@font-face { font-family: "Montserrat"; font-weight: 400; font-display: swap; src: url("/labs/crowd-flow/Montserrat-Regular.ttf") format("truetype"); }
@font-face { font-family: "Montserrat"; font-weight: 600 700; font-display: swap; src: url("/labs/crowd-flow/Montserrat-SemiBold.ttf") format("truetype"); }
:root { color-scheme: light; }
body { margin: 0; font: 14px system-ui; }
[hidden] { display: none !important; }
/* Layout: an operations console. A slim header, the map as the stage, one control rail on the right that reads top to
   bottom in the order you work: fill the venue, sound the alarm, read the result. Brand: Tango Vision amber on deep purple. */
:root {
  --bg: #f6f4f9;
  --surface: #ffffff;
  --surface-2: #efecf5;
  --ink: #2a1f3d;
  --muted: #6c6280;
  --line: #ddd7e8;
  --brand: #5b407f;
  --brand-ink: #ffffff;
  --accent: #f8a324;
  --accent-ink: #2a1f3d;
  --good: #1f8a5b;
  --warn: #c77700;
  --bad: #c8372d;
  --stage: #e9e6ef;
  --unguided: #7a6a96;
  --guided: #e08a00;
  --font-display: "Montserrat", "Avenir Next", "Segoe UI", sans-serif;
  --font-body: "Open Sans", "Segoe UI", system-ui, sans-serif;
  --radius: 6px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #17121f; --surface: #211a2d; --surface-2: #2b2339; --ink: #f1ecf8; --muted: #a79dba; --line: #3a304b;
    --brand: #b79be0; --brand-ink: #1b1426; --accent: #f8a324; --accent-ink: #2a1f3d; --good: #4fc38f; --warn: #f0b04a;
    --bad: #f0786e; --stage: #120e19; --unguided: #a898c6; --guided: #f8a324; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #17121f; --surface: #211a2d; --surface-2: #2b2339; --ink: #f1ecf8; --muted: #a79dba; --line: #3a304b;
  --brand: #b79be0; --brand-ink: #1b1426; --accent: #f8a324; --accent-ink: #2a1f3d; --good: #4fc38f; --warn: #f0b04a;
  --bad: #f0786e; --stage: #120e19; --unguided: #a898c6; --guided: #f8a324; color-scheme: dark;
}
html, body { height: 100%; }
body { background: var(--bg); color: var(--ink); font-family: var(--font-body); font-size: 14px; line-height: 1.45; }
* { box-sizing: border-box; }
button, select, input { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.app { display: grid; grid-template-rows: auto 1fr; height: 100%; min-height: 0; }
.top { display: flex; align-items: center; gap: 12px 20px; flex-wrap: wrap; padding-block: 10px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); border-bottom: 1px solid var(--line); background: var(--surface); }
.brand { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.brand h1 { font-family: var(--font-display); font-weight: 700; font-size: 18px; margin: 0; letter-spacing: -0.01em; color: var(--brand); }
.brand span { color: var(--muted); font-size: 12px; }
.brand span a { color: inherit; }
.top .caveat { flex: 1 1 100%; margin: 0; font-size: 11.5px; color: var(--muted); }
.brand .concept { font-style: normal; font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--warn); border: 1px solid currentColor; border-radius: 999px; padding: 1px 8px; white-space: nowrap; }
.top .grow { flex: 1 1 auto; }
.field { display: flex; align-items: center; gap: 8px; min-width: 0; max-width: 100%; }
.field select { min-width: 0; max-width: 100%; flex: 0 1 auto; }
.app { overflow-x: hidden; }
.field label { color: var(--muted); font-size: 12px; }
select, input[type="number"] { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 6px 8px; }

