:root {
  --ink: #17202b;
  --ink-soft: #3c4d60;
  --rail: #121920;
  --rail-2: #1c2834;
  --rail-line: #2c3c4c;
  --rail-text: #e6eef4;
  --rail-dim: #b7c5d2;
  --zinc: #d5dde6;
  --sheet: #f3f6f8;
  --paper: #f8fafb;
  --rule: #d0d9e2;
  --steel: #35506a;
  --brass: #8d6b30;
  --brass-ink: #684c1c;
  --brass-soft: #f6f1e6;
  --mark: #b8431f;
  --mark-ink: #8a3012;
  --mark-soft: #f8ece7;
  --patina: #1a645d;
  --patina-soft: #e5f3f1;
  --display: "Big Shoulders Display", "Arial Narrow", sans-serif;
  --serif: Literata, Palatino, "Palatino Linotype", serif;
  --sans: "IBM Plex Sans", "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --shadow: 0 18px 48px rgba(18, 25, 32, 0.14);
  --rail-w: 280px;
  --field: #ffffff;
  --code-bg: #e7eef3;
  --input-border: #b7c5d1;
  --rule-line: #e0d3b8;
  --plate: #17202b;
  --plate-text: #f3f6f8;
  --hover-row: #ffffff;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --ink: #e7eef3;
  --ink-soft: #b7c5d2;
  --zinc: #0c1218;
  --sheet: #161d26;
  --paper: #1d2631;
  --rule: #31404e;
  --steel: #9bb3c8;
  --brass: #e0bc7a;
  --brass-ink: #f0d7a4;
  --brass-soft: #2c2618;
  --mark: #e07a45;
  --mark-ink: #f3b89a;
  --mark-soft: #3a261e;
  --patina: #8ed4cb;
  --patina-soft: #16312e;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.45);
  --field: #10161d;
  --code-bg: #243140;
  --input-border: #3d5164;
  --rule-line: #5a4a2e;
  --hover-row: #243140;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { scroll-behavior: auto; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--zinc);
  font-family: var(--serif);
  font-optical-sizing: auto;
  font-size: 1.0625rem;
  line-height: 1.6;
}

::selection { background: #8a4a32; color: #f8fafb; }

.skip {
  position: absolute;
  left: 1rem;
  top: -4rem;
  background: var(--ink);
  color: white;
  padding: 0.5rem 0.8rem;
  z-index: 50;
}
.skip:focus { top: 0.6rem; }

a { color: var(--mark-ink); text-underline-offset: 0.18em; }
a:hover { color: var(--ink); }

button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible {
  outline: 2px solid var(--mark);
  outline-offset: 3px;
}

.noscript {
  margin: 1rem;
  padding: 1rem;
  background: var(--sheet);
  border-left: 4px solid var(--mark);
}

.topbar {
  display: none;
  position: sticky;
  top: 0;
  z-index: 30;
  align-items: center;
  gap: 0.8rem;
  padding: 0.7rem 0.9rem;
  background: var(--rail);
  color: var(--rail-text);
}
.topbar button {
  background: transparent;
  color: var(--rail-text);
  border: 1px solid var(--rail-line);
  padding: 0.4rem 0.7rem;
  font-family: var(--sans);
  font-size: 0.92rem;
}
#top-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--rail-dim);
}
.back {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--rail-text);
}
.topbar .back { border-bottom: 1px solid transparent; }
.topbar .back:hover { color: white; border-bottom-color: var(--mark); }
.theme-btn {
  background: transparent;
  color: var(--rail-text);
  border: 1px solid var(--rail-line);
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.35rem 0.55rem;
  text-decoration: none;
}
.theme-btn:hover { border-color: var(--mark); color: white; }
.rail-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  margin: 0 0.2rem 0.85rem;
}
.rail-back {
  display: inline-block;
  margin: 0;
  color: var(--rail-dim);
}
.rail-back:hover { color: var(--rail-text); }
.rail-tools .theme-btn { flex: none; }

#backdrop {
  position: fixed;
  inset: 0;
  background: rgba(18, 25, 32, 0.45);
  z-index: 25;
}
#copy-fallback {
  position: fixed;
  z-index: 40;
  left: 50%;
  bottom: 1rem;
  transform: translateX(-50%);
  width: min(36rem, calc(100vw - 2rem));
  background: var(--sheet);
  border: 1px solid var(--ink);
  box-shadow: var(--shadow);
  padding: 0.85rem 1rem 1rem;
}
#copy-fallback p { margin: 0 0 0.45rem; font-family: var(--sans); font-size: 0.92rem; }
#copy-fallback textarea {
  width: 100%;
  min-height: 7rem;
  font-family: var(--mono);
  font-size: 0.82rem;
  line-height: 1.45;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--rule);
  background: var(--field);
}

