* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg-dark: #0d0d0d;
  --bg-panel: #151515;
  --wood-light: #8B6914;
  --wood-dark: #3d2b06;
  --wood-mid: #5c3d10;
  --phosphor-green: #00ff41;
  --phosphor-amber: #ffb000;
  --led-red: #ff2222;
  --led-green: #22ff44;
  --metal-dark: #2a2a2a;
  --metal-mid: #3a3a3a;
  --text-dim: #666;
  --text-label: #999;
  --crt-tint: rgba(0, 30, 20, 0.08);
}

body {
  background: var(--bg-dark);
  background-image: 
    radial-gradient(ellipse at 50% 0%, rgba(40,30,10,0.3) 0%, transparent 60%),
    repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(255,255,255,0.003) 2px, rgba(255,255,255,0.003) 4px);
  color: #ccc;
  font-family: 'IBM Plex Mono', monospace;
  min-height: 100vh;
  overflow-x: hidden;
}

#app-container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 20px 15px;
}

/* Antenna */
#antenna-container {
  position: relative;
  height: 80px;
  width: 200px;
  margin: 0 auto -5px;
}
.antenna {
  position: absolute;
  bottom: 0;
  width: 3px;
  height: 70px;
  background: linear-gradient(to top, #888, #bbb);
  border-radius: 2px;
  transform-origin: bottom center;
  cursor: grab;
  transition: transform 0.1s;
}
.antenna::after {
  content: '';
  position: absolute;
  top: -6px;
  left: -3px;
  width: 9px;
  height: 9px;
  background: #ccc;
  border-radius: 50%;
}
#antenna-left {
  left: 50px;
  transform: rotate(-25deg);
}
#antenna-right {
  right: 50px;
  transform: rotate(25deg);
}
#antenna-base {
  position: absolute;
  bottom: -4px;
  left: 50%;
  transform: translateX(-50%);
  width: 30px;
  height: 12px;
  background: linear-gradient(to bottom, #777, #555);
  border-radius: 4px 4px 0 0;
}

/* TV Body */
#tv-body {
  background: linear-gradient(160deg, 
    #7a5a1a 0%, #5c3d10 15%, #3d2b06 40%, 
    #2d1e04 60%, #5c3d10 80%, #7a5a1a 100%);
  border-radius: 16px;
  padding: 20px;
  box-shadow: 
    0 8px 40px rgba(0,0,0,0.8),
    inset 0 1px 0 rgba(255,255,255,0.1),
    inset 0 -2px 0 rgba(0,0,0,0.5);
  position: relative;
  display: grid;
  grid-template-columns: 1fr 200px;
  gap: 15px;
}

/* Screen */
#screen-area {
  position: relative;
}

#screen-bezel {
  background: #1a1a1a;
  border-radius: 20px;
  padding: 12px;
  box-shadow: 
    inset 0 2px 8px rgba(0,0,0,0.9),
    inset 0 0 20px rgba(0,0,0,0.5),
    0 1px 0 rgba(255,255,255,0.05);
}

#crt-container {
  position: relative;
  width: 100%;
  padding-bottom: 75%;
  border-radius: 12px;
  overflow: hidden;
  background: #000;
}

#crt-screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 12px;
}

#screen-overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  border-radius: 12px;
  pointer-events: none;
  background: 
    repeating-linear-gradient(
      0deg,
      transparent 0px,
      transparent 2px,
      rgba(0,0,0,0.15) 2px,
      rgba(0,0,0,0.15) 4px
    );
  z-index: 2;
}

#screen-reflection {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  border-radius: 12px;
  pointer-events: none;
  background: linear-gradient(
    135deg,
    rgba(255,255,255,0.06) 0%,
    transparent 40%,
    transparent 60%,
    rgba(255,255,255,0.02) 100%
  );
  z-index: 3;
}

#upload-prompt {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 4;
  cursor: pointer;
}

.test-card {
  text-align: center;
  padding: 20px;
}

.test-card p {
  color: #ddd;
  font-size: 16px;
  font-family: 'IBM Plex Mono', monospace;
  font-weight: 700;
  text-shadow: 0 0 10px rgba(255,255,255,0.5);
  margin-top: 10px;
}

.test-card p span {
  font-size: 11px;
  font-weight: 300;
  color: #aaa;
}

#poweroff-dot {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 4px;
  height: 4px;
  background: white;
  border-radius: 50%;
  box-shadow: 0 0 20px white, 0 0 40px white;
  z-index: 5;
}

