﻿/* ============================================================
   知行岛 · 设计系统
   ============================================================ */
:root {
  --bg: #f3f5fb;
  --bg-2: #e9edf9;
  --card: #ffffff;
  --card-2: #f8f9fe;
  --text: #141a29;
  --text-2: #3b445a;
  --muted: #727d95;
  --line: #e4e8f4;
  --brand: #4f46e5;
  --brand-2: #7c3aed;
  --accent: #06b6d4;
  --ok: #15a34a;
  --ok-soft: #e7f8ee;
  --bad: #e5484d;
  --bad-soft: #fdecec;
  --warn: #f59e0b;
  --warn-soft: #fef4e2;
  --radius: 20px;
  --radius-sm: 14px;
  --shadow: 0 12px 32px rgba(22, 28, 56, .08), 0 2px 6px rgba(22, 28, 56, .04);
  --shadow-sm: 0 4px 14px rgba(22, 28, 56, .06);
  --font: "PingFang SC", "HarmonyOS Sans SC", "MiSans", "Microsoft YaHei", system-ui, -apple-system, "Segoe UI", sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
}
[data-theme="dark"] {
  --bg: #0a0e18;
  --bg-2: #0f1524;
  --card: #141b2c;
  --card-2: #192135;
  --text: #edf1fb;
  --text-2: #c2cade;
  --muted: #8b97b0;
  --line: #232c42;
  --ok-soft: #10291b;
  --bad-soft: #2c1417;
  --warn-soft: #2b2110;
  --shadow: 0 14px 34px rgba(0, 0, 0, .38), 0 2px 8px rgba(0, 0, 0, .28);
  --shadow-sm: 0 6px 18px rgba(0, 0, 0, .28);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
html { background: var(--bg); }
body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
body::before {
  content: "";
  position: fixed; inset: -20% -10% auto -10%; height: 60vh;
  background:
    radial-gradient(40% 55% at 15% 20%, rgba(99, 102, 241, .20), transparent 70%),
    radial-gradient(35% 50% at 85% 8%, rgba(6, 182, 212, .16), transparent 70%),
    radial-gradient(30% 45% at 55% 0%, rgba(16, 185, 129, .12), transparent 70%);
  filter: blur(10px);
  z-index: -1;
  pointer-events: none;
}
img { max-width: 100%; }
button { font-family: inherit; font-size: inherit; color: inherit; border: 0; background: none; cursor: pointer; }
a { color: var(--brand); text-decoration: none; }
h1, h2, h3, h4 { margin: 0; line-height: 1.3; letter-spacing: -.01em; }
p { margin: 0; }
::selection { background: rgba(99, 102, 241, .25); }

/* ---------- 布局 ---------- */
.app { min-height: 100dvh; }
.shell { display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: 100dvh; }
.side {
  position: sticky; top: 0; align-self: start;
  height: 100dvh; padding: 22px 14px;
  display: flex; flex-direction: column; gap: 8px;
  border-right: 1px solid var(--line);
  background: color-mix(in srgb, var(--card) 55%, transparent);
  backdrop-filter: blur(14px);
}
.main {
  min-width: 0;
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 26px clamp(16px, 3.2vw, 42px) 56px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; }
.brand-mark {
  width: 36px; height: 36px; border-radius: 11px; flex: none;
  background: linear-gradient(140deg, #6366f1, #06b6d4);
  display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 18px;
  box-shadow: 0 6px 16px rgba(79, 70, 229, .35);
}
.brand-name { font-weight: 800; font-size: 16px; letter-spacing: .02em; }
.brand-sub { font-size: 11px; color: var(--muted); letter-spacing: .08em; }

.nav { display: flex; flex-direction: column; gap: 4px; }
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 11px 12px; border-radius: 12px;
  color: var(--text-2); font-weight: 600; font-size: 14px;
  transition: background .18s, color .18s, transform .18s;
}
.nav-item .ico { width: 20px; text-align: center; font-size: 17px; opacity: .9; }
.nav-item:hover { background: var(--card-2); }
.nav-item.on { background: linear-gradient(120deg, rgba(99,102,241,.14), rgba(6,182,212,.10)); color: var(--brand); }
.nav-item .badge { margin-left: auto; }
.side-foot { margin-top: auto; padding: 10px; }
.side-tip { font-size: 11.5px; color: var(--muted); line-height: 1.55; }

.tabbar { display: none; }
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side { display: none; }
  .main { padding: 18px 16px calc(96px + var(--safe-b)); }
  .tabbar {
    display: grid; grid-template-columns: repeat(6, 1fr);
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    padding: 8px 8px calc(8px + var(--safe-b));
    background: color-mix(in srgb, var(--card) 88%, transparent);
    backdrop-filter: blur(18px) saturate(1.4);
    border-top: 1px solid var(--line);
  }
  .tab {
    position: relative;
    display: flex; flex-direction: column; align-items: center; gap: 3px;
    padding: 6px 0 2px; border-radius: 12px; color: var(--muted); font-size: 10px; font-weight: 600;
  }
  .tab .ico { font-size: 19px; line-height: 1; }
  .tab.on { color: var(--brand); }
}

