@font-face {
  font-family: "Atkinson Hyperlegible";
  src: url("fonts/AtkinsonHyperlegible-Regular.ttf") format("truetype");
  font-weight: 400;
}
@font-face {
  font-family: "Atkinson Hyperlegible";
  src: url("fonts/AtkinsonHyperlegible-Bold.ttf") format("truetype");
  font-weight: 700;
}
@font-face {
  font-family: "Yellowtail";
  src: url("fonts/Yellowtail-Regular.ttf") format("truetype");
}
@font-face {
  font-family: "Limelight";
  src: url("fonts/Limelight-Regular.ttf") format("truetype");
  font-weight: 400;
}
@font-face {
  font-family: "Oswald";
  src: url("fonts/Oswald-Regular.ttf") format("truetype");
  font-weight: 400;
}
@font-face {
  font-family: "Oswald";
  src: url("fonts/Oswald-Bold.ttf") format("truetype");
  font-weight: 700;
}

/* Night gift art — do not follow the browser's dark preference. */
html { color-scheme: only light; }

:root {
  --phosphor: #eef3ee;
  --phosphor-dim: #a9b4ae;
  --phosphor-faint: #6f7a75;
  --alert: #ff6b5a;
  --alert-glow: rgba(255, 90, 70, .45);
  --tube: #101413;
  --wood: #7b4423;
  --wood-dark: #44220e;
  --brass-hi: #f6e2a6;
  --brass: #c99d48;
  --brass-lo: #7c5a1d;
  --cream: #f3e6c8;
  /* Gold lettering printed on the cabinet's wood */
  --gilt: #f0dca6;
  /* 1950s TV lettering: condensed gothic labels + marquee titles + script badge */
  --ui-font: "Oswald", "Avenir Next Condensed", "Helvetica Neue", Arial, sans-serif;
  --display-font: "Limelight", "Copperplate Gothic", Georgia, serif;
  --script-font: "Yellowtail", "Snell Roundhand", "Brush Script MT", cursive;
  --body-font: "Atkinson Hyperlegible", "Avenir Next", "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #1a120e;
  font-family: var(--ui-font);
  -webkit-font-smoothing: antialiased;
  -webkit-user-select: none;
  user-select: none;
  cursor: default;
}

button { font-family: inherit; cursor: pointer; }
button:disabled { cursor: default; }

/* ---------- 3D Interactive 1950s Living Room ---------- */

.living-room {
  position: fixed;
  inset: 0;
  z-index: 20;
  overflow: hidden;
  background: #140d09;
  perspective: 1400px;
  -webkit-perspective: 1400px;
  transition: opacity .52s ease, visibility 0s linear 0s;
}

body.view-tv .living-room {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .52s ease .16s, visibility 0s linear .7s;
}

.room-camera {
  position: absolute;
  left: 50%;
  top: 50%;
  transform-style: preserve-3d;
  -webkit-transform-style: preserve-3d;
  /* The middle of the television's front in the room photo: zooming scales
     about this point while sliding it to the middle of the window. */
  transform-origin: 59.2% 55.6%;
  transform: translate3d(-50%, -50%, 0) scale(1);
  transition: transform .78s cubic-bezier(.22, .85, .28, 1);
  will-change: transform;
}

body.view-tv .room-camera {
  transform: translate3d(-59.2%, -55.6%, 0) scale(4.2);
}

.room-world {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  -webkit-transform-style: preserve-3d;
  transform: rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)) translate3d(var(--tx, 0px), var(--ty, 0px), 0);
  transition: transform .18s ease-out;
  will-change: transform;
}

/* Layer 0: Outside 1950s street behind the window cutout (true 3D depth parallax) */
/* Sized so that, once pushed back 120px, it overhangs the glass by about 2.5%
   of the room on every side and never shows an edge while looking around. */
.window-world {
  position: absolute;
  left: 10.04%;
  top: -2.12%;
  width: 34.31%;
  height: 55.59%;
  overflow: hidden;
  /* Near-dusk winter sky behind the street photo */
  background: linear-gradient(180deg, #0b1428 0%, #1a2744 42%, #2a3348 72%, #3a3f4a 100%);
  transform: translateZ(-120px);
}

/* The street photo and the cars share this 4:3 box, so a car placed at a row
   of the photo stays on that row of asphalt at any screen size. */
.street-scene {
  position: absolute;
  left: -9.55%;
  top: 3.45%;
  width: 117.8%;
  height: 96.8%;
  transform: translate3d(var(--out-tx, 0px), var(--out-ty, 0px), 0);
  transition: transform .18s ease-out;
}
.street-photo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}
/* Flying birds in the upper sky */
.outside-birds {
  position: absolute;
  inset: 3% 0 54% 0;
  pointer-events: none;
  overflow: hidden;
}
.bird {
  position: absolute;
  left: -10%;
  top: var(--bird-y, 24%);
  width: var(--bird-size, 22px);
  height: calc(var(--bird-size, 22px) * 0.56);
  color: rgba(28, 26, 24, .88);
  filter: drop-shadow(0 1px 1px rgba(255, 255, 255, .3));
  animation: bird-glide var(--bird-dur, 12s) linear var(--bird-delay, 0s) forwards;
}
.bird.is-rtl {
  left: auto;
  right: -12%;
  animation-name: bird-glide-rtl;
}
.bird svg {
  width: 100%;
  height: 100%;
  overflow: visible;
  animation: bird-bob 1.4s ease-in-out infinite;
}
.bird .wing-l {
  transform-origin: 12px 6px;
  animation: wing-flap-l var(--flap, .42s) ease-in-out infinite;
}
.bird .wing-r {
  transform-origin: 12px 6px;
  animation: wing-flap-r var(--flap, .42s) ease-in-out infinite;
}
@keyframes bird-glide {
  0% { transform: translate3d(0, 8px, 0) scale(.92); opacity: 0; }
  8% { opacity: .9; }
  50% { transform: translate3d(560%, var(--bird-arc, -12px), 0) scale(1); opacity: .95; }
  92% { opacity: .85; }
  100% { transform: translate3d(1200%, 4px, 0) scale(.9); opacity: 0; }
}
@keyframes bird-glide-rtl {
  0% { transform: translate3d(0, 6px, 0) scaleX(-1) scale(.9); opacity: 0; }
  8% { opacity: .9; }
  50% { transform: translate3d(-560%, var(--bird-arc, -10px), 0) scaleX(-1) scale(1); opacity: .95; }
  92% { opacity: .85; }
  100% { transform: translate3d(-1200%, 2px, 0) scaleX(-1) scale(.88); opacity: 0; }
}
@keyframes bird-bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-2.5px); }
}
@keyframes wing-flap-l {
  0%, 100% { transform: rotate(-22deg); }
  50% { transform: rotate(24deg); }
}
@keyframes wing-flap-r {
  0%, 100% { transform: rotate(22deg); }
  50% { transform: rotate(-24deg); }
}

/* Everything that passes along the street. Width, row and travel are set per
   mover from the street photo's perspective (see STREET in app.js); the bottom
   edge of each is its tyre or foot line and sits on its row of the photo. */
.outside-cars {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 4;
}
.street-mover {
  position: absolute;
  left: 0;
  bottom: var(--mover-bottom, 16%);
  width: var(--mover-w, 45%);
  will-change: transform;
  animation: street-pass var(--mover-dur, 4s) linear forwards;
}
@keyframes street-pass {
  from { transform: translate3d(var(--mover-from, -100%), 0, 0); }
  to { transform: translate3d(var(--mover-to, 220%), 0, 0); }
}

.vintage-car-body {
  position: relative;
  width: 100%;
  animation: car-suspension .9s ease-in-out infinite;
}
.vintage-car-body::after {
  /* Shadow the body throws on the asphalt between the wheels */
  content: "";
  position: absolute;
  left: 3%;
  right: 3%;
  bottom: -3%;
  height: 15%;
  border-radius: 50%;
  background: radial-gradient(ellipse at 50% 50%, rgba(22, 16, 10, .62), rgba(22, 16, 10, .3) 55%, transparent 76%);
  z-index: 0;
}
.vintage-car img {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  height: auto;
  /* Studio-lit cutouts warmed and softened toward the late-afternoon street photo */
  filter: sepia(.2) saturate(.94) brightness(.96) contrast(.95);
}
.vintage-car.is-rtl img {
  transform: scaleX(-1);
}
.vintage-car.is-far img {
  filter: sepia(.22) saturate(.9) brightness(.98) contrast(.92) blur(.3px);
}
/* After dark the street is lit only by the houses' windows and Christmas
   lights, so a car going by is a dim shape in the colour of the night. */
.street-scene.is-night .vintage-car img {
  filter: brightness(.5) saturate(.6) contrast(1.06);
}
.street-scene.is-night .vintage-car.is-far img {
  filter: brightness(.45) saturate(.56) contrast(1.04) blur(.3px);
}
.street-scene.is-night .vintage-car-body::after {
  opacity: .65;
}
@keyframes car-suspension {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-.5%); }
}

/* People walking past. The film is a grid of poses, one full stride; the frame
   shows one pose at a time. The rows are stepped up behind the frame on one
   clock and the film is stepped along each row on another. How long a loop
   takes, and the grid, are set per person by app.js. */
.passerby::before {
  content: "";
  position: absolute;
  left: 10%;
  right: 10%;
  bottom: -2.5%;
  height: 7%;
  border-radius: 50%;
  background: radial-gradient(ellipse at 50% 50%, rgba(22, 16, 10, .5), rgba(22, 16, 10, .22) 55%, transparent 76%);
}
.passerby-frame {
  position: relative;
  height: 0;
  overflow: hidden;
}
.passerby.is-rtl .passerby-frame {
  transform: scaleX(-1);
}
.passerby-rows {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  animation-name: sprite-rows;
  animation-iteration-count: infinite;
}
@keyframes sprite-rows {
  from { transform: translateY(0); }
  to { transform: translateY(-100%); }
}
.passerby-strip {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  max-width: none;
  filter: sepia(.2) saturate(.92) brightness(.95) contrast(.95);
  animation-name: sprite-play;
  animation-iteration-count: infinite;
}
.passerby.is-far .passerby-strip {
  filter: sepia(.22) saturate(.88) brightness(.97) contrast(.92) blur(.25px);
}
@keyframes sprite-play {
  from { transform: translateX(0); }
  to { transform: translateX(-100%); }
}
.street-scene.is-night .passerby-strip {
  filter: brightness(.56) saturate(.7) contrast(1.04);
}
.street-scene.is-night .passerby.is-far .passerby-strip {
  filter: brightness(.5) saturate(.64) contrast(1.02) blur(.25px);
}
.street-scene.is-night .passerby::before {
  opacity: .6;
}

