/* 自然發音魔法城堡：全站樣式（系統字體、無外部資源） */
:root {
  --ink: #2b1b4d;
  --ink-soft: #5a4a86;
  --paper: #fff8e8;
  --paper-edge: #e6d3a6;
  --gold: #f5b82e;
  --gold-light: #ffe08a;
  --gold-dark: #c98a0a;
  --violet: #6c4bd1;
  --ok: #2fbf71;
  --ok-dark: #1c8f52;
  --bad: #e5484d;
  --bad-dark: #b02a30;
  --night: #1a0f3a;
  --topbar-h: 56px;
  --radius: 18px;
  --font: "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", "Heiti TC", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  background: var(--night);
  color: #fff;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.45;
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  -webkit-text-size-adjust: 100%;
}

button { font: inherit; color: inherit; cursor: pointer; }
a { color: var(--gold-light); }
[hidden] { display: none !important; }
img { max-width: 100%; }

.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 2px;
  box-shadow: 0 0 0 6px var(--violet);
}

/* ── 整體版面：頂欄 / 內容區 / 固定頁尾 ───────────── */
#app {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  padding-left: env(safe-area-inset-left, 0px);
  padding-right: env(safe-area-inset-right, 0px);
}

#topbar {
  flex: none;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: var(--topbar-h);
  padding: calc(6px + env(safe-area-inset-top, 0px)) 10px 6px;
  background: linear-gradient(#2e1a63, #24134f);
  border-bottom: 3px solid var(--gold);
  z-index: 80;
}

.topbar-title {
  flex: 1;
  min-width: 0;
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: 0.04em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--gold-light);
}

.top-actions { display: flex; gap: 8px; margin-left: auto; }

.icon-btn {
  flex: none;
  width: 44px;
  height: 44px;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  padding: 0;
  transition: transform 0.12s, background 0.12s;
}
.icon-btn:hover { background: rgba(255, 255, 255, 0.26); }
.icon-btn:active { transform: scale(0.92); }

#stage {
  flex: 1;
  min-height: 0;
  position: relative;
  overflow: hidden;
  background: var(--bg, none) center / cover no-repeat, var(--night);
}
#stage::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(rgba(20, 10, 55, 0.35), rgba(20, 10, 55, 0.62));
  pointer-events: none;
}
#stage[data-screen="game"]::before { background: linear-gradient(rgba(20, 10, 55, 0.62), rgba(20, 10, 55, 0.8)); }

.site-footer {
  flex: none;
  padding: 6px 12px calc(6px + env(safe-area-inset-bottom, 0px));
  background: #190d38;
  border-top: 2px solid rgba(245, 184, 46, 0.6);
  color: #d9ceff;
  font-size: 0.78rem;
  line-height: 1.35;
  text-align: center;
  z-index: 80;
}

.screen {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px;
  -webkit-overflow-scrolling: touch;
}

