@import url('https://fonts.googleapis.com/css2?family=VT323&display=swap');

:root {
  --green: #33ff33;
  --dim-green: #1a8c1a;
  --dark-green: #0d440d;
  --amber: #ffaa00;
  --bg: #0a0a0a;
  --wood-light: #A0824A;
  --wood-dark: #8B6914;
  --crt-glow: 0 0 10px rgba(51, 255, 51, 0.3), 0 0 20px rgba(51, 255, 51, 0.1);
}

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

body {
  background: #050505;
  color: var(--green);
  font-family: 'VT323', monospace;
  overflow-x: hidden;
  min-height: 100vh;
}

/* CRT Scanline overlay */
.crt-overlay {
  pointer-events: none;
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    rgba(0,0,0,0) 0px,
    rgba(0,0,0,0) 1px,
    rgba(0,0,0,0.15) 1px,
    rgba(0,0,0,0.15) 2px
  );
  z-index: 10;
}

/* CRT flicker */
@keyframes flicker {
  0% { opacity: 1; }
  92% { opacity: 1; }
  93% { opacity: 0.95; }
  94% { opacity: 1; }
  97% { opacity: 0.97; }
  98% { opacity: 1; }
}

.crt-screen {
  animation: flicker 4s infinite;
  position: relative;
  background: var(--bg);
  border-radius: 12px;
  box-shadow:
    inset 0 0 60px rgba(0,0,0,0.8),
    0 0 20px rgba(51,255,51,0.15),
    0 0 60px rgba(51,255,51,0.05);
}

/* Cursor blink */
@keyframes blink {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0; }
}

.cursor-blink {
  animation: blink 1s step-end infinite;
  color: var(--green);
  text-shadow: var(--crt-glow);
}

/* Green glow text */
.glow-text {
  text-shadow: 0 0 5px rgba(51,255,51,0.5), 0 0 10px rgba(51,255,51,0.2);
}

/* Wood grain */
.wood-frame {
  background: linear-gradient(
    135deg,
    #6B4E1B 0%,
    #8B6914 15%,
    #A0824A 30%,
    #8B6914 45%,
    #6B4E1B 60%,
    #8B6914 75%,
    #A0824A 90%,
    #8B6914 100%
  );
  position: relative;
}

.wood-frame::after {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    90deg,
    rgba(0,0,0,0.03) 0px,
    transparent 2px,
    transparent 8px,
    rgba(0,0,0,0.03) 10px
  );
  pointer-events: none;
}

/* Terminal text */
.terminal-text {
  font-family: 'VT323', monospace;
  font-size: 18px;
  line-height: 1.3;
  color: var(--green);
  text-shadow: 0 0 5px rgba(51,255,51,0.4);
}

/* Register LED */
.led-on {
  background: var(--green);
  box-shadow: 0 0 6px var(--green), 0 0 12px rgba(51,255,51,0.4);
}

.led-off {
  background: #1a2a1a;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.5);
}

/* Physical button styles */
.physical-btn {
  background: linear-gradient(180deg, #444 0%, #222 100%);
  border: 1px solid #555;
  border-bottom: 3px solid #111;
  color: #ccc;
  font-family: 'VT323', monospace;
  cursor: pointer;
  transition: all 0.1s;
}

.physical-btn:hover {
  background: linear-gradient(180deg, #555 0%, #333 100%);
}

.physical-btn:active {
  border-bottom: 1px solid #111;
  transform: translateY(2px);
}

.physical-btn-red {
  background: linear-gradient(180deg, #cc2222 0%, #881111 100%);
  border: 1px solid #dd3333;
  border-bottom: 3px solid #550000;
  color: #fff;
}

.physical-btn-red:hover {
  background: linear-gradient(180deg, #dd3333 0%, #992222 100%);
}

/* Toggle switch */
.toggle-switch {
  position: relative;
  display: inline-block;
  cursor: pointer;
  padding: 6px 16px;
  font-family: 'VT323', monospace;
  font-size: 16px;
  color: #888;
  border: 1px solid #444;
  background: #1a1a1a;
  transition: all 0.2s;
}

.toggle-switch.active {
  color: var(--green);
  background: #0a1a0a;
  border-color: var(--dim-green);
  box-shadow: 0 0 8px rgba(51,255,51,0.2);
}

/* Scrollbar */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: #111; }
::-webkit-scrollbar-thumb { background: var(--dim-green); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--green); }

/* ROM Guide colors */
.rom-input { color: #33ff33; }
.rom-parse { color: #4488ff; }
.rom-store { color: #ffcc00; }
.rom-examine { color: #ff4444; }
.rom-output { color: #cc66ff; }
.rom-hexprint { color: #ff8800; }

/* Hex viewer byte hover */
.hex-byte {
  cursor: pointer;
  padding: 1px 2px;
  border-radius: 2px;
  transition: background 0.15s;
}

.hex-byte:hover {
  background: rgba(51,255,51,0.2);
}

/* Register flash animation */
@keyframes regflash {
  0% { color: #ffffff; text-shadow: 0 0 10px #fff; }
  100% { color: var(--green); text-shadow: 0 0 5px rgba(51,255,51,0.4); }
}

.reg-flash {
  animation: regflash 0.5s ease-out;
}

/* Tooltip */
.hex-tooltip {
  position: fixed;
  background: #1a1a1a;
  border: 1px solid var(--dim-green);
  padding: 8px 12px;
  border-radius: 4px;
  font-size: 14px;
  z-index: 1000;
  pointer-events: none;
  max-width: 280px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.8);
}

/* ROM guide row */
.rom-row {
  cursor: pointer;
  transition: background 0.15s;
  border-left: 3px solid transparent;
}

.rom-row:hover {
  background: rgba(51,255,51,0.05);
}

/* Mobile notice */
@media (max-width: 768px) {
  .terminal-text { font-size: 14px; }
  .sidebar-panel { display: none; }
}

/* Flowchart */
.flow-box {
  border: 1px solid;
  padding: 8px 12px;
  border-radius: 4px;
  font-size: 14px;
  text-align: center;
  min-width: 100px;
}

.flow-arrow {
  color: var(--dim-green);
  font-size: 20px;
}