/* Snow falling outside the window: small plain flakes, no glow. Each flake is
   two elements, so its steady fall (the <i>) and its side-to-side wander (the
   <b> inside) can run on separate clocks. Sizes, speeds and fall distance are
   set per flake by buildOutsideSnow in app.js; far flakes are smaller, fainter
   and slower than near ones. */
.outside-snow {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 4;
}
.outside-snow i {
  position: absolute;
  top: -3%;
  left: var(--flake-x, 50%);
  animation: outside-snowfall var(--flake-dur, 9s) linear var(--flake-delay, 0s) infinite;
  will-change: transform;
}
.outside-snow b {
  display: block;
  width: var(--flake-size, 2px);
  height: var(--flake-size, 2px);
  border-radius: 50%;
  background: #f1f5fc;
  opacity: var(--flake-alpha, .6);
  animation: outside-snow-sway var(--flake-sway-dur, 3s) ease-in-out var(--flake-delay, 0s) infinite alternate;
}
@keyframes outside-snowfall {
  from { transform: translate3d(0, 0, 0); }
  to { transform: translate3d(var(--flake-drift, 20px), var(--flake-fall, 520px), 0); }
}
@keyframes outside-snow-sway {
  from { transform: translateX(var(--flake-sway-from, -4px)); }
  to { transform: translateX(var(--flake-sway-to, 4px)); }
}

/* ---- The mug of cocoa ----
   The coffee table, the mug, its coaster and its shadow are in the room photo
   (tools/build-room-night.mjs). This box is the mug's body in the photo
   (x 396-465, y 562-624 of 1280x720); the lettering and the steam go over it. */
.cocoa-mug {
  position: absolute;
  pointer-events: none;
  left: 30.94%;
  top: 78.06%;
  width: 5.39%;
  height: 8.61%;
  z-index: 5;
}
.cocoa-mug-words {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  font-family: var(--script-font);
  opacity: .9;
}
.cocoa-mug-words .mug-big { font-size: 98px; }
.cocoa-mug-words .mug-mom { font-size: 170px; }
.cocoa-mug-words .mug-small { font-size: 88px; }
/* Rises from the cocoa, just above the box */
.cocoa-steam {
  position: absolute;
  left: 2%;
  width: 96%;
  bottom: 106%;
  height: 150%;
  overflow: visible;
}
.cocoa-steam i {
  position: absolute;
  bottom: 0;
  width: 26%;
  height: 70%;
  border-radius: 50%;
  background: radial-gradient(ellipse 50% 50% at 50% 60%, rgba(255, 247, 235, .62), rgba(255, 247, 235, .24) 55%, transparent 72%);
  -webkit-filter: blur(5px);
  filter: blur(5px);
  opacity: 0;
  transform-origin: 50% 100%;
  will-change: transform, opacity;
  -webkit-animation: steam-rise 5.2s ease-out infinite;
  animation: steam-rise 5.2s ease-out infinite;
}
.cocoa-steam i:nth-child(1) { left: 20%; -webkit-animation-delay: 0s; animation-delay: 0s; }
.cocoa-steam i:nth-child(2) { left: 42%; width: 22%; -webkit-animation-name: steam-rise-b; animation-name: steam-rise-b; -webkit-animation-duration: 6.1s; animation-duration: 6.1s; -webkit-animation-delay: -1.4s; animation-delay: -1.4s; }
.cocoa-steam i:nth-child(3) { left: 30%; width: 20%; -webkit-animation-duration: 4.6s; animation-duration: 4.6s; -webkit-animation-delay: -2.7s; animation-delay: -2.7s; }
.cocoa-steam i:nth-child(4) { left: 52%; width: 24%; -webkit-animation-name: steam-rise-b; animation-name: steam-rise-b; -webkit-animation-duration: 5.6s; animation-duration: 5.6s; -webkit-animation-delay: -3.9s; animation-delay: -3.9s; }
.cocoa-steam i:nth-child(5) { left: 36%; width: 18%; -webkit-animation-duration: 6.6s; animation-duration: 6.6s; -webkit-animation-delay: -4.8s; animation-delay: -4.8s; }
/* Each wisp leaves the cocoa thin, swells as it climbs, leans one way then the
   other, and thins out to nothing. */
@-webkit-keyframes steam-rise {
  0% { opacity: 0; -webkit-transform: translate3d(0, 12%, 0) scale(.35, .45) skewX(0); }
  18% { opacity: .85; }
  50% { opacity: .55; -webkit-transform: translate3d(16%, -42%, 0) scale(.8, .9) skewX(-14deg); }
  100% { opacity: 0; -webkit-transform: translate3d(-12%, -98%, 0) scale(1.35, 1.2) skewX(12deg); }
}
@keyframes steam-rise {
  0% { opacity: 0; transform: translate3d(0, 12%, 0) scale(.35, .45) skewX(0); }
  18% { opacity: .85; }
  50% { opacity: .55; transform: translate3d(16%, -42%, 0) scale(.8, .9) skewX(-14deg); }
  100% { opacity: 0; transform: translate3d(-12%, -98%, 0) scale(1.35, 1.2) skewX(12deg); }
}
@-webkit-keyframes steam-rise-b {
  0% { opacity: 0; -webkit-transform: translate3d(0, 12%, 0) scale(.35, .45) skewX(0); }
  22% { opacity: .75; }
  55% { opacity: .5; -webkit-transform: translate3d(-18%, -48%, 0) scale(.85, .95) skewX(12deg); }
  100% { opacity: 0; -webkit-transform: translate3d(14%, -104%, 0) scale(1.4, 1.25) skewX(-10deg); }
}
@keyframes steam-rise-b {
  0% { opacity: 0; transform: translate3d(0, 12%, 0) scale(.35, .45) skewX(0); }
  22% { opacity: .75; }
  55% { opacity: .5; transform: translate3d(-18%, -48%, 0) scale(.85, .95) skewX(12deg); }
  100% { opacity: 0; transform: translate3d(14%, -104%, 0) scale(1.4, 1.25) skewX(-10deg); }
}

/* Labradoodle on the rug in front of the hearth: one photograph
   (assets/dog-sleep.png). hearth.js draws it on a canvas and bends it, so it
   breathes, flicks an ear, twitches in a dream and now and then lifts its
   head; every movement is the same picture, so it is always the same dog.
   Without WebGL the photograph itself is shown, breathing from the floor up. */
.hearth-dog {
  position: absolute;
  /* On the cushion of his bed in the room photo (cushion x 840-1030,
     y 615-672 of 1280x720). The box is 172 x 63.6 photo pixels. */
  left: 66.1%;
  top: 84.78%;
  width: 13.44%;
  z-index: 3;
  pointer-events: none;
  transform: translateZ(4px);
  /* He lies behind the bed's front bolster: nothing of him is drawn below
     the top edge of that bolster, traced from the photo. Open above, so he
     can stand up. */
  -webkit-clip-path: polygon(-12% -220%, 112% -220%, 112% 31%, 101.2% 40.3%, 89.5% 48.1%, 75% 57.5%, 65.1% 67%, 60.5% 82.7%, 57.6% 100%, 51.7% 103.1%, 43% 101.6%, 31.4% 96.9%, 19.8% 90.6%, 8.1% 79.6%, -0.6% 62.3%, -6.4% 27.7%, -11.6% 2.5%);
  clip-path: polygon(-12% -220%, 112% -220%, 112% 31%, 101.2% 40.3%, 89.5% 48.1%, 75% 57.5%, 65.1% 67%, 60.5% 82.7%, 57.6% 100%, 51.7% 103.1%, 43% 101.6%, 31.4% 96.9%, 19.8% 90.6%, 8.1% 79.6%, -0.6% 62.3%, -6.4% 27.7%, -11.6% 2.5%);
}
/* Where the dog's weight presses into the cushion */
.hearth-dog-shadow {
  position: absolute;
  left: -2%;
  right: -2%;
  bottom: -6%;
  height: 40%;
  background: radial-gradient(ellipse 50% 50% at 50% 50%, rgba(14, 3, 3, .6) 0%, rgba(14, 3, 3, .32) 46%, rgba(14, 3, 3, 0) 74%);
}
.hearth-dog-frame {
  position: relative;
  width: 100%;
  height: 0;
  padding-bottom: 37%;
  transform-origin: 50% 100%;
  animation: dog-breathe 3.8s ease-in-out infinite;
  /* The room is lit by the fire and the lamp only */
  -webkit-filter: brightness(.66) saturate(1.08);
  filter: brightness(.66) saturate(1.08);
}
.hearth-dog-pose {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  display: block;
}
/* The canvas is a little larger than the photograph, so the head has room to lift. */
.hearth-dog-gl {
  position: absolute;
  left: -4%;
  top: -22.52%;
  width: 108%;
  height: 125.23%;
  display: block;
}
.hearth-dog-frame.has-gl { animation: none; }
.hearth-dog-frame.has-gl .hearth-dog-pose { visibility: hidden; }
@keyframes dog-breathe {
  0%, 100% { transform: scale(1, 1); }
  45% { transform: scale(1.005, 1.022); }
}

/* Layer 1: the window's glass and sash, between the street and the room.
   The box is the hole in the room photo plus a margin hidden behind the frame
   and the curtains; tools/build-window.mjs draws the sash for this box. */
.window-glass {
  position: absolute;
  left: 14.688%;
  top: 3.056%;
  width: 28.125%;
  height: 49.722%;
  overflow: hidden;
  pointer-events: none;
  transform: translateZ(-2px);
}
/* The room mirrored faintly in the glass. A reflection lies as far behind the
   glass as the thing is in front of it, so it drifts with the street as the
   view turns, only less. It is plainer after dark, when there is less outside
   to compete with it. */
