:root {
  --gold: #c47a3a;
  --room-bg: #050408;
  --chassis-surface: linear-gradient(170deg, #2a231b 0%, #15110d 45%, #0a0806 100%);
  --bezel-surface: linear-gradient(145deg, #1e1914 0%, #110e0b 60%, #080605 100%);
  --brass-accent: #c4a574;
  --brass-dark: #4d3d25;
  --ink-default: #f0e6d8;
  --font-serif: "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --font-mono: ui-monospace, "Cascadia Code", "Source Code Pro", Menlo, Monaco, "Courier New", monospace;
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--room-bg);
  color: var(--ink-default);
  font-family: var(--font-serif);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Accessibility: Skip Link */
.skip {
  position: absolute;
  top: -100px;
  left: 1rem;
  z-index: 1000;
  padding: 0.6rem 1.2rem;
  background: var(--gold);
  color: #000;
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 0.9rem;
  text-decoration: none;
  border-radius: 4px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.5);
  transition: top 0.15s ease-out;
}
.skip:focus {
  top: 1rem;
  outline: 2px solid #fff;
  outline-offset: 2px;
}

/* Room Environment with Dynamic Screen Ambient Glow */
.room {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
  position: relative;
  overflow: hidden;
  background-color: var(--room-bg);
  background-image:
    /* Screen glow ambient lighting cast into dark room */
    radial-gradient(ellipse 65% 55% at 50% 42%, rgba(200, 160, 100, 0.12) 0%, transparent 70%),
    /* Overhead room shadow */
    linear-gradient(to bottom, #020204 0%, transparent 25%),
    /* Floor/table horizon gradient */
    linear-gradient(to top, #020203 0%, transparent 40%);
}

/* Table Surface Reflection beneath the TV Set */
.room::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: min(1000px, 95vw);
  height: 120px;
  background: radial-gradient(ellipse at 50% 0%, rgba(200, 160, 100, 0.06) 0%, transparent 75%);
  pointer-events: none;
  z-index: 0;
}

/* TV Cabinet Chassis */
.set {
  position: relative;
  z-index: 1;
  width: min(880px, 96vw);
  background: var(--chassis-surface);
  border-radius: 1.5rem;
  padding: 1.25rem 1.5rem 1.5rem;
  border: 1px solid #362c21;
  box-shadow:
    /* Room drop shadow cast onto surface */
    0 50px 100px -20px #000000,
    0 25px 45px -10px rgba(0, 0, 0, 0.95),
    /* Screen ambient radiance around cabinet */
    0 0 60px -15px rgba(200, 160, 100, 0.15),
    /* Cabinet chamfer highlights */
    inset 0 1px 0 rgba(255, 230, 190, 0.12),
    inset 0 0 0 2px #15110d;
}

/* Cabinet Badge / Nameplate Header */
.chassis-badge {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.2rem 0.6rem 0.8rem;
  margin-bottom: 0.4rem;
  border-bottom: 1px solid #241d16;
}

.badge-brand {
  font-family: var(--font-serif);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.35em;
  color: var(--brass-accent);
  text-shadow: 0 1px 2px #000, 0 0 8px rgba(196, 165, 116, 0.3);
  text-transform: uppercase;
}

.badge-model {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.2em;
  color: #7a6850;
  text-transform: uppercase;
}

/* Bezel Frame */
.bezel {
  position: relative;
  background: var(--bezel-surface);
  border-radius: 1.1rem;
  padding: 1.1rem;
  border: 1px solid #282017;
  box-shadow:
    inset 0 4px 14px rgba(0, 0, 0, 0.95),
    inset 0 0 0 2px #0d0a08,
    0 1px 1px rgba(255, 255, 255, 0.05);
}

/* CRT Screen Glass */
.glass {
  position: relative;
  overflow: hidden;
  border-radius: 0.9rem;
  outline: none;
  background: #080605;
  box-shadow:
    /* CRT inner cathode shadow & phosphor glow */
    inset 0 0 60px rgba(0, 0, 0, 0.9),
    inset 0 0 15px rgba(0, 0, 0, 0.95),
    0 0 40px -10px var(--gold);
  transition: box-shadow 0.3s ease;
}

/* Keyboard Focus indicator for Glass */
.glass:focus-visible {
  box-shadow:
    inset 0 0 60px rgba(0, 0, 0, 0.9),
    0 0 0 3px var(--gold),
    0 0 45px var(--gold);
}

/* CRT Scanlines Overlay */
.glass::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background:
    /* Raster scanlines */
    repeating-linear-gradient(
      to bottom,
      rgba(255, 255, 255, 0.02) 0px,
      rgba(255, 255, 255, 0.02) 1px,
      transparent 1px,
      transparent 3px
    ),
    /* Radial CRT corner vignette */
    radial-gradient(
      circle at 50% 50%,
      transparent 55%,
      rgba(0, 0, 0, 0.6) 100%
    );
  mix-blend-mode: overlay;
}

/* CRT Curved Glass Glare / Lens Reflection */
.glass::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  background: radial-gradient(
    ellipse at 25% 20%,
    rgba(255, 255, 255, 0.12) 0%,
    rgba(255, 255, 255, 0.03) 40%,
    transparent 65%
  );
}

