/* ============================================================
   全国高中数学联赛 · 数学竞赛交互设计系统
   参考规范：https://navier-stokes.wangda.today/
   ============================================================ */

:root {
  /* 经典暗色数学画布 */
  --bg: #17171d;
  --bg2: #101015;
  --panel: rgba(24, 24, 32, 0.78);
  --panel-solid: #1b1b24;
  --line: rgba(140, 140, 160, 0.18);
  --line-strong: rgba(140, 140, 160, 0.35);

  /* 文字排印 */
  --ink: #ece6e2;
  --soft: #c9c4bd;
  --dim: #8f8a84;

  /* 经典光谱高亮 */
  --blue: #58C4DD;
  --blue-d: #29ABCA;
  --yellow: #FFFF00;
  --gold: #F4D34C;
  --soft-yellow: #FFE74C;
  --green: #83C167;
  --red: #FC6255;
  --orange: #FF862F;
  --teal: #5CD0B6;
  --purple: #B189C6;

  /* 板块主题色 */
  --c-geo: #58C4DD;     /* 几何：亮青 */
  --c-alg: #FFE74C;     /* 代数：明黄 */
  --c-nt: #5CD0B6;      /* 数论：薄荷青 */
  --c-comb: #FC6255;    /* 组合：珊瑚红 */
  --c-exam: #FF862F;    /* 真题：橙金 */

  /* 字体系统 */
  --serif: "Noto Serif SC", "STIX Two Text", "Songti SC", serif;
  --sans: "Noto Sans SC", -apple-system, BlinkMacSystemFont, "PingFang SC", "Segoe UI", Roboto, sans-serif;
  --math: "STIX Two Text", "Times New Roman", "KaTeX_Main", serif;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15.5px;
  line-height: 1.85;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* 深色背景微光晕 */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  background:
    radial-gradient(65% 55% at 50% 0%, rgba(88, 196, 221, 0.06), transparent 70%),
    radial-gradient(55% 45% at 85% 100%, rgba(177, 137, 198, 0.05), transparent 70%),
    radial-gradient(40% 40% at 10% 40%, rgba(244, 211, 76, 0.03), transparent 60%);
}

::selection {
  background: rgba(88, 196, 221, 0.35);
  color: #ffffff;
}

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: #2c2c38; border-radius: 6px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: #3d3d4e; }
::-webkit-scrollbar-track { background: var(--bg2); }

a { color: var(--blue); text-decoration: none; transition: color 0.2s, opacity 0.2s; }
a:hover { color: var(--soft-yellow); }

:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; border-radius: 4px; }

.katex { font-size: 1.08em; }
.kx { display: inline-block; max-width: 100%; overflow-x: auto; overflow-y: hidden; vertical-align: middle; }

.wrap {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 clamp(16px, 4vw, 36px);
}

/* ============================================================
   数学推演与公式动画系统
   ============================================================ */
/* 笔画书写动画 (Manim Write-on) */
@keyframes writeon {
  from { clip-path: inset(-15% 105% -15% -5%); }
  to { clip-path: inset(-15% -5% -15% -5%); }
}

/* 项框选高亮动画 (SurroundingRectangle) */
@keyframes surround {
  from { transform: scale(1.05); box-shadow: 0 0 0 2px rgba(255, 255, 0, 0); }
  to { transform: scale(1); box-shadow: 0 0 0 2px var(--yellow); }
}

/* 脉冲呼吸灯 */
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.35; transform: scale(0.92); }
}

/* 提示悬浮浮动 */
@keyframes hintFloat {
  0%, 100% { transform: translate(-50%, 0); }
  50% { transform: translate(-50%, -6px); }
}

/* 下拉光带指示器 */
@keyframes cue {
  0% { transform: scaleY(0.2); transform-origin: top; }
  55% { transform: scaleY(1); }
  100% { transform: scaleY(0.2); transform-origin: bottom; }
}

/* Manim 渐显 (FadeIn with blur) */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  filter: blur(4px);
  transition: opacity 0.75s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.75s cubic-bezier(0.16, 1, 0.3, 1),
              filter 0.75s cubic-bezier(0.16, 1, 0.3, 1);
  transition-delay: var(--d, 0s);
}
.reveal.in {
  opacity: 1;
  transform: none;
  filter: none;
}

@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; filter: none; transition: none; }
  * { animation: none !important; }
}

/* ============================================================
   顶部滚动指示器 & 毛玻璃导航栏 (#topnav)
   ============================================================ */
#pbar {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--blue), var(--yellow), var(--purple));
  width: 0%;
  z-index: 999;
  transition: width 0.1s ease-out;
}

#topnav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 13px clamp(16px, 4vw, 36px);
  transition: background 0.35s, border-color 0.35s, box-shadow 0.35s;
  border-bottom: 1px solid transparent;
}

