:root {
  --bg: #0A0C10;
  --panel: #11141B;
  --panel-2: #171B24;
  --line: #262C39;
  --line-soft: #1C212B;
  --text: #EEF1F6;
  --muted: #A3ACBB;
  --seg-light: #E6EAF1;
  --seg-mid: #9BA5B5;
  /* Brand red: the only colour used for selection and highlight. */
  --accent: #E4002B;
  --accent-soft: rgba(228, 0, 43, 0.3);
  --display: 'Space Grotesk', system-ui, sans-serif;
  --body: Inter, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, Menlo, monospace;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--body);
  font-size: 15px;
  line-height: 1.45;
}

h1, h2, h3, p, dl, dd { margin: 0; }

button { font: inherit; color: inherit; }

:focus-visible { outline: 2px solid #FFFFFF; outline-offset: 2px; }

.wrap {
  max-width: 1480px;
  margin: 0 auto;
  padding: 28px clamp(16px, 3vw, 40px) 72px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.muted { color: var(--muted); }
.small { font-size: 13px; }
.mono { font-family: var(--mono); font-weight: 500; }
.note { font-size: 13px; color: var(--muted); }
.eyebrow { font-family: var(--mono); font-weight: 500; font-size: 12px; letter-spacing: 0.1em; color: var(--muted); }

/* Header */
.top { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 20px 40px; }
.top-text { min-width: 0; }
h1 { margin-top: 6px; font-family: var(--display); font-weight: 700; font-size: clamp(30px, 4.2vw, 46px); line-height: 1.05; letter-spacing: -0.01em; }
.lede { margin-top: 10px; max-width: 62ch; color: var(--muted); }
.stats { display: flex; flex-wrap: wrap; gap: 10px; }
.stat { padding: 10px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
.stat dt { font-size: 12px; color: var(--muted); }
.stat dd { font-family: var(--mono); font-weight: 700; font-size: 15px; }

/* Cards */
.card { padding: 16px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.card h2 { font-family: var(--display); font-weight: 700; font-size: 20px; }
.card-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 20px; }
.row { display: flex; flex-wrap: wrap; gap: 20px; align-items: stretch; }
.scroll-x { overflow-x: auto; }

/* Plan */
.plan-card { flex: 1.2 1 460px; }
.plan { display: block; width: 100%; height: auto; }
.plan text { font-family: var(--display); font-weight: 700; text-anchor: middle; dominant-baseline: central; pointer-events: none; }
.plan .court { fill: #131720; stroke: #3A4252; stroke-width: 2; }
.plan .court-line { fill: none; stroke: #3A4252; stroke-width: 2; }
.plan .trib { font-size: 22px; letter-spacing: 4px; fill: var(--muted); }
.plan .cone { fill: rgba(228, 0, 43, 0.16); stroke: rgba(228, 0, 43, 0.7); stroke-width: 1.5; }
.plan .seg { fill: none; stroke-linejoin: round; cursor: pointer; stroke: var(--seg-light); }
.plan .seg.g-UPPER, .plan .seg.g-ACCES { stroke: var(--seg-mid); }
.plan .seg.dim { opacity: 0.38; }
.plan .seg:hover { stroke: var(--accent); opacity: 1; }
.plan .seg.on { stroke: var(--accent); opacity: 1; }
.plan .num { font-size: 20px; fill: #0A0C10; }
.plan .num.on { fill: #FFFFFF; }
.plan .ptxt { font-size: 17px; fill: var(--text); }
.plan .cam { cursor: pointer; }
.plan .cam circle { fill: #0A0C10; stroke: #FFFFFF; stroke-width: 2.5; }
.plan .cam text { font-family: var(--mono); font-size: 20px; fill: #FFFFFF; }
.plan .cam:hover circle { stroke: var(--accent); }
.plan .cam.on circle { fill: var(--accent); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 13px; color: var(--muted); }
.legend span { display: flex; align-items: center; gap: 7px; }
.legend .bar { width: 18px; height: 6px; border-radius: 2px; background: var(--seg-light); }
.legend .bar.mid { background: var(--seg-mid); }
.legend .bar.short { width: 10px; }
.legend .ring { width: 14px; height: 14px; border-radius: 50%; border: 2px solid #FFFFFF; }

/* Surface groups */
.groups-card { flex: 1 1 380px; gap: 14px; }
.group { display: flex; flex-direction: column; gap: 4px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.group:last-child { padding-bottom: 0; border-bottom: 0; }
.group h3 { font-family: var(--display); font-weight: 700; font-size: 16px; }
.group .mono { font-size: 13px; }
.group p { font-size: 13px; color: var(--muted); }

/* Toolbar */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }
.tab, .toggle {
  display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 8px 14px;
  border-radius: 10px; border: 1px solid var(--line); background: var(--panel);
  font-weight: 600; font-size: 14px; cursor: pointer;
}
.tab .mono { font-weight: 700; }
.tab:hover, .toggle:hover { border-color: var(--muted); }
.tab.on { background: var(--accent); border-color: var(--accent); color: #FFFFFF; }
.toggle { padding: 8px 12px; font-weight: 500; font-size: 13px; color: var(--muted); }
.toggle i { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--muted); }
.toggle.on { color: var(--text); }
.toggle.on i { border-color: var(--accent); background: var(--accent); }

/* Info bar */
.infobar { flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px 28px; padding: 14px 16px; }
.viewnav { display: flex; align-items: center; gap: 12px; min-width: 0; }
.view-text { min-width: 150px; }
.view-title { font-family: var(--display); font-weight: 700; font-size: 20px; line-height: 1.2; }
.icon-btn { display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; flex: none; border-radius: 10px; border: 1px solid var(--line); background: var(--panel-2); cursor: pointer; }
.icon-btn:hover { border-color: var(--muted); }
.icon-btn svg, .btn-primary svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.hint { max-width: 46ch; font-size: 14px; color: var(--muted); }
.detail { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 22px; }
.sel-name { padding: 6px 12px; border-radius: 8px; background: var(--accent); color: #FFFFFF; font-family: var(--display); font-weight: 700; font-size: 18px; white-space: nowrap; }
.kv { display: flex; flex-direction: column; }
.kv > span { font-size: 12px; color: var(--muted); }
.kv > b { font-family: var(--mono); font-weight: 700; font-size: 14px; }
.kv > b.plain { font-family: var(--body); font-weight: 600; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 2px; }
.chip { min-width: 32px; height: 32px; padding: 0 8px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel-2); font-family: var(--mono); font-weight: 700; font-size: 13px; cursor: pointer; }
.chip:hover { border-color: var(--muted); }
.chip.on { background: var(--accent); border-color: var(--accent); color: #FFFFFF; }
.btn-ghost { min-height: 44px; padding: 8px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel-2); color: var(--muted); font-weight: 500; font-size: 13px; cursor: pointer; }
.btn-ghost:hover { border-color: var(--muted); color: var(--text); }

/* Photo stage */
.stage-card { border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: #000000; scroll-margin-top: 12px; }
.infobar { scroll-margin-top: 12px; }
.stage { position: relative; min-width: 900px; aspect-ratio: 5712 / 2452; container-type: inline-size; overflow: hidden; }
.stage img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.overlay { position: absolute; inset: 0; overflow: hidden; font-size: 14px; font-size: clamp(11px, 1.12cqw, 22px); }
.stage img, .overlay { transition: opacity 0.18s ease; }
.stage.loading img { opacity: 0.35; }
.stage.loading .overlay { opacity: 0; }
@media (prefers-reduced-motion: reduce) { .stage img, .overlay { transition: none; } }
.badge { position: absolute; left: 1.2em; top: 1.1em; padding: 0.4em 0.75em; border-radius: 0.5em; background: rgba(8, 10, 14, 0.8); font-family: var(--mono); font-weight: 500; font-size: 0.85em; letter-spacing: 0.06em; white-space: nowrap; }
.tribune { position: absolute; transform: translate(-50%, -50%); font-family: var(--display); font-weight: 700; letter-spacing: 0.16em; color: rgba(255, 255, 255, 0.82); text-shadow: 0 0.05em 0.5em rgba(0, 0, 0, 0.95), 0 0 0.12em rgba(0, 0, 0, 0.9); white-space: nowrap; pointer-events: none; }
.lbl { position: absolute; z-index: 3; transform: translate(-50%, -100%); display: flex; flex-direction: column; align-items: center; margin: 0; padding: 0; border: 0; background: none; color: #FFFFFF; font-size: 1em; cursor: pointer; }
.lbl.down { transform: translate(-50%, 0); flex-direction: column-reverse; }
.lbl .pill { position: relative; display: flex; flex-direction: column; align-items: center; gap: 0.12em; padding: 0.28em 0.6em 0.3em; border-radius: 0.42em; border: 1.5px solid #FFFFFF; background: rgba(8, 10, 14, 0.86); font-family: var(--display); font-weight: 700; line-height: 1.1; letter-spacing: 0.02em; white-space: nowrap; box-shadow: 0 0.2em 0.8em rgba(0, 0, 0, 0.55); }
.lbl .co { font-family: var(--mono); font-weight: 500; font-size: 0.78em; }
.lbl .lead { width: 1.5px; background: #FFFFFF; }
.lbl .dot { width: 0.6em; height: 0.6em; border-radius: 50%; background: #FFFFFF; box-shadow: 0 0 0 0.14em rgba(8, 10, 14, 0.85); margin: 0 0 -0.3em; }
.lbl.down .dot { margin: -0.3em 0 0; }
.lbl:hover { z-index: 5; }
.lbl:hover .pill { border-color: var(--accent); }
.lbl:hover .lead, .lbl:hover .dot { background: var(--accent); }
.lbl.on { z-index: 6; }
.lbl.on .pill { background: var(--accent); border-color: var(--accent); }
.lbl.on .lead, .lbl.on .dot { background: var(--accent); }

/* Output map */
.map-card { padding: 0; gap: 0; overflow: hidden; }
.map { position: relative; min-width: 860px; aspect-ratio: 3840 / 2160; background: #000000; overflow: hidden; }
.map img { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.slice { position: absolute; margin: 0; padding: 0; border: 3px solid transparent; border-radius: 0; background: transparent; cursor: pointer; }
.slice:hover { border-color: var(--accent); }
.has-sel .slice { background: rgba(5, 7, 10, 0.64); }
.has-sel .slice.on, .slice.on { background: transparent; border-color: var(--accent); box-shadow: 0 0 0 1.5px rgba(255, 255, 255, 0.9); z-index: 2; }
.map-foot { display: flex; flex-direction: column; gap: 10px; padding: 14px 16px 16px; border-top: 1px solid var(--line); }
.btn-primary { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; padding: 8px 16px; border-radius: 10px; background: var(--text); color: #0A0C10; font-weight: 600; font-size: 14px; text-decoration: none; }
.btn-primary:hover { background: #FFFFFF; }
.btn-primary svg { width: 18px; height: 18px; }

/* Table */
table { width: 100%; min-width: 1080px; border-collapse: collapse; font-family: var(--mono); font-weight: 500; font-size: 13px; }
th, td { padding: 4px 10px; text-align: left; white-space: nowrap; }
thead th { padding: 8px 10px; font-family: var(--body); font-weight: 400; font-size: 12px; color: var(--muted); border-bottom: 1px solid var(--line); }
tbody tr { border-bottom: 1px solid var(--line-soft); }
tbody tr:hover { background: var(--panel-2); }
tbody tr.on { background: var(--accent-soft); }
tbody th { font-weight: 500; }
td.txt { font-family: var(--body); color: var(--muted); white-space: normal; min-width: 220px; }
tr.on td.txt { color: var(--text); }
.row-btn { display: flex; align-items: center; gap: 8px; min-height: 36px; margin: 0; padding: 4px 8px 4px 0; border: 0; background: none; font-family: var(--display); font-weight: 700; font-size: 14px; cursor: pointer; text-align: left; }
.row-btn:hover { text-decoration: underline; text-decoration-color: var(--accent); text-underline-offset: 4px; }

/* Footer */
.foot { display: flex; flex-direction: column; gap: 6px; max-width: 90ch; font-size: 13px; color: var(--muted); }

@media (max-width: 600px) {
  .view-text { min-width: 0; }
  .tab, .toggle { padding: 8px 10px; }
}
