/* =========================================================
   拾魂商队 · GDD
   Editorial dark theme / ember & ash
   ========================================================= */

:root {
  --bg: #08090b;
  --bg-2: #0d0f13;
  --panel: #12151a;
  --panel-2: #171b21;
  --panel-3: #1d222a;
  --line: rgba(233, 228, 216, 0.11);
  --line-strong: rgba(233, 228, 216, 0.22);
  --text: #e9e4d8;
  --text-soft: #c9c4b9;
  --muted: #989b9f;
  --dim: #6c7077;
  --ember: #ff6b35;
  --ember-2: #ffa45b;
  --ember-3: #ffd0a3;
  --gold: #d9a441;
  --gold-2: #f0c36a;
  --blood: #d05245;
  --teal: #58b7a8;
  --violet: #a084c2;
  --serif: "Noto Serif SC", "Source Han Serif SC", "Songti SC", "STSong", "SimSun", serif;
  --sans: "Noto Sans SC", "Source Han Sans SC", "PingFang SC", "Microsoft YaHei", "Segoe UI", system-ui, sans-serif;
  --mono: "JetBrains Mono", "Cascadia Code", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --sidebar: 286px;
  --maxw: 1120px;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.45);
}

*,
*::before,
*::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }
body.menu-open { overflow: hidden; }
.chapter { scroll-margin-top: 72px; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.85;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(1100px 760px at 86% -8%, rgba(255, 107, 53, 0.14), transparent 62%),
    radial-gradient(900px 680px at -8% 22%, rgba(88, 183, 168, 0.055), transparent 62%),
    radial-gradient(900px 900px at 55% 115%, rgba(160, 132, 194, 0.05), transparent 65%),
    var(--bg);
}

::selection { background: rgba(255, 107, 53, 0.35); color: #fff; }

a { color: var(--ember-2); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

img, svg { max-width: 100%; }

h1, h2, h3, h4, h5 {
  font-family: var(--serif);
  color: var(--text);
  font-weight: 600;
  line-height: 1.28;
  margin: 0;
}

p { margin: 0 0 1em; }
p:last-child { margin-bottom: 0; }

code, .mono { font-family: var(--mono); font-size: 0.92em; }
code {
  color: var(--gold-2);
  background: rgba(217, 164, 65, 0.08);
  border: 1px solid rgba(217, 164, 65, 0.14);
  border-radius: 4px;
  padding: 0.05em 0.35em;
  overflow-wrap: anywhere;
}

hr { border: 0; border-top: 1px solid var(--line); margin: 28px 0; }

/* ---------- utility ---------- */

.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0);
  white-space: nowrap; border: 0;
}

.skip {
  position: fixed;
  left: 12px; top: -80px;
  z-index: 200;
  background: var(--ember);
  color: #160a05;
  padding: 10px 16px;
  border-radius: 8px;
  font-weight: 700;
  transition: top 0.2s ease;
}
.skip:focus { top: 12px; }

.grain {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.progress {
  position: fixed;
  inset: 0 0 auto 0;
  height: 2px;
  z-index: 120;
  background: linear-gradient(90deg, var(--ember), var(--gold-2), var(--teal));
  transform: scaleX(0);
  transform-origin: 0 50%;
  will-change: transform;
}

/* ---------- sidebar ---------- */

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 80;
  width: var(--sidebar);
  display: flex;
  flex-direction: column;
  padding: 26px 18px 18px;
  background:
    linear-gradient(180deg, rgba(255, 107, 53, 0.045), transparent 26%),
    linear-gradient(180deg, #0b0d10, #090a0c 60%);
  border-right: 1px solid var(--line);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #2a2f37 transparent;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 8px 22px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 18px;
}

.brand-mark {
  width: 38px; height: 38px;
  flex: 0 0 38px;
  border-radius: 10px;
  border: 1px solid rgba(255, 107, 53, 0.35);
  background: radial-gradient(circle at 50% 38%, rgba(255, 107, 53, 0.24), rgba(255, 107, 53, 0.03));
  display: grid;
  place-items: center;
  box-shadow: 0 0 24px rgba(255, 107, 53, 0.12);
}

.brand-mark svg { width: 24px; height: 24px; display: block; }

.brand-text { min-width: 0; }
.brand-text strong {
  display: block;
  font-family: var(--serif);
  font-size: 16px;
  letter-spacing: 0.08em;
  color: var(--text);
  white-space: nowrap;
}
.brand-text span {
  display: block;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.18em;
  color: var(--dim);
  margin-top: 2px;
  white-space: nowrap;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 1px;
  flex: 1;
}

.nav a {
  position: relative;
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 8px 10px 8px 12px;
  border-radius: 7px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
  text-decoration: none;
  transition: color 0.16s ease, background 0.16s ease;
}
.nav a::before {
  content: "";
  position: absolute;
  left: 0; top: 50%;
  width: 2px; height: 0;
  background: var(--ember);
  border-radius: 2px;
  transform: translateY(-50%);
  transition: height 0.16s ease;
}
.nav a .num {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--dim);
  min-width: 16px;
  letter-spacing: 0.04em;
}
.nav a:hover { color: var(--text); background: rgba(255, 255, 255, 0.035); }
.nav a.active { color: var(--text); background: rgba(255, 107, 53, 0.07); }
.nav a.active::before { height: 60%; }
.nav a.active .num { color: var(--ember); }

