/* TVRSK. Swiss: Geist at heavy weights, tight spacing, a blue square for the period. Mono only for small details. See STYLE.md. */

@font-face {
  font-family: "Geist";
  src: url("/fonts/Geist-VF.woff") format("woff");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Geist Mono";
  src: url("/fonts/GeistMono-VF.woff") format("woff");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

/* Themes: auto follows the system (paper in light, ink in dark). */

:root,
[data-theme="paper"] {
  --bg: #f3f2ee;
  --surface: #fbfaf7;
  --ink: #161615;
  --ink-2: #3a3935;
  --muted: #6f6c63;
  --rule: #dfdcd3;
  --rule-2: #c9c5b9;
  --dot: #2f43ff;
  --on-dot: #ffffff;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --bg: #0d0d0c;
    --surface: #151514;
    --ink: #ecebe6;
    --ink-2: #c9c6be;
    --muted: #85827a;
    --rule: #262522;
    --rule-2: #3a3833;
    --dot: #8c98ff;
    --on-dot: #0d0d0c;
    color-scheme: dark;
  }
}

[data-theme="ink"] {
  --bg: #0d0d0c;
  --surface: #151514;
  --ink: #ecebe6;
  --ink-2: #c9c6be;
  --muted: #85827a;
  --rule: #262522;
  --rule-2: #3a3833;
  --dot: #8c98ff;
  --on-dot: #0d0d0c;
  color-scheme: dark;
}

[data-theme="amber"] {
  --bg: #100c06;
  --surface: #17120a;
  --ink: #ffb547;
  --ink-2: #e7a240;
  --muted: #a5753a;
  --rule: #2a1f10;
  --rule-2: #46341b;
  --dot: #fff0cf;
  --on-dot: #100c06;
  color-scheme: dark;
}

:root {
  --sans: "Geist", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --radius: 4px;
  --measure: 46rem;  /* content width */
  --gutter: 16px;    /* screen edge to guide line */
  --inset: 1.5rem;   /* guide line to content */
}

/* Base */

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; overflow-x: clip; }
body { overflow-x: clip; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 16.5px/1.6 var(--sans);
  letter-spacing: -0.006em;
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--dot); color: var(--bg); }
:focus-visible { outline: 2px solid var(--dot); outline-offset: 2px; border-radius: 2px; }
input, textarea { caret-color: var(--dot); }

.page {
  position: relative;
  min-height: 100vh;
  max-width: calc(var(--measure) + 2 * (var(--gutter) + var(--inset)));
  margin: 0 auto;
  padding: 0 calc(var(--gutter) + var(--inset)) 2rem;
}

.skip { position: absolute; left: -999px; top: 0; }
.skip:focus {
  left: 16px;
  top: 12px;
  z-index: 1;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius);
  background: var(--ink);
  color: var(--bg);
  text-decoration: none;
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* The square: the logo's period. Brand marks only (wordmark, line lockups, icon), never generic text. */

.sq {
  display: inline-block;
  width: 0.19em;
  height: 0.19em;
  margin-left: 0.04em;
  background: var(--dot);
  color: transparent;
  overflow: hidden;
  vertical-align: baseline;
}

/* Type */

p { margin: 0 0 1rem; text-wrap: pretty; }
h1, h2, h3 { margin: 0; text-wrap: balance; }

h2 {
  margin-bottom: 1rem;
  font: 650 1.4rem/1.2 var(--sans);
  letter-spacing: -0.025em;
}
h3 { font: 750 1.1rem/1.2 var(--sans); letter-spacing: -0.03em; }

a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: var(--rule-2);
  text-underline-offset: 0.22em;
  transition: color 0.12s ease, text-decoration-color 0.12s ease, background-color 0.12s ease;
}
a:hover { text-decoration-color: var(--dot); }

.dim { color: var(--muted); }
.label { color: var(--muted); font: 400 12.5px/1.5 var(--mono); letter-spacing: 0; }

kbd {
  padding: 1px 6px;
  border: 1px solid var(--rule-2);
  border-radius: var(--radius);
  color: var(--muted);
  font: 500 12px/1.4 var(--mono);
}

section { margin: 3.5rem 0; }

/* Lockups: TVRSK▪txt */

.lockup { font-weight: 900; letter-spacing: -0.065em; white-space: nowrap; }
.lockup .ext { margin-left: 0.04em; font-weight: 500; letter-spacing: -0.04em; }

/* Top bar */

.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  padding: 1.1rem 0;
}
.prompt { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 0.85rem; min-width: 0; }
.mark { font: 900 1.35rem/1 var(--sans); letter-spacing: -0.075em; text-decoration: none; }
.path { color: var(--muted); font: 400 12.5px/1 var(--mono); letter-spacing: 0; }
.path a { text-decoration: none; }
.path a:hover { color: var(--ink); }
.path .sep { color: var(--rule-2); }
.path [aria-current] { color: var(--ink); }

.nav { display: flex; gap: 1.4rem; font-size: 14.5px; font-weight: 500; }
.nav a { color: var(--muted); text-decoration: none; }
.nav a:hover { color: var(--ink); }
.nav [aria-current] { color: var(--ink); text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 0.4em; }

/* Home */

.hero { padding: 2.75rem 0 2.25rem; }

.logo {
  margin: 0 0 0 -0.05em;
  font: 900 clamp(3.4rem, 15vw, 6rem)/0.85 var(--sans);
  letter-spacing: -0.075em;
}

