/* 初一新生入学信息表 · 移动端样式（先手机，桌面居中收窄） */
:root {
  /* 取自校徽：藏蓝主色 + 金棕点缀 */
  --brand: #242c50;          /* 校徽藏蓝 */
  --brand-deep: #1a2140;     /* 封面渐变深端 */
  --brand-soft: #eef0f6;     /* 浅底：选中项、提示块 */
  --gold: #b87c33;           /* 校徽金棕，用于强调 */
  --gold-soft: #fbf4e9;
  --ink: #1f1f1f;
  --ink-2: #55565a;
  --ink-3: #8b8d93;
  --line: #e4e4e7;
  --bg: #f5f5f6;
  --card: #fff;
  --ok: #2e7d5b;
  --warn: #9a4a10;           /* 比 --gold 更深，避免跟金棕点缀混淆 */
  --r: 12px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.7 -apple-system, BlinkMacSystemFont, "PingFang SC",
        "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  padding-bottom: calc(76px + var(--safe-b));
}

.wrap { max-width: 560px; margin: 0 auto; }

/* ---------- 封面 ---------- */
.cover {
  background: linear-gradient(160deg, #2e3860 0%, var(--brand-deep) 100%);
  color: #fff;
  padding: 36px 22px 30px;
  text-align: center;
}
.cover .badge {
  display: block; width: 80px; height: 80px;
  margin: 0 auto 18px;
}
.cover .school { font-size: 13px; opacity: .8; letter-spacing: .2em; text-indent: .2em; }
.cover h1 {
  font-size: 25px; margin: 14px 0 0; font-weight: 600; letter-spacing: .03em;
  padding-bottom: 14px; position: relative;
}
.cover h1::after {
  content: ''; position: absolute; left: 50%; bottom: 0;
  width: 36px; height: 2px; margin-left: -18px;
  background: var(--gold);
}
.cover .sub { font-size: 14px; opacity: .85; margin-top: 13px; letter-spacing: .04em; }

.preface {
  background: var(--card);
  margin: 0;
  padding: 24px 22px 18px;
  border-bottom: 1px solid var(--line);
}
.preface p { margin: 0 0 13px; color: var(--ink-2); font-size: 15.5px; }
.preface p.hi { color: var(--ink); font-weight: 600; margin-bottom: 10px; }
.preface p.motto { color: var(--gold); font-weight: 600; }
.preface .meta {
  margin: 16px 0 0; padding-top: 14px; border-top: 1px dashed var(--line);
  font-size: 13px; color: var(--ink-3); line-height: 1.9;
}

/* ---------- 进度条 ---------- */
.bar-wrap {
  position: sticky; top: 0; z-index: 20;
  background: rgba(255,255,255,.96);
  backdrop-filter: saturate(180%) blur(8px);
  border-bottom: 1px solid var(--line);
  padding: 9px 18px 10px;
}
.bar-top { display: flex; justify-content: space-between; align-items: baseline; }
.bar-top .step { font-size: 14px; font-weight: 600; }
.bar-top .cnt { font-size: 12px; color: var(--ink-3); }
.bar { height: 3px; background: var(--line); border-radius: 2px; margin-top: 8px; }
.bar > i { display: block; height: 100%; background: var(--brand); border-radius: 2px; transition: width .28s; }

/* ---------- 章节与题目 ---------- */
.sec-head { padding: 22px 20px 4px; }
.sec-head h2 { font-size: 19px; margin: 0; font-weight: 600; }
.sec-head .note {
  font-size: 13px; color: var(--warn); margin-top: 6px;
  background: #fff7ed; border-left: 3px solid #fdba74;
  padding: 7px 10px; border-radius: 0 6px 6px 0;
}

.q {
  background: var(--card);
  margin: 12px 12px 0;
  border-radius: var(--r);
  padding: 16px 16px 18px;
  border: 1px solid var(--line);
}
.q.hidden { display: none; }
.q .num { color: var(--brand); font-weight: 600; font-size: 13px; }
.q .stem { font-size: 16px; font-weight: 500; margin: 2px 0 0; }
.q .stem .star { color: var(--brand); margin-left: 3px; }
.q .hint { font-size: 13px; color: var(--ink-3); margin-top: 5px; }
.q .body { margin-top: 13px; }
.q.klass .num {
  display: inline-block; background: var(--brand); color: #fff;
  font-size: 12px; line-height: 18px; padding: 0 7px; border-radius: 9px;
}
.q.err { border-color: #e0a0a0; background: #fffafa; }
.q .errmsg { display: none; color: #b3261e; font-size: 13px; margin-top: 9px; }
.q.err .errmsg { display: block; }

/* 选项：整块可点，44px 触摸高度 */
.opts { display: flex; flex-direction: column; gap: 8px; }
.opt {
  display: flex; align-items: center; gap: 10px;
  min-height: 46px; padding: 8px 13px;
  border: 1px solid var(--line); border-radius: 10px;
  background: #fcfcfd; cursor: pointer;
  transition: background .12s, border-color .12s;
}
.opt input { position: absolute; opacity: 0; width: 0; height: 0; }
.opt .mark {
  flex: none; width: 20px; height: 20px; border: 1.6px solid #bcbdc2;
  border-radius: 50%; position: relative; transition: border-color .12s;
}
.opt.cb .mark { border-radius: 5px; }
.opt .txt { font-size: 15px; }
.opt.on { background: var(--brand-soft); border-color: var(--brand); }
.opt.on .mark { border-color: var(--brand); background: var(--brand); }
.opt.on .mark::after {
  content: ''; position: absolute; left: 6px; top: 2.5px;
  width: 5px; height: 10px; border: solid #fff;
  border-width: 0 2px 2px 0; transform: rotate(42deg);
}
.opt.on:not(.cb) .mark::after {
  left: 4.5px; top: 4.5px; width: 7px; height: 7px;
  border: 0; border-radius: 50%; background: #fff; transform: none;
}
.opt.dim { opacity: .42; }

/* 选项内联填空 */
.fill {
  margin: -2px 0 0 30px; display: none;
}
.fill.show { display: block; }

/* 输入控件 */
input[type=text], input[type=tel], input[type=number], textarea, select {
  width: 100%; font: inherit; font-size: 16px; color: var(--ink);
  background: #fcfcfd; border: 1px solid var(--line);
  border-radius: 9px; padding: 11px 12px;
}
input:focus, textarea:focus { outline: none; border-color: var(--brand); background: #fff; }
textarea { min-height: 84px; resize: vertical; line-height: 1.65; }
::placeholder { color: #b6b8bd; }

.row { display: flex; gap: 9px; align-items: center; }
.row .lab { flex: none; font-size: 14px; color: var(--ink-2); min-width: 52px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.unit { flex: none; font-size: 14px; color: var(--ink-2); }

.sub-blk {
  margin-top: 12px; padding: 12px; background: #fafafb;
  border: 1px dashed var(--line); border-radius: 9px; display: none;
}
.sub-blk.show { display: block; }
.sub-blk .sl { font-size: 14px; color: var(--ink-2); margin: 0 0 7px; }
.sub-blk .sl + .opts { margin-bottom: 12px; }
.sub-blk > *:last-child { margin-bottom: 0; }

/* 矩阵题 */
.matrix { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.matrix th { font-weight: 500; color: var(--ink-2); padding: 0 2px 9px; text-align: center; }
.matrix th:first-child { text-align: left; }
.matrix td { padding: 6px 2px; text-align: center; border-top: 1px solid #f0f0f1; }
.matrix td:first-child { text-align: left; font-size: 15px; }
.matrix label { display: block; padding: 7px 0; cursor: pointer; }
.matrix .dot {
  display: inline-block; width: 21px; height: 21px;
  border: 1.6px solid #bcbdc2; border-radius: 50%; position: relative;
}
.matrix input { position: absolute; opacity: 0; }
.matrix input:checked + .dot { border-color: var(--brand); background: var(--brand); }
.matrix input:checked + .dot::after {
  content: ''; position: absolute; left: 5px; top: 5px;
  width: 7px; height: 7px; border-radius: 50%; background: #fff;
}

/* 特长 */
.tal { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.tal .item { border-bottom: 1px solid #f0f0f1; }
.tal .item:last-child { border-bottom: 0; }
.tal .head {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 13px; min-height: 46px; cursor: pointer;
}
.tal .head .mark {
  flex: none; width: 20px; height: 20px; border: 1.6px solid #bcbdc2;
  border-radius: 5px; position: relative;
}
.tal .item.on .head { background: var(--brand-soft); }
.tal .item.on .head .mark { border-color: var(--brand); background: var(--brand); }
.tal .item.on .head .mark::after {
  content: ''; position: absolute; left: 6px; top: 2.5px;
  width: 5px; height: 10px; border: solid #fff;
  border-width: 0 2px 2px 0; transform: rotate(42deg);
}
.tal .detail { display: none; padding: 0 13px 12px; gap: 8px; }
.tal .item.on .detail { display: grid; grid-template-columns: 1fr 1fr 1fr; }
.tal .detail input { padding: 9px 10px; font-size: 15px; }

/* ---------- 同意 ---------- */
.consent {
  background: var(--card); margin: 18px 12px 0;
  border: 1px solid var(--line); border-radius: var(--r); padding: 16px;
}
.consent h3 { margin: 0 0 9px; font-size: 15px; }
.consent .body { font-size: 13.5px; color: var(--ink-2); line-height: 1.85; }
.consent .body b { color: var(--ink); font-weight: 600; }
.consent .agree {
  display: flex; gap: 10px; align-items: flex-start;
  margin-top: 14px; padding: 12px; background: var(--brand-soft);
  border-radius: 9px; cursor: pointer;
}
.consent .agree input { position: absolute; opacity: 0; }
.consent .agree .mark {
  flex: none; width: 21px; height: 21px; margin-top: 1px;
  border: 1.6px solid var(--brand); border-radius: 5px;
  background: #fff; position: relative;
}
.consent .agree.on .mark { background: var(--brand); }
.consent .agree.on .mark::after {
  content: ''; position: absolute; left: 6.5px; top: 3px;
  width: 5px; height: 10px; border: solid #fff;
  border-width: 0 2px 2px 0; transform: rotate(42deg);
}
.consent .agree .t { font-size: 14.5px; }

/* ---------- 底部按钮 ---------- */
.foot {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  background: rgba(255,255,255,.97);
  backdrop-filter: saturate(180%) blur(8px);
  border-top: 1px solid var(--line);
  padding: 10px 12px calc(10px + var(--safe-b));
}
.foot .in { max-width: 560px; margin: 0 auto; display: flex; gap: 10px; }
.btn {
  flex: 1; min-height: 48px; border: 0; border-radius: 10px;
  font: inherit; font-size: 16.5px; font-weight: 600; cursor: pointer;
}
.btn.main { background: var(--brand); color: #fff; }
.btn.main:disabled { background: #cfcfd3; }
.btn.ghost { flex: 0 0 96px; background: #f0f0f2; color: var(--ink-2); }
.saved {
  text-align: center; font-size: 12px; color: var(--ink-3);
  padding: 14px 20px 4px;
}

/* ---------- 完成页 ---------- */
.done { padding: 60px 26px; text-align: center; }
.done .ic {
  width: 62px; height: 62px; margin: 0 auto 20px;
  border-radius: 50%; background: var(--ok); position: relative;
}
.done .ic::after {
  content: ''; position: absolute; left: 21px; top: 17px;
  width: 12px; height: 24px; border: solid #fff;
  border-width: 0 3px 3px 0; transform: rotate(42deg);
}
.done h2 { font-size: 21px; margin: 0 0 12px; }
.done p { color: var(--ink-2); font-size: 15px; margin: 0 0 8px; }
.done .code {
  display: inline-block; margin-top: 18px; padding: 9px 16px;
  background: var(--brand-soft); color: var(--brand);
  border-radius: 8px; font-size: 14px; letter-spacing: .06em;
}

.toast {
  position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%);
  background: rgba(28,28,30,.93); color: #fff; font-size: 14px;
  padding: 10px 18px; border-radius: 20px; z-index: 60;
  opacity: 0; pointer-events: none; transition: opacity .22s;
  max-width: 82vw; text-align: center;
}
.toast.on { opacity: 1; }
