:root {
  --bg-deep: #0a0a1a;
  --bg-panel: #111127;
  --bg-card: #181838;
  --border: #2a2a5a;
  --green: #00ff41;
  --green-dim: #00aa2a;
  --amber: #ffaa00;
  --red: #ff3333;
  --blue: #4488ff;
  --orange: #ff8844;
  --text: #c8c8e0;
  --text-dim: #666688;
  --tandy-red: #cc2222;
}

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

body {
  background: var(--bg-deep);
  color: var(--text);
  font-family: 'IBM Plex Mono', monospace;
  overflow-x: hidden;
  min-height: 100vh;
}

.pixel-font {
  font-family: 'Press Start 2P', monospace;
}

/* CRT Monitor */
.crt-monitor {
  background: linear-gradient(145deg, #2a2a3a 0%, #1a1a2a 50%, #0f0f1f 100%);
  border-radius: 16px;
  padding: 12px;
  box-shadow:
    0 0 0 2px #3a3a5a,
    0 0 0 4px #1a1a2a,
    0 0 30px rgba(0, 255, 65, 0.05),
    inset 0 0 60px rgba(0, 0, 0, 0.5);
  position: relative;
}

.crt-screen {
  position: relative;
  border-radius: 6px;
  overflow: hidden;
  background: #000;
}

.crt-screen canvas {
  display: block;
  width: 100%;
  image-rendering: pixelated;
}

.scanlines {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 1px,
    rgba(0, 0, 0, 0.15) 1px,
    rgba(0, 0, 0, 0.15) 2px
  );
  z-index: 2;
}

.crt-glow {
  position: absolute;
  top: -2px; left: -2px; right: -2px; bottom: -2px;
  border-radius: 8px;
  pointer-events: none;
  box-shadow: inset 0 0 80px rgba(0, 255, 65, 0.04);
  z-index: 3;
}

.phosphor-glow {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at center, rgba(0, 255, 65, 0.02) 0%, transparent 70%);
  z-index: 1;
}

/* Panel */
.panel {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}