/* The toolbox: every line as a drawer, in a ruled grid. */
.drawers { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; margin-top: 2rem; overflow: hidden; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--rule); }
.drawer { padding: 1rem 1rem 1.1rem; background: var(--surface); }
.drawer > a { font-size: 1.35rem; text-decoration: none; }
.drawer-sum { margin: 0.35rem 0 0.65rem; color: var(--muted); font-size: 13.5px; line-height: 1.4; }
.drawer ul { display: grid; gap: 0.2rem; margin: 0; padding: 0; list-style: none; font-size: 14.5px; }
.drawer li a { text-decoration: none; }
.drawer li a:hover { text-decoration: underline; text-decoration-color: var(--dot); }
.drawer .more a { color: var(--muted); font-size: 13.5px; }
@media (max-width: 760px) { .drawers { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
@media (max-width: 460px) { .drawers { grid-template-columns: minmax(0, 1fr); } }

.tagline { max-width: 34rem; margin: 1.1rem 0 0; color: var(--ink-2); font-size: 1.3rem; line-height: 1.35; letter-spacing: -0.02em; }

.index { margin-top: 2.5rem; }
.index-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0.25rem 1rem; }
.index-head h2 { margin: 0; }

.search {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 1.1rem 0 0.5rem;
  padding: 0.65rem 0.8rem;
  border: 1px solid var(--rule-2);
  border-radius: var(--radius);
  background: var(--surface);
  transition: border-color 0.12s ease;
}
.search:focus-within { border-color: var(--dot); }
.search input {
  flex: 1;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
}
.search input:focus { outline: none; }
.search input::placeholder { color: var(--muted); }
.search input::-webkit-search-cancel-button { display: none; }

/* Tool rows */

.tools { margin: 0; padding: 0; list-style: none; }
.tool {
  display: grid;
  grid-template-columns: 13rem 1fr auto;
  gap: 0 1.25rem;
  align-items: baseline;
  padding: 0.6rem 0.5rem;
  border-bottom: 1px solid var(--rule);
  text-decoration: none;
}
.name { font-weight: 650; letter-spacing: -0.02em; }
.blurb { color: var(--muted); font-size: 14.5px; }
.go, .tag { white-space: nowrap; color: var(--muted); font: 400 12.5px/1 var(--mono); letter-spacing: 0; }
a.tool:hover { background: var(--surface); }
a.tool:hover .go { color: var(--dot); }
a.tool:hover .name { text-decoration: underline; text-decoration-color: var(--dot); text-decoration-thickness: 2px; text-underline-offset: 0.2em; }
.is-soon .name { color: var(--muted); font-weight: 500; }

.empty { margin: 1rem 0 0; padding: 0 0.5rem; color: var(--muted); }
.all { margin-top: 1rem; font-size: 14.5px; }

/* Ad slot: fixed height so the page never jumps when an ad loads */

.ad {
  display: grid;
  place-items: center;
  min-height: 100px;
  margin: 3.5rem 0;
  border: 1px dashed var(--rule-2);
  border-radius: var(--radius);
}

/* Inner pages */

.title {
  margin: 2.75rem 0 1rem;
  font: 700 clamp(2.4rem, 8.5vw, 3.9rem)/1 var(--sans);
  letter-spacing: -0.04em;
}
.title.bare { font-weight: 900; }
.title.bare .lockup .ext { font-weight: 400; }
.lead { max-width: 34rem; margin-bottom: 2.25rem; color: var(--ink-2); font-size: 1.25rem; line-height: 1.4; letter-spacing: -0.018em; }

.prose { max-width: 40rem; }
.prose h2 { margin-top: 0; }
.prose ol, .prose ul { margin: 0 0 1rem; padding-left: 1.5rem; }
.prose li { margin: 0.4rem 0; }
.prose li::marker { color: var(--muted); font-weight: 600; }

.plain { margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--rule); }
.plain li { display: grid; grid-template-columns: 8rem 1fr; gap: 1rem; padding: 0.6rem 0; border-bottom: 1px solid var(--rule); align-items: baseline; }
.plain a { font-size: 1.1rem; text-decoration: none; }
.plain a:hover .ext { text-decoration: underline; text-decoration-color: var(--dot); }
.plain span:not(.lockup):not(.ext):not(.sq) { color: var(--muted); }

/* Tool panel */

.panel {
  overflow: hidden;
  border: 1px solid var(--rule-2);
  border-radius: var(--radius);
  background: var(--surface);
  transition: border-color 0.12s ease;
}
.panel:focus-within { border-color: var(--dot); }

.panel-bar, .panel-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  color: var(--muted);
  font: 400 12.5px/1.4 var(--mono);
  letter-spacing: 0;
}
.panel-bar { padding: 0.4rem 0.45rem 0.4rem 0.85rem; border-bottom: 1px solid var(--rule); }
.panel-foot { padding: 0.55rem 0.85rem; border-top: 1px solid var(--rule); }
.actions { display: flex; gap: 0.35rem; }

textarea {
  display: block;
  width: 100%;
  min-height: 15rem;
  padding: 0.95rem 0.9rem;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: 400 17px/1.6 var(--sans);
  letter-spacing: -0.01em;
  resize: vertical;
}
textarea:focus { outline: none; }
textarea::placeholder { color: var(--muted); }

button {
  padding: 0.45rem 0.7rem;
  border: 1px solid var(--rule-2);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--ink);
  font: 600 13px/1 var(--sans);
  letter-spacing: -0.01em;
  cursor: pointer;
  transition: background-color 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}
button:hover { border-color: var(--ink); background: var(--ink); color: var(--bg); }
button[aria-pressed="true"] { border-color: var(--ink); background: var(--ink); color: var(--bg); }
button[aria-disabled="true"] { opacity: 0.55; cursor: progress; }

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  margin: 1rem 0 0;
  overflow: hidden;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--rule);
}
.stats div { padding: 0.9rem 1rem 1rem; background: var(--surface); }
.stats dt { color: var(--muted); font: 500 13px/1.4 var(--sans); letter-spacing: -0.005em; }
.stats dd {
  margin: 0.35rem 0 0;
  font: 800 2.3rem/1 var(--sans);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.05em;
}

.defs { margin: 0; border-top: 1px solid var(--rule); }
.defs div {
  display: grid;
  grid-template-columns: 9rem 1fr;
  gap: 1rem;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--rule);
}
.defs dt { padding-top: 0.05rem; color: var(--ink); font: 600 15px/1.45 var(--sans); letter-spacing: -0.012em; }
.defs dd { margin: 0; color: var(--ink-2); }
.defs dd p:last-child { margin: 0; }

.note { margin: 1.5rem 0 0; padding-left: 0.9rem; border-left: 2px solid var(--rule-2); color: var(--ink-2); }

/* Footer */

