:root {
  --bg: #0a0a0a;
  --bg2: #111118;
  --bg3: #1a1a2e;
  --fg: #33ff33;
  --fg-dim: #1a8a1a;
  --amber: #ffb000;
  --amber-dim: #8a6000;
  --red: #ff3333;
  --blue: #33aaff;
  --white: #e0e0e0;
  --border: #2a2a3e;
  --border-light: #3a3a5e;
  --panel-bg: #0d0d14;
  --glow: 0 0 8px rgba(51, 255, 51, 0.3);
  --glow-amber: 0 0 8px rgba(255, 176, 0, 0.3);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body, #root { height: 100%; width: 100%; }

body {
  background: var(--bg);
  color: var(--fg);
  font-family: 'IBM Plex Mono', 'Courier New', monospace;
  font-size: 12px;
  overflow: hidden;
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg2); }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 3px; }

.crt-scanlines {
  position: relative;
}
.crt-scanlines::after {
  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: 2;
}

.monitor-bezel {
  border-radius: 12px;
  border: 3px solid #333;
  box-shadow: inset 0 0 30px rgba(0,0,0,0.8), 0 0 15px rgba(0,0,0,0.5);
  background: #000;
  overflow: hidden;
}

.panel {
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: 4px;
}

.panel-header {
  background: var(--bg3);
  border-bottom: 1px solid var(--border);
  padding: 4px 8px;
  font-weight: 600;
  font-size: 11px;
  color: var(--amber);
  text-shadow: var(--glow-amber);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.glow-text {
  text-shadow: var(--glow);
}

.glow-amber {
  text-shadow: var(--glow-amber);
}

.reg-changed {
  animation: regFlash 0.5s ease-out;
}

@keyframes regFlash {
  0% { color: #ffff00; text-shadow: 0 0 10px #ffff00; }
  100% { color: var(--fg); text-shadow: var(--glow); }
}

.btn {
  background: var(--bg3);
  border: 1px solid var(--border-light);
  color: var(--fg);
  padding: 4px 10px;
  border-radius: 3px;
  cursor: pointer;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  transition: all 0.15s;
  white-space: nowrap;
  min-height: 28px;
}
.btn:hover {
  background: var(--border);
  border-color: var(--fg-dim);
}
.btn:active {
  transform: scale(0.97);
}
.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.btn-primary {
  background: #1a3a1a;
  border-color: var(--fg-dim);
  color: var(--fg);
}
.btn-danger {
  background: #3a1a1a;
  border-color: #883333;
  color: var(--red);
}

.status-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
}

.tab-active {
  border-bottom: 2px solid var(--fg);
  color: var(--fg);
  background: transparent;
}
.tab-inactive {
  border-bottom: 2px solid transparent;
  color: var(--fg-dim);
  cursor: pointer;
  background: transparent;
}
.tab-inactive:hover {
  color: var(--fg);
}

.flag-on {
  color: var(--fg);
  text-shadow: var(--glow);
  cursor: pointer;
  user-select: none;
}
.flag-off {
  color: #333;
  cursor: pointer;
  user-select: none;
}
.flag-on:hover, .flag-off:hover {
  text-decoration: underline;
}

.drop-zone {
  border: 2px dashed var(--border-light);
  border-radius: 8px;
  padding: 20px;
  text-align: center;
  transition: all 0.2s;
}
.drop-zone.drag-over {
  border-color: var(--fg);
  background: rgba(51,255,51,0.05);
}

input[type="text"], input[type="number"], select {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--fg);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 2px;
  min-height: 24px;
}
input:focus, select:focus {
  outline: none;
  border-color: var(--fg-dim);
}

input[type="range"] {
  accent-color: var(--fg);
}

.disk-cell {
  width: 5px;
  height: 5px;
  display: inline-block;
  margin: 0;
}
.disk-unread { background: #222; }
.disk-read { background: #2a8a2a; }
.disk-error { background: #8a2a2a; }
.disk-active { background: var(--blue); }

/* Desktop: 3-column layout */
.main-grid {
  display: grid;
  grid-template-columns: 220px 1fr 240px;
  gap: 1px;
  background: var(--bg3);
}

/* Tablet: 2-column */
@media (max-width: 1024px) {
  .main-grid {
    grid-template-columns: 200px 1fr !important;
  }
  .right-panel {
    grid-column: 1 / -1;
  }
}

/* Mobile: single column with tabs */
@media (max-width: 768px) {
  .main-grid {
    grid-template-columns: 1fr !important;
    grid-template-rows: auto;
  }
  .mobile-hide {
    display: none !important;
  }
  .mobile-show {
    display: block !important;
  }
  .top-bar {
    flex-direction: column;
    gap: 4px;
    align-items: flex-start !important;
  }
  .control-bar {
    flex-wrap: wrap;
    gap: 4px !important;
  }
  .control-bar .separator {
    display: none;
  }
  .footer-bar {
    flex-direction: column;
    gap: 2px;
    text-align: center;
  }
}

/* Hex view responsive */
.hex-row {
  display: flex;
  gap: 4px;
  white-space: nowrap;
}
.hex-addr {
  color: var(--amber-dim);
  width: 80px;
  flex-shrink: 0;
}
.hex-bytes {
  opacity: 0.7;
  flex-shrink: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.hex-ascii {
  color: var(--blue);
  flex-shrink: 0;
}

@media (max-width: 768px) {
  .hex-ascii {
    display: none;
  }
  .hex-bytes {
    font-size: 10px;
  }
}