:root {
  --wb-blue: #0055aa;
  --wb-blue2: #005a8c;
  --wb-gray: #a0a0a0;
  --wb-lite: #d8d8d8;
  --wb-dark: #4a4a4a;
  --wb-black: #000000;
  --wb-orange: #ff8a00;
  --amber: #ffb000;
  --green: #34ff6a;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  background:
    radial-gradient(circle at 20% 10%, #1a2540 0%, transparent 50%),
    radial-gradient(circle at 80% 90%, #2a1a3a 0%, transparent 50%),
    #0c0f1a;
  min-height: 100vh;
  font-family: 'IBM Plex Mono', monospace;
  color: #e8e8e8;
}

.app-root {
  max-width: 1100px;
  margin: 0 auto;
  padding: 14px;
}

/* --- Title bar (Workbench chrome) --- */
.titlebar {
  display: flex; justify-content: space-between; align-items: center;
  background: linear-gradient(#e8e8e8, #b8b8b8);
  border: 2px solid;
  border-color: #ffffff #606060 #606060 #ffffff;
  border-radius: 3px;
  padding: 6px 12px;
  color: #111;
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}
.titlebar-left { display: flex; flex-direction: column; }
.tb-title {
  font-family: 'VT323', monospace;
  font-size: 30px; line-height: 0.9;
  color: var(--wb-blue);
  letter-spacing: 1px;
  text-shadow: 1px 1px 0 rgba(255,255,255,0.6);
}
.tb-sub { font-size: 11px; color: #555; letter-spacing: 1px; }
.titlebar-right { display: flex; align-items: center; gap: 10px; }
.status-chip {
  font-family: 'VT323', monospace; font-size: 18px;
  background: #111; color: var(--green);
  padding: 2px 10px; border-radius: 3px;
  border: 1px solid #000;
  min-width: 90px; text-align: center;
}
.cyc { font-size: 12px; color: #333; }

.led {
  display: inline-block; width: 10px; height: 10px; border-radius: 50%;
  border: 1px solid #000;
}

/* --- Layout --- */
.main-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  margin-top: 14px;
}
@media (min-width: 900px) {
  .main-grid { grid-template-columns: minmax(0,1fr) 320px; align-items: start; }
}

/* --- CRT monitor --- */
.crt-bezel {
  background: linear-gradient(#d9cfb8, #b8ac90);
  border-radius: 18px;
  padding: 22px;
  border: 2px solid;
  border-color: #efe8d5 #8a7f66 #8a7f66 #efe8d5;
  box-shadow: 0 10px 40px rgba(0,0,0,0.6), inset 0 0 0 3px #c8bda2;
}
.crt-inner {
  position: relative;
  background: #000;
  border-radius: 10px / 14px;
  overflow: hidden;
  border: 3px solid #1a1a1a;
  aspect-ratio: 320 / 256;
}
.crt-canvas {
  width: 100%; height: 100%;
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  cursor: crosshair;
  filter: saturate(1.1);
}
.crt-inner.scan::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(rgba(0,0,0,0) 0px, rgba(0,0,0,0.25) 2px, rgba(0,0,0,0) 3px);
  border-radius: inherit;
}
.crt-inner::before {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  border-radius: inherit;
  box-shadow: inset 0 0 60px rgba(0,0,0,0.7);
  z-index: 2;
}

.insert-prompt {
  position: absolute; inset: 0; z-index: 3;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-family: 'VT323', monospace; font-size: 22px; color: #cfd8ff;
  gap: 12px; text-align: center; pointer-events: none;
}
.floppy-hand {
  font-size: 40px; color: #fff;
  animation: bob 1.1s ease-in-out infinite;
}
@keyframes bob { 0%,100% { transform: translateY(0) } 50% { transform: translateY(-8px) } }

.guru-overlay {
  position: absolute; inset: 0; z-index: 4;
  display: flex; align-items: flex-start; justify-content: center;
  padding-top: 6%;
  pointer-events: none;
}
.guru-box {
  border: 3px solid #ff2020;
  background: #000;
  color: #ff2020;
  font-family: 'VT323', monospace;
  font-size: 15px;
  padding: 8px 12px;
  width: 88%;
  text-align: center;
  animation: guruBlink 0.8s steps(2) infinite;
}
@keyframes guruBlink { 0%,100% { border-color: #ff2020; color: #ff2020 } 50% { border-color: #000; color: #000 } }

/* --- Bevel panels --- */
.bevel {
  border-radius: 4px; border: 2px solid;
}
.bevel-out { border-color: #d8d8d8 #505050 #505050 #d8d8d8; background: var(--wb-gray); }
.bevel-in { border-color: #505050 #d8d8d8 #d8d8d8 #505050; }

.control-panel {
  margin-top: 14px; padding: 12px;
  color: #111;
}
.ctrl-row {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  margin-bottom: 10px;
}
.ctrl-row:last-child { margin-bottom: 0; }

.file-btn, .amiga-btn {
  font-family: 'IBM Plex Mono', monospace; font-weight: 600;
  font-size: 13px;
  background: linear-gradient(#f0f0f0, #c8c8c8);
  border: 2px solid; border-color: #fff #606060 #606060 #fff;
  border-radius: 3px;
  padding: 8px 12px; color: #111; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
  user-select: none;
}
.file-btn:active, .amiga-btn:active {
  border-color: #606060 #fff #fff #606060;
  background: linear-gradient(#c8c8c8, #f0f0f0);
}
.amiga-btn-active { background: linear-gradient(var(--wb-blue), var(--wb-blue2)); color: #fff; border-color: #4a9 #024 #024 #4a9; }
.amiga-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.slider-row { gap: 10px; }
.lbl { font-size: 12px; font-weight: 600; }
.slider { flex: 1; min-width: 120px; accent-color: var(--wb-blue); }
.clk-val { font-family: 'VT323', monospace; font-size: 18px; min-width: 68px; color: var(--wb-blue); }
.chk { font-size: 12px; display: flex; align-items: center; gap: 4px; }

.rom-info { font-size: 12px; margin-top: 6px; color: #222; word-break: break-all; }
.rom-info b { color: var(--wb-blue); }

/* --- Debug column --- */
.debug-col {
  padding: 12px; background: #101418; color: var(--green);
  border-color: #444 #000 #000 #444;
  font-size: 12px;
  border-radius: 4px;
}
.debug-title {
  font-family: 'VT323', monospace; font-size: 22px; color: var(--amber);
  margin-bottom: 10px; border-bottom: 1px solid #333; padding-bottom: 4px;
}
.debug-subtitle { color: var(--amber); margin: 12px 0 4px; font-size: 11px; text-transform: uppercase; letter-spacing: 1px; }
.reg-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 2px 12px;
}
.reg { display: flex; justify-content: space-between; }
.reg-name { color: #6cf; }
.reg-val { color: var(--green); }
.sr-row { display: flex; gap: 14px; margin-top: 8px; align-items: center; flex-wrap: wrap; }
.flags { display: flex; gap: 4px; }
.flag {
  width: 18px; height: 18px; display: flex; align-items: center; justify-content: center;
  border: 1px solid #333; border-radius: 2px; color: #555; font-size: 10px;
}
.flag.on { color: #000; background: var(--amber); border-color: var(--amber); font-weight: 700; }
.mouse-info { color: #9cf; }
.exec-log {
  background: #000; border: 1px solid #333; border-radius: 2px;
  padding: 4px; max-height: 150px; overflow-y: auto;
  font-size: 10px; line-height: 1.4;
}
.log-line { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.log-line.dim { color: #555; }
.mm-row { display: flex; gap: 8px; padding: 2px 0; cursor: help; }
.mm-addr { color: var(--amber); }
.mm-name { color: #ccc; }

.footer {
  margin-top: 18px; text-align: center; font-size: 12px; color: #7a8199;
}
.footer a { color: var(--wb-orange); text-decoration: none; }
.footer a:hover { text-decoration: underline; }

@media (max-width: 500px) {
  .tb-title { font-size: 22px; }
  .titlebar-right { flex-direction: column; align-items: flex-end; gap: 3px; }
  .cyc { display: none; }
}