.app { display: flex; min-height: 100vh; align-items: stretch; }

#rail {
  width: var(--rail-w);
  flex: none;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
  background: var(--rail);
  color: var(--rail-text);
  z-index: 26;
  padding: 1.4rem 1rem 1.6rem;
}
#rail a { color: inherit; text-decoration: none; }
.wordmark {
  display: block;
  text-decoration: none;
  padding: 0 0.4rem 1rem;
  border-bottom: 1px solid var(--rail-line);
}
.wordmark::before {
  content: "";
  display: block;
  width: 14px;
  height: 14px;
  background: var(--mark);
  margin-bottom: 0.7rem;
}
.wordmark strong {
  display: block;
  font-family: var(--display);
  font-weight: 700;
  font-size: 2.35rem;
  letter-spacing: 0.02em;
  line-height: 0.85;
}
.wordmark span {
  display: block;
  margin-top: 0.45rem;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--rail-dim);
}
.rail-label {
  margin: 1.15rem 0.4rem 0.35rem;
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--rail-dim);
}
.sheet-nav { display: flex; flex-direction: column; gap: 1px; }
.sheet-nav a, .work-nav a {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.55rem;
  align-items: baseline;
  padding: 0.38rem 0.4rem;
  border-left: 2px solid transparent;
  font-family: var(--sans);
  font-size: 0.92rem;
  line-height: 1.3;
}
.sheet-nav a:hover, .work-nav a:hover,
.sheet-nav a[aria-current="page"], .work-nav a[aria-current="page"] {
  background: var(--rail-2);
  border-left-color: var(--mark);
}
.sheet-nav .code, .work-nav .code {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--rail-dim);
}
.tick {
  width: 0.55rem;
  height: 0.55rem;
  border: 1px solid var(--rail-dim);
  align-self: center;
}
.tick.is-done { background: var(--patina); border-color: var(--patina); }
.tick.is-open { background: var(--brass); border-color: var(--brass); }
.work-nav a { grid-template-columns: 1fr auto; }
.layers { display: flex; flex-direction: column; gap: 0.28rem; padding: 0 0.2rem; }
.layers a {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.28rem 0.45rem;
  font-family: var(--sans);
  font-size: 0.78rem;
  color: var(--rail-dim);
  border-left: 2px solid var(--rail-line);
}
.layers a.is-on { color: white; border-left-color: var(--mark); }
.layers i { font-style: normal; font-family: var(--mono); font-size: 0.68rem; }
.rail-foot {
  margin-top: 1.2rem;
  padding-top: 0.9rem;
  border-top: 1px solid var(--rail-line);
  font-family: var(--sans);
  font-size: 0.82rem;
  color: var(--rail-dim);
}
.rail-foot p { margin: 0 0 0.7rem; }
.rail-foot button:not(.theme-btn) {
  background: transparent;
  color: var(--rail-dim);
  border: 0;
  padding: 0;
  font-family: var(--sans);
  font-size: 0.82rem;
  text-decoration: underline;
  text-underline-offset: 0.18em;
}
.reset-box {
  margin-top: 0.6rem;
  padding: 0.6rem;
  background: var(--rail-2);
  color: var(--rail-text);
}
.reset-box p { margin: 0 0 0.5rem; }
.reset-box button { margin-right: 0.4rem; text-decoration: none; border: 1px solid var(--rail-line); padding: 0.25rem 0.45rem; color: var(--rail-text); }

.desk {
  flex: 1;
  min-width: 0;
  padding: 1.4rem 1.4rem 3rem;
}
.sheet {
  width: min(920px, 100%);
  margin: 0 auto;
  background: var(--sheet);
  box-shadow: var(--shadow);
  position: relative;
  min-height: calc(100vh - 2.8rem);
}
.sheet.is-wide { width: min(1080px, 100%); }
.sheet-in { padding: clamp(1.3rem, 3vw, 2.6rem); }
.sheet-foot {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.7rem 1.2rem 0.9rem;
  border-top: 1px solid var(--rule);
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.crops {
  position: absolute;
  inset: 9px;
  width: calc(100% - 18px);
  height: calc(100% - 18px);
  pointer-events: none;
}

.eyebrow, .meta, .kicker {
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brass-ink);
  margin: 0;
}
.meta { color: var(--ink-soft); letter-spacing: 0.04em; text-transform: none; margin-top: 0.8rem; }

