/* Hallmark · genre: editorial (reference) · macrostructure: Catalogue (lists) / Ecosystem Index (home) / Long Document (articles)
 * theme: Almanac voice · enrichment: none (the game's own pictures) · nav: N3 side-rail (16ch, filled bar) · footer: Ft4 dense colophon
 * design-system: design.md · designed-as-app
 * pre-emit critique: P4 H4 E4 S5 R4 V5
 * contrast: pass (40–41) · nav: N3 · footer: Ft4 · slop: pass (42–45) · honest: pass (46) · chrome: pass (47) · tokens: pass (48) · responsive: pass (49) · mobile: pass (34, 49, 50–57)
 */
*, *::before, *::after { box-sizing: border-box; }
html { overflow-x: clip; scroll-padding-top: var(--space-xl); -webkit-text-size-adjust: 100%; }
body {
  margin: 0; overflow-x: clip;
  background: var(--color-paper); color: var(--color-ink);
  font: 400 var(--text-base)/1.7 var(--font-body);
  word-break: keep-all; overflow-wrap: break-word;
  font-variant-numeric: tabular-nums;
}
[hidden] { display: none !important; }
img { max-width: 100%; height: auto; }
a { color: var(--color-link); text-decoration: none; text-underline-offset: 0.2em; }
a:hover { text-decoration: underline; text-decoration-thickness: var(--rule-hair); }
a:active { color: var(--color-ink); }
:focus-visible { outline: var(--rule-strong) solid var(--color-focus); outline-offset: 2px; }
code, kbd { font: 400 0.9em/1.4 var(--font-data); }
code { background: var(--color-paper-2); padding: 0 var(--space-2xs); }
kbd { color: var(--color-muted); border: var(--rule-hair) solid var(--color-rule-2); border-radius: var(--radius-key); padding: 0 var(--space-2xs); background: var(--color-paper); }
.skip { position: absolute; left: var(--space-md); top: -4rem; background: var(--color-ink); color: var(--color-paper); padding: var(--space-xs) var(--space-md); z-index: var(--z-modal); }
.skip:focus { top: var(--space-md); }