#topnav.scrolled {
  background: rgba(16, 16, 21, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-color: var(--line);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

.brand {
  font-family: var(--math);
  font-weight: 600;
  letter-spacing: 0.12em;
  font-size: 14px;
  color: var(--ink);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
}

.brand-icon {
  width: 28px;
  height: 28px;
  background: rgba(88, 196, 221, 0.12);
  border: 1px solid rgba(88, 196, 221, 0.4);
  border-radius: 7px;
  display: grid;
  place-items: center;
  color: var(--blue);
  font-family: var(--serif);
  font-weight: 900;
  font-size: 16px;
  box-shadow: 0 0 12px rgba(88, 196, 221, 0.2);
}

.brand b {
  font-family: var(--serif);
  font-weight: 900;
  font-size: 16px;
  color: var(--ink);
  letter-spacing: 0.04em;
}

#topnav nav {
  display: flex;
  gap: 4px;
  margin-left: auto;
  flex-wrap: wrap;
}

#topnav nav a {
  font-size: 13px;
  letter-spacing: 0.05em;
  color: var(--soft);
  text-decoration: none;
  padding: 6px 12px;
  border-radius: 6px;
  transition: color 0.2s, background 0.2s;
  font-weight: 500;
}

#topnav nav a:hover {
  color: var(--blue);
  background: rgba(88, 196, 221, 0.09);
}

#topnav nav a.active {
  color: var(--yellow);
  background: rgba(255, 255, 0, 0.08);
}

.nav-cta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: 12px;
}

.menu-btn {
  display: none;
  margin-left: auto;
  width: 42px;
  height: 42px;
  background: rgba(28, 28, 38, 0.6);
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
}

.menu-btn span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--blue);
  transition: 0.3s;
}
.menu-btn.x span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.menu-btn.x span:nth-child(2) { opacity: 0; }
.menu-btn.x span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.mmenu {
  position: fixed;
  inset: 0;
  background: rgba(13, 13, 17, 0.98);
  backdrop-filter: blur(14px);
  z-index: 95;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}
.mmenu.open { opacity: 1; pointer-events: auto; }
.mmenu a {
  font-family: var(--serif);
  font-weight: 900;
  font-size: 20px;
  color: var(--ink);
  text-decoration: none;
  padding: 8px 24px;
  text-align: center;
}
.mmenu a:hover { color: var(--blue); }
.mmenu a small {
  display: block;
  font-family: var(--math);
  font-style: italic;
  font-weight: 400;
  font-size: 11px;
  letter-spacing: 0.18em;
  color: var(--dim);
}

@media (max-width: 960px) {
  #topnav nav { display: none; }
  .menu-btn { display: flex; }
}

/* ============================================================
   首屏交互引力场 (Hero Section)
   ============================================================ */
.hero {
  position: relative;
  height: 100vh;
  height: 100svh;
  min-height: 640px;
  overflow: hidden;
  display: flex;
  align-items: center;
}

#mathHeroCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  cursor: crosshair;
  touch-action: none;
}

.hero-grid {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  background-image:
    linear-gradient(rgba(88, 196, 221, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(88, 196, 221, 0.05) 1px, transparent 1px);
  background-size: 60px 60px;
  -webkit-mask-image: radial-gradient(110% 90% at 50% 40%, #000 40%, transparent 100%);
  mask-image: radial-gradient(110% 90% at 50% 40%, #000 40%, transparent 100%);
}

.hero-scrim {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
  background:
    linear-gradient(105deg, rgba(16, 16, 21, 0.88) 0%, rgba(16, 16, 21, 0.55) 42%, transparent 72%),
    linear-gradient(0deg, rgba(16, 16, 21, 0.85), transparent 32%);
}

.hero-copy {
  position: relative;
  max-width: 820px;
  pointer-events: none;
  z-index: 3;
  margin-top: -20px;
}

.kicker {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--math);
  font-style: italic;
  font-size: 13px;
  letter-spacing: 0.28em;
  color: var(--blue);
  margin-bottom: 14px;
}
.kicker::before {
  content: "";
  width: 44px;
  height: 1px;
  background: var(--blue);
}

.hero h1 {
  font-family: var(--serif);
  font-weight: 900;
  font-size: clamp(38px, 6.5vw, 84px);
  line-height: 1.1;
  color: var(--ink);
  text-shadow: 0 4px 40px rgba(0, 0, 0, 0.7);
  animation: writeon 1.3s ease 0.15s both;
}

.hero h1 span.accent {
  color: var(--blue);
  text-shadow: 0 0 35px rgba(88, 196, 221, 0.4);
}

.hero .latin {
  font-family: var(--math);
  font-style: italic;
  font-weight: 400;
  font-size: clamp(15px, 2vw, 21px);
  color: var(--soft);
  margin-top: 8px;
  letter-spacing: 0.04em;
}

.hero .sub {
  margin-top: 14px;
  color: var(--soft);
  font-size: clamp(14px, 1.5vw, 16.5px);
  max-width: 620px;
  line-height: 1.8;
}

.eq-hero {
  margin-top: 24px;
  display: inline-block;
  background: rgba(16, 16, 21, 0.86);
  border: 1px solid rgba(88, 196, 221, 0.35);
  border-radius: 12px;
  padding: 16px 24px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6), inset 0 0 20px rgba(88, 196, 221, 0.05);
  max-width: 100%;
  overflow-x: auto;
  pointer-events: auto;
}
.eq-hero > .kx {
  animation: writeon 1.8s ease 0.5s both;
}
.eq-hero .katex {
  font-size: clamp(1rem, 2.3vw, 1.45rem);
}
.eq-hero .cap {
  display: block;
  margin-top: 8px;
  font-size: 12px;
  color: var(--dim);
  letter-spacing: 0.08em;
}

.hero-chip {
  position: absolute;
  top: 76px;
  right: clamp(16px, 4vw, 36px);
  z-index: 3;
  font-family: var(--math);
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--dim);
  background: rgba(16, 16, 21, 0.75);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 14px;
  pointer-events: none;
}
.hero-chip b { color: var(--blue); font-weight: 600; }

