/* ==========================================================================
   中小学·高中知识图谱 · UI v10「墨线」
   Paper + ink hairlines + one subject color. Square geometry, hard shadows,
   condensed numerals. Loaded last; replaces studio.css.
   ========================================================================== */

:root {
  color-scheme: light;

  --paper: #fafaf7;
  --paper-2: #f1f0eb;
  --paper-3: #e8e6df;
  --card: #ffffff;
  --ink: #14161b;
  --ink-2: #3a3d45;
  --ink-3: #6e717a;
  --ink-4: #9a9ca3;
  --rule: #e2e0d8;
  --rule-2: #c9c6bb;

  /* Subject color (math = vermilion); overridden per subject on <body> */
  --c: #e0441f;
  --c-strong: #b3310f;
  --c-soft: #fdebe5;
  --c-tint: #fff6f2;

  --font-sans: "HarmonyOS Sans SC", "MiSans", "PingFang SC", "Microsoft YaHei UI", "Microsoft YaHei", "Noto Sans SC", "Noto Sans CJK SC", sans-serif;
  --font-num: "Bahnschrift", "DIN Alternate", "DIN Pro", "Roboto Condensed", "Arial Narrow", sans-serif;
  --font-mono: "JetBrains Mono", "Cascadia Mono", "SFMono-Regular", Consolas, monospace;

  --hard: 3px 3px 0 var(--ink);
  --hard-lg: 5px 5px 0 var(--ink);
  --r: 3px;
  --header-h: 104px;

  /* Status palette (restated so site.css dark values never leak in) */
  --ok: #1d7a43;
  --ok-bg: #e3f5e9;
  --on-ok: #ffffff;
  --bad: #c42b1c;
  --bad-bg: #fde8e5;
  --on-bad: #ffffff;
  --warn: #9a4a0c;
  --warn-bg: #fff1dc;
  --unk: #565a64;
  --unk-bg: #eceef1;
  --junior: #2453d4;
  --junior-soft: #e8eefd;
  --hard-bg: #fff1dc;
  --hard-fg: #9a4a0c;
  --soft-bg: #eceef1;
  --soft-fg: #565a64;

  /* Graph tokens (read by explore/diagnose Cytoscape from :root) */
  --node-primary: #16815a;
  --node-primary-bg: #e4f4ec;
  --node-junior: #2453d4;
  --node-junior-bg: #e8eefd;
  --node-senior: #8a36c9;
  --node-senior-bg: #f3e9fb;
  --node-current-bg: #fff0c2;
  --node-current-border: #14161b;
  --node-text: #14161b;
  --edge: #3a3d45;
  --edge-soft: #9a9ca3;
  --diagram-ok-bg: #e3f5e9;
  --diagram-ok: #1d7a43;
  --diagram-bad-bg: #fde8e5;
  --diagram-bad: #c42b1c;
  --diagram-unk-bg: #eceef1;
  --diagram-unk: #6e717a;
  --diagram-shaky-bg: #fff1dc;
  --diagram-shaky: #a85a07;
  --diagram-text: #14161b;
  --diagram-edge: #6e717a;

  --stage-p: #16815a;
  --stage-j: #2453d4;
  --stage-h: #8a36c9;
}

