/* ============================================================
   小小闯关乐园 —— 设计系统
   断点：手机 < 560px ｜ 平板 560-1024px ｜ 桌面 > 1024px
   间距：8px 网格 ｜ 圆角：12/16/22/28 ｜ 触控目标 ≥ 48px
   ============================================================ */

:root {
  --bg: #f4f7fd;
  --bg2: #e9f0fd;
  --card: #ffffff;
  --ink: #1f2b44;
  --ink2: #61708c;
  --ink3: #97a3b8;
  --line: #e8eef8;
  --line2: #d8e2f2;
  --brand: #3f6fff;
  --brand-d: #2f56d6;
  --brand-l: #eaf0ff;
  --ok: #16a34a;
  --ok-l: #e9f9ef;
  --warn: #f59e0b;
  --warn-l: #fff6e5;
  --bad: #e5484d;
  --bad-l: #fdeeee;
  --gold: #ffb020;
  --r-xl: 28px;
  --r-lg: 22px;
  --r-md: 16px;
  --r-sm: 10px;
  --sh-1: 0 1px 2px rgba(31, 43, 68, .05), 0 2px 8px rgba(31, 43, 68, .05);
  --sh-2: 0 2px 6px rgba(31, 43, 68, .06), 0 10px 24px rgba(31, 43, 68, .08);
  --sh-3: 0 8px 20px rgba(31, 43, 68, .10), 0 20px 44px rgba(31, 43, 68, .12);
  --sh-brand: 0 6px 16px rgba(63, 111, 255, .28);
  --ease: cubic-bezier(.34, 1.4, .64, 1);
  --font: "PingFang SC", "Microsoft YaHei UI", "Hiragino Sans GB", "Heiti SC", system-ui, sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(1000px 520px at -12% -12%, #ffe6f0 0%, rgba(255, 230, 240, 0) 58%),
    radial-gradient(820px 460px at 112% -4%, #dfeaff 0%, rgba(223, 234, 255, 0) 55%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg2) 100%);
  background-attachment: fixed;
  min-height: 100vh;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; padding: 0; }
:focus-visible { outline: 3px solid rgba(63, 111, 255, .45); outline-offset: 2px; }
a { color: var(--brand); text-decoration: none; }

#app { max-width: 1080px; margin: 0 auto; padding: 0 14px calc(40px + var(--safe-b)); }

/* ---------- 通用 ---------- */
.card { background: var(--card); border-radius: var(--r-lg); box-shadow: var(--sh-2); padding: 18px; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.spacer { flex: 1; }
.muted { color: var(--ink2); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.center { text-align: center; }
.hidden { display: none !important; }
.strong { font-weight: 800; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border-radius: 999px; padding: 0 22px; min-height: 48px;
  font-weight: 800; font-size: 16px; letter-spacing: .2px;
  background: linear-gradient(180deg, #5c84ff, var(--brand)); color: #fff;
  box-shadow: var(--sh-brand);
  transition: transform .14s var(--ease), box-shadow .14s, filter .14s;
}
.btn:active { transform: scale(.97); }
.btn:disabled { background: #dbe3f4; color: #93a0b8; box-shadow: none; cursor: not-allowed; }
.btn.ghost { background: #fff; color: var(--brand); box-shadow: inset 0 0 0 2px var(--line2); }
.btn.ghost:disabled { background: #f4f7fd; color: var(--ink3); box-shadow: inset 0 0 0 2px var(--line); }
.btn.ok { background: linear-gradient(180deg, #34c76a, var(--ok)); box-shadow: 0 6px 16px rgba(22, 163, 74, .28); }
.btn.bad { background: linear-gradient(180deg, #f2666b, var(--bad)); box-shadow: 0 6px 16px rgba(229, 72, 77, .28); }
.btn.big { min-height: 56px; padding: 0 30px; font-size: 17px; }
.btn.sm { min-height: 40px; padding: 0 14px; font-size: 14px; }
.btn.block { width: 100%; }

/* 加载 / 空状态 */
.spinner {
  width: 34px; height: 34px; margin: 0 auto; border-radius: 50%;
  border: 4px solid var(--line2); border-top-color: var(--brand);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.boot { padding: 56px 0; text-align: center; color: var(--ink2); }
.empty-state { text-align: center; padding: 44px 20px; }
.empty-state .ic { font-size: 52px; margin-bottom: 10px; }
.empty-state .tx { color: var(--ink2); margin-bottom: 18px; }

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 10px;
  padding: 10px 2px; margin-bottom: 4px;
  background: linear-gradient(180deg, rgba(244, 247, 253, .97) 62%, rgba(244, 247, 253, 0));
  backdrop-filter: blur(10px);
}
.avatar-btn {
  width: 46px; height: 46px; flex: none; border-radius: 50%; background: #fff;
  box-shadow: var(--sh-1); display: grid; place-items: center; font-size: 24px;
  transition: transform .14s var(--ease);
}
.avatar-btn:active { transform: scale(.92); }
.tb-name { min-width: 0; }
.tb-name .n { font-weight: 800; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 130px; }
.tb-name .s { font-size: 12px; color: var(--ink2); }
.stat-chip {
  display: inline-flex; align-items: center; gap: 4px; flex: none;
  background: #fff; border-radius: 999px; padding: 0 11px; height: 36px;
  font-weight: 800; font-size: 14px; box-shadow: var(--sh-1);
}
.stat-chip.urgent { background: var(--bad-l); color: var(--bad); animation: blink .8s infinite; }
@keyframes blink { 50% { opacity: .45; } }
.icon-btn {
  width: 42px; height: 42px; flex: none; border-radius: 50%; background: #fff;
  box-shadow: var(--sh-1); display: grid; place-items: center; font-size: 18px;
  transition: transform .14s var(--ease);
}
.icon-btn:active { transform: scale(.92); }

/* ---------- 首页 ---------- */
.hero {
  position: relative; overflow: hidden;
  border-radius: var(--r-xl); padding: 20px; color: #fff; margin-bottom: 6px;
  background: linear-gradient(135deg, #5b7cff 0%, #8b5cf6 52%, #ff6fae 100%);
  box-shadow: 0 14px 34px rgba(110, 90, 235, .3);
}
.hero::after {
  content: "🌟"; position: absolute; right: -14px; top: -22px;
  font-size: 132px; opacity: .16; pointer-events: none;
}
.hero h1 { margin: 0 0 6px; font-size: 21px; font-weight: 900; letter-spacing: .3px; }
.hero p { margin: 0; opacity: .93; font-size: 14px; }
.hero .stats { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.hero .stat {
  background: rgba(255, 255, 255, .2); border-radius: 14px; padding: 8px 12px;
  font-weight: 800; font-size: 13.5px; backdrop-filter: blur(4px);
}

.sec { margin: 22px 0 0; }
.sec-head { display: flex; align-items: center; gap: 8px; margin: 0 2px 12px; }
.sec-head .dot { width: 5px; height: 17px; border-radius: 4px; background: var(--brand); flex: none; }
.sec-head h2 { margin: 0; font-size: 17px; font-weight: 900; letter-spacing: .2px; }
.sec-head .extra { margin-left: auto; font-size: 13px; font-weight: 700; color: var(--ink2); }

.rec-row { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 8px; scrollbar-width: thin; }
.rec-row::-webkit-scrollbar { height: 6px; }
.rec-row::-webkit-scrollbar-thumb { background: var(--line2); border-radius: 6px; }
.rec-pill {
  flex: none; display: inline-flex; align-items: center; gap: 6px;
  background: #fff; border-radius: 999px; padding: 0 16px; height: 44px;
  font-weight: 800; font-size: 14px; box-shadow: var(--sh-1);
  transition: transform .14s var(--ease);
}
.rec-pill:active { transform: scale(.96); }
.rec-pill .t { font-size: 18px; }
.rec-pill .s { font-size: 12px; color: var(--ink2); font-weight: 700; }

.subjects { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.subj {
  position: relative; overflow: hidden; cursor: pointer;
  border-radius: var(--r-lg); padding: 14px; color: #fff; min-height: 138px;
  display: flex; flex-direction: column;
  box-shadow: var(--sh-2); transition: transform .16s var(--ease), box-shadow .16s;
}
.subj:hover { transform: translateY(-3px); box-shadow: var(--sh-3); }
.subj:active { transform: scale(.985); }
.subj .ic { font-size: 30px; line-height: 1; filter: drop-shadow(0 3px 6px rgba(0, 0, 0, .18)); }
.subj .nm { font-size: 16.5px; font-weight: 900; margin-top: 8px; letter-spacing: .2px; }
.subj .ds { font-size: 12px; opacity: .93; margin-top: 4px; line-height: 1.45; flex: 1; }
.subj .bar { height: 7px; border-radius: 7px; background: rgba(255, 255, 255, .32); overflow: hidden; margin-top: 6px; }
.subj .bar i { display: block; height: 100%; background: #fff; border-radius: 7px; transition: width .5s var(--ease); }
.subj .meta { display: flex; justify-content: space-between; font-size: 11.5px; font-weight: 800; margin-top: 6px; opacity: .95; }
.subj::before {
  content: ""; position: absolute; right: -30px; bottom: -30px; width: 96px; height: 96px;
  border-radius: 50%; background: rgba(255, 255, 255, .12);
}

.quick-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.quick {
  background: #fff; border-radius: var(--r-md); box-shadow: var(--sh-1);
  padding: 14px; text-align: left; display: flex; align-items: center; gap: 12px;
  transition: transform .14s var(--ease);
}
.quick:active { transform: scale(.97); }
.quick .q-ic {
  width: 42px; height: 42px; flex: none; border-radius: 13px; display: grid; place-items: center;
  font-size: 21px; background: var(--brand-l);
}
.quick .q-t { font-weight: 800; font-size: 15px; }
.quick .q-d { font-size: 12px; color: var(--ink2); margin-top: 1px; }

/* ---------- 关卡地图 ---------- */
.map-head {
  display: flex; align-items: center; gap: 12px; padding: 14px 16px; margin-bottom: 14px;
  background: #fff; border-radius: var(--r-lg); box-shadow: var(--sh-2);
}
.map-head .mh-ic {
  width: 54px; height: 54px; flex: none; border-radius: 17px; display: grid; place-items: center;
  font-size: 28px; color: #fff; box-shadow: var(--sh-1);
}
.map-head .mh-t { font-size: 18px; font-weight: 900; }
.map-head .mh-d { font-size: 12.5px; color: var(--ink2); margin-top: 2px; }
.ring { position: relative; width: 58px; height: 58px; flex: none; }
.ring svg { transform: rotate(-90deg); }
.ring .ring-tx {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-size: 13px; font-weight: 900;
}

.unit { margin-bottom: 12px; }
.unit-head {
  display: flex; align-items: center; gap: 11px; width: 100%;
  padding: 13px 15px; background: #fff; border-radius: var(--r-md); box-shadow: var(--sh-1);
  transition: transform .14s var(--ease);
}
.unit-head:active { transform: scale(.99); }
.unit-head .u-ic {
  width: 40px; height: 40px; flex: none; border-radius: 12px; display: grid; place-items: center;
  font-size: 20px; background: var(--brand-l);
}
.unit-head.locked .u-ic { background: #eef1f7; filter: grayscale(1); }
.unit-head .u-t { font-weight: 800; font-size: 15.5px; text-align: left; }
.unit-head .u-d { font-size: 12px; color: var(--ink2); margin-top: 1px; text-align: left; }
.unit-head .u-tag {
  flex: none; font-size: 11.5px; font-weight: 800; padding: 3px 9px; border-radius: 999px;
  background: var(--brand-l); color: var(--brand);
}
.unit-head .u-tag.lock { background: #f0f2f7; color: var(--ink3); }
.unit-head .u-arrow { flex: none; font-size: 18px; color: var(--ink3); transition: transform .2s; }
.unit-head .u-arrow.open { transform: rotate(90deg); }
.unit-body { padding: 10px 0 2px; }
.levels { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.lv {
  position: relative; border-radius: var(--r-md); background: #fff; box-shadow: var(--sh-1);
  padding: 12px 6px 10px; display: flex; flex-direction: column; align-items: center; gap: 6px;
  transition: transform .14s var(--ease); text-align: center; min-height: 108px;
}
.lv:active { transform: scale(.95); }
.lv .n {
  width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center;
  font-size: 18px; font-weight: 900; color: #fff; box-shadow: 0 4px 10px rgba(31, 43, 68, .18);
}
.lv .t { font-size: 12.5px; font-weight: 800; line-height: 1.35; color: var(--ink); }
.lv .stars { font-size: 11px; letter-spacing: 1px; color: var(--gold); }
.lv.locked { filter: grayscale(.9); opacity: .6; background: #f6f8fc; }
.lv.locked .lock-ic { position: absolute; right: 7px; top: 6px; font-size: 14px; }
.lv.cleared { background: linear-gradient(180deg, #f2fdf6, #fff); box-shadow: inset 0 0 0 2px #cdeedb, var(--sh-1); }

/* ---------- 闯关 ---------- */
.play-wrap { padding-top: 2px; }
.play-bar { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.progress { flex: 1; height: 12px; border-radius: 999px; background: #fff; box-shadow: var(--sh-1); overflow: hidden; }
.progress i { display: block; height: 100%; width: 0; border-radius: 999px; background: linear-gradient(90deg, #6ee7a8, var(--ok)); transition: width .4s var(--ease); }

.q-card { padding: 20px 18px 18px; }
.q-head { display: flex; gap: 6px; margin-bottom: 10px; }
.q-badge {
  font-size: 11.5px; font-weight: 800; padding: 3px 10px; border-radius: 999px;
  background: var(--brand-l); color: var(--brand);
}
.q-badge.hard { background: var(--warn-l); color: #b45309; }
.q-stem { font-size: 20px; font-weight: 800; line-height: 1.55; letter-spacing: .2px; }
.q-tip {
  display: flex; gap: 8px; align-items: flex-start;
  font-size: 13.5px; color: var(--ink2); background: #f5f8ff; border-radius: var(--r-sm);
  padding: 9px 12px; margin: 12px 0 4px;
}
.q-tip .tip-ic { flex: none; }
.q-media { display: grid; place-items: center; margin: 14px 0 18px; }
.big-char { font-size: 88px; font-weight: 900; line-height: 1.1; letter-spacing: 4px; }
.big-pinyin { font-size: 19px; color: var(--brand); font-weight: 700; margin-top: 2px; text-align: center; }
.emoji-grid { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; max-width: 400px; }
.emoji-grid span { font-size: 36px; animation: pop .34s var(--ease) backwards; }
@keyframes pop { from { transform: scale(.3); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.opts { display: grid; gap: 10px; margin-top: 4px; }
.opts.two { grid-template-columns: 1fr 1fr; gap: 12px; }
.opt {
  background: #fff; border: 2.5px solid var(--line2); border-radius: var(--r-md);
  padding: 12px 14px; font-size: 17px; font-weight: 800; min-height: 58px;
  display: flex; align-items: center; gap: 10px; text-align: left;
  transition: transform .12s var(--ease), border-color .12s, background .12s;
}
.opt:active { transform: scale(.98); }
.opt .idx {
  width: 30px; height: 30px; flex: none; border-radius: 50%; background: var(--brand-l);
  color: var(--brand); display: grid; place-items: center; font-size: 14px; font-weight: 900;
}
.opt.sel { border-color: var(--brand); background: var(--brand-l); }
.opt.right { border-color: var(--ok); background: var(--ok-l); }
.opt.wrong { border-color: var(--bad); background: var(--bad-l); }
.opt.big-emoji { justify-content: center; font-size: 40px; min-height: 96px; padding: 10px; }

.bubbles { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.bubble {
  width: 58px; height: 58px; border-radius: 50%; background: #fff; box-shadow: var(--sh-1);
  display: grid; place-items: center; font-size: 28px; transition: transform .15s var(--ease), box-shadow .15s;
}
.bubble:active { transform: scale(.92); }
.bubble.picked { background: var(--ok-l); box-shadow: inset 0 0 0 3px var(--ok); transform: scale(1.06); }

.slots {
  display: flex; flex-wrap: wrap; gap: 8px; min-height: 60px; padding: 12px;
  background: #f5f8ff; border-radius: var(--r-md); justify-content: center; align-items: center;
}
.slot {
  min-width: 50px; min-height: 50px; border-radius: 13px; background: #fff;
  box-shadow: inset 0 0 0 2px var(--brand); display: grid; place-items: center;
  font-weight: 800; font-size: 16px; padding: 0 10px;
}
.token {
  min-width: 50px; min-height: 50px; border-radius: 13px; background: #fff; box-shadow: var(--sh-1);
  display: grid; place-items: center; font-weight: 800; font-size: 16px; padding: 0 12px;
  transition: transform .13s var(--ease);
}
.token:active { transform: scale(.94); }
.token.used { opacity: .3; pointer-events: none; }
.token.sel { box-shadow: inset 0 0 0 3px var(--brand); }
.pool { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 14px; }

.match-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.match-col { display: grid; gap: 9px; align-content: start; }
.match-item {
  background: #fff; box-shadow: inset 0 0 0 2.5px var(--line2); border-radius: var(--r-md);
  padding: 12px 10px; font-weight: 800; font-size: 15px; text-align: center; min-height: 54px;
  display: grid; place-items: center; transition: all .13s;
}
.match-item.sel { box-shadow: inset 0 0 0 2.5px var(--brand); background: var(--brand-l); }
.match-item.done { box-shadow: inset 0 0 0 2.5px var(--ok); background: var(--ok-l); }
.match-item.bad { box-shadow: inset 0 0 0 2.5px var(--bad); background: var(--bad-l); }

.buckets { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.bucket {
  box-shadow: inset 0 0 0 2.5px var(--line2); border-radius: var(--r-md); padding: 12px;
  min-height: 104px; background: #fbfcff; transition: all .13s;
}
.bucket.hot { box-shadow: inset 0 0 0 2.5px var(--brand); background: var(--brand-l); }
.bucket .bt { font-weight: 800; text-align: center; margin-bottom: 8px; font-size: 14px; }
.bucket .items { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }

.number-pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; max-width: 320px; margin: 0 auto; }
.number-pad button {
  background: #fff; border-radius: var(--r-md); min-height: 56px;
  font-size: 21px; font-weight: 900; box-shadow: var(--sh-1); transition: transform .12s;
}
.number-pad button:active { transform: scale(.95); background: var(--brand-l); }
.number-view {
  text-align: center; font-size: 42px; font-weight: 900; letter-spacing: 3px;
  min-height: 60px; color: var(--brand); margin-bottom: 14px; word-break: break-all;
}

.memory-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 9px; max-width: 400px; margin: 0 auto; }
.mem-card {
  aspect-ratio: 1 / 1.12; border-radius: var(--r-sm); display: grid; place-items: center;
  font-size: 30px; color: transparent; box-shadow: var(--sh-1);
  background: linear-gradient(160deg, #6f92ff, var(--brand)); transition: transform .18s var(--ease);
}
.mem-card.open { background: #fff; color: var(--ink); box-shadow: inset 0 0 0 2.5px var(--line2); }
.mem-card.gone { opacity: 0; pointer-events: none; transform: scale(.8); }

.scene-svg { width: 100%; max-width: 460px; margin: 0 auto; border-radius: var(--r-md); overflow: hidden; box-shadow: var(--sh-1); background: #fff; }
.scene-svg svg { width: 100%; height: auto; display: block; }

/* 语音 */
.speak-box { text-align: center; }
.mic {
  width: 104px; height: 104px; border-radius: 50%; margin: 10px auto;
  display: grid; place-items: center; font-size: 42px; color: #fff;
  background: linear-gradient(180deg, #ff92b4, #ff5c8a); box-shadow: 0 10px 26px rgba(255, 92, 138, .38);
  transition: transform .14s var(--ease);
}
.mic:active { transform: scale(.94); }
.mic.listening { animation: pulse 1.2s infinite; background: linear-gradient(180deg, #ff7a7a, #dc2626); }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, .5); }
  70% { box-shadow: 0 0 0 24px rgba(239, 68, 68, 0); }
  100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}
.heard {
  min-height: 52px; background: #f5f8ff; border-radius: var(--r-md); padding: 12px;
  font-size: 15.5px; margin-top: 10px; color: var(--ink); text-align: left;
}
.heard.empty { color: var(--ink3); }
.kw { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; margin-top: 12px; }
.kw span {
  background: #fff; box-shadow: inset 0 0 0 2px var(--line2); border-radius: 999px;
  padding: 5px 12px; font-size: 12.5px; font-weight: 700; color: var(--ink2);
}
.kw span.hit { box-shadow: inset 0 0 0 2px var(--ok); background: var(--ok-l); color: #15803d; }
.speaker {
  display: inline-flex; align-items: center; gap: 6px; color: #fff;
  background: linear-gradient(180deg, #63c8f5, #0ea5e9); border-radius: 999px;
  padding: 0 18px; height: 44px; font-weight: 800; font-size: 15px;
  box-shadow: 0 6px 14px rgba(14, 165, 233, .3); transition: transform .13s;
}
.speaker:active { transform: scale(.96); }
.text-input {
  width: 100%; border: 2.5px solid var(--line2); border-radius: var(--r-md);
  padding: 12px 14px; font-size: 16px; margin-top: 10px; outline: none; background: #fff;
  min-height: 50px;
}
.text-input:focus { border-color: var(--brand); }
.sample-box {
  margin-top: 12px; text-align: left; background: #f5f8ff; border-radius: var(--r-sm);
  padding: 10px 12px; font-size: 13.5px; color: var(--ink2); line-height: 1.6;
}
.sample-box summary { cursor: pointer; font-weight: 700; color: var(--brand); font-size: 13.5px; }

/* 反馈 */
.feedback { border-radius: var(--r-md); padding: 14px; margin-top: 16px; }
.feedback.ok { background: var(--ok-l); box-shadow: inset 0 0 0 2px #b6efcd; }
.feedback.no { background: var(--bad-l); box-shadow: inset 0 0 0 2px #f9c9cb; }
.fb-head { display: flex; align-items: center; gap: 9px; }
.fb-ic { font-size: 24px; }
.fb-tx { font-size: 17px; font-weight: 900; color: var(--ink); }
.feedback.ok .fb-tx { color: #15803d; }
.feedback.no .fb-tx { color: #b42318; }
.fb-sub { font-size: 13px; font-weight: 700; margin-top: 4px; color: var(--ink2); }
.feedback .an { font-size: 13.5px; margin-top: 8px; color: var(--ink2); line-height: 1.6; }
.fb-actions { display: flex; gap: 10px; margin-top: 14px; }
.fb-actions .btn:last-child { flex: 1; }

/* 底部操作栏 */
.action-bar {
  position: sticky; bottom: calc(12px + var(--safe-b)); z-index: 20;
  display: flex; gap: 10px; margin-top: 14px;
  padding: 10px; background: rgba(255, 255, 255, .86); backdrop-filter: blur(12px);
  border-radius: var(--r-lg); box-shadow: var(--sh-2);
}
.action-bar .btn { flex: 1; }

/* ---------- 结算 ---------- */
.result { text-align: center; padding: 24px 18px 20px; }
.result-sub { font-size: 13px; font-weight: 700; color: var(--ink2); }
.result-title { font-size: 17px; font-weight: 900; margin-top: 2px; }
.result .stars { font-size: 50px; letter-spacing: 4px; margin: 10px 0 2px; }
.result .stars i { display: inline-block; animation: starPop .55s var(--ease) backwards; }
@keyframes starPop {
  from { transform: scale(0) rotate(-70deg); opacity: 0; }
  60% { transform: scale(1.32) rotate(8deg); }
  to { transform: scale(1) rotate(0); opacity: 1; }
}
.score { font-size: 44px; font-weight: 900; color: var(--brand); line-height: 1.1; }
.score-unit { font-size: 17px; margin-left: 3px; color: var(--ink2); }
.result-verdict { margin-top: 6px; font-weight: 800; font-size: 15px; }
.result-verdict.pass { color: var(--ok); }
.result-verdict.fail { color: var(--warn); }
.rewards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 16px 0; }
.reward {
  background: #fffaf0; box-shadow: inset 0 0 0 2px #ffe4b0; border-radius: var(--r-md);
  padding: 10px 4px; display: flex; flex-direction: column; align-items: center; gap: 1px;
}
.reward .rw-ic { font-size: 20px; }
.reward span:nth-child(2) { font-weight: 900; font-size: 16px; }
.reward .rw-l { font-size: 11px; color: var(--ink2); font-weight: 700; }
.result-actions { display: flex; gap: 10px; margin-top: 4px; }
.result-actions .btn { flex: 1; }
.wrong-review { margin-top: 20px; text-align: left; }
.wr-title { font-weight: 800; margin-bottom: 10px; font-size: 15px; }
.wr-item { background: #fbfcff; box-shadow: inset 0 0 0 2px var(--line); border-radius: var(--r-md); padding: 12px; margin-bottom: 8px; }
.wr-stem { font-weight: 800; font-size: 14.5px; }
.wr-an { font-size: 13px; color: var(--ink2); margin-top: 4px; line-height: 1.55; }

.ach-toast {
  position: fixed; left: 50%; bottom: calc(20px + var(--safe-b)); transform: translateX(-50%);
  background: #fff; border-radius: 18px; box-shadow: var(--sh-3); padding: 12px 18px;
  display: flex; gap: 12px; align-items: center; z-index: 99; max-width: 90vw;
  animation: toastUp .4s var(--ease);
}
@keyframes toastUp { from { transform: translate(-50%, 26px); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }
.ach-toast .at-ic { font-size: 32px; }
.ach-toast .at-t { font-weight: 900; font-size: 14.5px; }
.ach-toast .at-d { font-size: 12px; color: var(--ink2); margin-top: 2px; }

/* ---------- 家长中心 ---------- */
.tabs { display: flex; gap: 8px; margin: 4px 0 14px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: none; white-space: nowrap; background: #fff; border-radius: 999px;
  padding: 0 16px; height: 40px; font-weight: 800; font-size: 14px; box-shadow: var(--sh-1);
  transition: all .14s;
}
.tab.on { background: var(--brand); color: #fff; box-shadow: var(--sh-brand); }

.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.tile { background: #fff; border-radius: var(--r-md); box-shadow: var(--sh-1); padding: 14px; }
.tile .k { font-size: 12.5px; color: var(--ink2); font-weight: 700; }
.tile .v { font-size: 22px; font-weight: 900; margin-top: 2px; letter-spacing: .2px; }
.tile.wide { grid-column: 1 / -1; }

.bars { display: grid; gap: 12px; }
.bar-row { display: grid; grid-template-columns: 96px 1fr 44px; align-items: center; gap: 10px; font-size: 13.5px; font-weight: 700; }
.bar-row .track { height: 10px; border-radius: 8px; background: #eef2fa; overflow: hidden; }
.bar-row .track i { display: block; height: 100%; border-radius: 8px; transition: width .5s var(--ease); }
.bar-row .pct { text-align: right; font-size: 12.5px; color: var(--ink2); }

.wrong-item { background: #fff; border-radius: var(--r-md); box-shadow: var(--sh-1); padding: 14px; margin-bottom: 10px; }
.wrong-item .wi-stem { font-weight: 800; font-size: 15px; margin-top: 8px; line-height: 1.5; }
.wrong-item .wi-an { font-size: 13px; color: var(--ink2); margin-top: 5px; line-height: 1.55; }

.ach-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.ach {
  background: #fff; border-radius: var(--r-md); box-shadow: var(--sh-1);
  padding: 14px 6px 10px; text-align: center;
}
.ach .ic { font-size: 30px; filter: grayscale(1); opacity: .38; }
.ach.got .ic { filter: none; opacity: 1; }
.ach .nm { font-size: 12.5px; font-weight: 800; margin-top: 5px; }
.ach .ds { font-size: 11px; color: var(--ink2); margin-top: 2px; line-height: 1.4; }

/* ---------- 表单 ---------- */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; font-weight: 800; margin-bottom: 6px; color: var(--ink2); }
.field input, .field select {
  width: 100%; box-shadow: inset 0 0 0 2px var(--line2); border: none; border-radius: var(--r-md);
  padding: 12px 14px; font-size: 16px; background: #fff; outline: none; min-height: 50px;
}
.field input:focus, .field select:focus { box-shadow: inset 0 0 0 2.5px var(--brand); }
.avatar-pick { display: flex; gap: 8px; flex-wrap: wrap; }
.avatar-pick button {
  width: 46px; height: 46px; border-radius: 50%; background: #fff; box-shadow: var(--sh-1);
  font-size: 23px; box-shadow: inset 0 0 0 2.5px transparent, var(--sh-1);
}
.avatar-pick button.sel { box-shadow: inset 0 0 0 3px var(--brand), var(--sh-1); }

.modal-mask {
  position: fixed; inset: 0; background: rgba(20, 28, 45, .5); backdrop-filter: blur(3px);
  display: grid; place-items: center; z-index: 60; padding: 16px;
}
.modal {
  background: #fff; border-radius: var(--r-xl); padding: 20px; width: 100%; max-width: 420px;
  box-shadow: var(--sh-3); animation: modalUp .26s var(--ease); max-height: 88vh; overflow-y: auto;
}
@keyframes modalUp { from { transform: translateY(22px) scale(.97); opacity: 0; } to { transform: none; opacity: 1; } }
.modal h3 { margin: 0 0 12px; font-size: 18px; }

.toast {
  position: fixed; left: 50%; top: 16px; transform: translateX(-50%);
  background: rgba(28, 38, 58, .94); color: #fff; padding: 11px 20px; border-radius: 999px;
  z-index: 120; font-size: 14px; font-weight: 700; box-shadow: var(--sh-3);
  animation: toastIn .24s var(--ease); max-width: 88vw; text-align: center;
}
@keyframes toastIn { from { transform: translate(-50%, -12px); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }

/* ---------- 登录 ---------- */
.auth-wrap { max-width: 420px; margin: 0 auto; padding-top: 6vh; }
.auth-brand { text-align: center; margin-bottom: 18px; }
.auth-brand .logo {
  width: 76px; height: 76px; margin: 0 auto 12px; border-radius: 24px; display: grid; place-items: center;
  font-size: 40px; background: linear-gradient(140deg, #5b7cff, #8b5cf6 60%, #ff6fae);
  box-shadow: 0 12px 28px rgba(110, 90, 235, .32);
}
.auth-brand h1 { margin: 0; font-size: 25px; font-weight: 900; letter-spacing: .5px; }
.auth-brand p { margin: 6px 0 0; color: var(--ink2); font-size: 13.5px; line-height: 1.6; }
.auth-tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; background: #eef2fa; padding: 4px; border-radius: 999px; margin-bottom: 18px; }
.auth-tabs button { height: 40px; border-radius: 999px; font-weight: 800; font-size: 14px; color: var(--ink2); }
.auth-tabs button.on { background: #fff; color: var(--brand); box-shadow: var(--sh-1); }

/* ============================================================
   平板 560px+
   ============================================================ */
@media (min-width: 560px) {
  #app { padding: 0 20px calc(48px + var(--safe-b)); }
  .subjects { grid-template-columns: repeat(3, 1fr); gap: 14px; }
  .quick-grid { grid-template-columns: repeat(4, 1fr); }
  .levels { grid-template-columns: repeat(4, 1fr); }
  .tiles { grid-template-columns: repeat(3, 1fr); }
  .ach-grid { grid-template-columns: repeat(4, 1fr); }
  .q-stem { font-size: 21px; }
  .hero h1 { font-size: 24px; }
  .rewards { gap: 12px; }
}

/* ============================================================
   桌面 1024px+
   ============================================================ */
@media (min-width: 1024px) {
  #app { padding: 0 28px 64px; }
  .card { padding: 22px; }
  .subjects { grid-template-columns: repeat(4, 1fr); gap: 16px; }
  .levels { grid-template-columns: repeat(6, 1fr); }
  .tiles { grid-template-columns: repeat(4, 1fr); }
  .ach-grid { grid-template-columns: repeat(6, 1fr); }
  .hero { padding: 26px 28px; }
  .hero h1 { font-size: 27px; }
  .q-stem { font-size: 22px; }
  .q-card { padding: 24px 26px; }
  .opts.two { grid-template-columns: repeat(2, 1fr); gap: 14px; }
  .topbar { gap: 12px; padding: 12px 2px; }
  .action-bar { position: static; background: none; box-shadow: none; padding: 0; margin-top: 16px; max-width: 420px; margin-left: auto; }
  .subj:hover .ic { transform: scale(1.08) rotate(-4deg); }
  .subj .ic { transition: transform .2s var(--ease); }
}

/* 手机横屏 / 超窄屏 */
@media (max-width: 380px) {
  .levels { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .lv { min-height: 98px; padding: 10px 4px 8px; }
  .lv .n { width: 38px; height: 38px; font-size: 16px; }
  .lv .t { font-size: 11.5px; }
  .rewards { grid-template-columns: repeat(2, 1fr); }
  .big-char { font-size: 68px; }
}

/* 降低动效偏好 */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ---------- 迷宫 ---------- */
.maze-wrap { display: grid; place-items: center; gap: 12px; margin: 4px 0 2px; }
.maze-grid {
  display: grid; gap: 2px; width: min(330px, 82vw);
  background: #dbe4f5; padding: 4px; border-radius: 14px;
}
.mz-cell { aspect-ratio: 1 / 1; border-radius: 4px; display: grid; place-items: center; font-size: 20px; transition: background .15s; }
.mz-cell.wall { background: linear-gradient(160deg, #93a8cb, #6b82ad); }
.mz-cell.path { background: #fff; }
.mz-cell.end { background: #fff6e5; }
.mz-cell.hero { background: #eaf0ff; }
.maze-pad { display: grid; gap: 6px; justify-items: center; }
.maze-pad > button, .maze-pad .mp-row button {
  width: 54px; height: 54px; border-radius: 15px; background: #fff;
  box-shadow: var(--sh-1); font-size: 21px; font-weight: 900; transition: transform .12s;
}
.maze-pad > button:active, .maze-pad .mp-row button:active { transform: scale(.93); background: var(--brand-l); }
.maze-pad .mp-row { display: flex; gap: 6px; }
.maze-info { font-size: 13.5px; color: var(--ink2); font-weight: 700; }
.maze-info b { color: var(--brand); font-size: 17px; }

/* ---------- 连连看 ---------- */
.link-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; max-width: 430px; margin: 0 auto; }
.link-card {
  aspect-ratio: 1 / 1.12; border-radius: var(--r-md); display: grid; place-items: center;
  background: linear-gradient(160deg, #6f92ff, var(--brand)); box-shadow: var(--sh-1);
  transition: transform .16s var(--ease), opacity .3s, background .16s;
}
.link-card .lc-tx { font-size: 26px; font-weight: 900; color: #fff; }
.link-card.sel { box-shadow: inset 0 0 0 3px #fff, var(--sh-2); transform: scale(1.05); }
.link-card.bad { background: linear-gradient(160deg, #f2666b, var(--bad)); }
.link-card.gone { opacity: 0; pointer-events: none; transform: scale(.65); }

/* ---------- 数独 ---------- */
.sudoku-grid {
  display: grid; gap: 3px; width: min(330px, 82vw); margin: 0 auto;
  background: #cfd9ec; padding: 3px; border-radius: 14px;
}
.sd-cell {
  aspect-ratio: 1 / 1; background: #fff; border-radius: 4px;
  display: grid; place-items: center; font-size: 22px; font-weight: 900; color: var(--brand);
}
.sd-cell.fixed { background: #f1f5fd; color: var(--ink2); }
.sd-cell.blank { cursor: pointer; }
.sd-cell.br { box-shadow: 2px 0 0 #6b82ad; }
.sd-cell.bb { box-shadow: 0 2px 0 #6b82ad; }
.sd-cell.sel { box-shadow: inset 0 0 0 3px var(--brand); }
.sd-pad { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 14px; }
.sd-pad button {
  min-width: 54px; height: 54px; border-radius: 15px; background: #fff;
  box-shadow: var(--sh-1); font-size: 20px; font-weight: 900; transition: transform .12s;
}
.sd-pad button:active { transform: scale(.93); }
.sd-pad .sd-clear { min-width: auto; padding: 0 16px; font-size: 14px; color: var(--bad); }

/* ---------- 排行榜 ---------- */
.rank-me {
  display: flex; align-items: center; gap: 12px; padding: 14px 16px; margin-bottom: 14px;
  border-radius: var(--r-lg); color: #fff;
  background: linear-gradient(135deg, #5b7cff 0%, #8b5cf6 60%, #ff6fae 100%);
  box-shadow: 0 10px 26px rgba(110, 90, 235, .28);
}
.rank-me .rm-av { width: 48px; height: 48px; border-radius: 50%; background: rgba(255, 255, 255, .25); display: grid; place-items: center; font-size: 25px; }
.rank-me .rm-r { font-size: 13px; opacity: .92; }
.rank-me .rm-n { font-size: 17px; font-weight: 900; }
.rank-list { display: grid; gap: 8px; }
.rank-row {
  display: grid; grid-template-columns: 42px 44px 1fr auto; align-items: center; gap: 10px;
  background: #fff; border-radius: var(--r-md); padding: 10px 12px; box-shadow: var(--sh-1);
}
.rank-row.me { box-shadow: inset 0 0 0 2.5px var(--brand), var(--sh-1); }
.rank-row .rk {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  font-weight: 900; font-size: 14px; background: #f1f5fd; color: var(--ink2);
}
.rank-row.top1 .rk { background: linear-gradient(160deg, #ffd76e, #f0a800); color: #fff; }
.rank-row.top2 .rk { background: linear-gradient(160deg, #dbe3ef, #a9b6cc); color: #fff; }
.rank-row.top3 .rk { background: linear-gradient(160deg, #f0b68a, #c1783c); color: #fff; }
.rank-row .av { width: 40px; height: 40px; border-radius: 50%; background: #f5f8ff; display: grid; place-items: center; font-size: 21px; }
.rank-row .nm { font-weight: 800; font-size: 14.5px; }
.rank-row .sub { font-size: 11.5px; color: var(--ink2); }
.rank-row .sc { text-align: right; font-weight: 900; font-size: 15px; color: var(--brand); }
.rank-row .sc span { display: block; font-size: 11px; color: var(--ink2); font-weight: 700; }

/* ---------- 好友 PK ---------- */
.pk-code {
  font-size: 38px; font-weight: 900; letter-spacing: 8px; text-align: center;
  color: var(--brand); padding: 16px 0 6px; font-family: ui-monospace, Consolas, monospace;
}
.pk-vs { display: grid; grid-template-columns: 1fr 56px 1fr; align-items: center; gap: 8px; }
.pk-side { background: #fff; border-radius: var(--r-md); box-shadow: var(--sh-1); padding: 14px 8px; text-align: center; }
.pk-side .ps-av { font-size: 34px; }
.pk-side .ps-n { font-weight: 800; font-size: 14px; margin-top: 2px; }
.pk-side .ps-s { font-size: 22px; font-weight: 900; color: var(--brand); margin-top: 4px; }
.pk-side.waiting { opacity: .55; }
.pk-vs-mid { text-align: center; font-size: 20px; font-weight: 900; color: var(--ink3); }
.code-input {
  width: 100%; text-align: center; font-size: 26px; font-weight: 900; letter-spacing: 6px;
  text-transform: uppercase; border: 3px solid var(--line2); border-radius: var(--r-md);
  padding: 14px; outline: none; font-family: ui-monospace, Consolas, monospace;
}
.code-input:focus { border-color: var(--brand); }