.hero-hint {
  position: absolute;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%);
  z-index: 3;
  font-size: 12.5px;
  letter-spacing: 0.12em;
  color: var(--soft);
  background: rgba(16, 16, 21, 0.75);
  border: 1px solid var(--line);
  padding: 8px 20px;
  border-radius: 30px;
  pointer-events: none;
  animation: hintFloat 3s ease-in-out infinite;
  white-space: nowrap;
}

.scroll-cue {
  position: absolute;
  left: clamp(16px, 4vw, 36px);
  bottom: 24px;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--dim);
  font-size: 11.5px;
  letter-spacing: 0.26em;
  pointer-events: none;
  font-family: var(--math);
  font-style: italic;
}
.scroll-cue i {
  width: 1px;
  height: 38px;
  background: linear-gradient(var(--blue), transparent);
  display: block;
  animation: cue 1.8s ease-in-out infinite;
}

/* ============================================================
   浮动控制台 (Floating Simulation Dock)
   ============================================================ */
.dock {
  position: absolute;
  right: clamp(16px, 4vw, 36px);
  bottom: 24px;
  z-index: 10;
  width: min(340px, calc(100vw - 32px));
  background: rgba(16, 16, 21, 0.94);
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
  overflow: hidden;
  transition: transform 0.3s;
}

.dock-head {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  background: none;
  border: 0;
  color: var(--soft);
  font-family: var(--math);
  font-style: italic;
  font-size: 13px;
  letter-spacing: 0.1em;
  padding: 12px 14px;
  cursor: pointer;
  min-height: 44px;
}
.dock-head .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 8px var(--green);
  animation: pulse 2s infinite;
  flex: none;
}
.dock-head .arr {
  margin-left: auto;
  transition: transform 0.3s;
  color: var(--dim);
}
.dock.closed .arr { transform: rotate(180deg); }

.dock-body {
  padding: 4px 14px 14px;
  border-top: 1px solid var(--line);
}
.dock.closed .dock-body { display: none; }

.modes {
  display: flex;
  gap: 6px;
  margin: 10px 0 8px;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 13px;
  border: 1px solid #3a3a46;
  background: rgba(28, 28, 38, 0.75);
  color: #e6e0da;
  border-radius: 7px;
  font-family: var(--sans);
  font-size: 12px;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: all 0.2s;
  user-select: none;
}
.btn:hover {
  border-color: var(--blue);
  box-shadow: 0 0 0 1px rgba(88, 196, 221, 0.3), 0 4px 14px rgba(88, 196, 221, 0.15);
  transform: translateY(-1px);
}
.btn.on {
  background: var(--blue);
  color: #101015;
  border-color: var(--blue);
  font-weight: 700;
}
.btn.warm:hover {
  border-color: var(--gold);
  box-shadow: 0 0 0 1px rgba(244, 211, 76, 0.3);
}
.btn.mini {
  padding: 5px 11px;
  font-size: 11.5px;
  margin-top: 10px;
}

.ctl {
  display: block;
  margin: 9px 0;
}
.ctl span {
  display: flex;
  justify-content: space-between;
  font-size: 11.5px;
  color: var(--dim);
  letter-spacing: 0.05em;
  margin-bottom: 3px;
}
.ctl output {
  color: var(--blue);
  font-family: var(--math);
}

input[type=range] {
  width: 100%;
  height: 22px;
  appearance: none;
  background: transparent;
  cursor: pointer;
}
input[type=range]::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 2px;
  background: rgba(140, 140, 160, 0.25);
}
input[type=range]::-webkit-slider-thumb {
  appearance: none;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--blue);
  border: 2px solid #101015;
  margin-top: -5.5px;
  box-shadow: 0 0 8px rgba(88, 196, 221, 0.6);
  transition: transform 0.15s;
}
input[type=range]::-webkit-slider-thumb:hover { transform: scale(1.25); }

