/* 家庭学堂：窄栏布局，刻度线贯穿列表，刻度长短表示上次测试成绩。深色模式跟随系统。 */
:root {
  color-scheme: light;
  --bg: #F2F4F1; --surface: #FFFFFF; --ink: #1D2B2A; --muted: #5B6C69; --line: #D6DDD9;
  --btn: #22302F; --on-btn: #FFFFFF; --mark: #F2C230; --on-mark: #1D2B2A; --bar: #3E5754;
  --danger: #B3392B; --on-danger: #FFFFFF; --h0: #E4E9E5; --h1: #F6E39B;
  --s1: #D55E00; --s2: #0072B2; --s3: #CC79A7; --s4: #009E73; --s5: #8E6BBF; --s6: #E69F00; --s7: #3AA6DC; --s8: #7C8A86;
  --font-display: "ZCOOL KuaiLe", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --font-body: "Noto Sans SC", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #101816; --surface: #18221F; --ink: #E6EDEA; --muted: #9BADA8; --line: #2B3834;
    --btn: #E6EDEA; --on-btn: #101816; --bar: #86A8A1; --danger: #F08A7C; --on-danger: #2A0F0B;
    --h0: #24302D; --h1: #5C4D16;
    --s1: #F07F3C; --s2: #4FA3E0; --s3: #E08FBC; --s4: #2FC49A; --s5: #B093E0; --s6: #F0B429; --s7: #7CC8F2; --s8: #A3B2AD;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0; background: var(--bg); color: var(--ink); font: 400 16px/1.6 var(--font-body);
  padding-top: max(20px, env(safe-area-inset-top, 0px));
  padding-bottom: calc(108px + env(safe-area-inset-bottom, 0px));
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.wrap { max-width: 680px; margin: 0 auto; }
h2 { margin: 0; }
.lead { margin: 0 0 16px; color: var(--muted); max-width: 34em; }
.muted { color: var(--muted); }
.sec-title { font: 400 22px/1.25 var(--font-display); margin: 0 0 12px; text-wrap: balance; }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }

.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand h1 { font: 400 27px/1.1 var(--font-display); letter-spacing: .03em; margin: 0; white-space: nowrap; }
.mk-body { fill: var(--mark); stroke: var(--ink); stroke-width: 1.6; }
.mk-tick { stroke: var(--ink); stroke-width: 1.6; stroke-linecap: round; }
.acct { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 13px; color: var(--muted); }
.acct .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 28vw; }
.banner { margin: 0 0 14px; padding: 10px 14px; border-radius: 10px; background: var(--h1); color: var(--ink); font-size: 14px; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 18px; }
.codebox { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.codebox b { font: 700 22px/1 var(--font-body); letter-spacing: .12em; font-variant-numeric: tabular-nums; }
.field { display: grid; gap: 6px; margin-bottom: 16px; }
.field > label, .legend { font-size: 13px; font-weight: 500; color: var(--muted); letter-spacing: .04em; }
.hint { margin: 0; font-size: 13px; color: var(--muted); }
input[type=text], input[type=email], input[type=password], textarea, select {
  width: 100%; min-height: 46px; padding: 10px 12px; font: inherit; color: var(--ink);
  background: var(--bg); border: 1.5px solid var(--line); border-radius: 10px;
}
textarea { min-height: 120px; resize: vertical; line-height: 1.7; }
.opts { display: flex; flex-wrap: wrap; gap: 8px; }
.opt { position: relative; display: inline-block; }
.vh { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.chip {
  display: inline-flex; align-items: center; gap: 7px; min-height: 42px; padding: 0 14px;
  border: 1.5px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink);
  font: 500 14px/1 var(--font-body); cursor: pointer; user-select: none;
}
.chip[aria-pressed="true"], input:checked + .chip { background: var(--mark); border-color: var(--mark); color: var(--on-mark); font-weight: 700; }
input:focus-visible + .chip { outline: 3px solid var(--ink); outline-offset: 2px; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--sc, var(--muted)); flex: none; }
.btn { min-height: 46px; padding: 0 22px; border: 0; border-radius: 10px; background: var(--btn); color: var(--on-btn); font: 700 16px/1 var(--font-body); cursor: pointer; }
.btn.block { width: 100%; }
.btn.ghost { background: transparent; color: var(--ink); border: 1.5px solid var(--line); }
.btn.danger { background: var(--danger); color: var(--on-danger); }
.btn.mini { min-height: 34px; padding: 0 12px; font-size: 13px; }
.btn.mark { background: var(--mark); color: var(--on-mark); }
.btn:disabled { opacity: .55; cursor: default; }
.link { min-height: 34px; padding: 4px 0; background: none; border: 0; color: var(--muted); font: 500 13px var(--font-body); text-decoration: underline; cursor: pointer; }
.link.danger-link { color: var(--danger); }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
.msg { margin: 0 0 12px; color: var(--danger); font-size: 14px; }
.info { margin: 0 0 12px; font-size: 14px; }
.msg:empty, .info:empty { display: none; }
.back { display: inline-block; margin-bottom: 10px; min-height: 32px; color: var(--muted); font-size: 14px; text-decoration: none; }
.pill { display: inline-block; padding: 0 9px; border-radius: 999px; border: 1px solid var(--line); font-size: 12px; font-weight: 700; line-height: 20px; color: var(--muted); white-space: nowrap; }
.pill.learning { border-color: var(--ink); color: var(--ink); }
.pill.done { background: var(--mark); border-color: var(--mark); color: var(--on-mark); }
.pbar { height: 10px; border-radius: 5px; background: var(--h0); overflow: hidden; }
.pbar i { display: block; height: 100%; border-radius: 5px; background: var(--bar); }
.cap { margin: 0 0 8px; font-size: 13px; color: var(--muted); }
.empty-note { margin: 12px 0; color: var(--muted); max-width: 34em; }
.empty-note a { color: var(--ink); font-weight: 700; }

