/* Relaxio Resort and Spa: low-res neochibi, early-2000s web, finished like a
   modern product. One system: the tokens below drive every colour, size,
   shadow and movement on the site. Resting state is always the usable state;
   motion only ever adds to it (and stands down for prefers-reduced-motion). */

@font-face {
  font-family: 'PEPSI';
  src: url('../assets/fonts/PEPSI-Regular.woff2') format('woff2');
  font-display: swap;
}

:root {
  /* ---- colour, by role */
  --ink: #2b2c32;            /* outlines, text on light */
  --ink-2: #4a4b53;
  --night: #1d1e22;          /* page */
  --void: #0b0c0f;           /* transitions, loader */
  --pink: #cc4364;           /* the brand accent: shadows, primary actions */
  --pink-hi: #e9718d;
  --pink-lo: #8f2a45;
  --pink-soft: #f2a3b3;      /* accent on dark */
  --cream: #f6eee2;          /* surfaces on the scene */
  --paper: #fffaf3;
  --sand: #e9d8bb;
  --teal: #8fd3c7;
  --teal-lo: #3f8f88;
  --gold: #f2c14e;           /* hover, focus, highlights */
  --wood: #c8955f;
  --wood-lo: #5a3826;
  --ok: #9ff2a8;
  --bad: #ff9db1;

  /* ---- type: three voices, one scale (1.2) */
  --pixel: 'Silkscreen', 'Courier New', monospace;      /* labels, controls */
  --display: 'Krona One', 'Arial Black', sans-serif;    /* titles */
  --body: 'DM Sans', Verdana, Tahoma, sans-serif;       /* reading */
  --brand: 'PEPSI', 'Krona One', sans-serif;
  --t-2xs: 9px;
  --t-xs: 10px;
  --t-sm: 12px;
  --t-base: 14.5px;
  --t-md: 17px;
  --t-lg: 20px;
  --t-xl: 26px;

  /* ---- space: 4px grid */
  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-5: 24px; --s-6: 32px;

  /* ---- motion */
  --ease-out: cubic-bezier(.16, 1, .3, 1);       /* quick start, long settle: things arriving */
  --ease-in: cubic-bezier(.5, 0, .75, 0);        /* things leaving */
  --ease-in-out: cubic-bezier(.65, 0, .35, 1);   /* things travelling */
  --ease-spring: cubic-bezier(.34, 1.56, .64, 1);/* a little overshoot: things popping */
  --d-1: 110ms;   /* colour, press */
  --d-2: 240ms;   /* hover, small moves */
  --d-3: 480ms;   /* panels, menus */
  --d-4: 800ms;   /* reveals */

  /* ---- depth */
  --bevel: inset 2px 2px 0 rgba(255, 255, 255, .55), inset -2px -2px 0 rgba(0, 0, 0, .28);
  --bevel-in: inset 2px 2px 0 rgba(0, 0, 0, .28), inset -2px -2px 0 rgba(255, 255, 255, .4);
  --glass-edge: inset 0 1px 0 rgba(255, 255, 255, .35);
  --float: 0 30px 80px rgba(0, 0, 0, .5);
}

* { box-sizing: border-box; }

/* Components below set their own display; never let that override [hidden]. */
[hidden] { display: none !important; }

html, body { margin: 0; height: 100%; }

