/* zane & ezra: a cozy room with a shelf of tapes, a VCR and a CRT.
   The whole room is one fixed-size "stage" (1600x900, or 640x1400 on phones) that app.js scales and
   pans like a camera. Everything inside it is laid out in stage pixels. */

:root {
  --ink: #26202b;
  --paper: #f5ebd3;
  --S: 1; /* current stage scale, set by app.js; the TV screen counter-scales by it */
  --woodgrain: repeating-linear-gradient(91deg, rgba(0, 0, 0, .07) 0 2px, transparent 2px 9px, rgba(255, 255, 255, .035) 9px 11px, transparent 11px 23px);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: clip; background: #21161b; }
body {
  font-family: 'Caveat', 'Segoe Print', 'Comic Sans MS', cursive;
  color: var(--paper);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
button { font: inherit; color: inherit; cursor: pointer; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.booting *, .booting *::before, .booting *::after { transition: none !important; }

/* clip, not hidden: a hidden box can still be scrolled by focus/scrollIntoView, which would knock the camera math off */
.viewport { position: fixed; inset: 0; overflow: clip; }
.viewport::after {
  content: ''; position: absolute; inset: 0; z-index: 50; pointer-events: none;
  background: radial-gradient(ellipse 75% 70% at 50% 46%, transparent 55%, rgba(10, 5, 8, .6) 100%);
}

/* ---------- stage + camera ---------- */
.stage {
  position: absolute; left: 0; top: 0; width: 1600px; height: 900px;
  transform-origin: 0 0;
  transition: transform .9s cubic-bezier(.62, 0, .22, 1);
  --floor: 760px; --lamp-x: 170px; --lamp-y: 120px; --neon-x: 1220px;
  opacity: 0;
}
.stage.ready { opacity: 1; transition: transform .9s cubic-bezier(.62, 0, .22, 1), opacity .5s; }
.stage.no-anim { transition: none !important; }
.is-portrait .stage { width: 640px; height: 1450px; --floor: 1370px; --lamp-x: 120px; --lamp-y: 750px; --neon-x: 320px; }

/* ---------- walls + floor (extend far past the stage so panning never shows an edge) ---------- */
.room-bg { position: absolute; left: -3000px; top: -3000px; width: calc(100% + 6000px); height: calc(100% + 6000px); pointer-events: none; }
.wall {
  position: absolute; left: 0; right: 0; top: 0; height: calc(3000px + var(--floor));
  background:
    radial-gradient(circle, rgba(255, 220, 200, .045) 1.2px, transparent 1.8px) 14px 14px / 56px 56px,
    repeating-linear-gradient(90deg, rgba(0, 0, 0, .13) 0 2px, transparent 2px 56px),
    repeating-linear-gradient(90deg, transparent 0 26px, rgba(255, 255, 255, .018) 26px 30px, transparent 30px 56px),
    #2c1e25;
}
.wall-light {
  position: absolute; left: 3000px; top: 3000px; width: calc(100% - 6000px); height: calc(100% - 6000px);
  background:
    radial-gradient(ellipse 640px 560px at var(--lamp-x) var(--lamp-y), rgba(255, 176, 98, .30), rgba(255, 160, 90, .09) 48%, transparent 76%),
    radial-gradient(ellipse 520px 260px at var(--neon-x) 80px, rgba(255, 80, 165, .17), transparent 72%);
}
.floor {
  position: absolute; left: 0; right: 0; top: calc(3000px + var(--floor)); bottom: 0;
  background:
    linear-gradient(rgba(0, 0, 0, .55), transparent 90px),
    repeating-linear-gradient(180deg, transparent 0 30px, rgba(0, 0, 0, .3) 30px 32px),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, .025) 0 3px, transparent 3px 17px),
    linear-gradient(#5b3923, #6e462a);
}
.baseboard {
  position: absolute; left: 0; right: 0; top: calc(3000px + var(--floor) - 20px); height: 20px;
  background: linear-gradient(#6a4429, #4a2d1a); box-shadow: 0 -1px 0 rgba(255, 255, 255, .06), 0 3px 0 rgba(0, 0, 0, .35);
}

.tv-light {
  position: absolute; left: 820px; top: 70px; width: 820px; height: 860px; pointer-events: none;
  background: radial-gradient(ellipse at 50% 42%, rgba(120, 170, 255, .2), transparent 64%);
  mix-blend-mode: screen; opacity: 0; transition: opacity .7s;
}
.is-portrait .tv-light { left: -90px; top: 90px; }
.is-on .tv-light { opacity: 1; animation: tv-flick 2.6s infinite; }
@keyframes tv-flick { 0%, 100% { filter: brightness(1); } 30% { filter: brightness(.82); } 55% { filter: brightness(1.12); } 80% { filter: brightness(.9); } }

/* ---------- fairy lights ---------- */
.fairy { position: absolute; left: 0; top: 0; width: 100%; height: 120px; overflow: visible; pointer-events: none; }
.fairy .wire { fill: none; stroke: #120d0b; stroke-width: 2; }
.fairy .glow { animation: twinkle var(--dur, 3s) ease-in-out var(--delay, 0s) infinite; }
@keyframes twinkle { 50% { opacity: .25; } }

/* ---------- neon sign ---------- */
.neon-wrap { position: absolute; left: 960px; top: 22px; width: 520px; height: 124px; }
.is-portrait .neon-wrap { left: 20px; top: 74px; width: 600px; }
.neon-glow { position: absolute; inset: -30px -40px; background: radial-gradient(closest-side, rgba(255, 70, 160, .2), transparent); }
.neon {
  position: relative; margin: 0; text-align: center; white-space: nowrap;
  font-family: 'Neonderthaw', 'Brush Script MT', cursive; font-weight: 400; font-size: 104px; line-height: 124px;
  color: #fff2f8;
  text-shadow: 0 0 2px #fff, 0 0 6px #ffd0e7, 0 0 14px #ff7cc0, 0 0 28px #ff4fa6, 0 0 56px #ff2f93;
  animation: neon-hum 6s ease-in-out infinite;
}
.is-portrait .neon { font-size: 88px; }
.neon .amp {
  color: #fff7e2;
  text-shadow: 0 0 2px #fff, 0 0 6px #ffe2a8, 0 0 14px #ffb347, 0 0 28px #ff9a1f, 0 0 56px #ff8800;
  animation: amp-flicker 11s steps(1) infinite;
}
@keyframes neon-hum { 50% { opacity: .93; } }
@keyframes amp-flicker { 0%, 100% { opacity: 1; } 61% { opacity: .3; } 61.6% { opacity: 1; } 62.4% { opacity: .45; } 63% { opacity: 1; } }

/* ---------- window (wide layout only) ---------- */
.window { position: absolute; left: 600px; top: 150px; width: 220px; height: 296px; }
.is-portrait .window { display: none; }
.window .rod { position: absolute; left: -52px; right: -52px; top: -16px; height: 7px; border-radius: 4px; background: linear-gradient(#caa56b, #86663a); box-shadow: 0 2px 3px rgba(0, 0, 0, .45); }
.window .rod::before, .window .rod::after { content: ''; position: absolute; top: -3px; width: 13px; height: 13px; border-radius: 50%; background: #b08850; }
.window .rod::before { left: -6px; }
.window .rod::after { right: -6px; }
.pane { position: absolute; inset: 0; border: 12px solid #86603f; border-radius: 4px; overflow: hidden; background: #0e1a33; box-shadow: inset 0 0 0 2px rgba(0, 0, 0, .4), 0 12px 26px rgba(0, 0, 0, .45); }
.sky { position: absolute; inset: 0; background: linear-gradient(#0a1430, #1a2b50 62%, #2d3a5f); }
.moon { position: absolute; right: 26px; top: 26px; width: 32px; height: 32px; border-radius: 50%; background: #f2e8cd; box-shadow: 0 0 24px 8px rgba(242, 232, 205, .3); }
.town {
  position: absolute; left: 0; right: 0; bottom: 0; height: 96px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 90' preserveAspectRatio='none'%3E%3Cpath fill='%23090d1c' d='M0 90V60H14V48H26V64H36V38H56V56H64V46H80V62H90V30H108V54H120V44H136V60H144V40H166V56H180V48H200V90Z'/%3E%3Cg fill='%23ffcf7a'%3E%3Crect x='4' y='66' width='3' height='3'/%3E%3Crect x='18' y='54' width='3' height='3' opacity='.7'/%3E%3Crect x='40' y='44' width='3' height='3'/%3E%3Crect x='48' y='52' width='3' height='3' opacity='.6'/%3E%3Crect x='44' y='62' width='3' height='3'/%3E%3Crect x='68' y='52' width='3' height='3' opacity='.8'/%3E%3Crect x='94' y='36' width='3' height='3'/%3E%3Crect x='100' y='46' width='3' height='3' opacity='.6'/%3E%3Crect x='96' y='58' width='3' height='3'/%3E%3Crect x='124' y='50' width='3' height='3'/%3E%3Crect x='130' y='60' width='3' height='3' opacity='.7'/%3E%3Crect x='148' y='46' width='3' height='3' opacity='.8'/%3E%3Crect x='158' y='56' width='3' height='3'/%3E%3Crect x='186' y='54' width='3' height='3' opacity='.6'/%3E%3Crect x='192' y='64' width='3' height='3'/%3E%3C/g%3E%3C/svg%3E") bottom / 100% 100% no-repeat;
}
.rain { position: absolute; left: -40px; right: -40px; top: -60px; height: calc(100% + 120px); rotate: 9deg; animation: rain .55s linear infinite; }
.rain.r1 { background: repeating-linear-gradient(90deg, rgba(200, 215, 255, .30) 0 1px, transparent 1px 19px); -webkit-mask-image: repeating-linear-gradient(180deg, #000 0 14px, transparent 14px 47px); mask-image: repeating-linear-gradient(180deg, #000 0 14px, transparent 14px 47px); }
.rain.r2 { left: -31px; background: repeating-linear-gradient(90deg, rgba(200, 215, 255, .18) 0 1px, transparent 1px 27px); -webkit-mask-image: repeating-linear-gradient(180deg, transparent 0 22px, #000 22px 31px, transparent 31px 47px); mask-image: repeating-linear-gradient(180deg, transparent 0 22px, #000 22px 31px, transparent 31px 47px); animation-duration: .75s; }
@keyframes rain { from { translate: 0 -47px; } to { translate: 0 0; } }
.drops {
  position: absolute; inset: 0;
  background:
    radial-gradient(circle at 22% 30%, rgba(255, 255, 255, .35) 0 1.5px, rgba(180, 200, 255, .15) 2px 3.5px, transparent 4px),
    radial-gradient(circle at 68% 18%, rgba(255, 255, 255, .3) 0 1px, rgba(180, 200, 255, .12) 1.5px 3px, transparent 3.5px),
    radial-gradient(circle at 40% 64%, rgba(255, 255, 255, .3) 0 1.5px, rgba(180, 200, 255, .12) 2px 4px, transparent 4.5px),
    radial-gradient(circle at 80% 72%, rgba(255, 255, 255, .28) 0 1px, rgba(180, 200, 255, .12) 1.5px 3px, transparent 3.5px),
    radial-gradient(circle at 12% 84%, rgba(255, 255, 255, .25) 0 1px, transparent 3px),
    linear-gradient(115deg, rgba(255, 255, 255, .07), transparent 40%);
}
.mullion-v { position: absolute; left: calc(50% - 4px); top: 0; bottom: 0; width: 8px; background: #86603f; }
.mullion-h { position: absolute; top: calc(48% - 4px); left: 0; right: 0; height: 8px; background: #86603f; }
.sill { position: absolute; left: -16px; right: -16px; bottom: -16px; height: 16px; border-radius: 3px; background: linear-gradient(#a0714b, #75502f); box-shadow: 0 8px 12px rgba(0, 0, 0, .4); }
.curtain {
  position: absolute; top: -12px; height: 340px; width: 66px;
  background:
    linear-gradient(rgba(0, 0, 0, .0) 60%, rgba(0, 0, 0, .25)),
    repeating-linear-gradient(90deg, #b45f39 0 9px, #9d4f2d 9px 15px, #c46c42 15px 24px);
  filter: drop-shadow(4px 8px 8px rgba(0, 0, 0, .4));
}
.curtain.left { left: -40px; clip-path: polygon(0 0, 100% 0, 92% 30%, 52% 60%, 78% 100%, 0 100%); }
.curtain.right { right: -40px; clip-path: polygon(0 0, 100% 0, 100% 100%, 22% 100%, 48% 60%, 8% 30%); }

/* ---------- bookcase ---------- */
.bookcase {
  position: absolute; left: 70px; top: 200px; width: 460px; height: 560px; z-index: 3;
  --sk: 1.25; --stack: 5; --cols: 3; --lk: 1; --long-cap: 9;
}
.is-portrait .bookcase { left: 0; top: 810px; width: 640px; --sk: 1.45; --stack: 4; --cols: 3; --long-cap: 13; }
.case {
  position: absolute; inset: 0; display: grid; grid-template-rows: 16px 150px 14px 150px 14px 1fr 16px; padding: 0 16px;
  border-radius: 4px;
  background: var(--woodgrain), linear-gradient(90deg, #6c4127, #87552f 12%, #7a4b2b 88%, #5f381f);
  box-shadow: 0 22px 34px rgba(0, 0, 0, .5), inset 0 0 0 1px rgba(0, 0, 0, .35), inset 0 1px 0 rgba(255, 255, 255, .1);
}
.is-portrait .case { border-radius: 0 0 6px 6px; }
.board { background: var(--woodgrain), linear-gradient(#9a6539, #7a4a2a 60%, #5a341d); margin: 0 -16px; box-shadow: 0 2px 0 rgba(0, 0, 0, .3); position: relative; z-index: 1; }
.board.top { border-radius: 4px 4px 0 0; }
.is-portrait .board.top { border-radius: 0; }
.board.bottom { border-radius: 0 0 4px 4px; }
.cubby {
  position: relative; display: flex; align-items: flex-end; justify-content: space-evenly; padding: 0 4px;
  background: linear-gradient(#2a180e, #3b2416);
  box-shadow: inset 0 14px 18px rgba(0, 0, 0, .6), inset 10px 0 14px -6px rgba(0, 0, 0, .5), inset -10px 0 14px -6px rgba(0, 0, 0, .5);
}
.stack { display: flex; flex-direction: column; align-items: center; width: calc(92px * var(--sk)); flex: none; }
.cubby-long { justify-content: space-between; padding: 0 10px; }
.long-row { display: flex; align-items: flex-end; gap: 3px; height: 100%; }
.books { display: flex; align-items: flex-end; gap: 2px; }
.books i {
  display: block; width: 22px; height: var(--h); border-radius: 2px 2px 0 0;
  background: linear-gradient(90deg, rgba(0, 0, 0, .28), transparent 30%, rgba(255, 255, 255, .1) 50%, transparent 70%, rgba(0, 0, 0, .3)), var(--c);
  box-shadow: inset 0 18px 0 -14px rgba(255, 230, 180, .35), inset 0 -18px 0 -14px rgba(255, 230, 180, .35);
}
.books i:nth-child(1) { --h: 150px; --c: #7b3f3a; }
.books i:nth-child(2) { --h: 168px; --c: #3e5f6b; }
.books i:nth-child(3) { --h: 140px; --c: #c39a4b; }
.books i:nth-child(4) { --h: 160px; --c: #56456e; }
.books i.lean { rotate: 9deg; transform-origin: bottom left; margin-left: 10px; }

/* top-of-bookcase decor */
.lamp { position: absolute; left: 44px; top: -124px; width: 120px; height: 124px; }
.lamp-shade { position: absolute; left: 0; top: 0; width: 120px; height: 72px; clip-path: polygon(18% 0, 82% 0, 100% 100%, 0 100%); background: linear-gradient(90deg, #e2b878, #f8e2b4 45%, #dcae70); }
.lamp-shade::after { content: ''; position: absolute; inset: 0; background: repeating-linear-gradient(90deg, transparent 0 7px, rgba(120, 70, 20, .08) 7px 9px); }
.lamp-bulb { position: absolute; left: 22px; top: 58px; width: 76px; height: 26px; border-radius: 50%; background: radial-gradient(#fff8e0, #ffd27f 55%, transparent 72%); filter: blur(3px); }
.lamp-stem { position: absolute; left: 57px; top: 72px; width: 6px; height: 40px; background: linear-gradient(90deg, #7d5f33, #dcbd80, #7d5f33); }
.lamp-base { position: absolute; left: 32px; top: 108px; width: 56px; height: 16px; border-radius: 50% 50% 6px 6px; background: linear-gradient(#c99c5c, #8a6235); }
.plant { position: absolute; left: 352px; top: -110px; width: 80px; height: 110px; }
.plant svg { width: 100%; height: 100%; display: block; filter: drop-shadow(0 4px 4px rgba(0, 0, 0, .35)); }
.is-portrait .lamp, .is-portrait .plant { display: none; }

/* shelf decor that fills empty spots */
.decor { flex: none; width: calc(92px * var(--sk)); display: flex; justify-content: center; align-items: flex-end; pointer-events: none; }
.decor.bookstack { flex-direction: column-reverse; align-items: center; }
.decor.bookstack i { display: block; height: 15px; border-radius: 2px; margin-top: 1px; box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .2), inset 0 3px 0 rgba(255, 255, 255, .12); }
.decor.candle .jar { position: relative; width: 38px; height: 46px; border-radius: 6px 6px 10px 10px; background: linear-gradient(90deg, rgba(255, 255, 255, .14), rgba(255, 255, 255, .04) 40%, rgba(255, 255, 255, .12)); box-shadow: inset 0 -26px 0 #e9dcc4, inset 0 0 0 1px rgba(255, 255, 255, .2); }
.decor.candle .jar::before { content: ''; position: absolute; left: 50%; bottom: 26px; width: 9px; height: 16px; translate: -50% 0; border-radius: 50% 50% 45% 45%; background: radial-gradient(circle at 50% 70%, #fff6c2, #ffb347 60%, transparent 70%); animation: flame 1.6s ease-in-out infinite; transform-origin: 50% 100%; }
.decor.candle .jar::after { content: ''; position: absolute; left: 50%; bottom: 20px; width: 90px; height: 90px; translate: -50% 40%; border-radius: 50%; background: radial-gradient(rgba(255, 180, 90, .28), transparent 65%); pointer-events: none; }
@keyframes flame { 0%, 100% { scale: 1 1; } 30% { scale: .9 1.1; } 60% { scale: 1.05 .92; } }
.decor.frame .pic { width: 64px; height: 78px; border: 7px solid #d9c39a; border-radius: 2px; background: linear-gradient(#f2a76b, #e3708a 55%, #5d4c8a); box-shadow: 0 4px 6px rgba(0, 0, 0, .45); rotate: -4deg; position: relative; }
.decor.frame .pic::after { content: ''; position: absolute; left: 50%; bottom: 14px; width: 20px; height: 20px; translate: -50% 0; border-radius: 50%; background: #ffe9b0; box-shadow: 0 0 10px rgba(255, 233, 176, .7); }

/* the "more tapes" crate */
.crate {
  position: absolute; left: 540px; top: 692px; width: 128px; height: 78px; z-index: 5; padding: 0; border: 0;
  border-radius: 3px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: repeating-linear-gradient(180deg, #a77a4a 0 22px, #5e3c22 22px 25px), #a77a4a;
  box-shadow: 0 10px 16px rgba(0, 0, 0, .45), inset 0 0 0 3px rgba(60, 35, 18, .6);
  color: #2b1d14; font-weight: 700; line-height: .9;
}
.crate[hidden] { display: none; }
.crate::before { content: ''; position: absolute; left: 10px; right: 10px; top: -12px; height: 14px; background: repeating-linear-gradient(90deg, #1b1a1f 0 20px, transparent 20px 24px); border-radius: 2px 2px 0 0; }
.crate-label { font-size: 26px; background: rgba(245, 235, 211, .9); padding: 2px 8px; rotate: -3deg; border-radius: 2px; }
.crate-page { font-size: 20px; margin-top: 4px; color: #f5ebd3; }
.crate:hover .crate-label, .crate:focus-visible .crate-label { rotate: 2deg; }
.is-portrait .crate { left: 496px; top: 1366px; width: 120px; height: 70px; }

/* ---------- tapes on the shelf ---------- */
.tape { position: relative; display: block; flex: none; padding: 0; border: 0; background: none; transition: translate .16s, scale .16s, filter .16s; }
.tape:focus-visible { outline: 2px dashed #ffd38a; outline-offset: 3px; }
.tape.mini { width: calc(92px * var(--sk)); height: calc(23px * var(--sk)); --t: calc(23px * var(--sk)); margin-left: var(--nudge, 0px); rotate: var(--tilt, 0deg); }
.tape.mini:hover, .tape.mini:focus-visible, .tape.mini.sel { scale: 1.07; translate: 0 -2px; filter: brightness(1.18); z-index: 2; }
.tape.big { width: calc(25px * var(--lk)); height: calc(187px * var(--lk)); --t: calc(25px * var(--lk)); }
.tape.big .spine { inset: auto; left: 50%; top: 50%; width: calc(187px * var(--lk)); height: calc(25px * var(--lk)); translate: -50% -50%; rotate: -90deg; }
.tape.big:hover, .tape.big:focus-visible, .tape.big.sel { translate: 0 -8px; filter: brightness(1.18); }
.tape.gone { visibility: hidden; }
.tape.empty .lbl b { color: #7d6f74; }

/* a tape spine (used on the shelf AND on the front face of the flying cassette) */
.spine {
  position: absolute; inset: 0; border-radius: 2px;
  background: linear-gradient(#2c2b31, #141317 60%, #1c1b20);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .09), 0 1px 0 rgba(0, 0, 0, .6);
}
.lbl {
  position: absolute; left: 6%; right: 6%; top: 17%; bottom: 17%; border-radius: 1px; overflow: hidden;
  display: flex; align-items: center; padding: 0 5% 0 9%;
  background: linear-gradient(rgba(255, 255, 255, .25), transparent), var(--paper);
}
.lbl::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 5.5%; background: var(--accent, #d9774a); }
.lbl b {
  display: block; width: 100%; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
  font-family: 'Permanent Marker', 'Comic Sans MS', cursive; font-weight: 400; font-size: calc(var(--t) * .37); line-height: 1.25; letter-spacing: -.01em;
  color: var(--ink); rotate: -1deg;
}

/* ---------- flying cassette (3D) ---------- */
.fly { position: absolute; inset: 0; pointer-events: none; z-index: 30; perspective: 2200px; perspective-origin: var(--po-x, 50%) var(--po-y, 50%); }
/* no filter/opacity on .cas itself: either one would flatten the 3D faces */
.cas { position: absolute; left: 0; top: 0; width: var(--W); height: var(--T); transform-style: preserve-3d; will-change: transform; }
.cas .f { position: absolute; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.cas .front { inset: 0; transform: translateZ(calc(var(--D) / 2)); }
.cas .back { inset: 0; transform: rotateY(180deg) translateZ(calc(var(--D) / 2)); }
.cas .top, .cas .bottom { left: 0; width: var(--W); height: var(--D); top: calc((var(--T) - var(--D)) / 2); }
.cas .top { transform: rotateX(90deg) translateZ(calc(var(--T) / 2)); }
.cas .bottom { transform: rotateX(-90deg) translateZ(calc(var(--T) / 2)); }
.cas .end { top: 0; height: var(--T); width: var(--D); left: calc((var(--W) - var(--D)) / 2); }
.cas .end.l { transform: rotateY(-90deg) translateZ(calc(var(--W) / 2)); }
.cas .end.r { transform: rotateY(90deg) translateZ(calc(var(--W) / 2)); }
.cas .back, .cas .bottom, .cas .end { background: linear-gradient(#1e1d22, #111014); border-radius: 3px; }
.cas .top { border-radius: 5px; overflow: hidden; background: linear-gradient(170deg, #2d2c33, #19181d 55%, #141317); box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .05); }
.cas .win { position: absolute; left: 22%; right: 22%; top: 9%; height: 46%; border-radius: 8px; overflow: hidden; background: linear-gradient(#3e3533, #241e1d); box-shadow: inset 0 0 0 3px #0c0b0e, inset 0 3px 10px rgba(0, 0, 0, .85); }
.cas .win::after { content: ''; position: absolute; inset: 0; background: linear-gradient(120deg, rgba(255, 255, 255, .18), transparent 35%, transparent 70%, rgba(255, 255, 255, .06)); }
.cas .pack { position: absolute; top: 50%; aspect-ratio: 1; translate: -50% -50%; border-radius: 50%; background: radial-gradient(circle, #5a4132 0 30%, #2f211a 31%, #4a3328 60%, #2a1d17 100%); }
.cas .pack.l { left: 27%; width: 78%; }
.cas .pack.r { left: 73%; width: 46%; }
.cas .hub { position: absolute; left: 50%; top: 50%; width: 30px; height: 30px; translate: -50% -50%; border-radius: 50%; background: radial-gradient(circle, #1a1a1a 0 18%, transparent 20%), conic-gradient(#e9e6e0 0 14deg, transparent 14deg 60deg, #e9e6e0 60deg 74deg, transparent 74deg 120deg, #e9e6e0 120deg 134deg, transparent 134deg 180deg, #e9e6e0 180deg 194deg, transparent 194deg 240deg, #e9e6e0 240deg 254deg, transparent 254deg 300deg, #e9e6e0 300deg 314deg, transparent 314deg); box-shadow: 0 0 0 4px #d8d4cc; }
.cas.mini .hub { width: 18px; height: 18px; box-shadow: 0 0 0 3px #d8d4cc; }
.cas.spinning .hub { animation: spin 1.1s linear infinite; }
@keyframes spin { to { rotate: 360deg; } }
.cas .tlabel {
  position: absolute; left: 7%; right: 7%; bottom: 7%; height: 32%; border-radius: 2px; overflow: hidden;
  display: flex; align-items: center; padding: 0 4% 0 8%;
  background: linear-gradient(rgba(255, 255, 255, .3), transparent), var(--paper);
  font-family: 'Permanent Marker', cursive; color: var(--ink); line-height: 1.12;
  font-size: calc(var(--D) * .095);
}
.cas .tlabel span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cas.mini .tlabel { font-size: calc(var(--D) * .11); }
.cas .tlabel::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4.5%; background: var(--accent, #d9774a); }

/* ---------- TV ---------- */
.tv {
  position: absolute; left: 930px; top: 150px; width: 580px; height: 470px; z-index: 5; border-radius: 28px;
  background: var(--woodgrain), linear-gradient(160deg, #905c36, #6e432a 55%, #5a3621);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, .14), inset 0 -8px 14px rgba(0, 0, 0, .35), 0 26px 44px rgba(0, 0, 0, .55), 0 0 0 2px #3a2314;
}
.is-portrait .tv { left: 30px; top: 200px; }
.tv-bezel { position: absolute; left: 16px; top: 18px; width: 480px; height: 366px; border-radius: 32px; background: linear-gradient(#27221f, #141210); box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .05), inset 0 6px 14px rgba(0, 0, 0, .75); }
.tv-panel { position: absolute; left: 508px; top: 26px; width: 56px; height: 352px; border-radius: 10px; background: linear-gradient(#2a2420, #1b1714); box-shadow: inset 0 2px 6px rgba(0, 0, 0, .6); }
.knob { position: absolute; left: 8px; top: 14px; width: 40px; height: 40px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #e0cfae, #8c7757 58%, #4a3c2b); box-shadow: 0 3px 6px rgba(0, 0, 0, .6); }
.knob::after { content: ''; position: absolute; left: calc(50% - 1.5px); top: 4px; width: 3px; height: 13px; border-radius: 2px; background: #3b2f22; }
.knob.small { left: 13px; top: 70px; width: 30px; height: 30px; rotate: 50deg; }
.knob.small::after { height: 9px; }
.grille { position: absolute; left: 10px; right: 10px; top: 120px; bottom: 16px; border-radius: 6px; background: repeating-linear-gradient(0deg, #0e0c0b 0 3px, #312a26 3px 6px); }
.tv-foot { position: absolute; left: 16px; right: 16px; top: 396px; height: 54px; border-radius: 12px; display: flex; align-items: center; justify-content: space-between; padding: 0 26px; background: linear-gradient(#2a2420, #1a1613); }
.tv-brand { font-family: Georgia, 'Times New Roman', serif; font-size: 15px; letter-spacing: .32em; text-transform: uppercase; color: #cdb58b; opacity: .8; }
.tv-led { width: 9px; height: 9px; border-radius: 50%; background: #3a1a14; box-shadow: inset 0 1px 1px rgba(0, 0, 0, .6); transition: background .3s, box-shadow .3s; }
.is-on .tv-led { background: #ff5a3c; box-shadow: 0 0 8px 2px rgba(255, 90, 60, .7); }

/* the sticky note on the TV */
.about-note {
  position: absolute; left: 866px; top: 290px; width: 106px; height: 102px; z-index: 8; rotate: -8deg;
  padding: 26px 6px 6px; border: 0; border-radius: 2px;
  background: linear-gradient(#ffe2ec, #ffd1df); color: #5c2a3e;
  font-weight: 700; font-size: 28px; line-height: .95; text-align: center;
  box-shadow: 0 9px 14px rgba(0, 0, 0, .42), inset 0 -12px 18px rgba(120, 40, 70, .06);
  transition: rotate .2s, translate .2s, box-shadow .2s;
}
.about-note:hover, .about-note:focus-visible { rotate: -3deg; translate: 0 -5px; box-shadow: 0 16px 22px rgba(0, 0, 0, .45); outline: none; }
.about-note:focus-visible { box-shadow: 0 0 0 3px #ffd38a, 0 16px 22px rgba(0, 0, 0, .45); }
.about-note .washi { position: absolute; left: 25px; top: -11px; width: 58px; height: 22px; rotate: 5deg; background: rgba(110, 196, 186, .72); clip-path: polygon(3% 0, 97% 4%, 100% 50%, 96% 100%, 2% 96%, 0 50%); }
.about-note .heart { display: block; width: 20px; height: 18px; margin: 5px auto 0; color: #d6557f; }
.is-portrait .about-note { left: -4px; top: 324px; width: 98px; height: 94px; font-size: 26px; padding-top: 24px; }

/* ---------- the screen (lives on the stage, sits over the TV's glass) ---------- */
.screen {
  position: absolute; left: 958px; top: 182px; width: 456px; height: 342px; z-index: 6; overflow: hidden;
  border-radius: 30px / 26px; background: #0d1210;
  --ease: cubic-bezier(.6, 0, .2, 1);
  /* z-index waits out the shrink, so leaving big screen doesn't slide it under the sticky note */
  transition: left .5s var(--ease), top .5s var(--ease), width .5s var(--ease), height .5s var(--ease), border-radius .5s, z-index 0s .5s;
}
.is-big .screen { transition: left .5s var(--ease), top .5s var(--ease), width .5s var(--ease), height .5s var(--ease), border-radius .5s, z-index 0s; }
.is-portrait .screen { left: 58px; top: 232px; }
.screen-inner {
  position: absolute; left: 0; top: 0; width: calc(100% * var(--S)); height: calc(100% * var(--S));
  transform: scale(calc(1 / var(--S))); transform-origin: 0 0; container-type: size;
}
.crt { position: absolute; inset: 0; background: #000; overflow: hidden; transform-origin: 50% 50%; }
.screen[data-show="off"] .crt { visibility: hidden; }
.screen-fill { position: absolute; left: -10%; top: -10%; width: 120%; height: 120%; object-fit: cover; filter: blur(22px) brightness(.5) saturate(1.3); display: none; }
.screen.short .screen-fill[src] { display: block; }
.player-box { position: absolute; left: 50%; top: 50%; translate: -50% -50%; opacity: 0; transition: opacity .25s; }
.screen.short .player-box { height: 100%; aspect-ratio: 9 / 16; }
.screen.long .player-box { width: 100%; aspect-ratio: 16 / 9; }
.screen[data-show="video"] .player-box { opacity: 1; }
.player-box iframe, #player { display: block; width: 100%; height: 100%; border: 0; }
.static { position: absolute; inset: 0; width: 100%; height: 100%; image-rendering: pixelated; opacity: 0; pointer-events: none; }
.screen.staticky .static { opacity: .92; }
.osd {
  position: absolute; left: 6cqw; top: 6cqh; z-index: 3; pointer-events: none; opacity: 0; transition: opacity .15s;
  font-family: 'VT323', monospace; font-size: max(15px, 8cqh); line-height: 1; letter-spacing: .04em; color: #fff;
  text-shadow: 2px 2px 0 rgba(0, 0, 0, .6), 0 0 6px rgba(255, 255, 255, .45);
}
.osd.show { opacity: 1; }
.blue {
  position: absolute; inset: 0; display: none; flex-direction: column; align-items: flex-start; justify-content: center; gap: 1.6cqh;
  padding: 8cqh 8cqw; color: #fff; background: radial-gradient(ellipse at 50% 40%, #2b44d6, #1f30b0);
  font-family: 'VT323', monospace; font-size: max(15px, 6.4cqh); line-height: 1.12; text-shadow: 2px 2px 0 rgba(0, 0, 50, .5);
}
.screen[data-show="blue"] .blue { display: flex; }
.blue p { margin: 0; }
.blue .big { font-size: max(20px, 10cqh); }
.blue a { color: #fff6a6; }
.blue .btns { display: flex; flex-wrap: wrap; gap: 2cqw; margin-top: 1.5cqh; }
.blue button { font: inherit; padding: .05em .6em; border: 2px solid #fff; border-radius: 0; background: transparent; color: #fff; text-shadow: inherit; }
.blue button:hover, .blue button:focus-visible { background: #fff; color: #1f30b0; text-shadow: none; outline: none; }
.scanlines { position: absolute; inset: 0; z-index: 4; pointer-events: none; opacity: .65; background: repeating-linear-gradient(180deg, rgba(0, 0, 0, .28) 0 1px, transparent 1px 3px); }
.screen[data-show="off"] .scanlines { opacity: 0; }
.glass {
  position: absolute; inset: 0; z-index: 5; pointer-events: none;
  background:
    radial-gradient(120% 90% at 28% 12%, rgba(255, 255, 255, .11), transparent 42%),
    radial-gradient(ellipse at 50% 50%, transparent 58%, rgba(0, 0, 0, .55) 100%);
  box-shadow: inset 0 0 28px rgba(0, 0, 0, .85);
}
.screen[data-show="off"] .glass { background: radial-gradient(120% 90% at 28% 12%, rgba(255, 220, 180, .13), transparent 40%), radial-gradient(ellipse at 50% 50%, rgba(40, 60, 50, .25), rgba(0, 0, 0, .6) 100%); }

/* big screen: the same screen element grows to fill the window, so the video never reloads */
.dim { position: absolute; left: -3000px; top: -3000px; right: -3000px; bottom: -3000px; z-index: 40; background: rgba(12, 7, 10, .88); opacity: 0; pointer-events: none; transition: opacity .45s; }
.is-big .dim { opacity: 1; pointer-events: auto; }
.is-big .screen { z-index: 45; border-radius: 16px; }

/* ---------- stand + VCR ---------- */
.stand { position: absolute; left: 900px; top: 620px; width: 640px; height: 140px; z-index: 4; }
.is-portrait .stand { left: 0; top: 670px; }
.stand-top { position: absolute; left: -10px; right: -10px; top: 0; height: 16px; z-index: 1; border-radius: 4px; background: var(--woodgrain), linear-gradient(#a26b3e, #7c4e2d); box-shadow: 0 3px 0 #4a2c19, 0 10px 18px rgba(0, 0, 0, .35); }
.stand-body { position: absolute; left: 0; right: 0; top: 16px; height: 110px; display: flex; background: var(--woodgrain), linear-gradient(#7a4a2b, #60381f); box-shadow: inset 0 -4px 10px rgba(0, 0, 0, .35); }
.is-portrait .stand-body { height: 124px; }
.door { position: relative; flex: 1; margin: 10px 8px; border-radius: 4px; background: var(--woodgrain), linear-gradient(#83512f, #6c4126); box-shadow: inset 0 0 0 2px rgba(0, 0, 0, .25), inset 0 0 0 7px rgba(255, 255, 255, .04), 0 1px 0 rgba(255, 255, 255, .06); }
.door i { position: absolute; top: 50%; width: 10px; height: 10px; margin-top: -5px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #f0d8a0, #9b7a42); box-shadow: 0 2px 3px rgba(0, 0, 0, .5); }
.door.left i { right: 10px; }
.door.right i { left: 10px; }
.nook { position: relative; width: 470px; margin: 8px 0; border-radius: 4px; background: linear-gradient(#1d110a, #2d1a10); box-shadow: inset 0 9px 16px rgba(0, 0, 0, .75); }
.legs { position: absolute; left: 0; right: 0; top: 126px; height: 14px; }
.legs i { position: absolute; top: 0; width: 16px; height: 14px; background: #4a2c19; clip-path: polygon(0 0, 100% 0, 78% 100%, 22% 100%); }
.legs i:first-child { left: 26px; }
.legs i:last-child { right: 26px; }
.is-portrait .legs { display: none; }

.vcr {
  position: absolute; left: 15px; bottom: 6px; width: 440px; height: 80px; border-radius: 5px;
  background: linear-gradient(#47474e, #2d2d33 28%, #232328);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .2), inset 0 -2px 0 rgba(0, 0, 0, .45), 0 4px 8px rgba(0, 0, 0, .5);
}
.is-portrait .vcr { bottom: 14px; }
.vcr-slot { position: absolute; left: 24px; top: 13px; width: 200px; height: 27px; border-radius: 3px; background: #040405; box-shadow: inset 0 2px 5px #000, 0 1px 0 rgba(255, 255, 255, .12); }
.vcr-flap { position: absolute; inset: 3px; border-radius: 2px; background: linear-gradient(#3a3a40, #26262b); box-shadow: inset 0 -1px 0 rgba(255, 255, 255, .07); transition: opacity .3s; }
.vcr.loaded .vcr-flap { opacity: .12; }
.vcr-print { position: absolute; left: 26px; top: 48px; font: 600 9px/1 system-ui, sans-serif; letter-spacing: .2em; text-transform: uppercase; color: #9696a0; }
.vcr-led { position: absolute; left: 26px; top: 63px; width: 6px; height: 6px; border-radius: 50%; background: #1f3a24; transition: background .3s, box-shadow .3s; }
.vcr.loaded .vcr-led { background: #6dff8a; box-shadow: 0 0 6px #6dff8a; }
.vcr-display {
  position: absolute; left: 252px; top: 9px; width: 166px; height: 34px; padding: 0 8px; border-radius: 3px;
  display: flex; align-items: center; justify-content: space-between;
  background: #061110; box-shadow: inset 0 2px 5px #000;
  font-family: 'VT323', monospace; color: #5df2d0; text-shadow: 0 0 6px rgba(93, 242, 208, .75);
}
.vcr-mode { font-size: 18px; }
.vcr-counter { font-size: 21px; opacity: .35; }
.vcr.loaded .vcr-counter { opacity: 1; }
.vcr-buttons { position: absolute; left: 252px; top: 52px; width: 166px; display: flex; gap: 4px; }
.vcr-buttons button {
  flex: 1; height: 19px; padding: 0; border: 0; border-radius: 3px; font-size: 9px; line-height: 19px; letter-spacing: -.1em;
  background: linear-gradient(#5d5d65, #3a3a41); color: #dcdce4; box-shadow: 0 1px 0 rgba(0, 0, 0, .6), inset 0 1px 0 rgba(255, 255, 255, .16);
}
.vcr-buttons button:hover { background: linear-gradient(#6c6c75, #45454d); }
.vcr-buttons button:active { translate: 0 1px; }

/* ---------- rug ---------- */
.rug {
  position: absolute; left: 520px; top: 782px; width: 1040px; height: 100px; border-radius: 50%; z-index: 1;
  background: repeating-radial-gradient(ellipse at center, #7a3832 0 14px, #a5523d 14px 21px, #d8a064 21px 25px, #7a3832 25px 40px);
  box-shadow: 0 6px 10px rgba(0, 0, 0, .35), inset 0 0 30px rgba(0, 0, 0, .35);
}
.is-portrait .rug { left: 26px; top: 1384px; width: 588px; height: 52px; }

/* ---------- hover card (outside the stage, so it stays crisp and readable) ---------- */
.card {
  position: fixed; left: 0; top: 0; z-index: 60; width: min(270px, calc(100vw - 32px)); padding: 12px 16px 14px;
  border-radius: 3px; rotate: -1.5deg; pointer-events: none; color: #2b2430;
  background: repeating-linear-gradient(180deg, transparent 0 25px, rgba(80, 120, 200, .17) 25px 26px) 0 8px, #fbf3df;
  box-shadow: 0 12px 26px rgba(0, 0, 0, .45);
  animation: card-in .14s ease-out;
}
.card[hidden] { display: none; }
.card::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 5px; background: var(--accent, #d9774a); border-radius: 3px 3px 0 0; }
.card-title { margin: 0; font-weight: 700; font-size: 26px; line-height: 1.02; overflow-wrap: anywhere; }
.card-meta { margin: 4px 0 0; font-size: 20px; color: #6e6066; }
.card-play { display: none; margin-top: 10px; padding: 4px 18px; border: 0; border-radius: 999px; background: #2b2430; color: #fbf3df; font-weight: 700; font-size: 22px; }
.card.touch { pointer-events: auto; }
.card.touch .card-play { display: inline-block; }
@keyframes card-in { from { opacity: 0; translate: 0 6px; } }

/* ---------- remote (shows while a tape is in) ---------- */
.remote {
  position: fixed; left: 50%; bottom: max(14px, env(safe-area-inset-bottom)); z-index: 70; translate: -50% 0;
  display: flex; gap: 8px; padding: 8px; border-radius: 22px;
  background: linear-gradient(#2c2931, #1a181d); box-shadow: 0 12px 30px rgba(0, 0, 0, .55), inset 0 1px 0 rgba(255, 255, 255, .09);
  animation: remote-in .4s cubic-bezier(.2, .9, .3, 1.2);
}
.remote[hidden] { display: none; }
.remote button {
  display: flex; align-items: center; gap: 6px; height: 42px; padding: 0 14px; border: 0; border-radius: 14px; white-space: nowrap;
  background: linear-gradient(#3b3741, #2c2932); color: #efe6d6; font: 22px/1 'VT323', monospace; letter-spacing: .03em;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .1), 0 2px 0 #111;
}
.remote button:hover { background: linear-gradient(#48434f, #36323c); }
.remote button:active { translate: 0 1px; }
.remote button:focus-visible { outline: 2px solid #ffd38a; outline-offset: 2px; }
.remote button[aria-pressed="true"] { background: linear-gradient(#6a3c50, #50293a); color: #ffd9e8; }
.remote button[hidden] { display: none; }
@keyframes remote-in { from { translate: -50% 120%; } }
@media (max-width: 440px) {
  .remote { gap: 6px; padding: 6px; }
  .remote button { padding: 0 12px; font-size: 21px; }
  .remote .w2 { display: none; }
}

/* ---------- corner: channel link + sound toggle ---------- */
.corner { position: fixed; top: max(12px, env(safe-area-inset-top)); right: 14px; z-index: 70; display: flex; gap: 8px; align-items: center; }
.yt-link { padding: 4px 12px 5px; border-radius: 999px; background: rgba(20, 12, 16, .6); color: var(--paper); font-weight: 700; font-size: 21px; text-decoration: none; backdrop-filter: blur(4px); }
.yt-link:hover, .yt-link:focus-visible { color: #ffd38a; }
.sound { display: grid; place-items: center; width: 38px; height: 38px; padding: 0; border: 0; border-radius: 50%; background: rgba(20, 12, 16, .6); color: var(--paper); backdrop-filter: blur(4px); }
.sound svg { width: 21px; height: 21px; }
.sound[aria-pressed="false"] .waves, .sound[aria-pressed="true"] .mute { display: none; }
.sound:hover { color: #ffd38a; }
.is-big ~ .corner { opacity: .5; }

/* ---------- about card ---------- */
.about { max-width: min(440px, calc(100vw - 32px)); padding: 0; border: 0; background: transparent; overflow: visible; color: #2b2430; }
.about::backdrop { background: rgba(14, 8, 12, .62); backdrop-filter: blur(3px); }
.about[open] { animation: note-in .38s cubic-bezier(.2, .9, .3, 1.15); }
.paper {
  position: relative; rotate: -2deg; padding: 44px 38px 30px 50px; border-radius: 3px;
  font-size: 29px; line-height: 35px;
  background:
    linear-gradient(90deg, transparent 0 34px, rgba(220, 90, 110, .35) 34px 36px, transparent 36px),
    repeating-linear-gradient(180deg, transparent 0 34px, rgba(80, 120, 200, .2) 34px 35px) 0 9px,
    #fbf3df;
  box-shadow: 0 26px 54px rgba(0, 0, 0, .55);
}
.paper h2 { margin: 0 0 6px; font-size: 40px; line-height: 42px; font-weight: 700; }
.paper p { margin: 0; }
.paper .sign { margin-top: 10px; text-align: right; font-weight: 700; }
.paper .washi { position: absolute; left: 50%; top: -14px; width: 116px; height: 28px; translate: -50% 0; rotate: -3deg; background: rgba(240, 150, 182, .78); clip-path: polygon(2% 0, 98% 6%, 100% 50%, 97% 100%, 1% 94%, 0 50%); }
.about-close { position: absolute; right: 8px; top: 4px; padding: 2px 10px; border: 0; background: none; color: #7a6a70; font-weight: 700; font-size: 38px; line-height: 1; }
.about-close:hover, .about-close:focus-visible { color: #d6557f; outline: none; }
@keyframes note-in { from { opacity: 0; transform: translateY(24px) rotate(-6deg) scale(.9); } }

.noscript { position: fixed; inset: auto 16px 16px; z-index: 99; padding: 12px 16px; border-radius: 8px; background: #fbf3df; color: #2b2430; font-size: 24px; }

@media (prefers-reduced-motion: reduce) {
  .stage, .stage.ready, .screen { transition: none; }
  .neon, .neon .amp, .rain, .fairy .glow, .is-on .tv-light, .decor.candle .jar::before, .cas.spinning .hub { animation: none !important; }
  .about[open], .remote, .card { animation: none; }
}