.dock-actions {
  display: flex;
  gap: 6px;
  margin-top: 12px;
  flex-wrap: wrap;
}
.dock-actions .btn { flex: 1; }

@media (max-width: 640px) {
  .dock {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: 12px;
    width: auto;
  }
  .dock.closed { transform: translateY(calc(100% - 46px)); }
  .dock.closed .dock-body { display: block; }
  .dock-body { max-height: 50vh; overflow-y: auto; }
}

/* ============================================================
   章节骨架与序号排印 (.section)
   ============================================================ */
.section {
  max-width: 1200px;
  margin: 0 auto;
  padding: clamp(60px, 8vw, 100px) clamp(16px, 4vw, 36px);
  scroll-margin-top: 70px;
}

.sec-head {
  display: flex;
  align-items: flex-end;
  gap: 20px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.sec-num {
  font-family: var(--math);
  font-weight: 600;
  font-size: clamp(44px, 6vw, 64px);
  line-height: 0.9;
  color: transparent;
  -webkit-text-stroke: 1px rgba(88, 196, 221, 0.6);
  letter-spacing: -0.02em;
}

.sec-head h2 {
  font-family: var(--serif);
  font-weight: 900;
  font-size: clamp(24px, 3.8vw, 38px);
  line-height: 1.25;
  color: var(--ink);
}

.sec-tag {
  font-family: var(--math);
  font-style: italic;
  color: var(--dim);
  font-size: clamp(13px, 1.6vw, 16px);
  padding-bottom: 4px;
  white-space: nowrap;
}

.sec-rule {
  flex: 1 1 60px;
  height: 1px;
  background: linear-gradient(90deg, rgba(88, 196, 221, 0.5), transparent);
  margin-bottom: 12px;
}

.sec-kick {
  font-family: var(--math);
  font-style: italic;
  font-size: 13px;
  letter-spacing: 0.2em;
  color: var(--blue);
  margin-bottom: 12px;
}

.prose p {
  color: var(--soft);
  margin: 14px 0;
  max-width: 76ch;
}
.prose p b, .prose li b { color: var(--ink); }
em.hl { font-style: normal; color: var(--soft-yellow); }

.split {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 40px;
  align-items: start;
}
@media (max-width: 900px) { .split { grid-template-columns: 1fr; } }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 24px;
  backdrop-filter: blur(8px);
}
.panel h4 {
  font-family: var(--serif);
  font-weight: 900;
  font-size: 18px;
  margin-bottom: 12px;
  color: var(--blue);
}

/* ============================================================
   01: 逐项拆解 (Equation Dissection Stage)
   ============================================================ */
.eq-stage {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px 6px;
  padding: 28px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: radial-gradient(120% 160% at 50% 0%, rgba(28, 28, 40, 0.85), rgba(16, 16, 21, 0.95));
  margin: 18px 0;
}
.eq-stage .katex {
  font-size: clamp(1.05rem, 2.5vw, 1.6rem);
}

.term {
  position: relative;
  padding: 12px 10px 10px;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.3s;
  text-align: center;
}
.term:hover {
  background: rgba(88, 196, 221, 0.08);
}
.eq-stage.has-active .term:not(.active) {
  opacity: 0.28;
  filter: saturate(0.4);
}
.term.active {
  background: rgba(255, 255, 0, 0.06);
  box-shadow: 0 0 0 2px var(--yellow);
  animation: surround 0.35s ease;
}
.term .tlab {
  display: block;
  margin-top: 8px;
  font-size: 11px;
  letter-spacing: 0.2em;
  color: var(--c);
}
.term .tlab::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--c);
  margin-right: 6px;
  vertical-align: 1px;
}
.op {
  padding: 0 4px;
  color: var(--dim);
}

.term-detail {
  margin-top: 22px;
  border-left: 3px solid var(--c, #58C4DD);
  background: var(--panel);
  border-radius: 0 12px 12px 0;
  padding: 24px 28px;
  transition: border-color 0.3s;
}
.term-detail h3 {
  font-family: var(--serif);
  font-weight: 900;
  font-size: 22px;
  color: var(--ink);
}
.term-detail .one {
  color: var(--c, #58C4DD);
  font-size: 14px;
  margin: 4px 0 12px;
  letter-spacing: 0.05em;
}

.tcards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
  margin-top: 24px;
}
.tcard {
  --c: #58C4DD;
  text-align: left;
  border: 1px solid var(--line);
  border-left: 3px solid var(--c);
  background: rgba(24, 24, 32, 0.6);
  border-radius: 0 10px 10px 0;
  padding: 14px 16px;
  cursor: pointer;
  font-family: var(--sans);
  color: var(--soft);
  transition: all 0.25s;
}
.tcard:hover {
  transform: translateX(6px);
  background: rgba(32, 32, 44, 0.85);
}
.tcard.active {
  background: rgba(36, 36, 50, 0.95);
  box-shadow: 0 0 0 1.5px var(--yellow);
}
.tcard b { display: block; color: var(--c); font-size: 14.5px; }
.tcard span { font-family: var(--math); font-size: 12.5px; color: var(--dim); }
.tcard i { display: block; font-style: normal; font-size: 12px; margin-top: 5px; color: var(--dim); }

/* ============================================================
   02: 模块导航与 Bento 风格专题大厅
   ============================================================ */
.search-box {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #15151c;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  padding: 10px 18px;
  margin: 24px 0 16px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  transition: border-color 0.2s;
}
.search-box:focus-within {
  border-color: var(--blue);
  box-shadow: 0 0 0 1px var(--blue), 0 10px 30px rgba(88, 196, 221, 0.15);
}
.search-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--blue);
  flex: none;
}
.search-input {
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
}
.search-input::placeholder { color: var(--dim); }

