:root {
  --bg: #11131a;
  --surface: #1a1d27;
  --surface-2: #222634;
  --line: #2e3342;
  --text: #e6e8ef;
  --muted: #9aa2b6;
  --accent: #6ea8fe;
  --danger: #e0655f;
  color-scheme: dark;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 12px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.brand { display: flex; gap: 10px; align-items: baseline; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.label { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; }

.clock { display: flex; align-items: baseline; gap: 8px; }
.countdown { font-variant-numeric: tabular-nums; font-size: 18px; font-weight: 600; }

.seat { display: flex; align-items: center; gap: 8px; }

select, input, button {
  font: inherit;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 8px;
}

button { cursor: pointer; }
button:hover { border-color: var(--accent); }
button.primary { background: var(--accent); color: #0b1020; border-color: transparent; font-weight: 600; }
button.danger { background: transparent; border-color: var(--danger); color: var(--danger); }
button:disabled { opacity: .5; cursor: not-allowed; }

main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 16px;
  padding: 16px 20px;
  align-items: start;
}

.map-pane { position: sticky; top: 16px; }

@media (max-width: 900px) {
  main { grid-template-columns: 1fr; }
}

.map-pane {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px;
}

/* The map is square (a 264-unit viewBox). Without a height ceiling it grows to
   the full width of its pane and pushes the legend and panel off-screen on a
   typical laptop, so cap it to the viewport and let it letterbox. */
#map {
  width: 100%;
  height: auto;
  max-height: calc(100vh - 150px);
  display: block;
}

.edge { stroke: #39405430; stroke-width: 1.2; }
.node { cursor: pointer; stroke: #0c0e14; stroke-width: 1.4; transition: filter .12s; }
.node:hover { filter: brightness(1.25); }
.node.selected { stroke: #fff; stroke-width: 2.4; }
.node-label { font-size: 4.4px; fill: #dfe3ee; text-anchor: middle; pointer-events: none; }
.node-sub { font-size: 3.6px; fill: #b9c0d4; text-anchor: middle; pointer-events: none; }

.legend { display: flex; flex-wrap: wrap; gap: 10px; padding: 8px 4px 2px; }
.legend span { display: flex; align-items: center; gap: 6px; font-size: 12px; }
.swatch { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

.panel { display: flex; flex-direction: column; gap: 12px; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
}

.card h2 { margin: 0 0 8px; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }

.row { display: grid; grid-template-columns: 1fr 110px; gap: 8px; align-items: center; margin-bottom: 8px; }
.row label { font-size: 13px; }

.pool, .orders { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.pool li, .orders li {
  display: flex; justify-content: space-between; gap: 8px;
  padding: 4px 8px; background: var(--surface-2); border-radius: 6px; font-size: 13px;
}
.orders li button { padding: 0 6px; font-size: 12px; }

.force-grid { display: grid; grid-template-columns: 1fr 80px; gap: 6px; align-items: center; margin: 6px 0; }
.force-grid label { font-size: 12px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }

.ok { color: #7fd49a; }
.err { color: var(--danger); }

.frames { list-style: none; padding: 0; margin: 6px 0 0; display: flex; flex-direction: column; gap: 3px; max-height: 260px; overflow-y: auto; }
.frames li { font-size: 12px; padding: 3px 6px; background: var(--surface-2); border-radius: 5px; }
