/* slashtube, "Field Kit" design system (docs/DESIGN.md). Owner: UI.
   An explorer's kit on a table: a finely printed map underneath (flat, hairline, no shadows), physical objects on
   top (2 px ink edge, hard shadow cast south-east). One action colour: survey red by day, survey-flag pink at night.
   Light by default via prefers-color-scheme, forced by <html data-theme="light|dark">. No build step.
   Page-specific styles live in app/static/pages/*.css; this file holds tokens, base, chrome and shared components. */

/* ============================================================== tokens */
:root {
  color-scheme: light;
  /* type: Bricolage Grotesque (headlines, controls, objects), Newsreader (reading text, the italic "why" voice),
     DM Mono (labels, readouts). --sans and --display are the same face; --display is for headline roles. */
  --display: "Bricolage Grotesque", "Arial Narrow", ui-sans-serif, system-ui, sans-serif;
  --sans: "Bricolage Grotesque", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --serif: "Newsreader", "Iowan Old Style", Georgia, serif;
  --mono: "DM Mono", ui-monospace, "SF Mono", Menlo, monospace;

  /* Field Kit surfaces: table < sheet (printed map) < card (objects); tray = a sunk well */
  --table: #E7E0CD;
  --table-2: #DFD7C2;
  --sheet: #F5F0E2;
  --card: #FFFCF3;
  --tray: #E2DAC5;
  --edge: #1A1915;                       /* object outlines (>= 3:1 everywhere) */
  --drop: #1A1915;                       /* hard shadow */
  --rule: rgb(26 25 21 / .14);
  --rule-2: rgb(26 25 21 / .32);
  --red: #BF3518;                        /* the one action colour */
  --red-ink: #A72D13;                    /* red as text: 5.6:1 on table */
  --on-red: #FFF8EE;
  --on-band: #FFF9EC;                    /* text on a band fill (sticker): >= 6.4:1 */
  --fam-t: #EBDDC3; --adj-t: #DCE6CB; --far-t: #D3E2E8;   /* band tints */
  /* map-only inks */
  --contour: #B78E5F; --contour-idx: #8D5F2A; --water: #CFE0E5; --wood: #DCE5CA; --hach: #3B342A;
  --frame: #1A1915;                      /* neatline, zebra border */
  --env: #EDE0C9; --env-2: #E8D8BD; --env-3: #E4D2B4;     /* envelope paper: kraft by day */

  /* the app's long-standing names, mapped onto the kit */
  --bg: var(--table);
  --surface: var(--card);
  --sunk: var(--tray);
  --ink: #1A1915;
  --ink-2: #45403A;
  --muted: #5F584A;                      /* 5.3:1 on table, 6.0:1 on sheet */
  --line: var(--rule);
  --line-2: var(--rule-2);
  --line-strong: #7A715F;                /* control borders: 3.4:1 on table */
  --accent: var(--red);
  --accent-ink: var(--on-red);
  --accent-soft: #F3DACF;
  --focus: var(--red);
  --fam: #7F521D;                        /* contour brown · familiar ground · circle */
  --adj: #3A6633;                        /* wood green · next door · diamond */
  --far: #245A8A;                        /* water blue · far field · triangle */
  --bad: #A72D13;
  --bad-ink: #FFF8EE;
  --good: #3A6633;
  --highlight: #F1E2A4;
  --grid-dot: rgb(26 25 21 / .14);
  --band: var(--ink);
  --band-t: var(--tray);
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .33 0 0 0 0 .27 0 0 0 0 .18 0 0 0 .2 0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
  --grain-opacity: .3;

  /* legacy names still read by atlas.css / older templates */
  --font-ui: var(--sans); --font-voice: var(--serif); --font-mono: var(--mono);
  --band-familiar: var(--fam); --band-adjacent: var(--adj); --band-far: var(--far);
  --warn-soft: var(--highlight); --hatch: var(--line);

  --fs-xs: 11px; --fs-sm: 14px; --fs-base: 18px; --fs-md: 19px; --fs-lg: 24px;
  --fs-xl: clamp(32px, 4.4vw, 48px); --fs-display: clamp(42px, 6.8vw, 88px);
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 20px; --s5: 32px; --s6: 52px; --s7: 84px;
  --r: 10px; --r-s: 8px; --r-l: 14px; --r-xs: 4px;
  --measure: 64ch;
  --ease: cubic-bezier(.2, .75, .2, 1);
  --pop: cubic-bezier(.2, .9, .25, 1.22);
  --ease-stamp: var(--pop);              /* old name, still read by page styles */
  --lift: 3px 3px 0 var(--drop);
  --lift-s: 2px 2px 0 var(--drop);
  --offset: var(--lift);
  --collar-h: 28px; --top-h: 64px;
}
:root[data-theme="light"] { color-scheme: light; }
/* Dark ("survey at night") values are set here, not with light-dark(): Chromium freezes colour transitions
   between light-dark() values. The two blocks must stay identical. */
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { color-scheme: dark;
  --table: #0A0E14; --table-2: #0E131A; --sheet: #0F1620; --card: #18202B; --tray: #121923;
  --edge: #5D6C80; --drop: #000; --rule: rgb(232 237 243 / .12); --rule-2: rgb(232 237 243 / .28);
  --red: #FF5C9D; --red-ink: #FF86B6; --on-red: #1E0412; --on-band: #0A0E14;
  --fam-t: #2A2617; --adj-t: #11271E; --far-t: #112239;
  --contour: #2A3F53; --contour-idx: #4D6985; --water: #0B1E33; --wood: #0F2219; --hach: #A6B5C7; --frame: #6F7F93;
  --env: #1D2A3A; --env-2: #203041; --env-3: #243548;
  --ink: #E8EDF3; --ink-2: #C3CCD8; --muted: #8F9BAB; --line-strong: #5D6C80; --accent-soft: #3A1628;
  --fam: #E3BD74; --adj: #6CD5A4; --far: #7DB4FF; --bad: #FF8E7A; --bad-ink: #1E0412; --good: #6CD5A4;
  --highlight: #3A3418; --grid-dot: rgb(232 237 243 / .09);
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .5 0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
  --grain-opacity: .045;
  --lift: 3px 3px 0 var(--drop), inset 1px 1px 0 rgb(232 237 243 / .07);
  --lift-s: 2px 2px 0 var(--drop), inset 1px 1px 0 rgb(232 237 243 / .07); } }
