:root {
  color-scheme: light;
  --paper: #f5f2ea;
  --surface: #fffdf7;
  --surface-strong: #ffffff;
  --ink: #20231f;
  --muted: #6d7169;
  --line: #d9d5ca;
  --accent: #1746a2;
  --accent-soft: #e7eefc;
  --cyan: #057e87;
  --green: #2b6c45;
  --green-soft: #e3f2e8;
  --amber: #91610c;
  --amber-soft: #fff2d2;
  --violet: #6e3ca3;
  --violet-soft: #f0e7fa;
  --red: #a43d37;
  --shadow: 0 16px 48px rgba(28, 31, 26, 0.08);
  --sidebar-width: 322px;
  --content-width: 820px;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #151815;
  --surface: #1d211d;
  --surface-strong: #242924;
  --ink: #edf1e9;
  --muted: #adb5aa;
  --line: #394038;
  --accent: #88aaff;
  --accent-soft: #253354;
  --cyan: #65cbd0;
  --green: #8ed4a9;
  --green-soft: #213b2b;
  --amber: #f0c66f;
  --amber-soft: #493a1d;
  --violet: #c9a2ef;
  --violet-soft: #3b2c4d;
  --red: #ef918b;
  --shadow: 0 16px 48px rgba(0, 0, 0, 0.28);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--paper); color: var(--ink); line-height: 1.72; }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
button, input, select, textarea { font: inherit; }
code { font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace; font-size: 0.9em; }

.topbar {
  position: sticky; top: 0; z-index: 30; height: 58px; display: flex; align-items: center; gap: 16px;
  padding: 0 22px; border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(14px);
}
.brand { display: flex; align-items: center; gap: 11px; color: var(--ink); font-weight: 800; text-decoration: none; letter-spacing: -0.02em; }
.brand-mark { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 8px; color: white; background: linear-gradient(135deg, var(--accent), var(--cyan)); font-size: 13px; }
.topbar-meta { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-actions { margin-left: auto; display: flex; gap: 8px; }
.icon-button { min-width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); cursor: pointer; }
.language-switch { display: inline-flex; align-items: center; height: 38px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); font-size: 13px; font-weight: 700; text-decoration: none; }
.language-switch:hover { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.nav-toggle { display: none; }

.layout { display: grid; grid-template-columns: var(--sidebar-width) minmax(0, 1fr); min-height: calc(100vh - 58px); }
.sidebar { position: sticky; top: 58px; align-self: start; height: calc(100vh - 58px); overflow: auto; border-right: 1px solid var(--line); background: var(--surface); padding: 18px 14px 34px; }
.filter { width: 100%; padding: 10px 12px; border: 1px solid var(--line); background: var(--surface-strong); color: var(--ink); border-radius: 10px; margin-bottom: 14px; }
.part-title { margin: 20px 9px 8px; color: var(--muted); font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; }
.chapter-link { display: grid; grid-template-columns: 30px 1fr 8px; align-items: center; gap: 7px; padding: 8px 9px; margin: 2px 0; border-radius: 9px; color: var(--muted); text-decoration: none; font-size: 13px; line-height: 1.35; }
.chapter-link:hover { color: var(--ink); background: var(--paper); }
.chapter-link.current { color: var(--accent); background: var(--accent-soft); font-weight: 650; }
.chapter-number { font-family: "SFMono-Regular", Consolas, monospace; font-size: 11px; opacity: 0.72; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--line); }
.status-dot.drafting { background: var(--amber); }
.status-dot.verified { background: var(--green); }

.main { min-width: 0; }
.page-shell { max-width: 1180px; margin: 0 auto; padding: 46px 34px 80px; display: grid; grid-template-columns: minmax(0, var(--content-width)) 220px; gap: 54px; justify-content: center; }
.article { min-width: 0; }
.page-kicker { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; margin-bottom: 9px; }
h1 { font-family: ui-serif, Georgia, "Noto Serif SC", serif; font-size: clamp(34px, 5vw, 58px); line-height: 1.08; letter-spacing: -0.035em; margin: 0 0 14px; }
.subtitle { font-size: 19px; color: var(--muted); margin: 0 0 26px; max-width: 690px; }
.page-meta { display: flex; flex-wrap: wrap; gap: 10px 20px; padding-bottom: 28px; margin-bottom: 36px; border-bottom: 1px solid var(--line); font-size: 13px; color: var(--muted); }
.status { display: inline-flex; align-items: center; border-radius: 99px; padding: 2px 9px; font-size: 12px; font-weight: 700; }
.status.queued { background: color-mix(in srgb, var(--muted) 13%, transparent); color: var(--muted); }
.status.drafting { background: var(--amber-soft); color: var(--amber); }
.status.verified { background: var(--green-soft); color: var(--green); }

