/* ============================================================
   PANDA ARCADE — Neon Arcade Design System
   Dark plum stage · hot pink / gold / teal accents · chunky
   sticker shadows · touch-first · reduced-motion friendly
   ============================================================ */

:root {
  --bg: #150e26;
  --bg2: #1e1438;
  --panel: #241a44;
  --panel2: #2e2154;
  --line: #3d2f6b;
  --ink: #fdf6ff;
  --ink-dim: #b9a8e0;
  --pink: #ff6bb5;
  --pink-deep: #e8479b;
  --gold: #ffc93f;
  --teal: #3ee6c4;
  --purple: #a86bff;
  --red: #ff5c7a;
  --green: #7be07b;
  --orange: #ff9a3f;
  --shadow: 0 6px 0 rgba(0, 0, 0, 0.35);
  --radius: 22px;
  --font-display: "Baloo 2", "Fredoka", "Arial Rounded MT Bold", "Comic Sans MS", system-ui, sans-serif;
  --font-cjk: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
}

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

html, body { margin: 0; padding: 0; }

body {
  min-height: 100vh;
  background:
    radial-gradient(1200px 600px at 15% -10%, rgba(168, 107, 255, 0.22), transparent 60%),
    radial-gradient(1000px 500px at 110% 15%, rgba(255, 107, 181, 0.16), transparent 55%),
    radial-gradient(900px 700px at 50% 120%, rgba(62, 230, 196, 0.10), transparent 60%),
    var(--bg);
  color: var(--ink);
  font-family: var(--font-display);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

button { font-family: inherit; cursor: pointer; color: inherit; }
a { color: inherit; text-decoration: none; }
img, svg { vertical-align: middle; }

::selection { background: var(--pink); color: #fff; }

/* ============ Top bar ============ */
#topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 16px;
  background: rgba(21, 14, 38, 0.86);
  backdrop-filter: blur(10px);
  border-bottom: 2px solid var(--line);
}
.tb-left { display: flex; align-items: center; gap: 14px; min-width: 0; }
.tb-logo { font-size: 22px; font-weight: 800; white-space: nowrap; letter-spacing: 0.5px; }
.tb-logo span { color: var(--gold); }
.tb-games { display: flex; gap: 6px; }
.tb-game {
  display: flex; align-items: center; gap: 5px;
  padding: 7px 12px; border-radius: 999px;
  background: var(--panel); border: 2px solid var(--line);
  font-size: 14px; font-weight: 700; color: var(--ink-dim);
  transition: transform 0.12s, border-color 0.12s, color 0.12s;
}
.tb-game span { display: none; }
.tb-game:hover { transform: translateY(-2px); color: var(--ink); }
.tb-game.on { background: var(--pink-deep); border-color: var(--pink); color: #fff; }
.tb-stats { display: flex; align-items: center; gap: 8px; }
.tb-chip {
  border: 2px solid var(--line); background: var(--panel);
  color: var(--ink); font-weight: 800; font-size: 14px;
  padding: 8px 12px; border-radius: 999px;
}
.chip-coin { border-color: #8a6a1f; background: #33270f; }
.chip-streak { border-color: #7a3550; background: #331524; }
.tb-profile { display: flex; align-items: center; gap: 8px; padding: 5px 12px 5px 6px; border-radius: 999px; background: var(--panel); border: 2px solid var(--line); }
.tb-pinfo { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.15; }
.tb-pinfo b { font-size: 14px; }
.tb-lvl { font-size: 11px; color: var(--gold); font-weight: 700; white-space: nowrap; }
.tb-xpbar { width: 90px; height: 6px; border-radius: 99px; background: #171030; overflow: hidden; display: block; }
.tb-xpbar i { display: block; height: 100%; background: linear-gradient(90deg, var(--teal), var(--gold)); border-radius: 99px; transition: width 0.5s cubic-bezier(.2,.8,.3,1.2); }

/* ============ Layout ============ */
.page { max-width: 1080px; margin: 0 auto; padding: 20px 16px 80px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 6px 0 18px; }
.page-title { font-size: clamp(26px, 4.5vw, 40px); font-weight: 800; margin: 0; }
.page-title .cn { color: var(--pink); }
.page-sub { color: var(--ink-dim); font-weight: 600; margin: 4px 0 0; }

/* ============ Cards & panels ============ */
.panel {
  background: linear-gradient(180deg, var(--panel2), var(--panel));
  border: 2px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}
.section-title { font-size: 20px; font-weight: 800; margin: 26px 0 12px; display: flex; align-items: center; gap: 8px; }
.section-title .hint { font-size: 13px; color: var(--ink-dim); font-weight: 600; }

/* ============ Buttons ============ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: none; border-radius: 18px;
  padding: 14px 22px; font-size: 18px; font-weight: 800; color: #fff;
  box-shadow: var(--shadow);
  transition: transform 0.1s, filter 0.15s;
  touch-action: manipulation; user-select: none; -webkit-user-select: none;
}
.btn:active { transform: translateY(4px); box-shadow: 0 2px 0 rgba(0,0,0,0.35); }
.btn-pink  { background: linear-gradient(180deg, var(--pink), var(--pink-deep)); }
.btn-gold  { background: linear-gradient(180deg, #ffd76b, #f5a623); color: #4a2c00; }
.btn-teal  { background: linear-gradient(180deg, #5ff0d4, #17b795); color: #00382c; }
.btn-ghost { background: var(--panel2); border: 2px solid var(--line); box-shadow: none; color: var(--ink); }
.btn-red   { background: linear-gradient(180deg, #ff7b93, #e03458); }
.btn-big   { font-size: 22px; padding: 18px 34px; border-radius: 24px; }
.btn:disabled { filter: grayscale(0.7) brightness(0.7); cursor: default; }

/* ============ Hub: hero ============ */
.hero {
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  background: linear-gradient(135deg, rgba(255,107,181,0.18), rgba(168,107,255,0.14) 55%, rgba(62,230,196,0.12));
  border: 2px solid var(--line); border-radius: 26px; padding: 20px 22px;
  box-shadow: var(--shadow);
}
.hero-panda { animation: bob 3.2s ease-in-out infinite; }
.hero-hi { font-size: clamp(24px, 4vw, 34px); font-weight: 800; margin: 0; }
.hero-hi .cn { color: var(--gold); }
.hero-meta { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.hero-pill { background: rgba(0,0,0,0.28); border: 2px solid var(--line); padding: 7px 14px; border-radius: 999px; font-weight: 800; font-size: 14px; }
.hero-pill b { color: var(--gold); }
.hero-xp { flex: 1 1 220px; min-width: 200px; }
.hero-xp .bar { height: 16px; border-radius: 99px; background: #171030; border: 2px solid var(--line); overflow: hidden; }
.hero-xp .bar i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--teal), var(--gold)); transition: width 0.6s cubic-bezier(.2,.8,.3,1.2); }
.hero-xp .lbl { font-size: 13px; color: var(--ink-dim); font-weight: 700; margin-top: 5px; }

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

/* ============ Hub: game cards ============ */
.game-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 16px; }
.game-card {
  position: relative; overflow: hidden;
  border-radius: var(--radius); border: 2px solid var(--line);
  padding: 20px; min-height: 170px;
  display: flex; flex-direction: column; justify-content: flex-end; gap: 4px;
  box-shadow: var(--shadow);
  transition: transform 0.15s cubic-bezier(.2,.8,.3,1.4), filter 0.15s;
  touch-action: manipulation; user-select: none; -webkit-user-select: none;
}
.game-card:hover { transform: translateY(-6px) scale(1.02); }
.game-card:active { transform: translateY(0) scale(0.98); }
.game-card .big { font-size: 52px; position: absolute; top: 12px; right: 16px; filter: drop-shadow(0 4px 0 rgba(0,0,0,0.25)); animation: bob 3s ease-in-out infinite; }
.game-card h3 { margin: 0; font-size: 22px; }
.game-card .cn { font-size: 15px; font-weight: 700; opacity: 0.85; }
.game-card p { margin: 0; font-size: 14px; font-weight: 600; color: var(--ink-dim); }
.game-card .best { position: absolute; top: 14px; left: 16px; font-size: 12px; font-weight: 800; background: rgba(0,0,0,0.3); padding: 5px 10px; border-radius: 99px; border: 1px solid rgba(255,255,255,0.15); }
.gc-flash  { background: linear-gradient(150deg, #8a2f63, #4a1b56); }
.gc-whack  { background: linear-gradient(150deg, #2f6b52, #1b4a56); }
.gc-memory { background: linear-gradient(150deg, #6b2f8a, #38205e); }
.gc-listen { background: linear-gradient(150deg, #8a5a2f, #56521b); }
.gc-duel   { background: linear-gradient(150deg, #1f6e8a, #4a1b56); }

/* ============ Duel (pass & play) ============ */
.duel-vs {
  display: flex; align-items: center; justify-content: center; gap: 14px;
  margin: 10px 0 4px;
}
.duel-vs .duelist {
  background: var(--panel); border: 2px solid var(--line); border-radius: 20px;
  padding: 14px 18px; text-align: center; min-width: 130px;
}
.duel-vs .duelist b { display: block; font-size: 17px; margin-top: 6px; }
.duel-vs .vs { font-size: 26px; font-weight: 900; color: var(--pink); }
.select-label { display: block; font-size: 13px; font-weight: 800; color: var(--ink-dim); margin: 10px 0 4px; text-transform: uppercase; letter-spacing: 0.06em; }
.handoff {
  text-align: center; padding: 40px 20px;
}
.handoff .who { font-size: clamp(30px, 7vw, 46px); font-weight: 900; margin: 10px 0 4px; }
.handoff .pass { font-size: 18px; color: var(--ink-dim); font-weight: 700; }
.handoff .target { font-size: 20px; color: var(--gold); font-weight: 800; margin: 12px 0; }
.big-countdown {
  font-size: clamp(60px, 16vw, 110px); font-weight: 900; color: var(--gold);
  text-shadow: 0 6px 0 rgba(0,0,0,0.4);
  animation: comboPop 0.5s cubic-bezier(.2,.8,.3,1.6);
}
.duel-winner {
  font-size: clamp(30px, 7vw, 52px); font-weight: 900; color: var(--gold);
  text-shadow: 0 4px 0 rgba(0,0,0,0.4); margin: 6px 0;
}
.duel-score-row { display: flex; justify-content: center; gap: 16px; align-items: stretch; flex-wrap: wrap; margin: 18px 0; }
.duel-score-card {
  background: var(--panel2); border: 2px solid var(--line); border-radius: 20px;
  padding: 16px 22px; text-align: center; min-width: 150px;
}
.duel-score-card.win { border-color: var(--gold); box-shadow: 0 0 24px rgba(255, 201, 63, 0.35); background: linear-gradient(180deg, #3a2f14, #2b230f); }
.duel-score-card b { display: block; font-size: 17px; }
.duel-score-card .sc { font-size: 42px; font-weight: 900; color: var(--teal); }
.duel-score-card small { color: var(--ink-dim); font-weight: 700; display: block; margin-top: 4px; }

/* ============ Quests ============ */
.quest-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.quest {
  background: var(--panel); border: 2px solid var(--line); border-radius: 18px;
  padding: 14px; display: flex; gap: 12px; align-items: center;
}
.quest .qi { font-size: 30px; }
.quest .qt { flex: 1; min-width: 0; }
.quest .qt b { display: block; font-size: 15px; }
.quest .bar { height: 10px; margin-top: 7px; border-radius: 99px; background: #171030; overflow: hidden; }
.quest .bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--purple), var(--pink)); border-radius: 99px; transition: width 0.4s; }
.quest.done { border-color: var(--green); background: linear-gradient(180deg, #1d3a26, #17301f); }
.quest.done .qcheck { color: var(--green); font-size: 22px; font-weight: 900; }

/* ============ Badges ============ */
.badge-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.badge {
  background: var(--panel); border: 2px solid var(--line); border-radius: 18px;
  padding: 14px 10px; text-align: center; position: relative;
}
.badge .bi { font-size: 34px; display: block; }
.badge b { display: block; font-size: 14px; margin-top: 6px; }
.badge small { color: var(--ink-dim); font-size: 11.5px; display: block; line-height: 1.3; margin-top: 3px; }
.badge.locked { filter: grayscale(1) brightness(0.55); }
.badge.locked::after { content: "🔒"; position: absolute; top: 8px; right: 10px; font-size: 15px; }
.badge.unlocked { border-color: var(--gold); background: linear-gradient(180deg, #3a2f14, #2b230f); }

/* ============ Word zoo ============ */
.pack-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.pack-card {
  border-radius: 18px; border: 2px solid var(--line); padding: 14px;
  display: flex; flex-direction: column; gap: 4px; min-height: 92px;
  cursor: pointer; transition: transform 0.14s;
  touch-action: manipulation; user-select: none; color: var(--ink);
}
.pack-card:hover { transform: translateY(-4px); }
.pack-card .pi { font-size: 28px; }
.pack-card b { font-size: 16px; color: #fff; text-shadow: 0 1px 0 rgba(0,0,0,0.4); }
.pack-card small { color: var(--ink-dim); font-weight: 700; }
.pack-bar { height: 8px; border-radius: 99px; background: rgba(0,0,0,0.35); overflow: hidden; margin-top: 6px; }
.pack-bar i { display: block; height: 100%; background: var(--gold); }

.word-list { display: flex; flex-wrap: wrap; gap: 10px; }
.word-chip {
  display: inline-flex; align-items: center; gap: 10px;
  background: linear-gradient(180deg, #3a2c66, #2e2254);
  border: 2px solid #5a4894; border-radius: 16px;
  padding: 10px 16px; cursor: pointer; transition: transform 0.12s, border-color 0.12s;
  touch-action: manipulation; user-select: none;
  color: #ffffff; box-shadow: 0 3px 0 rgba(0,0,0,0.3);
}
.word-chip:hover { transform: translateY(-3px); border-color: var(--pink); }
.word-chip .we { font-size: 24px; }
.word-chip .wc {
  font-size: 28px; font-family: var(--font-cjk); font-weight: 800;
  color: #ffffff; text-shadow: 0 0 12px rgba(255, 214, 112, 0.45), 0 2px 0 rgba(0,0,0,0.5);
  line-height: 1.1;
}
.word-chip .wp { font-size: 13px; color: #6ffbe0; font-weight: 800; letter-spacing: 0.02em; }
.word-chip .stars { font-size: 11px; color: var(--gold); letter-spacing: 1px; }

/* ============ Shop ============ */
.shop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.shop-item {
  background: var(--panel); border: 2px solid var(--line); border-radius: 18px;
  padding: 14px 10px; text-align: center; position: relative;
}
.shop-item .si { font-size: 34px; display: block; min-height: 40px; }
.shop-item .sw { width: 34px; height: 34px; border-radius: 50%; display: inline-block; margin: 3px 0; border: 3px solid rgba(255,255,255,0.4); }
.shop-item b { display: block; font-size: 14px; margin: 4px 0; }
.shop-item .buy {
  border: none; border-radius: 12px; padding: 8px 14px; font-weight: 800; font-size: 13px;
  background: linear-gradient(180deg, #ffd76b, #f5a623); color: #4a2c00; box-shadow: 0 3px 0 rgba(0,0,0,0.3);
}
.shop-item .buy:disabled { background: var(--panel2); color: var(--ink-dim); box-shadow: none; }
.shop-item.owned { border-color: var(--teal); }
.shop-item.wearing { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(255, 201, 63, 0.25); }
.shop-item .wear { background: linear-gradient(180deg, #5ff0d4, #17b795); color: #00382c; }

/* ============ Profile picker ============ */
#profile-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: radial-gradient(1000px 600px at 50% 0%, rgba(168,107,255,0.25), rgba(21,14,38,0.97) 70%);
  display: flex; align-items: center; justify-content: center; padding: 20px;
  overflow-y: auto;
}
#profile-overlay .picker-box { max-width: 560px; width: 100%; text-align: center; margin: auto; }
.profile-cards { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; margin: 18px 0; }
.profile-card {
  width: 150px; border-radius: 20px; border: 2px solid var(--line);
  background: var(--panel); padding: 16px 10px; text-align: center;
  transition: transform 0.14s, border-color 0.14s;
  touch-action: manipulation; position: relative;
}
.profile-card:hover { transform: translateY(-5px); border-color: var(--pink); }
.profile-card b { display: block; margin-top: 6px; font-size: 16px; color: #fff; }
.profile-card small { color: var(--gold); font-weight: 800; font-size: 12px; }
.new-profile { border-style: dashed; color: var(--ink-dim); }
.color-dots { display: flex; gap: 8px; justify-content: center; margin: 12px 0; flex-wrap: wrap; }
.color-dot { width: 36px; height: 36px; border-radius: 50%; border: 3px solid transparent; cursor: pointer; }
.color-dot.sel { border-color: #fff; transform: scale(1.15); }
.modal-input {
  width: 100%; max-width: 260px; text-align: center;
  background: var(--bg2); border: 2px solid var(--line); border-radius: 14px;
  color: var(--ink); font-family: inherit; font-size: 18px; font-weight: 700;
  padding: 12px; outline: none;
}
.modal-input:focus { border-color: var(--pink); }

/* ============ Game shells ============ */
.game-stage {
  max-width: 760px; margin: 0 auto; padding: 18px 14px 60px;
  user-select: none; -webkit-user-select: none;
}
.hud {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: var(--panel); border: 2px solid var(--line); border-radius: 18px;
  padding: 10px 16px; margin-bottom: 16px; flex-wrap: wrap;
}
.hud .hitem { display: flex; flex-direction: column; align-items: center; line-height: 1.1; }
.hud .hitem small { font-size: 11px; color: var(--ink-dim); font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; }
.hud .hitem b { font-size: 22px; }
.hud .hitem b.gold { color: var(--gold); }
.hud .hitem b.teal { color: var(--teal); }
.timerbar { height: 12px; border-radius: 99px; background: #171030; overflow: hidden; border: 2px solid var(--line); margin-bottom: 16px; }
.timerbar i { display: block; height: 100%; background: linear-gradient(90deg, var(--red), var(--gold), var(--green)); border-radius: 99px; transition: width 0.3s linear; }
.timerbar.low i { background: var(--red); animation: pulse 0.5s infinite; }
@keyframes pulse { 50% { opacity: 0.55; } }

.prompt-zone { text-align: center; margin: 8px 0 18px; }
.prompt-cn { font-family: var(--font-cjk); font-size: clamp(46px, 10vw, 76px); font-weight: 800; line-height: 1.1; text-shadow: 0 4px 0 rgba(0,0,0,0.4); }
.prompt-py { font-size: clamp(17px, 3vw, 22px); color: var(--teal); font-weight: 800; letter-spacing: 0.03em; }
.prompt-en { font-size: 16px; color: var(--ink-dim); font-weight: 700; }

.combo-badge {
  display: inline-block; background: linear-gradient(180deg, #ff9a3f, #ff5c2b);
  color: #fff; font-weight: 900; border-radius: 99px; padding: 6px 16px;
  box-shadow: 0 0 18px rgba(255, 120, 40, 0.55);
  animation: comboPop 0.35s cubic-bezier(.2,.8,.3,1.6);
}
.combo-badge.hot { background: linear-gradient(180deg, #ffd76b, #ff5c2b); animation: firePulse 0.6s infinite alternate; }
@keyframes comboPop { from { transform: scale(0.4); } to { transform: scale(1); } }
@keyframes firePulse { from { box-shadow: 0 0 12px rgba(255,120,40,0.5); } to { box-shadow: 0 0 26px rgba(255,160,40,0.9); } }

.answer-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.answer-grid.four { grid-template-columns: 1fr 1fr; }
@media (min-width: 640px) { .answer-grid.four { grid-template-columns: 1fr 1fr; } }
.ans-btn {
  border: 2px solid var(--line); border-radius: 20px;
  background: linear-gradient(180deg, var(--panel2), var(--panel));
  color: var(--ink); font-family: inherit; font-size: 19px; font-weight: 800;
  padding: 18px 14px; min-height: 74px;
  box-shadow: var(--shadow); transition: transform 0.1s, border-color 0.1s;
  touch-action: manipulation;
}
.ans-btn:active { transform: translateY(4px); box-shadow: 0 2px 0 rgba(0,0,0,0.3); }
.ans-btn.right { border-color: var(--green); background: linear-gradient(180deg, #2c5c34, #1d4225); animation: yay 0.4s; }
.ans-btn.wrong { border-color: var(--red); background: linear-gradient(180deg, #5c2430, #421a24); animation: shake 0.35s; }
.ans-btn .cn-big { font-family: var(--font-cjk); font-size: 34px; display: block; line-height: 1.2; }
.ans-btn .py-small { display: block; font-size: 13px; color: var(--teal); font-weight: 700; }
@keyframes yay { 30% { transform: scale(1.12); } }
@keyframes shake { 20%,60% { transform: translateX(-8px); } 40%,80% { transform: translateX(8px); } }

.hear-btn {
  width: 64px; height: 64px; border-radius: 50%;
  border: 3px solid var(--gold); background: radial-gradient(circle at 35% 30%, #ffe9a8, #f5a623);
  font-size: 26px; box-shadow: 0 5px 0 rgba(0,0,0,0.35), 0 0 20px rgba(255,201,63,0.4);
  transition: transform 0.1s; touch-action: manipulation;
}
.hear-btn:active { transform: translateY(4px) scale(0.96); }
.hear-btn.playing { animation: ring 0.8s infinite; }
@keyframes ring { 50% { box-shadow: 0 0 0 14px rgba(255,201,63,0); } }

/* ============ Whack-a-mole ============ */
.mole-field {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px;
  background: linear-gradient(180deg, #233, #18243800), linear-gradient(180deg, #1d2f4a, #14203a);
  border: 3px solid #24385c; border-radius: 26px; padding: 18px;
  max-width: 560px; margin: 0 auto;
}
.hole {
  position: relative; aspect-ratio: 1; border-radius: 50%;
  background: radial-gradient(circle at 50% 35%, #3a2b1e 0%, #241a12 65%);
  border: 3px solid #120d09; overflow: hidden; cursor: pointer;
  touch-action: manipulation;
}
.mole {
  position: absolute; left: 50%; bottom: 6%;
  width: 72%; transform: translateX(-50%) translateY(110%);
  transition: transform 0.16s cubic-bezier(.2,.8,.3,1.3);
  text-align: center; pointer-events: none;
}
.hole.up .mole { transform: translateX(-50%) translateY(0); }
.mole-face {
  width: 74%; margin: 0 auto -12%; aspect-ratio: 1; border-radius: 50% 50% 42% 42%;
  background: radial-gradient(circle at 35% 30%, #8a6a4f, #6b4f38);
  border: 3px solid #3c2b1c; position: relative;
  display: flex; align-items: center; justify-content: center;
}
.mole.gold .mole-face { background: radial-gradient(circle at 35% 30%, #ffe9a8, #ffb52b); border-color: #b97e12; }
.mole .char {
  font-family: var(--font-cjk); font-weight: 800;
  font-size: clamp(24px, 6.5vw, 36px); color: #fff;
  text-shadow: 0 2px 0 rgba(0,0,0,0.6); position: relative; z-index: 2;
}
.mole.gold .char { color: #503000; text-shadow: 0 1px 0 rgba(255,255,255,0.5); }
.mole-eyes { position: absolute; top: 12%; width: 100%; display: flex; justify-content: space-evenly; }
.mole-eyes i { width: 16%; aspect-ratio: 1; background: #1c1410; border-radius: 50%; display: block; }
.hole.bonked .mole { transform: translateX(-50%) translateY(20%) rotate(-12deg) scale(0.9); filter: brightness(1.4); }
.hole.hitright { animation: yay 0.35s; box-shadow: 0 0 24px rgba(123, 224, 123, 0.7); }
.hole.hitwrong { animation: shake 0.35s; box-shadow: 0 0 24px rgba(255, 92, 122, 0.7); }
.splat {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 40px; z-index: 5; pointer-events: none; animation: splatUp 0.5s forwards;
}
@keyframes splatUp { from { transform: scale(0.3); opacity: 1; } to { transform: scale(1.6) translateY(-30px); opacity: 0; } }

/* ============ Memory ============ */
.mem-grid { display: grid; gap: 10px; max-width: 560px; margin: 0 auto; }
.mem-grid.g12 { grid-template-columns: repeat(4, 1fr); }
.mem-grid.g16 { grid-template-columns: repeat(4, 1fr); }
.mem-card {
  aspect-ratio: 3/3.4; perspective: 600px; cursor: pointer;
  touch-action: manipulation;
}
.mem-inner {
  position: relative; width: 100%; height: 100%;
  transform-style: preserve-3d; transition: transform 0.35s cubic-bezier(.2,.8,.3,1.2);
  border-radius: 16px;
}
.mem-card.flip .mem-inner { transform: rotateY(180deg); }
.mem-face {
  position: absolute; inset: 0; border-radius: 16px;
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
  display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 2px;
  border: 2px solid var(--line); box-shadow: var(--shadow);
}
.mem-back {
  background: linear-gradient(150deg, #5b3fa8, #33235e);
  font-size: 34px;
}
.mem-back::after { content: "🐼"; }
.mem-front { background: linear-gradient(180deg, #fdf6ff, #e8dcff); transform: rotateY(180deg); color: #221; }
.mem-front .mc-char { font-family: var(--font-cjk); font-weight: 800; font-size: clamp(22px, 6vw, 34px); color: #3a2470; }
.mem-front .mc-pin { font-size: 11px; font-weight: 800; color: #17a689; }
.mem-front .mc-en { font-size: 11px; font-weight: 700; color: #7a6a9a; }
.mem-card.done .mem-front { border-color: var(--teal); background: linear-gradient(180deg, #d8fff4, #b2f0e0); animation: yay 0.45s; }
.mem-card.done { pointer-events: none; }

/* ============ Listen & pick bubbles ============ */
.bubble-field { position: relative; min-height: 430px; border-radius: 26px; border: 3px solid var(--line); background: linear-gradient(180deg, rgba(62,230,196,0.06), rgba(168,107,255,0.08)), var(--bg2); overflow: hidden; }
.bubble {
  position: absolute; min-width: 84px; height: 84px; padding: 0 16px;
  border-radius: 50%; border: 3px solid rgba(255,255,255,0.35);
  background: radial-gradient(circle at 32% 28%, rgba(255,255,255,0.28), rgba(255,255,255,0.06) 60%), var(--panel2);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-family: var(--font-cjk); font-weight: 800; font-size: 26px; color: var(--ink);
  cursor: pointer; box-shadow: 0 6px 0 rgba(0,0,0,0.3);
  transition: transform 0.12s; touch-action: manipulation;
  animation: drift 5s ease-in-out infinite alternate;
}
.bubble .bpin { font-size: 11px; font-weight: 700; color: var(--teal); font-family: var(--font-display); }
.bubble.right { border-color: var(--green); animation: yay 0.4s; z-index: 5; }
.bubble.wrong { border-color: var(--red); animation: shake 0.35s; }
@keyframes drift { from { transform: translateY(-7px); } to { transform: translateY(7px); } }

/* ============ Results screen ============ */
.result-card { text-align: center; padding: 30px 20px; }
.result-emoji { font-size: 64px; }
.result-score { font-size: clamp(40px, 9vw, 64px); font-weight: 900; color: var(--gold); text-shadow: 0 4px 0 rgba(0,0,0,0.4); }
.result-row { display: flex; justify-content: center; gap: 22px; flex-wrap: wrap; margin: 16px 0; }
.result-stat b { display: block; font-size: 26px; }
.result-stat small { color: var(--ink-dim); font-weight: 700; }
.star-row { font-size: 40px; letter-spacing: 6px; margin: 8px 0; }
.star-row .off { filter: grayscale(1) brightness(0.5); }
.result-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-top: 18px; }
.word-recap { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 16px; }
.recap-chip { background: var(--panel2); border: 2px solid var(--line); border-radius: 12px; padding: 6px 10px; font-size: 14px; font-weight: 700; cursor: pointer; color: var(--ink); }
.recap-chip .ok { color: var(--green); } .recap-chip .no { color: var(--red); }
.recap-chip .pyc { color: var(--teal); font-size: 12px; }

/* ============ Toasts / floaters / fx ============ */
#toasts { position: fixed; top: 76px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast {
  background: rgba(20, 12, 40, 0.95); border: 2px solid var(--teal);
  color: var(--ink); font-weight: 800; font-size: 15px;
  padding: 12px 20px; border-radius: 999px;
  animation: toastIn 0.3s cubic-bezier(.2,.8,.3,1.4);
  box-shadow: 0 8px 24px rgba(0,0,0,0.5); max-width: 88vw; text-align: center;
}
.toast.out { opacity: 0; transform: translateY(-12px); transition: 0.35s; }
@keyframes toastIn { from { transform: translateY(-16px) scale(0.8); opacity: 0; } }

.floater {
  position: fixed; z-index: 190; pointer-events: none;
  font-weight: 900; font-size: 22px; color: var(--gold);
  text-shadow: 0 2px 0 rgba(0,0,0,0.5);
  animation: floatUp 1.3s ease-out forwards;
}
.floater.big { font-size: 30px; color: var(--teal); }
@keyframes floatUp { to { transform: translateY(-90px) scale(1.25); opacity: 0; } }

#fx-canvas { position: fixed; inset: 0; pointer-events: none; z-index: 300; }

#celebrate { position: fixed; inset: 0; z-index: 250; display: none; align-items: center; justify-content: center; background: rgba(10, 5, 25, 0.6); backdrop-filter: blur(3px); }
#celebrate.show { display: flex; }
.cele-card {
  background: linear-gradient(180deg, var(--panel2), var(--panel));
  border: 3px solid var(--gold); border-radius: 28px; padding: 34px 40px;
  text-align: center; max-width: 90vw;
  animation: comboPop 0.45s cubic-bezier(.2,.8,.3,1.6);
  box-shadow: 0 0 60px rgba(255, 201, 63, 0.35);
}
.cele-big { font-size: clamp(30px, 7vw, 48px); font-weight: 900; color: var(--gold); }
.cele-small { font-size: 18px; font-weight: 700; color: var(--ink-dim); margin: 10px 0 20px; }

/* ============ Parents zone ============ */
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.setting-row:last-child { border-bottom: none; }
.setting-row b { font-size: 16px; }
.setting-row .desc { font-size: 13px; color: var(--ink-dim); font-weight: 600; }
.switch { position: relative; width: 58px; height: 32px; border-radius: 99px; background: #171030; border: 2px solid var(--line); transition: background 0.2s; flex-shrink: 0; }
.switch::after { content: ""; position: absolute; top: 2px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: var(--ink-dim); transition: 0.2s; }
.switch.on { background: var(--teal); border-color: var(--teal); }
.switch.on::after { left: 27px; background: #fff; }
input[type="range"] { width: 160px; accent-color: var(--pink); }
select.pselect { background: var(--bg2); color: var(--ink); border: 2px solid var(--line); border-radius: 10px; padding: 8px 10px; font-family: inherit; font-weight: 700; max-width: 260px; }
.mastery-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.mastery-table th, .mastery-table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.mastery-table th { color: var(--ink-dim); font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; }
.mastery-table .cjk { font-family: var(--font-cjk); font-weight: 700; font-size: 17px; }
.mastery-table .stars { color: var(--gold); letter-spacing: 1px; }
.report-scroll { max-height: 380px; overflow-y: auto; border: 2px solid var(--line); border-radius: 14px; padding: 4px 10px; }
.report-scroll::-webkit-scrollbar { width: 10px; }
.report-scroll::-webkit-scrollbar-thumb { background: var(--line); border-radius: 99px; }

/* ============ Onboarding hint / footer ============ */
.howto { background: rgba(62, 230, 196, 0.07); border: 2px dashed rgba(62, 230, 196, 0.4); border-radius: 18px; padding: 14px 18px; font-size: 15px; font-weight: 600; color: var(--ink-dim); margin: 14px 0; }
.howto b { color: var(--teal); }
.pfooter { text-align: center; color: var(--ink-dim); font-size: 13px; font-weight: 600; padding: 30px 0 20px; }
.pfooter a { color: var(--pink); }

/* ============ Responsive / a11y ============ */
@media (max-width: 720px) {
  .tb-games { display: none; }
  .tb-xpbar { width: 56px; }
  .answer-grid { grid-template-columns: 1fr 1fr; }
  .ans-btn { font-size: 16px; padding: 14px 10px; min-height: 64px; }
  .page { padding-bottom: 60px; }
}
@media (max-width: 420px) {
  .mem-grid.g16 { grid-template-columns: repeat(4, 1fr); gap: 7px; }
  .bubble { min-width: 74px; height: 74px; font-size: 22px; }
}

/* Reduced motion (setting or OS preference) */
body.no-motion .mole, body.no-motion .bubble, body.no-motion .hero-panda,
body.no-motion .game-card .big { animation: none !important; transition-duration: 0.01s !important; }
body.no-motion .mem-inner { transition-duration: 0.05s !important; }
@media (prefers-reduced-motion: reduce) {
  .mole, .bubble, .hero-panda, .game-card .big { animation: none !important; }
}