/* ------------------------------------------------------------ shell: side rail + page */
.shell { display: block; }
.rail { border-bottom: var(--rule-hair) solid var(--color-rule); background: var(--color-paper); position: sticky; top: 0; z-index: var(--z-sticky); }
.rail__top { display: flex; align-items: center; gap: var(--space-sm); padding: var(--space-xs) var(--space-md); }
.mark { display: inline-flex; align-items: baseline; gap: var(--space-xs); color: var(--color-ink); white-space: nowrap; margin-right: auto; }
.mark:hover { text-decoration: none; }
.mark__seal { width: 0.62em; height: 0.62em; background: var(--color-accent); align-self: center; flex: none; font-size: var(--text-lg); }
.mark__name { font: 900 var(--text-lg)/1.1 var(--font-display); letter-spacing: -0.02em; }
.mark__sub { font: 400 var(--text-sm)/1 var(--font-body); color: var(--color-muted); }
.find, .menu-btn {
  font: 400 var(--text-sm)/1 var(--font-body); color: var(--color-muted); background: var(--color-paper);
  border: var(--rule-hair) solid var(--color-rule-2); border-radius: var(--radius-none);
  display: inline-flex; align-items: center; gap: var(--space-xs); min-height: 2.5rem; padding: 0 var(--space-sm);
  white-space: nowrap; cursor: pointer; transition: border-color var(--dur-micro) var(--ease-out), color var(--dur-micro) var(--ease-out);
}
.find:hover, .menu-btn:hover { border-color: var(--color-ink); color: var(--color-ink); }
.find:active, .menu-btn:active { background: var(--color-paper-2); }
.find:disabled, .menu-btn:disabled, .filter:disabled { opacity: 0.55; cursor: not-allowed; }
.find kbd { display: none; }
.rail__nav { display: none; padding: 0 var(--space-md) var(--space-md); max-height: calc(100dvh - 3.5rem); overflow-y: auto; }
.rail.is-open .rail__nav { display: block; }
.rail__group { margin: var(--space-md) 0 var(--space-2xs); font: 500 var(--text-xs)/1.4 var(--font-data); color: var(--color-muted); letter-spacing: 0.04em; }
.rail__nav ul { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.rail__nav li { margin: 0; }
.rail__nav a { display: block; padding: var(--space-xs) var(--space-sm); color: var(--color-ink); white-space: nowrap; border-left: var(--rule-strong) solid transparent; }
.rail__nav a:hover { background: var(--color-paper-2); text-decoration: none; }
.rail__nav a.on { border-left-color: var(--color-accent); font-weight: 600; }

.page { max-width: 62rem; margin: 0; padding: var(--space-lg) var(--space-md) var(--space-2xl); min-width: 0; }
.page.wide { max-width: 80rem; }

@media (min-width: 62rem) {
  .shell { display: grid; grid-template-columns: var(--rail) minmax(0, 1fr); align-items: start; }
  .rail { position: sticky; top: 0; height: 100dvh; overflow-y: auto; border-bottom: 0; border-right: var(--rule-hair) solid var(--color-rule); padding: var(--space-lg) 0 var(--space-lg); }
  .rail__top { flex-direction: column; align-items: stretch; gap: var(--space-md); padding: 0 var(--space-md) 0 var(--space-lg); }
  .mark { margin: 0; flex-direction: row; }
  .mark__name { font-size: var(--text-xl); }
  .mark__seal { font-size: var(--text-xl); }
  .find { justify-content: space-between; }
  .find kbd { display: inline-block; }
  .menu-btn { display: none; }
  .rail__nav { display: block; padding: 0 0 0 var(--space-lg); max-height: none; overflow: visible; }
  .rail__nav ul { grid-template-columns: minmax(0, 1fr); }
  .rail__nav a { padding: var(--space-2xs) var(--space-sm); margin-left: calc(var(--space-sm) * -1); }
  .page { padding: var(--space-xl) var(--space-xl) var(--space-3xl) var(--space-2xl); }
}

/* ------------------------------------------------------------ page head, type */
.crumb { margin: 0 0 var(--space-sm); font-size: var(--text-sm); color: var(--color-muted); }
.crumb i { font-style: normal; color: var(--color-rule-2); margin: 0 var(--space-2xs); }
.crumb a { white-space: nowrap; }
.pagehead { margin: 0 0 var(--space-xl); }
h1, h2, h3, h4 { font-style: normal; overflow-wrap: anywhere; min-width: 0; }
h1 { font: 900 var(--text-display)/1.18 var(--font-display); letter-spacing: -0.03em; margin: 0 0 var(--space-md); }
h2 { font: 700 var(--text-lg)/1.3 var(--font-display); letter-spacing: -0.02em; margin: 0 0 var(--space-sm); }
h3 { font: 600 var(--text-md)/1.4 var(--font-body); margin: var(--space-lg) 0 var(--space-xs); }
h4 { font: 600 var(--text-base)/1.4 var(--font-body); margin: 0 0 var(--space-2xs); }
p { margin: 0 0 var(--space-md); }
.lead { font-size: var(--text-lead); line-height: 1.75; color: var(--color-muted); max-width: var(--measure); margin: 0; }
section { border-top: var(--rule-hair) solid var(--color-rule); padding-top: var(--space-lg); margin-top: var(--space-xl); }
.cnt { font: 400 var(--text-sm)/1 var(--font-data); font-style: normal; color: var(--color-muted); margin-left: var(--space-xs); letter-spacing: 0; vertical-align: 0.15em; }
.dim { color: var(--color-muted); }
.note { font-size: var(--text-sm); color: var(--color-muted); margin: var(--space-sm) 0 var(--space-md); max-width: var(--measure); }
.note::before { content: "※ "; color: var(--color-muted); }
.quote { font: 700 var(--text-lead)/1.6 var(--font-display); color: var(--color-muted); }
ul, ol { padding-left: var(--space-lg); margin: 0 0 var(--space-md); }
li { margin: var(--space-2xs) 0; }
ul.plain { list-style: none; padding: 0; }
ul.plain li { padding: var(--space-xs) 0; border-bottom: var(--rule-hair) solid var(--color-rule); margin: 0; }
.cols2, .cols3 { columns: 1; }
.cols2 li, .cols3 li { break-inside: avoid; }
@media (min-width: 46rem) { .cols2 { columns: 2; column-gap: var(--space-xl); } .cols3 { columns: 2; column-gap: var(--space-xl); } }
@media (min-width: 76rem) { .cols3 { columns: 3; } }

/* ------------------------------------------------------------ home: discovery rails */
.people { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-md) var(--space-sm); margin: 0; padding: 0; list-style: none; }
.people li { margin: 0; }
.people a { display: grid; justify-items: center; gap: var(--space-2xs); color: var(--color-ink); text-align: center; }
.people img { image-rendering: pixelated; width: auto; height: 6.5rem; object-fit: contain; }
.people b { font: 700 var(--text-base)/1.3 var(--font-display); white-space: nowrap; }
.people small { font: 400 var(--text-xs)/1.3 var(--font-data); color: var(--color-muted); white-space: nowrap; }
@media (min-width: 40rem) { .people { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
.index { list-style: none; padding: 0; margin: 0; }
.index li { margin: 0; border-bottom: var(--rule-hair) solid var(--color-rule); }
.index a { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0 var(--space-md); padding: var(--space-sm) 0; color: var(--color-ink); align-items: baseline; }
.index a:hover { background: var(--color-paper-2); text-decoration: none; }
.index b { font: 700 var(--text-md)/1.3 var(--font-display); letter-spacing: -0.015em; white-space: nowrap; }
.index em { font: 400 var(--text-sm)/1.3 var(--font-data); font-style: normal; color: var(--color-muted); white-space: nowrap; }
.index span { grid-column: 1 / -1; color: var(--color-muted); font-size: var(--text-sm); line-height: 1.6; }
@media (min-width: 46rem) {
  .index a { grid-template-columns: 11rem minmax(0, 1fr) auto; }
  .index span { grid-column: 2; grid-row: 1; }
  .index em { grid-column: 3; }
}
.more { margin: var(--space-sm) 0 0; font-size: var(--text-sm); }
.more a { white-space: nowrap; }

/* ------------------------------------------------------------ catalogue: a lattice of hairlines, pictures straight on the paper */
.grid { display: grid; gap: var(--rule-hair); background: var(--color-rule); border: var(--rule-hair) solid var(--color-rule); }
.grid.mons { grid-template-columns: repeat(auto-fill, minmax(7.25rem, 1fr)); }
.grid.mons.sm { grid-template-columns: repeat(auto-fill, minmax(6rem, 1fr)); margin-bottom: var(--space-md); }
.grid.maps { grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr)); }
.grid.areas { grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr)); }
@media (min-width: 46rem) { .grid.maps, .grid.areas { grid-template-columns: repeat(auto-fill, minmax(12.5rem, 1fr)); } }
.card { display: flex; flex-direction: column; background: var(--color-paper); color: var(--color-ink); font-size: var(--text-sm); line-height: 1.45; min-width: 0; transition: background-color var(--dur-micro) var(--ease-out); }
.card:hover { background: var(--color-paper-2); text-decoration: none; }
.card b { padding: var(--space-xs) var(--space-sm) 0; font-weight: 600; overflow-wrap: anywhere; }
.card small { padding: var(--space-3xs) var(--space-sm) var(--space-sm); color: var(--color-muted); font: 400 var(--text-xs)/1.5 var(--font-data); }
.card.mon.sm b { padding-bottom: var(--space-xs); font-size: var(--text-xs); font-weight: 400; }
.card .thumb { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; background: var(--color-paper-3); }
.tags { padding: 0 var(--space-xs) var(--space-xs); display: flex; flex-wrap: wrap; gap: var(--space-2xs); margin-top: calc(var(--space-2xs) * -1); }
.spr { display: flex; align-items: flex-end; justify-content: center; height: 6.75rem; padding: var(--space-xs) var(--space-xs) 0; overflow: hidden; }
.spr img { image-rendering: pixelated; max-height: 6rem; max-width: 100%; width: auto; height: auto; object-fit: contain; }
.spr.none::after { content: "그림 없음"; font: 400 var(--text-xs)/1 var(--font-data); color: var(--color-muted); align-self: center; }
.spr.big { height: auto; min-height: 12rem; padding: var(--space-lg) var(--space-md); align-items: center; }
.spr.big img { max-height: 20rem; }
.spr.sm { height: 3.75rem; width: 3.75rem; padding: var(--space-3xs); flex: none; }
.spr.sm img { max-height: 3.5rem; }
.ico { display: inline-flex; align-items: center; justify-content: center; vertical-align: middle; flex: none; }
.ico img { image-rendering: pixelated; max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; }
.ico.sm { width: 1.5rem; height: 1.5rem; margin-right: var(--space-2xs); }
.ico.md { width: 2.75rem; height: 2.75rem; }
.ico.lg { width: 9.5rem; height: 9.5rem; }
.ico.lg img { max-height: 8.75rem; }
.il { white-space: nowrap; }