.side-foot {
  margin-top: 20px;
  padding: 16px 8px 2px;
  border-top: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 9.5px;
  line-height: 1.8;
  letter-spacing: 0.06em;
  color: var(--dim);
}
.side-foot strong { color: var(--muted); font-weight: 500; }

.scrim {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(2px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

/* ---------- topbar (mobile) ---------- */

.topbar {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 90;
  display: none;
  align-items: center;
  gap: 12px;
  height: 58px;
  padding: 0 16px;
  background: rgba(8, 9, 11, 0.82);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.menu-btn {
  display: grid;
  place-items: center;
  width: 38px; height: 38px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  cursor: pointer;
}
.menu-btn:hover { border-color: var(--line-strong); }

.topbar-title {
  flex: 1;
  min-width: 0;
  font-family: var(--serif);
  font-size: 13px;
  letter-spacing: 0.08em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-soft);
}

.print-btn {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  border-radius: 8px;
  padding: 7px 10px;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.08em;
  cursor: pointer;
}
.print-btn:hover { color: var(--text); border-color: var(--line-strong); }

/* ---------- main / hero ---------- */

main { margin-left: var(--sidebar); }

.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  padding: 82px clamp(22px, 5vw, 76px) 92px;
  overflow: hidden;
}

.hero::after {
  content: "";
  position: absolute;
  left: 8%; right: 8%; bottom: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--line-strong), transparent);
}

.hero-grid {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1.06fr) minmax(400px, 0.94fr);
  gap: clamp(36px, 5vw, 72px);
  align-items: center;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ember-2);
  margin-bottom: 20px;
}
.eyebrow::before {
  content: "";
  width: 26px; height: 1px;
  background: var(--ember);
  display: inline-block;
}

.hero h1 {
  font-size: clamp(58px, 8.4vw, 108px);
  line-height: 0.98;
  letter-spacing: 0.045em;
  margin: 0 0 16px;
  text-shadow: 0 0 60px rgba(255, 107, 53, 0.12);
}
.hero h1 .thin {
  display: block;
  font-family: var(--mono);
  font-size: clamp(10px, 1.1vw, 13px);
  letter-spacing: 0.42em;
  color: var(--dim);
  margin-top: 15px;
  font-weight: 400;
}

.hero-sub {
  font-family: var(--serif);
  font-size: clamp(19px, 2.2vw, 26px);
  color: var(--ember-3);
  letter-spacing: 0.04em;
  margin: 0 0 18px;
}

.hero-lede {
  max-width: 590px;
  font-size: 15.5px;
  line-height: 1.95;
  color: var(--muted);
  margin-bottom: 28px;
}
.hero-lede strong { color: var(--text-soft); font-weight: 500; }

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 30px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 44px;
  padding: 0 20px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: var(--ember);
  color: #170a04;
  font-family: var(--sans);
  font-size: 13.5px;
  font-weight: 700;
  letter-spacing: 0.03em;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.btn:hover { background: var(--ember-2); text-decoration: none; transform: translateY(-1px); box-shadow: 0 10px 30px rgba(255, 107, 53, 0.18); }
.btn.ghost {
  background: rgba(255, 255, 255, 0.035);
  color: var(--text);
  border-color: var(--line-strong);
}
.btn.ghost:hover { background: rgba(255, 255, 255, 0.06); box-shadow: none; }
.btn svg { width: 14px; height: 14px; }

.hero-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  border-top: 1px solid var(--line);
  padding-top: 18px;
  max-width: 600px;
}
.hero-stats .stat {
  padding-right: 26px;
  margin-right: 26px;
  border-right: 1px solid var(--line);
}
.hero-stats .stat:last-child { border-right: 0; margin-right: 0; padding-right: 0; }
.hero-stats b {
  display: block;
  font-family: var(--mono);
  font-size: 17px;
  color: var(--text);
  font-weight: 500;
  letter-spacing: 0.02em;
}
.hero-stats span {
  display: block;
  font-size: 10.5px;
  color: var(--dim);
  letter-spacing: 0.08em;
  margin-top: 2px;
}

/* ---------- hero console ---------- */

.console-wrap { position: relative; }
.console-wrap::before {
  content: "";
  position: absolute;
  inset: 12% -6% -8% 8%;
  background: radial-gradient(closest-side, rgba(255, 107, 53, 0.16), transparent 72%);
  filter: blur(26px);
  z-index: -1;
}

.console {
  position: relative;
  border: 1px solid rgba(233, 228, 216, 0.16);
  border-radius: 20px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.045), transparent 32%),
    #0c0e12;
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  overflow: hidden;
  transform: rotate(0.6deg);
}

.console-top {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 11px 15px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.018);
}
.console-top .dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: #30353d;
}
.console-top .dot.live { background: var(--ember); box-shadow: 0 0 8px rgba(255, 107, 53, 0.65); }
.console-top .label {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.16em;
  color: var(--dim);
}

.res-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--line);
  border-bottom: 1px solid var(--line);
}
.res {
  background: #0c0e12;
  padding: 10px 12px 9px;
}
.res span {
  display: block;
  font-size: 8.5px;
  letter-spacing: 0.1em;
  color: var(--dim);
}
.res b {
  display: block;
  font-family: var(--mono);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-soft);
  margin-top: 2px;
}
.res b.gold { color: var(--gold-2); }
.res b.blood { color: var(--blood); }
.res b.teal { color: var(--teal); }

