/* =========================================================
   字里行间 · 小学学习舱
   视觉方向：教材纸感 + 印章批注。米色纸面、墨绿正文、朱红批注。
   ========================================================= */

:root {
  --paper: #F3EDE0;
  --sheet: #FCF8EE;
  --sheet-2: #F8F2E4;
  --ink: #1E2E28;
  --ink2: #4C6259;
  --muted: #7E8C83;
  --line: #DCD2BF;
  --line-strong: #BCAF95;
  --accent: #BF4A2E;
  --accent-soft: #F1DDD5;
  --teal: #2F6159;
  --teal-soft: #DCE7E2;
  --gold: #B99236;
  --gold-soft: #F1E5C9;
  --ok: #3E7A52;
  --bad: #B2453A;
  --blue: #485C8C;
  --shadow: 0 1px 0 rgba(255, 255, 255, .7) inset, 3px 3px 0 rgba(30, 46, 40, .06);
  --shadow-lift: 0 1px 0 rgba(255, 255, 255, .7) inset, 6px 8px 0 rgba(30, 46, 40, .08);
  --font-display: "Kaiti SC", "KaiTi", "STKaiti", "Songti SC", "SimSun", serif;
  --font-body: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  --font-num: Georgia, "Times New Roman", "Songti SC", serif;
  --r: 16px;
  --rail: 228px;
}

body[data-theme="teal"] {
  --paper: #E7EFE9;
  --sheet: #F7FBF6;
  --sheet-2: #EDF4EE;
  --ink: #16302A;
  --ink2: #3C5A51;
  --line: #C6D8CE;
  --line-strong: #9DB8AA;
  --accent: #276B5C;
  --accent-soft: #D3E5DD;
  --teal: #276B5C;
  --teal-soft: #D9E9E2;
}

body[data-theme="night"] {
  --paper: #1B2420;
  --sheet: #232E29;
  --sheet-2: #28352F;
  --ink: #E9EFE9;
  --ink2: #BCCBC2;
  --muted: #8DA096;
  --line: #394A43;
  --line-strong: #536B60;
  --accent: #DB7B5C;
  --accent-soft: #3B2E28;
  --teal: #7FB5A6;
  --teal-soft: #2B3B35;
  --gold: #D3AC55;
  --gold-soft: #3A3426;
  --ok: #79B98E;
  --bad: #E08678;
  --shadow: 0 1px 0 rgba(255, 255, 255, .05) inset, 3px 3px 0 rgba(0, 0, 0, .25);
  --shadow-lift: 0 1px 0 rgba(255, 255, 255, .06) inset, 6px 8px 0 rgba(0, 0, 0, .3);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  background-image:
    radial-gradient(circle at 12% 8%, rgba(191, 74, 46, .05), transparent 42%),
    radial-gradient(circle at 88% 92%, rgba(47, 97, 89, .06), transparent 46%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    repeating-linear-gradient(0deg, rgba(30, 46, 40, .028) 0 1px, transparent 1px 28px),
    repeating-linear-gradient(90deg, rgba(30, 46, 40, .028) 0 1px, transparent 1px 28px);
  mask-image: radial-gradient(circle at 50% 40%, #000 20%, transparent 78%);
}

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--teal); }
::selection { background: var(--accent); color: #fff; }

/* ---------- 布局 ---------- */
.app {
  position: relative;
  z-index: 1;
  display: flex;
  min-height: 100vh;
}

.rail {
  width: var(--rail);
  flex: 0 0 var(--rail);
  border-right: 1px solid var(--line);
  background: color-mix(in srgb, var(--sheet) 72%, transparent);
  backdrop-filter: blur(6px);
  padding: 22px 16px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.brand { display: flex; align-items: center; gap: 11px; padding: 0 4px; }
.brand-mark {
  width: 42px; height: 42px;
  display: grid; place-items: center;
  background: var(--ink);
  color: var(--sheet);
  font-family: var(--font-display);
  font-size: 24px;
  border-radius: 8px;
  transform: rotate(-3deg);
  box-shadow: 2px 2px 0 var(--accent);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.3; }
.brand-text b { font-family: var(--font-display); font-size: 19px; letter-spacing: .08em; }
.brand-text small { color: var(--muted); font-size: 11px; letter-spacing: .04em; }

.nav { display: flex; flex-direction: column; gap: 3px; }
.nav-btn {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 9px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--ink2);
  text-align: left;
  transition: background .18s, color .18s, border-color .18s;
}
.nav-btn i {
  width: 30px; height: 30px;
  flex: 0 0 30px;
  display: grid; place-items: center;
  font-family: var(--font-display);
  font-style: normal;
  font-size: 15px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  color: var(--ink2);
  background: var(--sheet);
  transition: inherit;
}
.nav-btn span { font-size: 13.5px; letter-spacing: .02em; }
.nav-btn:hover { background: color-mix(in srgb, var(--sheet) 70%, transparent); border-color: var(--line); }
.nav-btn.is-active {
  background: var(--sheet);
  border-color: var(--line-strong);
  color: var(--ink);
  box-shadow: var(--shadow);
}
.nav-btn.is-active i {
  background: var(--accent);
  border-color: var(--accent);
  color: #FCF8EE;
  transform: rotate(-4deg);
}
.nav-btn:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }

.rail-foot {
  margin-top: auto;
  display: flex; gap: 7px; align-items: center;
  font-size: 11px; color: var(--muted);
  padding: 10px 8px;
  border-top: 1px dashed var(--line);
}
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); flex: 0 0 7px; }
.dot.warn { background: var(--gold); }
.dot.bad { background: var(--bad); }

.main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: flex-end; justify-content: space-between; gap: 18px;
  padding: 18px 34px 14px;
  background: color-mix(in srgb, var(--paper) 86%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.topbar-title h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 25px;
  font-weight: 600;
  letter-spacing: .06em;
}
.topbar-title p { margin: 2px 0 0; font-size: 12px; color: var(--muted); }
.topbar-side { display: flex; align-items: center; gap: 8px; }

.pill {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--line-strong);
  background: var(--sheet);
  border-radius: 999px;
  padding: 4px 11px 4px 9px;
  font-size: 11px; color: var(--muted);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .6) inset;
}
.pill em { font-style: normal; letter-spacing: .04em; }
.pill b { font-family: var(--font-num); font-size: 15px; color: var(--ink); }
.pill-coin b { color: var(--gold); }
.pill-lv b { color: var(--teal); }

.profile {
  display: flex; align-items: center; gap: 9px;
  border: 1px solid var(--line);
  background: var(--sheet);
  border-radius: 999px;
  padding: 4px 14px 4px 4px;
  box-shadow: var(--shadow);
}
.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--teal); color: #FCF8EE;
  font-family: var(--font-display); font-size: 16px;
}
.profile-text { display: flex; flex-direction: column; line-height: 1.25; text-align: left; }
.profile-text b { font-size: 12.5px; }
.profile-text small { color: var(--muted); font-size: 10.5px; }

.view { flex: 1 1 auto; padding: 26px 34px 10px; max-width: 1240px; width: 100%; margin: 0 auto; }

.page-foot {
  display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding: 18px 34px 22px;
  font-size: 11px; color: var(--muted);
  border-top: 1px dashed var(--line);
  max-width: 1240px; margin: 18px auto 0; width: 100%;
}

/* ---------- 通用组件 ---------- */
.card {
  background: var(--sheet);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 18px;
  box-shadow: var(--shadow);
}
.card.flat { box-shadow: none; }
.card.ink { background: var(--ink); color: var(--sheet); border-color: var(--ink); }
.card.ink .muted, .card.ink small { color: rgba(252, 248, 238, .66); }

.sec { margin: 26px 0 12px; display: flex; align-items: baseline; gap: 12px; }
.sec h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 18px; font-weight: 600; letter-spacing: .08em;
  white-space: nowrap;
}
.sec h2::before {
  content: ""; display: inline-block; width: 8px; height: 8px;
  background: var(--accent); margin-right: 8px; transform: translateY(-2px) rotate(45deg);
}
.sec .rule { flex: 1 1 auto; border-top: 1px dashed var(--line-strong); height: 1px; }
.sec small { color: var(--muted); font-size: 11.5px; white-space: nowrap; }

.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.row { display: flex; gap: 10px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.spread { justify-content: space-between; }
.muted { color: var(--muted); }
.small { font-size: 11.5px; }
.num { font-family: var(--font-num); }
.mt0 { margin-top: 0; } .mb0 { margin-bottom: 0; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 18px;
  border-radius: 9px;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--sheet);
  font-size: 13px; font-weight: 600; letter-spacing: .04em;
  box-shadow: 2px 2px 0 color-mix(in srgb, var(--accent) 55%, transparent);
  transition: transform .16s, box-shadow .16s, background .16s;
}
.btn:hover { transform: translate(-1px, -1px); box-shadow: 3px 3px 0 color-mix(in srgb, var(--accent) 60%, transparent); }
.btn:active { transform: translate(1px, 1px); box-shadow: 1px 1px 0 color-mix(in srgb, var(--accent) 50%, transparent); }
.btn:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line-strong); box-shadow: none; }
.btn.ghost:hover { background: var(--sheet-2); transform: none; }
.btn.accent { background: var(--accent); border-color: var(--accent); }
.btn.sm { padding: 5px 12px; font-size: 11.5px; border-radius: 7px; box-shadow: none; }
.btn.sm:hover { transform: none; box-shadow: none; background: var(--ink2); }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .45; cursor: not-allowed; transform: none; box-shadow: none; }

