:root {
  --bg: #121315; --panel: #1a1c1f; --line: #2b2e33; --text: #d9dbde; --dim: #7d838c;
  --ink: #ece6d6; --center: #54c6eb; --cage: #6c727b; --sel: #ffffff;
  --exact: #7de0b4; --degraded: #ffb53d; --invalid: #ff5470; --dormant: #5a5f66;
  font: 13px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); }
main { display: grid; grid-template-columns: minmax(0, 1fr) 380px; height: 100vh; }
#stage { position: relative; overflow: hidden; }
#canvas { width: 100%; height: 100%; display: block; cursor: crosshair; touch-action: none; }
#canvas.panning { cursor: grabbing; }
#keys { position: absolute; left: 10px; right: 10px; bottom: 8px; color: var(--dim); pointer-events: none; font-size: 11px; }
#banner { position: absolute; left: 10px; top: 10px; right: 10px; padding: 8px 10px; background: #3a1018; border: 1px solid var(--invalid); white-space: pre-wrap; max-height: 40%; overflow: auto; }
#panel { background: var(--panel); border-left: 1px solid var(--line); overflow-y: auto; padding: 6px 14px 20px; }
h2 { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--dim); margin: 16px 0 8px; font-weight: 600; }
.row { display: flex; gap: 8px; align-items: center; margin: 4px 0; }
.row label { flex: 1; color: var(--dim); }
.row input[type=number], .row select { width: 110px; }
.row.station label { flex: 0; }
.row.station input[type=number] { width: 64px; flex: 1; }
input, select, textarea, button { font: inherit; color: var(--text); background: #0f1012; border: 1px solid var(--line); border-radius: 3px; padding: 3px 6px; }
textarea, #case-name { width: 100%; margin: 3px 0; resize: vertical; }
button { cursor: pointer; background: #24272c; }
button:hover { border-color: var(--dim); }
.checks { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 8px; }
.checks label { color: var(--dim); display: flex; gap: 5px; align-items: center; }
.readout { color: var(--dim); }
.readout b { color: var(--text); font-weight: 500; }
.st-exact { color: var(--exact); } .st-degraded { color: var(--degraded); } .st-invalid { color: var(--invalid); } .st-dormant { color: var(--dormant); }
#diag div { padding: 2px 0; cursor: pointer; }
#diag div:hover { text-decoration: underline; }
#stats { color: var(--dim); margin-top: 6px; }
#cases div { display: flex; justify-content: space-between; gap: 6px; padding: 3px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
#cases div:hover { color: var(--sel); }
#cases small { color: var(--dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 150px; }
.seg { display: flex; gap: 0; }
.seg button { border-radius: 0; flex: 1; }
.seg button.on { background: #3a4048; border-color: var(--dim); }
.types { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; margin: 6px 0 8px; }
.types button { display: flex; align-items: center; gap: 5px; padding: 3px 6px; text-align: left; font-size: 12px; border-radius: 5px; background: #202328; }
.types button small { color: var(--dim); margin: 0; font-size: 10px; }
.types button.on { border-color: var(--type-color); background: color-mix(in srgb, var(--type-color) 12%, #202328); color: var(--type-color); }
.align button { padding: 3px 7px; font-size: 11px; }
.align button.on { background: #3a4048; border-color: var(--dim); }
.align input[type=number] { width: 58px; }
.align input.on { border-color: var(--center); background: #14303a; }

/* A quiet property inspector: type color describes intent; rings describe results. */
h2 { border-top: 1px solid var(--line); padding-top: 10px; margin-top: 12px; }
#form > h2:first-child { border-top: 0; margin-top: 0; padding-top: 6px; }
.badge { float: right; font-size: 10px; font-weight: 400; letter-spacing: .03em; text-transform: none; border: 1px solid var(--line); border-radius: 12px; padding: 1px 8px; }
.hint { color: var(--dim); font: 12px/1.4 system-ui, sans-serif; margin: 0 0 8px; }
.type-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--type-color); flex: none; }
.types button:hover { border-color: var(--type-color); }
input, select, textarea, button { min-height: 24px; }
input[type=checkbox] { min-height: auto; accent-color: var(--center); }
button:focus-visible, input:focus-visible, textarea:focus-visible { outline: 2px solid var(--center); outline-offset: 2px; }
.readout { font-size: 11px; line-height: 1.45; padding: 4px 0; }
#keys { max-width: 780px; line-height: 1.6; background: #121315d9; padding: 8px 10px; border-radius: 6px; }
@media (max-width: 800px) { main { grid-template-columns: minmax(0, 1fr) 350px; } #panel { padding-inline: 12px; } #keys { font-size: 10px; max-height: 90px; overflow: hidden; } }

input[type=number], .readout, #stats { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; }
