/* ==========================================================================
   OCHRE — a Video.js v10 skin carved into a stone device
   The device picture is 1536 × 1024. Every carved control is positioned in
   those picture pixels (--x, --y = centre, --w, --h = size).
   ========================================================================== */

:root {
  --fire: #ffb04a;            /* focus ring: firelight */
  --ochre: #c4552f;
  --chalk: #efe0c2;
  --soot: #0d0805;
  --media-font-family: "Rubik", system-ui, sans-serif;
  color-scheme: dark;
}
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--soot); color: var(--chalk); font-family: var(--media-font-family); }
body {
  min-height: 100dvh;
  overflow-x: hidden;
  /* beyond the picture the cave carries on in rock, falling off into darkness
     the further it is from the fire (no blur: the rock stays sharp) */
  background:
    radial-gradient(60% 75% at 50% 48%, rgb(255 140 60 / .10), transparent 70%),
    radial-gradient(75% 95% at 50% 48%, transparent 25%, rgb(6 3 2 / .7) 62%, rgb(4 2 1 / .97) 100%),
    url("assets/rock.jpg") center / 640px auto repeat,
    var(--soot);
}

/* ---------------------------------------------------------------------------
   The cave around the player: ceiling, foreground rocks, firelight, drifting dust
   --------------------------------------------------------------------------- */
.cave { position: fixed; inset: 0; z-index: 2; pointer-events: none; overflow: hidden; }
.cave-glow {      /* the fire, just out of frame on the left, lights the whole cave */
  position: absolute; left: -25vmax; top: 5vh; width: 70vmax; height: 70vmax; border-radius: 50%;
  background: radial-gradient(closest-side, rgb(255 150 60 / .2), rgb(255 110 40 / .07) 50%, transparent 72%);
  mix-blend-mode: screen;
  animation: flicker 2.9s infinite steps(1, end);
}
.ceiling { position: absolute; left: -2%; width: 104%; top: 0; }
.ceiling.back  { height: clamp(70px, 15vh, 170px); fill: rgb(20 12 8 / .75); filter: blur(3px); }
.ceiling.front { height: clamp(80px, 18vh, 210px); filter: drop-shadow(0 6px 10px rgb(0 0 0 / .6)); }
.ceiling .drip { fill: rgb(255 190 130 / .55); animation: drip var(--dd) ease-in infinite; animation-delay: var(--dl); }
@keyframes drip {
  0%, 70% { transform: translateY(0) scale(1); opacity: .8 }
  88%     { transform: translateY(0) scale(1, 1.4); opacity: .9 }
  100%    { transform: translateY(40vh); opacity: 0 }
}
.foreground {     /* dark rocks right in front of the camera, out of focus */
  position: absolute; left: -3%; bottom: -1%; width: 106%; height: clamp(70px, 16vh, 190px);
  fill: #070403; filter: blur(5px);
}
.motes i {        /* dust drifting through the firelight */
  position: absolute; left: var(--x); top: var(--y);
  width: var(--s); height: var(--s); border-radius: 50%;
  background: rgb(255 214 160 / .55);
  box-shadow: 0 0 6px rgb(255 170 90 / .45);
  filter: blur(var(--b));
  opacity: 0;
  animation: mote var(--d) linear infinite; animation-delay: var(--dl);
}
@keyframes mote {
  0%   { transform: translate(0, 0); opacity: 0 }
  15%  { opacity: .8 }
  50%  { transform: translate(calc(var(--dx) * .5), -6vh); opacity: .5 }
  85%  { opacity: .75 }
  100% { transform: translate(var(--dx), -12vh); opacity: 0 }
}