.site-foot { margin-top: 5rem; padding-top: 2.25rem; font-size: 14.5px; }
.site-foot .mark { font-size: 1.6rem; }
.foot-row { display: grid; grid-template-columns: 5rem 1fr; gap: 1rem; padding: 0.3rem 0; align-items: baseline; }
.foot-row > .dim { font: 400 12.5px/1.4 var(--mono); letter-spacing: 0; }
.foot-row ul { display: flex; flex-wrap: wrap; gap: 0.25rem 1.25rem; margin: 0; padding: 0; list-style: none; }
.foot-row a { color: var(--ink-2); text-decoration: none; }
.foot-row a:hover { color: var(--ink); }
.themes { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.themes button { padding: 0.35rem 0.6rem; font-size: 12.5px; }
.fine { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.5rem; margin: 2rem 0 0; color: var(--muted); font: 400 12.5px/1.4 var(--mono); letter-spacing: 0; }

/* Small screens */

@media (max-width: 640px) {
  body { font-size: 16px; }
  .hero { padding: 2rem 0 1.75rem; }
  .fields > .field-sm { flex: 1 1 5.5rem; width: auto; min-width: 0; }
  .tagline { font-size: 1.15rem; }
  .tool { grid-template-columns: 1fr auto; padding: 0.65rem 0.25rem; }
  .blurb { grid-column: 1; grid-row: 2; }
  .go, .tag { grid-column: 2; grid-row: 1; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .stats div:last-child:nth-child(odd) { grid-column: span 2; }
  .stats dd { font-size: 1.9rem; }
  .defs div, .plain li { grid-template-columns: 1fr; gap: 0.15rem; }
  .panel-bar .file, .hint { display: none; }
  .panel-bar { justify-content: flex-end; }
  .foot-row { grid-template-columns: 1fr; gap: 0.15rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* Top bar: search button */

.topbar-end { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1.4rem; }
.cmd-open {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.4rem 0.35rem 0.65rem;
  background: var(--surface);
  color: var(--muted);
  font-weight: 500;
}
.cmd-open kbd { padding: 0 5px; }
.cmd-open:hover kbd { color: inherit; border-color: currentColor; }

/* Command bar */

.cmd {
  width: min(36rem, calc(100vw - 32px));
  max-height: min(30rem, 80vh);
  margin: 12vh auto auto;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--rule-2);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
}
.cmd[open] { display: flex; flex-direction: column; }
.cmd::backdrop { background: rgba(10, 10, 9, 0.4); }
.cmd-box { display: flex; align-items: center; gap: 0.75rem; padding: 0.9rem 1rem; border-bottom: 1px solid var(--rule); }
.cmd-box input {
  flex: 1;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: 500 1.15rem/1.3 var(--sans);
  letter-spacing: -0.02em;
}
.cmd-box input:focus { outline: none; }
.cmd-box input::placeholder { color: var(--muted); }
.cmd-list { flex: 1; margin: 0; padding: 0.4rem; overflow-y: auto; list-style: none; }
.cmd-list li {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.55rem 0.7rem;
  border-radius: var(--radius);
  cursor: pointer;
}
.cmd-list li[aria-selected="true"] { background: var(--bg); }
.cmd-list li[aria-selected="true"] span:first-child { text-decoration: underline; text-decoration-color: var(--dot); text-decoration-thickness: 2px; text-underline-offset: 0.2em; }
.cmd-list li[aria-disabled="true"] { color: var(--muted); cursor: default; }
.cmd-list .meta { color: var(--muted); font: 400 12px/1 var(--mono); letter-spacing: 0; white-space: nowrap; }
.cmd-list .cmd-empty { color: var(--muted); cursor: default; }
.cmd-foot { margin: 0; padding: 0.55rem 1rem; border-top: 1px solid var(--rule); }

/* Tool pages: questions */


.faq { border-top: 1px solid var(--rule); }
.faq details { border-bottom: 1px solid var(--rule); }
.faq summary {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 0;
  font-weight: 600;
  letter-spacing: -0.015em;
  list-style: none;
  cursor: pointer;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; color: var(--muted); font: 400 1rem/1.5 var(--mono); }
.faq details[open] summary::after { content: "−"; }
.faq details p { max-width: 40rem; margin: 0 0 1rem; color: var(--ink-2); }



@media (max-width: 640px) {
  .cmd-open { padding: 0.35rem 0.5rem; }
  .cmd-open kbd { display: none; }
  .cmd { margin-top: 8vh; }
}

/* ---------- tool controls (shared by all tools) ---------- */

.controls { display: grid; gap: 1rem; margin: 1.25rem 0; }
.opts { margin: 0; padding: 0; border: 0; min-width: 0; }
.opts legend, .field > span { display: block; margin-bottom: 0.4rem; padding: 0; color: var(--ink-2); font: 500 13px/1.4 var(--sans); letter-spacing: -0.005em; }
.chips { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.chip { position: relative; }
.chip input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.chip span {
  display: inline-block;
  padding: 0.45rem 0.7rem;
  border: 1px solid var(--rule-2);
  border-radius: var(--radius);
  background: var(--bg);
  font: 600 13px/1 var(--sans);
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.chip:hover span { border-color: var(--ink); }
.chip input:checked + span { border-color: var(--ink); background: var(--ink); color: var(--bg); }
.chip input:focus-visible + span { outline: 2px solid var(--dot); outline-offset: 2px; }

.fields { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 0.75rem 1rem; }
.field { display: block; }
.input,
.field input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),
.sentence input {
  width: 100%;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--rule-2);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font: 500 16px/1.3 var(--sans);
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}
.field input:focus, .sentence input:focus, .input:focus { outline: none; border-color: var(--dot); }
.field-sm { width: 7.5rem; }
.field-md { width: 11rem; }
input[type="range"] { width: 14rem; max-width: 100%; accent-color: var(--ink); }

.panel.out { margin-top: 1rem; }
.panel.out textarea { min-height: 11rem; }
.panel textarea.code, .panel pre.code { font: 400 14px/1.6 var(--mono); letter-spacing: 0; tab-size: 2; }

.error { margin: 0.75rem 0 0; padding-left: 0.9rem; border-left: 2px solid var(--ink); font-weight: 600; }
.ok { color: var(--muted); }

.meter { height: 6px; margin-top: 0.75rem; overflow: hidden; border-radius: 3px; background: var(--rule); }
.meter i { display: block; height: 100%; width: 0; background: var(--dot); transition: width 0.15s ease; }
.meter.over i { background: var(--ink); }
.meter-text { margin-top: 0.4rem; color: var(--muted); font: 400 12.5px/1.4 var(--mono); }
.meter-text b { color: var(--ink); font-weight: 600; }
.tip { margin: 0.6rem 0 0; color: var(--muted); font-size: 14.5px; line-height: 1.5; }

/* Calculators: sentences with inputs in them */
.sentence {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.6rem;
  padding: 1.1rem 0;
  border-bottom: 1px solid var(--rule);
  font-size: 1.15rem;
  letter-spacing: -0.015em;
}
.sentence:first-of-type { border-top: 1px solid var(--rule); }
.sentence input { width: 7.5rem; }
.sentence output { margin-left: auto; font: 800 1.7rem/1.1 var(--sans); letter-spacing: -0.045em; font-variant-numeric: tabular-nums; }
.sentence output:empty::before { content: "–"; color: var(--rule-2); }

/* Timer and stopwatch */
.clock {
  margin: 1.5rem 0 1rem;
  font: 800 clamp(4rem, 19vw, 9.5rem)/1 var(--sans);
  letter-spacing: -0.055em;
  font-variant-numeric: tabular-nums;
  text-align: center;
}
.clock small { font-size: 0.45em; letter-spacing: -0.04em; color: var(--muted); }
.clock.done { animation: flash 0.8s steps(1) 4; }
@keyframes flash { 50% { color: var(--dot); } }
.big-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.5rem; }
.big-actions button { padding: 0.75rem 1.3rem; font-size: 15px; }
button.primary { border-color: var(--ink); background: var(--ink); color: var(--bg); }
button.primary:hover { border-color: var(--dot); background: var(--dot); color: var(--on-dot); }
.center { justify-content: center; text-align: center; }
.laps { width: 100%; margin-top: 1.5rem; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.laps th { padding: 0.5rem 0.5rem; color: var(--muted); font: 400 12.5px/1.4 var(--mono); text-align: left; border-bottom: 1px solid var(--ink); }
.laps td { padding: 0.55rem 0.5rem; border-bottom: 1px solid var(--rule); }
.laps td:first-child { color: var(--muted); font-family: var(--mono); font-size: 13px; }

/* Image tools */
.drop {
  display: grid;
  place-items: center;
  gap: 0.4rem;
  padding: 2.75rem 1rem;
  border: 1px dashed var(--rule-2);
  border-radius: var(--radius);
  background: var(--surface);
  text-align: center;
  cursor: pointer;
}
.drop:hover, .drop.over { border-color: var(--dot); }
.drop:focus-within { border-color: var(--dot); }
.drop b { font-size: 1.1rem; letter-spacing: -0.02em; }
.drop span { color: var(--muted); font-size: 14.5px; }
.drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.preview { display: grid; place-items: center; margin-top: 1rem; padding: 1rem; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--surface); }
.preview img { display: block; max-width: 100%; max-height: 22rem; height: auto; }
.file-line { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.5rem 1rem; margin-top: 1rem; font: 400 13px/1.4 var(--mono); letter-spacing: 0; color: var(--muted); }
.file-line b { color: var(--ink); font-weight: 600; }

/* ---------- guides and registration marks ----------
   Two hairlines run down the page at the gutters. Sections, the top bar and the footer
   are cut by full-width hairlines, with a small + where a cut crosses a guide. */

:root {
  --guide: color-mix(in srgb, var(--dot) 16%, var(--rule));
  --mark: color-mix(in srgb, var(--dot) 30%, var(--ink-2));
  --tick: 13px;  /* odd, so a 1px line has 6px of mark on each side */
  --half: 6px;
}

.page::before,
.page::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  border-left: 1px solid var(--guide);
  pointer-events: none;
}
.page::before { left: var(--gutter); }
.page::after { right: var(--gutter); }

main > section,
.site-foot,
.cut-b { position: relative; }
main > section { margin: 3.5rem 0; padding-top: 2.5rem; }
main > section[hidden] { display: none; }

main > section::before,
.site-foot::before,
.cut-b::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  width: 100vw;
  margin-left: -50vw;
  border-top: 1px solid var(--guide);
  pointer-events: none;
}
.cut-b::before { top: auto; bottom: 0; }

