/* ============================================================
   [KMA] Alliance Handbook — Last Asylum: Plague
   Ink-navy ground from the hero portraits, antitoxin-gold accent from the
   skill icons, cure-green for good news. Light theme is cool paper.
   ============================================================ */

:root {
  --bg: #f5f6fa;
  --bg-deep: #eceef4;
  --surface: #ffffff;
  --surface-2: #f0f2f7;
  --line: #e1e4ec;
  --line-strong: #c9cedb;
  --text: #151826;
  --text-soft: #3a3f52;
  --muted: #646a80;
  --accent: #9a5f0c;
  --accent-soft: rgba(196, 128, 20, 0.12);
  --accent-ink: #ffffff;
  --green: #17864f;
  --green-soft: rgba(23, 134, 79, 0.11);
  --red: #c93a3a;
  --red-soft: rgba(201, 58, 58, 0.10);
  --blue: #2463c7;
  --blue-soft: rgba(36, 99, 199, 0.10);
  --shadow: 0 1px 2px rgba(21, 24, 38, 0.06), 0 8px 24px rgba(21, 24, 38, 0.08);
  --shadow-sm: 0 1px 2px rgba(21, 24, 38, 0.06);
  --tier-s: #c93a3a;
  --tier-a: #9a5f0c;
  --tier-b: #17864f;
  --tier-c: #2463c7;
  --tier-d: #646a80;
  --tier-ink: #ffffff;
  --glow: rgba(196, 128, 20, 0.10);
  --font-display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --font-body: "Figtree", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --font-flourish: "Cormorant Garamond", Georgia, serif;
  --radius: 10px;
  --radius-sm: 6px;
  --side-w: 268px;
  --toc-w: 220px;
  --content-w: 760px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d0f17;
    --bg-deep: #090b12;
    --surface: #151826;
    --surface-2: #1c2032;
    --line: #262b40;
    --line-strong: #363c57;
    --text: #eceef5;
    --text-soft: #c4c8d6;
    --muted: #8d93a8;
    --accent: #f2b544;
    --accent-soft: rgba(242, 181, 68, 0.13);
    --accent-ink: #1a1203;
    --green: #4fd18b;
    --green-soft: rgba(79, 209, 139, 0.12);
    --red: #ff6b6b;
    --red-soft: rgba(255, 107, 107, 0.12);
    --blue: #6ea8ff;
    --blue-soft: rgba(110, 168, 255, 0.12);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 12px 32px rgba(0, 0, 0, 0.35);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
    --tier-s: #ff5d5d;
    --tier-a: #f2b544;
    --tier-b: #4fd18b;
    --tier-c: #6ea8ff;
    --tier-d: #8d93a8;
    --tier-ink: #0d0f17;
    --glow: rgba(242, 181, 68, 0.08);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0d0f17;
  --bg-deep: #090b12;
  --surface: #151826;
  --surface-2: #1c2032;
  --line: #262b40;
  --line-strong: #363c57;
  --text: #eceef5;
  --text-soft: #c4c8d6;
  --muted: #8d93a8;
  --accent: #f2b544;
  --accent-soft: rgba(242, 181, 68, 0.13);
  --accent-ink: #1a1203;
  --green: #4fd18b;
  --green-soft: rgba(79, 209, 139, 0.12);
  --red: #ff6b6b;
  --red-soft: rgba(255, 107, 107, 0.12);
  --blue: #6ea8ff;
  --blue-soft: rgba(110, 168, 255, 0.12);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 12px 32px rgba(0, 0, 0, 0.35);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
  --tier-s: #ff5d5d;
  --tier-a: #f2b544;
  --tier-b: #4fd18b;
  --tier-c: #6ea8ff;
  --tier-d: #8d93a8;
  --tier-ink: #0d0f17;
  --glow: rgba(242, 181, 68, 0.08);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } *, *::before, *::after { animation: none !important; transition: none !important; } }

