:root { color-scheme: dark; font: 14px/1.45 system-ui, sans-serif; background: #080e19; color: #edf3ff; }
* { box-sizing: border-box; }
body { margin: 0; display: grid; grid-template: auto minmax(0, 1fr) / 320px minmax(0, 1fr); height: 100dvh; }
header { grid-column: 1 / -1; display: flex; gap: 24px; align-items: center; padding: 12px 22px; border-bottom: 1px solid #293549; background: #101a29; }
h1, h2, p { margin: 0; }
h1 { font-size: 23px; }
h2, legend { font-size: 14px; font-weight: 700; letter-spacing: .04em; }
header p, .muted { color: #aabbd2; font-size: 12px; }
header a { margin-left: auto; padding: 10px 12px; border: 1px solid #41516b; border-radius: 5px; font-weight: 600; white-space: nowrap; text-underline-offset: 3px; }
a { color: #a2cdff; }
.badge { color: #84e5c0; background: #173c35; padding: 5px 9px; border-radius: 4px; font-size: 10px; letter-spacing: .05em; white-space: nowrap; }
aside { min-width: 0; overflow-y: auto; padding: 18px; background: #101927; border-right: 1px solid #293549; scrollbar-gutter: stable; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
legend { margin-bottom: 12px; }
label { display: block; font-size: 12px; color: #c7d4e7; margin-bottom: 11px; }
input:not([type=checkbox]), select, button, .file-button { width: 100%; min-width: 0; padding: 8px; border: 1px solid #41516b; border-radius: 5px; background: #182538; color: #edf3ff; font: inherit; }
input:not([type=checkbox]), select { display: block; margin-top: 4px; }
input[type=range] { padding: 0; }
button, .file-button { min-height: 40px; cursor: pointer; font-size: 12px; text-align: center; }
button:hover, .file-button:hover, header a:hover { background: #273b56; }
:focus-visible { outline: 2px solid #86c5ff; outline-offset: 2px; }
button:disabled, fieldset:disabled { opacity: .65; cursor: wait; }
.primary { background: #225d98; border-color: #5b9bdd; font-weight: 700; margin-bottom: 10px; }
.pair, .triple { display: grid; gap: 8px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.triple { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.buttons { margin-bottom: 12px; }
.file-button { position: relative; margin: 0; display: flex; align-items: center; justify-content: center; }
.file-button input[type=file] { position: absolute; width: 1px; height: 1px; padding: 0; border: 0; margin: 0; opacity: 0; }
.file-button:focus-within { outline: 2px solid #86c5ff; outline-offset: 2px; }
aside section { border-top: 1px solid #293549; margin-top: 8px; padding-top: 14px; }
aside h2 { margin-bottom: 10px; }
aside p.muted { margin-bottom: 12px; }
.check { display: flex; gap: 8px; align-items: center; }
#selection { margin-bottom: 14px; overflow-wrap: anywhere; }
#city-cards { display: grid; gap: 7px; margin: 10px 0 14px; }
.city-card { text-align: left; }
.city-card span { display: block; color: #aabbd2; font-size: 11px; margin-top: 3px; }
#viewport { min-width: 0; min-height: 0; position: relative; overflow: hidden; background: #0b111d; }
#lab-stage { display: block; position: absolute; width: 100%; height: 100%; inset: 0; touch-action: none; }
#labels { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.district-label { position: absolute; transform: translate(-50%, -100%); padding: 3px 6px; border-radius: 4px; background: #08101ce8; font-size: 11px; white-space: nowrap; }
.city-label { border: 1px solid #8199ba; font-size: 13px; font-weight: 700; }
.scene-status { position: absolute; top: 15px; left: 15px; right: 15px; z-index: 2; display: grid; gap: 8px; pointer-events: none; }
#status { width: fit-content; max-width: 100%; padding: 8px 12px; border-radius: 5px; background: #111e30eb; font-size: 12px; overflow-wrap: anywhere; }
#error { padding: 12px; border: 1px solid #d57d7d; border-radius: 5px; background: #431b25f2; white-space: pre-wrap; overflow-wrap: anywhere; max-height: 35dvh; overflow: auto; pointer-events: auto; }
#metrics { position: absolute; left: 15px; right: 15px; bottom: 15px; z-index: 1; max-height: 42%; overflow: auto; padding: 12px 16px; border: 1px solid #33455f; border-radius: 7px; background: #0b1525eb; }
#metrics p { margin-top: 4px; font-size: 12px; }
#checks[data-ok=true] { color: #84e5c0; }
#checks[data-ok=false] { color: #ffc5b6; }
#fidelity[data-warning=true] { color: #ffc5b6; }
details { margin-top: 8px; font-size: 12px; }
summary { cursor: pointer; min-height: 40px; padding: 10px 0; color: #c7d4e7; font-weight: 600; }
summary:hover { color: #edf3ff; }
summary::marker { color: #86c5ff; }
.control-disclosure { margin: 12px 0; border: 1px solid #33455f; border-radius: 6px; background: #111e30; }
.control-disclosure > summary { padding: 12px; }
.control-disclosure[open] > summary { border-bottom: 1px solid #33455f; }
.disclosure-body { padding: 12px; }
.disclosure-body > :last-child { margin-bottom: 0; }
.diagnostics-disclosure > .disclosure-body { padding: 0 0 4px; }
pre { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 11px; }
[hidden] { display: none !important; }
@media (max-width: 800px) {
  body { grid-template: auto minmax(300px, 60dvh) minmax(0, 1fr) / 1fr; height: auto; min-height: 100dvh; }
  header { flex-wrap: wrap; gap: 8px 18px; padding: 10px 15px; }
  header h1 { font-size: 19px; }
  .badge { display: none; }
  aside { grid-row: 3; overflow: visible; border-right: 0; }
  #viewport { grid-row: 2; }
  #metrics { max-height: 44%; padding: 8px 12px; }
}
@media (max-width: 420px) {
  header a { margin-left: 0; }
  .scene-status { top: 10px; left: 10px; right: 10px; }
  #metrics { left: 10px; right: 10px; bottom: 10px; }
}
@media (forced-colors: active) {
  :focus-visible, .file-button:focus-within { outline-color: Highlight; }
  summary::marker { color: ButtonText; }
}