.route-box {
  position: relative;
  padding: 8px 10px 4px;
  border-bottom: 1px solid var(--line);
  background:
    linear-gradient(rgba(255, 255, 255, 0.028) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.028) 1px, transparent 1px);
  background-size: 28px 28px;
  background-position: center;
}
.route-box svg { display: block; width: 100%; height: auto; overflow: visible; }
.route-caption {
  position: absolute;
  right: 14px; top: 12px;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.14em;
  color: var(--dim);
  text-align: right;
  line-height: 1.7;
}

.console-event { padding: 14px 15px 15px; }
.console-event .kicker {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.13em;
  color: var(--ember);
  margin-bottom: 5px;
}
.console-event .kicker em {
  font-style: normal;
  color: var(--dim);
}
.console-event h4 {
  font-size: 15px;
  margin: 0 0 4px;
  color: var(--text);
}
.console-event p {
  font-size: 11.5px;
  line-height: 1.7;
  color: var(--muted);
  margin: 0 0 11px;
}
.event-choices { display: grid; gap: 6px; }
.event-choices span {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  font-size: 10.5px;
  color: var(--text-soft);
  background: rgba(255, 255, 255, 0.018);
}
.event-choices span em {
  font-style: normal;
  color: var(--dim);
  font-family: var(--mono);
  font-size: 8.5px;
}
.event-choices span:first-child { border-color: rgba(255, 107, 53, 0.24); }
.event-choices span:first-child::before {
  content: "›";
  color: var(--ember);
  margin-right: 6px;
}

.console-foot {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 15px;
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.018);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.08em;
  color: var(--dim);
}
.console-foot b { color: var(--ember-2); font-weight: 500; }

/* ---------- chapter shell ---------- */

.chapter { padding: 0 clamp(20px, 4.6vw, 76px); }

.chapter-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: clamp(58px, 7vw, 92px) 0;
  border-top: 1px solid var(--line);
}

.chapter-head {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr);
  gap: 10px 22px;
  align-items: start;
  margin-bottom: clamp(28px, 4vw, 44px);
}

.chapter-num {
  font-family: var(--serif);
  font-size: 46px;
  line-height: 0.9;
  color: transparent;
  -webkit-text-stroke: 1px rgba(255, 107, 53, 0.55);
  opacity: 0.9;
  padding-top: 4px;
}

.chapter-head .kicker {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--dim);
  margin: 0 0 7px;
}
.chapter-head h2 {
  font-size: clamp(30px, 4vw, 43px);
  letter-spacing: 0.015em;
  margin: 0 0 10px;
}
.chapter-head .lede {
  max-width: 780px;
  color: var(--muted);
  font-size: 14.5px;
  line-height: 1.95;
  margin: 0;
}

.section { margin-top: clamp(36px, 5vw, 54px); }
.section:first-of-type { margin-top: 0; }

.section-title {
  display: flex;
  align-items: baseline;
  gap: 12px;
  font-family: var(--sans);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.02em;
  margin: 0 0 16px;
  color: var(--text);
}
.section-title::before {
  content: "";
  width: 18px; height: 1px;
  background: var(--ember);
  transform: translateY(-5px);
  flex: 0 0 18px;
}
.section-title .sub {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--dim);
  letter-spacing: 0.12em;
  font-weight: 400;
}

.subhead {
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 600;
  color: var(--text-soft);
  letter-spacing: 0.03em;
  margin: 26px 0 10px;
}

.lead {
  font-family: var(--serif);
  font-size: clamp(18px, 2.1vw, 23px);
  line-height: 1.8;
  color: var(--text);
  margin: 0 0 26px;
}
.lead em { color: var(--ember-2); font-style: normal; }

.muted { color: var(--muted); }
.dim { color: var(--dim); }
.tiny { font-size: 12px; line-height: 1.7; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }

/* ---------- grids & cards ---------- */

.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }

.card {
  position: relative;
  padding: 21px 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.014));
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}
.card:hover { border-color: rgba(233, 228, 216, 0.2); }
.card h3 {
  font-family: var(--sans);
  font-size: 14.5px;
  font-weight: 600;
  margin: 0 0 8px;
  letter-spacing: 0.01em;
}
.card h3 .idx {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--ember);
  letter-spacing: 0.08em;
  margin-right: 8px;
  vertical-align: 2px;
}
.card p { font-size: 13px; line-height: 1.8; color: var(--muted); }
.card p strong { color: var(--text-soft); font-weight: 500; }
.card .card-foot {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
  font-family: var(--mono);
  font-size: 9px;
  color: var(--dim);
  letter-spacing: 0.05em;
}

.card.ember { border-color: rgba(255, 107, 53, 0.24); background: linear-gradient(180deg, rgba(255, 107, 53, 0.09), rgba(255, 107, 53, 0.02)); }
.card.gold { border-color: rgba(217, 164, 65, 0.22); background: linear-gradient(180deg, rgba(217, 164, 65, 0.075), rgba(217, 164, 65, 0.018)); }
.card.teal { border-color: rgba(88, 183, 168, 0.22); background: linear-gradient(180deg, rgba(88, 183, 168, 0.07), rgba(88, 183, 168, 0.016)); }
.card.blood { border-color: rgba(208, 82, 69, 0.22); background: linear-gradient(180deg, rgba(208, 82, 69, 0.075), rgba(208, 82, 69, 0.016)); }