.tag {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  font-size: 10.5px; color: var(--ink2);
  background: var(--sheet);
}
.tag.ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 40%, transparent); background: color-mix(in srgb, var(--ok) 9%, transparent); }
.tag.warn { color: var(--gold); border-color: color-mix(in srgb, var(--gold) 45%, transparent); background: color-mix(in srgb, var(--gold) 12%, transparent); }
.tag.bad { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, transparent); background: color-mix(in srgb, var(--bad) 10%, transparent); }
.tag.plain { background: transparent; }

.bar { height: 7px; border-radius: 4px; background: var(--sheet-2); border: 1px solid var(--line); overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--teal); border-radius: 3px; transition: width .6s cubic-bezier(.2, .8, .2, 1); }
.bar.accent > i { background: var(--accent); }
.bar.gold > i { background: var(--gold); }

.stamp {
  display: inline-grid; place-items: center;
  width: 62px; height: 62px;
  border: 2px solid var(--accent);
  border-radius: 50%;
  color: var(--accent);
  font-family: var(--font-display);
  font-size: 11px;
  text-align: center;
  line-height: 1.2;
  transform: rotate(-8deg);
  opacity: .85;
  letter-spacing: .06em;
}
.seal {
  display: grid; place-items: center;
  width: 38px; height: 38px;
  border: 1.5px solid currentColor;
  border-radius: 8px;
  font-family: var(--font-display);
  font-size: 18px;
  flex: 0 0 38px;
}
.seal.sm { width: 30px; height: 30px; font-size: 15px; border-radius: 6px; flex-basis: 30px; }

.kv { display: flex; flex-direction: column; gap: 2px; }
.kv b { font-family: var(--font-num); font-size: 24px; line-height: 1.1; }
.kv small { color: var(--muted); font-size: 11px; letter-spacing: .04em; }

.stat {
  display: flex; flex-direction: column; gap: 3px;
  padding: 13px 15px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--sheet-2);
}
.stat b { font-family: var(--font-num); font-size: 22px; line-height: 1.15; }
.stat small { color: var(--muted); font-size: 11px; }

.empty {
  border: 1px dashed var(--line-strong);
  border-radius: 12px;
  padding: 26px 18px;
  text-align: center;
  color: var(--muted);
  font-size: 12.5px;
  background: color-mix(in srgb, var(--sheet-2) 60%, transparent);
}

hr.dash { border: 0; border-top: 1px dashed var(--line); margin: 14px 0; }