section { margin: 46px 0; }
section:first-of-type { margin-top: 0; }
h2 { font-family: ui-serif, Georgia, "Noto Serif SC", serif; font-size: 29px; line-height: 1.25; margin: 0 0 17px; letter-spacing: -0.02em; }
h3 { font-size: 18px; line-height: 1.4; margin: 24px 0 8px; }
p { margin: 12px 0; }
.lede { font-size: 19px; color: var(--muted); max-width: 720px; }
.eyebrow { color: var(--cyan); text-transform: uppercase; font-size: 12px; font-weight: 800; letter-spacing: 0.13em; }
.hero-panel { padding: 30px; border: 1px solid var(--line); border-radius: 20px; background: linear-gradient(145deg, var(--surface-strong), var(--accent-soft)); box-shadow: var(--shadow); }
.hero-panel h2 { font-size: clamp(28px, 4vw, 42px); }
.baseline-card { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-top: 24px; padding-top: 17px; border-top: 1px solid color-mix(in srgb, var(--accent) 20%, var(--line)); font-size: 12px; }
.baseline-card code { padding: 4px 8px; border-radius: 6px; background: color-mix(in srgb, var(--surface) 70%, transparent); overflow-wrap: anywhere; }

.question-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.question-grid article { border: 1px solid var(--line); border-radius: 14px; padding: 17px; background: var(--surface); }
.question-grid h3 { margin-top: 0; }
.question-grid p { color: var(--muted); font-size: 14px; }

.claim { position: relative; margin: 18px 0; padding: 18px 20px 18px 22px; border: 1px solid var(--line); border-left-width: 4px; border-radius: 12px; background: var(--surface); }
.claim.fact { border-left-color: var(--green); }
.claim.inference { border-left-color: var(--violet); }
.claim.assessment { border-left-color: var(--amber); }
.claim-label { color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; }
.claim.fact .claim-label { color: var(--green); }
.claim.inference .claim-label { color: var(--violet); }
.claim.assessment .claim-label { color: var(--amber); }
.evidence { display: inline-flex; margin-left: 5px; padding: 0 5px; border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--line)); border-radius: 5px; font-size: 11px; font-weight: 750; text-decoration: none; vertical-align: 1px; }

.reading-path, .audit-list { padding-left: 24px; }
.reading-path li, .audit-list li { margin: 9px 0; padding-left: 5px; }
.evidence-ladder { display: grid; gap: 10px; }
.evidence-ladder > div { display: grid; grid-template-columns: 36px 1fr; column-gap: 12px; padding: 13px 15px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.evidence-ladder span { grid-row: 1 / span 2; width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%; color: white; background: var(--accent); font-weight: 800; }
.evidence-ladder h3, .evidence-ladder p { margin: 0; }
.evidence-ladder p { color: var(--muted); font-size: 14px; }
.thesis { padding: 25px; border-radius: 18px; color: var(--ink); background: var(--accent-soft); font-family: ui-serif, Georgia, "Noto Serif SC", serif; font-size: 23px; line-height: 1.55; }
.principle-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.principle-grid div { display: flex; justify-content: space-between; gap: 12px; padding: 13px 15px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
.principle-grid span { color: var(--accent); text-align: right; font-family: monospace; }
.caveat { margin-top: 20px; padding: 15px 17px; background: var(--amber-soft); border-radius: 11px; color: var(--amber); }
.atlas-summary { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 9px; margin: 20px 0; }
.atlas-summary div { padding: 13px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.atlas-summary strong { display: block; color: var(--accent); font-size: 25px; line-height: 1.1; }
.atlas-summary span { color: var(--muted); font-size: 11px; }
.package-group { margin: 10px 0; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); overflow: hidden; }
.package-group summary { display: flex; justify-content: space-between; gap: 14px; padding: 12px 15px; cursor: pointer; }
.package-group summary span { color: var(--muted); font-size: 12px; text-align: right; }
.index-group { margin: 10px 0; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); overflow: hidden; }
.index-group summary { padding: 12px 15px; cursor: pointer; font-weight: 700; }
.index-group summary:hover { color: var(--accent); background: color-mix(in srgb, var(--accent-soft) 45%, transparent); }
.index-group summary:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: -3px; }
.index-group[open] > summary { border-bottom: 1px solid var(--line); }
.index-group .table-scroll { max-height: min(70vh, 760px); overflow: auto; }
.index-group table { margin: 0; min-width: 920px; font-size: 12px; }
.index-group th { position: sticky; top: 0; z-index: 1; background: var(--surface-strong); }
.table-scroll { overflow-x: auto; }
.package-table { margin: 0; min-width: 1080px; font-size: 12px; }
.package-table td:first-child { min-width: 180px; }
.package-table td:nth-child(2) { min-width: 330px; }
.package-table td:nth-child(3) { min-width: 260px; }
.package-table small { display: block; color: var(--muted); overflow-wrap: anywhere; }
.dependency-list code { display: inline-block; margin: 2px 3px 2px 0; }

