/* ==========================================================================
   数据库 · 长征  —— 学生端视觉系统 v2
   设计语言：史诗电影感（深色舞台） × 红色档案（宣纸 / 朱砂 / 鎏金）
   ========================================================================== */
:root {
  --ink: #0a0d11;
  --ink-2: #11151b;
  --panel: rgba(17, 16, 15, 0.86);
  --panel-solid: #15130f;
  --panel-2: rgba(28, 25, 21, 0.92);
  --line: rgba(255, 236, 200, 0.10);
  --line-2: rgba(255, 236, 200, 0.18);

  --red: #c62a1f;
  --red-hi: #e8452f;
  --red-deep: #7a130d;
  --gold: #d6a344;
  --gold-hi: #f2d38b;
  --gold-deep: #8a6420;
  --jade: #2f9e72;
  --jade-hi: #7fe0b6;
  --wrong: #e0574a;

  --text: #ede6d8;
  --text-2: #c9bfad;
  --muted: #8f8676;

  --paper: #efe4cb;
  --paper-2: #e6d7b6;
  --paper-ink: #2b1d14;
  --paper-red: #a8231a;

  --serif: "Noto Serif SC", "Source Han Serif SC", "Source Han Serif CN", "Songti SC", "STZhongsong", "STSong", "SimSun", serif;
  --sans: "Noto Sans SC", "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  --kai: "KaiTi", "STKaiti", "Kaiti SC", "楷体", serif;
  --mono: Consolas, "JetBrains Mono", "Cascadia Mono", "Courier New", monospace;
  --math: "Cambria Math", "Times New Roman", Georgia, serif;

  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --ease-io: cubic-bezier(.65, 0, .35, 1);

  --noise-paper: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='p'><feTurbulence type='fractalNoise' baseFrequency='.75' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 .42  0 0 0 0 .3  0 0 0 0 .16  0 0 0 .14 0'/></filter><rect width='100%' height='100%' filter='url(%23p)'/></svg>");
  --noise: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 .55 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--ink);
  color: var(--text);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button { font-family: inherit; cursor: pointer; color: inherit; }
img.ico { display: block; width: 100%; height: 100%; user-select: none; -webkit-user-drag: none; }

/* 深色细滚动条 */
* { scrollbar-width: thin; scrollbar-color: rgba(214, 163, 68, .35) transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: rgba(214, 163, 68, .28); border-radius: 8px; border: 2px solid transparent; background-clip: padding-box; }
*::-webkit-scrollbar-thumb:hover { background-color: rgba(214, 163, 68, .5); }

/* ================= 舞台 ================= */
#app { position: fixed; inset: 0; }

#stage {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: radial-gradient(120% 90% at 55% 45%, #131a22 0%, #0a0d11 70%);
}
#map, #gl, #labels { position: absolute; inset: 0; width: 100%; height: 100%; }
#gl { display: block; touch-action: none; cursor: grab; }
#gl:active { cursor: grabbing; }
#labels { pointer-events: none; overflow: hidden; }

.vignette {
  position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(130% 100% at 50% 50%, transparent 55%, rgba(5, 7, 10, .72) 100%),
    linear-gradient(180deg, rgba(8, 10, 13, .78) 0%, transparent 16%, transparent 80%, rgba(8, 10, 13, .9) 100%);
}
.grain {
  position: absolute; inset: -50%; pointer-events: none;
  background-image: var(--noise);
  opacity: .07;
  mix-blend-mode: overlay;
  z-index: 40;
}

/* ================= 顶部 HUD ================= */
.hud {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 22px;
  z-index: 20;
  pointer-events: none;
  transition: opacity .6s var(--ease-out), transform .6s var(--ease-out);
}
.hud > * { pointer-events: auto; }
body.is-intro .hud, body.is-cine .hud { opacity: 0; transform: translateY(-12px); pointer-events: none; }
body.is-intro .hud > *, body.is-cine .hud > * { pointer-events: none; }

.brand { display: flex; align-items: center; gap: 12px; }
.seal {
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border-radius: 6px;
  background: linear-gradient(145deg, #d1352a, #8e1810);
  box-shadow: inset 0 0 0 1.5px rgba(255, 220, 160, .55), 0 6px 18px rgba(198, 42, 31, .35);
  font-family: var(--serif);
  font-weight: 900;
  font-size: 13.5px;
  line-height: 1.05;
  color: #fff1d2;
  text-align: center;
  letter-spacing: 1px;
}
.brand h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: 19px;
  font-weight: 900;
  letter-spacing: 3px;
  color: #fbf3e2;
}
.brand p { margin: 2px 0 0; font-size: 11.5px; letter-spacing: 1px; color: var(--muted); }

.hud-right { display: flex; align-items: center; gap: 8px; }

.tally {
  display: flex; align-items: center; gap: 2px;
  padding: 4px 6px;
  border-radius: 999px;
  background: rgba(14, 13, 12, .72);
  border: 1px solid var(--line);
  backdrop-filter: blur(8px);
}
.tally-item {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px 2px 4px;
  font-size: 13px; font-weight: 700;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}