body {
  margin: 0;
  background: radial-gradient(1200px 420px at 70% -120px, var(--glow), transparent 70%) no-repeat, var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16.5px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "ss01", "cv11";
  min-height: 100vh;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
button { font: inherit; color: inherit; }
img { max-width: 100%; }
code, pre, kbd { font-family: var(--font-mono); font-size: 0.86em; }
code { background: var(--surface-2); padding: 0.1em 0.4em; border-radius: 5px; font-size: 0.84em; }
pre { background: var(--surface-2); padding: 12px 14px; border-radius: var(--radius); overflow-x: auto; }
pre code { background: none; padding: 0; }
hr { border: 0; border-top: 1px solid var(--line); margin: 28px 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 12px;
  height: 58px; padding: 0 16px;
  background: color-mix(in srgb, var(--bg-deep) 92%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; min-width: 0; }
.brand:hover { text-decoration: none; }
.brand-tag {
  font-family: var(--font-display); font-weight: 800; font-size: 21px; letter-spacing: -0.01em;
  color: var(--accent); line-height: 1;
}
.brand-name { font-size: 13px; text-transform: uppercase; letter-spacing: 0.14em; color: var(--muted); white-space: nowrap; }
.topbar .spacer { flex: 1; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: var(--radius);
  border: 1px solid var(--line); background: var(--surface); cursor: pointer; color: var(--text-soft);
}
.icon-btn:hover { border-color: var(--line-strong); color: var(--text); }
.icon-btn svg { width: 18px; height: 18px; }
.search-wrap { position: relative; flex: 0 1 380px; min-width: 0; }
.search-wrap input {
  width: 100%; height: 38px; padding: 0 12px 0 36px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); color: var(--text); font: inherit; font-size: 15px;
}
.search-wrap input::placeholder { color: var(--muted); }
.search-wrap svg { position: absolute; left: 11px; top: 11px; width: 16px; height: 16px; color: var(--muted); pointer-events: none; }
.search-results {
  position: absolute; top: 44px; left: 0; right: 0; max-height: 70vh; overflow: auto;
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius);
  box-shadow: var(--shadow); z-index: 60; display: none;
}
.search-results.open { display: block; }
.search-results a { display: block; padding: 10px 12px; border-bottom: 1px solid var(--line); color: var(--text); }
.search-results a:last-child { border-bottom: 0; }
.search-results a:hover, .search-results a.active { background: var(--accent-soft); text-decoration: none; }
.search-results .r-title { font-weight: 700; }
.search-results .r-cat { font-size: 12px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); }
.search-results .r-snip { font-size: 14px; color: var(--text-soft); margin-top: 2px; }
.search-results .r-snip mark { background: var(--accent-soft); color: var(--accent); padding: 0 2px; border-radius: 2px; }
.search-results .r-empty { padding: 14px; color: var(--muted); }

/* ---------- layout ---------- */
.shell { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: calc(100vh - 58px); }
.sidebar {
  position: sticky; top: 58px; height: calc(100vh - 58px); overflow-y: auto;
  padding: 18px 14px 40px; border-right: 1px solid var(--line); background: var(--bg-deep);
}
.side-group { margin-bottom: 18px; }
.side-group h3 {
  margin: 0 0 6px 10px; font-family: var(--font-body); font-size: 11.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.14em; color: var(--muted);
}
.side-group a {
  display: flex; align-items: center; gap: 9px; padding: 7px 10px; border-radius: var(--radius);
  color: var(--text-soft); font-size: 15px; line-height: 1.3;
}
.side-group a:hover { background: var(--surface); color: var(--text); text-decoration: none; }
.side-group a.active { background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.side-group a .g-ico { width: 18px; height: 18px; flex: 0 0 18px; opacity: 0.85; }
.side-foot { margin: 10px 10px 0; font-size: 12.5px; color: var(--muted); line-height: 1.5; }

.main { min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr) var(--toc-w); }
.content { padding: 30px 40px 80px; max-width: calc(var(--content-w) + 80px); width: 100%; justify-self: center; min-width: 0; }
.toc-rail { position: sticky; top: 58px; height: calc(100vh - 58px); overflow-y: auto; padding: 30px 18px 30px 0; font-size: 13.5px; }
.toc-rail h4 { margin: 0 0 8px; font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.14em; color: var(--muted); font-weight: 700; }
.toc-rail ol { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--line); }
.toc-rail li a { display: block; padding: 4px 0 4px 12px; margin-left: -1px; border-left: 2px solid transparent; color: var(--text-soft); line-height: 1.35; }
.toc-rail li a:hover { color: var(--text); text-decoration: none; }
.toc-rail li a.active { color: var(--accent); border-left-color: var(--accent); }
.toc-rail li.h3 a { padding-left: 24px; font-size: 12.5px; color: var(--muted); }