/* the picture melts into the out-of-focus cave instead of ending in a hard edge */
.device:not(.compact) .viewport {
  -webkit-mask: linear-gradient(to right, transparent, #000 9%, #000 91%, transparent),
                linear-gradient(to bottom, transparent, #000 6%, #000 94%, transparent);
  -webkit-mask-composite: source-in;
          mask: linear-gradient(to right, transparent, #000 9%, #000 91%, transparent),
                linear-gradient(to bottom, transparent, #000 6%, #000 94%, transparent);
          mask-composite: intersect;
}
/* on phones the stone player floats in the cave with firelight pooling under it */
.device.compact { filter: drop-shadow(0 24px 30px rgb(0 0 0 / .75)); }
.device.compact .viewport { border-radius: 22px 22px 0 0; }
.page { position: relative; z-index: 1; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
media-status-announcer { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }

.page { min-height: 100dvh; display: grid; place-items: center; }
.ochre { display: block; width: min(100vw, calc(100dvh * 1.5)); }

/* Wide screens: the cave fills the whole screen, edge to edge (like background-size: cover).
   It is only cropped as far as keeps the whole stone player in view:
   picture x 250–1440 and y 190–800 always stay on screen. */
html.scene-mode, html.scene-mode body { height: 100%; overflow: hidden; }
html.scene-mode .page { position: relative; height: 100dvh; min-height: 0; overflow: hidden; display: block; }
html.scene-mode .ochre {
  /* sized so the whole device, antenna tips to stone feet (picture y 30–900), fits on screen;
     anything left over is the same cave, out of focus */
  position: absolute; left: 50%; top: 50%; translate: -50% -45.4%;
  width: min(90vw, 160dvh);
}

.device {
  position: relative; display: block; width: 100%;
  container: device / inline-size;
  outline: none;
  -webkit-tap-highlight-color: transparent;
}
.device:focus-visible { outline: 3px solid var(--fire); outline-offset: -6px; }

/* --------------------------------------------------------------------------
   The picture and its layers
   -------------------------------------------------------------------------- */
.viewport {
  position: relative; width: 100%;
  aspect-ratio: 1536 / 1024;
  overflow: hidden;
  container: view / inline-size;
}
.layer {
  position: absolute; left: 0; top: 0; width: 100%;
  aspect-ratio: 1536 / 1024;
  container: layer / inline-size;
}
.scene { position: absolute; inset: 0; width: 100%; height: 100%; display: block; user-select: none; pointer-events: none; }

/* place anything by its picture coordinates */
.screen, .screen-ui, .hit, .carved-time {
  position: absolute;
  left:   calc((var(--x) - var(--w) / 2) * 100% / 1536);
  top:    calc((var(--y) - var(--h) / 2) * 100% / 1024);
  width:  calc(var(--w) * 100% / 1536);
  height: calc(var(--h) * 100% / 1024);
}
.screen, .screen-ui { --x: 807; --y: 477.5; --w: 610; --h: 323; }

/* ---- the screen behind the stone ----------------------------------------- */
.screen { background: #050302; overflow: hidden; }
.screen video, .screen mux-video {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; display: block; background: #050302;
  filter: sepia(.16) saturate(.92) contrast(1.04) brightness(.96);   /* graded by firelight */
}
.screen { cursor: pointer; }
/* the picture falls on rock: a little stone grain shows through it */
.screen-grain {
  position: absolute; inset: 0; pointer-events: none;
  background: url("assets/stone.jpg") center / 34% auto;
  mix-blend-mode: soft-light; opacity: .4;
}
.screen-shade {        /* the carved lip throws shadow; firelight warms the glass-less picture */
  position: absolute; inset: 0; pointer-events: none;
  box-shadow:
    inset 0 2.2cqw 2.6cqw -1.2cqw rgb(0 0 0 / .9),
    inset 1.4cqw 0 1.8cqw -1.2cqw rgb(0 0 0 / .75),
    inset -1.2cqw 0 1.6cqw -1.1cqw rgb(0 0 0 / .7),
    inset 0 -.8cqw 1.2cqw -.6cqw rgb(0 0 0 / .6);
  background:
    radial-gradient(120% 120% at 0% 40%, rgb(255 150 60 / .12), transparent 60%),
    radial-gradient(85% 85% at 50% 50%, transparent 55%, rgb(20 10 4 / .5) 100%);
  animation: flicker 3.3s infinite steps(1, end);
}
.screen-ui { z-index: 3; pointer-events: none; }
.screen-ui > * { pointer-events: auto; }

/* ---- living firelight ----------------------------------------------------- */
.fire-flicker {
  position: absolute; left: -6%; top: 6%; width: 26%; height: 40%;
  background: radial-gradient(closest-side, rgb(255 190 90 / .55), rgb(255 120 40 / .25) 45%, transparent 72%);
  mix-blend-mode: screen; pointer-events: none;
  animation: flicker 2.4s infinite steps(1, end), sway 3.1s ease-in-out infinite alternate;
}
.firelight {
  position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(70% 90% at 6% 30%, rgb(255 150 60 / .18), transparent 60%);
  mix-blend-mode: soft-light;
  animation: flicker 3.3s infinite steps(1, end);
}
@keyframes flicker {
  0% { opacity: .85 } 8% { opacity: .62 } 16% { opacity: 1 } 29% { opacity: .74 } 41% { opacity: .95 }
  55% { opacity: .68 } 68% { opacity: 1 } 80% { opacity: .78 } 92% { opacity: .93 }
}
@keyframes sway { from { transform: translate(0, 0) scale(1) } to { transform: translate(.6%, -1.5%) scale(1.06, 1.1) } }

.embers i {
  position: absolute; left: var(--x); top: 34%;
  width: .28cqw; height: .28cqw; min-width: 2px; min-height: 2px; border-radius: 50%;
  background: #ffd585; box-shadow: 0 0 .6cqw .2cqw rgb(255 140 40 / .8);
  opacity: 0; pointer-events: none;
  animation: rise var(--d) linear infinite; animation-delay: var(--dl);
}
.embers i:nth-child(1)  { --x: 6%;  --d: 3.2s; --dl: 0s }
.embers i:nth-child(2)  { --x: 8%;  --d: 4.1s; --dl: -1.1s }
.embers i:nth-child(3)  { --x: 10%; --d: 3.6s; --dl: -2.3s }
.embers i:nth-child(4)  { --x: 7%;  --d: 4.6s; --dl: -.5s }
.embers i:nth-child(5)  { --x: 11%; --d: 3.9s; --dl: -3.1s }
.embers i:nth-child(6)  { --x: 5%;  --d: 4.3s; --dl: -1.8s }
.embers i:nth-child(7)  { --x: 9%;  --d: 3.4s; --dl: -2.8s }
.embers i:nth-child(8)  { --x: 12%; --d: 5s;   --dl: -.9s }
.embers i:nth-child(9)  { --x: 4%;  --d: 3.7s; --dl: -3.6s }
.embers i:nth-child(10) { --x: 9.5%;--d: 4.8s; --dl: -2s }
@keyframes rise {
  0%   { transform: translate(0, 0); opacity: 0 }
  10%  { opacity: 1 }
  60%  { transform: translate(2cqw, -14cqw); opacity: .8 }
  100% { transform: translate(-1cqw, -26cqw); opacity: 0 }
}

/* --------------------------------------------------------------------------
   Carved controls
   -------------------------------------------------------------------------- */
.k1 { --x: 350; --y: 340; --w: 112; --h: 84; }
.k2 { --x: 346; --y: 442; --w: 112; --h: 82; }
.k3 { --x: 343; --y: 540; --w: 112; --h: 82; }
.k4 { --x: 339; --y: 640; --w: 116; --h: 84; }
.knob { --x: 1300; --y: 463; --w: 180; --h: 180; }
.carved .mute { --x: 1300; --y: 674; --w: 156; --h: 68; }
.groove.hit { --x: 826.5; --y: 730; --w: 483; --h: 56; }
.carved-time.cur { --x: 518; --y: 727; --w: 104; --h: 50; }
.carved-time.dur { --x: 1126; --y: 731; --w: 96; --h: 50; }

/* Keys: the stone cap is its own layer sitting in a dark socket.
   Pressing drives it down fast; letting go springs it back with a little overshoot. */
.k1 { --x: 349; --y: 343; --w: 114; --h: 90; }
.k2 { --x: 347; --y: 442.5; --w: 110; --h: 85; }
.k3 { --x: 341.5; --y: 541.5; --w: 113; --h: 87; }
.k4 { --x: 339; --y: 641.5; --w: 118; --h: 87; }
.key {
  display: block; padding: 0; margin: 0; border: 0;
  background: transparent; color: inherit; cursor: pointer;
  border-radius: 20% / 26%;
}
.cap-body {
  position: absolute; inset: 0; display: grid; place-items: center;
  translate: 0 0;
  filter: drop-shadow(0 .28cqw .22cqw rgb(0 0 0 / .6));
  transition: translate .46s cubic-bezier(.28, 1.9, .42, 1), filter .46s ease;
  will-change: translate;
}
.cap-img {
  position: absolute; pointer-events: none; user-select: none;
  left: calc(-10 / var(--w) * 100%); top: calc(-10 / var(--h) * 100%);
  width: calc((var(--w) + 20) / var(--w) * 100%); height: calc((var(--h) + 20) / var(--h) * 100%);
}
.key:hover .cap-body { filter: drop-shadow(0 .28cqw .22cqw rgb(0 0 0 / .6)) brightness(1.1); }
.key:is(:active, [data-pressing]) .cap-body {
  translate: 0 .42cqw;
  filter: drop-shadow(0 0 .04cqw rgb(0 0 0 / .8)) brightness(.78);
  transition-duration: .07s; transition-timing-function: cubic-bezier(.5, 0, .9, .5);
}

.carved .mute {
  display: grid; place-items: center; grid-auto-flow: column; gap: 6%;
  padding: 0; margin: 0; border: 0; background: transparent; color: inherit; cursor: pointer;
  border-radius: 14px;
}
.carved .mute:is(:active, [data-pressing]) { background: rgb(0 0 0 / .14); box-shadow: inset 0 .3cqw .5cqw rgb(0 0 0 / .55); }
.carved .mute:is(:active, [data-pressing]) > * { translate: 0 .12cqw; }

/* raised stone symbols, like the ones chiselled on the original keys */
.icon { display: block; fill: url(#raised); }
.key .icon { position: relative; width: 38%; height: 58%; grid-area: 1 / 1; translate: 0 -6%;
  filter: url(#chisel) drop-shadow(.12cqw .2cqw .12cqw rgb(0 0 0 / .85)) drop-shadow(-.05cqw -.06cqw 0 rgb(255 232 196 / .3)); }
.key.k4 .icon { width: 40%; height: 56%; filter: drop-shadow(.12cqw .2cqw .12cqw rgb(0 0 0 / .85)) drop-shadow(-.05cqw -.06cqw 0 rgb(255 232 196 / .3)); }

.play .icon { display: none; }
.play[data-paused]:not([data-ended]) .i-play,
.play:not([data-paused]):not([data-ended]) .i-pause,
.play[data-ended] .i-replay { display: block; }
.play .i-play { translate: 6% 0; }
.fullscreen .i-exit { display: none; }
.fullscreen[data-fullscreen] .i-enter { display: none; }
.fullscreen[data-fullscreen] .i-exit { display: block; }
:is(.fullscreen, .mute)[data-hidden] { display: none; }

/* Keyboard focus (Tab only, never after a click): a warm glow of firelight around the stone */
:is(.key, .mute, .cap, .big-play, .pill, .knob-thumb, .pebble):focus { outline: none; }
:is(.key, .mute, .cap, .big-play, .pill):focus-visible {
  outline: 2px solid rgb(255 196 120 / .95); outline-offset: 2px;
  box-shadow: 0 0 0 4px rgb(255 140 50 / .28), 0 0 18px 4px rgb(255 150 60 / .45);
}
:is(.knob-thumb, .pebble):focus-visible {
  outline: 2px solid rgb(255 196 120 / .95); outline-offset: 3px; border-radius: 50%;
  box-shadow: 0 0 0 4px rgb(255 140 50 / .28), 0 0 18px 4px rgb(255 150 60 / .45);
}

/* ---- volume: the stone face stays put (lit by the fire); the wooden peg swings round it.
   --peg-angle is driven by a spring in elements.js, so the dial has weight and settles. */
.knob { display: block; border-radius: 50%; cursor: grab; touch-action: none; }
.knob:active { cursor: grabbing; }
.knob-track { position: absolute; inset: 0; opacity: 0; }
/* The dial: the stone's grain turns with it, but the firelight on it does not.
   dial.png is the face with its lighting divided out; dial-light.png multiplies the light back on, unrotated. */
.dial, .arm-shadow { position: absolute; left: -23.33%; top: -23.33%; width: 146.67%; height: 146.67%; pointer-events: none; }
.dial { isolation: isolate; }
.dial-tex, .dial-light, .arm, .peg { position: absolute; inset: 0; }
.dial-tex { background: url("assets/dial.png") center / 100% 100% no-repeat; rotate: calc(var(--peg-angle, 45deg) - 12.89deg); }
.dial-light { background: url("assets/dial-light.png") center / 100% 100% no-repeat; mix-blend-mode: multiply; }
.arm-shadow { filter: drop-shadow(.3cqw .5cqw .28cqw rgb(0 0 0 / .6)); }   /* shadow falls away from the fire, whatever the angle */
.arm { rotate: calc(var(--peg-angle, 45deg) - 12.89deg); }
.peg { background: url("assets/peg.png") center / 100% 100% no-repeat; }
.knob-thumb { position: absolute; inset: 14%; border-radius: 50%; }

/* mute: a horn and four carved slots. Pigment-filled stone bars rise in the slots
   with the volume (spring), and drop to nothing when muted. --vol comes from elements.js. */
.mute .horn { width: 2.7cqw; height: 2.9cqw;
  filter: url(#chisel) drop-shadow(.1cqw .16cqw .1cqw rgb(0 0 0 / .85)); }
.bars { display: inline-flex; align-items: flex-end; gap: .55cqw; height: 2.9cqw; }
.bars i {
  position: relative; display: block; width: .78cqw; border-radius: .18cqw;
  background: rgb(14 9 6 / .72);
  box-shadow: inset 0 .12cqw .18cqw rgb(0 0 0 / .9), 0 .06cqw 0 rgb(255 225 190 / .16);
  overflow: hidden;
}
.bars i:nth-child(1) { height: 34%; } .bars i:nth-child(2) { height: 56%; }
.bars i:nth-child(3) { height: 78%; } .bars i:nth-child(4) { height: 100%; }
.bars i::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0;
  height: calc(clamp(0, var(--vol, 1) * 4 - var(--i), 1) * 100%);
  border-radius: inherit;
  background: linear-gradient(170deg, #e2cfae, #9c8468 55%, #5e4e3f);
  box-shadow: inset 0 .08cqw 0 rgb(255 240 215 / .4);
  transition: height .55s cubic-bezier(.34, 1.56, .64, 1);
}
.mute:is([data-muted], [data-volume-level="off"]) .horn { opacity: .45; transition: opacity .3s ease; }

/* ---- time, chiselled into the stone (as in the original carving) ---------------
   Rough hand-cut numerals: a dark cut with a lit lower lip, pitted by the chisel filter. */
.carved-time {
  display: grid; place-items: center; pointer-events: none;
  font: 400 2.55cqw / 1 "Rubik Dirt", "Rubik", system-ui, sans-serif;
  font-variant-numeric: tabular-nums; letter-spacing: .04em;
  color: rgb(16 9 5);
  text-shadow: 0 .14cqw 0 rgb(255 214 168 / .55), 0 -.08cqw .02cqw rgb(0 0 0 / .7);
  filter: url(#hewn);
}
.carved-time.cur { rotate: -1.2deg; }
.carved-time.dur { rotate: .8deg; }

/* ---- the groove ------------------------------------------------------------ */
.groove { display: flex; align-items: center; cursor: pointer; touch-action: none; }
.groove-track { position: relative; width: 100%; height: 50%; border-radius: 999px; overflow: hidden; }
.groove-buffer, .groove-fill { position: absolute; inset: 0 auto 0 0; border-radius: inherit; }
.groove-buffer { width: var(--media-slider-buffer); background: rgb(255 226 186 / .07); }
.groove-fill {         /* red ochre rubbed into the groove */
  width: var(--media-slider-fill);
  background:
    repeating-linear-gradient(100deg, rgb(255 230 200 / .08) 0 .2cqw, transparent .2cqw .6cqw),
    linear-gradient(to bottom, rgb(150 70 36 / .55), rgb(176 82 40 / .62) 55%, rgb(96 40 20 / .7));
  box-shadow: inset 0 .3cqw .35cqw rgb(0 0 0 / .6);
}
.pebble {
  position: absolute; top: 50%; left: var(--media-slider-fill);
  width: 11%; aspect-ratio: 53 / 62; translate: -50% -50%;
  background: url("assets/pebble.png") center / 100% 100% no-repeat;
  border-radius: 45%;
  filter: drop-shadow(.15cqw .3cqw .2cqw rgb(0 0 0 / .7));
  isolation: isolate;
  transition: scale .35s cubic-bezier(.3, 1.8, .5, 1), translate .35s cubic-bezier(.3, 1.8, .5, 1);
}
/* it rolls: the grain turns by distance / radius, the firelight on it stays put */
.peb, .peb-tex, .peb-light { position: absolute; inset: 0; pointer-events: none; }
.peb { isolation: isolate; -webkit-mask: url("assets/pebble.png") center / 100% 100% no-repeat; mask: url("assets/pebble.png") center / 100% 100% no-repeat; }
.peb-tex { background: url("assets/pebble-tex.png") center / 100% 100% no-repeat; rotate: var(--roll, 0deg); scale: 1.18; }
.peb-light { background: url("assets/pebble-light.png") center / 100% 100% no-repeat; mix-blend-mode: multiply; }
.pebble { background: none; }
.groove[data-dragging] .pebble {              /* picked up a little while dragged */
  left: var(--media-slider-pointer); scale: 1.1; translate: -50% -62%;
  filter: drop-shadow(.3cqw .7cqw .35cqw rgb(0 0 0 / .55));
  transition-duration: .12s;
}
.groove[data-dragging] .groove-fill { width: var(--media-slider-pointer); }
.tag {
  position: absolute; bottom: 100%; left: var(--media-slider-pointer); translate: -50% -10%;
  padding: .45cqw .7cqw; border-radius: .6cqw;
  font: 400 1.25cqw / 1 "Rubik Dirt", "Rubik", sans-serif; font-variant-numeric: tabular-nums;
  color: rgb(20 12 7 / .92); text-shadow: 0 .08cqw 0 rgb(255 212 164 / .45);
  background: url("assets/stone.jpg") center / 140% auto, #7a6855;
  background-blend-mode: overlay;
  box-shadow: 0 .3cqw .6cqw rgb(0 0 0 / .6);
  opacity: 0; pointer-events: none; transition: opacity .15s ease;
}
.groove:is([data-pointing], [data-dragging]) .tag { opacity: 1; }

/* ---- in the screen -------------------------------------------------------- */
.big-play {
  position: absolute; left: 50%; top: 50%; translate: -50% -50%;
  width: 22%; aspect-ratio: 108 / 80;
  display: grid; place-items: center; padding: 0; border: 0; cursor: pointer;
  background: url("assets/keycap.png") center / 100% 100% no-repeat;
  border-radius: 24% / 30%;
  filter: drop-shadow(0 .6cqw .8cqw rgb(0 0 0 / .75));
  transition: scale .15s ease, opacity .25s ease;
}
.big-play .icon { width: 34%; height: 50%; translate: 6% 0;
  filter: url(#chisel) drop-shadow(.12cqw .2cqw .12cqw rgb(0 0 0 / .85)); }
.big-play { transition: scale .45s cubic-bezier(.28, 1.9, .42, 1), translate .45s cubic-bezier(.28, 1.9, .42, 1), opacity .25s ease, filter .3s; }
.big-play:hover { scale: 1.04; }
.big-play:is(:active, [data-pressing]) { scale: .95; translate: -50% -46%; filter: drop-shadow(0 .15cqw .2cqw rgb(0 0 0 / .8)) brightness(.9); transition-duration: .07s; }
.big-play[data-started] { opacity: 0; visibility: hidden; pointer-events: none; }

.loading { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none !important; }
.loading .wheel { width: 13%; height: auto; display: none; filter: drop-shadow(0 .4cqw .5cqw rgb(0 0 0 / .7)); }
.loading[data-visible] .wheel { display: block; animation: roll 1.1s linear infinite; }
@keyframes roll { to { rotate: 1turn } }

.error-popup {
  position: absolute; inset: 0; z-index: 5;
  display: grid; place-content: center; justify-items: center; gap: 6px;
  padding: 12px; text-align: center;
  background: radial-gradient(closest-side, rgb(40 28 20 / .96), rgb(14 9 6 / .97));
  color: var(--chalk);
}
.error-popup:not([data-open]) { display: none; }
.error-art { width: 26%; max-width: 130px; height: auto; }
.error-title { font: 700 clamp(14px, 1.6cqw, 22px) / 1.2 var(--media-font-family); }
.error-desc { max-width: 42ch; font-size: clamp(12px, 1cqw, 15px); line-height: 1.45; color: rgb(239 224 194 / .85); }
.pill {
  min-height: 44px; padding: 10px 20px; border: 0; border-radius: 14px; cursor: pointer;
  font: 700 14px var(--media-font-family); color: var(--chalk);
  background: url("assets/keycap.png") center / 100% 100%;
  text-shadow: 0 1px 0 rgb(0 0 0 / .8);
}

/* --------------------------------------------------------------------------
   Compact stone bar (narrow players and fullscreen)
   -------------------------------------------------------------------------- */
.bar { display: none; }

.device.compact .carved { display: none; }
.device.compact .viewport { aspect-ratio: 675 / 385; }
.device.compact .layer {      /* zoom into the carved screen */
  width: calc(1536 / 675 * 100cqw);
  left: calc(-470 / 675 * 100cqw);
  top: calc(-285 / 675 * 100cqw);
}
.device.compact .bar {
  display: flex; flex-direction: column; gap: 10px;
  padding: 12px 14px 16px;
  background:
    linear-gradient(to bottom, rgb(0 0 0 / .55), transparent 14px),
    radial-gradient(80% 140% at 0% 0%, rgb(255 150 60 / .12), transparent 60%),
    url("assets/slab.jpg") center / 100% 100% no-repeat, #3b2f25;
  border-radius: 0 0 22px 22px;
  box-shadow: inset 0 -3px 8px rgb(0 0 0 / .55), 0 14px 26px rgb(0 0 0 / .6);
}
.bar-row { display: flex; align-items: center; gap: 10px; }
.bar-gap { flex: 1; }
.bar-time {
  flex: none; min-width: 3.4ch; text-align: center;
  font: 400 17px / 1 "Rubik Dirt", "Rubik", sans-serif; font-variant-numeric: tabular-nums;
  color: var(--chalk); text-shadow: 0 -1px 0 rgb(0 0 0 / .85), 0 1px 0 rgb(255 220 180 / .15);
}
.bar-groove { position: relative; flex: 1; height: 44px; }
.bar-groove .groove-track {
  height: 14px;
  background: rgb(12 8 5 / .7);
  box-shadow: inset 0 3px 4px rgb(0 0 0 / .9), 0 1px 0 rgb(255 225 190 / .18);
}
.bar-groove .groove-fill { mix-blend-mode: normal; }
.bar-groove .pebble { width: 30px; height: 34px; aspect-ratio: auto; }
.cap {
  display: grid; place-items: center; flex: none;
  width: 54px; height: 46px; min-height: 44px; padding: 0; border: 0; cursor: pointer;
  border-radius: 12px;
  background: url("assets/key1.png") center / 100% 100% no-repeat;
  filter: drop-shadow(0 3px 2px rgb(0 0 0 / .6));
  transition: translate .45s cubic-bezier(.28, 1.9, .42, 1), filter .45s ease;
}
.cap[seconds="-10"] { background-image: url("assets/key2.png"); }
.cap[seconds="10"] { background-image: url("assets/key3.png"); }
.cap.fullscreen { background-image: url("assets/key4.png"); }
.cap:is(:active, [data-pressing]) { translate: 0 3px; filter: drop-shadow(0 0 1px rgb(0 0 0 / .8)) brightness(.8); transition-duration: .07s; }
.cap .icon { width: 50%; height: 62%; grid-area: 1 / 1; filter: url(#chisel) drop-shadow(1px 1.5px 1px rgb(0 0 0 / .85)); }
.cap.mute { width: 64px; grid-auto-flow: column; gap: 4px; }
.cap.mute .horn { width: 16px; height: 18px; }
.cap.mute .bars { height: 18px; gap: 2px; }
.cap.mute .bars i { width: 4px; border-radius: 1px; }
.knob.mini {
  position: relative; flex: none; width: 48px; height: 48px;
}
.mini-socket { position: absolute; inset: -4%; border-radius: 50%; background: rgb(10 6 4 / .6); box-shadow: inset 0 3px 5px rgb(0 0 0 / .8), 0 1px 0 rgb(255 225 190 / .15); }
.knob.mini .arm-shadow { filter: drop-shadow(1px 2px 1px rgb(0 0 0 / .6)); }
.knob.mini .dial, .knob.mini .arm-shadow { left: -50%; top: -50%; width: 200%; height: 200%; }

@media (max-width: 380px) {
  .cap { width: 46px; }
  .cap.mute { width: 58px; }
  .bar-row { gap: 7px; }
}

/* fullscreen: the same carved device, cropped to its stone edges, fills the screen.
   Every key, the dial and the pebble keep working (and moving) exactly as on the page. */
.device:fullscreen, .device:-webkit-full-screen {
  display: grid; place-items: center; width: 100vw; height: 100vh;
  background: radial-gradient(120% 90% at 50% 50%, transparent 40%, rgb(5 3 2 / .9) 100%),
              url("assets/rock.jpg") center / 640px auto repeat, var(--soot);
}
.device.fs .viewport { aspect-ratio: 1340 / 700; width: min(100vw, calc(100vh * 1340 / 700)); }
.device.fs .layer {
  width: calc(1536 / 1340 * 100cqw);
  left: calc(-110 / 1340 * 100cqw);
  top: calc(-180 / 1340 * 100cqw);
}

/* --------------------------------------------------------------------------
   Calm on request
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .fire-flicker, .firelight, .screen-shade, .cave-glow { animation: none; }
  .motes, .ceiling .drip { display: none; }
  .embers { display: none; }
  .loading[data-visible] .wheel { animation-duration: 4s; }
  .cap-body, .cap, .pebble, .tag, .big-play, .bars i::after { transition: none !important; }
}
@media (forced-colors: active) {
  .key, .cap, .mute, .knob, .groove-track { border: 2px solid ButtonText; forced-color-adjust: none; }
  .icon { fill: ButtonText; }
  .groove-fill { background: Highlight; }
}

/* compact caps: chalk-filled carving for contrast */
.cap .icon, .cap .horn { fill: var(--chalk); }

/* phones: frame the out-of-focus cave on the fire side, and pool its light under the player */
@media (max-width: 760px) {
  body { background-size: auto, auto, 420px auto, auto; }
  .cave-glow { left: -60vmax; top: 18vh; width: 110vmax; height: 110vmax; }
  .page::before {
    content: ""; position: fixed; left: 50%; top: 62%; width: 140vw; height: 40vh; translate: -50% 0;
    background: radial-gradient(closest-side, rgb(255 140 60 / .18), transparent 70%);
    pointer-events: none;
  }
}

/* when the cave fills the screen, keep the ceiling and foreground rocks to the edges */
html.scene-mode .ceiling.back  { height: clamp(40px, 7vh, 110px); }
html.scene-mode .ceiling.front { height: clamp(46px, 9vh, 130px); }
html.scene-mode .foreground    { height: clamp(40px, 9vh, 120px); }


/* the name, painted small in ochre at the top of the cave wall */
.title {
  position: fixed; z-index: 4; left: 50%; top: clamp(10px, 2.2vh, 22px); translate: -50% 0;
  margin: 0; pointer-events: none; user-select: none;
  font: 400 clamp(13px, 1.25vw, 19px) / 1 "Rubik Dirt", "Rubik", sans-serif;
  letter-spacing: .55em; padding-left: .55em;      /* keep it optically centred */
  color: #e2a36b;
  text-shadow: 0 1px 0 rgb(0 0 0 / .85), 0 0 14px rgb(255 140 50 / .45);
  opacity: .92;
}


/* ---- the antenna: two antlers in a lump of clay, swaying on a spring ----------
   --sway-l / --sway-r are driven by a damped spring in elements.js. */
.antenna-box { position: absolute; --x: 1160; --y: 155; --w: 320; --h: 310;
  left: calc((var(--x) - var(--w) / 2) * 100% / 1536); top: calc((var(--y) - var(--h) / 2) * 100% / 1024);
  width: calc(var(--w) * 100% / 1536); height: calc(var(--h) * 100% / 1024);
  pointer-events: none; }
/* rendered layers (render_antenna.py): each antler turns about its root in the clay */
.antenna-box > span { position: absolute; inset: 0; background: center / 100% 100% no-repeat; }
.antler { transform-origin: 50% 89.03%; filter: brightness(.86) drop-shadow(.3cqw .2cqw .22cqw rgb(0 0 0 / .5)); }
.antler.l { background-image: url("assets/antler-l.png"); rotate: var(--sway-l, 0deg); }
.antler.r { background-image: url("assets/antler-r.png"); rotate: var(--sway-r, 0deg); }
.antenna-box > .mount { background-image: url("assets/mount.png"); }


/* ==========================================================================
   STUDIO PRESENTATION — the stone player on a clean, premium light stage
   ========================================================================== */
:root { --stage: #f4f4f7; --ink: #1d1d1f; --ink-2: #6e6e73; --ink-3: #a1a1a6; --hair: rgb(0 0 0 / .08); }
html, body { background: var(--stage) !important; color: var(--ink); }
body {
  background:
    radial-gradient(70% 60% at 50% 42%, #ffffff 0%, rgb(255 255 255 / 0) 70%),
    linear-gradient(to bottom, #f7f7fa, #ececf1) !important;
  background-attachment: fixed !important;
}
.cave, .fire-flicker, .firelight, .embers { display: none !important; }

/* name, top centre */
.title {
  color: var(--ink); text-shadow: none; opacity: 1;
  font: 600 12px / 1 "Inter", system-ui, sans-serif; letter-spacing: .42em; padding-left: .42em;
  top: clamp(18px, 3.4vh, 34px);
}
/* small brand mark, bottom left (as in the reference) */
.brand {
  position: fixed; left: clamp(16px, 2.2vw, 32px); bottom: clamp(14px, 2.4vh, 26px); margin: 0; z-index: 3;
  font: 500 clamp(18px, 1.7vw, 26px) / 1 "Inter", system-ui, sans-serif; letter-spacing: -.01em; color: var(--ink);
  pointer-events: none;
}
.brand span { color: var(--ink-3); }

/* layout: player, then caption, centred in the viewport */
html.scene-mode, html.scene-mode body { height: auto; overflow: auto; }
.page, html.scene-mode .page {
  position: relative; display: flex !important; flex-direction: column; align-items: center; justify-content: center;
  gap: clamp(10px, 2.2vh, 26px);
  height: auto; min-height: 100dvh; overflow: visible;
  padding: clamp(56px, 9vh, 96px) 16px clamp(64px, 10vh, 110px);
}
.ochre, html.scene-mode .ochre {
  position: relative; left: auto; top: auto; translate: none;
  width: min(1000px, 86vw, calc((100dvh - 330px) * 1340 / 850));
  min-width: min(560px, 100%);
}

/* crop the picture to the device (x 110–1450, y 20–870) */
.device:not(.compact):not(.fs) .viewport { aspect-ratio: 1340 / 850; -webkit-mask: none; mask: none; overflow: visible; }
.device:not(.compact):not(.fs) .layer {
  width: calc(1536 / 1340 * 100cqw);
  left: calc(-110 / 1340 * 100cqw);
  top: calc(-20 / 1340 * 100cqw);
}

/* grounding: a tight contact shadow under the feet and a soft ambient one */
.floor-shadow {
  position: absolute; pointer-events: none;
  left: calc(170 * 100% / 1536); width: calc(1220 * 100% / 1536);
  top: calc(800 * 100% / 1024); height: calc(80 * 100% / 1024);
  background:
    radial-gradient(50% 32% at 50% 62%, rgb(0 0 0 / .42), transparent 100%),
    radial-gradient(50% 50% at 50% 60%, rgb(0 0 0 / .14), transparent 100%);
  filter: blur(6px);
}
/* a faint reflection in the polished floor */
.device:not(.compact):not(.fs) .viewport {
  -webkit-box-reflect: below calc(-2 / 1340 * 100cqw) linear-gradient(to bottom, transparent 78%, rgb(255 255 255 / .16));
}

/* caption, like a product card */
.caption { text-align: center; max-width: 640px; }
.cap-title { margin: 0; font: 600 clamp(17px, 1.5vw, 21px) / 1.25 "Inter", system-ui, sans-serif; letter-spacing: -.015em; color: var(--ink); }
.cap-sub { margin: 4px 0 0; font: 400 13px / 1.4 "Inter", system-ui, sans-serif; color: var(--ink-2); }
.specs {
  display: flex; justify-content: center; gap: clamp(22px, 4vw, 52px);
  margin: clamp(14px, 2.2vh, 22px) 0 0; padding-top: clamp(12px, 2vh, 18px);
  border-top: 1px solid var(--hair);
}
.specs div { text-align: left; }
.specs dt { font: 400 11px / 1.3 "Inter", system-ui, sans-serif; color: var(--ink-3); }
.specs dd { margin: 3px 0 0; font: 600 14px / 1.3 "Inter", system-ui, sans-serif; color: var(--ink); }

/* phones: the stone screen + stone control bar, floating as a card */
.device.compact { filter: drop-shadow(0 18px 28px rgb(0 0 0 / .22)) drop-shadow(0 3px 6px rgb(0 0 0 / .14)); }
@media (max-width: 760px) {
  .ochre, html.scene-mode .ochre { width: 100%; min-width: 0; }
  .page::before { display: none; }
  .brand { font-size: 17px; }
}

/* fullscreen: the same studio light, the device as large as fits */
.device:fullscreen, .device:-webkit-full-screen {
  background: radial-gradient(70% 60% at 50% 45%, #ffffff, #e9e9ee) !important;
}
.device.fs .scene { content: url("assets/device.webp"); }
.device.fs .viewport { aspect-ratio: 1340 / 850 !important; width: min(96vw, calc(96vh * 1340 / 850)) !important; overflow: visible; }
.device.fs .layer { width: calc(1536 / 1340 * 100cqw) !important; left: calc(-110 / 1340 * 100cqw) !important; top: calc(-20 / 1340 * 100cqw) !important; }

/* keyboard focus on a light stage: an ink ring instead of firelight */
:is(.key, .mute, .cap, .pill):focus-visible, :is(.knob-thumb, .pebble):focus-visible {
  outline: 2px solid #0a84ff; outline-offset: 3px; box-shadow: 0 0 0 5px rgb(10 132 255 / .22);
}

/* studio refinements */
.screen-grain { display: none; }
.screen video, .screen mux-video { filter: sepia(.06) saturate(1.02) contrast(1.03); }
.screen-shade { animation: none; background: radial-gradient(85% 85% at 50% 50%, transparent 60%, rgb(20 10 4 / .35) 100%); }
.device:not(.compact):not(.fs) .viewport {
  -webkit-box-reflect: below calc(-2 / 1340 * 100cqw) linear-gradient(to bottom, transparent 86%, rgb(255 255 255 / .14));
}
.caption { margin-top: clamp(4px, 1.6vh, 18px); }
@media (max-width: 760px) {
  .page, html.scene-mode .page { padding-inline: 8px; }
  .bar-row { gap: 6px; }
  .cap { width: 46px; }
  .cap.mute { width: 58px; }
  .knob.mini { width: 44px; height: 44px; }
}

.era { margin: clamp(6px, 1.8vh, 20px) 0 0; font: 500 13px / 1 "Inter", system-ui, sans-serif; letter-spacing: .28em; padding-left: .28em; color: var(--ink-2); }

/* carved time: crisp engraved numerals that read at any size */
.carved-time {
  font: 700 2.5cqw / 1 "Rubik", system-ui, sans-serif !important; letter-spacing: .03em;
  color: rgb(28 22 18 / .92) !important;
  text-shadow: 0 .12cqw 0 rgb(255 255 255 / .35), 0 -.06cqw 0 rgb(0 0 0 / .55) !important;
  filter: none !important;
}
/* studio light from above: a soft sheen on the top of the stone, deeper contact under it */
.floor-shadow { filter: blur(5px); }


/* ==========================================================================
   FULLSCREEN — the picture fills the whole screen inside a carved stone bezel;
   the controls float on a stone slab that fades away while you watch.
   ========================================================================== */
.bar-wrap { display: contents; }
.device:fullscreen, .device:-webkit-full-screen { background: #0b0806 !important; display: block !important; }
.device.fs { cursor: default; }
.device.fs .viewport {
  position: absolute !important; inset: 0 !important; width: 100% !important; height: 100% !important;
  aspect-ratio: auto !important; overflow: hidden !important; -webkit-box-reflect: unset !important;
}
.device.fs .layer { position: absolute !important; inset: 0 !important; width: 100% !important; height: 100% !important; left: 0 !important; top: 0 !important; aspect-ratio: auto !important; }
.device.fs :is(.scene, .carved, .floor-shadow, .antenna-box) { display: none !important; }
.device.fs :is(.screen, .screen-ui) { left: 0 !important; top: 0 !important; width: 100% !important; height: 100% !important; }
.device.fs .screen video, .device.fs .screen mux-video { object-fit: contain; background: #0b0806; }

/* the carved bezel: rough stone round the edge with a chiselled lip throwing shadow inward */
.device.fs .viewport::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 4;
  border: clamp(10px, 1.3vw, 20px) solid transparent;
  border-image: url("assets/stone.jpg") 46 round;
  box-shadow: inset 0 0 0 1px rgb(0 0 0 / .6), inset 0 14px 22px -6px rgb(0 0 0 / .85),
              inset 0 -10px 18px -6px rgb(0 0 0 / .7), inset 12px 0 18px -8px rgb(0 0 0 / .7), inset -12px 0 18px -8px rgb(0 0 0 / .7);
}

/* the floating stone slab */
.device.fs .bar {
  display: flex !important; flex-direction: column; gap: 12px;
  position: absolute; z-index: 6; left: 50%; bottom: clamp(26px, 5vh, 54px); translate: -50% 0;
  width: min(880px, calc(100% - 64px)); padding: 16px 22px 18px;
  border-radius: 30px 34px 28px 32px / 30px 28px 34px 30px;
  background:
    radial-gradient(120% 140% at 20% 0%, rgb(255 245 230 / .16), transparent 55%),
    linear-gradient(rgb(60 50 42 / .25), rgb(20 15 12 / .45)),
    url("assets/rock.jpg") center / 640px auto repeat, #4a3d32;
  box-shadow: 0 26px 50px rgb(0 0 0 / .55), 0 6px 14px rgb(0 0 0 / .45),
              inset 0 2px 1px rgb(255 240 220 / .22), inset 0 -4px 8px rgb(0 0 0 / .5);
  transition: opacity .45s ease, translate .55s cubic-bezier(.2, .9, .25, 1.15);
}
.device.fs .bar:not([data-visible]):not(:has(:focus-visible)) { opacity: 0; translate: -50% 18px; pointer-events: none; }
.device.fs:has(.bar:not([data-visible])) .screen { cursor: none; }
.device.fs .bar-row { gap: 14px; }
.device.fs .cap { width: 62px; height: 52px; }
.device.fs .cap.mute { width: 76px; }
.device.fs .cap .icon { width: 46%; height: 58%; }
.device.fs .knob.mini { width: 54px; height: 54px; }
.device.fs .bar-time { font: 700 16px / 1 "Rubik", system-ui, sans-serif; color: var(--chalk); }
.device.fs .bar-groove .pebble { width: 34px; height: 38px; }
@media (prefers-reduced-motion: reduce) { .device.fs .bar { transition: opacity .2s linear; } }


/* ---- the sparrow ---------------------------------------------------------- */
.bird { position: fixed; left: 0; top: 0; z-index: 5; pointer-events: none; will-change: transform; opacity: 0; transition: opacity .3s; }
.bird-body { position: absolute; inset: 0; display: block; transform-origin: 60% 83%;
  filter: drop-shadow(0 2px 2px rgb(0 0 0 / .25)); }
.bird-body img { position: absolute; inset: 0; width: 100%; height: 100%; display: block; user-select: none; }
.bird .b-head { transform-origin: 70% 45%; }
.bird .b-tail { transform-origin: 38% 56.7%; }
.bird .b-wing, .bird .b-wingfar { transform-origin: 58% 46.7%; }
.bird-shadow { position: absolute; left: 38%; top: 78%; width: 44%; height: 12%; border-radius: 50%;
  background: radial-gradient(closest-side, rgb(0 0 0 / .45), transparent); filter: blur(1.5px); transition: opacity .15s; }
@media (prefers-reduced-motion: reduce) { .bird { display: none !important; } }


/* ---- the hunt, running along the bottom of the screen ----------------------- */
:root { --hunt-h: clamp(92px, 19vh, 200px); }
.hunt { position: fixed; left: 0; right: 0; bottom: 0; width: 100%; height: var(--hunt-h); z-index: 2; pointer-events: none; }
/* make room so the whole page fits without scrolling */
html, body { overflow: hidden; height: 100%; }
.page, html.scene-mode .page { padding-bottom: calc(var(--hunt-h) + 4px) !important; padding-top: clamp(40px, 7vh, 80px) !important; min-height: 100dvh; height: 100dvh; box-sizing: border-box; }
.ochre, html.scene-mode .ochre { min-width: 0 !important; width: min(1000px, 86vw, calc((100dvh - var(--hunt-h) - 150px) * 1340 / 850)) !important; }
@media (max-width: 760px) {
  .ochre, html.scene-mode .ochre { width: min(100%, calc((100dvh - var(--hunt-h) - 130px) * 1.05)) !important; }
}
@media (prefers-reduced-motion: reduce) { .hunt { display: none; } }
.bar-groove { margin-inline: 12px; }


/* ---- faint cave paintings on the studio wall -------------------------------- */
.wall-art { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.wa { position: absolute; color: #a2452a; fill: currentColor; opacity: .09; }
.wa-bison   { left: 4vw;  top: 12vh; width: clamp(110px, 15vw, 230px); rotate: -4deg; }
.wa-hand    { left: 9vw;  top: 46vh; width: clamp(54px, 6vw, 96px); rotate: -14deg; opacity: .08; }
.wa-deer    { right: 5vw; top: 40vh; width: clamp(96px, 12vw, 190px); rotate: 5deg; color: #6b4a34; }
.wa-hunters { right: 7vw; top: 10vh; width: clamp(100px, 13vw, 200px); rotate: 3deg; opacity: .08; }
.wa-sun     { left: 20vw; top: 6vh;  width: clamp(44px, 4.6vw, 76px); color: #6b4a34; opacity: .07; }
@media (max-width: 760px) {
  .wa-bison { left: 3vw; top: 7vh; } .wa-hunters { right: 3vw; top: 62vh; } .wa-deer { right: 4vw; top: 9vh; width: 84px; }
  .wa-hand { left: 6vw; top: 66vh; } .wa-sun { display: none; }
}

/* two more, and everything a touch more visible */
.wa { opacity: .13; }
.wa-hand, .wa-hunters { opacity: .12; }
.wa-sun { opacity: .11; }
.wa-mammoth { left: 13vw; top: 62vh; width: clamp(90px, 11vw, 170px); rotate: 3deg; color: #6b4a34; opacity: .15; }
.wa-ibex    { right: 15vw; top: 63vh; width: clamp(80px, 9.5vw, 150px); rotate: -4deg; opacity: .15; }
@media (max-width: 760px) { .wa-mammoth { left: 34vw; top: 70vh; width: 80px; } .wa-ibex { display: none; } }
/* very slightly fainter */
.wa { opacity: .115; }
.wa-hand, .wa-hunters { opacity: .105; }
.wa-sun { opacity: .095; }
.wa-mammoth, .wa-ibex { opacity: .13; }


/* ==========================================================================
   NIGHT MODE — the same stone set under a Stone Age night sky
   ========================================================================== */
.mode-toggle {
  position: fixed; z-index: 6; left: clamp(12px, 1.6vw, 24px); top: clamp(10px, 2vh, 20px);
  width: 44px; height: 44px; padding: 0; display: grid; place-items: center; cursor: pointer;
  border-radius: 50%; border: 1px solid rgb(0 0 0 / .08); color: #3a3a3f;
  background: rgb(255 255 255 / .55); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 1px 2px rgb(0 0 0 / .06), 0 6px 16px rgb(0 0 0 / .06);
  transition: transform .35s cubic-bezier(.28, 1.9, .42, 1), background-color .4s, color .4s, border-color .4s, box-shadow .4s;
}
.mode-toggle:hover { transform: scale(1.06); }
.mode-toggle:active { transform: scale(.94); }
.mode-toggle:focus-visible { outline: 2px solid #0a84ff; outline-offset: 3px; }
.mode-toggle svg { grid-area: 1 / 1; width: 20px; height: 20px; fill: currentColor; transition: opacity .35s, rotate .6s cubic-bezier(.3, 1.4, .5, 1), scale .45s; }
.mode-toggle .i-sun { opacity: 0; rotate: -90deg; scale: .5; }
.night .mode-toggle { color: #f3dfb6; background: rgb(22 26 40 / .55); border-color: rgb(255 255 255 / .12); box-shadow: 0 0 0 1px rgb(0 0 0 / .3), 0 0 18px rgb(255 200 120 / .18); }
.night .mode-toggle .i-moon { opacity: 0; rotate: 90deg; scale: .5; }
.night .mode-toggle .i-sun { opacity: 1; rotate: 0deg; scale: 1; }
.device.fs ~ .mode-toggle, html:has(.device.fs) .mode-toggle { display: none; }

html, body, .title, .era { transition: background-color .6s ease, color .6s ease; }
.night-sky { position: fixed; inset: 0; z-index: 0; pointer-events: none; opacity: 0; transition: opacity .8s ease; overflow: hidden;
  background:
    radial-gradient(90% 60% at 50% 110%, rgb(120 60 30 / .22), transparent 70%),
    radial-gradient(120% 90% at 70% 0%, #1b2440 0%, #0d1322 45%, #07090f 100%); }
.night .night-sky { opacity: 1; }
.stars { position: absolute; inset: 0; }
.stars .tw { animation: twinkle var(--d) ease-in-out infinite; animation-delay: var(--dl); }
@keyframes twinkle { 0%, 100% { opacity: .2 } 50% { opacity: 1 } }
.milky { position: absolute; left: -10%; top: -5%; width: 120%; height: 60%; rotate: -14deg;
  background: radial-gradient(50% 22% at 50% 50%, rgb(190 205 255 / .10), transparent 70%); filter: blur(10px); }
.moon { position: absolute; right: 21vw; top: 7vh; width: clamp(44px, 5vw, 78px); aspect-ratio: 1; border-radius: 50%;
  background: radial-gradient(circle at 38% 36%, #fffaf0, #efe3c8 55%, #cfc0a0);
  box-shadow: 0 0 30px 6px rgb(255 240 210 / .25), 0 0 120px 40px rgb(200 210 255 / .10);
  -webkit-mask: radial-gradient(circle at 78% 30%, transparent 46%, #000 48%); mask: radial-gradient(circle at 78% 30%, transparent 46%, #000 48%); }
.ember-glow { position: absolute; left: 50%; bottom: -30vh; width: 120vw; height: 70vh; translate: -50% 0; border-radius: 50%;
  background: radial-gradient(closest-side, rgb(255 140 60 / .16), transparent 70%); animation: flicker 3.1s infinite steps(1, end); }

.night, .night body { background: #07090f !important; color: #ece3d0; }
.night body { background: #07090f !important; }
.night .title { color: #f0e2c4; text-shadow: 0 0 14px rgb(255 190 110 / .35); }
.night .era { color: #b9ad97; }
.night .wa { color: #e9dcc4; opacity: .085; }
.night .wa-deer, .night .wa-sun, .night .wa-mammoth { color: #d9a27c; }
.night .wa-mammoth, .night .wa-ibex { opacity: .1; }
/* the stone at night: cooler and darker, with firelight warming its underside */
.night .device:not(.fs) :is(.scene, .cap-img, .dial, .arm, .peb, .antenna-box) { filter: brightness(.74) saturate(.9) contrast(1.06); }
.night .device:not(.fs):not(.compact) .layer::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  -webkit-mask: url("assets/device.webp") center / 100% 100% no-repeat; mask: url("assets/device.webp") center / 100% 100% no-repeat;
  background: linear-gradient(to bottom, rgb(150 175 255 / .16), transparent 30%, transparent 62%, rgb(255 140 60 / .26));
  mix-blend-mode: soft-light;
}
.night .floor-shadow { background: radial-gradient(50% 40% at 50% 60%, rgb(0 0 0 / .7), transparent 100%), radial-gradient(60% 60% at 50% 70%, rgb(255 140 60 / .10), transparent 100%); }
.night .device:not(.compact):not(.fs) .viewport { -webkit-box-reflect: below calc(-2 / 1340 * 100cqw) linear-gradient(to bottom, transparent 82%, rgb(255 255 255 / .10)); }
.night .screen-ui::before { content: ""; position: absolute; inset: -2%; border-radius: 4%; pointer-events: none; box-shadow: 0 0 3cqw .6cqw rgb(200 220 255 / .12); }
.night .device.fs .screen-ui::before { display: none; }
.night .device.compact { filter: drop-shadow(0 18px 30px rgb(0 0 0 / .7)); }
.night .carved-time { color: rgb(10 7 5 / .95) !important; }
.night .bird { filter: brightness(.8); }
.night :is(.key, .mute, .cap, .pill):focus-visible, .night :is(.knob-thumb, .pebble):focus-visible { outline-color: #ffc27a; box-shadow: 0 0 0 5px rgb(255 160 70 / .25); }
@media (prefers-reduced-motion: reduce) { .stars .tw, .ember-glow { animation: none; } }
@media (max-width: 760px) { .moon { right: 8vw; top: 4vh; } }


/* the day/night mark: a small cave-painted moon (or sun), barely there until you reach for it */
.mode-toggle, .night .mode-toggle {
  background: none; border: 0; box-shadow: none; backdrop-filter: none; -webkit-backdrop-filter: none;
  color: #9a4a2c; opacity: .38;
  transition: opacity .3s ease, transform .35s cubic-bezier(.28, 1.9, .42, 1), color .5s;
}
.night .mode-toggle { color: #e6c79a; opacity: .3; }
.mode-toggle:hover, .mode-toggle:focus-visible { opacity: .95; }
.mode-toggle svg { width: 24px; height: 24px; }
.night .mode-toggle:hover, .night .mode-toggle:focus-visible { opacity: .95; }
/* a quieter, smaller moon */
.moon { width: clamp(26px, 2.8vw, 44px); opacity: .55;
  background: radial-gradient(circle at 38% 36%, #efe6d2, #d5c8ad 55%, #b3a587);
  box-shadow: 0 0 14px 2px rgb(255 240 210 / .14), 0 0 60px 18px rgb(200 210 255 / .05); }

/* ==========================================================================
   FULLSCREEN, refined — a clean picture; the controls are one slab of the same stone
   ========================================================================== */
.device.fs .screen video, .device.fs .screen mux-video { filter: none; }
.device.fs .screen-grain { display: none; }
.device.fs .screen-shade {            /* only a soft fall-off behind the controls */
  box-shadow: none; animation: none;
  background: linear-gradient(to top, rgb(8 5 3 / .6), rgb(8 5 3 / .18) 22%, transparent 38%),
              linear-gradient(to bottom, rgb(8 5 3 / .35), transparent 14%);
  transition: opacity .5s ease;
}
.device.fs:has(.bar:not([data-visible]):not(:has(:focus-visible))) .screen-shade { opacity: 0; }
.device.fs .viewport::after { display: none; }

.device.fs .bar {
  width: min(820px, calc(100% - 48px)); padding: 14px 26px 18px; gap: 8px;
  bottom: clamp(22px, 4.5vh, 48px);
  border-radius: 40px; background: url("assets/fs-slab.webp") center / 100% 100% no-repeat; box-shadow: none;
  filter: drop-shadow(0 26px 30px rgb(0 0 0 / .55)) drop-shadow(0 4px 6px rgb(0 0 0 / .45));
}
.device.fs .viewport { -webkit-mask: none !important; mask: none !important; }
.device.fs .bar::before {              /* a small ochre hand-print signs the slab */
  content: ""; position: absolute; right: 30%; bottom: 14px; width: 22px; height: 26px; opacity: .22; pointer-events: none;
  background: #b4492a;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='-70 -110 150 160'%3E%3Cpath d='M-34 40C-40 10-38-10-30-22L-36-70C-38-80-26-82-24-72L-16-34-14-88C-14-98-2-98-2-88L0-36 6-92C7-102 19-100 18-90L14-34 26-80C29-90 40-86 37-76L26-26 44-46C51-54 61-46 55-38L28 4C22 26 12 40-34 40Z'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='-70 -110 150 160'%3E%3Cpath d='M-34 40C-40 10-38-10-30-22L-36-70C-38-80-26-82-24-72L-16-34-14-88C-14-98-2-98-2-88L0-36 6-92C7-102 19-100 18-90L14-34 26-80C29-90 40-86 37-76L26-26 44-46C51-54 61-46 55-38L28 4C22 26 12 40-34 40Z'/%3E%3C/svg%3E") center / contain no-repeat;
}
.device.fs .bar-groove { margin-inline: 14px; height: 40px; }
.device.fs .bar-groove .groove-track {
  height: 12px; background: linear-gradient(to bottom, #0b0705, #241a13);
  box-shadow: inset 0 4px 5px rgb(0 0 0 / .95), 0 1.5px 0 rgb(255 240 220 / .3), 0 -1px 0 rgb(0 0 0 / .5);
}
.device.fs .bar-time {
  font: 700 17px / 1 "Rubik", system-ui, sans-serif; letter-spacing: .03em;
  color: rgb(22 14 9 / .92); text-shadow: 0 1.5px 0 rgb(255 240 218 / .35), 0 -1px 0 rgb(0 0 0 / .5);   /* cut into the slab */
}
.device.fs .cap { filter: drop-shadow(0 4px 3px rgb(0 0 0 / .7)); }
.device.fs .cap .icon, .device.fs .cap .horn { fill: #f1e6cf; }
.device.fs .bar { padding: 24px 46px 30px; width: min(900px, calc(100% - 40px)); }
.device.fs .screen-shade { background: linear-gradient(to top, rgb(8 5 3 / .5), rgb(8 5 3 / .12) 22%, transparent 36%); }
.device.fs .bar::before { right: 33%; bottom: 30px; }
.device.fs .bar-time { color: #efe3cb; text-shadow: 0 -1px 0 rgb(0 0 0 / .85), 0 1px 2px rgb(0 0 0 / .5); }

/* pigment blown onto the wall where you touch it */
.touch-fx { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 1; pointer-events: none; }


/* PERFORMANCE: the floor reflection is a still mirror of the stone, not a live copy of the video */
.device .viewport, .night .device .viewport { -webkit-box-reflect: unset !important; }
.reflection {                       /* image flipped about the feet (picture y 848) */
  position: absolute; left: 0; width: 100%; top: calc(672 / 1024 * 100%); height: 100%; pointer-events: none;
  background: url("assets/device.webp") center / 100% 100% no-repeat;
  transform: scaleY(-1);
  -webkit-mask: linear-gradient(to bottom, transparent 75%, rgb(0 0 0 / .13) 83%);
          mask: linear-gradient(to bottom, transparent 75%, rgb(0 0 0 / .13) 83%);
}
.night .reflection { opacity: .7; }
.device.compact .reflection, .device.fs .reflection { display: none; }