body.subject-chinese { --c: #b8233f; --c-strong: #8f1830; --c-soft: #fbe7eb; --c-tint: #fff5f7; }
body.subject-science { --c: #13865c; --c-strong: #0c6645; --c-soft: #e1f4ec; --c-tint: #f3fbf7; }
body.subject-morality { --c: #d16a00; --c-strong: #a35200; --c-soft: #fdeedb; --c-tint: #fff8ef; }
body.subject-history { --c: #9a5b22; --c-strong: #774317; --c-soft: #f6eadc; --c-tint: #fcf7f1; }
body.subject-english { --c: #2f56d6; --c-strong: #213fa6; --c-soft: #e6ecfc; --c-tint: #f5f7fe; }
body.subject-physics { --c: #0b7d8c; --c-strong: #075e6a; --c-soft: #dff2f4; --c-tint: #f2fafb; }

/* Bridge legacy tokens on <body> so they follow the subject color.
   body[class] matches site.css's body.subject-* specificity and wins by order. */
body,
body[class] {
  --bg: var(--paper);
  --bg-elev: var(--card);
  --bg-muted: var(--paper-2);
  --text: var(--ink);
  --muted: var(--ink-3);
  --line: var(--rule);
  --line-strong: var(--rule-2);
  --brand: var(--c);
  --brand-strong: var(--c-strong);
  --brand-soft: var(--c-soft);
  --on-brand: #ffffff;
  --focus: var(--c);
  --accent: var(--c);
  --accent-strong: var(--c-strong);
  --accent-soft: var(--c-soft);
  --panel: var(--card);
  --header-bg: var(--paper);
  --logo-sheet: var(--c-soft);
  --logo-fold: #ffffff;
  --shadow: none;
  --radius: var(--r);
  --radius-sm: var(--r);
  --font: var(--font-sans);
}

/* ==========================================================================
   1. BASE
   ========================================================================== */
html {
  background: var(--paper);
}
body {
  font-family: var(--font-sans);
  color: var(--ink);
  background-color: var(--paper);
  background-image:
    linear-gradient(180deg, var(--c-tint) 0, rgba(250, 250, 247, 0) 520px),
    radial-gradient(var(--rule-2) 0.8px, transparent 0.8px);
  background-size: 100% 100%, 24px 24px;
  background-repeat: no-repeat, repeat;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
::selection {
  background: var(--c);
  color: #ffffff;
}
:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}
.muted {
  color: var(--ink-3);
}
h1, h2, h3, h4 {
  color: var(--ink);
  letter-spacing: -0.01em;
}

/* Numerals everywhere use the condensed face */
.stat-num,
.stat b,
.step-no,
.section-no,
.mode-index,
.path-symbol,
.grade-count,
.count-pill,
.home-chap-cnt,
.id-code {
  font-family: var(--font-num);
  font-variant-numeric: tabular-nums;
}

/* ==========================================================================
   2. HEADER: masthead row + color-coded subject strip
   ========================================================================== */
.top-banner {
  display: none !important;
}
.site-header,
body:not(.page-explore) .site-header {
  position: sticky;
  top: 0;
  z-index: 60;
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-areas:
    "brand pages"
    "subjects subjects";
  align-items: center;
  gap: 0 24px;
  min-height: 0;
  padding: 0 clamp(16px, 3vw, 40px);
  background: rgba(250, 250, 247, 0.94);
  backdrop-filter: blur(10px) saturate(140%);
  -webkit-backdrop-filter: blur(10px) saturate(140%);
  border-bottom: 1px solid var(--ink);
  box-shadow: none;
}
.site-nav {
  display: contents;
}
.brand {
  grid-area: brand;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-height: 60px;
  padding: 0;
  color: var(--ink);
  text-decoration: none;
  border-radius: 0;
}
.brand:hover {
  transform: none;
  background: none;
}
.logo {
  width: 34px;
  height: 34px;
  padding: 5px;
  color: #ffffff;
  background: var(--c);
  border-radius: 0;
  box-shadow: 2px 2px 0 var(--ink);
  filter: none;
  --logo-sheet: transparent;
  --logo-fold: rgba(255, 255, 255, 0.35);
}
.brand-copy {
  display: flex;
  flex-direction: column;
  gap: 1px;
  line-height: 1.2;
}
.brand-name {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: var(--ink);
}
.brand-kicker {
  width: auto;
  padding: 0;
  background: none;
  border-radius: 0;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.18em;
  color: var(--ink-3);
}

/* Page links: plain text with an ink underline marker */
.page-links {
  grid-area: pages;
  justify-self: end;
  align-self: stretch;
  display: flex;
  align-items: stretch;
  gap: 4px;
  padding: 0;
  background: none;
  border-radius: 0;
}
.page-links .nav-link,
.nav-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: 60px;
  padding: 0 14px;
  border-radius: 0;
  background: none;
  color: var(--ink-2);
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  box-shadow: none;
  transition: color 0.15s ease;
}
.page-links .nav-link::after {
  content: "";
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: -1px;
  height: 3px;
  background: var(--ink);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.2s ease;
}
.page-links .nav-link:hover,
.nav-link:hover {
  color: var(--ink);
  background: none;
}
.page-links .nav-link:hover::after {
  transform: scaleX(0.4);
}
.page-links .nav-link.active,
.page-links .nav-link[aria-current="page"],
.nav-link.active,
.nav-link[aria-current="page"],
.nav-link.active:hover,
.nav-link[aria-current="page"]:hover {
  color: var(--ink);
  background: none;
  box-shadow: none;
}
.page-links .nav-link.active::after,
.page-links .nav-link[aria-current="page"]::after {
  transform: scaleX(1);
}

/* Subject strip: each subject carries its own color swatch */
.subject-switch {
  grid-area: subjects;
  display: flex;
  align-items: stretch;
  gap: 0;
  margin: 0 calc(-1 * clamp(16px, 3vw, 40px));
  padding: 0 clamp(16px, 3vw, 40px);
  background: none;
  border: none;
  border-top: 1px solid var(--rule);
  border-radius: 0;
  box-shadow: none;
  overflow-x: auto;
  scrollbar-width: none;
}
.subject-switch::-webkit-scrollbar {
  height: 0;
}
.subject-switch::after {
  display: none;
}
.subject-link[data-subject="math"] { --sc: #e0441f; }
.subject-link[data-subject="chinese"] { --sc: #b8233f; }
.subject-link[data-subject="science"] { --sc: #13865c; }
.subject-link[data-subject="morality"] { --sc: #d16a00; }
.subject-link[data-subject="history"] { --sc: #9a5b22; }
.subject-link[data-subject="english"] { --sc: #2f56d6; }
.subject-link[data-subject="physics"] { --sc: #0b7d8c; }
.subject-switch .subject-link,
.nav-link.subject-link {
  flex: none;
  gap: 8px;
  min-height: 42px;
  padding: 0 16px;
  border-radius: 0;
  border-right: 1px solid var(--rule);
  background: none;
  color: var(--ink-2);
  font-size: 13.5px;
  font-weight: 700;
  box-shadow: none;
}
.subject-switch .subject-link:first-child {
  border-left: 1px solid var(--rule);
}
.subject-switch .subject-link::before {
  content: "";
  width: 8px;
  height: 8px;
  background: var(--sc);
  transition: transform 0.2s ease;
}
.subject-switch .subject-link:hover,
.nav-link.subject-link:hover {
  color: var(--ink);
  background: var(--card);
}
.subject-switch .subject-link:hover::before {
  transform: rotate(45deg);
}
.subject-switch .subject-link.on,
.nav-link.subject-link.on,
.nav-link.subject-link.on:hover {
  background: var(--sc);
  color: #ffffff;
  box-shadow: none;
}
.subject-switch .subject-link.on::before {
  background: #ffffff;
}

/* ==========================================================================
   3. CONTROLS
   ========================================================================== */
button,
.btn {
  font-family: inherit;
  border-radius: var(--r);
  border: 1px solid var(--ink);
  background: var(--card);
  color: var(--ink);
  font-weight: 700;
  box-shadow: none;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background-color 0.12s ease, color 0.12s ease;
}
button:hover,
.btn:hover {
  background: var(--paper-2);
  color: var(--ink);
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
}
button.primary,
.btn-primary,
main#root button.primary,
main#root .btn-primary {
  background: var(--c);
  border-color: var(--ink);
  color: #ffffff;
  box-shadow: var(--hard);
}
button.primary:hover,
.btn-primary:hover,
main#root button.primary:hover,
main#root .btn-primary:hover {
  background: var(--c);
  color: #ffffff;
  filter: none;
  transform: translate(-1px, -1px);
  box-shadow: 4px 4px 0 var(--ink);
}
button.primary:active,
.btn-primary:active {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 var(--ink);
}
.btn-lg {
  min-height: 50px;
  padding: 0 24px;
  font-size: 15px;
}
button:disabled,
button:disabled:hover {
  transform: none;
  box-shadow: none;
}

input[type="search"],
input[type="text"],
input[type="number"],
select,
textarea {
  font-family: inherit;
  border: 1px solid var(--rule-2);
  border-radius: var(--r);
  background: var(--card);
  color: var(--ink);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
input[type="search"]:focus,
input[type="text"]:focus,
input[type="number"]:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--ink);
  box-shadow: 0 0 0 3px var(--c-soft);
}

/* Segmented tabs (stage filters, grade filters, chapter tabs) */
.stage-tabs,
.grade-filters,
.chapter-panel-tabs {
  display: flex;
  flex-wrap: wrap;
  width: fit-content;
  max-width: 100%;
  gap: 0;
  padding: 0;
  border: 1px solid var(--ink);
  border-radius: var(--r);
  background: var(--card);
  overflow: hidden;
}
.stage-tabs .stage-tab,
main#root .stage-tabs .stage-tab,
.grade-filters button,
.chapter-grade-tab {
  min-height: 34px;
  padding: 0 14px;
  margin: 0;
  border: none;
  border-right: 1px solid var(--rule);
  border-radius: 0;
  background: transparent;
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 700;
  box-shadow: none;
}
.stage-tabs .stage-tab:last-child,
.grade-filters button:last-child,
.chapter-grade-tab:last-child {
  border-right: none;
}
.stage-tabs .stage-tab:hover:not(.on),
main#root .stage-tabs .stage-tab:hover:not(.on),
.grade-filters button:hover:not([aria-pressed="true"]),
.chapter-grade-tab:hover:not(.on) {
  background: var(--paper-2);
  color: var(--ink);
}
.stage-tabs .stage-tab.on,
.stage-tab[aria-selected="true"],
main#root .stage-tabs .stage-tab.on,
.grade-filters button[aria-pressed="true"],
.chapter-grade-tab.on {
  background: var(--ink);
  color: #ffffff;
  box-shadow: none;
}

/* Kickers: small ink labels with a subject-color square */
.section-kicker,
.diag-card-kicker,
.path-kicker {
  display: flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  margin: 0 0 8px;
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: none;
  color: var(--ink-3);
}
.section-kicker::before,
.diag-card-kicker::before,
.path-kicker::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 0;
  background: var(--c);
}
.badge {
  border-radius: 2px;
}

/* ==========================================================================
   4. HOME
   ========================================================================== */
.home {
  width: min(1240px, 100%);
  max-width: none;
  margin: 0 auto;
  padding: 0 clamp(16px, 3vw, 40px) 72px;
}

/* Hero */
.hero,
.hero.workbench-console {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(340px, 0.75fr);
  gap: clamp(28px, 4vw, 64px);
  align-items: start;
  margin: 0;
  padding: clamp(36px, 5vw, 64px) 0 40px;
  background: none;
  border: none;
  border-radius: 0;
  box-shadow: none;
}
.hero::before,
.hero::after {
  display: none;
}
.eyebrow-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 22px;
}
.hero .eyebrow,
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  padding: 0;
  background: none;
  border: none;
  border-radius: 0;
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
}
.hero .eyebrow::before,
.eyebrow::before {
  content: "";
  width: 28px;
  height: 3px;
  border-radius: 0;
  background: var(--c);
}
.hero-pill {
  padding: 3px 10px;
  border: 1px solid var(--ink);
  border-radius: 999px;
  background: var(--card);
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
}
.hero h1 {
  margin: 0 0 22px;
  font-family: var(--font-sans);
  font-size: clamp(30px, 3.9vw, 52px);
  font-weight: 900;
  line-height: 1.14;
  letter-spacing: -0.03em;
  color: var(--ink);
}
.hero h1 span {
  color: var(--ink);
  background: linear-gradient(transparent 62%, var(--c-soft) 62%, var(--c-soft) 92%, transparent 92%);
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}
.hero .lede,
.lede {
  max-width: 34em;
  margin: 0 0 30px;
  color: var(--ink-2);
  font-size: 16px;
  line-height: 1.8;
}

/* Search: one heavy ink box */
.home-search-box {
  position: relative;
  display: flex;
  align-items: center;
  max-width: 640px;
  background: var(--card);
  border: 2px solid var(--ink);
  border-radius: var(--r);
  box-shadow: var(--hard);
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}
.home-search-box:focus-within {
  transform: translate(-1px, -1px);
  box-shadow: 5px 5px 0 var(--c);
}
.home-search-icon {
  position: static;
  flex: none;
  width: 20px;
  height: 20px;
  margin-left: 16px;
  color: var(--ink);
  transform: none;
}
#home-search {
  flex: 1;
  min-width: 0;
  height: 56px;
  padding: 0 14px;
  border: none;
  border-radius: 0;
  background: transparent;
  font-size: 16px;
  font-weight: 600;
  box-shadow: none;
}
#home-search:focus {
  border: none;
  box-shadow: none;
  background: transparent;
}
#home-search::placeholder {
  color: var(--ink-4);
  font-weight: 500;
}
.home-search-kbd {
  flex: none;
  margin-right: 12px;
  padding: 3px 8px;
  border: 1px solid var(--rule-2);
  border-bottom-width: 2px;
  border-radius: 3px;
  font-family: var(--font-num);
  font-size: 11px;
  color: var(--ink-3);
  background: var(--paper);
}
.home-search-results {
  position: absolute;
  top: calc(100% + 8px);
  left: -2px;
  right: -2px;
  z-index: 30;
  padding: 6px;
  background: var(--card);
  border: 2px solid var(--ink);
  border-radius: var(--r);
  box-shadow: var(--hard-lg);
}
.home-search-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px;
  border-radius: 0;
  border-bottom: 1px solid var(--rule);
}
.home-search-item:last-child {
  border-bottom: none;
}
.home-search-item:hover {
  background: var(--c-tint);
}
.home-search-info {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 8px;
  min-width: 0;
}
.home-search-info strong {
  font-size: 14.5px;
  color: var(--ink);
}
.home-search-info small {
  flex-basis: 100%;
  color: var(--ink-3);
  font-size: 12px;
}
.mini-stage {
  padding: 1px 6px;
  border-radius: 2px;
  font-size: 11px;
  font-weight: 800;
}
.mini-stage.is-p { background: var(--node-primary-bg); color: var(--stage-p); }
.mini-stage.is-j { background: var(--node-junior-bg); color: var(--stage-j); }
.mini-stage.is-h { background: var(--node-senior-bg); color: var(--stage-h); }
.home-search-actions {
  display: flex;
  flex: none;
  gap: 6px;
}
.mini-btn {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 11px;
  border: 1px solid var(--ink);
  border-radius: var(--r);
  background: var(--card);
  color: var(--ink);
  font-size: 12.5px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}
.mini-btn:hover {
  background: var(--paper-2);
}
.mini-btn.primary {
  background: var(--ink);
  color: #ffffff;
}
.mini-btn.primary:hover {
  background: var(--c);
}
.home-search-empty {
  padding: 14px;
  color: var(--ink-3);
  font-size: 13.5px;
}

.quick-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 18px 0 30px;
}
.quick-chips-label {
  color: var(--ink-3);
  font-size: 12.5px;
  font-weight: 700;
}
.quick-chip {
  padding: 5px 11px;
  border: 1px solid var(--rule-2);
  border-radius: 999px;
  background: var(--card);
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: border-color 0.15s ease, color 0.15s ease, background-color 0.15s ease;
}
.quick-chip::before {
  content: "#";
  margin-right: 3px;
  color: var(--c);
  font-family: var(--font-num);
}
.quick-chip:hover {
  border-color: var(--ink);
  color: var(--ink);
  background: var(--c-tint);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px 16px;
}
.hero-actions .btn {
  flex: none;
}
.quiet-link {
  margin: 0;
}
.quiet-link a {
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
  text-decoration: underline;
  text-decoration-color: var(--c);
  text-decoration-thickness: 2px;
  text-underline-offset: 5px;
}
.quiet-link a:hover {
  color: var(--c-strong);
}
.hero-footnote {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 0;
  margin-top: 30px;
  padding-top: 16px;
  border-top: 1px solid var(--rule);
  color: var(--ink-3);
  font-size: 13px;
}
.hero-footnote > span:not(.status-dot) + span:not(.status-dot)::before {
  content: "/";
  margin: 0 12px;
  color: var(--rule-2);
}
.status-dot {
  width: 8px;
  height: 8px;
  margin-right: 10px;
  border-radius: 50%;
  background: var(--node-primary);
  box-shadow: 0 0 0 3px var(--node-primary-bg);
  animation: ink-pulse 2.4s ease-in-out infinite;
}
@keyframes ink-pulse {
  50% { box-shadow: 0 0 0 6px rgba(22, 129, 90, 0.08); }
}

/* Path preview: a metro line on paper */
.path-preview {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0;
  background: var(--card);
  border: 1px solid var(--ink);
  border-radius: var(--r);
  box-shadow: var(--hard-lg);
  color: var(--ink);
  overflow: visible;
}
.path-caption {
  display: block;
  padding: 18px 22px 14px;
  border-bottom: 1px solid var(--rule);
}
.path-caption .path-kicker {
  margin-bottom: 6px;
}
.path-caption strong,
#path-title {
  display: block;
  font-size: 18px;
  font-weight: 800;
  color: var(--ink);
}
.path-samples {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
  padding: 12px 22px 0;
  background: none;
  border: none;
}
.path-samples:empty {
  display: none;
}
.path-sample-tab {
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid var(--rule-2);
  border-radius: 999px;
  background: var(--card);
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.path-sample-tab:hover {
  border-color: var(--ink);
  background: var(--card);
  color: var(--ink);
}
.path-sample-tab.on {
  background: var(--ink);
  border-color: var(--ink);
  color: #ffffff;
}
.path-map {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0;
  margin: 0;
  padding: 18px 22px 8px;
}
.path-map > .muted {
  margin: 12px 0;
}
.path-node {
  position: relative;
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  padding: 0 0 22px;
  margin: 0;
  border: none;
  border-radius: 0;
  background: none;
  color: var(--ink);
  text-decoration: none;
}
/* the line between stations */
.path-node:not(:last-child)::after {
  content: "";
  position: absolute;
  left: 16px;
  top: 34px;
  bottom: 0;
  width: 4px;
  background: var(--c);
}
.path-node + .path-node::before {
  display: none;
}
.path-node:hover,
.path-node.is-target,
.path-node.is-foundation {
  background: none;
  border: none;
  transform: none;
}
.path-symbol {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 4px solid var(--c);
  border-radius: 50%;
  background: var(--card);
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
  box-shadow: none;
  transition: transform 0.15s ease;
}
.path-node:hover .path-symbol {
  transform: scale(1.12);
}
.path-node.is-target .path-symbol {
  border-color: var(--ink);
  background: var(--ink);
  color: #ffffff;
}
.path-node.is-foundation .path-symbol {
  border-color: var(--c);
  background: var(--c);
  color: #ffffff;
}
.path-node-copy {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  padding-top: 5px;
}
.path-node-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}
.path-node strong {
  font-size: 15px;
  font-weight: 800;
  line-height: 1.35;
  color: var(--ink);
  transition: color 0.15s ease;
}
.path-node:hover strong {
  color: var(--c-strong);
}
.path-node-stage {
  flex: none;
  padding: 1px 6px;
  border: 1px solid var(--rule-2);
  border-radius: 2px;
  background: none;
  color: var(--ink-3);
  font-size: 11px;
  font-weight: 700;
}
.path-node small {
  color: var(--ink-3);
  font-size: 12px;
  line-height: 1.5;
}
.path-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: 0;
  padding: 14px 22px;
  border-top: 1px dashed var(--rule-2);
  background: var(--paper);
}
.path-note {
  margin: 0;
  color: var(--ink-3);
  font-size: 12.5px;
  line-height: 1.6;
}
.path-demo-btn {
  flex: none;
  padding: 7px 12px;
  border: 1px solid var(--ink);
  border-radius: var(--r);
  background: var(--ink);
  color: #ffffff;
  font-size: 12.5px;
  font-weight: 700;
  text-decoration: none;
  box-shadow: none;
  transition: background-color 0.15s ease;
}
.path-demo-btn:hover {
  background: var(--c);
  color: #ffffff;
  transform: none;
}