.glass-reflect {
  position: absolute;
  left: -5%;
  top: -5%;
  width: 110%;
  height: 110%;
  opacity: .6;
  transform: translate3d(calc(var(--out-tx, 0px) * .55), calc(var(--out-ty, 0px) * .55), 0);
  transition: transform .18s ease-out;
}
.window-glass.is-night .glass-reflect { opacity: 1; }
.glass-reflect i {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
}
/* A soft band of the lit ceiling across the whole window */
.glass-band {
  background: linear-gradient(116deg, transparent 26%, rgba(255, 246, 226, .08) 40%, rgba(255, 246, 226, .03) 49%, transparent 60%);
  transition: opacity .45s ease;
}
/* The floor lamp, which stands just left of the window */
.glass-lamp {
  background:
    radial-gradient(ellipse 5.5% 8% at 14.6% 48%, rgba(255, 232, 180, .08), transparent 100%),
    radial-gradient(ellipse 15% 21% at 14.6% 50%, rgba(255, 208, 140, .09), transparent 100%);
  transition: opacity .35s ease;
}
/* The fire, across the room to the right. hearth.js sets how bright it is
   from the flames it is drawing; this is its steady level without them. */
.glass-fire {
  background: radial-gradient(ellipse 38% 34% at 96% 76%, rgba(255, 138, 56, .2), rgba(255, 120, 44, .07) 55%, transparent 100%);
  opacity: .8;
}
/* A few of the tree's lights, out of focus */
.glass-tree {
  background:
    radial-gradient(circle at 84.6% 53.5%, rgba(255, 92, 70, .38), transparent 1.6%),
    radial-gradient(circle at 88.4% 62.5%, rgba(255, 206, 112, .36), transparent 1.8%),
    radial-gradient(circle at 82.8% 67%, rgba(110, 220, 130, .3), transparent 1.5%),
    radial-gradient(circle at 90.2% 49.7%, rgba(120, 170, 255, .3), transparent 1.4%),
    radial-gradient(circle at 86.4% 75.2%, rgba(255, 196, 100, .34), transparent 1.7%);
  animation: glass-twinkle 5.5s ease-in-out infinite alternate;
}
@keyframes glass-twinkle {
  from { opacity: .55; }
  to { opacity: 1; }
}
.window-sash {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  display: block;
  transition: filter .45s ease, -webkit-filter .45s ease;
}
/* Lamp off: no lamp in the glass, and the sash falls as dark as the wall
   round it does under the night veil. */
.living-room.is-cozy-dim .glass-lamp { opacity: 0; }
.living-room.is-cozy-dim .glass-band { opacity: .4; }
.living-room.is-cozy-dim .window-sash {
  -webkit-filter: brightness(.42) saturate(.9);
  filter: brightness(.42) saturate(.9);
}

/* The room photo's own edges, mirrored outward. Turning the view swings one
   side of the room away from the viewer, which draws that edge of the photo
   in from the edge of the screen; these carry the wall, floor and curtains on
   past it. They sit a hair behind the photo and tuck a little way under it,
   so no seam shows between them. */
.room-spill {
  position: absolute;
  pointer-events: none;
  background: url("assets/room-xmas-1950s.png") no-repeat;
  transition: filter .45s ease, -webkit-filter .45s ease;
}
.room-spill-l, .room-spill-r { top: 0; width: 6%; height: 100%; background-size: 1666.667% 100%; transform: translateZ(-1px) scaleX(-1); }
/* The floor lamp's shade starts 8px in from the photo's left edge, and a
   mirror would show a second shade beside it. The left side carries on with
   just the strip of wall before the lamp, drawn out sideways. */
.room-spill-l { right: 99.8%; background-position: 0 0; background-size: 18000% 100%; }
.room-spill-r { left: 99.8%; background-position: 100% 0; }
/* 4.4% high: the window's cut-out starts just below that in the photo. */
.room-spill-t, .room-spill-b { left: 0; width: 100%; height: 4.4%; background-size: 100% 2272.727%; transform: translateZ(-1px) scaleY(-1); }
.room-spill-t { bottom: 99.8%; background-position: 0 0; }
.room-spill-b { top: 99.8%; background-position: 0 100%; }
.room-spill-tl, .room-spill-tr, .room-spill-bl, .room-spill-br { width: 6%; height: 4.4%; background-size: 1666.667% 2272.727%; transform: translateZ(-1px) scale(-1, -1); }
.room-spill-tl { right: 99.8%; bottom: 99.8%; background-position: 0 0; background-size: 18000% 2272.727%; }
.room-spill-tr { left: 99.8%; bottom: 99.8%; background-position: 100% 0; }
.room-spill-bl { right: 99.8%; top: 99.8%; background-position: 0 100%; background-size: 18000% 2272.727%; }
.room-spill-br { left: 99.8%; top: 99.8%; background-position: 100% 100%; }
.living-room.is-cozy-dim .room-spill {
  -webkit-filter: brightness(.3);
  filter: brightness(.3);
}

/* Layer 2: Photorealistic 1950s living room interior (with cut-out window) */
.room-photo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: fill;
  pointer-events: none;
  transform: translateZ(0);
}

/* ---- The log fire ----
   .hearth-fire sits exactly over the burning logs in the room photo (the
   rectangle cropped into assets/hearth-flames.jpg). hearth-bed.png repaints
   the back of the firebox without the photo's frozen flame, and hearth.js
   draws the living fire over it on a canvas (.hearth-gl), setting the
   brightness of .room-firelight from the same flames.
   What follows from .flame down is the stand-in for when that cannot run (no
   WebGL): the photo's own flame (hearth-flame.png) laid back as four
   overlapping upright bands, each stretched, leaned and dimmed from its own
   base on its own rhythm, with two tongues (.flame-lick) breaking away. With
   reduced motion the same flame is shown and stands still. */
.hearth-fire {
  position: absolute;
  left: 79.06%;
  top: 54.44%;
  width: 7.81%;
  height: 16.11%;
  pointer-events: none;
  transform: translateZ(1px);
}
.hearth-bed {
  position: absolute;
  inset: 0;
  background: url("assets/hearth-bed.png") center / 100% 100% no-repeat;
}
.hearth-flames {
  position: absolute;
  inset: 0;
}
/* The living fire (hearth.js). Once it is running the still flame is put away. */
.hearth-gl {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  display: block;
}
.hearth-fire.has-gl .hearth-flames { display: none; }
.flame {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background: url("assets/hearth-flame.png") center / 100% 100% no-repeat;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-size: 100% 100%;
  mask-size: 100% 100%;
  animation-timing-function: ease-in-out;
  animation-iteration-count: infinite;
  will-change: transform, opacity;
}
/* Neighbouring bands overlap, and each is still solid where the next begins to
   fade, so no seam opens between them as they move apart. */
