/* 驾驶舱整站蓝黑。工作台首页不引用这份样式，避免把纸本入口改成驾驶舱配色。
   自学、手册、授课不再切回暖纸，否则从地图点进去像进了另一个站。 */
:root {
  --bg: #101827;
  --panel: #1c2838;
  --accent: #71b9e9;
  --ink: #f4f7fb;
  --muted: #b7c3d4;
  --line: rgba(113, 185, 233, 0.35);
  --danger: #f0a8a0;
  --radius: 16px;
  --gap: 18px;
  --shadow: 0 16px 40px rgba(8, 12, 20, 0.18);
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { background: var(--bg); color: var(--ink); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.num { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }
.top {
  width: min(1080px, calc(100% - 40px));
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 0 8px;
  color: #9fb0c3;
}
.top small, .top a, .status { color: #9fb0c3; }
.top strong { display: block; font-size: 22px; color: var(--ink); font-weight: 650; }
.top a { text-decoration: none; border-bottom: 1px solid transparent; }
.top a:hover { border-bottom-color: var(--accent); }
.wrap { width: min(1180px, calc(100% - 36px)); margin: 0 auto; padding-bottom: 48px; }
.page-title { margin: 8px 0 18px; font-size: clamp(32px, 4vw, 48px); letter-spacing: 0; }
.card-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: var(--gap); align-items: stretch; }
.theme { grid-column: span 2; display: flex; flex-direction: column; gap: 12px; }
.theme:nth-child(4) { grid-column: 2 / span 2; }
.theme:nth-child(5) { grid-column: 4 / span 2; }
.theme > button {
  flex: 1;
  text-align: left;
  background: var(--panel);
  color: var(--ink);
  border: 2px solid transparent;
  border-radius: var(--radius);
  padding: 22px;
  min-height: 180px;
}
.theme.is-on > button { border-color: var(--accent); }
.theme h2 { margin: 0 0 10px; color: var(--accent); font-size: 28px; }
.theme p { margin: 0; font-size: 18px; line-height: 1.5; }
.theme .status { display: inline-block; margin-top: 16px; }
.detail.in-card { display: none; }
.detail {
  margin-top: 18px;
  display: grid;
  grid-template-columns: 1.4fr 0.8fr;
  gap: 22px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
}
.detail h3 { margin: 0 0 8px; color: var(--accent); font-size: 22px; }
.detail ul { margin: 12px 0 0; padding-left: 1.2em; line-height: 1.6; }
.actions { display: flex; flex-direction: column; gap: 10px; align-items: stretch; }
.btn, .btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 16px;
  border-radius: 12px;
  text-decoration: none;
  border: 1px solid var(--accent);
}
.btn { background: var(--accent); color: #102033; font-weight: 700; }
.btn-secondary { background: transparent; color: var(--ink); }
.btn-secondary.is-on, .filters a.is-on { background: var(--accent); color: #102033; }
.study { display: grid; grid-template-columns: 200px 1fr; gap: 22px; align-items: start; }
.toc { position: sticky; top: 12px; display: flex; flex-direction: column; gap: 6px; }
.toc a, .toc button {
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: 10px;
  padding: 10px 12px;
  color: var(--muted);
  text-decoration: none;
}
.toc .is-on { background: #31445d; color: #fff; font-weight: 700; }
.toc-mobile { display: none; }
.panel, .clause, .stage-card, .timeline li { background: var(--panel); border: 1px solid rgba(255,255,255,0.06); border-radius: var(--radius); padding: 22px; color: var(--ink); }
.panel .panel { background: #101827; }
.stack { display: grid; gap: 14px; }
.panel h2, .panel h3 { margin: 0 0 10px; }
.kicker { color: var(--muted); font-size: 14px; }
.step-nav { display: flex; justify-content: space-between; gap: 12px; margin-top: 22px; }
.work { display: grid; grid-template-columns: minmax(260px, 0.9fr) minmax(280px, 1.1fr); gap: 18px; align-items: start; }
label { display: grid; gap: 6px; margin: 0 0 12px; font-size: 14px; }
.pair { display: grid; grid-template-columns: 1fr 110px; gap: 8px; align-items: center; }
input[type="number"], input[type="text"], input[type="search"], textarea, select {
  width: 100%;
  background: #101827;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
}
textarea { min-height: 88px; resize: vertical; }
input[type="range"] { width: 100%; accent-color: var(--accent); }
input::placeholder, textarea::placeholder { color: #8ea0b3; }
.unit { color: var(--muted); }
.field-error { color: var(--danger); min-height: 1.2em; font-size: 13px; }
.hero {
  background: #101827;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px 18px;
  min-height: 112px;
}
.hero span { display: block; color: var(--muted); }
.hero b { display: block; font-size: 42px; min-height: 52px; color: var(--accent); }
.bars { display: grid; gap: 8px; margin-top: 14px; }
.bar { display: grid; grid-template-columns: 7em 1fr auto; gap: 8px; align-items: center; }
.bar i { display: block; height: 12px; border-radius: 99px; background: #31445d; position: relative; }
.bar i::after { content: ""; position: absolute; inset: 0 auto 0 0; width: var(--w); background: var(--accent); border-radius: inherit; }
.bar b { min-width: 8ch; text-align: right; }
.note, .source { margin-top: 12px; color: var(--muted); line-height: 1.6; }
.source { background: #101827; border-radius: 12px; padding: 12px 14px; }
.changed { outline: 2px solid #b86b45; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.academy { width: min(1080px, calc(100% - 40px)); margin: 0 auto; padding: 8px 0 96px; }
.academy-top { display: flex; justify-content: space-between; align-items: center; padding: 22px 0 8px; color: #9fb0c3; font-size: 13px; letter-spacing: 0.08em; }
.academy-top a { color: #9fb0c3; text-decoration: none; }
.academy-brand { display: flex; align-items: center; gap: 8px; font-weight: 700; }
.academy-kicker { margin: 28px 0 8px; color: #7f93a8; letter-spacing: 0.16em; font-size: 13px; }
.academy h1 { margin: 0 0 8px; font-size: clamp(32px, 4vw, 44px); font-weight: 650; }
.academy-lead { margin: 0 0 28px; color: #9fb0c3; }
.sys-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 16px; }
.sys-slot { grid-column: span 2; }
.sys-slot:nth-child(4) { grid-column: 2 / span 2; }
.sys-slot:nth-child(5) { grid-column: 4 / span 2; }
.sys-card { width: 100%; text-align: left; background: #243044; color: #f4f7fb; border: 1px solid rgba(255,255,255,0.06); border-radius: 12px; padding: 18px 18px 16px; min-height: 148px; }
.sys-card.is-on { border-color: #7ec8ea; box-shadow: inset 0 0 0 1px #7ec8ea; }
.sys-icon { display: block; color: #d5deea; font-size: 18px; margin-bottom: 14px; }
.sys-card h2 { margin: 0 0 8px; font-size: 22px; }
.sys-card p { margin: 0; color: #c5d0dc; font-size: 14px; }
.sys-card small { display: block; margin-top: 12px; color: #8ea0b3; font-size: 13px; }
.guide { margin-top: 16px; background: #243044; border: 1px solid rgba(255,255,255,0.06); border-radius: 12px; padding: 16px 18px 18px; }
.guide h2 { margin: 0 0 12px; font-size: 16px; font-weight: 650; }
.pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pills a { display: inline-flex; align-items: center; text-decoration: none; background: #1c2838; color: #d5deea; border-radius: 8px; padding: 8px 12px; min-height: 40px; font-size: 13px; }
.pills a.is-on { background: #31445d; color: #fff; }
.guide-lead { color: #c5d0dc; margin: 14px 0; }
.xgroup { margin: 12px 0; }
.xgroup h3 { margin: 0 0 6px; color: #8ec8e8; font-size: 14px; }
.xgroup ul { margin: 0; padding-left: 1.1em; }
.xgroup li { margin: 4px 0; line-height: 1.5; }
.xlink { margin-left: 8px; color: #8ec8e8; }
.xnote { margin-left: 8px; color: #8ea0b3; font-size: 12px; }
.guide-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.bottom-nav { position: sticky; bottom: 0; display: grid; grid-template-columns: repeat(2, 1fr); background: #101827; border-top: 1px solid rgba(255,255,255,0.06); z-index: 5; }
.bottom-nav a { text-align: center; text-decoration: none; color: #8ea0b3; padding: 10px 4px 12px; font-size: 12px; }
.bottom-nav a.is-on { color: #8ec8e8; }
.bottom-nav span { display: block; font-size: 16px; }
body.view-study, body.view-clause { padding-bottom: 64px; }
@media (max-width: 860px) {
  .sys-grid { grid-template-columns: 1fr; }
  .sys-slot, .sys-slot:nth-child(4), .sys-slot:nth-child(5) { grid-column: auto; }
  .academy { width: min(100% - 28px, 1080px); }
}
.choice { display: flex; flex-wrap: wrap; gap: 8px; }
.choice button, .dock button, .filters button, .filters a {
  min-height: 44px;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--accent);
  background: #101827;
  color: var(--ink);
  text-decoration: none;
}
.choice button[aria-pressed="true"] { background: var(--accent); color: #102033; }
.timeline { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; list-style: none; padding: 0; margin: 0 0 16px; }
.timeline li { background: var(--panel); border: 1px solid rgba(255,255,255,0.06); border-radius: 12px; padding: 12px; }
.stages { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.stage-card { background: var(--panel); border: 1px solid rgba(255,255,255,0.06); border-radius: 12px; padding: 12px; }
.stage-card b { font-size: 32px; color: var(--accent); }
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.clause { background: var(--panel); border: 1px solid rgba(255,255,255,0.06); border-radius: 14px; padding: 14px 16px; margin: 10px 0; color: var(--ink); }
.clause summary { cursor: pointer; }
.compare { display: grid; gap: 10px; }
.compare-row { display: grid; grid-template-columns: 8em 1fr 1fr; gap: 10px; }
.teach-stage { min-height: calc(100vh - 92px); display: flex; flex-direction: column; justify-content: center; padding: 4vh 6vw 6vh; }
.teach-stage h2 { margin: 0 0 16px; font-size: clamp(40px, 4.8vw, 64px); line-height: 1.25; max-width: 16em; }
.teach-stage .lead, .teach-stage li, .teach-stage p { font-size: clamp(22px, 2.3vw, 34px); line-height: 1.45; }
.hero-num { font-size: clamp(56px, 6.5vw, 72px); line-height: 1; min-height: 1.1em; }
.progress { color: var(--accent); letter-spacing: 0.08em; }
.dock { flex: none; background: #0c121c; color: var(--ink); padding: 10px 16px 12px; border-top: 4px solid var(--accent); }
.dock h3 { margin: 0 0 8px; }
.solo { min-height: 100vh; display: grid; grid-template-rows: auto 1fr auto; }
.solo .teach-stage { min-height: 0; }
.hidden-result { color: var(--muted); }
.map-app { height: 100dvh; display: flex; flex-direction: column; background: #101827; color: #f4f7fb; }
.map-app .bottom-nav { position: relative; z-index: 2; }
.map-bar { display: flex; align-items: center; gap: 12px; padding: 12px 16px 8px; }
.map-bar h1 { margin: 0; font-size: 18px; font-weight: 650; white-space: nowrap; }
.map-bar a { color: #9fb0c3; text-decoration: none; white-space: nowrap; }
.map-search { position: relative; flex: 1; min-width: 0; }
.map-search input { background: #1c2838; color: #f4f7fb; border: 1px solid rgba(113,185,233,.35); border-radius: 10px; padding: 8px 12px; width: 100%; }
.map-results { position: absolute; z-index: 4; left: 0; right: 0; top: calc(100% + 4px); background: #f4f7fb; color: #1c2838; border-radius: 12px; max-height: 240px; overflow: auto; }
.map-results button { display: block; width: 100%; text-align: left; background: transparent; color: #1c2838; border: 0; padding: 8px 12px; }
.map-results button:hover, .map-results button:focus { background: #e4eef6; }
.map-results small { display: block; color: #5d6b7a; }
.map-tools { display: flex; gap: 8px; }
.map-tools button, .map-bar button {
  background: #1c2838;
  color: #f4f7fb;
  border: 1px solid rgba(113,185,233,.45);
  border-radius: 10px;
  padding: 0 12px;
  min-height: 40px;
}
.map-stage { position: relative; flex: 1; min-height: 0; overflow: hidden; touch-action: none; outline: none; }
.map-stage.is-dragging .map-world { transition: none; }
.map-world { position: absolute; left: 0; top: 0; transform-origin: 0 0; transition: transform .18s ease; }
.map-svg { position: absolute; left: 0; top: 0; overflow: visible; width: 1px; height: 1px; pointer-events: none; }
.map-svg path { opacity: .45; pointer-events: none; }
.map-svg path.is-path { opacity: 1; stroke-width: 2.5; }
.mnode { position: absolute; z-index: 1; width: 132px; height: 44px; display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 0 8px; border-radius: 12px; border: 1px solid rgba(255,255,255,.14); background: #243044; color: #f4f7fb; text-align: left; }
.mnode.out-left { flex-direction: row-reverse; }
.mnode span { min-width: 0; flex: 1; overflow: hidden; white-space: normal; line-height: 1.25; }
.mnode i { flex: none; width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; font-style: normal; color: #102033; background: var(--branch, #71b9e9); }
.mnode.depth-0 { height: 52px; font-size: 16px; font-weight: 700; }
.mnode.depth-1 { background: color-mix(in srgb, var(--branch) 22%, #1c2838); border-color: var(--branch); font-weight: 650; }
.mnode.depth-2 { background: #1c2838; border-color: color-mix(in srgb, var(--branch) 70%, transparent); }
.mnode.depth-3 { background: transparent; font-size: 13px; }
.mnode.is-path { box-shadow: inset 0 0 0 1px var(--branch, #71b9e9); }
.mnode.is-on { background: color-mix(in srgb, var(--branch, #71b9e9) 35%, #163044); border-color: #9fd4f2; }
.sheet { display: flex; flex-direction: column; min-height: 0; flex: 0 0 clamp(292px, 34%, 420px); background: #f4f7fb; color: #1c2838; border-inline-start: 1px solid #34445c; }
.sheet h2 { margin: 0 0 8px; font-size: 22px; }
.sheet h3 { margin: 14px 0 6px; font-size: 14px; color: #1d6f99; }
.sheet p, .sheet li { line-height: 1.55; }
.sheet a { color: #1d6f99; }
.sheet-fig { display: block; width: 100%; height: auto; border-radius: 12px; margin: 8px 0; }
.sheet .cite { background: #fff; border-radius: 12px; padding: 10px 12px; margin: 8px 0; }
.sheet-top { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.sheet-top button { background: transparent; border: 0; color: #1c2838; min-height: 40px; }
.teach-root { height: 100dvh; min-height: 0; overflow: hidden; display: flex; flex-direction: column; background: #101827; }
.teach-map { position: relative; height: 210px; flex: none; overflow: hidden; border-bottom: 1px solid rgba(255,255,255,.08); }
.teach-map .map-stage { height: 100%; }
.teach-card { flex: 1; min-height: 0; overflow: auto; padding: 16px 18px 12px; }
.teach-card h2 { margin: 0 0 10px; font-size: clamp(26px, 3vw, 40px); }
.dock details { margin-bottom: 8px; }
@media (max-height: 800px) {
  .teach-map { height: 200px; }
  .teach-card { padding: 8px 16px; }
  .teach-card h2 { font-size: 26px; margin-bottom: 6px; }
  .hero { padding: 8px 12px; margin-bottom: 8px; min-height: 0; }
  .hero b, .hero-num { font-size: 40px; min-height: 0; }
}
@media (max-width: 860px) {
  .map-bar { flex-wrap: wrap; }
  .map-bar h1 { font-size: 16px; }
  .mnode.depth-0 { width: 132px; }
}
@media (prefers-reduced-motion: reduce) {
  .map-world { transition: none; }
}
@media (max-width: 860px) {
  .card-grid { grid-template-columns: 1fr; }
  .theme, .theme:nth-child(4), .theme:nth-child(5) { grid-column: auto; }
  .detail { grid-template-columns: 1fr; margin-top: 0; }
  .detail.desktop { display: none; }
  .detail.in-card { display: grid; }
  .study { grid-template-columns: 1fr; }
  .toc { display: none; }
  .toc-mobile { display: block; margin-bottom: 12px; }
  .work, .stages, .compare-row { grid-template-columns: 1fr; }
  .timeline { grid-template-columns: 1fr; }
  .top { padding: 14px 0; align-items: flex-start; }
  .wrap { width: min(100% - 24px, 1180px); }
  table.bill thead { display: none; }
  table.bill tr { display: block; margin: 0 0 10px; border: 1px solid var(--line); border-radius: 12px; padding: 8px; }
  table.bill td { display: flex; justify-content: space-between; gap: 12px; border: 0; }
  table.bill td::before { content: attr(data-label); color: var(--muted); }
}


/* Give the map the full stage only on the course overview. */
.view-teach .teach-map { flex: 1; height: auto; min-height: 0; }
.teach-path {
  display: flex;
  gap: 14px;
  align-items: center;
  padding: 8px clamp(16px, 4vw, 56px);
  background: #192638;
  color: #d0dfed;
}
.teach-path a { color: #9bd5fb; white-space: nowrap; }
.view-teach .teach-card { width: min(100%, 1280px); margin-inline: auto; padding-inline: clamp(16px, 4vw, 56px); }
.view-teach .teach-card h2 { font-size: clamp(28px, 4vw, 54px); line-height: 1.15; }
.map-tools button:disabled { opacity: .45; cursor: default; }
.map-app .mnode:focus-visible, .teach-root a:focus-visible, .teach-root button:focus-visible {
  outline: 2px solid #9bd5fb;
  outline-offset: 3px;
}
@media (max-width: 640px) {
  .map-search { flex-basis: 100%; order: 3; }
  .map-tools { margin-left: auto; flex-wrap: wrap; }
}

.theme-tabs {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 4px;
  padding: 4px clamp(8px, 2vw, 24px) 8px;
  border-bottom: 1px solid #34445c;
}
.theme-tabs button {
  min-height: 44px;
  padding: 4px;
  color: #d0dfed;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  font-size: clamp(12px, 2vw, 15px);
}
.theme-tabs button[aria-pressed="true"] {
  border-color: #71b9e9;
  background: #20384e;
  color: #f4f7fb;
}
.theme-tabs button:focus-visible { outline: 2px solid #9bd5fb; outline-offset: 2px; }

#selected-clause-point { scroll-margin-top: 16px; border-inline-start: 3px solid #2f6f62; padding-inline-start: 12px; }

.map-workspace { display: flex; flex: 1; min-height: 0; min-width: 0; }
.map-workspace .map-stage { min-width: 0; }
.sheet-top { flex: none; padding: 12px 16px; border-bottom: 1px solid #dbe4ec; }
.sheet-top h2 { margin: 0; }
.sheet-top button { flex: none; border: 1px solid #bdcbd8; border-radius: 8px; padding-inline: 10px; }
.sheet-top .sheet-path { font-size: 13px; color: #52667a; margin: 0 0 4px; }
.sheet-body { min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 0 16px 16px; }
@media (max-width: 900px) {
  .map-workspace { flex-direction: column; }
  .sheet { flex: 0 1 46%; border-inline-start: 0; border-top: 1px solid #34445c; }
}