:root[data-theme="dark"] { color-scheme: dark;
  --table: #0A0E14; --table-2: #0E131A; --sheet: #0F1620; --card: #18202B; --tray: #121923;
  --edge: #5D6C80; --drop: #000; --rule: rgb(232 237 243 / .12); --rule-2: rgb(232 237 243 / .28);
  --red: #FF5C9D; --red-ink: #FF86B6; --on-red: #1E0412; --on-band: #0A0E14;
  --fam-t: #2A2617; --adj-t: #11271E; --far-t: #112239;
  --contour: #2A3F53; --contour-idx: #4D6985; --water: #0B1E33; --wood: #0F2219; --hach: #A6B5C7; --frame: #6F7F93;
  --env: #1D2A3A; --env-2: #203041; --env-3: #243548;
  --ink: #E8EDF3; --ink-2: #C3CCD8; --muted: #8F9BAB; --line-strong: #5D6C80; --accent-soft: #3A1628;
  --fam: #E3BD74; --adj: #6CD5A4; --far: #7DB4FF; --bad: #FF8E7A; --bad-ink: #1E0412; --good: #6CD5A4;
  --highlight: #3A3418; --grid-dot: rgb(232 237 243 / .09);
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .5 0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
  --grain-opacity: .045;
  --lift: 3px 3px 0 var(--drop), inset 1px 1px 0 rgb(232 237 243 / .07);
  --lift-s: 2px 2px 0 var(--drop), inset 1px 1px 0 rgb(232 237 243 / .07); }

[data-band="fam"] { --band: var(--fam); --band-t: var(--fam-t); }
[data-band="adj"] { --band: var(--adj); --band-t: var(--adj-t); }
[data-band="far"] { --band: var(--far); --band-t: var(--far-t); }

/* ============================================================== base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: calc(var(--top-h) + 16px);
  text-rendering: optimizeLegibility; }
body {
  margin: 0; min-height: 100vh; display: flex; flex-direction: column;
  background: var(--bg); color: var(--ink);
  font: 400 var(--fs-base)/1.55 var(--serif); font-optical-sizing: auto;
  font-feature-settings: "kern", "liga"; -webkit-font-smoothing: antialiased;
}
body::after {        /* paper grain: one 160 px tile, no image file */
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 100; opacity: var(--grain-opacity);
  background-image: var(--grain);
}
body > main { flex: 1; }
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration-color: var(--line-2); text-decoration-thickness: 1px; text-underline-offset: .2em; }
a:hover { text-decoration-color: var(--accent); }
button, input, select, textarea { font-family: var(--sans); color: inherit; }
::selection { background: color-mix(in oklab, var(--accent) 28%, transparent); color: var(--ink); }
:focus-visible { outline: 2.5px solid var(--focus); outline-offset: 3px; border-radius: var(--r-xs); }
h1, h2, h3, h4 { font-family: var(--display); font-weight: 760; font-stretch: 86%; margin: 0; text-wrap: balance;
  letter-spacing: -.018em; font-variation-settings: "opsz" 48; }
h1 { font-size: var(--fs-xl); line-height: .98; font-weight: 800; font-stretch: 80%; letter-spacing: -.024em;
  font-variation-settings: "opsz" 96; }
h2 { font-size: var(--fs-lg); line-height: 1.08; }
h3 { font-size: 20px; line-height: 1.2; font-stretch: 92%; letter-spacing: -.012em; font-weight: 700; }
h4 { font-size: 17px; line-height: 1.25; font-stretch: 94%; font-weight: 700; letter-spacing: -.008em; }
/* the turn of a headline: map lettering, serif italic in survey red ("…, that's the problem.") */
h1 em, h2 em, .display em, .h1 em, .h2 em { font: italic 380 1.06em/.9 var(--serif); font-variation-settings: "opsz" 72;
  letter-spacing: -.025em; color: var(--red-ink); padding-right: .04em; }
p, li { text-wrap: pretty; }
p { margin: .6em 0; }
hr { border: 0; border-top: 1px solid var(--line); margin: var(--s5) 0; }
kbd { font: 500 11px/1 var(--mono); padding: 2px 5px; border: 1.5px solid var(--line-strong); border-bottom-width: 2.5px;
  border-radius: var(--r-xs); background: var(--card); }
code { font: 13.5px var(--mono); background: var(--sunk); padding: 1px 5px; border-radius: var(--r-xs); }
.wrap { width: 100%; max-width: 820px; margin: 0 auto; padding-inline: max(16px, env(safe-area-inset-left)) max(16px, env(safe-area-inset-right)); }
.wrap.mid { max-width: 1040px; }
.wrap.wide { max-width: 1240px; }
@media (min-width: 720px) { .wrap { padding-inline: max(24px, env(safe-area-inset-left)) max(24px, env(safe-area-inset-right)); } }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; z-index: 200; background: var(--ink); color: var(--card); padding: 10px 14px;
  font: 600 15px var(--sans); border-radius: var(--r-s); }
.skip:focus { left: 8px; }
main { padding-block: var(--s5) var(--s7); }

/* ---------- type roles */
.display { font: 800 var(--fs-display)/.92 var(--display); font-stretch: 78%; letter-spacing: -.026em;
  font-variation-settings: "opsz" 96; text-wrap: balance; }
.h1 { font: 800 clamp(38px, 5.6vw, 72px)/.94 var(--display); font-stretch: 80%; letter-spacing: -.024em;
  font-variation-settings: "opsz" 96; text-wrap: balance; }
.h2 { font: 800 clamp(30px, 4.4vw, 56px)/.96 var(--display); font-stretch: 80%; letter-spacing: -.022em;
  font-variation-settings: "opsz" 96; text-wrap: balance; }