.mast { display: grid; grid-template-columns: 1.4fr 0.8fr; gap: 1.5rem 2rem; align-items: end; }
.mast h1 {
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(4.6rem, 12vw, 7.6rem);
  line-height: 0.78;
  letter-spacing: 0.01em;
  margin: 0.15rem 0 0.6rem;
}
.thesis {
  font-size: 1.28rem;
  line-height: 1.45;
  margin: 0;
  max-width: 36ch;
}
.cartouche {
  border: 1px solid var(--ink);
  background: var(--paper);
  align-self: stretch;
}
.cartouche header {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.45rem 0.7rem;
  background: var(--plate);
  color: var(--plate-text);
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.cartouche dl { margin: 0; }
.cartouche dl div {
  display: grid;
  grid-template-columns: 7.2rem 1fr;
  gap: 0.4rem;
  padding: 0.42rem 0.7rem;
  border-top: 1px solid var(--rule);
  font-family: var(--sans);
  font-size: 0.86rem;
}
.cartouche dt { color: var(--ink-soft); margin: 0; }
.cartouche dd { margin: 0; font-weight: 500; }
.cartouche dd.is-ready { color: var(--patina); }

.stage { margin: 1.8rem 0 0.4rem; overflow-x: auto; max-width: 100%; }
.stage .diag { min-width: 720px; }
.cut { display: none; }

@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}
.mast h1 { animation: rise 0.55s ease both; }
.cartouche { animation: rise 0.7s ease 0.1s both; }
.diag .band { animation: rise 0.45s ease both; }
.diag .band:nth-of-type(1) { animation-delay: 0.05s; }
.diag .band:nth-of-type(2) { animation-delay: 0.12s; }
.diag .band:nth-of-type(3) { animation-delay: 0.19s; }
.diag .band:nth-of-type(4) { animation-delay: 0.26s; }
.diag .band:nth-of-type(5) { animation-delay: 0.33s; }
.diag .band:nth-of-type(6) { animation-delay: 0.4s; }
.fig { margin: 1.2rem 0 1.4rem; overflow-x: auto; max-width: 100%; }
html[data-theme="dark"] .fig .diag,
html[data-theme="dark"] .stage .diag { background: #f3f6f8; }
.fig .diag { width: 100%; height: auto; min-width: 640px; display: block; }
.fig figcaption, .sched figcaption {
  font-family: var(--sans);
  font-size: 0.88rem;
  color: var(--ink-soft);
  margin-top: 0.45rem;
}

.home-block { margin-top: 2.2rem; }
.home-block h2, .lesson-head h1, .sheet h1.page-title {
  font-family: var(--display);
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 0.9;
  margin: 0 0 0.7rem;
}
.home-block h2 { font-size: clamp(2rem, 4vw, 2.8rem); max-width: 18ch; }
.lede { font-size: 1.12rem; max-width: 62ch; }

.akt, .card-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  border: 1px solid var(--ink);
}
.akt li, .card-grid li {
  margin: 0;
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--rule);
  font-family: var(--sans);
  font-size: 0.95rem;
  line-height: 1.4;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.6rem;
  align-items: start;
}
.akt .box, .card-grid .n {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--ink-soft);
  padding-top: 0.2rem;
}
.akt li.is-done { background: var(--patina-soft); }
.akt li.is-done .box { color: var(--patina); }

.index { width: 100%; border-collapse: collapse; font-family: var(--sans); font-size: 0.95rem; }
.index th {
  text-align: left;
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 500;
  color: var(--ink-soft);
  padding: 0.4rem 0.5rem;
  border-bottom: 1px solid var(--ink);
}
.index td { padding: 0.55rem 0.5rem; border-bottom: 1px solid var(--rule); vertical-align: baseline; }
.index a { color: inherit; text-decoration: none; }
.index tr:hover td { background: var(--hover-row); }
.index .code { font-family: var(--mono); font-size: 0.78rem; color: var(--brass-ink); }
.status.is-done { color: var(--patina); font-weight: 600; }
.status.is-open { color: var(--brass-ink); }