.panel-header {
  background: linear-gradient(180deg, #1e1e40 0%, #161630 100%);
  padding: 6px 10px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  user-select: none;
}

.panel-body {
  padding: 8px;
  font-size: 12px;
}

.reg-val {
  font-family: 'IBM Plex Mono', monospace;
  font-weight: 600;
  transition: color 0.15s, background 0.15s;
}

.reg-changed {
  color: #ffff00 !important;
  background: rgba(255, 255, 0, 0.1);
  border-radius: 2px;
}

.flag-bit {
  display: inline-block;
  width: 18px;
  height: 18px;
  line-height: 18px;
  text-align: center;
  font-size: 10px;
  font-weight: 700;
  border-radius: 2px;
  margin: 0 1px;
}

.flag-active {
  background: var(--green);
  color: #000;
}

.flag-inactive {
  background: #222244;
  color: #444466;
}

.hex-row {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  line-height: 1.6;
  white-space: nowrap;
}

.hex-addr { color: var(--blue); }

.hex-byte { cursor: pointer; }
.hex-byte:hover {
  background: rgba(68, 136, 255, 0.2);
  border-radius: 2px;
}

.hex-ascii { color: var(--text-dim); }

.disasm-line {
  font-size: 11px;
  padding: 1px 4px;
  font-family: 'IBM Plex Mono', monospace;
  cursor: pointer;
  border-left: 3px solid transparent;
  white-space: nowrap;
}

.disasm-current {
  background: rgba(0, 255, 65, 0.1);
  border-left-color: var(--green);
}

.disasm-breakpoint {
  border-left-color: var(--red);
}

.power-led {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.led-on {
  background: var(--green);
  box-shadow: 0 0 6px var(--green), 0 0 12px var(--green);
}

.led-off { background: #333; }

.led-halt {
  background: var(--red);
  box-shadow: 0 0 6px var(--red);
}

.emu-btn {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  font-weight: 600;
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg-card);
  color: var(--text);
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
  min-height: 34px;
  min-width: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.emu-btn:hover {
  background: #222250;
  border-color: #4444aa;
}

.emu-btn:active { transform: scale(0.97); }

.emu-btn-power {
  background: linear-gradient(180deg, #2a1a1a, #1a0a0a);
  border-color: #aa3333;
  color: var(--red);
  padding: 6px 14px;
  font-size: 13px;
  min-height: 38px;
}

.emu-btn-power:hover {
  background: linear-gradient(180deg, #3a2020, #2a1010);
}

.emu-btn-power.active {
  background: linear-gradient(180deg, #1a3a1a, #0a2a0a);
  border-color: #33aa33;
  color: var(--green);
}

.upload-zone {
  border: 2px dashed var(--border);
  border-radius: 8px;
  padding: 16px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
}

.upload-zone:hover {
  border-color: var(--blue);
  background: rgba(68, 136, 255, 0.05);
}

.cassette-deck {
  background: linear-gradient(180deg, #3a3028 0%, #2a2018 100%);
  border: 2px solid #5a4a38;
  border-radius: 8px;
  padding: 12px;
}

.cassette-reel {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 3px solid #8a7a68;
  background: #1a1008;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cassette-reel.spinning {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.drive-led {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #333;
}

.drive-led.active {
  background: #00ff00;
  box-shadow: 0 0 4px #00ff00;
}

.vkb-key {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 28px;
  background: linear-gradient(180deg, #d0c0a0, #b0a080);
  color: #1a1a1a;
  font-size: 9px;
  font-weight: 700;
  border: 1px solid #8a7a5a;
  border-radius: 3px;
  margin: 1px;
  cursor: pointer;
  box-shadow: 0 2px 0 #6a5a3a;
  font-family: 'IBM Plex Mono', monospace;
}

.vkb-key:active {
  transform: translateY(2px);
  box-shadow: 0 0 0 #6a5a3a;
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-deep); }
::-webkit-scrollbar-thumb { background: #333366; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #444488; }

.collapse-icon {
  transition: transform 0.2s;
  display: inline-block;
  font-size: 10px;
}

.collapse-icon.open { transform: rotate(90deg); }

.hex-input {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  background: #0a0a1a;
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--green);
  padding: 3px 6px;
  width: 70px;
}

.hex-input:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 4px rgba(0, 255, 65, 0.2);
}

.mmu-slot {
  font-size: 10px;
  padding: 3px 4px;
  border: 1px solid var(--border);
  border-radius: 3px;
  text-align: center;
  background: var(--bg-card);
}

.mmu-slot.rom {
  border-color: var(--red);
  background: rgba(255, 51, 51, 0.1);
}

.vector-entry {
  font-size: 11px;
  padding: 2px 6px;
  display: flex;
  justify-content: space-between;
}

.vector-entry:nth-child(odd) {
  background: rgba(255, 255, 255, 0.02);
}

.io-pia { color: var(--green); }
.io-gime { color: var(--blue); }
.io-mmu { color: var(--orange); }
.io-vector { color: var(--red); }

.welcome-overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.95);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  border-radius: 6px;
}

.app-footer {
  text-align: center;
  padding: 12px;
  font-size: 11px;
  color: var(--text-dim);
  border-top: 1px solid var(--border);
  margin-top: 8px;
}

.app-footer a {
  color: var(--green);
  text-decoration: none;
}

.app-footer a:hover { text-decoration: underline; }

input[type="range"] {
  -webkit-appearance: none;
  height: 4px;
  background: #333366;
  border-radius: 2px;
  outline: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  background: var(--green);
  border-radius: 50%;
  cursor: pointer;
}

.tab-btn {
  padding: 6px 12px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: transparent;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  font-family: 'IBM Plex Mono', monospace;
  min-height: 36px;
}

.tab-btn.active {
  color: var(--green);
  border-bottom-color: var(--green);
}

.file-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 8px;
  margin-bottom: 4px;
}

.file-status-ready { color: var(--amber); }
.file-status-loaded { color: var(--green); }
.file-status-error { color: var(--red); }

/* ===== MOBILE NAV TABS ===== */
.mobile-section-tabs {
  display: none;
}

/* ===== RESPONSIVE ===== */

/* Desktop: 3-column layout */
@media (min-width: 1024px) {
  .layout-wrapper {
    display: flex;
    gap: 8px;
    padding: 8px;
    flex: 1;
    min-height: 0;
    overflow: hidden;
  }
  .left-sidebar {
    width: 260px;
    min-width: 260px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
  }
  .center-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
  }
  .right-sidebar {
    width: 280px;
    min-width: 280px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
  }
}

/* Tablet: 2-column + scrollable */
@media (min-width: 640px) and (max-width: 1023px) {
  .layout-wrapper {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 8px;
    flex: 1;
  }
  .left-sidebar {
    display: none;
  }
  .right-sidebar {
    display: none;
  }
  .left-sidebar.mobile-visible,
  .right-sidebar.mobile-visible {
    display: flex;
    flex-direction: column;
    gap: 8px;
  }
  .center-main {
    display: flex;
    flex-direction: column;
    gap: 8px;
  }
  .mobile-section-tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

/* Mobile: single column with section tabs */
@media (max-width: 639px) {
  .layout-wrapper {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 6px;
    flex: 1;
  }
  .left-sidebar {
    display: none;
  }
  .right-sidebar {
    display: none;
  }
  .left-sidebar.mobile-visible,
  .right-sidebar.mobile-visible {
    display: flex;
    flex-direction: column;
    gap: 8px;
  }
  .center-main {
    display: flex;
    flex-direction: column;
    gap: 6px;
  }
  .mobile-section-tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .crt-monitor {
    padding: 6px;
    border-radius: 10px;
  }
  .hex-row {
    font-size: 9px;
  }
  .disasm-line {
    font-size: 10px;
  }
  .emu-btn {
    font-size: 11px;
    padding: 4px 8px;
  }
  .emu-btn-power {
    font-size: 12px;
    padding: 5px 12px;
  }
}