/* ============================================================
   PuiPui 學習樂園 — 可愛卡通風 🎀
   字型：jf open 粉圓（開源 OFL，justfont/open-huninn-font）
   ============================================================ */

@font-face {
  font-family: "Open Huninn";
  src: url("/static/fonts/jf-openhuninn.woff2") format("woff2");
  font-display: swap;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

:root {
  --pink: #ff6b9d;
  --pink-soft: #ff8fb3;
  --pink-light: #ffe0ec;
  --lavender: #b197fc;
  --blue: #4dabf7;
  --blue-light: #d0ebff;
  --mint: #63e6be;
  --yellow: #ffd43b;
  --green: #51cf66;
  --purple: #9775fa;
  --cream: #fff9f0;
  --text: #4a3f4c;
  --muted: #9c8ba0;
}

html, body { height: 100%; }
body {
  font-family: "Open Huninn", "Microsoft JhengHei", "PingFang HK", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 12% 18%, rgba(255,255,255,.75) 0 26px, transparent 27px),
    radial-gradient(circle at 78% 10%, rgba(255,255,255,.65) 0 34px, transparent 35px),
    radial-gradient(circle at 88% 55%, rgba(255,255,255,.5) 0 22px, transparent 23px),
    radial-gradient(circle at 30% 80%, rgba(255,255,255,.45) 0 30px, transparent 31px),
    linear-gradient(160deg, #ffeef5 0%, #f3ecff 45%, #e8f7ff 100%);
  background-attachment: fixed;
  min-height: 100vh;
  user-select: none;
}

/* 屏幕底彩虹糖果條 */
body::after {
  content: "";
  position: fixed; left: 0; right: 0; bottom: 0; height: 10px; z-index: 5;
  background: linear-gradient(90deg,
    #ff8fb3 0 20%, #ffc078 20% 40%, #ffe066 40% 60%, #8ce99a 60% 80%, #91c7ff 80% 100%);
  pointer-events: none;
}

button { font-family: inherit; cursor: pointer; border: none; }

/* ===== 糖果按鈕通用 ===== */
.mode-btn, .sum-btn, .choice-card, .ctl-btn, .btn-home, .menu-bar {
  background: linear-gradient(180deg, #ffffff 0%, #ffeef5 100%);
  border: 3px solid var(--pink-soft);
  border-radius: 22px;
  color: var(--text);
  box-shadow: 0 5px 0 #f5b5cb, 0 8px 16px rgba(255,107,157,.18);
  transition: transform .12s, box-shadow .12s;
}
.mode-btn:hover, .sum-btn:hover, .choice-card:hover, .ctl-btn:hover, .menu-bar:hover {
  transform: translateY(-2px);
  box-shadow: 0 7px 0 #f5b5cb, 0 10px 20px rgba(255,107,157,.24);
}
.mode-btn:active, .sum-btn:active, .choice-card:active, .ctl-btn:active {
  transform: translateY(3px);
  box-shadow: 0 2px 0 #f5b5cb, 0 4px 8px rgba(255,107,157,.18);
}

/* ===== 頂欄 ===== */
.topbar {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px;
  background: rgba(255,255,255,.75);
  backdrop-filter: blur(4px);
  border-bottom: 3px solid var(--pink-light);
}
.btn-home {
  font-size: 24px; text-decoration: none;
  width: 52px; height: 52px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}
.progress {
  flex: 1; text-align: center;
  font-size: 20px; font-weight: 700; color: var(--pink);
}
.scorebox {
  font-size: 20px; font-weight: 800; color: #e8590c;
  background: #fff; padding: 8px 18px; border-radius: 999px;
  border: 3px solid var(--yellow);
  box-shadow: 0 3px 10px rgba(255,212,59,.35);
}
.avatar {
  width: 52px; height: 52px; border-radius: 50%;
  object-fit: cover; border: 3px solid var(--pink);
  background: #fff;
  box-shadow: 0 3px 8px rgba(255,107,157,.3);
}

/* ===== 主選單 ===== */
.menu-wrap {
  max-width: 720px; margin: 0 auto; padding: 24px 20px 50px;
  display: flex; flex-direction: column; align-items: center; gap: 22px;
}
.menu-title {
  font-size: 40px; font-weight: 900; color: var(--pink);
  text-shadow: 2px 3px 0 #fff, 4px 6px 12px rgba(255,107,157,.25);
  display: flex; align-items: center; gap: 14px;
}
.menu-title img {
  width: 76px; height: 76px; border-radius: 50%;
  border: 4px solid var(--pink); background: #fff;
  box-shadow: 0 4px 12px rgba(255,107,157,.35);
}
.menu-sub { font-size: 18px; color: var(--muted); }
.menu-cards { display: flex; flex-direction: column; gap: 18px; width: 100%; }
.menu-card {
  display: flex; align-items: center; gap: 18px;
  background: #fff;
  border-radius: 26px;
  padding: 20px 24px;
  box-shadow: 0 8px 20px rgba(180,140,200,.18);
  text-decoration: none; color: var(--text);
  border: 4px solid transparent;
  transition: transform .15s, box-shadow .15s;
}
.menu-card:hover { transform: translateY(-4px) scale(1.01); box-shadow: 0 12px 26px rgba(180,140,200,.28); }
.menu-card:active { transform: scale(.97); }
.menu-card .icon { font-size: 50px; width: 82px; text-align: center; }
.menu-card img.icon-img { width: 82px; height: 82px; object-fit: contain; }
.menu-card .info { flex: 1; }
.menu-card .name { font-size: 26px; font-weight: 800; }
.menu-card .desc { font-size: 15px; color: var(--muted); margin-top: 4px; }
.menu-card .best { font-size: 15px; color: #e8590c; font-weight: 700; margin-top: 4px; }
.menu-card.c-zh { border-color: var(--pink-soft); }
.menu-card.c-en { border-color: var(--blue); }
.menu-card.c-math { border-color: var(--mint); }
.menu-card.c-pairs { border-color: var(--lavender) !important; }
.menu-bar {
  width: 100%; padding: 15px 24px; border-radius: 26px;
  display: flex; align-items: center; gap: 12px; text-decoration: none;
  font-size: 20px; font-weight: 800; color: var(--purple);
  border-color: var(--lavender);
  box-shadow: 0 5px 0 #cdbdf5, 0 8px 16px rgba(151,117,250,.18);
}
.menu-bar .cnt-badge { margin-left: auto; font-size: 15px; color: var(--muted); font-weight: 400; }

/* ===== 模式選擇 ===== */
.mode-wrap {
  max-width: 640px; margin: 30px auto; padding: 0 20px;
  display: flex; flex-direction: column; gap: 20px; align-items: center;
}
.mode-title {
  font-size: 32px; font-weight: 900; color: var(--pink);
  text-shadow: 2px 3px 0 #fff;
}
.mode-btn { width: 100%; padding: 26px; font-size: 26px; font-weight: 800; }
.mode-btn .small { display: block; font-size: 15px; color: var(--muted); font-weight: 400; margin-top: 7px; }

/* ===== 遊戲區 ===== */
.game-wrap {
  max-width: 640px; margin: 0 auto; padding: 8px 20px 40px;
  display: flex; flex-direction: column; align-items: center; gap: 18px;
}
.big-card {
  background: #fff;
  border-radius: 30px;
  border: 4px dashed var(--pink-soft);
  width: 100%; min-height: 240px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  box-shadow: 0 10px 24px rgba(255,143,179,.2);
  padding: 18px;
  position: relative;
}
.big-char {
  font-size: 104px; font-weight: 900; line-height: 1.15;
  color: var(--text);
}
.big-word { font-size: 72px; font-weight: 900; color: var(--blue); letter-spacing: 2px; }
.big-emoji { font-size: 76px; }
.cat-chip {
  position: absolute; top: 12px; left: 16px;
  background: var(--pink-light); color: var(--pink);
  font-size: 15px; font-weight: 700; border-radius: 999px; padding: 5px 14px;
}
.hint-emoji { position: absolute; top: 12px; right: 16px; font-size: 30px; }
.word-zh-small { font-size: 19px; color: var(--muted); margin-top: 9px; }

/* 控制列 */
.controls { display: flex; gap: 24px; align-items: flex-start; justify-content: center; }
.ctl-btn {
  width: 92px; height: 92px; border-radius: 50%;
  font-size: 40px;
  border-color: var(--blue);
  box-shadow: 0 5px 0 #a5cff0, 0 8px 16px rgba(77,171,247,.22);
  display: flex; align-items: center; justify-content: center;
}
.ctl-btn:hover { box-shadow: 0 7px 0 #a5cff0, 0 10px 18px rgba(77,171,247,.28); }
.ctl-btn:active { box-shadow: 0 2px 0 #a5cff0, 0 4px 8px rgba(77,171,247,.2); }
.ctl-btn.mic {
  width: 112px; height: 112px; font-size: 50px;
  border-color: var(--pink);
  background: linear-gradient(180deg, #fff 0%, #ffe0ec 100%);
  box-shadow: 0 5px 0 #f5a5c2, 0 8px 16px rgba(255,107,157,.28);
}
.ctl-btn.mic.listening {
  background: linear-gradient(180deg, #ff8fb3 0%, #ff6b9d 100%);
  animation: pulse 1s infinite;
}
.ctl-btn:disabled { opacity: .45; }
.ctl-label { font-size: 14px; color: var(--muted); text-align: center; margin-top: 8px; }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(255,107,157,.55); }
  70% { box-shadow: 0 0 0 22px rgba(255,107,157,0); }
  100% { box-shadow: 0 0 0 0 rgba(255,107,157,0); }
}

.heard-line { min-height: 30px; font-size: 18px; color: var(--muted); text-align: center; }
.heard-line b { color: var(--purple); }

/* 選項卡 */
.choices { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; width: 100%; }
.choice-card {
  min-width: 120px; padding: 18px 24px;
  font-size: 42px; font-weight: 800;
  border-color: var(--blue-light);
}
.choice-card.en { font-size: 32px; color: var(--blue); }
.choice-card.num { font-size: 38px; color: var(--green); }
.choice-card.wrong-pick { border-color: #ffa8a8; background: #fff5f5; opacity: .6; }
.choice-card.right-pick { border-color: var(--green); background: #ebfbee; }

/* 數學題 */
.math-eq { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; justify-content: center; }
.math-group { display: flex; flex-wrap: wrap; gap: 4px; max-width: 220px; justify-content: center; }
.math-group img { width: 42px; height: 42px; object-fit: contain; }
.math-group img.small { width: 30px; height: 30px; }
.math-group img.gone { opacity: .28; filter: grayscale(1); }
.math-op { font-size: 52px; font-weight: 900; color: var(--pink); }
.math-nums { font-size: 40px; font-weight: 900; color: var(--text); margin-top: 6px; text-align: center; }

/* 回饋閃現 */
.feedback-flash {
  position: fixed; inset: 0; z-index: 60;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  pointer-events: none; gap: 10px;
}
.feedback-flash .fb-emoji { font-size: 110px; animation: pop .5s; }
.feedback-flash .fb-text {
  font-size: 38px; font-weight: 900; color: #fff;
  text-shadow: 0 3px 10px rgba(0,0,0,.3);
  background: linear-gradient(90deg, rgba(255,107,157,.85), rgba(151,117,250,.85));
  border-radius: 999px; padding: 8px 30px;
}
@keyframes pop { 0% { transform: scale(.2); } 70% { transform: scale(1.25); } 100% { transform: scale(1); } }

/* streak 打氣 */
.cheer-pop {
  position: fixed; right: 18px; bottom: 26px; z-index: 55;
  display: flex; flex-direction: column; align-items: center;
  animation: cheerIn .45s;
  pointer-events: none;
}
.cheer-pop img { width: 130px; height: 130px; object-fit: contain; filter: drop-shadow(0 6px 10px rgba(180,140,200,.35)); }
.cheer-pop .bubble {
  background: #fff; border-radius: 18px; padding: 8px 16px;
  font-size: 18px; font-weight: 800; color: var(--pink);
  border: 2px solid var(--pink-light);
  box-shadow: 0 4px 10px rgba(255,107,157,.2); margin-bottom: 8px;
}
@keyframes cheerIn { from { transform: translateY(120px); opacity: 0; } to { transform: none; opacity: 1; } }

/* 彩帶 */
.confetti-piece {
  position: fixed; top: -40px; z-index: 50; pointer-events: none;
  font-size: 28px; animation: fall linear forwards;
}
@keyframes fall {
  to { transform: translateY(110vh) rotate(720deg); opacity: .9; }
}

/* 總結 overlay */
.overlay {
  position: fixed; inset: 0; z-index: 70;
  background: rgba(255, 238, 245, .94);
  display: flex; align-items: center; justify-content: center;
}
.overlay.hidden { display: none; }
.summary {
  background: #fff; border-radius: 34px; padding: 36px 44px;
  border: 4px solid var(--pink-light);
  box-shadow: 0 14px 34px rgba(255,107,157,.25);
  display: flex; flex-direction: column; align-items: center; gap: 14px;
  max-width: 90vw; text-align: center;
}
.summary .stars { font-size: 62px; letter-spacing: 6px; filter: drop-shadow(0 4px 8px rgba(255,180,60,.4)); }
.summary .sum-title { font-size: 32px; font-weight: 900; color: var(--pink); }
.summary .sum-score { font-size: 23px; font-weight: 700; }
.summary .sum-best { font-size: 16px; color: var(--muted); }
.summary .fam-row { display: flex; gap: 6px; }
.summary .fam-row img { width: 64px; height: 64px; object-fit: contain; animation: bounce 1s infinite alternate; }
.summary .fam-row img:nth-child(2n) { animation-delay: .25s; }
@keyframes bounce { from { transform: translateY(0); } to { transform: translateY(-14px); } }
.summary .sum-btns { display: flex; gap: 14px; margin-top: 8px; flex-wrap: wrap; justify-content: center; }
.sum-btn {
  font-size: 19px; font-weight: 800; border-radius: 999px; padding: 13px 26px;
  text-decoration: none; color: #fff;
  background: linear-gradient(180deg, var(--pink-soft), var(--pink));
  border-color: #fff;
  box-shadow: 0 5px 0 #d64f82, 0 8px 16px rgba(255,107,157,.3);
}
.sum-btn.alt {
  background: linear-gradient(180deg, #74c0fc, var(--blue));
  box-shadow: 0 5px 0 #2f8ad1, 0 8px 16px rgba(77,171,247,.3);
}

/* 提示訊息條 */
.toast {
  position: fixed; left: 50%; bottom: 30px; transform: translateX(-50%);
  background: rgba(74,63,76,.92); color: #fff;
  font-size: 17px; padding: 11px 24px; border-radius: 999px; z-index: 80;
  opacity: 0; transition: opacity .3s; pointer-events: none;
  max-width: 86vw; text-align: center;
}
.toast.show { opacity: 1; }

/* ===== 冒險地圖（糖果小路） ===== */
.adv-path { width: min(640px, 92vw); height: 66px; margin: 6px auto 0; }
.adv-inner { position: relative; margin: 0 28px; height: 100%; }
.adv-line {
  position: absolute; left: 0; right: 0; top: 41px; height: 6px;
  background: repeating-linear-gradient(90deg,
    var(--pink-soft) 0 14px, transparent 14px 24px);
  border-radius: 3px;
}
.adv-station { position: absolute; top: 32px; transform: translateX(-50%); font-size: 20px; z-index: 1; }
.adv-station.big { font-size: 27px; top: 27px; filter: drop-shadow(0 2px 4px rgba(0,0,0,.18)); }
.adv-station.dot {
  width: 12px; height: 12px; top: 38px;
  background: #fff; border: 3px solid var(--pink-soft); border-radius: 50%;
}
.adv-station img {
  width: 36px; height: 36px; object-fit: contain;
  filter: drop-shadow(0 2px 4px rgba(180,140,200,.4));
}
.adv-avatar {
  position: absolute; top: 2px; width: 42px; height: 42px;
  border-radius: 50%; border: 3px solid var(--pink); background: #fff;
  object-fit: cover; transform: translateX(-50%); z-index: 2;
  box-shadow: 0 3px 8px rgba(255,107,157,.35);
  transition: left .6s cubic-bezier(.34, 1.56, .64, 1);
}
.adv-avatar.hop { animation: hop .6s; }
@keyframes hop { 30% { margin-top: -14px; } 60% { margin-top: 3px; } 100% { margin-top: 0; } }

/* ===== 汽球爆爆（返返嚟圓碌碌汽球） ===== */
.balloons { display: flex; gap: 30px; justify-content: center; align-items: flex-start;
  min-height: 215px; padding-top: 10px; width: 100%; }
.balloon {
  position: relative; width: 122px; height: 150px;
  border-radius: 50% 50% 47% 47%;
  display: flex; align-items: center; justify-content: center;
  font-size: 32px; font-weight: 800; color: #fff;
  text-shadow: 0 2px 5px rgba(0,0,0,.28);
  animation: bob 2.4s ease-in-out infinite;
  box-shadow: inset -10px -12px 20px rgba(0,0,0,.12), 0 6px 14px rgba(180,140,200,.25);
}
.balloon::after {
  content: ""; position: absolute; bottom: -42px; left: 50%;
  width: 2px; height: 42px;
  background: linear-gradient(#c8b8d0, transparent);
}
.balloon.b1 { background: radial-gradient(circle at 35% 28%, #ffb3cd, #ff6b9d); }
.balloon.b2 { background: radial-gradient(circle at 35% 28%, #d0bdfc, #9775fa); }
.balloon.b3 { background: radial-gradient(circle at 35% 28%, #9fd4ff, #4dabf7); }
.balloon:nth-child(2) { animation-delay: .5s; }
.balloon:nth-child(3) { animation-delay: 1s; }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-16px); } }
.balloon.pop { animation: balloonPop .45s forwards; }
@keyframes balloonPop {
  35% { transform: scale(1.3); }
  100% { transform: scale(0); opacity: 0; }
}
.balloon.wobble { animation: wobble .55s; opacity: .5; }
@keyframes wobble { 25% { transform: rotate(-9deg); } 75% { transform: rotate(9deg); } }
.balloon.reveal { animation: revealPulse 1s infinite; }
@keyframes revealPulse { 50% { transform: scale(1.12); box-shadow: 0 0 0 12px rgba(81,207,102,.3); } }

/* ===== 釣魚（粉藍海洋） ===== */
.sea {
  position: relative; width: 100%; height: 240px;
  background:
    radial-gradient(circle at 18% 22%, rgba(255,255,255,.5) 0 10px, transparent 11px),
    radial-gradient(circle at 65% 60%, rgba(255,255,255,.35) 0 8px, transparent 9px),
    radial-gradient(circle at 85% 30%, rgba(255,255,255,.4) 0 7px, transparent 8px),
    linear-gradient(180deg, #a5d8ff 0%, #4dabf7 100%);
  border-radius: 26px;
  border: 4px solid #fff;
  box-shadow: 0 8px 20px rgba(77,171,247,.3);
  overflow: hidden;
}
.sea::before { content: "🎣"; position: absolute; top: 6px; right: 14px; font-size: 24px; }
.fish {
  position: absolute; display: flex; align-items: center; gap: 4px;
  background: transparent; border: none; padding: 4px;
  animation-name: swim; animation-timing-function: ease-in-out;
  animation-iteration-count: infinite; animation-direction: alternate;
}
.fish .body { font-size: 46px; filter: drop-shadow(0 3px 5px rgba(0,0,0,.2)); }
.fish .tag {
  background: #fff; border-radius: 999px; padding: 6px 15px;
  font-size: 22px; font-weight: 800; color: var(--blue);
  box-shadow: 0 3px 8px rgba(0,0,0,.15);
}
@keyframes swim { from { left: 2%; } to { left: 55%; } }
.fish.caught { animation: caught .8s forwards; }
@keyframes caught {
  40% { transform: translateY(-70px) rotate(-15deg); }
  100% { transform: translateY(-220px) rotate(-30deg); opacity: 0; }
}
.fish.flee { animation: flee .6s forwards; }
@keyframes flee { to { transform: translateX(60vw); opacity: .2; } }
.fish .tag.right-pick { background: #ebfbee; color: var(--green); box-shadow: 0 0 0 4px rgba(81,207,102,.35); }

/* ===== 飛行 emoji（餵食動畫） ===== */
.fly-emoji {
  position: fixed; z-index: 65; pointer-events: none;
  font-size: 46px;
  transform: translate(-50%, -50%);
  transition-property: transform, opacity;
  transition-timing-function: cubic-bezier(.5, -.2, .72, .38);
}

/* ===== 中文大聲讀：開寶箱 ===== */
.chest-scene { gap: 8px; }
.chest-sign {
  background: linear-gradient(180deg, #fff, var(--pink-light));
  border: 4px solid var(--pink-soft);
  border-radius: 24px;
  padding: 8px 34px;
  font-size: 60px; font-weight: 900; color: var(--text);
  box-shadow: 0 6px 14px rgba(255,107,157,.22);
}
.chest { position: relative; width: 134px; height: 108px; margin-top: 16px; }
.chest-box {
  position: absolute; bottom: 0; width: 100%; height: 62px;
  background: linear-gradient(180deg, #f5a5c2, #e87ba3);
  border: 3px solid #d64f82;
  border-radius: 10px 10px 16px 16px;
  box-shadow: inset 0 4px 0 rgba(255,255,255,.35);
}
.chest-box::before {
  content: "💛"; position: absolute; top: -13px; left: 50%; transform: translateX(-50%);
  font-size: 22px; z-index: 3;
}
.chest-lid {
  position: absolute; top: 0; width: 100%; height: 48px;
  background: linear-gradient(180deg, #ffc4d8, #f5a5c2);
  border: 3px solid #d64f82;
  border-radius: 18px 18px 6px 6px;
  box-shadow: inset 0 4px 0 rgba(255,255,255,.4);
  transform-origin: bottom left;
  transition: transform .35s;
  z-index: 2;
}
.chest.open .chest-lid { transform: rotate(-26deg) translate(-4px, -14px); }
.chest-loot {
  position: absolute; left: 50%; top: 30px;
  transform: translateX(-50%) scale(0);
  font-size: 46px; z-index: 1;
  transition: transform .45s .12s, top .45s .12s;
}
.chest.open .chest-loot { transform: translateX(-50%) scale(1.15); top: -42px; }

/* ===== 英文 Read it!：餵小動物 ===== */
.feed-row { display: flex; align-items: center; gap: 20px; justify-content: center; }
.feed-food {
  font-size: 52px;
  background: #fff;
  border: 3px solid var(--yellow);
  border-radius: 20px;
  padding: 8px 15px;
  box-shadow: 0 5px 12px rgba(255,212,59,.3);
}
.feed-arrow { font-size: 30px; }
.feed-target {
  width: 114px; height: 114px; object-fit: contain;
  background: #fff;
  border: 3px solid var(--mint);
  border-radius: 24px;
  box-shadow: 0 5px 14px rgba(99,230,190,.3);
}
.feed-target.munch { animation: munch .8s; }
@keyframes munch {
  20% { transform: scale(1.16) rotate(-4deg); }
  45% { transform: scale(.94) rotate(3deg); }
  70% { transform: scale(1.1); }
}

/* ===== 數學：敲寶石 ===== */
.ores { display: flex; gap: 20px; justify-content: center; flex-wrap: wrap; width: 100%; }
.ore {
  position: relative; width: 114px; height: 114px;
  display: flex; align-items: center; justify-content: center;
  font-size: 44px; font-weight: 800; color: #fff;
  text-shadow: 0 2px 5px rgba(0,0,0,.3);
  border-radius: 28px;
  border: 4px solid #fff;
  box-shadow: 0 6px 0 rgba(0,0,0,.12), 0 10px 20px rgba(180,140,200,.28),
    inset -8px -10px 18px rgba(0,0,0,.12), inset 6px 8px 14px rgba(255,255,255,.35);
  transition: transform .12s;
}
.ore:nth-child(1) { background: radial-gradient(circle at 35% 28%, #ffb3cd, #f06595); }
.ore:nth-child(2) { background: radial-gradient(circle at 35% 28%, #d0bdfc, #845ef7); }
.ore:nth-child(3) { background: radial-gradient(circle at 35% 28%, #8ee8d0, #20c997); }
.ore:hover { transform: translateY(-3px); }
.ore.cracking { animation: crackshake .38s linear; }
@keyframes crackshake {
  20% { transform: translate(-3px, 1px) rotate(-2deg); }
  40% { transform: translate(3px, -1px) rotate(2deg); }
  60% { transform: translate(-3px, 0); }
  80% { transform: translate(3px, 1px); }
}
.ore.break { animation: oreBreak .55s forwards; }
@keyframes oreBreak {
  35% { transform: scale(1.18); }
  100% { transform: scale(0) rotate(12deg); opacity: 0; }
}
.ore.dud { background: #cfc4d4; color: #9c8ba0; text-shadow: none; }
.ore.dud::after {
  content: "✖"; position: absolute; right: 8px; top: 4px;
  font-size: 26px; color: #ff8787;
}

/* ===== 翻卡配對（禮物卡背） ===== */
.pair-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; width: 100%; }
.pcard { aspect-ratio: 3 / 4; perspective: 700px; background: transparent; border: none; padding: 0; }
.pcard .inner {
  position: relative; width: 100%; height: 100%;
  transform-style: preserve-3d; transition: transform .45s;
}
.pcard.flipped .inner { transform: rotateY(180deg); }
.pcard .face {
  position: absolute; inset: 0; backface-visibility: hidden;
  border-radius: 18px; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 4px;
  box-shadow: 0 5px 12px rgba(180,140,200,.25);
}
/* 卡背：粉紅禮物包裝（白點點＋絲帶） */
.pcard .front {
  background:
    radial-gradient(circle, rgba(255,255,255,.5) 0 5px, transparent 6px),
    linear-gradient(180deg, #ff9fbe, #ff6b9d);
  background-size: 34px 34px, 100% 100%;
  color: #fff; font-size: 36px;
  border: 3px solid #fff;
}
.pcard .back {
  background: #fff; transform: rotateY(180deg);
  border: 3px solid var(--blue-light);
  font-size: 26px; font-weight: 800;
}
.pcard .back .em { font-size: 44px; }
.pcard.matched { pointer-events: none; animation: matchedPulse .6s; }
.pcard.matched .back { border-color: var(--green); background: #ebfbee; }
@keyframes matchedPulse { 40% { transform: scale(1.12); } }

/* ===== 貼紙簿 ===== */
.sticker-wrap { max-width: 680px; margin: 0 auto; padding: 10px 20px 50px; }
.sticker-set { margin-top: 22px; }
.sticker-set h2 {
  font-size: 23px; color: var(--purple);
  margin-bottom: 10px;
  display: flex; align-items: center; gap: 10px;
}
.sticker-set h2 .done { font-size: 15px; color: var(--green); }
.sticker-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 12px; }
.sticker-cell {
  position: relative; aspect-ratio: 1; background: #fff; border-radius: 20px;
  display: flex; align-items: center; justify-content: center; font-size: 44px;
  box-shadow: 0 5px 12px rgba(180,140,200,.2);
  border: 3px solid var(--pink-light);
}
.sticker-cell.locked { filter: grayscale(1); opacity: .38; font-size: 30px; }
.sticker-cell .cnt {
  position: absolute; top: -7px; right: -7px;
  background: var(--pink); color: #fff; font-size: 13px; font-weight: 800;
  border-radius: 999px; min-width: 25px; height: 25px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 6px rgba(255,107,157,.4);
}
.sum-stickers { display: flex; gap: 10px; justify-content: center; }
.sum-stickers .stk {
  font-size: 42px; animation: pop .5s backwards;
  background: #fff; border: 3px solid var(--yellow); border-radius: 18px; padding: 6px 11px;
  box-shadow: 0 4px 10px rgba(255,212,59,.35);
}
.sum-stickers .stk:nth-child(2) { animation-delay: .25s; }
.sum-stickers .stk:nth-child(3) { animation-delay: .5s; }

/* ===== AI 傾偈 ===== */
.chat-wrap {
  max-width: 640px; margin: 0 auto; padding: 12px 16px 20px;
  display: flex; flex-direction: column;
  height: calc(100vh - 90px); height: calc(100dvh - 90px);
}
.chat-log {
  flex: 1 1 auto; overflow-y: auto;
  display: flex; flex-direction: column; gap: 12px;
  padding: 8px 2px;
}
.chat-row { display: flex; align-items: flex-end; gap: 8px; }
.chat-row.user { justify-content: flex-end; }
.chat-ava {
  width: 42px; height: 42px; border-radius: 50%;
  object-fit: contain; background: #fff;
  border: 2px solid var(--pink-light); flex: 0 0 auto;
}
.chat-bubble {
  max-width: 75%; padding: 12px 16px; font-size: 18px; line-height: 1.5;
  border-radius: 20px;
}
.chat-bubble.ai {
  background: #fff; border: 2px solid var(--lavender);
  border-bottom-left-radius: 6px;
  box-shadow: 0 4px 10px rgba(151,117,250,.15);
}
.chat-bubble.user {
  background: linear-gradient(180deg, var(--pink-soft), var(--pink));
  color: #fff; border-bottom-right-radius: 6px;
  box-shadow: 0 4px 10px rgba(255,107,157,.25);
}
.chat-bubble.thinking { color: var(--muted); font-style: italic; }
.chat-chips { display: flex; gap: 8px; flex-wrap: wrap; padding: 10px 0; }
.chip {
  background: #fff; border: 2px solid var(--blue-light);
  border-radius: 999px; padding: 8px 14px; font-size: 15px;
  color: var(--blue); font-weight: 700;
  box-shadow: 0 3px 8px rgba(77,171,247,.15);
}
.chip:active { transform: scale(.95); }
.chat-inputrow { display: flex; gap: 8px; align-items: center; padding-top: 8px; }
.chat-mic {
  width: 56px; height: 56px; border-radius: 50%; font-size: 24px; flex: 0 0 auto;
  background: linear-gradient(180deg, #fff, #ffe0ec);
  border: 3px solid var(--pink);
  box-shadow: 0 4px 0 #f5a5c2;
}
.chat-mic.listening { background: linear-gradient(180deg, #ff8fb3, #ff6b9d); animation: pulse 1s infinite; }
.chat-input {
  flex: 1 1 auto; min-width: 0;
  font-family: inherit; font-size: 17px;
  padding: 13px 18px; border-radius: 999px;
  border: 3px solid var(--pink-light); outline: none;
  background: #fff; color: var(--text);
}
.chat-input:focus { border-color: var(--pink-soft); }
.chat-send {
  flex: 0 0 auto; font-size: 16px; font-weight: 800; color: #fff;
  padding: 13px 18px; border-radius: 999px;
  background: linear-gradient(180deg, var(--pink-soft), var(--pink));
  box-shadow: 0 4px 0 #d64f82;
}
.chat-send:active { transform: translateY(2px); box-shadow: 0 2px 0 #d64f82; }

/* ===== Responsive：平板 / 手機 ===== */
@media (max-width: 560px) {
  .menu-wrap { padding: 16px 12px 40px; gap: 16px; }
  .menu-title { font-size: 27px; gap: 10px; }
  .menu-title img { width: 54px; height: 54px; }
  .menu-sub { font-size: 15px; }
  .menu-card { padding: 14px 16px; gap: 12px; border-radius: 20px; }
  .menu-card .icon { font-size: 36px; width: 52px; }
  .menu-card img.icon-img { width: 54px; height: 54px; }
  .menu-card .name { font-size: 21px; }
  .menu-card .desc { font-size: 13px; }
  .menu-bar { font-size: 17px; padding: 12px 16px; }

  .topbar { padding: 8px 10px; gap: 8px; }
  .btn-home { width: 44px; height: 44px; font-size: 20px; }
  .progress { font-size: 16px; }
  .scorebox { font-size: 16px; padding: 6px 12px; }
  .avatar { width: 44px; height: 44px; }

  .mode-wrap { margin: 18px auto; gap: 14px; }
  .mode-title { font-size: 25px; }
  .mode-btn { font-size: 21px; padding: 18px; border-radius: 18px; }
  .mode-btn .small { font-size: 13px; }

  .game-wrap { padding: 6px 12px 30px; gap: 14px; }
  .big-card { min-height: 190px; border-radius: 24px; padding: 14px; }
  .big-char { font-size: 62px; }
  .big-word { font-size: 42px; }
  .big-emoji { font-size: 56px; }
  .chest-sign { font-size: 38px; padding: 6px 22px; }
  .chest { width: 110px; height: 92px; }
  .word-zh-small { font-size: 16px; }
  .heard-line { font-size: 15px; }

  .controls { gap: 16px; }
  .ctl-btn { width: 72px; height: 72px; font-size: 30px; }
  .ctl-btn.mic { width: 88px; height: 88px; font-size: 38px; }
  .ctl-label { font-size: 12px; }

  .choices { gap: 10px; }
  .choice-card { min-width: 88px; padding: 12px 14px; font-size: 30px; }
  .choice-card.en { font-size: 22px; }

  .balloons { gap: 14px; min-height: 165px; }
  .balloon { width: 96px; height: 120px; font-size: 24px; }

  .sea { height: 195px; }
  .fish .body { font-size: 36px; }
  .fish .tag { font-size: 16px; padding: 4px 10px; }

  .ores { gap: 12px; }
  .ore { width: 88px; height: 88px; font-size: 32px; border-radius: 20px; }
  .math-group img { width: 32px; height: 32px; }
  .math-group img.small { width: 24px; height: 24px; }
  .math-op { font-size: 38px; }
  .math-nums { font-size: 30px; }

  .feed-food { font-size: 40px; padding: 6px 11px; }
  .feed-target { width: 90px; height: 90px; }
  .feed-arrow { font-size: 22px; }

  .pair-grid { gap: 8px; }
  .pcard .face { border-radius: 12px; }
  .pcard .front { font-size: 26px; }
  .pcard .back { font-size: 17px; }
  .pcard .back .em { font-size: 30px; }

  .adv-path { height: 56px; }
  .adv-inner { margin: 0 22px; }
  .adv-station img { width: 28px; height: 28px; }
  .adv-avatar { width: 34px; height: 34px; }
  .adv-line { top: 34px; }
  .adv-station { top: 27px; font-size: 16px; }
  .adv-station.big { font-size: 21px; top: 23px; }
  .adv-station.dot { top: 31px; width: 9px; height: 9px; }

  .summary { padding: 22px 18px; border-radius: 24px; gap: 10px; }
  .summary .stars { font-size: 44px; }
  .summary .sum-title { font-size: 24px; }
  .summary .sum-score { font-size: 18px; }
  .summary .fam-row img { width: 46px; height: 46px; }
  .sum-btn { font-size: 16px; padding: 11px 18px; }
  .sum-stickers .stk { font-size: 32px; }

  .sticker-grid { grid-template-columns: repeat(auto-fill, minmax(66px, 1fr)); gap: 8px; }
  .sticker-cell { font-size: 32px; border-radius: 14px; }

  .chat-bubble { font-size: 16px; max-width: 82%; }
  .chat-ava { width: 34px; height: 34px; }
  .chat-send { font-size: 14px; padding: 12px 13px; }

  /* 魚游短啲，免得走出屏幕 */
  @keyframes swim { from { left: 2%; } to { left: 42%; } }
}

/* ===== 叮叮老師數字人 ===== */
.dh-stage {
  max-width: 640px; margin: 0 auto; padding: 10px 16px 16px;
  display: flex; flex-direction: column; align-items: center;
  height: calc(100vh - 90px); height: calc(100dvh - 90px);
  gap: 6px;
}
.dh-bubble-wrap { min-height: 108px; display: flex; align-items: flex-end; width: 100%; justify-content: center; }
.dh-bubble {
  position: relative; max-width: 92%;
  background: #fff; border: 3px solid var(--lavender);
  border-radius: 24px; padding: 14px 22px;
  font-size: 19px; line-height: 1.55; color: var(--text);
  box-shadow: 0 6px 16px rgba(151,117,250,.2);
}
.dh-bubble::after {
  content: ""; position: absolute; bottom: -13px; left: 50%;
  transform: translateX(-50%);
  border: 11px solid transparent; border-top-color: var(--lavender);
}
.dh-bubble.pop { animation: bubblePop .35s; }
@keyframes bubblePop { 0% { transform: scale(.7); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }

.dh-avatar-wrap {
  position: relative; width: 250px; flex: 0 0 auto;
  display: flex; flex-direction: column; align-items: center;
  animation: dhFloat 3.2s ease-in-out infinite;
}
@keyframes dhFloat { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }
.dh-svg { width: 100%; height: auto; filter: drop-shadow(0 8px 14px rgba(180,140,200,.3)); }

/* 眨眼 */
.dh-eyelid {
  transform-box: fill-box; transform-origin: center top;
  transform: scaleY(0);
  animation: dhBlink 4.4s infinite;
}
@keyframes dhBlink {
  0%, 93%, 100% { transform: scaleY(0); }
  95%, 97% { transform: scaleY(1); }
}

/* 嘴：預設合埋，.mo 一開一合 */
.dh-mouth-open { opacity: 0; }
.dh-avatar-wrap.mo .dh-mouth-open { opacity: 1; }
.dh-avatar-wrap.mo .dh-mouth-closed { opacity: 0; }

/* 聽緊：粉紅光環＋腮紅加深＋側頭 */
.st-listening .dh-avatar-wrap::before {
  content: ""; position: absolute; top: 8px; left: 50%;
  transform: translateX(-50%);
  width: 230px; height: 230px; border-radius: 50%;
  border: 4px solid rgba(255,107,157,.45);
  animation: dhRing 1.2s infinite;
  pointer-events: none;
}
@keyframes dhRing {
  0% { transform: translateX(-50%) scale(.92); opacity: .9; }
  100% { transform: translateX(-50%) scale(1.12); opacity: 0; }
}
.st-listening .dh-svg { transform: rotate(-3deg); }
.st-listening .dh-blush { opacity: .85; }

/* 諗緊：眼珠望上 */
.dh-pupil { transform-box: fill-box; transform-origin: center; transition: transform .3s; }
.st-thinking .dh-pupil { transform: translate(3px, -5px); }
.st-thinking .dh-svg { transform: rotate(2deg); }

/* 講緊嘢：聲波＋輕微彈跳 */
.dh-waves {
  position: absolute; right: -38px; top: 42%;
  display: flex; gap: 4px; align-items: center; height: 30px;
  opacity: 0; transition: opacity .25s;
}
.dh-waves span {
  width: 5px; height: 10px; border-radius: 3px;
  background: var(--pink-soft);
}
.st-speaking .dh-waves { opacity: 1; }
.st-speaking .dh-waves span { animation: dhWave .7s ease-in-out infinite; }
.dh-waves span:nth-child(2) { animation-delay: .12s; }
.dh-waves span:nth-child(3) { animation-delay: .24s; }
.dh-waves span:nth-child(4) { animation-delay: .36s; }
.dh-waves span:nth-child(5) { animation-delay: .48s; }
@keyframes dhWave { 0%, 100% { height: 8px; } 50% { height: 28px; } }
.st-speaking .dh-avatar-wrap { animation: dhTalk .55s ease-in-out infinite; }
@keyframes dhTalk { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }

.dh-name {
  margin-top: 4px;
  background: #fff; border: 3px solid var(--pink-soft); border-radius: 999px;
  padding: 5px 18px; font-size: 17px; font-weight: 800; color: var(--pink);
  box-shadow: 0 4px 10px rgba(255,107,157,.22);
}
.dh-status { font-size: 14px; color: var(--muted); margin-top: 6px; min-height: 20px; }

.dh-inputrow {
  display: flex; gap: 10px; align-items: center; width: 100%;
  margin-top: auto; padding-top: 8px;
}
.dh-mic {
  width: 84px; height: 84px; border-radius: 50%; font-size: 38px; flex: 0 0 auto;
  background: linear-gradient(180deg, #fff, #ffe0ec);
  border: 4px solid var(--pink);
  box-shadow: 0 5px 0 #f5a5c2, 0 8px 16px rgba(255,107,157,.3);
}
.dh-mic:active { transform: translateY(3px); box-shadow: 0 2px 0 #f5a5c2; }
.dh-mic.listening {
  background: linear-gradient(180deg, #ff8fb3, #ff6b9d);
  animation: pulse 1s infinite;
}
.dh-stage .chat-send { font-size: 22px; padding: 13px 16px; }
.dh-stage .chat-chips { justify-content: center; }

@media (max-width: 560px), (max-height: 760px) {
  .dh-avatar-wrap { width: 185px; }
  .st-listening .dh-avatar-wrap::before { width: 172px; height: 172px; }
  .dh-bubble { font-size: 16px; padding: 11px 16px; }
  .dh-bubble-wrap { min-height: 88px; }
  .dh-mic { width: 68px; height: 68px; font-size: 30px; }
  .dh-waves { right: -26px; }
  .dh-name { font-size: 15px; }
}

/* ===== 數字人：淨係得大咪高風掣 ===== */
.dh-microw {
  margin-top: auto; padding-top: 10px;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.dh-mic.big { width: 112px; height: 112px; font-size: 52px; }
.dh-mic-label { font-size: 15px; color: var(--muted); }
.dh-heard { font-size: 14px; color: var(--purple); margin-top: 4px; min-height: 20px; }
@media (max-width: 560px), (max-height: 760px) {
  .dh-mic.big { width: 92px; height: 92px; font-size: 42px; }
}