/* ---------- article typography ---------- */
.eyebrow { font-size: 12px; text-transform: uppercase; letter-spacing: 0.16em; color: var(--muted); font-weight: 700; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.eyebrow .dot { width: 4px; height: 4px; border-radius: 50%; background: var(--line-strong); }
.article h1 {
  font-family: var(--font-display); font-weight: 750; font-size: clamp(30px, 4.4vw, 42px);
  line-height: 1.08; margin: 8px 0 10px; letter-spacing: -0.025em; text-wrap: balance;
}
.article .lede { font-size: 19px; color: var(--text-soft); margin: 0 0 8px; max-width: 62ch; }
.meta-row { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; margin: 10px 0 26px; padding-bottom: 18px; border-bottom: 1px solid var(--line); font-size: 13.5px; color: var(--muted); }
.meta-row .tag { display: inline-block; padding: 2px 9px; border: 0; background: var(--surface-2); border-radius: 999px; font-size: 12px; color: var(--text-soft); }
.updated { display: inline-flex; align-items: center; gap: 6px; }
.updated::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--green); }
.updated.stale::before { background: var(--accent); }

.article h2 {
  font-family: var(--font-display); font-weight: 700; font-size: 25px; line-height: 1.2; letter-spacing: -0.02em;
  margin: 44px 0 12px; padding-top: 18px; border-top: 1px solid var(--line); scroll-margin-top: 76px; text-wrap: balance;
}
.article h2:first-of-type { border-top: 0; padding-top: 0; margin-top: 26px; }
.article h3 { font-family: var(--font-display); font-weight: 650; font-size: 18.5px; letter-spacing: -0.01em; margin: 28px 0 8px; scroll-margin-top: 76px; }
.article h4 { font-size: 15px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin: 22px 0 6px; }
.article p { margin: 0 0 14px; max-width: 68ch; }
.article ul, .article ol { margin: 0 0 16px; padding-left: 24px; max-width: 68ch; }
.article li { margin-bottom: 5px; }
.article li > ul, .article li > ol { margin-top: 5px; margin-bottom: 4px; }
.article strong { color: var(--text); }
.article blockquote {
  margin: 18px 0; padding: 12px 16px 12px 18px; border-left: 3px solid var(--accent);
  background: var(--accent-soft); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; color: var(--text);
}
.article blockquote p { margin: 0; max-width: none; }
.article blockquote p + p { margin-top: 8px; }
.article blockquote.warn { border-left-color: var(--red); background: var(--red-soft); }
.article blockquote.good { border-left-color: var(--green); background: var(--green-soft); }
.article blockquote.info { border-left-color: var(--blue); background: var(--blue-soft); }
.article blockquote.kma { border-left-color: var(--accent); background: var(--surface-2); }
.article blockquote strong:first-child { text-transform: uppercase; letter-spacing: 0.1em; font-size: 11.5px; display: block; margin-bottom: 3px; }
.article blockquote.warn strong:first-child { color: var(--red); }
.article blockquote.good strong:first-child { color: var(--green); }
.article blockquote.info strong:first-child { color: var(--blue); }
.article blockquote strong:first-child:not(.warn):not(.good):not(.info) { color: var(--accent); }