.tabs-bar {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 6px;
  scrollbar-width: none;
  margin-bottom: 24px;
}
.tabs-bar::-webkit-scrollbar { display: none; }

.tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 18px;
  border: 1px solid var(--line);
  background: rgba(24, 24, 32, 0.6);
  color: var(--soft);
  border-radius: 30px;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
}
.tab-btn:hover {
  border-color: var(--blue);
  color: var(--ink);
}
.tab-btn.active {
  background: var(--blue);
  color: #101015;
  border-color: var(--blue);
  font-weight: 700;
  box-shadow: 0 4px 16px rgba(88, 196, 221, 0.3);
}

.bento {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}
@media (max-width: 960px) { .bento { grid-template-columns: 1fr 1fr; } }
@media (max-width: 640px) { .bento { grid-template-columns: 1fr; } }

.mod-card {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  padding: 24px;
  transition: all 0.3s;
  display: flex;
  flex-direction: column;
}
.mod-card:hover {
  transform: translateY(-4px);
  border-color: var(--blue);
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.5);
}

.mod-head {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 16px;
}
.mod-num {
  font-family: var(--math);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--blue);
  background: rgba(88, 196, 221, 0.1);
  border: 1px solid rgba(88, 196, 221, 0.28);
  border-radius: 6px;
  padding: 4px 8px;
  flex: none;
  line-height: 1.3;
}
.mod-head h3 {
  font-family: var(--serif);
  font-weight: 900;
  font-size: 17px;
  color: var(--ink);
  line-height: 1.3;
}
.mod-head .des {
  font-size: 12.5px;
  color: var(--dim);
  margin-top: 4px;
  line-height: 1.6;
}
.mod-head .cnt {
  font-family: var(--math);
  font-size: 11.5px;
  letter-spacing: 0.1em;
  color: var(--blue);
  white-space: nowrap;
  margin-left: auto;
  background: rgba(88, 196, 221, 0.1);
  border: 1px solid rgba(88, 196, 221, 0.25);
  border-radius: 20px;
  padding: 3px 10px;
}

.topic-grid {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: auto;
}
.topic {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: rgba(16, 16, 21, 0.6);
  border: 1px solid rgba(140, 140, 160, 0.12);
  border-radius: 8px;
  color: var(--soft);
  text-decoration: none;
  font-size: 13.5px;
  transition: all 0.2s;
  position: relative;
}
.topic::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: rgba(140, 140, 160, 0.4);
  flex: none;
  transition: background 0.2s, transform 0.2s;
}
.topic:hover {
  background: rgba(32, 32, 44, 0.9);
  border-color: var(--blue);
  color: var(--ink);
  transform: translateX(4px);
}
.topic:hover::before {
  background: var(--blue);
  transform: scale(1.4);
  box-shadow: 0 0 6px rgba(88, 196, 221, 0.6);
}
.topic .tt { flex: 1; font-weight: 500; }
.topic .tk {
  font-size: 11px;
  color: var(--dim);
  font-family: var(--math);
  background: rgba(255, 255, 255, 0.04);
  padding: 2px 7px;
  border-radius: 4px;
}

.mod-card .glyph {
  position: absolute;
  right: 6px;
  bottom: -32px;
  font-family: var(--serif);
  font-weight: 900;
  font-size: 130px;
  color: rgba(236, 230, 226, 0.03);
  transition: color 0.3s;
  pointer-events: none;
  line-height: 1;
}
.mod-card:hover .glyph {
  color: rgba(88, 196, 221, 0.08);
}

/* ============================================================
   03: 动态实验室展厅 (.viz & .stage)
   ============================================================ */
.viz {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: var(--bg2);
  box-shadow: inset 0 0 60px rgba(0, 0, 0, 0.55);
}

.stage {
  position: relative;
  width: 100%;
}
.stage::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(88, 196, 221, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(88, 196, 221, 0.05) 1px, transparent 1px);
  background-size: 44px 44px;
}