/* Data strip: ruled row of big numerals */
.data-strip,
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  margin: 0 0 8px;
  padding: 0;
  border-top: 2px solid var(--ink);
  border-bottom: 1px solid var(--ink);
  background: none;
}
.data-strip .stat-card,
.stat-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 20px 22px 18px;
  border: none;
  border-right: 1px solid var(--rule);
  border-radius: 0;
  background: none;
  box-shadow: none;
}
.data-strip .stat-card:last-child {
  border-right: none;
}
.stat-num {
  font-size: clamp(34px, 4vw, 52px);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.data-strip .stat-card:first-child .stat-num {
  color: var(--c);
}
.stat-label {
  color: var(--ink-3);
  font-size: 13px;
  font-weight: 700;
}

.load-error {
  margin: 20px 0;
  padding: 14px 16px;
  border: 1px solid var(--bad);
  border-left: 6px solid var(--bad);
  border-radius: var(--r);
  background: var(--bad-bg);
  color: var(--bad);
}

/* Section heading: outlined index number + title + ink rule */
.modes-section,
.grade-section,
.workbench-overview,
.blind-home {
  margin: 72px 0 0;
  padding: 0;
  background: none;
  border: none;
  box-shadow: none;
}
.section-heading {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: end;
  gap: 8px 22px;
  margin: 0 0 26px;
  padding: 0 0 16px;
  border-bottom: 1px solid var(--ink);
}
.section-no {
  font-size: 64px;
  font-weight: 700;
  line-height: 0.82;
  color: transparent;
  -webkit-text-stroke: 1.5px var(--ink);
  letter-spacing: -0.02em;
}
.section-heading h2 {
  margin: 0 0 4px;
  font-size: 26px;
  font-weight: 900;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.section-heading p {
  margin: 0;
  color: var(--ink-3);
  font-size: 14px;
}
.section-title {
  margin: 0 0 6px;
  font-size: 22px;
  font-weight: 900;
}

/* Modes: three ruled columns, the first one inked */
.workbench-modes {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  margin: 0;
  border: 1px solid var(--ink);
  border-radius: var(--r);
  background: var(--card);
  overflow: hidden;
}
.mode-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 230px;
  padding: 26px 26px 24px;
  border: none;
  border-right: 1px solid var(--ink);
  border-radius: 0;
  background: var(--card);
  color: var(--ink);
  text-decoration: none;
  box-shadow: none;
  transition: background-color 0.2s ease;
}
.mode-card:last-child {
  border-right: none;
}
.mode-card:hover {
  background: var(--c-tint);
  transform: none;
  box-shadow: none;
}
.mode-card.is-primary-mode {
  background: var(--ink);
  color: #ffffff;
}
.mode-card.is-primary-mode:hover {
  background: #24272e;
}
.mode-index {
  position: absolute;
  top: 18px;
  right: 22px;
  font-size: 56px;
  font-weight: 700;
  line-height: 1;
  color: transparent;
  -webkit-text-stroke: 1.2px var(--rule-2);
  transition: transform 0.25s ease;
}
.mode-card:hover .mode-index {
  -webkit-text-stroke-color: var(--c);
  transform: translateY(-3px);
}
.mode-card.is-primary-mode .mode-index {
  -webkit-text-stroke-color: rgba(255, 255, 255, 0.35);
}
.mode-tag {
  width: fit-content;
  padding: 2px 8px;
  border: 1px solid currentColor;
  border-radius: 2px;
  background: none;
  color: var(--c);
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.1em;
}
.mode-card.is-primary-mode .mode-tag {
  color: #ffffff;
  background: var(--c);
  border-color: var(--c);
}
.mode-card strong {
  margin-top: 6px;
  font-size: 22px;
  font-weight: 900;
  letter-spacing: -0.01em;
  color: inherit;
}
.mode-card p {
  flex: 1;
  margin: 0;
  color: var(--ink-3);
  font-size: 14px;
  line-height: 1.7;
}
.mode-card.is-primary-mode p {
  color: rgba(255, 255, 255, 0.7);
}
.mode-cta {
  margin-top: 6px;
  font-size: 14px;
  font-weight: 800;
  color: inherit;
}
.mode-card:hover .mode-cta {
  color: var(--c);
}
.mode-card.is-primary-mode:hover .mode-cta {
  color: #ffffff;
  text-decoration: underline;
  text-decoration-color: var(--c);
  text-decoration-thickness: 2px;
  text-underline-offset: 5px;
}

/* Grade matrix */
.grade-filters {
  align-self: end;
  margin: 0;
}
.grade-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
}
a.grade-card,
.grade-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
  padding: 18px 18px 16px 22px;
  border: 1px solid var(--rule-2);
  border-top: 1px solid var(--rule-2);
  border-radius: var(--r);
  background: var(--card);
  color: var(--ink);
  text-decoration: none;
  box-shadow: none;
  overflow: hidden;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.grade-card::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  right: auto;
  width: 4px;
  height: auto;
  background: var(--stage-p);
}
.grade-card.is-junior::before { background: var(--stage-j); }
.grade-card.is-senior::before { background: var(--stage-h); }
a.grade-card:hover,
.grade-card:hover {
  border-color: var(--ink);
  transform: translate(-2px, -2px);
  box-shadow: var(--hard);
}
.grade-card.is-inspected {
  border-color: var(--ink);
  box-shadow: var(--hard);
  background: var(--c-tint);
}
.grade-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.grade-card .grade-stage,
.grade-stage {
  padding: 0;
  background: none;
  color: var(--stage-p);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
}
.grade-card.is-junior .grade-stage { color: var(--stage-j); background: none; }
.grade-card.is-senior .grade-stage { color: var(--stage-h); background: none; }
.grade-split-pill {
  padding: 1px 7px;
  border: 1px solid var(--rule-2);
  border-radius: 2px;
  background: none;
  color: var(--ink-3);
  font-size: 11px;
  font-weight: 700;
}
a.grade-card strong,
.grade-card strong {
  font-size: 20px;
  font-weight: 900;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.grade-count {
  color: var(--ink-2);
  font-size: 14px;
  font-weight: 600;
}
.grade-domains {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.grade-domain-pill {
  padding: 1px 6px;
  border-radius: 2px;
  background: var(--paper-2);
  color: var(--ink-3);
  font-size: 11px;
  font-weight: 600;
}
.grade-card .grade-foot {
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px dashed var(--rule);
  color: var(--ink-3);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
}
.grade-card:hover .grade-foot {
  color: var(--c-strong);
}
.grade-result {
  margin: 10px 0 0;
  color: var(--ink-3);
  font-size: 13px;
}

/* Chapter inspector */
.home-chapter-panel {
  margin-top: 30px;
  padding: 24px;
  border: 1px solid var(--ink);
  border-radius: var(--r);
  background: var(--card);
  box-shadow: var(--hard-lg);
}
.chapter-panel-head {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--rule);
}
.chapter-panel-title h3 {
  margin: 0;
  font-size: 20px;
  font-weight: 900;
}
.chapter-panel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 0;
  border-top: 1px solid var(--rule);
  border-left: 1px solid var(--rule);
}
.home-chap-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px;
  border: none;
  border-right: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  border-radius: 0;
  background: var(--card);
  box-shadow: none;
  transition: background-color 0.15s ease;
}
.home-chap-card:hover {
  background: var(--c-tint);
}
.home-chap-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.home-chap-vol {
  padding: 1px 6px;
  border-radius: 2px;
  background: var(--ink);
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
}
.home-chap-cnt {
  color: var(--ink-3);
  font-size: 12px;
}
.home-chap-title {
  margin: 0;
  font-size: 15px;
  font-weight: 800;
  line-height: 1.45;
  color: var(--ink);
}
.home-chap-topics {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
}
.home-chap-topic {
  padding: 0;
  border: none;
  border-bottom: 1px solid var(--rule-2);
  border-radius: 0;
  background: none;
  color: var(--ink-2);
  font-size: 12.5px;
  text-decoration: none;
}
.home-chap-topic:hover {
  color: var(--c-strong);
  border-bottom-color: var(--c);
  background: none;
}
.home-chap-more {
  color: var(--ink-4);
  font-size: 12px;
}
.home-chap-actions {
  display: flex;
  gap: 6px;
  margin-top: auto;
  padding-top: 6px;
}