.pillar {
  padding: 22px 22px 20px;
  border-top: 1px solid var(--line-strong);
  border-radius: 0;
  background: transparent;
}
.pillar:hover { background: rgba(255, 255, 255, 0.02); }
.pillar .pillar-num {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.16em;
  color: var(--ember);
  display: block;
  margin-bottom: 12px;
}
.pillar h3 { font-family: var(--serif); font-size: 17px; margin-bottom: 8px; }

/* ---------- tags & pills ---------- */

.tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 9px;
  line-height: 1.7;
  letter-spacing: 0.04em;
  color: var(--muted);
  white-space: nowrap;
  vertical-align: 1px;
}
.tag.ember { color: var(--ember-2); border-color: rgba(255, 107, 53, 0.32); background: rgba(255, 107, 53, 0.08); }
.tag.gold { color: var(--gold-2); border-color: rgba(217, 164, 65, 0.3); background: rgba(217, 164, 65, 0.075); }
.tag.teal { color: var(--teal); border-color: rgba(88, 183, 168, 0.3); background: rgba(88, 183, 168, 0.07); }
.tag.blood { color: #ef8b80; border-color: rgba(208, 82, 69, 0.32); background: rgba(208, 82, 69, 0.08); }
.tag.violet { color: var(--violet); border-color: rgba(160, 132, 194, 0.3); background: rgba(160, 132, 194, 0.07); }
.tag.plain { border-color: var(--line); color: var(--dim); background: transparent; }

.pill-row { display: flex; flex-wrap: wrap; gap: 7px; }

/* ---------- callouts ---------- */

.callout {
  position: relative;
  padding: 17px 20px 17px 46px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.022);
  font-size: 13px;
  line-height: 1.85;
  color: var(--text-soft);
}
.callout::before {
  content: "!";
  position: absolute;
  left: 18px; top: 17px;
  width: 17px; height: 17px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 700;
  color: #150a04;
  background: var(--ember);
}
.callout strong { color: var(--text); font-weight: 600; }
.callout.warn { border-color: rgba(208, 82, 69, 0.28); background: rgba(208, 82, 69, 0.055); }
.callout.warn::before { background: var(--blood); color: #fff; }
.callout.good { border-color: rgba(88, 183, 168, 0.28); background: rgba(88, 183, 168, 0.05); }
.callout.good::before { content: "✓"; background: var(--teal); color: #06211d; }
.callout.info { border-color: rgba(217, 164, 65, 0.26); background: rgba(217, 164, 65, 0.052); }
.callout.info::before { content: "i"; background: var(--gold); color: #1d1302; }

/* ---------- tables ---------- */

.table-wrap {
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: auto;
  background: rgba(255, 255, 255, 0.012);
  scrollbar-width: thin;
  scrollbar-color: #2c323b transparent;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  line-height: 1.7;
  min-width: 560px;
}
thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  text-align: left;
  font-family: var(--sans);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--muted);
  background: #15181e;
  padding: 11px 13px;
  border-bottom: 1px solid var(--line-strong);
  white-space: nowrap;
}
tbody td {
  padding: 11px 13px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  color: var(--text-soft);
}
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: rgba(255, 255, 255, 0.022); }
td strong { color: var(--text); font-weight: 600; }
td .sm { font-size: 11.5px; color: var(--muted); }
td em { font-style: normal; color: var(--dim); }
.table-note { margin-top: 10px; font-size: 11.5px; color: var(--dim); line-height: 1.7; }

/* ---------- stat / kpi ---------- */

.kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
}
.kpi {
  background: #0e1115;
  padding: 16px 18px 15px;
}
.kpi b {
  display: block;
  font-family: var(--mono);
  font-size: clamp(18px, 2.2vw, 24px);
  font-weight: 500;
  color: var(--text);
  letter-spacing: 0.01em;
}
.kpi b .unit { font-size: 10px; color: var(--dim); margin-left: 3px; }
.kpi span {
  display: block;
  margin-top: 3px;
  font-size: 10.5px;
  letter-spacing: 0.04em;
  color: var(--dim);
}
.kpi.ember b { color: var(--ember-2); }
.kpi.gold b { color: var(--gold-2); }
.kpi.teal b { color: var(--teal); }

/* ---------- loops ---------- */

.loop-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.loop-card {
  position: relative;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.012));
  overflow: hidden;
}
.loop-card::after {
  content: attr(data-mark);
  position: absolute;
  right: 14px; top: 2px;
  font-family: var(--serif);
  font-size: 76px;
  line-height: 1;
  color: rgba(255, 255, 255, 0.035);
  pointer-events: none;
}
.loop-card .loop-head {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 12px;
}
.loop-card .loop-head .dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--ember);
  box-shadow: 0 0 10px rgba(255, 107, 53, 0.6);
}
.loop-card .loop-head h3 { font-family: var(--sans); font-size: 14px; margin: 0; }
.loop-card .loop-head .time {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 9px;
  color: var(--dim);
}
.loop-flow {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px 8px;
  font-size: 11.5px;
  line-height: 1.7;
  color: var(--muted);
}
.loop-flow .step {
  padding: 2px 7px;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--text-soft);
  background: rgba(255, 255, 255, 0.025);
  white-space: nowrap;
}
.loop-flow .arr { color: var(--dim); font-family: var(--mono); font-size: 9px; }

/* ---------- timeline ---------- */