/* labels: outlined, never filled */
.chip { display: inline-block; font: 400 var(--text-xs)/1.6 var(--font-body); padding: 0 var(--space-xs); border: var(--rule-hair) solid var(--color-rule-2); color: var(--color-muted); white-space: nowrap; vertical-align: 0.08em; background: var(--color-paper); }
.chip.warn { border-color: var(--color-warn); color: var(--color-warn); }
.chip.tag.dim { border-color: var(--color-rule); color: var(--color-muted); }
.chip.el { border-color: transparent; padding-left: 0; background: none; color: var(--color-ink); }
.chip.el::before { content: ""; display: inline-block; width: 0.55em; height: 0.55em; margin-right: var(--space-2xs); background: var(--el-0); }
.chip.el1::before { background: var(--el-1); } .chip.el2::before { background: var(--el-2); } .chip.el3::before { background: var(--el-3); }
.chip.el4::before { background: var(--el-4); } .chip.el5::before { background: var(--el-5); }
.chip.el0 { color: var(--color-muted); }

/* in-page jumps and the list filter */
.toc { display: flex; flex-wrap: wrap; gap: var(--space-2xs) var(--space-md); align-items: baseline; margin: 0 0 var(--space-lg); font-size: var(--text-sm); }
.toc b { font: 500 var(--text-xs)/1.6 var(--font-data); color: var(--color-muted); }
.toc a { white-space: nowrap; }
.filter { display: block; width: 100%; max-width: 22rem; font: 400 var(--text-base)/1.4 var(--font-body); color: var(--color-ink); padding: var(--space-xs) 0; margin: 0 0 var(--space-lg); border: 0; border-bottom: var(--rule-hair) solid var(--color-rule-2); border-radius: var(--radius-none); background: transparent; outline: var(--rule-strong) solid transparent; outline-offset: 2px; }
.filter::placeholder { color: var(--color-muted); }
.filter:hover { border-bottom-color: var(--color-ink); }
.filter:focus-visible { outline-color: var(--color-focus); border-bottom-color: var(--color-ink); }
.filter:active { background: var(--color-paper-2); }

