/* 許願池：手機優先，系統字型，所有字級 >= 16px */
:root {
  --ink: #3b2a5c;
  --ink-soft: #5a4780;
  --purple: #7c4dcc;
  --purple-deep: #5b34a8;
  --pink: #ff8fb8;
  --cream: #fff8ee;
  --gold: #e8a800;
  --card-bg: rgba(255, 255, 255, 0.82);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: -apple-system, "PingFang TC", "Noto Sans TC", sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink);
  background-color: #2d1f6b;
  position: relative;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

/* 背景：Lee Know 照片（手機輪播淡入淡出、桌面拼貼）＋遮罩 */
.lk-bg {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: -1;
  overflow: hidden;
  background-color: #1e1248;
}
.lk-slide {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background-size: cover;
  background-position: center 15%;
  background-repeat: no-repeat;
  opacity: 0;
  transition: opacity 1.6s ease-in-out;
}
.lk-slide.is-on { opacity: 1; }
.lk-s1 { background-image: url("/img/leeknow-1.webp"); }
.lk-bg.is-ready .lk-s2 { background-image: url("/img/leeknow-2.webp"); }
.lk-bg.is-ready .lk-s3 { background-image: url("/img/leeknow-3.webp"); }
.lk-bg.is-ready .lk-s4 { background-image: url("/img/leeknow-4.webp"); }
.lk-bg::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background: linear-gradient(180deg, rgba(30, 18, 72, 0.5) 0%, rgba(40, 26, 96, 0.72) 40%, rgba(30, 18, 72, 0.88) 100%);
}
@media (max-width: 899px) {
  .hero .slot-hero { max-width: 230px; }
}
@media (min-width: 900px) {
  .lk-bg { display: flex; }
  .lk-slide { position: relative; flex: 1 1 0; opacity: 1; transition: none; }
  .lk-bg::after {
    background: linear-gradient(90deg, rgba(30, 18, 72, 0.2) 0%, rgba(30, 18, 72, 0.35) 22%, rgba(30, 18, 72, 0.82) 36%, rgba(30, 18, 72, 0.82) 64%, rgba(30, 18, 72, 0.35) 78%, rgba(30, 18, 72, 0.2) 100%);
  }
}


.page {
  max-width: 520px;
  margin: 0 auto;
  padding: 20px 16px 40px;
}