.lesson-head h1 {
  font-size: clamp(3rem, 7vw, 4.8rem);
  max-width: 14ch;
  margin: 0.25rem 0 0.8rem;
}
.promise {
  font-size: 1.2rem;
  line-height: 1.45;
  max-width: 46ch;
  margin: 0.4rem 0 0;
}

.prose { max-width: 68ch; margin-top: 1.6rem; }
.prose h2 {
  font-family: var(--sans);
  font-weight: 600;
  font-size: 1.45rem;
  letter-spacing: -0.02em;
  line-height: 1.25;
  margin: 2.3rem 0 0.75rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--rule);
}
.prose p, .say p, .exercise p, .note p, .rule p, .sources p { margin: 0 0 0.85rem; }
.prose p, .exercise .prompt p { font-size: 1.125rem; line-height: 1.65; }
.prose ul, .prose ol, .exercise ul, .exercise ol { margin: 0 0 1rem; padding-left: 1.2rem; }
.prose li, .exercise li { margin: 0.28rem 0; padding-left: 0.2rem; }
.prose li::marker { color: var(--brass-ink); }
code {
  font-family: var(--mono);
  font-size: 0.84em;
  background: var(--code-bg);
  padding: 0.05em 0.32em;
}
.pre {
  font-family: var(--mono);
  font-size: 0.8rem;
  line-height: 1.55;
  white-space: pre-wrap;
  background: var(--code-bg);
  padding: 1rem 1.05rem;
  border-left: 3px solid var(--brass);
  max-width: 74ch;
  overflow-x: auto;
}

.rule, .note, .say, .exercise, .quiz, .sources, .pair, .sched, .terms {
  max-width: 74ch;
}
.rule {
  margin: 1.2rem 0;
  padding: 0.85rem 1rem 0.2rem;
  background: var(--brass-soft);
  border: 1px solid var(--rule-line);
}
.rule-k, .note-k {
  display: block;
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 0.3rem;
}
.rule-k { color: var(--brass-ink); }
.rule p { font-family: var(--sans); font-weight: 600; font-size: 1.05rem; line-height: 1.45; }

.note { margin: 1.15rem 0; padding: 0.85rem 1rem 0.25rem; background: var(--paper); border-left: 3px solid var(--steel); }
.note h3, .pair h3, .say h2, .exercise h2, .quiz h2, .sources h2 {
  font-family: var(--sans);
  font-size: 1.12rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0 0 0.4rem;
  line-height: 1.3;
}
.note.is-duty { border-left-color: var(--steel); }
.note.is-mistake { border-left-color: var(--mark); background: var(--mark-soft); }
.note.is-decision { border-left-color: var(--patina); background: var(--patina-soft); }
.note.is-interview { border-left-color: var(--brass); background: var(--brass-soft); }
.note.is-revision { border-left-color: var(--mark-ink); }
.note-k { color: var(--ink-soft); }

blockquote {
  margin: 1.2rem 0;
  padding: 0.2rem 0 0.2rem 1rem;
  border-left: 2px solid var(--ink);
  max-width: 58ch;
}
blockquote p { font-style: italic; font-size: 1.2rem; line-height: 1.45; }
blockquote footer { font-family: var(--sans); font-style: normal; font-size: 0.88rem; color: var(--ink-soft); }

.pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--rule);
  border: 1px solid var(--rule);
  margin: 1.1rem 0 1.3rem;
  max-width: 74ch;
}
.pair > div { background: var(--paper); padding: 0.9rem 1rem 0.4rem; }
.pair p { font-size: 1rem; }

.sched { margin: 1.1rem 0 1.3rem; }
.table-wrap { overflow-x: auto; border-top: 1px solid var(--ink); }
.sched table, .gloss table { width: 100%; border-collapse: collapse; font-family: var(--sans); font-size: 0.92rem; }
.sched th, .sched td, .gloss th, .gloss td {
  text-align: left;
  vertical-align: top;
  padding: 0.5rem 0.55rem;
  border-bottom: 1px solid var(--rule);
}
.sched th {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 500;
  color: var(--ink-soft);
}

.terms { margin: 0.4rem 0 1rem; }
.terms div { display: grid; grid-template-columns: 9.5rem 1fr; gap: 0.8rem; padding: 0.45rem 0; border-bottom: 1px solid var(--rule); }
.terms dt { font-family: var(--sans); font-weight: 600; margin: 0; }
.terms dd { margin: 0; }