table { width: 100%; border-collapse: collapse; margin: 18px 0; font-size: 14px; }
th, td { text-align: left; vertical-align: top; padding: 11px 12px; border: 1px solid var(--line); }
th { background: var(--surface); }

.placeholder { padding: 28px; border: 1px dashed var(--line); border-radius: 16px; background: color-mix(in srgb, var(--surface) 65%, transparent); }
.placeholder strong { color: var(--amber); }
.placeholder-checks { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 18px; padding-left: 22px; }

.right-rail { position: sticky; top: 88px; align-self: start; max-height: calc(100vh - 110px); overflow: auto; }
.rail-title { margin: 0 0 9px; color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; }
.toc { display: grid; gap: 5px; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.toc a { color: var(--muted); font-size: 12px; line-height: 1.4; text-decoration: none; }
.toc a:hover { color: var(--accent); }
.toc .toc-sub { padding-left: 12px; }
.jump-label { display: block; margin-top: 18px; color: var(--muted); font-size: 11px; font-weight: 800; }
.jump-select { width: 100%; margin-top: 7px; padding: 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); font-size: 12px; }

.learning-notes { margin-top: 62px; padding: 24px; border: 1px solid var(--line); border-radius: 17px; background: var(--surface); }
.learning-notes h2 { margin-bottom: 5px; }
.learning-notes .privacy { color: var(--muted); font-size: 13px; }
.learning-notes textarea { width: 100%; min-height: 230px; resize: vertical; padding: 14px; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); background: var(--surface-strong); line-height: 1.65; }
.note-footer { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; margin-top: 10px; color: var(--muted); font-size: 12px; }
.note-footer button { padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-strong); color: var(--ink); cursor: pointer; }
.note-footer .danger { color: var(--red); }
.note-footer [data-note-count] { margin-left: auto; }

.pagination { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 30px; }
.pagination a, .pagination span { min-height: 88px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); text-decoration: none; }
.pagination .next { text-align: right; }
.pagination small { display: block; color: var(--muted); }
.pagination strong { color: var(--ink); }
.pagination .disabled { opacity: 0.45; }

.footer { padding: 26px 34px 50px; color: var(--muted); font-size: 12px; text-align: center; }

@media (max-width: 1050px) {
  .page-shell { grid-template-columns: minmax(0, var(--content-width)); }
  .right-rail { display: none; }
}

@media (max-width: 820px) {
  .topbar { padding: 0 12px; }
  .topbar-meta { display: none; }
  .nav-toggle { display: inline-grid; place-items: center; }
  .layout { display: block; }
  .sidebar { position: fixed; z-index: 25; top: 58px; left: 0; width: min(88vw, var(--sidebar-width)); transform: translateX(-102%); transition: transform 180ms ease; box-shadow: var(--shadow); }
  .sidebar.open { transform: translateX(0); }
  .page-shell { padding: 30px 18px 60px; }
  .question-grid, .principle-grid, .placeholder-checks, .atlas-summary { grid-template-columns: 1fr; }
  .hero-panel { padding: 21px; }
  .pagination { grid-template-columns: 1fr; }
  table { display: block; overflow-x: auto; }
  .index-group table { display: table; }
}

@media print {
  .topbar, .sidebar, .right-rail, .learning-notes, .pagination { display: none !important; }
  .layout, .page-shell { display: block; }
  .page-shell { max-width: none; padding: 0; }
  body { background: white; color: black; }
}
