/* The Solo Operator's Field Manual: field-guide reading system.
   Layout: a fixed left spine (volumes + chapters) on wide screens, a top bar on narrow ones;
   the reading column is 68ch with a right margin for sidebars at >=1100px; a quiet Care bar is pinned to the bottom. */

@import url('https://fonts.googleapis.com/css2?family=Source+Serif+4:ital,opsz,wght@0,8..60,400;0,8..60,600;1,8..60,400&family=IBM+Plex+Sans+Condensed:wght@400;500;600&family=IBM+Plex+Mono:wght@400;500&display=swap');

:root {
  --paper: #f3f2ec;
  --paper-2: #eae8e0;
  --paper-3: #dfdcd2;
  --ink: #1e2227;
  --ink-2: #4a5057;
  --ink-3: #7b8188;
  --rule: #cfccc2;
  --accent: #2d6e6a;          /* overridden per volume */
  --accent-ink: #ffffff;
  --accent-soft: color-mix(in srgb, var(--accent) 12%, var(--paper));
  --amber: #a6711c;
  --amber-soft: #f3e6cc;
  --care: #5f5a86;
  --care-soft: #e9e6f3;
  --ok: #2f6b3a;
  --danger: #8a3a3a;
  --shadow: 0 1px 2px rgba(20,24,28,.08), 0 8px 24px rgba(20,24,28,.08);
  --serif: 'Source Serif 4', Georgia, 'Times New Roman', serif;
  --sans: 'IBM Plex Sans Condensed', 'Helvetica Neue', Arial, sans-serif;
  --mono: 'IBM Plex Mono', 'SFMono-Regular', Menlo, Consolas, monospace;
  --spine-w: 300px;
  --measure: 68ch;
  --radius: 4px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #15181b; --paper-2: #1d2125; --paper-3: #262b30;
    --ink: #e6e3da; --ink-2: #b5b1a6; --ink-3: #868279; --rule: #353a40;
    --accent-ink: #0f1214; --amber: #d9a54a; --amber-soft: #3a2f16;
    --care: #b3acdb; --care-soft: #25233a; --ok: #7fbf8a; --danger: #d98080;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.4);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #15181b; --paper-2: #1d2125; --paper-3: #262b30;
  --ink: #e6e3da; --ink-2: #b5b1a6; --ink-3: #868279; --rule: #353a40;
  --accent-ink: #0f1214; --amber: #d9a54a; --amber-soft: #3a2f16;
  --care: #b3acdb; --care-soft: #25233a; --ok: #7fbf8a; --danger: #d98080;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.4);
  color-scheme: dark;
}
/* Calm mode (Volume 10, Chapter 9.5, or by choice): lower contrast, no accent saturation, wider leading. */
:root[data-calm="1"] {
  --accent: #6b7580; --paper: #f1f1ee; --ink: #2f343a; --ink-2: #5a6068; --rule: #d9d7d0; --accent-soft: #e7e9ea;
}
@media (prefers-color-scheme: dark) { :root[data-calm="1"]:not([data-theme="light"]) { --paper: #191b1e; --ink: #cfccc4; --ink-2: #a19d95; --accent: #8a929c; --accent-soft: #23272b; --rule: #30343a; } }
:root[data-calm="1"][data-theme="dark"] { --paper: #191b1e; --ink: #cfccc4; --ink-2: #a19d95; --accent: #8a929c; --accent-soft: #23272b; --rule: #30343a; }
:root[data-calm="1"] body { line-height: 1.75; }
:root[data-calm="1"] *, :root[data-calm="1"] *::before, :root[data-calm="1"] *::after { animation: none !important; transition: none !important; }

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font-family: var(--serif); font-size: 17px; line-height: 1.6;
  font-feature-settings: 'onum' 0; -webkit-font-smoothing: antialiased;
}
:root[data-density="compact"] body { font-size: 15.5px; line-height: 1.5; }
:root[data-density="loose"] body { font-size: 18px; line-height: 1.8; }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
h1, h2, h3, h4 { font-family: var(--sans); font-weight: 600; line-height: 1.2; text-wrap: balance; margin: 0; }
h1 { font-size: 2rem; letter-spacing: -.01em; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.15rem; margin-top: 2.2rem; margin-bottom: .6rem; }
h4 { font-size: 1rem; margin-top: 1.6rem; margin-bottom: .4rem; color: var(--ink-2); }
p { margin: 0 0 1.05em; }
ul, ol { padding-left: 1.4em; margin: 0 0 1.05em; }
li { margin-bottom: .35em; }
li > p { margin-bottom: .4em; }
strong { font-weight: 600; }
code, pre { font-family: var(--mono); font-size: .85em; }
pre { background: var(--paper-2); border: 1px solid var(--rule); border-radius: var(--radius); padding: .9rem 1rem; overflow-x: auto; line-height: 1.5; }
blockquote { margin: 1.2rem 0; padding: .2rem 0 .2rem 1rem; border-left: 3px solid var(--accent); color: var(--ink-2); }
hr { border: 0; border-top: 1px solid var(--rule); margin: 2rem 0; }
.eyebrow { font-family: var(--sans); font-size: .78rem; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); }
.num { font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* tables: field-guide ledger */
.table-wrap { overflow-x: auto; margin: 1.2rem 0; border: 1px solid var(--rule); border-radius: var(--radius); }
table { border-collapse: collapse; width: 100%; font-size: .92rem; font-family: var(--sans); }
thead th { text-align: left; font-weight: 600; background: var(--paper-2); border-bottom: 1px solid var(--rule); padding: .55rem .7rem; white-space: nowrap; }
td { padding: .5rem .7rem; border-bottom: 1px solid var(--rule); vertical-align: top; min-width: 7em; }
tbody tr:last-child td { border-bottom: 0; }
td:first-child { font-weight: 500; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: var(--spine-w) 1fr; min-height: 100%; }
.spine {
  position: sticky; top: 0; height: 100vh; overflow-y: auto; background: var(--paper-2);
  border-right: 1px solid var(--rule); padding: 1rem 1rem 6rem; font-family: var(--sans);
}
.spine .brand { display: block; color: var(--ink); text-decoration: none; margin-bottom: 1rem; }
.spine .brand b { display: block; font-size: 1.05rem; font-weight: 600; }
.spine .brand span { font-size: .8rem; color: var(--ink-3); }
.spine nav details { margin-bottom: .15rem; }
.spine nav summary { cursor: pointer; padding: .35rem .5rem; border-radius: var(--radius); list-style: none; display: flex; gap: .55rem; align-items: baseline; font-weight: 500; font-size: .92rem; }
.spine nav summary::-webkit-details-marker { display: none; }
.spine nav summary:hover { background: var(--paper-3); }
.spine nav summary .vn { font-family: var(--mono); font-size: .75rem; color: var(--accent-ink); background: var(--vcolor, var(--accent)); border-radius: 3px; padding: 0 .35em; min-width: 1.7em; text-align: center; }
.spine a.ch { display: block; padding: .25rem .5rem .25rem 2.5rem; font-size: .86rem; color: var(--ink-2); text-decoration: none; border-radius: var(--radius); }
.spine a.ch:hover { background: var(--paper-3); color: var(--ink); }
.spine a.ch.active { color: var(--ink); background: var(--paper-3); font-weight: 500; }
.spine a.ch .cn { font-family: var(--mono); font-size: .75rem; color: var(--ink-3); margin-right: .4em; }
.spine .tools { display: flex; flex-wrap: wrap; gap: .4rem; margin: .6rem 0 1rem; }
.spine .locked { opacity: .55; }
.spine .locked summary::after { content: 'locked'; font-size: .7rem; color: var(--ink-3); margin-left: auto; font-family: var(--mono); }

.main { min-width: 0; padding: 0 clamp(16px, 4vw, 48px) 7rem; }
.topbar { display: none; }
.scrim { display: none; } /* on wide screens the scrim must not take a grid cell, or main drops below the spine */
.reading { max-width: calc(var(--measure) + 260px); margin: 0 auto; padding-top: 2.2rem; }
.reading > article { max-width: var(--measure); }
.chapter-head { margin-bottom: 1.8rem; padding-bottom: 1rem; border-bottom: 2px solid var(--accent); }
.chapter-head .eyebrow { color: var(--accent); margin-bottom: .4rem; }
.chapter-head h1 { font-size: clamp(1.6rem, 3.5vw, 2.2rem); }
.chapter-head .meta { font-family: var(--sans); font-size: .82rem; color: var(--ink-3); margin-top: .5rem; display: flex; gap: 1rem; flex-wrap: wrap; }
.chapter-nav { display: flex; justify-content: space-between; gap: 1rem; margin-top: 3rem; padding-top: 1.2rem; border-top: 1px solid var(--rule); font-family: var(--sans); font-size: .92rem; }
.chapter-nav a { text-decoration: none; max-width: 48%; }
.chapter-nav a small { display: block; color: var(--ink-3); font-size: .75rem; letter-spacing: .06em; text-transform: uppercase; }
.vol-intro { font-style: italic; color: var(--ink-2); font-size: 1.05rem; }
.plate { margin: 1.5rem 0 2rem; }
.plate figure { margin: 0; }
.plate svg { width: 100%; height: auto; display: block; max-width: 100%; }
.plate figcaption { font-family: var(--sans); font-size: .82rem; color: var(--ink-2); margin-top: .5rem; }
.plate figcaption b { font-family: var(--mono); font-weight: 500; color: var(--accent); margin-right: .5em; }

/* ---------- inline components ---------- */
a.xref { text-decoration: none; border-bottom: 1px dotted var(--accent); color: inherit; }
a.xref:hover { background: var(--accent-soft); }
.peek { position: absolute; z-index: 40; max-width: 360px; background: var(--paper); border: 1px solid var(--rule); border-radius: var(--radius); box-shadow: var(--shadow); padding: .7rem .85rem; font-size: .88rem; line-height: 1.45; }
.peek .eyebrow { margin-bottom: .25rem; }
.peek b { font-family: var(--sans); display: block; margin-bottom: .3rem; }
.gloss { border-bottom: 1px dotted var(--ink-3); cursor: help; }
/* "Figures checked <Month YYYY>" line under every table that carries a figure; muted in light, dark and calm alike via the ink tokens. */
.checked { font-family: var(--sans); font-size: .76rem; color: var(--ink-3); margin: -.7rem 0 1.4rem .1rem; letter-spacing: .01em; }
.checked a.xref { color: var(--ink-3); }
.changes .entry { margin: 2rem 0; padding-top: 1.2rem; border-top: 1px solid var(--rule); }
.changes .entry h2 { font-size: 1.15rem; margin: 0 0 .6rem; }
.changes .entry p { font-size: 1rem; }
.front-foot { margin-top: 2rem; padding-top: .8rem; border-top: 1px solid var(--rule); font-family: var(--sans); font-size: .82rem; color: var(--ink-3); }
.verify { font-family: var(--sans); font-size: .78em; color: var(--amber); background: var(--amber-soft); border-radius: 3px; padding: 0 .3em; white-space: nowrap; cursor: help; }
a.src::after { content: '↗'; font-size: .7em; margin-left: .15em; vertical-align: super; color: var(--ink-3); }
.badge { display: inline-flex; align-items: center; gap: .35em; font-family: var(--sans); font-size: .74rem; padding: .1em .5em; border-radius: 999px; border: 1px solid var(--rule); color: var(--ink-2); background: var(--paper-2); }
.badge.amber { border-color: var(--amber); color: var(--amber); background: var(--amber-soft); }

/* side panel (cross-ref open) */
.panel { position: fixed; top: 0; right: 0; height: 100vh; width: min(560px, 100vw); background: var(--paper); border-left: 1px solid var(--rule); box-shadow: var(--shadow); z-index: 60; transform: translateX(100%); transition: transform .25s ease; display: flex; flex-direction: column; }
.panel.open { transform: none; }
.panel header { display: flex; align-items: center; gap: .6rem; padding: .8rem 1rem; border-bottom: 1px solid var(--rule); font-family: var(--sans); }
.panel header b { flex: 1; font-weight: 600; }
.panel .body { overflow-y: auto; padding: 1rem 1.2rem 6rem; }
.panel .body article { max-width: 100%; }

/* exercises */
.exercises { margin: 1rem 0; display: grid; gap: .6rem; }
.ex { display: grid; grid-template-columns: auto 1fr; gap: .7rem; padding: .8rem .9rem; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--paper-2); align-items: start; }
.ex input[type=checkbox] { width: 1.15rem; height: 1.15rem; margin-top: .25rem; accent-color: var(--accent); }
.ex .ex-body { min-width: 0; }
.ex .ex-text { font-size: .97rem; }
.ex .done-when { font-family: var(--sans); font-size: .84rem; color: var(--ink-2); margin-top: .35rem; }
.ex .done-when b { color: var(--accent); font-weight: 600; }
.ex textarea { width: 100%; margin-top: .5rem; min-height: 2.4rem; font: inherit; font-size: .9rem; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--paper); color: var(--ink); padding: .4rem .5rem; resize: vertical; }
.ex .ex-meta { font-family: var(--mono); font-size: .72rem; color: var(--ink-3); margin-top: .3rem; }
.ex.done { border-color: var(--accent); }
.ex.done .ex-text { color: var(--ink-2); }