/* Controls Panel */
#controls-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 5px 0;
}

#brand-label {
  text-align: center;
  font-size: 18px;
  font-weight: 700;
  color: #c9a84c;
  letter-spacing: 4px;
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

#brand-label span {
  font-weight: 300;
  font-size: 11px;
  display: block;
  letter-spacing: 6px;
  color: #8a7235;
}

#channel-display {
  text-align: center;
  margin: 4px 0;
}

.led-display {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 28px;
  font-weight: 700;
  color: var(--led-red);
  text-shadow: 0 0 8px var(--led-red), 0 0 20px rgba(255,50,50,0.3);
  background: #111;
  display: inline-block;
  padding: 4px 12px;
  border-radius: 3px;
  border: 1px solid #222;
}

#knobs-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 8px;
}

.knob-container {
  text-align: center;
}

.knob-container label {
  display: block;
  font-size: 8px;
  color: var(--text-label);
  letter-spacing: 1.5px;
  margin-top: 3px;
  font-weight: 600;
}

.knob {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(145deg, #4a4a4a, #222);
  margin: 0 auto;
  cursor: grab;
  position: relative;
  box-shadow: 
    0 2px 6px rgba(0,0,0,0.6),
    inset 0 1px 0 rgba(255,255,255,0.15),
    0 0 0 2px #1a1a1a;
  user-select: none;
}

.knob:active {
  cursor: grabbing;
}

.knob-indicator {
  position: absolute;
  top: 4px;
  left: 50%;
  transform: translateX(-50%);
  width: 2px;
  height: 12px;
  background: #fff;
  border-radius: 1px;
  pointer-events: none;
}

#power-section {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: auto;
}

#power-led {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--led-red);
  box-shadow: 0 0 4px var(--led-red);
  transition: all 0.3s;
}

#power-led.on {
  background: var(--led-green);
  box-shadow: 0 0 8px var(--led-green), 0 0 16px rgba(34,255,68,0.3);
}

#power-btn {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 2px;
  padding: 6px 16px;
  background: linear-gradient(to bottom, #3a3a3a, #222);
  color: #aaa;
  border: 1px solid #444;
  border-radius: 4px;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

#power-btn:hover {
  background: linear-gradient(to bottom, #444, #2a2a2a);
  color: #ddd;
}

#power-btn:active {
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.5);
}

/* Mode Bar */
#mode-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
  padding: 10px;
  background: var(--bg-panel);
  border-radius: 8px;
  align-items: center;
  justify-content: center;
}

.mode-btn, .toggle-btn, .action-btn {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1px;
  padding: 5px 12px;
  border: 1px solid #333;
  border-radius: 3px;
  cursor: pointer;
  transition: all 0.2s;
}

.mode-btn {
  background: #1a1a1a;
  color: #666;
}
.mode-btn.active {
  background: #222;
  color: var(--phosphor-green);
  border-color: var(--phosphor-green);
  box-shadow: 0 0 6px rgba(0,255,65,0.2);
}
.mode-btn:hover { color: #aaa; }

.toggle-btn {
  background: #1a1a1a;
  color: #555;
}
.toggle-btn.active {
  background: #1a1200;
  color: var(--phosphor-amber);
  border-color: var(--phosphor-amber);
}

.action-btn {
  background: linear-gradient(to bottom, #2a2a2a, #1a1a1a);
  color: #888;
}
.action-btn:hover {
  color: #ccc;
  border-color: #555;
}

.mode-sep {
  width: 1px;
  height: 20px;
  background: #333;
  margin: 0 4px;
}

/* VCR Controls */
#vcr-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  padding: 10px;
  background: linear-gradient(to bottom, #222, #181818);
  border-radius: 8px;
  border: 1px solid #2a2a2a;
}

.vcr-btn {
  width: 40px;
  height: 32px;
  background: linear-gradient(to bottom, #333, #1e1e1e);
  border: 1px solid #444;
  border-radius: 3px;
  color: #aaa;
  font-size: 12px;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
}

.vcr-btn:hover { background: linear-gradient(to bottom, #3a3a3a, #252525); color: #fff; }
.vcr-btn:active { box-shadow: inset 0 1px 3px rgba(0,0,0,0.5); }

#seek-container {
  flex: 1;
  padding: 0 8px;
}

#seek-bar {
  width: 100%;
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  background: #333;
  border-radius: 2px;
  outline: none;
}

#seek-bar::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  background: var(--phosphor-amber);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 0 6px rgba(255,176,0,0.4);
}

#time-display {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 14px;
  font-weight: 700;
  color: var(--led-red);
  text-shadow: 0 0 6px rgba(255,50,50,0.3);
  white-space: nowrap;
}

.time-sep { color: #552222; }

/* Signal Panel */
#signal-panel-toggle {
  display: block;
  width: 100%;
  margin-top: 10px;
  padding: 8px;
  background: var(--bg-panel);
  border: 1px solid #222;
  border-radius: 6px;
  color: var(--phosphor-green);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 2px;
  cursor: pointer;
  text-align: center;
}

#signal-panel-toggle:hover { background: #1a1a1a; }

#signal-panel {
  margin-top: 6px;
  overflow: hidden;
  transition: max-height 0.4s ease, opacity 0.3s;
}

