@charset "utf-8";
/* CSS Document */

:root {
    --body: #cdbb98;
    --body-dark: #a8966f;
    --wood: #6b4528;
    --wood-dark: #4a2e19;
    --vcr: #1b1b1d;
    --vcr-light: #2b2b2f;
  }
  * { box-sizing: border-box; }
  html, body { margin: 0; }
  body {
    min-height: 100vh;
    display: grid;
    place-items: center;
    background: linear-gradient(160deg, #1a6698 0%, #45c9f5 100%);
    background-attachment: fixed;
    font-family: "Courier New", monospace;
    padding: 24px 12px;
  }

  /* ---------- set-up ---------- */
  /* fixed design width; the script scales it down uniformly on small screens */
  #retro-tv { width: 960px; flex: none; }

  /* ---------- TV ---------- */
  .tv {
    position: relative;
    background: linear-gradient(160deg, var(--wood) 0%, var(--wood-dark) 100%);
    border-radius: 34px 34px 18px 18px;
    padding: 32px;
    display: grid;
    grid-template-columns: 1fr 160px;
    gap: 26px;
    box-shadow: 0 2px 0 #8a6240 inset, 0 -6px 0 rgba(0,0,0,.35) inset, 0 20px 30px rgba(0,0,0,.5);
  }
  .tv::before { /* wood grain */
    content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
    background: repeating-linear-gradient(90deg, rgba(0,0,0,.06) 0 2px, transparent 2px 7px);
  }
  .bezel {
    background: #111;
    border-radius: 28px;
    padding: 20px;
    box-shadow: 0 0 0 5px #2a2a2a, inset 0 0 18px #000;
  }
  .screen {
    position: relative;
    aspect-ratio: 4 / 3;
    border-radius: 48% / 9%;
    overflow: hidden;
    background: #050505;
    box-shadow: inset 0 0 40px rgba(0,0,0,.9);
  }
  .screen video, .screen canvas, .screen .nosignal {
    position: absolute; inset: 0; width: 100%; height: 100%;
    object-fit: cover; display: none;
  }
  .screen.state-static canvas { display: block; }
  .screen.state-play video { display: block; }
  .screen.state-nosignal .nosignal { display: grid; }
  .nosignal {
    place-items: center; text-align: center;
    background: #1030c0; color: #fff; font-size: clamp(14px, 4vw, 30px);
    letter-spacing: 3px;
  }
  /* glass, scanlines, vignette */
  .screen::after {
    content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 5;
    background:
      linear-gradient(125deg, rgba(255,255,255,.14) 0%, rgba(255,255,255,0) 35%),
      repeating-linear-gradient(0deg, rgba(0,0,0,.18) 0 1px, transparent 1px 3px),
      radial-gradient(ellipse at center, transparent 55%, rgba(0,0,0,.55) 100%);
  }
  /* CRT power animations */
  .screen .stage { position: absolute; inset: 0; }
  .screen.anim-on  .stage { animation: crt-on 0.5s ease-out; }
  .screen.anim-off .stage { animation: crt-off 0.45s ease-in forwards; }
  .screen.is-off .stage { visibility: hidden; }
  @keyframes crt-on {
    0%   { transform: scale(1, 0.005); filter: brightness(6); }
    55%  { transform: scale(1, 0.005); filter: brightness(6); }
    100% { transform: scale(1, 1); filter: brightness(1); }
  }
  @keyframes crt-off {
    0%   { transform: scale(1, 1); filter: brightness(1); }
    60%  { transform: scale(1, 0.01); filter: brightness(5); }
    100% { transform: scale(0, 0.01); filter: brightness(8); opacity: 0; }
  }

  /* control panel */
  .panel {
    background: linear-gradient(180deg, #3a2515, #2a1a0e);
    border-radius: 14px;
    padding: 20px 14px;
    display: flex; flex-direction: column; align-items: center; gap: 22px;
    box-shadow: inset 0 0 10px rgba(0,0,0,.7);
  }
  .power-wrap { display: flex; flex-direction: column; align-items: center; gap: 8px; }
  .led {
    width: 14px; height: 14px; border-radius: 50%;
    background: #400; box-shadow: 0 0 0 2px #1a1a1a;
    transition: .2s;
  }
  .tv.on .led { background: #ff2a1a; box-shadow: 0 0 0 2px #1a1a1a, 0 0 10px 3px #ff2a1a; }
  .power-btn {
    width: 76px; height: 76px; border-radius: 50%;
    border: 0; cursor: pointer; position: relative;
    background: radial-gradient(circle at 35% 30%, #f1f1f1, #9a9a9a 70%);
    box-shadow: 0 5px 0 #555, 0 8px 10px rgba(0,0,0,.6);
    transition: transform .08s, box-shadow .08s;
  }
  .power-btn:active, .tv.on .power-btn { transform: translateY(3px); box-shadow: 0 1px 0 #555, 0 2px 4px rgba(0,0,0,.6); }
  .power-btn:focus-visible { outline: 3px solid #ffd54a; outline-offset: 3px; }
  .power-btn svg { width: 36px; height: 36px; position: absolute; inset: 20px; }
  .label { color: #d8c8a8; font-size: 13px; letter-spacing: 2px; }
  .knob {
    width: 66px; height: 66px; border-radius: 50%;
    background: radial-gradient(circle at 35% 30%, #666, #1d1d1d 75%);
    box-shadow: 0 3px 5px rgba(0,0,0,.7), 0 0 0 4px #111;
    position: relative;
  }
.power-btn:hover,
.power-btn:focus {
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #5a5a5a, #1b1b1b 70%);
  box-shadow:
    0 7px 12px rgba(0,0,0,.8),
    0 0 0 4px #0c0c0c,
    inset 0 2px 3px rgba(255,255,255,.25);
}
  .knob::after { content: ""; position: absolute; left: 50%; top: 7px; width: 4px; height: 20px; margin-left: -2px; background: #ddd; border-radius: 2px; }
  .knob.k2::after { transform: rotate(50deg); transform-origin: 50% 26px; top: 7px; }
  .grille {
    width: 100%; flex: 1; min-height: 70px; border-radius: 6px;
    background: repeating-linear-gradient(0deg, #0d0804 0 3px, #3a2515 3px 7px);
  }

  /* feet */
  .feet { display: flex; justify-content: space-between; padding: 0 60px; height: 11px; }
  .feet i { width: 78px; background: #111; border-radius: 0 0 8px 8px; }

  /* ---------- VCR ---------- */
  .vcr {
    background: linear-gradient(180deg, var(--vcr-light), var(--vcr));
    border-radius: 10px 10px 16px 16px;
    padding: 22px 30px;
    display: grid; grid-template-columns: 1.4fr 1fr; gap: 26px; align-items: center;
    box-shadow: 0 1px 0 #444 inset, 0 16px 24px rgba(0,0,0,.55);
    margin-top: -2px;
  }
  .tape-bay {
    background: #0a0a0b; border-radius: 5px; padding: 12px 14px;
    box-shadow: inset 0 0 8px #000;
    position: relative;
  }
  .slot {
    height: 32px; background: #000; border-radius: 4px;
    box-shadow: inset 0 3px 6px #000, 0 1px 0 #444;
    position: relative; overflow: hidden;
  }
  .tape {
    position: absolute; left: 10px; right: 10px; top: 4px; bottom: -4px;
    background: #222; border-radius: 4px 4px 0 0;
    border-top: 3px solid #3a3a3a;
  }
  .tape-label {
    margin-top: 9px; background: #f2ecd6; color: #222; font-size: 16px;
    padding: 4px 8px; border-radius: 2px; text-align: center;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    transform: rotate(-.6deg);
  }
  .vcr-right { display: flex; flex-direction: column; gap: 14px; align-items: flex-end; }
  .display {
    background: #06140f; color: #43ff9a; font-size: 30px; letter-spacing: 4px;
    padding: 6px 14px; border-radius: 4px; min-width: 190px; text-align: center;
    box-shadow: inset 0 0 8px #000; text-shadow: 0 0 6px #19d46f;
  }
  .display.blink { animation: blink 1s steps(1) infinite; }
  @keyframes blink { 50% { opacity: .15; } }
  .vcr-btns { display: flex; gap: 9px; align-items: center; }
  .vcr-btns span { width: 32px; height: 17px; background: #3c3c40; border-radius: 3px; box-shadow: 0 2px 0 #111; }
  .play-ind { color: #43ff9a; font-size: 14px; letter-spacing: 1px; opacity: .2; margin-left: 8px; }
  .tv.on ~ .vcr .play-ind { opacity: 1; text-shadow: 0 0 6px #19d46f; }

