:root {
  --bg-primary: #0a0e14;
  --bg-secondary: #0d1117;
  --bg-panel: #111820;
  --bg-gutter: #0c1018;
  --border: #1a2030;
  --border-focus: #2a3545;
  --text-primary: #33ff33;
  --text-dim: #1a8a1a;
  --text-comment: #3a5a3a;
  --text-register: #ffb000;
  --text-number: #ff66aa;
  --text-label: #e0e0e0;
  --text-directive: #66bbff;
  --text-error: #ff3333;
  --text-accent: #00aaff;
  --glow-color: rgba(51, 255, 51, 0.4);
  --scanline-opacity: 0.04;
}

.theme-amber {
  --text-primary: #ffb000;
  --text-dim: #8a6000;
  --text-comment: #5a4a2a;
  --glow-color: rgba(255, 176, 0, 0.4);
}

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

body {
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: 'Fira Code', 'Consolas', 'Monaco', monospace;
  overflow: hidden;
  height: 100vh;
}

.crt-active .crt-screen {
  position: relative;
}

.crt-active .crt-screen::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0,0,0,var(--scanline-opacity)) 2px,
    rgba(0,0,0,var(--scanline-opacity)) 4px
  );
  pointer-events: none;
  z-index: 100;
}

.crt-active .glow-text {
  text-shadow: 0 0 5px var(--glow-color), 0 0 10px var(--glow-color);
}

.code-editor {
  background: transparent;
  color: var(--text-primary);
  font-family: 'Fira Code', monospace;
  font-size: 13px;
  line-height: 1.6;
  border: none;
  outline: none;
  resize: none;
  caret-color: var(--text-primary);
  width: 100%;
  height: 100%;
  padding: 0;
  tab-size: 8;
  -moz-tab-size: 8;
  white-space: pre;
  overflow-wrap: normal;
  overflow-x: auto;
}

.code-editor::placeholder {
  color: var(--text-dim);
  opacity: 0.5;
}

.line-numbers {
  font-family: 'Fira Code', monospace;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-dim);
  text-align: right;
  user-select: none;
  padding-right: 12px;
  min-width: 40px;
}

.syntax-overlay {
  font-family: 'Fira Code', monospace;
  font-size: 13px;
  line-height: 1.6;
  white-space: pre;
  pointer-events: none;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.hex-dump {
  font-family: 'Fira Code', monospace;
  font-size: 12px;
  line-height: 1.7;
}

.hex-addr { color: var(--text-accent); }
.hex-byte { color: var(--text-primary); }
.hex-ascii { color: var(--text-dim); }

.tab-active {
  border-bottom: 2px solid var(--text-accent);
  color: var(--text-accent);
}

.tab-inactive {
  border-bottom: 2px solid transparent;
  color: var(--text-dim);
}

.tab-inactive:hover {
  color: var(--text-primary);
}

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

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

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.fade-in {
  animation: fade-in 0.3s ease-in;
}

.error-line {
  border-left: 3px solid var(--text-error);
  background: rgba(255, 51, 51, 0.08);
}

.scrollbar-thin::-webkit-scrollbar { width: 6px; height: 6px; }
.scrollbar-thin::-webkit-scrollbar-track { background: var(--bg-primary); }
.scrollbar-thin::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
.scrollbar-thin::-webkit-scrollbar-thumb:hover { background: var(--border-focus); }

.toolbar-btn {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-family: 'Fira Code', monospace;
  font-size: 11px;
  padding: 4px 10px;
  cursor: pointer;
  transition: all 0.15s;
}

.toolbar-btn:hover {
  background: var(--border);
  border-color: var(--border-focus);
}

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

select.toolbar-btn {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 20px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%2333ff33'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 6px center;
}

select.toolbar-btn option {
  background: var(--bg-panel);
  color: var(--text-primary);
}

.status-ready { color: #33ff33; }
.status-assembling { color: #ffb000; }
.status-error { color: #ff3333; }

@media (max-width: 768px) {
  .ide-layout {
    flex-direction: column !important;
  }
  .ide-left, .ide-right {
    width: 100% !important;
    height: 50vh !important;
  }
}