:root {
  --bg: #12110f;
  --ink: #f3ece2;
  --muted: #c4b8a8;
  --faint: #8f8476;
  --line: rgba(243, 236, 226, 0.12);
  --line-strong: rgba(243, 236, 226, 0.26);
  --accent: #d7a15a;
  --accent-ink: #2a1c0c;
  --moon: #f6edd8;
  --swift: #c5d5e4;
  --danger: #e07a68;
  --serif: Batang, "BatangChe", "Iowan Old Style", Palatino, "Palatino Linotype", serif;
  --sans: "Malgun Gothic", "Segoe UI", sans-serif;
  --mono: "Cascadia Mono", "Segoe UI Mono", Consolas, monospace;
  --nav: 248px;
  --measure: 74ch;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background:
    radial-gradient(900px 420px at 0% -8%, rgba(215, 161, 90, 0.08), transparent 55%),
    var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16.5px;
  line-height: 1.7;
  word-break: keep-all;
  overflow-wrap: break-word;
}
::selection { background: rgba(215, 161, 90, 0.35); color: var(--ink); }
a { color: var(--accent); text-underline-offset: 3px; }
a:hover { color: #f0c48a; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.skip {
  position: absolute;
  left: 12px;
  top: -40px;
  background: var(--accent);
  color: var(--accent-ink);
  padding: 8px 12px;
  z-index: 5;
}
.skip:focus { top: 12px; }

.shell {
  display: grid;
  grid-template-columns: var(--nav) minmax(0, 1fr);
  min-height: 100vh;
}