.timeline {
  position: relative;
  margin: 4px 0 0;
  padding-left: 26px;
}
.timeline::before {
  content: "";
  position: absolute;
  left: 5px; top: 6px; bottom: 6px;
  width: 1px;
  background: linear-gradient(var(--ember), var(--line), transparent);
}
.tl-item { position: relative; padding: 0 0 20px 8px; }
.tl-item:last-child { padding-bottom: 0; }
.tl-item::before {
  content: "";
  position: absolute;
  left: -25px; top: 8px;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--bg);
  border: 1px solid var(--ember);
}
.tl-item.major::before { background: var(--ember); box-shadow: 0 0 12px rgba(255, 107, 53, 0.5); }
.tl-time {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.1em;
  color: var(--ember-2);
  display: block;
  margin-bottom: 3px;
}
.tl-item h4 { font-family: var(--sans); font-size: 13.5px; margin: 0 0 3px; }
.tl-item p { font-size: 12px; color: var(--muted); margin: 0; line-height: 1.75; }

/* ---------- formula / code ---------- */

.formula {
  padding: 15px 17px;
  border: 1px solid var(--line);
  border-left: 2px solid var(--ember);
  border-radius: 0 10px 10px 0;
  background: #0d1014;
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.95;
  color: var(--text-soft);
  overflow-x: auto;
  white-space: pre-wrap;
}
.formula b { color: var(--ember-2); font-weight: 500; }
.formula .cm { color: var(--dim); }

/* ---------- tabs / search ---------- */

.tabbar {
  position: sticky;
  top: 10px;
  z-index: 20;
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  padding: 7px;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(10, 12, 15, 0.9);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.tab-btn {
  appearance: none;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  padding: 7px 12px;
  border-radius: 7px;
  font-family: var(--sans);
  font-size: 11.5px;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.15s ease, background 0.15s ease;
}
.tab-btn:hover { color: var(--text); background: rgba(255, 255, 255, 0.04); }
.tab-btn[aria-selected="true"] {
  color: #1a0c05;
  background: var(--ember);
  font-weight: 700;
}

.filterbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}
.search {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 12px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.025);
}
.search svg { width: 14px; height: 14px; color: var(--dim); flex: 0 0 14px; }
.search input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-family: var(--sans);
  font-size: 12.5px;
}
.search input::placeholder { color: var(--dim); }
.search-count {
  font-family: var(--mono);
  font-size: 9.5px;
  color: var(--dim);
  letter-spacing: 0.06em;
  white-space: nowrap;
}
.tab-panel[hidden] { display: none; }
.is-hidden { display: none !important; }
.empty-note {
  display: none;
  padding: 22px;
  border: 1px dashed var(--line-strong);
  border-radius: 12px;
  text-align: center;
  color: var(--dim);
  font-size: 12px;
}
.empty-note.show { display: block; }

/* ---------- affix table ---------- */

.affix-table td:first-child { min-width: 90px; }
.affix-table td:nth-child(2) { white-space: nowrap; }
.affix-table td:nth-child(3) { min-width: 240px; }
.affix-table td:nth-child(4) { min-width: 130px; }
.affix-table td:nth-child(5) { min-width: 100px; }

/* ---------- set cards ---------- */

.set-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.set-card {
  position: relative;
  padding: 20px 20px 17px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.012));
  overflow: hidden;
}
.set-card::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 2px;
  background: linear-gradient(var(--set-color, var(--ember)), transparent);
}
.set-head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 11px;
}
.set-icon {
  width: 34px; height: 34px;
  flex: 0 0 34px;
  border-radius: 9px;
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  font-family: var(--serif);
  font-size: 15px;
  color: var(--set-color, var(--ember-2));
  background: rgba(255, 255, 255, 0.025);
}
.set-head h3 { font-family: var(--sans); font-size: 14px; margin: 0 0 3px; }
.set-head .set-sub { font-size: 10px; color: var(--dim); letter-spacing: 0.05em; }
.set-head .tag { margin-left: auto; }
.set-effects { display: grid; gap: 6px; margin: 10px 0 11px; }
.set-effect {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 8px;
  align-items: start;
  font-size: 12px;
  line-height: 1.7;
  color: var(--muted);
}
.set-effect .pc {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--set-color, var(--ember-2));
  border: 1px solid var(--line);
  border-radius: 4px;
  text-align: center;
  padding: 1px 0;
  margin-top: 2px;
}
.set-effect strong { color: var(--text-soft); font-weight: 500; }
.set-risk {
  display: flex;
  gap: 7px;
  align-items: baseline;
  padding-top: 9px;
  border-top: 1px dashed var(--line);
  font-size: 11px;
  line-height: 1.7;
  color: var(--muted);
}
.set-risk b {
  flex: 0 0 auto;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.1em;
  color: var(--blood);
}

/* ---------- event cards ---------- */

.event-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.event-card {
  padding: 18px 19px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.022);
}
.event-card .event-top {
  display: flex;
  align-items: baseline;
  gap: 9px;
  margin-bottom: 5px;
}
.event-card h3 { font-family: var(--sans); font-size: 13.5px; margin: 0; }
.event-card .event-top .tag { margin-left: auto; }
.event-card .trigger {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--dim);
  letter-spacing: 0.05em;
  margin-bottom: 9px;
}
.choices { display: grid; gap: 5px; }
.choice {
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 8px;
  font-size: 11.5px;
  line-height: 1.7;
  color: var(--muted);
}
.choice .k {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--ember-2);
  padding-top: 2px;
}
.choice strong { color: var(--text-soft); font-weight: 500; }
.choice .tag { margin-right: 4px; }