/* Steps: numbered ruled columns */
.steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}
.steps li {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 0 26px 0 0;
  margin: 0 26px 0 0;
  border: none;
  border-right: 1px solid var(--rule);
  border-radius: 0;
  background: none;
  box-shadow: none;
}
.steps li:last-child {
  margin-right: 0;
  padding-right: 0;
  border-right: none;
}
.step-no {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: var(--card);
  color: var(--ink);
  font-size: 20px;
  font-weight: 700;
  box-shadow: none;
}
.steps li:first-child .step-no {
  background: var(--c);
  border-color: var(--c);
  color: #ffffff;
}
.step-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  margin-bottom: 6px;
}
.step-head h3,
.steps h3 {
  margin: 0;
  font-size: 17px;
  font-weight: 900;
}
.step-tag {
  padding: 1px 7px;
  border: 1px solid var(--rule-2);
  border-radius: 2px;
  background: none;
  color: var(--ink-3);
  font-size: 11.5px;
  font-weight: 700;
}
.steps p {
  margin: 0;
  color: var(--ink-3);
  font-size: 14px;
  line-height: 1.75;
}

/* Blind-spot ledger */
.blind-home {
  padding: 24px;
  border: 1px solid var(--ink);
  border-left: 6px solid var(--bad);
  border-radius: var(--r);
  background: var(--card);
}
.blind-home-header {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.blind-home-header .section-kicker::before {
  background: var(--bad);
}
.blind-home-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 8px;
}
.blind-home-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 12px;
  border: 1px solid var(--rule);
  border-radius: var(--r);
  background: var(--paper);
}
.blind-home-name {
  color: var(--ink);
}
.blind-home-name:hover {
  color: var(--c-strong);
}