/* ------------------------------------------------------------ tables: the data */
table { border-collapse: collapse; width: 100%; margin: 0 0 var(--space-md); }
td, th { border-bottom: var(--rule-hair) solid var(--color-rule); padding: var(--space-xs) var(--space-sm) var(--space-xs) 0; text-align: left; vertical-align: top; }
th { color: var(--color-muted); font-weight: 400; }
table.kv th { white-space: nowrap; width: 1%; padding-right: var(--space-lg); }
table.kv.wideth th { white-space: normal; }
table.list th { font: 500 var(--text-xs)/1.6 var(--font-data); color: var(--color-muted); white-space: nowrap; border-bottom-color: var(--color-rule-2); vertical-align: bottom; }
table.list td { font-size: var(--text-sm); }
table.list tr:hover td { background: var(--color-paper-2); }
table.narrow { width: auto; min-width: min(100%, 26rem); }
table.num td, table.num th { text-align: right; }
table.num td { font-family: var(--font-data); font-size: var(--text-sm); }
table.num td:first-child, table.num th:first-child { text-align: left; font-family: var(--font-body); }
td.r, th.r { text-align: right; white-space: nowrap; }
td.r { font-family: var(--font-data); font-size: var(--text-sm); }
td.ic { width: 1%; padding: var(--space-2xs) var(--space-xs) var(--space-2xs) 0; }
.scroll { overflow-x: auto; }

/* ------------------------------------------------------------ one thing: the sheet beside its picture */
.detail { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-lg); align-items: start; }
.detail .main > section:first-child { border-top: 0; margin-top: 0; padding-top: 0; }
.info { border-top: var(--rule-strong) solid var(--color-ink); }
.info .pic.item { display: flex; justify-content: center; align-items: center; min-height: 9.5rem; padding: var(--space-sm); }
.info table { margin: 0; }
.info td { font-family: var(--font-data); font-size: var(--text-sm); }
@media (min-width: 52rem) { .detail { grid-template-columns: 19rem minmax(0, 1fr); gap: var(--space-xl); } }
@media (min-width: 62rem) { .info { position: sticky; top: var(--space-lg); } }
.prevnext { display: flex; justify-content: space-between; gap: var(--space-md); margin: var(--space-xl) 0 0; padding-top: var(--space-md); border-top: var(--rule-hair) solid var(--color-rule); font-size: var(--text-sm); }
.prevnext a { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 48%; }

.char { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-md); }
.charpic { display: flex; flex-direction: row; align-items: flex-end; gap: var(--space-md); }
.charpic .face { image-rendering: pixelated; width: auto; height: 9rem; }
.charpic .spr.big { min-height: 0; padding: 0; }
.charpic .spr.big img { max-height: 9rem; }
.char h2 { font-size: var(--text-xl); }
.char h2 .chip { vertical-align: 0.3em; }
.cols { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-2xs) var(--space-xl); }
@media (min-width: 52rem) {
  .char { grid-template-columns: 11rem minmax(0, 1fr); gap: var(--space-xl); }
  .charpic { flex-direction: column; align-items: center; }
  .cols { grid-template-columns: 1.15fr 0.85fr; }
}