/* ---------- boss cards ---------- */

.boss-grid { display: grid; gap: 14px; }
.boss-card {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1.35fr);
  gap: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: rgba(255, 255, 255, 0.02);
}
.boss-side {
  padding: 20px;
  border-right: 1px solid var(--line);
  background:
    radial-gradient(240px 160px at 0% 0%, rgba(208, 82, 69, 0.09), transparent 70%),
    rgba(255, 255, 255, 0.012);
}
.boss-side .act {
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.16em;
  color: var(--ember);
  margin-bottom: 8px;
}
.boss-side h3 { font-family: var(--serif); font-size: 21px; margin: 0 0 3px; }
.boss-side .epithet { font-size: 11px; color: var(--dim); margin-bottom: 12px; }
.boss-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px 10px;
  margin: 12px 0;
}
.boss-stats div {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 9.5px;
  color: var(--dim);
}
.boss-stats b { color: var(--text-soft); font-weight: 500; }
.boss-side .tag { margin: 2px 4px 0 0; }

.boss-body { padding: 20px; }
.boss-row { display: grid; grid-template-columns: 62px 1fr; gap: 10px; padding: 7px 0; border-bottom: 1px dashed var(--line); }
.boss-row:first-child { padding-top: 0; }
.boss-row:last-child { border-bottom: 0; padding-bottom: 0; }
.boss-row .lab {
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.1em;
  color: var(--dim);
  padding-top: 3px;
}
.boss-row p { font-size: 12px; line-height: 1.75; color: var(--muted); margin: 0; }
.boss-row p strong { color: var(--text-soft); font-weight: 500; }
.boss-row p .num { color: var(--gold-2); font-family: var(--mono); font-size: 11px; }
.boss-reward {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 9px;
}

/* ---------- dialogue cards ---------- */

.dialogue-grid { display: grid; gap: 12px; }
.dialogue-card {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 16px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.02);
}
.dialogue-who {
  border-right: 1px solid var(--line);
  padding-right: 14px;
}
.dialogue-who .portrait {
  width: 48px; height: 48px;
  border-radius: 12px;
  border: 1px solid var(--line-strong);
  display: grid;
  place-items: center;
  font-family: var(--serif);
  font-size: 20px;
  color: var(--ember-2);
  background: radial-gradient(circle at 40% 30%, rgba(255, 107, 53, 0.15), rgba(255, 255, 255, 0.02));
  margin-bottom: 9px;
}
.dialogue-who h3 { font-family: var(--sans); font-size: 13px; margin: 0 0 2px; }
.dialogue-who .role { font-size: 10px; color: var(--dim); line-height: 1.6; }
.dialogue-body .scene {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.08em;
  color: var(--dim);
  margin-bottom: 6px;
}
.dialogue-line {
  font-family: var(--serif);
  font-size: 15px;
  line-height: 1.75;
  color: var(--text);
  margin: 0 0 11px;
}
.dialogue-line::before { content: "「"; color: var(--ember); }
.dialogue-line::after { content: "」"; color: var(--ember); }
.dlg-opts { display: grid; gap: 6px; }
.dlg-opt {
  display: grid;
  grid-template-columns: 20px 1fr;
  gap: 8px;
  font-size: 11.5px;
  line-height: 1.75;
  color: var(--muted);
}
.dlg-opt .k { font-family: var(--mono); font-size: 9px; color: var(--ember-2); padding-top: 2px; }
.dlg-opt strong { color: var(--text-soft); font-weight: 500; }

/* ---------- build matrix ---------- */

.matrix td, .matrix th { text-align: center; }
.matrix td:first-child, .matrix th:first-child { text-align: left; white-space: nowrap; }
.matrix .yes { color: var(--teal); font-weight: 700; }
.matrix .mid { color: var(--gold-2); }
.matrix .no { color: var(--blood); }
.matrix tbody td { font-family: var(--mono); font-size: 11px; }
.matrix tbody td:first-child { font-family: var(--sans); font-size: 12px; color: var(--text-soft); }

/* ---------- wireframes ---------- */