/* ---------- 通用组件 ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.pad { padding: 18px; }
.row { display: flex; align-items: center; gap: 10px; }
.row.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.tiny { font-size: 11.5px; }
.bold { font-weight: 700; }
.num { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mt8 { margin-top: 8px } .mt12 { margin-top: 12px } .mt16 { margin-top: 16px } .mt24 { margin-top: 24px }
.mb8 { margin-bottom: 8px } .mb12 { margin-bottom: 12px } .mb16 { margin-bottom: 16px }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 20px; border-radius: 13px; font-weight: 700; font-size: 14.5px;
  background: var(--card-2); color: var(--text); border: 1px solid var(--line);
  transition: transform .12s, box-shadow .18s, filter .18s;
  user-select: none;
}
.btn:active { transform: scale(.97); }
.btn.primary {
  background: linear-gradient(135deg, #6366f1, #7c3aed);
  color: #fff; border-color: transparent;
  box-shadow: 0 10px 22px rgba(99, 102, 241, .32);
}
.btn.primary:hover { filter: brightness(1.06); }
.btn.ok { background: var(--ok); color: #fff; border-color: transparent; }
.btn.ghost { background: transparent; }
.btn.sm { padding: 7px 13px; border-radius: 10px; font-size: 12.5px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .45; pointer-events: none; }
.btn.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 30%, var(--line)); }

.chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600;
  background: var(--card-2); color: var(--text-2); border: 1px solid var(--line);
  white-space: nowrap;
}
.chip.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.chip.bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.chip.warn { background: var(--warn-soft); color: #b47405; border-color: transparent; }
.chip.brand { background: rgba(99, 102, 241, .12); color: var(--brand); border-color: transparent; }
[data-theme="dark"] .chip.warn { color: var(--warn); }
.badge {
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--bad); color: #fff; font-size: 10.5px; font-weight: 700;
  display: inline-grid; place-items: center;
}

.stars { display: inline-flex; gap: 2px; font-size: 13px; letter-spacing: 1px; }
.stars .s { color: #d7dbe8; }
.stars .s.on { color: #fbbf24; text-shadow: 0 0 10px rgba(251, 191, 36, .45); }
[data-theme="dark"] .stars .s { color: #2b3450; }

.bar { height: 8px; border-radius: 99px; background: var(--line); overflow: hidden; }
.bar > i {
  display: block; height: 100%; border-radius: 99px;
  background: linear-gradient(90deg, #6366f1, #06b6d4);
  transition: width .7s cubic-bezier(.2, .8, .2, 1);
}
.bar.thin { height: 6px; }

.ring { --p: 0; --sz: 64px; width: var(--sz); height: var(--sz); position: relative; flex: none; }
.ring::before {
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  background: conic-gradient(var(--ring-c, #6366f1) calc(var(--p) * 1%), var(--line) 0);
  mask: radial-gradient(farthest-side, transparent calc(50% - 5px), #000 calc(50% - 4px));
  -webkit-mask: radial-gradient(farthest-side, transparent calc(50% - 5px), #000 calc(50% - 4px));
}
.ring .ring-txt { position: absolute; inset: 0; display: grid; place-items: center; font-weight: 800; font-size: 12px; }

/* ---------- 首页 ---------- */
.hero {
  position: relative; overflow: hidden;
  border-radius: 26px; padding: 24px;
  color: #fff;
  background: linear-gradient(120deg, #4338ca 0%, #6d28d9 45%, #0891b2 100%);
  box-shadow: 0 18px 40px rgba(67, 56, 202, .28);
}
.hero::after {
  content: ""; position: absolute; right: -60px; top: -80px; width: 260px; height: 260px;
  background: radial-gradient(circle, rgba(255,255,255,.30), transparent 65%);
  border-radius: 50%;
}
.hero::before {
  content: ""; position: absolute; right: 40px; bottom: -110px; width: 220px; height: 220px;
  border: 26px solid rgba(255,255,255,.08); border-radius: 50%;
}
.hero-hi { font-size: 13px; opacity: .85; letter-spacing: .08em; }
.hero-title { font-size: clamp(22px, 4.6vw, 30px); font-weight: 800; margin-top: 4px; }
.hero-sub { font-size: 13.5px; opacity: .88; margin-top: 6px; }
.hero-stats { display: flex; gap: 18px; margin-top: 18px; position: relative; z-index: 1; flex-wrap: wrap; }
.hero-stat b { font-size: 20px; font-weight: 800; display: block; line-height: 1.2; }
.hero-stat span { font-size: 11px; opacity: .8; }
.hero-ring { position: absolute; right: 22px; top: 22px; z-index: 2; }
.hero-ring .ring::before { background: conic-gradient(#fff calc(var(--p) * 1%), rgba(255,255,255,.22) 0); }
.hero-ring .ring-txt { color: #fff; }

.sec-title { display: flex; align-items: baseline; justify-content: space-between; margin: 26px 2px 12px; }
.sec-title h2 { font-size: 17px; font-weight: 800; }
.sec-title .more { font-size: 12.5px; color: var(--muted); }

.quest { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px dashed var(--line); }
.quest:last-child { border-bottom: 0; }
.quest .q-ico { width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; background: var(--card-2); font-size: 16px; flex: none; }
.quest.done .q-ico { background: var(--ok-soft); }
.quest .q-bar { margin-top: 5px; }

.subj-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.subj {
  position: relative; overflow: hidden; text-align: left;
  padding: 18px; border-radius: 20px; background: var(--card);
  border: 1px solid var(--line); box-shadow: var(--shadow-sm);
  transition: transform .2s, box-shadow .2s, border-color .2s;
  display: flex; flex-direction: column; gap: 12px;
}
.subj:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); }
.subj::before {
  content: ""; position: absolute; right: -30px; top: -30px; width: 120px; height: 120px; border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--accent) 22%, transparent), transparent 70%);
}
.subj-top { display: flex; align-items: center; gap: 11px; }
.subj-emoji {
  width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; font-size: 22px;
  background: color-mix(in srgb, var(--accent) 14%, var(--card));
  border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent);
  flex: none;
}
.subj-name { font-weight: 800; font-size: 16px; }
.subj-book { font-size: 11px; color: var(--muted); }
.subj-desc { font-size: 12.5px; color: var(--muted); line-height: 1.55; min-height: 38px; }
.subj-prog { display: flex; align-items: center; gap: 10px; }
.subj-prog .bar { flex: 1; }
.subj-prog .bar > i { background: linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--accent) 55%, #fff)); }

.continue {
  display: flex; align-items: center; gap: 14px; padding: 16px 18px;
  border-radius: 20px; background: var(--card); border: 1px solid var(--line);
  box-shadow: var(--shadow-sm); width: 100%; text-align: left;
  transition: transform .18s, box-shadow .18s;
}
.continue:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.continue .c-ico { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; font-size: 22px; background: rgba(99,102,241,.12); flex: none; }

/* ---------- 学科页 ---------- */
.page-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.icon-btn {
  width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center;
  background: var(--card); border: 1px solid var(--line); font-size: 17px; flex: none;
  box-shadow: var(--shadow-sm);
}
.icon-btn:active { transform: scale(.94); }
.page-title { font-size: 20px; font-weight: 800; }
.page-sub { font-size: 12px; color: var(--muted); }

.subject-hero {
  border-radius: 24px; padding: 20px; color: #fff; position: relative; overflow: hidden;
  background: linear-gradient(125deg, var(--accent), color-mix(in srgb, var(--accent) 55%, #111827));
  box-shadow: 0 14px 34px color-mix(in srgb, var(--accent) 30%, transparent);
}
.subject-hero::after {
  content: ""; position: absolute; right: -40px; bottom: -70px; width: 190px; height: 190px;
  border-radius: 50%; background: rgba(255,255,255,.12);
}
.subject-hero .sh-title { font-size: 24px; font-weight: 800; display: flex; align-items: center; gap: 8px; }
.subject-hero .sh-sub { font-size: 12.5px; opacity: .88; margin-top: 4px; }
.subject-hero .sh-stats { display: flex; gap: 16px; margin-top: 14px; position: relative; z-index: 1; }
.subject-hero .sh-stats b { font-size: 17px; }

.path { position: relative; margin-top: 18px; }
.node {
  position: relative; display: flex; gap: 14px; padding: 10px 0 10px 0;
  width: 100%; text-align: left; align-items: flex-start;
}
.node::before {
  content: ""; position: absolute; left: 23px; top: 52px; bottom: -6px; width: 2px;
  background: repeating-linear-gradient(to bottom, var(--line) 0 6px, transparent 6px 12px);
}
.node:last-child::before { display: none; }
.node-dot {
  width: 48px; height: 48px; border-radius: 16px; flex: none; display: grid; place-items: center;
  font-weight: 800; font-size: 15px; background: var(--card); border: 1px solid var(--line);
  color: var(--text-2); box-shadow: var(--shadow-sm); position: relative; z-index: 1;
  transition: transform .18s;
}
.node:hover .node-dot { transform: scale(1.05); }
.node.done .node-dot { background: color-mix(in srgb, var(--accent) 14%, var(--card)); border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); color: var(--accent); }
.node.locked .node-dot { color: var(--muted); background: var(--card-2); }
.node-body {
  flex: 1; min-width: 0; padding: 12px 14px; border-radius: 16px; background: var(--card);
  border: 1px solid var(--line); box-shadow: var(--shadow-sm); transition: border-color .2s, transform .2s;
}
.node:hover .node-body { border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); }
.node.locked .node-body { opacity: .62; }
.node-t { font-weight: 700; font-size: 14.5px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.node-focus { font-size: 11.5px; color: var(--muted); margin-top: 3px; }
.node-meta { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.node-boss { font-size: 11px; color: var(--muted); }

/* ---------- 单元页 ---------- */
.unit-hero { border-radius: 24px; padding: 22px; position: relative; overflow: hidden; background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow-sm); }
.unit-hero .u-no { font-size: 12px; font-weight: 700; color: var(--accent); letter-spacing: .1em; }
.unit-hero h1 { font-size: clamp(20px, 4vw, 26px); font-weight: 800; margin-top: 6px; }
.unit-boss { margin-top: 14px; display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 14px; background: var(--card-2); border: 1px dashed var(--line); }
.unit-boss .b-ico { font-size: 20px; }
.focus-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }

/* ---------- 答题 ---------- */
.quiz-wrap { max-width: 820px; margin: 0 auto; padding: 18px 16px calc(44px + var(--safe-b)); }
@media (min-width: 901px) { .quiz-wrap { padding-top: 34px; } }
.quiz { max-width: 760px; margin: 0 auto; padding-top: 4px; }
.quiz-top { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.quiz-prog { flex: 1; height: 9px; border-radius: 99px; background: var(--line); overflow: hidden; }
.quiz-prog > i { display: block; height: 100%; background: linear-gradient(90deg, #6366f1, #06b6d4); border-radius: 99px; transition: width .4s; }
.hearts { display: flex; gap: 2px; font-size: 15px; }
.hearts .h { filter: grayscale(1); opacity: .35; transition: .2s; }
.hearts .h.on { filter: none; opacity: 1; }
.combo {
  font-weight: 800; font-size: 12.5px; padding: 3px 9px; border-radius: 999px;
  background: linear-gradient(135deg, #f59e0b, #ef4444); color: #fff;
  transform: scale(.9); opacity: 0; transition: .2s;
}
.combo.on { transform: scale(1); opacity: 1; }
.q-meta { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.q-card { padding: clamp(18px, 3vw, 26px); border-radius: 22px; background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow); }
.q-stem { font-size: clamp(16px, 2.3vw, 18.5px); line-height: 1.75; font-weight: 600; white-space: pre-wrap; word-break: break-word; }
.q-stem .hl { color: var(--brand); }
.opts { display: flex; flex-direction: column; gap: 10px; margin-top: 18px; }
.opt {
  display: flex; gap: 12px; align-items: flex-start; text-align: left; width: 100%;
  padding: 13px 15px; border-radius: 14px; background: var(--card-2);
  border: 1.5px solid var(--line); transition: .16s; font-size: 15px; line-height: 1.55;
}
.opt:hover:not(:disabled) { border-color: color-mix(in srgb, var(--brand) 40%, var(--line)); transform: translateY(-1px); }
.opt .k {
  width: 26px; height: 26px; border-radius: 8px; flex: none; display: grid; place-items: center;
  background: var(--card); border: 1px solid var(--line); font-size: 12.5px; font-weight: 800; color: var(--muted);
  margin-top: 1px;
}
.opt.sel { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 8%, var(--card)); }
.opt.sel .k { background: var(--brand); color: #fff; border-color: transparent; }
.opt.correct { border-color: var(--ok); background: var(--ok-soft); }
.opt.correct .k { background: var(--ok); color: #fff; border-color: transparent; }
.opt.wrong { border-color: var(--bad); background: var(--bad-soft); }
.opt.wrong .k { background: var(--bad); color: #fff; border-color: transparent; }
.opt.dim { opacity: .55; }
.opt:disabled { cursor: default; }

.fill-line { display: flex; gap: 10px; margin-top: 18px; }
.fill-line input {
  flex: 1; min-width: 0; padding: 13px 15px; border-radius: 14px; font-size: 16px;
  background: var(--card-2); border: 1.5px solid var(--line); color: var(--text); outline: none;
  transition: border-color .18s;
}
.fill-line input:focus { border-color: var(--brand); }
.fill-line input:disabled { opacity: .75; }

.feedback { margin-top: 16px; border-radius: 16px; padding: 15px 16px; border: 1px solid transparent; }
.feedback.ok { background: var(--ok-soft); border-color: color-mix(in srgb, var(--ok) 25%, transparent); }
.feedback.bad { background: var(--bad-soft); border-color: color-mix(in srgb, var(--bad) 25%, transparent); }
.feedback .fb-title { font-weight: 800; display: flex; align-items: center; gap: 7px; font-size: 14.5px; }
.feedback.ok .fb-title { color: var(--ok); }
.feedback.bad .fb-title { color: var(--bad); }
.feedback .fb-explain { margin-top: 8px; font-size: 13.8px; line-height: 1.75; color: var(--text-2); white-space: pre-wrap; }
.feedback .fb-answer { margin-top: 6px; font-size: 13px; font-weight: 700; }
.fb-actions { display: flex; justify-content: flex-end; margin-top: 12px; }

.hintbox { margin-top: 14px; padding: 11px 14px; border-radius: 12px; background: var(--warn-soft); color: #8a5a00; font-size: 13px; border: 1px dashed color-mix(in srgb, var(--warn) 40%, transparent); }
[data-theme="dark"] .hintbox { color: #f3c675; }
.quiz-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 14px; gap: 10px; }
.timer { font-size: 12.5px; font-weight: 700; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.timer.low { color: var(--bad); animation: pulse 1s infinite; }

@keyframes pop { from { transform: scale(.96); opacity: 0 } to { transform: scale(1); opacity: 1 } }
@keyframes pulse { 50% { opacity: .45 } }
@keyframes shake { 10%,90% { transform: translateX(-2px) } 30%,70% { transform: translateX(4px) } 50% { transform: translateX(-4px) } }
.shake { }
@keyframes rise { from { transform: translateY(14px); opacity: 0 } to { transform: none; opacity: 1 } }
.rise { animation: none; }

/* ---------- 结算 ---------- */
.result { max-width: 620px; margin: 0 auto; text-align: center; padding-top: 12px; }
.result-card { padding: 28px 22px; border-radius: 26px; background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow); position: relative; overflow: hidden; }
.result-card::before {
  content: ""; position: absolute; inset: -40% -20% auto; height: 70%;
  background: radial-gradient(50% 60% at 50% 0%, rgba(99,102,241,.18), transparent 70%);
}
.result-stars { font-size: 40px; letter-spacing: 6px; margin: 6px 0 2px; position: relative; }
.result-stars .s { color: var(--line); display: inline-block; transform: scale(.6); opacity: .5; }
.result-stars .s.on { color: #fbbf24; animation: starPop .5s cubic-bezier(.2,1.6,.4,1) both; text-shadow: 0 4px 18px rgba(251,191,36,.55); }
.result-stars .s:nth-child(2) { animation-delay: .12s } .result-stars .s:nth-child(3) { animation-delay: .24s }
@keyframes starPop { 0% { transform: scale(.2) rotate(-25deg); opacity: 0 } 70% { transform: scale(1.18) rotate(4deg) } 100% { transform: scale(1); opacity: 1 } }
.result h1 { font-size: 24px; font-weight: 800; position: relative; }
.result-sub { color: var(--muted); font-size: 13px; margin-top: 4px; }
.res-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 20px; }
.res-cell { background: var(--card-2); border-radius: 14px; padding: 12px 6px; }
.res-cell b { display: block; font-size: 19px; font-weight: 800; }
.res-cell span { font-size: 10.5px; color: var(--muted); }
.wrong-list { margin-top: 18px; text-align: left; }
.wrong-item { display: flex; gap: 10px; padding: 11px 0; border-bottom: 1px dashed var(--line); align-items: flex-start; }
.wrong-item:last-child { border-bottom: 0; }
.wrong-item .wi-q { flex: 1; font-size: 13px; line-height: 1.55; }
.wrong-item .wi-tag { font-size: 11px; color: var(--muted); margin-top: 3px; }

/* ---------- 错题本 ---------- */
.wb-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.wb-filters { display: flex; gap: 6px; margin: 14px 0; overflow-x: auto; padding-bottom: 2px; }
.wb-filters::-webkit-scrollbar { display: none; }
.fchip { padding: 7px 13px; border-radius: 999px; font-size: 12.5px; font-weight: 700; background: var(--card); border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.fchip.on { background: var(--text); color: var(--bg); border-color: var(--text); }
.wb-card { padding: 15px 16px; border-radius: 18px; background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow-sm); margin-bottom: 10px; }
.wb-card .wb-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.wb-card .wb-stem { font-size: 14px; line-height: 1.65; margin-top: 8px; }
.wb-card .wb-bot { display: flex; align-items: center; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }

.empty { text-align: center; padding: 48px 18px; color: var(--muted); }
.empty .e-ico { font-size: 42px; margin-bottom: 10px; }

/* ---------- 数据页 ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 12px; }
.stat-cell { padding: 15px; border-radius: 16px; background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow-sm); }
.stat-cell b { font-size: 22px; font-weight: 800; display: block; line-height: 1.2; }
.stat-cell span { font-size: 11.5px; color: var(--muted); }
.chart { display: flex; align-items: flex-end; gap: 8px; height: 120px; padding-top: 10px; }
.chart .col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.chart .col i { width: 100%; max-width: 34px; border-radius: 7px 7px 3px 3px; background: linear-gradient(180deg, #6366f1, #06b6d4); min-height: 3px; transition: height .6s; }
.chart .col span { font-size: 10px; color: var(--muted); }
.ach-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.ach { padding: 13px; border-radius: 15px; background: var(--card); border: 1px solid var(--line); display: flex; gap: 10px; align-items: center; opacity: .5; }
.ach.on { opacity: 1; border-color: color-mix(in srgb, #f59e0b 35%, var(--line)); background: linear-gradient(120deg, color-mix(in srgb, #f59e0b 8%, var(--card)), var(--card)); }
.ach .a-ico { font-size: 22px; }
.ach b { font-size: 12.5px; display: block; }
.ach span { font-size: 10.5px; color: var(--muted); line-height: 1.4; display: block; }

/* ---------- 设置 ---------- */
.list { border-radius: 18px; overflow: hidden; border: 1px solid var(--line); background: var(--card); }
.li { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.li:last-child { border-bottom: 0; }
.li .li-ico { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; background: var(--card-2); font-size: 16px; flex: none; }
.li .li-t { font-weight: 600; font-size: 14px; }
.li .li-s { font-size: 11.5px; color: var(--muted); }
.switch { width: 46px; height: 27px; border-radius: 99px; background: var(--line); position: relative; transition: .2s; flex: none; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 21px; height: 21px; border-radius: 50%; background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.2); transition: .2s; }
.switch.on { background: var(--brand); }
.switch.on::after { left: 22px; }
.seg { display: flex; background: var(--card-2); border-radius: 11px; padding: 3px; gap: 2px; }
.seg button { padding: 6px 11px; border-radius: 8px; font-size: 12px; font-weight: 600; color: var(--muted); }
.seg button.on { background: var(--card); color: var(--text); box-shadow: var(--shadow-sm); }

/* ---------- 弹层/提示 ---------- */
.toast-wrap { position: fixed; left: 50%; bottom: calc(88px + var(--safe-b)); transform: translateX(-50%); z-index: 90; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast {
  padding: 10px 18px; border-radius: 999px; background: rgba(20, 26, 41, .92); color: #fff;
  font-size: 13px; font-weight: 600; box-shadow: 0 10px 26px rgba(0,0,0,.25);
  animation: toastIn .3s cubic-bezier(.2,.9,.3,1.2), toastOut .3s 1.9s forwards;
  backdrop-filter: blur(8px);
  max-width: 80vw; text-align: center;
}
.toast.ok { background: rgba(21, 163, 74, .95); }
.toast.bad { background: rgba(229, 72, 77, .95); }
@keyframes toastIn { from { transform: translateY(12px); opacity: 0 } }
@keyframes toastOut { to { transform: translateY(-8px); opacity: 0 } }

.fx-layer { position: fixed; inset: 0; pointer-events: none; z-index: 100; overflow: hidden; }
.confetti { position: absolute; top: -12px; width: 8px; height: 14px; border-radius: 2px; animation: fall 2.4s linear forwards; }
@keyframes fall { to { transform: translateY(105vh) rotate(720deg); opacity: .1 } }

/* ---------- 响应式细节 ---------- */
@media (max-width: 560px) {
  .hero { padding: 20px; }
  .hero-ring { display: none; }
  .res-grid { grid-template-columns: repeat(2, 1fr); }
  .subj-grid { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .page-title { font-size: 18px; }
}
@media (min-width: 901px) {
  .mobile-only { display: none !important; }
}
@media (max-width: 900px) {
  .desktop-only { display: none !important; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ============================================================
   星砂岛
   ============================================================ */
.coin-hero {
  position: relative; overflow: hidden;
  border-radius: 24px; padding: 20px;
  color: #fff;
  background: linear-gradient(135deg, #7c2d12 0%, #b45309 45%, #f59e0b 100%);
  box-shadow: 0 16px 36px rgba(180, 83, 9, .28);
}
.coin-hero::after {
  content: ""; position: absolute; right: -40px; top: -50px; width: 180px; height: 180px;
  border-radius: 50%; background: radial-gradient(circle, rgba(255,255,255,.35), transparent 65%);
}
.coin-amount { font-size: 38px; font-weight: 800; line-height: 1.1; letter-spacing: -.02em; display: flex; align-items: baseline; gap: 6px; }
.coin-amount b { font-variant-numeric: tabular-nums; }
.coin-star { font-size: 26px; color: #fde68a; text-shadow: 0 0 14px rgba(253, 230, 138, .8); }
.coin-sub { position: relative; z-index: 1; }
.coin-hero .chip { background: rgba(255,255,255,.18); color: #fff; border: 0; }
.btn.collect { background: #fff; color: #92400e; border: 0; font-weight: 800; box-shadow: 0 6px 16px rgba(0,0,0,.18); }
.island-badge { text-align: center; font-size: 11px; opacity: .95; }
.island-badge .ring { margin: 0 auto 2px; }
.island-badge .ring-txt { color: #fff; }

.island-scene {
  position: relative; height: 260px; margin-top: 14px; border-radius: 24px; overflow: hidden;
  background: linear-gradient(180deg, #bae6fd 0%, #e0f2fe 55%, #7dd3fc 100%);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}
[data-theme="dark"] .island-scene { background: linear-gradient(180deg, #0c1a33 0%, #0f2440 55%, #0b3a55 100%); }
.island-sun {
  position: absolute; right: 12%; top: 12%; width: 46px; height: 46px; border-radius: 50%;
  background: radial-gradient(circle at 40% 40%, #fef9c3, #fbbf24);
  box-shadow: 0 0 40px rgba(251, 191, 36, .75);
}
.island-cloud {
  position: absolute; background: rgba(255,255,255,.85); border-radius: 999px; height: 14px; width: 56px;
  filter: blur(.5px); animation: drift 18s linear infinite;
}
.island-cloud::before, .island-cloud::after {
  content: ""; position: absolute; background: inherit; border-radius: 50%;
}
.island-cloud::before { width: 24px; height: 24px; top: -10px; left: 10px; }
.island-cloud::after { width: 18px; height: 18px; top: -7px; left: 30px; }
.island-cloud.c1 { left: 10%; top: 18%; }
.island-cloud.c2 { left: 55%; top: 30%; transform: scale(.75); animation-delay: -8s; }
@keyframes drift { 0% { transform: translateX(0) } 50% { transform: translateX(18px) } 100% { transform: translateX(0) } }
.island-sea {
  position: absolute; left: 0; right: 0; bottom: 0; height: 34%;
  background: linear-gradient(180deg, #38bdf8, #0284c7);
  border-radius: 46% 54% 0 0 / 18% 18% 0 0;
  opacity: .9;
}
[data-theme="dark"] .island-sea { background: linear-gradient(180deg, #0e7490, #082f49); }
.island-land {
  position: absolute; left: 50%; bottom: 6%; transform: translateX(-50%);
  width: 82%; height: 46%; border-radius: 52% 48% 46% 54% / 60% 62% 40% 38%;
  background: linear-gradient(180deg, #86efac, #16a34a);
  box-shadow: inset 0 -10px 24px rgba(0,0,0,.12);
}
[data-theme="dark"] .island-land { background: linear-gradient(180deg, #166534, #14532d); }
.island-buildings { position: absolute; inset: 0; }
.bld {
  position: absolute; transform: translate(-50%, -50%);
  width: 44px; height: 44px; border-radius: 14px;
  background: rgba(255,255,255,.82); backdrop-filter: blur(4px);
  box-shadow: 0 6px 14px rgba(0,0,0,.16);
  display: grid; place-items: center; transition: transform .18s, box-shadow .18s;
}
.bld:hover { transform: translate(-50%, -50%) scale(1.1); }
.bld-ico { font-size: 22px; line-height: 1; }
.bld-empty { opacity: .55; background: rgba(255,255,255,.4); border: 1px dashed rgba(255,255,255,.9); }
.bld-lv {
  position: absolute; right: -4px; bottom: -4px; min-width: 18px; height: 18px; padding: 0 4px;
  border-radius: 9px; background: var(--brand); color: #fff; font-size: 10px; font-weight: 800;
  display: grid; place-items: center;
}
.bld-plus { position: absolute; right: -4px; bottom: -4px; width: 18px; height: 18px; border-radius: 9px; background: var(--warn); color: #fff; font-size: 12px; font-weight: 800; display: grid; place-items: center; }
.island-tip {
  position: absolute; left: 12px; bottom: 10px; font-size: 10.5px; color: #fff;
  background: rgba(0,0,0,.28); padding: 3px 9px; border-radius: 999px;
  backdrop-filter: blur(4px);
}

.build-list { padding: 4px 14px; }
.brow { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px dashed var(--line); }
.brow:last-child { border-bottom: 0; }
.bico {
  width: 40px; height: 40px; border-radius: 12px; flex: none; display: grid; place-items: center;
  font-size: 20px; background: color-mix(in srgb, var(--tint) 14%, var(--card));
  border: 1px solid color-mix(in srgb, var(--tint) 25%, transparent);
}
.bdesc { line-height: 1.45; margin-top: 2px; }
.brow.flash { animation: flashRow 1.1s ease; }
@keyframes flashRow { 0%, 100% { background: transparent } 30% { background: rgba(245, 158, 11, .12) } }

.voyage-card { padding: 16px; }
.voyage-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.v-ico {
  width: 44px; height: 44px; border-radius: 13px; display: grid; place-items: center; font-size: 22px;
  background: linear-gradient(135deg, rgba(14,165,233,.16), rgba(6,182,212,.12));
}
.voyage-board {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; margin-top: 14px;
}
.vtile {
  position: relative; aspect-ratio: 1 / 1; border-radius: 12px;
  background: var(--card-2); border: 1.5px solid var(--line);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  transition: transform .2s, border-color .2s;
}
.vtile .vt-ico { font-size: 17px; line-height: 1; }
.vtile .vt-label { font-size: 9.5px; color: var(--muted); font-weight: 700; }
.vtile.on {
  border-color: var(--brand); background: color-mix(in srgb, var(--brand) 10%, var(--card));
  transform: scale(1.06); box-shadow: 0 6px 16px rgba(99,102,241,.25);
}
.vtile.finish { background: linear-gradient(135deg, rgba(251,191,36,.18), rgba(245,158,11,.08)); }
.vtile.quiz { background: color-mix(in srgb, #6366f1 8%, var(--card-2)); }
.vtile.chest { background: color-mix(in srgb, #f59e0b 10%, var(--card-2)); }
.vtile.fog { background: color-mix(in srgb, #64748b 10%, var(--card-2)); }
.vt-token { position: absolute; top: -10px; right: -6px; font-size: 20px; filter: drop-shadow(0 3px 6px rgba(0,0,0,.25)); animation: bob 1.2s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-4px) } }

.voyage-ctrl { display: flex; align-items: center; gap: 12px; margin-top: 14px; }
.die {
  width: 52px; height: 52px; border-radius: 14px; flex: none;
  background: var(--card); border: 1.5px solid var(--line);
  display: grid; place-items: center; font-size: 22px; font-weight: 800;
  box-shadow: var(--shadow-sm);
}
.die.rolling { animation: dice .5s ease-in-out infinite; }
@keyframes dice { 0%,100% { transform: rotate(-8deg) scale(.98) } 50% { transform: rotate(10deg) scale(1.05) } }
.voyage-log { margin-top: 12px; border-top: 1px dashed var(--line); padding-top: 8px; }
.vlog { font-size: 12px; color: var(--muted); line-height: 1.7; }
.voyage-q { margin-top: 14px; border-top: 1px dashed var(--line); padding-top: 14px; }

@media (max-width: 560px) {
  .island-scene { height: 220px; }
  .coin-amount { font-size: 32px; }
  .build-list { padding: 2px 10px; }
  .brow { gap: 9px; }
  .bico { width: 34px; height: 34px; font-size: 17px; }
  .vtile .vt-label { font-size: 8.5px; }
}
.lv-pill {
  display: inline-flex; align-items: baseline; gap: 2px;
  background: rgba(255,255,255,.92); color: #7c2d12;
  border-radius: 999px; padding: 5px 13px; font-weight: 800; font-size: 13px;
  box-shadow: 0 4px 12px rgba(0,0,0,.15);
}
.lv-pill b { font-size: 16px; }
.island-tip { left: auto; right: 12px; }
.modal-backdrop {
  position: fixed; inset: 0; z-index: 85;
  background: rgba(8, 12, 22, .58);
  backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
}
.modal-panel {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 22px; width: min(520px, 100%);
  max-height: 88vh; overflow: auto; padding: 18px;
  box-shadow: 0 26px 70px rgba(0, 0, 0, .38);
}
.voyage-q.gate { margin-top: 0; border-top: 0; padding-top: 2px; }

/* ---------- 星砂岛子页签 & 农场 ---------- */
.game-tabs {
  display: flex; gap: 6px; margin: 14px 0 12px; padding: 4px;
  background: var(--card-2); border: 1px solid var(--line); border-radius: 14px;
}
.gtab {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 6px; border-radius: 11px; font-size: 13px; font-weight: 700; color: var(--muted);
  transition: background .18s, color .18s;
}
.gtab.on { background: var(--card); color: var(--text); box-shadow: var(--shadow-sm); }
.gt-ico { font-size: 15px; }

.farm-field {
  position: relative; overflow: hidden; padding: 14px; border-radius: 22px;
  background: linear-gradient(180deg, #bbf7d0, #86efac 60%, #4ade80);
  border: 1px solid #86efac;
  box-shadow: var(--shadow-sm);
}
[data-theme="dark"] .farm-field { background: linear-gradient(180deg, #14532d, #166534); border-color: #166534; }
.farm-head { display: flex; align-items: flex-start; justify-content: space-between; color: #14532d; }
[data-theme="dark"] .farm-head { color: #dcfce7; }
.farm-lv { font-size: 20px; font-weight: 800; line-height: 1.2; }
.farm-today { text-align: right; font-size: 10.5px; color: #166534; }
.farm-today b { display: block; font-size: 18px; color: #065f46; line-height: 1.1; }
[data-theme="dark"] .farm-today { color: #bbf7d0; }
[data-theme="dark"] .farm-today b { color: #86efac; }
.farm-xp { margin: 8px 0 10px; background: rgba(255,255,255,.45); }
.farm-xp i { background: linear-gradient(90deg, #f59e0b, #f97316); }

.farm-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
@media (min-width: 520px) { .farm-grid { grid-template-columns: repeat(4, 1fr); } }
.plot {
  position: relative; aspect-ratio: 1 / 1; border-radius: 14px; overflow: hidden;
  border: 2px solid #92400e;
  background: linear-gradient(180deg, #a16207, #713f12);
  box-shadow: inset 0 -6px 12px rgba(0,0,0,.25);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  transition: transform .15s;
}
.plot:active { transform: scale(.97); }
.plot.empty { border-style: dashed; background: rgba(255,255,255,.30); border-color: rgba(120,53,15,.45); }
[data-theme="dark"] .plot.empty { background: rgba(0,0,0,.18); }
.plot-plus { font-size: 22px; color: #78350f; font-weight: 800; line-height: 1; }
.plot-hint { font-size: 10px; font-weight: 700; color: #fef3c7; }
.plot.empty .plot-hint { color: #78350f; }
.plot.locked { background: rgba(0,0,0,.12); border-style: dashed; border-color: rgba(0,0,0,.2); opacity: .55; }
.plot-lock { font-size: 16px; }
.plot .crop { font-size: 24px; line-height: 1; filter: drop-shadow(0 2px 3px rgba(0,0,0,.3)); }
.plot .crop.big { font-size: 34px; animation: bob 1.6s ease-in-out infinite; }
.plot.ready { box-shadow: 0 0 0 2px #fde047, 0 0 18px rgba(253,224,71,.65) inset, inset 0 -6px 12px rgba(0,0,0,.2); }
.plot.watered { border-color: #0ea5e9; }
.plot-time { font-size: 10.5px; font-weight: 700; color: #fef3c7; font-variant-numeric: tabular-nums; }
.plot-bar { position: absolute; left: 6px; right: 6px; bottom: 6px; height: 4px; border-radius: 2px; background: rgba(0,0,0,.28); overflow: hidden; }
.plot-bar i { display: block; height: 100%; background: #4ade80; border-radius: 2px; transition: width .6s; }
.plot.ready .plot-bar { display: none; }
.drop { position: absolute; top: 4px; right: 5px; font-size: 11px; }
.farm-tip { margin-top: 10px; text-align: center; font-size: 10.5px; color: #14532d; opacity: .85; font-weight: 600; }
[data-theme="dark"] .farm-tip { color: #dcfce7; }

.seed-list { margin-top: 12px; }
.seed { display: flex; align-items: center; gap: 11px; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.seed:last-child { border-bottom: 0; }
.seed-ico { width: 38px; height: 38px; border-radius: 11px; flex: none; display: grid; place-items: center; font-size: 20px; background: var(--card-2); }
.drop.dim { opacity: .32; }
.farm-wrap { max-width: 560px; margin: 0 auto; }

/* ---------- 农场场景与 NPC ---------- */
.farm-scene { position: relative; }
.farm-scene .farm-field { border-radius: 0 0 22px 22px; border-top: 0; }
.farm-field {
  background:
    radial-gradient(120% 60% at 50% 0%, rgba(255,255,255,.35), transparent 60%),
    repeating-linear-gradient(90deg, rgba(255,255,255,.05) 0 2px, transparent 2px 30px),
    linear-gradient(180deg, #bbf7d0, #86efac 55%, #4ade80);
}
[data-theme="dark"] .farm-field {
  background:
    radial-gradient(120% 60% at 50% 0%, rgba(255,255,255,.08), transparent 60%),
    repeating-linear-gradient(90deg, rgba(255,255,255,.03) 0 2px, transparent 2px 30px),
    linear-gradient(180deg, #14532d, #166534 55%, #15803d);
}
.farm-banner {
  position: relative; height: 108px; overflow: hidden;
  border-radius: 22px 22px 0 0;
  background: linear-gradient(180deg, #bae6fd 0%, #e0f2fe 62%, #bbf7d0 100%);
  border: 1px solid #86efac; border-bottom: 0;
}
[data-theme="dark"] .farm-banner {
  background: linear-gradient(180deg, #0b1a30 0%, #102a45 62%, #14532d 100%);
  border-color: #166534;
}
.fb-sun {
  position: absolute; right: 18px; top: 10px; width: 36px; height: 36px; border-radius: 50%;
  background: radial-gradient(circle at 40% 40%, #fef9c3, #fbbf24);
  box-shadow: 0 0 28px rgba(251,191,36,.75);
}
.fb-cloud {
  position: absolute; height: 10px; width: 44px; border-radius: 99px;
  background: rgba(255,255,255,.92); animation: drift 22s linear infinite;
}
.fb-cloud::before, .fb-cloud::after {
  content: ""; position: absolute; background: inherit; border-radius: 50%;
}
.fb-cloud::before { width: 18px; height: 18px; top: -8px; left: 8px; }
.fb-cloud::after { width: 13px; height: 13px; top: -6px; left: 24px; }
.fb-cloud.c1 { left: 12%; top: 16%; }
.fb-cloud.c2 { left: 44%; top: 32%; transform: scale(.75); animation-delay: -9s; }
.fb-hill { position: absolute; bottom: -28px; border-radius: 50%; }
.fb-hill.h1 { left: -8%; width: 72%; height: 74px; background: #86efac; }
.fb-hill.h2 { right: -10%; width: 62%; height: 60px; background: #4ade80; }
[data-theme="dark"] .fb-hill.h1 { background: #166534; }
[data-theme="dark"] .fb-hill.h2 { background: #15803d; }
.fb-barn { position: absolute; left: 18px; bottom: 8px; font-size: 34px; filter: drop-shadow(0 4px 6px rgba(0,0,0,.22)); }
.fb-tree { position: absolute; bottom: 6px; font-size: 24px; filter: drop-shadow(0 3px 5px rgba(0,0,0,.2)); }
.fb-tree.t1 { left: 36%; }
.fb-tree.t2 { left: 47%; transform: scale(.82); }
.fb-fence { position: absolute; left: 0; right: 0; bottom: 0; height: 9px; background: repeating-linear-gradient(90deg, #a16207 0 6px, transparent 6px 17px); opacity: .5; }
.fb-butterfly { position: absolute; font-size: 14px; animation: fly 13s linear infinite; filter: drop-shadow(0 2px 3px rgba(0,0,0,.2)); }
.fb-butterfly.b1 { left: 28%; top: 24%; }
.fb-butterfly.b2 { left: 60%; top: 14%; animation-delay: -6s; }
@keyframes fly { 0%,100% { transform: translate(0,0) rotate(-6deg) } 50% { transform: translate(16px,-12px) rotate(8deg) } }

.npc-stand {
  position: absolute; right: 20px; bottom: 8px;
  display: flex; flex-direction: column; align-items: center;
  animation: bob 2.6s ease-in-out infinite;
}
.npc-avatar { font-size: 36px; filter: drop-shadow(0 4px 6px rgba(0,0,0,.22)); line-height: 1; }
.npc-tag {
  font-size: 9.5px; font-weight: 800; color: #14532d; background: rgba(255,255,255,.92);
  border-radius: 99px; padding: 1px 7px; margin-top: -2px;
}
.npc-badge {
  position: absolute; top: -4px; right: 0; width: 16px; height: 16px; border-radius: 50%;
  background: #ef4444; color: #fff; font-size: 10px; font-weight: 800;
  display: grid; place-items: center; box-shadow: 0 2px 6px rgba(0,0,0,.3);
}
.npc-panel { max-width: 420px; }
.npc-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.npc-face {
  width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; font-size: 24px;
  background: linear-gradient(135deg, #fde68a, #fbbf24);
}
.npc-text {
  font-size: 14px; line-height: 1.85; white-space: pre-wrap;
  background: var(--card-2); border: 1px solid var(--line); border-radius: 14px;
  padding: 12px 14px; margin-bottom: 14px;
}
.fb-sun { right: 92px; }

/* ---------- 页面切换：直接切换，不做渐变 ---------- */

/* ---------- 实验 / 模型 ---------- */
.lab-cards { display: flex; gap: 12px; overflow-x: auto; padding: 2px 2px 10px; scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.lab-cards::-webkit-scrollbar { display: none; }
.lab-card { flex: 0 0 156px; scroll-snap-align: start; }
.lab-row-right { display: flex; align-items: center; gap: 6px; }
.lab-arrow { width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--line); background: var(--card); color: var(--muted); font-size: 16px; line-height: 1; cursor: pointer; }
.lab-card { display: block; background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 10px; color: var(--text); }
.lab-card:hover { border-color: color-mix(in srgb, var(--brand) 40%, var(--line)); }
.lab-thumb { height: 96px; border-radius: 12px; overflow: hidden; background: #eef2f7; margin-bottom: 8px; }
.lab-thumb svg { width: 100%; height: 100%; display: block; }
.lab-card-t { font-weight: 700; font-size: 14px; }

.lab-wrap { margin-top: 6px; }
.lab-viewport {
  position: relative; height: min(58vh, 460px); overflow: hidden;
  border-radius: 18px; border: 1px solid var(--line); background: #eef2f7;
  touch-action: none; cursor: grab; user-select: none;
}
.lab-viewport:active { cursor: grabbing; }
.lab-canvas { position: absolute; left: 0; top: 0; width: 800px; height: 460px; transform-origin: 0 0; will-change: transform; }
.lab-svg { width: 100%; height: 100%; display: block; }
.lab-tools { position: absolute; right: 10px; bottom: 10px; display: flex; gap: 8px; }
.lab-tools button {
  width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--line);
  background: color-mix(in srgb, var(--card) 92%, transparent); color: var(--text);
  font-size: 20px; font-weight: 700; line-height: 1; cursor: pointer;
  box-shadow: 0 4px 14px rgba(15,23,42,.08);
}
.lab-info { margin-top: 12px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px; min-height: 86px; }
.lab-info-t { font-weight: 800; font-size: 16px; }
.lab-info-d { margin-top: 6px; font-size: 13.5px; line-height: 1.7; color: var(--text); }
.lab-legend { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.lab-chip { border: 1px solid var(--line); background: var(--card); color: var(--muted); border-radius: 999px; padding: 7px 12px; font-size: 12.5px; font-weight: 600; cursor: pointer; }
.lab-chip.on { color: var(--brand); border-color: color-mix(in srgb, var(--brand) 50%, var(--line)); background: color-mix(in srgb, var(--brand) 10%, var(--card)); }

.lab-svg .ph-head { fill: #f59e0b; stroke: #d97706; stroke-width: 1.5; }
.lab-svg .ph-tail { fill: none; stroke: #fbbf24; stroke-width: 4; stroke-linecap: round; }
.lab-svg .prot { fill: #14b8a6; opacity: .92; }
.lab-svg .prot-in { fill: #0f766e; opacity: .45; }
.lab-svg .glyco { fill: #8b5cf6; }
.lab-svg .glyco-line { stroke: #8b5cf6; stroke-width: 3; fill: none; }
.lab-svg .sugar { fill: #a78bfa; }
.lab-svg .chol { fill: #ef4444; opacity: .88; }
.lab-svg .lab-lbl { font: 700 20px system-ui, sans-serif; fill: #334155; }
.lab-svg .lab-tag { font: 600 13px system-ui, sans-serif; fill: #475569; }
.lab-svg .lab-dash { stroke: #94a3b8; stroke-dasharray: 6 6; stroke-width: 1; }
.lab-svg .hot { cursor: pointer; }
.lab-svg .hot.sel * { filter: drop-shadow(0 0 6px #0ea5e9); }
@media (max-width: 900px) {
  .lab-viewport { height: min(52vh, 380px); }
  .lab-card { padding: 8px; }
  .lab-thumb { height: 82px; }
}

/* 3D 模型 */
.lab-canvas3d { position: absolute; inset: 0; }
.lab-canvas3d canvas { display: block; width: 100%; height: 100%; }
.lab-viewport.lab3d { background: #eaf5fb; }
.lab-viewport.lab3d { background: radial-gradient(120% 90% at 50% 18%, #fbfdff 0%, #e9f5fc 55%, #d7ebf7 100%); }

.lab-colors { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.dotbtn { width: 26px; height: 26px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line); cursor: pointer; padding: 0; }
.dotbtn.on { box-shadow: 0 0 0 2px var(--brand); }

.lab-compare { margin-top: 14px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 12px 14px; overflow-x: auto; }
.lab-compare-t { font-weight: 800; margin-bottom: 8px; }
.lab-compare table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.lab-compare th, .lab-compare td { border-bottom: 1px solid var(--line); padding: 8px 6px; text-align: left; vertical-align: top; }
.lab-compare thead th { color: var(--muted); font-weight: 700; }
.lab-compare tbody th { white-space: nowrap; color: var(--muted); font-weight: 700; }

.lab-labels { position: absolute; inset: 0; overflow: hidden; pointer-events: none; z-index: 2; }
.lab-label { position: absolute; left: 0; top: 0; will-change: transform; background: rgba(255,255,255,.94); border: 1.5px solid #94a3b8; border-radius: 9px; padding: 3px 8px; font-size: 12px; font-weight: 700; color: #0f172a; white-space: nowrap; box-shadow: 0 2px 10px rgba(15,23,42,.10); }
.lab-tools { z-index: 3; }

.lab-pan { position: absolute; left: 10px; bottom: 10px; display: grid; grid-template-columns: repeat(3, 34px); grid-template-rows: repeat(3, 34px); gap: 4px; z-index: 3; }
.lab-pan button { width: 34px; height: 34px; border-radius: 10px; border: 1px solid var(--line); background: rgba(255,255,255,.92); color: var(--text); font-size: 15px; font-weight: 700; cursor: pointer; box-shadow: 0 2px 8px rgba(15,23,42,.08); padding: 0; }
.lab-pan .pan-up { grid-column: 2; grid-row: 1; }
.lab-pan .pan-left { grid-column: 1; grid-row: 2; }
.lab-pan .pan-right { grid-column: 3; grid-row: 2; }
.lab-pan .pan-down { grid-column: 2; grid-row: 3; }

/* ---------- 实验教程 ---------- */
.exp-layout { display: grid; grid-template-columns: minmax(220px, 320px) 1fr; gap: 16px; margin-top: 6px; }
.exp-stage { position: relative; background: linear-gradient(160deg,#f8fcff,#eaf5fb); border: 1px solid var(--line); border-radius: 18px; padding: 10px; display: flex; align-items: center; justify-content: center; min-height: 340px; }
.exp-svg { width: 100%; max-width: 300px; height: auto; display: block; }
.exp-result { margin-top: 12px; background: #fff7ed; border: 1px solid #fed7aa; border-radius: 12px; padding: 10px 12px; }
.exp-result-k { display: inline-block; font-size: 11px; font-weight: 700; color: var(--muted); margin-right: 8px; }
.exp-result-v { font-weight: 800; font-size: 15px; color: #7c2d12; }
.exp-side { display: flex; flex-direction: column; }
.exp-pos { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--muted); font-weight: 700; }
.exp-pos .bar { flex: 1; }
.exp-step-t { font-size: 18px; font-weight: 800; margin-top: 12px; }
.exp-step-d { font-size: 14px; line-height: 1.75; margin-top: 8px; }
.exp-tip { margin-top: 12px; background: #fffbeb; border: 1px solid #fde68a; color: #92400e; border-radius: 12px; padding: 10px 12px; font-size: 12.5px; line-height: 1.65; }
.exp-actions { display: flex; gap: 10px; margin-top: 16px; }
.exp-reagents { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.exp-reagent { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.exp-reagent-n { font-weight: 700; font-size: 13px; margin-bottom: 3px; }
.exp-notes { margin: 8px 0 0; padding-left: 18px; font-size: 13px; line-height: 1.8; color: var(--text); }
.exp-compare { margin-top: 16px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 12px 14px; overflow-x: auto; }
.exp-compare-t { font-weight: 800; margin-bottom: 8px; }
.exp-compare table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.exp-compare th, .exp-compare td { border-bottom: 1px solid var(--line); padding: 8px 6px; text-align: left; vertical-align: top; }
.exp-compare thead th { color: var(--muted); font-weight: 700; }
.exp-compare tbody th { white-space: nowrap; color: var(--muted); font-weight: 700; }
.exp-same td { background: #f0fdf4; }
@media (max-width: 900px) {
  .exp-layout { grid-template-columns: 1fr; }
  .exp-stage { min-height: 300px; }
  .exp-svg { max-width: 240px; }
}

.exp-brief { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 10px 14px; margin-bottom: 12px; font-size: 13px; line-height: 1.7; }
.exp-brief-row { display: flex; gap: 10px; padding: 4px 0; }
.exp-brief-k { flex: 0 0 62px; color: var(--muted); font-weight: 700; font-size: 12px; }
.exp-record { margin-top: 16px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 12px 14px; overflow-x: auto; }
.exp-record table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.exp-record th, .exp-record td { border: 1px solid var(--line); padding: 8px 6px; text-align: left; min-width: 56px; }
.exp-record thead th { background: #f8fafc; color: var(--muted); }

.lab-search { position: relative; margin: 10px 0 6px; }
.lab-search input { width: 100%; box-sizing: border-box; padding: 12px 42px 12px 40px; border-radius: 14px; border: 1px solid var(--line); background: var(--card); color: var(--text); font-size: 14px; outline: none; }
.lab-search input:focus { border-color: color-mix(in srgb, var(--brand) 45%, var(--line)); box-shadow: 0 0 0 3px rgba(99,102,241,.1); }
.lab-search-ico { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); font-size: 15px; opacity: .7; }
.lab-search-clear { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); width: 28px; height: 28px; border: 0; border-radius: 50%; background: transparent; color: var(--muted); font-size: 13px; cursor: pointer; }
.lab-hint { font-size: 12px; color: var(--muted); display: flex; align-items: center; flex-wrap: wrap; gap: 6px; min-height: 24px; }
.lab-quick { border: 1px solid var(--line); background: var(--card); color: var(--muted); border-radius: 999px; padding: 4px 10px; font-size: 12px; cursor: pointer; }
.lab-result-count { font-size: 12.5px; color: var(--muted); margin-top: 8px; }

.lab-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.lab-tag2 { font-size: 11.5px; padding: 3px 9px; border-radius: 999px; background: #eef2ff; color: #4338ca; font-weight: 700; }

/* ---------- 深色模式：实验 / 模型 ---------- */
[data-theme="dark"] { color-scheme: dark; }
[data-theme="dark"] .lab-viewport { background: #0d1424; border-color: #232c42; }
[data-theme="dark"] .lab-viewport.lab3d { background: radial-gradient(120% 90% at 50% 18%, #1a2438 0%, #0f1728 55%, #0a1020 100%); }
[data-theme="dark"] .lab-canvas { background: #ffffff; border-radius: 14px; box-shadow: 0 10px 30px rgba(0,0,0,.45); }
[data-theme="dark"] .lab-tools button,
[data-theme="dark"] .lab-pan button,
[data-theme="dark"] .lab-arrow { background: #1a2338; color: #edf1fb; border-color: #2b3650; }
[data-theme="dark"] .lab-info { background: var(--card); border-color: var(--line); }
[data-theme="dark"] .lab-label { background: rgba(20,27,44,.96); color: #edf1fb; }
[data-theme="dark"] .lab-search input { background: var(--card); color: var(--text); border-color: var(--line); }
[data-theme="dark"] .exp-stage { background: linear-gradient(160deg,#111a2b,#0b1220); border-color: #232c42; }
[data-theme="dark"] .exp-tip { background: #2b2110; border-color: #5a4318; color: #f3c675; }
[data-theme="dark"] .exp-result { background: #2b1c10; border-color: #5a3a18; }
[data-theme="dark"] .lab-chip { background: var(--card); border-color: var(--line); }

.exam-page { max-width: 760px; margin: 0 auto; }
.exam-top { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; margin-bottom: 12px; }
.exam-timer { font-size: 22px; font-weight: 800; color: var(--brand); }
.exam-q { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px; margin-bottom: 12px; }
.eq-head { display: flex; gap: 8px; align-items: flex-start; }
.eq-no { font-weight: 800; color: var(--brand); }
.eq-stem { flex: 1; font-weight: 600; }
.eq-p { font-size: 12px; color: var(--muted); white-space: nowrap; }
.eq-opts { margin-top: 10px; display: grid; gap: 8px; }
.eq-opt { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; }
.eq-opt.static { cursor: default; }
.eq-letter { font-weight: 800; color: var(--brand); }
.eq-opt.right { border-color: #22c55e; background: rgba(34,197,94,.08); }
.eq-opt.wrong { border-color: #ef4444; background: rgba(239,68,68,.08); }
.eq-explain { margin-top: 10px; padding: 10px; background: var(--card-2); border-radius: 10px; font-size: 13px; }
.exam-foot { display: flex; justify-content: center; margin: 16px 0 24px; }
.exam-score { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 20px; text-align: center; margin-bottom: 16px; }
.es-num { font-size: 44px; font-weight: 900; color: var(--brand); }
.es-num span { font-size: 16px; }
.es-actions { display: flex; gap: 10px; justify-content: center; margin-top: 12px; }

.q-img { display: block; max-width: 100%; max-height: 320px; margin: 10px auto; border-radius: 10px; border: 1px solid var(--line); background: #fff; cursor: zoom-in; }

.img-view { position: fixed; inset: 0; z-index: 200; background: rgba(0,0,0,.86); display: flex; align-items: center; justify-content: center; padding: 18px; }
.img-view img { max-width: 100%; max-height: 90vh; border-radius: 10px; background: #fff; }

.q-img-pending { margin: 10px 0; padding: 14px; border: 1px dashed var(--line); border-radius: 10px; color: var(--muted); font-size: 13px; text-align: center; }
