/* 配色沿用天津转学测评：深海蓝 + 薄荷绿 */
:root {
  --deep: #0b365b;
  --night: #082946;
  --mint: #8fd5b5;
  --mint-deep: #3f9c78;
  --mint-soft: #c9eddd;
  --paper: #f5f7f6;
  --card: #ffffff;
  --fog: #e8eff1;
  --ink: #172733;
  --muted: #5d7180;
  --line: #d8e2e6;
  --amber: #c98a12;
  --amber-soft: #fbf1dc;
  --red: #b5473a;
  --red-soft: #f8e6e3;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", Arial, sans-serif;
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
}
button, input, textarea { font: inherit; }
button { -webkit-tap-highlight-color: transparent; cursor: pointer; }
.hidden { display: none !important; }

/* 顶栏 */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 10px;
  height: 52px; padding: 0 16px;
  background: var(--night); color: #fff;
}
.topbar-logo { width: 32px; height: 32px; border-radius: 7px; }
.topbar-title { font-weight: 600; font-size: 15px; }
.topbar-timer {
  margin-left: auto; padding: 3px 10px; border-radius: 99px;
  background: rgba(143, 213, 181, .16); color: var(--mint-soft);
  font-size: 14px; font-variant-numeric: tabular-nums;
}
.topbar-timer.low { background: rgba(241, 140, 110, .22); color: #ffd2c4; }

main { max-width: 560px; margin: 0 auto; }
.view { padding: 20px 16px 40px; }

/* 按钮 */
.btn-primary {
  display: block; width: 100%;
  min-height: 50px; border: 0; border-radius: 10px;
  background: var(--mint); color: var(--night);
  font-size: 17px; font-weight: 700;
}
.btn-primary:disabled { background: var(--line); color: #8a9aa5; cursor: not-allowed; }
.btn-ghost {
  min-height: 50px; padding: 0 18px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--card); color: var(--muted);
  font-size: 15px;
}
.btn-ghost:disabled { opacity: .45; cursor: not-allowed; }
.btn-ghost.wide { display: block; width: 100%; margin-top: 10px; }
.link-btn { border: 0; background: none; padding: 4px 0; color: var(--mint-deep); font-size: 13px; font-weight: 600; }

/* 开场页 */
#introView { padding: 0; }
.hero {
  position: relative; overflow: hidden;
  min-height: calc(100vh - 52px);
  padding: 40px 24px 32px;
  display: flex; flex-direction: column;
  color: #fff;
  background:
    radial-gradient(circle at 88% 10%, rgba(143, 213, 181, .24), transparent 42%),
    radial-gradient(circle at 8% 96%, rgba(241, 189, 86, .16), transparent 45%),
    linear-gradient(168deg, #12517f 0%, #0b365b 46%, #072640 100%);
}
.hero > *:not(.hero-deco) { position: relative; }
.hero-deco { position: absolute; top: 56px; right: -14px; width: 150px; height: 150px; opacity: .7; }
.deco-ring { fill: none; stroke: var(--mint); stroke-width: 1.2; opacity: .45; }
.deco-ring.thin { stroke-dasharray: 3 5; opacity: .6; }
.deco-book { fill: rgba(143, 213, 181, .18); stroke: var(--mint); stroke-width: 1.6; stroke-linejoin: round; }
.deco-line { stroke: var(--mint); stroke-width: 1.4; }
.deco-star { fill: #f1d08a; }
.eyebrow { margin: 0 0 10px; font-size: 13px; letter-spacing: .08em; color: var(--mint); }
.eyebrow.dark { color: var(--mint-deep); }
.eyebrow.hero-chip {
  align-self: flex-start; display: inline-flex; align-items: center;
  height: 28px; padding: 0 14px; border-radius: 99px; line-height: 1;
  border: 1px solid rgba(143, 213, 181, .45); background: rgba(143, 213, 181, .14);
  color: var(--mint-soft); font-size: 12px; letter-spacing: .04em;
}
.hero h1 { margin: 18px 0 14px; font-size: 40px; line-height: 1.2; }
.h1-accent { color: var(--mint); }
.lead { margin: 0 0 26px; color: #d4e2ea; font-size: 16px; }
.pick-label { margin: 0 0 10px; font-size: 14px; color: #f1d08a; }
.subjects { display: grid; gap: 10px; }
.subject {
  display: flex; align-items: center; gap: 14px; width: 100%;
  padding: 14px 16px; border-radius: 14px; text-align: left; color: #fff;
  border: 1px solid rgba(255, 255, 255, .14); background: rgba(255, 255, 255, .07);
}
.subject:disabled { opacity: .5; cursor: not-allowed; }
.subject-icon {
  flex: none; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px;
  background: var(--mint); color: var(--night); font-size: 20px; font-weight: 800;
}
.subject:disabled .subject-icon { background: rgba(255, 255, 255, .2); color: #fff; }
.subject-text { flex: 1; min-width: 0; }
.subject-text strong { display: block; font-size: 17px; }
.subject-text span { font-size: 13px; color: #b9cbd6; }
.subject-go { color: var(--mint); font-size: 14px; font-weight: 600; white-space: nowrap; }
.subject-go.done { color: #f1d08a; }
.micro { margin: 18px 0 0; text-align: center; font-size: 12px; color: #9db2be; }
.hero-brand { display: flex; align-items: center; justify-content: center; gap: 8px; margin: auto 0 0; padding-top: 22px; font-size: 12px; color: #9db2be; }
.hero-brand img { width: 22px; height: 22px; border-radius: 5px; }

/* 说明页、留资 */
.lead-card { padding: 26px 20px; border-radius: 14px; background: var(--card); border: 1px solid var(--line); }
.lead-card h2 { margin: 0 0 8px; font-size: 22px; color: var(--deep); }
.lead-desc { margin: 0 0 16px; color: var(--muted); font-size: 14px; }
.rules { margin: 0 0 22px; padding: 12px 14px 12px 32px; border-radius: 10px; background: var(--fog); font-size: 14px; color: #33495a; }
.field { display: block; margin-bottom: 14px; }
.field span { display: block; margin-bottom: 6px; font-size: 14px; font-weight: 600; }
.field .opt { font-style: normal; font-weight: 400; font-size: 12px; color: var(--muted); margin-left: 4px; }
.field input, .text-input {
  width: 100%; min-height: 50px; padding: 0 14px;
  border: 1.5px solid var(--line); border-radius: 10px;
  background: var(--card); color: var(--ink); font-size: 16px;
}
.text-area {
  width: 100%; min-height: 150px; padding: 12px 14px; resize: vertical;
  border: 1.5px solid var(--line); border-radius: 10px;
  background: var(--card); color: var(--ink); font-size: 16px; line-height: 1.6;
}
.field input:focus, .text-input:focus, .text-area:focus { outline: none; border-color: var(--mint-deep); }
.consent { display: flex; gap: 8px; align-items: flex-start; margin: 4px 0 8px; font-size: 13px; color: var(--muted); }
.consent input { margin-top: 3px; width: 18px; height: 18px; flex: none; accent-color: var(--mint-deep); }
.form-error { min-height: 20px; margin: 0 0 8px; color: var(--red); font-size: 14px; }

/* 答题 */
.progress { height: 6px; border-radius: 3px; background: var(--fog); overflow: hidden; }
.progress-bar { height: 100%; width: 0; background: var(--mint-deep); transition: width .25s; }
.q-meta { display: flex; justify-content: space-between; align-items: center; margin: 10px 0 10px; font-size: 13px; color: var(--mint-deep); font-weight: 600; }
.q-meta b { color: var(--muted); font-weight: 400; }

.passage { margin-bottom: 12px; border-radius: 12px; border: 1px solid var(--line); background: #fbfcfc; }
.passage summary {
  padding: 10px 14px; font-size: 14px; font-weight: 600; color: var(--deep);
  list-style: none; cursor: pointer;
}
.passage summary::-webkit-details-marker { display: none; }
.passage summary::after { content: '收起'; float: right; font-weight: 400; color: var(--mint-deep); font-size: 13px; }
.passage:not([open]) summary::after { content: '展开阅读材料'; }
.passage-body { max-height: 46vh; overflow-y: auto; padding: 0 14px 12px; font-size: 15px; line-height: 1.85; -webkit-overflow-scrolling: touch; }
.passage-body p { margin: 0 0 8px; text-indent: 2em; }
.passage-body p.poem { text-indent: 0; text-align: center; line-height: 2; }
.note-s { font-size: 13px; color: var(--muted); text-indent: 0 !important; }

.q-card { padding: 16px; border-radius: 14px; background: var(--card); border: 1px solid var(--line); }
.q-no { margin: 0 0 6px; font-size: 13px; color: var(--muted); }
.q-no b { color: var(--deep); font-size: 15px; margin-right: 6px; }
.q-stem { margin-bottom: 14px; font-size: 17px; line-height: 1.75; color: var(--ink); }
.q-stem b { display: inline-block; margin-top: 6px; font-weight: 600; color: var(--deep); }
.options { display: grid; gap: 10px; }
.option {
  display: flex; align-items: flex-start; gap: 12px;
  width: 100%; min-height: 52px; padding: 12px 14px;
  border: 1.5px solid var(--line); border-radius: 12px;
  background: var(--card); color: var(--ink);
  text-align: left; font-size: 16px; line-height: 1.65;
}
.option.selected { border-color: var(--mint-deep); background: #eef8f3; }
.opt-mark {
  flex: none; display: grid; place-items: center;
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--fog); color: var(--deep); font-size: 13px; font-weight: 700;
}
.option.selected .opt-mark { background: var(--mint-deep); color: #fff; }
.opt-text { flex: 1; min-width: 0; padding-top: 1px; }
.fill-hint { margin: 8px 0 0; font-size: 13px; color: var(--muted); }
.q-nav { display: grid; grid-template-columns: auto 1fr; gap: 10px; margin-top: 18px; }

/* 题面排版：加点字、画线、分数、根号、分段函数 */
em.dot { font-style: normal; -webkit-text-emphasis: dot; text-emphasis: dot; -webkit-text-emphasis-position: under; text-emphasis-position: under right; }
u { text-underline-offset: 4px; }
u.wave { text-decoration-style: wavy; text-decoration-color: var(--mint-deep); }
.frac { display: inline-flex; flex-direction: column; align-items: center; vertical-align: middle; margin: 0 2px; font-size: .9em; line-height: 1.25; }
.frac > span:first-child { padding: 0 2px; border-bottom: 1px solid currentColor; }
.frac > span:last-child { padding: 0 2px; }
.root { white-space: nowrap; }
.root sup { font-size: .65em; margin-right: -4px; }
.rad { border-top: 1px solid currentColor; padding: 0 2px; }
.piece { display: inline-flex; flex-direction: column; vertical-align: middle; padding-left: 8px; border-left: 2px solid currentColor; border-radius: 6px 0 0 6px; line-height: 1.9; }

/* 答题卡 */
.sheet-mask { position: fixed; inset: 0; z-index: 40; display: flex; align-items: flex-end; justify-content: center; background: rgba(8, 41, 70, .55); }
.sheet { width: 100%; max-width: 560px; padding: 16px 16px calc(16px + env(safe-area-inset-bottom)); border-radius: 16px 16px 0 0; background: var(--card); }
.sheet-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; color: var(--deep); }
.sheet-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin-bottom: 12px; }
.cell { min-height: 44px; border-radius: 10px; border: 1.5px solid var(--line); background: var(--card); color: var(--muted); font-size: 13px; line-height: 1.2; }
.cell.done { border-color: var(--mint-deep); background: #eef8f3; color: var(--deep); font-weight: 600; }
.cell.cur { box-shadow: 0 0 0 2px var(--mint); }
.sheet-tip { margin: 0 0 12px; font-size: 13px; color: var(--muted); }
.sheet-tip.warn { color: var(--amber); }

/* 报告 */
#reportView { padding-top: 0; }
.r-cover { position: relative; overflow: hidden; margin: 0 -16px 16px; padding: 28px 22px 24px; background: var(--deep); color: #fff; }
.r-cover > *:not(.r-deco) { position: relative; }
.r-deco { position: absolute; top: 14px; right: -10px; width: 120px; height: 120px; opacity: .5; }
.r-cover h2 { margin: 0 0 4px; font-size: 24px; }
.r-sub { margin: 0 0 18px; color: #c4d4de; font-size: 14px; }
.rate { padding: 16px; border-radius: 12px; background: rgba(255, 255, 255, .08); border-left: 5px solid var(--mint); }
.rate span { display: block; font-size: 13px; color: #c4d4de; }
.rate strong { display: block; margin: 2px 0 8px; font-size: 34px; line-height: 1.2; color: var(--mint); font-variant-numeric: tabular-nums; }
.rate-bar { position: relative; height: 8px; border-radius: 4px; background: rgba(255, 255, 255, .14); }
.rate-bar i { position: absolute; top: 0; bottom: 0; border-radius: 4px; background: var(--mint); }
.rate-scale { display: flex; justify-content: space-between; margin-top: 4px; font-size: 11px; color: #9db2be; }
.r-explain { margin: 12px 0 0; font-size: 13px; color: #c4d4de; }

.r-sec { margin-bottom: 14px; padding: 18px 16px; border-radius: 14px; background: var(--card); border: 1px solid var(--line); }
.r-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; padding-bottom: 10px; border-bottom: 2px solid var(--mint-soft); }
.r-no { font-size: 13px; font-weight: 700; color: var(--mint-deep); }
.r-head h3 { margin: 0; font-size: 18px; color: var(--deep); }
.r-sec > p { margin: 0 0 10px; font-size: 15px; }
.fine { font-size: 12.5px !important; color: var(--muted); }

.weak-list { display: grid; gap: 8px; }
.weak { padding: 12px; border-radius: 10px; background: var(--red-soft); }
.weak.part { background: var(--amber-soft); }
.weak-top { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-bottom: 4px; }
.weak-top strong { color: var(--deep); }
.weak p { margin: 0; font-size: 14px; color: #33495a; }
.tag { font-style: normal; font-size: 11.5px; padding: 1px 7px; border-radius: 99px; background: rgba(255, 255, 255, .7); color: var(--muted); }
.tag-weak { background: var(--red); color: #fff; }
.tag-part { background: var(--amber); color: #fff; }
.tag-good { background: var(--mint-deep); color: #fff; }

.groups { display: grid; gap: 12px; }
.group-name { margin: 0 0 6px; font-size: 14px; font-weight: 700; color: var(--deep); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: 99px; font-size: 13px; background: var(--fog); color: var(--ink); }
.chip.good::before { content: '✓'; color: var(--mint-deep); font-weight: 700; }
.chip.part::before { content: '△'; color: var(--amber); font-weight: 700; }
.chip.weak::before { content: '✗'; color: var(--red); font-weight: 700; }
.chip.untested { background: transparent; border: 1px dashed var(--line); color: var(--muted); }

.review { border-top: 1px solid var(--line); }
.review summary { padding: 12px 0 0; font-size: 14px; font-weight: 600; color: var(--mint-deep); cursor: pointer; }
.rv { padding: 10px 0; border-bottom: 1px dashed var(--line); font-size: 14px; }
.rv:last-child { border-bottom: 0; }
.rv-top { display: flex; justify-content: space-between; gap: 8px; }
.rv-top b { color: var(--deep); }
.rv-ok { color: var(--mint-deep); font-weight: 600; }
.rv-bad { color: var(--red); font-weight: 600; }
.rv-mid { color: var(--amber); font-weight: 600; }
.rv p { margin: 4px 0 0; color: #33495a; }
.rv .ref { padding: 8px 10px; border-radius: 8px; background: var(--fog); }

.r-cta { margin: 18px 0 14px; padding: 24px 18px; border-radius: 14px; background: var(--deep); color: #fff; text-align: center; }
.r-cta h3 { margin: 0 0 8px; font-size: 20px; }
.r-cta > p { margin: 0 0 16px; font-size: 14px; color: #d4e2ea; text-align: left; }
/* 用 block 居中而不是 inline-block：生成报告图片时 inline-block 里的二维码会丢失 */
.qr-wrap { display: block; width: 200px; margin: 0 auto; padding: 10px; border-radius: 12px; background: #fff; }
.qr-wrap img { display: block; width: 180px; height: 180px; object-fit: contain; }
.qr-tip { margin: 10px 0 0 !important; color: var(--mint) !important; text-align: center !important; }
.disclaimer { font-size: 12px; color: var(--muted); text-align: center; margin: 0 8px 14px; }
.r-actions { display: grid; gap: 10px; }

/* 报告图片预览 */
.shot-mask { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; padding: 16px; background: var(--night); }
.shot-box { display: flex; flex-direction: column; width: 100%; max-width: 420px; max-height: 100%; }
.shot-tip { margin: 0 0 10px; text-align: center; color: var(--mint); font-weight: 600; }
.shot-img { flex: 1; min-height: 0; overflow-y: auto; border-radius: 10px; background: #fff; -webkit-overflow-scrolling: touch; }
.shot-img img { display: block; width: 100%; -webkit-touch-callout: default; -webkit-user-select: auto; user-select: auto; }
.shot-btns { display: grid; gap: 10px; margin-top: 12px; }
.shot-btns .btn-primary { display: grid; place-items: center; text-decoration: none; }
.shot-btns .btn-ghost { background: transparent; color: #fff; border-color: rgba(255, 255, 255, .35); }
.nw { white-space: nowrap; }