main > section::after,
.site-foot::after,
.cut-b::after {
  content: "";
  position: absolute;
  top: calc(-1 * var(--half));
  left: calc(-1 * var(--inset) - var(--half));
  right: calc(-1 * var(--inset) - var(--half));
  z-index: 2; /* above the right guide, which paints after the page content */
  height: var(--tick);
  pointer-events: none;
  /* Whole-pixel offsets: each arm's 1px line lands exactly on the guide and the cut. */
  background:
    linear-gradient(var(--mark), var(--mark)) left var(--half) top 0 / 1px 100% no-repeat,
    linear-gradient(var(--mark), var(--mark)) left 0 top var(--half) / var(--tick) 1px no-repeat,
    linear-gradient(var(--mark), var(--mark)) right var(--half) top 0 / 1px 100% no-repeat,
    linear-gradient(var(--mark), var(--mark)) right 0 top var(--half) / var(--tick) 1px no-repeat;
}
/* The top bar's cut is its bottom pixel row, so the mark sits one pixel higher. */
.cut-b::after { top: auto; bottom: calc(-1 * var(--half)); }

/* ---------- trees ---------- */

.tree-root {
  position: relative;
  margin: 1.25rem 0 0;
  padding-bottom: 0.45rem;
  color: var(--muted);
  font: 400 12.5px/1.2 var(--mono);
  letter-spacing: 0;
}
.tree-root a { text-decoration: none; }
.tree-root a:hover { color: var(--ink); }
.tree-root::after {
  content: "";
  position: absolute;
  left: 0.5rem;
  bottom: 0;
  height: 0.45rem;
  border-left: 1px solid var(--rule-2);
}

/* Rows are tight (0.3rem padding, 1.35 line height); the elbow meets the middle of a row's first line. */
.branch { --row-pad: 0.3rem; --elbow: calc(var(--row-pad) + 0.675em); position: relative; margin: 0; padding: 0 0 0 1.5rem; list-style: none; }
.branch > li { position: relative; }
.branch > li::before {
  content: "";
  position: absolute;
  left: -1rem;
  top: 0;
  bottom: 0;
  border-left: 1px solid var(--rule-2);
}
.branch > li:last-child::before { bottom: auto; height: var(--elbow); }
.branch > li::after {
  content: "";
  position: absolute;
  left: -1rem;
  top: var(--elbow);
  width: 0.75rem;
  border-top: 1px solid var(--rule-2);
}
.branch .tool {
  grid-template-columns: 12rem 1fr auto;
  padding: var(--row-pad) 0.5rem;
  border-bottom: 0;
  border-radius: var(--radius);
  line-height: 1.35;
}
.branch .blurb { font-size: 14px; }
.branch .go, .branch .tag { line-height: 1.35; }
.tree { --elbow: 1.2rem; }
.tree > li { padding-bottom: 0.5rem; }
.tree > li:last-child { padding-bottom: 0; }

.node-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.15rem 0.9rem;
  padding: 0.4rem 0.5rem 0.3rem;
  cursor: pointer;
  list-style: none;
}
.node-head::-webkit-details-marker { display: none; }
.node-head h3 { font-size: 1.35rem; }
.node-head h3 a { text-decoration: none; }
.node-head .line-sum { color: var(--muted); font-size: 14.5px; }
.node-head .label { margin-left: auto; }
.node-head::after { content: "−"; width: 1ch; color: var(--muted); font: 400 1rem/1 var(--mono); }
details:not([open]) > .node-head::after { content: "+"; }
.node-head:hover::after { color: var(--ink); }

.is-here .name { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 0.22em; text-decoration-color: var(--dot); }
.is-here .tag { color: var(--ink); }

@media (max-width: 640px) {
  :root { --gutter: 10px; --inset: 14px; }
  .branch { --row-pad: 0.4rem; padding-left: 1.25rem; }
  .branch .tool { grid-template-columns: 1fr auto; row-gap: 0.1rem; }
  .branch > li::before, .branch > li::after { left: -0.85rem; }
  .branch > li::after { width: 0.6rem; }
  .node-head .line-sum { flex-basis: 100%; order: 3; }
}

.prose .plain { padding-left: 0; }

/* The tree sits on a solid panel so it reads clearly against the page. */
.tree-panel {
  margin-top: 1rem;
  padding: 0.6rem 1rem 0.8rem 0.9rem;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--surface);
}
.tree-panel .tree-root { margin-top: 0.4rem; }
.tree-panel a.tool:hover { background: var(--bg); }
@media (max-width: 640px) {
  .tree-panel { padding: 0.5rem 0.6rem 0.7rem 0.55rem; }
}
.node-head { flex-wrap: nowrap; }
.node-head h3, .node-head .label, .node-head::after { flex: none; }
.node-head .line-sum { flex: 1 1 auto; min-width: 0; }
@media (max-width: 640px) {
  .node-head { flex-wrap: wrap; }
}