.main { display: grid; grid-template-columns: minmax(0, 1fr) 340px; min-height: 0; }
.stage { position: relative; background: var(--stage); min-height: 0; min-width: 0; display: grid; grid-template-columns: 1fr; gap: 2px; }
.stage.split { grid-template-columns: 1fr 1fr; }
.view { position: relative; min-width: 0; min-height: 0; overflow: hidden; }
.view canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; }
.view canvas:active { cursor: grabbing; }
.tag { position: absolute; left: 12px; top: 12px; display: flex; flex-direction: column; gap: 4px; pointer-events: none; }
.tag b { font-family: var(--font-display); font-weight: 700; font-size: 13px; letter-spacing: 0.04em; text-transform: uppercase; padding: 4px 9px; border-radius: 4px; align-self: flex-start; }
.tag.unguided b { background: var(--unguided); color: #fff; }
.tag.guided b { background: var(--guided); color: #241a05; }
.tag.base b { background: var(--brand); color: var(--brand-ink); }
.tag .big { font-family: var(--font-display); font-weight: 700; font-size: 30px; font-variant-numeric: tabular-nums; color: var(--ink); text-shadow: 0 0 6px var(--stage), 0 0 2px var(--stage); line-height: 1.1; }
.tag .sub { font-size: 12px; color: var(--ink); font-variant-numeric: tabular-nums; text-shadow: 0 0 5px var(--stage), 0 0 2px var(--stage); }
.loading { position: absolute; inset: 0; display: grid; place-items: center; background: var(--stage); color: var(--muted); z-index: 3; text-align: center; padding: 24px; }
.loading b { display: block; font-family: var(--font-display); color: var(--ink); font-size: 16px; margin-bottom: 6px; }
.legend { position: absolute; right: 10px; bottom: 10px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; justify-content: flex-end; background: color-mix(in srgb, var(--surface) 88%, transparent); border: 1px solid var(--line); border-radius: var(--radius); padding: 5px 9px; font-size: 11px; color: var(--muted); pointer-events: none; max-width: calc(100% - 20px); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 4px; vertical-align: -1px; }
.legend .ramp { width: 70px; height: 8px; border-radius: 2px; background: linear-gradient(90deg, #ffe08a, #ff9a3c, #e0352b, #8f0f2e); display: inline-block; vertical-align: middle; margin: 0 4px; }

.rail { background: var(--surface); border-left: 1px solid var(--line); overflow-y: auto; min-height: 0; padding-block: 4px 20px; }
.sec { padding: 14px 16px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; }
.sec h2 { font-family: var(--font-display); font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; margin: 0; color: var(--brand); display: flex; gap: 8px; align-items: baseline; }
.sec h2 .n { color: var(--accent); font-variant-numeric: tabular-nums; }
.sec p { margin: 0; color: var(--muted); font-size: 12.5px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row > .grow { flex: 1 1 auto; min-width: 0; }
.btn { border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius); padding: 7px 12px; cursor: pointer; font-weight: 600; }
.btn:hover { border-color: var(--brand); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.05); }
.btn.alarm { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; }
.btn.wide { width: 100%; padding: 10px 12px; font-family: var(--font-display); letter-spacing: 0.02em; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 4px 11px; cursor: pointer; font-size: 12.5px; }
.chip[aria-pressed="true"] { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.seg button { border: 0; background: var(--surface); padding: 6px 4px; cursor: pointer; font-size: 12.5px; border-right: 1px solid var(--line); }
.seg button:last-child { border-right: 0; }
.seg button[aria-pressed="true"] { background: var(--brand); color: var(--brand-ink); font-weight: 600; }
input[type="range"] { width: 100%; accent-color: var(--brand); }
.kv { display: grid; grid-template-columns: 1fr auto; gap: 3px 12px; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; text-align: right; font-weight: 600; }
.verdict { font-family: var(--font-display); font-size: 15px; font-weight: 700; line-height: 1.3; text-wrap: balance; }
.verdict small { display: block; font-family: var(--font-body); font-weight: 400; font-size: 12.5px; color: var(--muted); margin-top: 4px; }
#chart { width: 100%; height: 150px; display: block; }
table.runs { width: 100%; border-collapse: collapse; font-size: 12px; font-variant-numeric: tabular-nums; }
table.runs th { text-align: left; color: var(--muted); font-weight: 600; padding: 3px 4px; border-bottom: 1px solid var(--line); }
table.runs td { padding: 4px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.runs td.num, table.runs th.num { text-align: right; }
.runs-wrap { overflow-x: auto; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; }
.check { display: flex; gap: 8px; align-items: center; font-size: 13px; cursor: pointer; }
.check input { accent-color: var(--brand); }
.note { font-size: 12px; color: var(--muted); }
.note li { margin-bottom: 3px; }
.note ul { margin: 0; padding-left: 16px; }
.exitlist { display: flex; flex-direction: column; gap: 2px; max-height: 190px; overflow-y: auto; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.exitlist button { display: grid; grid-template-columns: 14px 1fr auto; gap: 6px; align-items: center; border: 0; background: transparent; padding: 3px 4px; border-radius: 4px; cursor: pointer; text-align: left; }
.exitlist button:hover { background: var(--surface-2); }
.exitlist .closed { color: var(--bad); text-decoration: line-through; }
.exitlist .sw { width: 10px; height: 10px; border-radius: 50%; }

@media (max-width: 860px) {
  .top .grow { display: none; }
  .brand { flex: 1 1 100%; }
  #mapSel { width: 100%; }
  .top .field:has(#mapSel) { flex: 1 1 100%; }
  .app { height: auto; min-height: 100%; }
  .main { grid-template-columns: 1fr; }
  .stage { height: 62vh; min-height: 340px; }
  .stage.split { grid-template-columns: 1fr; grid-template-rows: 1fr 1fr; }
  .rail { border-left: 0; border-top: 1px solid var(--line); overflow: visible; padding-left: max(0px, env(safe-area-inset-left, 0px)); padding-right: max(0px, env(safe-area-inset-right, 0px)); }
  .tag .big { font-size: 22px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
