:root {
  color-scheme: light;
  --bg: #fff3f5;
  --card: #ffffff;
  --ink: #4a3540;
  --muted: #9a7f8a;
  --pink: #ff7aa2;
  --pink-d: #e8517f;
  --pink-l: #ffd6e2;
  --pink-xl: #fff0f4;
  --gold: #ffc861;
  --gold-d: #b07a00;
  --ok: #2fae7f;
  --bad: #e45b6b;
  --shadow: 0 10px 30px rgba(232, 81, 127, 0.14);
  --radius: 22px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { margin: 0; }

body {
  min-height: 100dvh;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 15% 10%, #ffe1ea 0, transparent 40%),
    radial-gradient(circle at 90% 80%, #ffe9d6 0, transparent 45%),
    var(--bg);
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}

button { font: inherit; color: inherit; cursor: pointer; }

h1, h2, h3 { margin: 0; line-height: 1.3; }
h1 { font-size: 30px; text-align: center; }
h2 { font-size: 24px; }
h3 { font-size: 20px; }
p { margin: 0; line-height: 1.7; }

.center { text-align: center; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.tiny { font-size: 12px; }
.pre { white-space: pre-line; }

/* ── 版面 ─────────────────────────────── */
#app {
  position: relative;
  z-index: 1;
  max-width: 460px;
  margin: 0 auto;
  padding: 64px 16px 48px;
}
#app.enter > * { animation: fadeUp 0.45s ease both; }

.screen { display: flex; flex-direction: column; gap: 16px; }
.screen.centered { text-align: center; align-items: stretch; }

.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.level-head { text-align: center; display: flex; flex-direction: column; gap: 6px; align-items: center; }

.badge {
  display: inline-block;
  align-self: center;
  background: var(--pink-l);
  color: var(--pink-d);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 13px;
  font-weight: 700;
}

.big-emoji { font-size: 72px; text-align: center; line-height: 1.1; }

.lead { text-align: center; color: var(--muted); white-space: pre-line; }

/* ── 頂部進度 ─────────────────────────── */
#topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 10;
  max-width: 460px;
  margin: 0 auto;
  padding: 16px;
  padding-top: max(16px, env(safe-area-inset-top));
  display: flex;
  justify-content: space-between;
  align-items: center;
  pointer-events: none;
}
#topbar > * { pointer-events: auto; }
#progress { display: flex; gap: 6px; }
.dot { width: 20px; height: 6px; border-radius: 3px; background: var(--pink-l); transition: all 0.3s; }
.dot.done { background: var(--pink); }
.dot.cur { background: var(--pink-d); width: 34px; }

#music-btn {
  width: 38px; height: 38px;
  border-radius: 50%;
  border: 0;
  background: #fff;
  box-shadow: var(--shadow);
  font-size: 18px;
  color: var(--muted);
  margin-left: auto;
}
#music-btn.on { color: var(--pink-d); animation: pulse 1.6s ease-in-out infinite; }

/* ── 按鈕與輸入 ───────────────────────── */
.btn {
  width: 100%;
  border: 0;
  border-radius: 999px;
  padding: 14px 22px;
  font-size: 17px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, var(--pink), var(--pink-d));
  box-shadow: 0 8px 20px rgba(232, 81, 127, 0.3);
  transition: transform 0.12s, opacity 0.2s;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.4; box-shadow: none; }