#signal-panel.collapsed {
  max-height: 0;
  opacity: 0;
  pointer-events: none;
}

#signal-panel:not(.collapsed) {
  max-height: 600px;
  opacity: 1;
}

#signal-displays {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
}

.signal-display {
  background: #0a0a0a;
  border: 1px solid #1a1a1a;
  border-radius: 6px;
  padding: 6px;
  position: relative;
}

.signal-label {
  font-size: 9px;
  letter-spacing: 2px;
  color: var(--phosphor-green);
  text-shadow: 0 0 4px rgba(0,255,65,0.3);
  margin-bottom: 4px;
  text-align: center;
}

.signal-display canvas {
  width: 100%;
  height: 180px;
  border-radius: 4px;
  display: block;
}

#edu-toggle-container {
  text-align: center;
  margin-top: 8px;
}

#edu-toggle {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  padding: 6px 16px;
  background: #1a1200;
  border: 1px solid var(--phosphor-amber);
  border-radius: 3px;
  color: var(--phosphor-amber);
  cursor: pointer;
  letter-spacing: 1px;
}

/* Educational Panel */
#edu-panel {
  margin-top: 10px;
  padding: 16px;
  background: var(--bg-panel);
  border-radius: 8px;
  border: 1px solid #222;
}

#edu-panel h2 {
  font-family: 'Crimson Pro', serif;
  font-size: 22px;
  color: var(--phosphor-amber);
  margin-bottom: 12px;
  font-weight: 600;
}

.edu-section {
  margin-bottom: 4px;
}

.edu-accordion {
  width: 100%;
  text-align: left;
  padding: 10px 14px;
  background: #111;
  border: 1px solid #222;
  border-radius: 4px;
  color: #ccc;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.edu-accordion:hover { background: #181818; color: var(--phosphor-green); }
.edu-accordion.open { border-color: var(--phosphor-green); color: var(--phosphor-green); }

.edu-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.edu-content.open {
  max-height: 200px;
}

.edu-content p {
  font-family: 'Crimson Pro', serif;
  font-size: 15px;
  line-height: 1.6;
  color: #aaa;
  padding: 10px 14px;
}

/* Footer */
footer {
  text-align: center;
  padding: 20px;
  margin-top: 20px;
}

footer a {
  color: #555;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  text-decoration: none;
  letter-spacing: 2px;
}

footer a:hover { color: var(--phosphor-green); }

/* Mobile Responsive */
@media (max-width: 768px) {
  #tv-body {
    grid-template-columns: 1fr;
    padding: 12px;
  }
  
  #controls-panel {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
  }
  
  #brand-label { width: 100%; }
  #channel-display { width: 100%; }
  
  #knobs-grid {
    grid-template-columns: repeat(4, 1fr);
    width: 100%;
  }
  
  #power-section { width: 100%; }
  
  #signal-displays {
    grid-template-columns: 1fr;
  }
  
  .signal-display canvas {
    height: 120px;
  }
  
  #antenna-container { height: 50px; }
  .antenna { height: 45px; }
  
  .knob {
    width: 36px;
    height: 36px;
  }
  
  .knob-indicator {
    height: 9px;
    top: 3px;
  }
}

@media (max-width: 480px) {
  #knobs-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 6px 4px;
  }
  
  .knob {
    width: 32px;
    height: 32px;
  }
  
  #mode-bar {
    gap: 4px;
    padding: 6px;
  }
  
  .mode-btn, .toggle-btn, .action-btn {
    font-size: 8px;
    padding: 4px 8px;
  }
}