.viz canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.viz-cap {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--dim);
  letter-spacing: 0.05em;
  padding: 10px 16px;
  border-top: 1px solid var(--line);
  background: rgba(13, 13, 17, 0.88);
  flex-wrap: wrap;
}
.viz-cap .sp {
  margin-left: auto;
  display: flex;
  gap: 8px;
  align-items: center;
}

.live-dot {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--green);
  font-size: 11.5px;
  letter-spacing: 0.1em;
}
.live-dot::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 7px var(--green);
  animation: pulse 1.6s infinite;
}

.cap-btn {
  background: none;
  border: 1px solid var(--line);
  color: var(--soft);
  border-radius: 6px;
  padding: 4px 12px;
  cursor: pointer;
  font-size: 12px;
  min-height: 30px;
  transition: all 0.2s;
}
.cap-btn:hover {
  border-color: var(--blue);
  color: var(--blue);
}

/* ============================================================
   04: 折叠推导与步骤 (Scene 卡片)
   ============================================================ */
details.step {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  margin: 10px 0;
  overflow: hidden;
  transition: border-color 0.2s;
}
details.step:hover {
  border-color: var(--line-strong);
}
details.step summary {
  cursor: pointer;
  padding: 15px 18px;
  display: flex;
  gap: 12px;
  align-items: center;
  list-style: none;
  font-weight: 700;
  font-size: 15px;
  min-height: 44px;
  user-select: none;
}
details.step summary::-webkit-details-marker { display: none; }
details.step summary .no {
  font-family: var(--math);
  font-style: italic;
  color: var(--blue);
  font-size: 14px;
  letter-spacing: 0.1em;
  flex: none;
}
details.step summary .chev {
  margin-left: auto;
  color: var(--dim);
  transition: transform 0.3s;
  flex: none;
  font-size: 12px;
}
details.step[open] summary .chev {
  transform: rotate(90deg);
}

details.step .body {
  padding: 4px 20px 20px;
  color: var(--soft);
  font-size: 14.5px;
  line-height: 1.8;
}
details.step .body .fx {
  overflow-x: auto;
  padding: 8px 0;
  margin: 6px 0;
}

.concl {
  border: 1px solid rgba(131, 193, 103, 0.4);
  background: rgba(131, 193, 103, 0.08);
  border-radius: 10px;
  padding: 16px 20px;
  margin-top: 16px;
  font-size: 14px;
  color: var(--soft);
}
.concl b { color: var(--green); }

/* 口诀卡 */
.jue-card {
  border-left: 3px solid var(--gold);
  padding: 18px 24px;
  margin: 22px 0;
  background: rgba(244, 211, 76, 0.06);
  color: var(--soft);
  border-radius: 0 12px 12px 0;
  font-size: 15.5px;
  line-height: 2;
}
.jue-card b { color: var(--gold); }

/* ============================================================
   主题独立页专用样式 (Pages Shell)
   ============================================================ */
.page-hero {
  padding: clamp(90px, 12vh, 130px) 0 40px;
  border-bottom: 1px solid var(--line);
  background: radial-gradient(80% 60% at 50% 0%, rgba(88, 196, 221, 0.08), transparent 70%);
}
.crumb {
  font-family: var(--math);
  font-size: 13px;
  color: var(--dim);
  margin-bottom: 12px;
}
.crumb a { color: var(--soft); }
.crumb a:hover { color: var(--blue); }

.page-hero h1 {
  font-family: var(--serif);
  font-weight: 900;
  font-size: clamp(28px, 4.5vw, 48px);
  line-height: 1.2;
  color: var(--ink);
  margin: 8px 0 14px;
  animation: writeon 1.1s ease both;
}
.page-hero .sub {
  font-size: 15.5px;
  color: var(--soft);
  max-width: 80ch;
  line-height: 1.8;
}
.page-hero .tags {
  display: flex;
  gap: 8px;
  margin-top: 16px;
  flex-wrap: wrap;
}
.chip {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  background: rgba(88, 196, 221, 0.08);
  border: 1px solid rgba(88, 196, 221, 0.25);
  color: var(--blue);
}
.chip.gold {
  background: rgba(244, 211, 76, 0.08);
  border-color: rgba(244, 211, 76, 0.3);
  color: var(--gold);
}

/* 考点知识卡 (.kgrid) */
.kgrid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px;
}
.kcard {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  padding: 22px;
  transition: all 0.25s;
}
.kcard:hover {
  border-color: var(--blue);
  transform: translateY(-3px);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4);
}
.kcard h4 {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-family: var(--serif);
  font-weight: 900;
  font-size: 17px;
  color: var(--ink);
  margin-bottom: 10px;
  line-height: 1.4;
}
.kcard .ki {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: rgba(88, 196, 221, 0.15);
  color: var(--blue);
  font-family: var(--math);
  font-size: 12px;
  display: grid;
  place-items: center;
  flex: none;
  margin-top: 2px;
}
.kcard p {
  color: var(--soft);
  font-size: 14px;
  line-height: 1.8;
}
.kex {
  margin-top: 12px;
  padding: 10px 14px;
  background: rgba(16, 16, 21, 0.7);
  border-left: 2px solid var(--blue);
  border-radius: 0 8px 8px 0;
  font-size: 13px;
  color: var(--dim);
}
.kex b { color: var(--blue); }