.h3 { font: 700 21px/1.15 var(--display); font-stretch: 92%; letter-spacing: -.015em; }
.voice, .why { font-family: var(--serif); font-style: italic; font-weight: 400; font-variation-settings: "opsz" 18; }
.why { color: var(--band); }
.label, .kicker { font: 500 var(--fs-xs)/1.3 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.kicker { display: flex; align-items: center; gap: 10px; margin-bottom: var(--s2); letter-spacing: .1em; color: var(--ink-2); }
.kicker b { font-weight: 500; color: var(--red-ink); }
.kicker::after { content: ""; flex: 0 0 32px; height: 1px; background: currentColor; opacity: .45; }
.mono, .readout b, time { font-family: var(--mono); font-variant-numeric: tabular-nums lining-nums; }
.muted { color: var(--muted); }
.small { font-size: var(--fs-sm); }
.stn { font: 500 13px/1 var(--mono); letter-spacing: .02em; color: var(--muted); font-variant-numeric: tabular-nums; }
.lede { font-family: var(--serif); font-size: var(--fs-md); line-height: 1.5; color: var(--ink-2); max-width: var(--measure); }

/* ============================================================== chrome: collar, header, key bar, footer */
/* the collar: the sheet's printed margin note (mono readout above the header), no longer an ink strip */
.collar { color: var(--muted); font: 500 10.5px/var(--collar-h) var(--mono); letter-spacing: .1em; text-transform: uppercase;
  height: var(--collar-h); overflow: hidden; border-bottom: 1px solid var(--line); }
.collar .wrap { display: flex; gap: 0 14px; white-space: nowrap; overflow: hidden; }
.collar span:first-child { color: var(--ink-2); }
.collar span + span::before { content: "/"; margin-right: 14px; color: var(--accent); opacity: .8; }
.collar .grow { flex: 1; }
.collar .grow + span::before, .collar span.grow::before { content: none; }
.top { position: sticky; top: 0; z-index: 40; background: color-mix(in oklab, var(--bg) 90%, transparent);
  backdrop-filter: blur(10px) saturate(1.15); -webkit-backdrop-filter: blur(10px) saturate(1.15); }
.top .wrap { display: flex; align-items: center; gap: var(--s4); height: var(--top-h); }
/* wordmark "/tube": the slash is a red survey bearing cut as a physical tab (ink edge, hard shadow) with a station
   ring at its head. Markup stays <a class="wm"><span>/</span>tube</a>; the slash glyph is hidden, the tab drawn. */
.wm { display: inline-flex; align-items: center; min-height: 44px; color: var(--ink); text-decoration: none;
  font: 800 27px/1 var(--display); font-stretch: 82%; letter-spacing: -.045em; font-variation-settings: "opsz" 48; }
.wm > span:first-child { position: relative; display: inline-block; flex: none; width: .22em; height: .84em; margin: .2em .3em 0 .12em;
  background: var(--red); border: 1.4px solid var(--edge); border-radius: 1px; transform: skewX(-24deg);
  box-shadow: 1.5px 1.5px 0 var(--drop); color: transparent; overflow: visible; line-height: 0; user-select: none; }
.wm > span:first-child::before { content: ""; position: absolute; top: -.27em; left: -.17em; width: .27em; height: .27em; border-radius: 50%;
  background: var(--bg); border: 1.4px solid var(--edge); transform: skewX(24deg); }
.wm:hover { text-decoration: none; }
.top nav { display: flex; gap: 6px; flex: 1; justify-content: center; }
.top nav a { display: inline-flex; align-items: center; gap: 8px; min-height: 42px; padding: 0 14px; border-radius: var(--r-s);
  border: 2px solid transparent; font: 650 15.5px/1 var(--sans); font-stretch: 94%; letter-spacing: -.005em;
  color: var(--ink-2); text-decoration: none; }
.top nav a:hover { color: var(--ink); border-color: var(--line-2); }
.top nav a[aria-current="page"] { background: var(--ink); color: var(--card); border-color: var(--ink); }
.top nav a .ico { width: 17px; height: 17px; }
.top .icons { display: flex; align-items: center; gap: var(--s2); }
.iconbtn { display: inline-grid; place-items: center; width: 40px; height: 40px; color: var(--ink-2); text-decoration: none;
  border: 2px solid transparent; border-radius: var(--r-s); background: none; cursor: pointer; }
.iconbtn:hover { color: var(--ink); border-color: var(--line-2); }
.iconbtn[aria-current="page"] { background: var(--ink); color: var(--card); border-color: var(--ink); }
.avatar { width: 44px; height: 44px; border-radius: 50%; background: var(--fam); color: var(--on-band); border: 2px solid var(--edge);
  display: inline-grid; place-items: center; font: 800 18px/1 var(--display); text-decoration: none; box-shadow: var(--lift-s);
  transition: transform 90ms var(--ease), box-shadow 90ms var(--ease); }
.avatar:hover { transform: translate(-1px, -1px); box-shadow: 3px 3px 0 var(--drop); }
.avatar:active { transform: translate(2px, 2px); box-shadow: none; }
.tabbar { display: none; }
/* footer: Powered by YouTube, the policies, the imprint */
footer.colophon { border-top: 1px solid var(--line); padding-block: var(--s5) calc(var(--s5) + env(safe-area-inset-bottom));
  font: 400 14.5px/1.6 var(--sans); color: var(--muted); }
footer.colophon .wrap { display: grid; gap: 10px 32px; align-items: end; }
footer.colophon nav { display: flex; flex-wrap: wrap; gap: 0 20px; }
footer.colophon a { color: var(--muted); text-decoration: none; }
footer.colophon a:hover { color: var(--ink); text-decoration: underline; text-decoration-color: var(--accent); }
footer.colophon nav a { display: inline-block; padding-block: 6px; }
footer.colophon .yt { margin: 0; color: var(--ink-2); font-weight: 600; }
footer.colophon .imprint { margin: 0; font: 500 10.5px/1.7 var(--mono); letter-spacing: .07em; text-transform: uppercase; }
footer.colophon .imprint a { text-decoration: underline; text-decoration-color: var(--line-2); }
@media (min-width: 900px) { footer.colophon .wrap { grid-template-columns: 1fr auto; } footer.colophon .imprint { text-align: right; } }

/* ============================================================== components */
/* ---------- buttons: objects that go down when you press them */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 9px; min-height: 46px;
  padding: 0 20px; font: 700 16.5px/1.1 var(--sans); font-stretch: 94%; letter-spacing: -.01em; color: var(--card);
  background: var(--ink); border: 2px solid var(--edge); border-radius: var(--r); box-shadow: var(--lift);
  cursor: pointer; text-decoration: none; text-align: center; white-space: nowrap; user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: transform 90ms var(--ease), box-shadow 90ms var(--ease), background-color 120ms, color 120ms; }
.btn:hover { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--drop); text-decoration: none; }
.btn:active, .btn.is-down { transform: translate(3px, 3px); box-shadow: 0 0 0 var(--drop); }
.btn.accent { background: var(--red); color: var(--on-red); }
.btn.ghost { background: var(--card); color: var(--ink); }
.btn.ghost[aria-pressed="true"] { background: var(--ink); color: var(--card); transform: translate(2px, 2px); box-shadow: none; }
.btn.small { min-height: 38px; padding: 0 14px; font-size: 15px; gap: 7px; border-radius: var(--r-s); box-shadow: var(--lift-s); }
.btn.small:hover { box-shadow: 3px 3px 0 var(--drop); }
.btn.small:active { transform: translate(2px, 2px); box-shadow: none; }
.btn.block { width: 100%; }
.btn.danger { background: var(--bad); color: var(--bad-ink); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; }
.btn svg { width: 18px; height: 18px; flex: none; }
.btn.small svg { width: 16px; height: 16px; }
/* Google sign-in: Google's own light / dark button inside the kit's physical frame */
.btn.gbtn { background: #fff; color: #1F1F1F; border: 1px solid #747775; outline: 2px solid var(--edge); outline-offset: 0;
  font: 500 16.5px/1 Roboto, var(--sans); font-stretch: 100%; letter-spacing: 0; min-height: 52px; box-shadow: 4px 4px 0 var(--drop); }
