/* ============================================================
   知源 · 组件样式 (ui.css)：毛玻璃卡片、按钮、徽章、题目卡、结果卡
   ============================================================ */

/* ---------------------------------------------- 毛玻璃卡片 */
/* Glass card: 半透明底 + 大背景模糊 + 高光描边 + 柔和投影 = 扁平化毛玻璃 */
.card {
  position: relative;
  background: var(--glass);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(var(--sat));
  backdrop-filter: blur(var(--blur)) saturate(var(--sat));
  border: 1px solid var(--glass-brd);
  border-radius: var(--r-lg);
  padding: var(--sp-5);
  box-shadow: var(--shadow-2);
  transition: transform var(--t-mid) var(--ease), box-shadow var(--t-mid) var(--ease),
    background var(--t-mid) var(--ease);
}
.card::after {
  /* 顶部高光，制造玻璃厚度感 */
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 42%;
  border-radius: var(--r-lg) var(--r-lg) 40% 40%;
  background: linear-gradient(180deg, var(--glass-hi), transparent);
  opacity: 0.5;
  pointer-events: none;
}
.card > * {
  position: relative;
  z-index: 1;
}
.card-flat {
  box-shadow: var(--shadow-1);
}
.card-pad-sm {
  padding: var(--sp-4);
}
.card-hover:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-3);
}
.card-accent {
  border-color: var(--accent-40);
}

/* 可点击卡片（年级入口等） */
.tile {
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-decoration: none;
  color: var(--ink);
  cursor: pointer;
  border: none;
  text-align: left;
  font-family: inherit;
  position: relative;
  overflow: hidden;
}
.tile .tile-ico {
  font-size: 26px;
  line-height: 1;
  margin-bottom: 2px;
}
.tile .tile-name {
  font-size: 16px;
  font-weight: 750;
}
.tile .tile-meta {
  font-size: 12.5px;
  color: var(--ink-3);
}
.tile .tile-bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  opacity: 0;
  transition: opacity var(--t-mid) var(--ease);
}
.tile:hover .tile-bar {
  opacity: 1;
}

/* ---------------------------------------------- 按钮 */
.btn {
  --btn-bg: var(--glass-hi);
  --btn-fg: var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 11px 20px;
  border: 1px solid var(--glass-brd);
  border-radius: var(--r-pill);
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  -webkit-backdrop-filter: blur(12px) saturate(1.3);
  backdrop-filter: blur(12px) saturate(1.3);
  box-shadow: var(--shadow-1);
  transition: transform var(--t-fast) var(--ease-back), box-shadow var(--t-fast) var(--ease),
    background var(--t-fast) var(--ease), opacity var(--t-fast) var(--ease);
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-2);
}
.btn:active {
  transform: translateY(0) scale(0.985);
}
.btn[disabled],
.btn.is-disabled {
  opacity: 0.45;
  pointer-events: none;
}
.btn svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.btn-primary {
  --btn-bg: linear-gradient(135deg, var(--accent), var(--accent-2));
  --btn-fg: var(--accent-ink);
  border-color: transparent;
  box-shadow: 0 10px 24px -8px var(--accent-40);
}
.btn-primary:hover {
  box-shadow: 0 16px 34px -10px var(--accent-40);
}
.btn-ghost {
  background: transparent;
  border-color: var(--line);
  box-shadow: none;
}
.btn-ghost:hover {
  background: var(--glass-hi);
}
.btn-danger {
  --btn-bg: var(--bad-soft);
  --btn-fg: var(--bad);
  border-color: transparent;
}
.btn-lg {
  min-height: 54px;
  padding: 14px 28px;
  font-size: 16.5px;
  border-radius: var(--r-pill);
}
.btn-sm {
  min-height: 34px;
  padding: 6px 13px;
  font-size: 13px;
}
.btn-block {
  width: 100%;
}
.btn-icon {
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: var(--r-sm);
}