/* ── 按鈕 ─────────────────────────────────────── */
.btn {
  min-height: 48px;
  min-width: 48px;
  padding: 10px 22px;
  border-radius: 999px;
  border: 3px solid var(--ink);
  border-bottom-width: 6px;
  background: #fff;
  color: var(--ink);
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: 0.04em;
  transition: transform 0.1s, filter 0.1s;
}
.btn:hover { filter: brightness(1.05); }
.btn:active { transform: translateY(3px); border-bottom-width: 3px; }
.btn.primary { background: linear-gradient(#ffd873, #f5a623); }
.btn.danger { background: linear-gradient(#ff8a8a, #e5484d); color: #fff; }
.btn.ghost { background: transparent; color: #fff; border-color: rgba(255, 255, 255, 0.7); }
.modal-card .btn.ghost { color: var(--ink); border-color: var(--ink); background: rgba(255, 255, 255, 0.6); }
.btn.big { font-size: 1.5rem; padding: 14px 44px; min-height: 64px; }
.btn.small { min-height: 44px; font-size: 0.95rem; padding: 8px 16px; }
.btn:disabled { opacity: 0.5; pointer-events: none; }

/* ── 主選單 ───────────────────────────────────── */
.menu { display: grid; place-items: center; }
.menu-inner {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  text-align: center; max-width: 560px; width: 100%;
}
.menu-owl { width: clamp(120px, 30vh, 220px); height: auto; filter: drop-shadow(0 10px 18px rgba(0, 0, 0, 0.5)); animation: float 3.2s ease-in-out infinite; }
.title {
  margin: 0;
  font-size: clamp(2rem, 8vw, 3.4rem);
  line-height: 1.15;
  color: #fff;
  text-shadow: 0 3px 0 var(--violet), 0 6px 14px rgba(0, 0, 0, 0.5);
}
.title span { display: block; color: var(--gold-light); }
.subtitle { margin: 0; font-weight: 700; color: #e7ddff; }
.menu-blurb { margin: 4px 0 8px; max-width: 30em; color: #fff; text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6); }
.menu-progress { margin: 0; color: var(--gold-light); font-weight: 700; min-height: 1.4em; text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6); }

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

/* ── 選關 ─────────────────────────────────────── */
.levels { padding-bottom: 24px; }
.levels-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.levels-head h2 { margin: 0; font-size: 1.4rem; text-shadow: 0 2px 6px rgba(0, 0, 0, 0.6); }
.levels-stars { margin: 0; font-weight: 800; color: var(--gold-light); }

.zone {
  margin-bottom: 18px;
  border-radius: 22px;
  overflow: hidden;
  border: 3px solid rgba(255, 255, 255, 0.25);
  background: rgba(20, 10, 55, 0.55);
}
.zone-head {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px;
  background: linear-gradient(90deg, rgba(20, 10, 55, 0.9), rgba(20, 10, 55, 0.35)), var(--zone-bg) center / cover;
}
.zone-icon { font-size: 2rem; }
.zone-name { margin: 0; font-size: 1.15rem; }
.zone-desc { margin: 0; font-size: 0.85rem; color: #e7ddff; }
.level-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; padding: 12px; }

.level-card {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto auto;
  column-gap: 10px;
  align-items: center;
  text-align: left;
  min-height: 88px;
  padding: 10px 12px;
  border-radius: 16px;
  border: 3px solid var(--paper-edge);
  border-bottom-width: 6px;
  background: var(--paper);
  color: var(--ink);
  transition: transform 0.1s;
}
.level-card:active { transform: translateY(3px); }
.level-card .num {
  grid-row: 1 / 4;
  width: 42px; height: 42px; border-radius: 50%;
  display: grid; place-items: center;
  font-weight: 900; font-size: 1.2rem;
  background: linear-gradient(#ffd873, #f5a623);
  border: 2px solid var(--ink);
}
.level-card .lname { font-weight: 800; font-size: 0.98rem; line-height: 1.25; padding-right: 22px; }
.level-card .lstars { color: var(--gold-dark); letter-spacing: 0.1em; font-size: 1.05rem; }
.level-card .lstars .off { color: #d9cfb8; }
.level-card .lbest { font-size: 0.78rem; color: var(--ink-soft); }
.level-card .ltag { position: absolute; top: 6px; right: 8px; font-size: 1.1rem; }
.level-card.locked { background: #c9c1dc; border-color: #9d92bd; color: #5f5680; }
.level-card.locked .num { background: #aaa1c8; }
.level-card.locked .lock { position: absolute; right: 8px; bottom: 6px; opacity: 0.8; }

/* ── 遊戲畫面 ─────────────────────────────────── */
.game { display: flex; flex-direction: column; gap: 8px; padding: 10px 12px; overflow: hidden; }
.hud {
  display: flex; align-items: center; gap: 8px 12px; flex-wrap: wrap;
  padding: 6px 10px;
  background: rgba(30, 16, 70, 0.78);
  border: 2px solid rgba(255, 255, 255, 0.22);
  border-radius: 16px;
}
.mascot { width: 52px; height: 52px; object-fit: contain; flex: none; }
.hud-title { display: flex; flex-direction: column; min-width: 0; flex: 1 1 120px; }
.hud-level { font-size: 0.8rem; color: var(--gold-light); font-weight: 800; }
.hud-name { font-weight: 800; font-size: 1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hud-stats { display: flex; align-items: center; gap: 6px 14px; flex-wrap: wrap; margin-left: auto; }
.stat { display: flex; flex-direction: column; align-items: center; min-width: 44px; line-height: 1.1; }
.stat-label { font-size: 0.68rem; color: #cfc3f5; }
.stat-value { font-weight: 900; font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.stat.combo-hot .stat-value { color: var(--gold); transform: scale(1.2); }
.stat.lives { flex-direction: row; gap: 2px; }
.stat.lives .heart { width: 22px; height: 22px; color: #ff5d7a; }
.stat.lives .heart.lost { color: #5d4f86; }

.timer { flex: none; height: 12px; border-radius: 8px; background: rgba(0, 0, 0, 0.4); overflow: hidden; border: 2px solid rgba(255, 255, 255, 0.25); }
#hud-timer-fill { height: 100%; width: 100%; background: linear-gradient(90deg, #5ee08a, #f5d24a); transition: width 0.1s linear; }
.timer.danger #hud-timer-fill { background: linear-gradient(90deg, #ff6a6a, #ff9f5a); animation: blink 0.5s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0.55; } }

.game-area { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; display: flex; flex-direction: column; }
.mc, .spell, .rain, .memory-wrap { flex: 1; display: flex; flex-direction: column; gap: 10px; min-height: 0; }

.prompt-card {
  position: relative;
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px;
  background: var(--paper);
  color: var(--ink);
  border: 3px solid var(--paper-edge);
  border-bottom-width: 6px;
  border-radius: var(--radius);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35);
}
.prompt-card.slim { padding: 8px 14px; justify-content: center; text-align: center; flex-direction: column; gap: 2px; }
.prompt-main { flex: 1; text-align: center; min-width: 0; }
.prompt-instruction { margin: 0 0 6px; font-weight: 700; color: var(--ink-soft); font-size: 1.02rem; }
.prompt-word { display: flex; justify-content: center; align-items: flex-end; gap: 0.35em; flex-wrap: wrap; }
.word-big { font-size: clamp(2.4rem, 11vw, 4.2rem); font-weight: 900; letter-spacing: 0.05em; line-height: 1.15; }
.word-big.decode { font-size: clamp(2.6rem, 12vw, 4.4rem); }
.magic-e { font-size: clamp(1.4rem, 6vw, 2.2rem); font-weight: 900; color: var(--violet); }
.eq { font-size: clamp(1.6rem, 7vw, 2.6rem); font-weight: 900; }
.gap {
  display: inline-block; min-width: 1.6em; text-align: center;
  font-size: clamp(2.4rem, 11vw, 4.2rem); font-weight: 900; line-height: 1.15;
  color: transparent; border-bottom: 5px dashed var(--gold-dark); letter-spacing: 0.05em;
}
.gap.filled { color: var(--ok-dark); border-bottom-style: solid; border-color: var(--ok-dark); }
.gap.filled.no { color: var(--bad-dark); border-color: var(--bad-dark); }
.prompt-emoji { font-size: clamp(2.2rem, 9vw, 3.4rem); line-height: 1.1; }
.reveal { min-height: 1.5em; font-weight: 800; color: var(--ink-soft); }
.reveal-word { color: var(--violet); font-size: 1.15em; }
.goal-text { margin: 0; font-weight: 900; font-size: 1.15rem; color: var(--violet); }

.speaker {
  flex: none;
  width: 60px; height: 60px; border-radius: 50%;
  display: grid; place-items: center;
  background: linear-gradient(#ffd873, #f5a623);
  color: var(--ink);
  border: 3px solid var(--ink); border-bottom-width: 6px;
  padding: 0;
}
.speaker:active { transform: translateY(3px); border-bottom-width: 3px; }

/* mc 選項 */
.options { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.mc > .prompt-card { flex: 1 1 auto; max-height: 52vh; }
.options.count-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.opt {
  position: relative;
  min-height: 72px;
  display: grid; place-items: center;
  padding: 10px 8px;
  border-radius: var(--radius);
  border: 3px solid #cdbcf5; border-bottom-width: 7px;
  background: #fff;
  color: var(--ink);
  transition: transform 0.1s, background 0.15s, border-color 0.15s;
}
.opt:hover:not(:disabled) { background: #f4eeff; }
.opt:active:not(:disabled) { transform: translateY(3px); border-bottom-width: 4px; }
.opt-text { font-size: clamp(1.5rem, 6vw, 2.2rem); font-weight: 900; letter-spacing: 0.04em; }
.opt-emoji { font-size: clamp(2.6rem, 11vw, 3.8rem); line-height: 1.1; }
.opt.emoji { min-height: 96px; }
.opt-key {
  position: absolute; left: 8px; top: 6px;
  min-width: 22px; height: 22px; border-radius: 6px;
  background: #ece3ff; color: var(--ink-soft);
  font-size: 0.75rem; font-weight: 800; display: grid; place-items: center;
}
.opt-mark { position: absolute; right: 10px; top: 6px; font-size: 1.3rem; font-weight: 900; }
.opt:disabled { cursor: default; }
.opt.correct { background: var(--ok); border-color: var(--ok-dark); color: #fff; }
.opt.correct .opt-mark::after { content: "✓"; }
.opt.wrong { background: var(--bad); border-color: var(--bad-dark); color: #fff; }
.opt.wrong .opt-mark::after { content: "✗"; }
.opt.answer:not(.correct) { border-color: var(--ok-dark); background: #e4ffef; animation: glow 0.7s ease-in-out 2; }
.opt.answer:not(.correct) .opt-mark::after { content: "✓"; color: var(--ok-dark); }
@keyframes glow { 50% { box-shadow: 0 0 0 6px rgba(47, 191, 113, 0.5); } }

/* 魔王 */
.boss-box { display: flex; align-items: center; gap: 12px; padding: 4px 10px; background: rgba(30, 16, 70, 0.7); border-radius: 14px; }
.boss-img { width: 64px; height: 64px; object-fit: contain; flex: none; }
.boss-hp { flex: 1; height: 16px; border-radius: 10px; background: rgba(0, 0, 0, 0.5); border: 2px solid #fff; overflow: hidden; }
.boss-hp-fill { height: 100%; background: linear-gradient(90deg, #ff5d7a, #ffb347); transition: width 0.3s; }
.boss-box.defeated .boss-img { filter: grayscale(1); opacity: 0.6; transform: rotate(-12deg); }

/* 拼字 */
.spell-line {
  min-height: 80px;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px;
  padding: 10px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.92);
  border: 4px dashed var(--gold-dark);
  color: var(--ink);
}
.spell-line.ok { border-style: solid; border-color: var(--ok-dark); background: #e4ffef; }
.spell-line.no { border-style: solid; border-color: var(--bad-dark); background: #ffe8ea; }
.spell-placeholder { color: var(--ink-soft); font-weight: 700; }
.spell-bank { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.tile {
  min-width: 56px; min-height: 56px; padding: 6px 14px;
  border-radius: 14px;
  border: 3px solid var(--ink); border-bottom-width: 6px;
  background: linear-gradient(#ffe9a8, #ffd25e);
  color: var(--ink);
  font-size: 1.7rem; font-weight: 900; letter-spacing: 0.03em;
  transition: transform 0.1s, opacity 0.15s;
}
.tile:active:not(:disabled) { transform: translateY(3px); border-bottom-width: 3px; }
.tile.placed { background: #fff; }
.tile.used { opacity: 0.22; }
.spell-actions { display: flex; justify-content: center; }

/* 記憶翻牌 */
.memory { flex: 1; display: grid; gap: 10px; grid-template-columns: repeat(4, minmax(0, 1fr)); align-content: center; max-width: 720px; width: 100%; margin: 0 auto; }
.mcard {
  position: relative;
  aspect-ratio: 3 / 4;
  max-height: 24vh;
  min-height: 84px;
  width: 100%;
  padding: 0;
  background: transparent;
  border: 0;
  perspective: 700px;
}
.mcard .face {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  border-radius: 14px;
  border: 3px solid var(--ink); border-bottom-width: 6px;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  transition: transform 0.35s;
}
.mcard .front { background: linear-gradient(#8a6bff, #5b3fc4); font-size: 2.2rem; transform: rotateY(0); }
.mcard .back { background: #fff; color: var(--ink); transform: rotateY(180deg); }
.mcard.open .front { transform: rotateY(-180deg); }
.mcard.open .back { transform: rotateY(0); }
.mcard .mw { font-size: clamp(1.1rem, 4.6vw, 1.7rem); font-weight: 900; }
.mcard .me { font-size: clamp(1.4rem, 6vw, 2.2rem); }
.mcard.matched .back { background: #d8ffe8; border-color: var(--ok-dark); }
.mcard.nomatch .back { background: #ffe3e5; border-color: var(--bad-dark); }
.mcard:disabled { cursor: default; }

/* 魔法雨 */
.rain-field {
  position: relative; flex: 1; min-height: 230px; overflow: hidden;
  border-radius: var(--radius);
  background: linear-gradient(rgba(60, 30, 140, 0.35), rgba(20, 10, 60, 0.55));
  border: 3px dashed rgba(255, 255, 255, 0.3);
}
.drop {
  position: absolute; top: 0;
  height: 64px; min-width: 92px; padding: 0 16px;
  border-radius: 32px;
  border: 3px solid var(--ink); border-bottom-width: 6px;
  background: radial-gradient(circle at 30% 25%, #fffbe0, #ffd25e 70%);
  color: var(--ink);
  font-size: 1.55rem; font-weight: 900; letter-spacing: 0.03em;
  transform: translate(-50%, 0);
  will-change: transform;
}
.drop.caught { background: var(--ok); color: #fff; opacity: 0; transition: opacity 0.4s; }
.drop.bad { background: var(--bad); color: #fff; opacity: 0; transition: opacity 0.4s; }
.drop.missed { opacity: 0; filter: grayscale(1); transition: opacity 0.4s; }
.drop.dodged { opacity: 0; transition: opacity 0.4s; }

/* ── 對話框 ───────────────────────────────────── */
.modal {
  position: absolute; inset: 0; z-index: 60;
  display: flex; align-items: center; justify-content: center;
  padding: 14px;
  background: rgba(15, 8, 40, 0.78);
  overflow-y: auto;
}
.modal[hidden] { display: none; }
.modal-card {
  width: 100%; max-width: 520px; max-height: 100%; overflow-y: auto;
  padding: 18px 20px;
  background: var(--paper); color: var(--ink);
  border: 4px solid var(--gold); border-radius: 24px;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.6);
  text-align: center;
  animation: pop 0.25s ease-out;
}
@keyframes pop { from { transform: scale(0.9); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.modal-card h2 { margin: 0 0 6px; font-size: 1.5rem; }
.modal-kicker { margin: 0; font-weight: 800; color: var(--violet); }
.modal-text { margin: 6px 0 10px; font-size: 1.02rem; }
.modal-note { margin: 8px 0 0; font-size: 0.88rem; color: var(--ink-soft); }
.modal-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.chip {
  min-height: 44px; padding: 6px 14px; border-radius: 999px;
  border: 2px solid var(--violet); background: #fff; color: var(--ink);
  font-weight: 800; font-size: 1.1rem;
}
.chip:active { transform: translateY(2px); }

.setting-row { display: flex; align-items: center; gap: 12px; padding: 8px 0; text-align: left; }
.setting-row label { flex: 0 0 6.5em; font-weight: 700; }
.setting-row input[type="range"] { flex: 1; min-width: 0; height: 32px; accent-color: var(--violet); }
.setting-row.check label { flex: 1; }
.setting-row input[type="checkbox"] { width: 26px; height: 26px; accent-color: var(--violet); }
.reset-zone { margin-top: 6px; }
.reset-confirm { margin-top: 8px; padding: 10px; border-radius: 14px; background: #ffe8ea; border: 2px solid var(--bad); }

.install-steps { text-align: left; margin: 6px 0; padding-left: 1.4em; font-size: 1.02rem; }
.install-steps li { margin-bottom: 8px; }
.install-steps svg { vertical-align: middle; color: var(--violet); }

.result .result-owl { width: 110px; height: 110px; object-fit: contain; }
.stars { display: flex; justify-content: center; gap: 6px; margin: 4px 0; }
.star { font-size: 3rem; line-height: 1; filter: grayscale(1) opacity(0.3); transition: filter 0.3s, transform 0.3s; }
.star.on { filter: none; transform: scale(1.1); }
.result-book { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 2px 0; font-weight: 800; color: var(--violet); }
.result-book img { width: 40px; height: 40px; object-fit: contain; }
.result-score { margin: 4px 0; font-size: 1.6rem; font-weight: 900; color: var(--violet); }

/* ── 浮層：特效、橫幅 ─────────────────────────── */
#fx-layer { position: absolute; inset: 0; pointer-events: none; z-index: 90; overflow: hidden; }
.particle { position: absolute; font-size: 1.5rem; pointer-events: none; user-select: none; }
.float-text {
  position: absolute; pointer-events: none; white-space: nowrap;
  font-weight: 900; font-size: 1.5rem;
  color: #fff; text-shadow: 0 2px 0 var(--ink), 0 0 8px var(--ink);
}
.float-text.good { color: #b7ffd3; }
.float-text.bad { color: #ffc2c6; }
.flash { position: absolute; inset: 0; pointer-events: none; }

.banner {
  position: absolute; top: 12px; left: 50%; transform: translateX(-50%);
  z-index: 95; max-width: calc(100% - 24px);
  padding: 10px 20px; border-radius: 999px;
  background: linear-gradient(#ffd873, #f5a623);
  color: var(--ink); font-weight: 900; text-align: center;
  border: 3px solid var(--ink);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.45);
  animation: pop 0.25s ease-out;
}

/* ── 減弱動畫 ─────────────────────────────────── */
html[data-reduce-motion="1"] *,
html[data-reduce-motion="1"] *::before,
html[data-reduce-motion="1"] *::after {
  animation-duration: 0.001ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.001ms !important;
  scroll-behavior: auto !important;
}
@media (prefers-reduced-motion: reduce) {
  .menu-owl { animation: none; }
  .modal-card, .banner { animation: none; }
  .mcard .face { transition: none; }
}

/* ── 響應式 ───────────────────────────────────── */
@media (max-width: 420px) {
  .screen { padding: 12px; }
  .game { padding: 8px; }
  .options.count-3 { gap: 8px; }
  .prompt-card { padding: 10px; gap: 8px; }
  .speaker { width: 52px; height: 52px; }
  .hud { padding: 6px 8px; }
  .stat-value { font-size: 1.05rem; }
  .btn.big { padding: 12px 32px; }
  .site-footer { font-size: 0.72rem; }
}

@media (orientation: landscape) and (max-height: 540px) {
  :root { --topbar-h: 46px; }
  #topbar { padding-top: calc(3px + env(safe-area-inset-top, 0px)); padding-bottom: 3px; }
  .icon-btn { width: 40px; height: 40px; }
  .site-footer { padding-top: 3px; padding-bottom: calc(3px + env(safe-area-inset-bottom, 0px)); font-size: 0.72rem; }
  .screen { padding: 8px 12px; }
  .menu-inner { gap: 4px; }
  .menu-owl { width: 90px; }
  .menu-blurb { display: none; }
  .btn.big { min-height: 52px; padding: 8px 36px; font-size: 1.3rem; }
  .game { gap: 6px; padding: 6px 10px; }
  .hud { padding: 4px 8px; }
  .mascot { width: 40px; height: 40px; }
  .hud-title { flex-direction: row; align-items: baseline; gap: 8px; }
  .mc { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; align-items: center; align-content: center; }
  .mc .boss-box { grid-column: 1 / -1; padding: 2px 10px; }
  .mc .boss-img { width: 40px; height: 40px; }
  .mc .boss-hp { height: 12px; }
  .options { margin-top: 0; gap: 8px; }
  .opt { min-height: 56px; padding: 4px 8px; border-bottom-width: 5px; }
  .opt.emoji { min-height: 60px; }
  .opt-text { font-size: 1.6rem; }
  .opt-emoji { font-size: 2.2rem; }
  .word-big, .gap { font-size: 2rem; }
  .prompt-emoji { font-size: 2rem; }
  .prompt-card { padding: 8px 10px; }
  .prompt-instruction { font-size: 0.88rem; margin-bottom: 2px; }
  .spell { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; align-content: center; }
  .spell .prompt-card { grid-column: 1 / 2; }
  .spell-line { min-height: 52px; padding-top: 4px; padding-bottom: 4px; }
  .spell .prompt-card { padding: 4px 10px; }
  .spell .prompt-emoji { font-size: 1.6rem; }
  .spell .reveal { min-height: 1.2em; }
  .spell-bank { gap: 6px; }
  .spell .spell-bank { grid-column: 1 / -1; }
  .spell .spell-actions { grid-column: 2 / 3; grid-row: 1; align-self: center; }
  .tile { min-height: 44px; min-width: 46px; font-size: 1.35rem; }
  .memory { grid-template-columns: repeat(4, minmax(0, 1fr)); grid-template-rows: repeat(2, minmax(0, 1fr)); gap: 8px; min-height: 0; align-content: stretch; }
  .mcard { aspect-ratio: auto; height: 100%; max-height: none; min-height: 0; }
  .mcard .mw { font-size: 1.2rem; }
  .mcard .me { font-size: 1.4rem; }
  .prompt-card.slim { flex-direction: row; padding: 4px 12px; }
  .prompt-card.slim .prompt-instruction { margin: 0; }
  .rain-field { min-height: 120px; }
  .modal-card { padding: 12px 16px; }
  .result .result-owl { width: 70px; height: 70px; }
  .star { font-size: 2.2rem; }
}

@media (min-width: 900px) and (min-height: 600px) {
  .game { padding: 14px 24px; }
  .mc, .spell { max-width: 900px; width: 100%; margin: 0 auto; }
  .options { gap: 16px; }
  .opt { min-height: 96px; }
  .level-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