.say, .exercise, .quiz, .sources { margin-top: 2rem; padding-top: 1.2rem; border-top: 1px solid var(--rule); }
.say { background: linear-gradient(90deg, var(--brass-soft), transparent 28%); padding: 1rem 0 0.2rem 1rem; border-top: 0; border-left: 3px solid var(--brass); max-width: 68ch; }
.say p { font-size: 1.12rem; font-style: italic; }

.field { display: block; margin: 0 0 0.9rem; }
.field span, .rubric-q {
  display: block;
  font-family: var(--sans);
  font-weight: 600;
  font-size: 0.92rem;
  margin-bottom: 0.3rem;
}
.hint { display: block; font-family: var(--sans); font-weight: 400; color: var(--ink-soft); font-size: 0.82rem; margin-top: 0.15rem; }
textarea, input[type="text"], input[type="search"] {
  width: 100%;
  background: var(--field);
  border: 1px solid var(--input-border);
  padding: 0.65rem 0.7rem;
  border-radius: 0;
}
textarea { min-height: 7.5rem; resize: vertical; line-height: 1.5; font-family: var(--serif); }
.actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0.6rem 0 0.4rem; }

.btn {
  appearance: none;
  border: 1px solid var(--plate);
  background: var(--plate);
  color: var(--plate-text);
  font-family: var(--sans);
  font-size: 0.92rem;
  padding: 0.62rem 0.85rem;
}
.btn:hover { background: var(--mark); border-color: var(--mark); color: white; }
.btn.ghost { background: transparent; color: var(--ink); }
.btn.ghost:hover { background: var(--mark-soft); color: var(--mark-ink); border-color: var(--mark); }
.btn:disabled { opacity: 0.55; cursor: default; }

.anchor {
  margin-top: 0.8rem;
  padding: 0.8rem 0.9rem 0.2rem;
  background: var(--field);
  border: 1px solid var(--rule);
}
.saved { font-family: var(--sans); font-size: 0.85rem; color: var(--patina); min-height: 1.2em; }

.q { border: 0; margin: 0 0 1.1rem; padding: 0; }
.q legend { font-family: var(--sans); font-weight: 600; padding: 0; margin-bottom: 0.45rem; }
.choice {
  display: flex;
  gap: 0.55rem;
  align-items: flex-start;
  width: 100%;
  text-align: left;
  margin: 0 0 0.4rem;
  padding: 0.65rem 0.75rem;
  background: var(--paper);
  border: 1px solid var(--rule);
  font-family: var(--sans);
  font-size: 0.98rem;
  line-height: 1.4;
}
.choice:hover { border-color: var(--steel); }
.choice.is-hit, .choice.is-right { border-color: var(--patina); background: var(--patina-soft); }
.choice.is-defend { border-color: var(--brass); background: var(--brass-soft); }
.choice.is-weak, .choice.is-wrong { border-color: var(--mark); background: var(--mark-soft); }
.choice .grade { display: block; margin-top: 0.45rem; font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-soft); }
.why { display: block; margin-top: 0.35rem; color: var(--ink-soft); font-size: 0.9rem; }
.quiz-result { font-family: var(--sans); font-size: 1.05rem; }
.quiz-result strong { font-weight: 600; }

.pager {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--ink);
  font-family: var(--sans);
}
.pager a { text-decoration: none; max-width: 46%; }
.pager small { display: block; font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-soft); }
.pager span { display: block; color: var(--ink); font-weight: 600; }

.studio-grid { display: grid; grid-template-columns: 1.15fr 0.85fr; gap: 1.2rem; align-items: start; }
.brief {
  position: sticky;
  top: 1rem;
  background: var(--paper);
  border: 1px solid var(--ink);
  padding: 0.9rem 1rem 1rem;
  font-family: var(--sans);
  font-size: 0.9rem;
}
.brief h2 { font-family: var(--display); font-size: 2rem; margin: 0.2rem 0 0.6rem; line-height: 0.9; }
.brief section { padding: 0.45rem 0; border-top: 1px solid var(--rule); }
.brief h3 { margin: 0; font-size: 0.78rem; font-family: var(--mono); letter-spacing: 0.06em; text-transform: uppercase; font-weight: 500; color: var(--brass-ink); }
.brief p { margin: 0.2rem 0 0; white-space: pre-wrap; }
.rubric { margin-top: 1.2rem; }
.rubric-row { padding: 0.7rem 0; border-bottom: 1px solid var(--rule); }
.scores { display: flex; gap: 0.35rem; }
.scores button[aria-pressed="true"] { background: var(--plate); color: var(--plate-text); border-color: var(--plate); }