.mapfig { margin: 0 0 var(--space-lg); }
.mapfig img { display: block; width: 100%; background: var(--color-paper-3); border: var(--rule-hair) solid var(--color-rule-2); }
.mapfig figcaption { font-size: var(--text-sm); color: var(--color-muted); margin-top: var(--space-xs); }
table.mapinfo { max-width: 40rem; }
.shops { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 19rem), 1fr)); gap: var(--space-lg) var(--space-xl); align-items: start; }
.shop { border-top: var(--rule-strong) solid var(--color-ink); padding-top: var(--space-xs); min-width: 0; }
.shop p { margin: 0; font-size: var(--text-sm); }
.shop table { margin: 0; width: 100%; }
.shopmap { margin-bottom: var(--space-lg); }
.shopmap h3 { margin-top: var(--space-sm); }
.npcs { display: flex; flex-wrap: wrap; gap: var(--space-sm) var(--space-md); margin-bottom: var(--space-sm); }
.npc { display: flex; flex-direction: column; align-items: center; width: 4.75rem; font-size: var(--text-xs); line-height: 1.35; text-align: center; }
.npc b { font-weight: 400; margin-top: var(--space-2xs); overflow-wrap: anywhere; }

/* counts as a strip of figures, not boxes */
.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0; margin: 0 0 var(--space-lg); border-top: var(--rule-strong) solid var(--color-ink); }
.stat { padding: var(--space-sm) var(--space-sm) var(--space-sm) 0; border-bottom: var(--rule-hair) solid var(--color-rule); min-width: 0; }
.stat b { display: block; font: 500 var(--text-lg)/1.2 var(--font-data); letter-spacing: -0.02em; }
.stat span { font-size: var(--text-sm); color: var(--color-muted); }
@media (min-width: 40rem) { .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (min-width: 76rem) { .stats { grid-template-columns: repeat(7, minmax(0, 1fr)); } }

/* cut content: what a scene was, in a few lines */
.cut { list-style: none; padding: 0; margin: 0; }
.cut li { margin: 0; padding: var(--space-md) 0 var(--space-lg); border-bottom: var(--rule-hair) solid var(--color-rule); }
.cut h3 { margin: 0 0 var(--space-2xs); font: 700 var(--text-md)/1.35 var(--font-display); }
.cut small { display: block; font: 400 var(--text-xs)/1.6 var(--font-data); color: var(--color-muted); margin: 0 0 var(--space-sm); }
.cut p { margin: 0; max-width: var(--measure); }

/* ------------------------------------------------------------ long document */
.prose { max-width: var(--measure); }
.prose h2 { margin-top: var(--space-2xl); padding-top: var(--space-lg); border-top: var(--rule-hair) solid var(--color-rule); }
.prose .toc + h2 { margin-top: var(--space-lg); }
.prose section { border: 0; }
.prose table { font-size: var(--text-sm); }
.formula { background: var(--color-paper-2); border: var(--rule-hair) solid var(--color-rule); padding: var(--space-sm) var(--space-md); font: 400 var(--text-sm)/1.75 var(--font-data); white-space: pre-wrap; margin: 0 0 var(--space-md); overflow-wrap: anywhere; }
.cycle { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-xs); margin: 0 0 var(--space-md); font-weight: 600; }
.cycle span { border: var(--rule-hair) solid var(--color-rule-2); padding: var(--space-3xs) var(--space-sm); }
.cycle i { font-style: normal; color: var(--color-warn); font-size: var(--text-sm); font-weight: 400; }

/* ------------------------------------------------------------ colophon */
.colophon { border-top: var(--rule-hair) solid var(--color-rule); margin-top: var(--space-2xl); padding-top: var(--space-md); max-width: var(--measure); font: 400 var(--text-xs)/1.8 var(--font-data); color: var(--color-muted); }
.colophon p { margin: 0; }