.tally-item .ico-wrap { width: 22px; height: 22px; }
.tally-item b { color: #fff3d8; font-weight: 800; }
.tally-item small { color: var(--muted); font-weight: 600; }
.tally-sep { width: 1px; height: 18px; background: var(--line-2); margin: 0 2px; }

.hud-btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 36px;
  padding: 0 12px 0 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(14, 13, 12, .72);
  backdrop-filter: blur(8px);
  font-size: 13px; font-weight: 600;
  color: var(--text-2);
  transition: border-color .2s, background .2s, color .2s;
}
.hud-btn .ico-wrap { width: 22px; height: 22px; }
.hud-btn em {
  font-style: normal;
  min-width: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: rgba(214, 163, 68, .18);
  color: var(--gold-hi);
  font-size: 11.5px; font-weight: 800;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.hud-btn em.warn { background: rgba(224, 87, 74, .22); color: #ffaea4; }
.hud-btn:hover { border-color: rgba(214, 163, 68, .5); color: #fff3d8; }

.btn-reunion {
  border-color: rgba(242, 211, 139, .7);
  background: linear-gradient(135deg, rgba(198, 42, 31, .85), rgba(160, 98, 22, .85));
  color: #fff6e0;
  box-shadow: 0 0 24px rgba(214, 163, 68, .35);
}

.user-chip {
  display: inline-flex; align-items: center; gap: 8px;
  height: 36px;
  padding: 0 12px 0 4px;
  border-radius: 999px;
  border: 1px solid rgba(214, 163, 68, .38);
  background: rgba(14, 13, 12, .78);
  font-size: 13px; font-weight: 700;
  color: #fff3d8;
}
.avatar {
  width: 28px; height: 28px; border-radius: 50%;
  display: grid; place-items: center;
  background: linear-gradient(145deg, #c62a1f, #7a130d);
  font-family: var(--serif); font-weight: 900; font-size: 13px;
  color: #ffe9bf;
  box-shadow: inset 0 0 0 1px rgba(255, 220, 160, .5);
}
.sync-dot { width: 7px; height: 7px; border-radius: 50%; background: #c2903c; box-shadow: 0 0 0 3px rgba(194, 144, 60, .18); }
.sync-dot.online { background: #43d394; box-shadow: 0 0 0 3px rgba(67, 211, 148, .18); }

/* ================= 开场片头 ================= */
.intro {
  position: absolute; inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  padding: 0 7vw;
  background:
    linear-gradient(90deg, rgba(7, 9, 12, .94) 0%, rgba(7, 9, 12, .78) 34%, rgba(7, 9, 12, .12) 62%, transparent 80%);
  transition: opacity 1s var(--ease-out), transform 1.2s var(--ease-out);
}
.intro.leaving { opacity: 0; transform: translateX(-40px); pointer-events: none; }
.intro-inner { max-width: 560px; }

.intro-kicker {
  display: inline-flex; align-items: center; gap: 10px;
  margin: 0 0 22px;
  font-size: 13px; letter-spacing: 4px;
  color: var(--gold);
  opacity: 0; animation: rise .9s .2s var(--ease-out) forwards;
}
.intro-kicker::before { content: ""; width: 34px; height: 1px; background: var(--gold); }

.intro-title {
  margin: 0;
  font-family: var(--serif);
  font-weight: 900;
  font-size: clamp(56px, 7.4vw, 104px);
  line-height: 1;
  letter-spacing: .08em;
  color: #fbf2df;
  text-shadow: 0 8px 40px rgba(0, 0, 0, .6);
  display: flex; align-items: baseline; gap: .12em;
}
.intro-title span { white-space: nowrap; opacity: 0; animation: rise 1.1s var(--ease-out) forwards; }
.intro-title span:nth-child(1) { animation-delay: .35s; }
.intro-title span:nth-child(2) { animation-delay: .55s; color: var(--red-hi); }
.intro-title span:nth-child(3) {
  animation-delay: .75s;
  background: linear-gradient(180deg, #ffe7a6 0%, #d6a344 60%, #9c6f22 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

.intro-poem {
  margin: 28px 0 0;
  font-family: var(--kai);
  font-size: clamp(20px, 1.8vw, 26px);
  letter-spacing: .35em;
  color: var(--text-2);
  display: flex; flex-wrap: wrap; gap: .2em 1.2em;
}
.intro-poem span { opacity: 0; animation: ink 1.6s var(--ease-out) forwards; }
.intro-poem span:nth-child(1) { animation-delay: 1.05s; }
.intro-poem span:nth-child(2) { animation-delay: 1.55s; }

.intro-facts {
  list-style: none;
  display: flex; gap: 0;
  margin: 40px 0 0; padding: 0;
  opacity: 0; animation: rise 1s 1.9s var(--ease-out) forwards;
}
.intro-facts li {
  padding: 0 26px;
  border-left: 1px solid var(--line-2);
  display: flex; flex-direction: column; gap: 4px;
}
.intro-facts li:first-child { padding-left: 0; border-left: none; }
.intro-facts b { font-family: var(--serif); font-size: 34px; font-weight: 900; color: #fbf2df; line-height: 1; }
.intro-facts span { font-size: 12px; letter-spacing: 2px; color: var(--muted); }

.intro-cta-row {
  display: flex; align-items: center; gap: 22px;
  margin-top: 46px;
  opacity: 0; animation: rise 1s 2.2s var(--ease-out) forwards;
}
.btn-depart {
  position: relative;
  display: inline-flex; align-items: center; gap: 14px;
  height: 58px;
  padding: 0 30px 0 10px;
  border: none;
  border-radius: 4px;
  background: linear-gradient(135deg, #d0342a 0%, #a01d14 100%);
  box-shadow: 0 14px 40px rgba(198, 42, 31, .42), inset 0 0 0 1px rgba(255, 210, 150, .35);
  font-family: var(--serif);
  font-size: 19px; font-weight: 900; letter-spacing: 6px;
  color: #fff3dc;
  transition: transform .25s var(--ease-out), box-shadow .25s;
}
.btn-depart::after {
  content: ""; position: absolute; inset: 0; border-radius: 4px;
  background: linear-gradient(110deg, transparent 30%, rgba(255, 240, 210, .28) 50%, transparent 70%);
  background-size: 250% 100%;
  animation: sheen 3.6s 3s infinite;
}
.btn-depart:hover { transform: translateY(-2px); box-shadow: 0 18px 48px rgba(198, 42, 31, .55), inset 0 0 0 1px rgba(255, 210, 150, .5); }
.btn-depart .flag-ico { width: 40px; height: 40px; padding: 4px; border-radius: 3px; background: rgba(0, 0, 0, .18); }
.intro-user { margin: 0; font-size: 13px; line-height: 1.6; color: var(--muted); }
.intro-user b { color: var(--gold-hi); font-weight: 700; }

.intro-foot {
  position: absolute; left: 7vw; bottom: 34px;
  font-size: 11.5px; letter-spacing: 2px; color: rgba(201, 191, 173, .45);
}

@keyframes rise { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
@keyframes ink { from { opacity: 0; filter: blur(6px); letter-spacing: .6em; } to { opacity: 1; filter: blur(0); } }
@keyframes sheen { 0% { background-position: 150% 0; } 30%, 100% { background-position: -50% 0; } }

/* ================= 电影遮幅 / 行军字幕 ================= */
.cine { position: absolute; inset: 0; z-index: 28; pointer-events: none; }
.cine-bar {
  position: absolute; left: 0; right: 0; height: 11vh;
  background: #050608;
  transition: transform .9s var(--ease-io);
}
.cine-bar.top { top: 0; transform: translateY(-100%); }
.cine-bar.bottom { bottom: 0; transform: translateY(100%); }
.cine.on .cine-bar { transform: none; }
.cine.on { pointer-events: auto; cursor: pointer; }

.cine-caption {
  position: absolute; left: 6vw; bottom: calc(11vh + 34px);
  opacity: 0; transform: translateY(16px);
  transition: opacity .35s, transform .35s;
}
.cine.on .cine-caption { opacity: 1; transform: none; transition: opacity .8s .35s var(--ease-out), transform .8s .35s var(--ease-out); }
.cine-kicker { font-size: 12.5px; letter-spacing: 4px; color: var(--gold); }
.cine-title {
  margin: 8px 0 6px;
  font-family: var(--serif);
  font-size: clamp(30px, 3.6vw, 52px);
  font-weight: 900; letter-spacing: .12em;
  color: #fbf2df;
  text-shadow: 0 6px 30px rgba(0, 0, 0, .7);
}
.cine-title .arrow { color: var(--red-hi); margin: 0 .3em; font-weight: 400; }
.cine-sub { margin: 0; font-size: 14px; letter-spacing: 2px; color: var(--text-2); }

.cine-li {
  white-space: nowrap;
  position: absolute; right: 6vw; bottom: calc(11vh + 34px);
  text-align: right;
  opacity: 0; transition: opacity .3s;
}
.cine.on .cine-li { opacity: 1; transition: opacity .8s .5s; }
.cine-li > span { display: block; font-size: 12px; letter-spacing: 4px; color: var(--muted); }
.cine-li b {
  display: block;
  font-family: var(--serif);
  font-size: clamp(36px, 4vw, 58px);
  font-weight: 900;
  color: var(--gold-hi);
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
.cine-li b small { font-size: .4em; color: var(--text-2); margin-left: 6px; letter-spacing: 2px; }

.cine-skip {
  position: absolute; left: 50%; bottom: calc(11vh * .5); transform: translate(-50%, 50%);
  font-size: 11.5px; letter-spacing: 3px; color: rgba(201, 191, 173, .5);
  opacity: 0; transition: opacity .2s;
}
.cine.on .cine-skip { opacity: 1; transition: opacity .6s 1s; }

/* 抵达印章 */
.arrive {
  position: absolute; left: 50%; top: 30%;
  transform: translate(-50%, -50%);
  z-index: 29;
  pointer-events: none;
  text-align: center;
  opacity: 0;
}
.arrive.on { animation: arrive 2.3s var(--ease-out) forwards; }
.arrive-frame {
  display: inline-flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 18px 40px 20px;
  border: 2px solid rgba(232, 69, 47, .85);
  outline: 1px solid rgba(232, 69, 47, .45);
  outline-offset: 5px;
  background: rgba(10, 8, 7, .55);
  backdrop-filter: blur(4px);
}
.arrive-kicker { font-size: 12.5px; letter-spacing: 8px; color: var(--red-hi); font-weight: 700; }
.arrive-name { font-family: var(--serif); font-size: 46px; font-weight: 900; letter-spacing: .25em; color: #fbf2df; margin-right: -.25em; }
.arrive-date { font-size: 13px; letter-spacing: 3px; color: var(--gold); }
@keyframes arrive {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(1.5); filter: blur(6px); }
  14% { opacity: 1; transform: translate(-50%, -50%) scale(.97); filter: blur(0); }
  22% { transform: translate(-50%, -50%) scale(1); }
  78% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -54%) scale(1); }
}

/* ================= 地图控制 ================= */
.map-controls {
  position: absolute; top: 76px; left: 22px;
  z-index: 15;
  display: flex; flex-direction: column; gap: 8px;
  transition: opacity .5s;
}
body.is-intro .map-controls, body.is-cine .map-controls { opacity: 0; pointer-events: none; }
.ctrl-group {
  display: inline-flex; gap: 2px;
  padding: 3px;
  border-radius: 8px;
  background: rgba(14, 13, 12, .74);
  border: 1px solid var(--line);
  backdrop-filter: blur(8px);
  width: max-content;
}
.ctrl-btn, .filter-pill {
  height: 28px;
  padding: 0 11px;
  border: none; border-radius: 6px;
  background: transparent;
  font-size: 12.5px; font-weight: 600;
  color: var(--muted);
  transition: background .2s, color .2s;
}
.ctrl-btn:hover, .filter-pill:hover { color: var(--text); }
.ctrl-btn.active, .filter-pill.active { background: rgba(214, 163, 68, .18); color: var(--gold-hi); }
.ctrl-hint { font-size: 11px; letter-spacing: 1px; color: rgba(143, 134, 118, .75); padding-left: 4px; }

/* ================= 3D 地标（分级显示） ================= */
.mk {
  position: absolute; left: 0; top: 0;
  pointer-events: auto;
  display: flex; align-items: center; gap: 8px;
  padding: 0; border: none; background: none;
  will-change: transform;
  z-index: 3;
}
.mk:hover, .mk.is-selected, .mk.st-frontier { z-index: 9; }
.mk-pin {
  position: relative;
  flex-shrink: 0;
  display: grid; place-items: center;
}
.mk-label {
  display: none;
  flex-direction: column;
  padding: 5px 11px 6px;
  border-radius: 4px;
  background: rgba(14, 12, 10, .86);
  border: 1px solid var(--line-2);
  box-shadow: 0 8px 22px rgba(0, 0, 0, .5);
  text-align: left; white-space: nowrap; line-height: 1.25;
  backdrop-filter: blur(4px);
}
.mk.expanded .mk-label, .mk:hover .mk-label { display: flex; }
.mk-label b { font-family: var(--serif); font-size: 13.5px; font-weight: 900; letter-spacing: 1.5px; color: #fbf2df; }
.mk-label small { font-size: 11px; color: var(--text-2); margin-top: 1px; }

/* 主线 */
.mk-main .mk-pin {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #3b352d, #17140f);
  border: 1.5px solid rgba(214, 163, 68, .55);
  box-shadow: 0 4px 14px rgba(0, 0, 0, .6);
}
.pin-num { font-family: var(--serif); font-weight: 900; font-size: 14px; color: var(--gold-hi); }
.pin-medal { position: absolute; right: -9px; top: -10px; width: 22px; height: 22px; filter: drop-shadow(0 2px 4px rgba(0, 0, 0, .6)); }
.mk-main.st-locked .mk-pin { border-color: rgba(143, 134, 118, .35); background: rgba(16, 15, 13, .85); }
.mk-main.st-locked .pin-num { color: #6f685c; }
.mk-main.st-locked .mk-label { opacity: .78; }
.mk-main.st-passed .mk-pin { border-color: var(--gold); background: radial-gradient(circle at 35% 30%, #5a4520, #1f170c); }
.mk-main.st-frontier .mk-pin {
  width: 36px; height: 36px;
  border: 2px solid #ffd59a;
  background: radial-gradient(circle at 35% 30%, #ec4a35, #8a170f);
  box-shadow: 0 0 0 4px rgba(232, 69, 47, .25), 0 0 26px rgba(232, 69, 47, .7);
}
.mk-main.st-frontier .pin-num { color: #fff3dc; font-size: 15px; }
.mk-main.st-frontier .mk-pin::before, .mk-main.st-frontier .mk-pin::after {
  content: ""; position: absolute; inset: -2px; border-radius: 50%;
  border: 2px solid rgba(232, 69, 47, .8);
  animation: ripple 2.2s infinite var(--ease-out);
}
.mk-main.st-frontier .mk-pin::after { animation-delay: 1.1s; }
.mk-main.st-frontier .mk-label { border-color: rgba(232, 69, 47, .65); background: linear-gradient(135deg, rgba(120, 22, 14, .92), rgba(20, 12, 10, .92)); }
.mk.is-selected .mk-label { border-color: var(--gold); }
.mk-main.is-selected .mk-pin { outline: 2px solid var(--gold-hi); outline-offset: 3px; }
@keyframes ripple { from { transform: scale(1); opacity: .9; } to { transform: scale(2.3); opacity: 0; } }

/* 支线 */
.mk-side .mk-pin { width: 26px; height: 26px; filter: drop-shadow(0 3px 8px rgba(0, 0, 0, .65)); }
.mk-side.st-open .mk-pin img { filter: saturate(.55) brightness(.85); }
.mk-side .mk-label { border-color: rgba(214, 163, 68, .4); }
.mk-side .mk-label b { color: var(--gold-hi); }

/* 诗词 */
.mk-poem .mk-pin { width: 24px; height: 24px; }
.mk-poem.st-dim .mk-pin { animation: breathe 2.8s infinite ease-in-out; }
.mk-poem .mk-label b { font-family: var(--kai); font-weight: 700; color: #ffe6ad; letter-spacing: 2px; }
@keyframes breathe { 0%, 100% { opacity: .7; transform: scale(.94); } 50% { opacity: 1; transform: scale(1.06); } }

/* ================= 右侧 站点档案 ================= */
.drawer {
  position: absolute; right: 22px; top: 80px;
  z-index: 16;
  width: 360px; max-width: calc(100vw - 44px);
  padding: 22px 22px 20px;
  border-radius: 6px;
  background: linear-gradient(180deg, rgba(22, 19, 16, .94), rgba(14, 12, 10, .94));
  border: 1px solid var(--line-2);
  box-shadow: 0 30px 60px rgba(0, 0, 0, .55);
  backdrop-filter: blur(14px);
  animation: drawerIn .55s var(--ease-out);
}
.drawer::before {
  content: ""; position: absolute; left: 0; top: 22px; bottom: 22px; width: 3px;
  background: linear-gradient(180deg, var(--red-hi), var(--red-deep));
}
.drawer.side::before { background: linear-gradient(180deg, var(--gold-hi), var(--gold-deep)); }
@keyframes drawerIn { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: none; } }

.dossier-head { display: flex; align-items: center; justify-content: space-between; }
.dossier-no { font-size: 12px; letter-spacing: 3px; color: var(--red-hi); font-weight: 700; }
.drawer.side .dossier-no { color: var(--gold); }
.dossier-date { font-size: 12px; letter-spacing: 2px; color: var(--muted); margin-left: 10px; }
.icon-close {
  width: 30px; height: 30px; border-radius: 50%;
  border: 1px solid transparent; background: transparent;
  color: var(--muted); font-size: 18px; line-height: 1;
}
.icon-close:hover { border-color: var(--line-2); color: var(--text); }

.dossier-name {
  margin: 10px 0 6px;
  font-family: var(--serif);
  font-size: 34px; font-weight: 900;
  letter-spacing: .18em;
  color: #fbf2df;
}
.dossier-topic { display: flex; flex-direction: column; gap: 2px; margin-bottom: 16px; }
.dossier-topic strong { font-size: 15.5px; color: var(--gold-hi); font-weight: 700; }
.dossier-topic span { font-size: 12px; color: var(--muted); letter-spacing: 1px; }
.dossier-quote {
  margin: 0 0 18px;
  font-family: var(--serif);
  font-size: 13.5px; line-height: 1.85;
  color: var(--text-2);
}
.dossier-record {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px;
  border-radius: 4px;
  background: rgba(255, 240, 210, .04);
  border: 1px solid var(--line);
  margin-bottom: 16px;
}
.dossier-record .rec-medal { width: 40px; height: 40px; flex-shrink: 0; }
.dossier-record b { display: block; font-size: 14px; color: #fbf2df; }
.dossier-record small { display: block; margin-top: 2px; font-size: 12px; color: var(--muted); }
.dossier-hint { margin: 10px 0 0; text-align: center; font-size: 12px; color: var(--muted); letter-spacing: 1px; }

/* ================= 按钮 ================= */
.btn-primary {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  height: 46px;
  padding: 0 24px;
  border: none; border-radius: 4px;
  background: linear-gradient(135deg, #d0342a, #9f1c13);
  box-shadow: 0 10px 26px rgba(198, 42, 31, .35), inset 0 0 0 1px rgba(255, 210, 150, .3);
  font-size: 15px; font-weight: 800; letter-spacing: 2px;
  color: #fff3dc;
  transition: transform .2s var(--ease-out), box-shadow .2s, filter .2s;
}
.btn-primary:hover { transform: translateY(-1px); filter: brightness(1.08); }
.btn-primary.block { width: 100%; }
.btn-primary.gold { background: linear-gradient(135deg, #e3b65a, #a4741f); color: #2a1a06; box-shadow: 0 10px 26px rgba(214, 163, 68, .35); }
.btn-ghost {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 42px; padding: 0 18px;
  border-radius: 4px;
  border: 1px solid var(--line-2);
  background: rgba(255, 240, 210, .04);
  font-size: 14px; font-weight: 600;
  color: var(--text-2);
  transition: border-color .2s, color .2s, background .2s;
}
.btn-ghost:hover { border-color: rgba(214, 163, 68, .55); color: #fff3d8; background: rgba(214, 163, 68, .08); }
.btn-text { border: none; background: none; padding: 6px 4px; font-size: 13.5px; color: var(--muted); }
.btn-text:hover { color: var(--gold-hi); }

/* ================= Toast ================= */
.toast {
  position: absolute; bottom: 112px; left: 50%;
  transform: translateX(-50%);
  z-index: 35;
  display: flex; align-items: center; gap: 10px;
  padding: 10px 20px 10px 12px;
  border-radius: 4px;
  background: rgba(16, 13, 11, .94);
  border: 1px solid rgba(214, 163, 68, .45);
  box-shadow: 0 16px 36px rgba(0, 0, 0, .55);
  font-size: 13.5px; font-weight: 600;
  color: #fbf2df;
  animation: toastIn .4s var(--ease-out);
}
.toast .ico-wrap { width: 22px; height: 22px; }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 10px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* ================= 底部 行军路线条 ================= */
.trailbar {
  position: absolute; left: 0; right: 0; bottom: 0;
  z-index: 18;
  height: 92px;
  display: flex; align-items: center; gap: 28px;
  padding: 0 26px 6px;
  transition: opacity .6s var(--ease-out), transform .6s var(--ease-out);
}
body.is-intro .trailbar, body.is-cine .trailbar { opacity: 0; transform: translateY(14px); pointer-events: none; }

.li-meter { flex-shrink: 0; min-width: 150px; white-space: nowrap; }
.li-meter > span { display: block; font-size: 11px; letter-spacing: 3px; color: var(--muted); }
.li-meter b {
  display: block;
  font-family: var(--serif);
  font-size: 26px; font-weight: 900;
  color: var(--gold-hi);
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
}
.li-meter b small { font-size: 12px; color: var(--text-2); font-weight: 600; margin-left: 4px; letter-spacing: 1px; }
.li-meter i { display: block; font-style: normal; font-size: 11px; color: rgba(143, 134, 118, .8); letter-spacing: 1px; }

.trail { position: relative; flex: 1; height: 56px; min-width: 0; }
.trail-line {
  position: absolute; left: 14px; right: 14px; top: 15px; height: 2px;
  background: repeating-linear-gradient(90deg, rgba(214, 163, 68, .45) 0 6px, transparent 6px 12px);
}
.trail-fill {
  position: absolute; left: 0; top: -1px; height: 4px; width: 0;
  background: linear-gradient(90deg, #8f1810, #e8452f 70%, #ffb38a);
  box-shadow: 0 0 12px rgba(232, 69, 47, .7);
  border-radius: 4px;
}
.trail-nodes { position: absolute; left: 14px; right: 14px; top: 0; bottom: 0; }
.trail-node {
  position: absolute; top: 0;
  transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 7px;
  padding: 0; border: none; background: none;
}
.trail-dot {
  width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center;
  background: #16130f;
  border: 1.5px solid rgba(143, 134, 118, .4);
  font-family: var(--serif); font-weight: 900; font-size: 13px;
  color: #6f685c;
  position: relative;
  transition: transform .25s var(--ease-out), border-color .2s;
}
.trail-dot img { position: absolute; inset: 3px; width: 22px; height: 22px; }
.trail-name {
  font-size: 11.5px; letter-spacing: 1px;
  color: #6f685c;
  white-space: nowrap;
  transition: color .2s;
}
.trail-node:hover .trail-dot { transform: scale(1.12); }
.trail-node.passed .trail-dot { border-color: var(--gold); background: #22190c; }
.trail-node.passed .trail-name { color: var(--text-2); }
.trail-node.frontier .trail-dot {
  border: 2px solid #ffd59a;
  background: radial-gradient(circle at 35% 30%, #ec4a35, #8a170f);
  color: #fff3dc;
  box-shadow: 0 0 0 4px rgba(232, 69, 47, .22), 0 0 20px rgba(232, 69, 47, .6);
}
.trail-node.frontier .trail-name { color: #fff3dc; font-weight: 700; font-family: var(--serif); font-size: 12.5px; }
.trail-node.active .trail-dot { outline: 2px solid var(--gold-hi); outline-offset: 3px; }

.btn-sides {
  flex-shrink: 0;
  display: inline-flex; align-items: center; gap: 10px;
  height: 46px; padding: 0 18px 0 10px;
  border-radius: 4px;
  border: 1px solid rgba(214, 163, 68, .45);
  background: rgba(30, 24, 14, .82);
  font-size: 13.5px; font-weight: 700; letter-spacing: 1px;
  color: var(--gold-hi);
  backdrop-filter: blur(8px);
}
.btn-sides .ico-wrap { width: 28px; height: 28px; }
.btn-sides small { display: block; font-size: 11px; font-weight: 500; color: var(--muted); letter-spacing: 0; }
.btn-sides:hover { border-color: var(--gold); }

/* ================= 弹窗基础 ================= */
dialog {
  padding: 0; border: none; margin: auto;
  color: var(--text);
  background: transparent;
  max-width: 96vw; max-height: 94vh;
}
dialog::backdrop { background: rgba(4, 5, 7, .72); backdrop-filter: blur(6px); }
dialog[open] { animation: dlgIn .45s var(--ease-out); }
@keyframes dlgIn { from { opacity: 0; transform: translateY(14px) scale(.985); } to { opacity: 1; transform: none; } }

.dlg-dark {
  width: min(980px, 94vw);
  max-height: 88vh;
  background: linear-gradient(180deg, #1a1713, #110f0d);
  border: 1px solid var(--line-2);
  border-radius: 6px;
  box-shadow: 0 40px 100px rgba(0, 0, 0, .7);
  overflow: hidden;
}
.dlg-dark[open] { display: flex; flex-direction: column; }
.dlg-head {
  flex-shrink: 0;
  display: flex; align-items: flex-end; justify-content: space-between; gap: 16px;
  padding: 22px 28px 18px;
  border-bottom: 1px solid var(--line);
}
.dlg-kicker { margin: 0 0 6px; font-size: 12px; letter-spacing: 3px; color: var(--gold); }
.dlg-head h2 { margin: 0; font-family: var(--serif); font-size: 24px; font-weight: 900; letter-spacing: 3px; color: #fbf2df; }
.dlg-body { flex: 1; min-height: 0; overflow-y: auto; padding: 22px 28px 30px; }

/* ================= 宣纸弹窗（登记 / 证书） ================= */
.dlg-paper {
  position: relative;
  color: var(--paper-ink);
  background:
    var(--noise-paper),
    radial-gradient(120% 90% at 20% 10%, #f8f1df 0%, var(--paper) 50%, var(--paper-2) 100%);
  border-radius: 3px;
  box-shadow: 0 40px 100px rgba(0, 0, 0, .7), inset 0 0 80px rgba(120, 80, 30, .18);
}

.login-dlg { width: 470px; }
.login-box { position: relative; padding: 38px 40px 34px; }
.login-box::before {
  content: ""; position: absolute; inset: 12px;
  border: 1px solid rgba(168, 35, 26, .35);
  outline: 3px double rgba(168, 35, 26, .25);
  outline-offset: 4px;
  pointer-events: none;
}
.login-seal {
  position: absolute; right: 32px; top: 30px;
  width: 58px; height: 58px;
  display: grid; place-items: center;
  border: 2.5px solid var(--paper-red);
  border-radius: 4px;
  color: var(--paper-red);
  font-family: var(--serif); font-weight: 900; font-size: 15px; line-height: 1.1;
  text-align: center; letter-spacing: 2px;
  transform: rotate(-8deg);
  opacity: .82;
}
.login-kicker { margin: 0; font-size: 12px; letter-spacing: 4px; color: var(--paper-red); font-weight: 700; }
.login-box h2 { margin: 8px 0 8px; font-family: var(--serif); font-size: 28px; font-weight: 900; letter-spacing: 6px; }
.login-desc { margin: 0 0 22px; font-size: 13px; line-height: 1.7; color: #6a5641; max-width: 300px; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field span { font-size: 12.5px; font-weight: 700; letter-spacing: 2px; color: #5b4632; }
.field input {
  height: 42px; padding: 0 2px;
  border: none; border-bottom: 1.5px solid rgba(60, 40, 22, .35);
  background: transparent;
  font-family: var(--serif); font-size: 18px; font-weight: 700; letter-spacing: 2px;
  color: var(--paper-ink);
}
.field input::placeholder { color: rgba(90, 70, 50, .4); font-weight: 400; font-size: 15px; letter-spacing: 1px; }
.field input:focus { outline: none; border-bottom-color: var(--paper-red); }
.class-row { display: flex; gap: 8px; align-items: flex-end; }
.class-row input { flex: 1; min-width: 0; }
.cls-preset {
  height: 30px; padding: 0 10px;
  border: 1px solid rgba(168, 35, 26, .4);
  border-radius: 2px;
  background: transparent;
  font-size: 12px; font-weight: 700;
  color: var(--paper-red);
  white-space: nowrap;
  flex-shrink: 0;
}
.cls-preset:hover { background: rgba(168, 35, 26, .08); }
.login-actions { margin-top: 26px; }
.login-actions .btn-primary { width: 100%; height: 50px; font-family: var(--serif); font-size: 17px; letter-spacing: 6px; }

/* ================= 作战舱（答题弹窗） ================= */
.sheet {
  width: min(1100px, 95vw);
  height: min(780px, 92vh);
  background: #12100d;
  border: 1px solid var(--line-2);
  border-radius: 6px;
  box-shadow: 0 50px 120px rgba(0, 0, 0, .75);
  overflow: hidden;
}
.sheet[open] { display: flex; }

.sheet-side {
  position: relative;
  flex-shrink: 0;
  width: 128px;
  display: flex; flex-direction: column; align-items: center;
  padding: 26px 0 22px;
  background:
    var(--noise),
    linear-gradient(180deg, #8f1a11 0%, #5d0f0a 100%);
  background-blend-mode: overlay, normal;
  border-right: 1px solid rgba(255, 210, 150, .18);
}
.sheet-side.side { background: var(--noise), linear-gradient(180deg, #6b4c17 0%, #3a280b 100%); background-blend-mode: overlay, normal; }
.sheet-side::after {
  content: ""; position: absolute; inset: 10px;
  border: 1px solid rgba(255, 215, 150, .22);
  pointer-events: none;
}
.side-no { font-size: 12px; letter-spacing: 4px; color: rgba(255, 228, 180, .75); writing-mode: horizontal-tb; }
.side-name {
  flex: 1;
  margin: 18px 0;
  writing-mode: vertical-rl;
  font-family: var(--serif);
  font-size: 40px; font-weight: 900;
  letter-spacing: .32em;
  color: #fff0cf;
  text-shadow: 0 4px 18px rgba(0, 0, 0, .45);
}
.side-date { font-size: 12px; letter-spacing: 2px; color: rgba(255, 228, 180, .7); writing-mode: vertical-rl; margin-bottom: 14px; }
.side-medal { width: 54px; height: 54px; filter: drop-shadow(0 6px 10px rgba(0, 0, 0, .5)); }

.sheet-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.sheet-head {
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 18px 26px 0;
}
.sheet-kicker { margin: 0 0 4px; font-size: 12px; letter-spacing: 2px; color: var(--muted); }
.sheet-title { margin: 0; font-size: 19px; font-weight: 800; color: #fbf2df; letter-spacing: 1px; }
.sheet-tabs {
  flex-shrink: 0;
  display: flex; gap: 26px;
  padding: 0 26px;
  margin-top: 14px;
  border-bottom: 1px solid var(--line);
}
.q-tab {
  position: relative;
  height: 42px; padding: 0;
  border: none; background: none;
  font-size: 14px; font-weight: 700; letter-spacing: 2px;
  color: var(--muted);
}
.q-tab.active { color: #fbf2df; }
.q-tab.active::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px;
  background: linear-gradient(90deg, var(--red-hi), var(--gold));
}
.sheet-body { flex: 1; min-height: 0; overflow-y: auto; padding: 22px 26px 30px; }

/* 速记卡 */
.brief-quote {
  position: relative;
  margin: 0 0 22px;
  padding: 16px 20px 16px 62px;
  border-radius: 4px;
  background: linear-gradient(90deg, rgba(198, 42, 31, .16), rgba(198, 42, 31, .02));
  border-left: 3px solid var(--red-hi);
  font-family: var(--serif);
  font-size: 14.5px; line-height: 1.85;
  color: #f0e6d2;
}
.brief-quote::before {
  content: "“"; position: absolute; left: 20px; top: 6px;
  font-family: Georgia, serif; font-size: 46px; line-height: 1; color: rgba(232, 69, 47, .7);
}
.brief-grid { display: grid; gap: 14px; }
.brief-card {
  padding: 18px 20px;
  border-radius: 4px;
  background: rgba(255, 240, 210, .03);
  border: 1px solid var(--line);
}
.brief-card h3 {
  margin: 0 0 12px;
  display: flex; align-items: baseline; gap: 12px;
  font-family: var(--serif); font-size: 17px; font-weight: 900; letter-spacing: 1px;
  color: #fbf2df;
}
.brief-card h3 i { font-style: normal; font-size: 12px; letter-spacing: 2px; color: var(--gold); font-family: var(--sans); font-weight: 700; }
.brief-card ul { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 9px; }
.brief-card li {
  position: relative;
  padding-left: 18px;
  font-size: 14.5px; line-height: 1.75;
  color: #ddd3c0;
}
.brief-card li::before {
  content: ""; position: absolute; left: 2px; top: .72em;
  width: 6px; height: 6px; transform: rotate(45deg);
  background: var(--gold);
}
.brief-cta { display: flex; justify-content: center; margin-top: 24px; }

/* 题目进度条 */
.q-seg { display: flex; gap: 6px; margin-bottom: 18px; }
.q-seg span {
  flex: 1; height: 4px; border-radius: 4px;
  background: rgba(255, 240, 210, .08);
  transition: background .3s;
}
.q-seg span.cur { background: linear-gradient(90deg, var(--gold), var(--gold-hi)); }
.q-seg span.ok { background: var(--jade); }
.q-seg span.bad { background: var(--wrong); }
.q-seg-label { display: flex; justify-content: space-between; margin: -10px 0 16px; font-size: 12px; color: var(--muted); letter-spacing: 1px; }

/* 题卡 */
.q-card { animation: qIn .45s var(--ease-out); }
@keyframes qIn { from { opacity: 0; transform: translateX(16px); } to { opacity: 1; transform: none; } }
.q-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.q-type {
  padding: 3px 10px;
  border-radius: 2px;
  font-size: 12px; font-weight: 700; letter-spacing: 2px;
  color: var(--gold-hi);
  background: rgba(214, 163, 68, .12);
  border: 1px solid rgba(214, 163, 68, .35);
}
.q-type.t-ra { color: #ffd2a8; background: rgba(232, 69, 47, .14); border-color: rgba(232, 69, 47, .45); }
.q-type.t-sql { color: #bcd8ff; background: rgba(110, 160, 230, .12); border-color: rgba(110, 160, 230, .38); }
.q-keys { font-size: 11.5px; color: rgba(143, 134, 118, .85); letter-spacing: 1px; }
.q-keys kbd {
  display: inline-block; min-width: 18px; padding: 0 5px; margin: 0 1px;
  border-radius: 3px; border: 1px solid var(--line-2);
  font-family: var(--mono); font-size: 11px; color: var(--text-2); text-align: center;
}
.q-stem {
  margin-bottom: 20px;
  font-family: var(--serif);
  font-size: 18px; font-weight: 700; line-height: 1.75;
  color: #fbf2df;
}

.q-options { display: flex; flex-direction: column; gap: 10px; }
.q-opt {
  display: flex; align-items: center; gap: 14px;
  width: 100%;
  padding: 13px 16px;
  border-radius: 4px;
  border: 1px solid var(--line-2);
  background: rgba(255, 240, 210, .025);
  font-size: 15px; line-height: 1.6; text-align: left;
  color: var(--text);
  transition: border-color .18s, background .18s, transform .18s var(--ease-out);
}
.q-opt:hover:not(:disabled) { border-color: rgba(214, 163, 68, .55); background: rgba(214, 163, 68, .05); transform: translateX(3px); }
.opt-key {
  flex-shrink: 0;
  width: 30px; height: 30px; border-radius: 3px;
  display: grid; place-items: center;
  border: 1px solid var(--line-2);
  font-family: var(--serif); font-weight: 900; font-size: 15px;
  color: var(--gold-hi);
}
.q-opt.selected { border-color: var(--gold); background: rgba(214, 163, 68, .10); }
.q-opt.selected .opt-key { background: var(--gold); border-color: var(--gold); color: #24160a; }
.q-opt.is-right { border-color: var(--jade) !important; background: rgba(47, 158, 114, .14) !important; }
.q-opt.is-right .opt-key { background: var(--jade) !important; border-color: var(--jade) !important; color: #fff !important; }
.q-opt.is-wrong { border-color: var(--wrong) !important; background: rgba(224, 87, 74, .12) !important; animation: shake .4s; }
.q-opt.is-wrong .opt-key { background: var(--wrong) !important; border-color: var(--wrong) !important; color: #fff !important; }
.q-opt:disabled { cursor: default; }
@keyframes shake { 0%, 100% { transform: none; } 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }

.q-judge { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.judge-btn {
  height: 84px;
  display: flex; align-items: center; justify-content: center; gap: 14px;
  border-radius: 4px;
  border: 1px solid var(--line-2);
  background: rgba(255, 240, 210, .025);
  font-family: var(--serif); font-size: 22px; font-weight: 900; letter-spacing: 6px;
  color: var(--text);
  transition: all .18s;
}
.judge-btn svg { width: 28px; height: 28px; }
.judge-btn:hover:not(:disabled) { border-color: rgba(214, 163, 68, .55); }
.judge-btn.selected { border-color: var(--gold); background: rgba(214, 163, 68, .1); }
.judge-btn.is-right { border-color: var(--jade) !important; background: rgba(47, 158, 114, .16) !important; }
.judge-btn.is-wrong { border-color: var(--wrong) !important; background: rgba(224, 87, 74, .14) !important; animation: shake .4s; }

/* 关系代数 & SQL 槽位 */
.slot-hint { margin: 0 0 10px; font-size: 12.5px; color: var(--muted); letter-spacing: 1px; }
.ra-formula {
  display: flex; align-items: center; justify-content: center;
  min-height: 108px;
  padding: 22px 24px;
  margin-bottom: 16px;
  border-radius: 4px;
  background:
    linear-gradient(rgba(255, 240, 210, .025) 1px, transparent 1px) 0 0 / 100% 28px,
    #0c0b09;
  border: 1px solid rgba(214, 163, 68, .3);
  overflow-x: auto;
}
.ra-line {
  white-space: nowrap;
  font-family: var(--math);
  font-size: 26px;
  color: #f4ead6;
  letter-spacing: .5px;
}
.ra-line .ra-sub, .ra-line sub { font-family: var(--mono); font-size: 14px; color: #a9c9f2; vertical-align: -6px; margin-left: 2px; }
.sql-block {
  margin: 0 0 16px;
  padding: 18px 20px;
  border-radius: 4px;
  background: #0c0b09;
  border: 1px solid rgba(110, 160, 230, .28);
  font-family: var(--mono);
  font-size: 14.5px; line-height: 1.95;
  color: #e3dccd;
  overflow-x: auto;
  white-space: pre;
}
.code-line { display: block; padding: 0 6px; border-radius: 2px; }

.slot {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 52px; height: 44px;
  padding: 0 12px;
  margin: 0 4px;
  vertical-align: middle;
  border-radius: 4px;
  border: 1.5px dashed rgba(214, 163, 68, .55);
  background: rgba(214, 163, 68, .06);
  font-family: var(--math); font-size: 26px; font-weight: 700;
  color: var(--gold-hi);
  transition: all .18s;
}
.sql-block .slot { height: 30px; min-width: 110px; font-family: var(--mono); font-size: 14px; margin: 0 2px; vertical-align: baseline; }
.slot-idx { font-family: var(--sans); font-size: 13px; color: rgba(214, 163, 68, .7); font-weight: 600; }
.slot.active { border-style: solid; border-color: var(--red-hi); background: rgba(232, 69, 47, .12); box-shadow: 0 0 0 4px rgba(232, 69, 47, .14); }
.slot.filled { border-style: solid; border-color: var(--gold); background: rgba(214, 163, 68, .16); color: #fff6df; }
.slot.ok { border-color: var(--jade) !important; background: rgba(47, 158, 114, .2) !important; color: var(--jade-hi) !important; border-style: solid !important; }
.slot.bad { border-color: var(--wrong) !important; background: rgba(224, 87, 74, .18) !important; color: #ffb3aa !important; border-style: solid !important; }

.palette { display: grid; gap: 10px; }
.palette.sym { grid-template-columns: repeat(7, minmax(0, 1fr)); }
.palette.sql { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.pal-btn {
  position: relative;
  height: 58px;
  border-radius: 4px;
  border: 1px solid rgba(214, 163, 68, .4);
  background: linear-gradient(180deg, rgba(214, 163, 68, .10), rgba(214, 163, 68, .03));
  font-family: var(--math); font-size: 30px; font-weight: 700;
  color: var(--gold-hi);
  transition: transform .15s var(--ease-out), background .15s, border-color .15s;
}
.palette.sql .pal-btn { height: 44px; font-family: var(--mono); font-size: 14px; color: #cfe2ff; border-color: rgba(110, 160, 230, .4); background: rgba(110, 160, 230, .07); }
.pal-btn:hover:not(:disabled) { transform: translateY(-2px); border-color: var(--gold); background: rgba(214, 163, 68, .18); }
.palette.sql .pal-btn:hover:not(:disabled) { border-color: #8fb8ee; background: rgba(110, 160, 230, .16); }
.pal-btn sup { position: absolute; left: 6px; top: 4px; font-family: var(--mono); font-size: 10px; color: var(--muted); font-weight: 400; }
.pal-btn:disabled { opacity: .45; cursor: default; }

.q-actions { display: flex; align-items: center; justify-content: flex-end; margin-top: 22px; }
.btn-submit:disabled { opacity: .35; cursor: not-allowed; filter: grayscale(.4); transform: none; }

/* 即时解析 */
.q-feedback {
  margin-top: 20px;
  padding: 18px 20px;
  border-radius: 4px;
  border: 1px solid;
  animation: rise .45s var(--ease-out);
}
.q-feedback.fb-ok { background: rgba(47, 158, 114, .08); border-color: rgba(47, 158, 114, .45); }
.q-feedback.fb-bad { background: rgba(224, 87, 74, .07); border-color: rgba(224, 87, 74, .45); }
.fb-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.fb-ico { width: 24px; height: 24px; flex-shrink: 0; }
.fb-title { font-family: var(--serif); font-size: 17px; font-weight: 900; letter-spacing: 2px; }
.fb-ok .fb-title { color: var(--jade-hi); }
.fb-bad .fb-title { color: #ffa196; }
.fb-answer { margin-left: auto; font-size: 13.5px; color: var(--text-2); }
.fb-answer strong { color: var(--gold-hi); }
.fb-explain { font-size: 14.5px; line-height: 1.85; color: #e2d9c7; }
.fb-explain-label { display: inline-block; margin-right: 8px; padding: 0 6px; font-size: 12px; font-weight: 700; letter-spacing: 2px; color: var(--gold); border: 1px solid rgba(214, 163, 68, .4); border-radius: 2px; }
.fb-next { display: flex; justify-content: flex-end; margin-top: 16px; }

/* 行内富文本 */
.inline-sql {
  padding: 1px 6px;
  border-radius: 3px;
  background: rgba(110, 160, 230, .12);
  border: 1px solid rgba(110, 160, 230, .2);
  color: #bcd8ff;
  font-family: var(--mono);
  font-size: .88em;
  font-weight: 500;
}
mark.hl { background: none; color: var(--gold-hi); font-weight: 800; box-shadow: inset 0 -.38em 0 rgba(214, 163, 68, .18); }
.ra-expr { display: inline-flex; align-items: baseline; font-family: var(--math); }
.ra-sym { font-family: var(--math); font-size: 1.25em; font-weight: 700; color: var(--gold-hi); padding: 0 1px; }
.ra-sub { font-family: var(--mono); font-size: .72em; color: #a9c9f2; margin-left: 1px; }
.ra-op { font-family: var(--math); font-weight: 700; color: var(--gold-hi); padding: 0 2px; }

/* ================= 授章结算 ================= */
.award {
  position: relative;
  text-align: center;
  padding: 6px 20px 4px;
  overflow: hidden;
}
.award-stage { position: relative; width: 150px; height: 150px; margin: 0 auto 2px; }
.award-rays {
  position: absolute; inset: -60px;
  background: repeating-conic-gradient(from 0deg, rgba(242, 211, 139, .16) 0deg 6deg, transparent 6deg 18deg);
  -webkit-mask: radial-gradient(circle, #000 18%, transparent 62%);
  mask: radial-gradient(circle, #000 18%, transparent 62%);
  animation: spin 24s linear infinite;
  opacity: 0;
  animation-name: spin, fadeIn;
  animation-duration: 24s, 1.2s;
  animation-delay: 0s, .6s;
  animation-iteration-count: infinite, 1;
  animation-fill-mode: none, forwards;
}
.award.fail .award-rays { display: none; }
.award-medal {
  position: absolute; inset: 14px;
  width: 122px; height: 122px;
  filter: drop-shadow(0 18px 26px rgba(0, 0, 0, .6));
  animation: medalDrop 1.1s var(--ease-out) both;
}
.award-glint {
  position: absolute; inset: 14px; border-radius: 50%;
  background: linear-gradient(120deg, transparent 35%, rgba(255, 255, 255, .55) 50%, transparent 65%);
  background-size: 300% 100%;
  -webkit-mask: url("../assets/icons/medal-gold.svg") center / contain no-repeat;
  mask: url("../assets/icons/medal-gold.svg") center / contain no-repeat;
  animation: glint 2.4s 1.2s var(--ease-io) both;
  mix-blend-mode: screen;
}
.award.fail .award-glint { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fadeIn { to { opacity: 1; } }
@keyframes medalDrop {
  0% { opacity: 0; transform: translateY(-120px) scale(1.25) rotate(-12deg); }
  55% { opacity: 1; transform: translateY(6px) scale(.96) rotate(2deg); }
  75% { transform: translateY(-4px) scale(1.02) rotate(0); }
  100% { transform: none; }
}
@keyframes glint { from { background-position: 120% 0; } to { background-position: -40% 0; } }

.award-kicker { margin: 4px 0 0; font-size: 12.5px; letter-spacing: 8px; color: var(--red-hi); font-weight: 700; animation: rise .6s .8s var(--ease-out) both; }
.award.fail .award-kicker { color: var(--muted); }
.award-title {
  margin: 6px 0 10px;
  font-family: var(--serif);
  font-size: 32px; font-weight: 900; letter-spacing: .16em;
  color: #fbf2df;
  animation: rise .7s .95s var(--ease-out) both;
}
.award-score {
  display: inline-flex; align-items: baseline; gap: 18px;
  margin-bottom: 12px;
  font-size: 13px; letter-spacing: 1px; color: var(--muted);
  animation: rise .7s 1.1s var(--ease-out) both;
}
.award-score b { font-family: var(--serif); font-size: 34px; font-weight: 900; color: var(--gold-hi); margin-right: 3px; }
.award-score .sep { width: 1px; height: 26px; background: var(--line-2); align-self: center; }
.award-review { display: flex; justify-content: center; gap: 8px; margin-bottom: 14px; animation: rise .7s 1.2s var(--ease-out) both; }
.award-review span {
  width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 12px; font-weight: 800;
  border: 1.5px solid;
}
.award-review .ok { border-color: var(--jade); color: var(--jade-hi); background: rgba(47, 158, 114, .12); }
.award-review .bad { border-color: var(--wrong); color: #ffaea4; background: rgba(224, 87, 74, .12); }
.award-msg {
  max-width: 620px; margin: 0 auto 16px;
  font-family: var(--serif);
  font-size: 15px; line-height: 1.9;
  color: var(--text-2);
  animation: rise .7s 1.3s var(--ease-out) both;
}
.award-poem {
  display: inline-flex; align-items: center; gap: 14px;
  margin: 0 auto 16px;
  padding: 8px 14px 8px 10px;
  border-radius: 4px;
  border: 1px solid rgba(214, 163, 68, .45);
  background: rgba(214, 163, 68, .07);
  text-align: left;
  animation: rise .7s 1.45s var(--ease-out) both;
  cursor: pointer;
}
.award-poem .ico-wrap { width: 40px; height: 40px; }
.award-poem small { display: block; font-size: 11.5px; letter-spacing: 2px; color: var(--gold); }
.award-poem b { font-family: var(--kai); font-size: 18px; color: #ffe6ad; letter-spacing: 2px; }
.award-actions {
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  animation: rise .7s 1.6s var(--ease-out) both;
}
.award-actions .row { display: flex; gap: 6px; }
.award-actions .btn-primary { min-width: 360px; height: 52px; font-size: 16px; }

/* ================= 错题本 ================= */
.wb-summary { display: flex; gap: 22px; margin-bottom: 18px; font-size: 13px; color: var(--muted); }
.wb-summary b { font-family: var(--serif); font-size: 22px; color: #fbf2df; margin-right: 4px; }
.wb-list { display: flex; flex-direction: column; gap: 12px; }
.wb-item {
  position: relative;
  padding: 16px 20px 16px 22px;
  border-radius: 4px;
  background: rgba(255, 240, 210, .025);
  border: 1px solid var(--line);
}
.wb-item::before { content: ""; position: absolute; left: 0; top: 14px; bottom: 14px; width: 3px; background: var(--wrong); }
.wb-item.resolved::before { background: var(--jade); }
.wb-item.resolved { opacity: .72; }
.wb-top { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 8px; font-size: 12px; letter-spacing: 1px; }
.wb-status { font-weight: 700; color: #ffa196; }
.wb-item.resolved .wb-status { color: var(--jade-hi); }
.wb-source { color: var(--gold); }
.wb-stem { font-family: var(--serif); font-size: 15.5px; font-weight: 700; line-height: 1.7; margin-bottom: 8px; color: #fbf2df; }
.wb-explain { font-size: 13.5px; line-height: 1.75; color: var(--text-2); margin-bottom: 12px; }
.wb-foot { display: flex; align-items: center; justify-content: space-between; font-size: 12.5px; color: var(--muted); }
.wb-foot code { font-family: var(--mono); color: #ffb3aa; }
.wb-redo-head { display: flex; align-items: center; gap: 16px; margin-bottom: 18px; font-size: 13px; color: var(--muted); }
.wb-redo-head strong { color: var(--gold-hi); }
.empty-state { text-align: center; padding: 60px 20px; color: var(--muted); }
.empty-state .ico-wrap { width: 72px; height: 72px; margin: 0 auto 16px; opacity: .85; }
.empty-state h3 { margin: 0 0 8px; font-family: var(--serif); font-size: 20px; letter-spacing: 3px; color: #fbf2df; }
.empty-state p { margin: 0; font-size: 13.5px; line-height: 1.7; }

/* ================= 诗词星火集 ================= */
.poem-intro { margin: 0 0 20px; font-size: 13.5px; line-height: 1.7; color: var(--muted); }
.poem-intro b { color: var(--gold-hi); }
.poem-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.poem-card {
  position: relative;
  min-height: 210px;
  padding: 20px 18px;
  border-radius: 3px;
  border: 1px solid var(--line);
  background: rgba(255, 240, 210, .02);
  text-align: left;
  display: flex; flex-direction: column;
  transition: transform .25s var(--ease-out), border-color .25s;
}
.poem-card.lit {
  color: var(--paper-ink);
  border-color: transparent;
  background: var(--noise-paper), radial-gradient(120% 100% at 30% 0%, #f8f1df, var(--paper) 55%, var(--paper-2));
  box-shadow: 0 14px 30px rgba(0, 0, 0, .35);
}
.poem-card.lit:hover { transform: translateY(-4px); }
.poem-card .pc-icon { width: 34px; height: 34px; margin-bottom: 14px; }
.poem-card h3 { margin: 0 0 6px; font-family: var(--kai); font-size: 20px; font-weight: 700; letter-spacing: 1px; color: #f1e7d3; }
.poem-card.lit h3 { color: var(--paper-ink); }
.poem-card .pc-loc { font-size: 12px; letter-spacing: 1px; color: var(--muted); }
.poem-card.lit .pc-loc { color: #7b6347; }
.poem-card .pc-line { margin-top: auto; padding-top: 16px; font-family: var(--kai); font-size: 15.5px; letter-spacing: 2px; color: #5a4430; }
.poem-card .pc-lock { margin-top: auto; padding-top: 16px; font-size: 12.5px; line-height: 1.6; color: var(--muted); }
.poem-card .pc-go { margin-top: 10px; align-self: flex-start; }
.poem-card .pc-seal {
  position: absolute; right: 16px; top: 18px;
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border: 2px solid var(--paper-red); border-radius: 3px;
  color: var(--paper-red);
  font-family: var(--serif); font-size: 11px; font-weight: 900; line-height: 1.1; text-align: center;
  transform: rotate(-6deg); opacity: .78;
}

/* 卷轴详情 */
.scroll-view { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 26px; align-items: stretch; }
.scroll-paper {
  position: relative;
  min-height: 460px;
  padding: 40px 34px;
  border-radius: 2px;
  color: var(--paper-ink);
  background: var(--noise-paper), radial-gradient(130% 100% at 70% 0%, #f8f1df, var(--paper) 50%, #dfcfa8);
  box-shadow: 0 24px 50px rgba(0, 0, 0, .5), inset 0 0 60px rgba(120, 80, 30, .2);
  display: flex; justify-content: center;
  overflow-x: auto;
}
.scroll-paper::before, .scroll-paper::after {
  content: ""; position: absolute; top: -6px; bottom: -6px; width: 14px;
  background: linear-gradient(90deg, #3e2a17, #7a5532, #3e2a17);
  border-radius: 6px;
}
.scroll-paper::before { left: -7px; }
.scroll-paper::after { right: -7px; }
.scroll-text {
  writing-mode: vertical-rl;
  font-family: var(--kai);
  height: 430px;
  display: flex; flex-direction: column; flex-wrap: nowrap;
}
.scroll-text h3 { margin: 0 0 0 28px; font-size: 32px; font-weight: 700; letter-spacing: 8px; }
.scroll-text .st-author { margin: 0 0 0 26px; font-size: 13px; letter-spacing: 3px; color: #7b6347; padding-top: 160px; }
.scroll-text p.st-line { margin: 0 0 0 12px; font-size: 22px; letter-spacing: 6px; line-height: 1.5; opacity: 0; animation: inkV 1.1s var(--ease-out) forwards; }
@keyframes inkV { from { opacity: 0; filter: blur(4px); transform: translateY(-10px); } to { opacity: 1; filter: none; transform: none; } }
.scroll-seal {
  position: absolute; left: 30px; bottom: 34px;
  width: 54px; height: 54px;
  display: grid; place-items: center;
  background: var(--paper-red);
  color: #f6e3c8;
  font-family: var(--serif); font-weight: 900; font-size: 15px; line-height: 1.1; text-align: center; letter-spacing: 2px;
  border-radius: 3px;
  transform: rotate(-5deg);
  box-shadow: inset 0 0 0 2px rgba(246, 227, 200, .35);
  opacity: .9;
}
.scroll-side { display: flex; flex-direction: column; gap: 16px; }
.scroll-meta small { font-size: 12px; letter-spacing: 3px; color: var(--gold); }
.scroll-meta h3 { margin: 6px 0 4px; font-family: var(--kai); font-size: 28px; letter-spacing: 2px; color: #fbf2df; }
.scroll-meta p { margin: 0; font-size: 13px; color: var(--muted); }
.scroll-reflect {
  padding: 18px 20px;
  border-radius: 4px;
  border-left: 3px solid var(--red-hi);
  background: rgba(198, 42, 31, .08);
  font-family: var(--serif); font-size: 14.5px; line-height: 1.95;
  color: #e9dfcb;
}

/* ================= 支线任务 ================= */
.sides-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.side-card {
  position: relative;
  display: flex; gap: 16px;
  padding: 18px 20px;
  border-radius: 4px;
  border: 1px solid var(--line);
  background: rgba(255, 240, 210, .025);
  transition: border-color .2s, transform .2s var(--ease-out);
}
.side-card:hover { border-color: rgba(214, 163, 68, .5); transform: translateY(-2px); }
.side-card .sc-icon { width: 54px; height: 54px; flex-shrink: 0; }
.side-card:not(.passed) .sc-icon img { filter: saturate(.5) brightness(.85); }
.side-card small.sc-kicker { font-size: 11.5px; letter-spacing: 2px; color: var(--gold); }
.side-card h3 { margin: 4px 0 6px; font-family: var(--serif); font-size: 17px; font-weight: 900; letter-spacing: 1px; color: #fbf2df; }
.side-card p { margin: 0 0 12px; font-size: 13px; line-height: 1.7; color: var(--text-2); }
.side-card .sc-foot { display: flex; align-items: center; justify-content: space-between; font-size: 12px; color: var(--muted); }
.side-card.passed { border-color: rgba(214, 163, 68, .5); background: rgba(214, 163, 68, .05); }
.side-card .sc-badge { color: var(--gold-hi); font-weight: 700; }

/* ================= 会师证书 ================= */
.reunion-dlg { width: min(860px, 94vw); max-height: 94vh; overflow-y: auto; }
.cert { position: relative; padding: 46px 56px 40px; text-align: center; }
.cert::before {
  content: ""; position: absolute; inset: 16px;
  border: 2px solid rgba(168, 35, 26, .7);
  outline: 1px solid rgba(168, 35, 26, .4);
  outline-offset: 6px;
  pointer-events: none;
}
.cert::after {
  content: ""; position: absolute; inset: 30px;
  border: 1px solid rgba(168, 120, 40, .45);
  pointer-events: none;
}
.cert-star { width: 74px; height: 74px; margin: 0 auto 10px; }
.cert-sup { margin: 0; font-size: 13px; letter-spacing: 6px; color: var(--paper-red); font-weight: 700; }
.cert-title { margin: 10px 0 18px; font-family: var(--serif); font-size: 46px; font-weight: 900; letter-spacing: .4em; margin-right: -.4em; color: var(--paper-red); }
.cert-to { margin: 0 0 22px; font-family: var(--serif); font-size: 17px; line-height: 2; color: var(--paper-ink); }
.cert-to b { font-size: 24px; letter-spacing: 4px; border-bottom: 1.5px solid var(--paper-ink); padding: 0 10px; }
.cert-stats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 0; margin: 0 auto 24px; max-width: 680px; border-top: 1px solid rgba(60, 40, 22, .25); border-bottom: 1px solid rgba(60, 40, 22, .25); }
.cert-stats div { padding: 14px 6px; border-left: 1px solid rgba(60, 40, 22, .15); }
.cert-stats div:first-child { border-left: none; }
.cert-stats span { display: block; font-size: 11.5px; letter-spacing: 2px; color: #7b6347; }
.cert-stats b { display: block; margin-top: 4px; font-family: var(--serif); font-size: 21px; font-weight: 900; color: var(--paper-ink); }
.cert-quote { max-width: 640px; margin: 0 auto 26px; font-family: var(--kai); font-size: 16.5px; line-height: 2; color: #3e2c1e; text-align: left; text-indent: 2em; }
.cert-foot { display: flex; align-items: flex-end; justify-content: space-between; max-width: 680px; margin: 0 auto; }
.cert-date { text-align: left; font-family: var(--serif); font-size: 13px; line-height: 1.9; color: #5b4632; }
.cert-seal {
  width: 96px; height: 96px; border-radius: 50%;
  display: grid; place-items: center;
  border: 3px solid var(--paper-red);
  color: var(--paper-red);
  font-family: var(--serif); font-weight: 900; font-size: 15px; line-height: 1.25; letter-spacing: 2px;
  transform: rotate(-12deg);
  opacity: .85;
  position: relative;
}
.cert-seal::before { content: "★"; position: absolute; top: 8px; font-size: 14px; }
.cert-actions { margin-top: 28px; display: flex; justify-content: center; gap: 12px; }
.cert-actions .btn-ghost { color: #5b4632; border-color: rgba(60, 40, 22, .35); background: transparent; }

@media (max-width: 1100px) {
  .tally-item small, .hud-btn span.lbl { display: none; }
  .poem-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .brand p { display: none; }
  .trail-name { display: none; }
  .trail-node.frontier .trail-name { display: block; }
  .sheet-side { display: none; }
  .sides-grid, .scroll-view { grid-template-columns: 1fr; }
  .palette.sym { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .cert-stats { grid-template-columns: repeat(2, 1fr); }
  .li-meter { min-width: 0; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0ms !important; transition-duration: .01ms !important; }
}

/* ================= 补充 ================= */
.ico-wrap { display: inline-block; flex-shrink: 0; line-height: 0; }

.finale-video {
  position: absolute; inset: 0; z-index: 45;
  background: #000;
  display: grid; place-items: center;
}
.finale-video video { width: 100%; height: 100%; object-fit: cover; }
.finale-skip {
  position: absolute; right: 28px; bottom: 24px;
  padding: 8px 16px !important;
  border: 1px solid rgba(255, 255, 255, .25) !important;
  border-radius: 999px;
  color: rgba(255, 255, 255, .7) !important;
  letter-spacing: 3px;
}

@media print {
  body * { visibility: hidden !important; }
  #dlg-reunion, #dlg-reunion * { visibility: visible !important; }
  #dlg-reunion { position: fixed; inset: 0; margin: 0; width: 100%; max-height: none; box-shadow: none; }
  .cert-actions { display: none !important; }
}