.table-wrap { overflow-x: auto; margin: 16px 0 22px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm); }
.article table { border-collapse: collapse; width: 100%; font-size: 15px; font-variant-numeric: tabular-nums; }
.article th, .article td { padding: 8px 12px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
.article th { background: var(--surface-2); font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.09em; color: var(--muted); white-space: nowrap; }
.article tr:last-child td { border-bottom: 0; }
.article tbody tr:nth-child(even) td { background: color-mix(in srgb, var(--surface-2) 40%, transparent); }
.article tbody tr:hover td { background: var(--accent-soft); }

.tier { display: inline-block; min-width: 26px; text-align: center; padding: 1px 7px; border-radius: 6px; font-weight: 800; font-size: 12.5px; color: var(--tier-ink); font-family: var(--font-mono); }
.tier-S { background: var(--tier-s); } .tier-A { background: var(--tier-a); } .tier-B { background: var(--tier-b); } .tier-C { background: var(--tier-c); } .tier-D { background: var(--tier-d); }
.rar { font-family: var(--font-mono); font-size: 12.5px; font-weight: 700; letter-spacing: 0.04em; }
.rar-UR { color: var(--red); } .rar-SSR { color: var(--accent); } .rar-SR { color: var(--blue); } .rar-R { color: var(--muted); }

/* checklist */
.article input[type="checkbox"] { accent-color: var(--accent); width: 16px; height: 16px; margin-right: 6px; vertical-align: -2px; }
.article li.task { list-style: none; margin-left: -22px; }

/* prev/next */
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 48px; padding-top: 20px; border-top: 1px solid var(--line); }
.pager a { display: block; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius); color: var(--text); background: var(--surface); box-shadow: var(--shadow-sm); transition: border-color .15s, transform .15s, box-shadow .15s; }
.pager a:hover { border-color: var(--accent); text-decoration: none; transform: translateY(-1px); box-shadow: var(--shadow); }
.pager a span { display: block; font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--muted); margin-bottom: 2px; }
.pager a.next { text-align: right; }

/* ---------- home ---------- */
.hero { padding: 6px 0 22px; border-bottom: 1px solid var(--line); margin-bottom: 26px; }
.hero .kicker { font-size: 12.5px; text-transform: uppercase; letter-spacing: 0.18em; color: var(--accent); font-weight: 700; }
.hero h1 { font-family: var(--font-display); font-weight: 800; font-size: clamp(36px, 5.4vw, 56px); line-height: 1.02; letter-spacing: -0.035em; margin: 8px 0 12px; text-wrap: balance; }
.hero p { font-size: 18px; color: var(--text-soft); max-width: 58ch; margin: 0 0 18px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 10px 16px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--text); font-weight: 700; cursor: pointer; box-shadow: var(--shadow-sm); transition: border-color .15s, transform .15s, filter .15s; }
.btn:hover { text-decoration: none; border-color: var(--accent); transform: translateY(-1px); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.primary:hover { filter: brightness(1.06); }

.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); margin: 16px 0 28px; }
.card { display: block; padding: 16px 16px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); color: var(--text); box-shadow: var(--shadow-sm); transition: border-color .15s, transform .15s, box-shadow .15s; }
.card:hover { text-decoration: none; border-color: color-mix(in srgb, var(--accent) 60%, var(--line)); transform: translateY(-2px); box-shadow: var(--shadow); }
.card .c-ico { width: 24px; height: 24px; color: var(--accent); margin-bottom: 8px; }
.card h3 { margin: 0 0 4px; font-family: var(--font-display); font-size: 19px; font-weight: 700; line-height: 1.2; letter-spacing: -0.015em; }
.card p { margin: 0; font-size: 14.5px; color: var(--text-soft); }
.card .c-count { display: block; margin-top: 10px; font-size: 12px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--muted); }

.section-title { font-family: var(--font-display); font-size: 24px; font-weight: 750; letter-spacing: -0.02em; margin: 30px 0 4px; }
.section-sub { color: var(--muted); font-size: 14.5px; margin: 0 0 12px; }