/* ------------------------------------------------------------ the finder */
.finder { width: min(36rem, calc(100% - 2rem)); max-height: min(34rem, calc(100dvh - 4rem)); margin: var(--space-3xl) auto auto; padding: 0; border: var(--rule-hair) solid var(--color-ink); border-radius: var(--radius-none); background: var(--color-paper); color: var(--color-ink); box-shadow: 0 12px 40px var(--color-shadow); overflow: hidden; }
.finder[open] { display: flex; flex-direction: column; animation: finder-in var(--dur-short) var(--ease-out); }
.finder::backdrop { background: var(--color-scrim); }
@keyframes finder-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.finder__field { display: flex; align-items: center; gap: var(--space-sm); padding: var(--space-sm) var(--space-md); border-bottom: var(--rule-hair) solid var(--color-rule); }
.finder__field input { flex: 1; min-width: 0; font: 400 var(--text-md)/1.4 var(--font-body); color: var(--color-ink); border: 0; background: transparent; padding: var(--space-2xs) 0; }
.finder__field input::placeholder { color: var(--color-muted); font-size: var(--text-base); }
.finder__field input:focus-visible { outline: none; }
.finder__field:focus-within { box-shadow: inset 0 calc(var(--rule-strong) * -1) 0 var(--color-focus); }
.finder__results { overflow-y: auto; flex: 1; padding: var(--space-xs) 0; min-height: 4rem; }
.finder__group { margin: var(--space-sm) var(--space-md) var(--space-2xs); font: 500 var(--text-xs)/1.4 var(--font-data); color: var(--color-muted); }
.finder__item { display: flex; justify-content: space-between; gap: var(--space-md); padding: var(--space-xs) var(--space-md); color: var(--color-ink); white-space: nowrap; overflow: hidden; }
.finder__item span { overflow: hidden; text-overflow: ellipsis; }
.finder__item small { color: var(--color-muted); font: 400 var(--text-xs)/1.8 var(--font-data); flex: none; }
.finder__item:hover { text-decoration: none; background: var(--color-paper-2); }
.finder__item.is-active { background: var(--color-ink); color: var(--color-paper); }
.finder__item.is-active small { color: var(--color-rule); }
.finder__empty { margin: var(--space-md); color: var(--color-muted); font-size: var(--text-sm); }
.finder__foot { display: none; gap: var(--space-md); margin: 0; padding: var(--space-xs) var(--space-md); border-top: var(--rule-hair) solid var(--color-rule); font-size: var(--text-xs); color: var(--color-muted); }
@media (hover: hover) and (pointer: fine) { .finder__foot { display: flex; } }
@media (max-width: 39.99rem) { .finder { margin-top: var(--space-md); max-height: calc(100dvh - 2rem); } .finder__field kbd { display: none; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 120ms !important; animation-iteration-count: 1 !important; transition-duration: 120ms !important; }
  .finder[open] { animation: none; }
}
@media print {
  .rail, .finder, .filter, .skip { display: none; }
  .shell { display: block; }
  .page { max-width: none; padding: 0; }
}

/* ------------------------------------------------------------ turn-around figure (characters) */
/* the game's own field sprite, straight on the paper: eight facings, standing / walking / running */
.turn { margin: 0; display: flex; flex-direction: column; align-items: center; gap: var(--space-xs); min-width: 0; }
.turn canvas, .turn__still { display: block; image-rendering: pixelated; width: calc(var(--tw) * 2px); height: calc(var(--th) * 2px); }
.turn canvas { touch-action: pan-y; cursor: ew-resize; }
.turn canvas:focus-visible { outline: 2px solid var(--color-focus); outline-offset: var(--space-2xs); }
.turn__ctl { display: flex; flex-direction: column; align-items: stretch; gap: var(--space-2xs); width: 100%; max-width: 11rem; }
.turn__ctl[hidden] { display: none; }
/* a monster: its picture at the page's own scale, the motions as a row that wraps */
.turn.turn--mon canvas, .turn.turn--mon .turn__still { width: calc(var(--tw) * var(--ts, 2) * 1px); height: calc(var(--th) * var(--ts, 2) * 1px); max-width: 100%; height: auto; aspect-ratio: var(--tw) / var(--th); }
.turn--mon .turn__ctl { max-width: 22rem; }
.turn__motions { flex-wrap: wrap; }
.turn__row.turn__motions[role="group"] .turn__btn { flex: 1 0 auto; margin: 0 calc(var(--rule-hair) * -1) calc(var(--rule-hair) * -1) 0; white-space: nowrap; }
.turn__rot[hidden] { display: none; }
.turn__note { font: 400 var(--text-xs)/1.5 var(--font-body, inherit); color: var(--color-ink-2, inherit); }
.turn__row { display: flex; align-items: stretch; }
.turn__row[role="group"] .turn__btn, .turn__row .turn__dir { flex: 1 1 0; }
.turn__row .turn__btn + .turn__btn { margin-left: calc(var(--rule-hair) * -1); }
.turn__btn {
  font: 400 var(--text-xs)/1 var(--font-body); color: var(--color-muted); background: var(--color-paper);
  border: var(--rule-hair) solid var(--color-rule-2); border-radius: var(--radius-none);
  min-width: 2.75rem; min-height: 2.75rem; padding: 0 var(--space-2xs); white-space: nowrap; cursor: pointer;
  transition: border-color var(--dur-micro) var(--ease-out), color var(--dur-micro) var(--ease-out);
}
.turn__btn:hover { border-color: var(--color-ink); color: var(--color-ink); position: relative; }
.turn__btn:focus-visible { position: relative; }
.turn__btn:active { background: var(--color-paper-2); }
.turn__btn[aria-pressed="true"] { border-color: var(--color-ink); color: var(--color-ink); font-weight: 600; position: relative; }
.turn__btn:disabled { opacity: 0.55; cursor: not-allowed; }
.turn__dir { display: flex; align-items: center; justify-content: center; min-width: 0; padding: 0 var(--space-2xs); font: 400 var(--text-xs)/1 var(--font-data); white-space: nowrap; color: var(--color-muted); border-top: var(--rule-hair) solid var(--color-rule-2); border-bottom: var(--rule-hair) solid var(--color-rule-2); }
.charpic { flex-wrap: wrap; }
@media (min-width: 52rem) {
  .turn canvas, .turn__still { width: calc(var(--tw) * 3px); height: calc(var(--th) * 3px); }
}