/* Canvas Scene */
#scene {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 832 / 480;
  border-radius: inherit;
  filter: contrast(1.05) brightness(0.98);
}

/* Station Ident OSD Overlay */
.ident-hud {
  position: absolute;
  top: 1rem;
  left: 1.2rem;
  z-index: 4;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.75rem;
  background: rgba(8, 6, 12, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-left: 2px solid var(--gold);
  border-radius: 4px;
  backdrop-filter: blur(4px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

.signal-indicator {
  font-size: 0.55rem;
  color: var(--gold);
  text-shadow: 0 0 6px var(--gold);
  animation: pulse-signal 3s infinite ease-in-out;
}

@keyframes pulse-signal {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.ident {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  text-shadow: 0 0 10px currentColor;
}

/* Lower-Third Chyron Overlay on Glass */
.lower-third {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 4;
  padding: 0.85rem 1.4rem;
  background: linear-gradient(
    90deg,
    rgba(6, 5, 8, 0.94) 0%,
    rgba(14, 11, 17, 0.88) 60%,
    rgba(6, 5, 8, 0.65) 100%
  );
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  gap: 1rem;
}

.lower-third-bar {
  width: 4px;
  height: 2.2rem;
  background: var(--gold);
  box-shadow: 0 0 8px var(--gold);
  flex-shrink: 0;
  border-radius: 2px;
}

.lower {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 0.95rem;
  font-style: italic;
  line-height: 1.4;
  color: #ebdcd0;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9);
  min-height: 2.6em;
  display: flex;
  align-items: center;
}

/* Control Deck Housing */
.control-deck {
  margin-top: 1.1rem;
  padding: 0.8rem 1.2rem;
  background: linear-gradient(180deg, #16120e 0%, #1c1712 100%);
  border: 1px solid #2e251b;
  border-radius: 0.8rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow:
    inset 0 1px 0 rgba(255, 230, 190, 0.06),
    0 4px 10px rgba(0, 0, 0, 0.5);
}

/* Pilot Power Indicator Lamp */
.pilot-lamp {
  width: 0.75rem;
  height: 0.75rem;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #ffe6a0 0%, var(--gold) 60%, #5a3c10 100%);
  box-shadow: 0 0 10px var(--gold), 0 0 2px var(--gold);
  border: 1px solid #4a381a;
  flex-shrink: 0;
}

/* Dial Section */
.dial {
  display: flex;
  align-items: center;
  gap: 1.4rem;
}

/* Knurled Metallic Selector Buttons */
.dial button {
  font-family: var(--font-sans);
  font-size: 0.95rem;
  color: var(--brass-accent);
  background: radial-gradient(circle at 35% 35%, #463b2d 0%, #221b14 70%, #120e0a 100%);
  border: 1px solid #5a4b38;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow:
    0 4px 8px rgba(0, 0, 0, 0.6),
    inset 0 1px 0 rgba(255, 255, 255, 0.15),
    inset 0 -2px 4px rgba(0, 0, 0, 0.8);
  transition: transform 0.1s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.dial button:hover {
  border-color: var(--gold);
  color: #fff;
  box-shadow:
    0 4px 12px rgba(0, 0, 0, 0.7),
    0 0 12px var(--gold),
    inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.dial button:active {
  transform: translateY(2px);
  box-shadow:
    0 1px 3px rgba(0, 0, 0, 0.8),
    inset 0 2px 4px rgba(0, 0, 0, 0.9);
}

.dial button:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 4px;
}

/* Frequency Band Window */
.band-window {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.3rem 1.2rem;
  background: #080605;
  border: 1px solid #382c1f;
  border-radius: 6px;
  box-shadow: inset 0 0 10px #000, 0 1px 0 rgba(255, 255, 255, 0.05);
  min-width: 130px;
}

.band-label {
  font-family: var(--font-mono);
  font-size: 0.55rem;
  letter-spacing: 0.25em;
  color: #7a6854;
  margin-bottom: 0.1rem;
}

.band {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.35em;
  color: var(--gold);
  text-shadow: 0 0 10px var(--gold);
}

/* Room Keyboard Controls Legend Footer */
.room-hint {
  margin-top: 1.6rem;
  z-index: 1;
  font-family: var(--font-sans);
  font-size: 0.78rem;
  color: #7a6f62;
  text-align: center;
  letter-spacing: 0.04em;
}

.room-hint kbd {
  display: inline-block;
  padding: 0.15rem 0.45rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: #c4b5a0;
  background: #181410;
  border: 1px solid #382d22;
  border-radius: 4px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.4);
}

/* Responsive adjustments */
@media (max-width: 640px) {
  .set {
    padding: 1rem;
    border-radius: 1.1rem;
  }
  .bezel {
    padding: 0.75rem;
  }
  .ident-hud {
    top: 0.6rem;
    left: 0.6rem;
    padding: 0.25rem 0.5rem;
  }
  .ident {
    font-size: 0.65rem;
  }
  .lower-third {
    padding: 0.6rem 0.9rem;
  }
  .lower {
    font-size: 0.82rem;
  }
  .control-deck {
    padding: 0.6rem;
  }
  .dial {
    gap: 0.8rem;
  }
  .band-window {
    min-width: 100px;
    padding: 0.25rem 0.75rem;
  }
  .band {
    font-size: 0.85rem;
  }
}
