:root {
  --ink: #33407a;
  --ink-soft: #6b76ad;
  --bg1: #fff7e6;
  --bg2: #e9f1ff;
  --card: #ffffff;
  --line: #d9def5;
  --primary: #6c5ce7;
  --primary-dark: #5445c9;
  --accent: #20c9a6;
  --warn: #e8590c;
  --radius: 22px;
  --font: ui-rounded, 'PingFang SC', 'Hiragino Maru Gothic ProN', 'Microsoft YaHei', system-ui, sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: linear-gradient(160deg, var(--bg1), var(--bg2)) fixed;
  min-height: 100vh;
  line-height: 1.55;
}
#app { max-width: 640px; margin: 0 auto; padding: 14px 14px calc(28px + env(safe-area-inset-bottom)); }
h1, h2, h3 { margin: 0; line-height: 1.3; }
p { margin: 0 0 8px; }
.loading { text-align: center; padding: 40px; }

.hero { text-align: center; padding: 10px 0 6px; }
.hero h1 { font-size: 30px; letter-spacing: 1px; margin-top: 4px; }
.hero.small h1 { font-size: 24px; }
.hero .tagline { font-size: 12px; color: var(--ink-soft); margin: 2px 0 4px; }
.hero .sub { color: var(--ink-soft); margin: 4px 0 2px; }
.hero .tag {
  display: inline-block; background: #fff; border: 2px solid var(--line); border-radius: 999px;
  padding: 2px 14px; font-size: 14px; color: var(--ink-soft);
}
.mascot { display: block; margin: 0 auto; }

.card {
  background: var(--card); border: 2px solid var(--line); border-radius: var(--radius);
  padding: 16px; margin: 12px 0; box-shadow: 0 6px 0 rgba(108, 118, 173, 0.12);
}
.card h2 { font-size: 20px; margin-bottom: 4px; }
.meta { color: var(--ink-soft); margin-bottom: 6px; }
.hint { color: var(--ink-soft); font-size: 14px; }
.lead { font-size: 17px; }

