/* Holiday TV demo: a vintage Christmas tube TV in a dim living room. Sizes inside the set use cqw of .tv-wrap so the
   whole TV scales as one object down to phone width. */

:root {
  --wall: #2a1914;
  --wall-2: #1c100c;
  --ink: #2b1d16;
  --brass: #c99a55;
  --brass-2: #8a6330;
  --glow: 255 196 120;      /* warm screen spill, rgb triplet; JS updates --glow-a */
  --glow-a: 0;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --wall: #24150f; } }
:root[data-theme="dark"] { --wall: #24150f; }

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--wall-2);
  color: #f3e6cf;
  font-family: var(--font-ui, system-ui, sans-serif);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ---------------------------------------------------------------- the room ---- */
.room {
  position: relative;
  min-height: 100dvh;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  place-items: center;
  padding: 1.5vh 2vw;
  isolation: isolate;
  overflow: clip;
  background:
    /* floor */
    linear-gradient(to bottom, transparent 0 82%, #140b07 82%, #1d110b 84%, #2a1810 100%),
    /* wainscot rail */
    linear-gradient(to bottom, transparent 0 60.5%, rgb(255 210 160 / .06) 60.5% 61%, #160d09 61% 61.6%, transparent 61.6%),
    /* wainscot panels */
    repeating-linear-gradient(90deg, transparent 0 118px, rgb(0 0 0 / .22) 118px 121px, rgb(255 220 180 / .04) 121px 123px) 0 0 / 100% 100%,
    /* damask-ish wallpaper */
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='64' height='92' viewBox='0 0 64 92'%3E%3Cg fill='none' stroke='%23e8b98a' stroke-opacity='.07' stroke-width='1.3'%3E%3Cpath d='M32 6c10 10 14 22 0 40C18 28 22 16 32 6z'/%3E%3Cpath d='M32 46c10 10 14 22 0 40C18 68 22 56 32 46z' transform='translate(32 0)'/%3E%3Cpath d='M32 46c10 10 14 22 0 40C18 68 22 56 32 46z' transform='translate(-32 0)'/%3E%3Ccircle cx='32' cy='46' r='2'/%3E%3C/g%3E%3C/svg%3E"),
    radial-gradient(ellipse 80% 60% at 40% 45%, #3a221a, var(--wall) 60%, var(--wall-2));
}
.room::before {            /* the TV's light spilling onto the wall, tinted by the picture */
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(ellipse 50% 58% at var(--glow-x, 38%) var(--glow-y, 40%), rgb(var(--glow) / calc(var(--glow-a) * .7)), rgb(var(--glow) / calc(var(--glow-a) * .32)) 42%, rgb(var(--glow) / calc(var(--glow-a) * .1)) 66%, transparent 85%);
}
.wall-lights {             /* a soft string of warm bulbs high on the wall */
  position: absolute; left: 0; right: 0; top: 10px; height: 46px; z-index: -1; pointer-events: none; opacity: .75;
  background:
    radial-gradient(circle at 50% 70%, rgb(255 190 110 / .9) 0 2.5px, rgb(255 170 80 / .25) 4px, transparent 13px) 0 0 / 74px 46px,
    radial-gradient(circle at 50% 30%, rgb(255 120 90 / .8) 0 2px, rgb(255 110 80 / .2) 4px, transparent 12px) 37px 0 / 74px 46px;
  -webkit-mask: linear-gradient(to right, transparent, #000 10%, #000 90%, transparent);
          mask: linear-gradient(to right, transparent, #000 10%, #000 90%, transparent);
  animation: wl 5s ease-in-out infinite alternate;
}
@keyframes wl { to { opacity: .5; } }

/* ---------------------------------------------------------------- the TV ---- */
.stage { display: flex; flex-direction: column; align-items: center; min-width: 0; width: 100%; }
/* the TV is the hero: as big as the viewport allows (its box is ~0.77 as tall as wide, antenna and legs included) */
.tv-wrap {
  container-type: inline-size;
  position: relative;
  width: min(100%, calc((100dvh - 3vh) / var(--tv-ratio, .77)));
  min-width: 0;
  padding: 8.5cqw 3.4cqw 5cqw .8cqw;   /* antenna above, legs below, cabinet depth to the right */
}
.tv { position: relative; }

/* the cabinet: a heavy, rounded wooden box; its depth (top and right side) is an extrusion of stacked shadows set in JS */
.body {
  position: relative; z-index: 2;
  display: grid; grid-template-columns: minmax(0, 1fr) 12.5cqw; gap: 1.8cqw; align-items: stretch;
  padding: 2.2cqw 2.2cqw 2.4cqw 2.4cqw;
  border-radius: 5.2cqw / 5.8cqw;
  background:
    radial-gradient(ellipse 80% 45% at 30% 0%, rgb(255 210 160 / .2), transparent 70%),
    radial-gradient(ellipse 60% 60% at 100% 100%, rgb(0 0 0 / .25), transparent 70%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='600' height='400' preserveAspectRatio='none'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.0035 0.11' numOctaves='4' seed='7'/%3E%3CfeColorMatrix values='0 0 0 0 .16 0 0 0 0 .07 0 0 0 0 .02 0 0 0 1.25 -.42'/%3E%3C/filter%3E%3Crect width='600' height='400' filter='url(%23g)'/%3E%3C/svg%3E") 0 0 / 100% 100%,
    repeating-linear-gradient(176deg, rgb(0 0 0 / 0) 0 7px, rgb(60 20 5 / .13) 7px 9px, rgb(0 0 0 / 0) 9px 19px),
    linear-gradient(180deg, #92502a 0%, #713a1b 45%, #552710 100%);
}
.body::after {             /* rounded front bevel catching the light */
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  box-shadow: inset .5cqw .55cqw .2cqw rgb(255 214 170 / .28), inset -.6cqw -.8cqw 1.2cqw rgb(0 0 0 / .45), inset 0 0 0 .2cqw rgb(40 15 5 / .5);
}

/* screen stack: chrome trim ring > thick recessed bezel > dark mask > convex glass */
.housing { position: relative; display: grid; align-items: center; }
.trim {
  padding: .65cqw; border-radius: 4.6cqw / 5.2cqw;
  background: linear-gradient(160deg, #ffffff 0%, #c9c9c9 18%, #7d7d7d 38%, #e9e9e9 55%, #8a8a8a 75%, #d8d8d8 100%);
  box-shadow: 0 .5cqw 1cqw rgb(0 0 0 / .55), 0 0 0 .18cqw #3a2412;
}
.bezel {
  padding: 1.9cqw; border-radius: 4cqw / 4.6cqw;
  background: radial-gradient(ellipse 90% 80% at 40% 30%, #3a2519, #1a0f0a 60%, #0d0705);
  box-shadow:
    inset 0 1cqw 1.6cqw rgb(0 0 0 / .85), inset 0 -.4cqw .6cqw rgb(255 220 180 / .12),
    inset 0 0 4cqw rgb(var(--glow) / calc(var(--glow-a) * .22));
}
.mask {
  padding: 1cqw; border-radius: 3.2cqw / 3.8cqw; background: #050303;
  box-shadow: inset 0 .6cqw 1.4cqw #000, 0 .15cqw 0 rgb(255 220 180 / .08),
    inset 0 0 2.6cqw rgb(var(--glow) / calc(var(--glow-a) * .5));
}
.screen { position: relative; aspect-ratio: 3 / 2; clip-path: url(#crt); background: #0b0f0d; isolation: isolate; }
.screen > * { position: absolute; inset: 0; pointer-events: none; }
.glass-off { background: radial-gradient(ellipse 80% 75% at 42% 38%, #2c3631, #121815 55%, #060807); }
.picture { transform-origin: 50% 50%; transform: scale(0, 0); background: #000; }
.picture canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.glass {                    /* convex glass: a curved specular streak, a soft hot-spot, faint room reflections, rim falloff */
  z-index: 5;
  background:
    radial-gradient(ellipse 46% 24% at 30% 11%, rgb(255 255 255 / .2), rgb(255 255 255 / .05) 55%, transparent 72%),
    radial-gradient(ellipse 120% 70% at 62% -38%, transparent 64%, rgb(255 255 255 / .1) 66.5%, transparent 69.5%),
    linear-gradient(104deg, transparent 63%, rgb(255 222 180 / .035) 65% 71%, transparent 73%),
    radial-gradient(ellipse 14% 6% at 82% 91%, rgb(255 255 255 / .07), transparent 70%),
    radial-gradient(ellipse 72% 70% at 50% 50%, transparent 78%, rgb(0 0 0 / .32) 100%);
}
.dot { z-index: 4; inset: auto; left: 50%; top: 50%; width: 3cqw; height: 3cqw; margin: -1.5cqw; border-radius: 50%; opacity: 0;
  background: radial-gradient(circle, #fff 0 12%, rgb(200 230 255 / .7) 26%, transparent 70%); }

/* power states */
.tv.on .picture { transform: none; }
.tv.turning-on .picture { animation: tv-on .95s cubic-bezier(.2, .7, .2, 1) both; }
.tv.turning-off .picture { animation: tv-off .55s cubic-bezier(.6, 0, .8, .4) both; }
.tv.turning-off .dot { animation: dot 1.6s .45s ease-out both; }
@keyframes tv-on {
  0%   { transform: scale(0, .004); filter: brightness(8) saturate(0); }
  28%  { transform: scale(1, .006); filter: brightness(6) saturate(0); }
  62%  { transform: scale(1, 1.04); filter: brightness(2.2) saturate(.7); }
  80%  { transform: scale(1, .99); filter: brightness(1.3); }
  100% { transform: none; filter: none; }
}
@keyframes tv-off {
  0%   { transform: none; filter: none; }
  55%  { transform: scale(1, .006); filter: brightness(5) saturate(0); }
  100% { transform: scale(0, .004); filter: brightness(9) saturate(0); }
}
@keyframes dot { 0% { opacity: 1; transform: scale(1.4); } 100% { opacity: 0; transform: scale(.3); } }

/* ---- control column: brand plate, channel dial, volume, grille cloth, power ---- */
.side { position: relative; z-index: 1; display: grid; grid-template-rows: auto auto auto 1fr auto; justify-items: center; align-content: start; gap: 1.1cqw; }
.brand { margin-top: 1.6cqw; font-family: var(--font-display); font-style: italic; font-weight: 800; font-size: 1.85cqw; color: #6a1a14; letter-spacing: .01em;
  padding: .25cqw 1.5cqw .35cqw; border-radius: 99px;
  background: linear-gradient(180deg, #ffffff, #d4d4d4 42%, #8f8f8f 52%, #ececec);
  box-shadow: 0 .25cqw .45cqw rgb(0 0 0 / .5), inset 0 0 0 .14cqw #6d6d6d; text-shadow: 0 .08cqw 0 rgb(255 255 255 / .75); }
.dialbtn { all: unset; cursor: pointer; border-radius: 50%; display: block; line-height: 0; }
.dialbtn:hover .dial { filter: drop-shadow(0 .5cqw .6cqw rgb(0 0 0 / .5)) brightness(1.08); }
.dialbtn:active .dial .pointer { transition-duration: .2s; }
.dialbtn:focus-visible { outline: 3px solid var(--c-focus); outline-offset: 3px; }
.dial { width: 11.2cqw; height: 11.2cqw; filter: drop-shadow(0 .5cqw .6cqw rgb(0 0 0 / .5)); overflow: visible; }
.dial .pointer { transition: transform .6s var(--ease-out, cubic-bezier(.2,.7,.2,1)); transform-origin: 50px 50px; }
.knob { position: relative; width: 6.4cqw; aspect-ratio: 1; border-radius: 50%;
  background: radial-gradient(circle at 34% 28%, rgb(255 240 220 / .3), transparent 42%), repeating-conic-gradient(#4a3326 0 5deg, #24170f 5deg 10deg);
  box-shadow: 0 .5cqw .9cqw rgb(0 0 0 / .55), inset 0 0 0 .3cqw #1a0f0a, 0 0 0 .45cqw #b8b8b8, 0 0 0 .6cqw #3a2412; transform: rotate(-35deg); }
.knob i { position: absolute; inset: 22%; border-radius: 50%; background: radial-gradient(circle at 36% 30%, #ffffff, #c8c8c8 45%, #6c6c6c);
  box-shadow: 0 .3cqw .5cqw rgb(0 0 0 / .5); }
.knob i::after { content: ""; position: absolute; left: 50%; top: 8%; width: .6cqw; height: 34%; margin-left: -.3cqw; border-radius: 9px; background: #6a1a14; }
.grille { width: 100%; height: 100%; min-height: 9cqw; border-radius: 1.6cqw;
  background:
    radial-gradient(circle, rgb(246 215 127 / .7) 0 .4px, transparent .9px) 0 0 / 5px 7px,
    radial-gradient(circle, rgb(230 191 98 / .55) 0 .45px, transparent 1px) 2px 3px / 9px 11px,
    radial-gradient(circle, rgb(255 233 168 / .6) 0 .35px, transparent .8px) 4px 1px / 13px 5px,
    repeating-linear-gradient(0deg, rgb(0 0 0 / .2) 0 1px, transparent 1px 3px),
    repeating-linear-gradient(90deg, rgb(255 230 190 / .09) 0 1px, transparent 1px 3px),
    linear-gradient(170deg, #6a4527, #46291a);
  box-shadow: inset 0 0 0 .32cqw #c9a25e, inset 0 0 0 .5cqw #2a170c, inset 0 .9cqw 1.4cqw rgb(0 0 0 / .5), 0 .2cqw 0 rgb(255 220 180 / .15); }
.power { all: unset; cursor: pointer; position: relative; width: 4.4cqw; aspect-ratio: 1; border-radius: 50%; margin-top: 1.4cqw;
  background: radial-gradient(circle at 38% 30%, #ffffff, #c9c9c9 50%, #6f6f6f);
  box-shadow: 0 .45cqw 0 #2a170c, 0 .7cqw 1cqw rgb(0 0 0 / .5); transition: transform .08s, box-shadow .08s; }
.power:active { transform: translateY(.35cqw); box-shadow: 0 .1cqw 0 #2a170c, 0 .3cqw .5cqw rgb(0 0 0 / .5); }
.power:focus-visible { outline: 3px solid var(--c-focus); outline-offset: 3px; }
.power .lamp { position: absolute; left: 50%; top: -2.2cqw; width: 1.4cqw; height: 1.4cqw; margin-left: -.7cqw; border-radius: 50%;
  background: #4a1a12; box-shadow: inset 0 0 .3cqw #000; transition: background .3s, box-shadow .3s; }
.tv.on .power .lamp, .tv.turning-on .power .lamp { background: #ffb347; box-shadow: 0 0 1.2cqw #ff9a2a, 0 0 .4cqw #fff3c4; }

/* ---- rabbit ears: a weighted base sitting on the cabinet top, two telescoping rods with ball tips ---- */
.antenna { position: absolute; z-index: 1; left: 0; right: 0; top: -9.4cqw; height: 9cqw; pointer-events: none; }
.antenna .ant-base { position: absolute; left: calc(50% + 1.2cqw); bottom: 0; width: 12cqw; height: 4.4cqw; margin-left: -6cqw;
  border-radius: 6cqw 6cqw 1cqw 1cqw / 4.4cqw 4.4cqw 1cqw 1cqw;
  background: radial-gradient(ellipse 70% 90% at 40% 20%, #8a8a8a, #2c2c2c 70%); box-shadow: 0 .5cqw .8cqw rgb(0 0 0 / .6), inset 0 -.3cqw .4cqw rgb(0 0 0 / .5); }
.antenna .ant-base::after { content: ""; position: absolute; left: 50%; top: -.8cqw; width: 2.6cqw; height: 1.6cqw; margin-left: -1.3cqw; border-radius: 1cqw 1cqw .3cqw .3cqw;
  background: linear-gradient(90deg, #555, #ddd 45%, #666); }
.antenna .rod { position: absolute; left: calc(50% + 1.2cqw); bottom: 4.2cqw; width: .5cqw; height: 10.5cqw; margin-left: -.27cqw; border-radius: 1cqw;
  background: linear-gradient(90deg, #8d8d8d, #f6f6f6 40%, #7b7b7b); transform-origin: 50% 100%; }
.antenna .rod::before { content: ""; position: absolute; left: -.1cqw; right: -.1cqw; top: 45%; height: 55%; border-radius: 1cqw;
  background: linear-gradient(90deg, #6f6f6f, #e2e2e2 40%, #5f5f5f); }
.antenna .rod::after { content: ""; position: absolute; left: 50%; top: -1.1cqw; width: 1.7cqw; height: 1.7cqw; margin-left: -.85cqw; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff, #cfcfcf 40%, #666); box-shadow: 0 .2cqw .3cqw rgb(0 0 0 / .4); }
.antenna .rod.l { transform: rotate(-32deg); }
.antenna .rod.r { transform: rotate(27deg); height: 9.5cqw; }

/* ---- splayed, tapered legs with brass ferrules ---- */
.legs { position: absolute; z-index: 0; left: 0; right: 0; top: calc(100% - 1cqw); height: 5.5cqw; pointer-events: none; }
.legs i { position: absolute; top: 0; width: 2.2cqw; height: 5.2cqw; transform-origin: 50% 0;
  background: linear-gradient(90deg, #3b1d0c, #74401f 45%, #2f160a); clip-path: polygon(0 0, 100% 0, 72% 100%, 30% 100%); }
.legs i::after { content: ""; position: absolute; left: 25%; bottom: 0; width: 52%; height: 15%; background: linear-gradient(90deg, #8a6330, #f0cf8c 45%, #8a6330); }
.legs .front.l { left: 9cqw; transform: rotate(16deg); }
.legs .front.r { right: 12cqw; transform: rotate(-16deg); }
.legs .back { height: 4cqw; filter: brightness(.55); top: -1.2cqw; }
.legs .back.l { left: 15cqw; transform: rotate(9deg); }
.legs .back.r { right: 6cqw; transform: rotate(-12deg); }
.floor-glow { position: absolute; left: 50%; bottom: 0; width: 130cqw; height: 22cqw; translate: -50% 35%; pointer-events: none; z-index: 0;
  background: radial-gradient(ellipse 50% 50% at 50% 50%, rgb(var(--glow) / calc(var(--glow-a) * .32)), transparent 70%); }

/* ---- Christmas dressing ---- */
.garland { position: absolute; left: -3.5cqw; top: -4.4cqw; width: calc(100% + 7cqw); height: 14cqw; z-index: 4; overflow: visible; }
.garland .bulb { animation: twinkle var(--d, 2.4s) ease-in-out infinite alternate; animation-delay: var(--dl, 0s); }
.garland .bulb-glow { animation: twinkle-g var(--d, 2.4s) ease-in-out infinite alternate; animation-delay: var(--dl, 0s); mix-blend-mode: screen; }
@keyframes twinkle { from { opacity: 1; } to { opacity: .55; } }
@keyframes twinkle-g { from { opacity: .95; } to { opacity: .25; } }
.snow { position: absolute; left: 2.5cqw; top: -2.9cqw; width: calc(100% - 1cqw); height: 5cqw; z-index: 3; overflow: visible; }
.bow { position: absolute; z-index: 5; right: -5.5cqw; top: -6.4cqw; width: 11cqw; transform: rotate(9deg); filter: drop-shadow(0 .6cqw .6cqw rgb(0 0 0 / .45)); }

/* ---- captions: comic speech bubbles with a tail to the speaker's mouth ---- */
.caps { position: absolute; inset: 0; z-index: 3; overflow: hidden; pointer-events: none; }
.bub { position: absolute; left: 0; top: 0; will-change: transform; }
.bub .shape { position: absolute; left: 0; top: 0; overflow: visible; z-index: 0; filter: drop-shadow(.12cqw .22cqw 0 rgb(60 40 25 / .3)); }
.bub .shape path { fill: #fff7ea; stroke: #3a2a22; stroke-width: 1.8; stroke-linejoin: round; }
.bub .txt { position: relative; z-index: 1; width: max-content; max-width: 30cqw; padding: .45em .8em .5em;
  font-family: "Fredoka", "Baloo 2", system-ui, sans-serif; font-weight: 600; font-size: clamp(10px, 1.95cqw, 26px); line-height: 1.16;
  color: #2b1d16; text-wrap: balance; }
.bub .off { visibility: hidden; }
.bub.pop { animation: bub-pop .3s var(--ease-out, cubic-bezier(.2,.7,.2,1)); }
@keyframes bub-pop { from { opacity: 0; scale: .7; } }
.cc { position: absolute; left: 50%; bottom: 7%; translate: -50% 0; width: max-content; max-width: 84%; z-index: 2;
  background: rgb(0 0 0 / .86); color: #fff; padding: .2em .55em .25em;
  font: 600 clamp(9px, 1.9cqw, 24px)/1.32 "IBM Plex Mono", ui-monospace, monospace; text-transform: uppercase; letter-spacing: .02em; text-align: center; }
.cc .off { visibility: hidden; }

/* ---- remote: a slim bar at the bottom of the room; hides itself while the show plays ---- */
.remote {
  position: fixed; z-index: 50; left: 50%; bottom: max(12px, env(safe-area-inset-bottom)); translate: -50% 0;
  transition: opacity .35s, translate .35s;
  display: flex; align-items: center; gap: 10px; width: min(calc(100% - 24px), 720px);
  padding: 10px 14px; border-radius: 999px;
  background: linear-gradient(#2a1d16, #17100c);
  box-shadow: inset 0 1px 0 rgb(255 220 180 / .14), inset 0 0 0 1.5px rgb(201 154 85 / .4), 0 10px 26px -10px #000;
}
.rb { all: unset; cursor: pointer; flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%;
  background: radial-gradient(circle at 38% 30%, #fbf1dc, #d9c39b 60%, #a88a5a); color: #2b1d16;
  box-shadow: 0 3px 0 #0e0805, 0 4px 8px rgb(0 0 0 / .4); transition: transform .08s, box-shadow .08s; }
.rb:active { transform: translateY(2px); box-shadow: 0 1px 0 #0e0805; }
.rb:focus-visible, .scrub input:focus-visible { outline: 3px solid #f2c45a; outline-offset: 3px; }
.rb svg { width: 20px; height: 20px; fill: currentColor; stroke: currentColor; stroke-width: 0; }
.rb.back10 svg path { fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.rb.back10 svg text { font: 700 7.5px var(--font-ui); stroke: none; }
.rb.restart svg path { stroke-width: 2; stroke-linejoin: round; }
.rb.play { width: 50px; height: 50px; background: radial-gradient(circle at 38% 30%, #f07a6c, #b8302c 60%, #7e1716); color: #fff6ea; }
.rb.play svg { width: 24px; height: 24px; }
.rb.play .i-pause, .rb.play.playing .i-play { display: none; }
.rb.play.playing .i-pause { display: block; }
.scrub { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; }
.scrub input { flex: 1; min-width: 60px; -webkit-appearance: none; appearance: none; height: 22px; background: transparent; cursor: pointer; }
.scrub input::-webkit-slider-runnable-track { height: 6px; border-radius: 9px;
  background: linear-gradient(90deg, #c8392f var(--p, 0%), #4a3529 var(--p, 0%)); box-shadow: inset 0 1px 2px #000; }
.scrub input::-moz-range-track { height: 6px; border-radius: 9px; background: #4a3529; }
.scrub input::-moz-range-progress { height: 6px; border-radius: 9px; background: #c8392f; }
.scrub input::-webkit-slider-thumb { -webkit-appearance: none; width: 18px; height: 18px; margin-top: -6px; border-radius: 50%;
  background: radial-gradient(circle at 38% 30%, #fff3d0, #e2b75a 55%, #8a6330); box-shadow: 0 2px 4px #000; }
.scrub input::-moz-range-thumb { width: 18px; height: 18px; border: 0; border-radius: 50%; background: #e2b75a; }
.time { flex: none; font-variant-numeric: tabular-nums; font-size: 14px; color: #f2d9ad; min-width: 7.6ch; text-align: right; }

/* ---- cast panel ---- */
.panel {
  position: fixed; z-index: 60; top: 0; right: 0; height: 100dvh; width: min(360px, 92vw); overflow-y: auto;
  color: var(--c-ink); background: var(--c-card); background-image: var(--tex-paper);
  border-radius: 22px 0 0 22px; padding: 20px 18px 16px;
  box-shadow: -20px 0 50px -20px #000, 0 0 0 1px rgb(255 240 210 / .3);
  transform: translateX(105%); visibility: hidden; transition: transform .35s var(--ease-out), visibility 0s .35s;
}
.panel.open { transform: none; visibility: visible; transition: transform .35s var(--ease-out); }
.panel header { text-align: left; margin-bottom: 12px; }
.kicker { margin: 0; font-size: var(--fs-xs); letter-spacing: .08em; text-transform: uppercase; color: var(--c-ink-2); }
.panel h1 { margin: 2px 0 0; font-family: var(--font-display); font-weight: 800; font-size: 1.9rem; line-height: 1.05; color: var(--c-accent); }
.sub { margin: 4px 0 0; font-family: var(--font-display); font-style: italic; color: var(--c-primary); }
.slots { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; margin: 12px 0 8px; }
.slot { display: grid; justify-items: center; gap: 2px; padding: 6px 2px 4px; border-radius: 10px; border: 1.5px dashed var(--c-line);
  font-size: 12px; color: var(--c-ink-2); min-width: 0; }
.slot b { font-family: var(--font-display); color: var(--c-primary); font-size: 14px; }
.slot.full { border-style: solid; border-color: rgb(156 31 51 / .5); background: rgb(156 31 51 / .05); }
.slot canvas, .slot .blank { width: 32px; height: 32px; border-radius: 50%; background: var(--c-paper-2); }
.slot span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hint { margin: 6px 0 12px; font-size: var(--fs-xs); line-height: 1.4; color: var(--c-ink-2); }
.picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 10px; }
.pgroup { grid-column: 1 / -1; margin: 6px 0 -2px; font: 700 var(--fs-xs) var(--font-ui); letter-spacing: .08em; text-transform: uppercase; color: var(--c-ink-2); }
.pgroup:first-child { margin-top: 0; }
.pick { all: unset; cursor: pointer; position: relative; display: grid; justify-items: center; gap: 4px; padding: 8px 4px 6px; border-radius: 14px;
  background: var(--c-paper); box-shadow: var(--sh-1); transition: transform var(--t-fast), box-shadow var(--t-fast); }
.pick:hover { transform: translateY(-2px); box-shadow: var(--sh-2); }
.pick:focus-visible { outline: 3px solid var(--c-focus); outline-offset: 2px; }
.pick canvas { width: 64px; height: 64px; border-radius: 50%; background: radial-gradient(circle at 50% 40%, #fdf7ea, #e8d6b2); }
.pick .nm { font-family: var(--font-display); font-weight: 600; font-size: 15px; color: var(--c-ink); }
.pick .badge { position: absolute; top: 4px; right: 6px; width: 24px; height: 24px; border-radius: 50%; display: none; place-items: center;
  font: 700 13px var(--font-ui); background: var(--c-accent); color: var(--c-on-accent); box-shadow: 0 2px 4px rgb(0 0 0 / .3); }
.pick.on { box-shadow: 0 0 0 2.5px var(--c-accent), var(--sh-2); }
.pick.on .badge { display: grid; }
.keys { margin: 14px 0 0; font-size: var(--fs-xs); color: var(--c-ink-2); }
kbd { font: 600 11px var(--font-ui); padding: 1px 5px; border-radius: 4px; background: var(--c-paper-2); border: 1px solid var(--c-line); }
.loading { font-size: var(--fs-sm); color: var(--c-ink-2); }

.remote.idle { opacity: 0; translate: -50% 14px; pointer-events: none; }
.rb.cc { font: 700 13px var(--font-ui); letter-spacing: .04em; }

/* ---- cast: a pill with the picked faces opens the drawer ---- */
.castbtn { all: unset; cursor: pointer; position: fixed; z-index: 55; top: 12px; right: 14px; display: flex; align-items: center; gap: 8px;
  padding: 5px 12px 5px 6px; border-radius: 999px; background: rgb(28 18 13 / .78); color: #f6e4c2;
  box-shadow: inset 0 0 0 1.5px rgb(201 154 85 / .45), 0 6px 18px -6px #000; font: 700 14px var(--font-ui); letter-spacing: .02em;
  backdrop-filter: blur(4px); transition: opacity .35s; }
.castbtn:focus-visible { outline: 3px solid #f2c45a; outline-offset: 3px; }
.castbtn .faces { display: flex; }
.castbtn canvas { width: 28px; height: 28px; border-radius: 50%; background: #e8d6b2; box-shadow: 0 0 0 2px #1c120d; }
.castbtn canvas + canvas { margin-left: -8px; }
.castbtn.idle { opacity: .35; }
.panel .close { all: unset; cursor: pointer; position: absolute; top: 12px; right: 14px; width: 32px; height: 32px; border-radius: 50%;
  display: grid; place-items: center; font: 700 20px/1 var(--font-ui); color: var(--c-ink-2); background: var(--c-paper-2); }
.panel .close:focus-visible { outline: 3px solid var(--c-focus); }
.rb.cc[aria-pressed="true"] { background: radial-gradient(circle at 38% 30%, #3a3a3a, #111 70%); color: #fff; }

/* ---- responsive ---- */
@media (max-width: 700px) {
  .room { place-items: center; padding: 52px 6px 92px; }
  .tv-wrap { padding-right: 2.6cqw; }
  .body { grid-template-columns: minmax(0, 1fr) 9cqw; gap: 1.4cqw; padding: 2cqw; }
  .side .knob, .side .grille { display: none; }
  .side { grid-template-rows: auto auto 1fr; }
  .dial { width: 8.6cqw; height: 8.6cqw; }
  .brand { font-size: 1.5cqw; padding: .2cqw .8cqw; }
  .power { width: 4.6cqw; margin-top: auto; }
  .bow { right: -1.5cqw; }
  .panel { top: auto; bottom: 0; left: 0; right: 0; width: 100%; height: auto; max-height: 80dvh; border-radius: 22px 22px 0 0;
    transform: translateY(105%); box-shadow: 0 -20px 50px -20px #000; }
  .remote.idle { opacity: 1; translate: -50% 0; pointer-events: auto; }   /* phones: keep the controls (no hover) */
}
@media (max-width: 520px) {
  .remote { gap: 6px; padding: 8px 10px; }
  .rb { width: 34px; height: 34px; }
  .rb.play { width: 42px; height: 42px; }
  .time { font-size: 12px; min-width: 0; }
  .bub .shape path { stroke-width: 1.4; }
}
@media (prefers-reduced-motion: reduce) {
  .garland .bulb, .garland .bulb-glow, .wall-lights { animation: none; }
}

/* ---- embedded (StorycardTV.mount in a page that is not the demo room): the remote sits under the set ---- */
.sctv { position: relative; min-width: 0; }
.sctv:not(.room .sctv) { display: flex; flex-direction: column; align-items: center; width: 100%; font-family: var(--font-ui, system-ui, sans-serif); color: #f3e6cf; }
.sctv:not(.room .sctv) .remote { position: relative; left: auto; bottom: auto; translate: none; margin: 14px auto 0; }
.sctv:not(.room .sctv) .remote.idle { opacity: 1; translate: none; pointer-events: auto; }
.sctv-nocontrols .remote { display: none; }
.sctv-nocontrols .power, .sctv-nocontrols .dialbtn { pointer-events: none; }