/* ---------------------------------------------- 标签 / 徽章 / 药丸 */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 11px;
  border-radius: var(--r-pill);
  background: var(--glass-hi);
  border: 1px solid var(--glass-brd);
  font-size: 12.5px;
  font-weight: 650;
  color: var(--ink-2);
  white-space: nowrap;
}
.chip-accent {
  background: var(--accent-soft);
  border-color: transparent;
  color: var(--accent);
}
.chip-ok {
  background: var(--ok-soft);
  border-color: transparent;
  color: var(--ok);
}
.chip-warn {
  background: var(--warn-soft);
  border-color: transparent;
  color: var(--warn);
}
.chip-bad {
  background: var(--bad-soft);
  border-color: transparent;
  color: var(--bad);
}
.chip-lv-primary {
  background: var(--lv-primary-soft);
  border-color: transparent;
  color: var(--lv-primary);
}
.chip-lv-junior {
  background: var(--lv-junior-soft);
  border-color: transparent;
  color: var(--lv-junior);
}
.chip-lv-senior {
  background: var(--lv-senior-soft);
  border-color: transparent;
  color: var(--lv-senior);
}

/* 可点击筛选片 */
.seg {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  background: var(--glass-2);
  border: 1px solid var(--glass-brd);
  border-radius: var(--r-pill);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  overflow-x: auto;
  max-width: 100%;
  scrollbar-width: none;
}
.seg::-webkit-scrollbar {
  display: none;
}
.seg button {
  border: none;
  background: transparent;
  color: var(--ink-2);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 650;
  padding: 7px 14px;
  border-radius: var(--r-pill);
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.seg button:hover {
  background: var(--glass-hi);
}
.seg button[aria-pressed="true"] {
  background: var(--accent);
  color: var(--accent-ink);
  box-shadow: 0 6px 14px -6px var(--accent-40);
}

/* ---------------------------------------------- 输入 */
.input,
.select {
  width: 100%;
  min-height: 44px;
  padding: 10px 16px;
  border-radius: var(--r-pill);
  border: 1px solid var(--glass-brd);
  background: var(--glass-hi);
  color: var(--ink);
  font-family: inherit;
  font-size: 15px;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  outline: none;
  transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}
.input::placeholder {
  color: var(--ink-3);
}
.input:focus,
.select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.search-wrap {
  position: relative;
  flex: 1 1 220px;
  min-width: 0;
}
.search-wrap svg {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 17px;
  height: 17px;
  color: var(--ink-3);
  pointer-events: none;
}
.search-wrap .input {
  padding-left: 40px;
}

/* ---------------------------------------------- 进度条 / 环 */
.bar {
  height: 9px;
  border-radius: var(--r-pill);
  background: var(--glass-2);
  overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(15, 32, 60, 0.08);
}
.bar > i {
  display: block;
  height: 100%;
  border-radius: var(--r-pill);
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width var(--t-slow) var(--ease);
}
.ring {
  --p: 0;
  width: 66px;
  height: 66px;
  border-radius: 50%;
  background: conic-gradient(var(--accent) calc(var(--p) * 1%), var(--glass-2) 0);
  display: grid;
  place-items: center;
  flex: 0 0 auto;
}
.ring > b {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: var(--bg-2);
  display: grid;
  place-items: center;
  font-size: 14px;
  box-shadow: var(--shadow-1);
}

/* ---------------------------------------------- 英雄区 */
.hero {
  position: relative;
  padding: var(--sp-7) var(--sp-5);
  border-radius: var(--r-xl);
  background: var(--glass);
  -webkit-backdrop-filter: blur(20px) saturate(var(--sat));
  backdrop-filter: blur(20px) saturate(var(--sat));
  border: 1px solid var(--glass-brd);
  box-shadow: var(--shadow-3);
  overflow: hidden;
  margin-bottom: var(--sp-6);
}
.hero-grid {
  display: grid;
  grid-template-columns: 1.25fr 0.75fr;
  gap: var(--sp-6);
  align-items: center;
}
@media (max-width: 860px) {
  .hero-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .hero {
    padding: var(--sp-6) var(--sp-4);
  }
}
.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 14px;
  border-radius: var(--r-pill);
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
  margin-bottom: var(--sp-4);
}
.hero-lead {
  font-size: 16.5px;
  color: var(--ink-2);
  max-width: 44em;
}
.hero-cta {
  display: flex;
  gap: var(--sp-3);
  flex-wrap: wrap;
  margin-top: var(--sp-5);
}

/* 学习进度条：设过年级之后，首页给一个「开始测试」的直达入口，
   其他年级都收进「修改年级设置」页，首页只留这一行 */