/* sidebars and callouts */
.aside { border-left: 3px solid var(--accent); background: var(--accent-soft); padding: .8rem 1rem; margin: 1.2rem 0; border-radius: 0 var(--radius) var(--radius) 0; font-size: .95rem; }
.aside .eyebrow { color: var(--accent); margin-bottom: .3rem; }
.aside.care { border-color: var(--care); background: var(--care-soft); }
.aside.care .eyebrow { color: var(--care); }
@media (min-width: 1100px) {
  .reading > article { position: relative; }
  .margin-note { position: absolute; right: -260px; width: 230px; font-family: var(--sans); font-size: .82rem; color: var(--ink-2); line-height: 1.4; border-top: 1px solid var(--rule); padding-top: .4rem; }
}
@media (max-width: 1099px) { .margin-note { font-family: var(--sans); font-size: .85rem; color: var(--ink-2); border-top: 1px solid var(--rule); padding-top: .4rem; margin: 1rem 0; } }

/* ---------- calculator kit ---------- */
.calc { border: 1px solid var(--rule); border-radius: var(--radius); background: var(--paper-2); margin: 1.4rem 0; font-family: var(--sans); overflow: hidden; }
.calc > header { display: flex; align-items: center; gap: .6rem; padding: .7rem .95rem; border-bottom: 1px solid var(--rule); background: var(--paper-3); }
.calc > header .eyebrow { color: var(--accent); }
.calc > header b { font-size: 1rem; font-weight: 600; flex: 1; }
.calc .calc-body { display: grid; grid-template-columns: 1fr 1fr; gap: 0; }
@media (max-width: 720px) { .calc .calc-body { grid-template-columns: 1fr; } }
.calc .calc-inputs { padding: .8rem .95rem; display: grid; gap: .55rem; align-content: start; border-right: 1px solid var(--rule); }
@media (max-width: 720px) { .calc .calc-inputs { border-right: 0; border-bottom: 1px solid var(--rule); } }
.calc .calc-results { padding: .8rem .95rem; display: grid; gap: .45rem; align-content: start; background: var(--paper); }
.field { display: grid; gap: .2rem; min-width: 0; }
.field label { font-size: .8rem; color: var(--ink-2); }
.field .in { display: flex; align-items: center; gap: .35rem; }
.field input, .field select { font: inherit; font-family: var(--mono); font-size: .92rem; width: 100%; min-width: 0; padding: .4rem .5rem; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--paper); color: var(--ink); }
.field .unit { font-family: var(--mono); font-size: .8rem; color: var(--ink-3); }
.result { display: flex; justify-content: space-between; gap: .8rem; align-items: baseline; padding: .3rem 0; border-bottom: 1px dashed var(--rule); }
.result:last-child { border-bottom: 0; }
.result .label { font-size: .85rem; color: var(--ink-2); }
.result .value { font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 1rem; font-weight: 500; white-space: nowrap; }
.result.primary .value { font-size: 1.25rem; color: var(--accent); }
.result.warn .value { color: var(--amber); }
.result.bad .value { color: var(--danger); }
.result.good .value { color: var(--ok); }
.calc footer, .calc .calc-note { padding: .6rem .95rem; font-size: .8rem; color: var(--ink-3); border-top: 1px solid var(--rule); }
.calc .actions { display: flex; gap: .4rem; flex-wrap: wrap; }
.btn { font-family: var(--sans); font-size: .85rem; font-weight: 500; padding: .4rem .8rem; border-radius: var(--radius); border: 1px solid var(--rule); background: var(--paper); color: var(--ink); cursor: pointer; }
.btn:hover { background: var(--paper-3); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.small { font-size: .78rem; padding: .25rem .6rem; }
.btn.quiet { border-color: transparent; background: transparent; color: var(--ink-2); }
.calc .grid-wrap { overflow-x: auto; }
.calc table { font-size: .84rem; }
.calc table input { width: 6.5em; font-family: var(--mono); font-size: .84rem; padding: .25rem .35rem; border: 1px solid var(--rule); border-radius: 3px; background: var(--paper); color: var(--ink); text-align: right; }
.calc .chart { padding: .6rem .95rem .2rem; }
.calc .chart svg { width: 100%; height: auto; display: block; }
.floor-line { stroke: var(--danger); stroke-dasharray: 4 3; }
.bar { fill: var(--accent); }
.bar.under { fill: var(--danger); }
.axis text, .lbl { font-family: var(--sans); font-size: 11px; fill: var(--ink-2); }
.axis line, .axis path { stroke: var(--rule); }

/* ---------- atlas ---------- */
.atlas { font-family: var(--sans); margin: 1.4rem 0; }
.atlas .controls { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; margin-bottom: .8rem; }
.tilemap { display: grid; grid-template-columns: repeat(12, 1fr); gap: 3px; max-width: 760px; }
.tile { aspect-ratio: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; border-radius: 3px; cursor: pointer; border: 1px solid transparent; color: var(--ink); background: var(--paper-3); font-size: clamp(9px, 1.3vw, 13px); line-height: 1.1; text-align: center; position: relative; }
.tile b { font-family: var(--mono); font-weight: 500; }
.tile small { font-size: .75em; opacity: .85; display: none; }
@media (min-width: 720px) { .tile small { display: block; } }
.tile.mine { outline: 2px solid var(--ink); outline-offset: -2px; }
.tile:hover, .tile:focus-visible { border-color: var(--ink); }
.legend { display: flex; gap: .3rem; align-items: center; font-size: .8rem; color: var(--ink-2); margin-top: .6rem; flex-wrap: wrap; }
.legend i { display: inline-block; width: 1.6em; height: .9em; border-radius: 2px; }
.state-card { border: 1px solid var(--rule); border-radius: var(--radius); background: var(--paper-2); padding: .9rem 1rem; margin-top: .8rem; font-size: .92rem; }
.state-card h3 { margin-top: 0; }
.glance { border: 1px solid var(--rule); border-radius: var(--radius); margin: 1.2rem 0; font-family: var(--sans); font-size: .9rem; overflow: hidden; }
.glance header { background: var(--accent); color: var(--accent-ink); padding: .5rem .9rem; font-weight: 600; display: flex; justify-content: space-between; gap: 1rem; }
.glance .row { display: grid; grid-template-columns: minmax(9em, 1fr) 2fr; gap: .8rem; padding: .45rem .9rem; border-top: 1px solid var(--rule); }
.glance .row span:first-child { color: var(--ink-2); }
.tabs { display: flex; gap: .2rem; flex-wrap: wrap; border-bottom: 1px solid var(--rule); margin: 1rem 0; font-family: var(--sans); }
.tabs a { padding: .4rem .7rem; font-size: .86rem; text-decoration: none; color: var(--ink-2); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a.active, .tabs a:hover { color: var(--ink); border-color: var(--accent); }

/* ---------- care layer ---------- */
.carebar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; background: var(--care-soft); color: var(--ink); border-top: 1px solid var(--rule); font-family: var(--sans); font-size: .86rem; padding: .45rem clamp(12px, 3vw, 24px); padding-bottom: calc(.45rem + env(safe-area-inset-bottom, 0px)); display: flex; gap: .8rem 1.2rem; align-items: center; flex-wrap: wrap; }
.carebar b { font-weight: 600; color: var(--care); }
.carebar a { color: var(--ink); font-weight: 500; text-decoration: none; border: 1px solid var(--rule); border-radius: 999px; padding: .15rem .65rem; background: var(--paper); }
.carebar a:hover { border-color: var(--care); }
.carebar .spacer { flex: 1; }
.carebar .quiet { color: var(--ink-3); font-size: .78rem; }
.crisis-rows { display: grid; gap: .5rem; margin: 1rem 0; }
.crisis-row { display: flex; justify-content: space-between; gap: 1rem; align-items: center; padding: .8rem 1rem; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--paper-2); font-family: var(--sans); flex-wrap: wrap; }
.crisis-row a.call { font-family: var(--mono); font-size: 1.1rem; font-weight: 500; text-decoration: none; color: var(--ink); border: 1px solid var(--care); border-radius: var(--radius); padding: .3rem .7rem; background: var(--paper); }