/* ------------------------------------------------------------ a script read in order (unused stories) */
.script { max-width: var(--measure); }
.script .say { display: grid; grid-template-columns: 6.5rem minmax(0, 1fr); gap: 0 var(--space-md); padding: var(--space-xs) 0; }
.script .who { font: 600 var(--text-sm)/1.7 var(--font-body); color: var(--color-muted); overflow-wrap: anywhere; }
.script .who img { display: block; image-rendering: pixelated; height: 3.5rem; width: auto; margin-bottom: var(--space-3xs); }
.script .say p { margin: 0; }
.script .say.screen p { font-family: var(--font-display); }
.script .dir { font: 400 var(--text-xs)/1.6 var(--font-data); color: var(--color-muted); margin: var(--space-sm) 0 var(--space-2xs); }
.script .dir a { white-space: nowrap; }
.script .br { padding-left: var(--space-lg); }
.script ol.pick { margin: 0 0 var(--space-sm); padding-left: calc(6.5rem + var(--space-md) + 1.4em); }
.script ol.pick li { margin: 0; }
.cast { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--space-md) var(--space-lg); margin: var(--space-sm) 0 var(--space-lg); padding: 0; list-style: none; }
.cast li { margin: 0; font-size: var(--text-sm); color: var(--color-muted); text-align: center; }
.cast img { display: block; image-rendering: pixelated; height: 6rem; width: auto; margin: 0 auto var(--space-2xs); }
.cut h3 a { color: inherit; }
.cut .more { display: inline-block; margin-top: var(--space-xs); font-size: var(--text-sm); }
@media (max-width: 30rem) {
  .script .say { grid-template-columns: minmax(0, 1fr); gap: var(--space-3xs) 0; }
  .script .who img { display: inline-block; height: 2.5rem; margin: 0 var(--space-2xs) 0 0; vertical-align: middle; }
  .script .br { padding-left: var(--space-sm); }
  .script ol.pick { padding-left: 1.4em; }
}