body {
  background-color: var(--night);
  /* tiny checker tile, the way every 2003 site had one, under a soft pool of light */
  background-image:
    radial-gradient(90% 70% at 50% 40%, rgba(204, 67, 100, .07), transparent 70%),
    linear-gradient(45deg, #23242a 25%, transparent 25%, transparent 75%, #23242a 75%),
    linear-gradient(45deg, #23242a 25%, transparent 25%, transparent 75%, #23242a 75%);
  background-size: 100% 100%, 8px 8px, 8px 8px;
  background-position: 0 0, 0 0, 4px 4px;
  color: var(--ink);
  font-family: var(--body);
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

::selection { background: var(--pink); color: #fff; }

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

.skip-link {
  position: fixed; left: 8px; top: -60px; z-index: 50;
  background: var(--gold); color: var(--ink); padding: 8px 12px;
  font: 12px var(--pixel); text-decoration: none; border: 2px solid var(--ink);
  transition: top var(--d-2) var(--ease-out);
}
.skip-link:focus { top: 8px; }

:focus-visible { outline: 2px dashed var(--gold); outline-offset: 2px; animation: focus-in var(--d-2) var(--ease-out); }
@keyframes focus-in { from { outline-offset: 8px; outline-color: transparent; } }

/* ------------------------------------------------------------- buttons */
/* One tactile button: it lifts off its shadow on hover, a sheen crosses it,
   it presses into the shadow on click, and a pixel ripple spreads from the
   press. --mx/--my come from the magnetic pull (js/fx.js). */
.btn, .menu-btn, .room .close, .room .lower, .dialog-actions button, .dock button, .pill, .ca, .gen-placeholder button {
  --lift: 0px;
  --drop: 0px;
  --drop-c: var(--pink);
  position: relative; overflow: hidden; isolation: isolate;
  font: 11px/1 var(--pixel);
  letter-spacing: .02em;
  color: var(--ink);
  background: var(--cream);
  border: 2px solid var(--ink);
  box-shadow: var(--bevel), var(--drop) var(--drop) 0 var(--drop-c);
  padding: 8px 12px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transform: translate(calc(var(--mx, 0px) - var(--lift)), calc(var(--my, 0px) - var(--lift)));
  transition:
    transform var(--d-2) var(--ease-out),
    box-shadow var(--d-2) var(--ease-out),
    background-color var(--d-1) linear,
    border-color var(--d-1) linear,
    color var(--d-1) linear;
}
.btn::before, .menu-btn::before, .room .close::before, .room .lower::before, .dialog-actions button::before, .dock button::before, .pill::before, .ca::before,
.aff-btn::before, .ub-btn::before, .ub-mode::before, .brand::before {
  content: ''; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: linear-gradient(105deg, transparent 38%, rgba(255, 255, 255, .6) 50%, transparent 62%);
  translate: -130% 0;
}
.btn:hover, .menu-btn:hover, .room .close:hover, .room .lower:hover, .dialog-actions button:hover, .dock button:hover, .pill:hover, .ca:hover {
  --lift: 1px;
  background: var(--gold);
}
.btn:hover::before, .menu-btn:hover::before, .room .close:hover::before, .room .lower:hover::before, .dialog-actions button:hover::before, .dock button:hover::before, .pill:hover::before, .ca:hover::before,
.aff-btn:hover::before, .ub-btn:hover::before, .ub-mode:hover::before, .brand:hover::before {
  translate: 130% 0;
  transition: translate .7s var(--ease-out);
}
.btn:active, .menu-btn:active, .room .close:active, .room .lower:active, .dialog-actions button:active, .dock button:active, .pill:active, .ca:active {
  --lift: -2px;
  box-shadow: var(--bevel-in), 0 0 0 var(--drop-c);
  transition-duration: 60ms;
}

/* the ripple: a square of the button's own ink, stepping outward */
.rp {
  position: absolute; z-index: -1; pointer-events: none;
  background: currentColor; opacity: .22;
  scale: 0;
  animation: rp .55s steps(9, end) forwards;
}
@keyframes rp { to { scale: 1; opacity: 0; } }

/* -------------------------------------------------------------- topbar */
.topbar {
  position: fixed; inset: 10px 10px auto 10px; z-index: 20;
  display: flex; justify-content: space-between; align-items: flex-start;
  pointer-events: none;
}
.topbar > * { pointer-events: auto; }

.brand {
  position: relative; overflow: hidden; isolation: isolate;
  display: inline-flex; flex-direction: column; align-items: flex-end;
  padding: 6px 10px 5px;
  background: var(--cream);
  border: 2px solid var(--ink);
  box-shadow: var(--bevel), 3px 3px 0 var(--pink);
  color: var(--ink); text-decoration: none; line-height: 1;
  transform: translate(var(--mx, 0px), var(--my, 0px));
  transition: transform var(--d-2) var(--ease-out), box-shadow var(--d-2) var(--ease-out), opacity .6s linear, translate .8s var(--ease-out);
}
.brand:hover { box-shadow: var(--bevel), 5px 5px 0 var(--pink); transform: translate(calc(var(--mx, 0px) - 1px), calc(var(--my, 0px) - 1px)); }
.brand:active { box-shadow: var(--bevel-in), 1px 1px 0 var(--pink); transform: translate(2px, 2px); transition-duration: 60ms; }
.brand-word { font: 22px/1 var(--brand); letter-spacing: .02em; }
.brand-sub { font: 8px/1 var(--pixel); color: var(--pink); margin-top: 3px; }

.menu-btn { --drop: 3px; }
.menu-btn:hover { --drop: 5px; }
.menu-btn[aria-expanded="true"] { background: var(--gold); --lift: -1px; --drop: 2px; }

.top-actions { display: flex; gap: 8px; align-items: flex-start; transition: opacity .6s linear .1s, translate .8s var(--ease-out) .1s; }

/* Everything on the page chrome waits for the resort to appear, then eases in. */
body:not(.ready) .brand, body:not(.ready) .top-actions { opacity: 0; translate: 0 -16px; }
body:not(.ready) .hud { opacity: 0; translate: -16px 0; }

/* sound: a mute button with a little equaliser, and a volume drawer */
.sound-ctl { display: flex; flex-direction: row-reverse; align-items: stretch; }
.eq { display: inline-flex; align-items: flex-end; gap: 1px; width: 8px; height: 10px; }
.eq i { display: block; width: 2px; height: 5px; background: currentColor; }
.eq i:nth-child(2) { height: 9px; }
.eq i:nth-child(3) { height: 7px; }
.sound-btn[aria-pressed="false"] .eq i { height: 2px; }
.sound-btn.live .eq i { animation: eq .9s steps(5, end) infinite alternate; }
.sound-btn.live .eq i:nth-child(2) { animation-duration: .7s; animation-delay: -.3s; }
.sound-btn.live .eq i:nth-child(3) { animation-duration: 1.1s; animation-delay: -.6s; }
@keyframes eq { from { height: 2px; } to { height: 10px; } }
.sound-btn[aria-pressed="false"] { color: var(--ink-2); }
.sound-btn[aria-pressed="false"] .sound-label { text-decoration: line-through; text-decoration-color: var(--pink); }

.vol-wrap {
  display: flex; align-items: center; width: 0; padding: 0; overflow: hidden;
  background: var(--ink); border: 2px solid var(--ink); border-right: 0; opacity: 0;
  transition: width var(--d-3) var(--ease-out), padding var(--d-3) var(--ease-out), opacity var(--d-2) linear;
}
.sound-ctl:hover .vol-wrap, .sound-ctl:focus-within .vol-wrap { width: 96px; padding: 0 8px; opacity: 1; }
body.portrait .vol-wrap { display: none; }

.vol {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 16px; margin: 0; background: transparent;
}
.vol::-webkit-slider-runnable-track {
  height: 6px;
  background:
    repeating-linear-gradient(90deg, transparent 0 4px, var(--ink) 4px 6px),
    linear-gradient(90deg, var(--pink-hi) var(--v, 70%), #60616a var(--v, 70%));
}
.vol::-moz-range-track {
  height: 6px;
  background:
    repeating-linear-gradient(90deg, transparent 0 4px, var(--ink) 4px 6px),
    linear-gradient(90deg, var(--pink-hi) var(--v, 70%), #60616a var(--v, 70%));
}
.vol::-webkit-slider-thumb {
  -webkit-appearance: none; width: 8px; height: 16px; margin-top: -5px;
  background: var(--cream); border: 2px solid var(--ink); box-shadow: 1px 1px 0 var(--pink);
  transition: scale var(--d-2) var(--ease-spring), background-color var(--d-1) linear;
}
.vol::-moz-range-thumb {
  width: 4px; height: 12px; border-radius: 0;
  background: var(--cream); border: 2px solid var(--ink); box-shadow: 1px 1px 0 var(--pink);
}
.vol:hover::-webkit-slider-thumb, .vol:focus-visible::-webkit-slider-thumb { background: var(--gold); scale: 1.15; }

/* ----------------------------------------------------------- directory */
.directory {
  position: fixed; right: 10px; top: 58px; z-index: 25;
  width: min(300px, calc(100vw - 20px));
  max-height: calc(100dvh - 70px); overflow-y: auto; overscroll-behavior: contain;
  background: var(--paper);
  border: 2px solid var(--ink);
  box-shadow: 4px 4px 0 var(--pink), 0 24px 60px rgba(0, 0, 0, .35);
  transform-origin: 100% 0;
  opacity: 0; scale: .96; translate: 0 -8px; clip-path: inset(0 -70px 100% -70px);
  transition: opacity var(--d-2) linear, scale var(--d-2) var(--ease-in), translate var(--d-2) var(--ease-in), clip-path var(--d-2) var(--ease-in);
}
.directory.open {
  opacity: 1; scale: 1; translate: 0 0; clip-path: inset(0 -70px -90px -70px);
  transition: opacity var(--d-1) linear, scale var(--d-3) var(--ease-spring), translate var(--d-3) var(--ease-out), clip-path var(--d-3) var(--ease-out);
}
.dir-title {
  margin: 0; padding: 7px 10px 6px;
  background: linear-gradient(var(--pink-hi), var(--pink) 60%, var(--pink-lo));
  color: #fff; font: 11px var(--pixel);
  text-shadow: 1px 1px 0 var(--pink-lo);
}
.directory ul { list-style: none; margin: 0; padding: 6px; }
.directory li { opacity: 0; translate: 12px 0; transition: opacity var(--d-2) linear, translate var(--d-3) var(--ease-out); }
.directory.open li { opacity: 1; translate: 0 0; transition-delay: calc(var(--i, 0) * 24ms + 70ms); }
.directory li a {
  position: relative; overflow: hidden; isolation: isolate;
  display: flex; justify-content: space-between; align-items: baseline; gap: 10px;
  padding: 7px 8px; color: var(--ink); text-decoration: none;
  font: 600 14px var(--body);
  border-bottom: 1px dotted #d8c7ab;
  background: linear-gradient(var(--gold), var(--gold)) no-repeat 0 0 / 0% 100%;
  transition: background-size var(--d-2) var(--ease-out), padding var(--d-2) var(--ease-out);
}
.directory li a:hover, .directory li a:focus-visible { background-size: 100% 100%; padding-left: 14px; }
.directory li a[aria-current] { padding-left: 18px; }
.directory li a[aria-current]::before {
  content: ''; position: absolute; left: 6px; top: 50%; width: 6px; height: 6px; margin-top: -3px;
  background: var(--pink); box-shadow: 1px 1px 0 var(--ink);
}
.directory li small { font: 9px var(--pixel); color: var(--pink); font-weight: normal; flex: none; }
.dir-sound { display: none; align-items: center; gap: 10px; padding: 8px 12px; border-top: 2px solid var(--ink); background: var(--ink); }
.dir-sound span { font: 10px var(--pixel); color: var(--cream); }
body.portrait .dir-sound { display: flex; }
.dir-foot { display: flex; flex-wrap: wrap; gap: 4px 12px; padding: 8px 12px 10px; border-top: 2px solid var(--ink); }
.dir-foot a { font: 12px var(--body); color: var(--pink); }

/* --------------------------------------------------------------- stage */
.stage { height: 100%; display: flex; flex-direction: column; }

/* The scene sits behind a lens: a vignette, the faintest scanlines, and a
   pool of warm light that follows the pointer. */
.vp-wrap { position: relative; flex: none; transition: filter var(--d-3) var(--ease-out); }
.lens {
  position: absolute; inset: 0; z-index: 2; pointer-events: none;
  background:
    radial-gradient(125% 95% at 50% 45%, transparent 52%, rgba(10, 6, 16, .46) 100%),
    repeating-linear-gradient(0deg, rgba(0, 0, 0, .045) 0 1px, transparent 1px 3px);
}
.lens::after {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(260px circle at var(--lx, 50%) var(--ly, 40%), rgba(255, 232, 190, .5), transparent 72%);
  mix-blend-mode: soft-light; opacity: 0;
  transition: opacity .8s linear;
}
.lens.lit::after { opacity: 1; }

.viewport {
  position: relative;
  overflow: hidden;
  display: grid;
  place-items: center;
  flex: none;
}
.sizer { position: relative; flex: none; }
.world {
  position: absolute; left: 0; top: 0;
  width: 320px; height: 180px;
  transform-origin: 0 0;
}
#mirror { display: none; }
#scene {
  display: block; width: 320px; height: 180px;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

/* (the room stays bright behind the glass, as in the reference) */
body.panel-up .hotspots { visibility: hidden; }

/* hotspots live in scene coordinates (1 unit = 1 scene pixel) */
.hotspots { position: absolute; inset: 0; }
.hotspot {
  position: absolute; padding: 0; margin: 0;
  background: transparent; border: 0;
  cursor: pointer;
}
.hotspot:focus-visible { outline: 1px dashed var(--gold); outline-offset: 1px; animation: none; }
.hotspot .tag {
  position: absolute; left: 50%; bottom: calc(100% + 3px);
  transform: translateX(-50%);
  transform-origin: 50% 100%;
  white-space: nowrap;
  font: 5px/1 var(--pixel);
  color: var(--cream);
  background: var(--ink);
  padding: 2px 3px 1px;
  box-shadow: 1px 1px 0 var(--pink);
  opacity: 0; scale: .6; pointer-events: none;
  transition: opacity var(--d-1) linear, scale var(--d-2) var(--ease-spring);
}
.hotspot.tag-below .tag { bottom: auto; top: calc(100% + 3px); transform-origin: 50% 0; }
.hotspot.tag-left .tag { left: 0; transform: none; transform-origin: 0 100%; }
.hotspot.tag-right .tag { left: auto; right: 0; transform: none; transform-origin: 100% 100%; }
.hotspot:hover .tag, .hotspot:focus-visible .tag { opacity: 1; scale: 1; }

/* ----------------------------------------------------------------- HUD */
.below { flex: 1; min-height: 0; }
.hud {
  position: fixed; left: 10px; bottom: 10px; z-index: 10;
  display: flex; flex-direction: column; gap: 4px; align-items: flex-start;
  pointer-events: none;
  transition: opacity .6s linear .2s, translate .8s var(--ease-out) .2s;
}
.hud-place {
  font: 12px/1 var(--pixel); color: var(--ink);
  background: var(--gold); border: 2px solid var(--ink);
  padding: 5px 8px 4px; box-shadow: var(--bevel), 2px 2px 0 var(--ink);
}
/* The hint is for screen readers only; on screen the yellow label stands alone. */
.hud-hint { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.hud-place.swap { animation: place-in var(--d-3) var(--ease-out); }
@keyframes place-in { from { clip-path: inset(0 100% 0 0); translate: -8px 0; } to { clip-path: inset(0 -4px -4px 0); translate: 0 0; } }
.dock { display: none; }   /* (phones only: the caption over the scene) */


/* The transition veil: an ordered-dither dissolve painted on a tiny canvas
   (js/veil.js), ink between scenes and Relaxio pink into rooms. */
.fade { position: fixed; inset: 0; z-index: 30; pointer-events: none; visibility: hidden; }
.fade.on { visibility: visible; }
.fade canvas { display: block; width: 100%; height: 100%; image-rendering: pixelated; image-rendering: crisp-edges; }

/* Walking a passage: nothing to click until you arrive. */
body.travelling .hotspots, body.travelling .hud { visibility: hidden; }

/* Scene intro: hide the HUD while the foliage parts. */
body.intro .hud, body.intro .dock, body.intro .hotspots { visibility: hidden; }

/* Hotspots whose feedback is in the scene itself (the gate toast). */
.hotspot.quiet .tag { display: none; }

/* -------------------------------------------------------------- dialog */
.dialog {
  position: fixed; z-index: 28;
  left: 50%; bottom: 16px; transform: translate(-50%, 0);
  width: min(640px, calc(100vw - 20px));
  display: flex; gap: 12px; align-items: flex-start;
  padding: 10px;
  background: var(--ink);
  border: 3px solid var(--cream);
  outline: 3px solid var(--ink);
  box-shadow: 6px 6px 0 var(--pink), 0 24px 60px rgba(0, 0, 0, .4);
  color: var(--cream);
  cursor: pointer;
  opacity: 0; translate: 0 18px; scale: .97;
  transition: opacity var(--d-1) linear, translate var(--d-2) var(--ease-in), scale var(--d-2) var(--ease-in);
}
.dialog.open {
  opacity: 1; translate: 0 0; scale: 1;
  transition: opacity var(--d-1) linear, translate var(--d-3) var(--ease-spring), scale var(--d-3) var(--ease-spring);
}
.dlg-portrait {
  flex: none; width: 88px; height: 88px;
  image-rendering: pixelated;
  border: 2px solid var(--cream);
  background: var(--ink-2);
  scale: .8; opacity: 0;
  transition: scale var(--d-3) var(--ease-spring) 60ms, opacity var(--d-2) linear 60ms;
}
.dialog.open .dlg-portrait { scale: 1; opacity: 1; }
.dialog-text { flex: 1; min-width: 0; }
.speaker { margin: 0 0 6px; font: 11px var(--pixel); color: var(--pink-soft); }
.line { margin: 0; font: 500 16px/1.5 var(--body); min-height: 3em; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 6px; margin-top: 8px; }
.dialog-actions button { padding: 6px 10px; font-size: 10px; }
.dialog-actions .skip { background: transparent; color: var(--cream); border-color: var(--ink-2); box-shadow: none; }
.dialog-actions .skip:hover { background: var(--ink-2); }
/* when the line has finished typing, the Next button nods */
.dialog-actions .next::after { content: '\25B8'; font-family: var(--body); font-size: 12px; line-height: 0; opacity: .35; }
.dialog.typed .next::after { opacity: 1; animation: nudge .8s steps(2, end) infinite; }
@keyframes nudge { to { translate: 3px 0; } }

/* ---------------------------------------------------------------- room */
/* A room's content is a slab of glass standing in the scene: a sheet of the
   room's own reflection that rises out of the waterline, a little wider at
   the top than the bottom, mirrored in the water under it. Its contents fade
   in only once it is standing. (REFERENCE.md, 30.2-31.3s) */
.room {
  --glass-line: rgba(255, 255, 255, .3);
  --glass-text: #f4f8f8;
  --glass-muted: #c6d6d6;
  --glass: rgba(20, 62, 68, .4);                 /* legibility tint over the reflection */
  --glass-top: rgba(200, 240, 232, .26);
  --rule: rgba(150, 196, 255, .5);               /* the thin blue rules */
  position: fixed; inset: 0; z-index: 22;
  pointer-events: none;
  /* nothing of the slab (or its mirror image) shows below the scene itself */
  clip-path: inset(0 0 var(--scene-gap, 0px) 0);
}
.room-stand {
  position: absolute; left: 50%; translate: -50% 0;
  /* its lower edge is the waterline: 18% up from the bottom of the scene */
  top: 56px; bottom: calc(var(--scene-gap, 0px) + var(--scene-h, 100vh) * .18);
  width: min(max(940px, 52vw), calc(100vw - 24px)); padding: 0 36px;
  display: flex; align-items: flex-end; justify-content: center;
  overflow: hidden;
  container: slab / size;
  -webkit-box-reflect: below 0 linear-gradient(rgba(255, 255, 255, .34), rgba(255, 255, 255, 0) 46%);
}
.room-panel {
  position: relative; isolation: isolate; pointer-events: auto;
  /* the tilt lifts the top edge by about 3.4% of the slab's height, so the
     slab stops short of the stand's top and its head is never cut off */
  width: 100%; max-width: clamp(780px, 44vw, 1160px); max-height: 95.5%;
  display: flex; flex-direction: column;
  color: var(--glass-text);
  border-radius: 24px 24px 18px 18px;
  overflow: hidden;
  /* perspective scales with the window so the slab's shape is the same at any size */
  transform: perspective(180vh) rotateX(-5deg); transform-origin: 50% 100%;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .6), inset 0 0 0 1px rgba(255, 255, 255, .14), inset 0 -18px 30px rgba(8, 28, 32, .35);
  -webkit-backdrop-filter: blur(4px) saturate(1.15);
  backdrop-filter: blur(4px) saturate(1.15);
}
/* the reflection itself (js sets --glass-img from the room's backdrop) */
.room-glass {
  position: absolute; inset: -16px; z-index: -2;
  background: var(--glass-img, none) center / 100% 100% no-repeat, #4f8486;
  filter: blur(8px) saturate(1.5) brightness(1.1);
  opacity: .88;
}
.room-panel::before {
  content: ''; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(180deg, var(--glass-top), rgba(0, 0, 0, 0) 40%), var(--glass);
}
/* a slow sheen crossing the glass */
.room-panel::after {
  content: ''; position: absolute; inset: 0; z-index: 4; pointer-events: none;
  background: linear-gradient(104deg, rgba(255, 255, 255, 0) 42%, rgba(255, 255, 255, .13) 50%, rgba(255, 255, 255, 0) 58%);
  background-size: 300% 100%; background-position: 120% 0;
  animation: glass-sheen 9s var(--ease-in-out) infinite;
}
@keyframes glass-sheen { 0%, 55% { background-position: 120% 0; } 100% { background-position: -40% 0; } }
/* The panel surfaces out of the scene (js: raisePanel / sinkPanel). */
.room-panel.sunk { visibility: hidden; pointer-events: none; }
.room-scroll {
  overflow-y: auto; flex: 1; overscroll-behavior: contain;
  scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, .5) transparent;
  transition: opacity .3s linear;
}
.room-panel.veiled .room-scroll { opacity: 0; }

/* Head: the stacked wordmark, the white bar, the title on its thin blue rule,
   and round glossy buttons, as on the reference's player. */
.room-head {
  position: sticky; top: 0; z-index: 2;
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 18px; align-items: center;
  padding: 18px 20px 12px 24px;
  background: linear-gradient(rgba(22, 54, 58, .82), rgba(22, 54, 58, .6));
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  transition: box-shadow var(--d-3) var(--ease-out);
}
.room-head.scrolled { box-shadow: 0 10px 24px rgba(0, 0, 0, .28); }
.room-mark {
  margin: 0; font: 400 15px/.92 var(--body); letter-spacing: -.01em; text-align: right; color: #fff;
  opacity: .92;
}
.room-titles { min-width: 0; }
/* the white bar: how far through the room you have read */
.room-progress {
  height: 5px; margin: 0 0 9px; border-radius: 1px;
  background: linear-gradient(90deg, #fff, #fff) no-repeat 0 0 / calc(22% + var(--p, 0) * 78%) 100%, rgba(255, 255, 255, .16);
  transition: background-size .15s linear;
}
.room-head .place { margin: 0 0 3px; font: 500 10px var(--body); letter-spacing: .22em; text-transform: uppercase; color: var(--glass-muted); }
.room-head h2 {
  margin: 0; padding-bottom: 6px; border-bottom: 1px solid var(--rule);
  font: 400 21px/1.15 var(--body); letter-spacing: .05em; text-transform: uppercase; color: #fff;
  text-wrap: balance; overflow-wrap: anywhere;
}
.room-head h2:focus { outline: none; }
.room-head-actions { display: flex; gap: 8px; flex: none; }
.room .close, .room .lower {
  --drop-c: transparent;
  width: 38px; height: 38px; padding: 0; justify-content: center; border-radius: 50%;
  color: #fff; font: 11px/1 var(--body); letter-spacing: -2px;
  border: 1px solid rgba(255, 255, 255, .32);
  background: radial-gradient(circle at 50% 22%, #7b8186 0%, #24272a 42%, #000 100%);
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, .55), 0 3px 8px rgba(0, 0, 0, .45);
}
.room .lower::after { content: '\25BC'; letter-spacing: 0; translate: 0 1px; }
.room .close::after { content: '\25C0\25C0'; translate: -1px 0; }
.room .close:hover, .room .lower:hover {
  color: #fff; background: radial-gradient(circle at 50% 22%, #a9b0b5 0%, #3a3f44 42%, #0b0c0f 100%);
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, .7), 0 0 0 3px rgba(255, 255, 255, .16), 0 4px 10px rgba(0, 0, 0, .5);
}
.room .close:active, .room .lower:active { box-shadow: inset 0 2px 5px rgba(0, 0, 0, .7); }

/* the thin rounded outline that frames the content */
.room-body {
  margin: 6px 16px 0; padding: 18px 20px 8px;
  border: 1px solid var(--glass-line); border-radius: 14px;
  font-size: clamp(14.5px, .5vw + 8px, 18px); line-height: 1.72;   /* reads the same on a big monitor */
  text-shadow: 0 1px 2px rgba(6, 24, 28, .55);
}
.room-body p { margin: 0 0 14px; }
.room-body h3 {
  margin: 30px 0 12px; padding: 0 0 6px;
  font: 500 12px var(--body); letter-spacing: .18em; text-transform: uppercase; color: #fff;
  border-bottom: 1px solid var(--rule);
}
.room-body h4 { margin: 0 0 6px; font: 10px var(--pixel); color: var(--pink-soft); }
.room-body a { color: var(--pink-soft); }
/* text links: the underline redraws itself from the left on hover */
.room-body p a, .room-body li a, .room-foot a, .dir-foot a {
  text-decoration: none;
  background: linear-gradient(currentColor, currentColor) no-repeat 0 100% / 100% 1px;
  transition: color var(--d-1) linear;
}
.room-body p a:hover, .room-body li a:hover, .room-foot a:hover, .dir-foot a:hover { color: #fff; animation: underline var(--d-3) var(--ease-out); }
.dir-foot a:hover { color: var(--pink-lo); }
@keyframes underline { from { background-size: 0% 1px; } }
.room-body code { font: 12px 'Courier New', monospace; color: #c9f7cf; background: rgba(0, 0, 0, .35); padding: 1px 4px; word-break: break-all; }
.lede { font-size: var(--t-md); line-height: 1.55; color: #fff; }
.motto { font: var(--t-xl)/1.1 var(--brand); color: var(--pink-soft); margin: 18px 0 !important; text-shadow: 2px 2px 0 var(--pink-lo); }
.note { font-size: var(--t-sm); color: var(--glass-muted); border-left: 3px solid var(--gold); padding-left: 10px; }
.signoff { font: 18px var(--brand); color: var(--pink-soft); }
.eyebrow-date { font: 11px var(--pixel); color: var(--gold); margin-bottom: 6px !important; }

/* Content rises in piece by piece as it scrolls into view (js/fx.js). The
   classes are removed once a piece has landed. */
.rv { opacity: 0; translate: 0 18px; }
.rv.in { opacity: 1; translate: 0 0; transition: opacity .6s linear var(--rv-d, 0ms), translate var(--d-4) var(--ease-out) var(--rv-d, 0ms); }
.timeline li.rv::before { scale: 0; }
.timeline li.rv.in::before { scale: 1; transition: scale var(--d-3) var(--ease-spring) calc(var(--rv-d, 0ms) + 160ms); }

.room-foot {
  margin: 14px 36px 18px; padding-top: 12px;
  border-top: 1px dotted var(--glass-line);
  display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap;
}
.room-foot p { margin: 0; font: 10px var(--pixel); color: var(--glass-muted); }
.room-foot a { color: var(--pink-soft); font-size: 13px; }

/* photos */
.shot {
  position: relative; margin: 0 0 16px;
  border: 1px solid rgba(255, 255, 255, .5);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .6), 4px 4px 0 rgba(143, 211, 199, .55);
  background: #000; overflow: hidden;
}
.shot img, .develop-overlay { display: block; width: 100%; height: auto; }
.develop-overlay {
  position: absolute; inset: 0; height: 100%;
  object-fit: cover; image-rendering: pixelated;
}
.shot.wide img { aspect-ratio: 16 / 9; object-fit: cover; height: auto; }
.shot.crop-top img { object-position: center 20%; }
.shot.square { max-width: 280px; }
.shot.narrow { max-width: 380px; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 4px; }
.pair .shot img { aspect-ratio: 1; object-fit: cover; }
/* glass buttons inside rooms */
.room-body .pill, .room-body .ca {
  --drop-c: transparent;
  color: #fff; background: linear-gradient(rgba(255, 255, 255, .22), rgba(255, 255, 255, .06));
  border: 1px solid rgba(255, 255, 255, .55); border-radius: 3px;
  box-shadow: var(--glass-edge);
}
.room-body .pill:hover, .room-body .ca:hover { background: var(--pink); border-color: #fff; color: #fff; box-shadow: var(--glass-edge), 0 6px 16px rgba(204, 67, 100, .45); }
.room-body .pill:active, .room-body .ca:active { box-shadow: inset 0 2px 4px rgba(0, 0, 0, .35); }
.pills { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 6px; }
.pills.center { justify-content: center; margin: 18px 0; }
.pill { font-size: 11px; }
.pill::after { content: '\2197'; font-family: var(--body); transition: translate var(--d-2) var(--ease-spring); }
.pill:hover::after { translate: 2px -2px; }

.desk-block {
  margin: 0 0 12px; padding: 12px 14px;
  background: rgba(255, 255, 255, .06); border: 1px solid var(--glass-line); border-radius: 4px;
  transition: background-color var(--d-2) linear, border-color var(--d-2) linear;
}
.desk-block:hover { background: rgba(255, 255, 255, .09); border-color: rgba(255, 255, 255, .38); }
.desk-block p:last-child, .desk-block .pills:last-child { margin-bottom: 0; }
.ca { width: 100%; justify-content: space-between; margin: 0 0 14px; text-align: left; }
.ca code { background: transparent; font-size: 11px; padding: 0; color: #c9f7cf; }
.ca span { flex: none; color: var(--gold); }

.signposts { display: grid; gap: 8px; margin: 6px 0 14px; }
.signposts a {
  position: relative; overflow: hidden; isolation: isolate;
  display: grid; grid-template-columns: 110px 1fr; gap: 10px; align-items: baseline;
  padding: 9px 30px 9px 12px; text-decoration: none; color: var(--ink);
  background: var(--wood); border: 2px solid var(--wood-lo); box-shadow: var(--bevel), 0 0 0 var(--wood-lo);
  transition: transform var(--d-2) var(--ease-out), box-shadow var(--d-2) var(--ease-out), background-color var(--d-1) linear;
}
.signposts a::after {
  content: '\25B8'; position: absolute; right: 12px; top: 50%; translate: -6px -50%; opacity: 0;
  font: 14px/1 var(--body); color: var(--wood-lo);
  transition: translate var(--d-2) var(--ease-spring), opacity var(--d-1) linear;
}
.signposts a:hover { background: var(--gold); transform: translate(3px, -1px); box-shadow: var(--bevel), -3px 3px 0 var(--wood-lo); }
.signposts a:hover::after { translate: 0 -50%; opacity: 1; }
.signposts a:active { transform: translate(1px, 1px); box-shadow: var(--bevel-in), 0 0 0 var(--wood-lo); transition-duration: 60ms; }
.signposts b { font: 11px var(--pixel); }
.signposts span { font-size: 13.5px; }

/* lore */
.timeline { list-style: none; margin: 0; padding: 0 0 0 18px; border-left: 2px dashed var(--pink-soft); }
.timeline li { position: relative; margin-bottom: 22px; }
.timeline li::before {
  content: ''; position: absolute; left: -25px; top: 4px;
  width: 10px; height: 10px; background: var(--gold); border: 1px solid #000;
  box-shadow: 0 0 0 3px rgba(242, 193, 78, .18);
}
.timeline time { display: block; font: 11px var(--pixel); color: var(--gold); margin-bottom: 6px; }
.vice-list { columns: 2; margin: 0 0 14px; padding-left: 20px; }
.vices { display: grid; gap: 6px; margin-bottom: 8px; }
.vice { border: 1px solid var(--glass-line); background: rgba(255, 255, 255, .05); border-radius: 3px; transition: border-color var(--d-2) linear, background-color var(--d-2) linear; }
.vice:hover { border-color: rgba(255, 255, 255, .4); }
.vice[open]:not(.is-closing) { background: rgba(255, 255, 255, .08); }
.vice summary {
  cursor: pointer; list-style: none; padding: 9px 10px;
  font: 11px var(--pixel); display: flex; gap: 10px; align-items: baseline;
  transition: background-color var(--d-2) linear, padding var(--d-2) var(--ease-out);
}
.vice summary:hover { padding-left: 14px; }
.vice summary::-webkit-details-marker { display: none; }
.vice summary em { font: italic 12.5px var(--body); color: var(--glass-muted); }
.vice summary::after { content: '+'; margin-left: auto; color: var(--gold); transition: rotate var(--d-3) var(--ease-spring); }
.vice[open]:not(.is-closing) summary::after { rotate: 135deg; }
.vice[open]:not(.is-closing) summary { background: rgba(204, 67, 100, .45); border-bottom: 1px solid var(--glass-line); }
.vice .num { display: inline-block; min-width: 26px; color: var(--gold); }
.vice p { padding: 10px 12px; margin: 0 !important; font-size: 13.5px; }

/* cards that tilt toward the pointer (js/fx.js sets --rx/--ry/--gx/--gy) */
.aff-canvas, .ub-card, .shot.ascended-art, .merch a, .ascended-grid a {
  transform: perspective(800px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
  transition: transform .6s var(--ease-out), box-shadow .6s var(--ease-out), border-color var(--d-2) linear;
}
.tilting { transition-duration: .14s, .6s, var(--d-2) !important; }
.shot.ascended-art::after, .merch .shot::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(60% 60% at var(--gx, 50%) var(--gy, 0%), rgba(255, 255, 255, .28), transparent 70%);
  opacity: 0; transition: opacity var(--d-3) linear;
}
.shot.ascended-art.tilting::after, .merch a:hover .shot::after { opacity: 1; }

/* store */
.merch { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.merch a { display: block; }
.merch .shot { margin: 0; background: #fff; transition: box-shadow var(--d-2) var(--ease-out); }
.merch .shot img { transition: scale .7s var(--ease-out); }
.merch a:hover .shot { box-shadow: 0 0 0 1px #000, 6px 6px 0 var(--gold); }
.merch a:hover .shot img { scale: 1.05; }

/* basement: same glass, but greener and darker */
.room[data-room="basement"] { --glass: rgba(6, 14, 10, .78); --glass-top: rgba(120, 200, 140, .12); --rule: rgba(159, 242, 168, .45); }
.room[data-room="basement"] .room-head { background: linear-gradient(rgba(14, 30, 20, .9), rgba(14, 30, 20, .7)); }
.room[data-room="basement"] .room-body h3 { color: var(--ok); }
.room[data-room="basement"] .motto { color: var(--ok); text-shadow: none; }
.room[data-room="basement"] .room-body a { color: var(--ok); }
.solved { font: 11px var(--pixel); color: var(--ok); margin-bottom: 4px !important; }
.casefile { border: 1px solid rgba(159, 242, 168, .3); padding: 10px 12px; margin: 14px 0; background: rgba(0, 0, 0, .4); }
.casefile summary { cursor: pointer; font: 11px var(--pixel); color: var(--ok); }
.casefile pre { white-space: pre-wrap; word-break: break-all; font: 11px/1.5 'Courier New', monospace; color: #c9f7cf; background: #000; padding: 8px; }
.casefile blockquote { margin: 0 0 12px; padding-left: 10px; border-left: 3px solid #4a6b4f; font-style: italic; }

/* generators */
.generator { margin: 18px 0; }
.gen-placeholder {
  padding: 18px; text-align: center;
  background: repeating-linear-gradient(-45deg, rgba(255, 255, 255, .05), rgba(255, 255, 255, .05) 8px, rgba(255, 255, 255, .1) 8px, rgba(255, 255, 255, .1) 16px);
  border: 1px dashed var(--pink-soft);
}
.gen-placeholder p { margin: 8px 0 12px !important; }
.gen-tag { font: 10px var(--pixel); color: #fff; background: var(--pink); padding: 3px 6px; }
.gen-placeholder button[disabled] { opacity: .6; cursor: not-allowed; }

/* Glass buttons shared by the affirmation room and the arcade. */
.aff-btn, .ub-mode, .ub-btn {
  position: relative; overflow: hidden; isolation: isolate;
  font: 10px/1.2 var(--pixel); text-transform: uppercase; letter-spacing: .03em;
  padding: 9px 10px; cursor: pointer; color: #fff;
  background: linear-gradient(rgba(255, 255, 255, .22), rgba(255, 255, 255, .06));
  border: 1px solid rgba(255, 255, 255, .55); border-radius: 3px;
  box-shadow: var(--glass-edge);
  transform: translate(var(--mx, 0px), calc(var(--my, 0px) + var(--ty, 0px))) scale(var(--sc, 1));
  transition: transform var(--d-2) var(--ease-out), box-shadow var(--d-2) var(--ease-out), background-color var(--d-1) linear, border-color var(--d-1) linear, opacity var(--d-2) linear;
}
.aff-btn:hover, .ub-mode:hover, .ub-btn:hover { --ty: -1px; border-color: #fff; background: rgba(255, 255, 255, .25); box-shadow: var(--glass-edge), 0 6px 14px rgba(0, 0, 0, .28); }
.aff-btn:active, .ub-mode:active, .ub-btn:active { --ty: 1px; --sc: .98; box-shadow: inset 0 2px 5px rgba(0, 0, 0, .4); transition-duration: 60ms; }
.aff-btn.aff-primary, .ub-btn.ub-primary { background: linear-gradient(rgba(255, 255, 255, .3), rgba(255, 255, 255, 0) 55%), var(--pink); border-color: #fff; }
.aff-btn.aff-primary:hover, .ub-btn.ub-primary:hover { background: linear-gradient(rgba(255, 255, 255, .34), rgba(255, 255, 255, 0) 55%), #d84f71; box-shadow: var(--glass-edge), 0 8px 20px rgba(204, 67, 100, .5); }
.aff-btn:disabled, .ub-mode:disabled, .ub-btn:disabled { --ty: 0px; --sc: 1; opacity: .5; box-shadow: var(--glass-edge); }
.aff-btn:disabled { cursor: progress; }
.ub-mode:disabled, .ub-btn:disabled { cursor: default; }
.aff-btn:disabled::before, .ub-btn:disabled::before, .ub-mode:disabled::before { display: none; }

/* Interactive rooms (Affirmations, the Arcade) fit one screen: the panel has a
   fixed height, nothing scrolls, and the content sizes itself to the space. */
.room.fit .room-stand { bottom: calc(var(--scene-gap, 0px) + var(--scene-h, 100vh) * .08); }
.room.fit .room-panel { max-width: clamp(860px, 48vw, 1240px); height: 95.5%; }
.room.fit .room-scroll { overflow: hidden; display: flex; flex-direction: column; }
.room.fit .room-head { position: relative; flex: none; }
.room.fit .room-progress { background-size: 100% 100%, auto; }
.room.fit .room-body { flex: 1; min-height: 0; display: flex; flex-direction: column; margin: 6px 16px 16px; padding: 12px; text-shadow: none; }
.room.fit .room-body > .lede, .room.fit .room-foot { display: none; }
.room.fit .generator { flex: 1; min-height: 0; margin: 0; display: flex; flex-direction: column; }
.room.fit .ub { flex: 1; min-height: 0; margin: 0; display: flex; flex-direction: column; }
.room.fit .ub-stage { flex: 1; min-height: 0; grid-template-rows: minmax(0, 1fr); align-items: center; overflow: hidden; container: stage / size; }
.room.fit .ub-screen { align-self: stretch; }
.room.fit .ub-canvas { box-shadow: 0 0 0 1px rgba(255, 255, 255, .4); }

/* Daily Affirmation (js/affirmations/): the card on one side, everything you
   can do on the other. Identical before and after an affirmation. */
.aff-preview {
  flex: 1; min-height: 0; margin: 0; padding: 14px;
  display: grid; grid-template-columns: minmax(0, 1fr) min(250px, 40%); gap: 16px;
  background: none; border: 0; border-radius: 10px;
  transition: border-color var(--d-3) linear, box-shadow var(--d-3) linear;
}
.aff-card {
  --side: 200px;
  position: relative; overflow: hidden; min-height: 0; min-width: 0;
  display: grid; place-items: center; padding: 10px;
  background: rgba(6, 26, 30, .28); border: 1px solid rgba(255, 255, 255, .28); border-radius: 10px;
}
/* while the next card is on its way, light sweeps the frame */
.aff-card::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(105deg, transparent 40%, rgba(255, 255, 255, .14) 50%, transparent 60%);
  translate: -100% 0; opacity: 0;
}
.aff-preview.is-busy .aff-card::after { opacity: 1; animation: sweep 1s var(--ease-in-out) infinite; }
@keyframes sweep { to { translate: 100% 0; } }
.aff-placeholder {
  width: var(--side); height: var(--side);
  display: grid; place-content: center; text-align: center;
  color: var(--glass-muted); font: 11px var(--pixel); text-transform: uppercase;
  border: 1px dashed rgba(255, 255, 255, .25);
}
.aff-placeholder p { margin: 6px 0 0 !important; color: #fff; }
.aff-sparkle { display: inline-block; font-size: 28px; color: var(--gold); animation: twinkle 2.4s var(--ease-in-out) infinite alternate; }
@keyframes twinkle { from { scale: .85; opacity: .6; rotate: -8deg; } to { scale: 1.1; opacity: 1; rotate: 8deg; } }
.aff-canvas {
  display: block; width: var(--side); height: var(--side);
  box-shadow: 0 0 0 1px #000, 5px 5px 0 rgba(204, 67, 100, .6);
}
.aff-canvas.tilting { box-shadow: 0 0 0 1px #000, 9px 12px 0 rgba(204, 67, 100, .45); }
/* a new card develops like a photograph */
.aff-canvas.card-in { animation: card-in .9s var(--ease-out); }
@keyframes card-in {
  from { opacity: 0; scale: .93; filter: brightness(2.4) saturate(0) blur(5px); }
  55% { opacity: 1; filter: brightness(1.25) saturate(.7) blur(0); }
}
.aff-side { min-width: 0; display: flex; flex-direction: column; justify-content: center; gap: 10px; }
.aff-eyebrow { font: 10px var(--pixel); color: var(--gold); letter-spacing: .08em; margin: 0 !important; }
.aff-meta { min-height: 64px; }
.aff-text { margin: 0 !important; font: 16px/1.3 var(--display); color: #fff; }
.aff-who { display: block; margin-top: 6px; font: 9px/1.5 var(--pixel); color: var(--gold); letter-spacing: .06em; text-transform: uppercase; }
.aff-go { display: grid; gap: 8px; }
.aff-go .aff-btn { padding: 12px 10px; }
.aff-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.aff-actions .aff-btn { padding: 9px 4px; font-size: 9px; }
.aff-msg { min-height: 2.8em; margin: 0 !important; font-size: 12px; line-height: 1.4; color: var(--glass-muted); }
.aff-msg[data-type="success"] { color: var(--ok); }
.aff-msg[data-type="warning"] { color: var(--gold); }
.aff-msg[data-type="error"] { color: var(--bad); }
.aff-msg[data-type="rare"] { color: var(--gold); font: 10px/1.6 var(--pixel); text-transform: uppercase; }
.aff-preview.is-rare { border-color: var(--gold); animation: rare-glow 2.2s var(--ease-in-out) infinite alternate; }
@keyframes rare-glow {
  from { box-shadow: 0 0 0 1px rgba(242, 193, 78, .3), 0 0 14px rgba(242, 193, 78, .15); }
  to { box-shadow: 0 0 0 1px rgba(242, 193, 78, .5), 0 0 34px rgba(242, 193, 78, .38); }
}
/* a narrow slab (and phones): the card on top, the controls under it */
@container slab (max-width: 480px) and (min-height: 360px), (orientation: portrait) and (min-height: 520px) {
  .aff-preview { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; gap: 10px; padding: 10px; }
  .aff-side { gap: 8px; text-align: center; }
  .aff-eyebrow { display: none; }
  .aff-meta { min-height: 44px; }
  .aff-text { font-size: 14px; }
  .aff-go { grid-template-columns: 1fr 1fr; }
  .aff-go .aff-btn { padding: 12px 6px; }
  .aff-msg { min-height: 1.4em; }
}

/* a big slab (a large monitor): its head and the affirmation controls grow with it */
@container slab (min-width: 1040px) {
  .room-head { padding: 22px 26px 16px 30px; gap: 22px; }
  .room-mark { font-size: 18px; }
  .room-head .place { font-size: 12px; margin-bottom: 4px; }
  .room-head h2 { font-size: 27px; padding-bottom: 8px; }
  .room-progress { height: 6px; margin-bottom: 11px; }
  .room .close, .room .lower { width: 46px; height: 46px; font-size: 13px; }
  .aff-preview { grid-template-columns: minmax(0, 1fr) 340px; gap: 26px; padding: 18px; }
  .aff-side { gap: 14px; }
  .aff-eyebrow { font-size: 12px; }
  .aff-meta { min-height: 84px; }
  .aff-text { font-size: 23px; }
  .aff-who { font-size: 11px; margin-top: 8px; }
  .aff-go { gap: 10px; }
  .aff-btn { font-size: 12px; }
  .aff-go .aff-btn { padding: 16px 12px; }
  .aff-actions { gap: 8px; }
  .aff-actions .aff-btn { padding: 12px 6px; font-size: 11px; }
  .aff-msg { font-size: 14px; }
}
/* the biggest slab (a large monitor): the controls grow with the card */
@container slab (min-width: 1200px) {
  .aff-preview { grid-template-columns: minmax(0, 1fr) clamp(340px, 34%, 430px); gap: 30px; }
  .aff-text { font-size: 27px; }
  .aff-who { font-size: 12px; }
  .aff-btn { font-size: 13px; }
  .aff-actions .aff-btn { font-size: 12px; }
}

/* a slab wide enough for two columns but not by much: Download gets its own row */
@container slab (max-width: 700px) and (max-height: 359px), (min-width: 481px) and (max-width: 700px) {
  .aff-actions { grid-template-columns: 1fr 1fr; }
  .aff-actions .aff-btn:first-child { grid-column: 1 / -1; }
}

/* a tall slab stacks, so its three small buttons always share one row */
@container slab (orientation: portrait) and (min-height: 520px) {
  .aff-actions { grid-template-columns: repeat(3, 1fr); }
  .aff-actions .aff-btn:first-child { grid-column: auto; }
}

/* A short slab (a small window, or a small phone): everything tightens so
   the room still fits one screen. */
@container slab (max-height: 540px) {
  .room-head { padding: 10px 16px 8px 18px; gap: 12px; }
  .room-mark { font-size: 12px; }
  .room-head h2 { font-size: 17px; padding-bottom: 4px; }
  .room-head .place { font-size: 9px; margin-bottom: 2px; }
  .room-progress { height: 4px; margin-bottom: 6px; }
  .room .close, .room .lower { width: 32px; height: 32px; }
  .room-body { margin: 4px 12px 0; padding: 12px 14px 6px; }
  .room.fit .room-body { margin: 4px 10px 10px; padding: 8px; }
  .aff-preview { padding: 6px; gap: 10px; }
  .aff-card { padding: 6px; }
  .aff-side { gap: 6px; }
  .aff-eyebrow { display: none; }
  .aff-meta { min-height: 36px; }
  .aff-text { font-size: 14px; }
  .aff-who { margin-top: 3px; }
  .aff-go { gap: 6px; }
  .aff-go .aff-btn { padding: 8px 8px; }
  .aff-actions .aff-btn { padding: 7px 4px; }
  .aff-msg { min-height: 1.3em; font-size: 11px; }
}
/* a very short slab (a tiny window): the wordmark steps aside too */
@container slab (max-height: 380px) {
  .room-mark { display: none; }
  .room-head { grid-template-columns: minmax(0, 1fr) auto; padding: 8px 14px 6px 16px; }
  .aff-meta { min-height: 0; }
  .aff-who { display: none; }
  .aff-go .aff-btn { padding: 6px 8px; }
  .aff-actions .aff-btn { padding: 6px 4px; }
}
@container slab (max-height: 540px) and (max-width: 480px) {
  .aff-go .aff-btn { padding: 9px 6px; }
}
/* a small phone held upright, once the browser's own bars are counted: the
   words live on the card alone, so the card can stay a decent size */
@container slab (max-width: 480px) and (min-height: 360px) and (max-height: 440px) {
  .aff-meta { position: absolute; width: 1px; height: 1px; min-height: 0; overflow: hidden; clip-path: inset(50%); }
  .aff-preview { padding: 6px; gap: 8px; }
  .aff-go .aff-btn { padding: 7px 6px; font-size: 9px; }
}
/* the smallest slab there is (an old small phone on its side): the card and
   its controls share the width evenly, and the words live on the card alone */
@container slab (max-height: 359px) {
  .aff-meta { position: absolute; width: 1px; height: 1px; min-height: 0; overflow: hidden; clip-path: inset(50%); }
}
@container slab (max-height: 359px) and (max-width: 480px) {
  .aff-preview { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .aff-go .aff-btn { padding: 5px 6px; }
}

.noscript { color: var(--cream); padding: 40px; font: 14px var(--body); }

/* A short landscape window (a phone on its side): the chrome shrinks and the
   slab uses nearly the whole height. */
body.short .topbar { inset: 6px 8px auto 8px; }
body.short .brand { padding: 4px 8px 3px; }
body.short .brand-word { font-size: 16px; }
body.short .brand-sub { font-size: 7px; margin-top: 2px; }
body.short .menu-btn { padding: 6px 9px; font-size: 10px; }
body.short .directory { top: 42px; }
body.short .hud { left: 8px; bottom: 6px; }
body.short .room-stand { top: 40px; bottom: calc(var(--scene-gap, 0px) + var(--scene-h, 100vh) * .05); }
body.short .room.fit .room-stand { bottom: calc(var(--scene-gap, 0px) + var(--scene-h, 100vh) * .03); }
/* shorter still (a small phone on its side): the slab takes the whole window,
   and the top bar steps aside while it is up (the slab has its own way back) */
body.tiny .room-stand, body.tiny .room.fit .room-stand { top: 4px; bottom: calc(var(--scene-gap, 0px) + 6px); padding: 0 18px; }
body.tiny.panel-up .topbar { visibility: hidden; }

/* -------------------------------------------------------------- phones */
/* Portrait is one full-screen scene, the same journey as the desktop:
     the scene            fills the screen top to bottom; it is wider than the
                          window, so you swipe to look along it (js/main.js)
     the top bar          floats over it
     the caption          over its foot: where you are facing, and the way in
     a room               a sheet of glass that rises over the scene
   Nothing sits beside the scene, and nothing cuts it. */
body.portrait { --bar: 52px; --safe-top: env(safe-area-inset-top, 0px); --safe-bottom: env(safe-area-inset-bottom, 0px); }
body.portrait .topbar {
  inset: 0 0 auto 0; height: calc(var(--bar) + var(--safe-top) + 28px);
  padding: var(--safe-top) 10px 28px 12px; align-items: center;
  background: linear-gradient(rgba(12, 10, 18, .8), rgba(12, 10, 18, .52) 58%, rgba(12, 10, 18, 0));
}
body.portrait .brand {
  flex-direction: row; align-items: baseline; gap: 8px; padding: 6px 0;
  background: none; border: 0; box-shadow: none; color: var(--cream); overflow: visible;
  text-shadow: 0 2px 0 rgba(0, 0, 0, .45);
}
body.portrait .brand::before { display: none; }
body.portrait .brand-word { font-size: 21px; }
body.portrait .brand-sub { font-size: 8px; color: var(--pink-soft); margin: 0; }
body.portrait .top-actions { align-items: center; gap: 6px; }
@media (max-width: 359px) { body.portrait .brand-sub { display: none; } }   /* the smallest phones: just the wordmark */
body.portrait .menu-btn { --drop: 0px; min-height: 36px; padding: 0 11px; }
body.portrait .sound-btn { width: 40px; justify-content: center; padding: 0; }
body.portrait .sound-btn .sound-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
body.portrait .sound-btn[aria-pressed="false"] .eq { opacity: .35; }

body.portrait .stage { position: fixed; inset: 0; height: auto; display: block; overflow: hidden; }
body.portrait .vp-wrap { position: absolute; inset: 0; }
body.portrait .viewport { display: block; place-items: normal; overflow: hidden; touch-action: pan-y pinch-zoom; }
body.portrait .sizer { will-change: translate; }
/* the floor the scene stands on: its own last rows, mirrored, fading out */
body.portrait #mirror {
  display: block; position: absolute; left: 0; top: 180px; width: 320px; height: 72px;
  image-rendering: pixelated; image-rendering: crisp-edges;
  opacity: .62;
  -webkit-mask-image: linear-gradient(#000, rgba(0, 0, 0, .5) 40%, rgba(0, 0, 0, 0) 96%);
  mask-image: linear-gradient(#000, rgba(0, 0, 0, .5) 40%, rgba(0, 0, 0, 0) 96%);
}
body.portrait .stage::after {   /* the edge of the floor: a thin line of light where the scene meets its reflection */
  content: ''; position: absolute; left: 0; right: 0; bottom: var(--foot, 160px); height: 2px; z-index: 2;
  background: linear-gradient(90deg, rgba(255, 250, 243, 0), rgba(255, 250, 243, .5) 30%, rgba(255, 250, 243, .5) 70%, rgba(255, 250, 243, 0));
  mix-blend-mode: soft-light; pointer-events: none;
}
body.portrait.panning .hotspot { cursor: grabbing; }

/* the arrows at either edge: there is more hall that way */
.look { display: none; }
body.portrait .look {
  position: absolute; z-index: 3; top: calc((100% - var(--foot, 160px)) * .5 - 6px);
  display: grid; place-items: center;
  width: 34px; height: 52px; padding: 0;
  font: 11px/1 var(--pixel); color: var(--cream);
  background: rgba(22, 23, 27, .86); border: 2px solid var(--cream);
  box-shadow: 0 0 0 2px var(--ink), 3px 3px 0 2px var(--pink);
  cursor: pointer;
  transition: opacity var(--d-2) linear, translate var(--d-2) var(--ease-out), background-color var(--d-1) linear;
}
body.portrait .look[hidden] { display: none; }
body.portrait .look-l { left: 8px; }
body.portrait .look-r { right: 10px; }
body.portrait .look span { display: block; animation: look-nudge 1.5s steps(2, end) infinite; }
body.portrait .look-l span { animation-name: look-nudge-l; }
body.portrait .look:active { background: var(--pink); translate: 0 2px; }
@keyframes look-nudge { to { translate: 2px 0; } }
@keyframes look-nudge-l { to { translate: -2px 0; } }

/* the caption lies in the reflection at the foot of the scene: the place
   label, the name of what you are facing, and the way in */
body.portrait .below {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 4;
  display: flex; flex-direction: column; align-items: flex-start; justify-content: flex-end; gap: 8px;
  min-height: calc(var(--foot, 160px) + 34px);
  padding: 34px 16px calc(14px + var(--safe-bottom));
  background: linear-gradient(rgba(12, 10, 18, 0), rgba(12, 10, 18, .5) 34px, rgba(12, 10, 18, .84));
  pointer-events: none;
  transition: opacity var(--d-2) linear, translate var(--d-3) var(--ease-out), visibility 0s;
}
body.portrait .hud { position: static; }
body.portrait .hud-place { font-size: 10px; padding: 4px 7px 3px; }
body.portrait .dock { display: block; width: 100%; color: var(--cream); }
.look-hint {   /* rides beside the place label until the first swipe */
  position: absolute; right: 0; top: -24px;
  margin: 0; font: 9px/1 var(--pixel); letter-spacing: .1em; text-transform: uppercase; color: var(--gold);
  text-shadow: 1px 1px 0 rgba(0, 0, 0, .6);
  animation: hint-blink 1.6s steps(2, end) infinite;
}
body.portrait .dock { position: relative; }
.look-hint::before { content: '\25C0  '; }
.look-hint::after { content: '  \25B6'; }
@keyframes hint-blink { to { opacity: .45; } }
.cap-title { margin: 0; font: 21px/1.1 var(--display); letter-spacing: -.01em; text-shadow: 0 2px 0 rgba(0, 0, 0, .5); }
.cap-line { margin: 4px 0 0; font: 500 14px/1.35 var(--body); color: #dcd8d2; text-shadow: 0 1px 0 rgba(0, 0, 0, .5); }
.cap-actions { display: flex; gap: 10px; margin-top: 12px; pointer-events: auto; }
body.portrait .dock .cap-btn { --drop: 3px; --drop-c: #000; flex: 1; justify-content: center; min-height: 48px; padding: 0 12px; font-size: 12px; }
body.portrait .dock .cap-btn:hover { --lift: 0px; background: var(--cream); }
body.portrait .dock .cap-btn:active { --lift: -2px; background: var(--gold); }
body.portrait .dock .cap-btn.primary { background: var(--pink); color: #fff; text-shadow: 1px 1px 0 var(--pink-lo); }
body.portrait .dock .cap-btn.primary:hover { background: var(--pink); }
body.portrait .dock .cap-btn.primary:active { background: var(--pink-lo); }
/* a new place swims up as the camera settles on it */
.dock.swap .cap-title, .dock.swap .cap-line, .dock.swap .cap-actions { animation: cap-in var(--d-3) var(--ease-out) both; }
.dock.swap .cap-line { animation-delay: 40ms; }
.dock.swap .cap-actions { animation-delay: 80ms; }
@keyframes cap-in { from { opacity: 0; translate: 0 8px; } }
/* short screens: the caption keeps to a title and a button */
@media (max-height: 640px) {
  body.portrait .below { gap: 6px; padding-bottom: calc(10px + var(--safe-bottom)); }
  body.portrait .cap-title { font-size: 18px; }
  body.portrait .cap-line { display: none; }
  body.portrait .cap-actions { margin-top: 8px; }
  body.portrait .dock .cap-btn { min-height: 40px; }
}
/* a big upright screen (a large phone, a tablet): the caption and arrows scale up */
@media (min-width: 600px) {
  body.portrait .below { padding-left: 24px; padding-right: 24px; }
  body.portrait .hud-place { font-size: 12px; padding: 5px 8px 4px; }
  body.portrait .cap-title { font-size: 28px; }
  body.portrait .cap-line { font-size: 16px; }
  body.portrait .cap-actions { max-width: 520px; }
  body.portrait .dock .cap-btn { min-height: 52px; font-size: 13px; }
  body.portrait .look { width: 42px; height: 64px; font-size: 13px; }
  body.portrait .look-hint { font-size: 11px; }
}
/* while something else has the floor (a room's glass, a walk, someone
   talking, the opening) the caption and the arrows step aside */
body.portrait.panel-up .below, body.portrait.away .below, body.portrait.talking .below,
body.portrait.travelling .below, body.portrait.intro .below, body.portrait:not(.ready) .below {
  opacity: 0; translate: 0 14px; visibility: hidden;
  transition: opacity var(--d-2) linear, translate var(--d-2) var(--ease-in), visibility 0s var(--d-2);
}
body.portrait.panel-up .look, body.portrait.away .look, body.portrait.travelling .look,
body.portrait.intro .look, body.portrait:not(.ready) .look { opacity: 0; pointer-events: none; }

/* a room is a sheet of glass that rises over the scene, edge to edge */
body.portrait .room {
  z-index: 18; padding: 0; align-items: stretch; clip-path: none;
  inset: calc(var(--bar) + var(--safe-top) + 2px) 6px calc(6px + var(--safe-bottom)) 6px;
}
body.portrait .room .room-stand, body.portrait .room.fit .room-stand {
  inset: 0; left: 0; translate: none; width: auto; padding: 0;
  -webkit-box-reflect: none; border-radius: 18px;
}
body.portrait .room-panel {
  width: 100%; max-width: none; height: 100%; max-height: none;
  transform: none; border-radius: 18px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .6);
}
body.portrait .room-head { padding: 14px 12px 10px 16px; gap: 10px; }
body.portrait .room-mark { font-size: 12px; }
body.portrait .room-head h2 { font-size: 17px; }
body.portrait .room .close, body.portrait .room .lower { width: 38px; height: 38px; }
body.portrait .room-head-actions { gap: 6px; }
body.portrait .room-body { margin: 6px 10px 0; padding: 14px 14px 8px; }
body.portrait .room-foot { margin: 14px 24px 18px; padding-bottom: var(--safe-bottom); }
body.portrait .room.fit .room-panel { height: 100%; }
body.portrait .room.fit .room-body { margin: 4px 8px 8px; padding: 8px; }
/* a narrow sheet: the wordmark steps aside so the title keeps to one line */
@container slab (max-width: 430px) {
  body.portrait .room-mark { display: none; }
  body.portrait .room-head { grid-template-columns: minmax(0, 1fr) auto; }
}

body.portrait .directory {
  left: 0; right: 0; top: calc(var(--bar) + var(--safe-top)); width: 100%;
  max-height: calc(100dvh - var(--bar) - var(--safe-top));
  border-width: 0 0 2px; box-shadow: 0 24px 60px rgba(0, 0, 0, .5);
}
body.portrait .directory li a { padding: 12px 12px; font-size: 15px; }
body.portrait .directory li a[aria-current] { padding-left: 24px; }
body.portrait .directory li a[aria-current]::before { left: 10px; }
body.portrait .dialog { bottom: calc(14px + var(--safe-bottom)); }

@media (max-width: 520px) {
  .pair, .merch { grid-template-columns: 1fr 1fr; }
  .vice-list { columns: 1; }
  .signposts a { grid-template-columns: 1fr; gap: 2px; }
  .dlg-portrait { width: 64px; height: 64px; }
  .line { font-size: 15px; }
}

/* Ascended Gallery */
.pill.internal::after { content: none; }
.vice-row { font: 10px var(--pixel); color: var(--gold); letter-spacing: .06em; text-align: center; }
.ascended-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin: 4px 0 14px; }
.ascended-grid a { position: relative; display: block; border: 2px solid #d4a24c; box-shadow: 0 0 0 1px #000; }
.ascended-grid a:hover { border-color: var(--pink-soft); box-shadow: 0 0 0 1px #000, 0 10px 22px rgba(160, 190, 255, .35); z-index: 1; }
.ascended-grid img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; }
.ascended-grid span { position: absolute; left: 50%; bottom: -1px; transform: translateX(-50%); font: 9px var(--pixel); color: var(--gold); background: #1b1530; padding: 1px 4px; }
.shot.ascended-art { box-shadow: 0 0 0 1px #000, 0 0 24px rgba(160, 190, 255, .35), 5px 5px 0 rgba(212, 162, 76, .7); border-color: #d4a24c; }
.shot.ascended-art.tilting { box-shadow: 0 0 0 1px #000, 0 0 40px rgba(160, 190, 255, .5), 9px 11px 0 rgba(212, 162, 76, .55); }
.room[data-room^="ascended"] { --glass: rgba(20, 14, 48, .62); --glass-top: rgba(190, 170, 255, .2); --rule: rgba(200, 180, 255, .5); }
.room[data-room^="ascended"] .room-head { background: linear-gradient(rgba(34, 24, 74, .86), rgba(34, 24, 74, .62)); }
@media (max-width: 520px) { .ascended-grid { grid-template-columns: repeat(4, 1fr); } }

/* -------------------------------------------------------------- loader */
/* Check-in: the mark drops in, the word assembles letter by letter, the bar
   fills in blocks, then the whole card lifts away and the resort resolves
   through the dither. */
.loader {
  position: fixed; inset: 0; z-index: 60;
  display: grid; place-items: center;
  background:
    radial-gradient(60% 50% at 50% 46%, rgba(204, 67, 100, .16), transparent 70%),
    var(--void);
}
.loader-card { text-align: center; color: var(--cream); width: min(300px, 80vw); transition: opacity .3s linear .2s, translate .5s var(--ease-in) .1s; }
.loader.ready .loader-card { opacity: 0; translate: 0 -14px; }
.loader-mark { display: flex; justify-content: center; margin-bottom: 14px; animation: drop-in .8s var(--ease-spring) both; }
.loader-mark canvas { width: 44px; height: 52px; image-rendering: pixelated; box-shadow: 4px 4px 0 var(--pink); animation: bob 1.6s steps(2, end) infinite .8s; }
@keyframes drop-in { from { opacity: 0; translate: 0 -24px; } }
@keyframes bob { to { translate: 0 -3px; } }
.loader-word { margin: 0; font: 34px/1 var(--brand); letter-spacing: .02em; text-shadow: 2px 2px 0 var(--pink-lo); }
.loader-word span { display: inline-block; animation: letter .7s var(--ease-spring) both; }
.loader-word span:nth-child(1) { animation-delay: .10s; }
.loader-word span:nth-child(2) { animation-delay: .15s; }
.loader-word span:nth-child(3) { animation-delay: .20s; }
.loader-word span:nth-child(4) { animation-delay: .25s; }
.loader-word span:nth-child(5) { animation-delay: .30s; }
.loader-word span:nth-child(6) { animation-delay: .35s; }
.loader-word span:nth-child(7) { animation-delay: .40s; }
@keyframes letter { from { opacity: 0; translate: 0 14px; scale: .7; } }
.loader-sub { margin: 6px 0 22px; font: 10px var(--pixel); color: var(--pink-soft); text-transform: uppercase; letter-spacing: .3em; text-indent: .3em; animation: fade-up .7s var(--ease-out) .5s both; }
.loader-bar { height: 14px; padding: 2px; border: 2px solid var(--cream); background: var(--night); box-shadow: 3px 3px 0 var(--pink-lo); animation: fade-up .7s var(--ease-out) .6s both; }
.loader-fill {
  height: 100%; width: 0;
  background:
    repeating-linear-gradient(90deg, transparent 0 8px, var(--night) 8px 10px),
    linear-gradient(90deg, var(--pink), var(--pink-hi));
  transition: width .35s steps(8, end);
}
.loader.ready .loader-fill { width: 100% !important; }
.loader-text { margin: 10px 0 0; font: 10px var(--pixel); color: var(--cream); text-transform: uppercase; animation: fade-up .7s var(--ease-out) .7s both; }
.loader-tip { margin: 18px 0 0; font: italic 13px var(--body); color: #8a8b93; animation: fade-up .9s var(--ease-out) .9s both; }
@keyframes fade-up { from { opacity: 0; translate: 0 8px; } }

/* Pixel cursors (drawn at runtime in js/cursor.js) */
html { cursor: var(--cur-arrow, auto); }
a, button, .hotspot, summary, select, label, input[type="range"] { cursor: var(--cur-hand, pointer); }
input:not([type="range"]), textarea { cursor: text; }

/* Stay Unbothered (Poolside Arcade minigame, js/game/unbothered.js) */
.ub { margin: 4px 0 10px; }
.ub-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 10px; margin-bottom: 8px; }
.ub-modes { display: flex; gap: 4px; }
.ub-mode, .ub-btn { padding: 8px 10px; }
.ub-mode[aria-pressed="true"] { background: var(--teal-lo); border-color: #fff; }
.ub-mode:focus-visible, .ub-btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.ub-best { margin: 0 !important; font: 9px var(--pixel); text-transform: uppercase; color: var(--gold); }

.ub-stage { position: relative; display: grid; justify-content: center; }
.ub-stage > * { grid-area: 1 / 1; }
.ub-canvas {
  display: block; max-width: 100%; height: auto;
  image-rendering: pixelated; image-rendering: crisp-edges;
  touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
  box-shadow: 0 0 0 1px #000, 5px 5px 0 rgba(204, 67, 100, .6);
  background: #3f8f88;
}
.ub.is-playing .ub-canvas { cursor: crosshair; }
.ub-screen {
  display: grid; place-items: center; padding: 10px; overflow: auto;
  background: rgba(16, 22, 34, .5);
  animation: screen-in var(--d-2) linear;
}
@keyframes screen-in { from { opacity: 0; } }
.ub-box {
  width: min(100%, 340px); padding: 14px; text-align: center;
  background: var(--glass); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
  border: 1px solid rgba(255, 255, 255, .4); border-radius: 5px;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .5), 4px 4px 0 rgba(204, 67, 100, .55);
  animation: box-in var(--d-3) var(--ease-spring);
}
@keyframes box-in { from { opacity: 0; scale: .92; translate: 0 10px; } }
.ub-box p { margin: 0 0 10px !important; }
.ub .ub-title { display: block; margin: 0 0 8px; padding: 0; border: 0; background: none; box-shadow: none; font: 16px var(--display); color: #fff; text-shadow: 2px 2px 0 var(--pink-lo); letter-spacing: 0; }
.ub-copy { font-size: 13px; line-height: 1.5; }
.ub-small { font-size: 12px; line-height: 1.45; color: var(--glass-muted); }
.ub-kicker { font: 9px var(--pixel); text-transform: uppercase; color: var(--gold); letter-spacing: .08em; }
.ub-legend { display: grid; gap: 6px; margin: 0 0 10px; }
.ub-row { display: flex; align-items: center; gap: 8px; padding: 6px 8px; background: rgba(0, 0, 0, .25); border: 1px solid var(--glass-line); border-radius: 4px; }
.ub-tag { flex: none; width: 52px; font: 9px var(--pixel); text-transform: uppercase; color: var(--bad); text-align: left; }
.ub-tag-good { color: var(--teal); }
.ub-icons { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.ub-icon { display: block; image-rendering: pixelated; transition: translate var(--d-2) var(--ease-spring); }
.ub-icon:hover { translate: 0 -3px; }
.ub-box .ub-btn.ub-primary { min-width: 140px; padding: 10px 14px; font-size: 11px; }

.ub-over { width: min(100%, 560px); }
.ub-result { display: grid; grid-template-columns: minmax(0, min(220px, 32vh)) 1fr; gap: 12px; align-items: center; text-align: left; }
.ub-cardwrap { display: grid; place-items: center; aspect-ratio: 1; background: rgba(0, 0, 0, .35); border: 1px solid rgba(255, 255, 255, .25); }
.ub-card { display: block; width: 100%; height: auto; box-shadow: 0 0 0 1px #000; image-rendering: pixelated; }
.ub-card.tilting { box-shadow: 0 0 0 1px #000, 7px 9px 0 rgba(204, 67, 100, .5); }
.ub-score { font: 12px var(--pixel); text-transform: uppercase; color: var(--glass-muted); }
.ub-score b { display: inline-block; font: 30px/1 var(--display); color: var(--gold); text-shadow: 2px 2px 0 var(--pink-lo); margin-right: 4px; animation: score-in .7s var(--ease-spring) .15s both; }
@keyframes score-in { from { scale: .4; opacity: 0; } }
.ub-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.ub-actions .ub-primary { grid-column: 1 / -1; }
/* two to a row: a button left on its own at the end takes the whole row */
.ub-actions .ub-btn:last-child:nth-child(even) { grid-column: 1 / -1; }
.ub-msg { min-height: 1.3em; margin: 8px 0 0 !important; font-size: 12px; color: var(--glass-muted); }

.ub-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 10px; }
.ub-who { font: 10px var(--pixel); text-transform: uppercase; color: var(--pink-soft); }
.ub-spacer { flex: 1; }
.ub-small-btn { padding: 7px 9px; font-size: 9px; }

@media (max-width: 520px) {
  .ub-result { grid-template-columns: 1fr; text-align: center; }
  .ub-cardwrap { width: min(100%, 210px, 26vh); margin: 0 auto; }
  .ub-box { padding: 12px; }
  .ub .ub-title { font-size: 14px; }
  .ub-controls { gap: 4px; }
  .ub-small-btn { padding: 6px 6px; font-size: 8px; }
  .ub-who { font-size: 9px; }
}

/* --- The arcade, adapting to its room. These come after the arcade's own
   styles above so that they win when the play area is short or the slab big. --- */
@container slab (max-height: 540px) {
  .ub-bar { margin-bottom: 6px; }
  .ub-controls { margin-top: 6px; }
  .ub-mode, .ub-btn { padding: 6px 8px; }
}
/* the narrowest phones: the bottom row of controls stays on one line */
@container slab (max-width: 340px) {
  .ub-controls { gap: 3px; }
  .ub-controls .ub-btn { padding: 6px 5px; font-size: 8px; }
  .ub-who { font-size: 8px; }
}
@container slab (min-width: 1040px) {
  .ub-mode, .ub-btn { font-size: 12px; padding: 10px 14px; }
  .ub-best, .ub-who { font-size: 12px; }
}
/* The arcade's start and result screens tighten when the play area is short. */
@container stage (max-height: 340px) {
  .ub-legend, .ub-box:not(.ub-over) .ub-small { display: none; }
  .ub-box { padding: 10px 12px; }
  .ub .ub-title { font-size: 14px; margin-bottom: 4px; }
  .ub-copy { font-size: 12px; margin-bottom: 8px !important; }
  .ub-box .ub-btn.ub-primary { padding: 8px 12px; }
  .ub-kicker, .ub-msg { display: none; }
  .ub .ub-result { grid-template-columns: minmax(0, 104px) 1fr; gap: 10px; text-align: left; }
  .ub .ub-cardwrap { width: 100%; margin: 0; }
  .ub-score { margin-bottom: 4px !important; }
  .ub-score b { font-size: 22px; }
  .ub-over-best { font-size: 11px; margin-bottom: 6px !important; }
  .ub-actions { grid-template-columns: repeat(3, 1fr); gap: 4px; }
  .ub-actions .ub-btn:last-child:nth-child(even) { grid-column: auto; }
  .ub-actions .ub-btn { padding: 6px 4px; font-size: 9px; }
}
@container stage (max-height: 230px) {
  .ub-copy, .ub-over-best { display: none; }
  .ub .ub-result { grid-template-columns: minmax(0, 76px) 1fr; }
  .ub-over-title { margin-bottom: 4px; }
}
@container stage (max-height: 190px) {
  .ub-box { padding: 6px 10px; }
  .ub .ub-title { font-size: 12px; margin: 0 0 2px; }
  .ub .ub-result { grid-template-columns: minmax(0, 60px) 1fr; gap: 8px; }
  .ub-score { margin-bottom: 2px !important; }
  .ub-score b { font-size: 18px; }
  .ub-actions .ub-btn { padding: 4px 4px; }
  .ub-box .ub-btn.ub-primary { padding: 5px 10px; min-width: 0; }
}
@container stage (max-width: 420px) and (max-height: 400px) {
  .ub .ub-result .ub-cardwrap { width: min(100%, 88px); }
  .ub-over-best { display: none; }
  .ub .ub-over-title { font-size: 13px; margin-bottom: 4px; }
}
/* a tall, narrow play area (phones): the result stacks, and stays compact on small phones */
@container stage (max-width: 420px) and (min-height: 250px) and (max-height: 470px) {
  .ub-kicker { display: none; }
  .ub .ub-result { grid-template-columns: 1fr; text-align: center; }
  .ub .ub-cardwrap { width: min(100%, 120px); margin: 0 auto; }
  .ub-score b { font-size: 24px; }
  .ub-actions { grid-template-columns: repeat(3, 1fr); gap: 4px; }
  .ub-actions .ub-btn:last-child:nth-child(even) { grid-column: auto; }
  .ub-actions .ub-btn { padding: 8px 4px; font-size: 9px; }
  .ub-box { padding: 10px; }
}
/* narrow and short at once (a small phone with the browser's bars showing):
   the card stays beside the score, and the buttons get every pixel going */
@container stage (max-width: 330px) and (max-height: 249px) {
  .ub-box { padding: 8px 6px; }
  .ub .ub-result { grid-template-columns: minmax(0, 60px) 1fr; gap: 8px; }
  .ub .ub-result .ub-cardwrap { width: 100%; }
  .ub-actions .ub-btn { padding: 6px 2px; font-size: 8px; }
}

/* ------------------------------------------------ preferences respected */
/* Reduced motion: everything is simply where it belongs. */
/* (html.reduce-motion is set by js/motion.js from the system setting or ?motion=reduce) */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
  .lens::after { display: none; }
}
html.reduce-motion *, html.reduce-motion *::before, html.reduce-motion *::after { transition: none !important; animation: none !important; }
html.reduce-motion .lens::after { display: none; }
/* More contrast: drop the lens effects and make the glass solid. */
@media (prefers-contrast: more) {
  .lens { display: none; }
  .room { --glass: rgba(10, 12, 18, .97); --glass-muted: #dfe4ea; }
}
