/* 三陶闯关 · 设计系统 v3
 * 配色：天蓝 + 白 + 亮粉（明亮清爽），60/30/10
 */
:root {
  --bg: #eff7ff;
  --bg-2: #f8fcff;
  --surface: #ffffff;
  --ink: #10344e;
  --ink-2: #3f6b8a;
  --muted: #8aa8bd;
  --line: #d8ebfa;
  --primary: #3d93d6;
  --primary-2: #2c7ab8;
  --accent: #ff8fb3;
  --accent-soft: #ffe9f1;
  --good: #2f8f6b;
  --bad: #cf5b4a;

  --shadow-sm: 0 1px 2px rgba(15, 42, 63, 0.04), 0 2px 8px rgba(15, 42, 63, 0.04);
  --shadow: 0 2px 6px rgba(15, 42, 63, 0.05), 0 10px 28px rgba(15, 42, 63, 0.07);
  --shadow-lg: 0 8px 20px rgba(15, 42, 63, 0.08), 0 24px 60px rgba(15, 42, 63, 0.12);

  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --r: 18px;
  --r-lg: 24px;
}

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

html, body {
  margin: 0; padding: 0; min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Segoe UI", "Helvetica Neue", "Microsoft YaHei", sans-serif;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: contain;
}

body::before {
  content: "";
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(900px 500px at 12% -10%, #e2eef8 0%, transparent 60%),
    radial-gradient(700px 420px at 95% 0%, #fdeee8 0%, transparent 55%),
    var(--bg);
}

#app { position: relative; min-height: 100dvh; padding-bottom: calc(78px + env(safe-area-inset-bottom)); }

/* ================= 顶栏（桌面） ================= */
.topnav {
  display: none;
  position: sticky; top: 0; z-index: 40;
  align-items: center; gap: 28px;
  height: 64px; padding: 0 32px;
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(16px) saturate(1.2);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; }
.logo {
  width: 30px; height: 30px; border-radius: 9px;
  display: grid; place-items: center;
  background: linear-gradient(140deg, var(--primary-2), var(--primary));
  color: #fff; font-size: 15px; font-weight: 700;
}
.brand-name { font-size: 16px; font-weight: 650; letter-spacing: 0.3px; }
.top-links { display: flex; gap: 4px; }
.tlink {
  border: 0; background: transparent; color: var(--ink-2);
  font-size: 14px; padding: 8px 14px; border-radius: 10px; cursor: pointer;
  transition: background 0.2s, color 0.2s;
}
.tlink:hover { background: var(--bg); }
.tlink.on { color: var(--primary); background: #e8f1f8; font-weight: 600; }
.top-right { margin-left: auto; }
.top-chip {
  font-size: 12.5px; color: var(--ink-2);
  background: var(--bg); border: 1px solid var(--line);
  padding: 5px 12px; border-radius: 99px;
}

/* ================= 通用 ================= */
.screen { padding: 20px 18px 30px; animation: screenIn 0.32s var(--ease) both; }
@keyframes screenIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.card {
  background: var(--surface);
  border: 1px solid rgba(220, 232, 241, 0.9);
  border-radius: var(--r);
  padding: 18px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 14px;
}
.row { display: flex; align-items: center; }
.between { display: flex; align-items: center; justify-content: space-between; }
.muted { color: var(--muted); font-size: 13px; }
.title { font-size: 16px; font-weight: 650; letter-spacing: 0.2px; }
.divider { height: 1px; background: var(--line); margin: 14px 0; }

.btn {
  display: flex; align-items: center; justify-content: center;
  width: 100%; height: 50px; border: 0; border-radius: 14px;
  background: var(--primary); color: #fff; font-size: 15.5px; font-weight: 600;
  letter-spacing: 0.3px; cursor: pointer; font-family: inherit;
  box-shadow: 0 6px 18px rgba(18, 58, 87, 0.22);
  transition: transform 0.2s var(--spring), box-shadow 0.2s, background 0.2s;
}
.btn:active { transform: translateY(1px) scale(0.985); box-shadow: 0 2px 8px rgba(18, 58, 87, 0.18); }
.btn.ghost { background: transparent; color: var(--primary); border: 1.5px solid var(--line); box-shadow: none; }
.btn.ghost:hover { border-color: var(--primary-2); background: #f4f9fd; }
.btn.plain { background: #e8f1f8; color: var(--primary); box-shadow: none; }
.btn:disabled { opacity: 0.4; pointer-events: none; }
.btn + .btn { margin-top: 10px; }

.press { transition: transform 0.22s var(--spring), box-shadow 0.22s; }
.press:active { transform: scale(0.985); }

.ripple {
  position: absolute; border-radius: 50%; pointer-events: none;
  background: rgba(255, 255, 255, 0.5);
  transform: scale(0); animation: rippleOut 0.6s var(--ease) forwards;
}
.ripple.dark { background: rgba(18, 58, 87, 0.12); }
@keyframes rippleOut { to { transform: scale(2.4); opacity: 0; } }

/* ================= 首页 ================= */
.hero {
  position: relative; overflow: hidden;
  background: linear-gradient(135deg, #4fa3e0 0%, #2f7ab8 72%);
  border-radius: var(--r-lg);
  padding: 26px 24px 22px;
  color: #fff;
  margin-bottom: 16px;
  box-shadow: 0 18px 44px rgba(47, 122, 184, 0.28);
}
.hero::after {
  content: ""; position: absolute; width: 300px; height: 300px; right: -110px; top: -140px;
  background: radial-gradient(circle, rgba(255, 143, 179, 0.34), transparent 68%);
  border-radius: 50%; animation: float 9s ease-in-out infinite;
}
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(12px); } }

.hello { margin: 0; font-size: 13px; opacity: 0.66; letter-spacing: 0.6px; }
.name { margin: 4px 0 0; font-size: 26px; font-weight: 650; letter-spacing: 0.2px; }
.streak-badge {
  position: relative; z-index: 1;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 16px; padding: 10px 16px; text-align: center; min-width: 82px;
}
.streak-badge .n { display: block; font-size: 24px; font-weight: 700; line-height: 1.15; font-variant-numeric: tabular-nums; }
.streak-badge .t { display: block; font-size: 11px; opacity: 0.7; margin-top: 2px; }

.hero-stats { display: flex; margin-top: 22px; padding-top: 16px; border-top: 1px solid rgba(255, 255, 255, 0.12); }
.hero-stat { flex: 1; }
.hero-stat:first-child { text-align: left; }
.hero-stat:nth-child(2) { text-align: center; }
.hero-stat:last-child { text-align: right; }
.hero-stat .n { display: block; font-size: 19px; font-weight: 650; font-variant-numeric: tabular-nums; letter-spacing: 0.3px; }
.hero-stat .t { display: block; font-size: 11.5px; opacity: 0.6; margin-top: 2px; }

.quick-row { display: flex; flex-direction: column; gap: 12px; margin-bottom: 22px; }
.quick-row .daily { margin-bottom: 0; }

.daily {
  position: relative; overflow: hidden;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: var(--r); padding: 16px 18px; margin-bottom: 22px;
  box-shadow: var(--shadow-sm);
}
.daily-tag {
  display: inline-block; background: var(--accent-soft); color: #b5543a;
  font-size: 11px; font-weight: 600; padding: 2px 9px; border-radius: 99px; margin-bottom: 6px;
}
.daily-title { font-size: 16.5px; font-weight: 650; }
.daily-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.daily-go {
  font-size: 14px; font-weight: 600; color: var(--primary); white-space: nowrap;
  display: flex; align-items: center; gap: 2px;
}
.daily-go::after { content: "›"; font-size: 20px; margin-top: -2px; }

.section-head { display: flex; align-items: baseline; justify-content: space-between; margin: 0 2px 12px; }
.section-head h2 { font-size: 15.5px; margin: 0; font-weight: 650; letter-spacing: 0.2px; }

.subjects { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.subject {
  position: relative; overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 16px 16px 14px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  will-change: transform;
  transition: box-shadow 0.25s var(--ease), border-color 0.25s;
}
.subject:hover { box-shadow: var(--shadow); border-color: #cfe0ec; }
.subject-head { display: flex; align-items: center; gap: 10px; }
.mono {
  width: 34px; height: 34px; border-radius: 10px; flex: 0 0 34px;
  display: grid; place-items: center;
  font-size: 15px; font-weight: 650;
  background: var(--tint); color: var(--c);
}
.subject-name { font-size: 15.5px; font-weight: 650; }
.subject-stars { color: var(--accent); font-size: 12px; letter-spacing: 2px; margin: 10px 0 8px; }
.bar { height: 4px; background: #edf3f8; border-radius: 99px; overflow: hidden; }
.bar > i { display: block; height: 100%; width: 0; background: var(--c); border-radius: 99px; transition: width 0.9s var(--ease); }
.subject-foot { display: flex; justify-content: space-between; margin-top: 9px; font-size: 11.5px; color: var(--muted); }

.stagger > * { animation: rise 0.5s var(--ease) both; }
.stagger > *:nth-child(1) { animation-delay: 0.02s; }
.stagger > *:nth-child(2) { animation-delay: 0.05s; }
.stagger > *:nth-child(3) { animation-delay: 0.08s; }
.stagger > *:nth-child(4) { animation-delay: 0.11s; }
.stagger > *:nth-child(5) { animation-delay: 0.14s; }
.stagger > *:nth-child(6) { animation-delay: 0.17s; }
.stagger > *:nth-child(7) { animation-delay: 0.2s; }
.stagger > *:nth-child(8) { animation-delay: 0.23s; }
.stagger > *:nth-child(9) { animation-delay: 0.26s; }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

.wrong-entry {
  display: flex; align-items: center; justify-content: space-between; cursor: pointer;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  padding: 16px 18px; box-shadow: var(--shadow-sm);
  transition: box-shadow 0.22s, border-color 0.22s;
}
.wrong-entry:hover { box-shadow: var(--shadow); border-color: #cfe0ec; }
.wrong-entry .ico-box {
  width: 34px; height: 34px; border-radius: 10px; background: var(--accent-soft);
  display: grid; place-items: center; margin-right: 12px; color: #b5543a; font-size: 15px;
}
.wrong-entry .arrow { color: var(--muted); font-size: 20px; }
.ico-box {
  width: 34px; height: 34px; border-radius: 10px; flex: 0 0 34px;
  display: grid; place-items: center; margin-right: 12px; font-size: 15px;
  background: #e8f1f8; color: var(--primary-2);
}
.pt-entry { display: flex; align-items: center; justify-content: space-between; cursor: pointer; }

/* ================= 覆盖页（关卡/答题/结算） ================= */
.screen.overlay {
  position: fixed; inset: 0; z-index: 20; background: var(--bg);
  overflow-y: auto; padding-bottom: calc(30px + env(safe-area-inset-bottom));
  animation: slideUp 0.34s var(--ease) both;
}
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: none; } }

.nav {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 12px;
  padding: 14px 18px 10px;
  background: rgba(238, 244, 249, 0.92);
  backdrop-filter: blur(10px);
}
.back {
  width: 34px; height: 34px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); cursor: pointer;
  display: grid; place-items: center; font-size: 17px; line-height: 1;
  transition: transform 0.2s var(--spring);
}
.back:active { transform: scale(0.92); }
.back { width: auto; padding: 0 12px; font-size: 13px; gap: 2px; white-space: nowrap; }
.nav-home {
  margin-left: auto; border: 1px solid var(--line); background: var(--surface);
  color: var(--ink-2); font-size: 12.5px; padding: 6px 12px; border-radius: 9px;
  cursor: pointer; font-family: inherit;
}
.nav-home:active { transform: scale(0.95); }
.nav-title { font-size: 16.5px; font-weight: 650; }
.nav .nav-sub { font-size: 12px; color: var(--muted); margin-left: auto; }

.pad { padding: 0 18px 20px; }

/* 筛选 */
.filters { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.filter-row { display: flex; align-items: center; gap: 10px; }
.filter-label { font-size: 12px; color: var(--muted); flex: 0 0 32px; }
.chips { display: flex; gap: 7px; overflow-x: auto; scrollbar-width: none; padding: 2px 0; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto; border: 1px solid var(--line); background: var(--surface);
  color: var(--ink-2); font-size: 12.5px; padding: 5px 13px; border-radius: 9px; cursor: pointer;
  font-family: inherit; transition: all 0.2s var(--spring); white-space: nowrap;
}
.chip:hover { border-color: #c3d8e8; }
.chip.on { background: var(--primary); border-color: var(--primary); color: #fff; }

.select {
  appearance: none; -webkit-appearance: none;
  flex: 1; min-width: 0; max-width: 420px;
  border: 1px solid var(--line); background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%238399ac' stroke-width='1.6'/%3E%3C/svg%3E") no-repeat right 12px center;
  color: var(--ink); font-size: 13px; padding: 8px 32px 8px 12px;
  border-radius: 9px; font-family: inherit; cursor: pointer;
  transition: border-color 0.2s;
}
.select:hover { border-color: #c3d8e8; }
.select:focus { outline: none; border-color: var(--primary-2); }

/* 题型配比 */
.pick-bar { flex-wrap: wrap; row-gap: 10px; }
.pick-bar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  padding: 12px 14px; margin-bottom: 14px; box-shadow: var(--shadow-sm);
}
.pick-label { font-size: 12px; color: var(--muted); white-space: nowrap; }
.steppers { display: flex; flex-wrap: wrap; gap: 8px; flex: 1 1 100%; }
.stepper {
  display: flex; align-items: center; gap: 2px;
  border: 1px solid var(--line); border-radius: 10px; padding: 2px; background: var(--bg-2);
}
.step-btn {
  width: 24px; height: 24px; border: 0; border-radius: 7px; background: transparent;
  color: var(--ink-2); font-size: 15px; line-height: 1; cursor: pointer; font-family: inherit;
  transition: background 0.15s;
}
.step-btn:hover { background: #e8f1f8; }
.step-btn:active { transform: scale(0.92); }
.stepper.off { opacity: 0.42; }
.step-btn[disabled] { cursor: not-allowed; }
.step-val { display: flex; align-items: baseline; gap: 3px; min-width: 42px; justify-content: center; }
.step-val span { font-size: 14px; font-weight: 650; font-variant-numeric: tabular-nums; }
.step-val i { font-size: 10px; color: var(--muted); font-style: normal; }
.pick-total { font-size: 12px; color: var(--primary-2); font-weight: 600; white-space: nowrap; }

/* 关卡 */
.level {
  display: flex; gap: 14px; align-items: center;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  padding: 15px 16px; box-shadow: var(--shadow-sm); margin-bottom: 10px;
  cursor: pointer; transition: box-shadow 0.22s, transform 0.22s var(--spring), border-color 0.22s;
}
.level:hover { box-shadow: var(--shadow); border-color: #cfe0ec; }
.level:active { transform: scale(0.99); }
.level.locked { opacity: 0.52; cursor: not-allowed; }
.level-dot {
  width: 42px; height: 42px; flex: 0 0 42px; border-radius: 12px;
  display: grid; place-items: center;
  background: #edf3f8; color: var(--muted); font-weight: 650; font-size: 15px;
}
.level.done .level-dot { background: #e6f2ec; color: var(--good); }
.level.full .level-dot { background: var(--accent-soft); color: #b5543a; }
.level-body { flex: 1; min-width: 0; }
.level-title { font-size: 15px; font-weight: 600; }
.level-meta { display: flex; align-items: center; gap: 10px; margin-top: 5px; }
.dots { display: flex; gap: 4px; }
.dot { width: 5px; height: 5px; border-radius: 50%; background: #dbe7f0; }
.dot.on { background: var(--primary-2); }
.level-stars { color: var(--accent); font-size: 12px; letter-spacing: 1.5px; }
.level.locked .level-stars { color: #cfdae3; }
.level-pool { font-size: 11.5px; color: var(--muted); margin-left: auto; }
.level-status {
  font-size: 11px; padding: 2px 9px; border-radius: 7px;
  background: #e8f1f8; color: var(--primary-2); white-space: nowrap;
}
.level-status.off { background: #f1f5f8; color: var(--muted); }

/* ================= 答题 ================= */
.quiz-top { padding: 14px 18px 8px; }
.progress { height: 4px; background: #dfeaf3; border-radius: 99px; overflow: hidden; }
.progress > i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--primary-2), var(--primary)); border-radius: 99px; transition: width 0.45s var(--ease); }
.quiz-meta { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-top: 9px; font-variant-numeric: tabular-nums; }
.quiz-meta .count { color: var(--primary); font-weight: 600; }

.q-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 22px; box-shadow: var(--shadow-sm); margin: 10px 0 14px;
}
.q-tags { display: flex; gap: 6px; margin-bottom: 12px; flex-wrap: wrap; }
.tag { font-size: 11px; padding: 2px 9px; border-radius: 6px; background: var(--accent-soft); color: #b5543a; font-weight: 500; }
.tag.plain { background: #e8f1f8; color: var(--primary-2); }
.tag.hint { background: #fdece6; color: #c9542f; }
.frac {
  display: inline-flex; flex-direction: column; vertical-align: -0.35em;
  text-align: center; margin: 0 3px; line-height: 1.05; font-size: 0.92em;
}
.frac i { font-style: normal; padding: 0 3px; }
.frac i:first-child { border-bottom: 1px solid currentColor; }
sup { font-size: 0.72em; vertical-align: 0.55em; margin-left: 1px; }
sub { font-size: 0.72em; vertical-align: -0.25em; margin-left: 1px; }

.q-updated { margin-top: 10px; font-size: 11px; color: var(--muted); }
.q-stem { font-size: 16.5px; line-height: 1.72; font-weight: 550; letter-spacing: 0.2px; }

.options { display: flex; flex-direction: column; gap: 10px; position: relative; }
.option {
  position: relative; overflow: hidden;
  display: flex; align-items: flex-start; gap: 12px;
  background: var(--surface); border: 1.5px solid var(--line); border-radius: 14px;
  padding: 14px 15px; cursor: pointer;
  transition: transform 0.2s var(--spring), border-color 0.2s, background 0.2s, box-shadow 0.2s;
}
.option:hover { border-color: #c3d8e8; box-shadow: var(--shadow-sm); }
.option:active { transform: scale(0.99); }
.opt-letter {
  width: 24px; height: 24px; flex: 0 0 24px; border-radius: 8px;
  display: grid; place-items: center;
  background: #f2f7fb; color: var(--muted); font-size: 12px; font-weight: 650;
  transition: all 0.22s var(--spring);
}
.opt-text { flex: 1; font-size: 15px; line-height: 1.6; }
.opt-mark { width: 18px; text-align: right; font-weight: 700; }
.option.picked { border-color: var(--primary-2); background: #f5fafd; }
.option.picked .opt-letter { background: var(--primary); color: #fff; }
.option.right { border-color: #7fb59b; background: #f1f9f5; }
.option.right .opt-letter { background: var(--good); color: #fff; }
.option.right .opt-mark { color: var(--good); }
.option.wrong { border-color: #e0a094; background: #fdf3f0; }
.option.wrong .opt-letter { background: var(--bad); color: #fff; }
.option.wrong .opt-mark { color: var(--bad); }
.option.wrong.shake { animation: shake 0.42s var(--ease); }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-5px); } 40% { transform: translateX(4px); }
  60% { transform: translateX(-3px); } 80% { transform: translateX(2px); }
}

.analysis { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; box-shadow: var(--shadow-sm); animation: rise 0.36s var(--ease) both; }
.analysis-head { font-weight: 650; margin-bottom: 8px; display: flex; align-items: center; gap: 8px; font-size: 14.5px; }
.analysis-head.ok { color: var(--good); }
.analysis-head.no { color: var(--bad); }
.analysis-ans { font-size: 12px; background: #e8f1f8; color: var(--primary-2); padding: 2px 9px; border-radius: 6px; font-weight: 500; }
.analysis-body { font-size: 14px; line-height: 1.8; color: var(--ink-2); }

.bottom-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  padding: 14px 18px calc(14px + env(safe-area-inset-bottom));
  background: var(--bg);
  border-top: 1px solid var(--line);
  box-shadow: 0 -8px 24px rgba(15, 42, 63, 0.06);
}
.bottom-bar .btn { box-shadow: 0 10px 26px rgba(18, 58, 87, 0.24); }

.particle { position: absolute; width: 5px; height: 5px; border-radius: 50%; animation: pop 0.68s var(--ease) forwards; }
@keyframes pop {
  0% { transform: translate(0, 0) scale(1); opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)) scale(0.2); opacity: 0; }
}

/* 填空 / 解答 */
.fill-box { display: flex; gap: 10px; align-items: center; }
.fill-input {
  flex: 1; height: 48px; border: 1.5px solid var(--line); border-radius: 12px;
  padding: 0 14px; font-size: 15px; font-family: inherit; background: var(--surface);
  transition: border-color 0.2s, background 0.2s;
}
.fill-input:focus { outline: none; border-color: var(--primary-2); }
.fill-box.ok .fill-input { border-color: #7fb59b; background: #f1f9f5; }
.fill-box.no .fill-input { border-color: #e0a094; background: #fdf3f0; }
.fill-mark { font-size: 13px; font-weight: 600; white-space: nowrap; }
.open-box { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.open-input {
  width: 100%; min-height: 108px; border: 1.5px solid var(--line); border-radius: 12px;
  padding: 12px 14px; font-size: 15px; line-height: 1.7; font-family: inherit;
  background: var(--surface); resize: vertical;
}
.open-input:focus { outline: none; border-color: var(--primary-2); }
.ref-answer { width: 100%; background: var(--bg-2); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.ref-label { font-size: 11px; color: var(--muted); margin-bottom: 4px; }
.ref-text { font-size: 14px; line-height: 1.75; color: var(--ink-2); white-space: pre-wrap; }
.self-check { display: flex; gap: 8px; align-items: center; }
.mini-btn.ok.on { background: var(--good); color: #fff; border-color: var(--good); }
.mini-btn.no.on { background: var(--bad); color: #fff; border-color: var(--bad); }
.hide { display: none !important; }

/* ================= 结算 ================= */
.result-hero {
  position: relative; overflow: hidden;
  background: linear-gradient(150deg, #163f5f, #0f2a3f);
  border-radius: var(--r-lg); padding: 34px 24px 24px; color: #fff; text-align: center;
  box-shadow: 0 20px 48px rgba(15, 42, 63, 0.28);
}
.stars { display: flex; justify-content: center; gap: 12px; font-size: 38px; line-height: 1; }
.stars .star { color: rgba(255, 255, 255, 0.18); }
.stars .star.on { color: var(--accent); text-shadow: 0 6px 22px rgba(242, 149, 122, 0.5); animation: starPop 0.52s var(--spring) both; }
.stars .star.on:nth-child(1) { animation-delay: 0.06s; }
.stars .star.on:nth-child(2) { animation-delay: 0.19s; }
.stars .star.on:nth-child(3) { animation-delay: 0.32s; }
@keyframes starPop { from { transform: scale(0.3) rotate(-16deg); opacity: 0; } to { transform: none; opacity: 1; } }

.score { margin-top: 10px; }
.score .n { font-size: 46px; font-weight: 700; line-height: 1.05; font-variant-numeric: tabular-nums; letter-spacing: -1px; }
.score .t { font-size: 13px; opacity: 0.66; margin-left: 4px; }
.comment { font-size: 13px; opacity: 0.72; margin-top: 4px; }
.levelup {
  display: inline-block; margin-top: 14px; font-size: 12px;
  background: rgba(242, 149, 122, 0.16); border: 1px solid rgba(242, 149, 122, 0.42);
  color: #ffc4b0; padding: 4px 14px; border-radius: 99px;
}
.metrics { display: flex; margin-top: 22px; padding-top: 18px; border-top: 1px solid rgba(255, 255, 255, 0.12); }
.metric { flex: 1; }
.metric .n { display: block; font-size: 17px; font-weight: 650; font-variant-numeric: tabular-nums; }
.metric .t { display: block; font-size: 11px; opacity: 0.6; margin-top: 2px; }

/* ================= 知识点 ================= */
.pt-head { position: sticky; top: 0; z-index: 6; background: rgba(238,244,249,.94); backdrop-filter: blur(10px); padding: 6px 0 10px; }
.search-input {
  width: 100%; height: 40px; border: 1px solid var(--line); border-radius: 11px;
  padding: 0 14px; font-size: 13.5px; font-family: inherit; background: var(--surface);
  margin-top: 10px;
}
.search-input:focus { outline: none; border-color: var(--primary-2); }

.pt-modes { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.pt-mode {
  text-align: left; border: 1.5px solid var(--line); background: var(--surface);
  border-radius: 14px; padding: 12px 14px; cursor: pointer; font-family: inherit;
  transition: all .22s var(--spring);
}
.pt-mode b { display: block; font-size: 14px; font-weight: 650; color: var(--ink); }
.pt-mode i { display: block; font-style: normal; font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.pt-mode.on { border-color: var(--primary); background: #eef5fa; }
.pt-mode:active { transform: scale(.98); }

.pt-group { margin-bottom: 16px; }
.pt-root { font-size: 11px; color: var(--muted); letter-spacing: .5px; }
.pt-group-name { font-size: 14.5px; font-weight: 650; margin: 2px 0 8px; }
.pt-chips { display: flex; flex-wrap: wrap; gap: 7px; }
.pt-chip {
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-2);
  font-size: 13px; padding: 6px 12px; border-radius: 9px; cursor: pointer; font-family: inherit;
  transition: all .2s var(--spring); display: inline-flex; align-items: center; gap: 5px;
}
.pt-chip i { font-style: normal; font-size: 10.5px; color: var(--muted); }
.pt-chip:hover { border-color: #c3d8e8; }
.pt-chip.on { background: var(--primary); border-color: var(--primary); color: #fff; }
.pt-chip.on i { color: rgba(255,255,255,.7); }

.pt-bar {
  position: fixed; left: 0; right: 0; bottom: calc(64px + env(safe-area-inset-bottom)); z-index: 45;
  max-width: 560px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 18px; background: rgba(255,253,247,.96); backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
}
.pt-bar-info { font-size: 13px; color: var(--ink-2); }
.pt-bar-info b { color: var(--primary); font-size: 16px; }
.pt-bar-actions { display: flex; align-items: center; gap: 8px; }
.pt-start { width: auto; padding: 0 22px; height: 40px; font-size: 14px; }
@media (min-width: 900px) {
  .pt-bar { bottom: 0; max-width: 1080px; border-radius: 14px 14px 0 0; }
}

/* ================= 错题本 ================= */
.wrong-item { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; box-shadow: var(--shadow-sm); margin-bottom: 10px; }
.wrong-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; gap: 8px; }
.badge { font-size: 11px; padding: 2px 8px; border-radius: 6px; background: #e8f1f8; color: var(--primary-2); font-weight: 500; white-space: nowrap; }
.badge.ghost { background: #f1f5f8; color: var(--muted); font-weight: 400; }
.badge.plain { background: var(--accent-soft); color: #b5543a; }
.wrong-times { font-size: 11px; color: var(--bad); white-space: nowrap; }
.wrong-assign {
  display: inline-block; margin-top: 6px; padding: 2px 9px; border-radius: 6px;
  font-size: 11px; background: #fdeee8; color: var(--accent); font-weight: 500;
}
.wrong-stem { font-size: 14.5px; line-height: 1.68; cursor: pointer; }
.wrong-hint { font-size: 11.5px; color: #a8bccb; margin-top: 6px; }
.wrong-detail { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--line); animation: rise 0.28s var(--ease) both; }
.opt-row { display: flex; gap: 8px; font-size: 13.5px; color: var(--ink-2); padding: 3px 0; }
.opt-row.right { color: var(--good); font-weight: 500; }
.opt-row b { color: var(--muted); font-weight: 600; }
.wrong-analysis { margin-top: 10px; background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px; padding: 12px; font-size: 13px; line-height: 1.75; color: var(--ink-2); }
.wrong-foot { display: flex; justify-content: flex-end; margin-top: 10px; }
.mini-btn {
  border: 1px solid var(--line); color: var(--primary); background: var(--surface);
  font-size: 12px; padding: 5px 13px; border-radius: 8px; cursor: pointer; font-family: inherit;
  transition: all 0.2s var(--spring);
}
.mini-btn:hover { border-color: var(--primary-2); color: var(--primary-2); }
.mini-btn:active { transform: scale(0.96); }

/* ================= 我的 ================= */
.profile { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.avatar {
  width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center;
  background: linear-gradient(140deg, var(--primary-2), var(--primary));
  color: #fff; font-size: 20px; font-weight: 600; margin-right: 14px; flex: 0 0 52px;
}
.rank-item { display: flex; align-items: center; padding: 9px 0; font-size: 14px; }
.rank-item.me { background: #eef5fa; border-radius: 10px; padding: 9px 12px; font-weight: 600; }
.rank-no { width: 26px; color: var(--muted); font-weight: 600; font-variant-numeric: tabular-nums; }
.rank-no.top { color: var(--accent); }
.rank-name { flex: 1; }
.rank-xp { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; text-align: center; }
.stat-grid .n { display: block; font-size: 18px; font-weight: 650; font-variant-numeric: tabular-nums; }
.stat-grid .t { display: block; font-size: 11px; color: var(--muted); margin-top: 2px; }

/* ================= 底部标签栏（移动） ================= */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  display: flex; align-items: center;
  height: calc(64px + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(16px) saturate(1.4);
  border-top: 1px solid var(--line);
}
.tabbar.hidden { transform: translateY(110%); transition: transform 0.28s var(--ease); }
.tab {
  flex: 1; border: 0; background: transparent; color: var(--muted);
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  font-size: 10.5px; cursor: pointer; padding: 8px 0; font-family: inherit;
  transition: color 0.25s;
  z-index: 2;
}
.tab .ico { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; transition: transform 0.3s var(--spring); }
.tab.on { color: var(--primary); font-weight: 600; }
.tab.on .ico { transform: translateY(-1px) scale(1.08); }
.tab-pill {
  position: absolute; top: 8px; height: 48px; width: 30%;
  border-radius: 14px; background: #eef5fa;
  transition: transform 0.42s var(--spring), width 0.42s var(--spring);
  z-index: 1;
}

/* ================= 登记弹层 ================= */
.reg-mask {
  position: fixed; inset: 0; z-index: 80; display: grid; place-items: center;
  background: rgba(15, 42, 63, 0.42); backdrop-filter: blur(8px);
  padding: 20px; opacity: 0; animation: fadeIn .28s var(--ease) forwards;
}
@keyframes fadeIn { to { opacity: 1; } }
.reg-card {
  width: min(400px, 100%); background: var(--surface); border-radius: 24px;
  padding: 28px 24px 20px; box-shadow: var(--shadow-lg);
  animation: cardIn .42s var(--spring) both;
}
@keyframes cardIn { from { opacity: 0; transform: translateY(24px) scale(.96); } to { opacity: 1; transform: none; } }
.reg-logo {
  width: 44px; height: 44px; border-radius: 13px; display: grid; place-items: center;
  background: linear-gradient(140deg, var(--primary-2), var(--primary));
  color: #fff; font-size: 19px; font-weight: 700; margin-bottom: 14px;
}
.reg-title { margin: 0; font-size: 21px; font-weight: 650; letter-spacing: .3px; }
.reg-sub { margin: 4px 0 18px; color: var(--muted); font-size: 13px; }
.reg-form { display: flex; flex-direction: column; gap: 10px; margin-bottom: 18px; }
.reg-field { display: flex; align-items: center; gap: 10px; }
.reg-field > span { flex: 0 0 62px; font-size: 13px; color: var(--ink-2); }
.reg-field input, .reg-field select {
  flex: 1; height: 42px; border: 1.5px solid var(--line); border-radius: 11px;
  padding: 0 12px; font-size: 14.5px; font-family: inherit; background: var(--bg-2);
  transition: border-color .2s, background .2s;
}
.reg-field input:focus, .reg-field select:focus { outline: none; border-color: var(--primary-2); background: var(--surface); }
.stage-switch {
  display: inline-flex; padding: 3px; background: #e3ecf4; border-radius: 10px;
  margin: 4px 0 10px; gap: 2px;
}
.stage-tab {
  border: 0; background: transparent; padding: 6px 18px; border-radius: 8px;
  font-size: 13.5px; font-family: inherit; color: var(--ink-2); cursor: pointer;
  transition: all .2s var(--spring);
}
.stage-tab.on { background: #fff; color: var(--primary); font-weight: 600; box-shadow: 0 1px 3px rgba(15,42,63,.1); }

.stage-pick { display: flex; gap: 8px; flex: 1; }
.stage-btn {
  flex: 1; height: 42px; border: 1.5px solid var(--line); border-radius: 11px;
  background: var(--bg-2); color: var(--ink-2); font-size: 14px; font-family: inherit;
  cursor: pointer; transition: all .2s var(--spring);
}
.stage-btn.on { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }
.reg-skip {
  display: block; width: 100%; margin-top: 12px; border: 0; background: none;
  color: var(--muted); font-size: 13px; cursor: pointer; font-family: inherit;
}

/* ================= 档案条 / 薄弱点 ================= */
.idbar {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  padding: 12px 16px; margin-bottom: 14px; box-shadow: var(--shadow-sm); cursor: pointer;
}
.idbar-avatar {
  width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center;
  background: linear-gradient(140deg, var(--primary-2), var(--primary)); color: #fff;
  font-size: 16px; font-weight: 600; flex: 0 0 38px;
}
.idbar-info { flex: 1; min-width: 0; }
.idbar-name { font-size: 15px; font-weight: 650; }
.idbar-edit { font-size: 12px; color: var(--primary-2); white-space: nowrap; }

.weak-card {
  background: linear-gradient(135deg, #ffffff, #f7fbff);
  border: 1px solid var(--line); border-left: 3px solid var(--accent);
  border-radius: var(--r); padding: 16px 18px; margin-bottom: 14px;
  box-shadow: var(--shadow-sm);
}
.weak-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 10px; }
.weak-title { font-size: 14.5px; font-weight: 650; }
.weak-row { display: flex; align-items: center; gap: 8px; padding: 6px 0; font-size: 13.5px; }
.weak-key { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.weak-n { color: var(--bad); font-size: 12px; white-space: nowrap; }
.weak-go {
  margin-top: 10px; border: 0; background: none; color: var(--primary-2);
  font-size: 13px; font-weight: 600; cursor: pointer; font-family: inherit; padding: 0;
}

/* ================= 提示 ================= */
.toast {
  position: fixed; left: 50%; bottom: 90px; transform: translate(-50%, 16px);
  background: rgba(15, 42, 63, 0.94); color: #fff; font-size: 13px;
  padding: 9px 18px; border-radius: 10px; opacity: 0; pointer-events: none;
  transition: all 0.28s var(--ease); z-index: 60; max-width: 80vw; text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.empty { text-align: center; color: var(--muted); font-size: 14px; padding: 50px 0; }
.loading-wrap { text-align: center; padding: 70px 0; color: var(--muted); font-size: 13.5px; }
.spinner {
  width: 26px; height: 26px; margin: 0 auto 12px;
  border: 2.5px solid var(--line); border-top-color: var(--primary-2);
  border-radius: 50%; animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ================= 二维码页 ================= */
.qr-page {
  min-height: 100dvh; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 20px; padding: 30px; text-align: center;
}
.qr-box { background: #fff; padding: 18px; border-radius: 18px; box-shadow: var(--shadow-lg); border: 1px solid var(--line); }
.qr-url { font-size: 15px; font-weight: 650; color: var(--primary); word-break: break-all; }
.qr-tip { font-size: 13px; color: var(--muted); line-height: 1.85; max-width: 330px; }

/* ================= 桌面 ================= */
@media (min-width: 900px) {
  body { font-size: 15px; }
  #app { padding-bottom: 40px; }
  .topnav { display: flex; }
  .tabbar { display: none; }
  .screen { max-width: 1080px; margin: 0 auto; padding: 28px 32px 40px; }

  /* 首页：英雄卡 + 科目网格 */
  .home-grid { display: grid; grid-template-columns: 1fr 340px; gap: 20px; align-items: start; }
  .hero { padding: 30px 30px 24px; margin-bottom: 0; }
  .quick-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 16px; }
  .hero-stats { margin-top: 26px; }
  .subjects { grid-template-columns: repeat(3, 1fr); gap: 14px; }
  .subject { padding: 18px; }
  .daily { margin-bottom: 20px; }

  /* 覆盖页变成居中面板 */
  .screen.overlay {
    inset: auto; left: 50%; top: 50%;
    transform: translate(-50%, -50%);
    width: min(860px, calc(100vw - 96px));
    max-height: 88vh; border-radius: 22px;
    box-shadow: var(--shadow-lg); border: 1px solid var(--line);
    animation: panelIn 0.3s var(--ease) both;
  }
  @keyframes panelIn { from { opacity: 0; transform: translate(-50%, -48%) scale(0.985); } to { opacity: 1; transform: translate(-50%, -50%) scale(1); } }
  .nav { padding: 16px 22px 12px; border-radius: 22px 22px 0 0; }
  .pad { padding: 0 22px 24px; }

  .screen.overlay.quiz-panel { width: min(760px, calc(100vw - 96px)); }
  #levelList { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
  #levelList[hidden] { display: none !important; }
  #levelList .level { margin-bottom: 0; }
  .level-dot { width: 46px; height: 46px; flex: 0 0 46px; }
  .bottom-bar {
    position: sticky; left: auto; right: auto; bottom: 0;
    padding: 16px 22px 20px; background: var(--bg);
    border-top: 1px solid var(--line); border-radius: 0 0 22px 22px;
  }
  .q-stem { font-size: 17px; }

  .result-hero { padding: 40px 30px 28px; }

  /* 错题本两列 */
  .wrong-list { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: start; }
  .wrong-item { margin-bottom: 0; }

  .me-grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: 18px; align-items: start; }
}

@media (min-width: 1200px) {
  .subjects { grid-template-columns: repeat(3, 1fr); }
}

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


/* ================= 教师端工作台 ================= */
.mode-switch { display: none; }

@media (min-width: 900px) {
  .mode-switch {
    display: inline-flex; padding: 3px; background: #e3effa; border-radius: 10px; margin-right: 16px;
  }
  .mode-btn {
    border: 0; background: transparent; padding: 6px 16px; border-radius: 8px;
    font-size: 13.5px; font-family: inherit; color: var(--ink-2); cursor: pointer;
    transition: all .2s var(--spring);
  }
  .mode-btn.on { background: #fff; color: var(--primary); font-weight: 600; box-shadow: 0 1px 3px rgba(15,42,63,.12); }
}

.wb { max-width: 1080px; margin: 0 auto; padding: 4px 0 40px; }
.wb-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.wb-title { font-size: 22px; font-weight: 700; }

.wb-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.wb-stat {
  background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 18px 20px;
  box-shadow: var(--shadow-sm);
}
.wb-stat b { display: block; font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; }
.wb-stat span { font-size: 12.5px; color: var(--muted); }
.wb-stat.warn b { color: var(--bad); }

.wb-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 22px; }
.wb-card {
  display: flex; align-items: center; gap: 12px; text-decoration: none; color: inherit;
  background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 16px;
  box-shadow: var(--shadow-sm); transition: transform .18s var(--spring), box-shadow .18s;
}
.wb-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.wb-ico { font-size: 20px; width: 38px; height: 38px; display: grid; place-items: center; background: #eef6fe; border-radius: 10px; flex: 0 0 38px; }
.wb-card b { display: block; font-size: 14px; }
.wb-card i { font-style: normal; font-size: 11.5px; color: var(--muted); }

.wb-section { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 18px 20px; margin-bottom: 16px; box-shadow: var(--shadow-sm); }
.wb-sec-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 14px; }
.wb-sec-head h3 { margin: 0; font-size: 15px; }

.wb-bars { display: flex; flex-direction: column; gap: 9px; }
.wb-bar-row { display: grid; grid-template-columns: 88px 1fr 64px; align-items: center; gap: 10px; }
.wb-bar-name { font-size: 13px; color: var(--ink-2); }
.wb-bar-track { height: 8px; background: #eef4fa; border-radius: 6px; overflow: hidden; }
.wb-bar-track i { display: block; height: 100%; background: linear-gradient(90deg, #7cc0ef, #3d93d6); border-radius: 6px; }
.wb-bar-num { font-size: 12.5px; color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }

.wb-act { display: grid; grid-template-columns: 110px 1fr 70px 56px; gap: 10px; align-items: center; padding: 9px 0; border-top: 1px solid #f1f7fc; font-size: 13px; }
.wb-act:first-of-type { border-top: 0; }
.wb-act-name { font-weight: 500; }
.wb-act-what { color: var(--ink-2); }
.wb-act-score { color: var(--good); font-weight: 600; text-align: right; }
.wb-act-time { color: var(--muted); font-size: 12px; text-align: right; }

@media (max-width: 899px) {
  .wb-stats, .wb-grid { grid-template-columns: repeat(2, 1fr); }
}
