:root {
  --oric-orange: #f37021;
  --oric-orange-dark: #c8551a;
  --case: #ddd2bd;
  --case-shadow: #b3a888;
  --bg: #14110c;
  --panel: #1e1a14;
  --text: #e8e0cf;
  --muted: #8c8168;
  --mono: 'JetBrains Mono', monospace;
  --display: 'Bricolage Grotesque', sans-serif;
}

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

body {
  background:
    radial-gradient(circle at 20% 10%, rgba(243,112,33,0.10), transparent 45%),
    radial-gradient(circle at 85% 90%, rgba(243,112,33,0.06), transparent 40%),
    var(--bg);
  color: var(--text);
  font-family: var(--mono);
  min-height: 100vh;
  padding: 16px;
}

#app { max-width: 900px; margin: 0 auto; }

/* Header */
#topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 2px solid var(--oric-orange);
  padding-bottom: 12px;
  margin-bottom: 18px;
  flex-wrap: wrap;
  gap: 10px;
}
.title-wrap { display: flex; flex-direction: column; }
#topbar h1 {
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(28px, 6vw, 46px);
  letter-spacing: 0.12em;
  color: var(--text);
  line-height: 0.9;
  text-shadow: 3px 3px 0 var(--oric-orange-dark);
}
.subtitle { color: var(--oric-orange); font-size: 12px; letter-spacing: 0.18em; margin-top: 4px; text-transform: uppercase; }
.badge {
  font-size: 11px; font-weight: 800; letter-spacing: 0.1em;
  background: var(--oric-orange); color: #1a0e04;
  padding: 5px 10px; border-radius: 3px;
}

/* Drop zone */
.drop-zone {
  border: 2px dashed rgba(243,112,33,0.5);
  border-radius: 8px;
  background: rgba(243,112,33,0.05);
  padding: 16px 18px;
  margin-bottom: 18px;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.drop-zone:hover, .drop-zone.drag-over {
  border-color: var(--oric-orange);
  background: rgba(243,112,33,0.12);
}
.drop-zone strong { font-family: var(--display); font-weight: 700; font-size: 15px; color: var(--oric-orange); }
.drop-zone span { font-size: 12px; color: var(--muted); }
.drop-zone code { color: var(--text); background: rgba(255,255,255,0.06); padding: 1px 5px; border-radius: 3px; }
.drop-zone input[type=file] {
  margin-top: 6px; color: var(--muted); font-size: 11px; font-family: var(--mono);
}
.rom-info { font-size: 11px; color: var(--muted); }
.rom-info.active { color: #7dd97d; }
.note { font-size: 10px; color: var(--muted); font-style: italic; margin-top: 4px; }

/* Screen */
.screen-panel { display: flex; justify-content: center; margin-bottom: 16px; }
.case {
  background: linear-gradient(160deg, var(--case), var(--case-shadow));
  padding: 18px 18px 10px;
  border-radius: 12px;
  box-shadow:
    0 12px 30px rgba(0,0,0,0.6),
    inset 0 2px 4px rgba(255,255,255,0.4),
    inset 0 -4px 8px rgba(0,0,0,0.25);
  max-width: 100%;
}
.bezel {
  background: #050403;
  padding: 10px;
  border-radius: 6px;
  box-shadow: inset 0 0 20px rgba(0,0,0,0.9), inset 0 0 3px rgba(243,112,33,0.4);
}
#canvas {
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  background: #000;
  border-radius: 2px;
  width: 480px; height: 448px; max-width: 100%;
}
.case-strip {
  height: 8px;
  margin-top: 12px;
  background: linear-gradient(90deg, var(--oric-orange-dark), var(--oric-orange), var(--oric-orange-dark));
  border-radius: 3px;
}

/* Controls */
.controls { margin-bottom: 18px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.controls button {
  font-family: var(--mono);
  font-weight: 500;
  font-size: 12px;
  background: var(--panel);
  color: var(--text);
  border: 1px solid rgba(243,112,33,0.35);
  padding: 8px 14px;
  border-radius: 5px;
  cursor: pointer;
  transition: all 0.12s ease;
  letter-spacing: 0.04em;
}
.controls button:hover { background: rgba(243,112,33,0.18); border-color: var(--oric-orange); }
.controls button.on { background: var(--oric-orange); color: #1a0e04; border-color: var(--oric-orange); }
.slider-row { display: flex; align-items: center; gap: 10px; }
.slider-row label { font-size: 11px; color: var(--muted); }
.slider-row input[type=range] { accent-color: var(--oric-orange); flex: 0 0 160px; }
.perf { font-size: 11px; color: var(--oric-orange); margin-left: auto; letter-spacing: 0.05em; }

/* Debug */
.debug {
  background: var(--panel);
  border: 1px solid rgba(243,112,33,0.3);
  border-radius: 8px;
  padding: 14px 16px;
  margin-bottom: 18px;
}
.debug.hidden { display: none; }
.debug h2 { font-family: var(--display); font-weight: 700; font-size: 14px; color: var(--oric-orange); margin-bottom: 10px; letter-spacing: 0.1em; text-transform: uppercase; }
.mono { font-family: var(--mono); font-size: 11px; color: var(--text); margin-bottom: 8px; word-break: break-all; }
.hexctl { display: flex; align-items: center; gap: 8px; margin: 8px 0; }
.hexctl label { font-size: 11px; color: var(--muted); }
.hexctl input {
  background: #0c0a07; color: var(--oric-orange); border: 1px solid rgba(243,112,33,0.3);
  padding: 4px 8px; border-radius: 4px; font-family: var(--mono); width: 90px; font-size: 12px;
}
#hexDump {
  font-family: var(--mono); font-size: 10px; color: var(--muted);
  background: #0c0a07; padding: 10px; border-radius: 5px; overflow-x: auto;
  line-height: 1.5; white-space: pre;
}

/* Footer */
#footer {
  display: flex; justify-content: space-between; align-items: center;
  border-top: 1px solid rgba(243,112,33,0.25);
  padding-top: 12px; margin-top: 8px;
  font-size: 11px; color: var(--muted);
  flex-wrap: wrap; gap: 8px;
}
#footer a { color: var(--oric-orange); text-decoration: none; font-weight: 500; }
#footer a:hover { text-decoration: underline; }

@media (max-width: 520px) {
  #canvas { width: 100%; height: auto; }
  .slider-row input[type=range] { flex: 1; }
  .perf { width: 100%; margin-left: 0; }
}