/* 核心公式卡 (.fx-grid) */
.fx-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.fx-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  padding: 22px;
}
.fx-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  font-family: var(--serif);
  font-weight: 900;
  font-size: 16px;
}
.fx-formula {
  background: rgba(16, 16, 21, 0.85);
  border: 1px solid rgba(88, 196, 221, 0.25);
  border-radius: 10px;
  padding: 16px;
  text-align: center;
  overflow-x: auto;
  margin-bottom: 14px;
}
.fx-vars {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
}
.fx-var-row {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--soft);
}
.fx-var-sym {
  font-family: var(--math);
  color: var(--blue);
  min-width: 50px;
}
.fx-note {
  margin-top: 10px;
  font-size: 12px;
  color: var(--dim);
}

/* 交互公式计算器 (.calc-card) */
.calc-card {
  border: 1px solid rgba(244, 211, 76, 0.35);
  border-radius: 12px;
  background: linear-gradient(145deg, rgba(28, 28, 40, 0.85), rgba(16, 16, 21, 0.95));
  padding: 22px 26px;
  margin-top: 16px;
}
.calc-header {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  font-weight: 700;
  color: var(--gold);
  margin-bottom: 16px;
}
.calc-form {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  align-items: flex-end;
}
.calc-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex: 1 1 140px;
}
.calc-field label {
  font-size: 12px;
  color: var(--dim);
}
.calc-field input {
  background: #14141c;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  padding: 8px 12px;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 14px;
  outline: none;
}
.calc-field input:focus { border-color: var(--gold); }
.calc-res {
  margin-top: 16px;
  padding: 12px 16px;
  background: rgba(16, 16, 21, 0.8);
  border-radius: 8px;
  font-size: 14px;
  color: var(--soft);
}

/* 技巧与易错点卡片 (.board-card) */
.t-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px;
}
.board-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  padding: 22px;
}
.board-card h3 {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--serif);
  font-weight: 900;
  font-size: 17px;
  color: var(--ink);
  margin-bottom: 14px;
}
.step-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.step-item {
  display: flex;
  gap: 10px;
  font-size: 14px;
  color: var(--soft);
  line-height: 1.7;
}
.step-num {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(88, 196, 221, 0.15);
  color: var(--blue);
  font-size: 11px;
  display: grid;
  place-items: center;
  flex: none;
  margin-top: 2px;
}
.miss-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.miss-item {
  padding: 10px 14px;
  background: rgba(16, 16, 21, 0.6);
  border-radius: 8px;
  font-size: 13px;
}
.miss-bad { color: var(--red); margin-bottom: 4px; }
.miss-good { color: var(--green); }

/* 测验系统 (.quiz-box) */
.quiz-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}
.score-chip {
  font-family: var(--math);
  font-size: 13px;
  color: var(--soft);
  background: rgba(16, 16, 21, 0.75);
  border: 1px solid var(--line);
  padding: 6px 14px;
  border-radius: 20px;
}
.score-chip b { color: var(--yellow); }

.q-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  padding: 22px;
  margin-bottom: 16px;
}
.q-title {
  font-weight: 700;
  font-size: 15.5px;
  color: var(--ink);
  margin-bottom: 16px;
  line-height: 1.7;
}
.q-opts {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.opt-btn {
  text-align: left;
  padding: 10px 16px;
  border: 1px solid var(--line);
  background: rgba(16, 16, 21, 0.7);
  color: var(--soft);
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s;
}
.opt-btn:hover:not(:disabled) {
  border-color: var(--blue);
  color: var(--ink);
}
.opt-btn.correct {
  background: rgba(131, 193, 103, 0.15);
  border-color: var(--green);
  color: var(--green);
  font-weight: 700;
}
.opt-btn.wrong {
  background: rgba(252, 98, 85, 0.15);
  border-color: var(--red);
  color: var(--red);
}

.q-exp {
  display: none;
  margin-top: 14px;
  padding: 12px 16px;
  background: rgba(16, 16, 21, 0.85);
  border-left: 3px solid var(--blue);
  border-radius: 0 8px 8px 0;
  font-size: 13.5px;
  color: var(--soft);
  line-height: 1.7;
}
.q-exp.show { display: block; }

/* 页面切换按钮 (.pn-grid) */
.pn-grid {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin: 40px 0;
  flex-wrap: wrap;
}
.pn-link {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 20px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--soft);
  text-decoration: none;
  min-width: 200px;
  transition: all 0.2s;
}
.pn-link:hover {
  border-color: var(--blue);
  transform: translateY(-2px);
}
.pn-link.next { margin-left: auto; text-align: right; }
.pn-label { font-size: 12px; color: var(--dim); }
.pn-title { font-weight: 700; color: var(--blue); }