.flame-left {
  transform-origin: 22% 83%;
  -webkit-mask-image: linear-gradient(to right, #000 36%, transparent 44%);
  mask-image: linear-gradient(to right, #000 36%, transparent 44%);
  animation-name: flame-flick-a;
  animation-duration: 1.31s;
}
.flame-mid {
  transform-origin: 45% 76%;
  -webkit-mask-image: linear-gradient(to right, transparent 28%, #000 36%, #000 52%, transparent 60%);
  mask-image: linear-gradient(to right, transparent 28%, #000 36%, #000 52%, transparent 60%);
  animation-name: flame-flick-b;
  animation-duration: 1.73s;
  animation-delay: -.4s;
}
.flame-core {
  transform-origin: 62% 71%;
  -webkit-mask-image: linear-gradient(to right, transparent 44%, #000 52%, #000 72%, transparent 80%);
  mask-image: linear-gradient(to right, transparent 44%, #000 52%, #000 72%, transparent 80%);
  animation-name: flame-flick-c;
  animation-duration: 2.09s;
  animation-delay: -1.1s;
}
.flame-right {
  transform-origin: 80% 84%;
  -webkit-mask-image: linear-gradient(to right, transparent 64%, #000 72%);
  mask-image: linear-gradient(to right, transparent 64%, #000 72%);
  animation-name: flame-flick-d;
  animation-duration: 1.49s;
  animation-delay: -.7s;
}
@keyframes flame-flick-a {
  0%, 100% { transform: skewX(0deg) scale(1, 1); opacity: 1; }
  9% { transform: skewX(-4deg) scale(1.03, 1.16); opacity: .97; }
  21% { transform: skewX(2.5deg) scale(.97, .88); opacity: .86; }
  33% { transform: skewX(5deg) scale(1.02, 1.1); opacity: 1; }
  46% { transform: skewX(-1.5deg) scale(.98, .82); opacity: .84; }
  57% { transform: skewX(-6deg) scale(1.04, 1.22); opacity: 1; }
  69% { transform: skewX(1deg) scale(.99, .94); opacity: .9; }
  81% { transform: skewX(4deg) scale(1.01, 1.12); opacity: 1; }
  91% { transform: skewX(-3deg) scale(.97, .9); opacity: .9; }
}
@keyframes flame-flick-b {
  0%, 100% { transform: skewX(1deg) scale(1, .96); opacity: .93; }
  12% { transform: skewX(4deg) scale(1.02, 1.1); opacity: 1; }
  23% { transform: skewX(-2deg) scale(.98, .9); opacity: .88; }
  37% { transform: skewX(-5deg) scale(1.03, 1.17); opacity: 1; }
  48% { transform: skewX(0deg) scale(1, 1.02); opacity: .95; }
  59% { transform: skewX(3.5deg) scale(.97, .86); opacity: .85; }
  72% { transform: skewX(6deg) scale(1.02, 1.13); opacity: 1; }
  84% { transform: skewX(-3deg) scale(1, 1.05); opacity: .96; }
  93% { transform: skewX(-1deg) scale(.98, .9); opacity: .9; }
}
/* The tall middle flame: slower and steadier than the small ones round it */
@keyframes flame-flick-c {
  0%, 100% { transform: skewX(0deg) scale(1, 1); opacity: 1; }
  10% { transform: skewX(2.5deg) scale(.99, 1.06); opacity: 1; }
  22% { transform: skewX(-1.5deg) scale(1.02, .95); opacity: .92; }
  34% { transform: skewX(-3.5deg) scale(.98, 1.08); opacity: 1; }
  45% { transform: skewX(1deg) scale(1.01, .93); opacity: .9; }
  58% { transform: skewX(3.5deg) scale(.98, 1.05); opacity: 1; }
  70% { transform: skewX(.5deg) scale(1.02, 1.1); opacity: 1; }
  82% { transform: skewX(-2.5deg) scale(1, .96); opacity: .93; }
  92% { transform: skewX(-1deg) scale(.99, 1.03); opacity: .98; }
}
@keyframes flame-flick-d {
  0%, 100% { transform: skewX(-1deg) scale(1, 1.04); opacity: 1; }
  13% { transform: skewX(3deg) scale(.98, .9); opacity: .88; }
  26% { transform: skewX(5.5deg) scale(1.03, 1.14); opacity: 1; }
  38% { transform: skewX(-2deg) scale(1, .97); opacity: .93; }
  51% { transform: skewX(-5deg) scale(1.02, 1.18); opacity: 1; }
  63% { transform: skewX(0deg) scale(.97, .85); opacity: .85; }
  76% { transform: skewX(4deg) scale(1.01, 1.08); opacity: 1; }
  88% { transform: skewX(-3.5deg) scale(.99, .93); opacity: .9; }
}
/* Tongues breaking away: the top of the tall flame, and of the one to its
   left, lifting off, thinning and fading out. */
.flame-lick {
  opacity: 0;
  transform-origin: 62% 70%;
  -webkit-mask-image: radial-gradient(ellipse 13% 36% at 62% 40%, #000 55%, transparent 100%);
  mask-image: radial-gradient(ellipse 13% 36% at 62% 40%, #000 55%, transparent 100%);
  animation-name: flame-lick-rise;
  animation-duration: 2.3s;
  animation-timing-function: ease-out;
}
.flame-lick.is-late {
  transform-origin: 42% 76%;
  -webkit-mask-image: radial-gradient(ellipse 12% 30% at 41% 54%, #000 55%, transparent 100%);
  mask-image: radial-gradient(ellipse 12% 30% at 41% 54%, #000 55%, transparent 100%);
  animation-name: flame-lick-rise-late;
  animation-duration: 3.1s;
  animation-delay: -1.3s;
}
@keyframes flame-lick-rise {
  0% { transform: translate3d(0, 4%, 0) skewX(0deg) scale(.92, .8); opacity: 0; }
  22% { transform: translate3d(-1%, -3%, 0) skewX(-3deg) scale(.95, 1); opacity: .7; }
  55% { transform: translate3d(-2.5%, -11%, 0) skewX(-7deg) scale(.8, 1.12); opacity: .32; }
  80%, 100% { transform: translate3d(-3%, -17%, 0) skewX(-9deg) scale(.6, 1.2); opacity: 0; }
}
@keyframes flame-lick-rise-late {
  0%, 30% { transform: translate3d(0, 3%, 0) skewX(0deg) scale(.94, .82); opacity: 0; }
  48% { transform: translate3d(1%, -4%, 0) skewX(4deg) scale(.95, 1.02); opacity: .65; }
  72% { transform: translate3d(2.5%, -12%, 0) skewX(8deg) scale(.78, 1.14); opacity: .28; }
  90%, 100% { transform: translate3d(3%, -18%, 0) skewX(10deg) scale(.6, 1.2); opacity: 0; }
}
.hearth-sparks {
  position: absolute;
  inset: 0;
}
/* Each spark is a box the size of the hearth, so its rise can be given as a
   share of the hearth's height; the dot is the ::after. A spark is out of
   sight for most of its loop, so one pops only every few seconds. */
.spark {
  position: absolute;
  inset: 0;
  opacity: 0;
  animation: spark-rise var(--spark-dur, 9s) linear var(--spark-delay, 0s) infinite;
}
.spark::after {
  content: "";
  position: absolute;
  left: var(--spark-x, 50%);
  top: 58%;
  width: 2px;
  height: 2px;
  border-radius: 50%;
  background: #ffd9a0;
  box-shadow: 0 0 3px rgba(255, 150, 60, .75);
}
@keyframes spark-rise {
  0% { transform: translate3d(0, 0, 0); opacity: 0; }
  1.5% { opacity: .95; }
  7% { transform: translate3d(var(--spark-mid, 3%), -30%, 0); opacity: .85; }
  14%, 100% { transform: translate3d(var(--spark-dx, 6%), -54%, 0); opacity: 0; }
}

/* Lamp glow, firelight and dimming when the lamp is switched off */
.room-light-floor {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity .35s ease;
  background:
    radial-gradient(ellipse 16% 22% at 5.5% 32%, rgba(255, 214, 140, .55), rgba(255, 180, 90, .16) 52%, transparent 76%),
    radial-gradient(ellipse 22% 28% at 12% 62%, rgba(255, 196, 110, .22), transparent 70%),
    radial-gradient(ellipse 28% 16% at 20% 82%, rgba(255, 186, 100, .16), transparent 72%);
  mix-blend-mode: screen;
}
.room-light-floor.is-on { opacity: 1; }

/* With the lamp off the room falls dark except round the television, the
   hearth and the tree. The street is no darker for it: the veil is masked by
   the room photo, whose window is cut out, so it covers the room and not the
   view through the glass. */
.room-night-veil {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse 52% 62% at 74% 56%, rgba(16, 14, 12, 0) 30%, rgba(14, 10, 8, .5) 72%, rgba(8, 5, 4, .76) 100%);
  -webkit-mask: url("assets/room-xmas-1950s.png") 0 0 / 100% 100% no-repeat;
  mask: url("assets/room-xmas-1950s.png") 0 0 / 100% 100% no-repeat;
  opacity: 0;
  transition: opacity .45s ease;
}
.living-room.is-cozy-dim .room-night-veil { opacity: 1; }

/* The television throws a little cool light on the cabinet and the floor in front of it */
.room-tv-glow {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 12% 9% at 59% 58%, rgba(186, 214, 204, .28), transparent 70%),
    radial-gradient(ellipse 16% 7% at 58% 76%, rgba(160, 186, 176, .14), transparent 74%);
  mix-blend-mode: screen;
}

/* Flickering orange light the fire throws on the bricks, the hearth and the floor */
.room-firelight {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 13% 20% at 82.5% 63%, rgba(255, 150, 60, .2), rgba(255, 120, 40, .07) 55%, transparent 78%),
    radial-gradient(ellipse 26% 14% at 78% 84%, rgba(255, 140, 55, .2), transparent 72%);
  mix-blend-mode: screen;
  animation: firelight-flicker 2.9s linear infinite;
}
/* hearth.js sets the brightness from the height of the flames it is drawing. */
.room-firelight.is-live { animation: none; }
@keyframes firelight-flicker {
  0%, 100% { opacity: .82; }
  9% { opacity: 1; }
  17% { opacity: .76; }
  28% { opacity: .93; }
  36% { opacity: .7; }
  49% { opacity: .98; }
  58% { opacity: .84; }
  66% { opacity: 1; }
  77% { opacity: .74; }
  88% { opacity: .92; }
}

/* A soft glow over each string light on the tree (positions come from
   scene-data.js), fading in and out so the lights twinkle. */
.tree-lights {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.string-light {
  position: absolute;
  left: var(--light-x);
  top: var(--light-y);
  width: var(--light-size, 1.7%);
  height: 0;
  padding-bottom: var(--light-size, 1.7%);
  margin: calc(var(--light-size, 1.7%) / -2) 0 0 calc(var(--light-size, 1.7%) / -2);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(var(--light-rgb), .95) 0%, rgba(var(--light-rgb), .5) 28%, rgba(var(--light-rgb), 0) 70%);
  mix-blend-mode: screen;
  animation: light-twinkle var(--light-dur, 2.6s) ease-in-out var(--light-delay, 0s) infinite;
}
@keyframes light-twinkle {
  0%, 100% { opacity: .08; transform: scale(.7); }
  45%, 60% { opacity: 1; transform: scale(1.1); }
}

/* Golden afternoon dust motes floating in the sunbeam */
.sunbeam-motes {
  position: absolute;
  left: 18%;
  top: 22%;
  width: 66%;
  height: 68%;
  pointer-events: none;
  overflow: hidden;
  transform: translateZ(14px);
}
.mote {
  position: absolute;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 242, 204, .9), rgba(255, 226, 160, 0) 70%);
  animation: mote-float var(--mote-dur, 11s) ease-in-out var(--mote-delay, 0s) infinite;
}
@keyframes mote-float {
  0%, 100% { transform: translate3d(0, 0, 0); opacity: .15; }
  35% { opacity: .65; }
  50% { transform: translate3d(var(--mote-dx, 26px), var(--mote-dy, -18px), 0); opacity: .55; }
  75% { opacity: .25; }
}

/* Layer 3: the picture tube of the living-room television.
   The box is the glass in the room photo (x 674-832, y 303-425 of 1280x720).
   The tube face is opaque - dark grey-green glass, with the phosphor glow, the
   lettering and the scan lines over it - so nothing in the photo's own glass
   shows through, lit or dark. (The photo has a pale reflection of the window
   down the left of its glass, which read as a grey rectangle under the old
   see-through overlay.) Switched off, only the dark glass and its sheen are
   left. */
/* Cut to the tube's opening in the photo, traced by
   tools/build-screen-mask.mjs: its sides bow out, so a rounded rectangle
   left the photo's dark glass showing at the middle of each side. */
.room-tv-screen {
  position: absolute;
  left: 52.344%;
  top: 41.528%;
  width: 12.344%;
  height: 17.917%;
  overflow: hidden;
  -webkit-mask: url("assets/room-tv-screen-mask.png") 0 0 / 100% 100% no-repeat;
  mask: url("assets/room-tv-screen-mask.png") 0 0 / 100% 100% no-repeat;
  pointer-events: none;
  background: radial-gradient(ellipse 72% 68% at 50% 46%, #252c28 0%, #191e1b 56%, #0e110f 100%);
  transform: translateZ(6px);
  transition: filter .28s ease;
}
.living-room:has(.hotspot-tv:hover) .room-tv-screen:not(.is-off),
.living-room:has(.hotspot-tv:focus-visible) .room-tv-screen:not(.is-off) {
  filter: brightness(1.22);
}
.room-crt-glow,
.room-crt-label,
.room-crt-scan {
  transition: opacity .4s ease;
}
.room-tv-screen.is-off .room-crt-glow,
.room-tv-screen.is-off .room-crt-label,
.room-tv-screen.is-off .room-crt-scan {
  opacity: 0;
}
.room-crt-glow {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 74% at 50% 47%, rgba(214, 230, 222, .36) 0%, rgba(150, 178, 168, .2) 46%, rgba(70, 88, 80, .05) 84%, transparent 100%);
  animation: mini-crt-flicker 5.5s ease-in-out infinite;
}
@keyframes mini-crt-flicker {
  0%, 100% { opacity: .88; }
  48% { opacity: 1; }
  52% { opacity: .82; }
  56% { opacity: .96; }
}
/* A running animation would hold the glow's opacity up; stop it so the glow
   can fade out with the rest. */
.room-tv-screen.is-off .room-crt-glow {
  animation: none;
}
.room-crt-scan {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(to bottom, rgba(0, 0, 0, .3) 0 1px, transparent 1px 3px);
  opacity: .7;
}
.room-crt-label {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 6%;
  text-align: center;
  color: rgba(238, 245, 240, .92);
  text-shadow: 0 0 10px rgba(220, 245, 235, .65);
}
.room-crt-brand {
  font-family: var(--script-font);
  font-size: clamp(16px, 2.2vw, 34px);
  line-height: 1.05;
  transform: rotate(-3deg);
}
.room-crt-sub {
  font-family: var(--ui-font);
  font-size: clamp(9px, .85vw, 13px);
  letter-spacing: .18em;
  text-transform: uppercase;
  color: rgba(222, 236, 228, .85);
}
.room-crt-static {
  position: absolute;
  inset: 0;
  opacity: 0;
  background-image:
    repeating-radial-gradient(circle at 30% 40%, rgba(255, 255, 255, .9) 0 1px, rgba(0, 0, 0, .8) 1px 3px);
  background-size: 9px 9px;
  transition: opacity .12s;
}
.room-crt-static.is-burst {
  opacity: .78;
  animation: static-jitter .08s steps(2) infinite;
}
@keyframes static-jitter {
  0% { background-position: 0 0; }
  50% { background-position: 5px 3px; }
  100% { background-position: 2px 7px; }
}
/* The curved glass in front of the tube: darker toward its rim, a soft sheen
   from the lamp high on the left, and the warm floor reflected low down. */
.room-crt-glass {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 58% 30% at 30% 4%, rgba(255, 250, 235, .1), transparent 72%),
    linear-gradient(to top, rgba(128, 80, 40, .14), transparent 24%),
    radial-gradient(ellipse 78% 76% at 50% 50%, transparent 62%, rgba(7, 9, 8, .4) 100%);
}

/* Layer 4: Interactive 3D Hotspots */
.hotspot {
  position: absolute;
  border: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
  transform: translateZ(20px);
  outline: none;
}
.hotspot:focus-visible {
  box-shadow: 0 0 0 3px rgba(255, 240, 190, .9), inset 0 0 24px rgba(255, 240, 190, .25);
  border-radius: 18px;
}

.hotspot-lamp-floor {
  left: 1%;
  top: 20%;
  width: 11%;
  height: 62%;
  border-radius: 20px;
}
.hotspot-antenna {
  left: 53.9%;
  top: 18%;
  width: 14.1%;
  height: 20.2%;
  border-radius: 16px;
}

/* Hero TV Hotspot — soft diegetic phosphor aura on hover (no boxy border) */
.hotspot-tv {
  left: 49.2%;
  top: 38.2%;
  width: 22.3%;
  height: 39.6%;
  border-radius: 28px;
}
.hotspot-tv::before {
  content: "";
  position: absolute;
  inset: -10%;
  border-radius: 50%;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(ellipse 68% 66% at 50% 48%, rgba(255, 236, 185, .24) 0%, rgba(255, 210, 130, .09) 48%, transparent 74%);
  transition: opacity .3s ease;
}
.hotspot-tv:hover::before,
.hotspot-tv:focus-visible::before {
  opacity: 1;
}
/* "Click to play" arrow: sits on the wall left of the set with its tip at the
   cabinet edge, level with the screen. Part of the TV button, so clicking the
   arrow works too. Hidden for good once the TV has been clicked (knows-tv). */
.tv-hint {
  position: absolute;
  right: 97%;
  top: 32.6%;
  width: 69%;
  transform: translateY(-50%);
  transition: opacity .35s ease;
}
.tv-hint-arrow {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
  filter: drop-shadow(0 5px 0 #5a3a14) drop-shadow(0 12px 14px rgba(0, 0, 0, .55));
  animation: tv-hint-nudge 1.5s ease-in-out infinite;
}
.tv-hint-arrow path {
  fill: #ecd096;
  fill: url(#tv-hint-fill);
  stroke: #4a2c0e;
  stroke-width: 4;
  stroke-linejoin: round;
}
.tv-hint-arrow text {
  fill: #2f1b0a;
  font-family: var(--ui-font);
  font-size: 31px;
  font-weight: 700;
}
.hotspot-tv:hover .tv-hint-arrow,
.hotspot-tv:focus-visible .tv-hint-arrow {
  filter: drop-shadow(0 5px 0 #5a3a14) drop-shadow(0 12px 14px rgba(0, 0, 0, .55)) brightness(1.07);
}
body.knows-tv .tv-hint {
  display: none;
}
@keyframes tv-hint-nudge {
  0%, 100% { transform: translateX(-5%); }
  50% { transform: translateX(0); }
}

/* ---------- Close-up TV View (zooms in cleanly from the living room) ---------- */

.room {
  position: fixed;
  inset: 0;
  z-index: 10;
  overflow: hidden;
  /* Wallpaper green above and floorboard brown below, for any strip of
     window the photo does not reach */
  background: linear-gradient(180deg, #3d3c29 0%, #3d3c29 50%, #2e1a0c 50%, #2e1a0c 100%);
  opacity: 0;
  pointer-events: none;
  transform: scale(.58);
  transform-origin: 50% 50%;
  transition: opacity .52s ease, transform .72s cubic-bezier(.22, .85, .28, 1);
}

body.view-tv .room {
  z-index: 25;
  opacity: 1;
  pointer-events: auto;
  transform: scale(1);
}

.back-to-room-btn {
  position: fixed;
  left: 20px;
  top: 18px;
  z-index: 40;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border: 1px solid rgba(246, 226, 166, .55);
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(64, 38, 18, .9), rgba(34, 19, 9, .92));
  color: #f6e7c4;
  font-family: var(--ui-font);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  box-shadow:
    inset 0 1px 0 rgba(255, 240, 200, .35),
    0 8px 22px rgba(0, 0, 0, .55);
  transition: transform .15s ease, filter .15s ease, background .15s ease;
}
.back-to-room-btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.1);
}
.back-to-room-btn:active { transform: translateY(1px); }
.back-to-room-btn:focus-visible { outline: 3px solid #fff3c4; outline-offset: 3px; }
.back-to-room-btn .back-arrow { font-size: 19px; line-height: 1; }

/* Download: an icon matching the Living room button, upper right. The list
   slides out from this edge and covers the set. */
.download-btn {
  position: fixed;
  right: 20px;
  top: 18px;
  z-index: 40;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid rgba(246, 226, 166, .55);
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(64, 38, 18, .9), rgba(34, 19, 9, .92));
  color: #f6e7c4;
  box-shadow:
    inset 0 1px 0 rgba(255, 240, 200, .35),
    0 8px 22px rgba(0, 0, 0, .55);
  transition: transform .15s ease, filter .15s ease;
}
.download-btn svg { width: 22px; height: 22px; display: block; }
.download-btn .download-close { display: none; }
.download-btn.is-open .download-glyph { display: none; }
.download-btn.is-open .download-close { display: block; }
.download-btn:hover { transform: translateY(-1px); filter: brightness(1.1); }
.download-btn:active { transform: translateY(1px); }
.download-btn:focus-visible { outline: 3px solid #fff3c4; outline-offset: 3px; }
.download-btn.is-open { filter: brightness(1.15); }

.download-scrim {
  position: fixed;
  inset: 0;
  z-index: 34;
  border: 0;
  padding: 0;
  background: rgba(12, 7, 4, .28);
}
.download-scrim[hidden] { display: none; }

.download-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 36;
  width: min(440px, 100%);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  visibility: hidden;
  transition: transform .38s cubic-bezier(.22, .85, .28, 1), visibility 0s linear .38s;
  background: linear-gradient(180deg, #3c2616 0%, #24160c 28%, #1a100a 100%);
  color: #f6e7c4;
  box-shadow: -18px 0 48px rgba(0, 0, 0, .5);
  font-family: var(--body-font);
}
.download-drawer.is-open {
  transform: translateX(0);
  visibility: visible;
  transition: transform .38s cubic-bezier(.22, .85, .28, 1), visibility 0s;
}
.download-drawer-head {
  padding: 22px 72px 8px 22px;
}
.download-drawer-head h2 {
  margin: 0;
  font-family: var(--ui-font);
  font-size: 28px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.download-drawer-head p {
  margin: 6px 0 0;
  font-size: 18px;
  line-height: 1.35;
  color: rgba(246, 231, 196, .82);
}
.download-all-row {
  display: flex;
  align-items: center;
  margin: 4px 18px 0;
  border-bottom: 1px solid rgba(246, 226, 166, .22);
}
.download-all {
  flex: 1;
  padding: 12px 10px;
}
.download-fold-all {
  flex: none;
  margin-left: 10px;
  min-height: 40px;
  padding: 6px 14px;
  border: 1px solid rgba(246, 226, 166, .45);
  border-radius: 10px;
  background: rgba(255, 236, 196, .06);
  color: inherit;
  font-family: var(--ui-font);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  cursor: pointer;
}
.download-fold-all[hidden] { display: none; }
.download-fold-all:hover { background: rgba(255, 236, 196, .14); }
.download-fold-all:focus-visible { outline: 3px solid #fff3c4; outline-offset: 2px; }
.download-tree {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 6px 14px 12px;
}
.download-season { margin-top: 8px; }
.download-season-row {
  display: flex;
  align-items: center;
  gap: 4px;
}
.download-season-name {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 48px;
  padding: 8px 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: inherit;
  font-family: var(--ui-font);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  text-align: left;
}
.download-season-name:hover { background: rgba(255, 236, 196, .08); }
.download-season-name:focus-visible { outline: 3px solid #fff3c4; outline-offset: 2px; }
.download-count {
  font-family: var(--body-font);
  font-size: 16px;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
  color: rgba(246, 231, 196, .7);
}
.download-episodes { padding: 0 0 8px 34px; }
.download-season.is-shut .download-episodes { display: none; }
.download-check {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 7px 8px;
  font-size: 20px;
  line-height: 1.3;
  cursor: pointer;
}
.download-check input {
  width: 22px;
  height: 22px;
  margin: 2px 0 0;
  flex: none;
  accent-color: #c99d48;
}
.download-check.is-unavailable { opacity: .45; cursor: default; }
.download-pending {
  font-size: 15px;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: rgba(246, 231, 196, .7);
}
.download-ep-num {
  display: inline-block;
  min-width: 2.2em;
  font-variant-numeric: tabular-nums;
  color: rgba(246, 231, 196, .7);
}
.download-drawer-foot {
  padding: 14px 18px 18px;
  border-top: 1px solid rgba(246, 226, 166, .22);
  background: rgba(0, 0, 0, .18);
}
.download-status {
  margin: 0 0 10px;
  min-height: 1.3em;
  font-size: 17px;
  line-height: 1.35;
  color: rgba(246, 231, 196, .85);
}
.download-go {
  width: 100%;
  min-height: 52px;
  border: 1px solid rgba(246, 226, 166, .55);
  border-radius: 12px;
  background: linear-gradient(180deg, #6a4524, #3a2412);
  color: #fff8ea;
  font-family: var(--ui-font);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.download-go:hover:not(:disabled) { filter: brightness(1.1); }
.download-go:disabled { opacity: .45; }
.download-go:focus-visible { outline: 3px solid #fff3c4; outline-offset: 3px; }

/* Warm lamplight from the left and darkened corners, over the photo */
.lamp-glow {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background:
    radial-gradient(ellipse 34% 62% at 0% 56%, rgba(255, 190, 110, .17), transparent 72%),
    radial-gradient(ellipse 78% 86% at 50% 47%, transparent 58%, rgba(10, 6, 3, .46) 100%);
  animation: lamp-breathe 7s ease-in-out infinite;
}

@keyframes lamp-breathe {
  0%, 100% { opacity: .92; }
  50% { opacity: 1; }
}

.stage {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 1;
  width: 1600px;
  height: 1000px;
  transform-origin: 0 0;
}

/* ---------- Cabinet ----------
   The set is a photograph (assets/tv-console-1950s.jpg, 2048x1152) laid under
   the stage so that the cabinet fills it; the screen, buttons and knobs are
   placed over the matching parts of the photo. In stage pixels: picture-tube
   glass 219-987 x 181-744, lower rail 115-1085 x 826-918, and the plain walnut
   face the knobs are on 1141-1510 x 99-907 (tools/build-console.mjs painted
   the photo's speaker cloth out there, to match the set in the living room). */

.tv-photo {
  position: absolute;
  left: -224px;
  top: -32px;
  width: 2048px;
  height: 1152px;
  max-width: none;
  display: block;
  pointer-events: none;
}
/* More wall and floor either side of the photo, for very wide windows */
.tv-wall {
  position: absolute;
  top: -32px;
  width: 1536px;
  height: 1152px;
  background-size: 256px 1152px;
  background-repeat: repeat-x;
  pointer-events: none;
}
.tv-wall-left {
  left: -1760px;
  background-image: url("assets/tv-wall-left.jpg");
  background-position: right top;
}
.tv-wall-right {
  left: 1824px;
  background-image: url("assets/tv-wall-right.jpg");
  background-position: left top;
}
/* More wallpaper above the photo, for windows taller than the stage: the 76px
   of bare wall above the cabinet in the photo, upside down, so the paper
   carries on upward from the photo's top edge without a seam. */
.tv-wall-top {
  position: absolute;
  left: -224px;
  top: -108px;
  width: 2048px;
  height: 76px;
  background: url("assets/tv-console-1950s.jpg") 0 0 / 2048px 1152px no-repeat;
  transform: scaleY(-1);
  pointer-events: none;
}

.cabinet {
  position: absolute;
  inset: 0;
}

/* The tube's opening in the photo, out to the cream bezel, traced by
   tools/build-screen-mask.mjs; the screen is cut to exactly that shape so
   none of the photo's own glass shows round its edge. */
.mask {
  position: absolute;
  left: 201px;
  top: 165px;
  width: 800px;
  height: 592px;
}

.crt {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  -webkit-mask: url("assets/tv-screen-mask.png") 0 0 / 100% 100% no-repeat;
  mask: url("assets/tv-screen-mask.png") 0 0 / 100% 100% no-repeat;
  background: radial-gradient(ellipse at 50% 45%, #1a201e 0%, #101413 60%, #060807 100%);
}

.crt::before {
  /* The tube's vignette */
  content: "";
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  -webkit-mask: url("assets/tv-screen-mask.png") 0 0 / 100% 100% no-repeat;
  mask: url("assets/tv-screen-mask.png") 0 0 / 100% 100% no-repeat;
  box-shadow: inset 0 0 120px 24px rgba(0, 0, 0, .55);
}
/* An episode on the screen: the picture shows through, under a lighter
   vignette and faint scan lines. */
.crt.is-playing::before { box-shadow: inset 0 0 70px 10px rgba(0, 0, 0, .35); }
.crt.is-playing .scanlines { opacity: .35; }
.crt.is-playing .roll,
.crt.is-playing .snow,
.crt.is-playing .crt-content { display: none; }

/* Laid out at 893x655 and shown at 86%, which is the size of the glass */
.crt-content {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 893px;
  height: 655px;
  margin: -327.5px 0 0 -446.5px;
  z-index: 1;
  padding: 48px 84px 42px;
  color: var(--phosphor);
  /* Phosphor palette is already B&W, keeping alert/error text authentically red */
  filter: contrast(1.05);
  /* Soft glow only: a hard 0 0 2px shadow doubled up with scanlines on
     large headings and looked like overlapping text. */
  text-shadow: 0 0 12px rgba(225, 240, 232, .28);
  transform: scale(.86);
  transform-origin: 50% 50%;
}

.crt.is-warming .crt-content { animation: warm-up .9s cubic-bezier(.2, .7, .2, 1) both; }
.crt.is-off .crt-content { animation: power-off .55s ease-in forwards; }

@keyframes warm-up {
  0% { transform: scale(.86, .0035); filter: brightness(4); opacity: .2; }
  35% { transform: scale(.86, .017); filter: brightness(3); opacity: 1; }
  70% { transform: scale(.86, .877); filter: brightness(1.3); }
  100% { transform: scale(.86, .86); filter: brightness(1) contrast(1.05); }
}

@keyframes power-off {
  0% { transform: scale(.86, .86); filter: brightness(1); }
  55% { transform: scale(.86, .005); filter: brightness(5); }
  100% { transform: scale(0, .0035); filter: brightness(8); opacity: 0; }
}

.scanlines {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  background: repeating-linear-gradient(to bottom, rgba(0, 0, 0, .28) 0 1px, transparent 1px 3px);
  mix-blend-mode: multiply;
}

.roll {
  position: absolute;
  left: 0;
  right: 0;
  height: 160px;
  z-index: 3;
  pointer-events: none;
  background: linear-gradient(to bottom, transparent, rgba(230, 245, 240, .045), transparent);
  animation: roll 9s linear infinite;
}

@keyframes roll {
  from { transform: translateY(-180px); }
  to { transform: translateY(800px); }
}

.glass {
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  border-radius: inherit;
  background:
    radial-gradient(ellipse 70% 40% at 28% 8%, rgba(255, 255, 255, .13), transparent 60%),
    linear-gradient(160deg, rgba(255, 255, 255, .07) 0%, transparent 32%, transparent 78%, rgba(255, 255, 255, .03));
}

.static {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  opacity: 0;
  pointer-events: none;
  image-rendering: pixelated;
  transition: opacity .12s;
}
.static.is-on { opacity: .55; }

.snow {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  overflow: hidden;
}
.snow i {
  position: absolute;
  top: -12px;
  border-radius: 50%;
  background: #fff;
  opacity: .75;
  box-shadow: 0 0 6px rgba(255, 255, 255, .8);
  animation: snowfall linear infinite;
}
@keyframes snowfall {
  to { transform: translate3d(var(--drift, 20px), 700px, 0); }
}

/* ---------- Screen content ---------- */

.tv-page {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.tv-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 30px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
}
.tv-top .dim { color: var(--phosphor-dim); font-weight: 400; letter-spacing: .08em; }

.tv-kicker {
  margin: 4px 0 2px;
  font-size: 22px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--phosphor-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 28px;
}

.channel-page {
  justify-content: center;
  gap: 14px;
}

.channel-eyebrow {
  text-align: center;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: .28em;
  text-transform: uppercase;
  color: var(--phosphor-dim);
  margin: 0;
  flex: none;
}

.channel-readout {
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: 0;
  margin: 0 auto;
  padding: 14px 28px 18px;
  border: 3px solid rgba(238, 243, 238, .45);
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(238, 243, 238, .08), rgba(0, 0, 0, .25)),
    repeating-linear-gradient(0deg, transparent 0 3px, rgba(0, 0, 0, .12) 3px 4px);
  box-shadow: inset 0 0 30px rgba(0, 0, 0, .45), 0 0 24px rgba(220, 240, 230, .12);
  max-width: 100%;
  flex: none;
  overflow: hidden;
}
.channel-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 160px;
  padding: 0 18px;
}
.channel-label {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--phosphor-dim);
}
.channel-num {
  font-family: var(--display-font);
  font-size: 92px;
  line-height: 1;
  font-weight: 400;
  letter-spacing: .02em;
  color: var(--phosphor);
  text-shadow: 0 0 18px rgba(225, 240, 232, .35);
  padding: 4px 0 8px;
}
.channel-sep {
  width: 3px;
  margin: 10px 8px;
  background: linear-gradient(to bottom, transparent, rgba(238, 243, 238, .55), transparent);
}

.tv-title {
  margin: 0;
  font-family: var(--display-font);
  font-size: 40px;
  line-height: 1.35;
  font-weight: 400;
  letter-spacing: .01em;
  text-align: center;
  /* Avoid -webkit-box clamp — Limelight metrics collapsed the box and the
     next line painted on top of the title. */
  display: block;
  overflow: visible;
  text-shadow: 0 0 10px rgba(225, 240, 232, .25);
  flex: none;
  max-width: 100%;
  padding: 4px 8px 0;
}
.tv-title.spaced { margin-top: 0; }

.tv-status {
  margin: 0;
  font-size: 26px;
  letter-spacing: .04em;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  min-height: 40px;
  color: var(--phosphor);
  text-align: center;
  flex: none;
  position: relative;
  z-index: 1;
  padding: 8px 16px;
  border-radius: 12px;
}
.tv-status .muted { color: var(--phosphor-dim); }
.tv-status .is-alert,
.tv-status .is-error {
  color: var(--alert);
  text-shadow: 0 0 10px var(--alert-glow);
}
.tv-status.is-alert-band {
  background: rgba(80, 12, 8, .45);
  box-shadow: inset 0 0 0 1px rgba(255, 107, 90, .35);
}

.tune-hint {
  margin: 8px 0 0;
  font-size: 22px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--phosphor-faint);
  text-align: center;
  flex: none;
}
.tune-hint b { color: var(--phosphor-dim); font-weight: 700; }

.channel-foot {
  margin: 0 !important;
  text-align: center;
  flex: none;
}

.meter {
  flex: 0 0 220px;
  height: 14px;
  border-radius: 7px;
  border: 2px solid var(--phosphor-dim);
  overflow: hidden;
}
.meter > span { display: block; height: 100%; background: var(--phosphor); box-shadow: 0 0 10px rgba(255, 255, 255, .6); }

.tv-actions {
  margin: 0;
  display: flex;
  gap: 22px;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  flex: none;
}

.tv-btn {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  padding: 12px 28px;
  min-height: 64px;
  border-radius: 16px;
  border: 3px solid var(--phosphor);
  background: transparent;
  color: var(--phosphor);
  font-size: 30px;
  font-weight: 700;
  white-space: nowrap;
  text-shadow: none;
  box-shadow: 0 0 16px rgba(220, 240, 230, .25), inset 0 0 12px rgba(220, 240, 230, .12);
  transition: background .15s, color .15s, transform .1s;
}
.tv-btn svg { width: 28px; height: 28px; flex: none; }
.tv-btn.primary { background: var(--phosphor); color: #0d1110; text-shadow: none; }
.tv-btn:hover:not(:disabled) { transform: translateY(-2px); }
.tv-btn.primary:hover:not(:disabled) { background: #fff; }
.tv-btn:not(.primary):hover:not(:disabled) { background: rgba(238, 243, 238, .12); }
.tv-btn:active:not(:disabled) { transform: translateY(1px); }
.tv-btn:disabled { opacity: .35; }
.tv-btn.small { font-size: 24px; min-height: 56px; padding: 10px 22px; border-width: 2px; }
.tv-btn:focus-visible { outline: 3px solid rgba(238, 243, 238, .55); outline-offset: 5px; }

.guide {
  margin-top: 16px;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border-top: 2px solid rgba(238, 243, 238, .35);
  padding-top: 10px;
}
.guide-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 6px;
  scrollbar-width: thin;
  scrollbar-color: rgba(238, 243, 238, .45) transparent;
}
.guide-row {
  display: grid;
  grid-template-columns: 40px 56px 1fr auto;
  align-items: center;
  width: 100%;
  min-height: 52px;
  padding: 6px 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--phosphor-dim);
  font-size: 26px;
  text-align: left;
  text-shadow: none;
}
.guide-row:hover { background: rgba(238, 243, 238, .1); color: var(--phosphor); }
.guide-row.is-current {
  background: rgba(238, 243, 238, .18);
  color: var(--phosphor);
  box-shadow: inset 0 0 0 2px rgba(238, 243, 238, .55);
}
.guide-row.is-offline .name { opacity: .7; }
.guide-row .num { font-weight: 700; }
.guide-row .name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.guide-row .tag {
  font-size: 18px;
  letter-spacing: .08em;
  text-transform: uppercase;
  padding-left: 12px;
  min-width: 7em;
  text-align: right;
  color: var(--phosphor-faint);
}
.guide-row.is-current .tag { color: var(--phosphor); }
.guide-row svg { width: 26px; height: 26px; }
.guide-label {
  font-size: 20px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--phosphor-faint);
  margin: 0 12px 6px;
  flex: none;
}

.check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.check svg { width: 34px; height: 34px; }

.center-page {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 18px;
}
.center-page h1 {
  margin: 0;
  font-family: var(--display-font);
  font-size: 52px;
  line-height: 1.22;
  font-weight: 400;
  text-shadow: 0 0 8px rgba(225, 240, 232, .22);
}
.center-page p {
  margin: 0;
  font-family: var(--body-font);
  font-size: 30px;
  line-height: 1.35;
  color: var(--phosphor-dim);
  max-width: 760px;
}
.center-page .tv-actions { justify-content: center; margin-top: 18px; }
.center-page ol { margin: 0; padding-left: 1.3em; text-align: left; font-size: 30px; line-height: 1.45; color: var(--phosphor); }

.big-label { font-size: 26px; letter-spacing: .16em; text-transform: uppercase; color: var(--phosphor-dim); }

.countdown { font-size: 30px; color: var(--phosphor-dim); }
.countdown b { color: var(--phosphor); font-size: 36px; }

.welcome { gap: 10px; }
.welcome h1 {
  font-family: var(--script-font);
  font-weight: 400;
  font-size: 76px;
  line-height: 1.05;
  letter-spacing: .01em;
}
.welcome .message {
  font-family: var(--body-font);
  font-size: 29px;
  line-height: 1.36;
  color: var(--phosphor);
  white-space: pre-wrap;
  max-width: 800px;
  max-height: 280px;
  overflow: auto;
}
.welcome .signature { font-family: var(--script-font); font-size: 48px; line-height: 1.1; color: var(--phosphor); }
.welcome .tv-actions { margin-top: 10px; }

.warming { font-size: 34px; letter-spacing: .2em; text-transform: uppercase; color: var(--phosphor-dim); }

.surprise-title {
  font-family: var(--display-font);
  font-size: 56px;
  font-weight: 400;
  line-height: 1.22;
  max-width: 800px;
  text-shadow: 0 0 8px rgba(225, 240, 232, .22);
}

.error-page .is-error-label {
  color: var(--alert);
  letter-spacing: .2em;
}
.error-page .is-error-heading {
  color: var(--alert);
  text-shadow: 0 0 14px var(--alert-glow);
}
.error-page .is-error-copy {
  color: #ffb0a6;
}

.ornament { width: 30px; height: 30px; }

/* ---------- Right control panel ---------- */

.panel {
  position: absolute;
  left: 1141px;
  top: 99px;
  width: 369px;
  height: 808px;
  padding: 16px 16px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
}

/* The maker's name, lettered in gilt straight on the wood, as are the other
   markings on this face: the set in the living room has no plate or frame
   round its knobs, so nothing here has one either. */
.nameplate {
  position: relative;
  width: 240px;
  height: 72px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
}
.nameplate span {
  font-family: var(--script-font);
  font-size: 50px;
  color: var(--gilt);
  text-shadow: 0 1px 1px rgba(20, 8, 0, .85), 0 -1px 0 rgba(255, 244, 210, .12);
  transform: rotate(-4deg) translateY(-2px);
}

.knob-block {
  position: relative;
  margin-top: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: none;
  gap: 6px;
}
.knob-label {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: .28em;
  text-transform: uppercase;
  color: var(--gilt);
  text-shadow: 0 1px 1px rgba(20, 8, 0, .85);
  padding: 2px 14px;
}

/* The knob with its markings round it: season numbers or episode ticks,
   printed on the wood. The box only keeps them in a ring about the knob. */
.knob-wrap {
  position: relative;
  width: 236px;
  height: 236px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
}

.dial-numbers {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 5;
}
.dial-ticks {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
}
.dial-numbers .dial-hit {
  pointer-events: auto;
  position: absolute;
  left: 50%;
  top: 50%;
  width: 40px;
  height: 40px;
  margin: -20px 0 0 -20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 50%;
  padding: 0;
  font: inherit;
  font-size: 24px;
  font-weight: 700;
  color: var(--gilt);
  background: transparent;
  text-shadow: 0 1px 1px rgba(20, 8, 0, .9);
  cursor: pointer;
  transition: background .12s, color .12s, transform .1s;
}
.dial-numbers .dial-hit:hover {
  background: rgba(243, 230, 200, .2);
  transform: scale(1.06);
}
/* The chosen season: a small brass stud under its number */
.dial-numbers .dial-hit.is-active {
  background: linear-gradient(180deg, #fff3cf, #dcbb6e 60%, #c49a48);
  color: #3a2410;
  text-shadow: 0 1px 0 rgba(255, 255, 255, .5);
  box-shadow: 0 0 10px rgba(255, 226, 150, .45), 0 2px 3px rgba(0, 0, 0, .6), inset 0 1px 0 #fff8e0;
}
.dial-numbers .dial-hit:focus-visible { outline: 3px solid #fff3c4; outline-offset: 2px; }

/* Tick marks in a ring outside the knob, so grabbing the knob still works */
.tick-hit {
  pointer-events: auto;
  position: absolute;
  left: 50%;
  top: 50%;
  width: 26px;
  height: 28px;
  margin: -110px 0 0 -13px;
  padding: 0;
  border: 0;
  background: transparent;
  transform-origin: 50% 110px;
  cursor: pointer;
}
.tick-hit .tick-mark {
  display: block;
  width: 3px;
  height: 14px;
  margin: 0 auto;
  border-radius: 2px;
  background: rgba(236, 214, 160, .6);
  box-shadow: 0 1px 1px rgba(20, 8, 0, .6);
}
.tick-hit.is-active .tick-mark {
  background: #fff3cf;
  height: 18px;
  width: 4px;
  box-shadow: 0 0 8px #fff3cf;
}
.tick-hit.is-watched .tick-mark { background: #f6e8bd; }
.tick-hit:hover .tick-mark { background: #fff8e0; }
.tick-hit:focus-visible { outline: none; }
.tick-hit:focus-visible .tick-mark { box-shadow: 0 0 0 3px #fff3c4; }

.knob {
  position: relative;
  width: 148px;
  height: 148px;
  border-radius: 50%;
  cursor: grab;
  touch-action: none;
  outline: none;
  z-index: 4;
  filter: drop-shadow(0 10px 9px rgba(0, 0, 0, .7));
}
.knob:active, .knob.is-dragging { cursor: grabbing; }
.knob:focus-visible { box-shadow: 0 0 0 5px #fff3c4; }

/* The photographed knob (assets/tv-knob.png); its brass pointer line points up
   at 0 degrees and the whole face turns. */
/* Photographed brass knob matching the living-room set; the pointer notch
   points up at 0 degrees and the whole face turns. */
.knob-face {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  pointer-events: none;
  background: url("assets/tv-knob.png") center / 100% 100% no-repeat;
  transition: transform .28s cubic-bezier(.3, 1.4, .5, 1);
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, .35));
}
.knob.is-dragging .knob-face { transition: none; }
/* The brass photo already has its own lighting; this only darkens its rim a
   little where it meets the wood. */
.knob::after {
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: 50%;
  pointer-events: none;
  box-shadow: inset 0 0 10px 2px rgba(0, 0, 0, .18);
}

.knob-arrows {
  display: flex;
  gap: 14px;
  margin-top: 4px;
  padding: 8px 10px;
  position: relative;
  z-index: 2;
  flex: none;
}
/* Ivory push-buttons built like the strip buttons: a brass rim round a blank
   photographed face (assets/tv-arrow-btn.png). The chevron is drawn on top
   (an SVG in the button), flat like printed ink. */
.arrow-btn {
  position: relative;
  z-index: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 74px;
  height: 50px;
  border: 0;
  border-radius: 12px;
  padding: 0;
  color: #3a2410;
  background: linear-gradient(180deg, #f3dfa3 0%, #cfa650 32%, #a47a2e 68%, #7c5a1d 100%);
  box-shadow:
    0 0 0 1.5px #2e1c0a,
    0 2px 0 #2a180c,
    0 4px 7px rgba(0, 0, 0, .5);
  transition: transform .08s ease, box-shadow .08s ease, filter .12s ease;
}
.arrow-btn::before {
  content: "";
  position: absolute;
  left: 3px;
  top: 3px;
  right: 3px;
  bottom: 3px;
  z-index: -1;
  border-radius: 10px;
  background: url("assets/tv-arrow-btn.png") center / 100% 100% no-repeat;
  box-shadow: inset 0 0 0 1px rgba(52, 32, 10, .5);
  transition: filter .08s ease;
}
.arrow-chevron {
  display: block;
  width: 26px;
  height: 26px;
}
.arrow-chevron path {
  fill: none;
  stroke: currentColor;
  stroke-width: 3.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.arrow-btn:active:not(:disabled) {
  transform: translateY(2px);
  box-shadow:
    0 0 0 1.5px #2e1c0a,
    0 1px 0 #2a180c,
    0 1px 3px rgba(0, 0, 0, .5);
}
.arrow-btn:active:not(:disabled)::before { filter: brightness(.93); }
.arrow-btn:hover:not(:disabled) { filter: brightness(1.05); }
.arrow-btn:disabled { opacity: .5; }
.arrow-btn:focus-visible { outline: 4px solid #fff3c4; outline-offset: 3px; }

/* ---------- Christmas garland ----------
   A photographed pine swag (assets/garland-xmas.png) laid along the top of the
   cabinet three times, the middle run mirrored, with a twinkling glow over
   each of its lights (positions from scene-data.js). It stays above the
   nameplate, which starts 115px down the stage. */

.garland {
  position: absolute;
  left: 14px;
  top: -18px;
  width: 1572px;
  height: 128px;
  z-index: 10;
  pointer-events: none;
  display: none;
}
.is-festive .garland { display: block; }
.garland-run {
  position: absolute;
  top: 0;
  left: 0;
  width: 36%;
  filter: drop-shadow(0 9px 7px rgba(0, 0, 0, .55));
}
.garland-run.is-middle {
  left: 32%;
  transform: scaleX(-1);
}
.garland-run.is-right {
  left: 64%;
}
.garland-run img {
  display: block;
  width: 100%;
  height: auto;
}
.garland-run .string-light {
  --light-size: 5.2%;
}

/* ---------- Preview-only player stand-in ---------- */

.preview-player {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: #000;
  color: #ddd;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
  font-size: 28px;
  text-align: center;
}
.preview-player button { font-size: 26px; padding: 14px 28px; border-radius: 12px; border: 2px solid #ddd; background: transparent; color: #fff; }

/* ---------- Cloudflare progressive HTML5 player ----------
   An episode plays on the television's screen (.is-in-tv, inside .crt).
   Full screen moves the same player out to fill the page. */

.cloud-player {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: #000;
  display: flex;
  flex-direction: column;
  color: #f4efe6;
  font-family: var(--ui-font);
}
.cloud-player video {
  flex: 1;
  min-height: 0;
  width: 100%;
  background: #000;
  outline: none;
  cursor: pointer;
}
.cloud-player-bar {
  order: -1;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 18px;
  background: linear-gradient(to bottom, #1a120c, #0a0705);
  border-bottom: 1px solid rgba(255, 220, 160, .18);
}
.cloud-player-back {
  font: inherit;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: .06em;
  padding: 9px 16px;
  border-radius: 10px;
  border: 1px solid rgba(255, 220, 160, .35);
  background: #3a2410;
  color: #fff8e8;
  cursor: pointer;
}
.cloud-player-back:hover { filter: brightness(1.12); }
.cloud-player-title {
  flex: 1;
  font-size: 19px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cloud-player-controls {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 18px;
  background: linear-gradient(to top, #1a120c, #0a0705);
  border-top: 1px solid rgba(255, 220, 160, .18);
}
.cloud-player-btn {
  flex: none;
  width: 46px;
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid rgba(255, 220, 160, .35);
  border-radius: 50%;
  background: #3a2410;
  color: #fff8e8;
  cursor: pointer;
}
.cloud-player-btn svg { width: 24px; height: 24px; }
.cloud-player-btn:hover { filter: brightness(1.12); }
.cloud-player-btn .icon-play,
.cloud-player.is-paused .cloud-player-btn .icon-pause { display: none; }
.cloud-player.is-paused .cloud-player-btn .icon-play { display: block; }
.cloud-player-time {
  flex: none;
  min-width: 4.2em;
  font-size: 17px;
  font-variant-numeric: tabular-nums;
  text-align: center;
}
.cloud-player-seek {
  flex: 1;
  min-width: 0;
  accent-color: #e2c88a;
  cursor: pointer;
}
.cloud-player [data-cloud="to-tv"] { display: none; }
body.is-cloud-overlay .cloud-player [data-cloud="to-tv"] { display: inline-block; }
body.is-cloud-overlay .cloud-player [data-cloud="full"] { display: none; }

/* On the television: the picture fills the glass, and the controls float in
   from the edges, clear of the tube's corners, until she stops moving the
   mouse. Sizes are in stage pixels (the stage is scaled to the window). */
.cloud-player.is-in-tv {
  position: absolute;
  z-index: 2;
  display: block;
  background: #000;
}
.cloud-player.is-in-tv video {
  position: absolute;
  inset: 0;
  height: 100%;
  object-fit: cover;
  filter: contrast(1.04) brightness(1.02);
}
.cloud-player.is-in-tv .cloud-player-bar,
.cloud-player.is-in-tv .cloud-player-controls {
  position: absolute;
  left: 14%;
  right: 14%;
  z-index: 6;
  border: 0;
  border-radius: 18px;
  padding: 12px 18px;
  background: rgba(10, 7, 5, .72);
  opacity: 0;
  transition: opacity .35s ease;
}
.cloud-player.is-in-tv .cloud-player-bar { top: 9%; }
.cloud-player.is-in-tv .cloud-player-controls { bottom: 9%; }
.cloud-player.is-in-tv.is-awake .cloud-player-bar,
.cloud-player.is-in-tv.is-awake .cloud-player-controls { opacity: 1; }
.cloud-player.is-in-tv .cloud-player-back { font-size: 24px; padding: 10px 20px; }
.cloud-player.is-in-tv .cloud-player-title { font-size: 24px; }
.cloud-player.is-in-tv .cloud-player-btn { width: 60px; height: 60px; }
.cloud-player.is-in-tv .cloud-player-btn svg { width: 30px; height: 30px; }
.cloud-player.is-in-tv .cloud-player-time { font-size: 22px; }
.cloud-player.is-in-tv .cloud-player-seek { height: 26px; }

.cloud-player-off {
  align-items: center;
  justify-content: center;
  font-size: 28px;
  text-align: center;
  padding: 40px;
}
body.is-cloud-overlay .room,
body.is-cloud-overlay .living-room { visibility: hidden; }

@media (prefers-reduced-motion: reduce) {
  .roll, .snow i, .lamp-glow,
  .bird, .bird svg, .bird .wing-l, .bird .wing-r,
  .street-mover, .vintage-car-body, .passerby-strip, .passerby-rows, .mote, .room-crt-glow, .tv-hint-arrow,
  .hearth-flames .flame, .spark, .room-firelight, .string-light, .glass-tree,
  .outside-snow i, .outside-snow b, .hearth-dog-frame { animation: none; }
  .cocoa-steam i { animation: none; opacity: .35; transform: translate3d(0, -30%, 0) scale(.8, .9); }
  .string-light { opacity: .85; }
  /* The fire stands still as it does in the photograph. */
  .hearth-flames .flame-lick { opacity: 0; }
  .crt.is-warming .crt-content { animation: none; }
  .room-camera, .room, .living-room, .download-drawer { transition-duration: .05s; }
}
