:root {
  --phosphor: #33ff33;
  --phosphor-dim: #1a8c1a;
  --amber: #ffaa00;
  --crt-bg: #0a0a0a;
  --panel-bg: #1a1a1a;
  --bezel: #3a3632;
  --bezel-dark: #2a2622;
}

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

body {
  background: #111;
  font-family: 'IBM Plex Mono', monospace;
  color: #ccc;
  overflow-x: hidden;
  min-height: 100vh;
}

.tandy-stripe {
  height: 4px;
  background: linear-gradient(90deg,
    #e53935 0%, #e53935 20%,
    #ff9800 20%, #ff9800 40%,
    #fdd835 40%, #fdd835 60%,
    #43a047 60%, #43a047 80%,
    #1e88e5 80%, #1e88e5 100%
  );
}

.tandy-stripe-thick {
  height: 6px;
  background: linear-gradient(90deg,
    #e53935 0%, #e53935 20%,
    #ff9800 20%, #ff9800 40%,
    #fdd835 40%, #fdd835 60%,
    #43a047 60%, #43a047 80%,
    #1e88e5 80%, #1e88e5 100%
  );
}

.crt-bezel {
  background: linear-gradient(145deg, #4a4640, #2a2622);
  border-radius: 16px;
  padding: 16px;
  box-shadow:
    0 8px 32px rgba(0,0,0,0.6),
    inset 0 2px 4px rgba(255,255,255,0.05),
    inset 0 -2px 4px rgba(0,0,0,0.3);
}

.crt-screen-container {
  background: #000;
  border-radius: 8px;
  overflow: hidden;
  position: relative;
  box-shadow: inset 0 0 40px rgba(0,0,0,0.8);
}

/* Scanline overlay — covers entire canvas including VDG borders */
.crt-screen-container::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(0,0,0,0.15) 2px, rgba(0,0,0,0.15) 4px);
  pointer-events: none;
  z-index: 10;
}

/* CRT curvature/vignette — covers entire canvas including VDG borders */
.crt-screen-container::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: radial-gradient(ellipse at center, transparent 60%, rgba(0,0,0,0.4) 100%);
  pointer-events: none;
  z-index: 11;
}

.crt-glow {
  filter: brightness(1.05) contrast(1.1);
  image-rendering: pixelated;
}

.power-led {
  width: 8px; height: 8px; border-radius: 50%; background: #333; transition: all 0.3s;
}
.power-led.on {
  background: #ff2222;
  box-shadow: 0 0 6px #ff2222, 0 0 12px #ff000088;
}

.retro-btn {
  font-family: 'IBM Plex Mono', monospace;
  font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em;
  border: none; cursor: pointer; padding: 8px 18px; border-radius: 4px;
  transition: all 0.1s; font-size: 13px;
}
.retro-btn:active { transform: translateY(2px); }