.learning-note {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 14px;
  margin: 72px 0 0;
  padding: 18px 0 0;
  border: none;
  border-top: 1px solid var(--ink);
  border-radius: 0;
  background: none;
  color: var(--ink-3);
  font-size: 13.5px;
}
.learning-note strong {
  color: var(--ink);
}
.learning-note p {
  margin: 0;
}

.site-footer {
  padding: 22px 16px 28px;
  border-top: 1px solid var(--rule);
  background: none;
  color: var(--ink-3);
  font-size: 13px;
  text-align: center;
}
.site-footer a {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--c);
  text-underline-offset: 4px;
}

/* ==========================================================================
   5. EXPLORE
   ========================================================================== */
body.page-explore {
  background: var(--paper);
}
.explore {
  grid-template-columns: minmax(250px, 300px) minmax(0, 1fr) minmax(290px, 380px);
}
.side {
  background: var(--card);
  border-right: 1px solid var(--ink);
}
.side-tools {
  gap: 10px;
  padding: 14px;
  background: var(--card);
  border-bottom: 1px solid var(--rule);
}
#q {
  height: 42px;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--ink);
  font-size: 14px;
}
.side-tools .stage-tabs {
  width: 100%;
}
.side-tools .stage-tab {
  flex: 1;
}
.side-tools select {
  min-height: 38px;
  font-size: 13px;
}
.edition-row {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 6px 10px;
  padding: 8px 10px;
  border: 1px solid var(--ink);
  border-left: 4px solid var(--c);
  background: var(--c-tint);
}
.edition-row label {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .06em;
  white-space: nowrap;
}
.edition-row select {
  min-height: 34px;
  font-weight: 700;
  border-color: var(--rule-2);
}
.edition-note {
  grid-column: 1 / -1;
  margin: 0;
  font-size: 12px;
  line-height: 1.5;
  color: var(--ink-3);
}
.side .vol-rest > summary {
  color: var(--ink-3);
  font-style: normal;
  border-top: 1px dashed var(--rule-2);
}
.count-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.count {
  color: var(--ink-3);
  font-family: var(--font-num);
  font-size: 13px;
}
.tree-actions {
  display: flex;
  gap: 4px;
}
.tree-btn {
  min-height: 28px;
  padding: 0 9px;
  border: 1px solid var(--rule-2);
  font-size: 12px;
}
.tree-btn:hover {
  border-color: var(--ink);
}

.side .vol {
  margin: 0;
  border: none;
  border-radius: 0;
  background: none;
  overflow: visible;
}
.side .vol > summary,
.side .chap > summary {
  display: flex;
  align-items: center;
  gap: 8px;
  list-style: none;
}
.side .vol > summary::-webkit-details-marker,
.side .chap > summary::-webkit-details-marker {
  display: none;
}
.side .vol > summary {
  min-height: 42px;
  padding: 9px 14px;
  font-size: 14px;
  font-weight: 800;
  background: var(--card);
  border-bottom: 1px solid var(--rule);
}
.side .vol > summary::before,
.side .chap > summary::before {
  content: "";
  flex: none;
  width: 0;
  height: 0;
  border-left: 5px solid var(--ink-3);
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  transition: transform 0.15s ease;
}
.side .vol[open] > summary::before,
.side .chap[open] > summary::before {
  transform: rotate(90deg);
  border-left-color: var(--c);
}
.side .vol[open] > summary {
  background: var(--paper);
  box-shadow: inset 4px 0 0 var(--c);
}
.side .vol > summary .count-pill {
  margin-left: auto;
  color: var(--ink-3);
  font-size: 12px;
  font-weight: 600;
}
.side .chap > summary {
  min-height: 36px;
  padding: 7px 14px 7px 24px;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-2);
}
.side .topic-item {
  width: calc(100% - 30px);
  min-height: 0;
  margin: 0 8px 0 22px;
  padding: 7px 10px;
  border: none;
  border-left: 1px solid var(--rule);
  border-radius: 0;
}
.side .topic-item .nm {
  font-size: 13.5px;
  font-weight: 700;
}
.side .topic-item .meta {
  font-size: 11.5px;
  color: var(--ink-4);
}
.side .topic-item:hover {
  background: var(--paper);
  border-left-color: var(--ink);
}
.side .topic-item.sel {
  background: var(--c-soft);
  border-left: 3px solid var(--c);
  box-shadow: none;
}

