:root {
  color-scheme: dark;
  --base: #0a151d; --panel: #101f28; --border: #2a414d;
  --text: #e9f3f5; --muted: #a9bfca; --accent: #65dfc5;
  font: 14px/1.55 "Malgun Gothic", system-ui, sans-serif;
  background: var(--base); color: var(--text);
}
* { box-sizing: border-box; }
body { margin: 0; }
a { color: var(--accent); text-decoration: none; }
button, select, textarea { font: inherit; color: inherit; background: #192e39; border: 1px solid var(--border); border-radius: 6px; padding: 7px 10px; }
button, select, summary { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
button:hover, button[aria-pressed=true] { color: var(--accent); border-color: var(--accent); }
input { accent-color: var(--accent); }
output, label, p { color: var(--muted); }
p { margin: 4px 0 8px; }
h1 { margin: 0; font-size: clamp(24px, 3vw, 39px); letter-spacing: -.045em; }
h2 { margin: 0 0 8px; font-size: 15px; }
hr { border: 0; border-top: 1px solid var(--border); margin: 15px 0; }
.top { background: #0e1c24; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 11px; padding: 14px clamp(12px, 3vw, 36px); }
.top output { margin-left: auto; text-align: right; }
main { max-width: 1660px; margin: auto; padding: 25px clamp(12px, 2.4vw, 36px); }
.mast, .stage-head, .graph-footer, .ends { display: flex; align-items: center; justify-content: space-between; gap: 9px; }
.mast { margin-bottom: 19px; }
.workspace { display: grid; grid-template-columns: minmax(175px, .8fr) minmax(300px, 2.9fr) minmax(220px, 1.05fr); gap: 12px; align-items: start; }
.panel { min-width: 0; background: var(--panel); border: 1px solid var(--border); border-radius: 9px; padding: 14px; }
#questions { display: grid; gap: 8px; }
#questions button { text-align: left; }
#questions small { display: block; margin-bottom: 3px; color: var(--muted); }
.questions select, .questions input[type=range], textarea { display: block; width: 100%; margin: 4px 0 10px; }
.ends { color: var(--muted); font-size: 11px; }
.canvas { height: clamp(350px, 62vh, 680px); background: #0a171f; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; position: relative; }
.canvas > svg, .canvas > canvas { width: 100%; height: 100%; display: block; }
.stage-head, .graph-footer { flex-wrap: wrap; }
.graph-footer { margin-top: 10px; }
#layers, .switch { display: flex; flex-wrap: wrap; gap: 7px; }
#layers label { color: var(--layer-color); white-space: nowrap; }
.graph-feedback { font-size: 12px; margin-bottom: 0; }
.graph-feedback:empty, #action-result:empty { display: none; }
.answer-count { font-size: 28px; font-weight: 750; color: var(--accent); }
.answer-list { max-height: 175px; overflow: auto; display: grid; gap: 5px; }
.answer-list button { text-align: left; }
.incident-list { display: grid; gap: 5px; max-height: 160px; overflow: auto; }
.incident-list button { text-align: left; }
.action-history { padding-left: 19px; margin: 8px 0; max-height: 205px; overflow: auto; }
.action-history li { margin: 6px 0; overflow-wrap: anywhere; }
.action-history small { display: block; color: var(--muted); }
dl { margin: 8px 0; }
dt { color: var(--muted); font-size: 11px; }
dd { margin: 0 0 7px; overflow-wrap: anywhere; }
.tag { color: var(--layer-color); font-size: 12px; }
.accent { background: var(--accent); color: #0a211d; font-weight: 750; }
.accent:hover { color: #0a211d; }
.schema { margin-top: 12px; }
#relations { max-height: 220px; overflow: auto; }
#relations button { padding: 2px 6px; margin: 2px; }
[hidden] { display: none !important; }
@media (max-width: 1050px) {
  .workspace { grid-template-columns: minmax(165px, .7fr) minmax(280px, 2fr); }
  .insight { grid-column: 1 / -1; }
}
@media (max-width: 620px) {
  .workspace { display: flex; flex-direction: column; }
  .workspace > * { width: 100%; }
  .mast { align-items: start; }
  #refresh { white-space: nowrap; }
}