.week { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin: 12px 0 24px; }
.day { padding: 12px 12px 10px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.day .d-name { font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.14em; color: var(--muted); font-weight: 700; }
.day .d-ev { font-family: var(--font-display); font-size: 17px; font-weight: 700; letter-spacing: -0.01em; line-height: 1.1; margin: 4px 0 4px; }
.day .d-do { font-size: 13.5px; color: var(--text-soft); }
.day.today { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent), 0 0 0 4px var(--glow); }
.day.today .d-name { color: var(--accent); }

.notice-list { list-style: none; padding: 0; margin: 0 0 24px; display: grid; gap: 8px; }
.notice-list li { padding: 10px 14px; background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: var(--radius); font-size: 15px; }
.notice-list li .n-date { font-family: var(--font-mono); font-size: 12px; color: var(--muted); margin-right: 8px; }

.stat-row { display: flex; flex-wrap: wrap; gap: 10px 24px; font-size: 13.5px; color: var(--muted); margin: -6px 0 14px; }
.stat-row b { color: var(--text); font-family: var(--font-mono); font-weight: 600; }

/* codes table quick-copy */
.copy-btn { font-size: 11.5px; padding: 2px 9px; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--surface); cursor: pointer; font-family: var(--font-mono); }
.copy-btn:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- live codes, countdown, time zones ---------- */
.codes-panel { margin: 4px 0 24px; }
.codes-meta { font-size: 13.5px; color: var(--muted); margin-bottom: 10px; }
.codes-meta b { color: var(--text); font-family: var(--font-mono); font-weight: 600; }
.codes-table code { font-size: 15px; font-weight: 600; }
.chip { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; vertical-align: middle; }
.chip-active { background: var(--green-soft); color: var(--green); }
.chip-disputed { background: var(--accent-soft); color: var(--accent); }
.chip-unconfirmed { background: var(--surface-2); color: var(--muted); }
.chip-expired { background: var(--red-soft); color: var(--red); }
.chip-new { background: var(--accent); color: var(--accent-ink); }
.muted { color: var(--muted); font-size: 12.5px; }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.notice-list li.auto { border-left-color: var(--green); }
.countdown { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 18px 0 8px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.cd-label { font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.14em; color: var(--muted); font-weight: 700; }
.cd-big { font-family: var(--font-display); font-size: 21px; font-weight: 700; letter-spacing: -0.015em; line-height: 1.15; margin-top: 2px; }
.cd-big.mono { font-family: var(--font-mono); font-size: 22px; font-weight: 600; }
.tz-clocks { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; margin: 10px 0 12px; }
.tz-clock { padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.tz-conv { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 18px; }
.tz-conv input, .tz-conv select, .section-sub select { font: inherit; padding: 5px 10px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); color: var(--text); }
.tz-conv b { font-size: 20px; }

/* ---------- footer ---------- */
.foot { margin-top: 60px; padding-top: 18px; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); line-height: 1.6; }

/* ---------- mobile ---------- */
.scrim { display: none; position: fixed; inset: 58px 0 0 0; background: rgba(0,0,0,0.5); z-index: 30; }
@media (max-width: 1100px) {
  .main { grid-template-columns: minmax(0, 1fr); }
  .toc-rail { display: none; }
  .toc-inline { display: block; }
}
@media (min-width: 1101px) { .toc-inline { display: none; } }
.toc-inline { margin: 0 0 22px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.toc-inline summary { cursor: pointer; padding: 10px 14px; font-size: 12.5px; text-transform: uppercase; letter-spacing: 0.14em; color: var(--muted); font-weight: 700; }
.toc-inline ol { margin: 0; padding: 0 14px 12px 30px; font-size: 15px; }
.toc-inline li.h3 { font-size: 14px; color: var(--muted); }

@media (max-width: 860px) {
  body { font-size: 16.5px; }
  .brand-name { display: none; }
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed; top: 58px; left: 0; bottom: 0; width: min(86vw, 320px); z-index: 35;
    transform: translateX(-102%); transition: transform 0.22s ease; box-shadow: var(--shadow);
  }
  body.nav-open .sidebar { transform: translateX(0); }
  body.nav-open .scrim { display: block; }
  .content { padding: 22px 18px 70px; }
  .search-wrap { flex: 1; }
  .pager { grid-template-columns: 1fr; }
  .article h2 { font-size: 26px; }
  .article table { font-size: 14px; }
  .article th, .article td { padding: 7px 9px; }
  .article table.wide { width: auto; min-width: 100%; }
  .article table.wide td, .article table.wide th { min-width: 96px; }
  .article table.wide td.long { min-width: 300px; }
  .brand-tag { font-size: 20px; }
  .icon-btn { width: 36px; flex: 0 0 36px; }
  .search-results { position: fixed; top: 60px; left: 10px; right: 10px; max-height: 65vh; }
}
@media (min-width: 861px) { .menu-btn { display: none; } }