/* ---------- 今日 ---------- */
.hero {
  display: grid;
  grid-template-columns: 1.35fr .95fr;
  gap: 0;
  border: 1px solid var(--line-strong);
  border-radius: 20px;
  background: var(--sheet);
  box-shadow: var(--shadow-lift);
  overflow: hidden;
  position: relative;
}
.hero-main { padding: 26px 28px; position: relative; }
.hero-main::before {
  content: "";
  position: absolute; inset: 0;
  background:
    repeating-linear-gradient(0deg, rgba(47, 97, 89, .07) 0 1px, transparent 1px 34px),
    repeating-linear-gradient(90deg, rgba(47, 97, 89, .07) 0 1px, transparent 1px 34px);
  mask-image: linear-gradient(115deg, #000 0%, transparent 62%);
  pointer-events: none;
}
.hero-kicker {
  position: relative;
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 11px; letter-spacing: .18em; color: var(--muted);
  text-transform: uppercase;
}
.hero-kicker::before { content: ""; width: 22px; height: 1px; background: var(--accent); }
.hero-title {
  position: relative;
  margin: 9px 0 6px;
  font-family: var(--font-display);
  font-size: 40px;
  line-height: 1.18;
  letter-spacing: .04em;
}
.hero-title em { font-style: normal; color: var(--accent); }
.hero-desc { position: relative; margin: 0 0 18px; color: var(--ink2); font-size: 13px; max-width: 48ch; }
.hero-actions { position: relative; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.hero-actions .hint { font-size: 11px; color: var(--muted); }

.hero-side {
  border-left: 1px dashed var(--line-strong);
  padding: 24px 26px;
  display: flex; flex-direction: column; gap: 14px;
  background: color-mix(in srgb, var(--sheet-2) 55%, transparent);
}
.goal-ring { position: relative; width: 132px; height: 132px; margin: 0 auto; }
.goal-ring svg { transform: rotate(-90deg); }
.goal-ring .ring-bg { fill: none; stroke: var(--line); stroke-width: 9; }
.goal-ring .ring-fg { fill: none; stroke: var(--teal); stroke-width: 9; stroke-linecap: round; transition: stroke-dashoffset .8s ease; }
.goal-ring .ring-txt {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-family: var(--font-num);
}
.goal-ring .ring-txt b { font-size: 27px; line-height: 1; }
.goal-ring .ring-txt small { font-size: 10px; color: var(--muted); letter-spacing: .1em; margin-top: 4px; }

.week {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px;
  text-align: center;
}
.week div {
  font-size: 10px; color: var(--muted);
  padding: 5px 0 3px;
  border-radius: 6px;
  border: 1px solid transparent;
}
.week div.done { background: var(--teal); color: #FCF8EE; border-color: var(--teal); }
.week div.today { border-color: var(--accent); color: var(--accent); font-weight: 600; }
.week div.done.today { background: var(--accent); border-color: var(--accent); color: #FCF8EE; }

.task {
  display: flex; align-items: center; gap: 13px;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--sheet);
  transition: border-color .16s, transform .16s, box-shadow .16s;
}
.task:hover { border-color: var(--line-strong); transform: translateY(-1px); box-shadow: var(--shadow); }
.task .seal { color: var(--teal); }
.task-main { flex: 1 1 auto; min-width: 0; }
.task-main b { display: block; font-size: 13.5px; letter-spacing: .02em; }
.task-main small { color: var(--muted); font-size: 11px; }

.subject-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 15px 16px;
  background: var(--sheet);
  text-align: left;
  transition: transform .18s, box-shadow .18s, border-color .18s;
  position: relative;
  overflow: hidden;
}
.subject-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--line-strong); }
.subject-card .sc-top { display: flex; align-items: center; gap: 10px; margin-bottom: 9px; }
.subject-card .sc-top b { font-family: var(--font-display); font-size: 17px; letter-spacing: .1em; }
.subject-card p { margin: 0 0 10px; font-size: 11.5px; color: var(--muted); min-height: 34px; }
.subject-card .sc-mark {
  position: absolute; right: -8px; bottom: -20px;
  font-family: var(--font-display); font-size: 76px;
  color: color-mix(in srgb, var(--ink) 5%, transparent);
  line-height: 1; pointer-events: none;
}

/* ---------- 知识图谱 ---------- */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.tab {
  padding: 6px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--ink2);
  font-size: 12px;
}
.tab.is-active { background: var(--ink); border-color: var(--ink); color: var(--sheet); }
.tab:hover:not(.is-active) { border-color: var(--line-strong); background: var(--sheet); }

.grade-block { margin-bottom: 10px; }
.grade-head { display: flex; align-items: center; gap: 10px; margin: 18px 0 8px; }
.grade-head b { font-family: var(--font-display); font-size: 16px; letter-spacing: .1em; }
.grade-head .tag { font-size: 10px; }
.grade-head .line { flex: 1; border-top: 1px dotted var(--line-strong); }
.grade-head .avg { font-family: var(--font-num); font-size: 12px; color: var(--muted); }