/* Chord transposer */
.stepper { display: inline-flex; align-items: center; gap: 0.35rem; }
.stepper button { width: 2.4rem; padding: 0.5rem 0; font-size: 16px; }
.stepper output { min-width: 2.75rem; text-align: center; font: 700 1.15rem/1 var(--sans); font-variant-numeric: tabular-nums; }
.select {
  padding: 0.55rem 0.6rem;
  border: 1px solid var(--rule-2);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font: 500 15px/1.2 var(--sans);
}
.select:focus { outline: none; border-color: var(--dot); }
.sheet {
  min-height: 12rem;
  margin: 0;
  padding: 1rem 1.1rem;
  overflow-x: auto;
  color: var(--ink-2);
  font: 400 14.5px/1.6 var(--mono);
  letter-spacing: 0;
  white-space: pre;
}
.sheet b { color: var(--ink); font-weight: 700; }
.sheet:empty::before { content: "The transposed sheet appears here."; color: var(--muted); font-family: var(--sans); }

@media print {
  html.print-sheet body * { visibility: hidden; }
  html.print-sheet #sheet, html.print-sheet #sheet * { visibility: visible; }
  html.print-sheet #sheet {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    padding: 0;
    overflow: visible;
    color: #000;
    font-size: 12pt;
    white-space: pre-wrap;
  }
  html.print-sheet #sheet b { color: #000; }
}

