:root {
  --bg: #0b1017;
  --panel: #121a24;
  --panel-2: #0e151d;
  --line: #1e2b3a;
  --text: #e7eef6;
  --muted: #8fa2b5;
  --accent: #f0b429;
  --atk: #ff8a3d;
  --def: #3da6ff;
  --win: #1fbe7a;
  --loss: #e8455e;
  --radius: 10px;
  font-synthesis: none;
}

/* Thin but VISIBLE scrollbars: many panels scroll horizontally (round strip,
   impact lanes, health rosters, clip tracks) and users need the affordance. */
* { box-sizing: border-box; scrollbar-width: thin; scrollbar-color: #2c3d50 transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-thumb { background: #2c3d50; border-radius: 4px; }
*::-webkit-scrollbar-thumb:hover { background: #3a4f66; }
*::-webkit-scrollbar-track, *::-webkit-scrollbar-corner { background: transparent; }

body {
  margin: 0;
  background: radial-gradient(1200px 600px at 70% -10%, #17222f 0%, var(--bg) 60%);
  color: var(--text);
  font: 14px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.hidden { display: none !important; }
.muted { color: var(--muted); }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid var(--line);
  background: rgba(10, 15, 21, 0.9);
  backdrop-filter: blur(12px);
}
.topbar-inner {
  display: flex;
  align-items: center;
  gap: 24px;
  width: 100%;
  max-width: 1800px;
  min-height: 64px;
  margin: 0 auto;
  padding: 10px 18px;
}
.brand { flex: none; font-weight: 850; letter-spacing: 2.4px; font-size: 16px; }
.brand span { color: var(--accent); }

.ingest {
  display: grid;
  grid-template-columns: auto repeat(2, minmax(0, 1fr)) auto;
  align-items: end;
  gap: 10px;
  width: min(920px, 100%);
}
.ingest label, .ingest-kind { display: flex; min-width: 0; flex-direction: column; gap: 6px; color: var(--muted); font-size: 10px; font-weight: 750; letter-spacing: 0.65px; text-transform: uppercase; }
.ingest input {
  width: 100%;
  min-width: 0;
  background: rgba(8, 13, 19, 0.78);
  border: 1px solid #2a394a;
  color: var(--text);
  padding: 10px 11px;
  border-radius: 8px;
  font-size: 12px;
}
.ingest input::placeholder { color: #596979; }
.ingest input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(240, 180, 41, 0.09); }
.ingest button { min-height: 39px; }

.mode-toggle {
  display: flex;
  min-height: 39px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  flex: none;
}
.mode-toggle label { display: block; gap: 0; cursor: pointer; letter-spacing: 0; text-transform: none; }
.mode-toggle input { position: absolute; width: 1px; height: 1px; padding: 0; opacity: 0; }
.mode-toggle span {
  display: grid;
  min-height: 37px;
  padding: 0 12px;
  place-items: center;
  font-size: 12px;
  color: var(--muted);
  background: var(--panel-2);
  user-select: none;
}
.mode-toggle input:checked + span { background: var(--panel); color: var(--accent); font-weight: 600; }
.mode-toggle input:focus-visible + span { outline: 1px solid var(--accent); outline-offset: -1px; }

button {
  background: var(--accent);
  color: #1a1204;
  border: none;
  padding: 8px 14px;
  border-radius: 8px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}
button:hover { filter: brightness(1.06); }
button:disabled { opacity: 0.5; cursor: progress; }
/* Mouse clicks leave buttons focused; without this the browser paints its
   pale focus halo on top of our own active styling (e.g. the round strip's
   accent ring). Keyboard navigation keeps a visible ring via :focus-visible. */
button:focus:not(:focus-visible) { outline: none; }
button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
button.ghost { background: transparent; color: var(--muted); border: 1px solid var(--line); font-weight: 600; }

.status { margin-left: auto; overflow: hidden; color: var(--muted); font-size: 11px; text-align: right; text-overflow: ellipsis; white-space: nowrap; }
.status:empty { display: none; }
.status.error { color: var(--loss); }
.status.ok { color: var(--win); }

.app {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(340px, 390px);
  gap: 16px;
  width: 100%;
  max-width: 1800px;
  margin: 0 auto;
  padding: 18px;
  align-items: start;
}
@media (max-width: 1100px) { .app { grid-template-columns: 1fr; } }
.stage { min-width: 0; }

/* Hero: equal video/map columns; the map is flanked by compact live rosters. */
.hero {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  align-items: start;
  min-width: 0;
}
.hero-map {
  display: flex;
  min-width: 0;
  min-height: 0;
  aspect-ratio: 16 / 9;
  overflow: hidden;
}
.hero-movement { display: flex; flex: 1; flex-direction: column; min-width: 0; min-height: 0; }
.hero-movement .movement-canvas-wrap { flex: 1; height: auto; min-height: 240px; }

/* Team health groups: one horizontal row per team beside the round picker. */
.hero-health { display: flex; align-items: stretch; gap: 6px; min-width: 0; padding: 8px 10px; overflow-x: auto; }
.hero-health + .hero-health { border-top: 1px solid var(--line); }
.hero-health h3 {
  display: flex;
  flex: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  width: 76px;
  margin: 0;
  padding: 1px 2px;
  font-size: 9px;
  letter-spacing: 0.9px;
  text-align: center;
}
.hero-health h3 img { width: 30px; height: 30px; object-fit: contain; }
#hero-health-0 h3 { color: #ffb27d; }
#hero-health-1 h3 { color: #8ec8ff; }
.hero-health .health-player { flex: 1; min-width: 96px; padding: 4px 6px; }
.hero-health .health-player-top { gap: 4px; }
.hero-health .operator-frame { width: 22px; height: 22px; }
.hero-health .health-delta { min-height: 0; }
.hero-health .health-delta:empty { display: none; }
.hero-status-bar {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 12px;
  margin: -6px 0 -2px;
  padding: 0 2px;
}
.hero-status-bar .health-sub { flex: 1; min-width: 0; }
.replay-reprocess { flex: none; padding: 5px 9px; font-size: 9px; letter-spacing: 0.45px; }
@media (max-width: 1350px) {
  .hero { grid-template-columns: 1fr; }
  .hero-map { min-height: 410px; aspect-ratio: auto; }
  .hero-movement .movement-canvas-wrap { min-height: 330px; }
}

.player-wrap { position: relative; width: 100%; min-width: 0; aspect-ratio: 16 / 9; background: #000; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); }
#player { width: 100%; height: 100%; border: 0; display: block; background: #000; }

.video-gate {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(6, 10, 14, 0.9);
}
.gate-card { text-align: center; max-width: 380px; padding: 22px; }
.gate-title { font-weight: 800; font-size: 16px; }
.gate-sub { color: var(--muted); font-size: 12px; margin: 8px 0 14px; }
.gate-msg { color: var(--muted); font-size: 12px; margin-top: 10px; min-height: 16px; }
.gate-msg.error { color: var(--loss); }
.gate-progress { height: 6px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 4px; margin-top: 14px; overflow: hidden; }
.gate-bar { height: 100%; width: 0%; background: var(--accent); transition: width 0.4s ease; }

.overlay {
  position: absolute;
  top: 12px;
  left: 12px;
  width: 260px;
  padding: 10px 12px;
  background: rgba(9, 13, 18, 0.82);
  border: 1px solid var(--line);
  border-radius: 10px;
  pointer-events: none;
}
.overlay-round { display: flex; justify-content: space-between; align-items: baseline; }
.ov-round { font-weight: 700; font-size: 12px; letter-spacing: 1px; color: var(--muted); }
.ov-clock { font-weight: 800; font-size: 20px; font-variant-numeric: tabular-nums; }
.ov-teams { display: flex; justify-content: space-between; margin: 6px 0; font-weight: 700; }
.ov-feed { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-direction: column; gap: 3px; }
.ov-feed li { font-size: 12px; display: flex; gap: 6px; align-items: center; }
.ov-feed .clk { color: var(--muted); font-variant-numeric: tabular-nums; }
.ov-feed .hs { color: var(--accent); }

.sync-bar {
  margin-top: 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.sync-state { font-weight: 700; }
.sync-state.aligned { color: var(--win); }
.hint { color: var(--muted); font-size: 11px; font-weight: 500; letter-spacing: 0; }

/* Version-gated health telemetry, matching the Rebellion analyzer HUD. */
.replay-health { margin-top: 12px; }
.health-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}
.health-title { color: #aeb7c2; font-size: 11px; font-weight: 800; letter-spacing: 1.4px; }
.health-sub { color: var(--muted); font-size: 11px; margin-top: 2px; }
.telemetry-badge {
  flex: none;
  border: 1px solid rgba(31, 190, 122, 0.35);
  border-radius: 999px;
  background: rgba(31, 190, 122, 0.09);
  color: #64e2ae;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.8px;
  padding: 5px 9px;
}
.health-teams { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.health-team { min-width: 0; padding: 9px 10px 10px; border-right: 1px solid var(--line); }
.health-team:last-child { border-right: 0; }
.health-team h3 { color: #64e2ae; font-size: 10px; letter-spacing: 0.9px; margin: 0 0 7px; }
.health-team:nth-child(2) h3 { color: #ef9bec; }
.health-roster { display: grid; grid-template-columns: repeat(5, minmax(105px, 1fr)); gap: 6px; overflow-x: auto; }
.health-player { min-width: 105px; border: 1px solid var(--line); border-radius: 7px; background: rgba(7, 11, 16, 0.68); padding: 6px 7px; }
.health-player-top { display: flex; align-items: center; gap: 6px; min-width: 0; }
.operator-frame {
  display: grid;
  place-items: center;
  flex: none;
  width: 28px;
  height: 28px;
  overflow: hidden;
  border: 1px solid #344251;
  border-radius: 5px;
  background: #202a35;
  color: #6f7f8e;
  font-size: 10px;
  font-weight: 800;
}
.operator-frame img { width: 100%; height: 100%; object-fit: contain; padding: 2px; }
.health-name { min-width: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 10px; font-weight: 700; }
.health-label { color: #57dba6; font: 700 9px ui-monospace, SFMono-Regular, Menlo, monospace; white-space: nowrap; }
.health-bar { height: 6px; margin-top: 5px; overflow: hidden; border-radius: 999px; background: #28313d; }
.health-fill { height: 100%; width: 0; border-radius: inherit; background: #18c88f; transition: width 140ms ease, background-color 140ms ease; }
.health-fill.warn { background: #f0b429; }
.health-fill.critical { background: var(--loss); }
.health-fill.dead { background: #55616e; }
.health-delta { min-height: 12px; margin-top: 1px; color: #ef8494; text-align: right; font: 9px ui-monospace, SFMono-Regular, Menlo, monospace; }
.health-player.unknown { opacity: 0.68; }
@media (max-width: 1450px) { .health-teams { grid-template-columns: 1fr; } .health-team { border-right: 0; border-bottom: 1px solid var(--line); } }

/* Stat cards + timeline scroller (lol-coach style) */
.cards { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; margin-top: 12px; }
@media (max-width: 720px) { .cards { grid-template-columns: repeat(3, 1fr); } }
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 9px 12px;
}
.card .k { color: var(--muted); font-size: 10px; letter-spacing: 1px; text-transform: uppercase; }
.card .v { font-weight: 800; font-size: 20px; font-variant-numeric: tabular-nums; margin-top: 2px; }
.card .v small { font-weight: 600; font-size: 12px; color: var(--muted); }

.round-strip-panel {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.round-strip-left { display: flex; min-width: 0; flex-direction: column; border-right: 1px solid var(--line); }
.round-strip-row { display: flex; flex: 1; min-width: 0; align-items: stretch; }
.round-strip-teams { display: grid; grid-template-rows: repeat(2, minmax(0, 1fr)); min-width: 0; }
.round-strip { display: flex; flex: 1; min-width: 0; align-items: flex-start; justify-content: safe center; gap: 9px; overflow-x: auto; padding: 10px 12px; }
.round-cell { flex: none; display: flex; flex-direction: column; align-items: center; gap: 5px; }
.round-box {
  box-sizing: border-box;
  display: grid;
  place-items: center;
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-2);
  color: var(--muted);
  font: 800 12px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  text-align: center;
}
.round-box.team-0 { background: rgba(255, 138, 61, 0.78); color: #fff; border-color: rgba(255, 177, 124, 0.7); }
.round-box.team-1 { background: rgba(61, 166, 255, 0.8); color: #07131e; border-color: rgba(130, 199, 255, 0.75); }
.round-box.active { box-shadow: 0 0 0 2px var(--accent); }
.round-cell .score { color: var(--muted); font-size: 10px; letter-spacing: 0.3px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.round-swap { flex: none; color: var(--muted); font-size: 15px; padding: 0 3px; height: 40px; line-height: 40px; }
.scroller { margin-top: 12px; }
.chart-wrap { position: relative; height: 200px; }
.util-chart-wrap { height: 240px; }
#timeline, #util-timeline { width: 100%; height: 100%; }
.playhead {
  position: absolute;
  top: 10px;
  bottom: 24px;
  width: 2px;
  background: var(--win);
  pointer-events: none;
  opacity: 0;
  transform: translateX(-1px);
  box-shadow: 0 0 6px rgba(31, 190, 122, 0.7);
}
.playhead.on { opacity: 1; }
.sync-hint { color: var(--muted); font-size: 12px; max-width: 460px; margin-top: 2px; }
.sync-controls { display: flex; align-items: flex-end; gap: 8px; flex-wrap: wrap; }
/* Manual pinning is the correction fallback; keep it behind a disclosure. */
.sync-advanced { align-self: center; min-width: 0; }
.sync-advanced summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  user-select: none;
}
.sync-advanced summary:hover { color: var(--text); }
.sync-advanced[open] summary { margin-bottom: 6px; }
.sync-manual { display: flex; align-items: flex-end; gap: 8px; flex-wrap: wrap; }

/* Collapsible advanced-evidence panels. */
.panel-head-toggle { cursor: pointer; user-select: none; }
.panel-head-toggle:hover { color: var(--text); }
.panel-head-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.panel-chevron { flex: none; margin-left: 10px; color: var(--muted); font-size: 11px; }
.panel.collapsed > :not(.panel-head) { display: none; }
.panel.collapsed .panel-head { border-bottom: 0; }
.sync-controls label { display: flex; flex-direction: column; gap: 3px; font-size: 11px; color: var(--muted); }
.sync-controls select, .sync-controls input {
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 13px;
}

.side { display: flex; flex-direction: column; gap: 14px; }
.match-banner {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: center;
  gap: 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: -6px;
}
.match-banner .match-head { min-width: 0; }
.match-banner .scoreline { justify-self: center; margin-top: 0; }
.match-banner .scoreline .team { font-size: 17px; }
.match-banner .scoreline .sc { font-size: 22px; }
@media (max-width: 1250px) {
  .match-banner { grid-template-columns: 1fr; }
  .match-banner .match-head { text-align: center; }
}
.winner-tag {
  border: 1px solid rgba(31, 190, 122, 0.45);
  border-radius: 999px;
  background: rgba(31, 190, 122, 0.12);
  color: var(--win);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 1px;
  padding: 3px 7px;
  margin-left: 2px;
}
.match-head h1 { font-size: 18px; margin: 0 0 4px; }
.match-meta { color: var(--muted); font-size: 12px; }
.scoreline { display: flex; align-items: center; gap: 12px; margin-top: 10px; font-weight: 800; font-size: 20px; }
.scoreline .team { display: flex; align-items: center; gap: 8px; font-size: 15px; }
.scoreline img { width: 26px; height: 26px; object-fit: contain; }
.scoreline .sc { font-variant-numeric: tabular-nums; }
.scoreline .win { color: var(--win); }

/* First-run setup checklist: surfaces the Download VOD → Auto-sync flow at the
   top of the match view instead of burying the controls in the sync bar. */
.setup-banner {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 22px;
  flex-wrap: wrap;
  padding: 13px 16px;
  border: 1px solid rgba(240, 180, 41, 0.35);
  border-radius: var(--radius);
  background: linear-gradient(100deg, rgba(240, 180, 41, 0.08), var(--panel) 55%);
}
.setup-intro { display: flex; min-width: 220px; max-width: 340px; flex-direction: column; gap: 3px; }
.setup-intro b { font-size: 14px; }
.setup-intro span { color: var(--muted); font-size: 11px; line-height: 1.5; }
.setup-steps { display: flex; flex: 1; min-width: 0; margin: 0; padding: 0; gap: 12px; list-style: none; flex-wrap: wrap; }
.setup-step {
  display: flex;
  flex: 1;
  min-width: 280px;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
}
.setup-num {
  display: grid;
  flex: none;
  width: 26px;
  height: 26px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}
.setup-step.active { border-color: rgba(240, 180, 41, 0.5); }
.setup-step.active .setup-num { border-color: var(--accent); color: var(--accent); }
.setup-step.done { opacity: 0.75; }
.setup-step.done .setup-num { border-color: var(--win); background: rgba(31, 190, 122, 0.12); color: var(--win); }
.setup-step.error .setup-num { border-color: var(--loss); color: var(--loss); }
.setup-body { display: flex; min-width: 0; flex: 1; flex-direction: column; gap: 2px; }
.setup-body b { font-size: 12px; }
.setup-msg { color: var(--muted); font-size: 11px; line-height: 1.45; }
.setup-step.error .setup-msg { color: var(--loss); }
.setup-step button { flex: none; padding: 7px 12px; font-size: 11px; }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  font-size: 11px;
  letter-spacing: 1px;
  color: var(--muted);
  font-weight: 700;
}
.align-tag { font-weight: 600; letter-spacing: 0; }
.align-tag.pinned { color: var(--win); }
.align-tag.predicted { color: var(--def); }
.align-tag.none { color: var(--loss); }

/* VOD-synchronized raw replay movement viewer. */
.movement-panel { min-width: 0; min-height: 320px; }
.movement-head { align-items: center; gap: 8px; }
.movement-head > span { flex: none; }
.experimental {
  color: var(--accent);
  font-size: 9px;
  letter-spacing: 0.7px;
  margin-left: 4px;
}
.movement-controls { display: flex; min-width: 0; gap: 3px; align-items: center; justify-content: flex-end; flex-wrap: wrap; }
.movement-floors { display: flex; min-width: 0; gap: 3px; margin-right: 5px; flex-wrap: wrap; }
button.movement-floor {
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--muted);
  border-radius: 6px;
  padding: 4px 7px;
  font: 700 10px ui-monospace, SFMono-Regular, Menlo, monospace;
  cursor: pointer;
}
button.movement-floor.active { color: #1a1204; background: var(--accent); border-color: var(--accent); }
button.movement-zoom { font-size: 12px; line-height: 1; padding: 3px 7px 4px; }
button.movement-zoom.zoom-gap { margin-left: 7px; }
button.movement-mode {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--muted);
  font-size: 10px;
  padding: 3px 8px;
}
button.movement-mode.active { color: #1a1204; background: var(--accent); border-color: var(--accent); }
button.movement-help-btn { min-width: 24px; font-weight: 800; }
.movement-help {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 4px 16px;
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}
.movement-help b { display: inline-block; min-width: 64px; color: var(--accent); font: 750 10px ui-monospace, SFMono-Regular, Menlo, monospace; }
button.movement-live { color: #7be4b7; border-color: rgba(31, 190, 122, 0.5); animation: live-pulse 1.6s ease-in-out infinite; }
.movement-layers { position: absolute; top: 10px; left: 10px; z-index: 4; display: flex; flex-direction: column; gap: 4px; }
.movement-layers button { width: 36px; padding: 5px 0; border: 1px solid rgba(42, 59, 78, 0.9); border-radius: 6px; background: rgba(9, 15, 22, 0.78); color: #8ea1b3; font: 700 9px ui-monospace, SFMono-Regular, Menlo, monospace; cursor: pointer; }
.movement-layers button:hover { border-color: var(--accent); color: var(--text); }
.movement-layers button.active { border-color: var(--accent); background: rgba(240, 180, 41, 0.16); color: var(--accent); }
@keyframes live-pulse { 50% { border-color: rgba(31, 190, 122, 1); } }
.movement-status {
  display: none;
  padding: 7px 10px;
  color: var(--muted);
  background: var(--panel-2);
  border-bottom: 1px solid var(--line);
  font-size: 11px;
}
.movement-status.show { display: block; }
.movement-status.error { color: var(--loss); }
.movement-canvas-wrap {
  position: relative;
  height: 285px;
  background: #0a1119;
  overflow: hidden;
}
#movement-canvas { width: 100%; height: 100%; display: block; }
.movement-clock {
  position: absolute;
  top: 8px;
  left: 9px;
  padding: 3px 7px;
  border: 1px solid rgba(132, 151, 169, 0.3);
  border-radius: 5px;
  color: var(--text);
  background: rgba(7, 12, 18, 0.8);
  font-size: 11px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}
.movement-foot {
  min-height: 31px;
  padding: 7px 10px;
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 10px;
  border-top: 1px solid var(--line);
}
.movement-foot #movement-meta { margin-left: auto; text-align: right; }
.movement-foot .dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 3px; }
.movement-foot .dot.atk { background: var(--atk); }
.movement-foot .dot.def { background: var(--def); }

/* Top-level views: library / match / players / ask. */
.main-nav { display: flex; min-width: 0; gap: 5px; }
button.nav-tab {
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.8px;
  text-transform: uppercase;
}
button.nav-tab:hover:not(:disabled) { color: var(--text); filter: none; }
button.nav-tab.active { background: var(--accent); border-color: var(--accent); color: #1a1204; }
button.nav-tab:disabled { opacity: 0.35; cursor: not-allowed; }
.app-view { padding: 24px 18px 40px; }
.view-inner { max-width: none; margin: 0 auto; display: flex; flex-direction: column; gap: 18px; }
.view-empty { grid-column: 1 / -1; padding: 34px 18px; color: var(--muted); font-size: 13px; text-align: center; }
.eyebrow { color: var(--accent); font-size: 9px; font-weight: 850; letter-spacing: 1.35px; }

/* Library */
.library-hero {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 34px;
  padding: 26px 28px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background:
    linear-gradient(105deg, rgba(18, 26, 36, 0.98) 0%, rgba(18, 26, 36, 0.92) 52%, rgba(21, 36, 49, 0.82) 100%),
    radial-gradient(circle at 85% 20%, rgba(240, 180, 41, 0.17), transparent 45%);
}
.library-intro { min-width: 0; max-width: 430px; }
.library-intro h1 { margin: 5px 0 7px; font-size: 28px; line-height: 1.1; }
.library-intro p { margin: 0; color: #9aabbb; font-size: 12px; line-height: 1.6; }
.library-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 390px)); gap: 14px; padding: 16px; }
.library-card {
  position: relative;
  display: flex;
  min-height: 220px;
  flex-direction: column;
  gap: 10px;
  padding: 17px 18px;
  overflow: hidden;
  border: 1px solid #263546;
  border-radius: 10px;
  background: linear-gradient(145deg, #101924 0%, #0d141c 100%);
  color: var(--text);
  text-align: left;
  transition: transform 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
}
.library-card > * { position: relative; z-index: 1; }
.library-card::after {
  content: "";
  position: absolute;
  right: -42px;
  bottom: -62px;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(61, 166, 255, 0.1), transparent 68%);
  pointer-events: none;
}
.library-card:hover { transform: translateY(-2px); border-color: #4b6680; box-shadow: 0 10px 24px rgba(0, 0, 0, 0.18); }
.library-card-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; color: var(--muted); font-size: 9px; font-weight: 800; letter-spacing: 0.8px; }
.library-title { min-height: 38px; font-size: 15px; font-weight: 800; line-height: 1.35; }
.library-scoreline { display: flex; align-items: center; gap: 8px; margin-top: auto; font-size: 13px; font-weight: 750; }
.library-team.win { color: var(--win); }
.library-meta { padding-top: 10px; border-top: 1px solid rgba(42, 57, 74, 0.7); color: var(--muted); font-size: 11px; }
.library-card-actions { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 2px; }
.library-card-actions button { padding: 7px 10px; font-size: 10px; }
button.library-open { color: #1a1204; }
/* Series card: one entry per BO-N with its maps in played order. */
.library-parts { display: flex; flex-direction: column; gap: 6px; margin-top: auto; }
.library-part { display: flex; align-items: stretch; gap: 6px; }
button.library-part-open {
  display: grid;
  flex: 1;
  min-width: 0;
  grid-template-columns: 54px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(9, 15, 22, 0.6);
  color: var(--text);
  font-size: 11px;
  text-align: left;
}
button.library-part-open:hover { border-color: var(--accent); filter: none; }
.library-part-index { color: var(--muted); font: 750 10px ui-monospace, SFMono-Regular, Menlo, monospace; }
.library-part-map { overflow: hidden; font-weight: 750; text-overflow: ellipsis; white-space: nowrap; }
.library-part-score { color: var(--muted); font-variant-numeric: tabular-nums; font-weight: 700; }
button.library-part-delete {
  flex: none;
  width: 32px;
  padding: 0;
  border-color: transparent;
  color: #6b7c8c;
  font-size: 12px;
}
button.library-part-delete:hover { border-color: var(--loss); background: rgba(232, 69, 94, 0.08); color: #e88796; filter: none; }
button.library-delete { border-color: rgba(232, 69, 94, 0.3); color: #e88796; }
button.library-delete:hover { border-color: var(--loss); background: rgba(232, 69, 94, 0.08); filter: none; }

/* Maps */
.maps-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 12px; padding: 14px; }
button.map-card {
  display: flex;
  min-height: 180px;
  flex-direction: column;
  justify-content: flex-end;
  gap: 8px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background:
    linear-gradient(to top, rgba(8, 13, 19, 0.98) 0%, rgba(8, 13, 19, 0.72) 58%, rgba(8, 13, 19, 0.2) 100%),
    linear-gradient(145deg, rgba(61, 166, 255, 0.1), transparent 48%),
    var(--map-splash),
    var(--panel-2);
  background-position: center;
  background-size: cover;
  color: var(--text);
  text-align: left;
  transition: transform 140ms ease, border-color 140ms ease;
}
button.map-card:hover { transform: translateY(-2px); border-color: #4b6680; filter: none; }
button.map-card.active { border-color: var(--accent); box-shadow: inset 0 3px 0 var(--accent); }
.map-card-name { margin-bottom: auto; font-size: 22px; font-weight: 900; letter-spacing: 0.6px; text-transform: uppercase; }
.map-card-record { font-size: 12px; font-weight: 750; }
.map-side-split { height: 7px; overflow: hidden; border-radius: 999px; background: var(--def); }
.map-side-split .attack { height: 100%; background: var(--atk); }
.map-card-sides { color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: 0.5px; }
.map-card-stats { color: var(--muted); font-size: 10px; }
.map-detail { scroll-margin-top: 82px; }
.map-detail-body { display: grid; grid-template-columns: minmax(220px, 0.7fr) minmax(420px, 1.3fr); gap: 18px; padding: 14px; }
.map-detail-body h4 { margin: 0 0 8px; color: var(--muted); font-size: 9px; letter-spacing: 1px; }
.map-sites, .map-matches { display: flex; flex-direction: column; gap: 6px; }
.map-site-row, button.map-match-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 7px; background: #0e151d; font-size: 10px; }
button.map-match-row { width: 100%; color: var(--text); text-align: left; }
button.map-match-row:hover { border-color: #4b6680; filter: none; }
.map-match-title { min-width: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }

/* Players */
.rebellion-layout {
  display: grid;
  grid-template-columns: minmax(200px, 1fr) minmax(0, 4fr);
  gap: 18px;
  align-items: start;
}
.rebellion-side { position: sticky; top: 82px; display: flex; flex-direction: column; gap: 18px; max-height: calc(100vh - 100px); overflow-y: auto; }
.rebellion-main { display: flex; min-width: 0; flex-direction: column; gap: 18px; }
.players-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; padding: 14px; }
/* Sidebar roster: compact horizontal cards, one per row. */
.rebellion-side .players-grid { grid-template-columns: 1fr; gap: 8px; padding: 10px; }
.rebellion-side button.player-card { flex-direction: row; gap: 10px; padding: 8px 10px; text-align: left; }
.rebellion-side .player-portrait { width: 48px; flex: none; border-radius: 7px; }
.rebellion-side .player-card-body { align-items: flex-start; gap: 3px; }
.rebellion-side .player-card-name { font-size: 12px; }
.rebellion-side .player-card-stats { align-items: flex-start; font-size: 9px; }
.rebellion-side .players-others { margin-top: 4px; padding-top: 10px; }
.rebellion-side .players-others-list { grid-template-columns: 1fr; }
button.player-card {
  position: relative;
  display: flex;
  min-width: 0;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  padding: 13px 10px 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-2);
  color: var(--text);
  cursor: pointer;
  transition: transform 140ms ease, border-color 140ms ease, background 140ms ease;
}
button.player-card:hover { transform: translateY(-2px); border-color: #4b6680; filter: none; }
button.player-card.active { border-color: var(--accent); background: linear-gradient(180deg, rgba(240, 180, 41, 0.08), var(--panel-2) 38%); box-shadow: inset 0 3px 0 var(--accent); }
.player-portrait {
  display: grid;
  place-items: center;
  width: min(150px, 86%);
  aspect-ratio: 0.77;
  overflow: hidden;
  border-radius: 9px;
  background: radial-gradient(ellipse at 50% 30%, #223145 0%, #101823 70%);
}
.player-portrait img { width: 100%; height: 100%; object-fit: cover; object-position: top; }
.player-card-body { display: flex; min-width: 0; flex-direction: column; align-items: center; gap: 7px; max-width: 100%; }
.player-card-name { overflow: hidden; max-width: 100%; font-size: 14px; font-weight: 800; letter-spacing: 0.3px; text-overflow: ellipsis; }
.player-card-stats { display: flex; flex-direction: column; align-items: center; gap: 2px; max-width: 100%; font-size: 10px; font-variant-numeric: tabular-nums; }
.players-others { grid-column: 1 / -1; margin-top: 8px; padding-top: 12px; border-top: 1px solid var(--line); }
.players-others h4 { margin: 0 0 8px; color: var(--muted); font-size: 9px; letter-spacing: 1px; }
.players-others-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 6px; }
button.players-other-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 8px 9px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: #0e151d;
  color: var(--text);
  font-size: 10px;
  text-align: left;
  white-space: normal;
}
button.players-other-row:hover { border-color: var(--line); background: #111b26; filter: none; }
.player-detail { display: flex; flex-direction: column; gap: 16px; scroll-margin-top: 82px; }
.player-matches { padding: 10px 12px; overflow-x: auto; }
.pm-row {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) 120px repeat(4, 44px);
  min-width: 630px;
  gap: 6px;
  padding: 7px 6px;
  font-size: 11px;
  border-radius: 5px;
}
.pm-row.head { color: var(--muted); font-size: 9px; letter-spacing: 0.5px; }
.pm-row:hover:not(.head) { background: var(--panel-2); }
.pm-row .pm-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pm-row .v { text-align: center; font-variant-numeric: tabular-nums; }
.player-detail-columns {
  display: grid;
  grid-template-columns: minmax(210px, 1fr) minmax(0, 4fr);
  gap: 16px;
  align-items: start;
}
.player-operators {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 500px;
  overflow-y: auto;
  padding: 10px 12px 12px;
}
.op-chip {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 9px 5px 6px;
  border: 1px solid rgba(30, 43, 58, 0.72);
  border-radius: 7px;
  background: rgba(9, 15, 22, 0.46);
  color: inherit;
  font-family: inherit;
  font-size: 10px;
  text-align: left;
  cursor: pointer;
}
.op-chip:hover { border-color: #34485e; background: var(--panel-2); }
.op-chip.active { border-color: var(--accent); background: var(--panel-2); }
.op-chip img { width: 22px; height: 22px; object-fit: contain; }
.op-chip-text { display: grid; line-height: 1.35; }
.op-chip-text .n { font-weight: 700; }
.pe-op { width: 14px; height: 14px; object-fit: contain; vertical-align: -3px; margin-right: 4px; }

.player-events {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 6px;
  max-height: 500px;
  overflow-y: auto;
  padding: 10px 12px 12px;
}
.pe-row {
  display: grid;
  grid-template-columns: 112px 64px minmax(0, 1fr) 24px;
  align-items: center;
  gap: 7px;
  min-width: 0;
  padding: 8px 9px;
  border: 1px solid rgba(30, 43, 58, 0.72);
  border-radius: 7px;
  background: rgba(9, 15, 22, 0.46);
  font-size: 10px;
  font-family: inherit;
  color: inherit;
  text-align: left;
  width: 100%;
  cursor: pointer;
}
.pe-row:hover { border-color: #34485e; background: var(--panel-2); }
.pe-ctx, .pe-opponent { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pe-ctx { color: var(--muted); font-variant-numeric: tabular-nums; }
.pe-kind { font-weight: 800; font-size: 9px; letter-spacing: 0.4px; }
.pe-kind.kill { color: var(--win); }
.pe-kind.death { color: var(--loss); }
.pe-hs { color: var(--accent); font-weight: 800; font-size: 9px; text-align: right; }

/* Read-only LLM chat over deterministic replay tools. */
.ask-layout { display: grid; grid-template-columns: 218px minmax(0, 1fr); gap: 14px; align-items: start; }
.ask-sidebar { display: flex; flex-direction: column; gap: 8px; position: sticky; top: 14px; }
.ask-new-chat { padding: 9px 11px; border: 1px solid #2a3b4e; border-radius: 8px; background: rgba(9, 15, 22, 0.52); color: var(--text); font-size: 11px; font-weight: 700; text-align: left; cursor: pointer; }
.ask-new-chat:hover { border-color: var(--accent); }
.ask-chat-list { display: flex; flex-direction: column; gap: 3px; max-height: calc(100vh - 200px); overflow-y: auto; }
.ask-chat-row { display: flex; align-items: center; gap: 2px; border-radius: 7px; }
.ask-chat-row:hover, .ask-chat-row.active { background: rgba(25, 36, 50, 0.85); }
.ask-chat-row.active .ask-chat-open { color: var(--text); }
.ask-chat-open { min-width: 0; flex: 1; overflow: hidden; padding: 8px 9px; border: 0; background: none; color: #9caebe; font-size: 10.5px; text-align: left; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.ask-chat-delete { display: none; flex: none; width: 22px; height: 22px; margin-right: 4px; padding: 0; border: 0; border-radius: 5px; background: none; color: var(--muted); font-size: 13px; line-height: 1; cursor: pointer; }
.ask-chat-row:hover .ask-chat-delete,
.ask-chat-row:focus-within .ask-chat-delete { display: block; }
.ask-chat-delete:hover { background: rgba(232, 69, 94, 0.15); color: var(--loss); }
.ask-panel {
  grid-column: -2 / -1;
  grid-row: 1;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-width: 0;
  min-height: calc(100vh - 112px);
}
.ask-head { gap: 12px; }
.ask-head-actions { display: flex; align-items: center; gap: 9px; }
.ask-thread { min-height: 0; overflow-y: auto; padding: 16px 18px 8px; }
.ask-empty { display: flex; max-width: 720px; min-height: 430px; margin: 0 auto; padding: 64px 18px 42px; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.ask-orb { display: grid; place-items: center; width: 42px; height: 42px; margin-bottom: 13px; border: 1px solid rgba(240, 180, 41, 0.4); border-radius: 12px; background: rgba(240, 180, 41, 0.09); color: var(--accent); font-size: 19px; }
.ask-empty h1 { margin: 0 0 7px; font-size: 24px; }
.ask-intro { max-width: 610px; color: #9caebe; font-size: 12px; line-height: 1.6; }
.ask-suggestions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); width: min(560px, 100%); gap: 8px; margin-top: 18px; }
.ask-suggestions button { padding: 9px 11px; border-color: #2a3b4e; background: rgba(9, 15, 22, 0.52); color: #aebdca; font-size: 10px; white-space: normal; }
.ask-suggestions button:hover { border-color: var(--accent); color: var(--text); filter: none; }
.ask-turn { padding: 0 0 14px; }
.ask-turn + .ask-turn { padding-top: 14px; border-top: 1px solid rgba(30, 43, 58, 0.7); }
.ask-question { width: fit-content; max-width: min(760px, 88%); margin: 0 0 9px auto; padding: 8px 11px; border: 1px solid #344456; border-radius: 9px 9px 2px 9px; background: #192432; color: #d9e5ef; font-size: 12px; }
.ask-answer { max-width: 900px; color: var(--text); font-size: 12px; line-height: 1.55; white-space: pre-wrap; }
.ask-pending { color: var(--accent); font-size: 11px; }
.ask-error { color: var(--loss); font-size: 11px; }
.ask-error .ask-retry { margin-left: 8px; padding: 2px 8px; font-size: 10px; }
.ask-moments { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; }
button.ask-moment { padding: 5px 8px; border: 1px solid rgba(31, 190, 122, 0.35); background: rgba(31, 190, 122, 0.09); color: #7be4b7; font: 700 10px ui-monospace, SFMono-Regular, Menlo, monospace; }
.ask-clips { max-width: 100%; margin-top: 18px; }
.ask-clips-head { display: flex; align-items: end; justify-content: space-between; gap: 12px; margin-bottom: 9px; }
.ask-clips-heading { display: flex; min-width: 0; flex-direction: column; gap: 2px; }
.ask-clips-heading strong { font-size: 12px; }
.ask-clips-heading span { color: var(--muted); font-size: 9px; }
.ask-clips-controls { display: flex; flex: none; gap: 5px; }
.ask-clips-controls button { display: grid; width: 30px; height: 27px; padding: 0; place-items: center; font-size: 13px; }
.ask-clips-track {
  display: grid;
  grid-auto-columns: minmax(280px, 32%);
  grid-auto-flow: column;
  gap: 10px;
  max-width: 100%;
  padding: 1px 1px 8px;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  scroll-snap-type: inline mandatory;
}
.ask-clip-card {
  display: flex;
  min-width: 0;
  min-height: 260px;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid #29394a;
  border-radius: 9px;
  background: #0c141d;
  scroll-snap-align: start;
}
.ask-clip-card.loading { display: grid; place-items: center; color: var(--muted); }
.ask-clip-skeleton { padding: 24px; font-size: 10px; }
.ask-clip-video { display: block; width: 100%; aspect-ratio: 16 / 9; background: #05080c; object-fit: contain; }
.ask-clip-meta { display: flex; min-width: 0; padding: 10px 11px 8px; flex-direction: column; gap: 3px; }
.ask-clip-badges { display: flex; align-items: center; gap: 5px; margin-bottom: 2px; }
.ask-clip-index, .ask-clip-duration { padding: 2px 5px; border-radius: 4px; background: #182330; color: var(--muted); font: 750 8px ui-monospace, SFMono-Regular, Menlo, monospace; }
.ask-clip-duration { background: rgba(31, 190, 122, 0.1); color: #70dcae; }
.ask-clip-title { overflow: hidden; color: var(--text); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.ask-clip-context { overflow: hidden; color: var(--muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.ask-clip-actions { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: auto; padding: 8px 10px; border-top: 1px solid var(--line); color: #7f91a2; font-size: 10px; }
.ask-clip-actions > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ask-clip-actions button { flex: none; padding: 5px 8px; font-size: 9px; }
.ask-clip-error { margin: 10px; padding: 10px; border: 1px solid rgba(232, 69, 94, 0.25); border-radius: 6px; background: rgba(232, 69, 94, 0.06); color: #e77f90; font-size: 9px; }
.ask-clip-card > .ask-clip-title:first-child { margin: 14px 14px 2px; }
.ask-clip-card > .ask-clip-context { margin: 0 14px; }
.ask-visual { max-width: 820px; margin-top: 11px; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #0b1118; }
.ask-visual-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 34px; padding: 7px 9px; border-bottom: 1px solid var(--line); color: #a8b6c4; font-size: 10px; font-weight: 750; letter-spacing: 0.5px; }
.ask-visual-floors { display: flex; gap: 4px; }
button.ask-visual-floor { min-width: 28px; padding: 3px 6px; border: 1px solid var(--line); border-radius: 5px; background: var(--panel-2); color: var(--muted); font: 700 9px ui-monospace, SFMono-Regular, Menlo, monospace; }
button.ask-visual-floor.active { border-color: var(--accent); background: var(--accent); color: #1a1204; }
.ask-visual-canvas-wrap { position: relative; height: 340px; background: #090f15; }
.ask-visual-canvas { display: block; width: 100%; height: 100%; }
.ask-visual-meta { position: absolute; left: 8px; bottom: 8px; padding: 3px 6px; border: 1px solid rgba(132, 151, 169, 0.25); border-radius: 5px; background: rgba(6, 10, 15, 0.78); color: #aab8c5; font-size: 9px; pointer-events: none; }
.ask-trace { margin-top: 8px; color: #647484; font-size: 9px; }
.ask-trace summary { width: fit-content; cursor: pointer; }
.ask-trace pre { max-width: 900px; overflow-x: auto; padding: 7px 8px; border: 1px solid var(--line); border-radius: 6px; background: #091019; color: #7f91a1; font: 9px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre-wrap; }
.ask-form { display: flex; gap: 8px; padding: 12px 14px 14px; border-top: 1px solid var(--line); background: rgba(9, 15, 22, 0.45); }
.ask-form input { min-width: 0; flex: 1; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; outline: none; background: var(--panel-2); color: var(--text); font-size: 12px; }
.ask-form input:focus { border-color: var(--accent); }
@media (max-width: 720px) {
  .ask-layout { grid-template-columns: 1fr; }
  .ask-sidebar { position: static; }
  .ask-chat-list { flex-direction: row; max-height: none; overflow-x: auto; }
  .ask-chat-row { flex: none; max-width: 220px; }
  .ask-panel { grid-column: 1; grid-row: 2; min-height: calc(100vh - 136px); }
  .ask-empty { min-height: 390px; padding: 40px 4px 28px; }
  .ask-suggestions { grid-template-columns: 1fr; }
  .ask-clips-track { grid-auto-columns: minmax(270px, 88%); }
  .ask-visual-canvas-wrap { height: 260px; }
  .ask-head-actions .hint { display: none; }
}

.round-detail { padding: 10px 12px; }
.round-detail .site { color: var(--muted); font-size: 12px; margin-bottom: 8px; }
.feed { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.feed li {
  display: grid;
  grid-template-columns: 42px 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 5px 6px;
  border-radius: 6px;
  cursor: pointer;
}
.feed li:hover { background: var(--panel-2); }
.feed li.past { opacity: 0.55; }
.feed li.now { background: rgba(31, 190, 122, 0.14); }
.feed .clk { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 12px; }
.feed .who .k { font-weight: 700; }
.feed .who .arrow { color: var(--muted); margin: 0 5px; }
.feed .tag { font-size: 11px; color: var(--muted); }
.feed .tag.hs { color: var(--accent); font-weight: 700; }
.feed .tag.plant { color: var(--atk); font-weight: 700; }
.feed .tag.defuse { color: var(--def); font-weight: 700; }

.impact-panel { margin-top: 12px; }
.impact-head { align-items: flex-start; gap: 16px; }
.impact-sub { max-width: 600px; margin-top: 3px; color: #8296a8; font-size: 11px; font-weight: 500; letter-spacing: 0; }
.impact-guide { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px 12px; color: var(--muted); font-size: 10px; font-weight: 500; letter-spacing: 0; text-transform: none; }
.impact-guide > span { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.impact-guide b { color: #9aa9b7; font-weight: 650; }
.impact-key { display: inline-grid; min-width: 22px; height: 20px; padding: 0 5px; place-items: center; border: 1px solid #43505d; border-radius: 5px; background: #111922; color: #a9b5c0; font: 750 9px ui-monospace, SFMono-Regular, Menlo, monospace; font-style: normal; }
.impact-key.kill { border-color: rgba(255, 116, 136, 0.7); background: rgba(255, 116, 136, 0.14); color: #ff8fa0; }
.impact-key.death { color: #94a2ae; }
.impact-lanes { --round-count: 1; max-height: 500px; overflow: auto; }
.impact-axis, .impact-lane { display: grid; grid-template-columns: 145px repeat(var(--round-count), minmax(58px, 1fr)); min-width: calc(145px + var(--round-count) * 58px); }
.impact-axis { position: sticky; top: 0; z-index: 4; min-height: 34px; border-bottom: 1px solid var(--line); background: #10161d; }
.impact-axis-key { padding: 7px 10px; color: #8b9aa8; font-size: 9px; font-weight: 750; letter-spacing: 0.45px; }
.impact-round-head { display: grid; place-items: center; border-left: 1px solid var(--line); color: #697986; font: 750 9px ui-monospace, SFMono-Regular, Menlo, monospace; }
.impact-round-head.active { background: rgba(240, 180, 41, 0.07); color: var(--accent); }
.impact-lane { min-height: 48px; border-bottom: 1px solid rgba(30, 43, 58, 0.65); }
.impact-lane:last-child { border-bottom: 0; }
.impact-player { overflow: hidden; padding: 9px 10px; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; font-size: 10px; font-weight: 700; }
.impact-player small { display: block; margin-top: 4px; color: #788997; font-size: 9px; font-weight: 600; letter-spacing: 0.1px; }
.impact-player.team-0 { color: #ffab75; }
.impact-player.team-1 { color: #83c4ff; }
.impact-cell { display: flex; align-items: center; justify-content: center; gap: 4px; min-width: 0; border-left: 1px solid var(--line); background: rgba(7, 11, 16, 0.32); }
.impact-cell.active { background: rgba(240, 180, 41, 0.035); }
.impact-empty { color: #303d49; font: 700 9px ui-monospace, SFMono-Regular, Menlo, monospace; }
button.combat-result { min-width: 24px; height: 23px; padding: 0 5px; border: 1px solid #43505d; border-radius: 5px; background: #111922; color: #a9b5c0; font: 750 9px ui-monospace, SFMono-Regular, Menlo, monospace; }
button.combat-result:hover, button.combat-result:focus-visible { filter: brightness(1.18); }
button.combat-result.kill { border-color: rgba(255, 116, 136, 0.75); background: rgba(255, 116, 136, 0.16); color: #ff90a0; }
button.combat-result.death { color: #96a3ae; }

.scoreboard { padding: 6px 8px; }
.sb-team { margin: 6px 0 10px; }
.sb-team h4 { margin: 4px 6px; font-size: 12px; display: flex; justify-content: space-between; }
.sb-team h4 .win { color: var(--win); }
.sb-row { display: grid; grid-template-columns: minmax(70px, 1fr) repeat(6, 37px); gap: 1px; padding: 4px 3px; font-size: 10px; border-radius: 5px; }
.sb-row.head { color: var(--muted); font-size: 9px; letter-spacing: 0.4px; }
.sb-row:hover:not(.head) { background: var(--panel-2); }
.sb-row .n { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-row .v { text-align: center; font-variant-numeric: tabular-nums; }
.sb-row .damage { color: #ffad71; }
.sb-row .taken { color: #ef8494; }
.sb-row .points { color: #74c4ff; }

.signal-caveat { padding: 8px 10px; border-bottom: 1px solid rgba(240, 180, 41, 0.15); background: rgba(240, 180, 41, 0.05); color: #bda76e; font-size: 10.5px; }
.score-signals { max-height: 235px; overflow-y: auto; }
.score-signal { display: grid; grid-template-columns: 57px 20px minmax(0, 1fr) 38px; align-items: center; gap: 6px; width: 100%; padding: 7px 10px; border: 0; border-bottom: 1px solid rgba(30, 43, 58, 0.65); border-radius: 0; background: transparent; color: var(--text); text-align: left; }
.score-signal:hover { background: var(--panel-2); filter: none; }
.score-signal .clock { color: var(--muted); font: 9px ui-monospace, SFMono-Regular, Menlo, monospace; }
.score-operator-icon { width: 20px; height: 20px; padding: 2px; border-radius: 4px; background: #182330; object-fit: contain; }
.score-operator-icon.missing { visibility: hidden; }
.score-signal .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 10px; }
.score-signal .name small { display: block; overflow: hidden; color: var(--muted); font-size: 8px; font-weight: 500; text-overflow: ellipsis; }
.score-signal .delta { display: grid; justify-items: end; color: #74c4ff; font: 700 9px ui-monospace, SFMono-Regular, Menlo, monospace; }
.score-signal .delta strong { font-size: 10px; }
.score-signal .delta small { color: #7b8fa1; font-size: 9px; font-weight: 650; }
.signal-empty { padding: 11px; color: var(--muted); font-size: 10px; }

.warnings { color: var(--muted); font-size: 11px; }
.warnings div { padding: 2px 0; }

/* Responsive composition. Keep navigation and data usable without horizontal page overflow. */
@media (max-width: 1000px) {
  .topbar-inner { gap: 14px; }
  .status { max-width: 260px; }
  .library-hero { align-items: stretch; flex-direction: column; gap: 22px; }
  .library-intro { max-width: 620px; }
  .ingest { width: 100%; }
  .players-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .rebellion-layout { grid-template-columns: 1fr; }
  .player-detail-columns { grid-template-columns: 1fr; }
  .rebellion-side { position: static; max-height: none; overflow: visible; }
  .round-strip-panel { grid-template-columns: 1fr; }
  .round-strip-left { border-right: 0; border-bottom: 1px solid var(--line); }
}

@media (max-width: 700px) {
  .topbar-inner { min-height: 0; flex-wrap: wrap; padding: 9px 12px; }
  .brand { font-size: 14px; }
  /* Wrap instead of horizontal overflow: every view stays reachable on phones. */
  .main-nav { order: 3; width: 100%; flex-wrap: wrap; }
  button.nav-tab { flex: 1 0 auto; padding: 6px 10px; font-size: 10px; }
  .status { margin-left: auto; max-width: 54vw; }
  .app, .app-view { padding: 12px; }
  .match-banner { padding: 12px; }
  .match-banner .scoreline { flex-wrap: wrap; }
  .library-hero { padding: 21px 18px; }
  .library-intro h1 { font-size: 24px; }
  .ingest { grid-template-columns: 1fr; }
  .ingest button { width: 100%; }
  .library-grid { grid-template-columns: 1fr; padding: 12px; }
  .players-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 10px; }
  .map-detail-body { grid-template-columns: 1fr; }
  .players-others { grid-column: 1 / -1; }
  .hero-map { min-height: 0; }
  .hero-movement { min-height: 360px; }
  .movement-head { align-items: flex-start; flex-direction: column; }
  .movement-controls { justify-content: flex-start; }
  .hero-status-bar { align-items: flex-start; flex-wrap: wrap; }
  .telemetry-badge { margin-left: auto; }
  .cards { grid-template-columns: repeat(2, 1fr); }
  .pe-row { grid-template-columns: 104px 60px minmax(0, 1fr) 22px; }
}

@media (max-width: 430px) {
  .players-grid { grid-template-columns: 1fr; }
  .player-portrait { width: 145px; }
  .panel-head { align-items: flex-start; gap: 8px; }
  .ask-head { flex-direction: column; }
  .ask-head-actions { width: 100%; justify-content: space-between; }
}

/* ---- Pro replays view ----------------------------------------------------- */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.pro-replays-view { display: flex; flex-direction: column; gap: 14px; }
.pro-replays-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 390px);
  gap: 28px;
  align-items: end;
  padding: 26px 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(125deg, var(--panel), var(--panel-2));
}
.pro-replays-hero h1 { margin: 4px 0 7px; font-size: 30px; }
.pro-replays-hero p { margin: 0; max-width: 720px; color: var(--muted); }
.team-browser { display: grid; grid-template-columns: 1fr; gap: 6px; }
.team-browser label { color: var(--muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }
.team-browser input, .team-browser select {
  width: 100%;
  min-height: 40px;
  padding: 9px 12px;
  border: 1px solid #2b3b4d;
  border-radius: 8px;
  outline: none;
  background: #0d151e;
  color: var(--text);
  color-scheme: dark;
  font: inherit;
  font-size: 12px;
}
.team-browser input::placeholder { color: #617184; }
.team-browser input:focus, .team-browser select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(240, 180, 41, 0.09); }
.team-browser select { cursor: pointer; }
.team-browser select:disabled { cursor: wait; opacity: 0.6; }
.results-head-right { display: flex; align-items: center; gap: 10px; }
.results-grid { display: flex; flex-direction: column; gap: 8px; padding: 12px; }
.results-foot { display: flex; justify-content: center; padding: 0 12px 12px; }
.results-foot:has(> .hidden) { display: none; }
.result-row {
  display: grid;
  grid-template-columns: 72px 1fr auto auto;
  align-items: center;
  gap: 14px;
  padding: 10px 14px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.result-date { font-weight: 600; }
.result-line { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.result-outcome { font-weight: 700; }
.result-outcome.win { color: var(--win); }
.result-outcome.loss { color: var(--loss); }
.result-score { font-variant-numeric: tabular-nums; font-weight: 600; }
.result-opponent { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.result-status { display: flex; align-items: center; gap: 8px; justify-self: end; }
.result-actions { display: flex; align-items: center; gap: 8px; }
.result-badge {
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.4px;
  border: 1px solid var(--line);
}
.result-badge.ready { color: var(--accent); border-color: rgba(240, 180, 41, 0.5); }
.result-badge.ingested { color: var(--win); border-color: rgba(31, 190, 122, 0.5); }
.result-badge.waiting { color: var(--muted); }
.result-link {
  text-decoration: none;
  padding: 6px 10px;
  border-radius: 8px;
  color: var(--muted);
  border: 1px solid var(--line);
  font-weight: 600;
  font-size: 13px;
}
.result-link:hover { color: var(--text); }
@media (max-width: 760px) {
  .pro-replays-hero { grid-template-columns: 1fr; padding: 20px; }
  .results-head-right { align-items: flex-end; flex-direction: column; }
  .result-row { grid-template-columns: 1fr auto; }
  .result-date, .result-status { display: none; }
}

/* ---- Ingest queue view ----------------------------------------------------- */
.queue-list { display: flex; flex-direction: column; gap: 8px; padding: 12px; }
.queue-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-2);
}
.queue-row-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.queue-title { min-width: 0; overflow: hidden; font-size: 13px; font-weight: 750; text-overflow: ellipsis; white-space: nowrap; }
.queue-head-right { display: flex; flex: none; align-items: center; gap: 8px; }
.queue-state { flex: none; font-size: 9px; font-weight: 800; letter-spacing: 1px; color: var(--muted); }
.queue-state.running { color: var(--accent); }
.queue-state.cancelling { color: var(--accent); }
.queue-state.done { color: var(--win); }
.queue-state.error { color: var(--loss); }
.queue-state.cancelled { color: var(--muted); }
button.queue-cancel { padding: 3px 8px; font-size: 9px; }
.queue-step.cancelled { opacity: 0.6; }
.queue-steps { display: flex; flex-wrap: wrap; gap: 6px; }
.queue-step {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  padding: 4px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 10px;
  color: var(--muted);
}
.queue-step b { font-weight: 700; }
.queue-step i { font-style: normal; font-size: 9px; opacity: 0.85; }
.queue-step.running { border-color: rgba(240, 180, 41, 0.5); color: var(--accent); }
.queue-step.done { border-color: rgba(31, 190, 122, 0.45); color: #6fdcae; }
.queue-step.error { border-color: rgba(232, 69, 94, 0.5); color: #e88796; }
.queue-error { color: var(--loss); font-size: 11px; }

/* ---- Broadcast CV view (experimental) ------------------------------------- */
.cv-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 4;
}
.cv-panel { padding: 10px 14px; border-top: 1px solid var(--line); }
.cv-status { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.cv-status a.cv-queue-link { color: var(--accent); text-decoration: none; }
.cv-status a.cv-queue-link:hover { text-decoration: underline; }
.cv-actions { display: flex; gap: 6px; }
.cv-actions button { padding: 5px 9px; font-size: 10px; }
.cv-readout { display: flex; flex-direction: column; gap: 4px; }
.cv-row { display: flex; gap: 10px; font-size: 13px; }
.cv-k { color: var(--muted); width: 64px; flex: none; }
.cv-v { color: var(--text); }
.cv-locations { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.cv-loc-chip {
  font-size: 11px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 1px 8px;
}

/* ---- Admin: replay-data maintenance --------------------------------------- */
.admin-note { padding: 12px 15px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 12px; line-height: 1.5; }
.admin-list { display: flex; flex-direction: column; }
.admin-row { display: flex; align-items: center; gap: 12px; padding: 12px 15px; border-bottom: 1px solid var(--line); }
.admin-row:last-child { border-bottom: 0; }
.admin-row-all { background: var(--panel-2); justify-content: space-between; }
.admin-info { flex: 1; min-width: 0; }
.admin-title { font-weight: 700; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.admin-meta { margin-top: 3px; color: var(--muted); font-size: 11px; }
.admin-state { flex: none; padding: 4px 9px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: 10px; letter-spacing: .4px; text-transform: uppercase; }
.admin-state.running { border-color: rgba(31,190,122,.45); color: #6fdcae; }
.admin-state.error { border-color: rgba(232,69,94,.45); color: #e88796; }
.admin-state.done { border-color: rgba(31,190,122,.3); color: #4fae86; }
.admin-actions { display: flex; flex: none; gap: 7px; }
.admin-actions button { padding: 6px 11px; font-size: 11px; }

/* ---- Replay decode inspector --------------------------------------------- */
.decode-view { display: flex; flex-direction: column; gap: 14px; padding-top: 14px; }
.decode-status { padding: 12px 14px; border: 1px dashed var(--line); border-radius: var(--radius); color: var(--muted); }
.decode-status.error { border-color: rgba(232,69,94,.45); color: #e88796; }
.decode-overview { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 12px; }
.decode-summary { grid-column: span 12; display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 1px; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--line); }
.decode-metric { padding: 15px; background: var(--panel); }
.decode-metric b { display: block; margin-top: 4px; font-size: 20px; }
.decode-k { color: var(--muted); font-size: 10px; font-weight: 750; letter-spacing: .7px; text-transform: uppercase; }
.decode-card { grid-column: span 6; min-width: 0; }
.decode-card.full { grid-column: span 12; }
.decode-body { padding: 13px 15px; }
.decode-artifacts { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 7px; }
.decode-chip { padding: 9px 10px; border: 1px solid var(--line); border-radius: 7px; color: var(--muted); font-size: 11px; }
.decode-chip.ready { border-color: rgba(31,190,122,.4); color: #6fdcae; }
.decode-chip.missing, .decode-chip.error { border-color: rgba(232,69,94,.35); color: #e88796; }
.decode-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.decode-table th, .decode-table td { padding: 9px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.decode-table th { color: var(--muted); font-size: 9px; letter-spacing: .6px; text-transform: uppercase; }
.decode-table tbody tr:last-child td { border-bottom: 0; }
.decode-table button { padding: 5px 9px; font-size: 10px; }
.decode-warning-list { margin: 0; padding-left: 18px; color: #dfbd70; }
.decode-detail .panel-head { position: sticky; top: 64px; z-index: 2; background: var(--panel); }
.decode-detail-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; padding: 14px; }
.decode-detail-section { min-width: 0; padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel-2); }
.decode-detail-section h3 { margin: 0 0 10px; font-size: 12px; letter-spacing: .6px; }
.decode-detail-section code { color: #b8c8d8; }
.decode-bar { height: 8px; margin: 8px 0; overflow: hidden; border-radius: 999px; background: #071019; }
.decode-bar span { display: block; height: 100%; background: var(--accent); }
.decode-bar-tiered { display: flex; }
.decode-bar-tiered span { display: inline-block; }
.decode-note { color: var(--muted); font-size: 11px; }
@media (max-width: 900px) {
  .decode-summary { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .decode-card { grid-column: span 12; }
  .decode-artifacts { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .decode-detail-grid { grid-template-columns: 1fr; }
}

/* Decode: annotated byte view */
.decode-bytes { margin-top: 14px; }
.hex-controls { display: flex; gap: 8px; align-items: center; margin: 8px 0; }
.hex-controls input { width: 110px; background: #071019; border: 1px solid #1e2b3a; color: #e7eef6; border-radius: 6px; padding: 4px 8px; font: 11px ui-monospace, monospace; }
.hex-controls button { background: #101a26; border: 1px solid #1e2b3a; color: #aab9c8; border-radius: 6px; padding: 4px 10px; cursor: pointer; font-size: 11px; }
.hex-controls button:hover { color: #e7eef6; border-color: #2a3a4d; }
.hex-detail { font: 11px ui-monospace, monospace; color: #7fd4a8; min-height: 16px; margin: 4px 0; }
.hex-grid { font: 11px/1.5 ui-monospace, monospace; overflow-x: auto; background: #060b12; border: 1px solid #101a26; border-radius: 8px; padding: 8px 10px; }
.hex-row { display: flex; gap: 12px; white-space: nowrap; }
.hex-off { color: #46586b; }
.hex-bytes .hex-b { padding: 0 2px; border-radius: 2px; }
.hex-boundary { box-shadow: inset 2px 0 0 rgba(231, 238, 246, 0.55); }
.hex-ascii { color: #8497a9; letter-spacing: 1px; }
.hex-ascii .hex-a { padding: 0; }
.hexk-movement { background: rgba(77, 143, 209, 0.28); }
.hexk-weapon { background: rgba(196, 149, 62, 0.30); }
.hexk-clock { background: rgba(63, 185, 127, 0.28); }
.hexk-feedback { background: rgba(186, 108, 199, 0.28); }
.hexk-payload { background: rgba(132, 151, 169, 0.10); }
.hexk-dark { background: rgba(192, 87, 79, 0.30); }
.hex-ascii .hexk-payload, .hex-ascii .hexk-movement, .hex-ascii .hexk-weapon,
.hex-ascii .hexk-clock, .hex-ascii .hexk-feedback, .hex-ascii .hexk-dark { background: transparent; }
.hex-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 8px; font-size: 11px; color: #aab9c8; }
.hex-legend-item { display: flex; align-items: center; gap: 6px; }
.hex-swatch { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