/* ---------- toolbar / dialogs ---------- */
.toolbar { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; font-family: var(--sans); margin-bottom: 1.2rem; }
.search { position: relative; flex: 1; min-width: 180px; }
.search input { width: 100%; font: inherit; font-family: var(--sans); font-size: .9rem; padding: .45rem .7rem; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--paper-2); color: var(--ink); }
.search .results { position: absolute; top: 100%; left: 0; right: 0; z-index: 45; background: var(--paper); border: 1px solid var(--rule); border-radius: var(--radius); box-shadow: var(--shadow); max-height: 60vh; overflow-y: auto; }
.search .results a { display: block; padding: .5rem .7rem; text-decoration: none; color: var(--ink); border-bottom: 1px solid var(--rule); font-size: .88rem; }
.search .results a:hover, .search .results a.sel { background: var(--accent-soft); }
.search .results small { display: block; color: var(--ink-3); font-size: .76rem; }
.dialog { position: fixed; inset: 0; z-index: 70; background: rgba(20,24,28,.45); display: none; align-items: center; justify-content: center; padding: 16px; }
.dialog.open { display: flex; }
.dialog .box { background: var(--paper); border: 1px solid var(--rule); border-radius: 6px; box-shadow: var(--shadow); width: min(640px, 100%); max-height: 90vh; overflow-y: auto; padding: 1.2rem 1.3rem; font-family: var(--sans); }
.dialog .box h2 { font-size: 1.2rem; margin-bottom: .8rem; }
.dialog .grid { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; }
@media (max-width: 560px) { .dialog .grid { grid-template-columns: 1fr; } }
.dialog .row-actions { display: flex; gap: .5rem; justify-content: flex-end; margin-top: 1rem; flex-wrap: wrap; }
.toast { position: fixed; bottom: 4.2rem; left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--paper); font-family: var(--sans); font-size: .86rem; padding: .5rem .9rem; border-radius: 999px; z-index: 80; opacity: 0; transition: opacity .2s; pointer-events: none; }
.toast.show { opacity: 1; }
.record h3 { margin-top: 1.4rem; }
.record .ex { background: transparent; }