.wire-stage {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  align-items: start;
}
.wire {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #0d1014;
  overflow: hidden;
}
.wire-top {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 11px;
  border-bottom: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.1em;
  color: var(--dim);
}
.wire-top .dot { width: 5px; height: 5px; border-radius: 50%; background: #333942; }
.wire-top .dot.on { background: var(--ember); }
.wire-body { padding: 11px; display: grid; gap: 8px; }
.wire-row { display: flex; gap: 7px; }
.wire-box {
  flex: 1;
  min-height: 38px;
  border: 1px dashed rgba(233, 228, 216, 0.16);
  border-radius: 6px;
  padding: 7px 8px;
  font-size: 9.5px;
  line-height: 1.5;
  color: var(--dim);
  background: rgba(255, 255, 255, 0.015);
}
.wire-box strong { display: block; color: var(--text-soft); font-size: 10px; font-weight: 500; margin-bottom: 2px; }
.wire-box.fill { border-style: solid; border-color: rgba(255, 107, 53, 0.26); background: rgba(255, 107, 53, 0.06); }
.wire-box.tall { min-height: 90px; }
.wire-box.map {
  min-height: 108px;
  background:
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 18px 18px;
}
.wire-nav {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 5px;
  padding-top: 4px;
  border-top: 1px solid var(--line);
}
.wire-nav span {
  text-align: center;
  font-family: var(--mono);
  font-size: 8px;
  padding: 6px 2px;
  border-radius: 5px;
  color: var(--dim);
  background: rgba(255, 255, 255, 0.02);
}
.wire-nav span.on { color: var(--ember-2); background: rgba(255, 107, 53, 0.08); }

.phone {
  width: min(100%, 300px);
  margin: 0 auto;
  border: 7px solid #1b1f26;
  border-radius: 30px;
  background: #0a0c0f;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  overflow: hidden;
}
.phone .wire-top { border-bottom: 0; padding-bottom: 4px; }
.phone .wire-body { padding: 8px 10px 10px; }

/* ---------- steps ---------- */

.steps {
  counter-reset: step;
  display: grid;
  gap: 0;
  border-left: 1px solid var(--line);
  margin-left: 8px;
}
.step-item {
  position: relative;
  padding: 0 0 18px 24px;
  counter-increment: step;
}
.step-item:last-child { padding-bottom: 0; }
.step-item::before {
  content: counter(step, decimal-leading-zero);
  position: absolute;
  left: -9px; top: 0;
  width: 17px; height: 17px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--bg);
  border: 1px solid var(--ember);
  font-family: var(--mono);
  font-size: 7px;
  color: var(--ember-2);
}
.step-item h4 { font-family: var(--sans); font-size: 13px; margin: 0 0 2px; }
.step-item p { font-size: 11.5px; line-height: 1.7; color: var(--muted); margin: 0; }

/* ---------- notes / details ---------- */

details.note {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.018);
  padding: 0;
}
details.note summary {
  cursor: pointer;
  padding: 12px 15px;
  font-size: 12px;
  color: var(--text-soft);
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
}
details.note summary::-webkit-details-marker { display: none; }
details.note summary::before {
  content: "+";
  font-family: var(--mono);
  color: var(--ember);
  font-size: 12px;
}
details.note[open] summary::before { content: "−"; }
details.note .note-body {
  padding: 0 15px 14px;
  font-size: 12px;
  line-height: 1.8;
  color: var(--muted);
  border-top: 1px solid var(--line);
  padding-top: 11px;
}

/* ---------- quote ---------- */

.quote {
  margin: 0;
  padding: 24px 26px;
  border-left: 2px solid var(--ember);
  background: linear-gradient(90deg, rgba(255, 107, 53, 0.07), transparent 70%);
  border-radius: 0 14px 14px 0;
  font-family: var(--serif);
  font-size: clamp(16px, 1.8vw, 19px);
  line-height: 1.85;
  color: var(--text);
}
.quote footer {
  margin-top: 10px;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.1em;
  color: var(--dim);
}

/* ---------- footer ---------- */

.site-footer {
  margin-left: var(--sidebar);
  border-top: 1px solid var(--line);
  padding: 34px clamp(22px, 4.6vw, 76px) 46px;
}
.footer-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  align-items: baseline;
  justify-content: space-between;
}
.footer-inner p { font-size: 11px; color: var(--dim); line-height: 1.8; margin: 0; }
.footer-mark {
  font-family: var(--serif);
  font-size: 15px;
  color: var(--text-soft);
  letter-spacing: 0.08em;
}
.footer-mark span {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--dim);
  letter-spacing: 0.12em;
  margin-left: 8px;
}

/* ---------- 404 ---------- */

.error-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 48px 22px;
  text-align: center;
}
.error-inner { max-width: 560px; }
.error-code {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.28em;
  color: var(--ember);
}
.error-page h1 {
  font-family: var(--serif);
  font-size: clamp(38px, 7vw, 64px);
  font-weight: 500;
  letter-spacing: 0.04em;
  margin: 18px 0 14px;
}
.error-page p { color: var(--muted); margin: 0 auto 26px; max-width: 42ch; }
.error-page .btn { display: inline-flex; }

/* ---------- reveal ---------- */

.js .reveal { opacity: 0; transform: translateY(14px); transition: opacity 0.65s ease, transform 0.65s ease; }
.js .reveal.in { opacity: 1; transform: none; }

/* ---------- route svg animation ---------- */

.route-dash {
  stroke-dasharray: 4 7;
  animation: dash 7s linear infinite;
}
@keyframes dash { to { stroke-dashoffset: -110; } }

.node-pulse {
  animation: nodePulse 3.2s ease-in-out infinite;
  transform-box: fill-box;
  transform-origin: center;
}
@keyframes nodePulse {
  0%, 100% { opacity: 0.45; r: 10; }
  50% { opacity: 0.9; r: 13; }
}

.ash {
  animation: ashFloat 9s ease-in-out infinite;
}
.ash:nth-child(2) { animation-delay: -3s; animation-duration: 11s; }
.ash:nth-child(3) { animation-delay: -6s; animation-duration: 8s; }
@keyframes ashFloat {
  0%, 100% { transform: translateY(0); opacity: 0.2; }
  50% { transform: translateY(-12px); opacity: 0.7; }
}

/* ---------- print ---------- */