.graph-pane {
  background-color: var(--paper);
  background-image:
    linear-gradient(var(--rule) 1px, transparent 1px),
    linear-gradient(90deg, var(--rule) 1px, transparent 1px);
  background-size: 28px 28px;
  background-position: -1px -1px;
}
.graph-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 0;
  padding: 10px 14px;
  border: none;
  border-bottom: 1px solid var(--ink);
  border-radius: 0;
  background: var(--card);
  box-shadow: none;
  backdrop-filter: none;
}
.graph-toolbar button {
  background: var(--card);
}
.graph-context-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  flex-basis: 100%;
  padding-bottom: 8px;
  border-bottom: 1px dashed var(--rule);
}
.ctx-crumb {
  padding: 2px 7px;
  border: 1px solid var(--rule-2);
  border-radius: 2px;
  background: none;
  color: var(--ink-3);
  font-size: 11.5px;
  font-weight: 700;
}
.ctx-name {
  font-size: 15px;
  font-weight: 900;
  color: var(--ink);
}
.ctx-diag-link {
  margin-left: auto;
  padding: 4px 10px;
  border: 1px solid var(--ink);
  border-radius: var(--r);
  background: var(--c);
  color: #ffffff;
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
  box-shadow: 2px 2px 0 var(--ink);
}
.ctx-diag-link:hover {
  background: var(--c);
  color: #ffffff;
  transform: translate(-1px, -1px);
  box-shadow: 3px 3px 0 var(--ink);
}
.depth {
  display: flex;
  align-items: center;
  gap: 10px;
}
.depth-label {
  color: var(--ink-3);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
}
.graph-toolbar .seg {
  display: flex;
  gap: 0;
  padding: 0;
  border: 1px solid var(--ink);
  border-radius: var(--r);
  background: var(--card);
  overflow: hidden;
}
.graph-toolbar .seg button,
.graph-toolbar .seg button:first-child,
.graph-toolbar .seg button:last-child {
  min-height: 32px;
  margin: 0;
  padding: 0 13px;
  border: none;
  border-right: 1px solid var(--rule);
  border-radius: 0;
  background: transparent;
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 700;
  box-shadow: none;
}
.graph-toolbar .seg button:last-child {
  border-right: none;
}
.graph-toolbar .seg button:hover:not(.on) {
  background: var(--paper-2);
  color: var(--ink);
}
.graph-toolbar .seg button.on,
.graph-toolbar .seg button.on:hover,
.depth button.on {
  background: var(--ink);
  color: #ffffff;
  box-shadow: none;
}
.zoom-tools {
  display: flex;
  gap: 0;
  border: 1px solid var(--ink);
  border-radius: var(--r);
  overflow: hidden;
}
.zoom-tools .zoom-ico {
  display: block;
  width: 16px;
  height: 16px;
}
.graph-toolbar .zoom-tools button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 0 11px;
  border: none;
  border-right: 1px solid var(--rule);
  border-radius: 0;
  background: var(--card);
  color: var(--ink-2);
  font-size: 12.5px;
  font-weight: 700;
}
.graph-toolbar .zoom-tools button:last-child {
  border-right: none;
}
.graph-toolbar .zoom-tools button:hover {
  background: var(--paper-2);
  color: var(--ink);
}
.graph-fold {
  border-bottom: 1px solid var(--rule);
  background: var(--warn-bg);
}

.graph-empty {
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 32px 24px;
  text-align: center;
}
.graph-empty > * {
  max-width: 440px;
}
.graph-empty::before {
  content: "";
  width: 132px;
  height: 92px;
  margin-bottom: 4px;
  background: url("icons/empty-graph.svg") center / contain no-repeat;
  animation: ink-bob 4s ease-in-out infinite;
}
@keyframes ink-bob {
  50% { transform: translateY(-5px); }
}
.graph-empty p:first-of-type {
  margin: 0;
  color: var(--ink);
  font-size: 16px;
  font-weight: 800;
  line-height: 1.6;
}
.graph-empty .muted {
  margin: 0;
  font-size: 13px;
  line-height: 1.75;
}
.graph-empty #pick-sample {
  width: auto;
  min-height: 44px;
  margin-top: 8px;
  padding: 0 22px;
  font-size: 14px;
}
.legend {
  margin: 0;
  padding: 9px 14px;
  border: none;
  border-top: 1px solid var(--ink);
  border-radius: 0;
  background: var(--card);
  color: var(--ink-3);
  font-size: 12.5px;
}
.swatch {
  border-radius: 2px;
}
.graph-meta {
  padding: 6px 14px 10px;
  background: var(--card);
  color: var(--ink-3);
  font-size: 12.5px;
}
.node-tip {
  border: 1px solid var(--ink);
  border-radius: var(--r);
  background: var(--card);
  color: var(--ink);
  box-shadow: var(--hard);
}

/* Detail inspector */
.detail {
  padding: 22px 20px 28px;
  background: var(--card);
  border-left: 1px solid var(--ink);
}
.detail h1,
.detail-title {
  font-size: 24px;
  font-weight: 900;
  line-height: 1.3;
  letter-spacing: -0.02em;
}
.detail h2 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 24px 0 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--rule);
  font-size: 14px;
  font-weight: 900;
  letter-spacing: 0.04em;
}
.detail h2::before {
  content: "";
  width: 8px;
  height: 8px;
  background: var(--c);
}
.detail-empty h1 {
  font-size: 22px;
}
.pill {
  min-height: 24px;
  padding: 1px 8px;
  border-radius: 2px;
  font-size: 12px;
}
.pill-p { background: var(--node-primary-bg); color: var(--stage-p); }
.pill-j { background: var(--node-junior-bg); color: var(--stage-j); }
.pill-h { background: var(--node-senior-bg); color: var(--stage-h); }
.id-code {
  color: var(--ink-4);
  font-size: 12px;
}
.meta-grid {
  gap: 0;
  border: 1px solid var(--rule);
  border-radius: var(--r);
  overflow: hidden;
}
.meta-grid div {
  padding: 9px 12px;
  border-radius: 0;
  background: var(--card);
  border-right: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}
.meta-grid div:nth-child(2n) {
  border-right: none;
}
.meta-grid dt {
  color: var(--ink-4);
  font-size: 11.5px;
  font-weight: 700;
}
.meta-grid dd {
  font-size: 14px;
}
.std,
.sample-q {
  border: 1px solid var(--rule);
  border-left: 3px solid var(--c);
  border-radius: var(--r);
  background: var(--paper);
}
.rel-row {
  min-height: 0;
  padding: 10px 12px;
  border: 1px solid var(--rule);
  border-radius: var(--r);
  background: var(--card);
}
.rel-row:hover {
  border-color: var(--ink);
  background: var(--c-tint);
}
.rel-name {
  color: var(--ink);
}
.rel-row:hover .rel-name {
  color: var(--c-strong);
}
.copy-link-btn {
  border: 1px solid var(--ink);
  border-radius: var(--r);
  background: var(--card);
  font-size: 12.5px;
  font-weight: 700;
}
.alias-note {
  border-left: 3px solid var(--warn);
  border-radius: var(--r);
}

/* ==========================================================================
   6. DIAGNOSE
   ========================================================================== */