.plan-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: var(--sp-3);
  padding: 9px 12px 9px 13px;
  border-radius: var(--r-md);
  background: var(--bg-2);
  border: 1px solid var(--line);
  text-decoration: none;
  color: inherit;
}
.plan-bar .plan-ico {
  font-size: 17px;
  line-height: 1;
  flex: none;
}
.plan-bar .plan-txt {
  flex: 1 1 200px;
  min-width: 0;
  font-size: 13px;
  color: var(--ink-2);
  line-height: 1.6;
}
.plan-bar .plan-txt b {
  color: var(--ink);
  font-weight: 700;
}
.plan-bar .plan-edit {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--accent);
  text-decoration: none;
  white-space: nowrap;
}
.plan-bar .plan-edit:hover {
  text-decoration: underline;
}
.plan-bar.is-empty {
  background: var(--accent-soft);
  border-color: transparent;
}
.plan-bar.is-empty .plan-txt {
  color: var(--ink-2);
}

/* 吉祥物 */
.mascot {
  position: relative;
  display: grid;
  place-items: center;
}
.mascot svg,
.mascot img {
  width: min(100%, 260px);
  height: auto;
  filter: drop-shadow(0 18px 26px rgba(15, 32, 60, 0.18));
  animation: float 5.5s var(--ease) infinite alternate;
}
@keyframes float {
  to {
    transform: translateY(-14px) rotate(-2.5deg);
  }
}
@media (prefers-reduced-motion: reduce) {
  .mascot svg {
    animation: none;
  }
}

/* ---------------------------------------------- 统计卡 */
.stat {
  text-align: center;
  padding: var(--sp-4);
}
.stat b {
  display: block;
  font-size: 30px;
  font-weight: 850;
  font-family: var(--font-num);
  line-height: 1.1;
  letter-spacing: -1px;
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.stat span {
  display: block;
  font-size: 12.5px;
  color: var(--ink-3);
  margin-top: 4px;
}

/* ---------------------------------------------- 步骤 */
.steps {
  counter-reset: st;
  display: grid;
  gap: var(--sp-4);
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
}
.step {
  counter-increment: st;
  position: relative;
  padding-top: var(--sp-5);
}
.step::before {
  content: counter(st);
  position: absolute;
  top: -6px;
  left: 0;
  width: 34px;
  height: 34px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-family: var(--font-num);
  font-weight: 800;
  font-size: 16px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: var(--accent-ink);
  box-shadow: var(--shadow-accent);
}

/* ---------------------------------------------- 题目卡 */
.q-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  margin-bottom: var(--sp-4);
  flex-wrap: wrap;
}
.q-stem {
  font-size: 19px;
  font-weight: 700;
  line-height: 1.6;
  margin-bottom: var(--sp-4);
}
.q-stem .blank {
  color: var(--accent);
}
.opts {
  display: grid;
  gap: 10px;
}
.opt {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 54px;
  padding: 13px 16px;
  border-radius: var(--r-md);
  border: 1.5px solid var(--glass-brd);
  background: var(--glass-hi);
  color: var(--ink);
  font-family: inherit;
  font-size: 16.5px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: transform var(--t-fast) var(--ease-back), border-color var(--t-fast) var(--ease),
    background var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.opt:hover:not(.is-locked) {
  transform: translateY(-2px);
  border-color: var(--accent-40);
  box-shadow: var(--shadow-2);
}
.opt .key {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent);
  font-family: var(--font-num);
  font-weight: 800;
  font-size: 15px;
}
.opt.is-correct {
  border-color: var(--ok);
  background: var(--ok-soft);
}
.opt.is-correct .key {
  background: var(--ok);
  color: #fff;
}
.opt.is-wrong {
  border-color: var(--bad);
  background: var(--bad-soft);
}
.opt.is-wrong .key {
  background: var(--bad);
  color: #fff;
}
.opt.is-locked {
  cursor: default;
}
/* 已作答时只标"你选的是这个"，不标对错（对错留到结果页说） */
.opt.is-picked {
  border-color: var(--accent-40);
  background: var(--accent-soft);
}
.opt.is-picked .key {
  background: var(--accent);
  color: #fff;
}

.num-pad {
  display: flex;
  gap: 10px;
  align-items: stretch;
  flex-wrap: wrap;
}
.num-pad .input {
  font-size: 21px;
  font-family: var(--font-num);
  text-align: center;
  font-weight: 700;
  flex: 1 1 160px;
  min-height: 56px;
}