/* ------------------------------------------------------------ the story: the book's list and one event's branches */
.rail__out { margin-bottom: var(--space-md); }
.rail__out a { color: var(--color-muted); }
table.list.story td.no { font: 500 var(--text-sm)/1.6 var(--font-data); white-space: nowrap; text-align: right; padding-right: var(--space-md); }
table.list.story td.dim { color: var(--color-muted); max-width: 22rem; }
table.list.story td.num { font-family: var(--font-data); text-align: right; color: var(--color-muted); }
.toc ul { display: flex; flex-wrap: wrap; gap: var(--space-2xs) var(--space-md); margin: 0; padding: 0; list-style: none; }
.toc li { margin: 0; }
.toc em { font: 400 var(--text-xs)/1 var(--font-data); font-style: normal; color: var(--color-muted); margin-left: var(--space-3xs); }
/* the branch diagram: boxes left to right; a fork stacks its arms, the lines meet again after it */
.flow { overflow-x: auto; padding: var(--space-sm) 0 var(--space-md); margin: 0 0 var(--space-lg); }
.flow:focus-visible { outline: var(--rule-strong) solid var(--color-focus); outline-offset: 2px; }
.fl__seq { display: flex; align-items: center; width: max-content; }
.fl__seq > * + * { margin-left: var(--space-lg); position: relative; }
.fl__seq > * + *::before { content: ''; position: absolute; right: 100%; top: 50%; width: var(--space-lg); border-top: var(--rule-hair) solid var(--color-rule-2); }
.fl__box { flex: none; width: 14rem; border: var(--rule-hair) solid var(--color-rule-2); background: var(--color-paper); padding: var(--space-xs) var(--space-sm); }
.fl__body { list-style: none; margin: 0; padding: 0; font-size: var(--text-sm); line-height: 1.5; }
.fl__body li { margin: 0 0 var(--space-3xs); overflow-wrap: anywhere; }
.fl__body li:last-child { margin-bottom: 0; }
.fl__body small { font: 400 var(--text-xs)/1 var(--font-data); color: var(--color-muted); margin-left: var(--space-2xs); white-space: nowrap; }
.fl__pick, .fl__end { font: 400 var(--text-xs)/1.6 var(--font-data); color: var(--color-muted); }
.fl__next { font-weight: 600; }
.fl__if { margin: 0 0 var(--space-2xs); padding-bottom: var(--space-3xs); border-bottom: var(--rule-hair) dashed var(--color-rule); font: 500 var(--text-xs)/1.5 var(--font-data); color: var(--color-muted); }
.fl__tag { flex: none; max-width: 12rem; padding: var(--space-3xs) var(--space-xs); border: var(--rule-hair) dashed var(--color-rule-2); background: var(--color-paper); font: 500 var(--text-xs)/1.5 var(--font-data); color: var(--color-muted); }
.fl__tag--pass { border-style: dotted; }
/* a fork: its arms stacked; each arm draws its piece of the two bars and its stubs to them */
.fl__fork { display: flex; flex-direction: column; }
.fl__arm { position: relative; display: flex; align-items: center; padding: var(--space-2xs) 0; }
.fl__in { flex: none; width: var(--space-md); border-top: var(--rule-hair) solid var(--color-rule-2); }
.fl__out { flex: 1 0 var(--space-md); border-top: var(--rule-hair) solid var(--color-rule-2); }
.fl__arm::before, .fl__arm::after { content: ''; position: absolute; top: 0; bottom: 0; border-left: var(--rule-hair) solid var(--color-rule-2); }
.fl__arm::before { left: 0; }
.fl__arm::after { right: 0; }
.fl__arm:first-child::before, .fl__arm:first-child::after { top: 50%; }
.fl__arm:last-child::before, .fl__arm:last-child::after { bottom: 50%; }
.fl__arm:only-child::before, .fl__arm:only-child::after { display: none; }
@media (max-width: 30rem) { .fl__box { width: 12rem; } }

/* the dialogue book (2026-10-12): the chapters as cards, one page per chapter, a pager between them */
.readall { font-size: var(--text-md); margin: 0 0 var(--space-lg); }
.grid.chapters { grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr)); }
.card.chap .faces { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--space-2xs); min-height: 3rem; padding: var(--space-xs) var(--space-sm) 0; }
.card.chap .faces img { height: 2.5rem; width: auto; image-rendering: pixelated; }
.card.chap .quote { padding: var(--space-2xs) var(--space-sm) 0; color: var(--color-muted); font-size: var(--text-sm); overflow-wrap: anywhere; }
.pager { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-md); padding: var(--space-sm) 0; font-size: var(--text-md); }
.pager--top { margin: 0 0 var(--space-lg); border-bottom: var(--rule-hair) solid var(--color-rule); }
.pager--bottom { margin: var(--space-xl) 0 0; border-top: var(--rule-hair) solid var(--color-rule); }
.pager__prev, .pager__next { flex: 1 1 0; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pager__next { text-align: right; }
.pager__all { flex: none; font: 400 var(--text-xs)/1.5 var(--font-data); color: var(--color-muted); }
.chap__head { display: grid; grid-template-columns: minmax(0, 20rem) minmax(0, 1fr); gap: var(--space-lg); align-items: start; margin: 0 0 var(--space-md); }
.chap__pic img { display: block; width: auto; max-width: 100%; height: auto; max-height: 16rem; border: var(--rule-hair) solid var(--color-rule); }
.cast .cnt { display: block; font: 400 var(--text-xs)/1.4 var(--font-data); color: var(--color-muted); }
.scene { scroll-margin-top: var(--space-xl); }
.scene h2 a { font-family: var(--font-data); font-weight: 500; }
.scene__meta { margin: calc(-1 * var(--space-xs)) 0 var(--space-sm); color: var(--color-muted); font-size: var(--text-sm); }
@media (max-width: 40rem) { .chap__head { grid-template-columns: minmax(0, 1fr); } .pager { font-size: var(--text-base); } }
