:root {
  --ink: #1f2933; --muted: #6b7680; --bg: #f6f1e7; --card: #ffffff; --line: #e6dfd2;
  --navy: #1f3a5f; --accent: #2f6fb3; --gold: #f5b942; --gold-ink: #8a5a00;
  --ok: #2e9e6b; --no: #d9534f; --radius: 16px;
  font-family: "PingFang HK", "Noto Sans TC", "Microsoft JhengHei", system-ui, sans-serif;
  color: var(--ink); background: var(--bg);
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); }
body { min-height: 100dvh; -webkit-tap-highlight-color: transparent; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .5; }
h1, h2, h3, h4 { margin: 0 0 .4em; line-height: 1.25; }
h4 { font-size: 1rem; }
p { margin: .4em 0; line-height: 1.55; }
.muted { color: var(--muted); } .small { font-size: .85rem; } .center { text-align: center; }
.error { color: var(--no); } .ok { color: var(--ok); }
.big { font-size: 1.35rem; font-weight: 700; }
.gold-text { color: var(--gold-ink); font-weight: 700; }
.grow { flex: 1; min-width: 0; }
.boot { display: grid; place-items: center; min-height: 100dvh; color: var(--muted); }

#app { max-width: 480px; margin: 0 auto; min-height: 100dvh; position: relative; }
.screen { padding: 16px 16px 96px; }
.center-screen { display: grid; place-items: center; gap: 12px; min-height: 80dvh; }
.demo-banner { background: #fff4d6; color: var(--gold-ink); font-size: .8rem; text-align: center; padding: 6px 12px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 12px 0; }
.btn { border: 1px solid var(--line); background: #fff; border-radius: 12px; padding: 12px 16px; font-weight: 600; }
.btn.primary { background: var(--navy); color: #fff; border-color: var(--navy); }
.btn.gold { background: var(--gold); border-color: var(--gold); color: #3d2a00; }
.btn.ghost { background: transparent; }
.btn.small { padding: 6px 12px; font-size: .85rem; border-radius: 10px; }
.btn.block { display: block; width: 100%; margin-top: 10px; }
.link { background: none; border: 0; color: var(--accent); padding: 4px 0; }
.icon-btn { background: none; border: 0; font-size: 1.2rem; padding: 6px; }
label { display: block; font-weight: 600; margin: 10px 0 6px; font-size: .9rem; }
input:not([type=checkbox]) { display: block; width: 100%; margin-top: 6px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: #fffdf8; font-size: 1rem; }
label.check { display: flex; gap: 8px; font-weight: 400; align-items: flex-start; }
label.check input { margin-top: 4px; }

.seg { display: flex; background: #ebe4d6; border-radius: 12px; padding: 4px; gap: 4px; margin: 8px 0; }
.seg button { flex: 1; border: 0; background: none; padding: 8px 4px; border-radius: 9px; font-size: .9rem; }
.seg button.on { background: #fff; font-weight: 700; box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.chip-btn { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 6px 14px; font-size: .85rem; }
.chip-btn.on { background: var(--navy); color: #fff; border-color: var(--navy); }
.chip { display: inline-block; color: #fff; border-radius: 999px; padding: 2px 10px; font-size: .75rem; }
.chip.light { background: #efe9dd; color: var(--ink); }
.tag { font-style: normal; font-size: .65rem; background: #efe9dd; color: var(--muted); border-radius: 6px; padding: 1px 5px; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.kv { display: flex; justify-content: space-between; margin: 8px 0 4px; font-size: .9rem; }
.bar { height: 8px; background: #efe9dd; border-radius: 999px; overflow: hidden; margin: 4px 0; }
.bar > div { height: 100%; border-radius: 999px; transition: width .4s; }
.section-title { margin: 16px 0 8px; }
.term { font-size: .8rem; color: var(--muted); margin: 14px 0 4px; font-weight: 700; }

/* auth */
.auth .brand { text-align: center; padding: 24px 0 8px; }
.auth h1 { font-size: 2rem; color: var(--navy); margin-top: 8px; }
.auth h1 span { font-size: 1.1rem; color: var(--gold-ink); letter-spacing: .5px; }
.slogan { font-size: 1.1rem; letter-spacing: .4em; color: var(--navy); font-weight: 600; }

/* profiles */
.top-plain { display: flex; justify-content: space-between; align-items: center; }
.profile-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }
.profile { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.parent-entry { display: block; margin: 24px auto 0; }

/* student shell */
.top { position: sticky; top: 0; z-index: 5; display: flex; justify-content: space-between; align-items: center; background: var(--bg); padding: 8px 0; margin: -8px 0 0; }
.who { display: flex; align-items: center; gap: 8px; background: none; border: 0; text-align: left; padding: 0; }
.who span { display: flex; flex-direction: column; line-height: 1.2; } .who small { color: var(--muted); font-size: .75rem; }
.wallet { display: flex; gap: 10px; font-weight: 700; font-size: .9rem; }
.tabs { position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 480px; display: flex; background: #fff; border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); z-index: 10; }
.tabs button { flex: 1; background: none; border: 0; padding: 8px 0 10px; font-size: .75rem; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 2px; }
.tabs button span { font-size: 1.3rem; } .tabs button.on { color: var(--navy); font-weight: 700; }

.pet-card { display: flex; align-items: center; gap: 12px; background: linear-gradient(160deg, #fffaf0, #fff); }
.pet-card .pet-info { flex: 1; min-width: 0; }
.pet-card h3 small { font-size: .75rem; font-weight: 400; }
.stage { font-weight: 700; color: var(--gold-ink); font-size: .9rem; }
.big-pet { flex-direction: column; text-align: center; }
.big-pet .bar { width: 100%; }
.stages { display: flex; gap: 6px; justify-content: center; margin: 6px 0; }
.stages span { font-size: .75rem; padding: 3px 8px; border-radius: 999px; background: #efe9dd; color: var(--muted); }
.stages span.on { background: var(--gold); color: #3d2a00; font-weight: 700; }
.fact { background: #f3f7f1; border-radius: 10px; padding: 8px 10px; text-align: left; }
.task { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px dashed var(--line); font-size: .92rem; }
.task.claimed { color: var(--muted); }

.subject-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 12px 0; }
.subject { background: #fff; border: 1px solid var(--line); border-top: 4px solid var(--sub); border-radius: 14px; padding: 12px 6px; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.subject small { color: var(--muted); font-size: .7rem; }
.glyph { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; background: var(--sub); color: #fff; font-weight: 800; flex-shrink: 0; }
.subject-list { display: flex; flex-direction: column; gap: 10px; }
.subject-row { display: flex; align-items: center; gap: 12px; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 12px; text-align: left; }
.subject-head { display: flex; gap: 12px; align-items: center; border-left: 5px solid var(--sub); }
.subject-head h3 { margin: 0; }
.topic { display: flex; align-items: center; gap: 10px; width: 100%; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin: 6px 0; text-align: left; font-size: .92rem; }
.topic.lit { background: #fff8e6; border-color: #f3d898; }
.lamp { width: 24px; text-align: center; color: var(--muted); }

/* session */
.session { padding-top: 8px; }
.session-head { display: flex; align-items: center; gap: 10px; }
.q-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-top: 12px; }
.q-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.stars { color: var(--gold); margin-left: auto; letter-spacing: 1px; }
.passage { background: #fbf8f1; border-radius: 12px; padding: 8px 12px; margin: 12px 0 0; }
.passage-text { white-space: pre-wrap; line-height: 1.7; font-size: .95rem; padding: 4px 0 6px; }
.stem { font-size: 1.08rem; font-weight: 600; white-space: pre-wrap; margin: 14px 0; line-height: 1.6; }
.options { display: flex; flex-direction: column; gap: 10px; }
.opt { display: flex; gap: 10px; align-items: flex-start; text-align: left; background: #fff; border: 2px solid var(--line); border-radius: 12px; padding: 12px; font-size: 1rem; line-height: 1.45; }
.opt:disabled { opacity: 1; cursor: default; }
.opt-key { flex-shrink: 0; width: 26px; height: 26px; border-radius: 8px; background: #efe9dd; display: grid; place-items: center; font-weight: 700; font-size: .85rem; }
.opt.right { border-color: var(--ok); background: #eaf7f0; } .opt.right .opt-key { background: var(--ok); color: #fff; }
.opt.wrong { border-color: var(--no); background: #fdeeee; } .opt.wrong .opt-key { background: var(--no); color: #fff; }
.fill { display: flex; gap: 8px; align-items: flex-end; } .fill input { margin: 0; }
.feedback { margin-top: 14px; border-radius: 12px; padding: 12px; }
.feedback.ok { background: #eaf7f0; } .feedback.no { background: #fdf1e8; }
.feedback > b { font-size: 1.1rem; }
.review-note { font-size: .75rem; color: var(--muted); border-top: 1px dashed var(--line); padding-top: 6px; }

/* pet screen */
.box-row { display: flex; gap: 10px; } .box-row .btn { flex: 1; }
.items { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.item { position: relative; background: #fff; border: 2px solid var(--line); border-radius: 12px; padding: 8px 2px; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: .68rem; }
.item.rare { border-color: #a9c6ef; } .item.epic { border-color: #f0cf7d; background: #fffaf0; }
.item.locked { background: #f4f1ea; color: var(--muted); } .item:disabled { opacity: 1; }
.item.equipped { box-shadow: 0 0 0 3px var(--navy); }
.item-icon { font-size: 1.6rem; line-height: 1.2; }
.item em { position: absolute; top: 2px; right: 4px; font-style: normal; font-size: .65rem; color: var(--muted); }
.item .tag { position: absolute; top: -6px; left: 4px; }
.reveal-icon { font-size: 4rem; animation: pop .6s ease-out; }
.reveal.epic .reveal-icon { filter: drop-shadow(0 0 12px #f5b942); }
@keyframes pop { 0% { transform: scale(.2) rotate(-20deg); opacity: 0; } 70% { transform: scale(1.15); } 100% { transform: scale(1); opacity: 1; } }
.odds { width: 100%; border-collapse: collapse; font-size: .9rem; } .odds th, .odds td { padding: 6px; border-bottom: 1px solid var(--line); text-align: center; }

/* leaderboard */
.board { list-style: none; padding: 0; margin: 8px 0; }
.board li { display: flex; align-items: center; gap: 10px; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 6px 12px; margin: 6px 0; }
.board li.me { border-color: var(--navy); background: #eef3fa; }
.rank { width: 28px; text-align: center; font-weight: 700; }

/* parent */
.report-head { display: flex; align-items: center; gap: 12px; }
.report-head h3 { margin: 0; }
.index { text-align: center; } .index small { display: block; color: var(--muted); font-size: .7rem; } .index b { font-size: 1.5rem; color: var(--navy); }
.subj-acc { display: flex; align-items: center; gap: 10px; margin: 8px 0; font-size: .88rem; }
.subj-acc .name { width: 84px; flex-shrink: 0; } .subj-acc .num { width: 92px; text-align: right; flex-shrink: 0; }
.weak { padding-left: 18px; margin: 4px 0; font-size: .9rem; } .weak li { margin: 4px 0; }
.week-chart { display: flex; gap: 6px; align-items: flex-end; }
.week-chart .day { flex: 1; display: flex; flex-direction: column; align-items: center; font-size: .7rem; }
.week-chart .col { height: 90px; width: 100%; display: flex; align-items: flex-end; background: #f7f3ea; border-radius: 6px; }
.week-chart .col div { width: 100%; background: var(--accent); border-radius: 6px; min-height: 2px; }
.plan.current { border: 2px solid var(--gold); }
.plan ul { padding-left: 18px; }
.guardian-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.guardian-pick button { background: #fff; border: 2px solid var(--line); border-radius: 14px; padding: 8px; display: flex; flex-direction: column; align-items: center; }
.guardian-pick button.on { border-color: var(--navy); background: #eef3fa; }
.guardian-pick small { color: var(--muted); font-size: .72rem; }

/* modal, pin, toast */
.modal-back { position: fixed; inset: 0; background: rgba(20, 28, 38, .45); display: grid; place-items: end center; z-index: 50; }
.modal { background: #fff; width: 100%; max-width: 480px; border-radius: 20px 20px 0 0; padding: 16px 16px calc(20px + env(safe-area-inset-bottom)); max-height: 90dvh; overflow: auto; animation: up .25s ease-out; }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
.modal-head { display: flex; justify-content: space-between; align-items: center; }
.modal-head h3 { margin: 0; }
.pin-dots { display: flex; justify-content: center; gap: 14px; margin: 16px 0; }
.pin-dots span { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--navy); }
.pin-dots span.on { background: var(--navy); }
.pin-pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; max-width: 280px; margin: 0 auto; }
.pin-pad button { padding: 16px; font-size: 1.3rem; border-radius: 14px; border: 1px solid var(--line); background: #faf7f0; }
.toast { position: fixed; bottom: 84px; left: 50%; transform: translateX(-50%); background: var(--navy); color: #fff; padding: 10px 16px; border-radius: 12px; font-size: .9rem; z-index: 60; max-width: 90vw; text-align: center; }

.sample-row { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin: 12px 0 6px; }

/* 分步提示 and new question types (2026-11-21) */
.tutor { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.hint { background: #fff8e6; border: 1px solid #f5d99a; border-radius: 12px; padding: 8px 12px; font-size: .95rem; }
.hint-n { display: block; font-size: .8rem; font-weight: 700; color: var(--gold-ink); margin-bottom: 2px; }
.options.tf { grid-template-columns: 1fr 1fr; }
.order-picked { margin: 8px 0; padding-left: 1.4em; display: flex; flex-direction: column; gap: 6px; }
.order-picked li { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 6px 10px; }
.order-picked li.right { border-color: var(--ok); background: #eaf7f0; } .order-picked li.wrong { border-color: var(--no); background: #fdecec; }
.order-pool { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.match-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 8px 0 10px; }
.match-grid > div { display: flex; flex-direction: column; gap: 8px; }
.match-grid .opt.sel { outline: 3px solid var(--accent); } .match-grid .opt.used { opacity: .45; }
.match-to { display: block; font-size: .8rem; color: var(--accent); }
.steps { display: flex; flex-direction: column; gap: 10px; }
.step { display: flex; flex-direction: column; gap: 4px; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; }
.step.right { border-color: var(--ok); } .step.wrong { border-color: var(--no); }
.step-in { display: flex; align-items: center; gap: 6px; } .step-in input { flex: 1; min-width: 0; }
.match-grid .opt { flex-direction: column; align-items: flex-start; text-align: left; }