.td, .tick { display: inline-block; height: 4px; border-radius: 2px; background: var(--ink); }
.l1 { width: 10px; } .l2 { width: 20px; } .l3 { width: 32px; }
.l0 { width: 20px; height: 0; border-top: 2px dashed var(--muted); border-radius: 0; background: transparent; }
.legend-tick { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; margin: 10px 0 4px; font-size: 13px; color: var(--muted); }
.legend-tick .k { display: inline-flex; align-items: center; gap: 6px; }
.tl { position: relative; padding-left: 58px; margin-top: 4px; }
.tl.empty { padding-left: 0; }
.tl:not(.empty)::before {
  content: ""; position: absolute; left: 16px; top: 0; bottom: 0; width: 10px;
  border-left: 2px solid var(--ink);
  background: repeating-linear-gradient(to bottom, var(--line) 0 1px, transparent 1px 8px) 0 0 / 8px 100% no-repeat;
}
.ent { position: relative; display: block; padding: 10px 0 14px; border-bottom: 1px solid var(--line); min-width: 0; color: inherit; text-decoration: none; }
.ent .tick { position: absolute; left: -42px; top: 20px; background: var(--sc); }
.ent .tick.l0 { top: 21px; background: transparent; }
.ent-head { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 10px; font-size: 13px; color: var(--muted); }
.ent .sub { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; color: var(--ink); }
.ent-title { font-weight: 700; margin-top: 2px; overflow-wrap: anywhere; }
.ent-title a { color: inherit; text-decoration: none; }
.ent-meta { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 12px; margin-top: 4px; font-size: 13px; color: var(--muted); }
.confirm-inline { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; color: var(--ink); }
details.note { margin-top: 6px; font-size: 14px; }
details.note summary { cursor: pointer; color: var(--muted); min-height: 28px; }
.ntext { white-space: pre-wrap; overflow-wrap: anywhere; margin-top: 4px; color: var(--ink); }

.t-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin-bottom: 6px; font-size: 13px; color: var(--muted); }
.t-head .sub { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; color: var(--ink); }
.t-title { font: 400 28px/1.3 var(--font-display); margin: 0 0 14px; text-wrap: balance; }
.content { font-size: 17px; line-height: 1.95; white-space: pre-wrap; overflow-wrap: anywhere; max-width: 34em; }
.sec { margin-top: 30px; }
.sec h3 { margin: 0 0 8px; font-size: 15px; font-weight: 700; }
.status-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
.tests-list { margin: 0; padding: 0; list-style: none; }
.tests-list li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px; font-variant-numeric: tabular-nums; }

.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-block: 1px solid var(--line); margin-bottom: 18px; }
.stat { padding: 14px 6px; text-align: center; }
.stat + .stat { border-left: 1px solid var(--line); }
.stat b { display: block; font: 400 32px/1.1 var(--font-display); font-variant-numeric: tabular-nums; }
.stat span { font-size: 12px; color: var(--muted); }

#editor { margin-bottom: 22px; }
.qrow { display: grid; gap: 8px; padding: 12px; margin-bottom: 10px; border: 1px dashed var(--line); border-radius: 10px; }
.qrow .qhead { display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: var(--muted); }

.test-q { font: 400 26px/1.5 var(--font-display); margin: 14px 0 18px; overflow-wrap: anywhere; }
.ans { padding: 14px; margin-bottom: 14px; border-radius: 10px; background: var(--h1); color: var(--ink); overflow-wrap: anywhere; }
.big-score { font: 400 60px/1 var(--font-display); font-variant-numeric: tabular-nums; margin: 6px 0 14px; }
.wrong { margin: 0 0 16px; padding: 0; list-style: none; }
.wrong li { padding: 10px 0; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.foot { margin: 32px 0 0; font-size: 12px; color: var(--muted); }

.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; background: var(--surface); border-top: 1px solid var(--line);
  padding: 6px max(16px, env(safe-area-inset-right, 0px)) calc(6px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
}
.nav-in { max-width: 680px; margin: 0 auto; display: grid; gap: 6px; }
.nav a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 4px; border-radius: 10px; color: var(--muted); text-decoration: none; font: 500 13px/1.2 var(--font-body); }
.nav a[aria-current="page"] { background: var(--mark); color: var(--on-mark); font-weight: 700; }
.nav svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(84px + env(safe-area-inset-bottom, 0px)); z-index: 9;
  max-width: calc(100vw - 32px); padding: 10px 18px; border-radius: 999px; background: var(--btn); color: var(--on-btn); font-size: 14px; text-align: center;
}
