body.tv-page {
  font-family: "Bebas Neue", "Arial Narrow", sans-serif;
  background:
    radial-gradient(700px 400px at 50% 0%, #4a2c1c 0%, transparent 60%),
    #1a100c;
  color: #f3e0c8;
}

.den {
  width: min(1100px, 100%);
  margin: 0 auto;
  padding: 8px 12px 32px;
  padding-top: max(8px, env(safe-area-inset-top));
  padding-bottom: max(32px, env(safe-area-inset-bottom));
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.antennas {
  position: relative;
  height: 28px;
  margin: 0 16% 0;
  flex-shrink: 0;
}

.ear {
  position: absolute;
  bottom: 2px;
  width: 3px;
  height: 34px;
  background: linear-gradient(180deg, #d8d8d8, #7a7a7a);
  border-radius: 2px;
  transform-origin: bottom center;
}

.ear.left { left: 28%; transform: rotate(-28deg); }
.ear.right { right: 28%; transform: rotate(32deg); }

.ear::after {
  content: "";
  position: absolute;
  top: -6px;
  left: -4px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #c0c0c0;
  box-shadow: 0 0 0 2px #555;
}

.antennas .hub {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 22px;
  height: 14px;
  margin-left: -11px;
  background: #8a8a8a;
  border-radius: 4px 4px 0 0;
}

.stage {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.set {
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

.cabinet {
  background-color: #6b4326;
  background-image:
    repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.14) 0 2px, transparent 2px 7px),
    repeating-linear-gradient(180deg, rgba(255, 210, 140, 0.08) 0 3px, transparent 8px, rgba(0, 0, 0, 0.1) 14px),
    linear-gradient(180deg, #8a5a32, #4a2c18);
  border: 10px solid #3a2414;
  border-radius: 10px 10px 6px 6px;
  padding: 12px;
  box-shadow:
    inset 0 2px 0 rgba(255, 220, 170, 0.28),
    inset 0 -8px 16px rgba(0, 0, 0, 0.28),
    0 16px 30px rgba(0, 0, 0, 0.5);
}

.console-face {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.bezel {
  background: #16120e;
  border-radius: 22px;
  padding: 10px;
  box-shadow:
    inset 0 0 0 5px #2a2218,
    inset 0 0 22px #000;
}

.crt {
  position: relative;
  border-radius: 28px / 34px;
  overflow: hidden;
  background: #000;
  box-shadow:
    inset 0 0 28px rgba(0, 0, 0, 0.85),
    0 0 18px rgba(80, 160, 200, 0.18);
}

.crt .yt-frame {
  aspect-ratio: 4 / 3;
  width: 100%;
  height: auto;
  max-height: 42vh;
}

.scanlines,
.glass-glare {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
}

.scanlines {
  background: repeating-linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0.22) 0,
    rgba(0, 0, 0, 0.22) 1px,
    transparent 1px,
    transparent 3px
  );
  mix-blend-mode: multiply;
}

.glass-glare {
  background:
    radial-gradient(120% 80% at 20% 10%, rgba(255, 255, 255, 0.16), transparent 42%),
    radial-gradient(80% 60% at 80% 90%, rgba(80, 140, 200, 0.12), transparent 50%);
}

.side-panel {
  display: grid;
  grid-template-columns: 56px 1fr;
  grid-template-areas:
    "grille vfd"
    "grille lamp";
  gap: 8px 10px;
  align-items: center;
  padding: 8px;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.12), rgba(0, 0, 0, 0.22)),
    #5a3820;
  border: 3px solid #3a2414;
  border-radius: 6px;
}

.speaker-grille {
  grid-area: grille;
  align-self: stretch;
  min-height: 88px;
  border-radius: 4px;
  background:
    repeating-linear-gradient(
      180deg,
      #2a1c12 0 3px,
      #c9a05a 3px 4px
    );
  box-shadow: inset 0 0 8px rgba(0, 0, 0, 0.5);
}

.vfd {
  grid-area: vfd;
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 0;
  padding: 6px 10px;
  min-height: 36px;
  min-width: 0;
  background: #04140e;
  border: 3px solid #1a2a20;
  border-radius: 6px;
  color: #7dffb8;
  font-family: "VT323", "Courier New", monospace;
  font-size: 1.3rem;
  line-height: 1.15;
  letter-spacing: 0.04em;
  text-shadow: 0 0 8px #3dff8a;
  box-shadow: inset 0 0 12px rgba(0, 255, 120, 0.12);
}

.ch {
  flex-shrink: 0;
  opacity: 0.85;
}

.vfd-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dials {
  grid-area: dials;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  justify-items: center;
}

.knob {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  background: none;
  border: 0;
  color: #f3e0c8;
  padding: 0;
}

.knob-face {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background:
    repeating-conic-gradient(from 0deg, #3a3a3a 0 8deg, #1a1a1a 8deg 10deg),
    radial-gradient(circle at 40% 35%, #6a6a6a, #2a2a2a 70%);
  border: 3px solid #c8c8c8;
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.25),
    0 3px 0 #1a1a1a;
  display: grid;
  place-items: center;
  position: relative;
}

.knob-face::before {
  content: "";
  position: absolute;
  inset: 5px;
  border-radius: 50%;
  background: repeating-conic-gradient(from 0deg, transparent 0 14deg, #d8d8d8 14deg 15deg);
  opacity: 0.85;
  pointer-events: none;
}

.tick {
  position: relative;
  z-index: 1;
  width: 3px;
  height: 18px;
  background: #f4f4f4;
  border-radius: 1px;
  transform: translateY(-6px);
  box-shadow: 0 0 0 1px #111;
}

.knob-random .tick {
  transform: rotate(40deg) translateY(-6px);
}

.knob[data-action="shuffle"].is-on .knob-face {
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.25),
    0 3px 0 #1a1a1a,
    0 0 14px #7dffb8;
}

.knob-label {
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.85rem;
}

.tv-keys,
.tv-keys.keys-bookmarks {
  display: grid;
  grid-template-columns: 1.05fr 0.9fr 1.2fr 0.9fr 1.05fr;
  align-items: end;
  gap: 6px;
  margin-top: 10px;
  position: relative;
  z-index: 4;
}

.tv-keys button {
  min-height: 48px;
  padding: 6px 4px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.85rem;
  color: #f3e0c8;
  background: linear-gradient(180deg, #8a5a32, #4a2c18);
  border: 2px solid #c9a05a;
  border-radius: 6px;
  box-shadow: inset 0 1px 0 rgba(255, 220, 170, 0.35), 0 2px 0 #2a1608;
}

.tv-keys button:active {
  transform: translateY(2px);
  box-shadow: inset 0 1px 0 rgba(255, 220, 170, 0.25);
}

.tv-play {
  min-height: 58px;
  background: linear-gradient(180deg, #3d8a54, #145028) !important;
  border-color: #8ad0a0 !important;
  color: #f4fff4 !important;
}

.tv-play.is-playing {
  background: linear-gradient(180deg, #d4a024, #8a6010) !important;
  border-color: #ffe08a !important;
}

.tv-keys .key-tab {
  min-height: 58px;
  border-radius: 12px 12px 6px 6px;
  clip-path: polygon(6% 0, 94% 0, 100% 22%, 100% 100%, 0 100%, 0 22%);
}

.tv-keys .key-tab-left {
  background: linear-gradient(180deg, #7ac7ff, #1a5aa0);
  color: #f4fbff;
  border-color: #c8ecff;
}

.tv-keys .key-tab-left.is-on {
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.4),
    0 2px 0 #0a3060,
    0 0 14px #4dc3ff;
  border-color: #e8f7ff;
}

.tv-keys .key-tab-right,
.tv-keys .key-random {
  background: linear-gradient(180deg, #ffe08a, #d48912);
  color: #2a1600;
  border-color: #ffe9a8;
}

.power-lamp {
  grid-area: lamp;
  justify-self: end;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #3a1208;
  box-shadow: inset 0 0 4px #000, 0 0 0 2px #2a1608;
}

body.is-playing .power-lamp {
  background: #ff6a1a;
  box-shadow: 0 0 10px #ff6a1a, 0 0 0 2px #2a1608;
}

.legs {
  display: flex;
  justify-content: space-between;
  padding: 0 18%;
  height: 22px;
}

.legs span {
  width: 10px;
  height: 22px;
  background: linear-gradient(180deg, #4a2c18, #2a1608);
  border: 1px solid #2a1608;
  clip-path: polygon(15% 0, 85% 0, 100% 100%, 0 100%);
}

@media (min-width: 960px) {
  .den {
    padding: 8px 16px 40px;
    padding-top: max(8px, env(safe-area-inset-top));
    padding-bottom: max(40px, env(safe-area-inset-bottom));
  }

  .stage {
    min-height: calc(100dvh - 66px);
    height: calc(100dvh - 66px);
    flex: 0 0 auto;
    justify-content: center;
    align-items: center;
  }

  .set {
    width: min(100%, 980px);
    height: auto;
    margin: 0 auto;
  }

  .antennas {
    height: 34px;
  }

  .ear {
    height: 42px;
  }

  .cabinet {
    flex: 0 0 auto;
    display: block;
    width: 100%;
    padding: 14px;
    border-width: 12px;
  }

  .console-face {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 170px;
    gap: 14px;
    align-items: stretch;
    width: 100%;
  }

  .bezel {
    display: block;
    width: 100%;
    min-width: 0;
    padding: 12px;
  }

  .crt {
    display: block;
    width: 100%;
  }

  .crt .yt-frame {
    aspect-ratio: 4 / 3;
    width: 100%;
    height: auto;
    max-height: calc(100dvh - 220px);
  }

  .side-panel {
    grid-template-columns: 1fr;
    grid-template-areas:
      "grille"
      "vfd"
      "lamp";
    align-content: start;
    gap: 12px;
  }

  .speaker-grille {
    min-height: 90px;
  }

  .knob-face {
    width: 68px;
    height: 68px;
  }

  .tv-keys button {
    min-height: 48px;
  }

  .legs {
    height: 26px;
  }

  .legs span {
    height: 26px;
  }
}


@media (min-width: 960px) and (max-height: 800px) {
  .antennas { height: 20px; }
  .ear { height: 28px; }
  .cabinet { padding: 8px; border-width: 8px; }
  .bezel { padding: 8px; }
  .console-face { gap: 8px; }
  .crt .yt-frame { max-height: calc(100dvh - 250px); }
  .speaker-grille { min-height: 64px; }
  .tv-keys button { min-height: 42px; }
  .legs { height: 14px; }
  .vfd { min-height: 32px; }
}
