/* Gameviewer — main stylesheet */
:root {
  --ink: #1a2744; --ink-2: #243451; --ink-3: #314260;
  --content-bg: #f4f4f6; --content-panel: #fff; --content-panel-2: #eef0f2;
  --cream: #f4f4f6; --cream-2: #eef0f2; --cream-line: #e4e4ea;
  --paper: #18181b; --paper-soft: #5c5c66;
  --accent: #1a9ddd; --accent-2: #1a9ddd;
  --accent-text: #006b9c; --focus-ring: #006b9c;
  --winner: #138a5b;
  --row-alt: #f9fafb;
  --live: #1a9ddd;
  --neutral: #d8d8e0;
  --white-sq: #f0d9b5; --black-sq: #b58863;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { height: 100dvh; background: var(--content-bg); scrollbar-gutter: stable; }
body {
  font-family: 'Albert Sans', system-ui, sans-serif;
  background: var(--content-bg);
  color: var(--paper);
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  overflow-y: auto;
  max-width: 1700px;
  margin: 0 auto;
  min-height: 100dvh;
  width: 100%;
}
.mono { font-family: 'Inter', system-ui, sans-serif; }

/* ── TOP BAR ───────────────────────────────────────────────── */
.topbar {
  display: flex; align-items: center; gap: 32px;
  background: var(--ink); padding: 0 24px; height: 60px;
  flex: 0 0 auto; position: relative; z-index: 100;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.brand-home { display: inline-flex; align-items: center; flex: 0 0 auto; }
.brand-logo { height: 44px; width: 53.4px; aspect-ratio: 2000 / 1648; display: block; }
.nav-spacer { flex: 1; }
.nav { display: flex; align-items: center; gap: 28px; }
.nav a {
  position: relative; color: #aeb6c6; font-weight: 600;
  font-size: 14px; letter-spacing: 0; cursor: pointer;
  padding: 6px 2px; transition: color .15s; text-decoration: none; white-space: nowrap;
}
.nav a:hover { color: #fff; }
.nav a.is-active { color: #fff; }
.nav a.is-active::after {
  content: ""; position: absolute; left: 0; right: 0;
  bottom: -2px; height: 3px; background: var(--accent);
}
.live-dot {
  display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  background: var(--live); margin-left: 6px; vertical-align: middle;
  animation: pulse 1.6s infinite;
}
@keyframes pulse {
  0%, 100% { opacity: .65; }
  50% { opacity: 1; }
}
.burger {
  display: none; flex-direction: column; gap: 5px;
  background: none; border: 0; cursor: pointer; padding: 6px;
}
.burger span { width: 24px; height: 2.5px; background: #fff; border-radius: 2px; transition: .2s; }
.burger.open span:nth-child(1) { transform: translateY(7.5px) rotate(45deg); }
.burger.open span:nth-child(2) { opacity: 0; }
.burger.open span:nth-child(3) { transform: translateY(-7.5px) rotate(-45deg); }
.nav-mobile {
  display: none; position: absolute; top: 60px; left: 0; right: 0;
  flex-direction: column; background: var(--ink-2); z-index: 99;
  box-shadow: 0 14px 30px rgba(0,0,0,.4);
}
.nav-mobile a {
  padding: 14px 20px; font-size: 15px; letter-spacing: 0; font-weight: 600;
  color: #aeb6c6; cursor: pointer; border-bottom: 1px solid rgba(255,255,255,.05);
  text-decoration: none;
}
.nav-mobile a.is-active { color: #fff; background: rgba(26,157,221,.12); }
.nav-mobile.open { display: flex; }

/* ── STANDINGS BAR ─────────────────────────────────────────── */
.standings {
  display: flex; align-items: stretch; background: var(--cream);
  flex: 0 0 auto; border-bottom: 1px solid var(--cream-line);
  position: relative; z-index: 50; min-height: 58px;
}
.match {
  display: none; flex-direction: column; justify-content: center; gap: 6px;
  padding: 0 22px; background: var(--ink); color: #fff;
  flex: 0 0 auto; min-width: fit-content;
}
.match-score { display: flex; align-items: center; gap: 12px; }
.ms-team { display: flex; align-items: center; gap: 7px; font-weight: 700; font-size: 18px; letter-spacing: 0; }
.ms-nums { display: flex; align-items: center; gap: 6px; font-weight: 600; font-size: 22px; }
.ms-nums i { font-style: normal; color: var(--accent-2); font-weight: 400; }
.ms-nums b { min-width: 1em; text-align: center; }

/* flag-icons sizing override */
.fi {
  width: 26px !important; height: 17px !important;
  border-radius: 2px; box-shadow: 0 0 0 1px rgba(0,0,0,.18);
  flex: 0 0 auto; background-size: cover !important;
}

.liverow { display: flex; align-items: stretch; flex: 1; min-width: 0; background: var(--content-panel-2); }
.round-wrap { position: relative; display: flex; align-items: center; padding: 0 14px; flex: 0 0 auto; z-index: 60; }
.round-btn {
  display: flex; align-items: center; gap: 8px; cursor: pointer;
  background: #fff; border: 1px solid var(--cream-line); border-radius: 999px;
  padding: 8px 14px; font-family: 'Inter', system-ui, sans-serif; font-weight: 700;
  font-size: 12px; letter-spacing: 0; color: var(--ink);
  transition: .15s; box-shadow: 0 2px 9px rgba(26,39,68,.08); white-space: nowrap;
}
.round-btn:hover { border-color: var(--accent); color: var(--ink); }
.round-btn:hover .round-live { background: var(--accent); }
.round-btn.final { background: var(--ink); color: #fff; box-shadow: none; border-color: var(--ink); }
.round-live { width: 8px; height: 8px; border-radius: 50%; background: var(--live); animation: pulse 1.6s infinite; flex: 0 0 auto; }
.round-caret { opacity: .65; transition: transform .2s; }
.round-btn.open .round-caret { transform: rotate(180deg); }
.round-menu {
  position: absolute; top: calc(100% + 4px); left: 14px; z-index: 70;
  min-width: 160px; background: #fff; border: 1px solid var(--cream-line); border-radius: 6px;
  overflow: hidden; padding: 5px; box-shadow: 0 16px 34px rgba(26,39,68,.16);
}
.round-menu button {
  display: flex; width: 100%; align-items: center; justify-content: space-between; gap: 8px;
  background: none; border: 0; color: var(--ink); font-family: 'Inter', system-ui, sans-serif; font-weight: 700;
  font-size: 13px; letter-spacing: 0; padding: 9px 11px; border-radius: 4px; cursor: pointer; text-align: left;
}
.round-menu button:hover { background: var(--cream-2); color: var(--ink); }
.round-menu button.active { color: var(--accent-text); }

.engine-toggle {
  flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-width: 112px; padding: 0 12px; border: 0; border-left: 1px solid var(--cream-line);
  background: transparent; color: var(--paper-soft); cursor: pointer;
  font-family: 'Inter', system-ui, sans-serif; font-size: 11px; font-weight: 700; letter-spacing: 0;
}
.engine-toggle:hover { color: var(--ink); background: rgba(255,255,255,.28); }
.toggle-track { width: 26px; height: 14px; padding: 2px; display: flex; align-items: center; border-radius: 7px; background: var(--neutral); transition: background .15s; }
.toggle-knob { width: 10px; height: 10px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(26,39,68,.24); transform: translateX(0); transition: transform .15s; }
.engine-toggle.active { color: var(--ink); }
.engine-toggle.active .toggle-track { background: var(--ink); }
.engine-toggle.active .toggle-knob { transform: translateX(12px); }

.games { display: flex; align-items: stretch; flex: 1; min-width: 0; border-left: 1px solid var(--cream-line); background: var(--content-panel-2); }
.game-wrap { position: relative; flex: 1; min-width: 0; max-width: 250px; display: flex; }
.game {
  flex: 1; min-width: 0; display: flex; flex-direction: column;
  justify-content: center; gap: 5px; padding: 6px 10px;
  background: none; border: 0; border-right: 1px solid var(--cream-line);
  cursor: pointer; text-align: left; transition: background .15s;
}
.game-wrap:last-child .game { border-right: 0; }
.game:hover, .game-wrap:hover .game { background: var(--cream-2); }
.game-top { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.game-players {
  display: grid; grid-template-columns: minmax(0, 1fr) 14px minmax(0, 1fr); align-items: center; gap: 0;
  font-weight: 700; font-size: 14px; letter-spacing: 0;
  color: var(--paper); white-space: nowrap; width: 100%; min-width: 0;
}
.game-player-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.game-player-name.white { text-align: right; }
.game-player-name.black { text-align: left; }
.game-player-name.winner { text-decoration: underline; text-decoration-color: var(--accent); text-decoration-thickness: 2px; text-underline-offset: 3px; }
.gp-dash { opacity: .4; font-weight: 400; font-size: 13px; text-align: center; }
.game-res {
  min-width: 56px;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  margin: 0 auto;
  font-family: 'Inter', system-ui, sans-serif;
  font-weight: 700;
  font-size: 12px;
  color: var(--ink);
  text-align: center;
  letter-spacing: 0;
  background: #fff;
  border: 1px solid rgba(26,39,68,.38);
  border-radius: 0;
  padding: 4px 10px;
}
.game-res.spoiler { color: var(--ink); background: #fff; letter-spacing: 0; }

/* Eval bar */
.eval {
  position: relative; display: flex; height: 9px; border-radius: 2px;
  overflow: hidden; background: #111; box-shadow: inset 0 0 0 1px rgba(26,39,68,.3);
  width: 100%; max-width: 200px; margin: 0 auto;
}
.eval-white { background: #fff; }
.eval-black { background: #111; }
.eval-mid {
  display: block;
  position: absolute; left: 50%; top: -2px; bottom: -2px; width: 2px;
  background: #d12f2f; transform: translateX(-1px);
  border-radius: 1px;
}
.game-latest-move {
  width: 100%; min-height: 12px; color: var(--ink); font-size: 12px;
  font-weight: 700; line-height: 1; text-align: center; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}

/* Game hover popover — CSS :hover driven (reliable across all browsers) */
.game-pop {
  position: absolute; top: calc(100% + 8px); left: 50%; transform: translateX(-50%);
  z-index: 80; width: 240px; background: var(--ink); border-radius: 7px;
  padding: 0; box-shadow: 0 20px 44px rgba(0,0,0,.45);
  /* Hidden by default */
  display: none; opacity: 0; visibility: hidden; pointer-events: none;
  transition: opacity .12s ease, visibility .12s;
  transition-delay: 0s;
}
/* Show on CSS hover — works for element + all descendants regardless of position */
.game-wrap:hover .game-pop,
.game-wrap.preview-open .game-pop {
  display: block; opacity: 1; visibility: visible; pointer-events: auto;
  transition-delay: 0.05s; /* tiny delay prevents flicker on fast mouse moves */
}
.game-pop::before {
  content: ""; position: absolute; top: -6px; left: 50%;
  transform: translateX(-50%) rotate(45deg);
  width: 12px; height: 12px; background: var(--ink);
}
.game-wrap:first-child .game-pop { left: 8px; transform: none; }
.game-wrap:last-child .game-pop { left: auto; right: 8px; transform: none; }
.game-wrap:first-child .game-pop::before { left: 32px; transform: rotate(45deg); }
.game-wrap:last-child .game-pop::before { left: auto; right: 32px; transform: rotate(45deg); }
.game-pop-player {
  display: flex; align-items: center; gap: 7px; min-height: 28px; padding: 5px 9px;
  font-weight: 700; font-size: 13px; letter-spacing: 0;
}
.game-pop-player.top { background: var(--ink); color: #fff; border-radius: 7px 7px 0 0; }
.game-pop-player.bottom { background: #fff; color: var(--ink); }
.game-pop-player span:last-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.game-pop-dot { width: 9px; height: 9px; flex: 0 0 9px; border: 1.5px solid transparent; border-radius: 50%; }
.game-pop-player.top .game-pop-dot.active { background: #111; border-color: #fff; }
.game-pop-player.bottom .game-pop-dot.active { background: #fff; border-color: var(--ink); }
.game-pop-foot { padding: 7px 9px 8px; text-align: center; color: #fff; font-size: 13px; font-weight: 700; letter-spacing: 0; }
.mini-board { display: grid; grid-template-columns: repeat(8,1fr); aspect-ratio: 1/1; width: 100%; overflow: hidden; }
.mb-sq { display: flex; align-items: center; justify-content: center; aspect-ratio: 1/1; }
.mb-sq.lt { background: var(--white-sq); }
.mb-sq.dk { background: var(--black-sq); }
.mb-p { font-size: 16px; line-height: 1; user-select: none; }
.mb-p.wp { color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.6); }
.mb-p.bp { color: #1a1a1a; text-shadow: 0 1px 0 rgba(255,255,255,.25); }

/* ── STAGE ─────────────────────────────────────────────────── */
.stage {
  flex: 1 0 auto; min-height: 0; display: grid;
  height: calc(100dvh - 118px);
  grid-template-columns: auto 1fr; gap: 14px; padding: 14px;
  background: var(--content-bg);
  align-items: start; overflow: visible; box-sizing: border-box;
}
.board-col { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.stream-col { display: flex; flex-direction: column; gap: 10px; min-width: 0; width: 100%; }
.board-head { display: flex; align-items: center; }
.board-loading-shell {
  width: min(100%, calc(var(--loading-board-size, min(560px, calc(100vw - 32px))) + 18px));
  min-height: calc(var(--loading-board-size, min(560px, calc(100vw - 32px))) + 96px);
  border: 1px solid var(--cream-line);
  border-radius: 6px;
  background: var(--content-panel);
  box-shadow: 0 18px 44px rgba(26,39,68,.05);
}

/* Chess board shell */
.board-stack { display: grid; gap: 8px; width: 100%; min-width: 0; }
.chess-board-wrap {
  --eval-rail-lane-width: 16px;
  --eval-rail-gutter: 4px;
  --eval-rail-frame: #747d8c;
  display: block;
  background: var(--content-panel);
  border: 1px solid var(--cream-line);
  border-radius: 6px;
  overflow: hidden;
  flex: 0 0 auto;
  box-shadow: 0 18px 44px rgba(26,39,68,.08);
}
.chess-board-wrap.has-eval-rail > .board-player { width: calc(100% - var(--eval-rail-lane-width, 16px)); }
.board-player { display: flex; align-items: stretch; gap: 10px; padding: 0 0 0 14px; min-height: 48px; font-weight: 600; font-size: 23px; letter-spacing: 0; }
.board-player.top  { background: var(--ink); color: #fff; }
.board-player.bottom { background: #fff; color: var(--ink); }
.board-player-name { flex: 1; min-width: 0; align-self: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player-rating { font-size: .78em; font-weight: 600; opacity: .76; }
.board-player-clock {
  align-self: stretch;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Inter', system-ui, sans-serif;
  font-weight: 800;
  background: rgba(255,255,255,.1);
  color: #fff;
  padding: 0 18px;
  border-radius: 0;
  font-size: 20px;
  white-space: nowrap;
  min-width: 112px;
  text-align: center;
}
.board-player.bottom .board-player-clock { background: var(--cream-2); color: var(--ink); }
.board-player-clock.ticking { text-decoration: underline; text-decoration-color: var(--accent); text-decoration-thickness: 3px; text-underline-offset: 5px; }
.board-player-result { align-self: stretch; display: flex; align-items: center; justify-content: center; min-width: 112px; text-align: center; font-family: 'Inter', system-ui, sans-serif; font-weight: 800; font-size: 20px; padding: 0 18px; border-radius: 0; white-space: nowrap; letter-spacing: 0; }
.board-player.top    .board-player-result { background: #fff; color: var(--ink); }
.board-player.bottom .board-player-result { background: var(--ink); color: #fff; }
.board-player-result.winner,
.board-player-result.spoiler { border-radius: 0; }
.board-player-dot-slot { width: 16px; height: 16px; flex: 0 0 16px; align-self: center; display: flex; align-items: center; justify-content: center; }
.board-player-dot { width: 11px; height: 11px; border-radius: 50%; border: 2.5px solid transparent; flex: 0 0 auto; }
.board-player.top .board-player-dot.active { background: #111; border-color: #fff; }
.board-player.bottom .board-player-dot.active { background: #fff; border-color: var(--ink); }
.last-move-square { box-shadow: inset 0 0 0 999px rgba(255,210,54,.36), inset 0 0 0 3px rgba(117,80,12,.42); }
.mb-chessboard .last-move-square,
.mini-board .last-move-square { box-shadow: inset 0 0 0 999px rgba(255,210,54,.36), inset 0 0 0 1px rgba(117,80,12,.42); }

/* Board-height evaluation lane. The white gutter separates the gauge from the
   chessboard while the one-pixel frame keeps both gauge segments defined. */
.board-eval-wrap { display: flex; flex: 0 0 auto; }
.eval-rail-lane { width: var(--eval-rail-lane-width, 16px); flex: 0 0 var(--eval-rail-lane-width, 16px); align-self: stretch; display: flex; padding-left: var(--eval-rail-gutter, 4px); background: #fff; }
.eval-bar-v { width: 12px; flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; border: 1px solid var(--eval-rail-frame, #747d8c); border-radius: 0; overflow: hidden; position: relative; background: #111; }
.eval-bar-v-black { background: #111; }
.eval-bar-v-white { background: #fff; }
.eval-bar-v-mid { display: block; position: absolute; left: 0; right: 0; height: 2px; background: #d12f2f; top: 50%; margin-top: -1px; }

/* Multiview grid */
.multiboard-wrap { display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; gap: 10px; width: 100%; min-width: 0; }
.mb-cell {
  --eval-rail-lane-width: 16px;
  --eval-rail-gutter: 4px;
  --eval-rail-frame: #747d8c;
  display: flex; flex-direction: column; background: var(--content-panel);
  border: 1px solid var(--cream-line); border-radius: 6px; overflow: hidden; text-decoration: none;
  cursor: pointer; transition: outline .12s;
}
.mb-cell.has-eval-rail > .mb-player { width: calc(100% - var(--eval-rail-lane-width, 16px)); }
.mb-cell:hover { outline: 2px solid var(--accent); outline-offset: -2px; }
.mb-player { display: flex; align-items: center; gap: 6px; padding: 5px 8px; font-size: 12px; font-weight: 700; letter-spacing: 0; flex: 0 0 auto; }
.mb-player.top    { background: var(--ink); color: #fff; }
.mb-player.bottom { background: #fff; color: var(--ink); }
.mb-player-name   { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mb-player-clock  { font-family: 'Inter', system-ui, sans-serif; font-size: 12px; font-weight: 800; opacity: .9; }
.mb-player-clock.ticking { text-decoration: underline; text-decoration-color: var(--accent); text-decoration-thickness: 2px; text-underline-offset: 3px; }
.mb-player-score  { min-width: 28px; text-align: center; font-family: 'Inter', system-ui, sans-serif; font-size: 10px; font-weight: 800; padding: 2px 6px; border-radius: 0; opacity: .95; letter-spacing: 0; background: var(--ink); color: #fff; }
.mb-player-score.winner { background: var(--ink); color: #fff; opacity: 1; }
.mb-player-score.spoiler { background: var(--ink); color: #fff; opacity: 1; }
.mb-player.top .mb-player-score,
.mb-player.top .mb-player-score.winner,
.mb-player.top .mb-player-score.spoiler { background: #fff; color: var(--ink); }
.mb-dot { width: 8px; height: 8px; border-radius: 50%; border: 1.5px solid transparent; flex: 0 0 8px; }
.mb-player.top .mb-dot.active { background: #111; border-color: #fff; }
.mb-player.bottom .mb-dot.active { background: #fff; border-color: var(--ink); }
.mb-board-row { display: flex; flex: 1; min-height: 0; width: 100%; overflow: hidden; background: var(--ink); }
.mb-chessboard { flex: 1; min-width: 0; }

/* Board view switch */
.mv-switch { display: flex; width: 100%; background: transparent; border-bottom: 1px solid var(--cream-line); border-radius: 0; padding: 0; gap: 0; }
.mv-switch button {
  flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 7px; background: none; border: 0;
  border-bottom: 2px solid transparent;
  cursor: pointer; color: var(--paper-soft); font-family: 'Inter', system-ui, sans-serif; font-weight: 700;
  font-size: 13px; letter-spacing: 0; padding: 9px 12px 8px; border-radius: 0; transition: .15s;
}
.mv-switch button:hover { color: var(--ink); }
.mv-switch button.active { background: transparent; color: var(--ink); border-bottom-color: var(--accent); }
.mv-switch button:focus-visible { outline: 0; box-shadow: inset 0 0 0 3px var(--focus-ring); }

/* Move navigator */
.move-nav {
  background: var(--content-panel);
  border: 1px solid var(--cream-line);
  border-radius: 6px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  padding: 10px;
  min-width: 0;
  width: 100%;
}
.move-nav-head { display: grid; grid-template-columns: 1fr; align-items: center; gap: 10px; min-width: 0; }
.move-status {
  flex: 0 0 auto;
  min-width: 54px;
  text-align: center;
  border-radius: 3px;
  background: var(--cream-2);
  color: var(--ink);
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  padding: 6px 8px;
}
.move-status.live { background: rgba(26,157,221,.18); color: var(--ink); }
.move-status.finished { background: var(--ink); color: #fff; }
.move-controls { display: grid; grid-template-columns: repeat(4, minmax(58px, 1fr)); gap: 6px; justify-content: center; min-width: 0; }
.move-controls button,
.move-chip {
  border: 0;
  border-radius: 3px;
  background: var(--cream);
  color: var(--ink);
  cursor: pointer;
  font-family: 'Inter', system-ui, sans-serif;
  font-weight: 700;
}
.move-controls button { min-width: 58px; padding: 11px 14px; text-align: center; font-size: 15px; }
.move-controls button:hover,
.move-chip:hover { filter: brightness(.96); }
.move-chip:focus-visible,
.move-controls button:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
.move-list {
  display: flex;
  align-items: center;
  gap: 10px;
  overflow-x: auto;
  scrollbar-width: none;
  white-space: nowrap;
  min-width: 0;
  cursor: grab;
  user-select: none;
  touch-action: pan-y;
}
.move-list.dragging { cursor: grabbing; }
.move-list::-webkit-scrollbar { display: none; }
.move-pair { display: inline-flex; align-items: center; gap: 4px; }
.move-no { color: var(--paper-soft); font-family: 'Inter', system-ui, sans-serif; font-size: 14px; font-weight: 700; }
.move-chip { padding: 8px 10px; background: #edf1f8; font-size: 15px; }
.move-chip.class-book { background: #d6c0a0; color: #172743; }
.move-chip.class-best,
.move-chip.class-excellent,
.move-chip.class-good { background: #edf1f8; color: var(--ink); }
.move-chip.class-inaccuracy { background: #f0c85e; color: #2b2108; }
.move-chip.class-mistake { background: #ee9347; color: #2c1305; }
.move-chip.class-blunder { background: #d95555; color: #fff; }
.move-chip.active { background: var(--ink); color: #fff; box-shadow: none; }
.move-analysis {
  min-height: 148px;
  border-top: 1px solid var(--cream-line);
  padding-top: 0;
  display: grid;
  grid-template-rows: 64px minmax(74px, auto);
  gap: 10px;
}
.analysis-tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); width: 100%; height: 64px; border-bottom: 1px solid var(--cream-line); }
.analysis-tabs.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.analysis-tabs.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.analysis-tabs button { min-width: 0; width: 100%; height: 64px; padding: 9px 6px 8px; background: none; border: 0; border-bottom: 2px solid transparent; color: var(--paper-soft); cursor: pointer; font: inherit; overflow: hidden; }
.analysis-tab-label, .analysis-tab-value { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.analysis-tab-label { color: var(--ink); font-size: 15px; font-weight: 800; line-height: 1.2; }
.analysis-tab-value { margin-top: 3px; color: var(--paper-soft); font-size: 14px; font-weight: 700; line-height: 1.2; }
.analysis-tabs button + button { border-left: 1px solid var(--cream-line); }
.analysis-tabs button:hover { color: var(--ink); }
.analysis-tabs button.active { color: var(--ink); border-bottom-color: var(--accent); }
.analysis-tabs button[aria-disabled="true"] { cursor: default; opacity: .55; }
.analysis-tabs button:focus-visible { outline: 0; box-shadow: inset 0 0 0 3px var(--focus-ring); }
.analysis-panel { padding: 0 12px 12px; min-width: 0; width: 100%; }
.analysis-candidates, .analysis-opening-rows { display: grid; gap: 4px; }
.analysis-candidate, .analysis-opening-row { padding: 8px 9px; }
.analysis-candidate.odd, .analysis-opening-row.odd { background: var(--content-panel-2); }
.analysis-candidate.even, .analysis-opening-row.even { background: #fff; }
.analysis-candidate-line, .analysis-opening-line { display: grid; grid-template-columns: 92px 72px minmax(0, 1fr); align-items: center; justify-content: start; gap: 11px; min-width: 0; color: var(--ink); font-size: 16px; font-weight: 700; }
.analysis-candidate-line > span:first-child, .analysis-opening-line > b { white-space: nowrap; }
.analysis-candidate-line b { color: var(--ink); font-weight: 800; white-space: nowrap; }
.analysis-wdl { display: grid; grid-template-columns: minmax(0, 1fr); align-items: center; gap: 4px; min-width: 0; width: 100%; margin-left: 0; }
.analysis-wdl-bar { display: flex; width: 100%; height: 10px; overflow: hidden; border: 1px solid rgba(26,39,68,.55); background: #111; }
.analysis-wdl-white { background: #fff; }
.analysis-wdl-draw { background: #aeb0b3; }
.analysis-wdl-black { background: #111; }
.analysis-wdl-label { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); color: var(--paper-soft); font-size: 11px; font-weight: 700; line-height: 1; white-space: nowrap; }
.analysis-wdl-label span:nth-child(1) { text-align: left; }
.analysis-wdl-label span:nth-child(2) { text-align: center; }
.analysis-wdl-label span:nth-child(3) { text-align: right; }
.analysis-opening-summary { color: var(--paper-soft); font-size: 14px; font-weight: 700; margin-bottom: 10px; }
.analysis-opening-row { min-width: 0; }
.analysis-opening-line { grid-template-columns: 92px 132px minmax(0, 1fr); }
.analysis-opening-line > span:not(.analysis-wdl) { color: var(--paper-soft); font-size: 14px; font-weight: 600; white-space: nowrap; }
.analysis-tablebase, .analysis-claim { display: grid; gap: 9px; color: var(--ink); }
.analysis-tablebase > strong, .analysis-claim > strong { padding: 0 9px; font-size: 17px; }
.analysis-tablebase-rows, .analysis-claim-rows { display: grid; gap: 4px; }
.analysis-tablebase-row, .analysis-claim-row { display: grid; grid-template-columns: 120px minmax(0, 1fr); align-items: start; gap: 11px; padding: 8px 9px; font-size: 15px; }
.analysis-tablebase-row.odd, .analysis-claim-row.odd { background: var(--content-panel-2); }
.analysis-tablebase-row.even, .analysis-claim-row.even { background: #fff; }
.analysis-tablebase-row b, .analysis-claim-row b { color: var(--ink); font-weight: 800; }
.analysis-tablebase-row span, .analysis-claim-row span { color: var(--paper-soft); font-weight: 600; }
.analysis-empty { color: var(--paper-soft); font-size: 13px; font-weight: 600; padding: 4px 0; }

/* ── CAMERA SELECTOR ───────────────────────────────────────── */
.cams { display: flex; background: #fff; border: 1px solid var(--cream-line); border-radius: 6px; overflow-x: auto; overflow-y: hidden; flex: 0 0 auto; scrollbar-width: none; }
.cams::-webkit-scrollbar { display: none; }
.cam-tab { flex: 1 0 145px; min-width: 0; display: flex; align-items: stretch; border-right: 1px solid var(--cream-line); position: relative; transition: opacity .15s; }
.cam-tab:last-child { border-right: 0; }
.cam-tab.off { opacity: .4; }
.cam-eye  { display: flex; align-items: center; padding: 0 0 0 10px; background: none; border: 0; cursor: pointer; flex: 0 0 auto; }
.cam-check { display: flex; align-items: center; justify-content: center; width: 18px; height: 18px; border-radius: 4px; border: 1.5px solid var(--cream-line); color: var(--ink); background: transparent; transition: .15s; }
.cam-tab:not(.off) .cam-check { background: var(--accent); border-color: var(--accent); }
.cam-eye:hover .cam-check { border-color: var(--accent-2); }
.cam-pick { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; background: none; border: 0; cursor: pointer; padding: 9px 11px 9px 9px; text-align: left; }
.cam-pick:hover { background: var(--cream-2); }
.cam-meta { display: flex; flex-direction: column; min-width: 0; gap: 1px; }
.cam-k { font-weight: 700; font-size: 10px; letter-spacing: 0; color: var(--paper-soft); white-space: nowrap; }
.cam-k.on-air { color: var(--accent-text); }
.cam-l { font-weight: 700; font-size: 13px; letter-spacing: 0; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cam-tab.primary { background: var(--content-panel-2); }
.cam-tab.primary::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: var(--accent); }
.video-slot-control { flex: 1 0 160px; min-width: 0; display: flex; align-items: center; gap: 7px; padding: 6px 8px; border-right: 1px solid var(--cream-line); }
.video-slot-control:last-child { border-right: 0; }
.video-count-control { flex: 0 0 82px; display: flex; align-items: center; gap: 6px; padding: 6px 8px; border-right: 1px solid var(--cream-line); }
.video-count-control .video-slot-select { width: 38px; padding-left: 5px; padding-right: 3px; }
.video-slot-meta { flex: 0 0 auto; }
.video-slot-k { display: block; font-weight: 700; font-size: 9px; letter-spacing: 0; color: var(--paper-soft); white-space: nowrap; }
.video-slot-select {
  flex: 1; min-width: 0; border: 1px solid rgba(255,255,255,.12); border-radius: 3px;
  background: #fff; color: var(--ink); font-family: 'Inter', system-ui, sans-serif; font-weight: 600;
  font-size: 12px; letter-spacing: 0; padding: 5px 7px; cursor: pointer;
}
.video-slot-select:disabled { opacity: .65; cursor: default; }
.video-empty {
  width: 100%;
  padding: 9px 12px;
  color: var(--paper-soft);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-align: center;
}

/* ── STREAM GRID ───────────────────────────────────────────── */
.stream-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 8px; }
.stream-cell { position: relative; border-radius: 6px; overflow: hidden; background: var(--content-panel); border: 1px solid var(--cream-line); aspect-ratio: 16/9; }
.stream-cell iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; display: block; }
.stream-cell.primary { outline: 0; }
.stream-placeholder { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; color: rgba(26,39,68,.3); font-size: 13px; font-weight: 600; letter-spacing: 0; pointer-events: none; }
.stream-placeholder svg { opacity: .25; }
.stream-grid.n1 { grid-template-columns: 1fr; }
.stream-grid.n2 {
  grid-template-columns: minmax(0, 1fr);
  width: min(100%, calc(88.889dvh - 187px));
  margin-inline: auto;
}
.stream-grid.n3 { grid-template-columns: 1fr 1fr; }
.stream-grid.n3 .p0 { grid-column: 1 / span 2; }
.stream-grid.n4 { grid-template-columns: 1fr 1fr; }

/* Persist video root */
#video-persist-root { position: absolute; top: 0; left: 0; width: 0; height: 0; overflow: visible; z-index: 40; pointer-events: none; }
.video-persist-slot { position: absolute; pointer-events: auto; border-radius: 4px; overflow: hidden; background: var(--content-panel); }
.video-persist-slot iframe { width: 100%; height: 100%; border: 0; display: block; }

/* ── PLACEHOLDER PAGES ─────────────────────────────────────── */
.page-content { flex: 1; display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 14px; color: var(--paper-soft); background: var(--content-bg); padding: 28px; text-align: center; }
.page-content h2 { color: var(--ink); font-size: 34px; letter-spacing: 0; font-weight: 800; }
.page-content p  { max-width: 520px; font-size: 15px; letter-spacing: 0; line-height: 1.45; }
.page-status { display: inline-flex; gap: 8px; align-items: center; color: var(--accent-text); font-size: 13px; font-weight: 700; letter-spacing: 0; }
.event-page { display: block; overflow-y: auto; text-align: left; padding: 32px max(20px, calc((100% - 1120px) / 2)); }
.event-page-inner { width: 100%; max-width: 1120px; margin: 0 auto; }
.event-kicker { color: var(--accent-text); font-family: 'Fjalla One', sans-serif; font-size: 14px; font-weight: 400; letter-spacing: .04em; text-transform: uppercase; margin-bottom: 8px; }
.event-page h1 { color: var(--ink); font-family: 'Fjalla One', sans-serif; font-size: 38px; line-height: 1; font-weight: 400; letter-spacing: .02em; text-transform: uppercase; margin-bottom: 10px; }
.event-page-lead { max-width: 720px; color: var(--paper-soft); font-size: 16px; line-height: 1.5; margin-bottom: 26px; }
.event-section { border-top: 1px solid var(--cream-line); padding: 20px 0; }
.event-section h2 { color: var(--ink); font-family: 'Fjalla One', sans-serif; font-size: 22px; font-weight: 400; letter-spacing: .02em; text-transform: uppercase; margin-bottom: 12px; }
.event-section h3 { color: var(--ink); font-size: 14px; font-weight: 800; margin: 0 0 7px; }
.event-section p { color: var(--paper-soft); font-size: 14px; line-height: 1.55; }
.event-grid { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.5fr); gap: 34px; }
.standings-page .event-grid { display: block; }
.standings-page .event-grid .event-section { max-width: 840px; }
.match-summary { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; max-width: 560px; color: var(--ink); margin: 0 0 22px; }
.match-summary-team { display: flex; align-items: center; gap: 9px; font-size: 18px; font-weight: 800; }
.match-summary-team.away { justify-content: flex-end; }
.match-summary-score { color: var(--ink); font-size: 28px; font-weight: 800; padding: 0 18px; }
.event-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.event-table th { color: var(--paper-soft); font-size: 11px; font-weight: 800; text-align: left; padding: 0 8px 8px; text-transform: uppercase; }
.event-table td { border-top: 1px solid var(--cream-line); color: var(--ink); font-weight: 600; padding: 10px 8px; }
.event-table .num { text-align: right; }
.event-table .leader td { font-weight: 800; }
.pairing-meta { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--paper-soft); font-size: 12px; font-weight: 700; margin-bottom: 10px; }
.pairing-meta b { color: var(--ink); }
.pairing-live { color: var(--accent-text); }
.event-note { color: var(--paper-soft); font-size: 12px; line-height: 1.45; margin-top: 12px; }
.info-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; }
.info-list { list-style: none; display: grid; gap: 7px; color: var(--paper-soft); font-size: 14px; line-height: 1.45; }
.info-list strong { color: var(--ink); }
.schedule-table td:first-child { color: var(--paper-soft); width: 64px; }
.event-link { color: var(--ink); font-weight: 700; text-decoration-color: var(--accent); text-underline-offset: 3px; }
.nav a, .nav-mobile a { font-family: 'Fjalla One', sans-serif; font-size: 16px; font-weight: 400; letter-spacing: .035em; }
.standings-inner { max-width: 840px; }
.standings-page .event-grid { display: block; }
.standings-page .event-grid .event-section { max-width: none; }
.standings-total { max-width: 780px; margin-top: 26px; }
.standings-total .round-team-score { padding-block: 16px; }
.standing-rounds { max-width: 780px; margin-top: 16px; border: 1px solid var(--cream-line); }
.standing-round + .standing-round { border-top: 1px solid var(--cream-line); }
.standing-round-toggle { position: relative; display: grid; grid-template-columns: 112px minmax(0, 1fr); align-items: stretch; width: 100%; border: 0; padding: 0; color: var(--ink); cursor: pointer; font: inherit; text-align: left; }
.standing-round-toggle { background: #fff; }
.standing-round:nth-child(even) .standing-round-toggle { background: var(--row-alt); }
.standing-round-toggle:disabled { cursor: default; opacity: 1; }
.standing-round-toggle:not(:disabled)::after { position: absolute; right: 10px; top: 50%; width: 7px; height: 7px; border-right: 2px solid var(--paper-soft); border-bottom: 2px solid var(--paper-soft); content: ''; transform: translateY(-65%) rotate(45deg); transition: transform .16s ease; }
.standing-round-toggle[aria-expanded="true"]::after { transform: translateY(-25%) rotate(225deg); }
.standing-round-toggle:focus-visible { z-index: 1; box-shadow: inset 0 0 0 3px var(--focus); outline: 0; }
.standing-round-name { display: flex; align-items: center; justify-content: center; border-right: 1px solid var(--cream-line); padding: 10px; font-family: 'Fjalla One', sans-serif; font-size: 18px; text-transform: uppercase; }
.standing-round-toggle .round-team-score { width: 100%; padding: 11px 32px 11px 16px; background: transparent; color: var(--ink); }
.standing-round-toggle .round-team-score i { color: var(--accent-text); }
.round-team-score.is-unknown { grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); }
.round-team-score .unknown-score { min-width: 70px; text-align: center; }
.standing-round-details { margin-left: 112px; border: 0; border-top: 1px solid var(--cream-line); }
.standing-round-details[hidden] { display: none; }
.player-standings { max-width: 780px; margin-top: 34px; }
.player-standings h2 { margin-bottom: 12px; color: var(--ink); font-family: 'Fjalla One', sans-serif; font-size: 28px; font-weight: 400; text-transform: uppercase; }
.individual-results-note { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; max-width: none !important; margin: 0; padding: 11px 12px; background: var(--ink); color: #fff; font-size: 11px; }
.individual-results-note strong { font-size: 12px; text-transform: uppercase; }
.individual-results-note span { color: rgba(255,255,255,.75); }
.player-standings-scroll { overflow-x: auto; }
.player-standings-table { width: 100%; border-collapse: collapse; background: #fff; color: var(--ink); }
.player-standings-table th, .player-standings-table td { height: 48px; border-bottom: 1px solid var(--cream-line); padding: 9px 12px; text-align: center; }
.player-standings-table thead th { background: var(--content-panel-2); font-size: 10px; font-weight: 800; text-transform: uppercase; }
.player-standings-table thead th:first-child { text-align: left; }
.player-standings-table tbody th { display: flex; align-items: center; gap: 9px; min-width: 210px; font-size: 14px; text-align: left; }
.player-standings-table tbody td { font-size: 14px; font-weight: 700; }
.player-standings-table tbody td:nth-child(2) { font-size: 16px; font-weight: 800; }
.player-standings-table tbody tr { background: #fff; }
.player-standings-table tbody tr:nth-child(even) { background: var(--row-alt); }
.standing-table { max-width: 520px; }
.pairing-list { max-width: 760px; border-top: 1px solid var(--cream-line); }
.pairing-row { display: grid; grid-template-columns: 38px minmax(0, 1fr) 28px minmax(0, 1fr); align-items: center; min-height: 54px; border-bottom: 1px solid var(--cream-line); font-size: 15px; font-weight: 700; }
.pairing-board { color: var(--paper-soft); font-family: 'Fjalla One', sans-serif; font-size: 18px; text-align: center; }
.pairing-white { min-width: 0; overflow: hidden; text-align: right; text-overflow: ellipsis; white-space: nowrap; }
.pairing-sep { color: var(--accent-text); font-family: 'Fjalla One', sans-serif; font-size: 16px; text-align: center; }
.pairing-black { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.results-inner { max-width: 840px; }
.round-result { max-width: 760px; }
.round-result-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 12px; }
.round-result-head h2 { margin-bottom: 2px; }
.round-result-head span { color: var(--paper-soft); font-size: 12px; font-weight: 700; }
.round-result-head .pairing-live { color: var(--accent-text); }
.round-complete { color: var(--ink) !important; border: 1px solid var(--cream-line); padding: 4px 7px; }
.round-team-score { display: grid; grid-template-columns: minmax(0, 1fr) auto auto auto minmax(0, 1fr); align-items: center; gap: 9px; padding: 10px 12px; background: var(--ink); color: #fff; font-size: 15px; font-weight: 800; }
.round-team-score span { display: flex; align-items: center; gap: 7px; min-width: 0; }
.round-team-score > span:first-child { justify-content: flex-end; text-align: right; }
.round-team-score > span:last-child { justify-content: flex-start; text-align: left; }
.round-team-score > span.winner, .result-player.winner { text-decoration: underline; text-decoration-color: var(--winner); text-decoration-thickness: 3px; text-underline-offset: 5px; }
.round-team-score b { font-size: 22px; }
.round-team-score i { color: var(--accent); font-style: normal; }
.result-games { border: 1px solid var(--cream-line); border-top: 0; }
.result-game { display: grid; grid-template-columns: minmax(0, 1fr) 70px minmax(0, 1fr); align-items: center; min-height: 52px; border-top: 1px solid var(--cream-line); background: #fff; color: var(--ink); font-size: 14px; font-weight: 700; }
.result-game:first-child { border-top: 0; }
.result-game:nth-child(even) { background: var(--row-alt); }
.result-player { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 12px; }
.result-player.white { text-align: right; }
.result-player.black { text-align: left; }
.result-score { align-self: stretch; display: flex; align-items: center; justify-content: center; background: var(--content-panel-2); font-size: 13px; text-align: center; }
.preview-notice { max-width: 760px !important; margin: -10px 0 24px; border-left: 3px solid var(--accent); padding: 9px 12px; background: rgba(26,157,221,.08); color: var(--paper-soft); font-size: 12px !important; }
.preview-notice strong { color: var(--ink); text-transform: uppercase; }
.stage-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.stage-heading h2 { margin: 0; }
.stage-heading span { color: var(--paper-soft); font-size: 12px; font-weight: 700; }
.results-stage { max-width: 780px; border-top: 1px solid var(--cream-line); padding: 22px 0 30px; }
.match-results-list { display: grid; gap: 18px; }
.match-result-card { border: 1px solid var(--cream-line); background: #fff; }
.match-result-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 12px; background: #fff; }
.match-result-card:nth-child(even) .match-result-head { background: var(--row-alt); }
.match-result-head > div { display: grid; gap: 2px; }
.match-stage { color: var(--ink); font-family: 'Fjalla One', sans-serif; font-size: 20px; text-transform: uppercase; }
.match-result-head small { color: var(--paper-soft); font-size: 11px; font-weight: 700; }
.match-points-award { min-height: 31px; display: flex; align-items: center; justify-content: center; border-bottom: 1px solid var(--cream-line); color: var(--paper-soft); font-size: 11px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.match-result-card.complete .match-points-award { color: var(--ink); }
.match-result-card .result-games { border: 0; }
.info-inner { max-width: 1040px; }
.info-lead { max-width: 780px; font-size: 18px; }
.event-facts { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 1px; margin: 30px 0 14px; background: var(--cream-line); }
.event-facts > div { min-width: 0; padding: 18px 14px; background: #fff; }
.event-facts > div + div { border-left: 1px solid var(--cream-line); }
.event-facts span { display: block; margin-bottom: 6px; color: var(--paper-soft); font-size: 10px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.event-facts strong { display: block; color: var(--ink); font-family: 'Fjalla One', sans-serif; font-size: 17px; font-weight: 400; line-height: 1.2; text-transform: uppercase; }
.info-story { margin-top: 14px; padding: 30px 34px; background: #fff; }
.story-content { max-width: none; }
.story-content h2 { margin-bottom: 13px; color: var(--ink); font-family: 'Fjalla One', sans-serif; font-size: 32px; font-weight: 400; letter-spacing: -.02em; text-transform: uppercase; }
.story-content p { max-width: 690px; color: var(--paper-soft); font-size: 15px; line-height: 1.65; }
.story-content .event-link { display: inline-block; margin-top: 14px; }
.roster-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; }
.roster-team { border-top: 3px solid var(--ink); background: #fff; }
.roster-team h3 { display: flex; align-items: center; gap: 8px; margin: 0; padding: 12px 0; color: var(--ink); font-family: 'Fjalla One', sans-serif; font-size: 22px; font-weight: 400; text-transform: uppercase; }
.roster-team ul { list-style: none; }
.roster-team li { display: grid; grid-template-columns: 62px minmax(0, 1fr); gap: 9px; border-top: 1px solid var(--cream-line); padding: 10px 0; color: var(--ink); font-size: 14px; font-weight: 700; }
.roster-team li span { color: var(--paper-soft); font-size: 10px; letter-spacing: .06em; text-transform: uppercase; }
.roster-team li.reserve { color: var(--paper-soft); }
.schedule-zone { margin-bottom: 10px; }
.schedule-list { border-top: 1px solid var(--cream-line); }
.schedule-list > div { display: grid; grid-template-columns: 138px 82px minmax(0, 1fr); align-items: baseline; gap: 14px; border-bottom: 1px solid var(--cream-line); padding: 11px 10px; background: #fff; }
.schedule-list > div:nth-child(even) { background: var(--row-alt); }
.schedule-list time { color: var(--paper-soft); font-size: 12px; font-weight: 700; }
.schedule-list span { color: var(--accent-text); font-size: 10px; font-weight: 800; text-transform: uppercase; }
.schedule-list strong { color: var(--ink); font-size: 14px; }
@media (max-width: 780px) {
  .event-page { padding: 24px 16px; }
  .event-page h1 { font-size: 27px; }
  .event-grid, .info-grid { grid-template-columns: 1fr; gap: 8px; }
  .event-section { padding: 17px 0; }
  .event-table { font-size: 12px; }
  .event-table th, .event-table td { padding-left: 5px; padding-right: 5px; }
  .analysis-wdl { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .analysis-wdl-bar { width: 100%; }
  .analysis-wdl-label { font-size: 9px; }
  .analysis-candidate-line { grid-template-columns: 76px 62px minmax(0, 1fr); gap: 7px; font-size: 14px; }
  .analysis-opening-line { grid-template-columns: 76px 108px minmax(0, 1fr); gap: 7px; font-size: 14px; }
  .analysis-opening-line > span:not(.analysis-wdl) { font-size: 12px; }
  .round-team-score { gap: 6px; padding: 9px; font-size: 13px; }
  .round-team-score b { font-size: 18px; }
  .result-game { grid-template-columns: minmax(0, 1fr) 56px minmax(0, 1fr); font-size: 12px; }
  .result-player { padding: 0 7px; }
  .standing-round-toggle { grid-template-columns: 78px minmax(0, 1fr); }
  .standing-round-name { padding: 8px 4px; font-size: 15px; }
  .standing-round-toggle .round-team-score { padding: 9px 24px 9px 7px; font-size: 11px; }
  .standing-round-toggle .round-team-score b { font-size: 16px; }
  .standing-round-details { margin-left: 78px; }
  .individual-results-note { align-items: flex-start; flex-direction: column; gap: 3px; }
  .pairing-row { grid-template-columns: 28px minmax(0, 1fr) 20px minmax(0, 1fr); font-size: 12px; }
  .event-facts { grid-template-columns: 1fr 1fr; }
  .event-facts > div { border-bottom: 1px solid var(--cream-line); }
  .event-facts > div + div { border-left: 0; }
  .event-facts > div:nth-child(even) { border-left: 1px solid var(--cream-line); }
  .event-facts > div:last-child { grid-column: 1 / -1; border-bottom: 0; }
  .info-story { padding: 24px 18px; }
  .story-content h2 { font-size: 27px; }
  .roster-grid { grid-template-columns: 1fr; gap: 22px; }
  .schedule-list > div { grid-template-columns: 112px minmax(0, 1fr); gap: 4px 12px; }
  .schedule-list strong { grid-column: 2; }
  .stage-heading { align-items: flex-end; }
}

/* ── MOBILE ────────────────────────────────────────────────── */
@media (max-width: 720px) {
  body { overflow: auto; }
  .nav { display: none; }
  .burger { display: flex; }
  .topbar { gap: 0; }
  .standings { flex-direction: column; min-height: auto; }
  .match { padding: 10px 16px; }
  .match-score { justify-content: center; }
  .liverow { overflow-x: auto; scrollbar-width: none; background: var(--cream); }
  .liverow::-webkit-scrollbar { display: none; }
  .round-wrap { position: sticky; left: 0; z-index: 6; padding: 8px 12px; background: var(--cream); box-shadow: 7px 0 11px -5px rgba(0,0,0,.2); }
  .engine-toggle { min-width: 106px; padding: 0 10px; background: var(--cream); }
  .games { flex: 0 0 auto; border-left: 0; }
  .game-wrap { flex: 0 0 auto; width: 250px; }
  .game { padding: 8px 12px; }
  .round-menu {
    position: fixed;
    top: var(--round-menu-top, 113px);
    left: var(--round-menu-left, 12px);
    max-height: calc(100dvh - var(--round-menu-top, 113px) - 8px);
    overflow-y: auto;
  }
  .game-pop {
    position: fixed;
    top: var(--compact-popover-top, 113px);
    left: 50% !important;
    right: auto !important;
    width: min(280px, calc(100vw - 24px));
    max-height: calc(100dvh - var(--compact-popover-top, 113px) - 8px);
    overflow-y: auto;
    transform: translateX(-50%) !important;
  }
  .game-pop::before { display: none; }
  .stage { grid-template-columns: 1fr; height: calc(100dvh - 120px); min-height: calc(100dvh - 120px); overflow: visible; gap: 10px; padding: 10px; }
  .board-col { width: 100% !important; }
  #board-area { min-height: calc(100dvh - 140px); }
  .board-stack { width: 100% !important; }
  .multiboard-wrap { width: 100% !important; }
  .mv-switch { width: 100%; }
  .mv-switch button { flex: 1; justify-content: center; }
  .chess-board-wrap { width: 100% !important; }
  .board-player { font-size: 18px; padding: 8px 10px; gap: 8px; }
  .board-player-clock { font-size: 17px; min-width: 92px; padding: 6px 10px; }
  .board-player-result { font-size: 17px; min-width: 92px; padding: 6px 10px; }
  .move-nav { padding: 7px; gap: 7px; }
  .move-nav-head { align-items: stretch; }
  .move-status { min-width: 48px; padding: 6px; }
  .move-controls { flex: 1; }
  .move-controls button { flex: 1; min-width: 0; }
  .cams { flex-wrap: wrap; overflow: visible; scrollbar-width: none; }
  .video-count-control { flex: 0 0 100%; border-right: 0; border-bottom: 1px solid var(--cream-line); }
  .video-slot-control { flex: 1 1 50%; min-width: 0; }
  .stream-grid.n2,
  .stream-grid.n3,
  .stream-grid.n4 { grid-template-columns: 1fr; width: 100%; margin-inline: 0; }
  .stream-grid.n3 .p0 { grid-column: auto; }
  .cams::-webkit-scrollbar { display: none; }
  .cam-tab { flex: 0 0 auto; }
}

@media (hover: none), (pointer: coarse) {
  .game-pop,
  .game-wrap:hover .game-pop {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
  }
  .game-wrap.preview-open .game-pop {
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
  }
}

/* ── Opening explorer panel (game view) ───────────────────── */
.opening-panel { display: none; }
.game-view .opening-panel { display: none; }
.op-inner { display: flex; flex-direction: column; gap: 8px; }
.op-tabs {
  display: flex;
  border-bottom: 1px solid var(--cream-line);
  gap: 14px;
}
.op-tabs button {
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  color: var(--paper-soft);
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  padding: 8px 0 7px;
}
.op-tabs button.active {
  color: var(--ink);
  border-bottom-color: var(--accent);
}
.op-panel { display: grid; gap: 8px; }
.op-opening-name {
  font-weight: 800; font-size: 17px; letter-spacing: 0;
  color: var(--ink); text-align: center; padding: 4px 0 2px;
}
.op-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--ink);
  color: #fff;
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 700;
}
.op-summary b { font-size: 18px; }
.op-row { background: #fff; border: 1px solid var(--cream-line); border-radius: 6px; padding: 9px 12px 7px; }
.op-row-title {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  font-weight: 700; font-size: 14px; letter-spacing: 0;
  color: var(--ink); margin-bottom: 7px;
}
.op-row-title span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.op-row-title b { color: var(--paper-soft); font-size: 12px; font-weight: 800; }
.op-bar {
  display: flex; height: 13px; border-radius: 3px; overflow: hidden;
  background: var(--neutral); box-shadow: inset 0 0 0 1px rgba(26,39,68,.12);
}
.op-bar-w { background: var(--cream); }
.op-bar-d { background: var(--accent); }
.op-bar-b { background: var(--ink); }
.op-pcts {
  display: flex; justify-content: space-between;
  font-size: 12px; color: var(--paper-soft); margin-top: 4px;
  font-family: 'Inter', system-ui, sans-serif;
}
.op-tb { background: #fff; border: 1px solid var(--cream-line); border-radius: 6px; padding: 10px 12px; border-left: 3px solid var(--accent); }
.op-tb-title { font-weight: 700; font-size: 11px; letter-spacing: 0; color: var(--accent-text); margin-bottom: 4px; }
.op-tb-verdict { font-weight: 700; font-size: 15px; color: var(--ink); }
.op-tb-moves { font-size: 13px; color: var(--paper-soft); margin-top: 4px; }
