/* AlertLoop Drive overlays. Timings come from config.js via CSS variables set in ui.js.
   Fix pass (AGENTS.md point 4): physical things from a trucker's world (job sheet, paper notes, receipts, a log sheet on
   a clipboard), plain type, no glass cards, no glowing pills, no centred hero slogans. Fonts are system stacks only.
   Nothing here flashes faster than 3 Hz; .reduce-motion (toggle) and prefers-reduced-motion stop movement.
   Heights use vh first and dvh second (iOS Safari: dvh follows the visible area, vh is the fallback). */

:root {
  --navy-0: #050a18;
  --navy-1: #0b1530;
  --navy-2: #12204a;
  --navy-3: #1b2d63;
  --line: rgba(159, 176, 208, .22);
  --text: #e8eefc;
  --muted: #9fb0d0;
  --amber: #f5a524;
  --amber-ink: #1a1203;
  --teal: #2dd4bf;
  --red: #ef4444;
  --paper: #f1ebdc;
  --paper-2: #e9e1cc;
  --ink: #23221f;
  --ink-soft: #55524a;
  --ink-blue: #1f3a93;
  --font: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Roboto, Arial, sans-serif;
  --serif: Georgia, "Times New Roman", Times, serif;
  --type: "Courier Prime", "Courier New", Courier, ui-monospace, "Cascadia Mono", monospace;
  --hand: "Segoe Print", "Bradley Hand", "Noteworthy", "Comic Neue", "Chalkboard SE", cursive;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --gut: 16px;
  /* round 3 check (point 17): a light oak desk under the papers, not a near-black page */
  --desk-c: #8a7258;
  --desk: #8a7258 radial-gradient(95% 75% at 50% 0%, #a08667, #7b644c 85%);
  color-scheme: dark;
}

/* round 3 (AGENTS.md points 17 + 19): the page itself is the dark desk the papers lie on (never a black page), and it
   never scrolls; scrollbars are hidden everywhere */
html, body { margin: 0; height: 100%; overflow: hidden; overscroll-behavior: none; }
html { background: var(--desk-c); scrollbar-width: none; }
body { background: var(--desk); font-family: var(--font); color: var(--text); -webkit-text-size-adjust: 100%; }
html::-webkit-scrollbar, body::-webkit-scrollbar, .al-ui *::-webkit-scrollbar { width: 0; height: 0; display: none; }
.al-ui * { scrollbar-width: none; }
#game { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }

/* ---------- overlay root ---------- */
#ui, .al-ui { position: fixed; inset: 0; pointer-events: none; z-index: 1; font-family: var(--font); color: var(--text); }
.al-ui *, .al-ui *::before, .al-ui *::after { box-sizing: border-box; }
.al-ui [hidden] { display: none !important; }
/* boot: a blank job sheet on the desk with one typed line, until the start screen crossfades over it */
.boot { position: absolute; inset: 0; z-index: 19; display: flex; justify-content: center; align-items: flex-start; overflow: hidden;
  padding: calc(var(--safe-t) + 20px) calc(var(--safe-r) + var(--gut)) 24px calc(var(--safe-l) + var(--gut)); background: var(--desk); }
.boot-sheet { width: min(980px, 100%); height: min(560px, 82vh); margin: 0; padding: 30px 34px; box-sizing: border-box;
  background: var(--paper) linear-gradient(180deg, rgba(255, 255, 255, .25), rgba(0, 0, 0, 0) 40%); box-shadow: 0 18px 40px rgba(0, 0, 0, .55);
  color: var(--ink-soft); font: 15px/1.5 var(--type); }

.screen { position: absolute; inset: 0; pointer-events: auto; z-index: 20; overflow: hidden; }
/* round 3 (AGENTS.md point 17): screens crossfade; the old one stays drawn underneath until the new one covers it */
.screen.xfade { opacity: 0; transition: opacity var(--xfade, .7s) ease; }
.screen.xfade.xfade-in { opacity: 1; }
.retiring { pointer-events: none !important; }
.retiring * { pointer-events: none !important; }
.retiring.xfade-out { opacity: 0 !important; transition: opacity var(--xfade, .7s) ease !important; }
.muted { color: var(--muted); }
cite { font-style: normal; color: inherit; opacity: .8; }

:where(.al-ui) button { font: inherit; color: inherit; }
.al-ui :focus-visible { outline: 3px solid var(--amber); outline-offset: 3px; }

.linkish {
  background: none; border: 0; padding: 0 6px; min-height: 44px; min-width: 44px; cursor: pointer;
  color: inherit; text-decoration: underline; text-underline-offset: 3px; font-size: inherit;
}

