:root {
  --bg: #080b14;
  --panel: #111726;
  --panel2: #0d1220;
  --line: #253048;
  --text: #dfe7f7;
  --muted: #8ea0c4;
  --amber: #ffc447;
  --green: #58e08b;
  --red: #ff7a6e;
  --blue: #6fa8ff;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", "Trebuchet MS", sans-serif;
  -webkit-text-size-adjust: 100%;
}

#app { max-width: 980px; margin: 0 auto; padding: 10px 10px 40px; }

/* ---- status bar: the things a console always shows ---- */
#bar {
  display: flex;
  gap: 14px;
  align-items: baseline;
  flex-wrap: wrap;
  background: var(--panel2);
  border: 1px solid var(--line);
  border-radius: 8px 8px 0 0;
  padding: 8px 12px;
  font-size: 13px;
}
#bar .slot { display: flex; gap: 7px; align-items: baseline; }
#bar .slot.right { margin-left: auto; }
#bar .lab {
  font-size: 10px;
  letter-spacing: 1.2px;
  color: var(--muted);
}
#task { color: var(--text); }
#spec { color: var(--amber); font-family: ui-monospace, Consolas, monospace; }
#clock { color: var(--green); font-family: ui-monospace, Consolas, monospace; font-weight: bold; }
#clock.low { color: var(--red); }

canvas#view {
  display: block;
  width: 100%;
  height: auto;
  background: #0a0e1a;
  border: 1px solid var(--line);
  border-top: none;
  border-radius: 0 0 8px 8px;
}

/* ---- the console proper ---- */
#console {
  display: grid;
  grid-template-columns: 1.15fr 0.95fr 1fr;
  gap: 10px;
  margin-top: 10px;
}
@media (max-width: 800px) { #console { grid-template-columns: 1fr; } }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 13px 13px;
}
.panel h2 {
  margin: 0 0 10px;
  font-size: 11px;
  letter-spacing: 1.3px;
  text-transform: uppercase;
  color: var(--blue);
  font-weight: 600;
}
.hint { font-size: 11.5px; line-height: 1.5; color: var(--muted); margin: 10px 0 0; }

/* ---- shim controls ---- */
.shim { margin-bottom: 9px; }
.shim-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 12px;
}
.shim-name { color: var(--text); font-weight: bold; cursor: pointer; }
.shim.sel .shim-name { color: var(--amber); }
.shim-val { color: var(--muted); }
.shim input[type=range] {
  width: 100%;
  margin: 2px 0 0;
  accent-color: var(--amber);
}

/* ---- buttons ---- */
button {
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  background: #1a2338;
  color: var(--text);
  border: 1px solid #33405f;
  border-radius: 6px;
  padding: 8px 12px;
  cursor: pointer;
  display: block;
  width: 100%;
  margin-bottom: 7px;
  text-align: left;
}
button:hover:not(:disabled) { background: #222d48; }
button:disabled { opacity: 0.4; cursor: default; }
button.go { background: var(--amber); color: #2b2000; border-color: var(--amber); }
button.go:hover:not(:disabled) { background: #ffd370; }
.cost { float: right; font-weight: normal; opacity: 0.75; font-family: ui-monospace, monospace; }

/* ---- readout table ---- */
#readout { width: 100%; border-collapse: collapse; font-size: 12.5px; }
#readout td { padding: 4px 0; border-bottom: 1px solid var(--line); }
#readout td:nth-child(1) { color: var(--muted); }
#readout td:nth-child(2) {
  text-align: right;
  font-family: ui-monospace, Consolas, monospace;
  color: var(--text);
  padding-right: 8px;
}
#readout td:nth-child(3) { width: 34px; text-align: right; font-size: 11px; font-weight: bold; }
.ok { color: var(--green); }
.bad { color: var(--red); }

/* ---- overlay ---- */
#overlay {
  position: fixed;
  inset: 0;
  background: rgba(4, 6, 13, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  z-index: 30;
}
#overlay.hidden { display: none; }
#overlay .card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 24px 26px;
  max-width: 620px;
  width: 100%;
}
#overlay h1 {
  margin: 0 0 12px;
  font-size: 26px;
  letter-spacing: 3px;
  color: var(--amber);
}
#ov-body { font-size: 13.5px; line-height: 1.65; color: var(--text); }
#ov-body p { margin: 0 0 11px; }
#ov-body .note { color: var(--muted); font-size: 12.5px; }
#ov-body code {
  background: #070a12;
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 0 4px;
  font-size: 0.94em;
}
#ov-body table { width: 100%; border-collapse: collapse; font-size: 12.5px; margin: 4px 0 12px; }
#ov-body table td { padding: 3px 0; border-bottom: 1px solid var(--line); }
#ov-body table td:last-child { text-align: right; font-family: ui-monospace, monospace; }
#overlay button { width: auto; min-width: 150px; margin-top: 6px; text-align: center; }
#overlay .foot { font-size: 12px; color: var(--muted); margin: 14px 0 0; }
#overlay .foot a { color: var(--blue); }