@media print {
  :root {
    --bg: #fff;
    --text: #111;
    --text-soft: #222;
    --muted: #444;
    --dim: #666;
    --line: #d5d5d5;
    --line-strong: #aaa;
  }
  body { background: #fff; color: #111; font-size: 11pt; line-height: 1.65; }
  body::before, .grain, .sidebar, .topbar, .progress, .scrim, .hero-actions, .console-wrap, .skip, .tabbar, .filterbar, .print-btn { display: none !important; }
  main, .site-footer { margin-left: 0; }
  .hero { min-height: 0; padding: 0 0 24px; }
  .hero-grid { display: block; }
  .hero h1 { font-size: 42pt; color: #111; }
  .hero-sub { color: #333; }
  .hero-lede, .chapter-head .lede { color: #333; }
  .hero-stats { border-top: 1px solid #ccc; }
  .hero-stats b { color: #111; }
  .chapter { padding: 0; }
  .chapter-inner { max-width: none; padding: 22px 0; border-top: 1px solid #ccc; }
  .chapter-num { -webkit-text-stroke: 1px #999; }
  .card, .set-card, .event-card, .boss-card, .dialogue-card, .table-wrap, .callout, .formula, .kpis, .wire {
    background: #fff !important;
    border-color: #ccc !important;
    box-shadow: none !important;
    break-inside: avoid;
  }
  .chapter-head h2, .section-title, .card h3, .boss-side h3 { color: #111; }
  .tag { border-color: #bbb; color: #333; background: #fff; }
  a { color: #111; text-decoration: underline; }
  .tab-panel[hidden] { display: block !important; }
  .table-wrap { overflow: visible; }
  table { min-width: 0; font-size: 8.5pt; }
  thead th { background: #eee; color: #111; position: static; }
  .boss-card { grid-template-columns: 1fr; }
  .boss-side { border-right: 0; border-bottom: 1px solid #ccc; }
  .dialogue-card { grid-template-columns: 90px 1fr; }
}

/* ---------- responsive ---------- */

@media (max-width: 1240px) {
  .hero-grid { grid-template-columns: minmax(0, 1.1fr) minmax(360px, 0.9fr); gap: 36px; }
  .hero h1 { font-size: clamp(52px, 7.4vw, 86px); }
  .boss-card { grid-template-columns: 1fr; }
  .boss-side { border-right: 0; border-bottom: 1px solid var(--line); }
}

@media (max-width: 1000px) {
  body { font-size: 15.5px; }
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.28s ease;
    z-index: 100;
    width: 300px;
    box-shadow: 20px 0 60px rgba(0, 0, 0, 0.5);
  }
  .sidebar.open { transform: none; }
  .scrim.show { opacity: 1; pointer-events: auto; }
  .topbar { display: flex; }
  main, .site-footer { margin-left: 0; }
  .hero { min-height: auto; padding: 100px 22px 64px; }
  .hero-grid { grid-template-columns: 1fr; gap: 36px; }
  .console { transform: none; max-width: 560px; }
  .hero h1 { font-size: clamp(54px, 13vw, 88px); }
  .hero::after { left: 22px; right: 22px; }
  .chapter { padding: 0 22px; }
  .tabbar { top: 68px; }
  .g4, .g5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  .hero { padding-top: 88px; }
  .hero h1 { font-size: clamp(48px, 15vw, 72px); }
  .hero-sub { font-size: 18px; }
  .hero-lede { font-size: 14.5px; }
  .hero-stats { gap: 12px 0; }
  .hero-stats .stat { padding-right: 16px; margin-right: 16px; }
  .g2, .g3, .g4, .g5, .loop-grid, .set-grid, .event-grid, .wire-stage { grid-template-columns: 1fr; }
  .chapter-head { grid-template-columns: 40px minmax(0, 1fr); gap: 6px 14px; }
  .chapter-num { font-size: 30px; padding-top: 2px; }
  .chapter-head h2 { font-size: clamp(25px, 7vw, 32px); }
  .section-title { font-size: 16px; }
  .lead { font-size: 17px; }
  .boss-card { grid-template-columns: 1fr; }
  .boss-side { border-right: 0; border-bottom: 1px solid var(--line); }
  .dialogue-card { grid-template-columns: 1fr; gap: 10px; }
  .dialogue-who { border-right: 0; border-bottom: 1px solid var(--line); padding: 0 0 10px; display: flex; align-items: center; gap: 10px; }
  .dialogue-who .portrait { margin: 0; width: 38px; height: 38px; border-radius: 9px; font-size: 16px; }
  .dialogue-who .role { display: none; }
  .res-row { grid-template-columns: repeat(2, 1fr); }
  .table-wrap { border-radius: 10px; }
  table { font-size: 12px; }
  .tabbar { overflow-x: auto; flex-wrap: nowrap; }
  .tab-btn { font-size: 11px; padding: 6px 9px; }
  .filterbar { flex-wrap: wrap; }
  .search { flex: 1 1 100%; }
  .search-count { flex: 0 0 100%; text-align: right; margin-top: -4px; }
  .site-footer { padding: 26px 22px 36px; }
}

@media (max-width: 420px) {
  .hero h1 { font-size: 43px; }
  .hero h1 .thin { letter-spacing: 0.28em; }
  .hero-stats .stat { border-right: 0; padding-right: 0; margin-right: 0; flex: 1 1 40%; }
  .kpis { grid-template-columns: 1fr 1fr; }
  .console-event p { font-size: 11px; }
  .chapter { padding: 0 16px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .js .reveal { opacity: 1; transform: none; }
}