/* 页脚 */
footer {
  border-top: 1px solid var(--line);
  padding: 48px clamp(16px, 4vw, 36px) 64px;
  color: var(--dim);
  font-size: 13px;
  max-width: 1200px;
  margin: 0 auto;
  line-height: 2;
  display: flex;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}
footer b { color: var(--soft); }

/* iOS 安装提示条 */
.ios-hint {
  display: none;
  background: rgba(28, 28, 40, 0.95);
  border-bottom: 1px solid var(--line);
  padding: 8px 16px;
  text-align: center;
  font-size: 13px;
  color: var(--soft);
}

/* ============================================================
   动态实验控件适配 (暗色数学实验室)
   ============================================================ */
.demo-card {
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: var(--panel);
  overflow: hidden;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
}

.demo-header {
  padding: 18px 22px;
  background: rgba(16, 16, 21, 0.85);
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.demo-title {
  font-family: var(--serif);
  font-weight: 900;
  font-size: 16.5px;
  color: var(--blue);
}

.demo-desc {
  font-size: 13px;
  color: var(--dim);
  margin-top: 4px;
}

.demo-controls {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--soft);
}
.demo-controls label {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.demo-controls input[type="checkbox"] {
  accent-color: var(--blue);
  width: 15px;
  height: 15px;
}
.demo-controls input[type="range"] {
  accent-color: var(--blue);
  cursor: pointer;
  vertical-align: middle;
}
.demo-controls .ctrl-group {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.demo-controls .val {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-weight: 700;
  color: var(--yellow);
  min-width: 16px;
}

.demo-body {
  position: relative;
  background: var(--bg2);
}

.demo-canvas-wrap {
  position: relative;
  width: 100%;
}
.demo-canvas-wrap canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.demo-readout,
.demo-body [id$="Readout"],
.demo-body [id$="Output"],
.demo-body #invariantStats {
  background: rgba(16, 16, 21, 0.95) !important;
  border-top: 1px solid var(--line) !important;
  color: var(--soft) !important;
  padding: 14px 18px !important;
  font-size: 13.5px !important;
  line-height: 1.7 !important;
}
.demo-readout b,
.demo-body [id$="Readout"] b,
.demo-body [id$="Output"] b,
.demo-body #invariantStats b {
  color: var(--yellow) !important;
}

/* ============================================================
   真题精解卡片样式 (证明与采分结构)
   ============================================================ */
.real-exam-box {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  padding: 24px;
  margin-bottom: 22px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

.real-exam-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--line);
  padding-bottom: 14px;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 10px;
}

.real-exam-badge {
  background: rgba(255, 134, 47, 0.15);
  border: 1px solid var(--orange);
  color: var(--orange);
  border-radius: 6px;
  padding: 3px 10px;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.04em;
}

.real-exam-title {
  font-family: var(--serif);
  font-weight: 900;
  font-size: 17.5px;
  color: var(--ink);
}

.real-exam-stem {
  background: rgba(16, 16, 21, 0.7);
  border: 1px solid var(--line);
  border-left: 3px solid var(--blue);
  border-radius: 0 10px 10px 0;
  padding: 16px 20px;
  margin-bottom: 18px;
  line-height: 1.85;
  color: var(--ink);
  font-size: 14.5px;
}

.real-exam-stem b { color: var(--blue); }

.real-exam-analysis {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.exam-step-row {
  display: flex;
  gap: 12px;
  font-size: 14px;
  color: var(--soft);
  line-height: 1.85;
}

.exam-step-title {
  color: var(--blue);
  font-family: var(--math);
  font-weight: 600;
  white-space: nowrap;
  flex: none;
}

.exam-summary-box {
  margin-top: 14px;
  border: 1px solid rgba(131, 193, 103, 0.4);
  background: rgba(131, 193, 103, 0.08);
  border-radius: 10px;
  padding: 14px 18px;
  color: var(--soft);
  font-size: 13.5px;
  line-height: 1.75;
}
.exam-summary-box b { color: var(--green); }

.q-tag {
  display: inline-block;
  font-size: 11px;
  color: var(--dim);
  border: 1px solid var(--line);
  padding: 2px 8px;
  border-radius: 4px;
  margin-bottom: 10px;
  font-family: var(--math);
}
.q-stem {
  font-size: 15px;
  color: var(--ink);
  margin-bottom: 14px;
  line-height: 1.75;
}
.q-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.opt-btn {
  display: flex;
  align-items: center;
  gap: 12px;
}
.opt-idx {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
  color: var(--blue);
  font-family: var(--math);
  font-weight: 700;
  font-size: 13px;
  display: grid;
  place-items: center;
  flex: none;
}
.opt-text { flex: 1; text-align: left; }