/* ---------- 1. start: dispatch job sheet on a dark desk ---------- */
.start {
  /* round 3 (point 19): never scrolls; ui.js scales the sheet to fit (and trims text first, .trim-n) */
  overflow: hidden; display: flex; justify-content: center; align-items: flex-start;
  background: var(--desk);
  padding: calc(var(--safe-t) + 20px) calc(var(--safe-r) + var(--gut)) calc(var(--safe-b) + 20px) calc(var(--safe-l) + var(--gut));
}
.jobsheet {
  position: relative; flex: none; width: 100%; max-width: 980px; margin: 0; color: var(--ink); font-family: var(--type);
  background: var(--paper) linear-gradient(180deg, rgba(255, 255, 255, .25), rgba(0, 0, 0, 0) 40%);
  padding: 30px 34px 22px; box-shadow: 0 18px 40px rgba(0, 0, 0, .55);
  transition: opacity .5s ease;
}
.start.leaving .jobsheet { opacity: .6; }
.js-head { border-bottom: 2px solid var(--ink); padding-bottom: 14px; }
.js-form { margin: 0 0 10px; font-size: 13px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-soft); }
.start h1 { margin: 0; font-family: var(--type); font-size: clamp(1.9rem, 5vw, 3rem); font-weight: 700; line-height: 1.05; letter-spacing: -.01em; }
.js-premise { margin: 12px 0 0; font-family: var(--serif); font-size: clamp(1.05rem, 2.1vw, 1.25rem); max-width: 52ch; }
.js-honesty { margin: 8px 0 0; font-size: 14px; color: var(--ink-soft); }
.js-fields { display: flex; flex-wrap: wrap; gap: 6px 28px; margin: 16px 0 0; font-size: 14px; }
.js-fields div { display: flex; gap: 8px; align-items: baseline; }
.js-fields dt { color: var(--ink-soft); text-transform: uppercase; letter-spacing: .08em; font-size: 12px; }
.js-fields dd { margin: 0; font-family: var(--hand); font-size: 16px; color: var(--ink-blue); border-bottom: 1px solid rgba(35, 34, 31, .45); padding: 0 8px; }
.js-pickrow { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 18px; margin: 26px 0 10px; }
.js-pick { margin: 0; font-size: 15px; letter-spacing: .14em; text-transform: uppercase; }
.rm { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; font-size: 14px; cursor: pointer; }
.rm input { width: 20px; height: 20px; accent-color: #2b2a27; margin: 0; }

.photos { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 26px; }
.photo {
  display: block; width: 100%; padding: 10px 10px 8px; cursor: pointer; text-align: left; border: 0;
  background: #fbfaf6; color: var(--ink); box-shadow: 0 3px 10px rgba(0, 0, 0, .28);
  transform: rotate(var(--tilt, 0deg)); transition: transform .2s ease, box-shadow .2s ease;
}
.photo:hover, .photo:focus-visible { transform: rotate(0deg) translateY(-2px); box-shadow: 0 8px 18px rgba(0, 0, 0, .32); }
.photo:disabled { cursor: default; }
.photo:disabled:not(.picked) { opacity: .45; }
.photo-pic { position: relative; display: block; aspect-ratio: 16 / 10; background: #1b1f27; overflow: hidden; }
.photo-pic > img, .photo-pic > svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; object-fit: cover; opacity: 0; transition: opacity .3s ease; }
.photo-pic.loaded > img, .photo-pic.loaded > svg { opacity: 1; }
.photo-cap { display: flex; flex-direction: column; padding: 8px 2px 0; }
.photo-name { font-family: var(--hand); font-size: 1.2rem; color: var(--ink-blue); }
.photo-blurb { font-size: 13px; color: var(--ink-soft); }
.js-nocam { margin: 14px 0 0; font-size: 15px; }
.js-nocam .linkish { padding: 0 2px; color: var(--ink-blue); }
/* round 4 (point 26): "measure my eyes again" beside "watch without camera"; on a narrow phone on its own line, no dot */
.js-remeasure { white-space: nowrap; }
@media (max-width: 480px) { .js-remeasure { display: block; } .js-sep { display: none; } }
.js-how { margin: 10px 0 0; font-size: 14px; line-height: 1.55; max-width: 78ch; }
.js-foot { margin-top: 12px; padding-top: 6px; border-top: 1px dashed rgba(35, 34, 31, .4); font-size: 14px; }
.js-foot .linkish { padding-left: 0; color: var(--ink-soft); }

/* trims (ui.js adds them one by one only when the sheet would otherwise shrink below ~80 %) */
.jobsheet.trim-1 .js-pickrow { margin: 14px 0 8px; }
.jobsheet.trim-1 .js-how { font-size: 13px; line-height: 1.4; }
.jobsheet.trim-2 .photo-blurb { display: none; }
.jobsheet.trim-2 .js-premise { margin-top: 6px; }
.jobsheet.trim-3 .js-foot { margin-top: 2px; padding-top: 0; border-top: 0; }
.jobsheet.trim-3 .js-foot .linkish { min-height: 32px; }
.jobsheet.trim-3 .js-nocam { margin-top: 8px; }
/* round 3 check: the last trim keeps a one-line "How it works" (point 10) instead of dropping it */
.how-short { display: none; }
.jobsheet.trim-4 .how-full { display: none; }
.jobsheet.trim-4 .how-short { display: inline; }

/* phone portrait: one photo per row, smaller sheet padding */
@media (max-width: 680px) {
  .jobsheet { padding: 20px 16px 14px; }
  .photos { grid-template-columns: 1fr; gap: 14px; }
  .photo { display: grid; grid-template-columns: 46% 1fr; gap: 10px; align-items: center; padding: 8px; }
  .photo-pic { aspect-ratio: 16 / 10; }
  .photo-cap { padding: 0; }
  .js-fields { gap: 4px 16px; font-size: 13px; }
  .js-pickrow { margin-top: 18px; }
}
/* phone landscape / short screens: compact, photos in a row */
@media (max-height: 520px) and (min-width: 560px) {
  .start { padding-top: calc(var(--safe-t) + 10px); }
  .jobsheet { padding: 14px 20px 10px; }
  .js-form { display: none; }
  .start h1 { font-size: 1.7rem; }
  .js-premise { margin-top: 4px; font-size: 1rem; }
  .js-fields { display: none; }
  .js-pickrow { margin: 10px 0 6px; }
  .photos { gap: 14px; }
  .photo { padding: 6px 6px 4px; }
  .photo-pic { aspect-ratio: 16 / 8; }
  .photo-name { font-size: 1rem; }
}

/* ---------- 2 + 3. loading and calibration: one dispatch slip on the desk ---------- */
/* round 3 check (points 4, 17, 19): the same paper and desk as the start sheet, typed left-aligned lines, a pen line
   for progress; loading and calibration are two states of this one sheet (ui.js prepSheet), so they never overlap */
.prep {
  display: flex; justify-content: center; align-items: flex-start; overflow: hidden; background: var(--desk);
  padding: calc(var(--safe-t) + 9vh) calc(var(--safe-r) + var(--gut)) calc(var(--safe-b) + 20px) calc(var(--safe-l) + var(--gut));
  padding-top: calc(var(--safe-t) + 9dvh);
}
.slip {
  position: relative; width: min(660px, 100%); margin: 0; padding: 22px 30px 24px; color: var(--ink); font-family: var(--type);
  background: var(--paper) linear-gradient(180deg, rgba(255, 255, 255, .25), rgba(0, 0, 0, 0) 40%);
  box-shadow: 0 18px 40px rgba(0, 0, 0, .45); transform: rotate(-.6deg); text-align: left;
}
.slip-form { margin: 0 0 14px; padding-bottom: 8px; border-bottom: 2px solid var(--ink); font-size: 13px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-soft); }
.slip-line { margin: 0; font-family: var(--type); font-size: 17px; font-weight: 700; line-height: 1.4; }
.prep[data-state="loading"] .slip-cal, .prep[data-state="calib"] .slip-load { display: none; }
.pen { display: block; width: min(340px, 100%); height: 14px; margin: 10px 0 4px; overflow: visible; }
.pen-ink { fill: none; stroke: var(--ink-blue); stroke-width: 2.2; stroke-linecap: round; stroke-dasharray: 100; stroke-dashoffset: 100; vector-effect: non-scaling-stroke; }
.slip-load .pen-ink.drawing { animation: pen-draw 9s cubic-bezier(.2, .7, .3, 1) forwards; }
@keyframes pen-draw { from { stroke-dashoffset: 100; } to { stroke-dashoffset: 12; } }
.cal-pen .pen-ink { transition: stroke-dashoffset .25s linear; }
.load-fact { margin: 16px 0 0; padding: 10px 0 0; border-top: 1px dashed rgba(35, 34, 31, .4); }
.load-fact .fact-text { margin: 0 0 6px; font-family: var(--serif); font-size: 16px; line-height: 1.45; max-width: 60ch; }
.load-fact figcaption { color: var(--ink-soft); font-size: 12.5px; }
.slip-cal { display: flex; gap: 18px; align-items: flex-start; }
.cal-text { flex: 1 1 auto; min-width: 0; }
.cal-sub { margin: 6px 0 0; color: var(--ink-soft); max-width: 46ch; font-size: 15px; line-height: 1.45; }
.cal-pen { display: flex; align-items: center; gap: 10px; }
.cal-pen .pen { flex: 1 1 auto; margin: 8px 0; }
.cal-pct { flex: none; font-family: var(--hand); font-size: 18px; color: var(--ink-blue); font-variant-numeric: tabular-nums; min-width: 2.4em; }
.cal-status { margin: 4px 0 0; min-height: 1.45em; font-size: 15px; line-height: 1.45; color: #2f6b2f; max-width: 46ch; }
.cal-status.bad { color: #8a5200; }
.prep .cal-sub:empty, .prep:not([data-mode="camera"]) .cal-status:empty { display: none; }
.prep .notice { margin: 8px 0 0; max-width: 52ch; font-size: 14px; line-height: 1.45; color: var(--ink-soft); }
.cal-preview { flex: none; margin: 0; padding: 6px 6px 4px; background: #fbfaf6; box-shadow: 0 3px 10px rgba(0, 0, 0, .28); transform: rotate(1.2deg); }
.cal-preview[hidden] { display: none; }
.cal-preview canvas { width: min(180px, 34vw); height: auto; display: block; background: #1b1f27; }
.cal-preview-note { margin: 4px 0 0; font-size: 11.5px; color: var(--ink-soft); }
@media (max-width: 520px) {
  .slip { padding: 16px 16px 18px; }
  .slip-cal { flex-direction: column; gap: 12px; }
  .cal-preview canvas { width: min(200px, 56vw); }
  .slip-line { font-size: 16px; }
}
@media (max-height: 520px) {
  .prep { padding-top: calc(var(--safe-t) + 14px); }
  .slip { padding: 14px 22px 16px; }
  .slip-form { margin-bottom: 8px; }
  .load-fact { margin-top: 8px; }
  .cal-preview canvas { width: min(130px, 24vw); }
}

/* ---------- 4. HUD: quiet text lines, no pills, no glow ---------- */
.hud { position: absolute; inset: 0; z-index: 10; pointer-events: none; font-size: 15px; text-shadow: 0 1px 3px rgba(0, 0, 0, .9), 0 0 10px rgba(0, 0, 0, .6); }
.hud-tl, .hud-tr, .hud-top, .hud-bl, .hud-br { position: absolute; display: flex; flex-direction: column; gap: 6px; }
.hud-tl { top: calc(var(--safe-t) + 12px); left: calc(var(--safe-l) + 14px); align-items: flex-start; max-width: min(44vw, 440px); }
.hud-tr { top: calc(var(--safe-t) + 8px); right: calc(var(--safe-r) + 8px); }
.hud-top { top: calc(var(--safe-t) + 54px); left: 50%; transform: translateX(-50%); align-items: center; width: max-content; max-width: calc(100vw - 2 * var(--gut)); }
.hud-bl { bottom: calc(var(--safe-b) + 14px); left: calc(var(--safe-l) + 14px); align-items: flex-start; max-width: min(50vw, 420px); }
.hud-br { bottom: calc(var(--safe-b) + 14px); right: calc(var(--safe-r) + 14px); align-items: flex-end; }

.badge { font-size: 13px; color: var(--muted); }
.compress { font-size: 12px; color: var(--muted); }

.icon-btn { pointer-events: auto; width: 44px; height: 44px; display: grid; place-items: center; cursor: pointer; background: none; border: 0; color: var(--muted); }
.icon-btn svg { width: 22px; height: 22px; filter: drop-shadow(0 1px 2px #000); }
.mute .off { display: none; }
.mute.is-muted .off { display: inline; }
.mute.is-muted .on { display: none; }

/* the alert: a plain amber strip of text */
.alert-line {
  padding: 6px 14px; background: rgba(20, 14, 2, .72); border-top: 2px solid var(--amber); border-bottom: 2px solid var(--amber);
  color: #ffc861; font-weight: 700; font-size: clamp(16px, 2.3vw, 20px); letter-spacing: .02em; text-shadow: none;
}
.exit-line { padding: 4px 12px; background: rgba(5, 10, 24, .6); color: #b9e8c0; font-size: 15px; text-shadow: none; }
/* round 2: one quiet guidance line ("Watching your eyelids…", "Can't see your eyes…"); fades in and out */
.guide-line { padding: 4px 12px; background: rgba(5, 10, 24, .55); color: var(--text); font-size: 15px; text-shadow: none;
  max-width: min(46ch, calc(100vw - 2 * var(--gut))); text-align: center; opacity: 0; transition: opacity var(--guide-fade, 1.2s) ease; }
.guide-line.on { opacity: 1; transition-duration: .35s; }
.guide-line.bad { color: #ffc861; }
.guide-line:not(.on):empty { display: none; }

.blocker, .stim { display: flex; flex-direction: column; gap: 1px; }
.blk-text { font-size: 15px; color: #d8d0f0; }
.stim-title { font-size: 15px; color: #9ee8dc; }
.stim-phase { font-size: 13px; color: var(--muted); }
.stim-edge { position: absolute; inset: 0; opacity: 0; box-shadow: inset 0 0 70px 6px rgba(45, 212, 191, .35); transition: opacity .6s ease; }
.stim-edge.on { animation: edge-breathe var(--pulse-dur, 1.25s) ease-in-out infinite; }
@keyframes edge-breathe { 0%, 100% { opacity: .1; } 50% { opacity: .4; } }

.meter { display: none; width: 150px; padding: 6px 8px; background: rgba(5, 10, 24, .6); }
.hud.show-meter .meter { display: block; }
.meter-top { display: flex; justify-content: space-between; font-size: 12px; font-weight: 600; margin-bottom: 4px; }
.meter-val { font-variant-numeric: tabular-nums; color: var(--text); }
.meter-bar { position: relative; height: 6px; background: var(--navy-3); overflow: visible; }
.meter-fill { display: block; height: 100%; width: 0; background: var(--teal); transition: width .2s linear, background-color .3s; }
.meter.over .meter-fill { background: var(--amber); }
.meter.over .meter-val { color: var(--amber); }
.meter-line { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--amber); }
.meter-scale { display: flex; justify-content: space-between; font-size: 10.5px; color: var(--muted); margin-top: 3px; font-variant-numeric: tabular-nums; }

@media (max-width: 680px) {
  .hud-top { top: calc(var(--safe-t) + 64px); }
  .compress { font-size: 11px; }
  .hud-tl { max-width: calc(100vw - 80px); }
  .hud-bl { max-width: calc(100vw - 190px); }
  .stim-title, .blk-text { font-size: 14px; }
  .meter { width: 136px; }
}
@media (max-height: 500px) {
  .hud-top { top: calc(var(--safe-t) + 8px); }
  .compress { display: none; }
}

/* crash cut to black (also the fade before an ending picture) */
.blackout { position: absolute; inset: 0; z-index: 30; background: #000; opacity: 0; transition: opacity 1.4s ease; pointer-events: none; }
.blackout.on { opacity: 1; transition: opacity var(--crash-cut, .35s) ease-in; }

/* ---------- 6. ending cards: a still, one plain line, a paper artefact ---------- */
/* round 2 check: clip (not just hidden), so nothing (grain, zoomed still) can scroll the card sideways */
/* round 3 (AGENTS.md points 16 + 17): transparent at first, so the picture crossfades in over the last game frame;
   a dark ground only once the picture covers the screen (.settled) */
.ending { background: transparent; overflow: hidden; overflow: clip; cursor: pointer; }
.ending.settled { background: #000; }
.ending .still { position: absolute; inset: 0; opacity: 0; transition: opacity var(--fade-in, 4s) ease; }
.ending .still img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transform: scale(1.06); transition: transform 24s ease-out; }
.ending.in .still { opacity: 1; }
.ending.in .still img { transform: scale(1); }
/* round 4 (AGENTS.md point 28): the animated picture (src/ui/ending_fx.js). The stage is the picture's cover box; its
   layers move by JS transforms (compositor only); the canvas on top draws the small looping details. */
.fx-stage { position: absolute; pointer-events: none; }
.fx-layer { position: absolute; inset: 0; will-change: transform; }
.fx-layer[hidden] { display: none; }
.ending .fx-layer img, .fx-layer img { position: absolute; inset: 0; width: 100%; height: 100%; max-height: none; display: block; object-fit: fill; transform: none; transition: none; }
.ending .still.fx-on > img { transform: none; transition: none; }
.fx-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; pointer-events: none; }
.np-pic .fx-layer img { filter: grayscale(1) contrast(1.25) brightness(.98) sepia(.15); }
.np-pic .fx-canvas { filter: grayscale(1); }
.vignette { position: absolute; inset: 0; background: radial-gradient(120% 90% at 50% 45%, transparent 50%, rgba(0, 0, 0, .7) 100%); pointer-events: none; }
.grain {
  /* inset 0 + moving background-position (inset -40% + transform made the card 2304 px wide and scrollable) */
  position: absolute; inset: 0; pointer-events: none; opacity: .1; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%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 1.4 -.2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain var(--grain-dur, 1.8s) steps(1) infinite;
}
@keyframes grain { 0% { background-position: 0 0; } 25% { background-position: -71px 47px; } 50% { background-position: 59px -37px; } 75% { background-position: -33px -83px; } }
.end-text {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 14vh calc(var(--safe-r) + 6vw) calc(var(--safe-b) + 9vh) calc(var(--safe-l) + 6vw);
  padding: 14dvh calc(var(--safe-r) + 6vw) calc(var(--safe-b) + 9dvh) calc(var(--safe-l) + 6vw);
  opacity: 0; transition: opacity 2.2s ease calc(var(--fade-in, 4s) * .6);
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, .62));
  text-shadow: 0 1px 8px rgba(0, 0, 0, .9);
}
.ending.in .end-text { opacity: 1; }
/* round 3 check: on wide screens the line goes on the side away from the picture's subject (ui.js placeFocus) */
.ending.text-right .end-text { text-align: right; }
.ending.text-right .end-line { margin-left: auto; }
.end-kicker { margin: 0 0 6px; color: #e9d6b0; font-size: 14px; }
.end-line { margin: 0; max-width: 32ch; font-family: var(--serif); font-size: clamp(1.35rem, 3.4vw, 2.3rem); font-weight: 400; line-height: 1.25; }
.end-sub { margin: 10px 0 0; color: #cfe7e3; font-size: clamp(.95rem, 1.8vw, 1.1rem); }
.next-btn {
  position: absolute; z-index: 4; right: calc(var(--safe-r) + 16px); bottom: calc(var(--safe-b) + 16px);
  min-height: 44px; padding: 0 16px; cursor: pointer;
  background: rgba(0, 0, 0, .55); border: 1px solid rgba(255, 255, 255, .35); color: #e8e2d2; font-size: 14px;
  opacity: 0; transition: opacity 1s ease 2.5s;
}
.ending.in .next-btn { opacity: 1; }
.ending.show-stats .next-btn { opacity: 0; transition: opacity .3s ease; pointer-events: none; }
@media (max-height: 520px) { .end-text { padding-bottom: calc(var(--safe-b) + 60px); padding-top: 8vh; } .end-line { font-size: 1.3rem; } }

/* paper artefacts on the ending card */
.art {
  position: absolute; z-index: 2; top: calc(var(--safe-t) + 7vh); right: calc(var(--safe-r) + 6vw);
  top: calc(var(--safe-t) + 7dvh);
  width: min(300px, 70vw); padding: 16px 18px 14px; color: var(--ink); font-family: var(--type); font-size: 15px; line-height: 1.4;
  background: var(--paper); box-shadow: 0 10px 24px rgba(0, 0, 0, .55); transform: rotate(2deg);
  opacity: 0; transition: opacity 1.6s ease calc(var(--fade-in, 4s) * .8);
}
.ending.in .art { opacity: 1; }
.art p { margin: 0; }
.art-title { font-weight: 700; text-transform: uppercase; letter-spacing: .08em; margin-bottom: 8px !important; }
.art-tape { position: absolute; top: -10px; left: 50%; width: 90px; height: 22px; margin-left: -45px; background: rgba(235, 225, 190, .75); transform: rotate(-3deg); box-shadow: 0 1px 2px rgba(0, 0, 0, .2); }
.art-note { background: #f7e08a; font-family: var(--hand); font-size: 17px; color: #26315c; transform: rotate(-2.5deg); }
.art-receipt { width: min(250px, 66vw); background: #fbfaf5; font-size: 13.5px; transform: rotate(1.5deg); text-align: left;
  -webkit-mask: conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) 50% / 14px 100%;
  mask: conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) 50% / 14px 100%; padding-bottom: 22px; }
.art-receipt .art-title { text-align: center; border-bottom: 1px dashed var(--ink-soft); padding-bottom: 6px; }
.art-notice { background: #fffdf4; border: 3px double #8b1d1d; }
.art-notice .art-title { color: #8b1d1d; font-size: 18px; }
.art-notice .art-line:nth-child(n + 4) { font-family: var(--hand); color: var(--ink-blue); margin-top: 6px !important; }
.art-slip { background: #eef1f4; font-size: 14px; border-top: 6px solid #2a3b5c; transform: rotate(-1.5deg); }
.art-board { background: #f4f6f2; border: 6px solid #9aa0a6; font-family: var(--hand); font-size: 18px; color: #1d4ed8; transform: rotate(0deg); }
.art-board .art-title { font-family: var(--type); font-size: 12px; color: var(--ink-soft); }
@media (max-width: 680px) {
  .art { top: calc(var(--safe-t) + 16px); right: auto; left: calc(var(--safe-l) + 16px); width: min(280px, calc(100vw - 32px)); font-size: 14px; }
  .art-note { font-size: 16px; }
}
@media (max-height: 520px) and (min-width: 560px) {
  .art { top: calc(var(--safe-t) + 12px); width: 240px; font-size: 13px; padding: 10px 12px; }
}

/* ---------- crash: newspaper ---------- */
/* round 3 (point 19): the front page is scaled to fit the screen (ui.js), never scrolled */
.ending.crash { overflow: hidden; cursor: default; background: transparent; }
/* round 3: the dark table under the newspaper fades in with the paper, over the last game frame (no black cut) */
.ending.crash::before { content: ''; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: radial-gradient(70% 60% at 50% 40%, #151515, #000 75%); opacity: 0; transition: opacity var(--np-in, 2.2s) ease; }
.ending.crash.in::before { opacity: 1; }
.np-wrap { position: absolute; inset: 0; overflow: hidden; display: flex; justify-content: center; align-items: flex-start; padding: calc(var(--safe-t) + 18px) calc(var(--safe-r) + var(--gut)) calc(var(--safe-b) + 70px) calc(var(--safe-l) + var(--gut)); }
.np-fit { flex: none; width: min(880px, 100%); }
.newspaper {
  width: 100%; padding: 22px 26px 26px; color: #1b1a17; font-family: var(--serif);
  background:
    radial-gradient(120% 90% at 30% 20%, rgba(255, 255, 255, .35), transparent 60%),
    radial-gradient(100% 80% at 90% 100%, rgba(120, 90, 40, .18), transparent 60%),
    #ece4d1;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .7), 0 0 0 1px rgba(0, 0, 0, .3);
  opacity: 0; transform: rotate(-9deg) scale(.82);
  transition: opacity var(--np-in, 2.2s) ease, transform var(--np-in, 2.2s) cubic-bezier(.2, .8, .2, 1);
}
.ending.crash.in .newspaper { opacity: 1; transform: rotate(var(--np-tilt, -2.5deg)) scale(1); }
.np-mast { text-align: center; border-bottom: 3px double #1b1a17; padding-bottom: 8px; }
.np-meta { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-family: var(--font); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; border-bottom: 1px solid #1b1a17; padding-bottom: 6px; }
.np-name { margin: 8px 0 0; font-size: clamp(2rem, 6.4vw, 3.9rem); font-weight: 900; letter-spacing: -.01em; line-height: 1; font-variant: small-caps; }
.np-motto { font-style: italic; font-size: 13px; margin-top: 4px; }
.np-headline { margin: 14px 0 14px; font-size: clamp(1.55rem, 4.4vw, 2.75rem); line-height: 1.04; font-weight: 800; letter-spacing: -.015em; text-align: center; }
.np-grid { display: grid; grid-template-columns: minmax(0, 2.1fr) minmax(0, 1fr); gap: 16px 22px; }
.np-photo { grid-column: 1; margin: 0; }
.np-pic { position: relative; overflow: hidden; }
.np-pic > img, .np-pic > svg { display: block; width: 100%; aspect-ratio: 16 / 9; max-height: 34vh; max-height: 34dvh; object-fit: cover; filter: grayscale(1) contrast(1.25) brightness(.98) sepia(.15); }
.np-pic::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(circle at 50% 50%, rgba(20, 18, 14, .55) 0 34%, transparent 38%) 0 0 / 4px 4px;
  mix-blend-mode: multiply; opacity: .45;
}
.np-photo figcaption { font-family: var(--font); font-size: 11.5px; color: #4b463c; margin-top: 5px; }
.np-cols { grid-column: 1; columns: 2; column-gap: 20px; column-rule: 1px solid rgba(27, 26, 23, .35); font-size: 14.5px; line-height: 1.45; text-align: justify; hyphens: auto; }
.np-col { display: contents; }
.np-cols p { margin: 0 0 9px; }
.np-lede::first-letter { float: left; font-size: 3.1em; line-height: .85; padding: 4px 6px 0 0; font-weight: 800; }
.np-side { grid-column: 2; grid-row: 1 / span 2; border-left: 1px solid rgba(27, 26, 23, .45); padding-left: 18px; font-size: 14px; line-height: 1.45; }
.np-side h3 { margin: 0 0 8px; font-size: 1.15rem; line-height: 1.15; }
.np-side p { margin: 0 0 9px; }
.np-real { font-family: var(--font); font-size: 12px; color: #4b463c; border-top: 1px solid rgba(27, 26, 23, .35); padding-top: 8px; }
/* three front-page layouts (crash variants) */
.np-layout-b .np-headline { text-align: left; font-size: clamp(1.7rem, 5vw, 3.1rem); border-bottom: 1px solid #1b1a17; padding-bottom: 10px; }
.np-layout-b .np-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr); }
.np-layout-b .np-photo { grid-column: 2; grid-row: 1; }
.np-layout-b .np-cols { grid-column: 1 / -1; columns: 3; }
.np-layout-b .np-side { grid-column: 1; grid-row: 1; border-left: 0; border-right: 1px solid rgba(27, 26, 23, .45); padding: 0 14px 0 0; }
.np-layout-c .np-headline { font-style: italic; font-weight: 700; }
.np-layout-c .np-grid { grid-template-columns: minmax(0, 1fr); }
.np-layout-c .np-photo, .np-layout-c .np-cols, .np-layout-c .np-side { grid-column: 1; grid-row: auto; }
.np-layout-c .np-cols { columns: 3; }
.np-layout-c .np-side { border-left: 0; border-top: 2px solid #1b1a17; padding: 10px 0 0; columns: 2; column-gap: 20px; }
/* trims (ui.js, point 19): least important copy first, so the page fits without tiny type */
.np-fit.trim-1 .np-side { display: none; }
.np-fit.trim-1 .np-grid { grid-template-columns: minmax(0, 1fr); }
.np-fit.trim-1 .np-photo, .np-fit.trim-1 .np-cols { grid-column: 1; grid-row: auto; }
.np-fit.trim-2 .np-col:last-child p:last-child, .np-fit.trim-2 .np-motto { display: none; }
.np-fit.trim-3 .np-col:first-child p:nth-child(2), .np-fit.trim-3 .np-col:last-child p:nth-child(2) { display: none; }
.np-fit.trim-3 .np-photo figcaption { display: none; }
.np-fit.trim-4 .np-pic > img, .np-fit.trim-4 .np-pic > svg { max-height: 24vh; max-height: 24dvh; }
.np-fit.trim-4 .np-col:first-child p:nth-child(3) { display: none; }
@media (max-width: 640px) {
  .newspaper { padding: 16px 16px 20px; }
  .np-grid, .np-layout-b .np-grid { grid-template-columns: 1fr; }
  .np-photo, .np-layout-b .np-photo { grid-column: 1; grid-row: auto; }
  .np-side, .np-layout-b .np-side { grid-column: 1; grid-row: auto; border: 0; border-top: 2px solid #1b1a17; padding: 10px 0 0; columns: 1; }
  .np-cols, .np-layout-b .np-cols, .np-layout-c .np-cols { columns: 1; }
  .np-meta { justify-content: center; font-size: 10px; }
}
@media (max-height: 520px) and (min-width: 560px) {
  .np-wrap { padding-top: calc(var(--safe-t) + 14px); }
  .np-name { font-size: 2rem; }
  .np-headline { font-size: 1.5rem; margin: 8px 0; }
}

/* ---------- 7. statistics: a log sheet on a clipboard ---------- */
/* round 3: crossfades in over the ending card (point 17), never scrolls; ui.js scales the sheet to fit (point 19) */
.stats-layer {
  position: absolute; inset: 0; z-index: 3; overflow: hidden; cursor: default;
  display: flex; justify-content: center; align-items: flex-start;
  background: var(--desk);
  padding: calc(var(--safe-t) + 16px) calc(var(--safe-r) + var(--gut)) calc(var(--safe-b) + 16px) calc(var(--safe-l) + var(--gut));
  animation: fade-in var(--card-out, .9s) ease both;
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.al-ui.reduce-motion .stats-layer { animation-duration: .3s; }
.logsheet { position: relative; flex: none; width: 100%; max-width: 860px; margin: 0; padding: 26px 14px 14px; background: #6b4a2b linear-gradient(135deg, #7a5532, #5e3f24); box-shadow: 0 16px 40px rgba(0, 0, 0, .6); }
.lg-clip { position: absolute; z-index: 2; top: -6px; left: 50%; width: 160px; height: 38px; margin-left: -80px; background: linear-gradient(180deg, #d7dbe0, #8d939b); box-shadow: 0 3px 6px rgba(0, 0, 0, .5); }
.lg-clip::after { content: ""; position: absolute; left: 50%; top: 9px; width: 54px; height: 12px; margin-left: -27px; background: #5f656d; }
.lg-paper {
  position: relative; overflow: hidden; color: var(--ink); font-family: var(--type); font-size: 15px; line-height: 26px;
  padding: 34px 28px 24px 64px;
  background:
    linear-gradient(90deg, transparent 47px, rgba(190, 60, 60, .5) 47px 49px, transparent 49px),
    repeating-linear-gradient(180deg, transparent 0 25px, rgba(60, 90, 140, .2) 25px 26px),
    var(--paper);
}
.lg-coffee { position: absolute; right: -34px; top: 130px; width: 130px; height: 130px; border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle, transparent 54%, rgba(120, 75, 30, .16) 56%, rgba(120, 75, 30, .26) 60%, rgba(120, 75, 30, .08) 64%, transparent 67%); }
.lg-head h2 { margin: 0; font-family: var(--type); font-size: 1.45rem; text-transform: uppercase; letter-spacing: .06em; line-height: 32px; }
.lg-meta { margin: 0; font-size: 13.5px; color: var(--ink-soft); }
.lg-rows { margin: 18px 0 8px; }
.lg-row { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 6px; }
.lg-lab { flex: none; }
.lg-dots { flex: 1 1 30px; border-bottom: 2px dotted rgba(35, 34, 31, .45); transform: translateY(-6px); min-width: 20px; }
.lg-val { flex: none; font-family: var(--hand); font-size: 18px; color: var(--ink-blue); }
.lg-note { flex: 1 0 100%; font-size: 12.5px; color: var(--ink-soft); line-height: 18px; margin: -4px 0 4px; }
.lg-chart { margin: 14px 0 6px; }
.lg-chart figcaption { display: flex; flex-wrap: wrap; gap: 0 16px; font-size: 13px; color: var(--ink-soft); }
.lg-key::before { content: ""; display: inline-block; width: 18px; height: 2px; margin-right: 6px; vertical-align: middle; }
.k-perclos::before { background: #1f3a93; height: 3px; }
.k-drift::before { background: #b3261e; }
.lg-canvas { display: block; width: 100%; height: 230px; }
/* round 3 check (point 11): one handwritten line under the chart (what the alert and the stimulation did) */
.lg-hand { margin: 2px 0 6px; font-family: var(--hand); font-size: 16px; line-height: 22px; color: var(--ink-blue); }
.lg-story h3 { margin: 12px 0 0; font-family: var(--type); font-size: 1rem; text-transform: uppercase; letter-spacing: .06em; }
.lg-story ol { margin: 0; padding-left: 22px; font-size: 14.5px; }
.lg-story li { margin: 0 0 4px; }
.lg-small { margin-top: 16px; font-size: 12.5px; line-height: 19px; color: var(--ink-soft); border-top: 1px dashed rgba(35, 34, 31, .4); padding-top: 8px; }
.lg-small p { margin: 0 0 6px; }
.lg-stamp { position: absolute; right: 26px; top: 40px; display: flex; flex-direction: column; align-items: center; padding: 4px 10px;
  border: 3px solid rgba(160, 30, 30, .62); color: rgba(160, 30, 30, .7); transform: rotate(-9deg); font-family: var(--type); font-weight: 700;
  text-transform: uppercase; letter-spacing: .08em; font-size: 14px; line-height: 18px; pointer-events: none; }
.lg-stamp-sub { font-size: 10.5px; }
.lg-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 14px; }
.lg-btn { min-height: 46px; padding: 0 20px; cursor: pointer; font-family: var(--type); font-size: 15px; background: transparent; color: var(--ink); border: 2px solid var(--ink); }
.lg-btn-main { background: var(--ink); color: var(--paper); }
.lg-btn:hover { background: rgba(35, 34, 31, .08); }
.lg-btn-main:hover { background: #3a3833; }
/* short landscape screens (phone on its side, 1280x720 and the like): the entries left, the chart right */
@media (max-height: 760px) and (min-aspect-ratio: 4 / 3) {
  .logsheet { max-width: 1060px; }
  .lg-paper { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); column-gap: 28px; align-items: start; }
  .lg-head { grid-column: 1 / -1; }
  .lg-rows { grid-column: 1; grid-row: 2; }
  .lg-chart { grid-column: 2; grid-row: 2; margin-top: 18px; }
  .lg-hand { grid-column: 2; grid-row: 3; align-self: end; }
  .lg-actions { grid-column: 1; grid-row: 3; }
  .lg-canvas { height: 250px; }
  .lg-coffee { right: auto; top: auto; left: 30%; bottom: -60px; }
  .logsheet.logsheet.trim-2 .lg-canvas, .logsheet.logsheet.trim-4 .lg-canvas { height: 220px; }
}

/* trims (ui.js, point 19) */
.logsheet.trim-1 .lg-note { display: none; }
.logsheet.trim-1 .lg-rows { margin: 10px 0 4px; }
.logsheet.trim-2 .lg-meta + .lg-meta, .logsheet.trim-2 .lg-coffee { display: none; }
.logsheet.trim-2 .lg-canvas { height: 180px; }
.logsheet.trim-3 .lg-row-minor { display: none; }
.logsheet.trim-3 .lg-paper { padding-top: 24px; padding-bottom: 16px; }
.logsheet.trim-4 .lg-canvas { height: 150px; }
.logsheet.trim-4 .lg-actions { margin-top: 8px; }
.logsheet.trim-4 .lg-hand { font-size: 14px; line-height: 19px; }
@media (max-width: 560px) {
  .logsheet { padding: 22px 6px 6px; }
  .lg-paper { padding: 30px 14px 18px 40px; font-size: 14px;
    background: linear-gradient(90deg, transparent 29px, rgba(190, 60, 60, .5) 29px 31px, transparent 31px),
      repeating-linear-gradient(180deg, transparent 0 25px, rgba(60, 90, 140, .2) 25px 26px), var(--paper); }
  .lg-stamp { position: static; display: inline-flex; margin: 6px 0 0; transform: rotate(-4deg); }
  .lg-coffee { right: -30px; top: 60px; }
  .lg-canvas { height: 210px; }
  .lg-actions .lg-btn { flex: 1 1 100%; }
}

/* ---------- toasts ---------- */
.toasts { position: absolute; z-index: 40; left: 50%; bottom: calc(var(--safe-b) + 34px); /* round 3 check: at the bottom edge, off the start title */ transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 8px; width: max-content; max-width: calc(100vw - 2 * var(--gut)); }
.toast { padding: 8px 14px; background: rgba(5, 10, 24, .85); border-left: 2px solid var(--muted); font-size: 15px; opacity: 0; transform: translateY(-6px); transition: opacity .35s ease, transform .35s ease; text-align: center; }
.toast.in { opacity: 1; transform: none; }

/* ---------- credits: a typed sheet of paper (round 3 check: was a navy app modal with a doubled heading) ---------- */
.credits {
  pointer-events: auto; width: min(820px, calc(100vw - 2 * var(--gut)));
  max-height: min(84vh, 900px); max-height: min(84dvh, 900px); padding: 0;
  border: 0; background: var(--paper); color: var(--ink); overflow: hidden; font-family: var(--type);
  box-shadow: 0 18px 40px rgba(0, 0, 0, .5); color-scheme: light;
}
.credits[open] { display: flex; flex-direction: column; }
.credits::backdrop { background: rgba(40, 28, 16, .45); }
.cr-head-bar { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 16px 16px 8px 24px; border-bottom: 2px solid var(--ink); margin: 0 16px 0 0; }
.cr-head-bar h2 { margin: 0; font-family: var(--type); font-size: 1.2rem; text-transform: uppercase; letter-spacing: .08em; }
.cr-body { overflow-y: auto; overscroll-behavior: contain; padding: 6px 24px 22px; font-size: 13.5px; line-height: 1.5; }
.cr-body h2, .cr-body h3, .cr-body h4 { margin: 16px 0 4px; font-family: var(--type); font-size: .95rem; text-transform: uppercase; letter-spacing: .06em; }
.cr-body a { color: var(--ink-blue); word-break: break-word; }
.cr-body code { font-size: 12.5px; color: var(--ink-soft); }
.cr-body ul { padding-left: 20px; }
.cr-table { display: flex; flex-direction: column; }
.cr-row { display: grid; grid-template-columns: 2.2fr 1.1fr .7fr 1.6fr; gap: 10px; padding: 5px 0; border-top: 1px dotted rgba(35, 34, 31, .45); }
.cr-row:first-child { border-top: 0; }
.cr-head { color: var(--ink-soft); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; border-bottom: 1px solid var(--ink); }
.cr-row span { min-width: 0; overflow-wrap: anywhere; }
.cr-foot { margin-top: 18px; color: var(--ink-soft); }
.btn { min-height: 44px; padding: 0 18px; cursor: pointer; background: none; border: 2px solid var(--ink); color: var(--ink); font-family: var(--type); }
@media (max-width: 640px) {
  .cr-head { display: none; }
  .cr-row { grid-template-columns: 1fr; gap: 2px; }
  .cr-head-bar { padding-left: 16px; } .cr-body { padding: 6px 16px 18px; }
}

/* ---------- reduce motion (toggle or OS) ---------- */
.al-ui.reduce-motion .slip-load .pen-ink.drawing { animation: none; stroke-dashoffset: 30; }
.al-ui.reduce-motion .load-bar span,
.al-ui.reduce-motion .grain { animation: none; }
.al-ui.reduce-motion .stim-edge.on { animation: none; opacity: .25; }
.al-ui.reduce-motion .load-bar span { width: 100%; opacity: .6; }
.al-ui.reduce-motion .photo, .al-ui.reduce-motion .photo:hover { transition: none; }
.al-ui.reduce-motion .ending .still img { transform: none; transition: none; }
.al-ui.reduce-motion .newspaper, .al-ui.reduce-motion .ending.crash.in .newspaper { transform: none; }
@media (prefers-reduced-motion: reduce) {
  .load-bar span, .grain { animation: none; }
  .slip-load .pen-ink.drawing { animation: none; stroke-dashoffset: 30; }
  .stim-edge.on { animation: none; opacity: .25; }
  .load-bar span { width: 100%; opacity: .6; }
  .ending .still img { transform: none; transition: none; }
  .newspaper, .ending.crash.in .newspaper { transform: none; }
}

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---------- integrate: fatal error box and ?debug=1 FPS readout (main.js) ---------- */
.fatal { position: fixed; inset: 0; z-index: 100; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px; padding: max(24px, env(safe-area-inset-top)) 24px 24px; background: var(--navy-0, #0b1530); color: var(--text, #e8eefc);
  font: 16px/1.5 var(--font, system-ui, sans-serif); text-align: center; }
.fatal h2 { margin: 0; font-size: 1.35rem; max-width: 34ch; }
.fatal p { margin: 0; max-width: 46ch; color: var(--muted, #9fb0d0); }
.fatal .fatal-detail { font: 12px/1.4 ui-monospace, monospace; opacity: .7; }
.fatal button { min-height: 44px; padding: 0 22px; border: 0; background: var(--amber, #f5a524); color: #1a1205;
  font: 600 16px var(--font, system-ui, sans-serif); cursor: pointer; }
.fps-readout { position: fixed; left: 50%; bottom: max(6px, env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 90;
  padding: 3px 10px; background: rgba(0, 0, 0, .6); color: #9ff; font: 11px/1.4 ui-monospace, monospace;
  pointer-events: none; white-space: nowrap; max-width: calc(100vw - 16px); overflow: hidden; text-overflow: ellipsis; }
/* scripted / debug driver eyelids (main.js sets --lid-top / --lid-bot 0..1 and --lid-dim); soft-edged lids close from
   the top and the bottom. While drift is on, main.js keeps the bottom lid low so the dash display stays readable. */
.lids { position: fixed; inset: 0; z-index: 1; pointer-events: none; --lid-top: 0; --lid-bot: 0; --lid-dim: 0; background: rgba(0, 0, 0, var(--lid-dim)); }
.lids::before, .lids::after { content: ""; position: absolute; left: -5%; right: -5%; }
.lids::before { top: 0; height: calc(var(--lid-top) * 62%); background: linear-gradient(to bottom, #000 0%, #000 65%, rgba(0, 0, 0, 0) 100%); border-radius: 0 0 50% 50% / 0 0 30% 30%; }
.lids::after { bottom: 0; height: calc(var(--lid-bot) * 62%); background: linear-gradient(to top, #000 0%, #000 65%, rgba(0, 0, 0, 0) 100%); border-radius: 50% 50% 0 0 / 30% 30% 0 0; }

/* 2026-11-26: 'turn your volume up' note on the start sheet (right of 'Pick your truck') */
.js-sound { font-size: .8em; opacity: .75; font-style: italic; }

/* 2026-11-27: endings count on the start sheet footer, right of Credits */
.js-foot { display: flex; justify-content: space-between; align-items: baseline; gap: 1em; flex-wrap: wrap; }
.js-endings { font-size: .8em; opacity: .75; font-style: italic; }

/* 2026-11-27: '12 endings' red stamp, top right corner of the start sheet (same look as .lg-stamp) */
.jobsheet { position: relative; }
.js-stamp { position: absolute; right: 22px; top: 18px; display: flex; flex-direction: column; align-items: center; padding: 4px 12px; border: 3px solid rgba(160, 30, 30, .62); color: rgba(160, 30, 30, .72); transform: rotate(7deg); font-family: var(--type); font-weight: 700; text-transform: uppercase; letter-spacing: .08em; font-size: 15px; line-height: 19px; pointer-events: none; }
.js-stamp-sub { font-size: 10.5px; }
@media (max-width: 480px) { .js-stamp { right: 10px; top: 8px; font-size: 12px; line-height: 15px; padding: 3px 8px; } .js-stamp-sub { font-size: 9px; } }

/* 2026-11-27 (Ahmed): no coffee ring on the log sheet */
.lg-coffee { display: none !important; }