.nav {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 28px 18px 24px;
  border-right: 1px solid var(--line);
  background: rgba(18, 17, 15, 0.92);
  overflow: auto;
}
.brand {
  display: flex;
  gap: 10px;
  align-items: center;
  text-decoration: none;
  color: inherit;
  margin-bottom: 22px;
}
.brand strong {
  display: block;
  font-family: var(--serif);
  font-size: 16px;
  font-weight: 500;
  line-height: 1.35;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.brand span { display: block; color: var(--faint); font-size: 12px; letter-spacing: 0.06em; }
.moons { position: relative; width: 36px; height: 28px; flex: none; }
.moons i {
  position: absolute;
  border-radius: 50%;
  display: block;
}
.moons .elder { width: 22px; height: 22px; background: var(--moon); left: 0; top: 4px; }
.moons .swift { width: 12px; height: 12px; background: var(--swift); right: 0; top: 0; }
.nav ol { list-style: none; margin: 0; padding: 0; }
.nav ol a {
  display: block;
  color: var(--muted);
  text-decoration: none;
  padding: 6px 10px;
  border-left: 2px solid transparent;
  font-size: 14.5px;
}
.nav ol a:hover { color: var(--ink); }
.nav ol a[aria-current="page"] {
  color: var(--ink);
  border-left-color: var(--accent);
}
.play {
  display: inline-block;
  margin-top: 22px;
  background: var(--accent);
  color: var(--accent-ink);
  text-decoration: none;
  font-weight: 700;
  padding: 8px 12px;
  border-radius: 8px;
}
.play:hover { color: var(--accent-ink); background: #e0b16e; }
.nav .fine { margin-top: 16px; color: var(--faint); font-size: 12px; line-height: 1.5; }
.nav-toggle {
  display: none;
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 6px 10px;
  font: inherit;
  font-size: 13px;
}
.phone-note { display: none; }
.to-top {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 4;
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
  text-decoration: none;
  font-size: 13px;
  font-weight: 700;
  opacity: 0;
  pointer-events: none;
}
.to-top.show { opacity: 1; pointer-events: auto; }
.to-top:hover { color: var(--accent-ink); background: #e0b16e; }

main { padding: 36px 48px 80px; max-width: 980px; }
.hero { position: relative; padding-bottom: 8px; }
.kicker {
  margin: 0 0 8px;
  color: var(--faint);
  letter-spacing: 0.12em;
  font-size: 12px;
  text-transform: uppercase;
}
h1, h2, h3 { font-family: var(--serif); font-weight: 500; letter-spacing: -0.03em; line-height: 1.25; }
h1 { font-size: clamp(40px, 6vw, 64px); margin: 0 0 14px; }
h2 { font-size: 30px; margin: 1.6em 0 0.45em; scroll-margin-top: var(--nav-h, 18px); }
h3 { font-size: 22px; margin: 28px 0 8px; scroll-margin-top: var(--nav-h, 18px); }
.lede { font-size: 19px; max-width: var(--measure); color: var(--muted); margin-top: 0; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; margin: 18px 0 8px; }
.button, .ghost {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  border-radius: 8px;
  padding: 10px 16px;
  font-weight: 700;
}
.button { background: var(--accent); color: var(--accent-ink); }
.button:hover { background: #e0b16e; color: var(--accent-ink); }
.ghost { border: 1px solid var(--line-strong); color: var(--ink); }
.ghost:hover { border-color: var(--accent); color: var(--ink); }

.strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin: 28px 0 10px;
}
.page-head { margin-bottom: 18px; }
.page-head h1 { font-size: clamp(34px, 5vw, 52px); }
.atlas { margin: 22px 0 8px; }
.atlas a { display: block; }
.atlas img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: #16315c;
}
.atlas figcaption {
  margin-top: 8px;
  color: var(--faint);
  font-size: 13px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}
.directory {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 32px;
}
.directory a {
  display: block;
  text-decoration: none;
  color: inherit;
  padding: 16px 16px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(243, 236, 226, 0.03);
}
.directory a:hover { border-color: var(--line-strong); background: rgba(243, 236, 226, 0.05); }
.directory small {
  color: var(--faint);
  letter-spacing: 0.12em;
  font-size: 12px;
}
.directory strong {
  display: block;
  margin: 4px 0 2px;
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 500;
}
.directory span { color: var(--muted); font-size: 14.5px; }
.pager {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 56px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}
.pager a {
  flex: 0 1 46%;
  text-decoration: none;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  background: rgba(243, 236, 226, 0.03);
}
.pager a:hover { border-color: var(--line-strong); color: var(--ink); }
.pager small { display: block; color: var(--faint); font-size: 12px; letter-spacing: 0.08em; }
.pager strong { display: block; font-family: var(--serif); font-size: 18px; font-weight: 500; }
.pager .blurb { display: block; color: var(--muted); font-size: 13px; line-height: 1.4; margin-top: 2px; }
.pager .next { margin-left: auto; text-align: right; }
.strip article, .card, .calc, .note {
  background: rgba(243, 236, 226, 0.03);
  border: 1px solid var(--line);
  border-radius: 10px;
}
.strip article { padding: 14px 14px 12px; }
.strip b { display: block; font-family: var(--serif); font-size: 26px; font-weight: 500; }
.strip span { color: var(--muted); font-size: 13px; }

section { padding-top: 8px; scroll-margin-top: 18px; }
section > p, .prose p { max-width: var(--measure); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 16px 0; }
.card { padding: 16px 16px 8px; }
.card h3 { margin-top: 0; }
ol.steps, ul.clean { padding-left: 1.15em; }
ol.steps li, ul.clean li { margin: 6px 0; }
ol.steps { max-width: var(--measure); }

.table-wrap { overflow-x: auto; margin: 14px 0 8px; border: 1px solid var(--line); border-radius: 10px; }
.table-wrap.more {
  background-image: linear-gradient(to left, rgba(18, 17, 15, 0.94), rgba(18, 17, 15, 0));
  background-repeat: no-repeat;
  background-position: right center;
  background-size: 28px 100%;
}
.table-wrap th:first-child,
.table-wrap td:first-child {
  position: sticky;
  left: 0;
  background: #171614;
  z-index: 1;
}
.table-wrap thead th:first-child { z-index: 2; }
.table-wrap tbody tr:hover td:first-child { background: #211f1c; }
table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
caption { text-align: left; padding: 12px 14px 0; color: var(--muted); font-size: 13px; }
th, td { padding: 8px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--faint); font-weight: 600; font-size: 12px; letter-spacing: 0.04em; white-space: nowrap; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; font-family: var(--mono); font-size: 13px; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: rgba(243, 236, 226, 0.04); }
.tag {
  display: inline-block;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 0 7px;
  color: var(--muted);
  font-size: 12px;
}
.tag.boss { color: var(--danger); border-color: rgba(224, 122, 104, 0.45); }
.na { color: var(--faint); }

.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 8px; }
.toolbar > input[type="search"],
.toolbar > label:has(input[type="search"]) { flex: 1 1 180px; max-width: 360px; min-width: 0; }
.chips { flex-basis: 100%; }
input, select {
  background: #0e0d0b;
  color: var(--ink);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 8px 10px;
  font: inherit;
}
input[type="search"] { width: min(360px, 100%); }
label { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
.calc { padding: 16px; margin: 16px 0; display: grid; gap: 14px; }
.calc-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.calc output {
  display: block;
  background: rgba(0, 0, 0, 0.25);
  border-radius: 8px;
  padding: 12px 14px;
  min-height: 3.2em;
}
.big {
  font-family: var(--serif);
  font-size: 42px;
  line-height: 1;
  color: var(--moon);
}
.result { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 4px; }
.result li { display: flex; justify-content: space-between; gap: 16px; font-size: 14.5px; }
.result span { color: var(--muted); }
.result b { font-weight: 600; text-align: right; }
.toc { display: flex; flex-wrap: wrap; gap: 6px 8px; margin: 4px 0 18px; }
.toc a {
  text-decoration: none;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 13px;
}
.toc a:hover, .toc a.is-here { color: var(--ink); border-color: var(--accent); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips button, .count { font: inherit; }
.chips button {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 13px;
}
.chips button.is-on { color: var(--ink); border-color: var(--accent); }
.count { color: var(--faint); font-size: 13px; }
.empty { color: var(--muted); margin: 10px 0; }
.icon-grid .alias { display: block; color: var(--faint); font-size: 12px; line-height: 1.35; }
a[target="_blank"]::after {
  content: "↗";
  font-size: 0.75em;
  margin-left: 0.28em;
  text-decoration: none;
  display: inline-block;
}
.note { padding: 12px 14px; color: var(--muted); margin: 12px 0; }
.note strong { color: var(--ink); }
.named { display: inline-flex; align-items: center; gap: 8px; vertical-align: middle; }
.named img, .icon-grid img {
  object-fit: contain;
  background: #070605;
  border-radius: 4px;
  flex: none;
}
.named img { width: 32px; height: 32px; }
.icon-board, #icon-mount { display: grid; gap: 8px; }
.icon-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 8px;
}
.icon-grid article {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(243, 236, 226, 0.03);
  min-width: 0;
}
.icon-grid img { width: 52px; height: 52px; }
.icon-grid strong { display: block; font-size: 14.5px; line-height: 1.35; font-weight: 600; }
.icon-grid small { display: block; color: var(--faint); font-size: 12px; line-height: 1.35; }
.sources { color: var(--muted); font-size: 14.5px; }
.sources li { margin: 6px 0; }
footer.colophon { margin-top: 48px; color: var(--faint); font-size: 13px; }

@media (max-width: 900px) {
  .shell { display: block; }
  .nav {
    position: sticky;
    top: 0;
    height: auto;
    z-index: 3;
    overflow: visible;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 10px 12px;
    background: #12110f;
  }
  .nav { display: flex; flex-wrap: wrap; align-items: center; column-gap: 10px; }
  .brand { flex: 1 1 auto; margin: 0; }
  .brand .tagline, .nav .fine { display: none; }
  .nav-toggle { display: inline-block; }
  .phone-note { display: block; margin: 28px 0 0; color: var(--faint); font-size: 12px; line-height: 1.5; }
  .nav > .play { order: 1; margin: 0; padding: 6px 10px; font-size: 13px; }
  .nav ol {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 4;
    flex-direction: column;
    gap: 0;
    padding: 6px 8px 10px;
    background: #171614;
    border-bottom: 1px solid var(--line);
    box-shadow: 0 18px 32px rgba(0, 0, 0, 0.45);
  }
  .nav.is-open ol { display: flex; }
  .nav ol a { white-space: nowrap; border-bottom: 0; padding: 8px 10px; }
  h1 { font-size: 34px; }
  .lede { font-size: 16.5px; word-break: normal; overflow-wrap: anywhere; }
  .nav ol a[aria-current="page"] { border-left-color: var(--accent); }
  main { padding: 22px 16px 64px; }
  .strip, .grid-2, .calc-grid, .directory { grid-template-columns: 1fr 1fr; }
  section { scroll-margin-top: var(--nav-h, 72px); }
}
@media (max-width: 560px) {
  .strip, .calc-grid, .directory { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; animation: none !important; }
}
@media print {
  .nav, .pager, .skip, .toc, .hero-actions, .toolbar, .to-top, .phone-note, .chips { display: none !important; }
  .shell { display: block; }
  main { max-width: none; padding: 0; }
  body { background: #fff; color: #1a1814; }
  a { color: #1a1814; }
  a[target="_blank"]::after { content: ""; }
  .table-wrap, .table-wrap th:first-child, .table-wrap td:first-child { overflow: visible; position: static; background: transparent; }
  h1, h2, h3, .strip b, .big { color: #1a1814; }
}