@media print {
  .topbar, .sidebar, .toc-rail, .pager, .scrim, .toc-inline { display: none !important; }
  .shell, .main { display: block; }
  .content { max-width: none; padding: 0; }
  body { background: #fff; color: #000; }
}

/* ---------- figures, posters, flows ---------- */
.fig { margin: 18px 0 26px; padding: 14px 14px 10px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.fig { overflow-x: auto; }
.fig svg { width: 100%; min-width: 540px; height: auto; display: block; }
.fig figcaption { font-size: 13px; color: var(--muted); margin-top: 8px; line-height: 1.45; }
.fig-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.fig-pair figcaption { grid-column: 1 / -1; }
@media (max-width: 700px) { .fig-pair { grid-template-columns: 1fr; } }
.poster { margin: 18px 0 26px; padding: 18px 18px 14px; background: var(--bg-deep); border: 1px solid var(--line-strong); border-radius: var(--radius); }
.poster-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 16px; margin-bottom: 14px; }
.poster-title { font-family: var(--font-display); font-size: 30px; font-weight: 700; line-height: 1; }
.poster-sub { color: var(--muted); font-size: 13.5px; }
.poster-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.pd { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px 10px; display: flex; flex-direction: column; }
.pd-rest { border-style: dashed; }
.pd-top { display: flex; align-items: baseline; gap: 8px; }
.pd-num { font-family: var(--font-display); font-size: 34px; font-weight: 700; color: var(--accent); line-height: 1; }
.pd-day { font-size: 11px; text-transform: uppercase; letter-spacing: 0.14em; color: var(--muted); font-weight: 700; }
.pd-theme { font-family: var(--font-display); font-size: 21px; font-weight: 700; margin: 4px 0 6px; line-height: 1.1; }
.pd ul { margin: 0 0 8px; padding-left: 16px; font-size: 13px; flex: 1; }
.pd li { margin-bottom: 2px; }
.pd-big { font-family: var(--font-mono); font-size: 11.5px; color: var(--accent); border-top: 1px solid var(--line); padding-top: 6px; }
.poster-foot { margin-top: 12px; font-size: 13px; color: var(--muted); }
.strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; }
.strip-day { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; }
.strip-war { border-color: var(--red); background: var(--red-soft); }
.strip-t { font-weight: 700; font-size: 14px; margin: 4px 0 2px; }
.strip-d { font-size: 12.5px; color: var(--text-soft); }
.flow { display: flex; align-items: stretch; gap: 8px; margin: 16px 0 6px; overflow-x: auto; padding-bottom: 6px; }
.flow-wrap { flex-wrap: wrap; overflow: visible; }
.flow-step { flex: 1 1 150px; min-width: 150px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; }
.flow-hl { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.flow-n { font-family: var(--font-mono); font-size: 11px; color: var(--accent); font-weight: 700; }
.flow-t { font-family: var(--font-display); font-size: 21px; font-weight: 700; line-height: 1.1; margin: 2px 0 4px; }
.flow-d { font-size: 12.5px; color: var(--text-soft); }
.flow-arrow { align-self: center; color: var(--muted); font-size: 20px; flex: 0 0 auto; }
.flow-note { font-size: 13px; color: var(--text-soft); margin: 0 0 18px; }