.ages { display: flex; flex-wrap: wrap; gap: 10px; }
.chip {
  font: inherit; font-size: 18px; font-weight: 700; color: var(--ink); background: #f3f5ff;
  border: 3px solid var(--line); border-radius: 999px; padding: 8px 20px; min-width: 76px; cursor: pointer;
}
.chip.on { background: var(--primary); border-color: var(--primary-dark); color: #fff; }

.btn {
  font: inherit; font-weight: 800; font-size: 18px; border-radius: 999px; padding: 12px 26px;
  border: 3px solid transparent; cursor: pointer; transition: transform 0.08s;
}
.btn:active:not(:disabled) { transform: translateY(2px); }
.btn.primary { background: var(--primary); color: #fff; border-color: var(--primary-dark); box-shadow: 0 5px 0 var(--primary-dark); }
.btn.primary.finish { background: var(--accent); border-color: #12a487; box-shadow: 0 5px 0 #12a487; }
.btn.ghost { background: #fff; color: var(--ink); border-color: var(--line); }
.btn.big { display: block; width: 100%; font-size: 20px; padding: 15px; margin: 14px 0 8px; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; box-shadow: none; }

.notice { font-size: 13px; color: var(--ink-soft); background: rgba(255, 255, 255, 0.7); border-radius: 14px; padding: 10px 12px; margin: 10px 0; }
.notice.small { background: none; text-align: center; padding: 4px; }
.notice.disclaimer.top { text-align: center; background: #fff6dc; color: var(--ink); }
.facts { padding-left: 20px; margin: 8px 0 0; }
.facts li { margin: 4px 0; }

/* 答题 */
.topbar { position: sticky; top: 0; z-index: 5; background: linear-gradient(var(--bg1) 70%, rgba(255, 247, 230, 0)); padding: 6px 0 10px; }
.progress { height: 14px; background: #fff; border: 2px solid var(--line); border-radius: 999px; overflow: hidden; }
.bar { height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), #7bd3b1); border-radius: 999px; transition: width 0.25s; }
.row { display: flex; justify-content: space-between; align-items: center; margin-top: 6px; }
.row.gap { gap: 10px; justify-content: stretch; }
.row.gap .btn { flex: 1; }
.count { font-weight: 800; }
.timer {
  display: inline-flex; align-items: center; gap: 6px; background: #fff; border: 2px solid var(--line);
  border-radius: 999px; padding: 2px 12px; font-variant-numeric: tabular-nums;
}
.timer.warn { color: #fff; background: var(--warn); border-color: var(--warn); animation: pulse 1s infinite; }
@keyframes pulse { 50% { transform: scale(1.06); } }

.qcard { padding: 14px; }
.kind { display: inline-block; font-size: 13px; font-weight: 800; color: var(--primary-dark); background: #ece9ff; border-radius: 999px; padding: 1px 12px; }
.prompt { font-size: 19px; margin: 8px 0 10px; }
.stem { display: flex; justify-content: center; margin: 8px 0 12px; }
.stem svg { display: block; }

.opts { display: grid; gap: 10px; grid-template-columns: repeat(2, 1fr); }
.opts.cols-1 { grid-template-columns: 1fr; }
.opt {
  padding: 6px 6px 6px; border: 4px solid transparent; border-radius: 22px; background: none; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 4px; font: inherit;
}
.opt svg { display: block; width: 100%; }
.opt .letter {
  min-width: 30px; height: 28px; padding: 0 10px; border-radius: 999px;
  background: var(--ink); color: #fff; font-weight: 800; font-size: 15px; display: inline-grid; place-items: center;
}
.opt[aria-pressed='true'] { border-color: var(--primary); background: #ece9ff; box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.25); }
.opt[aria-pressed='true'] .letter { background: var(--primary); }
.opt[aria-pressed='true'] .letter::after { content: ' ✓'; white-space: pre; }

.pager { display: flex; gap: 10px; margin: 6px 0 10px; }
.pager .btn { flex: 1; }
.dots { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.dot {
  font: inherit; font-size: 13px; font-weight: 800; width: 34px; height: 34px; border-radius: 50%; padding: 0;
  border: 2px solid var(--line); background: #fff; color: var(--ink); cursor: pointer;
}
.dot.done { background: #d8f5ec; border-color: var(--accent); }
.dot.cur { background: var(--primary); border-color: var(--primary-dark); color: #fff; }

.modal { position: fixed; inset: 0; background: rgba(51, 64, 122, 0.45); display: grid; place-items: center; z-index: 20; padding: 20px; }
.modal[hidden] { display: none; }
.dialog { background: #fff; border-radius: var(--radius); padding: 22px; max-width: 360px; width: 100%; }
.dialog h3 { font-size: 22px; margin-bottom: 6px; }
.dialog .row { margin-top: 12px; }

/* 结果 */
.score-card { text-align: center; }
.label { font-size: 14px; font-weight: 800; color: var(--ink-soft); margin-bottom: 0; }
.big-num { margin: 0; }
.big-num b { font-size: 64px; line-height: 1.1; color: var(--primary); }
.big-num span { font-size: 22px; font-weight: 800; }
.pct-card { text-align: center; }
.pct { font-size: 34px; font-weight: 900; color: var(--accent); margin: 2px 0 6px; }
.pct.muted { color: var(--ink-soft); }
.placeholder { background: #fff6dc; border: 2px dashed #e0b24a; border-radius: 999px; padding: 0 10px; margin-left: 6px; font-size: 12px; color: #8a5a00; }
.fine { font-size: 12px; color: var(--ink-soft); margin-top: 6px; }
.dims { list-style: none; padding: 0; margin: 10px 0 0; }
.dim { padding: 12px 0; border-top: 2px dashed var(--line); }
.dim:first-child { border-top: 0; }
.dim-head { display: flex; justify-content: space-between; align-items: center; }
.badge { font-size: 12px; font-weight: 800; border-radius: 999px; padding: 1px 10px; background: #ece9ff; color: var(--primary-dark); }
.dim.strong .badge { background: #d8f5ec; color: #0c7a63; }
.dim.practice .badge { background: #fff0e0; color: #a64b00; }
.meter { height: 12px; background: #eef0fb; border-radius: 999px; overflow: hidden; margin: 6px 0 2px; }
.meter i { display: block; height: 100%; background: var(--primary); border-radius: 999px; }
.dim.strong .meter i { background: var(--accent); }
.dim.practice .meter i { background: #ffa94d; }
.dim-score { font-size: 13px; color: var(--ink-soft); }
details summary { cursor: pointer; font-weight: 800; color: var(--primary-dark); font-size: 14px; }

@media (min-width: 640px) {
  .opts { grid-template-columns: repeat(4, 1fr); }
  .opts.cols-1 { grid-template-columns: 1fr 1fr; }
  .hero h1 { font-size: 36px; }
}
@media (prefers-reduced-motion: reduce) {
  .timer.warn { animation: none; }
  .btn, .bar { transition: none; }
}

.notice.fineprint { font-size: 11px; line-height: 1.5; }
.stats { display: flex; justify-content: center; gap: 8px; margin: 8px 0 0; text-align: center; }
.stats > div { flex: 1; background: #f3f5ff; border-radius: 12px; padding: 6px 4px; }
.stats dt { font-size: 12px; color: var(--ink-soft); }
.stats dd { margin: 0; font-size: 17px; font-weight: 800; }
.tips-title { font-size: 13px; font-weight: 800; color: var(--primary-dark); margin: 8px 0 2px; }
.tips { margin: 0; padding-left: 20px; font-size: 14px; }
.tips li { margin-bottom: 4px; }
.infos .info { padding: 0; }
.infos .info summary { padding: 14px 16px; min-height: 44px; font-size: 17px; }
.info-body { padding: 0 16px 16px; font-size: 14px; }
.info-body h3 { font-size: 15px; margin: 12px 0 4px; color: var(--primary-dark); }
.info-body ul { padding-left: 20px; margin: 4px 0 8px; }
.info-body li { margin-bottom: 4px; }

.share-out { text-align: center; }
.share-out[hidden], #share-error[hidden] { display: none; }
.share-out img { display: block; width: 100%; max-width: 360px; height: auto; margin: 0 auto 10px; border-radius: 14px; border: 2px solid var(--line); -webkit-touch-callout: default; user-select: auto; }
.share-out .btn { display: inline-block; text-decoration: none; }