.btn.ghost { background: #fff; color: var(--pink-d); border: 2px solid var(--pink-l); box-shadow: none; }

.link {
  background: none;
  border: 0;
  color: var(--muted);
  text-decoration: underline;
  font-size: 14px;
  padding: 8px;
  align-self: center;
}

.input {
  width: 100%;
  padding: 14px;
  font-size: 22px;
  text-align: center;
  letter-spacing: 0.2em;
  border: 2px solid var(--pink-l);
  border-radius: 14px;
  outline: none;
  color: var(--ink);
  background: var(--pink-xl);
}
.input:focus { border-color: var(--pink); background: #fff; }

.q { font-size: 18px; font-weight: 700; line-height: 1.6; white-space: pre-line; }
.q-count { font-size: 13px; color: var(--muted); font-weight: 700; }

.msg { min-height: 1.7em; text-align: center; color: var(--bad); font-weight: 600; }
.msg.ok { color: var(--ok); }

/* ── 翻牌 ─────────────────────────────── */
.mem-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.mem-card {
  aspect-ratio: 3 / 4;
  border: 0;
  padding: 0;
  background: none;
  perspective: 600px;
}
.mem-inner {
  position: relative;
  width: 100%; height: 100%;
  transition: transform 0.45s;
  transform-style: preserve-3d;
}
.mem-card.flipped .mem-inner { transform: rotateY(180deg); }
.mem-back, .mem-front {
  position: absolute;
  inset: 0;
  border-radius: 12px;
  display: grid;
  place-items: center;
  overflow: hidden;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}
.mem-back {
  background:
    radial-gradient(circle at 30% 30%, rgba(255,255,255,0.35) 0 12%, transparent 13%),
    linear-gradient(135deg, var(--pink), var(--pink-d));
  font-size: 22px;
}
.mem-front {
  background: #fff;
  border: 2px solid var(--pink-l);
  transform: rotateY(180deg);
}
.mem-img { width: 100%; height: 100%; object-fit: cover; }
.mem-emoji { font-size: 34px; }
.mem-card.matched .mem-front { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(255, 200, 97, 0.45); }
.mem-card.matched { animation: pop 0.4s ease; }

/* ── 拼圖 ─────────────────────────────── */
.pz-board {
  position: relative;
  display: grid;
  aspect-ratio: 1;
  border-radius: 14px;
  overflow: hidden;
  background: var(--pink-xl);
  box-shadow: inset 0 0 0 2px var(--pink-l);
}
.pz-ghost {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  opacity: 0.28;
  filter: grayscale(0.3);
  pointer-events: none;
  transition: opacity 0.6s;
}
.pz-slot {
  position: relative;
  overflow: hidden;
  outline: 1.5px dashed rgba(232, 81, 127, 0.4);
  outline-offset: -1px;
  transition: background 0.2s;
}
.pz-board.picking .pz-slot:not(.filled) { background: rgba(255, 122, 162, 0.12); cursor: pointer; }
.pz-slot.over { background: rgba(255, 122, 162, 0.3) !important; outline: 2.5px solid var(--pink-d); }
.pz-slot.filled { outline: none; }
.pz-slot.snap { animation: snap 0.35s ease; }
.pz-slot.nope { animation: nope 0.5s ease; }
.pz-piece { position: absolute; max-width: none; height: auto; pointer-events: none; user-select: none; -webkit-user-drag: none; }
.pz-board.solved .pz-ghost { opacity: 0; }

.pz-tray { display: grid; gap: 8px; margin-top: 4px; }
.pz-board, .pz-tray { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.pz-tray-piece {
  position: relative;
  aspect-ratio: 1;
  padding: 0;
  overflow: hidden;
  border: 2px solid #fff;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 3px 10px rgba(232, 81, 127, 0.22);
  touch-action: none;
  transition: transform 0.15s, opacity 0.15s;
}
.pz-tray-piece.sel { transform: translateY(-4px) scale(1.06); border-color: var(--pink-d); box-shadow: 0 6px 16px rgba(232, 81, 127, 0.4); }
.pz-tray-piece.lifted { opacity: 0.25; }
.pz-drag {
  position: fixed;
  z-index: 80;
  overflow: hidden;
  border: 2px solid #fff;
  border-radius: 8px;
  box-shadow: 0 12px 28px rgba(74, 53, 64, 0.35);
  transform: translate(-50%, -50%) scale(1.05);
  pointer-events: none;
}

/* ── 線索與彈窗 ───────────────────────── */
.clues { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.clue-chip {
  display: inline-block;
  background: #fff;
  border: 2px solid var(--gold);
  color: var(--gold-d);
  font-weight: 800;
  padding: 6px 16px;
  border-radius: 999px;
  font-size: 18px;
}

.overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(74, 53, 64, 0.35);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  display: grid;
  place-items: center;
  padding: 20px;
  animation: fadeIn 0.2s ease;
}
.modal {
  width: min(360px, 100%);
  background: #fff;
  border-radius: 24px;
  padding: 26px 22px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
  max-height: 90dvh;
  overflow-y: auto;
}
.row { display: flex; gap: 10px; width: 100%; }

/* ── 第一份禮物 ───────────────────────── */
.giftbox {
  font-size: 110px;
  line-height: 1;
  background: none;
  border: 0;
  padding: 10px;
  align-self: center;
}
.giftbox.wiggle { animation: wiggle 0.45s ease; }
.giftbox.burst { animation: burst 0.45s ease forwards; }
.reveal { display: flex; flex-direction: column; gap: 12px; text-align: center; }
.gift-img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 16px; }
.hint-box {
  background: #fff8e6;
  border: 2px dashed var(--gold);
  border-radius: 14px;
  padding: 14px;
}
.hint { font-size: 22px; font-weight: 800; color: var(--gold-d); margin-top: 4px; }

/* ── 第二份禮物 ───────────────────────── */
.opt-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.opt-card {
  position: relative;
  text-align: left;
  background: #fff;
  border: 3px solid transparent;
  border-radius: 18px;
  padding: 10px;
  box-shadow: var(--shadow);
  transition: transform 0.2s, border-color 0.2s;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.opt-card.chosen { border-color: var(--pink); transform: translateY(-4px); }
.opt-card.chosen::after {
  content: "✓";
  position: absolute;
  top: -10px; right: -10px;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--pink-d);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 15px;
}
.opt-img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 12px; }
.opt-img.product { object-fit: contain; background: #f6f4f5; }
.opt-name { font-weight: 800; margin-top: 4px; }
.opt-desc { font-size: 13px; color: var(--muted); line-height: 1.5; }
.sticky-cta { position: sticky; bottom: 16px; bottom: max(16px, env(safe-area-inset-bottom)); }
.result-card { align-items: center; text-align: center; }
.result-card .opt-img { width: 60%; }
.stamp { font-size: 12px; color: var(--muted); }

/* ── 拉霸機 ───────────────────────────── */
.slot-wrap { padding-right: 30px; }
.slot-machine {
  position: relative;
  background: linear-gradient(180deg, #ff9ab8 0%, #ff6f98 45%, #e8517f 100%);
  border-radius: 28px;
  padding: 14px 14px 16px;
  box-shadow:
    0 16px 32px rgba(232, 81, 127, 0.35),
    inset 0 4px 0 rgba(255, 255, 255, 0.35),
    inset 0 -6px 0 rgba(0, 0, 0, 0.12);
}
.marquee {
  background: #3b2632;
  border-radius: 16px;
  padding: 8px 12px;
  box-shadow: inset 0 0 0 3px #ffd700;
}
.marquee-text {
  text-align: center;
  font-size: 28px;
  font-weight: 900;
  letter-spacing: 0.08em;
  color: #ffd700;
  text-shadow: 0 0 8px rgba(255, 215, 0, 0.8), 0 2px 0 #b07a00;
  margin: 4px 0;
}
.bulbs { display: flex; justify-content: space-between; }
.bulb {
  width: 9px; height: 9px;
  border-radius: 50%;
  background: #ffe48a;
  box-shadow: 0 0 6px #ffd34d;
  animation: bulb 1.2s steps(1) infinite;
}
.bulb:nth-child(even) { animation-delay: 0.6s; }
.slot-machine.win .bulb { animation: bulbWin 0.25s steps(1) infinite; }
.slot-machine.win .bulb:nth-child(even) { animation-delay: 0.125s; }

.reels {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 12px;
  padding: 10px;
  background: #3b2632;
  border-radius: 18px;
  box-shadow: inset 0 4px 10px rgba(0, 0, 0, 0.4);
}
.reel {
  position: relative;
  height: calc(var(--sym-h) * 3);
  overflow: hidden;
  border-radius: 10px;
  background: #fff;
  transition: box-shadow 0.2s;
}
.reel::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(rgba(60, 30, 45, 0.45), transparent 28%, transparent 72%, rgba(60, 30, 45, 0.45));
}
.strip { will-change: transform; }
.sym-img { width: 78%; height: 78%; object-fit: contain; pointer-events: none; }
.sym {
  height: var(--sym-h);
  display: grid;
  place-items: center;
  font-size: 40px;
  line-height: 1;
  user-select: none;
}
.sym.seven {
  font-family: "Arial Black", "Helvetica Neue", Impact, sans-serif;
  font-size: 52px;
  font-weight: 900;
  color: #ff1f4b;
  -webkit-text-stroke: 2px #ffd700;
  text-shadow: 0 3px 0 #9b0024;
}
.reel.spinning .strip { filter: blur(2px); }
.reel.suspense { box-shadow: 0 0 0 3px #ffd700, 0 0 22px 4px #ffd700; animation: suspense 0.35s ease-in-out infinite alternate; }
.slot-machine.win .reel { box-shadow: 0 0 0 3px #ffd700, 0 0 18px #ffd700; }
.slot-machine.win .sym.seven { animation: sevenPulse 0.5s ease-in-out infinite alternate; }

.payline {
  position: absolute;
  left: 6px; right: 6px;
  top: 50%;
  height: 3px;
  transform: translateY(-50%);
  background: rgba(255, 60, 100, 0.75);
  box-shadow: 0 0 6px rgba(255, 60, 100, 0.8);
  pointer-events: none;
}
.slot-machine.win .payline { background: #ffd700; box-shadow: 0 0 12px #ffd700; }
.pay-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 12px;
  color: #ffd700;
}
.pay-arrow.left { left: -1px; }
.pay-arrow.right { right: -1px; }

.slot-info {
  display: flex;
  justify-content: space-between;
  margin-top: 10px;
  padding: 0 4px;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
}
.slot-info b { font-size: 16px; }

.lever-base {
  position: absolute;
  right: -14px;
  top: 52%;
  width: 16px;
  height: 46px;
  border-radius: 0 10px 10px 0;
  background: linear-gradient(90deg, #c94b73, #a63a5d);
}
.lever {
  position: absolute;
  right: -24px;
  top: calc(52% - 92px);
  width: 12px;
  height: 110px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: linear-gradient(90deg, #d9d9d9, #f5f5f5 45%, #a9a9a9);
  transform-origin: 50% 100%;
}
.lever-ball {
  position: absolute;
  top: -26px;
  left: 50%;
  width: 34px; height: 34px;
  transform: translateX(-50%);
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ffc2d4, #ff1f4b 55%, #a8002a);
  box-shadow: 0 4px 10px rgba(168, 0, 42, 0.4);
}
.lever.pulled { animation: leverPull 0.55s ease; }
.slot-machine.near { animation: shake 0.4s ease; }
.slot-machine.win { animation: winShake 0.6s ease; }
.pull-btn { font-size: 20px; padding: 16px; background: linear-gradient(135deg, #ff4d6d, #e8173f); box-shadow: 0 8px 20px rgba(232, 23, 63, 0.35); }

.flash { position: fixed; inset: 0; z-index: 90; background: #fff; pointer-events: none; animation: flash 0.75s ease-out forwards; }

.modal.jackpot { border: 4px solid #ffd700; background: radial-gradient(circle at 50% 0%, #fff6cc, #fff 60%); box-shadow: 0 0 40px rgba(255, 215, 0, 0.6); }
.jackpot-title {
  font-size: 44px;
  font-weight: 900;
  letter-spacing: 0.04em;
  background: linear-gradient(90deg, #ff1f4b, #ffb300, #ff1f4b, #ffb300);
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: shine 1.5s linear infinite, zoomIn 0.5s cubic-bezier(0.2, 1.6, 0.4, 1) both;
}
.jackpot-777 { display: flex; gap: 10px; }
.jackpot-777 span {
  font-family: "Arial Black", "Helvetica Neue", Impact, sans-serif;
  font-size: 46px;
  font-weight: 900;
  color: #ff1f4b;
  -webkit-text-stroke: 2px #ffd700;
  text-shadow: 0 3px 0 #9b0024;
  animation: sevenPulse 0.5s ease-in-out infinite alternate;
}
.jackpot-777 span:nth-child(2) { animation-delay: 0.15s; }
.jackpot-777 span:nth-child(3) { animation-delay: 0.3s; }

@keyframes bulb { 0% { opacity: 1; } 50% { opacity: 0.25; } }
@keyframes bulbWin { 0% { background: #ffe48a; box-shadow: 0 0 10px #ffd34d; } 50% { background: #ff7aa2; box-shadow: 0 0 10px #ff7aa2; } }
@keyframes suspense { from { transform: scale(1); } to { transform: scale(1.04); } }
@keyframes sevenPulse { from { transform: scale(1); } to { transform: scale(1.15); } }
@keyframes leverPull { 0% { transform: scaleY(1); } 35% { transform: scaleY(-0.55); } 60% { transform: scaleY(-0.55); } 100% { transform: scaleY(1); } }
@keyframes winShake { 0%, 100% { transform: none; } 20% { transform: rotate(-2deg) scale(1.02); } 40% { transform: rotate(2deg) scale(1.03); } 60% { transform: rotate(-1deg) scale(1.02); } 80% { transform: rotate(1deg); } }
@keyframes flash { from { opacity: 0.9; } to { opacity: 0; } }
@keyframes zoomIn { from { transform: scale(0.3); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* ── 拉霸：可愛版配色 ─────────────────── */
.slot-machine {
  background: linear-gradient(180deg, #ffe3ec 0%, #ffc4d6 55%, #ffadc6 100%);
  border: 4px solid #fff;
  box-shadow: 0 16px 32px rgba(232, 81, 127, 0.25), inset 0 -6px 0 rgba(232, 81, 127, 0.12);
}
.marquee { background: #fff; box-shadow: inset 0 0 0 3px #ffb3c6; border-radius: 20px; }
.marquee-text {
  color: #ff6f98;
  text-shadow: 0 2px 0 #ffd6e2;
  font-size: 24px;
  letter-spacing: 0.04em;
}
.bulb { background: #ffd6e2; box-shadow: 0 0 6px #ffb3c6; }
.reels { background: #ffd6e2; box-shadow: inset 0 3px 8px rgba(232, 81, 127, 0.25); }
.reel { background: #fffafc; }
.reel::after { background: linear-gradient(rgba(255, 179, 198, 0.5), transparent 28%, transparent 72%, rgba(255, 179, 198, 0.5)); }
.payline { background: rgba(255, 111, 152, 0.55); box-shadow: 0 0 6px rgba(255, 111, 152, 0.6); height: 2px; }
.pay-arrow { color: #ff6f98; }
.slot-info { color: #c43d6a; }
.lever { background: linear-gradient(90deg, #fff, #ffe3ec 50%, #ffc4d6); }
.lever-ball { background: radial-gradient(circle at 35% 30%, #fff, #ff9ab8 55%, #ff6f98); }
.lever-base { background: linear-gradient(90deg, #ffadc6, #ff8fb1); }
.pull-btn { background: linear-gradient(135deg, #ff9ab8, #ff6f98); box-shadow: 0 8px 20px rgba(255, 111, 152, 0.35); }
.sym-img { width: 82%; height: 82%; filter: drop-shadow(0 2px 3px rgba(232, 81, 127, 0.2)); }
.slot-machine.win .sym-img { animation: sevenPulse 0.45s ease-in-out infinite alternate; }
.jackpot-777 .sym { height: 72px; width: 72px; }
.jackpot-777 .sym:nth-child(2) .sym-img { animation-delay: 0.15s; }
.jackpot-777 .sym:nth-child(3) .sym-img { animation-delay: 0.3s; }
.jackpot-777 .sym-img { width: 100%; height: 100%; animation: sevenPulse 0.45s ease-in-out infinite alternate; }
.modal.jackpot { border-color: #ffb3c6; background: radial-gradient(circle at 50% 0%, #ffe3ec, #fff 65%); box-shadow: 0 0 40px rgba(255, 111, 152, 0.45); }
.jackpot-title { background: linear-gradient(90deg, #ff6f98, #ffb36b, #b48cf5, #ff6f98); background-size: 200% auto; -webkit-background-clip: text; background-clip: text; }

/* ── 信封與信紙 ───────────────────────── */
.env-wrap { display: grid; place-items: center; padding: 40px 0 10px; }
.envelope {
  position: relative;
  width: 260px;
  height: 170px;
  border: 0;
  padding: 0;
  background: none;
  perspective: 800px;
}
.envelope:not(.open) { animation: float 3s ease-in-out infinite; }
.env-back { position: absolute; inset: 0; background: #f48fb1; border-radius: 10px; }
.env-letter {
  position: absolute;
  left: 14px; right: 14px; top: 12px; bottom: 10px;
  background:
    repeating-linear-gradient(transparent 0 18px, #f6dbe3 18px 19px) 16px 30px / calc(100% - 32px) 60% no-repeat,
    #fff;
  border-radius: 6px;
  z-index: 1;
  transition: transform 0.6s 0.4s ease;
}
.env-front {
  position: absolute;
  inset: 0;
  background: #ffb6cb;
  clip-path: polygon(0 0, 50% 52%, 100% 0, 100% 100%, 0 100%);
  border-radius: 10px;
  z-index: 2;
}
.env-flap {
  position: absolute;
  left: 0; right: 0; top: 0;
  height: 60%;
  background: #ff9ab8;
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  transform-origin: top;
  transition: transform 0.5s ease, z-index 0s 0.25s;
  z-index: 3;
}
.env-seal {
  position: absolute;
  left: 50%; top: 58%;
  transform: translate(-50%, -50%);
  font-size: 34px;
  z-index: 4;
  transition: opacity 0.25s;
}
.envelope.open .env-flap { transform: rotateX(180deg); z-index: 0; }
.envelope.open .env-seal { opacity: 0; }
.envelope.open .env-letter { transform: translateY(-62%); }

.paper {
  background: #fffdf8;
  border-radius: 16px;
  padding: 28px 22px;
  box-shadow: var(--shadow);
  font-size: 17px;
  line-height: 2;
  display: flex;
  flex-direction: column;
  gap: 12px;
  border-top: 6px solid var(--pink-l);
}
.paper.rise { animation: rise 0.6s ease both; }
.paper p { line-height: 2; }
.greet { font-size: 20px; }
.sign { text-align: right; font-weight: 700; margin-top: 12px; animation: fadeUp 0.6s ease both; }
.skip { margin-top: 4px; }
.caret {
  display: inline-block;
  width: 2px;
  height: 1em;
  background: var(--pink-d);
  margin-left: 2px;
  vertical-align: -0.12em;
  animation: blink 0.9s steps(1) infinite;
}

.finale { display: flex; flex-direction: column; gap: 18px; margin-top: 8px; }
.rainbow {
  font-size: 30px;
  background: linear-gradient(90deg, #ff7aa2, #ffb36b, #b48cf5, #ff7aa2);
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: shine 4s linear infinite, fadeUp 0.6s ease both;
}
.wall { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; padding: 4px; }
.polaroid {
  margin: 0;
  background: #fff;
  padding: 8px 8px 12px;
  border-radius: 4px;
  box-shadow: 0 8px 20px rgba(74, 53, 64, 0.15);
  transform: rotate(var(--r, 0deg));
  animation: dropIn 0.6s ease both;
}
.polaroid img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; display: block; border-radius: 2px; }
.polaroid figcaption { text-align: center; font-size: 13px; margin-top: 8px; color: var(--muted); }

/* ── 小角色與泡泡 ─────────────────────── */
.avatar {
  width: 52px; height: 52px;
  flex: none;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--pink-l);
  box-shadow: var(--shadow);
  display: grid;
  place-items: center;
  font-size: 30px;
  line-height: 1;
  overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
/* 去背的頭像：拿掉圓框，改成白邊貼紙 */
.avatar.is-img { background: none; border: 0; box-shadow: none; overflow: visible; }
.avatar.is-img img {
  object-fit: contain;
  filter:
    drop-shadow(2px 0 0 #fff) drop-shadow(-2px 0 0 #fff)
    drop-shadow(0 2px 0 #fff) drop-shadow(0 -2px 0 #fff)
    drop-shadow(0 4px 6px rgba(232, 81, 127, 0.3));
}
.dlg-avatar.is-img { width: 84px; height: 84px; }
.avatar.big-av { width: 76px; height: 76px; font-size: 44px; }
.bob { animation: bob 2.4s ease-in-out infinite; }

.guide-row { display: flex; gap: 10px; align-items: flex-end; width: 100%; text-align: left; margin-top: 4px; }
.bubble-wrap { flex: 1; min-width: 0; }
.guide-name { font-size: 12px; font-weight: 800; color: var(--pink-d); margin: 0 0 4px 8px; }
.bubble {
  background: #fff;
  border-radius: 18px 18px 18px 4px;
  padding: 10px 14px;
  box-shadow: var(--shadow);
  font-size: 15px;
  line-height: 1.6;
  white-space: pre-line;
}
.pop-sm { animation: popSm 0.3s ease; }

/* ── 全螢幕對話 ───────────────────────── */
.dlg-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(74, 53, 64, 0.3);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 16px;
  padding-bottom: max(24px, env(safe-area-inset-bottom));
  animation: fadeIn 0.25s ease;
  cursor: pointer;
}
.dlg-box {
  position: relative;
  width: min(440px, 100%);
  background: #fff;
  border: 3px solid var(--pink-l);
  border-radius: 24px;
  padding: 0 20px 18px;
  box-shadow: 0 -8px 30px rgba(232, 81, 127, 0.18);
}
.dlg-head { display: flex; align-items: flex-end; gap: 10px; margin-top: -34px; }
.dlg-avatar { width: 72px; height: 72px; font-size: 42px; border-color: var(--pink); }
.dlg-name {
  background: var(--pink-d);
  color: #fff;
  font-weight: 800;
  font-size: 13px;
  padding: 3px 12px;
  border-radius: 999px;
  margin-bottom: 6px;
}
.dlg-count { margin-left: auto; margin-bottom: 8px; font-size: 12px; color: var(--muted); }
.dlg-text { min-height: 3.6em; margin-top: 12px; font-size: 17px; line-height: 1.75; white-space: pre-line; }
.dlg-more { position: absolute; right: 18px; bottom: 10px; color: var(--pink); font-size: 14px; animation: nudge 0.9s ease-in-out infinite; }

/* ── 背景漂浮愛心 ─────────────────────── */
#bg-hearts { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 0; }
#bg-hearts span {
  position: absolute;
  bottom: -40px;
  color: var(--pink);
  opacity: 0.22;
  animation: floatUp linear infinite;
}

#confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 100; }

/* ── 動畫 ─────────────────────────────── */
.pop { animation: pop 0.45s ease both; }
.float { animation: float 3s ease-in-out infinite; }
.shake { animation: shake 0.4s ease; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes pop { 0% { transform: scale(0.6); opacity: 0; } 70% { transform: scale(1.06); opacity: 1; } 100% { transform: scale(1); } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 20% { transform: translateX(-8px); } 40% { transform: translateX(8px); } 60% { transform: translateX(-5px); } 80% { transform: translateX(5px); } }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@keyframes wiggle { 0%, 100% { transform: rotate(0) scale(1); } 25% { transform: rotate(-12deg) scale(1.08); } 50% { transform: rotate(10deg) scale(1.1); } 75% { transform: rotate(-6deg) scale(1.05); } }
@keyframes burst { to { transform: scale(1.7); opacity: 0; } }
@keyframes blink { 50% { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(40px); } to { opacity: 1; transform: none; } }
@keyframes dropIn { from { opacity: 0; transform: translateY(-20px) rotate(0deg) scale(0.9); } to { opacity: 1; transform: rotate(var(--r, 0deg)); } }
@keyframes floatUp { from { transform: translateY(0) rotate(0); } to { transform: translateY(-115vh) rotate(40deg); } }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.1); } }
@keyframes shine { to { background-position: 200% center; } }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
@keyframes popSm { 0% { transform: scale(0.94); } 60% { transform: scale(1.03); } 100% { transform: scale(1); } }
@keyframes nudge { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(3px); } }
@keyframes snap { 0% { transform: scale(1.15); } 100% { transform: scale(1); } }
@keyframes nope { 0%, 100% { background: transparent; } 30% { background: rgba(228, 91, 107, 0.35); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  #bg-hearts { display: none; }
}