.feedback {
  margin-top: var(--sp-4);
  padding: var(--sp-4);
  border-radius: var(--r-md);
  border-left: 4px solid var(--accent);
  background: var(--glass-hi);
  animation: pop 0.32s var(--ease-back);
}
.feedback.ok {
  border-left-color: var(--ok);
}
.feedback.bad {
  border-left-color: var(--bad);
}
/* 答题过程中只用这一档：中性、安静，不暗示对错 */
.feedback.neutral {
  border-left-color: var(--accent-40);
  padding: 10px var(--sp-4);
}
@keyframes pop {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }
}
.fb-title {
  font-weight: 800;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 7px;
}
.fb-title.ok {
  color: var(--ok);
}
.fb-title.bad {
  color: var(--bad);
}

/* 做题进度点 */
.dots {
  display: flex;
  gap: 6px;
  align-items: center;
}
.dots i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--line);
  transition: background var(--t-fast) var(--ease), transform var(--t-fast) var(--ease-back);
}
.dots i.ok {
  background: var(--ok);
}
.dots i.bad {
  background: var(--bad);
}
/* 答题中的进度点：只表示做过，不表示对错 */
.dots i.done {
  background: var(--accent);
  opacity: 0.5;
}
.dots i.now {
  transform: scale(1.5);
  background: var(--accent);
}

/* ---------------------------------------------- 结果页错题复盘 */
.wrong-list {
  display: grid;
  gap: 8px;
  max-height: 420px;
  overflow-y: auto;
  padding: 4px 2px;
  margin-top: 4px;
}
.wrong-row {
  display: block;
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--glass-hi);
  color: var(--ink-2);
  font-family: inherit;
  font-size: 14px;
  text-align: left;
}

/* ---------------------------------------------- 结果卡 */
.result-hero {
  display: flex;
  align-items: center;
  gap: var(--sp-5);
  flex-wrap: wrap;
}
.score-big {
  font-size: 54px;
  font-weight: 850;
  font-family: var(--font-num);
  line-height: 1;
  letter-spacing: -2px;
}
/* AI 教研建议：整段中文长文，行距要松一点才好读；段落由 JS 按空行切开 */
.ai-coach p {
  margin: 0 0 10px;
  line-height: 1.9;
  font-size: 14.5px;
  color: var(--ink);
  white-space: pre-wrap;
}
.ai-coach p:last-of-type {
  margin-bottom: 12px;
}

.path-list {
  position: relative;
  padding-left: 26px;
  margin: 0;
  list-style: none;
}
.path-list::before {
  content: "";
  position: absolute;
  left: 8px;
  top: 6px;
  bottom: 6px;
  width: 2px;
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
  opacity: 0.4;
  border-radius: 2px;
}
.path-list li {
  position: relative;
  padding: 7px 0;
}
.path-list li::before {
  content: "";
  position: absolute;
  left: -22px;
  top: 15px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--bg-2);
  border: 2.5px solid var(--accent);
}
.path-list li.root::before {
  border-color: var(--bad);
  background: var(--bad);
  box-shadow: 0 0 0 4px var(--bad-soft);
}

/* ---------------------------------------------- 图谱容器 */
.graph-wrap {
  position: relative;
  border-radius: var(--r-lg);
  overflow: hidden;
  background: var(--glass-2);
  border: 1px solid var(--glass-brd);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  min-height: 380px;
  touch-action: none;
}
.graph-wrap svg {
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
}
.graph-wrap svg.is-panning {
  cursor: grabbing;
}
.graph-tools {
  position: absolute;
  right: 10px;
  bottom: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 3;
}
.graph-legend {
  position: absolute;
  left: 10px;
  top: 10px;
  z-index: 3;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 11px;
  border-radius: var(--r-sm);
  background: var(--glass);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border: 1px solid var(--glass-brd);
  font-size: 11.5px;
  color: var(--ink-2);
}
.graph-legend span {
  display: flex;
  align-items: center;
  gap: 6px;
}
.graph-legend i {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  flex: 0 0 auto;
}
.gnode {
  cursor: pointer;
}
.gnode rect {
  transition: filter var(--t-fast) var(--ease);
}
.gnode:hover rect {
  filter: brightness(1.06);
}
.gnode.is-sel rect {
  stroke-width: 3;
}

