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

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

body {
  background: #111;
  color: #33ff33;
  font-family: 'VT323', 'Courier New', monospace;
  overflow-x: hidden;
  min-height: 100vh;
}

/* CRT Terminal */
.crt-terminal {
  background: #0a0a0a;
  border: 12px solid #222;
  border-radius: 16px;
  position: relative;
  overflow: hidden;
  box-shadow:
    inset 0 0 60px rgba(0,0,0,0.8),
    0 0 20px rgba(51, 255, 51, 0.05),
    0 4px 20px rgba(0,0,0,0.6);
}

.crt-terminal::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: 2;
}

.crt-terminal::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: 3;
}

.terminal-text {
  font-family: 'VT323', monospace;
  font-size: 20px;
  line-height: 1.2;
  color: #33ff33;
  text-shadow: 0 0 5px rgba(51, 255, 51, 0.6), 0 0 10px rgba(51, 255, 51, 0.3);
  white-space: pre;
  position: relative;
  z-index: 1;
}

.cursor-blink {
  animation: blink 1s step-end infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* Keyboard */
.kb-key {
  background: linear-gradient(180deg, #f5f0e0 0%, #e8e0cc 100%);
  color: #333;
  border: 1px solid #bbb;
  border-bottom: 3px solid #999;
  border-radius: 4px;
  font-family: 'VT323', monospace;
  font-size: 16px;
  cursor: pointer;
  user-select: none;
  transition: all 0.05s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 4px 8px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.kb-key:hover {
  background: linear-gradient(180deg, #e8e0cc 0%, #d8d0bc 100%);
}

.kb-key:active, .kb-key.pressed {
  transform: translateY(2px);
  border-bottom-width: 1px;
  box-shadow: 0 0 2px rgba(0,0,0,0.3);
  background: linear-gradient(180deg, #d8d0bc 0%, #ccc4aa 100%);
}

.kb-key.active-modifier {
  background: linear-gradient(180deg, #b0a888 0%, #a09878 100%);
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.3);
  border-bottom-width: 1px;
  transform: translateY(1px);
}

/* Control buttons */
.ctrl-btn {
  background: #2a2a2a;
  color: #33ff33;
  border: 1px solid #444;
  border-radius: 4px;
  font-family: 'VT323', monospace;
  font-size: 16px;
  padding: 6px 14px;
  cursor: pointer;
  transition: all 0.1s;
}

.ctrl-btn:hover {
  background: #3a3a3a;
  border-color: #33ff33;
}

.ctrl-btn:active {
  background: #1a1a1a;
}

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

/* File input styling */
.rom-upload-btn {
  background: #2a2a2a;
  color: #ffb000;
  border: 1px dashed #555;
  border-radius: 4px;
  font-family: 'VT323', monospace;
  font-size: 14px;
  padding: 6px 12px;
  cursor: pointer;
  transition: all 0.1s;
}

.rom-upload-btn:hover {
  border-color: #ffb000;
  background: #332a00;
}

.rom-loaded {
  border-color: #33ff33;
  border-style: solid;
}

/* Memory inspector */
.mem-cell {
  font-family: 'VT323', monospace;
  font-size: 14px;
  padding: 1px 3px;
}

.mem-ram { background: rgba(100, 149, 237, 0.1); }
.mem-io { background: rgba(255, 176, 0, 0.15); }
.mem-basic { background: rgba(51, 255, 51, 0.1); }
.mem-wozmon { background: rgba(255, 100, 100, 0.1); }

/* Scrollbar */
.terminal-scroll::-webkit-scrollbar {
  width: 6px;
}
.terminal-scroll::-webkit-scrollbar-track {
  background: #0a0a0a;
}
.terminal-scroll::-webkit-scrollbar-thumb {
  background: #1a3a1a;
  border-radius: 3px;
}

/* Status bar */
.status-text {
  font-family: 'VT323', monospace;
  color: #ffb000;
  font-size: 14px;
}

/* Help modal */
.help-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.85);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
}

.help-modal {
  background: #1a1a1a;
  border: 2px solid #33ff33;
  border-radius: 8px;
  padding: 24px;
  max-width: 500px;
  width: 90%;
  color: #33ff33;
  font-family: 'VT323', monospace;
  box-shadow: 0 0 40px rgba(51,255,51,0.15);
}

@media (max-width: 768px) {
  .terminal-text {
    font-size: 14px;
  }
  .kb-key {
    font-size: 12px;
    min-height: 36px;
    padding: 2px 4px;
  }
  .crt-terminal {
    border-width: 6px;
    border-radius: 8px;
  }
}