.kp-row {
  display: grid;
  grid-template-columns: 1fr 110px 56px auto;
  align-items: center;
  gap: 12px;
  padding: 9px 10px;
  border-bottom: 1px dashed var(--line);
}
.kp-row:last-child { border-bottom: 0; }
.kp-row .kp-name { min-width: 0; }
.kp-row .kp-name b { font-size: 13px; font-weight: 500; display: block; }
.kp-row .kp-name small { font-size: 11px; color: var(--muted); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kp-row .pct { font-family: var(--font-num); font-size: 12px; text-align: right; color: var(--ink2); }
.kp-row .state { font-size: 10px; color: var(--muted); }

/* ---------- 复习 ---------- */
.calendar { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-cell {
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 7px 6px;
  text-align: center;
  background: var(--sheet-2);
  min-height: 62px;
}
.cal-cell small { display: block; font-size: 10px; color: var(--muted); }
.cal-cell b { display: block; font-family: var(--font-num); font-size: 15px; margin-top: 3px; }
.cal-cell em { font-style: normal; font-size: 10px; color: var(--teal); }
.cal-cell.due { border-color: var(--accent); background: var(--accent-soft); }
.cal-cell.today { outline: 2px solid var(--ink); outline-offset: -1px; }

.curve-wrap { border: 1px solid var(--line); border-radius: 12px; padding: 10px; background: var(--sheet-2); }
.curve-wrap svg { width: 100%; height: auto; display: block; }

/* ---------- 错题本 ---------- */
.wrong-item {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 13px 15px;
  background: var(--sheet);
  margin-bottom: 9px;
}
.wrong-item .wq { font-size: 13px; margin: 4px 0 7px; }
.wrong-item .ans-line { font-size: 11.5px; color: var(--ink2); }
.wrong-item .ans-line b { color: var(--ok); }

/* ---------- 奖励 ---------- */
.badge-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.badge {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 13px 11px;
  text-align: center;
  background: var(--sheet-2);
  position: relative;
  transition: transform .2s;
}
.badge .seal { margin: 0 auto 7px; color: var(--muted); opacity: .45; }
.badge b { display: block; font-family: var(--font-display); font-size: 13.5px; letter-spacing: .06em; }
.badge small { display: block; font-size: 10.5px; color: var(--muted); line-height: 1.45; margin-top: 2px; }
.badge.on { background: var(--sheet); border-color: var(--gold); }
.badge.on .seal { color: var(--accent); opacity: 1; border-width: 2px; transform: rotate(-5deg); }
.badge.on::after {
  content: "已获得"; position: absolute; top: 6px; right: 6px;
  font-size: 9px; color: var(--gold); letter-spacing: .04em;
}

.shop-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 13px;
  border-bottom: 1px dashed var(--line);
}
.shop-item:last-child { border-bottom: 0; }
.shop-item .price { font-family: var(--font-num); font-size: 13px; color: var(--gold); }
.shop-item .own { font-size: 11px; color: var(--ok); }

/* ---------- 小升初 ---------- */
.xsc-hero {
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  background: var(--ink);
  color: var(--sheet);
  padding: 24px 26px;
  display: grid;
  grid-template-columns: 1.5fr .8fr;
  gap: 20px;
  box-shadow: var(--shadow-lift);
  background-image: radial-gradient(circle at 92% 12%, rgba(255, 255, 255, .1), transparent 42%);
}
.xsc-hero h2 { margin: 0 0 4px; font-family: var(--font-display); font-size: 27px; letter-spacing: .08em; }
.xsc-hero p { margin: 0; font-size: 12.5px; color: rgba(252, 248, 238, .72); max-width: 50ch; }
.countdown { display: flex; gap: 6px; margin-top: 14px; }
.countdown span {
  min-width: 56px;
  border: 1px solid rgba(252, 248, 238, .28);
  border-radius: 9px;
  padding: 6px 8px;
  text-align: center;
  background: rgba(252, 248, 238, .06);
}
.countdown b { display: block; font-family: var(--font-num); font-size: 22px; line-height: 1.15; }
.countdown small { font-size: 9.5px; letter-spacing: .12em; color: rgba(252, 248, 238, .6); }
.xsc-hero .btn { background: var(--sheet); color: var(--ink); border-color: var(--sheet); box-shadow: 2px 2px 0 rgba(0, 0, 0, .25); }

.phase {
  display: flex; gap: 11px; padding: 12px 0;
  border-bottom: 1px dashed var(--line);
}
.phase:last-child { border-bottom: 0; }
.phase .idx {
  width: 26px; height: 26px; flex: 0 0 26px;
  display: grid; place-items: center;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  font-family: var(--font-num); font-size: 12px;
  color: var(--ink2);
}
.phase.done .idx { background: var(--teal); border-color: var(--teal); color: #FCF8EE; }
.phase b { font-size: 13px; display: block; }
.phase small { display: block; color: var(--muted); font-size: 11px; }

.radar-wrap { display: grid; place-items: center; }
.radar-wrap svg { width: 100%; max-width: 320px; height: auto; }

/* ---------- 家长报告 ---------- */
.heat { display: grid; grid-template-columns: repeat(14, 1fr); gap: 4px; }
.heat i {
  display: block; aspect-ratio: 1 / 1; border-radius: 3px;
  background: var(--sheet-2); border: 1px solid var(--line);
}
.heat i.lv1 { background: color-mix(in srgb, var(--teal) 22%, var(--sheet)); border-color: transparent; }
.heat i.lv2 { background: color-mix(in srgb, var(--teal) 48%, var(--sheet)); border-color: transparent; }
.heat i.lv3 { background: color-mix(in srgb, var(--teal) 72%, var(--sheet)); border-color: transparent; }
.heat i.lv4 { background: var(--teal); border-color: transparent; }

.bars { display: flex; align-items: flex-end; gap: 8px; height: 110px; }
.bars .b { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 5px; height: 100%; }
.bars .b i {
  width: 100%; min-height: 2px;
  background: color-mix(in srgb, var(--teal) 55%, var(--sheet));
  border-radius: 4px 4px 0 0;
  transition: height .6s ease;
}
.bars .b.hi i { background: var(--accent); }
.bars .b small { font-size: 9.5px; color: var(--muted); }
.bars .b b { font-family: var(--font-num); font-size: 10px; font-weight: 500; color: var(--ink2); }

.advice { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px dashed var(--line); font-size: 12.5px; }
.advice:last-child { border-bottom: 0; }
.advice .seal { color: var(--accent); }

/* ---------- 审查 ---------- */
.audit-score {
  display: flex; align-items: center; gap: 18px;
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  padding: 18px 20px;
  background: var(--sheet);
  box-shadow: var(--shadow);
}
.audit-score .big {
  font-family: var(--font-num); font-size: 46px; line-height: 1;
  color: var(--ok);
}
.audit-score .big.warn { color: var(--gold); }
.audit-score .big.bad { color: var(--bad); }

.rule-row {
  display: grid; grid-template-columns: 34px 1fr auto;
  gap: 11px; align-items: start;
  padding: 10px 0;
  border-bottom: 1px dashed var(--line);
}
.rule-row:last-child { border-bottom: 0; }
.rule-row .code {
  font-family: var(--font-num); font-size: 12px;
  border: 1px solid var(--line-strong); border-radius: 5px;
  text-align: center; color: var(--ink2);
}
.rule-row b { font-size: 12.5px; display: block; }
.rule-row small { color: var(--muted); font-size: 11px; }

.log-item {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 9px 0; border-bottom: 1px dashed var(--line);
  font-size: 11.5px;
}
.log-item:last-child { border-bottom: 0; }
.log-item .time { font-family: var(--font-num); color: var(--muted); white-space: nowrap; font-size: 11px; }

/* ---------- 练习会话 ---------- */
.session {
  position: fixed; inset: 0; z-index: 60;
  background: var(--paper);
  background-image:
    radial-gradient(circle at 20% 10%, rgba(191, 74, 46, .06), transparent 40%),
    repeating-linear-gradient(0deg, rgba(30, 46, 40, .025) 0 1px, transparent 1px 30px);
  overflow-y: auto;
  padding: 20px 20px 40px;
}
.session-inner { max-width: 800px; margin: 0 auto; }
.session-top { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.session-top .back {
  border: 1px solid var(--line-strong); background: var(--sheet);
  border-radius: 8px; padding: 6px 12px; font-size: 12px; color: var(--ink2);
}
.session-meta { flex: 1; min-width: 0; }
.session-meta b { display: block; font-family: var(--font-display); font-size: 16px; letter-spacing: .06em; }
.session-meta small { color: var(--muted); font-size: 11px; }
.session-progress { height: 5px; background: var(--line); border-radius: 3px; margin-top: 6px; overflow: hidden; }
.session-progress > i { display: block; height: 100%; background: var(--accent); transition: width .35s ease; }
.session-timer {
  font-family: var(--font-num); font-size: 15px;
  border: 1px solid var(--line); border-radius: 8px;
  padding: 5px 10px; background: var(--sheet); min-width: 62px; text-align: center;
}
.session-timer.warn { color: var(--bad); border-color: var(--bad); }

.q-card {
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  background: var(--sheet);
  box-shadow: var(--shadow-lift);
  padding: 26px 28px;
  animation: rise .4s cubic-bezier(.2, .8, .2, 1) both;
}
.q-eyebrow { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.q-text { font-size: 19px; line-height: 1.75; margin: 6px 0 18px; font-weight: 500; letter-spacing: .01em; }
.q-text .blank { display: inline-block; min-width: 66px; border-bottom: 1.5px solid var(--ink); }

.options { display: flex; flex-direction: column; gap: 9px; }
.opt {
  display: flex; align-items: center; gap: 12px;
  text-align: left;
  padding: 12px 15px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--sheet-2);
  font-size: 15px;
  transition: border-color .15s, background .15s, transform .15s;
}
.opt:hover:not([disabled]) { border-color: var(--line-strong); background: var(--sheet); transform: translateX(2px); }
.opt .letter {
  width: 26px; height: 26px; flex: 0 0 26px;
  display: grid; place-items: center;
  border: 1px solid var(--line-strong); border-radius: 50%;
  font-family: var(--font-num); font-size: 12px; color: var(--ink2);
  background: var(--sheet);
}
.opt.picked { border-color: var(--ink); background: var(--sheet); }
.opt.correct { border-color: var(--ok); background: color-mix(in srgb, var(--ok) 11%, var(--sheet)); }
.opt.correct .letter { background: var(--ok); border-color: var(--ok); color: #fff; }
.opt.wrong { border-color: var(--bad); background: color-mix(in srgb, var(--bad) 9%, var(--sheet)); }
.opt.wrong .letter { background: var(--bad); border-color: var(--bad); color: #fff; }
.opt[disabled] { cursor: default; }

.fill-box { display: flex; gap: 9px; flex-wrap: wrap; }
.fill-box input {
  flex: 1 1 220px; min-width: 0;
  padding: 11px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--sheet-2);
  font-size: 15px;
  outline: none;
}
.fill-box input:focus { border-color: var(--teal); box-shadow: 0 0 0 3px color-mix(in srgb, var(--teal) 16%, transparent); }

.feedback {
  margin-top: 16px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--ok);
  border-radius: 10px;
  padding: 13px 16px;
  background: color-mix(in srgb, var(--ok) 7%, var(--sheet));
  animation: rise .3s ease both;
}
.feedback.bad { border-left-color: var(--bad); background: color-mix(in srgb, var(--bad) 7%, var(--sheet)); }
.feedback b { display: block; font-size: 13px; margin-bottom: 3px; }
.feedback p { margin: 0; font-size: 12.5px; color: var(--ink2); line-height: 1.7; }
.feedback .kp-tip { margin-top: 6px; font-size: 11px; color: var(--muted); }

.session-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 16px; }

/* 结算 */
.result {
  border: 1px solid var(--line-strong);
  border-radius: 20px;
  background: var(--sheet);
  box-shadow: var(--shadow-lift);
  padding: 30px 30px 24px;
  position: relative;
  overflow: hidden;
  animation: rise .45s ease both;
}
.result::before {
  content: "";
  position: absolute; inset: 0;
  background: repeating-linear-gradient(90deg, rgba(47, 97, 89, .05) 0 1px, transparent 1px 30px);
  mask-image: radial-gradient(circle at 85% 0%, #000, transparent 62%);
  pointer-events: none;
}
.result-head { position: relative; text-align: center; margin-bottom: 18px; }
.result-head .score { font-family: var(--font-num); font-size: 64px; line-height: 1; }
.result-head .score small { font-size: 18px; color: var(--muted); }
.result-head h2 { margin: 6px 0 2px; font-family: var(--font-display); font-size: 24px; letter-spacing: .08em; }
.result-head p { margin: 0; color: var(--muted); font-size: 12.5px; }
.result-head .stamp { position: absolute; right: 4px; top: 4px; }

.result-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 16px; }
.reward-line {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; border: 1px dashed var(--line-strong); border-radius: 8px;
  font-size: 12px; background: var(--sheet-2);
}
.reward-line b { font-family: var(--font-num); color: var(--gold); }

.new-badge {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px; margin-top: 8px;
  border: 1px solid var(--gold); border-radius: 10px;
  background: var(--gold-soft);
  animation: pop .5s cubic-bezier(.2, .9, .3, 1.4) both;
}
.new-badge .seal { color: var(--accent); }

/* ---------- 弹窗 ---------- */
.modal {
  position: fixed; inset: 0; z-index: 80;
  display: grid; place-items: center;
  background: rgba(20, 30, 26, .42);
  padding: 20px;
  backdrop-filter: blur(3px);
}
.modal[hidden] { display: none; }
.modal-card {
  width: min(520px, 100%);
  max-height: 86vh; overflow-y: auto;
  background: var(--sheet);
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  box-shadow: 0 22px 60px rgba(0, 0, 0, .25);
  padding: 24px;
  animation: rise .3s ease both;
}
.modal-card h3 { margin: 0 0 3px; font-family: var(--font-display); font-size: 20px; letter-spacing: .08em; }
.modal-card .sub { margin: 0 0 16px; color: var(--muted); font-size: 11.5px; }

.field { margin-bottom: 12px; }
.field label { display: block; font-size: 11.5px; color: var(--muted); margin-bottom: 5px; letter-spacing: .06em; }
.field input, .field select {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: var(--sheet-2);
  font-size: 13.5px;
  outline: none;
}
.field input:focus, .field select:focus { border-color: var(--teal); box-shadow: 0 0 0 3px color-mix(in srgb, var(--teal) 15%, transparent); }
.field .err { color: var(--bad); font-size: 11px; margin-top: 4px; display: none; }
.field.invalid .err { display: block; }
.field.invalid input { border-color: var(--bad); }

/* 题库 JSON 编辑器 */
.bank-json {
  width: 100%;
  min-height: 320px;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--sheet-2);
  color: var(--ink);
  font-family: ui-monospace, Consolas, "Courier New", monospace;
  font-size: 12px;
  line-height: 1.6;
  resize: vertical;
  outline: none;
}
.bank-json:focus { border-color: var(--teal); box-shadow: 0 0 0 3px color-mix(in srgb, var(--teal) 15%, transparent); }

.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }

/* ---------- 提示 ---------- */
.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 16px);
  background: var(--ink); color: var(--sheet);
  padding: 10px 18px; border-radius: 999px;
  font-size: 12.5px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .2);
  opacity: 0; pointer-events: none;
  transition: opacity .25s, transform .25s;
  z-index: 90;
  max-width: 88vw;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.gold { background: var(--gold); color: #1E2E28; }
.toast.bad { background: var(--bad); color: #fff; }

/* ---------- 动效 ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes pop { 0% { opacity: 0; transform: scale(.9); } 100% { opacity: 1; transform: scale(1); } }
.fade-in > * { animation: rise .4s cubic-bezier(.2, .8, .2, 1) both; }
.fade-in > *:nth-child(2) { animation-delay: .04s; }
.fade-in > *:nth-child(3) { animation-delay: .08s; }
.fade-in > *:nth-child(4) { animation-delay: .12s; }
.fade-in > *:nth-child(5) { animation-delay: .16s; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ---------- 响应式 ---------- */
@media (max-width: 1080px) {
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero { grid-template-columns: 1fr; }
  .hero-side { border-left: 0; border-top: 1px dashed var(--line-strong); flex-direction: row; align-items: center; flex-wrap: wrap; }
  .hero-side > * { flex: 1; }
  .xsc-hero { grid-template-columns: 1fr; }
}

@media (max-width: 860px) {
  .app { display: block; }
  .rail {
    position: fixed; left: 0; right: 0; bottom: 0; top: auto;
    width: 100%; height: auto; z-index: 40;
    flex-direction: row; align-items: center;
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
    border-right: 0; border-top: 1px solid var(--line-strong);
    background: var(--sheet);
    overflow-x: auto;
  }
  .brand, .rail-foot { display: none; }
  .nav { flex-direction: row; gap: 0; width: 100%; justify-content: space-between; }
  .nav-btn { flex-direction: column; gap: 2px; padding: 4px 2px; flex: 1; align-items: center; border-radius: 8px; }
  .nav-btn i { width: 26px; height: 26px; flex-basis: 26px; font-size: 13px; }
  .nav-btn span { font-size: 9.5px; letter-spacing: 0; }
  .main { padding-bottom: 70px; }
  .topbar { padding: 13px 16px 10px; align-items: center; }
  .topbar-title h1 { font-size: 19px; }
  .topbar-title p { display: none; }
  .pill em { display: none; }
  .pill { padding: 3px 9px; }
  .profile { padding: 3px 4px; }
  .profile-text { display: none; }
  .view { padding: 16px 14px 6px; }
  .page-foot { padding: 14px 16px 18px; flex-direction: column; gap: 4px; }
  .g2, .g3 { grid-template-columns: 1fr; }
  .badge-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kp-row { grid-template-columns: 1fr 70px auto; }
  .kp-row .pct { display: none; }
  .q-card { padding: 18px 16px; }
  .q-text { font-size: 16.5px; }
  .result { padding: 22px 16px; }
  .result-stats { grid-template-columns: repeat(2, 1fr); }
  .session { padding: 12px 12px 30px; }
  .session[hidden] { display: none; }
  .session-top .session-timer { font-size: 13px; padding: 4px 8px; min-width: 52px; }
  .hero-main { padding: 20px 18px; }
  .hero-title { font-size: 30px; }
  .hero-side { padding: 18px; }
  .heat { grid-template-columns: repeat(10, 1fr); }
  .week div { font-size: 9px; padding: 4px 0 2px; }
}

/* 手机竖屏：首屏卡片改为上下堆叠，九宫格导航压缩到能一行放下 */
@media (max-width: 480px) {
  .hero-side { flex-direction: column; align-items: stretch; }
  .hero-side > * { flex: 0 0 auto; min-width: 0; }
  .hero-side .goal-ring { margin: 0 auto; }
  .nav-btn { flex: 1 1 0; min-width: 0; padding: 4px 0; gap: 1px; }
  .nav-btn i { width: 24px; height: 24px; flex-basis: 24px; font-size: 12px; }
  .nav-btn span { font-size: 9px; letter-spacing: 0; }
  .task { padding: 11px 12px; }
  .heat { grid-template-columns: repeat(7, 1fr); }
}

/* ---------- 打印 ---------- */
@media print {
  body { background: #fff; }
  body::before { display: none; }
  .rail, .topbar-side, .page-foot, .btn, .session, .modal, .toast { display: none !important; }
  .app { display: block; }
  .rail { display: none; }
  .view { padding: 0; }
  .card, .stat, .audit-score { box-shadow: none; }
  .main { padding: 0; }
  .topbar { position: static; }
}