/* ---------- screening companion ---------- */
.screen { border: 1px solid var(--rule); border-radius: var(--radius); background: var(--paper-2); padding: 1rem 1.1rem; margin: 1.4rem 0; font-family: var(--sans); }
.screen .q { display: grid; grid-template-columns: 1fr; gap: .3rem; padding: .6rem 0; border-top: 1px solid var(--rule); }
.screen .q .opts { display: flex; gap: .3rem; flex-wrap: wrap; }
.screen .q .opts label { font-size: .82rem; border: 1px solid var(--rule); border-radius: 999px; padding: .2rem .6rem; cursor: pointer; background: var(--paper); }
.screen .q .opts input { position: absolute; opacity: 0; width: 0; height: 0; }
.screen .q .opts input:checked + span { font-weight: 600; }
.screen .q .opts label:has(input:checked) { border-color: var(--ink); }
.screen .help { border: 1px solid var(--care); background: var(--care-soft); border-radius: var(--radius); padding: .9rem 1rem; margin-top: .8rem; }

/* ---------- landing / gate pages ---------- */
.landing { max-width: 860px; margin: 0 auto; padding: clamp(24px, 6vw, 72px) clamp(16px, 4vw, 40px) 7rem; }
.landing header.hero { border-bottom: 2px solid var(--accent); padding-bottom: 1.4rem; margin-bottom: 2rem; }
.landing .hero h1 { font-size: clamp(2rem, 6vw, 3.4rem); letter-spacing: -.02em; }
.landing .hero .sub { font-size: 1.15rem; font-style: italic; color: var(--ink-2); margin-top: .6rem; max-width: 40em; }
.landing .hero .by { font-family: var(--sans); color: var(--ink-3); margin-top: .8rem; font-size: .9rem; }
.signup { border: 1px solid var(--rule); background: var(--paper-2); border-radius: 6px; padding: 1.2rem 1.3rem; margin: 2rem 0; font-family: var(--sans); }
.signup h2 { font-size: 1.25rem; margin-bottom: .4rem; }
.signup p { font-family: var(--serif); }
.signup form { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .8rem; }
.signup input[type=email] { flex: 1; min-width: 220px; font: inherit; font-size: 1rem; padding: .6rem .8rem; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--paper); color: var(--ink); }
.signup .btn { font-size: 1rem; padding: .6rem 1.1rem; }
.signup .msg { width: 100%; font-size: .9rem; margin-top: .4rem; min-height: 1.3em; }
.signup .msg.err { color: var(--danger); }
.signup .msg.ok { color: var(--ok); }
.vol-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: .7rem; margin: 1.4rem 0; font-family: var(--sans); }
.vol-card { border: 1px solid var(--rule); border-top: 4px solid var(--vcolor, var(--accent)); border-radius: var(--radius); padding: .7rem .85rem; background: var(--paper-2); font-size: .9rem; text-decoration: none; color: var(--ink); }
.vol-card b { display: block; font-size: .95rem; }
.vol-card small { color: var(--ink-3); }
.vol-card.locked { opacity: .65; }

/* ---------- responsive shell ---------- */
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .spine { position: fixed; left: 0; top: 0; bottom: 0; width: min(85vw, 340px); transform: translateX(-100%); transition: transform .22s ease; z-index: 65; height: 100vh; }
  .spine.open { transform: none; box-shadow: var(--shadow); }
  .topbar { display: flex; position: sticky; top: env(safe-area-inset-top, 0px); z-index: 55; background: var(--paper-2); border-bottom: 1px solid var(--rule); padding: .55rem 12px; gap: .6rem; align-items: center; font-family: var(--sans); font-size: .9rem; }
  .topbar b { flex: 1; font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .main { padding: 0 16px 8rem; }
  .reading { padding-top: 1.4rem; }
  .scrim { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 60; display: none; }
  .scrim.show { display: block; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
@media print {
  .spine, .topbar, .carebar, .toolbar, .chapter-nav, .panel, .btn, .scrim { display: none !important; }
  .shell { display: block; } .main { padding: 0; } body { font-size: 11pt; color: #000; background: #fff; }
  a { color: #000; } a.src::after { content: ' (' attr(href) ')'; font-size: .8em; }
  .calc, .atlas { break-inside: avoid; }
}
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