/* 主視覺 */
.hero { display: flex; justify-content: center; }
.slot-hero {
  display: block;
  width: 100%;
  max-width: 400px;
  height: auto;
  border-radius: 28px;
  border: 3px solid rgba(255, 255, 255, 0.75);
  box-shadow: 0 0 28px rgba(255, 214, 255, 0.55), 0 10px 30px rgba(20, 10, 60, 0.4);
  animation: float 5s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.title-block { text-align: center; margin: 22px 0 16px; }
.title-block h1 {
  margin: 0;
  font-size: 40px;
  line-height: 1.2;
  letter-spacing: 0.15em;
  color: #fff;
  text-shadow: 0 0 14px rgba(255, 190, 240, 0.9), 0 2px 6px rgba(30, 10, 80, 0.6);
}
.subtitle {
  margin: 8px 0 0;
  font-size: 17px;
  color: #fff;
  text-shadow: 0 1px 6px rgba(30, 10, 80, 0.7);
}

/* 卡片 */
.card {
  background: var(--card-bg);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border: 2px solid rgba(255, 255, 255, 0.8);
  border-radius: 24px;
  padding: 18px;
  box-shadow: 0 8px 28px rgba(30, 10, 80, 0.3);
}

.field-label { display: block; margin-bottom: 8px; font-size: 16px; font-weight: 700; color: var(--purple-deep); }

textarea,
input[type="password"] {
  display: block;
  width: 100%;
  font: inherit;
  font-size: 16px;
  color: var(--ink);
  background: #fff;
  border: 2px solid #d9c6f5;
  border-radius: 16px;
  padding: 12px 14px;
  min-height: 44px;
}
textarea { resize: vertical; min-height: 120px; }
textarea:focus,
input[type="password"]:focus { outline: 3px solid rgba(255, 143, 184, 0.6); border-color: var(--pink); }

.form-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px; }
.counter { font-size: 16px; color: var(--ink-soft); }
.counter.is-over { color: #c0265a; font-weight: 700; }

.btn {
  min-height: 44px;
  min-width: 44px;
  padding: 10px 22px;
  font: inherit;
  font-size: 16px;
  font-weight: 700;
  color: var(--purple-deep);
  background: #fff;
  border: 2px solid #d9c6f5;
  border-radius: 999px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(0.96); }
.btn:disabled { opacity: 0.6; cursor: default; }
.btn-primary {
  color: #fff;
  border-color: transparent;
  background: linear-gradient(135deg, #a06be8, #ff8fb8);
  box-shadow: 0 4px 14px rgba(255, 143, 184, 0.5);
}
.btn-primary:disabled { opacity: 0.6; }

button { min-height: 44px; min-width: 44px; font-size: 16px; }

.form-msg { margin: 10px 0 0; min-height: 1.6em; font-size: 16px; color: #b3225a; font-weight: 600; }

/* 願望牆 */
.wall { margin-top: 28px; }
.wall h2 {
  margin: 0 0 12px;
  font-size: 24px;
  color: #fff;
  text-align: center;
  text-shadow: 0 0 12px rgba(255, 190, 240, 0.8), 0 2px 6px rgba(30, 10, 80, 0.6);
}
.wish-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.wish-card {
  background: var(--card-bg);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  border: 2px solid rgba(255, 255, 255, 0.8);
  border-radius: 20px;
  padding: 14px 16px;
  box-shadow: 0 6px 20px rgba(30, 10, 80, 0.25);
}
.wish-card.is-new { animation: pop-in 0.6s ease-out; }
@keyframes pop-in {
  0% { transform: scale(0.8); opacity: 0; }
  70% { transform: scale(1.04); opacity: 1; }
  100% { transform: scale(1); }
}
.wish-text { margin: 0 0 10px; font-size: 16px; white-space: pre-wrap; overflow-wrap: anywhere; }
.wish-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.wish-date { font-size: 16px; color: var(--ink-soft); }

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 2px 14px;
  border-radius: 999px;
  font-size: 16px;
  font-weight: 700;
}
.tag-received { background: #e6dcfa; color: #4b2d94; }
.tag-doing { background: #ffd3e6; color: #a0204f; animation: pulse 1.6s ease-in-out infinite; }
.tag-done { background: #fff1bf; color: #6b4a00; }
.tag-done::before { content: "★ "; color: var(--gold); white-space: pre; }
@keyframes pulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 rgba(255, 143, 184, 0); }
  50% { transform: scale(1.06); box-shadow: 0 0 12px rgba(255, 143, 184, 0.8); }
}

.wall-empty {
  margin: 0;
  padding: 18px;
  text-align: center;
  font-size: 16px;
  background: var(--card-bg);
  border-radius: 20px;
}
.wall-empty[hidden] { display: none; }

.foot { margin-top: 32px; text-align: center; font-size: 16px; color: #fff; text-shadow: 0 1px 4px rgba(30, 10, 80, 0.8); }

/* 許願動畫 */
.wish-anim {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(20, 10, 60, 0.82);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  overflow: hidden;
  opacity: 0;
  transition: opacity 0.35s ease;
  cursor: pointer;
}
.wish-anim[hidden] { display: none; }
.wish-anim.is-playing { opacity: 1; }

.wa-stage { position: relative; width: 280px; height: 380px; }
.wa-rabbit {
  position: absolute;
  left: 50%;
  top: 70px;
  width: 128px;
  height: auto;
  margin-left: -64px;
  animation: rabbit-bounce 0.9s cubic-bezier(0.3, 1.6, 0.5, 1) both;
}
@keyframes rabbit-bounce {
  0% { transform: translateY(120px) scale(0.3); opacity: 0; }
  60% { transform: translateY(-14px) scale(1.08); opacity: 1; }
  100% { transform: translateY(0) scale(1); opacity: 1; }
}
.wa-note {
  position: absolute;
  left: 50%;
  top: 190px;
  width: 140px;
  height: 90px;
  margin-left: -70px;
  border-radius: 10px;
  background: #fff8ee;
  box-shadow: 0 0 18px rgba(255, 240, 180, 0.9);
  opacity: 0;
  animation: note-fly 1.5s ease-in 0.7s both;
}
@keyframes note-fly {
  0% { transform: translateY(40px) scale(1) rotate(0); opacity: 0; }
  15% { transform: translateY(0) scale(1) rotate(-4deg); opacity: 1; }
  55% { transform: translateY(-20px) scale(0.4) rotate(10deg); opacity: 1; border-radius: 50%; }
  100% { transform: translateY(-380px) scale(0.08) rotate(30deg); opacity: 0; border-radius: 50%; }
}
.wa-text {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  margin: 0;
  text-align: center;
  font-size: 20px;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 0 12px rgba(255, 190, 240, 0.9);
  animation: text-in 0.6s ease-out 1.1s both;
}
@keyframes text-in {
  0% { transform: translateY(14px); opacity: 0; }
  100% { transform: translateY(0); opacity: 1; }
}
.wa-p {
  position: absolute;
  left: 50%;
  top: 150px;
  font-size: 20px;
  line-height: 1;
  opacity: 0;
  animation: burst 1.6s ease-out var(--d, 0s) both;
}
@keyframes burst {
  0% { transform: translate(0, 0) scale(0.2); opacity: 0; }
  20% { opacity: 1; }
  70% { opacity: 1; }
  100% { transform: translate(var(--x, 0px), var(--y, 0px)) scale(var(--s, 1)) rotate(var(--r, 0deg)); opacity: 0; }
}
.wish-anim.is-reduced .wa-rabbit,
.wish-anim.is-reduced .wa-note,
.wish-anim.is-reduced .wa-p { animation: none; }
.wish-anim.is-reduced .wa-note,
.wish-anim.is-reduced .wa-p { display: none; }
.wish-anim.is-reduced .wa-text { animation: none; }

@media (prefers-reduced-motion: reduce) {
  .slot-hero,
  .tag-doing,
  .wish-card.is-new { animation: none; }
  .wish-anim { transition: opacity 0.4s ease; }
  .wa-rabbit,
  .wa-note,
  .wa-p,
  .wa-text { animation: none; }
  .wa-note,
  .wa-p { display: none; }
}

/* 管理頁 */
.admin .wish-card .wish-meta { flex-wrap: wrap; }
.admin-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.admin-actions .btn { padding: 8px 14px; }
.admin-actions .btn.is-current { background: var(--purple); color: #fff; border-color: transparent; }

/* 麥克整合微調：動畫文字的對比 */
.wa-text { color: #fff; text-shadow: 0 0 12px rgba(255, 190, 240, 0.9), 0 2px 6px rgba(30, 10, 80, 0.8); }

/* 卡片內改刪：操作列與文字區分開，窄螢幕仍可完整點選 */
.wish-actions, .wish-edit-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}
.wish-actions { justify-content: flex-end; }
.wish-actions[hidden], .admin-actions[hidden], .wish-text[hidden], .wish-list[hidden] { display: none; }
.wish-edit:empty { display: none; }
.wish-edit { margin-top: 10px; min-width: 0; }
.wish-edit textarea { max-width: 100%; }
.wish-edit-actions > .btn { flex: 1 1 0; min-width: 44px; padding: 10px 12px; }
.wish-confirm { margin: 0 0 8px; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; padding: 10px; }
.icon-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.btn:focus-visible { outline: 3px solid var(--purple-deep); outline-offset: 2px; }