main#root {
  width: min(1240px, 100%) !important;
  max-width: 1240px !important;
  margin: 0 auto;
  padding: 32px clamp(16px, 3vw, 40px) 72px;
}
.diag-workbench-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(330px, 0.85fr);
  gap: 24px;
  align-items: start;
}
.diag-col-side {
  position: sticky;
  top: calc(var(--header-h) + 16px);
  display: flex;
  flex-direction: column;
  gap: 18px;
}
main#root .card,
.card {
  margin: 0 0 18px;
  padding: clamp(20px, 2.4vw, 30px);
  border: 1px solid var(--ink);
  border-radius: var(--r);
  background: var(--card);
  box-shadow: none;
}
.diag-col-side .card {
  margin-bottom: 0;
}
.diag-target-card {
  box-shadow: var(--hard-lg) !important;
}
.diag-target-card,
#grade-card {
  border-top: 1px solid var(--ink) !important;
}
#grade-card {
  background: var(--paper);
}
.card h1,
.card h2 {
  margin: 0 0 10px;
  font-size: 24px;
  font-weight: 900;
  letter-spacing: -0.02em;
}
.card h3 {
  font-size: 16px;
  font-weight: 800;
}
.diag-card-kicker {
  margin-bottom: 10px;
}
.diag-meta-card {
  background: var(--paper) !important;
  border-style: dashed !important;
  border-color: var(--rule-2) !important;
}
.diag-meta-card strong {
  display: block;
  font-size: 15px;
}
.diag-rule-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  margin: 18px 0 20px;
  padding: 0;
  border: 1px solid var(--ink);
  border-radius: var(--r);
  background: var(--card);
}
.rule-pill {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-right: 1px solid var(--rule);
  color: var(--ink-2);
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.55;
}
.rule-pill:last-child {
  border-right: none;
}
.rule-pill b {
  display: grid;
  place-items: center;
  flex: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--ink);
  color: #ffffff;
  font-family: var(--font-num);
  font-size: 12px;
}
.rule-pill:first-child b {
  background: var(--c);
}
main#root .stage-tabs {
  margin-bottom: 12px;
}
main#root .search-lg,
.search-lg {
  height: 52px;
  min-height: 52px;
  padding: 0 16px;
  border: 2px solid var(--ink);
  border-radius: var(--r);
  background: var(--card);
  font-size: 15px;
  font-weight: 600;
}
main#root .search-lg:focus {
  background: var(--card);
  border-color: var(--ink);
  box-shadow: 4px 4px 0 var(--c);
}
.diag-settings-row {
  gap: 10px 18px;
  margin-top: 14px;
  padding: 14px 0 0;
  border-top: 1px dashed var(--rule-2);
}
.diag-settings-row label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--ink-2);
  font-size: 13.5px;
  font-weight: 700;
}
.diag-settings-row input,
.diag-settings-row select {
  width: auto;
  min-height: 38px;
}
#limit-input {
  width: 74px;
}
main#root .chapter-browser,
.chapter-browser {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--ink);
}
.chapter-browser > summary {
  font-size: 15px;
  font-weight: 900;
}
main#root .vol,
.vol {
  margin: 8px 0;
  border: 1px solid var(--rule-2);
  border-radius: var(--r);
  background: var(--card);
  overflow: hidden;
}
main#root .vol > summary {
  padding: 11px 14px;
  border-radius: 0;
  background: var(--paper);
  font-size: 14.5px;
  font-weight: 800;
}
main#root .vol[open] > summary {
  border-bottom: 1px solid var(--rule-2);
  box-shadow: inset 4px 0 0 var(--c);
}
.chap-head {
  padding: 10px 6px;
  border-bottom: 1px solid var(--rule);
  font-size: 14px;
}
main#root .topic-row,
.topic-row {
  padding: 8px 6px 8px 14px;
  border-radius: 0;
  border-bottom: 1px solid var(--rule);
}
main#root .topic-row:hover {
  background: var(--c-tint);
}
.topic-row .nm {
  font-size: 14.5px;
}
main#root .topic-row button,
main#root .chap-head button {
  min-height: 34px;
  padding: 0 12px;
  font-size: 12.5px;
}

.banner {
  padding: 14px 16px;
  border: 1px solid var(--ink);
  border-left: 6px solid var(--c);
  border-radius: var(--r);
  background: var(--card);
}
.banner.demo {
  border-left-color: var(--warn);
  background: var(--warn-bg);
}
main a:not([class]) {
  color: var(--ink);
  font-weight: 700;
  text-decoration: underline;
  text-decoration-color: var(--c);
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}
main a:not([class]):hover {
  color: var(--c-strong);
}

/* Question */
.progress {
  height: 6px;
  border-radius: 0;
  background: var(--paper-3);
}
.progress > i {
  border-radius: 0;
  background: var(--c);
}
.q-title {
  font-size: 24px;
  font-weight: 900;
}
.q-text {
  padding: 20px 22px;
  border: 1px solid var(--rule);
  border-left: 4px solid var(--ink);
  border-radius: var(--r);
  background: var(--paper);
  font-size: 18px;
  line-height: 1.75;
}
.choices {
  gap: 10px;
}
button.choice,
main#root button.choice {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 54px;
  padding: 12px 16px;
  border: 1px solid var(--ink);
  border-radius: var(--r);
  background: var(--card);
  font-size: 16px;
  font-weight: 600;
  text-align: left;
}
button.choice:hover:not(:disabled) {
  background: var(--c-tint);
  transform: translate(-1px, -1px);
  box-shadow: var(--hard);
}
button.choice.picked {
  border-color: var(--ink);
  background: var(--c-soft);
  box-shadow: inset 0 0 0 2px var(--c);
}
.choice-key {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 28px;
  height: 28px;
  border: 1px solid var(--ink);
  border-radius: 2px;
  background: var(--paper);
  font-family: var(--font-num);
  font-size: 13px;
  font-weight: 700;
}
button.choice:hover .choice-key,
button.choice.picked .choice-key {
  background: var(--ink);
  color: #ffffff;
}
button.good {
  background: var(--ok);
  border-color: var(--ink);
  color: #ffffff;
}
button.bad {
  background: var(--bad);
  border-color: var(--ink);
  color: #ffffff;
}
.verdict,
.notice,
.refans,
.explain {
  border-radius: var(--r);
}
.verdict.ok { border: 1px solid var(--ok); }
.verdict.no { border: 1px solid var(--bad); }
.explain {
  border-left-color: var(--ink);
  background: var(--paper);
}

/* Results */
main#root #summary {
  border-top: 6px solid var(--ink) !important;
}
.stats {
  gap: 0;
  border: 1px solid var(--ink);
  border-radius: var(--r);
  overflow: hidden;
}
.stat {
  padding: 14px 10px;
  border-radius: 0;
  border-right: 1px solid var(--rule);
}
.stat:last-child {
  border-right: none;
}
.stat b {
  font-size: 30px;
  font-weight: 700;
}
.tag {
  border-radius: 2px;
}
.tag.diff-challenge,
.tag.diff-advanced {
  background: var(--node-senior-bg);
  color: var(--stage-h);
}
.chap-bar {
  height: 8px;
  border-radius: 0;
}
ol.path > li::before {
  font-family: var(--font-num);
}
.share-panel {
  border: 1px solid var(--ink);
  border-radius: var(--r);
  box-shadow: var(--hard-lg);
}

/* ==========================================================================
   7. CHILDREN
   ========================================================================== */
body.page-kids main.kids,
.kids {
  width: min(1180px, 100%);
  max-width: 1180px !important;
  margin: 0 auto;
  padding: 36px clamp(16px, 3vw, 40px) 72px;
}
.kids-header {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 26px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--ink);
}
.kids-header h1,
.kids h1 {
  margin: 0 0 6px;
  font-size: clamp(28px, 3.4vw, 40px);
  font-weight: 900;
  letter-spacing: -0.03em;
}
.kids .lede {
  margin: 0;
  font-size: 15px;
}
.kids-subnav {
  display: flex;
  gap: 8px;
}
.kids-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(300px, 1fr);
  gap: 24px;
  align-items: start;
}
.kid-card,
.kid-form,
.kid-backup,
.kid-section > .rec,
.kid-empty-card,
.rec {
  border: 1px solid var(--ink);
  border-radius: var(--r);
  background: var(--card);
  box-shadow: none;
}
.kid-card {
  border-top: 1px solid var(--ink);
}
.kid-card.is-current {
  border-left: 6px solid var(--c);
  box-shadow: var(--hard);
}
.kid-avatar {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 2px;
  background: var(--ink);
  color: #ffffff;
  font-weight: 800;
}
.kid-badge {
  border-radius: 2px;
  background: var(--c);
}
.kid-form,
.kid-backup {
  padding: 22px;
}
.kid-backup {
  background: var(--paper);
}
.kid-empty {
  border: 1px dashed var(--rule-2);
  border-radius: var(--r);
  background: var(--paper);
}
.kid-tag {
  border-radius: 2px;
}
.wk-name {
  color: var(--ink);
}
.rec > summary:hover {
  background: var(--c-tint);
}

/* ==========================================================================
   8. PWA INSTALL TOAST
   ========================================================================== */