/* Seating chart */
.class-bar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 0.75rem 1rem; margin: 0 0 1.25rem; }
.class-bar .select { width: 100%; }
.class-bar .field:nth-child(2) { flex: 1 1 12rem; max-width: 20rem; }
.seat-grid-2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1rem; align-items: start; }
.seat-grid-2 .panel textarea { min-height: 14.25rem; }
.seat-grid-2:has(.rules > :nth-child(3):not([hidden])) .panel textarea { min-height: 22.5rem; }
.rules { display: grid; gap: 1rem; }
.input.small-area { min-height: 5.5rem; font: 500 15px/1.5 var(--sans); resize: vertical; }
.big-actions.start { justify-content: flex-start; }
.print-title { display: none; }
.chart-wrap {
  --seat-min: 5rem;
  --aisle: 1.25rem;
  margin-top: 1rem;
  padding: 1rem;
  overflow-x: auto;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--surface);
}
.board {
  max-width: 20rem;
  margin: 0 auto 1rem;
  padding: 0.35rem;
  border: 1px solid var(--rule-2);
  border-radius: var(--radius);
  color: var(--muted);
  font: 400 12.5px/1.4 var(--mono);
  letter-spacing: 0;
  text-align: center;
}
.chart.rows { display: grid; gap: 0.4rem; min-width: min-content; }
.chart.tables { display: grid; grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr)); gap: 0.75rem; }
.table-card { padding: 0.6rem; border: 1px solid var(--rule); border-radius: var(--radius); }
.table-name { margin: 0 0 0.45rem; color: var(--muted); font: 400 12.5px/1.4 var(--mono); letter-spacing: 0; }
.table-seats { display: grid; grid-template-columns: 1fr 1fr; gap: 0.35rem; }
.seat {
  position: relative;
  display: flex;
  min-width: var(--seat-min);
  border: 1px solid var(--rule-2);
  border-radius: var(--radius);
  background: var(--bg);
  transition: border-color 0.12s ease;
}
.seat:hover, .seat.drop { border-color: var(--ink); border-style: solid; }
.seat-main {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 3.1rem;
  padding: 0.45rem 0.55rem 1.15rem;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: 600 14px/1.2 var(--sans);
  text-align: left;
  overflow-wrap: break-word;
}
.seat-main:hover { background: transparent; color: var(--ink); }
.seat-pin {
  position: absolute;
  right: 0.15rem;
  bottom: 0.15rem;
  padding: 0.05rem 0.3rem;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: 400 11px/1.3 var(--mono);
  letter-spacing: 0;
  opacity: 0;
}
.seat:hover .seat-pin, .seat-pin:focus-visible, .seat.pinned .seat-pin { opacity: 1; }
@media (hover: none) { .seat-pin { opacity: 1; } }
.seat-pin:hover, .seat-pin[aria-pressed="true"]:hover { background: var(--ink); color: var(--bg); }
.seat-pin[aria-pressed="true"] { background: transparent; color: var(--ink); }
.seat.pinned { border-color: var(--ink); }
.seat.pinned .seat-pin { color: var(--ink); }
.seat.vacant { border-style: dashed; background: transparent; }
.seat.vacant .seat-main { color: var(--rule-2); }
.seat.conflict { border-color: var(--dot); }
.seat.conflict .seat-main { color: var(--dot); }
.seat.selected { border-color: var(--ink); background: var(--ink); }
.seat.selected .seat-main, .seat.selected .seat-pin { color: var(--bg); }
.floor { min-height: calc(3.1rem + 2px); }
.teacher-desk {
  display: grid;
  place-items: center;
  min-width: var(--seat-min);
  min-height: calc(3.1rem + 2px);
  border: 1px solid var(--ink);
  border-radius: var(--radius);
  color: var(--ink);
  font: 400 12.5px/1.4 var(--mono);
  letter-spacing: 0;
}
.room-cell {
  min-width: var(--seat-min);
  min-height: calc(3.1rem + 2px);
  padding: 0.45rem 0.55rem;
  background: var(--bg);
  font-size: 14px;
  text-align: left;
  overflow-wrap: break-word;
}
.room-cell.floor { border-style: dashed; background: transparent; color: var(--muted); font-weight: 400; }
.room-cell.teacher { border-color: var(--ink); font: 400 12.5px/1.4 var(--mono); letter-spacing: 0; text-align: center; }
.tray { margin-top: 0.75rem; }
.tray-label { display: block; margin-bottom: 0.45rem; color: var(--muted); font: 400 12.5px/1.4 var(--mono); letter-spacing: 0; }
.tray-names {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  min-height: 2.75rem;
  padding: 0.45rem;
  border: 1px dashed var(--rule-2);
  border-radius: var(--radius);
}
.tray.drop .tray-names { border-color: var(--ink); border-style: solid; }
.tray-name[aria-pressed="true"] { border-color: var(--ink); background: var(--ink); color: var(--bg); }
.tray-empty { align-self: center; padding: 0 0.3rem; color: var(--muted); font-size: 14.5px; line-height: 1.4; }
@media (max-width: 640px) {
  .seat-grid-2 { grid-template-columns: 1fr; }
  .chart-wrap { --seat-min: 4.75rem; --aisle: 0.75rem; padding: 0.75rem; }
  .seat-main { font-size: 13px; }
}
@media print {
  html.print-chart body * { visibility: hidden; }
  html.print-chart #print-area, html.print-chart #print-area * { visibility: visible; }
  html.print-chart #print-area { position: absolute; top: 0; left: 0; width: 100%; }
  html.print-chart .print-title { display: block; margin: 0 0 0.75rem; color: #000; font: 700 16pt/1.2 var(--sans); }
  html.print-chart .chart-wrap { --seat-min: 0; padding: 0; overflow: visible; border: 0; background: none; }
  html.print-chart .board { border-color: #000; color: #000; }
  html.print-chart .table-card { border-color: #000; break-inside: avoid; }
  html.print-chart .table-name { color: #000; }
  html.print-chart .seat { border: 1px solid #000; background: #fff; }
  html.print-chart .seat.vacant { border: 1px dashed #999; }
  html.print-chart .seat-main { min-height: 2.4rem; padding-bottom: 0.45rem; color: #000; font-size: 10.5pt; }
  html.print-chart .seat-pin { display: none; }
  html.print-chart .teacher-desk { min-height: calc(2.4rem + 2px); border-color: #000; color: #000; }
  html.print-chart .floor { min-height: calc(2.4rem + 2px); }
}

/* ---------- small tools: shared bits ---------- */

.wide-select { width: min(100%, 20rem); }
.field-xs { width: 5.5rem; }
.field input[type="color"] { height: 2.55rem; padding: 0.2rem; cursor: pointer; }
textarea.short { min-height: 6rem; }

/* White screen */
.swatch {
  display: flex;
  align-items: flex-end;
  width: 100%;
  height: clamp(12rem, 40vh, 22rem);
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--rule-2);
  color: #000;
  font: 400 12.5px/1.4 var(--mono);
  letter-spacing: 0;
  cursor: zoom-in;
  transition: border-color 0.12s ease;
}
.swatch.on-dark { color: #fff; }
.swatch:hover { border-color: var(--ink); color: #000; }
.swatch.on-dark:hover { color: #fff; }
html.screen-open { overflow: hidden; }
.screen { position: fixed; inset: 0; z-index: 1000; cursor: pointer; }
.screen.idle { cursor: none; }
.screen-hint {
  position: absolute;
  left: 50%;
  bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.5rem 0.5rem 0.9rem;
  border-radius: var(--radius);
  background: rgb(0 0 0 / 0.72);
  color: #fff;
  font: 400 12.5px/1.4 var(--mono);
  letter-spacing: 0;
  white-space: nowrap;
  transform: translateX(-50%);
  opacity: 0;
  transition: opacity 0.25s ease;
  pointer-events: none;
}
.screen-hint.show { opacity: 1; pointer-events: auto; }
.screen-hint button { border-color: #fff; background: transparent; color: #fff; }
.screen-hint button:hover { background: #fff; color: #000; }

/* Notepad */
textarea.notepad { min-height: 60vh; font: 400 16px/1.6 var(--sans); letter-spacing: -0.005em; }

/* Click counter */
.counter-name { margin: 0; color: var(--muted); font: 400 12.5px/1.4 var(--mono); letter-spacing: 0; text-align: center; }
.tap {
  display: block;
  width: 100%;
  margin: 0.5rem 0 1rem;
  padding: 1.75rem 0.5rem;
  border: 1px solid var(--rule-2);
  background: var(--surface);
  color: var(--ink);
  font: 800 clamp(4rem, 19vw, 9.5rem)/1 var(--sans);
  letter-spacing: -0.055em;
  font-variant-numeric: tabular-nums;
  touch-action: manipulation;
  user-select: none;
}
.tap:hover { border-color: var(--ink); background: var(--surface); color: var(--ink); }
.tap:active { border-color: var(--dot); }
.counter-list { margin-top: 2.5rem; }
.counter-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 0.5rem; margin-bottom: 0.6rem; }
.counter-head .label { color: var(--muted); font: 400 12.5px/1.4 var(--mono); letter-spacing: 0; }
.counters { display: grid; gap: 0.4rem; margin: 0; padding: 0; list-style: none; }
.counter-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) 5.5rem 5rem auto;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.5rem;
  border: 1px solid var(--rule-2);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
}
.counter-row.on { border-color: var(--ink); }
.counter-row.on .counter-label { font-weight: 700; }
.counter-pick { width: 2rem; padding: 0.4rem 0; font-family: var(--mono); }
.counter-row input {
  width: 100%;
  padding: 0.4rem 0.5rem;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: var(--ink);
  font: 500 15px/1.2 var(--sans);
  font-variant-numeric: tabular-nums;
}
.counter-row input:hover { border-color: var(--rule-2); }
.counter-row input:focus { outline: none; border-color: var(--dot); background: var(--bg); }
.counter-step { display: flex; align-items: center; gap: 0.3rem; color: var(--muted); font: 400 11.5px/1 var(--mono); }
.counter-value { font: 700 1.15rem/1 var(--sans); font-variant-numeric: tabular-nums; text-align: right; }
.counter-row .actions button { width: 2.1rem; padding: 0.45rem 0; }
.counter-total { margin: 0.6rem 0 0; font: 650 1rem/1.4 var(--sans); text-align: right; }
@media (max-width: 640px) {
  .counter-row { grid-template-columns: auto minmax(0, 1fr) auto; }
  .counter-step { grid-column: 2; }
  .counter-value { grid-column: 3; grid-row: 1; }
  .counter-row .actions { grid-column: 3; justify-content: flex-end; }
}

/* Online ruler */
.ruler-wrap { overflow: hidden; border: 1px solid var(--rule-2); border-radius: var(--radius); background: var(--surface); }
.ruler { display: block; width: 100%; height: 5.5rem; cursor: crosshair; touch-action: none; }
.ruler:focus-visible { outline-offset: -2px; }
.ruler .ticks { fill: none; stroke: var(--ink); stroke-width: 1; shape-rendering: crispEdges; }
.ruler text { fill: var(--ink-2); font: 500 11px var(--mono); text-anchor: middle; }
.ruler text.unit { fill: var(--muted); text-anchor: start; }
.ruler .marker { stroke: var(--dot); stroke-width: 2; }
.ruler .band { fill: color-mix(in srgb, var(--dot) 10%, transparent); }
.card-stage { margin: 1rem 0; overflow: hidden; }
.card-outline {
  display: grid;
  place-items: center;
  border: 2px dashed var(--ink-2);
  border-radius: var(--radius);
  color: var(--muted);
  font: 400 12.5px/1.4 var(--mono);
  letter-spacing: 0;
}
.calibrate input[type="range"] { width: min(100%, 26rem); }

/* Mic test */
.level { position: relative; height: 1.5rem; overflow: hidden; border: 1px solid var(--rule-2); border-radius: var(--radius); background: var(--surface); }
.level i { position: absolute; inset: 0 auto 0 0; width: 0; background: var(--dot); }
.level b { position: absolute; top: 0; bottom: 0; left: 0; width: 2px; background: var(--ink); }
.level-scale { display: flex; justify-content: space-between; margin-top: 0.3rem; color: var(--muted); font: 400 11px/1 var(--mono); letter-spacing: 0; }
.mic-state { margin: 1.25rem 0 0; font: 650 1.5rem/1.2 var(--sans); letter-spacing: -0.025em; }
#playback audio { display: block; width: 100%; margin-top: 1rem; }

/* Group maker */
.groups { display: grid; grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr)); gap: 0.75rem; margin-top: 1rem; }
.group-card { padding: 0.5rem; border: 1px solid var(--rule-2); border-radius: var(--radius); background: var(--surface); }
.group-name { display: flex; justify-content: space-between; width: 100%; margin-bottom: 0.35rem; border-color: transparent; background: transparent; font-size: 14px; font-weight: 650; text-align: left; }
.group-name span { color: var(--muted); font: 400 12px/1 var(--mono); }
.group-name:hover span { color: inherit; }
.group-card ol { display: grid; gap: 0.3rem; margin: 0; padding: 0; list-style: none; }
.group-member { width: 100%; padding: 0.5rem 0.6rem; font-weight: 500; font-size: 14px; text-align: left; overflow-wrap: anywhere; }
.group-member.conflict { border-color: var(--dot); color: var(--dot); }
.group-member.conflict:hover { color: var(--bg); }

.picked {
  display: grid;
  place-items: center;
  min-height: 11rem;
  margin: 0.5rem 0 1rem;
  padding: 1rem;
  border: 1px solid var(--rule-2);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--muted);
  font: 800 clamp(2.5rem, 11vw, 5.5rem)/1.05 var(--sans);
  letter-spacing: -0.045em;
  text-align: center;
  overflow-wrap: anywhere;
}
.picked.landed { color: var(--ink); border-color: var(--ink); }
.pick-history { margin: 1rem 0 0; color: var(--muted); font: 400 12.5px/1.6 var(--mono); letter-spacing: 0; text-align: center; }

/* Recipe converter */
.recipe-out { min-height: 11rem; padding: 0.95rem 0.9rem; font: 400 16px/1.55 var(--sans); }
.recipe-out p { margin: 0; }
.recipe-out p.gap { height: 0.8em; }
.recipe-out b { font-weight: 700; }

/* Initiative tracker */
.add-form { margin: 0 0 1.5rem; }
.turn-bar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 0.75rem; margin-bottom: 0.75rem; }
.turn-state { margin: 0; font: 650 1.35rem/1.25 var(--sans); letter-spacing: -0.025em; }
.combat { display: grid; gap: 0.5rem; margin: 0; padding: 0; list-style: none; }
.fighter {
  display: grid;
  grid-template-columns: 4rem minmax(0, 1fr) auto auto;
  grid-template-areas: "init who hp remove" ". tools tools tools";
  align-items: center;
  gap: 0.5rem 0.6rem;
  padding: 0.6rem 0.6rem;
  border: 1px solid var(--rule-2);
  border-left-width: 4px;
  border-radius: var(--radius);
  background: var(--surface);
}
.fighter.now { border-color: var(--ink); border-left-color: var(--dot); }
.fighter.down { opacity: 0.5; }
.fighter input {
  width: 100%;
  padding: 0.4rem 0.5rem;
  border: 1px solid var(--rule-2);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--ink);
  font: 500 15px/1.2 var(--sans);
  font-variant-numeric: tabular-nums;
}
.fighter input:focus { outline: none; border-color: var(--dot); }
.fighter label > span { display: block; margin-bottom: 0.2rem; color: var(--muted); font: 400 11px/1 var(--mono); letter-spacing: 0; }
.f-init { grid-area: init; }
.f-who { grid-area: who; min-width: 0; }
.f-who .f-name { padding-left: 0.3rem; border-color: transparent; background: transparent; font-weight: 650; font-size: 16px; }
.f-who .f-name:hover { border-color: var(--rule-2); }
.f-meta { display: block; padding-left: 0.3rem; color: var(--muted); font: 400 11.5px/1.4 var(--mono); letter-spacing: 0; }
.f-hp { grid-area: hp; display: flex; align-items: flex-end; gap: 0.35rem; }
.f-hp label { width: 4.5rem; }
.f-max { padding-bottom: 0.5rem; color: var(--muted); font: 400 13px/1 var(--mono); white-space: nowrap; }
.f-tools { grid-area: tools; display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem 0.75rem; }
.f-dmg { display: flex; align-items: center; gap: 0.35rem; }
.f-dmg .f-amount { width: 3.5rem; }
.f-tags { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.f-tags[hidden] { display: none; }
.cond { padding: 0.3rem 0.5rem; font-size: 12px; }
.cond-pick { width: 6.75rem; padding: 0.4rem 0.3rem; font-size: 13px; }
.f-remove { grid-area: remove; width: 2.1rem; padding: 0.45rem 0; }
@media (max-width: 640px) {
  .fighter { grid-template-columns: 3.75rem minmax(0, 1fr) auto; grid-template-areas: "init who remove" ". hp hp" ". tools tools"; }
  .turn-bar .big-actions { width: 100%; }
}

/* QR code generator */
.qr-box { display: grid; place-items: center; min-height: 20rem; margin-top: 0.5rem; padding: 1rem; border: 1px solid var(--rule-2); border-radius: var(--radius); background: var(--surface); }
.qr-box canvas { width: min(18rem, 100%); height: auto; image-rendering: pixelated; }
.qr-box.blank canvas { visibility: hidden; }

@media print {
  html.print-groups body *, html.print-recipe body * { visibility: hidden; }
  html.print-groups #print-groups, html.print-groups #print-groups *, html.print-recipe #out, html.print-recipe #out * { visibility: visible; }
  html.print-groups #print-groups, html.print-recipe #out { position: absolute; top: 0; left: 0; width: 100%; color: #000; }
  html.print-groups .print-title { display: block; margin: 0 0 0.75rem; font: 700 16pt/1.2 var(--sans); }
  html.print-groups .group-card { border-color: #000; background: #fff; break-inside: avoid; }
  html.print-groups .group-member { border-color: #999; background: #fff; color: #000; }
  html.print-groups .group-name { color: #000; }
  html.print-groups .group-name span { color: #555; }
  html.print-recipe #out { padding: 0; font-size: 12pt; }
}
.panel-bar button { white-space: nowrap; }
.panel-bar .file { white-space: nowrap; }
.panel-bar .actions { flex-wrap: wrap; justify-content: flex-end; }
#pick-mode { margin-bottom: 2rem; }
/* Printing adds a class and opens the dialog at once, so colour fades would be caught half-way. */
html.print-chart *, html.print-groups *, html.print-recipe *, html.print-sheet * { transition: none !important; }

/* ---------- tool structure: steps, folds, menus ---------- */

.step, .fold > summary {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  margin: 0 0 0.75rem;
  font: 650 1.05rem/1.3 var(--sans);
  letter-spacing: -0.02em;
}
.step-n { color: var(--muted); font: 400 12.5px/1 var(--mono); letter-spacing: 0; }
.step-row { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0.5rem 1rem; margin: 0 0 0.75rem; }
.step-row .step { margin: 0; }
.tool-steps { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1.75rem 1.5rem; align-items: start; }
.tool-steps > .wide { grid-column: 1 / -1; }
.step-stack { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1.25rem; align-content: start; }
@media (max-width: 720px) { .tool-steps { grid-template-columns: minmax(0, 1fr); } }

.fold { border: 1px solid var(--rule-2); border-radius: var(--radius); background: var(--surface); }
.fold > summary { margin: 0; padding: 0.75rem 0.85rem; list-style: none; cursor: pointer; }
.fold > summary::-webkit-details-marker { display: none; }
.fold > summary::after { content: "+"; margin-left: auto; color: var(--muted); font: 400 1rem/1 var(--mono); }
.fold[open] > summary::after { content: "−"; }
.fold > summary:hover::after { color: var(--ink); }
.fold-sum { min-width: 0; color: var(--muted); font: 400 12.5px/1.4 var(--mono); letter-spacing: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fold-body { display: grid; gap: 1rem; padding: 0.25rem 0.85rem 0.95rem; }
.fold-body .input { background: var(--bg); }

.menu { position: relative; display: inline-block; }
.menu > summary {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.45rem 0.7rem;
  border: 1px solid var(--rule-2);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--ink);
  font: 600 13px/1 var(--sans);
  letter-spacing: -0.01em;
  white-space: nowrap;
  list-style: none;
  cursor: pointer;
}
.menu > summary::-webkit-details-marker { display: none; }
.menu > summary::after { content: "▾"; color: var(--muted); font-size: 11px; }
.menu > summary:hover, .menu[open] > summary { border-color: var(--ink); }
.menu-list {
  position: absolute;
  top: calc(100% + 0.3rem);
  right: 0;
  z-index: 30;
  display: grid;
  min-width: 13rem;
  padding: 0.3rem;
  border: 1px solid var(--rule-2);
  border-radius: var(--radius);
  background: var(--surface);
}
.menu.left .menu-list { right: auto; left: 0; }
.menu-list button {
  width: 100%;
  padding: 0.55rem 0.6rem;
  border: 0;
  background: transparent;
  font: 500 14px/1.2 var(--sans);
  text-align: left;
  white-space: nowrap;
}
.menu-list button:hover, .menu-list button:focus-visible { background: var(--ink); color: var(--bg); }
.menu-list hr { margin: 0.25rem 0.3rem; border: 0; border-top: 1px solid var(--rule); }
.menu-list .menu-label { padding: 0.45rem 0.6rem 0.2rem; color: var(--muted); font: 400 11.5px/1.3 var(--mono); letter-spacing: 0; }
.bar-actions { display: flex; flex-wrap: wrap; gap: 0.35rem; align-items: center; }
.class-bar .menu { align-self: flex-end; }
.class-bar .menu > summary { padding: 0.68rem 0.8rem; }
.shuffle { padding: 0.75rem 1.6rem; font-size: 15px; }
.tool-steps .seat-grid-2 { display: block; }
.tool-steps .panel textarea#roster { min-height: 16rem; }

/* Name picker wheel */
.pick-view { justify-content: center; margin-bottom: 1rem; }
.wheel-box { display: grid; place-items: center; margin-bottom: 0.75rem; }
.wheel { display: block; width: min(26rem, 100%); height: auto; cursor: pointer; user-select: none; }
#wheel-spin { transform-origin: 200px 200px; transform-box: view-box; }
.w-slice { stroke: var(--rule-2); stroke-width: 1; }
.w-slice.a { fill: var(--surface); }
.w-slice.b { fill: color-mix(in srgb, var(--ink) 9%, var(--bg)); }
.w-slice.c { fill: color-mix(in srgb, var(--ink) 16%, var(--bg)); }
.w-slice.win { fill: var(--dot); }
.w-label { fill: var(--ink); font-family: var(--sans); font-weight: 600; letter-spacing: -0.01em; text-anchor: end; dominant-baseline: middle; pointer-events: none; }
.w-label.win { fill: var(--on-dot); }
.wheel-hub { fill: var(--bg); stroke: var(--rule-2); stroke-width: 1; }
.wheel-pointer { fill: var(--ink); }
.picked.slim { min-height: 4.75rem; font-size: clamp(1.75rem, 7vw, 3rem); }

/* Present: one part of a tool, full screen for the classroom screen */
html.presenting-open { overflow: hidden; }
.presenting { position: fixed; inset: 0; z-index: 900; overflow: auto; margin: 0; padding: clamp(1rem, 3vw, 2.5rem); background: var(--bg); }
.present-exit { display: none; }
.presenting .present-exit { display: inline-block; position: fixed; top: 0.9rem; right: 0.9rem; z-index: 901; }
.presenting .print-title { display: block; margin: 0 0 1rem; color: var(--ink); font: 700 clamp(1.5rem, 3vw, 2.5rem)/1.1 var(--sans); letter-spacing: -0.03em; }
#print-area.presenting .chart-wrap { --seat-min: 0; margin: 0; padding: 0; overflow: visible; border: 0; background: none; }
#print-area.presenting .seat-main { min-height: clamp(3.2rem, 8vh, 6rem); font-size: clamp(14px, 1.7vw, 26px); padding-bottom: 0.45rem; }
#print-area.presenting .seat-pin { display: none; }
#print-area.presenting .board { max-width: 28rem; font-size: 15px; }
#print-groups.presenting .groups { grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: 1rem; }
#print-groups.presenting .group-name { font-size: clamp(16px, 1.6vw, 22px); }
#print-groups.presenting .group-member { font-size: clamp(15px, 1.6vw, 24px); padding: 0.55em 0.7em; }
#pick-mode.presenting { display: grid; align-content: center; justify-items: center; gap: 1rem; }
#pick-mode.presenting .pick-view, #pick-mode.presenting .controls, #pick-mode.presenting .pick-history, #pick-mode.presenting #pick-full { display: none; }
#pick-mode.presenting .wheel { width: min(68vh, 88vw); }
#pick-mode.presenting .picked { width: min(60rem, 92vw); min-height: 0; padding: 1rem; font-size: clamp(2.5rem, 7vw, 6rem); }

/* Seating: students' view, absent students */
.chart-wrap.flipped { display: flex; flex-direction: column-reverse; }
.chart-wrap.flipped .board { width: 100%; margin: 1rem auto 0; }
.seat.away .seat-main { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--rule-2); }
.away-tag { display: block; margin-top: 0.15rem; color: var(--muted); font: 400 11px/1.2 var(--mono); letter-spacing: 0; text-decoration: none; }
.absent-field { margin-top: 1rem; }
.absent-field b { color: var(--ink); font-weight: 600; }
@media print { .present-exit { display: none !important; } }
.qr-form { display: grid; gap: 0.75rem; margin-bottom: 1rem; }

/* Notepad: find and replace, print */
.find-bar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 0.6rem 0.75rem; padding: 0.7rem 0.85rem; border-bottom: 1px solid var(--rule); }
.find-bar .field { flex: 1 1 10rem; }
.find-bar .meter-text { flex-basis: 100%; margin: 0; }
.note-print { display: none; }
@media print {
  html.print-note body * { visibility: hidden; }
  html.print-note #note-print { display: block; visibility: visible; position: absolute; top: 0; left: 0; width: 100%; margin: 0; color: #000; font: 400 12pt/1.5 var(--sans); white-space: pre-wrap; overflow-wrap: anywhere; }
}
html.print-note *, html.print-note *::before { transition: none !important; }