/* ---------------------------------------------- 详情列表 */
.kv {
  display: grid;
  grid-template-columns: 76px 1fr;
  gap: 6px var(--sp-3);
  font-size: 14px;
}
.kv dt {
  color: var(--ink-3);
  font-size: 13px;
}
.kv dd {
  margin: 0;
}

.list-plain {
  list-style: none;
  padding: 0;
  margin: 0;
}
.list-plain li {
  padding: 9px 0;
  border-bottom: 1px dashed var(--line);
}
.list-plain li:last-child {
  border-bottom: none;
}

/* 目录树 */
.catalog-group {
  margin-bottom: 10px;
}
.catalog-head {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 9px 12px;
  border: none;
  border-radius: var(--r-sm);
  background: var(--glass-hi);
  color: var(--ink);
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  text-align: left;
}
.catalog-head:hover {
  background: var(--accent-soft);
}
.catalog-head .arrow {
  transition: transform var(--t-fast) var(--ease);
  color: var(--ink-3);
}
.catalog-head[aria-expanded="true"] .arrow {
  transform: rotate(90deg);
}
.catalog-items {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 4px 0 4px 14px;
}
.topic-link {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 7px 10px;
  border: none;
  border-radius: var(--r-xs);
  background: transparent;
  color: var(--ink-2);
  font-family: inherit;
  font-size: 13.5px;
  text-align: left;
  cursor: pointer;
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.topic-link:hover {
  background: var(--glass-hi);
  color: var(--ink);
}
.topic-link.is-sel {
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 700;
}
.topic-link .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex: 0 0 auto;
  background: var(--lv-junior);
}
.topic-link.is-sel .dot {
  background: currentColor;
}

/* ------------------------------------------- 按学习进度选（册 + 单元目录） */
.unit-list {
  display: grid;
  gap: 6px;
  max-height: 320px;
  overflow: auto;
  padding: 4px 2px;
  margin-top: 4px;
}
.unit-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--glass-hi);
  color: var(--ink-2);
  font-family: inherit;
  font-size: 14px;
  text-align: left;
  cursor: pointer;
  transition: transform var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease),
    background var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}
.unit-row:hover {
  transform: translateX(3px);
  border-color: var(--accent-soft);
  color: var(--ink);
}
.unit-row.is-sel {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent);
  color: var(--ink);
}
.unit-row.is-empty {
  border-style: dashed;
  background: transparent;
  color: var(--ink-2);
  opacity: 0.72;
}
.unit-row.is-empty .unit-no {
  color: var(--ink-2);
}
.unit-row .unit-no {
  flex: 0 0 auto;
  min-width: 68px;
  font-weight: 800;
  font-size: 12.5px;
  letter-spacing: 0.02em;
  color: var(--accent);
}
.unit-row .unit-name {
  flex: 1 1 auto;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.unit-row.is-sel .unit-no {
  color: var(--ink);
}
.scope-note {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-top: 14px;
  padding: 12px 14px;
  border-left: 3px solid var(--accent);
  border-radius: var(--r-xs);
  background: var(--glass-hi);
  font-size: 13.5px;
  color: var(--ink-2);
}
.scope-note b {
  color: var(--ink);
  font-size: 14.5px;
}
.btn-ghost {
  background: transparent;
  border: 1.5px dashed var(--line);
  color: var(--ink-2);
}
.btn-ghost:hover {
  border-color: var(--accent);
  color: var(--ink);
}
.unit-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 9px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 15%, transparent);
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

/* ---------------------------------------------- 弹层 / 提示 */
.mask {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  display: grid;
  place-items: center;
  padding: var(--sp-4);
  background: rgba(10, 22, 40, 0.34);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  animation: fade 0.2s var(--ease);
}
@keyframes fade {
  from {
    opacity: 0;
  }
}
.modal {
  width: min(560px, 100%);
  max-height: 86vh;
  overflow: auto;
  background: var(--glass);
  -webkit-backdrop-filter: blur(26px) saturate(var(--sat));
  backdrop-filter: blur(26px) saturate(var(--sat));
  border: 1px solid var(--glass-brd);
  border-radius: var(--r-lg);
  padding: var(--sp-5);
  box-shadow: var(--shadow-3);
  animation: rise 0.3s var(--ease-back);
}
@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(22px) scale(0.97);
  }
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  margin-bottom: var(--sp-4);
}