.pwa-bar {
  left: auto;
  right: 20px;
  bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  max-width: 340px;
  margin: 0;
  padding: 14px;
  gap: 10px 12px;
  background: var(--card);
  border: 1px solid var(--ink);
  border-radius: var(--r);
  box-shadow: var(--hard-lg);
  animation: ink-toast 0.4s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
.pwa-bar-icon {
  width: 36px;
  height: 36px;
  border-radius: 2px;
}
.pwa-bar-text b {
  font-size: 14px;
}
.pwa-bar-text span {
  font-size: 12px;
  line-height: 1.5;
}
.pwa-bar-actions button {
  min-height: 34px;
  padding: 0 12px;
  font-size: 13px;
}
.pwa-bar button.primary,
.pwa-sheet-actions button.primary {
  background: var(--c) !important;
  border-color: var(--ink) !important;
  color: #ffffff !important;
}
.pwa-sheet {
  border: 1px solid var(--ink);
  border-radius: var(--r);
}
.pwa-footer-link {
  color: var(--ink);
}
@keyframes ink-toast {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}

/* ==========================================================================
   9. MOTION: one orchestrated page-load reveal
   ========================================================================== */
@keyframes ink-rise {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: none; }
}
@keyframes ink-draw {
  from { transform: scaleY(0); }
  to { transform: scaleY(1); }
}
.hero-copy > *,
.path-preview,
.data-strip,
.diag-workbench-grid > *,
.kids-header,
.kids-grid > * {
  animation: ink-rise 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
.hero-copy > :nth-child(2) { animation-delay: 0.05s; }
.hero-copy > :nth-child(3) { animation-delay: 0.1s; }
.hero-copy > :nth-child(4) { animation-delay: 0.15s; }
.hero-copy > :nth-child(5) { animation-delay: 0.2s; }
.hero-copy > :nth-child(n+6) { animation-delay: 0.25s; }
.path-preview { animation-delay: 0.18s; }
.data-strip { animation-delay: 0.3s; }
.diag-workbench-grid > :nth-child(2),
.kids-grid > :nth-child(2) { animation-delay: 0.1s; }
.path-node:not(:last-child)::after {
  transform-origin: top;
  animation: ink-draw 0.5s ease-out both;
}
.path-node:nth-child(1)::after { animation-delay: 0.35s; }
.path-node:nth-child(2)::after { animation-delay: 0.6s; }
.path-node:nth-child(3)::after { animation-delay: 0.85s; }
.path-node:nth-child(4)::after { animation-delay: 1.1s; }

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-delay: 0s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@media print {
  .site-header,
  .pwa-bar {
    display: none !important;
  }
  body {
    background: #ffffff !important;
  }
  main#root .card,
  .card,
  .diag-target-card {
    box-shadow: none !important;
  }
}

/* ==========================================================================
   10. RESPONSIVE
   ========================================================================== */
@media (max-width: 1080px) {
  .hero,
  .hero.workbench-console,
  .diag-workbench-grid,
  .kids-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .path-preview {
    max-width: 560px;
  }
  .diag-col-side {
    position: static;
  }
  .explore {
    grid-template-columns: 260px minmax(0, 1fr) 320px;
  }
}

@media (max-width: 900px) {
  .workbench-modes {
    grid-template-columns: minmax(0, 1fr);
  }
  .mode-card {
    min-height: 0;
    border-right: none;
    border-bottom: 1px solid var(--ink);
  }
  .mode-card:last-child {
    border-bottom: none;
  }
  .steps {
    grid-template-columns: minmax(0, 1fr);
    gap: 22px;
  }
  .steps li {
    flex-direction: row;
    margin: 0;
    padding: 0 0 22px;
    border-right: none;
    border-bottom: 1px solid var(--rule);
  }
  .steps li:last-child {
    padding-bottom: 0;
    border-bottom: none;
  }
  .step-no {
    flex: none;
  }
  .side {
    border-right: none;
  }
  .detail {
    border-left: none;
    border-top: 1px solid var(--ink);
  }
}

@media (max-width: 780px) {
  :root {
    --header-h: 0px;
  }
  .site-header,
  body:not(.page-explore) .site-header {
    position: static;
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "brand"
      "pages"
      "subjects";
    padding: 0 14px;
  }
  .brand {
    min-height: 56px;
  }
  .brand-kicker {
    display: none;
  }
  .page-links {
    justify-self: stretch;
    margin: 0 -14px;
    padding: 0 6px;
    border-top: 1px solid var(--rule);
    overflow-x: auto;
    scrollbar-width: none;
  }
  .page-links::-webkit-scrollbar {
    height: 0;
  }
  .page-links .nav-link {
    flex: none;
    min-height: 44px;
    padding: 0 10px;
    font-size: 13.5px;
    white-space: nowrap;
  }
  .page-links .nav-link::after {
    left: 10px;
    right: 10px;
  }
  .subject-switch {
    margin: 0 -14px;
    padding: 0;
  }
  .subject-switch .subject-link {
    min-height: 40px;
    padding: 0 12px;
    font-size: 13px;
    white-space: nowrap;
  }
  .subject-switch .subject-link:first-child {
    border-left: none;
  }

  .hero,
  .hero.workbench-console {
    padding: 28px 0;
  }
  .hero h1 {
    font-size: 28px;
  }
  .hero .lede,
  .lede {
    font-size: 15px;
  }
  .home-search-kbd {
    display: none;
  }
  #home-search {
    height: 52px;
    font-size: 15px;
  }
  .home-search-item {
    flex-direction: column;
    align-items: stretch;
  }
  .hero-actions .btn {
    flex: 1 1 100%;
  }
  .path-footer {
    flex-direction: column;
    align-items: stretch;
  }
  .path-demo-btn {
    text-align: center;
  }
  .data-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .data-strip .stat-card:nth-child(2) {
    border-right: none;
  }
  .data-strip .stat-card:nth-child(-n+2) {
    border-bottom: 1px solid var(--rule);
  }
  .data-strip .stat-card {
    padding: 16px 14px;
  }
  .modes-section,
  .grade-section,
  .workbench-overview,
  .blind-home,
  .learning-note {
    margin-top: 48px;
  }
  .section-heading {
    grid-template-columns: auto minmax(0, 1fr);
  }
  .section-heading .grade-filters {
    grid-column: 1 / -1;
  }
  .section-no {
    font-size: 48px;
  }
  .section-heading h2 {
    font-size: 22px;
  }
  .grade-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
  .home-chapter-panel {
    padding: 16px;
    box-shadow: var(--hard);
  }
  .diag-rule-strip {
    grid-template-columns: minmax(0, 1fr);
  }
  .rule-pill {
    border-right: none;
    border-bottom: 1px solid var(--rule);
  }
  .rule-pill:last-child {
    border-bottom: none;
  }
  main#root {
    padding-top: 20px;
  }
  .diag-target-card {
    box-shadow: var(--hard) !important;
  }
  .kids-subnav {
    width: 100%;
  }
  .kids-subnav .btn {
    flex: 1;
  }

  .pwa-bar {
    left: 10px;
    right: 10px;
    bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    max-width: none;
    flex-wrap: nowrap;
    padding: 10px 12px;
  }
  .pwa-bar-text {
    flex: 1 1 auto;
  }
  .pwa-bar-text span {
    display: none;
  }
  .pwa-bar-actions {
    flex: none;
    gap: 6px;
  }
}

@media (max-width: 640px) {
  .graph-toolbar {
    flex-wrap: nowrap;
    padding: 8px 10px;
    overflow-x: auto;
  }
  .graph-context-bar {
    display: none;
  }
  .graph-toolbar .depth-label {
    display: none;
  }
  .graph-toolbar .seg button,
  .graph-toolbar .seg button:first-child,
  .graph-toolbar .seg button:last-child {
    min-height: 36px;
    padding: 0 11px;
  }
  .zoom-tools {
    margin-left: auto;
  }
  .graph-toolbar .zoom-tools button {
    justify-content: center;
    width: 38px;
    min-width: 38px;
    min-height: 36px;
    padding: 0;
  }
  .zoom-label {
    display: none;
  }
  .grade-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}