.retro-btn-green {
  background: linear-gradient(180deg, #2d8c2d, #1a6b1a);
  color: #fff; box-shadow: 0 3px 0 #0d4d0d, 0 4px 8px rgba(0,0,0,0.3);
  text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}
.retro-btn-green:active { box-shadow: 0 1px 0 #0d4d0d; }
.retro-btn-green.glowing {
  background: linear-gradient(180deg, #44cc44, #2d8c2d);
  box-shadow: 0 3px 0 #1a6b1a, 0 0 16px rgba(51,255,51,0.3);
}

.retro-btn-red {
  background: linear-gradient(180deg, #c62828, #8e0000);
  color: #fff; box-shadow: 0 3px 0 #5c0000, 0 4px 8px rgba(0,0,0,0.3);
  text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}
.retro-btn-red:active { box-shadow: 0 1px 0 #5c0000; }

.retro-btn-amber {
  background: linear-gradient(180deg, #e6a200, #b37e00);
  color: #1a1a1a; box-shadow: 0 3px 0 #805a00, 0 4px 8px rgba(0,0,0,0.3);
}
.retro-btn-amber:active { box-shadow: 0 1px 0 #805a00; }

.retro-btn-dark {
  background: linear-gradient(180deg, #444, #2a2a2a);
  color: #ccc; box-shadow: 0 3px 0 #1a1a1a, 0 4px 8px rgba(0,0,0,0.3);
}
.retro-btn-dark:active { box-shadow: 0 1px 0 #1a1a1a; }

.register-panel {
  background: #0a0a0a; border: 1px solid #333; border-radius: 4px;
  font-family: 'VT323', monospace; color: var(--phosphor); padding: 8px;
}
.register-label { color: #888; font-size: 12px; }
.register-value {
  color: var(--phosphor); font-size: 16px; font-weight: bold;
  text-shadow: 0 0 4px rgba(51,255,51,0.3);
}

.hex-dump {
  font-family: 'VT323', monospace; font-size: 14px; line-height: 1.4;
  color: var(--phosphor); background: #0a0a0a; border: 1px solid #333;
  border-radius: 4px; padding: 8px; overflow-x: auto;
}
.hex-addr { color: var(--amber); }
.hex-byte { color: var(--phosphor); }
.hex-byte-rom { color: #66ff66; background: rgba(51,255,51,0.08); }
.hex-ascii { color: #888; }

.mem-map-segment { position: relative; cursor: pointer; transition: opacity 0.2s; }
.mem-map-segment:hover { opacity: 0.8; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: #1a1a1a; }
::-webkit-scrollbar-thumb { background: #444; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #555; }

.oscilloscope { background: #0a0a0a; border: 1px solid #333; border-radius: 4px; overflow: hidden; }

input[type="range"] { -webkit-appearance: none; appearance: none; background: transparent; width: 100%; }
input[type="range"]::-webkit-slider-track { height: 6px; background: #333; border-radius: 3px; }
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; width: 18px; height: 18px;
  border-radius: 50%; background: var(--amber); cursor: pointer; margin-top: -6px;
  box-shadow: 0 0 6px rgba(255,170,0,0.3);
}

.modal-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.75); z-index: 1000;
  display: flex; align-items: center; justify-content: center;
}
.modal-content {
  background: #1e1e1e; border: 1px solid #444; border-radius: 8px;
  max-width: 600px; max-height: 80vh; overflow-y: auto; padding: 24px; color: #ccc;
}

.cc-flag {
  display: inline-block; width: 20px; text-align: center;
  border: 1px solid #333; border-radius: 2px; padding: 1px 0; font-size: 11px;
}
.cc-flag.set { background: var(--phosphor); color: #000; border-color: var(--phosphor); }
.cc-flag.clear { background: #1a1a1a; color: #555; }

.file-drop-zone {
  border: 2px dashed #444; border-radius: 8px; padding: 16px; text-align: center;
  cursor: pointer; transition: all 0.2s;
}
.file-drop-zone:hover { border-color: var(--phosphor); background: rgba(51,255,51,0.03); }
.file-drop-zone.loaded { border-color: var(--phosphor); border-style: solid; }

.coco-key {
  background: linear-gradient(180deg, #555, #3a3a3a);
  color: #fff; border: 1px solid #666; border-radius: 3px;
  font-family: 'IBM Plex Mono', monospace; font-size: 11px;
  padding: 4px 6px; min-width: 28px; text-align: center; cursor: pointer;
  box-shadow: 0 2px 0 #222; user-select: none;
}
.coco-key:active, .coco-key.pressed {
  transform: translateY(1px); box-shadow: 0 1px 0 #222;
  background: linear-gradient(180deg, #3a3a3a, #2a2a2a);
}
.coco-key.special { background: linear-gradient(180deg, #6a4a2a, #4a3420); border-color: #7a5a3a; }

/* ============================================================
   CASSETTE DECK STYLES
   ============================================================ */
.cassette-deck {
  background: linear-gradient(180deg, #2e2a26, #1e1a16);
  border: 1px solid #555;
  border-radius: 8px;
  padding: 12px;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.06),
    0 4px 12px rgba(0,0,0,0.5);
}

.cassette-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.cassette-title {
  font-family: 'VT323', monospace;
  font-size: 16px;
  color: #ffaa00;
  letter-spacing: 0.1em;
  font-weight: bold;
}

.cassette-status {
  font-family: 'VT323', monospace;
  font-size: 14px;
  letter-spacing: 0.08em;
}

.cassette-window {
  background: #0d0805;
  border: 2px solid #444;
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 8px;
  box-shadow: inset 0 0 10px rgba(0,0,0,0.5);
  position: relative;
}

.cassette-window::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: linear-gradient(180deg, rgba(255,255,255,0.03) 0%, transparent 30%, transparent 70%, rgba(0,0,0,0.1) 100%);
  pointer-events: none;
  z-index: 1;
}

.cassette-counter-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.cassette-counter {
  display: flex;
  gap: 1px;
  background: #111;
  border: 1px solid #555;
  border-radius: 3px;
  padding: 2px 4px;
  flex-shrink: 0;
}

.counter-digit {
  font-family: 'VT323', monospace;
  font-size: 20px;
  color: #33ff33;
  text-shadow: 0 0 4px rgba(51,255,51,0.4);
  width: 14px;
  text-align: center;
  background: #0a0a0a;
  border-radius: 2px;
}

.cassette-progress-bar {
  flex: 1;
  height: 8px;
  background: #222;
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid #444;
}

.cassette-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #33ff33, #22aa22);
  transition: width 0.1s linear;
  border-radius: 4px;
  box-shadow: 0 0 4px rgba(51,255,51,0.3);
}

.transport-controls {
  display: flex;
  gap: 4px;
  justify-content: center;
  margin-bottom: 10px;
}

.transport-btn {
  font-size: 16px;
  width: 40px;
  height: 36px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, #555, #333);
  color: #ccc;
  box-shadow: 0 3px 0 #1a1a1a, 0 4px 6px rgba(0,0,0,0.3);
  transition: all 0.1s;
}

.transport-btn:hover { background: linear-gradient(180deg, #666, #444); }

.transport-btn:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #1a1a1a;
}

.transport-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.transport-btn.active-green {
  background: linear-gradient(180deg, #33cc33, #228822);
  color: #fff;
  box-shadow: 0 3px 0 #115511, 0 0 12px rgba(51,255,51,0.3);
}

.transport-btn.active-amber {
  background: linear-gradient(180deg, #cc8800, #885500);
  color: #fff;
  box-shadow: 0 3px 0 #553300, 0 0 12px rgba(255,170,0,0.3);
}

.transport-btn.active-red {
  background: linear-gradient(180deg, #cc2222, #882222);
  color: #fff;
  box-shadow: 0 3px 0 #551111, 0 0 12px rgba(255,50,50,0.3);
  animation: rec-pulse 1s infinite;
}

@keyframes rec-pulse {
  0%, 100% { box-shadow: 0 3px 0 #551111, 0 0 12px rgba(255,50,50,0.3); }
  50% { box-shadow: 0 3px 0 #551111, 0 0 20px rgba(255,50,50,0.6); }
}

.cassette-file-row {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
}

.cassette-load-btn {
  flex: 1;
  display: block;
  text-align: center;
  padding: 6px 12px;
  background: linear-gradient(180deg, #444, #2a2a2a);
  color: #ffaa00;
  border-radius: 4px;
  cursor: pointer;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  box-shadow: 0 2px 0 #1a1a1a;
  transition: all 0.1s;
}
.cassette-load-btn:hover { background: linear-gradient(180deg, #555, #333); }
.cassette-load-btn:active { transform: translateY(1px); box-shadow: 0 1px 0 #1a1a1a; }

.cassette-save-btn {
  padding: 6px 12px;
  background: linear-gradient(180deg, #444, #2a2a2a);
  color: #ccc;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  box-shadow: 0 2px 0 #1a1a1a;
  transition: all 0.1s;
}
.cassette-save-btn:disabled { opacity: 0.3; cursor: not-allowed; }
.cassette-save-btn:hover:not(:disabled) { background: linear-gradient(180deg, #555, #333); }

.cassette-file-info {
  font-family: 'VT323', monospace;
  font-size: 13px;
  margin-bottom: 8px;
  padding: 0 4px;
}

.baud-selector {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}

.baud-label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  color: #888;
  font-weight: 700;
  text-transform: uppercase;
}

.baud-btn {
  padding: 3px 10px;
  background: #222;
  color: #888;
  border: 1px solid #444;
  border-radius: 3px;
  cursor: pointer;
  font-family: 'VT323', monospace;
  font-size: 14px;
  transition: all 0.1s;
}

.baud-btn:hover { background: #333; color: #ccc; }

.baud-btn.active {
  background: #1a3a1a;
  color: #33ff33;
  border-color: #33ff33;
  box-shadow: 0 0 6px rgba(51,255,51,0.2);
}

.auto-play-toggle {
  margin-bottom: 8px;
  padding: 0 4px;
}

.auto-play-toggle input[type="checkbox"] {
  accent-color: #33ff33;
}

.block-directory {
  background: #0a0a0a;
  border: 1px solid #333;
  border-radius: 4px;
  padding: 6px;
  max-height: 120px;
  overflow-y: auto;
}

.block-entry {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 3px 6px;
  cursor: pointer;
  border-radius: 3px;
  transition: background 0.1s;
  font-family: 'VT323', monospace;
  font-size: 14px;
}

.block-entry:hover {
  background: rgba(51,255,51,0.08);
}

.block-name {
  color: #33ff33;
  flex: 1;
}

.block-type {
  color: #ffaa00;
  font-size: 12px;
  padding: 1px 6px;
  background: rgba(255,170,0,0.1);
  border: 1px solid rgba(255,170,0,0.3);
  border-radius: 2px;
}

.block-addr {
  color: #888;
  font-size: 12px;
}

@media (max-width: 1024px) {
  .main-layout {
    flex-direction: column !important;
  }
}