.toasts {
  position: fixed;
  z-index: var(--z-toast);
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(84px + var(--safe-b));
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
  width: max-content;
  max-width: calc(100vw - 24px);
}
.toast {
  padding: 11px 20px;
  border-radius: var(--r-pill);
  background: var(--glass);
  -webkit-backdrop-filter: blur(20px) saturate(var(--sat));
  backdrop-filter: blur(20px) saturate(var(--sat));
  border: 1px solid var(--glass-brd);
  box-shadow: var(--shadow-3);
  font-size: 14.5px;
  font-weight: 650;
  animation: rise 0.3s var(--ease-back);
}
.toast.ok {
  color: var(--ok);
}
.toast.bad {
  color: var(--bad);
}

/* ---------------------------------------------- 皮肤选择器 */
.skin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
  gap: 10px;
}
.skin-btn {
  border: 2px solid transparent;
  border-radius: var(--r-md);
  padding: 9px;
  background: var(--glass-hi);
  cursor: pointer;
  font-family: inherit;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  transition: transform var(--t-fast) var(--ease-back), border-color var(--t-fast) var(--ease);
}
.skin-btn:hover {
  transform: translateY(-2px);
}
.skin-btn[aria-pressed="true"] {
  border-color: var(--accent);
  box-shadow: var(--shadow-2);
}
.skin-swatch {
  width: 100%;
  height: 42px;
  border-radius: var(--r-sm);
  position: relative;
  overflow: hidden;
  display: flex;
}
.skin-swatch i {
  flex: 1;
}
.skin-btn span {
  font-size: 12.5px;
  font-weight: 650;
  color: var(--ink-2);
}

/* ---------------------------------------------- 徽章 */
.badge-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: var(--sp-3);
}
.badge-item {
  text-align: center;
  padding: var(--sp-4) var(--sp-2);
  border-radius: var(--r-md);
  background: var(--glass-2);
  border: 1px solid var(--glass-brd);
  transition: transform var(--t-fast) var(--ease-back);
}
.badge-item:hover {
  transform: translateY(-2px);
}
.badge-item .ico {
  font-size: 30px;
  line-height: 1;
  filter: grayscale(1);
  opacity: 0.35;
  transition: filter var(--t-mid) var(--ease), opacity var(--t-mid) var(--ease);
}
.badge-item.on .ico {
  filter: none;
  opacity: 1;
}
.badge-item .nm {
  font-size: 13px;
  font-weight: 700;
  margin-top: 7px;
}
.badge-item .ds {
  font-size: 11.5px;
  color: var(--ink-3);
  margin-top: 3px;
  line-height: 1.4;
}

/* ---------------------------------------------- 会员套餐 */
.plans {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--sp-4);
  align-items: stretch;
}
.plan {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}
.plan.hot {
  border-color: var(--accent);
  box-shadow: 0 20px 48px -18px var(--accent-40);
}
.plan-tag {
  position: absolute;
  top: -12px;
  right: 18px;
  padding: 4px 13px;
  border-radius: var(--r-pill);
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: var(--accent-ink);
  font-size: 12px;
  font-weight: 750;
  box-shadow: var(--shadow-accent);
}
.price {
  font-size: 36px;
  font-weight: 850;
  font-family: var(--font-num);
  letter-spacing: -1.5px;
  line-height: 1;
}
.price small {
  font-size: 14px;
  font-weight: 650;
  color: var(--ink-3);
  letter-spacing: 0;
}
.plan ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 14px;
  flex: 1 1 auto;
}
.plan li {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}
.plan li::before {
  content: "✓";
  color: var(--ok);
  font-weight: 800;
  flex: 0 0 auto;
}

/* ---------------------------------------------- 空状态 / 骨架 */
.empty {
  text-align: center;
  padding: var(--sp-6) var(--sp-4);
  color: var(--ink-3);
}
.empty .ico {
  font-size: 40px;
  opacity: 0.6;
}
.skeleton {
  border-radius: var(--r-sm);
  background: linear-gradient(90deg, var(--glass-2) 25%, var(--glass-hi) 37%, var(--glass-2) 63%);
  background-size: 400% 100%;
  animation: shimmer 1.4s linear infinite;
  min-height: 16px;
}
@keyframes shimmer {
  to {
    background-position: -135% 0;
  }
}

