/* ==========================================================================
   Jeffrey Groneberg · the cartridge room
   World: a 2704×1520 painted room. Every in-room element is positioned in
   world pixels; JS scales and moves .world like a camera.
   ========================================================================== */

@font-face {
  font-family: "M PLUS Rounded 1c";
  src: url("../fonts/m-plus-rounded-1c-500-latin.woff2") format("woff2");
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: "M PLUS Rounded 1c";
  src: url("../fonts/m-plus-rounded-1c-800-latin.woff2") format("woff2");
  font-weight: 800;
  font-display: swap;
}
@font-face {
  font-family: "DotGothic16";
  src: url("../fonts/dotgothic16-400-latin.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}

:root {
  --night: #0b1026;
  --night-2: #141b3d;
  --paper: #fff4e0;
  --paper-dim: #e9dcc4;
  --lantern: #ffb45a;
  --crt: #8fd3ff;
  --win-top: #2b3fb4;
  --win-bottom: #121b6e;
  --win-edge: #f3f1ff;
  --gold: #ffd75e;
  /* the café sign's neon across the street (sampled from the street plate's tube: 252,79,111; street.js glows it
     255,80,110): the HUD's one call to action, Share. Night text on it 5.8:1, on the lighter hover 7.1:1, on the
     deeper press 5.1:1. Not the lantern (the focus ring) nor gold (done, found) */
  --neon: #fc4f6f;
  --neon-hi: #ff7088;
  --neon-lo: #ea4a66;
  --neon-rim: #ff9aab;
  --ease-cam: cubic-bezier(0.65, 0.02, 0.25, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --round: "M PLUS Rounded 1c", "Hiragino Maru Gothic ProN", "Arial Rounded MT Bold", system-ui, sans-serif;
  --pixel: "DotGothic16", "Osaka-Mono", ui-monospace, monospace;
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--night);
  color: var(--paper);
  font-family: var(--round);
  font-weight: 500;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

body { overflow: hidden; overscroll-behavior: none; }

a { color: inherit; }

.skip {
  position: fixed;
  left: 16px;
  top: -80px;
  z-index: 100;
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--paper);
  color: var(--night);
  font-weight: 800;
  text-decoration: none;
  transition: top 0.2s var(--ease-out);
}
.skip:focus { top: 16px; }

/* ---------- stage & world ---------------------------------------------- */

.stage {
  position: fixed;
  inset: 0;
  overflow: hidden;
  touch-action: none;
  background:
    radial-gradient(120% 90% at 60% 40%, #1a2350 0%, var(--night) 70%);
}

[hidden] { display: none !important; }

.world {
  position: absolute;
  left: 0;
  top: 0;
  width: 2704px;
  height: 1520px;
  transform-origin: 0 0;
  will-change: transform;
  transition: transform 1.25s var(--ease-cam);
}
.world.no-anim { transition: none; }

.layer {
  position: absolute;
  left: 0;
  top: 0;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}

/* Every piece of the room is composited on its own, and none paints into the world itself: Safari rasterises a
   painted layer at the screen's full resolution whatever the room's zoom, so a world that paints anything (the
   street's frames, the TV's backing, a light map off screen, a focus ring, the ceiling band) costs a phone a
   world-sized layer of ~140 MB, while canvases and plain images are composited straight from their pixels
   (README › Performance). Each piece already has its own z-index; .glow is no stacking context (its glows blend
   with the room), so its glows get the layers instead. */
.world > :not(.glow), .glow > *, .world::before { will-change: transform; }
.street { left: 1300px; top: 0; width: 1260px; height: 1040px; z-index: 1; }
.pc { left: 2339px; top: 924px; width: 224px; height: 215px; z-index: 1; }
.room { width: 2704px; height: 1520px; z-index: 3; }

/* ---------- light -------------------------------------------------------
   room-base.webp is the room with every light off. lights.js adds one light map per source on top with
   mix-blend-mode: screen, so lights combine the way light does (1 − lit = (1 − base) · Π(1 − k)).
   They sit above everything of the painting they illuminate (plate, cord). The cartridges sit above them and
   light themselves from the same levels (carts.js); self-luminous glows (.glow), the LED and the hotspots sit
   above both; a small mask keeps window-side glows off the glass.
   Layer order in the world: street 1 · TV 2 · room 3 · chime 5 · cord 13 · light maps 14 · cartridges 15 ·
   glow 20 · LED 21 · hotspots and glints 22.
   Each map is one world-sized layer, the bare <img> itself (lights.js): its flicker runs on the map as brightness (for
   a screen-blended map the same as opacity, which carries the switch level), and lights.js hides a dark map so it is
   not composited. A wrapper around the image would be painted at the screen's resolution instead of composited from
   the image's pixels (README › Performance). */

.light { position: absolute; z-index: 14; display: block; mix-blend-mode: screen; pointer-events: none; }
.light-lantern { animation: lantern 7s ease-in-out infinite; }
@keyframes lantern {
  0%, 100% { filter: brightness(1); }
  38% { filter: brightness(0.975); }
  41% { filter: brightness(0.91); }
  44% { filter: brightness(0.985); }
  72% { filter: brightness(0.96); }
}
.light-tv, .light-tv-tint { animation: tvlight 3.9s steps(1) infinite; }
@keyframes tvlight {
  0% { filter: none; }
  11% { filter: brightness(0.93); }
  13% { filter: none; }
  36% { filter: brightness(0.97); }
  52% { filter: brightness(0.9); }
  54% { filter: none; }
  77% { filter: brightness(0.95); }
  79% { filter: none; }
}

/* the window glass reflects the room once the ceiling light is on, and the street looks darker (lights.js paints the
   sheen's two gradients into its canvas) */
.sheen {
  left: 1300px; top: 0; width: 1260px; height: 1040px; z-index: 2;
  mix-blend-mode: screen;
  opacity: 0;
  transition: opacity 0.9s ease;
}
.street { transition: filter 0.9s ease; }
body.ceiling-on .sheen { opacity: 1; }
body.ceiling-on .street { filter: brightness(0.74) saturate(0.9); }

/* .glow is only a wrapper (no stacking context, or the blend would stay inside it): each glow is screen-blended on
   its own, in a layer as big as its light rather than one world-sized group. They never overlap, except the sweep
   and the stars, which stay a group (.g-ceiling covers the sweep's whole path, blur included). None of them reaches
   the glass of the windows, the TV or the PC: the café sign's glow is painted with the window mask (lights.js), the
   stars sit on the ceiling and the sweep has faded in only once it is clear of the window. */
.glow > .g-neon, .glow > .g-ceiling, .glow > .g-led { z-index: 20; mix-blend-mode: screen; }
.g-ceiling { position: absolute; left: 0; top: 0; width: 1520px; height: 490px; }
.glow > i, .glow .g-stars > i { position: absolute; display: block; border-radius: 50%; }

/* the café sign across the street tints the window side of the room and follows its flicker; its ellipse runs
   past the room's right edge, so the box stops there (lights.js paints the full ellipse into its canvas) */
.glow > .g-neon {
  position: absolute; display: block;
  left: 1830px; top: 240px; width: 874px; height: 1160px;
  opacity: 0.6;
  transition: opacity 0.06s linear;
}

/* headlights of an oncoming car: the window's panes slide across the upper wall (shown only while they do) */
.g-sweep { position: absolute; left: 0; top: 0; width: 330px; height: 290px; opacity: 0; visibility: hidden; transform-origin: 0 0; filter: blur(14px); pointer-events: none; }
.g-sweep i { position: absolute; top: 0; bottom: 0; width: 45%; border-radius: 4px; background: linear-gradient(180deg, rgba(255, 246, 222, 0.9), rgba(255, 240, 210, 0.3)); }
.g-sweep i:first-child { left: 0; }
.g-sweep i:last-child { right: 0; }

.g-led {
  left: 1062px; top: 1164px; width: 60px; height: 36px;
  background: radial-gradient(closest-side, rgba(255, 70, 50, 0.9), rgba(255, 40, 30, 0.32) 45%, rgba(255, 0, 0, 0));
  opacity: 0;
  transition: opacity 0.25s ease;
}
.g-led.on { opacity: 1; }

.g-stars > i {
  width: var(--s, 34px); height: var(--s, 34px);
  background: radial-gradient(closest-side, rgba(200, 255, 190, 0.85), rgba(170, 255, 200, 0.2) 50%, rgba(160, 255, 200, 0));
  animation: twinkle var(--d, 4s) ease-in-out var(--delay, 0s) infinite;
}
@keyframes twinkle { 0%, 100% { opacity: 0.35; } 50% { opacity: 0.95; } }

/* the console's power LED: carts.js lays this 40 × 20 face on the painted LED housing (matrix3d); unlit, the painted
   LED shows through; lit, it sits above the light maps like the cartridges */
.led {
  left: 0; top: 0; width: 40px; height: 20px; z-index: 21;
  transform-origin: 0 0;
  border-radius: 5px;
  background: transparent;
  transition: background 0.25s ease, box-shadow 0.25s ease;
}
.led.on { background: #ff4a36; box-shadow: 0 0 8px 3px rgba(255, 70, 50, 0.8); }

/* ---------- things to touch: light switches and secrets ----------------- */

.hot, .cord {
  position: absolute; z-index: 22;
  padding: 0; margin: 0; border: 0; background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.hot:focus-visible, .cord:focus-visible { outline: 3px dashed rgba(255, 244, 224, 0.85); outline-offset: 4px; border-radius: 14px; }

/* the ceiling light's pull cord hangs into the frame; it is lit by the room, so it sits under the light maps */
.cord { z-index: 13; transform-origin: 50% 0; animation: cordsway 6.5s ease-in-out infinite; }
.cord svg { display: block; width: 100%; height: 100%; overflow: visible; }
@keyframes cordsway { 0%, 100% { transform: rotate(-0.7deg); } 50% { transform: rotate(0.8deg); } }
/* on phones the cord would hang behind the name and pills */
body.compact .cord { display: none; }

.glint {
  width: 80px; height: 80px; z-index: 22;
  opacity: 0;
  background:
    radial-gradient(closest-side, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0) 38%),
    linear-gradient(90deg, transparent 47%, rgba(255, 255, 255, 0.9) 50%, transparent 53%),
    linear-gradient(0deg, transparent 47%, rgba(255, 255, 255, 0.9) 50%, transparent 53%);
  -webkit-mask: radial-gradient(closest-side, #000 25%, transparent 100%);
  mask: radial-gradient(closest-side, #000 25%, transparent 100%);
  mix-blend-mode: screen;
}
.glint.on { animation: glint 1.2s ease-out; }
@keyframes glint {
  0% { opacity: 0; transform: scale(0.2) rotate(0deg); }
  28% { opacity: 1; transform: scale(1) rotate(22deg); }
  100% { opacity: 0; transform: scale(0.45) rotate(55deg); }
}

/* ---------- wind chime -------------------------------------------------- */

.chime {
  left: 1453px; top: -6px; width: 64px; height: auto;
  z-index: 5;
  pointer-events: auto;
  cursor: pointer;
  transform-origin: 50% 0;
  animation: sway 7s ease-in-out infinite;
}
.chime.ring { animation: ring 2.6s var(--ease-out), sway 7s ease-in-out 2.6s infinite; }
@keyframes sway { 0%, 100% { transform: rotate(-1.2deg); } 50% { transform: rotate(1.4deg); } }
@keyframes ring {
  0% { transform: rotate(0deg); }
  12% { transform: rotate(7deg); }
  30% { transform: rotate(-5deg); }
  48% { transform: rotate(3.2deg); }
  66% { transform: rotate(-1.8deg); }
  100% { transform: rotate(0deg); }
}

/* ---------- cartridges --------------------------------------------------
   carts.js builds each cartridge as a solid in room space and draws them all into one WebGL canvas (.carts-gl,
   carts-gl.js). Each keeps a real <button> on top, laid flat over its outline on screen: clicks, focus, its name.
   The focus ring (.cart-ring) is a flat outline around the visible part of the focused cartridge.
   Without WebGL (and with ?dom-carts) the faces are DOM elements instead: the button is the front face (its face
   painted into .cart-face), .cart-s are the extruded edges, every face a matrix3d of its local box (transform-origin
   0 0, at the world origin), the crate's rims and the slot's lip clip them.
   Either way they sit above the light maps and are lit per face. */

.crate { position: absolute; left: 0; top: 0; width: 0; height: 0; z-index: 15; }
.cart-g, .riser-g, .cart-shade { position: absolute; left: 0; top: 0; width: 0; height: 0; pointer-events: none; }
.riser-g { z-index: 1; }
.cart-g > *, .riser-g > *, .cart-shadow {
  position: absolute; left: 0; top: 0; display: block;
  transform-origin: 0 0;
  backface-visibility: visible;
}
.carts-gl { position: absolute; display: block; pointer-events: none; }
.cart-s { box-shadow: inset 0 -2.6px 0 rgba(24, 18, 26, 0.85); pointer-events: auto; cursor: pointer; }
.cart {
  width: 385px; height: 427px;
  padding: 0; margin: 0; border: 0;
  background: none;
  cursor: pointer;
  pointer-events: auto;
  -webkit-tap-highlight-color: transparent;
}
.cart:focus { outline: none; }
.cart-skin { position: absolute; inset: 0; display: block; isolation: isolate; }
.cart-face { position: absolute; left: 0; top: 0; width: 385px; height: 427px; display: block; pointer-events: none; }
/* the light on this face: brightness on .cart-skin, its colour multiplied in here (masked to the shell) */
.cart-lit, .cart-ao {
  position: absolute; inset: 0; display: block; pointer-events: none;
  -webkit-mask: var(--shell-mask); mask: var(--shell-mask);
}
.cart-lit { mix-blend-mode: multiply; background: #fff; }
.cart-ring { position: absolute; z-index: 30; overflow: visible; pointer-events: none; }
.cart-ring-glow { fill: none; stroke: rgba(255, 244, 224, 0.3); stroke-width: 14; stroke-linejoin: round; }
.cart-ring-line { fill: none; stroke: var(--paper); stroke-width: 5; stroke-linejoin: round; }
.cart-shadow {
  width: 200px; height: 100px;
  background: radial-gradient(closest-side, rgba(8, 6, 14, 0.95), rgba(8, 6, 14, 0.55) 52%, rgba(8, 6, 14, 0));
  opacity: 0;
  pointer-events: none;
}
/* under a cartridge lying flat: its outline (98×109 = 0.245×0.272 at 400 px per unit, domed end up) with a soft rim */
.cart-shadow.is-flat {
  width: 98px; height: 109px;
  background: rgba(8, 6, 14, 0.9);
  border-radius: 49px 49px 5px 5px / 14px 14px 5px 5px;
  box-shadow: 0 0 9px 3px rgba(8, 6, 14, 0.7);
}
.riser { background: linear-gradient(180deg, var(--wood, #3a2a20), var(--wood-2, #2c2018)); }
/* the DOM fallback's wood: a painted strip (canvas) at the face's own size; the soft shades on and around it are .riser-shade */
.riser.is-wood { background: none; }
.riser.is-wood canvas { display: block; }

/* ---------- television -------------------------------------------------- */

.tv {
  position: absolute;
  left: 455px;
  top: 434px;
  width: 522px;
  height: 450px;
  z-index: 2;
  overflow: hidden;
  overflow: clip; /* never scrollable, so focus and scrolling inside the screen cannot shift it */
  background: #04060f;
}

/* The 640×552 screen is projected onto the painted glass: a homography fitted to the hole in
   room-base.webp's alpha (edge tangents plus 2 px overscan), so the picture follows the turned tube
   and nothing hides behind the bezel. Refit it if the plate's TV ever changes. */
.tv-screen {
  position: absolute;
  left: 0;
  top: 0;
  width: 640px;
  height: 552px;
  transform: matrix3d(0.8819, 0.0055, 0, 0.0001536, 0.0174, 0.8229, 0, 0.0000171, 0, 0, 1, 0, 1.324, 4.559, 0, 1);
  transform-origin: 0 0;
  overflow: hidden;
  overflow: clip;
  background: #060a1c;
  font-family: var(--pixel);
  font-size: 16px;
  line-height: 1.25; /* 20 px, and it grows with a larger minimum font size */
  color: #fff;
  text-shadow: 2px 2px 0 #070b2a, 0 0 8px rgba(150, 200, 255, 0.35);
}

.tv-content { position: absolute; inset: 0; }

.tv-fx {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(115deg, rgba(255, 255, 255, 0.09) 0%, rgba(255, 255, 255, 0.02) 22%, rgba(255, 255, 255, 0) 38%),
    radial-gradient(120% 110% at 50% 50%, rgba(0, 0, 0, 0) 58%, rgba(0, 0, 10, 0.55) 100%),
    repeating-linear-gradient(to bottom, rgba(0, 0, 0, 0.22) 0 1px, rgba(0, 0, 0, 0) 1px 3px);
  mix-blend-mode: normal;
  animation: crtflicker 0.12s steps(2) infinite;
}
@keyframes crtflicker { 50% { opacity: 0.93; } }

.tv-power {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: #000;
  opacity: 0;
}
.tv-power.on { animation: poweron 0.75s var(--ease-out) forwards; }
.tv-power.off { animation: poweroff 0.55s ease-in forwards; }
@keyframes poweron {
  0% { opacity: 1; background: radial-gradient(ellipse 50% 0.6% at 50% 50%, #fff 0 60%, #000 100%); }
  35% { opacity: 1; background: radial-gradient(ellipse 60% 2% at 50% 50%, #fff 0 60%, #000 100%); }
  60% { opacity: 0.9; background: radial-gradient(ellipse 80% 60% at 50% 50%, #cfe4ff 0, #000 100%); }
  100% { opacity: 0; background: #000; }
}
@keyframes poweroff {
  0% { opacity: 0; background: #000; }
  25% { opacity: 1; background: radial-gradient(ellipse 70% 2% at 50% 50%, #fff 0 60%, #000 100%); }
  60% { opacity: 1; background: radial-gradient(ellipse 2% 1% at 50% 50%, #fff 0 70%, #000 100%); }
  100% { opacity: 1; background: #000; }
}

/* RPG windows inside the TV */
.win {
  position: relative;
  background: linear-gradient(180deg, var(--win-top), var(--win-bottom));
  border: 3px solid var(--win-edge);
  border-radius: 9px;
  box-shadow: inset 0 0 0 2px #0a1040, 0 6px 14px rgba(0, 0, 0, 0.45);
  padding: 10px 12px;
}
.win h3, .win h4 { margin: 0; font-weight: 400; }
.gold { color: var(--gold); }
.dim { color: #b9c4ff; }
.px { image-rendering: pixelated; }

/* padding = title-safe area of the projected glass: windows stay on the glass, text ≥ 10 px inside it */
.scr { position: absolute; inset: 0; padding: 28px 22px 28px 20px; display: flex; flex-direction: column; gap: 8px; }
.scr-bar { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 0 6px; }
.scr-title { margin: 0; font-weight: 400; font-size: 32px; line-height: 32px; letter-spacing: 0.02em; color: var(--c, #fff); text-shadow: 3px 3px 0 #070b2a, 0 0 10px rgba(255, 255, 255, 0.25); }
.scr-keys { color: #c9d2ff; font-size: 16px; white-space: nowrap; }
/* the screen's share key (tv.js): right of the key hints, which hide on phones */
.scr-bar .scr-keys { margin-left: auto; }
.scr-share {
  all: unset;
  display: inline-flex; align-items: center; gap: 6px;
  align-self: center;
  padding: 2px 9px 2px 7px;
  border: 2px solid var(--gold);
  border-radius: 6px;
  color: var(--gold);
  font-size: 16px; line-height: 20px;
  cursor: pointer;
}
.scr-share svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.scr-share:hover { background: rgba(255, 215, 94, 0.14); }
.scr-share:focus-visible { outline: 2px dashed var(--gold); outline-offset: 2px; }
/* a trophy a deep link points to */
.trophy.is-target { outline: 2px dashed var(--gold); outline-offset: 3px; border-radius: 6px; }
.trophy:focus { outline: 2px dashed var(--gold); outline-offset: 3px; border-radius: 6px; }

.menu { list-style: none; margin: 0; padding: 0; }
.menu > li > button, .menu > li > a {
  all: unset;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 4px 6px 4px 34px;
  position: relative;
  cursor: pointer;
  color: #fff;
  border-radius: 4px;
}
.menu > li > [aria-current="true"] { background: rgba(255, 255, 255, 0.12); }
.menu > li > [aria-current="true"]::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 50%;
  width: 28px;
  height: 28px;
  margin-top: -14px;
  background: url("../img/tv/icons/ui-cursor.png") center / 28px 28px no-repeat;
  image-rendering: pixelated;
  animation: bob 0.6s steps(2) infinite;
}
.menu > li > :focus-visible { outline: 2px dashed var(--gold); outline-offset: -2px; }
.tv-link:focus-visible { outline: 2px dashed var(--gold); outline-offset: 2px; }
@keyframes bob { 50% { transform: translateX(4px); } }

.tv-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  padding: 6px 12px;
  border: 2px solid var(--gold);
  border-radius: 6px;
  color: var(--gold);
  text-decoration: none;
}
.tv-link:hover { background: rgba(255, 215, 94, 0.14); }

@keyframes blink { 50% { opacity: 0; } }

/* scrolling windows: the body scrolls inside a fixed frame; blinking pixel ▲/▼ cues (clickable) say there is more */
.scroll { position: relative; display: flex; flex-direction: column; min-height: 0; }
.win.scroll { padding: 12px 12px 14px; }
/* 4 px of room around the content (cancelled by the margin) so focus rings are not cut by the scroller */
.scroll-body { position: relative; flex: 1 1 auto; min-height: 0; margin: -4px; padding: 4px; overflow: auto; overscroll-behavior: contain; scrollbar-width: none; }
.scroll-body::-webkit-scrollbar { display: none; }
.tv-screen {
  --arrow-up: polygon(40% 0, 60% 0, 60% 20%, 70% 20%, 70% 40%, 80% 40%, 80% 60%, 90% 60%, 90% 80%, 100% 80%, 100% 100%, 0 100%, 0 80%, 10% 80%, 10% 60%, 20% 60%, 20% 40%, 30% 40%, 30% 20%, 40% 20%);
  --arrow-down: polygon(0 0, 100% 0, 100% 20%, 90% 20%, 90% 40%, 80% 40%, 80% 60%, 70% 60%, 70% 80%, 60% 80%, 60% 100%, 40% 100%, 40% 80%, 30% 80%, 30% 60%, 20% 60%, 20% 40%, 10% 40%, 10% 20%, 0 20%);
}
.cue { position: absolute; left: 50%; z-index: 3; width: 48px; height: 14px; margin-left: -24px; display: none; cursor: pointer; }
.cue-up { top: 0; }
.cue-down { bottom: 0; }
.more-up > .cue-up, .more-down > .cue-down { display: block; }
.cue::before, .tv-screen::before, .tv-screen::after {
  content: ""; position: absolute; left: 50%; width: 20px; height: 10px; margin-left: -10px;
  background: var(--gold); animation: blink 0.8s steps(2) infinite;
}
.cue-up::before { top: 1px; clip-path: var(--arrow-up); }
.cue-down::before { bottom: 2px; clip-path: var(--arrow-down); }
/* phones: the whole screen scrolls, so the cues sit on the screen itself */
.tv-screen::before, .tv-screen::after { display: none; z-index: 3; pointer-events: none; }
.tv-screen::before { top: 4px; clip-path: var(--arrow-up); }
.tv-screen::after { bottom: 6px; clip-path: var(--arrow-down); }
.tv-full .tv-screen.more-up::before, .tv-full .tv-screen.more-down::after { display: block; }

/* attract & boot */
.attract { position: absolute; inset: 0; background: #0a1030 url("../img/tv/attract.png") center / cover no-repeat; image-rendering: pixelated; }
.attract-title {
  position: absolute; left: 0; right: 0; top: 118px;
  text-align: center;
  font-size: 64px; line-height: 64px;
  color: #fff7d6;
  text-shadow: 4px 4px 0 #1a2160, -2px -2px 0 #1a2160, 2px -2px 0 #1a2160, -2px 2px 0 #1a2160, 0 0 18px rgba(255, 240, 170, 0.45);
}
.attract-cta {
  position: absolute; left: 0; right: 0; bottom: 96px;
  display: flex; justify-content: center;
}
/* the attract screen is read from across the room (TV px ≈ 0.4–0.6 CSS px), so its prompt is big */
.attract-cta span {
  padding: 10px 20px 10px 58px;
  font-size: 32px;
  line-height: 32px;
  position: relative;
  background: rgba(12, 18, 70, 0.78);
  border: 3px solid var(--win-edge);
  border-radius: 9px;
}
.attract-cta span::before {
  content: ""; position: absolute; left: 14px; top: 50%; width: 32px; height: 32px; margin-top: -16px;
  background: url("../img/tv/icons/ui-cursor.png") center / 32px 32px no-repeat; image-rendering: pixelated;
  animation: bob 0.6s steps(2) infinite;
}

.boot { position: absolute; inset: 0; background: #f4f1ea; color: #1f2a7a; display: grid; place-items: center; text-shadow: none; }
.boot-logo { font-size: 48px; line-height: 48px; letter-spacing: 0.04em; transform: translateY(-260px); animation: drop 1.05s steps(14) forwards; }
.boot-sub { position: absolute; bottom: 150px; font-size: 16px; opacity: 0; animation: fadein 0.2s 1.15s forwards; }
@keyframes drop { to { transform: translateY(0); } }
@keyframes fadein { to { opacity: 1; } }

.card-title { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; gap: 14px; background: var(--c); }
.card-title b { font-weight: 400; font-size: 64px; line-height: 64px; color: #fff; text-shadow: 4px 4px 0 rgba(0, 0, 0, 0.35); }
.card-title span { font-size: 16px; color: #fff; }

/* ---------- HUD --------------------------------------------------------- */

.hud { position: fixed; z-index: 20; pointer-events: none; }
.hud > * { pointer-events: auto; }

.hud-top {
  top: 0; left: 0; right: 0;
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 24px;
  padding: max(20px, env(safe-area-inset-top)) max(28px, env(safe-area-inset-right)) 0 max(28px, env(safe-area-inset-left));
}

/* a stacked title block on the wall; main.js (fitHud) sets --hud-name/--hud-role as large as the free wall allows,
   clear of the pull cord, the belt and the camera */
.name {
  margin: 0;
  font-weight: 800;
  font-size: var(--hud-name, clamp(28px, 5.4vh, 66px));
  line-height: 0.94;
  letter-spacing: 0.005em;
  text-transform: uppercase;
  color: var(--paper);
  text-shadow: 0 3px 0 rgba(26, 14, 48, 0.55), 0 8px 22px rgba(0, 0, 0, 0.5);
}
.name span, .role span { display: block; }
.role {
  margin: 0.6em 0 0;
  font-size: var(--hud-role, clamp(13px, 1.65vh, 19px));
  line-height: 1.3;
  color: var(--paper-dim);
  /* it can fall on the light posters at some aspect ratios: a tight dark rim under the soft shadow keeps it AA */
  text-shadow: 0 1px 1px rgba(6, 8, 20, 0.95), 0 1px 3px rgba(6, 8, 20, 0.85), 0 3px 12px rgba(0, 0, 0, 0.7);
}

.pills { display: flex; gap: 12px; flex-wrap: wrap; justify-content: flex-end; margin-right: var(--pills-shift, 0px); max-width: var(--pills-max, none); }
/* one row unless main.js (fitHud) gives them the room of two */
body:not(.compact):not(.hud-sky) .pills { flex: none; }
/* main.js steps the pills left of the lantern where they would hang over it; zoomed into the TV it is out of view */
body.is-inserting .pills, body.is-playing .pills { margin-right: 0; }
.pill {
  appearance: none;
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 38px;
  padding: 0 18px;
  border: 1.5px solid rgba(255, 244, 224, 0.82);
  border-radius: 999px;
  background: rgba(11, 16, 38, 0.38);
  color: var(--paper);
  font: 500 clamp(12px, 1.35vh, 15px)/1 var(--round);
  letter-spacing: 0.09em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}
/* hover only where there is one: a tap on a phone would leave it lit */
@media (hover: hover) { .pill:hover { background: rgba(255, 244, 224, 0.92); color: var(--night); } }
.pill:focus-visible { outline: 2px solid var(--lantern); outline-offset: 3px; }
.pill[aria-pressed="false"] { border-style: dashed; color: var(--paper-dim); }
/* the two sound switches (main.js): a speaker with its waves or a cross, the name, and the state. The state is drawn by
   CSS in a cell as wide as "off", so a switch keeps its width either way; screen readers hear the name and aria-pressed */
.pill-switch { gap: 0.5em; padding-left: 13px; }
.sw-ico { flex: none; width: 1.4em; height: 1.4em; margin: -0.2em 0; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.sw-ico .sw-cone { fill: currentColor; fill-opacity: 0.2; }
.pill-switch[aria-pressed="true"] .sw-mute, .pill-switch[aria-pressed="false"] .sw-waves { display: none; }
.sw-state { display: inline-grid; justify-items: start; font-weight: 800; }
.sw-state::before, .sw-state::after { grid-area: 1 / 1; }
.sw-state::before { content: "off"; visibility: hidden; }
.pill-switch[aria-pressed="true"] .sw-state::after { content: "on"; }
.pill-switch[aria-pressed="false"] .sw-state::after { content: "off"; }
/* on phones the switches take a row of their own under the other pills */
.pills-break { display: none; }

/* ---------- Share: the HUD's one call to action (nudge.js) ------------------------------------------------------
   Filled with the street's neon, night text, a share glyph. Its focus ring is paper on a night gap: the lantern's
   would all but vanish on the pink (1.8:1). Now and then it nudges: it lifts and tilts a little for 0.8 s while its
   glow (a pseudo-element under it) breathes. Only transform and opacity move, so it stays on the compositor; the
   glow's shadow itself never animates. The TV's Share beside Eject has the color, never the nudge. */
.pill-cta {
  position: relative; isolation: isolate;
  gap: 0.45em; padding-left: 14px;
  border-color: var(--neon-rim);
  background: var(--neon);
  color: var(--night);
  font-weight: 800;
}
.pill-cta::before {
  content: ""; position: absolute; inset: -1.5px; z-index: -1;
  border-radius: inherit;
  box-shadow: 0 0 10px 2px rgb(252 79 111 / 0.75), 0 0 26px 7px rgb(252 79 111 / 0.3);
  opacity: 0;
  pointer-events: none;
}
.cta-ico { flex: none; width: 1.3em; height: 1.3em; margin: -0.2em 0 -0.2em -0.1em; fill: none; stroke: currentColor; stroke-width: 2.1; stroke-linecap: round; }
.cta-ico circle { fill: currentColor; stroke: none; }
@media (hover: hover) { .pill-cta:hover { background: var(--neon-hi); border-color: var(--paper); color: var(--night); } }
.pill-cta:active { background: var(--neon-lo); border-color: var(--neon-rim); color: var(--night); }
.pill-cta:focus-visible { outline: 2px solid var(--paper); outline-offset: 3px; box-shadow: 0 0 0 3px var(--night); }
#share-btn.is-nudge { animation: cta-nudge 0.8s cubic-bezier(0.37, 0, 0.36, 1) both; }
#share-btn.is-nudge::before { animation: cta-breath 0.8s ease-in-out both; }
@keyframes cta-nudge {
  0% { transform: none; }
  28% { transform: translateY(-2.5px) rotate(-3deg); }
  56% { transform: translateY(-1.5px) rotate(1.6deg); }
  80% { transform: translateY(-0.5px) rotate(-0.5deg); }
  100% { transform: none; }
}
@keyframes cta-breath { 0%, 100% { opacity: 0; } 42% { opacity: 0.85; } }
/* reduced motion: never a nudge, the color and a still glow */
@media (prefers-reduced-motion: reduce) {
  #share-btn.is-nudge, #share-btn.is-nudge::before { animation: none; }
  #share-btn::before { opacity: 0.4; }
}

.hud-bottom {
  left: 0; right: 0; bottom: 0;
  display: flex; justify-content: center; align-items: center;
  padding: 0 28px max(22px, env(safe-area-inset-bottom));
}
.hint {
  margin: 0;
  font-size: clamp(13px, 1.7vh, 18px);
  color: var(--paper);
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.7), 0 2px 14px rgba(0, 0, 0, 0.8);
  pointer-events: none;
}
/* Eject, and beside it on phones the full-screen TV's Share (main.js shows it with the full-screen TV) */
.tv-pills { position: absolute; right: max(28px, env(safe-area-inset-right)); bottom: max(22px, env(safe-area-inset-bottom)); display: flex; gap: 8px; }

.tip {
  position: fixed;
  z-index: 30;
  max-width: 280px;
  padding: 8px 12px;
  background: linear-gradient(180deg, var(--win-top), var(--win-bottom));
  border: 2px solid var(--win-edge);
  border-radius: 8px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.45);
  font: 16px/20px var(--pixel);
  color: #fff;
  text-shadow: 1px 1px 0 #070b2a;
  pointer-events: none;
  transform: translate(-50%, calc(-100% - 14px));
}
.tip b { font-weight: 400; color: var(--gold); display: block; }
.tip.tip-below { transform: translate(-50%, 14px); }

/* main.js (placeToast) anchors it where nothing can be touched: the window's night sky under the pills, or the lower
   half of the TV's attract screen on phones; the fallback is bottom centre */
.toast {
  position: fixed; z-index: 31;
  left: var(--toast-x, 50%);
  top: var(--toast-y, auto);
  bottom: var(--toast-b, max(70px, calc(env(safe-area-inset-bottom) + 58px)));
  width: max-content; max-width: min(460px, var(--toast-w, calc(100vw - 32px)));
  padding: 12px 20px 14px;
  transform: translateX(-50%);
  background: linear-gradient(180deg, var(--win-top), var(--win-bottom));
  border: 3px solid var(--win-edge);
  border-radius: 10px;
  box-shadow: inset 0 0 0 2px #0a1040, 0 14px 34px rgba(0, 0, 0, 0.5);
  font: 18px/1.35 var(--pixel);
  color: #fff;
  text-shadow: 1px 1px 0 #070b2a;
  text-align: center;
  pointer-events: none;
}
.toast b { display: block; margin-bottom: 4px; font-weight: 400; color: var(--gold); }
.toast.in { animation: toastin 0.5s var(--ease-out); }
body.is-inserting .toast, body.is-playing .toast { display: none; }
@keyframes toastin { from { opacity: 0; transform: translate(-50%, 16px); } to { opacity: 1; transform: translate(-50%, 0); } }

.secrets {
  display: inline-flex; align-items: center;
  min-height: 38px; padding: 0 16px;
  border: 1.5px dotted rgba(242, 194, 48, 0.85);
  border-radius: 999px;
  background: rgba(11, 16, 38, 0.38);
  color: var(--gold);
  font: 500 clamp(12px, 1.35vh, 15px)/1 var(--round);
  letter-spacing: 0.09em;
}

.loader {
  position: fixed; inset: 0; z-index: 50;
  display: grid; place-items: center;
  background: var(--night);
  font: 16px var(--pixel);
  color: var(--paper-dim);
  transition: opacity 0.8s ease, visibility 0.8s;
}
/* fading out, it must already let clicks through to the room */
body:not(.is-loading) .loader { opacity: 0; visibility: hidden; pointer-events: none; }
.loader span { animation: blink 1s steps(2) infinite; }

/* zoomed-in state (no filter on .world: it would recolour the TV, its logos and videos) */
body.is-playing .hint { opacity: 0; }
/* the zoomed TV fills the view; the name would sit on its bezel */
.who { transition: opacity 0.35s ease; }
body.is-playing .who { opacity: 0; }

/* ---------- credits dialog --------------------------------------------- */

.credits {
  width: min(620px, calc(100vw - 32px));
  max-height: calc(100dvh - 48px);
  padding: 22px 26px;
  border: 3px solid var(--win-edge);
  border-radius: 12px;
  background: linear-gradient(180deg, var(--win-top), var(--win-bottom));
  color: #fff;
  box-shadow: inset 0 0 0 2px #0a1040, 0 18px 50px rgba(0, 0, 0, 0.55);
  font-size: 15px;
  line-height: 1.55;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.credits:not([open]) { display: none; }
.credits::backdrop { background: rgba(5, 8, 22, 0.66); }
.credits-head { display: flex; flex: none; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.credits h2 { margin: 0; font: 400 26px/1.1 var(--pixel); color: var(--gold); }
.credits h3 { margin: 18px 0 6px; font: 400 16px/1.2 var(--pixel); color: var(--gold); }
.credits ul { margin: 0; padding-left: 1.1em; }
.credits li { margin: 0.2em 0; }
.credits-head form { margin: 0; }
.credits .credits-head button.pill { min-height: 44px; }
#credits-body { min-height: 0; overflow-y: auto; overscroll-behavior: contain; }

/* The first mobile visit: the room stays visible behind a small agent greeting, not a blocking device warning. */
.mobile-welcome {
  box-sizing: border-box;
  width: min(520px, calc(100vw - 28px));
  max-height: min(660px, calc(100dvh - 32px));
  overflow-y: auto;
  padding: clamp(20px, 5vw, 32px);
  border: 3px solid var(--win-edge);
  border-radius: 16px;
  background: linear-gradient(180deg, var(--win-top), var(--win-bottom));
  color: #fff;
  box-shadow: inset 0 0 0 2px #0a1040, 0 18px 50px rgba(0, 0, 0, 0.55);
  font: 600 16px/1.55 var(--round);
}
.mobile-welcome::backdrop { background: rgba(5, 8, 22, 0.78); }
.mobile-welcome-head { display: flex; align-items: center; gap: 16px; }
.mobile-welcome-agent {
  flex: none; width: clamp(64px, 20vw, 92px); height: clamp(64px, 20vw, 92px);
  object-fit: contain; filter: drop-shadow(0 5px 8px rgba(0, 0, 0, 0.42));
  animation: welcome-agent-idle 2.8s ease-in-out infinite;
}
.mobile-welcome-tag { margin: 0 0 6px; color: var(--gold); font: 400 14px/1 var(--pixel); letter-spacing: 0.08em; }
.mobile-welcome h2 { margin: 0; color: var(--gold); font: 400 clamp(20px, 5vw, 28px)/1.2 var(--pixel); }
#mobile-welcome-copy { margin: 20px 0 0; }
.mobile-welcome-note { margin: 12px 0 0; color: #e0e5ff; font-size: 14px; }
.mobile-welcome-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; margin-top: 22px; }
.mobile-welcome .mobile-welcome-actions .pill { min-height: 48px; }
.mobile-welcome-actions .pill-cta { flex: 1 1 190px; }
@keyframes welcome-agent-idle {
  0%, 100% { transform: translateY(0) rotate(-2deg); }
  50% { transform: translateY(-5px) rotate(2deg); }
}
@media (prefers-reduced-motion: reduce) {
  .mobile-welcome-agent { animation: none; }
}

/* ---------- share dialog (share.js) -------------------------------------
   The credits' blue window: the link and Copy, the device's own share sheet where there is one, the networks as pills
   (plain links, opening in a new tab: ↗), e-mail. Two columns on phones. */
.share {
  width: min(580px, calc(100vw - 24px));
  max-height: calc(100dvh - 32px);
  padding: 20px 22px 18px;
  border: 3px solid var(--win-edge);
  border-radius: 12px;
  background: linear-gradient(180deg, var(--win-top), var(--win-bottom));
  color: #fff;
  box-shadow: inset 0 0 0 2px #0a1040, 0 18px 50px rgba(0, 0, 0, 0.55);
  font-size: 15px;
  line-height: 1.5;
}
.share::backdrop { background: rgba(5, 8, 22, 0.66); }
.share h2 { margin: 0 0 2px; font: 400 26px/1.1 var(--pixel); color: var(--gold); }
.share-what { margin: 0 0 14px; color: #dfe4ff; text-wrap: balance; }
.share-what:empty { display: none; }
.share-link { display: flex; gap: 8px; align-items: stretch; }
.share-url {
  flex: 1; min-width: 0;
  padding: 8px 10px;
  border: 2px solid rgba(255, 244, 224, 0.55);
  border-radius: 8px;
  background: rgba(4, 8, 30, 0.55);
  color: #fff;
  font: 15px/1.2 var(--pixel);
}
.share-url:focus-visible { outline: 2px solid var(--lantern); outline-offset: 2px; }
.share .pill { min-height: 40px; gap: 8px; }
.share .pill svg { flex: none; width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.share-copy { flex: none; }
.share-copy.is-done { border-color: var(--gold); color: var(--gold); }
.share-status { min-height: 1.5em; margin: 6px 0 0; font-size: 14px; color: var(--gold); }
.share-list { list-style: none; margin: 8px 0 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.share-list .pill { width: 100%; justify-content: flex-start; padding: 0 12px; }
.share-list .pill svg.share-out { width: 14px; height: 14px; margin-left: auto; opacity: 0.75; }
.share-device-row { grid-column: 1 / -1; }
.share-note { margin: 12px 0 0; font-size: 13px; color: #c9d2ff; }
.share-close { margin-top: 14px; display: flex; justify-content: flex-end; }
.share-close .pill { gap: 0; }
@media (max-width: 560px) {
  .share { padding: 16px 14px 14px; }
  .share-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .share-esc { display: none; }
}
@media (hover: none) { .share-esc { display: none; } }

/* ---------- a deep link's chain (deeplinks.js) ---------------------------
   While a link plays its way to what it points to, a caption in the hint's place says where it goes and how to skip;
   over everything (the focus view is 40), never in the way of a click. */
.link-cap {
  position: fixed; left: 50%; bottom: max(22px, env(safe-area-inset-bottom)); z-index: 45;
  max-width: calc(100vw - 32px);
  margin: 0;
  padding: 9px 20px 10px;
  border: 1.5px solid rgba(255, 244, 224, 0.82);
  border-radius: 999px;
  background: rgba(11, 16, 38, 0.78);
  color: var(--paper);
  font: 500 clamp(13px, 1.6vh, 16px)/1.3 var(--round);
  text-align: center;
  transform: translateX(-50%);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
.link-cap.is-on { opacity: 1; }
body.focus-open .link-cap { bottom: calc(max(22px, calc(env(safe-area-inset-bottom) + 12px)) + 58px); }
.link-cap b { font-weight: 800; }
.link-cap span:not(:empty)::before { content: " · "; }
.link-cap span { color: var(--paper-dim); white-space: nowrap; }
body.is-chaining .hint { opacity: 0; }

/* ---------- mobile cartridge strip & full-screen TV --------------------- */

.cart-strip { display: none; }

.tv-full {
  position: fixed; inset: 0; z-index: 25;
  background: #05070f;
  padding: max(10px, env(safe-area-inset-top)) 10px max(10px, env(safe-area-inset-bottom));
}
/* the full-screen TV covers the room: skipped under it, the room's layers give back their memory until it closes
   (Safari keeps a hidden layer's pixels, so visibility alone frees nothing; content-visibility lets them go) */
body:has(> .tv-full) .world { visibility: hidden; content-visibility: hidden; }
.tv-full .tv-frame {
  position: relative; width: 100%; height: 100%;
  border-radius: 28px;
  padding: 14px;
  background: linear-gradient(160deg, #3b3a40, #1d1c22);
  box-shadow: inset 0 0 0 2px #55545c, 0 10px 30px rgba(0, 0, 0, 0.6);
}
.tv-full .tv-screen { position: relative; width: 100%; height: 100%; transform: none; border-radius: 16px; }

@media (max-aspect-ratio: 1/1), (max-width: 720px) {
  /* tighter on phones: less HUD over the room (main.js zooms the room just enough to keep the TV's camera clear) */
  .hud-top { flex-direction: column; gap: 8px; padding: max(14px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) 0 max(20px, env(safe-area-inset-left)); }
  .role span { display: inline; }
  .pills { justify-content: flex-start; gap: 8px; }
  .pill { min-height: 34px; padding: 0 12px; }
  .pills-break { display: block; flex-basis: 100%; height: 0; }
  .hint { display: none; }
  .cart-strip {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 21;
    display: flex; gap: 12px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    padding: 14px 16px max(16px, env(safe-area-inset-bottom));
    background: linear-gradient(180deg, rgba(11, 16, 38, 0), rgba(11, 16, 38, 0.85) 30%);
  }
  .cart-strip button {
    flex: 0 0 auto;
    scroll-snap-align: start;
    display: flex; align-items: center; gap: 8px;
    min-height: 48px;
    padding: 6px 14px 6px 6px;
    border: 1.5px solid rgba(255, 244, 224, 0.8);
    border-radius: 999px;
    background: rgba(11, 16, 38, 0.6);
    color: var(--paper);
    font: 800 13px/1 var(--round);
    letter-spacing: 0.04em;
    text-transform: uppercase;
  }
  .cart-strip button i { width: 34px; height: 34px; border-radius: 50%; background: var(--c); display: block; }
  /* above the full-screen TV (z 25): the pill's own z-index only counts inside .hud-bottom */
  .hud-bottom { z-index: 26; }
  .tv-pills { bottom: auto; top: max(14px, env(safe-area-inset-top)); z-index: 26; position: fixed; }
  .tv-pills .pill { min-height: 44px; }
  .tv-pills .eject-key { display: none; }
  .toast { bottom: var(--toast-b, calc(max(16px, env(safe-area-inset-bottom)) + 76px)); }
  .secrets { min-height: 34px; padding: 0 12px; }
  .link-cap { bottom: calc(max(16px, env(safe-area-inset-bottom)) + 78px); border-radius: 18px; padding: 8px 16px; }
  .link-cap span { display: block; }
  .link-cap span:not(:empty)::before { content: none; }
}

/* text sizes inside the full-screen TV stay readable; touch screens need no key hints */
.tv-full .scr-title { font-size: 24px; line-height: 28px; }
.tv-full .scr-keys { display: none; }
/* the full-screen TV covers the HUD in either orientation: keep the eject button above it (its z-index only counts
   inside .hud-bottom, so the whole bar is raised above the TV's z 25) */
body:has(> .tv-full) .hud-bottom { z-index: 26; }
body:has(> .tv-full) .tv-pills { position: fixed; top: max(14px, env(safe-area-inset-top)); bottom: auto; z-index: 26; }
body:has(> .tv-full) .tv-pills .pill { min-height: 44px; }
body:has(> .tv-full) .tv-pills .eject-key { display: none; }
/* there the screen's own share key would sit under them: the pill beside Eject shares instead */
.tv-full .scr-share { display: none; }

/* where the screen is taller than the room (16:10, 4:3, phones) the room stands on the floor under a dark ceiling band
   that carries the HUD (main.js baseCam); the painted top edge fades into it, and the pull cord hangs out of it. The
   band is only as tall as it shows (--band, world px, set by fitHud): a world-sized layer would cost phones ~5 Mpx */
.world::before {
  content: "";
  position: absolute; left: 0; bottom: calc(100% - 90px);
  width: 2704px; height: calc(var(--band, 0px) + 90px);
  z-index: 12;
  pointer-events: none;
  background: linear-gradient(to top, rgba(9, 12, 21, 0), #090c15 90px);
  display: none;
}
body.has-band .world::before { display: block; }

/* a phone on its side: the wall has no room for the name, so it stands in the window over the night sky (main.js
   sets --sky-l/--sky-w from the room); the pills go down to the desk corner, clear of the lantern and the cartridges */
body.hud-sky .hud-top {
  left: var(--sky-l, 50%); right: auto; width: var(--sky-w, 45%);
  flex-direction: column; align-items: flex-start; gap: 0;
  padding: max(8px, env(safe-area-inset-top)) 0 0;
}
body.hud-sky .name span { display: inline; }
body.hud-sky .pills { position: fixed; right: max(14px, env(safe-area-inset-right)); bottom: max(8px, env(safe-area-inset-bottom)); gap: 6px; }
body.hud-sky .pill, body.hud-sky .secrets { min-height: 32px; padding: 0 12px; }
/* all of them in one row along the bottom edge there: below the crate and the PC, clear of what you can touch */
body.hud-sky .pills-break { display: none; }
body.hud-sky .hint { display: none; }

@media (prefers-reduced-motion: reduce) {
  .world { transition: none; }
  .link-cap { transition-duration: 0.15s; }
  .chime, .light, .cord, .glint, .g-stars > i, .tv-fx, .menu [aria-current="true"]::before, .attract-cta span::before { animation: none !important; }
  .cue::before, .tv-screen::before, .tv-screen::after, .blinker, .flag.here { animation: none !important; }
  .street, .sheen { transition: none; }
}

.noscript { position: fixed; inset: auto 0 0 0; z-index: 60; padding: 18px; text-align: center; background: var(--night-2); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- TV screens -------------------------------------------------- */

.tv-screen ::-webkit-scrollbar { width: 8px; }
.tv-screen ::-webkit-scrollbar-thumb { background: var(--gold); border-radius: 4px; }
.tv-screen * { scrollbar-width: thin; scrollbar-color: var(--gold) transparent; }
.tv-screen p { margin: 0; }

/* career */
.map-view {
  position: relative; flex: none; width: 100%; height: 205px; overflow: hidden; overflow: clip;
  border: 3px solid var(--win-edge); border-radius: 9px; box-shadow: 0 6px 14px rgba(0, 0, 0, 0.45); background: #071028;
}
.map-inner { position: absolute; left: 0; top: 0; }
.map-img { display: block; width: 100%; height: 100%; }
.flag {
  position: absolute; width: 26px; height: 26px; margin: -13px 0 0 -13px; padding: 0;
  border: 3px solid #fff; border-radius: 50%; background: #1b2a8c; cursor: pointer; z-index: 1;
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.5);
}
/* stage labels: small plates in the employer plates' language (navy fill, thin light border), laid over the map by
   tv.js beside their flags and clear of discs, hero, plates and each other; a stage off screen keeps its label on
   that edge with a small arrow towards it. White on #05081c is 19:1, gold 13:1. */
.flag-tags { position: absolute; inset: 0; z-index: 2; pointer-events: none; }
.flag-tag {
  position: absolute; left: 0; top: 0; display: flex; align-items: center; gap: 3px;
  padding: 1px 5px; border: 1px solid #9aa3c7; border-radius: 4px; background: #05081c;
  color: #fff; font: 16px/16px var(--pixel); white-space: nowrap; text-shadow: none;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.35);
}
.flag-tag.here { color: var(--gold); border-color: var(--gold); }
.flag-tag[data-dir]::before, .flag-tag[data-dir="right"]::after, .flag-tag[data-dir="down"]::after { content: ""; flex: none; width: 6px; height: 10px; background: currentColor; }
.flag-tag[data-dir="right"]::before, .flag-tag[data-dir="down"]::before { content: none; }
.flag-tag[data-dir="left"]::before { clip-path: polygon(100% 0, 0 50%, 100% 100%); }
.flag-tag[data-dir="right"]::after { clip-path: polygon(0 0, 100% 50%, 0 100%); }
.flag-tag[data-dir="up"]::before { width: 10px; height: 6px; clip-path: polygon(50% 0, 100% 100%, 0 100%); }
.flag-tag[data-dir="down"]::after { width: 10px; height: 6px; clip-path: polygon(0 0, 100% 0, 50% 100%); }
.flag.done { background: var(--gold); }
.flag.here { background: var(--c); animation: pulse 0.7s steps(2) infinite; }
.flag:focus-visible { outline: 2px dashed var(--gold); outline-offset: 3px; }
@keyframes pulse { 50% { transform: scale(1.18); } }
.hero {
  position: absolute; width: 40px; height: 60px; margin: -54px 0 0 -20px; z-index: 2; pointer-events: none;
  background: url("../img/tv/avatar-walk.png") 0 0 / 120px 180px no-repeat; image-rendering: pixelated;
}
.hero.mirror { transform: scaleX(-1); }
/* employer plates, oldest first: the official logo, untouched, on a dark plate whose padding is its clear space
   (≥ one Microsoft square = half the 24 px logo height; SAP needs a quarter of its height). On the TV they label
   the two islands (SAP left, Microsoft right); the current employer is framed in gold. */
.org-legend { display: flex; flex-wrap: wrap; gap: 8px; pointer-events: none; }
.map-view > .org-legend { position: absolute; left: 8px; right: 8px; top: 8px; z-index: 3; justify-content: space-between; }
.career-dialog .org-legend { margin: 0 0 10px; }
.org-plate {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px;
  background: #05081c; border: 2px solid #9aa3c7; border-radius: 6px;
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.35);
}
.org-plate.is-here { border-color: var(--gold); box-shadow: 0 0 0 2px rgba(255, 215, 94, 0.45), 0 3px 0 rgba(0, 0, 0, 0.35); }
.org-logo { display: block; flex: none; width: auto; height: 24px; }
.org-years { color: var(--gold); white-space: nowrap; }
.career-dialog { flex: 1 1 auto; min-height: 64px; }
.win.scroll.career-dialog { padding-top: 10px; }
.role-line { margin: 0 0 4px !important; }
.points { list-style: none; margin: 0; padding: 0; }
.points li { position: relative; margin: 2px 0; padding-left: 18px; }
.points li::before { content: ""; position: absolute; left: 2px; top: 7px; width: 8px; height: 8px; background: var(--gold); }

/* lists (workshops, projects) */
.headline { flex: none; }
.split { flex: 1 1 auto; min-height: 0; display: grid; grid-template-columns: 284px minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); gap: 8px; }
.split .list { padding-left: 6px; padding-right: 6px; }
.split .menu > li > button { padding-top: 5px; padding-bottom: 5px; }
.split .menu > li > button img { flex: none; width: 32px; height: 32px; }
.split .menu > li > button img.star { width: 16px; height: 16px; }
.split .menu > li > button b { font-weight: 400; flex: none; }
.detail > .scroll-body { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; container-type: inline-size; }
/* a narrow details window puts the site preview above the titles */
@container (max-width: 270px) { .detail-head:has(> .preview) { flex-direction: column; align-items: flex-start; } }
.detail-head { display: flex; align-items: center; gap: 10px; }
.detail-head > img { flex: none; width: 48px; height: 48px; }
.detail-titles { min-width: 0; display: grid; gap: 2px; }
.detail h4 { margin: 0; font-weight: 400; }
/* featured work: a ★ on the row's icon; in the details the live site's preview, a ★ tag and the short URL */
.row-icon { position: relative; flex: none; display: block; }
.row-icon > .star { position: absolute; right: -7px; top: -7px; }
.row-star { flex: none; display: block; }
.preview { flex: none; display: block; width: 120px; height: 75px; border: 2px solid var(--win-edge); border-radius: 4px; overflow: hidden; background: #000; }
.preview img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: top; }
.tag { display: flex; align-items: center; gap: 6px; color: var(--gold); text-transform: uppercase; }
.tag .star { flex: none; width: 16px; height: 16px; }
.site { color: var(--gold); text-decoration: underline; text-underline-offset: 3px; overflow-wrap: anywhere; }
.site:focus-visible { outline: 2px dashed var(--gold); outline-offset: 2px; }
.choices { display: flex; flex-wrap: wrap; gap: 8px; }
.choices .tv-link { margin-top: 0; }
button.tv-link { font: inherit; background: none; cursor: pointer; text-shadow: inherit; }
/* rows cut at a scrolling edge fade out under the cue instead of looking clipped */
.scroll.more-down > .scroll-body { -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 20px), transparent); mask-image: linear-gradient(to bottom, #000 calc(100% - 20px), transparent); }
.scroll.more-up > .scroll-body { -webkit-mask-image: linear-gradient(to top, #000 calc(100% - 20px), transparent); mask-image: linear-gradient(to top, #000 calc(100% - 20px), transparent); }
.scroll.more-up.more-down > .scroll-body { -webkit-mask-image: linear-gradient(transparent, #000 20px, #000 calc(100% - 20px), transparent); mask-image: linear-gradient(transparent, #000 20px, #000 calc(100% - 20px), transparent); }
.scr-projects .split { grid-template-columns: 340px minmax(0, 1fr); }
.scr-projects .menu > li > button { align-items: flex-start; }

/* tech inventory: three columns of group windows, balanced by item count */
.groups { flex: 1 1 auto; padding-bottom: 12px; }
.groups > .cue { pointer-events: none; } /* no frame padding here: the cue sits on the slots and must not take their clicks */
.groups > .scroll-body { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; align-items: start; }
.groups .col { display: grid; gap: 8px; }
.group { padding: 6px 10px 8px; }
.group h4 { margin-bottom: 2px; }
.slots { list-style: none; margin: 0; padding: 0; display: grid; }
.slot { all: unset; box-sizing: border-box; display: flex; align-items: center; gap: 8px; width: 100%; min-height: 34px; padding: 1px 4px; border-radius: 4px; cursor: default; }
.slot img { flex: none; width: 32px; height: 32px; }
.slot > span { min-width: 0; overflow-wrap: anywhere; }
.slot:hover, .slot:focus-visible { background: rgba(255, 255, 255, 0.14); outline: 2px dashed var(--gold); outline-offset: -2px; }

/* trophies */
.trophy-list { flex: 1 1 auto; }
.trophy-list ul { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 10px; }
.trophy { display: grid; grid-template-columns: 48px 1fr; gap: 14px; align-items: center; opacity: 0; animation: unlock 0.45s steps(4) forwards; }
.trophy img { width: 48px; height: 48px; }
.tv-link.small { margin-top: 4px; padding: 2px 10px; }
@keyframes unlock { from { opacity: 0; transform: translateX(-14px); } to { opacity: 1; transform: none; } }

/* contact */
.continue { flex: 1 1 auto; min-height: 0; overflow: auto; display: flex; flex-direction: column; align-items: center; justify-content: safe center; gap: 16px; text-align: center; }
.continue .big { font-size: 64px; line-height: 64px; text-shadow: 4px 4px 0 #070b2a, 0 0 18px rgba(255, 255, 255, 0.3); }
.continue .line { max-width: 520px; }
.contact-menu { width: min(440px, 100%); text-align: left; }
.contact-menu button { padding-top: 6px; padding-bottom: 6px; }
.contact-menu button > span { display: flex; flex-direction: column; min-width: 0; }
.contact-menu b { font-weight: 400; }
.contact-menu small { font-size: 16px; overflow-wrap: anywhere; }
.blinker { animation: blink 1s steps(2) infinite; }

/* video tape: consent first; then the player fills the safe area (16:9, a Short 9:16) under the CRT overlay */
.scr-video:focus { outline: none; }
.scr-video.is-overlay { z-index: 4; background: #060a1c; }
.scr.has-player > :not(.scr-video) { visibility: hidden; }
.video-stage { flex: 1 1 auto; min-height: 0; display: grid; justify-items: center; align-items: safe center; container-type: size; }
.video-consent { width: min(100%, 470px); display: grid; gap: 10px; }
.video-consent .menu, .choices { text-transform: uppercase; } /* sentence case in the DOM for screen readers */
.video-box { background: #000; border: 3px solid var(--win-edge); border-radius: 6px; overflow: hidden; } /* sized by tv.js */
.video-frame { display: block; width: 100%; height: 100%; border: 0; }

/* phone: the TV fills the screen, every screen reflows and the whole screen scrolls */
.tv-full .tv-content {
  box-sizing: border-box;
  overflow: auto;
  overscroll-behavior: contain;
  padding-top: calc(44px + max(14px, env(safe-area-inset-top)) + 8px);
}
.tv-full .scr { position: relative; min-height: 100%; padding: 14px 12px 24px; }
.tv-full .scroll { min-height: auto; }
.tv-full .scroll-body { overflow: visible; }
.tv-full .groups > .scroll-body { grid-template-columns: 1fr; }
.tv-full .map-view { height: 240px; }
.tv-full .split { display: block; }
.tv-full .split .menu li > .detail { margin: 4px 0 10px; }
.tv-full .continue { overflow: visible; }
.tv-full .scr.has-player > :not(.scr-video) { display: none; }
.tv-full .scr.scr-video.is-overlay { position: absolute; inset: 0; min-height: 0; }
.tv-full .continue .big { font-size: 40px; line-height: 44px; }
/* a phone on its side: wide and short, so side-by-side windows come back */
@media (min-aspect-ratio: 1/1) {
  .tv-full .groups > .scroll-body { grid-template-columns: 1fr 1fr; }
  .tv-full .scr-career { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-rows: auto 1fr; gap: 8px; }
  .tv-full .scr-career .scr-bar { grid-column: 1 / -1; }
  .tv-full .scr-career .map-view { height: 240px; align-self: start; position: sticky; top: 0; } /* stays on screen while the stage text scrolls */
}

/* ---------- the photography camera (camera.js) --------------------------
   A 3D compact camera on the TV. Faces are flat elements mapped onto their projected quads (matrix3d) in face-local
   texture px; the whole solid is lit by an SVG colour matrix (#cam-fx) that camera.js drives from the room's lights,
   which also draws its ink outline at painting scale. The screen and keys ride on the back face, unlit (it glows). */

.cam-defs { position: absolute; width: 0; height: 0; overflow: hidden; }
.cam { position: absolute; left: 0; top: 0; pointer-events: none; filter: url(#cam-fx); --silver: #c9c7bb; --ink: #070f10; }
.cam.is-hot { filter: url(#cam-fx-hot); }
.cam.is-big { filter: url(#cam-fx-big); }
.cam-g { position: absolute; left: 0; top: 0; }
.cam-f { position: absolute; left: 0; top: 0; overflow: hidden; transform-origin: 0 0; pointer-events: none; }
.cam.is-held .cam-f { pointer-events: auto; }
.cam-f > img { position: absolute; display: block; max-width: none; pointer-events: none; user-select: none; -webkit-user-drag: none; }
.cam-f > .cam-tex { left: 0; top: 0; transform-origin: 0 0; }
.cam-f > .cam-tex[src] { will-change: transform; }
.cam-f > img:not([src]) { visibility: hidden; }

/* edges: brushed silver plates, the leatherette band on the short ends, a matte black lens barrel with a knurled ring;
   --dk darkens a face turned away from the light, ink lines mark where an edge meets the front and the back */
.cam-strip::after { content: ""; position: absolute; inset: 0; background: #02070c; opacity: var(--dk, 0); }
.cam-plate {
  background:
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.05) 0 3px, rgba(20, 30, 40, 0.05) 3px 7px),
    linear-gradient(180deg, #a9aea9 0%, #d8d3c2 32%, #c5c6bf 62%, #9ca4a5 100%);
  box-shadow: inset 0 4px 0 var(--ink), inset 0 -4px 0 var(--ink);
}
.cam-base {
  background:
    radial-gradient(circle at 50% 50%, #0b1015 0 15px, #737c80 16px 24px, var(--ink) 25px 27px, transparent 28px),
    linear-gradient(180deg, #8d9597 0%, #c5c6bf 40%, #a9aea9 100%);
}
.cam-end { background: var(--bands), url("../img/camera/camera-leather.webp") 0 0 / auto 100% repeat-x, #1d3241; box-shadow: inset 0 4px 0 var(--ink), inset 0 -4px 0 var(--ink); }
.cam-barrel {
  background:
    linear-gradient(180deg, #04080b 0 4%, #2a3945 4% 8%, #0b1218 8% 22%, transparent 22% 62%, #0b1218 62% 100%),
    repeating-linear-gradient(90deg, #0c141a 0 7px, #26343e 7px 10px, #0c141a 10px 14px);
  box-shadow: inset 0 4px 0 var(--ink), inset 0 -3px 0 var(--ink);
}
.cam-knobtop {
  border-radius: 50%;
  background: radial-gradient(circle, #dcd8c8 0 34%, #b7bab3 35% 58%, #8c969a 59% 66%, #cdcabc 67% 84%, #717b80 85% 100%);
  box-shadow: inset 0 0 0 5px var(--ink);
}
.cam-lugside { background: linear-gradient(90deg, #8f989a, #d7d3c3 50%, #9aa2a4); box-shadow: inset 0 0 0 3px var(--ink); }

/* resting on the TV: the button over it, and its contact shadow on the TV's top edge */
.cam-hit {
  position: absolute; padding: 0; margin: 0; border: 0; background: none;
  border-radius: 12px; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.cam-hit:focus-visible { outline: 3px solid var(--paper); outline-offset: 5px; }
.cam-hit.is-off, body.is-playing .cam-hit, body.is-inserting .cam-hit { pointer-events: none; }
.cam-hit.is-off { visibility: hidden; }
.cam-shadow {
  position: absolute; transform-origin: 0 0; pointer-events: none;
  mix-blend-mode: multiply;
  background: radial-gradient(50% 100% at 52% 0%, rgba(6, 8, 14, 0.78), rgba(6, 8, 14, 0.35) 45%, rgba(6, 8, 14, 0) 100%);
}

/* held: the room dims a little behind it; a click on the dimmed room puts the camera back */
.cam-scrim { position: absolute; left: 0; top: 0; width: 2704px; height: 1520px; background: rgba(5, 8, 22, 0.42); opacity: 0; transition: opacity 0.5s ease; }
.cam-scrim.on { opacity: 1; }

/* the camera's screen: a playback view in the TV's pixel face, photo first, info over it like a real camera's OSD */
.cam-ui { position: absolute; left: 0; top: 0; width: 1339.3px; height: 807.95px; transform-origin: 0 0; }
.cam-lcd {
  position: absolute; overflow: hidden;
  border-radius: 7px;
  background: #020509;
  color: #fff;
  font-family: var(--pixel);
  text-shadow: 2px 2px 0 #000, 0 0 6px rgba(0, 0, 0, 0.6);
  opacity: 0;
  touch-action: pan-y;
}
.cam-lcd.is-on { animation: lcdon 0.5s ease-out forwards; }
@keyframes lcdon { 0% { opacity: 0; filter: brightness(3) saturate(0); } 18% { opacity: 1; filter: brightness(2.2) saturate(0.2); } 100% { opacity: 1; filter: none; } }
.cam-shot { position: absolute; inset: 0; background: #020509; }
.cam-shot img { display: block; width: 100%; height: 100%; object-fit: cover; }
.cam-shot img:not([src]) { visibility: hidden; }
.cam-osd { position: absolute; inset: 0; pointer-events: none; transition: opacity 0.2s ease; }
.cam-lcd.osd-off .cam-osd { opacity: 0; }
.cam-osd p { position: absolute; left: 0; right: 0; margin: 0; }
.osd-top {
  top: 0; display: flex; justify-content: space-between;
  padding: 14px 22px 40px;
  font-size: 30px; line-height: 30px;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.55), rgba(0, 0, 0, 0));
}
.osd-top b { font-weight: 400; }
.osd-top i { font-style: normal; }
.osd-likes i { color: var(--gold); }
.osd-bottom {
  bottom: 0; display: flex; flex-direction: column; gap: 6px;
  padding: 46px 22px 16px;
  background: linear-gradient(0deg, rgba(0, 0, 0, 0.66), rgba(0, 0, 0, 0));
}
.osd-title { align-self: flex-start; font-size: 40px; line-height: 44px; color: #fff; text-decoration: none; pointer-events: auto; }
.osd-title::after { content: " ↗"; font-size: 0.7em; color: var(--gold); }
.osd-title:hover { color: var(--gold); }
.osd-title:focus-visible { outline: 4px dashed var(--gold); outline-offset: 4px; }
.osd-meta { font-size: 26px; line-height: 30px; color: #c9d2ff; }
.cam-glass {
  position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(118deg, rgba(255, 255, 255, 0.09) 0%, rgba(255, 255, 255, 0.02) 26%, rgba(255, 255, 255, 0) 40%);
}
.cam-wait {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  font-size: 28px; color: #c9d2ff; letter-spacing: 0.1em;
  opacity: 0; transition: opacity 0.2s ease 0.25s;
}
.cam-lcd.is-waiting .cam-wait { opacity: 1; animation: blink 0.8s steps(2) infinite; }

/* the d-pad answers like the cartridges do: warm light on hover, a press when clicked */
.cam-key {
  position: absolute; padding: 0; margin: 0; border: 0;
  background: transparent; border-radius: 16px; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.cam-key-ok { border-radius: 50%; }
.cam-key:hover { background: rgba(255, 186, 102, 0.14); box-shadow: 0 0 26px 6px rgba(255, 186, 102, 0.42); }
.cam-key:active { background: rgba(0, 0, 0, 0.32); box-shadow: none; }

/* HUD while you hold it */
.cam-bar {
  position: fixed; left: 50%; bottom: max(66px, calc(env(safe-area-inset-bottom) + 52px)); z-index: 22;
  display: flex; gap: 12px; align-items: center;
  transform: translateX(-50%);
  animation: barin 0.4s var(--ease-out);
}
@keyframes barin { from { opacity: 0; transform: translate(-50%, 12px); } to { opacity: 1; transform: translate(-50%, 0); } }
.pill-round { width: 38px; padding: 0; font-size: 22px; letter-spacing: 0; }
body.cam-active .cart-strip, body.cam-active .toast { display: none; }

/* on phones the camera comes close enough to fill the width; the big name block steps aside until it is put back */
.hud-top { transition: opacity 0.35s ease; }
body.compact.cam-active .hud-top { opacity: 0; pointer-events: none; }
body.compact.cam-active .hud-top * { pointer-events: none; }

@media (max-aspect-ratio: 1/1), (max-width: 720px) {
  .cam-esc { display: none; }
  .cam-bar { bottom: max(18px, env(safe-area-inset-bottom)); width: max-content; max-width: calc(100vw - 24px); flex-wrap: wrap; justify-content: center; gap: 8px; }
  .pill-round { width: 44px; min-height: 44px; }
}

@media (prefers-reduced-motion: reduce) {
  .cam-scrim, .cam-osd { transition: none; }
  .cam-lcd.is-on { animation-duration: 0.2s; }
  .cam-bar { animation: none; }
}

/* ---------- focus view (focus.js) ---------------------------------------
   A thing in the room taken off the wall and held up close (the "About me" poster, the badge rack). Its face flies from
   its projected corners on the wall into the panel (matrix3d, origin 0 0; will-change only while it flies), a dark
   backdrop dims the room (never a filter on .world: it would recolour the TV), and the rest of the panel fades in once
   the face has landed. Above the HUD (20), the full-screen TV (25) and the tooltips (30); hidden, it costs nothing.
   Phones, either way up: the panel fills the screen inside the safe areas and scrolls; a round close button replaces
   the pill. */
.focus { position: fixed; inset: 0; z-index: 40; }
.focus:focus { outline: none; }
.focus-backdrop { position: absolute; inset: 0; background: rgba(5, 8, 22, 0.78); opacity: 0; }
.focus-panel {
  position: absolute;
  inset: max(28px, 4.5vh) max(28px, 4vw) calc(max(28px, 4.5vh) + 54px);
  display: grid; place-items: center;
  container-type: size;
}
.focus .focus-flying {
  transform-origin: 0 0;
  will-change: transform, opacity;
  box-shadow: 0 calc(var(--lift, 0) * 26px) calc(var(--lift, 0) * 60px) rgb(0 0 0 / calc(var(--lift, 0) * 0.5));
}
/* on the wall it is in the room's night light; lifted into the panel it is in full light. A face can set the light's
   colour, strength and blend (multiply: the face times the light on the wall, as the plate shows it) */
.focus-dim {
  position: absolute; inset: 0; z-index: 5;
  border-radius: inherit;
  background: var(--focus-dim-c, #0b0f2c);
  mix-blend-mode: var(--focus-dim-blend, normal);
  opacity: calc((1 - var(--lift, 1)) * var(--focus-dim, 0.5));
  pointer-events: none;
}
.focus-dim.focus-glow { background: var(--focus-glow-c); mix-blend-mode: screen; opacity: calc(1 - var(--lift, 1)); }
/* everything beside the face waits for it to land, and goes first when it is put back */
:is(.focus-panel:has([data-focus-face]), .focus-panel :has([data-focus-face])) > :not([data-focus-face]):not(:has([data-focus-face])),
.focus-bar, .focus-x { transition: opacity 0.28s var(--ease-out); }
.focus:not(.is-open) :is(.focus-panel:has([data-focus-face]), .focus-panel :has([data-focus-face])) > :not([data-focus-face]):not(:has([data-focus-face])),
.focus:not(.is-open) .focus-bar, .focus:not(.is-open) .focus-x { opacity: 0; pointer-events: none; transition-duration: 0.15s; }
.focus-bar {
  position: absolute; left: 50%; bottom: max(22px, calc(env(safe-area-inset-bottom) + 12px));
  display: flex; gap: 12px;
  transform: translateX(-50%);
}
.focus-x { display: none; }
body.focus-open .hud-top, body.focus-open .hud-bottom { opacity: 0; pointer-events: none; }
body.focus-open .hud-top *, body.focus-open .hud-bottom * { pointer-events: none; }
body.focus-open .tip { visibility: hidden; }
.hud-bottom { transition: opacity 0.35s ease; }

@media (max-width: 720px), (max-height: 540px) {
  .focus-backdrop { background: rgba(5, 8, 22, 0.94); }
  .focus-panel {
    inset: 0;
    padding: max(14px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) max(14px, env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left));
    place-items: start center;
    overflow-y: auto; overscroll-behavior: contain;
  }
  .focus-bar { display: none; }
  .focus-x {
    position: absolute; z-index: 2;
    top: max(10px, env(safe-area-inset-top)); right: max(10px, env(safe-area-inset-right));
    display: grid; place-items: center;
    width: 44px; height: 44px; padding: 0;
    border: 1.5px solid rgba(255, 244, 224, 0.82); border-radius: 50%;
    background: rgba(11, 16, 38, 0.78);
    color: var(--paper);
    cursor: pointer;
  }
  .focus-x svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }
  .focus-x:focus-visible { outline: 2px solid var(--lantern); outline-offset: 3px; }
  .focus-x.focus-share-x { right: calc(max(10px, env(safe-area-inset-right)) + 54px); }
  .focus-share-x svg { stroke-linejoin: round; }
}

@media (prefers-reduced-motion: reduce) {
  :is(.focus-panel:has([data-focus-face]), .focus-panel :has([data-focus-face])) > :not([data-focus-face]):not(:has([data-focus-face])),
  .focus-bar, .focus-x, .hud-bottom { transition: none; }
}

/* ---------- talks and trainings: the badge rack (badges.js) --------------
   The oak peg rail is painted into the room plate. The badges, their lanyards and clips swing in one small canvas over
   it (.badges, above the light maps like the cartridges; lit by badges.js); .hot-badges is the rack's hit area. In the
   focus view the badges come off the wall as readable cards: the same card stock, the event's colour as the printed
   header, the role band at the foot, in a clear sleeve with its slot. */
.badges { pointer-events: none; }

.talks {
  display: flex; flex-direction: column;
  width: min(100cqw, 78rem);
  max-height: 100cqh;
  container: talks / inline-size;
}
.talks-top { flex: none; margin: 0 0 1rem; text-align: center; }
.talks-title { margin: 0; font: 800 clamp(1.5rem, 1.2rem + 1vw, 2.1rem) / 1.1 var(--round); color: var(--paper); text-wrap: balance; }
.talks-sub { margin: 0.35rem 0 0; font-size: 1rem; color: var(--paper-dim); }
/* the face that flies off the wall; on short screens it scrolls (focusable then, badges.js) and fades at the edge with more */
.talks-list {
  list-style: none; margin: 0; padding: 18px 12px 16px;
  min-height: 0;
  overflow-y: auto; overscroll-behavior: contain;
  scrollbar-width: thin; scrollbar-color: rgba(255, 244, 224, 0.45) transparent;
  display: grid; gap: 1.6rem 1.1rem;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 13.25rem), 1fr));
  align-items: stretch;
  border-radius: 10px;
}
.talks-list:focus-visible { outline: 2px solid var(--lantern); outline-offset: 2px; }
.talks-list.more-down { -webkit-mask: linear-gradient(#000 calc(100% - 46px), transparent); mask: linear-gradient(#000 calc(100% - 46px), transparent); }
.talks-list.more-up { -webkit-mask: linear-gradient(transparent, #000 46px); mask: linear-gradient(transparent, #000 46px); }
.talks-list.more-up.more-down { -webkit-mask: linear-gradient(transparent, #000 46px, #000 calc(100% - 46px), transparent); mask: linear-gradient(transparent, #000 46px, #000 calc(100% - 46px), transparent); }
.talk { display: flex; }
/* the clear vinyl sleeve (a pale rim and its slot) round the printed card */
.talk-card {
  position: relative;
  flex: 1;
  display: flex; flex-direction: column;
  min-height: 17.5rem;
  margin: 16px 0 0;
  border-radius: 6px;
  color: #23252e;
  background:
    linear-gradient(118deg, rgba(255, 255, 255, 0) 30%, rgba(255, 255, 255, 0.22) 36%, rgba(255, 255, 255, 0) 44%),
    url("../img/badges/badge-parts.webp") 80.6% 4.4% / 236.4% 122.1% no-repeat,
    #f3efe4;
  box-shadow: 0 0 0 6px rgba(206, 232, 236, 0.32), 0 0 0 7px rgba(16, 20, 30, 0.55), 0 14px 26px rgba(0, 0, 0, 0.38);
}
.talk-card::before {
  content: "";
  position: absolute; left: 50%; top: -14px;
  width: 36px; height: 8px; margin-left: -18px;
  border-radius: 5px;
  background: rgba(5, 8, 22, 0.92);
  box-shadow: inset 0 0 0 1px rgba(206, 232, 236, 0.5);
}
.talk-event {
  margin: 0;
  padding: 0.85rem 0.9rem 0.8rem;
  border-radius: 6px 6px 0 0;
  background: var(--c);
  color: #fff;
  font: 800 1.15rem / 1.2 var(--round);
  text-wrap: balance;
}
.talk-meta { margin: 0.85rem 0.9rem 0; font-size: 0.95rem; line-height: 1.4; color: #3e414c; }
.talk-meta time { font-weight: 800; color: #23252e; }
.talk-session { margin: 0.7rem 0.9rem 0; font-size: 0.95rem; line-height: 1.45; color: #23252e; }
/* the sessions he gave there: "Kind: title (aside) · link", under a caption for each day where there are several */
.talk-sessions { margin: 0.7rem 0.9rem 0; font-size: 0.95rem; line-height: 1.45; color: #23252e; }
.talk-sessions ul { margin: 0; padding: 0; list-style: none; }
.talk-sessions li { text-wrap: pretty; }
.talk-sessions li + li { margin-top: 0.4rem; }
.talk-day { margin: 0.8rem 0 0.25rem; font: 800 0.8rem / 1.3 var(--round); letter-spacing: 0.02em; color: #4a4d58; }
.talk-day:first-child { margin-top: 0; }
.talk-kind { font-weight: 800; }
.talk-aside, .talk-dot { color: #4a4d58; }
/* the link keeps its separator: "· Workshop site" wraps as one */
.talk-refs { white-space: nowrap; }
.talk-ref { font-weight: 800; color: #23252e; text-underline-offset: 3px; }
.talk-ref:hover { color: var(--c); }
.talk-ref:focus-visible { outline: 2px solid #23252e; outline-offset: 2px; border-radius: 3px; }
.talk-note { margin: 0.55rem 0.9rem 0; font-size: 0.88rem; line-height: 1.4; color: #4a4d58; font-style: italic; }
.talk-link { align-self: flex-start; margin: 0.7rem 0.9rem 0; padding: 0.15rem 0; font-size: 0.95rem; font-weight: 800; color: #23252e; text-underline-offset: 3px; }
.talk-link:hover { color: var(--c); }
.talk-link:focus-visible { outline: 2px solid #23252e; outline-offset: 3px; border-radius: 3px; }
.talk-role {
  margin: auto 0 0;
  padding: 0.55rem 0.9rem 0.6rem;
  border-radius: 0 0 6px 6px;
  background: var(--c);
  color: #fff;
  font-size: 0.85rem; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase;
}
.talk-session + .talk-role, .talk-meta + .talk-role, .talk-note + .talk-role, .talk-link + .talk-role { margin-top: auto; }
.talk-card > :nth-last-child(2) { margin-bottom: 1rem; }
/* each card's share button sits on its printed header (badges.js); a card or a session a deep link points to is ringed
   in gold and its line marked (deeplinks.js) */
.talk-share {
  position: absolute; top: 0.45rem; right: 0.45rem; z-index: 1;
  display: grid; place-items: center;
  width: 32px; height: 32px; padding: 0;
  border: 1.5px solid rgba(255, 255, 255, 0.8); border-radius: 50%;
  background: rgba(0, 0, 0, 0.16);
  color: #fff;
  cursor: pointer;
}
.talk-share svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.talk-share:hover { background: rgba(0, 0, 0, 0.32); }
.talk-share:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.talk-share + .talk-event { padding-right: 2.9rem; }
.talk.is-target .talk-card { box-shadow: 0 0 0 5px rgba(255, 215, 94, 0.5), 0 0 0 8px var(--gold), 0 14px 26px rgba(0, 0, 0, 0.38); }
.talk.is-target .talk-card:focus { outline: none; }
.talk-sessions li.is-target { background: rgba(255, 215, 94, 0.5); box-shadow: 0 0 0 4px rgba(255, 215, 94, 0.5); border-radius: 2px; }
.talk-sessions li:focus { outline: none; }
/* an event with many sessions takes two columns where three fit in a row (with two, it would leave a hole beside it) */
@container talks (width >= 43.5rem) {
  .talk.is-wide { grid-column: span 2; }
}

@container (max-height: 660px) {
  .talks-top { margin-bottom: 0.5rem; }
  .talk-card { min-height: 0; }
}
@media (max-width: 720px), (max-height: 540px) {
  .talks { width: 100%; max-height: none; padding: 3.5rem 0.25rem 1.5rem; }
  .talks-list { overflow: visible; padding: 14px 4px 4px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 10.5rem), 1fr)); gap: 1.4rem 0.9rem; }
  /* one column until three fit, so the two-column card never leaves a hole */
  @container talks (width < 33.8rem) {
    .talks-list { grid-template-columns: minmax(0, 1fr); }
  }
  @container talks (width >= 33.8rem) {
    .talk.is-wide { grid-column: span 2; }
  }
  .talk-card { min-height: 0; }
  .talk-event { font-size: 1.05rem; padding: 0.75rem 0.75rem 0.7rem; }
  .talk-meta, .talk-session, .talk-sessions, .talk-note, .talk-link { margin-left: 0.75rem; margin-right: 0.75rem; }
  .talk-role { padding: 0.5rem 0.75rem; }
}

/* ---------- "About me" poster (poster.js) --------------------------------
   The poster is painted into the room plate. .hot-poster is its hit area: the poster less the TV in front of its lower
   left corner (an SVG polygon, so a click on the TV's bezel is not a click on the poster), with a warm light over it on
   hover and a dashed ring along its edge for the keyboard. In the focus view the painting sits beside its billing
   block: cream print on a dark sheet with a printed frame line, the highlights as festival laurels. */
.hot-poster { pointer-events: none; }
.hot-poster svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.poster-hit { fill: rgb(255 214 150 / 0); pointer-events: fill; cursor: pointer; transition: fill 0.25s ease; }
.hot-poster:hover .poster-hit, .hot-poster:focus-visible .poster-hit { fill: rgb(255 214 150 / 0.1); }
.poster-ring { fill: none; stroke: none; stroke-width: 3; stroke-dasharray: 10 7; stroke-linejoin: round; }
.hot-poster:focus-visible { outline: none; }
.hot-poster:focus-visible .poster-ring { stroke: rgb(255 244 224 / 0.85); }
.cart-strip .chip-focus i { background: #2bb3a3 center / cover no-repeat; box-shadow: inset 0 0 0 1.5px rgb(255 244 224 / 0.7); }

.poster-view {
  --sheet: #121834;
  --pad-x: clamp(22px, 2.4cqw, 40px);
  position: relative;
  /* the panel's size, not a percentage: a percentage of its auto grid row would grow with the text */
  width: 100cqw; height: 100cqh;
  display: flex; align-items: center; justify-content: center;
  gap: clamp(20px, 3cqw, 52px);
}
.laurel-defs { position: absolute; width: 0; height: 0; }
/* the painting: as tall as the panel allows, leaving the billing block 380 px */
.poster-face {
  flex: none; position: relative; margin: 0;
  height: min(100cqh, calc((100cqw - 380px - clamp(20px, 3cqw, 52px)) * 2048 / 1442));
  aspect-ratio: 1442 / 2048;
  background: #6d93b8;
  box-shadow: 0 22px 56px rgb(0 0 0 / 0.55), 0 4px 12px rgb(0 0 0 / 0.35);
  /* on the wall: the painting times the light on it in the room (poster.js sets --focus-dim-c to that light's image) */
  --focus-dim-blend: multiply; --focus-dim: 1;
}
.poster-face img { display: block; width: 100%; height: 100%; }

.billing {
  flex: 0 1 600px; min-width: 320px; max-height: 100%;
  position: relative;
  overflow-y: auto; overscroll-behavior: contain;
  padding: clamp(18px, 3.6cqh, 40px) var(--pad-x) clamp(16px, 3cqh, 34px);
  background: var(--sheet);
  outline: 1px solid rgb(255 244 224 / 0.3); outline-offset: -10px;
  box-shadow: 0 22px 56px rgb(0 0 0 / 0.5), 0 4px 12px rgb(0 0 0 / 0.3);
  color: var(--paper);
  text-align: center;
  scrollbar-width: thin; scrollbar-color: rgb(255 244 224 / 0.45) transparent;
}
.billing:focus-visible { outline: 2px solid var(--lantern); outline-offset: -4px; }
.billing-name { margin: 0; font: 800 clamp(30px, 4.6cqh, 48px)/1 var(--round); letter-spacing: 0.02em; text-transform: uppercase; text-wrap: balance; }
.billing-role { margin: clamp(8px, 1.6cqh, 12.75px) 0 0; font-size: 17px; line-height: 1.45; }
.billing-employer { white-space: nowrap; }
/* narrow: the employer and the country on lines of their own, without the dot */
@media (max-width: 560px) {
  .billing-sep { display: none; }
  .billing-employer { display: block; }
}
.billing-meta { margin: 0.35em 0 0; font-size: 16px; line-height: 1.4; letter-spacing: 0.1em; text-transform: uppercase; color: var(--gold); }
.billing-headline {
  margin: clamp(12px, 2.4cqh, 21px) auto 0; padding-top: clamp(12px, 2.4cqh, 20px); max-width: 36ch;
  border-top: 1px solid rgb(255 244 224 / 0.22);
  font: 800 clamp(18px, 2.4cqh, 21px)/1.42 var(--round); text-wrap: balance;
}
.billing-intro { margin: clamp(8px, 1.6cqh, 12px) auto 0; max-width: 48ch; font-size: 16px; line-height: 1.6; color: var(--paper-dim); text-wrap: pretty; }

/* the highlights: festival laurels, the figure between two branches, what it means under it */
.laurels {
  list-style: none; margin: clamp(12px, 2.6cqh, 22px) 0 0; padding: clamp(12px, 2.4cqh, 21px) 0 0;
  border-top: 1px solid rgb(255 244 224 / 0.22);
  display: flex; flex-wrap: wrap; justify-content: center; align-items: flex-start; gap: clamp(10px, 2cqh, 18px) 10px;
}
/* three to a row while each keeps 150 px, else two */
.laurel { flex: 0 0 clamp(150px, calc((100% - 20px) / 3), 174px); display: grid; grid-template-columns: 22px minmax(0, 1fr) 22px; align-items: center; gap: 4px; color: var(--gold); }
.laurel-branch { width: 22px; height: 74px; fill: currentColor; }
.laurel-r { transform: scaleX(-1); }
.laurel-body { display: grid; gap: 4px; justify-items: center; }
.laurel-value { font: 800 22px/1.05 var(--round); white-space: nowrap; }
.laurel-text { font-size: 16px; line-height: 1.3; color: var(--paper); text-wrap: balance; }
a.laurel-text { text-decoration: underline; text-decoration-color: rgb(255 215 94 / 0.65); text-underline-offset: 3px; }
a.laurel-text:hover { color: var(--gold); }
a.laurel-text:focus-visible { outline: 2px solid var(--lantern); outline-offset: 3px; border-radius: 3px; }

/* more below (the block scrolls on short screens): a fade and a chevron at its foot */
.poster-more {
  position: sticky; bottom: 0; z-index: 1;
  display: flex; justify-content: center; align-items: flex-end;
  height: 58px; margin: -58px calc(-1 * var(--pad-x)) 0; padding-bottom: 6px;
  background: linear-gradient(to bottom, rgb(18 24 52 / 0), var(--sheet) 72%);
  pointer-events: none; opacity: 0; transition: opacity 0.2s ease;
}
.poster-view.has-more .poster-more { opacity: 1; }
.poster-more svg {
  width: 34px; height: 34px; padding: 6px;
  border: 1.5px solid rgb(255 244 224 / 0.8); border-radius: 50%;
  background: var(--sheet);
  fill: none; stroke: var(--paper); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round;
  pointer-events: auto; cursor: pointer;
}
.poster-view:not(.has-more) .poster-more svg { pointer-events: none; }

/* phones: the painting on top (on its side: at the left, and it stays while the text scrolls), the text under it; the
   whole view scrolls, clear of the close button */
@media (max-width: 720px), (max-height: 540px) {
  .poster-view {
    flex-direction: column; justify-content: flex-start;
    gap: 16px;
    padding-top: 46px;
    overflow-y: auto; overscroll-behavior: contain;
  }
  .poster-face { height: auto; width: min(100%, calc((100cqh - 46px) * 1442 / 2048)); }
  .billing { flex: none; width: 100%; min-width: 0; max-height: none; overflow: visible; }
  .laurel { flex-basis: 148px; }
}
@media (max-height: 540px) and (min-aspect-ratio: 1/1) {
  .poster-view { flex-direction: row; align-items: flex-start; }
  .poster-face { position: sticky; top: 0; width: auto; height: calc(100cqh - 46px); }
  .billing { flex: 1 1 auto; width: auto; }
}
@media (prefers-reduced-motion: reduce) {
  .poster-hit, .poster-more { transition: none; }
}

/* ---------- "My current focus": the whiteboard (whiteboard.js) -----------------------------------------------------
   A 70 × 50 cm whiteboard leans against the window's left pane behind the crate. Its front and the right end of its
   frame are two canvases at their own pixel size laid on their projected corners (matrix3d, origin 0 0), lit in code;
   they sit at the cartridges' z-index just before #crate, so the cartridges stand in front of them and the light maps
   lie under them. .hot-whiteboard is its hit area: the board less the cartridges in front of it and their hover lift
   (a clip-path polygon), with a warm light over it on hover and a dashed ring along its edge for the keyboard (.wb-deco).
   In the focus view the board sits beside its sheet, the poster's billing block: cream print on a dark sheet with a
   printed frame line, each topic with the workshops and repositories behind it and its official page. Kalam (Bold) is
   the marker's hand: on the board, and on the sticky note on the monitor (room.js). */
@font-face {
  font-family: "Kalam";
  src: url("../fonts/kalam-700-latin.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}
.whiteboard { display: block; transform-origin: 0 0; z-index: 15; }
/* the button is the hit area (a clip-path polygon, set by whiteboard.js) and paints nothing; its warm light and focus
   ring are an SVG on the board, under the cartridges (.wb-deco, at their z-index before #crate), shown only while the
   board is hovered or has the keyboard's focus (.is-on), so idle they cost no backing store */
.hot-whiteboard:focus-visible { outline: none; }
.wb-deco { position: absolute; display: none; z-index: 15; overflow: visible; pointer-events: none; }
.wb-deco.is-on { display: block; }
.wb-hit { fill: rgb(255 214 150 / 0.1); }
.wb-ring { fill: none; stroke: none; stroke-width: 3; stroke-dasharray: 10 7; stroke-linejoin: round; }
.wb-deco.is-ring .wb-ring { stroke: rgb(255 244 224 / 0.85); }

.wb-view {
  --sheet: #121834;
  --pad-x: clamp(20px, 2.2cqw, 36px);
  --gap: clamp(20px, 3cqw, 52px);
  position: relative;
  width: 100cqw; height: 100cqh;
  display: flex; align-items: center; justify-content: center;
  gap: var(--gap);
}
/* the board: as large as the panel allows, leaving the sheet 400 px */
.wb-face {
  flex: none; position: relative; margin: 0;
  width: min(calc(100cqw - 400px - var(--gap)), calc(100cqh * 1600 / 1143), 1180px);
  aspect-ratio: 1600 / 1143;
  /* on the window: the board times the light on it in the room (whiteboard.js sets --focus-dim-c to that light) */
  --focus-dim-blend: multiply; --focus-dim: 1;
}
/* its outline is the painted board's (rounded corner caps, the tray narrower than the frame): the light and the
   shadow follow it, not the box */
.wb-face > .focus-dim { -webkit-mask: url("../img/whiteboard/board.webp") 0 0 / 100% 100% no-repeat; mask: url("../img/whiteboard/board.webp") 0 0 / 100% 100% no-repeat; }
.focus .wb-face.focus-flying { box-shadow: none; }
.wb-art { display: block; width: 100%; height: 100%; filter: drop-shadow(0 18px 34px rgb(0 0 0 / 0.5)) drop-shadow(0 3px 8px rgb(0 0 0 / 0.35)); }

.wb-sheet {
  flex: 0 1 560px; min-width: 340px; max-height: 100%;
  position: relative;
  overflow-y: auto; overscroll-behavior: contain;
  padding: clamp(18px, 3.4cqh, 36px) var(--pad-x) clamp(16px, 3cqh, 30px);
  background: var(--sheet);
  outline: 1px solid rgb(255 244 224 / 0.3); outline-offset: -10px;
  box-shadow: 0 22px 56px rgb(0 0 0 / 0.5), 0 4px 12px rgb(0 0 0 / 0.3);
  color: var(--paper);
  scrollbar-width: thin; scrollbar-color: rgb(255 244 224 / 0.45) transparent;
}
.wb-sheet:focus-visible { outline: 2px solid var(--lantern); outline-offset: -4px; }
.wb-title { margin: 0; font: 800 clamp(26px, 4cqh, 40px)/1.05 var(--round); letter-spacing: 0.02em; text-transform: uppercase; text-align: center; text-wrap: balance; }
.wb-topics { list-style: none; margin: clamp(10px, 2cqh, 18px) 0 0; padding: 0; }
.wb-topic { padding: clamp(12px, 2.2cqh, 18px) 0 clamp(4px, 1cqh, 8px); border-top: 1px solid rgb(255 244 224 / 0.22); }
.wb-topic-title { display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 12px; align-items: baseline; margin: 0; font: 800 19px/1.32 var(--round); text-wrap: balance; }
.wb-num {
  display: grid; place-items: center; width: 28px; height: 28px; align-self: start;
  border: 1.5px solid rgb(255 215 94 / 0.85); border-radius: 50%;
  color: var(--gold); font: 800 15px/1 var(--round);
}
/* what the board says about it, in the marker's blue */
.wb-tag { margin: 4px 0 0 42px; font-size: 15px; line-height: 1.4; color: #a9c1ff; }
/* a topic's share button at the end of its title (whiteboard.js), and a topic a deep link points to (deeplinks.js) */
.wb-topic-title { grid-template-columns: 30px minmax(0, 1fr) auto; }
.wb-share {
  align-self: start;
  display: grid; place-items: center;
  width: 44px; height: 44px; margin: -3px 0 0; padding: 0;
  border: 1.5px solid rgb(255 244 224 / 0.55); border-radius: 50%;
  background: none;
  color: var(--paper-dim);
  cursor: pointer;
}
.wb-share svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.wb-share:hover { color: var(--gold); border-color: var(--gold); }
.wb-share:focus-visible { outline: 2px solid var(--lantern); outline-offset: 2px; }
.wb-topic.is-target { border-top-color: var(--gold); box-shadow: inset 3px 0 0 var(--gold); padding-left: 10px; margin-left: -10px; }
.wb-topic.is-target:focus { outline: none; }
.wb-topic-text { margin: 8px 0 0 42px; max-width: 62ch; font-size: 16px; line-height: 1.6; color: var(--paper-dim); text-wrap: pretty; }
.wb-refs { list-style: none; margin: 12px 0 0 42px; padding: 0; display: grid; gap: 10px; }
.wb-ref { display: grid; gap: 3px; padding: 9px 12px 10px; border-left: 2px solid rgb(255 215 94 / 0.55); background: rgb(255 244 224 / 0.04); }
.wb-kind { font: 800 12px/1.2 var(--round); letter-spacing: 0.1em; text-transform: uppercase; color: var(--gold); }
.wb-ref-title { font: 800 16px/1.35 var(--round); }
.wb-ref a { text-decoration: underline; text-decoration-color: rgb(255 215 94 / 0.65); text-underline-offset: 3px; }
.wb-ref a:hover { color: var(--gold); }
.wb-ref a:focus-visible { outline: 2px solid var(--lantern); outline-offset: 3px; border-radius: 3px; }
.wb-ref-url { font-size: 13px; line-height: 1.35; color: rgb(233 220 196 / 0.7); overflow-wrap: anywhere; }
.wb-ref-text { font-size: 15px; line-height: 1.5; color: var(--paper-dim); text-wrap: pretty; }
.wb-ref-more { font-size: 14px; line-height: 1.4; }
/* the official page behind the topic's facts */
.wb-source { margin: 12px 0 0 42px; font-size: 14px; line-height: 1.45; color: rgb(233 220 196 / 0.8); }
.wb-source-label { font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; font-size: 12px; color: var(--gold); }
.wb-source a { color: var(--paper); text-decoration: underline; text-decoration-color: rgb(255 215 94 / 0.65); text-underline-offset: 3px; }
.wb-source a:hover { color: var(--gold); }
.wb-source a:focus-visible { outline: 2px solid var(--lantern); outline-offset: 3px; border-radius: 3px; }

/* more below (the sheet scrolls): a fade and a chevron at its foot */
.wb-more {
  position: sticky; bottom: calc(-1 * clamp(16px, 3cqh, 30px)); z-index: 1;
  display: flex; justify-content: center; align-items: flex-end;
  height: 58px; margin: -58px calc(-1 * var(--pad-x)) calc(-1 * clamp(16px, 3cqh, 30px)); padding-bottom: 8px;
  background: linear-gradient(to bottom, rgb(18 24 52 / 0), var(--sheet) 72%);
  pointer-events: none; opacity: 0; transition: opacity 0.2s ease;
}
.wb-view.has-more .wb-more { opacity: 1; }
.wb-more svg {
  width: 34px; height: 34px; padding: 6px;
  border: 1.5px solid rgb(255 244 224 / 0.8); border-radius: 50%;
  background: var(--sheet);
  fill: none; stroke: var(--paper); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round;
  pointer-events: auto; cursor: pointer;
}
.wb-view:not(.has-more) .wb-more svg { pointer-events: none; }

/* phones: the board on top (on its side: at the left, and it stays while the text scrolls), the sheet under it; the
   whole view scrolls, clear of the close button */
@media (max-width: 720px), (max-height: 540px) {
  .wb-view {
    flex-direction: column; justify-content: flex-start;
    gap: 16px;
    padding-top: 46px;
    overflow-y: auto; overscroll-behavior: contain;
  }
  .wb-face { width: min(100%, calc((100cqh - 46px) * 1600 / 1143)); }
  /* the backdrop is all but black here: no shadow, whose filter would make the board a layer several times its size */
  .wb-art { filter: none; }
  .wb-sheet { flex: none; width: 100%; min-width: 0; max-height: none; overflow: visible; }
  .wb-tag, .wb-topic-text, .wb-refs, .wb-source { margin-left: 0; }
}
@media (max-height: 540px) and (min-aspect-ratio: 1/1) {
  .wb-view { flex-direction: row; align-items: flex-start; }
  .wb-face { position: sticky; top: 0; width: min(55%, calc((100cqh - 46px) * 1600 / 1143)); }
  .wb-sheet { flex: 1 1 auto; width: auto; }
}
@media (prefers-reduced-motion: reduce) {
  .wb-more { transition: none; }
}

/* ---------- JG-DOS: the PC's DOS shell (dos/shell.js, dos/terminal.js) ---------------------------------------------
   Clicked, the PC's monitor comes off the desk into the focus view: its painted front (assets/img/pc/monitor.webp, MAI
   art repainted from a straight-on view of the painted monitor, so its glass is the plate's), the glass a text-mode
   screen in DotGothic16: amber phosphor on the dark glass, the glass's reflection (monitor-shine.webp) added over the
   text like light. On the desk the monitor wears the room's light (--focus-dim-c, multiplied); the text, self-lit, does
   not. Beside it the quick commands. Phones: the glass alone fills the screen above the keyboard (visualViewport), with
   the quick commands under it, and the room is skipped beneath it. Nothing here is in the world. */
.dos {
  --dos-ink: #ffc062;
  --dos-bright: #ffe2a8;
  --dos-dim: #eab06a;
  --dos-glass: #13202a;
  --dos-dark: #120c05;
  position: relative;
  width: 100cqw; height: 100cqh;
  display: flex; align-items: center; justify-content: center;
  gap: clamp(16px, 2.4cqw, 32px);
}
.dos-head { display: none; }
.dos-screen {
  position: relative; flex: none;
  aspect-ratio: 1187 / 1225;
  width: min(calc(100cqh * 1187 / 1225), calc(100cqw - 17rem - 32px));
  isolation: isolate;
  --focus-dim-blend: multiply; --focus-dim: 1;
}
.focus .dos-screen.focus-flying { box-shadow: none; }
/* the light on the desk only where the monitor is (not on the art's transparent corners) */
.dos-screen:has(> .dos-art) > .focus-dim {
  -webkit-mask: url("../img/pc/monitor.webp") 0 0 / 100% 100% no-repeat;
  mask: url("../img/pc/monitor.webp") 0 0 / 100% 100% no-repeat;
}
.dos-art { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; user-select: none; pointer-events: none; }
.dos-glass {
  position: absolute; z-index: 6;
  inset: var(--glass-t, 0) var(--glass-r, 0) var(--glass-b, 0) var(--glass-l, 0);
  overflow: hidden;
}
.dos-scroll {
  position: absolute; inset: 0;
  overflow-y: auto; overscroll-behavior: contain;
  scrollbar-width: none;
  font: 400 var(--fs, 16px) / var(--lh, 1.25) var(--pixel);
  letter-spacing: 0;
  color: var(--dos-ink);
  text-shadow: 0 0 0.3em rgb(255 168 64 / 0.4);
  -webkit-font-smoothing: antialiased;
}
.dos-scroll::-webkit-scrollbar { display: none; }
.dos-log, .dos-cmd, .dos-more { width: calc(var(--cols, 80) * 1ch); margin-inline: auto; }
.dos ::selection { background: var(--dos-ink); color: var(--dos-dark); text-shadow: none; }
.dos-l {
  min-height: calc(var(--lh, 1.25) * 1em);
  white-space: pre-wrap; overflow-wrap: anywhere;
  padding-left: calc(var(--hang, 0) * 1ch); text-indent: calc(var(--hang, 0) * -1ch);
}
.dos .is-bright, .dos .is-err, .dos .is-ok { color: var(--dos-bright); text-shadow: 0 0 0.35em rgb(255 196 110 / 0.5); }
.dos .is-dim { color: var(--dos-dim); }
/* inverse video: a title row, a speaker's name */
.dos-l.is-title, .dos-l.is-speaker > span { background: var(--dos-ink); color: var(--dos-dark); text-shadow: none; }
/* diagrams (AGENT /ARCH): DotGothic16 has no box-drawing glyphs, so each cell draws its own half-lines (l r u d) or
   arrowhead (e w n s), one column wide and one line high, so a line meets the next row's; never wrapped */
.dos-l.is-diagram { white-space: pre; overflow: hidden; text-indent: 0; padding-left: 0; }
.dos-bx {
  --t: max(1px, 0.09em); --l: 0; --r: 0; --u: 0; --d: 0;
  display: inline-block; width: 1ch; height: 1lh; vertical-align: top;
  background:
    linear-gradient(currentColor, currentColor) 0 50% / calc(var(--l) * (50% + var(--t) / 2)) var(--t) no-repeat,
    linear-gradient(currentColor, currentColor) 100% 50% / calc(var(--r) * (50% + var(--t) / 2)) var(--t) no-repeat,
    linear-gradient(currentColor, currentColor) 50% 0 / var(--t) calc(var(--u) * (50% + var(--t) / 2)) no-repeat,
    linear-gradient(currentColor, currentColor) 50% 100% / var(--t) calc(var(--d) * (50% + var(--t) / 2)) no-repeat;
}
.dos-bx[data-bx*="l"] { --l: 1; }
.dos-bx[data-bx*="r"] { --r: 1; }
.dos-bx[data-bx*="u"] { --u: 1; }
.dos-bx[data-bx*="d"] { --d: 1; }
.dos-bx[data-bx="e"], .dos-bx[data-bx="w"], .dos-bx[data-bx="n"], .dos-bx[data-bx="s"] { background: currentColor; }
.dos-bx[data-bx="e"] { clip-path: polygon(10% 32%, 90% 50%, 10% 68%); }
.dos-bx[data-bx="w"] { clip-path: polygon(90% 32%, 10% 50%, 90% 68%); }
.dos-bx[data-bx="n"] { clip-path: polygon(12% 64%, 50% 34%, 88% 64%); }
.dos-bx[data-bx="s"] { clip-path: polygon(12% 36%, 50% 66%, 88% 36%); }
/* names in listings: a click or a tap opens them */
.dos-b {
  all: unset;
  text-indent: 0; /* a button lays out as an inline block: the line's hanging indent must not move its text */
  white-space: pre;
  cursor: pointer;
  text-decoration: underline dotted rgb(255 192 98 / 0.55);
  text-decoration-thickness: max(1px, 0.0625em);
  text-underline-offset: 0.2em;
  -webkit-tap-highlight-color: transparent;
}
.dos-b:hover, .dos-a:hover { background: var(--dos-ink); color: var(--dos-dark); text-shadow: none; text-decoration: none; }
.dos-b:focus-visible, .dos-a:focus-visible, .dos-more:focus-visible { outline: 2px solid var(--dos-bright); outline-offset: 1px; text-decoration: none; }
.dos-a {
  color: var(--dos-bright);
  text-decoration: underline; text-decoration-thickness: max(1px, 0.0625em); text-underline-offset: 0.2em;
  -webkit-tap-highlight-color: transparent;
}
/* a short link after a line of text is a tag, "[IMDb ↗]": bracketed, and taller to touch than its row */
.dos-a.dos-tag { text-decoration: none; padding-block: 0.35em; margin-block: -0.35em; }
.dos-a.dos-tag::before { content: "["; }
.dos-a.dos-tag::after { content: "]"; }
.dos-ext { display: inline-block; width: 1ch; height: 1em; vertical-align: -0.12em; overflow: visible; }
/* the command line; while a command runs it is out of sight, though what is typed waits on it */
.dos-cmd { display: flex; white-space: pre; min-height: calc(var(--lh, 1.25) * 1em); }
.dos-cmd.is-idle { opacity: 0; }
.dos-cmd[hidden] { display: none; }
.dos-ps { flex: none; }
.dos-field { position: relative; flex: 1; min-width: 0; }
.dos-in {
  all: unset;
  display: block; box-sizing: border-box;
  width: 100%; height: calc(var(--lh, 1.25) * 1em);
  font: inherit; color: inherit; text-shadow: inherit; letter-spacing: 0;
  caret-color: transparent;
  -webkit-text-fill-color: currentColor;
}
/* the DOS cursor: a blinking underline under the character at the caret; dim and still while the line is not focused */
.dos-cur {
  position: absolute; left: var(--x, 0px); top: calc((var(--lh, 1.25) - 1.448) * 0.5em + 1.12em);
  width: 1ch; height: 0.125em;
  background: currentColor;
  opacity: 0.4;
  pointer-events: none;
}
.dos-cur.is-on { opacity: 1; animation: dosblink 1.06s steps(1) infinite; }
@keyframes dosblink { 50% { opacity: 0; } }
.dos-more {
  all: unset;
  display: block;
  box-sizing: border-box;
  min-height: calc(var(--lh, 1.25) * 1em);
  cursor: pointer;
}
.dos-more > span { padding: 0 1ch; background: var(--dos-ink); color: var(--dos-dark); text-shadow: none; }
/* the reflection lies on the glass, over the text: it adds light */
.dos-shine { position: absolute; z-index: 7; pointer-events: none; user-select: none; mix-blend-mode: screen; mix-blend-mode: plus-lighter; opacity: calc(var(--lift, 1) * 0.45); }
/* the monitor's own power button and light (painted), a real button over the painted one */
.dos-power {
  position: absolute; z-index: 8;
  padding: 0; border: 0; border-radius: 50%;
  background: transparent;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.2s ease;
}
.dos-power:hover { background: rgb(255 246 226 / 0.16); }
.dos-power:focus-visible { outline: 2px solid var(--lantern); outline-offset: 2px; }
.dos-led { position: absolute; z-index: 8; border-radius: 50%; background: #79ffa6; box-shadow: 0 0 0.35em 0.12em rgb(90 255 150 / 0.65); opacity: var(--lift, 1); pointer-events: none; }
/* beside the monitor, in two columns (under it where the view is narrow): a button for every part of the site, the
   programs, then the quick commands; all the site's pills. A shortcut types its command into the command line and runs
   it (shell.js typeIn); while a program, a question or -- More -- has the screen, the shortcuts rest (aria-disabled) */
.dos-side { flex: none; width: 17rem; display: flex; flex-direction: column; gap: 18px; }
.dos-nav-host { display: contents; }
.dos-nav-triggers { display: none; }
.dos-nav-sheet { display: none; }
.dos-nav { display: flex; flex-direction: column; gap: 18px; }
.dos-nav-trigger { min-height: 44px; }
.dos-nav-trigger.is-cue { position: relative; isolation: isolate; animation: hero-nudge 1.1s cubic-bezier(0.37, 0, 0.36, 1) 3 both; }
.dos-nav-trigger.is-cue::before {
  content: ""; position: absolute; inset: -2px; z-index: -1; border-radius: inherit;
  box-shadow: 0 0 12px 3px rgb(255 192 98 / 0.8), 0 0 30px 8px rgb(255 192 98 / 0.3);
  opacity: 0; pointer-events: none; animation: hero-glow 1.1s ease-in-out 3 both;
}
.dos-nav-sheet[open] {
  display: block; position: fixed; inset: auto 0 0; box-sizing: border-box;
  width: 100%; max-width: none; max-height: min(72dvh, 560px); margin: 0;
  overflow: auto; padding: 14px max(16px, env(safe-area-inset-right)) max(18px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  border: 2px solid rgb(255 244 224 / 0.56); border-bottom: 0; border-radius: 18px 18px 0 0;
  background: linear-gradient(180deg, #253746, #101a2b 82%); color: var(--paper);
  box-shadow: 0 -12px 38px rgba(0, 0, 0, 0.56);
}
.dos-nav-sheet::backdrop { background: rgba(3, 5, 13, 0.7); }
.dos-nav-sheet-head { position: sticky; top: -14px; z-index: 1; display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: -14px 0 12px; padding: 14px 0 10px; background: #1d2c3b; }
.dos-nav-sheet-head h2 { margin: 0; color: var(--dos-bright); font: 400 18px/1.2 var(--pixel); }
.dos-nav-sheet .dos-nav-sheet-head .dos-nav-close { min-height: 44px; }
.dos-nav-sheet .dos-nav { width: auto; flex-direction: column; flex-wrap: nowrap; gap: 16px; }
.dos-nav-sheet .dos-group { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.dos-nav-sheet .dos-group-name { display: block; margin: 0 0 2px; color: var(--dos-bright); }
.dos-nav-sheet .dos-go { width: 100%; min-height: 48px; justify-content: flex-start; padding-inline: 14px; white-space: normal; text-align: left; }
.dos-nav-sheet .dos-group-programs .dos-go { grid-column: auto; }
.dos-nav-sheet .dos-go-hero { justify-content: space-between; }
.dos-nav-sheet [hidden] { display: none !important; }
.dos-group { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.dos-group-name {
  grid-column: 1 / -1; margin: 0 0 1px 3px;
  font: 500 11px / 1.2 var(--round); letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--paper-dim);
}
.dos-group-programs .dos-go { grid-column: 1 / -1; }
.dos-group-keys { display: flex; flex-direction: column; gap: 8px; }
.dos-keys { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.dos-key { min-width: 0; }
.dos-go { padding: 0 12px; white-space: nowrap; }
.dos-nav.is-off .dos-go { opacity: 0.4; cursor: default; }
.dos-nav.is-off .dos-go:hover { background: rgba(11, 16, 38, 0.38); color: var(--paper); }
.dos-key-icon { min-width: 0; width: 44px; height: 44px; padding: 0; }
/* Free the agent (AGENT.EXE, shell.js navGroups' hero): the programs' first, filled with the phosphor's amber, taller,
   in the screen's pixel face with a chevron. As the PC view opens it glows a few times (shell.js cue: silent, it ends at
   the visitor's first key or click); only transform and a pseudo-element's opacity move. Reduced motion: a still glow */
.dos-go.dos-go-hero {
  position: relative; isolation: isolate;
  min-height: 48px; gap: 0.5em;
  border: 2px solid var(--dos-bright);
  background: var(--dos-ink); color: var(--dos-dark);
  font: 400 clamp(15px, 1.7vh, 18px) / 1 var(--pixel); letter-spacing: 0.06em;
}
.dos-go-hero::after { content: "\25B6"; font-size: 0.7em; }
.dos-go-hero::before {
  content: ""; position: absolute; inset: -2px; z-index: -1; border-radius: inherit;
  box-shadow: 0 0 12px 3px rgb(255 192 98 / 0.8), 0 0 30px 8px rgb(255 192 98 / 0.3);
  opacity: 0; pointer-events: none;
}
@media (hover: hover) { .dos-go.dos-go-hero:hover { background: var(--dos-bright); color: var(--dos-dark); } }
.dos-go.dos-go-hero:focus-visible { outline: 2px solid var(--paper); outline-offset: 3px; }
.dos-nav.is-off .dos-go.dos-go-hero:hover { background: var(--dos-ink); color: var(--dos-dark); }
.dos-go-hero.is-cue { animation: hero-nudge 1.1s cubic-bezier(0.37, 0, 0.36, 1) 3 both; }
.dos-go-hero.is-cue::before { animation: hero-glow 1.1s ease-in-out 3 both; }
@keyframes hero-nudge { 0%, 100% { transform: none; } 30% { transform: scale(1.05) rotate(-1.2deg); } 60% { transform: scale(1.02) rotate(0.8deg); } }
@keyframes hero-glow { 0%, 100% { opacity: 0; } 40% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .dos-go-hero.is-cue, .dos-go-hero.is-cue::before { animation: none; }
  .dos-go-hero.is-cue::before { opacity: 0.7; }
  .dos-nav-trigger.is-cue, .dos-nav-trigger.is-cue::before { animation: none; }
  .dos-nav-trigger.is-cue::before { opacity: 0.7; }
}
.dos-key-icon svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.dos-key[aria-pressed="true"] { background: rgb(255 244 224 / 0.92); color: var(--night); border-style: solid; }
/* a touch leaves :hover on the key it pressed: only a toggle that is on stays lit, a press only flashes */
@media (hover: none) {
  .dos-key:hover:not([aria-pressed="true"]) { background: rgba(11, 16, 38, 0.38); color: var(--paper); }
  .dos-key[aria-pressed="false"]:hover { color: var(--paper-dim); }
  .dos-key:active:not([aria-pressed="true"]) { background: rgb(255 244 224 / 0.24); }
}
@container (aspect-ratio < 1.25) {
  .dos { flex-direction: column; gap: 14px; }
  .dos-screen { width: min(100cqw, calc((100cqh - 150px) * 1187 / 1225)); }
  .dos-side, .dos-nav { width: 100%; flex-direction: row; flex-wrap: wrap; justify-content: center; gap: 8px; }
  .dos-group, .dos-keys { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
  .dos-group-name { display: none; }
}
@media (pointer: coarse) {
  .dos.is-touch:not(.is-phone) .dos-group-name { display: block; flex-basis: 100%; }
  .dos.is-touch:not(.is-phone) .dos-go, .dos.is-touch:not(.is-phone) .dos-key { min-height: 44px; }
}
/* phones, either way up: the glass alone, full screen, above the on-screen keyboard */
.focus[data-focus="pc"] .focus-panel { overflow: hidden; }
@media (max-width: 720px), (max-height: 540px) {
  .focus[data-focus="pc"] .focus-panel { padding: 0; }
  .focus[data-focus="pc"] .focus-backdrop { background: #05070f; }
  body:has(> .focus[data-focus="pc"].is-open) .world { visibility: hidden; content-visibility: hidden; }
  .dos.is-phone {
    position: fixed; left: 0; right: 0; top: var(--vvt, 0px);
    width: auto; height: var(--vvh, 100%);
    flex-direction: column; align-items: stretch; justify-content: flex-start;
    gap: 10px;
    padding: max(10px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  }
  .dos.is-phone .dos-head {
    display: flex; align-items: center; flex: none;
    min-height: 44px; margin: 0; padding: 0 56px 0 4px;
    font: 400 16px / 1.2 var(--pixel); color: var(--dos-ink);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .dos-where { color: var(--dos-dim); }
  .dos.is-phone .dos-screen { flex: 1 1 auto; min-height: 0; width: 100%; aspect-ratio: auto; border-radius: 14px; background: var(--dos-glass); }
  .dos.is-phone .dos-glass { inset: 0; border-radius: inherit; }
  .dos.is-phone .dos-scroll { padding: 12px 10px; }
  .dos.is-phone .dos-power, .dos.is-phone .dos-led { display: none; }
  .dos.is-phone .dos-side { width: auto; flex-direction: column; flex-wrap: nowrap; justify-content: flex-start; gap: 8px; }
  .dos.is-phone .dos-nav-host { display: none; }
  .dos.is-phone .dos-nav-triggers { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .dos.is-phone .dos-nav-trigger { width: 100%; min-height: 48px; }
  .dos.is-phone .dos-group-keys { display: block; }
  .dos.is-phone .dos-keys { display: flex; flex: none; flex-direction: row; flex-wrap: nowrap; justify-content: flex-start; gap: 8px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
  .dos.is-phone .dos-keys::-webkit-scrollbar { display: none; }
  .dos.is-phone .dos-key { flex: 1 0 auto; min-width: 0; min-height: 44px; padding: 0 14px; }
  .dos.is-phone .dos-key-icon { flex: 0 0 44px; padding: 0; }
}
@media (max-height: 540px) and (orientation: landscape) {
  .dos.is-phone .dos-side { flex-direction: row; align-items: center; }
  .dos.is-phone .dos-nav { flex: 1 1 auto; min-width: 0; padding-right: 8px; border-right: 1px solid rgb(255 244 224 / 0.22); }
  .dos.is-phone .dos-group-keys { flex: none; max-width: 55%; }
}
/* graphics (term.graphics): a program's canvas in place of the text, one layer at its own pixel size scaled by a
   transform (terminal.js placeGraphics), crisp; its links over it untransformed. The scrollback stays for screen
   readers, out of sight; the command line shows only while the program asks something */
.dos-gfx { position: absolute; inset: 0; z-index: 2; padding: 4px; outline: none; }
.dos-gfx:focus-visible { outline: none; }
.dos-gfx:focus-visible .dos-canvas { outline: calc(2px / var(--gs, 1)) solid var(--dos-bright); outline-offset: calc(2px / var(--gs, 1)); }
.dos-canvas {
  position: absolute; left: 0; top: 0;
  transform-origin: 0 0;
  image-rendering: -webkit-optimize-contrast; image-rendering: crisp-edges; image-rendering: pixelated;
  will-change: transform;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}
/* a box of no size at the corner: its layer (it lies over the canvas's) is only as large as its links */
.dos-gfx-links { position: absolute; left: 0; top: 0; width: 0; height: 0; pointer-events: none; }
.dos-gfx-link {
  position: absolute; z-index: 1;
  display: flex; align-items: center; justify-content: center;
  pointer-events: auto;
  font-family: var(--pixel); line-height: 1; white-space: nowrap;
  text-shadow: 0 0 0.3em rgb(255 168 64 / 0.4);
}
.dos-gfx-link.dos-tag { padding-block: 0; margin-block: 0; }
.dos.is-gfx .dos-log {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}
.dos.is-gfx .dos-cmd, .dos.is-gfx .dos-more { display: none; }
.dos.is-gfx.is-reading .dos-cmd {
  display: flex; position: absolute; z-index: 3; left: 0; right: 0; bottom: 0;
  width: auto; padding: 0.15em 0.5ch;
  background: rgb(13 22 29 / 0.92);
}
@media (prefers-reduced-motion: reduce) {
  .dos-cur.is-on { animation: none; }
  .dos-power { transition: none; }
}
@media (prefers-contrast: more) {
  .dos-shine { display: none; }
  .dos-scroll { text-shadow: none; }
}

/* ---------- the PC's glass marking and GRIMBYTE's calls (pc.js, pc-robot.js) --------------------------------------
   .hot-pc (room.js) is the PC's hit area and paints nothing. Its warm light on hover and its dashed ring for the
   keyboard lie on the glass's own corners (.pc-deco, pc.js), so in the monitor's perspective, shown only then, like
   the poster's and the whiteboard's. During a call the robot on the glass can be clicked (.pc-call-hit, the glass's
   quad, painting nothing), and its line hangs in the room as a comic bubble: a canvas at its own size on its
   projected corners (matrix3d, origin 0 0), the line's button. */
.hot-pc:focus-visible { outline: none; }
.pc-deco { position: absolute; display: none; z-index: 22; overflow: visible; pointer-events: none; }
.pc-deco.is-on { display: block; }
.pc-hit { fill: rgb(255 214 150 / 0.1); }
.pc-ring { fill: none; stroke: none; stroke-width: 3; stroke-dasharray: 10 7; stroke-linejoin: round; }
.pc-deco.is-ring .pc-ring { stroke: rgb(255 244 224 / 0.85); }
.pc-call-hit { display: none; z-index: 23; }
.pc-call-hit.is-on { display: block; pointer-events: auto; cursor: pointer; }
.pc-bubble { z-index: 24; transform-origin: 0 0; pointer-events: auto; cursor: pointer; outline: none; }

/* ---------- the monitor's power button (room.js) -------------------------------------------------------------------
   The plate's chin wears the monitor art's own button (.pc-power-art, power.webp in the chin's perspective), under the
   light maps so the room lights it like the plate. Its LED glows green while the PC is on: a 24 px face on the lens
   (matrix3d, about 0.15 world px per px, hence the large glow), above the light maps like the console's. .pc-power is
   the hit area and paints nothing; its warm light on hover and its dashed ring for the keyboard lie around the button
   and the LED (.pc-power-mark), in the chin's perspective. */
.pc-power-art { z-index: 4; transform-origin: 0 0; }
/* the sticky note on the monitor, FREE ME! (room.js): its canvas in the glass's perspective, under the light maps like
   the button's art; above the glass (.pc, z 1), so GRIMBYTE stays behind it. While he points at it (.is-pointed), it
   lights up a little. .pc-note-hit is its hit area, above the call's (.pc-call-hit, z 23), with a warm light on hover. */
.pc-note { z-index: 4; transform-origin: 0 0; transition: filter 0.3s ease; }
.pc-note.is-pointed { filter: brightness(1.18) saturate(1.1); }
.hot.pc-note-hit { z-index: 24; border-radius: 6px; transition: background-color 0.25s ease, box-shadow 0.25s ease; }
.hot.pc-note-hit:hover, .hot.pc-note-hit.is-pointed { background-color: rgb(255 214 150 / 0.12); box-shadow: 0 0 18px 4px rgb(255 214 150 / 0.22); }
.hot.pc-note-hit:focus-visible { outline-offset: 2px; border-radius: 6px; }
.pc-power-led {
  width: 24px; height: 24px; z-index: 21;
  transform-origin: 0 0;
  border-radius: 50%;
  background: transparent;
  transition: background 0.25s ease, box-shadow 0.25s ease;
}
.pc-power-led.on { background: radial-gradient(circle at 42% 40%, #e9ffe9, #6dff9c 45%, #1fd46a); box-shadow: 0 0 16px 6px rgb(90 255 150 / 0.6); }
.pc-power svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.pc-power-mark { fill: rgb(255 214 150 / 0); stroke: none; stroke-width: 1.6; stroke-dasharray: 5 3.5; stroke-linejoin: round; transition: fill 0.25s ease; }
.pc-power:hover .pc-power-mark { fill: rgb(255 214 150 / 0.14); }
.pc-power:focus-visible { outline: none; }
.pc-power:focus-visible .pc-power-mark { stroke: rgb(255 244 224 / 0.85); }

/* ---------- whiteboard marker: controls stay behind while just the painted face flies ---------- */
.wb-easel {
  flex: none; min-width: 0;
  width: min(calc(100cqw - 400px - var(--gap)), calc((100cqh - 84px) * 1600 / 1143), 1180px);
}
.wb-easel > .wb-face { position: relative; top: auto; width: 100%; }
.wb-ink, .wb-grip { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.wb-ink { mix-blend-mode: multiply; clip-path: inset(4.3% 3.2% 8.1%); }
.is-open .wb-held .wb-ink { pointer-events: auto; touch-action: none; cursor: crosshair; }
.wb-held { z-index: 1; }
.wb-empty-tray { display: none; position: absolute; left: 62.5%; top: 92.476%; width: 21.125%; height: auto; pointer-events: none; }
.wb-held .wb-empty-tray { display: block; }
.wb-grip img {
  position: absolute; width: 16.8%; height: auto;
  transform: translateY(-38%) rotate(-48deg); transform-origin: 0 38%;
  filter: drop-shadow(2px 3px 2px rgb(22 28 45 / 0.26));
}
.wb-held:has(.wb-grip img:not([hidden])) .wb-ink { cursor: none; }
.wb-held:has(.wb-ink:focus-visible) { outline: 2px dashed var(--lantern); outline-offset: 2px; }
.wb-slot {
  position: absolute; top: 95%; transform: translateY(-50%);
  height: max(6%, 44px); padding: 0; border: 0; background: transparent; cursor: grab;
}
.wb-marker-slot { left: 62.5%; width: 20.5%; }
.wb-eraser-slot { left: 84%; width: max(11%, 44px); cursor: pointer; }
.wb-slot:disabled { cursor: default; }
.focus:not(.is-open) .wb-slot { visibility: hidden; }
.wb-tools {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 0 16px;
  padding: 4px 6px; color: var(--paper); text-align: center;
}
.wb-tool {
  min-height: 44px; padding: 4px 2px; border: 0; background: none;
  color: var(--paper); font: 800 15px/1.3 var(--round);
  text-decoration: underline; text-underline-offset: 4px; cursor: pointer;
}
.wb-tool:hover:not(:disabled), .wb-tool:focus-visible { color: var(--gold); }
.wb-tool:focus-visible { outline: 2px solid currentColor; outline-offset: 1px; }
.wb-tool:disabled { color: var(--paper-dim); text-decoration: none; opacity: 0.66; cursor: default; }
.wb-ink-status { color: var(--paper-dim); font-size: 14px; line-height: 1.4; text-wrap: balance; }
@media (max-width: 720px), (max-height: 540px) {
  .wb-easel { width: 100%; }
  .wb-view { overflow-x: hidden; }
  .wb-ink-status { flex-basis: 100%; }
}
@media (max-height: 540px) and (min-aspect-ratio: 1/1) {
  .wb-easel { position: sticky; top: 0; width: min(55%, calc((100cqh - 118px) * 1600 / 1143)); }
}

/* ---------- board games on the floor (board-games.js) -------------------
   MAI-painted faces on perspective solids, over the plate's reflection and light maps. Each canvas is its own
   natural-size layer and is lit by the cartridges' Rig; the shadows and the gloss share the floor plane. */
.board-games-art, .board-games-shadow, .board-games-gloss { z-index: 16; transform-origin: 0 0; }
.hot-board-games:focus-visible { outline: none; }
.hot-board-games svg { display: block; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.hot-board-games polygon { fill: none; stroke: none; stroke-width: 4; stroke-linejoin: round; }
.hot-board-games:focus-visible polygon { stroke: var(--paper); stroke-dasharray: 10 7; }
@media (hover: hover) {
  .hot-board-games:hover polygon { stroke: var(--lantern); fill: rgb(255 180 90 / 0.08); }
}
.board-games-view {
  display: grid;
  grid-template-columns: minmax(240px, 0.85fr) minmax(0, 1fr);
  align-items: center;
  gap: clamp(26px, 4vw, 64px);
  width: min(100%, 1060px);
  max-height: 100%;
}
.board-games-face { margin: 0; aspect-ratio: 1; width: 100%; }
.board-games-face img { display: block; width: 100%; height: auto; }
.board-games-copy { max-height: 88cqh; overflow-y: auto; padding: 5px 8px 12px; overscroll-behavior: contain; }
.board-games-copy h2 { margin: 0 0 20px; font-size: clamp(28px, 3.4vw, 44px); line-height: 1.15; font-weight: 800; text-wrap: balance; }
.board-games-intro { margin: 0; max-width: 30ch; font-size: clamp(18px, 1.7vw, 23px); line-height: 1.6; }
.board-games-copy h3 { margin: 30px 0 12px; font-size: 16px; color: var(--paper-dim); font-weight: 500; }
.board-games-copy ul { margin: 0 0 22px; padding-left: 1.1em; font-size: 17px; line-height: 1.65; }
.board-games-copy li { padding-left: 0.15em; margin: 4px 0; }
.board-games-copy li::marker { color: var(--lantern); }
.board-games-link { display: inline-block; padding: 12px 0; color: var(--lantern); font-size: 16px; line-height: 1.5; text-underline-offset: 4px; }
.board-games-link:hover { color: var(--paper); }
.board-games-link:focus-visible { outline: 2px solid var(--paper); outline-offset: 4px; border-radius: 2px; }
.board-games-credit { max-width: 44ch; margin: 18px 0 0; font-size: 12px; line-height: 1.65; color: var(--paper-dim); }
@media (max-width: 720px), (max-height: 540px) {
  .board-games-view { grid-template-columns: 1fr; gap: 24px; max-height: none; padding: 56px 10px 24px; }
  .board-games-face { width: min(58vw, 230px); justify-self: center; }
  .board-games-copy { max-height: none; overflow: visible; padding: 0; }
  .board-games-copy h2 { margin-bottom: 14px; }
  .board-games-copy h3 { margin-top: 24px; }
  .board-games-copy ul { font-size: 16px; }
}
@media (max-height: 540px) and (min-width: 600px) {
  .board-games-view { grid-template-columns: minmax(150px, 0.55fr) minmax(0, 1fr); align-items: start; padding-top: 56px; gap: 28px; }
  .board-games-face { width: 100%; max-width: 240px; }
}
/* ---------- end board games ------------------------------------------ */

/* ---------- Pocket Days: the virtual pet on the tatami (virtual-pet.js) ---------- */
.hot-virtual-pet { pointer-events: none; }
.hot-virtual-pet:focus-visible { outline: none; }
.hot-virtual-pet svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.pet-hit-body { pointer-events: all; fill: transparent; stroke: transparent; stroke-width: 5px; }
.pet-hit-chain { pointer-events: stroke; stroke: transparent; stroke-width: 8px; fill: none; }
body:not(.focus-open) .hot-virtual-pet:hover .pet-hit-body { fill: rgb(255 214 150 / 15%); }
body:not(.focus-open) .hot-virtual-pet:focus-visible .pet-hit-body { stroke: var(--paper); stroke-width: 3px; stroke-dasharray: 6 4; }
.pet-mat { left: 678px; top: 1291px; z-index: 15; }
.pet-binding { left: 606px; top: 1281px; z-index: 15; }
.pet-mat[hidden] { display: none; }
.pet-view {
  display: grid; grid-template-columns: auto minmax(0, 340px); align-items: center;
  gap: clamp(24px, 5cqw, 74px); max-width: 100%; color: var(--paper);
}
.pet-face {
  position: relative; width: min(460px, 46cqw, 65cqh); aspect-ratio: 760 / 1095;
  isolation: isolate; container-type: inline-size; user-select: none;
  --focus-dim-blend: multiply; --focus-dim: 1;
}
.focus .pet-face.focus-flying { box-shadow: none; }
.pet-face > .focus-dim { mask: url("../img/virtual-pet/shell.webp") center / 100% 100% no-repeat; }
.pet-shell { display: block; width: 100%; height: 100%; pointer-events: none; }
.pet-brand {
  position: absolute; top: 21.3%; left: 0; width: 100%; text-align: center; transform: rotate(-4deg);
  font: 700 8.5cqw/1 "Kalam", var(--round); color: #773049; pointer-events: none;
}
.pet-glass { position: absolute; left: 21.8%; top: 36.2%; width: 56%; height: 34.6%; image-rendering: pixelated; }
.pet-key {
  position: absolute; top: 78.9%; width: 18.5%; height: max(44px, 8.4%); transform: translate(-50%, -50%);
  border: 0; padding: 0; border-radius: 45%; background: transparent;
  color: #ffe4dc; font: 800 max(13px, 4.5cqw)/1 var(--round); touch-action: manipulation;
  cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.pet-key[data-key="A"] { left: 31%; }
.pet-key[data-key="B"] { left: 50%; }
.pet-key[data-key="C"] { left: 69%; }
.pet-key:hover { color: white; }
.pet-key:active { color: var(--lantern); translate: 0 2px; }
.pet-key:focus-visible { outline: 2px solid var(--paper); box-shadow: 0 0 0 4px var(--night); }
.pet-guide { max-width: 36ch; text-wrap: pretty; }
.pet-guide h2 { margin: 0 0 10px; font: 800 clamp(28px, 4.4cqw, 52px)/1.07 var(--round); letter-spacing: -.035em; text-wrap: balance; }
.pet-guide p { margin: 0; font-size: clamp(15px, 1.65cqw, 18px); line-height: 1.55; }
.pet-manual { border-top: 1px solid rgb(255 244 224 / 30%); margin-top: 24px; padding-top: 20px; }
.pet-manual h3 { margin: 0 0 6px; color: var(--neon-rim); font: 400 clamp(18px, 2.4cqw, 26px)/1.2 var(--pixel); }
.pet-manual .pet-feedback { margin-top: 8px; color: var(--paper-dim); font-size: 15px; }
.pet-legend { display: flex; flex-wrap: wrap; gap: 7px 16px; margin: 20px 0 6px; }
.pet-legend > div { display: flex; gap: 6px; align-items: center; }
.pet-legend dt {
  display: grid; place-items: center; width: 22px; height: 22px; border: 1px solid var(--neon-rim); border-radius: 50%;
  font: 800 13px/1 var(--round); color: #ffcece;
}
.pet-legend dd { margin: 0; font-size: 14px; }
.pet-guide .pet-how { font-size: 13px; color: var(--paper-dim); }
@media (max-width: 720px) and (orientation: portrait) {
  .focus[data-focus="virtual-pet"] .focus-panel { padding-top: max(58px, calc(env(safe-area-inset-top) + 48px)); }
  .pet-view { width: 100%; justify-items: center; align-self: safe center; grid-template-columns: 1fr; gap: 12px; }
  .pet-face { width: min(88cqw, 38dvh, 360px); }
  .pet-guide { width: min(100%, 380px); }
  .pet-guide h2 { font-size: 27px; margin-bottom: 4px; }
  .pet-guide p { line-height: 1.4; }
  .pet-manual { margin-top: 10px; padding-top: 8px; }
  .pet-manual h3 { margin-bottom: 3px; }
  .pet-manual .pet-feedback { margin-top: 3px; }
  .pet-legend { margin-top: 12px; }
}
@media (max-height: 540px) and (orientation: landscape) {
  .focus[data-focus="virtual-pet"] .focus-panel { place-items: safe center; }
  .pet-view { grid-template-columns: auto minmax(0, 360px); gap: 4cqw; padding-inline: 8px; }
  .pet-face { width: min(40cqw, 67cqh); }
  .pet-guide { padding-top: 32px; }
  .pet-guide h2 { font-size: 26px; margin-bottom: 4px; }
  .pet-guide p { font-size: 14px; line-height: 1.35; }
  .pet-manual { margin-top: 8px; padding-top: 8px; }
  .pet-manual h3 { font-size: 18px; margin-bottom: 3px; }
  .pet-manual .pet-feedback { margin-top: 4px; }
  .pet-legend { margin: 10px 0 3px; }
}

/* ---------- Five Dice (dice-ritual.js) -------------------------------
   While the cartridges leave the crate and the camera moves in, a transparent shield keeps the rest of the room from
   being touched, and the HUD steps back (opacity only). */
.board-games-play { margin: 8px 0 6px; display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.board-games-play button {
  padding: 12px 18px; min-height: 44px; cursor: pointer;
  background: linear-gradient(180deg, var(--win-top), var(--win-bottom));
  border: 3px solid var(--win-edge); border-radius: 10px;
  box-shadow: inset 0 0 0 2px #0a1040, 0 8px 22px rgba(0, 0, 0, 0.45);
  font: 18px/1.2 var(--pixel); color: #fff; text-shadow: 1px 1px 0 #070b2a; text-align: left;
}
.board-games-play button:hover, .board-games-play button:focus-visible { border-color: var(--gold); outline: none; }
.board-games-play span { font-size: 14px; color: var(--paper-dim); }
.dice-shield { position: fixed; inset: 0; z-index: 18; }
.dice-close {
  position: fixed; z-index: 30; right: max(16px, env(safe-area-inset-right)); bottom: max(16px, env(safe-area-inset-bottom));
  padding: 10px 16px; min-height: 44px; cursor: pointer;
  background: linear-gradient(180deg, var(--win-top), var(--win-bottom));
  border: 3px solid var(--win-edge); border-radius: 10px;
  box-shadow: inset 0 0 0 2px #0a1040, 0 10px 26px rgba(0, 0, 0, 0.5);
  font: 18px/1 var(--pixel); color: #fff; text-shadow: 1px 1px 0 #070b2a;
}
.dice-close:hover, .dice-close:focus-visible { border-color: var(--gold); outline: none; }
body.dice-on .hud-top, body.dice-on .hud-bottom, body.dice-on .cart-strip { opacity: 0; pointer-events: none; transition: opacity 0.35s ease; }
body.dice-on .tip, body.dice-on .toast { visibility: hidden; }

/* the 3D view (dice-stage.js) sits above the plate and below the shield; the room itself is hidden behind it */
.dice-stage { position: fixed; inset: 0; z-index: 17; background: #0b1017; opacity: 0; transition: opacity 0.5s ease; overflow: hidden; }
.dice-stage.on { opacity: 1; }
.dice-stage.now { transition: none; }
.dice-stage canvas { position: absolute; left: 0; top: 0; display: block; touch-action: none; }
.dice-note {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 2;
  margin: 0; padding: 14px 18px; max-width: min(420px, calc(100vw - 32px)); text-align: center;
  background: rgba(11, 16, 38, 0.92); border: 3px solid var(--win-edge); border-radius: 10px;
  font: 600 15px/1.35 var(--round); color: var(--paper);
}
.dice-note[hidden] { display: none; }

/* ---- the game (dice-ui.js): a column on the right (wide), a narrow column (land), a strip on top and a bar below (port) */
.dice-ui { position: fixed; inset: 0; z-index: 20; pointer-events: none; opacity: 0; transition: opacity 0.45s ease; --s: 2; --ink: #0b1030; --panel: #0d1340; }
.dice-ui.on { opacity: 1; }
.dice-ui[data-lay="wide"][data-size="l"] { --s: 3; }
.dice-ui button { font: inherit; }
.dice-pick { position: fixed; inset: 0; pointer-events: auto; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.dice-pick.hit { cursor: pointer; }
.dice-col { position: fixed; display: flex; flex-direction: column; gap: 8px; pointer-events: none; box-sizing: border-box; }
.dice-col > * { pointer-events: auto; }
.dice-ui[data-lay="wide"] .dice-col, .dice-ui[data-lay="land"] .dice-col {
  top: 0; right: 0; bottom: 0; padding: 10px 12px max(12px, env(safe-area-inset-bottom)) 12px;
  background: var(--panel); border-left: 3px solid var(--win-edge); box-shadow: -10px 0 30px rgba(0, 0, 0, 0.35); pointer-events: auto;
}
.dice-ui[data-lay="wide"] .dice-col { width: 340px; }
.dice-ui[data-lay="land"] .dice-col { width: 252px; padding: 6px max(8px, env(safe-area-inset-right)) 8px 8px; overflow-y: auto; gap: 6px; }
.dice-ui[data-lay="port"] .dice-col { inset: 0; }

/* GRIMBYTE: the face (80 x 40 sprite, kept sharp), the name tag, and the speech bubble */
.dice-top { flex: none; }
.dice-bot { display: grid; grid-template-columns: auto; justify-items: start; row-gap: 6px; position: relative; }
.dice-bot-face { width: calc(80px * var(--s)); height: calc(40px * var(--s)); image-rendering: pixelated; }
.dice-bot.no-art .dice-bot-face { display: none; }
.dice-bot-name { font: 14px/1 var(--pixel); letter-spacing: 0.08em; color: var(--gold); text-shadow: 1px 1px 0 #070b2a; }
.dice-bot-bubble {
  position: relative; box-sizing: border-box; margin: 4px 0 0; padding: 8px 11px; width: 100%; min-height: 3.6em;
  background: var(--paper); color: #1c1736; border: 3px solid #1c1736; border-radius: 12px;
  font: 600 14px/1.3 var(--round); opacity: 0.55; transition: opacity 0.25s ease;
}
.dice-bot-bubble.on { opacity: 1; }
.dice-bot-bubble::before {
  content: ""; position: absolute; left: 26px; top: -10px; width: 14px; height: 14px; box-sizing: border-box;
  background: var(--paper); border-left: 3px solid #1c1736; border-top: 3px solid #1c1736; transform: rotate(45deg);
}
.dice-bot[data-mood="rage"] .dice-bot-bubble, .dice-bot[data-mood="shock"] .dice-bot-bubble { border-color: var(--neon); }
.dice-bot[data-mood="delight"] .dice-bot-bubble, .dice-bot[data-mood="cheer"] .dice-bot-bubble, .dice-bot[data-mood="awe"] .dice-bot-bubble { border-color: #b8860b; }

/* the score card */
.dice-card {
  display: none; flex-direction: column; box-sizing: border-box; min-height: 0;
  background: var(--panel); border: 3px solid var(--win-edge); border-radius: 10px; box-shadow: inset 0 0 0 2px #0a1040;
  color: var(--paper); font: 15px/1 var(--pixel);
}
.dice-ui[data-lay="wide"] .dice-card, .dice-card.open { display: flex; }
.dice-ui[data-lay="wide"] .dice-card { flex: 1 1 0; }
.dice-card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 10px 6px; }
.dice-status { color: var(--gold); font-size: 15px; letter-spacing: 0.04em; }
.dice-cardx { display: none; min-height: 44px; padding: 4px 12px; cursor: pointer; color: #fff; background: #1b2780; border: 2px solid var(--win-edge); border-radius: 8px; font: 15px/1 var(--pixel); }
.dice-rows { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 0 10px 6px; overscroll-behavior: contain; scrollbar-width: none; }
.dice-rows::-webkit-scrollbar { display: none; }
.dice-half { display: block; }
.dice-half + .dice-half .headrow { display: none; }
.dice-row { display: grid; grid-template-columns: minmax(0, 1fr) 62px 66px; align-items: stretch; min-height: 24px; border-bottom: 1px solid rgba(243, 241, 255, 0.14); }
.dice-rowbtn { grid-column: 1 / 3; display: flex; align-items: center; justify-content: space-between; padding: 0; margin: 0; border: 0; background: none; color: inherit; font: inherit; text-align: left; border-radius: 4px; }
button.dice-rowbtn { cursor: pointer; }
@media (pointer: coarse) {
  button.dice-row-pick { min-height: 44px; }
}
@media (pointer: fine) {
  .dice-ui[data-lay="wide"] .dice-rows { display: flex; flex-direction: column; }
  .dice-ui[data-lay="wide"] .dice-half { display: contents; }
  .dice-ui[data-lay="wide"] .dice-row:not(.headrow):not(.static) { flex: 1 0 auto; }
}
button.dice-rowbtn:disabled { cursor: default; color: var(--paper-dim); }
.dice-rowbtn .lab { flex: 1; padding: 0 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dice-rowbtn .you, .dice-row .bot { display: flex; align-items: center; justify-content: center; text-align: center; }
.dice-rowbtn .you { width: 62px; flex: none; align-self: stretch; }
.dice-row .bot { color: #ffb7c4; }
.dice-row.headrow { color: var(--gold); font-size: 13px; min-height: 22px; }
.dice-row.done .lab { color: var(--paper-dim); }
.dice-row .ghost { color: var(--gold); opacity: 0.8; }
button.dice-rowbtn:not(:disabled):hover, button.dice-rowbtn:not(:disabled):focus-visible { background: rgba(255, 215, 94, 0.14); outline: none; }
.dice-row.sel { background: rgba(255, 215, 94, 0.22); outline: 2px solid var(--gold); outline-offset: -2px; border-radius: 4px; }
.dice-row.sel .you { color: #fff; font-size: 17px; }
.dice-row.static { color: var(--paper-dim); font-size: 13px; }
.dice-row.total { font-size: 17px; color: #fff; border-bottom: 0; border-top: 2px solid var(--win-edge); margin-top: 4px; min-height: 30px; }
.dice-row.total.lead-you .you, .dice-row.total.lead-bot .bot { color: var(--gold); }
/* the total stays in view when the card scrolls */
.dice-ui:not([data-lay="land"]) .dice-row.total { position: sticky; bottom: -6px; z-index: 1; background: var(--panel); }
.pulse { animation: dice-pulse 1.6s ease-out 1; }
@keyframes dice-pulse { 0% { background: rgba(255, 215, 94, 0.9); color: #1c1736; transform: scale(1.25); } 40% { transform: scale(1); } 100% { background: transparent; } }
.dice-card-foot { padding: 6px 10px 10px; }
.dice-score { width: 100%; }

/* buttons that look like the room's window buttons */
.dice-score, .dice-roll, .dice-cardbtn, .dice-go, .dice-level {
  min-height: 44px; padding: 8px 14px; cursor: pointer; color: #fff; text-shadow: 1px 1px 0 #070b2a;
  background: linear-gradient(180deg, var(--win-top), var(--win-bottom)); border: 3px solid var(--win-edge); border-radius: 10px;
  box-shadow: inset 0 0 0 2px #0a1040, 0 6px 16px rgba(0, 0, 0, 0.4); font: 17px/1.15 var(--pixel);
}
.dice-score:hover, .dice-roll:hover, .dice-cardbtn:hover, .dice-go:hover, .dice-level:hover,
.dice-score:focus-visible, .dice-roll:focus-visible, .dice-cardbtn:focus-visible, .dice-go:focus-visible, .dice-level:focus-visible, .dice-d:focus-visible, .dice-rowbtn:focus-visible { border-color: var(--gold); outline: none; }
.dice-score:disabled, .dice-roll:disabled, .dice-cardbtn:disabled { opacity: 0.5; cursor: default; }
.dice-cardbtn.call, .dice-go { border-color: var(--gold); }
.dice-level[aria-pressed="true"] { border-color: var(--gold); background: linear-gradient(180deg, #4a5ee0, #1c2a9a); }

/* the bar: what to do, the five dice as buttons, throw / card */
.dice-bar { display: flex; flex-direction: column; gap: 8px; }
.dice-hint { margin: 0; min-height: 2.6em; font: 600 13px/1.3 var(--round); color: var(--paper-dim); }
.dice-dice { display: flex; gap: 6px; }
.dice-d {
  flex: 1; aspect-ratio: 1; min-width: 0; max-width: 62px; padding: 0; display: grid; place-items: center; cursor: pointer;
  background: #fff4e0; color: #1c1736; border: 3px solid #1c1736; border-radius: 12px; box-shadow: 0 3px 0 #1c1736, 0 6px 14px rgba(0, 0, 0, 0.4);
  transition: transform 0.12s ease, border-color 0.12s ease;
}
.dice-d.bots { background: #f0d6d6; }
.dice-d.held { border-color: var(--gold); box-shadow: 0 3px 0 #b8860b, 0 0 0 3px rgba(255, 215, 94, 0.55); transform: translateY(-4px); }
.dice-d:disabled { cursor: default; }
.dice-d.rolling { opacity: 0.6; }
.dice-d .mark { font: 22px/1 var(--pixel); color: #6b6488; }
.dice-d .pips { display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr); width: 62%; height: 62%; }
.dice-d .pips i { display: block; place-self: center; width: 78%; height: 78%; border-radius: 50%; }
.dice-d .pips i.on { background: #1c1736; }
.dice-actions { display: flex; gap: 8px; }
.dice-roll { flex: 1; }
.dice-cardbtn { display: none; }
.dice-ui:not([data-lay="wide"]) .dice-cardbtn { display: block; }
.dice-ui[data-mode="intro"] .dice-bar .dice-dice, .dice-ui[data-mode="intro"] .dice-bar .dice-actions, .dice-ui[data-mode="intro"] .dice-bar .dice-hint { visibility: hidden; }

/* the intro and the result */
.dice-modal {
  position: fixed; z-index: 26; left: 50%; top: 50%; transform: translate(-50%, -50%); box-sizing: border-box; pointer-events: auto;
  width: min(420px, calc(100vw - 24px)); max-height: calc(100vh - 24px); overflow-y: auto; padding: 20px 20px 16px;
  background: var(--panel); border: 3px solid var(--win-edge); border-radius: 12px;
  box-shadow: inset 0 0 0 2px #0a1040, 0 24px 60px rgba(0, 0, 0, 0.6); color: var(--paper);
}
.dice-modal[hidden] { display: none; }
.dice-ui[data-lay="wide"] .dice-modal { left: calc((100vw - 340px) / 2); }
.dice-ui[data-lay="land"] .dice-modal { left: calc((100vw - 252px) / 2); }
.dice-ui[data-lay="port"] .dice-modal { top: calc(50% + 40px); max-height: calc(100vh - 220px); }
.dice-modal h2 { margin: 0 0 10px; font: 30px/1 var(--pixel); color: var(--gold); text-shadow: 2px 2px 0 #070b2a; }
.dice-modal p { margin: 0 0 12px; font: 600 15px/1.4 var(--round); }
.dice-modal .dice-fine { margin: 12px 0 0; font-size: 12.5px; color: var(--paper-dim); font-weight: 500; }
.dice-levels { display: flex; gap: 8px; margin: 0 0 12px; }
.dice-levels .dice-level { flex: 1; padding: 8px 6px; }
.dice-modal .dice-go { width: 100%; font-size: 20px; }
.dice-modal .dice-out { width: 100%; margin-top: 8px; }
.dice-final { display: flex; align-items: baseline; justify-content: center; gap: 12px; font: 22px/1.2 var(--pixel) !important; color: #fff; }
.dice-final .sep { color: var(--paper-dim); }

/* the way out moves to the corner while a game is on, clear of the bubble and the column */
body.dice-play .dice-close { right: auto; bottom: auto; top: max(8px, env(safe-area-inset-top)); left: max(8px, env(safe-area-inset-left)); min-height: 36px; padding: 6px 12px; font-size: 15px; }
body.dice-play.dice-lay-port .dice-close { left: auto; right: max(8px, env(safe-area-inset-right)); }

/* land: the card slides over the 3D view, left of the column */
.dice-ui[data-lay="land"] .dice-card.open { position: fixed; z-index: 24; left: max(8px, env(safe-area-inset-left)); top: 46px; right: 262px; bottom: 8px; }
.dice-ui[data-lay="land"] .dice-card { font-size: 13px; }
.dice-ui[data-lay="land"] .dice-cardx, .dice-ui[data-lay="port"] .dice-cardx { display: block; }
.dice-ui[data-lay="land"] .dice-rows { display: grid; grid-template-columns: 1fr 1fr; column-gap: 14px; align-items: start; }
.dice-ui[data-lay="land"] .dice-half + .dice-half .headrow { display: grid; }
.dice-ui[data-lay="land"] .dice-row { grid-template-columns: minmax(0, 1fr) 46px 52px; min-height: 26px; }
.dice-ui[data-lay="land"] .dice-rowbtn .you { width: 46px; }
.dice-ui[data-lay="land"] .dice-bot { grid-template-columns: auto; }
.dice-ui[data-lay="land"] .dice-bot-bubble { font-size: 12.5px; min-height: 4.2em; padding: 6px 9px; }
.dice-ui[data-lay="land"] .dice-hint { font-size: 12px; min-height: 2.4em; }
.dice-ui[data-lay="land"] .dice-dice { gap: 4px; }
.dice-ui[data-lay="land"] .dice-d { border-radius: 9px; border-width: 2px; }
.dice-ui[data-lay="land"] .dice-roll, .dice-ui[data-lay="land"] .dice-cardbtn { font-size: 15px; padding: 6px 10px; }

/* port: the strip on top (face left, bubble right), the bar at the bottom, the card between them */
.dice-ui[data-lay="port"] .dice-top { margin: 0; padding: max(6px, env(safe-area-inset-top)) 10px 4px 10px; min-height: 128px; background: var(--panel); border-bottom: 3px solid var(--win-edge); }
.dice-ui[data-lay="port"] .dice-bot { grid-template-columns: auto minmax(0, 1fr); grid-template-areas: "face bubble" "name bubble"; column-gap: 12px; align-items: start; }
.dice-ui[data-lay="port"] .dice-bot-face { grid-area: face; }
.dice-ui[data-lay="port"] .dice-bot-name { grid-area: name; }
.dice-ui[data-lay="port"] .dice-bot-bubble { grid-area: bubble; margin: 38px 0 0; font-size: 12px; padding: 6px 9px; min-height: 0; max-height: 84px; overflow: hidden; }
.dice-ui[data-lay="port"] .dice-bot-bubble::before { left: -9px; top: 12px; transform: rotate(-45deg); }
.dice-ui[data-lay="port"] .dice-bar { margin-top: auto; padding: 8px 10px max(10px, env(safe-area-inset-bottom)); background: var(--panel); border-top: 3px solid var(--win-edge); gap: 6px; }
.dice-ui[data-lay="port"] .dice-hint { font-size: 12.5px; min-height: 2.6em; }
.dice-ui[data-lay="port"] .dice-d { max-width: 64px; }
.dice-ui[data-lay="port"] .dice-card.open { flex: 1 1 0; margin: 8px 8px 0; z-index: 24; }
.dice-ui[data-lay="port"] .dice-row { min-height: 28px; }

/* short screens: tighter score rows so the card fits without scrolling */
.dice-ui[data-lay="land"][data-size="s"] .dice-bot { row-gap: 3px; }
.dice-ui[data-lay="land"][data-size="s"] .dice-bot-name { font-size: 12px; }
.dice-ui[data-lay="land"][data-size="s"] .dice-bot-bubble { font-size: 12px; min-height: 3.9em; padding: 4px 8px; margin-top: 3px; }
.dice-ui[data-lay="land"][data-size="s"] .dice-col { gap: 4px; }
.dice-ui[data-lay="land"][data-size="s"] .dice-hint { font-size: 11.5px; }
.dice-ui[data-lay="land"][data-size="s"] .dice-card { font-size: 12px; }
.dice-ui[data-lay="land"][data-size="s"] .dice-card-head { padding: 4px 10px 2px; }
.dice-ui[data-lay="land"][data-size="s"] .dice-cardx { min-height: 44px; padding: 2px 10px; }
.dice-ui[data-lay="land"][data-size="s"] .dice-row { min-height: 20px; }
.dice-ui[data-lay="land"][data-size="s"] .dice-row.headrow { min-height: 18px; font-size: 11px; }
.dice-ui[data-lay="land"][data-size="s"] .dice-row.total { min-height: 24px; margin-top: 2px; font-size: 15px; }
.dice-ui[data-lay="land"][data-size="s"] .dice-card-foot { padding: 3px 10px 6px; }
.dice-ui[data-lay="land"][data-size="s"] .dice-score { min-height: 36px; padding: 4px 12px; }
@media (max-height: 800px) {
  .dice-ui[data-lay="port"] .dice-row { min-height: 22px; }
  .dice-ui[data-lay="port"] .dice-row.headrow { min-height: 18px; }
  .dice-ui[data-lay="port"] .dice-row.total { min-height: 26px; margin-top: 2px; }
  .dice-ui[data-lay="port"] .dice-card-head { padding: 4px 10px 2px; }
  .dice-ui[data-lay="port"] .dice-card-foot { padding: 4px 10px 6px; }
  .dice-ui[data-lay="port"] .dice-score { min-height: 38px; padding: 4px 12px; }
}
@media (pointer: fine) and (max-height: 920px) {
  .dice-ui[data-lay="wide"] .dice-bot { --s: 1; grid-template-columns: auto minmax(0, 1fr); column-gap: 12px; row-gap: 3px; align-items: center; }
  .dice-ui[data-lay="wide"] .dice-bot-name { grid-column: 1; grid-row: 2; }
  .dice-ui[data-lay="wide"] .dice-bot-bubble { grid-column: 2; grid-row: 1 / 3; margin: 0; }
  .dice-ui[data-lay="wide"] .dice-bot-bubble::before { left: -9px; top: 12px; transform: rotate(-45deg); }
}
@media (max-height: 860px) {
  .dice-ui[data-lay="wide"] .dice-row { min-height: 20px; }
  .dice-ui[data-lay="wide"] .dice-row.headrow { min-height: 17px; }
  .dice-ui[data-lay="wide"] .dice-row.total { min-height: 26px; margin-top: 2px; }
  .dice-ui[data-lay="wide"] .dice-card-head { padding: 5px 10px 3px; }
  .dice-ui[data-lay="wide"] .dice-card-foot { padding: 4px 10px 6px; }
}
@media (max-height: 780px) {
  .dice-ui[data-lay="wide"] .dice-card { font-size: 14px; }
  .dice-ui[data-lay="wide"] .dice-row { min-height: 18px; }
  .dice-ui[data-lay="wide"] .dice-row.static { font-size: 12px; }
}
@media (max-height: 760px) {
  .dice-ui[data-lay="port"] .dice-card { font-size: 13px; }
  .dice-ui[data-lay="port"] .dice-row { min-height: 19px; }
  .dice-ui[data-lay="port"] .dice-row.headrow { min-height: 16px; font-size: 12px; }
  .dice-ui[data-lay="port"] .dice-row.static { font-size: 12px; }
  .dice-ui[data-lay="port"] .dice-row.total { min-height: 24px; font-size: 16px; }
  .dice-ui[data-lay="port"] .dice-score { min-height: 34px; }
}

@media (prefers-reduced-motion: reduce) {
  .dice-stage, .dice-ui, .dice-bot-bubble, .dice-d { transition: none; }
  .pulse { animation: none; background: rgba(255, 215, 94, 0.35); }
}
/* ---------- end Five Dice --------------------------------------------- */