.drill { padding: 1rem 0 1.1rem; border-bottom: 1px solid var(--rule); scroll-margin-top: 4.5rem; }
.drill h2 { font-family: var(--sans); font-size: 1.2rem; margin: 0 0 0.4rem; }
.forces { font-size: 1.05rem; }
.reveal { margin-top: 0.7rem; padding: 0.7rem 0.8rem; background: var(--paper); border-left: 3px solid var(--steel); }
#quiz { scroll-margin-top: 4.5rem; }

.gloss-tools { max-width: 28rem; margin: 0.6rem 0 1rem; }
.gloss-group { margin: 1.4rem 0; }
.gloss-group h2 { font-family: var(--sans); font-size: 1.15rem; margin: 0 0 0.4rem; }

.empty { font-size: 1.1rem; max-width: 52ch; }
.journal article { padding: 0.9rem 0; border-bottom: 1px solid var(--rule); }
.journal h2 { font-family: var(--sans); font-size: 1.15rem; margin: 0 0 0.3rem; }
.journal pre { white-space: pre-wrap; font-family: var(--serif); font-size: 1rem; margin: 0; }

.page-title { font-size: clamp(3rem, 7vw, 4.8rem); max-width: 16ch; }

@media (max-width: 980px) {
  .mast, .studio-grid, .akt, .card-grid, .pair, .terms div { grid-template-columns: 1fr; }
  .brief { position: static; }
  .cartouche { align-self: stretch; }
}

@media (max-width: 860px) {
  .topbar {
    display: flex;
    height: 3.6rem;
    padding-top: 0;
    padding-bottom: 0;
  }
  .desk { padding: 0.7rem 0.7rem 2.4rem; }
  .stage { display: none; }
  .cut { display: block; margin: 1.3rem 0 0.2rem; }
  .cut-band {
    display: grid;
    grid-template-columns: 5.4rem 1fr;
    gap: 0.35rem 0.55rem;
    align-items: center;
    background: var(--paper);
    border: 1px solid var(--steel);
    padding: 0.5rem 0.55rem;
    margin: 0 0 0.4rem;
  }
  .cut-meta { color: inherit; text-decoration: none; }
  .cut-meta .n {
    display: block;
    font-family: var(--mono);
    font-size: 0.72rem;
    letter-spacing: 0.06em;
    color: var(--brass-ink);
  }
  .cut-meta strong { font-weight: 600; font-family: var(--sans); font-size: 0.95rem; }
  .cut-rooms { display: flex; flex-wrap: wrap; gap: 0.35rem; }
  .room {
    flex: 1 1 5.2rem;
    background: var(--field);
    border: 1px solid var(--steel);
    color: var(--ink);
    text-decoration: none;
    text-align: center;
    font-family: var(--mono);
    font-size: 0.75rem;
    letter-spacing: 0.02em;
    padding: 0.48rem 0.35rem;
  }
  .cut-ground {
    margin: 0.15rem 0 0;
    font-family: var(--sans);
    font-size: 0.84rem;
    color: var(--ink-soft);
  }
  #rail {
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    padding-top: 4.5rem;
    scroll-padding-top: 4.5rem;
    transform: translateX(-105%);
    width: min(320px, 88vw);
    box-shadow: var(--shadow);
  }
  .wordmark { scroll-margin-top: 4.5rem; }
  body.rail-open #rail { transform: none; }
  .sheet { min-height: 0; }
  .pager { flex-direction: column; }
  .pager a { max-width: none; }
}

@media (prefers-reduced-motion: reduce) {
  #rail { transition: none; }
  .band, .mast h1, .cartouche { animation: none !important; opacity: 1 !important; }
}

@media (min-width: 861px) {
  #rail { transition: none; }
}
@media (max-width: 860px) {
  #rail { transition: transform 0.2s ease; }
}
@media (max-width: 860px) and (prefers-reduced-motion: reduce) {
  #rail { transition: none; }
}

@media print {
  body { background: white; }
  #rail, .topbar, #backdrop, #copy-fallback, .pager, .quiz, .actions, .crops, .sheet-foot { display: none !important; }
  .desk { padding: 0; }
  .sheet { box-shadow: none; width: 100%; }
  .app { display: block; }
  a { color: inherit; text-decoration: none; }
}