/* ---------------------------------------------- 连击火焰 / 经验条（顶栏） */
.hud {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 12px 5px 8px;
  border-radius: var(--r-pill);
  background: var(--glass-hi);
  border: 1px solid var(--glass-brd);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  min-height: 40px;
  color: var(--ink);
  text-decoration: none;
}
.hud:hover {
  box-shadow: var(--shadow-2);
}
.hud .lvl {
  width: 28px;
  height: 28px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: var(--accent-ink);
  font-family: var(--font-num);
  font-size: 13px;
  font-weight: 800;
}
.hud .xp {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 54px;
}
.hud .hud-xp-line {
  font-size: 11px;
  line-height: 1.2;
  white-space: nowrap;
}
.hud .xp .bar {
  height: 5px;
}
.hud .flame {
  color: var(--warn);
}
/* 窄屏：390px 的手机上「品牌 + 等级 + 称号·成长值 + 连续天数」凑不下，
   会撑出 31px 的横向滚动。把成长值那段收掉，只留称号与进度条。 */
@media (max-width: 430px) {
  .hud .hud-xp {
    display: none;
  }
}

/* ---------------------------------------------- 撒花 */
.confetti {
  position: fixed;
  inset: 0;
  z-index: var(--z-toast);
  pointer-events: none;
  overflow: hidden;
}
.confetti i {
  position: absolute;
  width: 9px;
  height: 14px;
  border-radius: 2px;
  animation: fall 2.4s linear forwards;
}
@keyframes fall {
  to {
    transform: translateY(108vh) rotate(720deg);
    opacity: 0.1;
  }
}

/* ---------------------------------------------- 打印 */
@media print {
  .topbar,
  .tabbar,
  .bg-deco,
  .graph-tools,
  .no-print {
    display: none !important;
  }
  .card,
  .hero {
    box-shadow: none;
    border: 1px solid #ddd;
    background: #fff;
  }
  body {
    background: #fff;
  }
}

/* ================================================ 语音朗读 / 听力 / 低年级模式
   一年级孩子不认识字，二年级孩子认字不全，英语听力题本来就不能靠看。
   所以：题干、每个选项都能单独点读；听力题有播放、慢速、重听。 */

.q-stem-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: var(--sp-4);
}
.q-stem-row .q-stem {
  margin-bottom: 0;
  flex: 1 1 auto;
  min-width: 0;
}

.speak {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1.5px solid var(--glass-brd);
  background: var(--glass-hi);
  color: var(--accent);
  display: grid;
  place-items: center;
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform var(--t-fast) var(--ease-back), background var(--t-fast) var(--ease),
    border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}
.speak:hover {
  transform: translateY(-1px) scale(1.06);
  border-color: var(--accent-40);
}
.speak.speak-sm {
  width: 32px;
  height: 32px;
  font-size: 15px;
}
.speak.speak-on {
  background: var(--accent);
  color: #fff;
  border-color: transparent;
  animation: speakPulse 1.1s var(--ease) infinite;
}
.speak.speak-bad {
  color: var(--ink-3);
  opacity: 0.5;
}
@keyframes speakPulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 var(--accent-40);
  }
  50% {
    box-shadow: 0 0 0 7px rgba(0, 0, 0, 0);
  }
}

.listen-card {
  border: 1.5px dashed var(--accent-40);
  border-radius: var(--r-md);
  padding: var(--sp-4);
  background: var(--accent-soft);
  margin-bottom: var(--sp-4);
}
.listen-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.listen-play {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  padding: 10px 20px;
  border-radius: 999px;
  border: none;
  background: var(--accent);
  color: #fff;
  font-family: inherit;
  font-size: 16px;
  font-weight: 750;
  cursor: pointer;
  box-shadow: var(--shadow-2);
  transition: transform var(--t-fast) var(--ease-back);
}
.listen-play.listen-slow {
  background: var(--glass-hi);
  color: var(--accent);
  border: 1.5px solid var(--accent-40);
  box-shadow: none;
}
.listen-play:active {
  transform: scale(0.97);
}
.listen-text {
  margin-top: var(--sp-3);
  padding-top: var(--sp-3);
  border-top: 1px dashed var(--glass-brd);
}
.listen-text.hidden {
  display: none;
}

