:root {
  --bg-deep: #0d0f1a;
  --bg-panel: #131629;
  --bg-panel-alt: #171b30;
  --border: #1e2a4a;
  --border-glow: #0f3460;
  --accent-cyan: #00d4ff;
  --accent-green: #00ff88;
  --accent-amber: #ffa500;
  --accent-pink: #ff3366;
  --accent-purple: #a855f7;
  --text-primary: #e2e8f0;
  --text-secondary: #8892b0;
  --text-dim: #4a5568;
}

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

body {
  background: var(--bg-deep);
  color: var(--text-primary);
  font-family: 'IBM Plex Sans', sans-serif;
  overflow: hidden;
  height: 100vh;
}

#root { height: 100vh; display: flex; flex-direction: column; }

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

.code-font { font-family: 'JetBrains Mono', monospace; }

.glow-text { text-shadow: 0 0 10px rgba(0, 212, 255, 0.5), 0 0 20px rgba(0, 212, 255, 0.2); }
.glow-green { text-shadow: 0 0 10px rgba(0, 255, 136, 0.5); }
.glow-pink { text-shadow: 0 0 10px rgba(255, 51, 102, 0.5); }

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

.panel-border:hover { border-color: var(--border-glow); }

.tab-btn {
  padding: 6px 14px;
  font-size: 12px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
  white-space: nowrap;
}

.tab-btn:hover { color: var(--text-primary); }
.tab-btn.active {
  color: var(--accent-cyan);
  border-bottom-color: var(--accent-cyan);
}

.btn-action {
  padding: 6px 14px;
  border: 1px solid var(--border);
  background: var(--bg-panel-alt);
  color: var(--text-primary);
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  font-family: 'IBM Plex Sans', sans-serif;
  transition: all 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.btn-action:hover {
  border-color: var(--accent-cyan);
  background: rgba(0, 212, 255, 0.08);
}

.btn-compile {
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
}
.btn-compile:hover { background: rgba(0, 212, 255, 0.15); }

.btn-run {
  border-color: var(--accent-green);
  color: var(--accent-green);
}
.btn-run:hover { background: rgba(0, 255, 136, 0.15); }

.editor-textarea {
  width: 100%;
  height: 100%;
  background: transparent;
  border: none;
  color: transparent;
  caret-color: var(--accent-cyan);
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  line-height: 1.6;
  resize: none;
  outline: none;
  padding: 12px;
  tab-size: 4;
  white-space: pre;
  overflow: auto;
  position: absolute;
  top: 0;
  left: 0;
  z-index: 2;
}

.editor-highlight {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  padding: 12px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  line-height: 1.6;
  white-space: pre;
  overflow: hidden;
  pointer-events: none;
  z-index: 1;
  color: var(--text-primary);
}

.line-numbers {
  padding: 12px 8px 12px 4px;
  text-align: right;
  color: var(--text-dim);
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  line-height: 1.6;
  user-select: none;
  min-width: 40px;
  border-right: 1px solid var(--border);
}

.token-keyword { color: #c792ea; }
.token-type { color: #00d4ff; }
.token-modifier { color: #ffcb6b; }
.token-storage { color: #f78c6c; }
.token-control { color: #c792ea; }
.token-number { color: #f78c6c; }
.token-string { color: #c3e88d; }
.token-comment { color: #546e7a; font-style: italic; }
.token-operator { color: #89ddff; }
.token-function { color: #82aaff; }
.token-punctuation { color: #89ddff; }
.token-preprocessor { color: #ff9cac; }

.console-output {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  line-height: 1.5;
  padding: 8px 12px;
  overflow-y: auto;
}

.console-line-out { color: var(--accent-green); }
.console-line-err { color: var(--accent-pink); }
.console-line-warn { color: var(--accent-amber); }
.console-line-info { color: var(--accent-cyan); }
.console-line-system { color: var(--text-dim); }

.ast-node {
  padding-left: 16px;
  border-left: 1px solid var(--border);
  margin-left: 4px;
}

.ast-label {
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: background 0.15s;
}

.ast-label:hover { background: rgba(0, 212, 255, 0.1); }

.ast-decl { color: #82aaff; }
.ast-expr { color: #00ff88; }
.ast-stmt { color: #c792ea; }
.ast-type { color: #f78c6c; }

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

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

.berry-spin { animation: spin-berry 0.8s linear infinite; }

@keyframes pipeline-flow {
  0% { width: 0%; }
  100% { width: 100%; }
}

.pipeline-bar {
  height: 2px;
  background: linear-gradient(90deg, var(--accent-cyan), var(--accent-green), var(--accent-cyan));
  animation: pipeline-flow 1.5s ease-out;
}

@keyframes confetti-fall {
  0% { transform: translateY(-10px) rotate(0deg); opacity: 1; }
  100% { transform: translateY(40px) rotate(720deg); opacity: 0; }
}

.confetti-particle {
  position: absolute;
  width: 4px;
  height: 4px;
  animation: confetti-fall 1.2s ease-out forwards;
}

.keyword-badge {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 11px;
  font-family: 'JetBrains Mono', monospace;
  cursor: pointer;
  transition: all 0.15s;
}

.keyword-badge:hover { transform: scale(1.05); }
.keyword-badge.in-code { box-shadow: 0 0 8px rgba(0, 212, 255, 0.3); }

.hex-dump { font-size: 11px; line-height: 1.4; }
.hex-section { color: var(--text-dim); }
.hex-byte { color: var(--text-primary); }
.hex-label { color: var(--accent-cyan); font-weight: 600; }

.symbol-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.symbol-table th {
  text-align: left;
  padding: 4px 8px;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
  font-weight: 500;
}
.symbol-table td {
  padding: 3px 8px;
  border-bottom: 1px solid rgba(30, 42, 74, 0.4);
}

.scope-global { color: #ffd700; }
.scope-local { color: #c0c0c0; }
.scope-param { color: #cd7f32; }

.resize-handle {
  cursor: col-resize;
  width: 4px;
  background: var(--border);
  transition: background 0.15s;
  flex-shrink: 0;
}
.resize-handle:hover, .resize-handle.active {
  background: var(--accent-cyan);
}
.resize-handle-h {
  cursor: row-resize;
  height: 4px;
  background: var(--border);
  transition: background 0.15s;
  flex-shrink: 0;
}
.resize-handle-h:hover, .resize-handle-h.active {
  background: var(--accent-cyan);
}

.settings-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.6);
}

.settings-content {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 24px;
  max-width: 480px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
}

.select-dropdown {
  background: var(--bg-panel-alt);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-family: 'IBM Plex Sans', sans-serif;
  outline: none;
}
.select-dropdown:focus { border-color: var(--accent-cyan); }

@media (max-width: 768px) {
  .desktop-only { display: none !important; }
  .mobile-fab {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--accent-cyan);
    color: var(--bg-deep);
    border: none;
    font-size: 24px;
    cursor: pointer;
    z-index: 50;
    box-shadow: 0 4px 12px rgba(0, 212, 255, 0.3);
  }
}