.btn.gbtn:hover { box-shadow: 5px 5px 0 var(--red); }
.btn.gbtn:active { transform: translate(4px, 4px); box-shadow: none; }
.btn.gbtn:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
:root[data-theme="dark"] .btn.gbtn { background: #131314; color: #E3E3E3; border-color: #8E918F; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn.gbtn { background: #131314; color: #E3E3E3; border-color: #8E918F; } }
.linkbtn { background: none; border: 0; font: inherit; font-family: var(--sans); font-weight: 600; color: var(--ink); cursor: pointer; padding: 0;
  text-decoration: underline; text-decoration-thickness: 1.5px; text-decoration-color: var(--line-2); text-underline-offset: 4px; }
.linkbtn:hover { text-decoration-color: var(--accent); }
.linkbtn.quiet { color: var(--muted); text-decoration: none; font-weight: 500; }
.linkbtn.quiet:hover { color: var(--ink); text-decoration: underline; text-decoration-color: var(--accent); }

/* ---------- keys (latching toggles that stay pressed), chips, segmented, switch, stepper */
.key { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 15px;
  border: 2px solid var(--edge); border-radius: var(--r-s); background: var(--card); color: var(--ink);
  font: 650 16px/1 var(--sans); font-stretch: 92%; letter-spacing: -.01em; text-decoration: none; box-shadow: var(--lift-s);
  cursor: pointer; -webkit-tap-highlight-color: transparent;
  transition: transform 90ms var(--ease), box-shadow 90ms var(--ease), background-color 120ms, color 120ms; }
.key:hover { transform: translate(-1px, -1px); box-shadow: 3px 3px 0 var(--drop); }
.key:active { transform: translate(2px, 2px); box-shadow: none; }
.key[aria-pressed="true"], .key[aria-checked="true"], .key[aria-current="page"] {
  background: var(--ink); color: var(--card); transform: translate(2px, 2px); box-shadow: none; }
.key[aria-pressed="true"]::before, .key[aria-checked="true"]::before { content: ""; width: 7px; height: 7px; border-radius: 50%;
  background: var(--red); box-shadow: 0 0 0 2px var(--ink); margin-left: -3px; flex: none; }
.key svg { width: 15px; height: 15px; flex: none; }
.keys { display: flex; flex-wrap: wrap; gap: 10px 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 12px;
  font: 600 14.5px/1.1 var(--sans); font-stretch: 94%; color: var(--ink); background: var(--card); border: 2px solid var(--edge);
  border-radius: var(--r-s); box-shadow: var(--lift-s); cursor: pointer; text-decoration: none;
  transition: transform 90ms var(--ease), box-shadow 90ms var(--ease), background-color 120ms, color 120ms; }
.chip:hover { transform: translate(-1px, -1px); box-shadow: 3px 3px 0 var(--drop); }
.chip:active { transform: translate(2px, 2px); box-shadow: none; }
.chip[aria-pressed="true"], .chip.on { background: var(--ink); color: var(--card); transform: translate(2px, 2px); box-shadow: none; }
.chip.static { cursor: default; border-style: dashed; border-color: var(--line-strong); box-shadow: none; background: transparent; }
.chip.static:hover { transform: none; box-shadow: none; }
.seg { display: inline-flex; border: 2px solid var(--edge); border-radius: var(--r); padding: 3px; gap: 3px; background: var(--tray); }
.seg button, .seg a, .seg label > span { display: inline-flex; align-items: center; justify-content: center; min-height: 38px;
  text-decoration: none; font: 650 15px/1 var(--sans); font-stretch: 94%; padding: 0 14px; border: 0; border-radius: 6px;
  background: transparent; color: var(--ink-2); cursor: pointer; }
.seg button:hover, .seg a:hover, .seg label:hover > span { color: var(--ink); }
.seg button[aria-pressed="true"], .seg a[aria-current="page"], .seg input:checked + span {
  background: var(--card); color: var(--ink); box-shadow: 0 0 0 2px var(--edge), 2px 2px 0 2px var(--drop); }
.seg label { position: relative; padding: 0; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label:has(input:focus-visible) > span { outline: 2.5px solid var(--focus); outline-offset: 3px; }
.switch { position: relative; display: inline-block; width: 46px; height: 28px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; border: 2px solid var(--edge); border-radius: 99px; background: var(--tray);
  transition: background-color .15s; }
.switch span::after { content: ""; position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; border-radius: 50%;
  background: var(--card); border: 2px solid var(--edge); transition: transform .16s var(--pop); }
.switch input:checked + span { background: var(--red); }
.switch input:checked + span::after { transform: translateX(18px); }
.switch input:focus-visible + span { outline: 2.5px solid var(--focus); outline-offset: 3px; }
.stepper { display: inline-flex; align-items: stretch; border: 2px solid var(--edge); border-radius: var(--r-s); background: var(--card);
  box-shadow: var(--lift-s); overflow: hidden; }
.stepper button { width: 42px; border: 0; background: none; font: 600 20px/1 var(--sans); color: var(--ink); cursor: pointer; }
.stepper button:hover { background: var(--sunk); }
.stepper input::-webkit-inner-spin-button, .stepper input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.stepper output, .stepper input, .stepper input[type=number] { width: 56px; min-width: 44px; -moz-appearance: textfield; appearance: textfield;
  box-shadow: none; border-radius: 0; text-align: center; font: 500 16px/40px var(--mono); border: 0;
  border-inline: 1.5px solid var(--line-2); background: none; color: var(--ink); padding: 0; }

/* ---------- band marks (shape + ink + name), stickers */
.bmark { display: inline-flex; align-items: center; gap: 6px; color: var(--band); font: 500 var(--fs-xs)/1.2 var(--mono);
  letter-spacing: .08em; text-transform: uppercase; white-space: nowrap; }
.bmark svg, .bshape { width: 10px; height: 10px; flex: none; fill: var(--band); }
.bshape.hollow { fill: none; stroke: var(--band); stroke-width: 1.6; }
/* sticker label: a band (or plain) label stuck on an object. Restrained: a slight tilt, a small hard shadow. */
.stk { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; height: 26px; padding: 0 10px 0 8px;
  border-radius: 5px; background: var(--band); color: var(--on-band); border: 1.5px solid var(--edge);
  font: 500 10.5px/1 var(--mono); letter-spacing: .07em; text-transform: uppercase;
  transform: rotate(var(--tilt, -2deg)); box-shadow: 1.5px 1.5px 0 var(--drop); }
.stk svg { width: 11px; height: 11px; fill: currentColor; flex: none; }
.stk.plain, .stk:not([data-band]) { background: var(--card); color: var(--ink); }
.stk.ink { background: var(--ink); color: var(--card); }
.stk.red { background: var(--red); color: var(--on-red); }
.stk.flat { transform: none; box-shadow: none; }
/* legacy: <span class="tag fam"><span class="dot"></span>Familiar</span> */
.tag { display: inline-flex; align-items: center; gap: 6px; font: 500 var(--fs-xs)/1.2 var(--mono);
  letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.tag .dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; display: inline-block; }
.tag.fam { color: var(--fam); } .tag.adj { color: var(--adj); } .tag.far { color: var(--far); }
.tag.adj .dot { border-radius: 0; transform: rotate(45deg) scale(.85); }
.tag.far .dot { border-radius: 0; background: none; width: 0; height: 0; border-left: 5px solid transparent;
  border-right: 5px solid transparent; border-bottom: 9px solid currentColor; }
.level { font: 400 var(--fs-xs)/1.5 var(--mono); letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.vtag { display: inline-flex; align-items: center; gap: 5px; font: 500 10.5px/1.4 var(--mono);
  letter-spacing: .08em; text-transform: uppercase; color: var(--ink); border: 1.5px solid var(--line-strong);
  border-radius: var(--r-xs); padding: 2px 7px; background: var(--card); }

/* ---------- objects and printed surfaces */
/* .card: an object on the table (tickets, panels you handle). .panel / .printed: flat printed paper, no shadow. */
.card { background: var(--card); border: 2px solid var(--edge); border-radius: var(--r); padding: var(--s4); box-shadow: var(--lift); }
.panel { background: var(--sheet); border: 1px solid var(--line-2); border-radius: var(--r-xs); padding: var(--s4); }
.printed { position: relative; background: var(--sheet); padding: 10px; border-radius: 3px;
  box-shadow: 0 1px 0 rgb(60 45 20 / .06), 0 22px 40px -28px rgb(50 35 15 / .5); }
:root[data-theme="dark"] .printed { box-shadow: 0 0 0 1px rgb(232 237 243 / .06), 0 22px 40px -24px #000; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .printed { box-shadow: 0 0 0 1px rgb(232 237 243 / .06), 0 22px 40px -24px #000; } }
.printed-head, .printed-foot { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 4px 12px;
  font: 500 10px/1.3 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.printed-head { padding: 2px 2px 9px; }
.printed-head b { font: 800 12px var(--display); font-stretch: 90%; letter-spacing: .06em; color: var(--ink); }
.printed-foot { padding: 9px 2px 0; }
/* a ticket: object with a perforation and a stub (tint the stub with data-band) */
.tk { --notch: var(--bg); position: relative; background: var(--card); color: var(--ink); border: 2px solid var(--edge);
  border-radius: var(--r); box-shadow: var(--lift); }
.tk-main { padding: 14px 14px 12px; }
.tk-stub { padding: 10px 14px 12px; border-radius: 0 0 calc(var(--r) - 2px) calc(var(--r) - 2px);
  background: color-mix(in oklab, var(--band, var(--card)) 9%, var(--card)); }
.perf { position: relative; height: 0; border-top: 2px dashed var(--rule-2); margin: 0 16px; }
.perf::before, .perf::after { content: ""; position: absolute; top: -12px; width: 20px; height: 20px; border-radius: 50%;
  background: var(--notch); border: 2px solid var(--edge); }
.perf::before { left: -29px; clip-path: inset(0 0 0 50%); }
.perf::after { right: -29px; clip-path: inset(0 50% 0 0); }
.plate { position: relative; background: var(--card); border: 2px solid var(--edge); border-radius: var(--r-s); overflow: hidden; }
.ticks { position: relative; }
.ticks::before, .ticks::after { content: ""; position: absolute; inset: -6px; pointer-events: none; z-index: 1;
  --t: var(--line-strong);
  background:
    linear-gradient(var(--t), var(--t)) 0 0 / 12px 1px no-repeat, linear-gradient(var(--t), var(--t)) 0 0 / 1px 12px no-repeat,
    linear-gradient(var(--t), var(--t)) 100% 0 / 12px 1px no-repeat, linear-gradient(var(--t), var(--t)) 100% 0 / 1px 12px no-repeat; }
.ticks::after { background:
    linear-gradient(var(--t), var(--t)) 0 100% / 12px 1px no-repeat, linear-gradient(var(--t), var(--t)) 0 100% / 1px 12px no-repeat,
    linear-gradient(var(--t), var(--t)) 100% 100% / 12px 1px no-repeat, linear-gradient(var(--t), var(--t)) 100% 100% / 1px 12px no-repeat; }
.rule { border: 0; border-top: 1px solid var(--line-2); margin: var(--s5) 0; }
.rule.double { height: 5px; border-top: 1.5px solid var(--ink); border-bottom: .75px solid var(--ink); }
.contour { display: block; width: 100%; height: 10px; color: var(--contour); margin: var(--s5) 0; }
.legend { border: 1px solid var(--line-2); background: var(--sheet); border-radius: var(--r-xs); padding: var(--s3) var(--s3) var(--s2); position: relative; }
.legend > .label:first-child { position: absolute; top: -8px; left: 10px; padding: 0 6px; background: var(--sheet); }
.readouts { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); border-top: 1.5px solid var(--ink); border-bottom: 1px solid var(--line); }
.readout { padding: var(--s3) var(--s3) var(--s3) 0; }
.readout + .readout { border-left: 1px solid var(--line); padding-left: var(--s3); }
.readout b { display: block; font: 800 clamp(30px, 4vw, 42px)/1.05 var(--display); font-stretch: 84%; letter-spacing: -.02em; }
.readout span { font: 500 var(--fs-xs)/1.3 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.highlight { background: linear-gradient(transparent 55%, var(--highlight) 55%, var(--highlight) 92%, transparent 92%); }

/* ---------- day glyph */
.glyph { display: inline-flex; gap: 6px; align-items: center; list-style: none; margin: 0; padding: 0; }
.glyph li { position: relative; display: grid; place-items: center; width: 14px; height: 14px; }
.glyph svg { width: 14px; height: 14px; fill: var(--band); stroke: var(--band); stroke-width: 1.6; }
.glyph li.open svg { fill: none; }
.glyph li.new::after { content: ""; position: absolute; width: 4px; height: 4px; border-radius: 50%; background: var(--bg); }
.glyph.lg { gap: 10px; }
.glyph.lg li, .glyph.lg svg { width: 22px; height: 22px; }
.glyph.lg li.new::after { width: 6px; height: 6px; }

/* ---------- scale bar (the day's minutes) */
.scalebar { margin-top: var(--s4); }
.scalebar .bar { display: flex; height: 14px; border: 2px solid var(--edge); border-radius: var(--r-xs); background: var(--card); overflow: hidden; }
.scalebar .seg-i { position: relative; flex: var(--w) 1 0; min-width: 6px; border-right: 1.5px solid var(--edge); }
.scalebar .seg-i:last-child { border-right: 0; }
.scalebar .seg-i:nth-child(even) { background: repeating-linear-gradient(90deg, var(--line-2) 0 1px, transparent 1px 4px); }
.scalebar .seg-i.done { background: var(--band); }
.scalebar .seg-i.part { background: linear-gradient(90deg, var(--band) var(--p), transparent var(--p)); }
.scalebar .seg-i.next { box-shadow: inset 0 -4px 0 var(--accent); }
.scalebar .ticks-row { display: flex; font: 400 10px/1 var(--mono); color: var(--muted); margin-top: 6px; letter-spacing: .04em; }
.scalebar .ticks-row span { flex: var(--w) 1 0; min-width: 6px; overflow: hidden; }
.scalebar .scale-ends { display: flex; justify-content: space-between; font: 400 10px/1 var(--mono); color: var(--muted); margin-top: 6px; }

/* ---------- the two-tap vote: plain toggle keys (no stamps). Pressed = ink key pushed in, with a check mark, so
   the state never rests on colour alone. Macro vote() in _macros.html, behaviour in ui.js. */
.vote { display: grid; gap: var(--s3); }
.vote .q { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.vote .qlabel { grid-column: 1 / -1; }
.vbtn { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px;
  padding: 0 12px; font: 650 15.5px/1.1 var(--sans); font-stretch: 94%; letter-spacing: -.005em;
  color: var(--ink); background: var(--card); border: 2px solid var(--edge); border-radius: var(--r-s); box-shadow: var(--lift-s);
  cursor: pointer; -webkit-tap-highlight-color: transparent;
  transition: transform 90ms var(--ease), box-shadow 90ms var(--ease), background-color 120ms, color 120ms; }
.vbtn:hover { transform: translate(-1px, -1px); box-shadow: 3px 3px 0 var(--drop); }
.vbtn:active { transform: translate(2px, 2px); box-shadow: none; }
.vbtn[aria-pressed="true"] { background: var(--ink); color: var(--card); transform: translate(2px, 2px); box-shadow: none; }
.vbtn[aria-pressed="true"]::before { content: ""; width: 14px; height: 14px; flex: none; margin-left: -2px; background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 12.5 4.5 4.5L19 7.5'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 12.5 4.5 4.5L19 7.5'/%3E%3C/svg%3E") center / contain no-repeat; }
.vbtn kbd { font-size: 10px; padding: 1px 4px; color: inherit; background: transparent; border-color: currentColor; opacity: .55; }
.vbtn .ico { width: 15px; height: 15px; flex: none; }
@media (hover: none) { .vbtn kbd { display: none; } }
@keyframes stamp { from { transform: scale(.94); } }   /* old name: a short press, read by page styles */
.vote.compact .vbtn { min-height: 36px; font-size: 14px; padding: 0 10px; }
.vote-status { font: 400 var(--fs-sm)/1.4 var(--sans); color: var(--muted); min-height: 1.4em; }

/* ---------- forms */
label.field, .field-label { display: block; margin: var(--s4) 0 6px; font: 500 var(--fs-xs)/1.3 var(--mono);
  letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
input[type=text], input[type=password], input[type=number], input[type=search], input[type=email], input[type=url], textarea, select {
  width: 100%; font: 400 16px/1.4 var(--sans); padding: 11px 13px; color: var(--ink); background: var(--card);
  border: 2px solid var(--line-strong); border-radius: var(--r-s); transition: border-color .15s, box-shadow .15s; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--edge); box-shadow: 0 0 0 3px color-mix(in oklab, var(--accent) 30%, transparent); }
:root[data-theme="dark"] :is(input, textarea, select):focus { border-color: var(--ink-2); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) :is(input, textarea, select):focus { border-color: var(--ink-2); } }
::placeholder { color: var(--muted); opacity: 1; }
select { appearance: none; padding-right: 36px; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-2) 50%), linear-gradient(135deg, var(--ink-2) 50%, transparent 50%);
  background-position: calc(100% - 18px) 55%, calc(100% - 13px) 55%; background-size: 5px 5px; background-repeat: no-repeat; }
textarea { resize: vertical; }
.check { display: grid; grid-template-columns: 24px 1fr; gap: 12px; align-items: start; padding: 14px 0; min-height: 44px;
  border-top: 1px solid var(--line); cursor: pointer; }
.check input { appearance: none; width: 22px; height: 22px; margin: 2px 0 0; border: 2px solid var(--edge); border-radius: 5px;
  background: var(--card); display: grid; place-items: center; cursor: pointer; }
.check input:checked { background: var(--ink); }
.check input:checked::after { content: ""; width: 10px; height: 6px; border: 2.5px solid var(--card); border-top: 0; border-right: 0;
  transform: rotate(-45deg) translate(1px, -1px); }
.check input:disabled { opacity: .55; }
.err { color: var(--bad); font: 500 var(--fs-sm)/1.4 var(--sans); margin-top: var(--s2); }

/* ---------- notes, quiet containers */
.note { border-left: 3px solid var(--accent); background: var(--card); padding: 10px 14px; font-size: 16px; margin: var(--s3) 0 var(--s4);
  border-radius: 0 var(--r-xs) var(--r-xs) 0; }
.note.warn { border-left-color: var(--fam); }
.stack > * + * { margin-top: var(--s4); }
.row-gap { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.empty { padding: var(--s5) 0; font-family: var(--serif); font-size: 20px; line-height: 1.45; color: var(--ink-2); }
.empty .btn { margin-top: var(--s3); font-family: var(--sans); }

/* ---------- menus (details.more): a popover on wide screens, a bottom sheet on phones */
.more { position: relative; }
.more summary { list-style: none; cursor: pointer; }
.more summary::-webkit-details-marker { display: none; }
.more .menu { position: absolute; right: 0; top: calc(100% + 8px); z-index: 30; min-width: 250px; padding: 6px; display: grid;
  background: var(--card); border: 2px solid var(--edge); border-radius: var(--r); box-shadow: var(--lift); }
.more .menu a { display: block; text-decoration: none; color: var(--ink); padding: 11px 12px; border-radius: 6px; font: 500 15px/1.3 var(--sans); }
.more .menu a:hover, .more .menu a:focus-visible { background: var(--sunk); }
.more .menu button { text-align: left; background: none; border: 0; font: 500 15px/1.3 var(--sans); color: var(--ink);
  padding: 11px 12px; border-radius: 6px; cursor: pointer; }
.more .menu button:hover, .more .menu button:focus-visible { background: var(--sunk); }
.more[open] summary { background: var(--ink); color: var(--card); transform: translate(2px, 2px); box-shadow: none; }
/* under 640px the open menu is a bottom sheet whose scrim is the summary's fixed ::before; a transform on the
   summary would make it the scrim's containing block, so the pressed look there is colour only */

/* ---------- bottom sheet: <dialog class="bsheet" id="x"> opened by [data-open-sheet="x"], closed by
   [data-close-sheet] or a tap on the backdrop (ui.js). A centred dialog on wide screens. */
dialog.bsheet { position: fixed; inset: auto 0 0 0; margin: 0; width: 100%; max-width: none; max-height: 92dvh; overflow-y: auto;
  overscroll-behavior: contain; padding: 8px 16px calc(24px + env(safe-area-inset-bottom)); color: var(--ink);
  background: var(--card); border: 2px solid var(--edge); border-bottom: 0; border-radius: 18px 18px 0 0; }
dialog.bsheet[open] { animation: sheet-up 300ms var(--ease); }
dialog.bsheet::backdrop { background: rgb(10 12 14 / .5); }
.bsheet .grab { width: 42px; height: 5px; border-radius: 3px; background: var(--rule-2); margin: 6px auto 12px; }
.bsheet-x { position: absolute; top: 12px; right: 12px; width: 44px; height: 44px; border-radius: var(--r-s); border: 2px solid var(--edge);
  background: var(--card); color: var(--ink); display: grid; place-items: center; cursor: pointer; box-shadow: var(--lift-s); }
.bsheet-x svg { width: 17px; height: 17px; }
@keyframes sheet-up { from { transform: translateY(40px); opacity: 0; } }
html:has(dialog.bsheet[open]) { overflow: hidden; }
@media (min-width: 900px) {
  dialog.bsheet { inset: 0; margin: auto; width: min(580px, calc(100vw - 48px)); height: fit-content; border-bottom: 2px solid var(--edge);
    border-radius: var(--r-l); box-shadow: 6px 6px 0 var(--drop); padding: 26px 28px 28px; }
  dialog.bsheet[open] { animation: sheet-in 260ms var(--pop); }
  .bsheet .grab { display: none; }
}
@keyframes sheet-in { from { transform: translateY(24px); opacity: 0; } }

/* ---------- tabs */
.tabs { display: flex; gap: var(--s4); border-bottom: 1px solid var(--line-2); margin: var(--s4) 0 var(--s5); overflow-x: auto; scrollbar-width: none; }
.tabs a { padding: 10px 0; color: var(--muted); text-decoration: none; border-bottom: 3px solid transparent; margin-bottom: -1px;
  white-space: nowrap; font: 650 15.5px/1.2 var(--sans); font-stretch: 94%; }
.tabs a:hover { color: var(--ink); }
.tabs a[aria-current="page"], .tabs [aria-selected="true"] { color: var(--ink); border-color: var(--accent); }

/* ---------- tables */
.tablewrap { overflow-x: auto; background:
  linear-gradient(to right, var(--bg) 30%, transparent) left / 24px 100% no-repeat local,
  linear-gradient(to left, var(--bg) 30%, transparent) right / 24px 100% no-repeat local,
  radial-gradient(farthest-side at 0 50%, var(--line-2), transparent) left / 10px 100% no-repeat scroll,
  radial-gradient(farthest-side at 100% 50%, var(--line-2), transparent) right / 10px 100% no-repeat scroll; }
table.data { width: 100%; border-collapse: collapse; font: 400 14px/1.4 var(--sans); font-variant-numeric: tabular-nums; }
table.data th, table.data td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.data thead th { position: sticky; top: 0; background: var(--bg); border-bottom: 1.5px solid var(--ink);
  font: 500 10.5px/1.3 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
table.data td.n, table.data th.n { text-align: right; font-family: var(--mono); }
.ok { color: var(--good); } .bad { color: var(--bad); }

/* ---------- toast */
.toast { position: fixed; left: 50%; bottom: calc(22px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 90;
  display: none; align-items: center; gap: 14px; max-width: calc(100vw - 32px); padding: 10px 10px 10px 16px; min-height: 48px;
  background: var(--ink); color: var(--card); border: 2px solid var(--edge); border-radius: var(--r); box-shadow: var(--lift);
  font: 500 15px/1.3 var(--sans); }
.toast.show { display: flex; animation: rise .2s var(--ease); }
.toast button { background: none; border: 1.5px solid currentColor; border-radius: 6px; color: inherit; padding: 6px 12px;
  font: 650 14px/1 var(--sans); cursor: pointer; }
@keyframes rise { from { opacity: 0; transform: translate(-50%, 8px); } }
@keyframes fade { from { opacity: 0; } }

/* ---------- cookie banner (_cookie_banner.html; ui.js). Fixed, so it never shifts the page; the body gets matching
   bottom padding while it shows so nothing ends up hidden under it. */
.cookie-banner { position: fixed; left: 0; right: 0; bottom: 0; z-index: 80; background: var(--card);
  border-top: 2px solid var(--edge); padding-bottom: env(safe-area-inset-bottom); }
.cookie-banner[data-cookie-banner] { padding-block: 0 env(safe-area-inset-bottom); }   /* page `section` rules must not pad it */
.cookie-banner .cb-in { display: flex; align-items: center; gap: var(--s4); padding-block: 14px; max-width: 1040px; }
.cookie-banner .cb-text { flex: 1; min-width: 0; }
.cookie-banner h2.label { margin: 0 0 4px; color: var(--ink); font-size: 11px; }
.cookie-banner p { margin: 0; font: 400 15px/1.45 var(--serif); color: var(--ink-2); max-width: 72ch; }
.cookie-banner p a { color: var(--ink); white-space: nowrap; }
.cookie-banner .cb-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; flex: none; }
.cookie-banner .cb-actions .btn { min-width: 150px; }
.cookie-banner.leaving { opacity: 0; transform: translateY(8px); transition: opacity .16s var(--ease), transform .16s var(--ease); }
body.has-cookie-banner { padding-bottom: 112px; }
body.has-cookie-banner .toast { bottom: calc(110px + env(safe-area-inset-bottom)); }
main:focus { outline: none; }
@media (max-width: 640px) {
  .cookie-banner .cb-in { flex-direction: column; align-items: stretch; gap: 10px; padding-block: 10px 12px; }
  .cookie-banner p { font-size: 14px; line-height: 1.4; }
  .cookie-banner .cb-actions .btn { min-width: 0; padding-inline: 8px; }
  body.has-tabbar .cookie-banner { bottom: calc(86px + env(safe-area-inset-bottom)); padding-bottom: 0;
    left: 10px; right: 10px; border: 2px solid var(--edge); border-radius: var(--r-l); box-shadow: var(--lift); }
  body.has-cookie-banner { padding-bottom: 186px; }
  body.has-tabbar.has-cookie-banner { padding-bottom: calc(290px + env(safe-area-inset-bottom)); }
  body.has-cookie-banner .toast { bottom: calc(196px + env(safe-area-inset-bottom)); }
  body.has-tabbar.has-cookie-banner .toast { bottom: calc(300px + env(safe-area-inset-bottom)); }
}

/* ---------- legacy layout helpers still used by some pages */
.understood .group { margin-top: var(--s4); }
.depth { display: inline-flex; gap: 2px; vertical-align: middle; }
.depth i { width: 10px; height: 6px; background: var(--line-2); display: inline-block; border-radius: 1px; }
.depth i.on { background: var(--ink); }
.legal { max-width: var(--measure); }
.legal h2 { margin-top: var(--s5); }
.legal li { margin: 4px 0; }

/* ============================================================== responsive chrome */
@media (max-width: 640px) {
  :root { --top-h: 60px; }
  .collar .wrap span:nth-child(n+4) { display: none; }
  .top .wrap { gap: var(--s3); }
  .top nav { display: none; }
  .top .icons { margin-left: auto; }
  /* the key bar: thumb-height navigation, a physical bar floating above the bottom edge */
  .tabbar { display: grid; grid-template-columns: repeat(var(--n, 4), 1fr); gap: 4px; position: fixed; z-index: 45;
    left: 10px; right: 10px; bottom: calc(10px + env(safe-area-inset-bottom)); padding: 5px;
    background: var(--card); border: 2px solid var(--edge); border-radius: var(--r-l); box-shadow: var(--lift); }
  .tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; min-height: 52px;
    border-radius: 9px; color: var(--ink-2); text-decoration: none; font: 500 10px/1 var(--mono); letter-spacing: .07em; text-transform: uppercase; }
  .tabbar a svg { width: 21px; height: 21px; }
  .tabbar a[aria-current="page"] { background: var(--ink); color: var(--card); }
  body.has-tabbar { padding-bottom: calc(86px + env(safe-area-inset-bottom)); }
  body.has-tabbar .toast { bottom: calc(96px + env(safe-area-inset-bottom)); }
  .btn { min-height: 48px; }
  .btn.small { min-height: 44px; }
  .more[open] > summary { transform: none; }
  .more[open] > summary::before { content: ""; position: fixed; inset: 0; z-index: 94; background: rgb(10 12 14 / .45); cursor: default; }
  .more .menu { position: fixed; left: 0; right: 0; top: auto; bottom: 0; min-width: 0; z-index: 95;
    padding: 18px 10px calc(14px + env(safe-area-inset-bottom)); border-bottom: 0; border-radius: 18px 18px 0 0; box-shadow: none; }
  .more .menu::before { content: ""; position: absolute; top: 7px; left: 50%; width: 42px; height: 5px; margin-left: -21px; border-radius: 3px; background: var(--rule-2); }
  .more .menu a, .more .menu button { padding: 14px 12px; font-size: 16px; }
  main { padding-block: var(--s4) var(--s6); }
  footer.colophon { padding-top: var(--s4); }
}
/* ---------- touch: every control at least 44 × 44 px */
@media (max-width: 640px), (pointer: coarse) {
  .btn, .btn.small, .chip, .key, .seg button, .seg a, .seg label > span { min-height: 44px; }
  .iconbtn { width: 44px; height: 44px; }
  .linkbtn { min-height: 44px; display: inline-flex; align-items: center; }
  .vote.compact .vbtn { min-height: 44px; }
  .more summary.btn { min-width: 44px; }
  .tabs a { display: inline-flex; align-items: center; min-height: 44px; padding: 12px 0 10px; }
  .ed-chip { min-height: 44px; }
  .toast button { min-height: 40px; padding-inline: 14px; }
  .switch { width: 52px; height: 30px; }
  .switch span::after { width: 22px; height: 22px; }
  .switch input:checked + span::after { transform: translateX(22px); }
  .switch input { inset: -7px -4px; }          /* a 44 px tall hit area around the 30 px track */
  .stepper button { min-width: 44px; min-height: 44px; }
  footer.colophon nav a { padding-block: 11px; }
}

/* ---------- without JavaScript */
.nojs { margin: 0; padding: 10px 0; background: var(--highlight); color: var(--ink); font: 500 15px/1.4 var(--sans); border-bottom: 1px solid var(--line-2); }
.nojs .wrap { display: block; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
@view-transition { navigation: auto; }
@media (prefers-reduced-motion: reduce) { @view-transition { navigation: none; } }
::view-transition-group(*) { animation-duration: .32s; animation-timing-function: var(--ease); }

/* ============================================================== in-app browser notice (_gsignin.html, on the landing page and /login) */
.inapp { border: 2px solid var(--edge); background: var(--card); border-radius: var(--r); box-shadow: var(--lift); padding: var(--s4); text-align: left; }
.inapp-head { margin: 0 0 6px; font: 700 18px/1.25 var(--sans); font-stretch: 94%; }
.inapp-why { margin: 0 0 var(--s3); font-size: 16px; color: var(--ink-2); }
.inapp .btn + .btn, .inapp .btn { margin-top: var(--s2); }
.inapp-anyway { display: inline-block; margin-top: var(--s3); font: 500 var(--fs-sm)/1.4 var(--sans); color: var(--muted); }
.inapp [hidden] { display: none !important; }

/* cookie banner heading and the phone bottom-sheet shape (_cookie_banner.html) */
.cookie-banner .cb-h { margin: 0 0 4px; font: 800 18px/1.1 var(--display); font-stretch: 86%; letter-spacing: -.012em; color: var(--ink); }
.cookie-banner .cb-h span { font: 500 10.5px/1 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-left: 8px; vertical-align: 2px; }
.cookie-banner .cb-grab { display: none; }
@media (max-width: 640px) {
  .cookie-banner { border: 2px solid var(--edge); border-bottom: 0; border-radius: 18px 18px 0 0; }
  .cookie-banner .cb-grab { display: block; width: 42px; height: 5px; margin: 8px auto 0; border-radius: 3px; background: var(--rule-2); }
  .cookie-banner .cb-in { padding-top: 6px; }
  .cookie-banner .cb-h { font-size: 17px; }
}