/* 一、二年级：字更大、行更高、按钮更厚，手指点得中 */
.kid-mode .q-stem {
  font-size: 23px;
  line-height: 1.7;
}
.kid-mode .opt {
  min-height: 68px;
  padding: 16px 18px;
  font-size: 19px;
}
.kid-mode .opt .key {
  width: 36px;
  height: 36px;
  font-size: 17px;
}
.kid-mode .btn {
  min-height: 50px;
  font-size: 17px;
}
.kid-mode .feedback {
  font-size: 16px;
}
.kid-mode .num-pad .input {
  min-height: 56px;
  font-size: 20px;
}
/* ───────────────────────── 答题中的鼓励浮层 ─────────────────────────
   半透明毛玻璃，顶部居中滑入、2.4s 自动淡出。
   pointer-events: none —— 绝不挡住答题，孩子不看也行。
   视觉上刻意做得"轻"：它是背景音式的鼓励，不是需要应付的弹窗。 */
.cheer-pop {
  position: fixed;
  z-index: var(--z-toast);
  left: 50%;
  top: calc(18px + var(--safe-t));
  transform: translate(-50%, -14px) scale(0.96);
  opacity: 0;
  pointer-events: none;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px 12px 16px;
  max-width: calc(100vw - 32px);
  border-radius: var(--r-lg);
  background: var(--glass);
  background: color-mix(in srgb, var(--bg-2) 58%, transparent);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  backdrop-filter: blur(16px) saturate(1.4);
  border: 1px solid var(--glass-brd);
  box-shadow: var(--shadow-2);
  transition: opacity var(--t-mid) var(--ease), transform var(--t-mid) var(--ease-back);
}
.cheer-pop.show {
  opacity: 1;
  transform: translate(-50%, 0) scale(1);
}
.cheer-pop.out {
  opacity: 0;
  transform: translate(-50%, -10px) scale(0.98);
}
.cheer-ico {
  font-size: 26px;
  line-height: 1;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.12));
}
.cheer-main { display: flex; flex-direction: column; gap: 2px; }
.cheer-title {
  font-weight: 800;
  font-size: 1.02rem;
  letter-spacing: 0.01em;
  /* 用实色，别用 background-clip:text —— 主题变量缺失时会让标题整个看不见 */
  color: var(--accent);
}
.cheer-sub { font-size: 0.78rem; color: var(--muted, #667); }
/* 等级越高越"亮"：给孩子的心理暗示是"我走得越来越远" */
.cheer-pop[data-level="2"] { box-shadow: var(--shadow-2), 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent); }
.cheer-pop[data-level="3"] { box-shadow: var(--shadow-2), 0 0 0 4px color-mix(in srgb, var(--accent) 24%, transparent); }
@media (max-width: 430px) {
  .cheer-pop { padding: 10px 14px 10px 12px; gap: 9px; top: calc(10px + var(--safe-t)); }
  .cheer-title { font-size: 0.95rem; }
  .cheer-ico { font-size: 22px; }
}
/* 尊重「减少动效」系统设置 */
html[data-reduce-motion="1"] .cheer-pop,
html[data-reduce-motion="1"] .cheer-pop.show,
html[data-reduce-motion="1"] .cheer-pop.out { transition: opacity 120ms linear; transform: translate(-50%, 0); }

/* 进度点脉冲：到鼓励节点时，最后那个"已完成"的点放大一下 */
.diag-top .dots i.pulse {
  animation: dotPulse 620ms var(--ease-back);
}
@keyframes dotPulse {
  0% { transform: scale(1); }
  40% { transform: scale(1.9); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 22%, transparent); }
  100% { transform: scale(1); }
}
html[data-reduce-motion="1"] .diag-top .dots i.pulse { animation: none; }

/* 练习里"正确答案"高亮：只在答错时标出来，帮孩子对上答案 */
.opt.is-answer {
  border-color: color-mix(in srgb, #1a9f6b 55%, transparent);
  background: color-mix(in srgb, #1a9f6b 10%, transparent);
}
.opt.is-answer .key { background: #1a9f6b; color: #fff; }

/* 通知铃铛上的未读红点 */
.notice-bell { position: relative; padding: 6px 10px; }
.notice-bell .dot {
  position: absolute;
  top: 0;
  right: 2px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 99px;
  background: #e0426b;
  color: #fff;
  font-size: 10px;
  line-height: 16px;
  text-align: center;
  font-weight: 700;
}
.notice-bell .dot[hidden] { display: none; }
