/* Layout A2 of the redesign (ql-tournament-0110, docs/superpowers/specs/2026-10-22-analytics-redesign-design.md):
   a finished game of two players; js/finished.js adds html.an-v2 and renders .an2. The two players' colours, the rest
   neutral in the site's tokens (light and dark); the site red only for the cursor. */

.an-body {
  --an-p1: rgb(0, 212, 255);
  --an-p2: rgb(255, 0, 30);
}

html.an-v2 .an-page {
  max-width: none;
  padding: 12px 24px 0;
}

html.an-v2 .an-page > .public-header {
  display: none;
}

html.an-v2 .public-page > * + * {
  margin-top: 8px;
}

.an2 {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* The strip: back to Games, server and map, the score at the cursor in the players' colours. */
.an2-strip {
  display: flex;
  align-items: center;
  gap: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--surface-border);
}

.an2-back {
  color: var(--text-secondary);
  font-size: 0.8125rem;
  text-decoration: none;
  white-space: nowrap;
}

.an2-back::before {
  content: "\2039\00a0";
}

.an2-back:hover {
  color: var(--text-primary);
}

.an2-title {
  min-width: 0;
}

.an2-name {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.0625rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.an2-meta {
  margin: 0;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.an2-score {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 auto;
}

.an2-score-name {
  font-weight: 700;
  font-size: 1rem;
}

.an2-score-num {
  font-family: var(--font-mono);
  font-size: 1.75rem;
  line-height: 1;
}

.an2-sep {
  color: var(--text-muted);
}

/* Body: the map on the left, as tall as the body (its width set by js/finished.js); on the right the panels and,
   under them, the course of the match over the replay controls. */
.an2-body {
  display: grid;
  grid-template-columns: 480px minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 12px;
  min-height: 0;
}

.an2-map {
  grid-row: 1 / 3;
  grid-column: 1;
  position: relative;
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--surface-border);
  border-radius: 0.5rem;
  background: var(--surface-raised);
}

/* A box of a definite size, so the widget's fit (map-widget-fit-contain) reads the column's height; not when it is
   maximized (full screen: the engine's position: fixed over the window, vendor/overlay.css). */
.an2-map .match-map-widget:not(.map-widget-maximized) {
  position: absolute;
  inset: 0;
}

/* Full screen covers the page: analytics.css makes the widget's background transparent (for the column), which let
   the page show through the maximized map. */
.an-body .map-widget-root.map-widget-maximized {
  background: var(--surface-base);
}

/* The score is in the strip. */
.an2 #map-score {
  display: none;
}

.an2-side {
  grid-row: 1;
  grid-column: 2;
  min-height: 0;
  overflow: auto;
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  align-content: start;
  gap: 8px;
}

.an2-panel,
.an2-tile,
.an2-flow {
  min-width: 0;
  padding: 8px 12px;
  border: 1px solid var(--surface-border);
  border-radius: 0.5rem;
  background: var(--surface-raised);
  box-shadow: var(--shadow-card);
}

.an2-tiles {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.an2-weapons {
  grid-column: 1 / 8;
  grid-row: 2;
}

.an2-killed {
  grid-column: 8 / 13;
  grid-row: 2;
}

.an2-items {
  grid-column: 1 / 8;
  grid-row: 3;
}

.an2-events {
  grid-column: 8 / 13;
  grid-row: 3;
}

.an2-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 6px;
}

.an2-head h3,
.an2-flow-head h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.an2-hint {
  font-size: 0.6875rem;
  color: var(--text-muted);
}

.an2-empty {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.an2-p1-text {
  color: var(--an-p1);
}

.an2-p2-text {
  color: var(--an-p2);
}

.an2-p1-bg {
  background: var(--an-p1);
}

.an2-p2-bg {
  background: var(--an-p2);
}

.an2-num {
  font-family: var(--font-mono);
}

.an2-muted {
  color: var(--text-secondary);
}

.an2-strong {
  font-weight: 700;
}

.an2-right {
  text-align: right;
}

.an2-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2rem;
  height: 18px;
  padding: 0 4px;
  border: 1px solid var(--surface-border-strong);
  border-radius: 3px;
  background: var(--surface-elevated);
  font: 700 0.6875rem var(--font-mono);
  color: var(--text-primary);
}

/* Tiles: label, "a : b", a two-colour share bar. */
.an2-tile {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-top: 6px;
  padding-bottom: 8px;
}

.an2-tile-label {
  font-size: 0.6875rem;
  color: var(--text-secondary);
}

.an2-tile-value {
  font-family: var(--font-mono);
  font-size: 1rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.an2-share {
  display: flex;
  height: 5px;
  border-radius: 3px;
  overflow: hidden;
}

.an2-share-p1 {
  background: var(--an-p1);
}

.an2-share-p2 {
  flex: 1;
  background: var(--an-p2);
}

/* Weapons: damage | accuracy bar to the left | weapon | accuracy bar to the right | damage. */
.an2-wrow {
  display: grid;
  grid-template-columns: 3rem minmax(0, 1fr) 2.25rem minmax(0, 1fr) 3rem;
  gap: 8px;
  align-items: center;
  padding: 2px 0;
  font-size: 0.75rem;
}

.an2-wrow > .an2-num:first-child {
  text-align: right;
}

.an2-wbar {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  height: 16px;
}

.an2-wbar--left {
  flex-direction: row-reverse;
}

.an2-wfill {
  flex: none;
  height: 14px;
  border-radius: 2px;
}

.an2-wlabel {
  font-family: var(--font-mono);
  white-space: nowrap;
}

/* Match totals of a weapon the hub's timeline lost (js/stats-model.js weaponRowsAt `whole`). */
.an2-whole {
  opacity: 0.45;
}

.an2-note {
  margin: 6px 0 0;
  font-size: 0.6875rem;
  color: var(--text-muted);
}

.an2-held {
  outline: 2px solid var(--text-primary);
  outline-offset: 1px;
}

/* Killed with: one stacked bar per player in shades of the player's colour. */
.an2-krow {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 8px;
  margin-bottom: 8px;
  font-size: 0.8125rem;
}

.an2-kname {
  font-weight: 700;
}

.an2-kbar {
  grid-column: 1 / -1;
  display: flex;
  min-width: 6rem;
  height: 20px;
  border-radius: 4px;
  overflow: hidden;
  background: var(--surface-elevated);
}

.an2-kseg {
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-right: 1px solid var(--surface-raised);
  font: 700 0.6875rem var(--font-mono);
  color: #0d0d0d;
  white-space: nowrap;
}

.an2-shade-1 {
  opacity: 0.75;
}

.an2-shade-2 {
  opacity: 0.55;
}

.an2-shade-3 {
  opacity: 0.4;
}

/* Last events: a row is a button that jumps 3 s before the event. */
.an2-event {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  height: 26px;
  padding: 0 4px;
  border: 0;
  border-radius: 4px;
  background: none;
  color: var(--text-primary);
  font: inherit;
  font-size: 0.8125rem;
  text-align: left;
  cursor: pointer;
}

.an2-event:hover,
.an2-event:focus-visible {
  background: var(--surface-elevated);
}

.an2-event .an2-num {
  width: 2.5rem;
  font-size: 0.6875rem;
}

.an2-dot {
  flex: none;
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

/* MH, RA, YA by minute: a cell is who took the item in that minute; the minutes after the cursor are dimmed. The
   columns come from data-cols (js/csp-shims.js). */
.an2-grid {
  display: grid;
  grid-template-columns: 2.5rem repeat(10, minmax(0, 1fr)) 4rem;
  gap: 3px;
  align-items: center;
  font-size: 0.75rem;
}

.an2-mins {
  text-align: center;
  font: 0.625rem var(--font-mono);
  color: var(--text-muted);
}

.an2-mins.is-now {
  color: var(--text-primary);
}

.an2-cell {
  height: 14px;
  border-radius: 2px;
  background: var(--surface-elevated);
}

.an2-cell--p1 {
  background: var(--an-p1);
}

.an2-cell--p2 {
  background: var(--an-p2);
}

.an2-cell--both {
  background: linear-gradient(90deg, var(--an-p1) 50%, var(--an-p2) 50%);
}

.an2-cell.is-future {
  opacity: 0.3;
}

/* Course of the match over the replay controls; the plot is inset like the scrubber's lanes (8 px). */
.an2-flow {
  grid-row: 2;
  grid-column: 2;
  padding: 8px 14px 4px;
}

.an2-flow-chart {
  position: relative;
}

.an2-killnav {
  position: absolute;
  top: 0;
  right: 0;
  display: flex;
  gap: 4px;
}

.an2-killbtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 24px;
  padding: 0;
  border: 1px solid var(--surface-border);
  border-radius: 4px;
  background: var(--surface-elevated);
  color: var(--text-primary);
  cursor: pointer;
}

.an2-killbtn svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
  stroke: currentColor;
  stroke-width: 2;
}

/* At least as tall as the previous / next kill buttons (.an2-killnav, absolute at its right): the plot starts under
   them, also in B2 where the title is hidden. */
.an2-flow-head {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 26px;
  padding-right: 72px;
}

.an2-flow-scale {
  margin-left: auto;
  font: 0.6875rem var(--font-mono);
}

.an2-flow-plot {
  position: relative;
  height: 50px;
  margin: 4px 8px 0;
  cursor: pointer;
}

.an2-flow-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.an2-flow-zero {
  stroke: var(--surface-border-strong);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

.an2-flow-area {
  fill: var(--text-primary);
  fill-opacity: 0.07;
}

.an2-flow-line {
  fill: none;
  stroke: var(--text-secondary);
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
}

.an2-flow-dot {
  position: absolute;
  z-index: 1;
  width: 10px;
  height: 10px;
  margin: -5px 0 0 -5px;
  padding: 0;
  border: 2px solid var(--surface-raised);
  border-radius: 50%;
  cursor: pointer;
}

.an2-flow-future {
  position: absolute;
  top: -4px;
  bottom: -4px;
  z-index: 2;
  background: var(--surface-raised);
  opacity: 0.6;
  pointer-events: none;
}

.an2-flow-cursor {
  position: absolute;
  top: -4px;
  bottom: -4px;
  z-index: 3;
  width: 2px;
  margin-left: -1px;
  background: var(--accent-primary);
  pointer-events: none;
}

.an2-flow-items {
  position: relative;
  height: 10px;
  margin: 4px 8px 0;
}

.an2-flow-item {
  position: absolute;
  top: 1px;
  width: 7px;
  height: 7px;
  margin-left: -3px;
  border-radius: 2px;
  opacity: 0.8;
}

/* Pickups after the cursor are dimmed like the chart's future (js/match-flow.js setFlowCursor). */
.an2-flow-item.is-future {
  opacity: 0.25;
}

/* The replay's own timeline under the chart: only its scrubber, ruler and controls. */
.an2 .match-timeline-panel {
  padding: 0;
  border: 0;
  background: none;
  box-shadow: none;
}

.an2 .match-timeline-head h3,
.an2 .match-timeline-kills,
.an2 .match-timeline-legend {
  display: none;
}

/* A finished game's head holds only the phase badge (its time is in the controls): hidden; a running game's holds
   the time at the cursor, kept. */
.an2 .match-timeline-head:not(:has(#match-timeline-label)) {
  display: none;
}

/* A running game: the clock, the phase and the delay in the strip. */
.an2-badges {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  white-space: nowrap;
}

.an2-clock {
  font-family: var(--font-mono);
  font-size: 1rem;
}

.an2-side-hint {
  grid-column: 1 / -1;
  padding: 12px;
}

/* Nothing to chart yet (a running game in warmup): no empty panel. */
.an2-flow:not(:has(.an2-flow-plot)):not(:has(.match-timeline-panel)) {
  display: none;
}

.an2 .match-timeline-track {
  padding: 2px 0 16px;
}

.an-body .an2 .an-pb {
  margin-top: 2px;
  padding-top: 2px;
}

.an2 .an-pb-btn {
  width: 34px;
  height: 34px;
}

/* ---- Layout switch Summary (A2) / Duel (B2) in the strip (js/a2-shell.js). ---- */

.an2-view {
  display: inline-flex;
  flex: none;
  gap: 2px;
  padding: 2px;
  border: 1px solid var(--surface-border);
  border-radius: 6px;
  background: var(--surface-raised);
}

.an2-view-btn {
  height: 26px;
  padding: 0 10px;
  border: 0;
  border-radius: 4px;
  background: none;
  color: var(--text-secondary);
  font: 500 0.75rem var(--font-sans);
  cursor: pointer;
}

.an2-moment {
  height: 30px;
  padding: 0 10px;
  border: 1px solid var(--surface-border);
  border-radius: 6px;
  background: var(--surface-raised);
  color: var(--text-primary);
  font: 500 0.75rem var(--font-sans);
  white-space: nowrap;
  cursor: pointer;
}

.an2-moment-status {
  font-size: 0.6875rem;
  color: var(--text-secondary);
}

.an2-view-btn[aria-pressed="true"] {
  background: var(--surface-elevated);
  color: var(--text-primary);
}

/* ---- Layout B2: a player's panel on each side, the map and its respawn timers in the middle, a lower course of the
   match under all three. The map's size is set by the fit (js/a2-shell.js). ---- */

.an2-body--b2 {
  grid-template-columns: minmax(0, 1fr) 480px minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr) auto;
}

.an2-body--b2 .an2-duel-col {
  grid-row: 1;
  min-height: 0;
  overflow: auto;
}

.an2-body--b2 .an2-center {
  grid-row: 1;
  grid-column: 2;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
}

.an2-body--b2 .an2-map {
  flex: none;
}

.an2-body--b2 .an2-flow {
  grid-row: 2;
  grid-column: 1 / -1;
  min-width: 0;
}

/* B2's course of the match is lower (the map in the middle needs the height): no title line, a lower plot. */
.an2--b2 .an2-flow-head h3,
.an2--b2 .an2-flow-head > .an2-hint {
  display: none;
}

.an2--b2 .an2-flow-plot {
  height: 40px;
}

/* the map is smaller in B2: the view button without its label, so it does not cover the match clock */
.an2--b2 .mv-preset-label {
  display: none;
}

.an2-duel {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 100%;
}

.an2-duel--p1 {
  border-top: 3px solid var(--an-p1);
}

.an2-duel--p2 {
  border-top: 3px solid var(--an-p2);
}

.an2-duel-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.an2-duel--p2 .an2-duel-head {
  flex-direction: row-reverse;
  text-align: right;
}

.an2-duel-score {
  font: 2.25rem/1 var(--font-mono);
}

.an2-duel-who {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.an2-duel-name {
  font-weight: 700;
  font-size: 1.0625rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.an2-vitals {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.an2-vital {
  padding: 6px 8px;
  border: 1px solid var(--surface-border);
  border-radius: 6px;
  background: var(--surface-elevated);
}

.an2-vital-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 0.6875rem;
  color: var(--text-secondary);
}

.an2-vital-n {
  font-size: 1.125rem;
  color: var(--text-primary);
}

.an2-vital-bar {
  display: block;
  height: 5px;
  margin-top: 4px;
  border-radius: 3px;
  background: var(--surface-border);
  overflow: hidden;
}

.an2-vital-fill {
  display: block;
  height: 5px;
}

.an2-vital-fill.is-hp {
  background: var(--text-primary);
}

.an2-vital-fill.is-ar {
  background: var(--text-secondary);
}

.an2-duel-h {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  margin: 4px 0 0;
  font-family: var(--font-display);
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.an2-drow {
  display: grid;
  grid-template-columns: 2.25rem minmax(0, 1fr) 2.75rem 2.75rem;
  gap: 6px;
  align-items: center;
  font-size: 0.75rem;
}

.an2-chip--held {
  outline: 2px solid var(--text-primary);
  outline-offset: 1px;
}

.an2-dbar {
  position: relative;
  height: 10px;
  border-radius: 2px;
  background: var(--surface-elevated);
}

.an2-dfill {
  display: block;
  height: 10px;
  border-radius: 2px;
}

/* the usual accuracy of the player (over earlier games): a mark across the bar */
.an2-usual {
  position: absolute;
  top: -3px;
  width: 2px;
  height: 16px;
  margin-left: -1px;
  background: var(--text-primary);
  opacity: 0.7;
}

.an2-duel .an2-grid {
  grid-template-columns: 2.25rem repeat(10, minmax(0, 1fr)) 2rem;
}

.an2-timers {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border: 1px solid var(--surface-border);
  border-radius: 0.5rem;
  background: var(--surface-raised);
}

.an2-timer {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  min-width: 64px;
  height: 24px;
  padding: 0 6px;
  overflow: hidden;
  border-radius: 4px;
  background: var(--surface-elevated);
  font-size: 0.75rem;
}

.an2-timer > * {
  position: relative;
}

.an2-timer-fill {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  background: var(--surface-border-strong);
}

.an2-timer.is-up {
  outline: 1px solid var(--text-secondary);
}

/* ---- Tabs of a finished duel: Replay (the body) and Summary (board C, js/summary.js). ---- */

.an2-tabs {
  display: inline-flex;
  flex: none;
  gap: 18px;
  align-self: stretch;
}

.an2-tab {
  padding: 0 2px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: none;
  color: var(--text-secondary);
  font: 700 0.875rem var(--font-display);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
}

.an2-tab[aria-selected="true"] {
  border-bottom-color: var(--accent-primary);
  color: var(--text-primary);
}

.an2--summary .an2-body {
  display: none;
}

.an2-summary[hidden] {
  display: none;
}

.an2-sum-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 8px;
  padding-bottom: 12px;
}

.an2-sum-flow {
  grid-column: 1 / 9;
}

.an2-sum-flow .an2-flow-plot {
  height: 120px;
}

.an2-sum-flow .an2-flow-cursor,
.an2-sum-flow .an2-flow-future {
  display: none;
}

.an2-sum-notes {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.an2-note-btn {
  height: 26px;
  padding: 0 10px;
  border: 1px solid var(--surface-border);
  border-radius: 13px;
  background: var(--surface-elevated);
  color: var(--text-primary);
  font: 500 0.75rem var(--font-sans);
  cursor: pointer;
}

.an2-note-btn.is-static {
  display: inline-flex;
  align-items: center;
  cursor: default;
  color: var(--text-secondary);
}

.an2-sum-tiles {
  grid-column: 9 / 13;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

/* Rows: the course of the match | tiles; weapons | killed with + damage | where they died (two rows); items. */
.an2-summary .an2-weapons {
  grid-column: 1 / 6;
  grid-row: 2;
}

.an2-sum-col {
  grid-column: 6 / 9;
  grid-row: 2;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.an2-kbar--full {
  min-width: 0;
}

.an2-summary .an2-items {
  grid-column: 1 / 9;
  grid-row: 3;
}

.an2-sum-deaths {
  grid-column: 9 / 13;
  grid-row: 2 / 4;
  display: flex;
  flex-direction: column;
}

.an2-deaths-filter {
  display: flex;
  gap: 4px;
  margin-bottom: 6px;
}

.an2-view-pill {
  height: 24px;
  padding: 0 10px;
  border: 1px solid var(--surface-border);
  border-radius: 12px;
  background: none;
  color: var(--text-secondary);
  font: 500 0.75rem var(--font-sans);
  cursor: pointer;
}

.an2-view-pill[aria-pressed="true"] {
  border-color: var(--accent-primary);
  color: var(--text-primary);
}

/* The picture as tall as the panel leaves (at most 380 px), its width from its own proportions; the points sit in
   the picture's box. */
.an2-deaths-map {
  position: relative;
  align-self: center;
  width: fit-content;
  margin: 0 auto;
}

.an2-deaths-map img {
  display: block;
  max-width: 100%;
  max-height: 360px;
  filter: grayscale(1) brightness(0.7);
}

.an2-death {
  position: absolute;
  width: 9px;
  height: 9px;
  margin: -4px 0 0 -4px;
  padding: 0;
  border: 1px solid var(--surface-base);
  border-radius: 50%;
  cursor: pointer;
}

.an2-sum-deaths[data-show="p1"] .an2-death--p2,
.an2-sum-deaths[data-show="p2"] .an2-death--p1 {
  display: none;
}

/* ---- Map view (board D, js/view-panel.js): the copied toolbar and its strip above the map are gone; three buttons
   on the map and a side panel over its right part. ---- */

/* Only the toolbar: its column (.map-chrome) also holds the killfeed on the map. */
.an2 #map-toolbar {
  display: none;
}

.an-body .an2 .match-map-widget {
  padding-top: 0;
}

.mv-bar {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 30;
  display: flex;
  gap: 4px;
}

.mv-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  border: 1px solid var(--surface-border-strong);
  border-radius: 6px;
  background: color-mix(in srgb, var(--surface-base) 85%, transparent);
  color: var(--text-primary);
  font: 500 0.75rem var(--font-sans);
  cursor: pointer;
}

.mv-btn svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.mv-btn[aria-pressed="true"],
.mv-btn[aria-expanded="true"] {
  border-color: var(--accent-primary);
  background: color-mix(in srgb, var(--accent-primary) 18%, var(--surface-base));
}

.mv-panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  width: min(360px, 100%);
  border-left: 1px solid var(--surface-border);
  background: var(--surface-raised);
  box-shadow: var(--shadow-elevated);
}

.mv-panel[hidden] {
  display: none;
}

.mv-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px 6px;
}

.mv-head h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.0625rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.mv-presets {
  display: flex;
  gap: 2px;
  margin: 0 12px;
  padding: 2px;
  border: 1px solid var(--surface-border);
  border-radius: 6px;
  background: var(--surface-base);
}

.mv-preset {
  flex: 1;
  height: 28px;
  border: 0;
  border-radius: 4px;
  background: none;
  color: var(--text-secondary);
  font: 500 0.75rem var(--font-sans);
  cursor: pointer;
}

.mv-preset[aria-pressed="true"] {
  background: var(--surface-elevated);
  color: var(--text-primary);
}

.mv-preset[data-mv-preset="custom"] {
  cursor: default;
}

.mv-preset-hint {
  margin: 6px 12px 8px;
  font-size: 0.6875rem;
  color: var(--text-muted);
}

.mv-scroll {
  flex: 1;
  min-height: 0;
  overflow: auto;
  border-top: 1px solid var(--surface-border);
}

.mv-section {
  border-bottom: 1px solid var(--surface-border);
}

.mv-section summary {
  padding: 8px 12px;
  font-family: var(--font-display);
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-secondary);
  cursor: pointer;
}

.mv-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 0 12px 10px;
  font-size: 0.8125rem;
}

.mv-switch {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 30px;
  cursor: pointer;
}

.mv-switch input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.mv-track {
  position: relative;
  flex: none;
  width: 32px;
  height: 18px;
  border-radius: 9px;
  background: var(--surface-border-strong);
}

.mv-track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--text-primary);
  transition: left 0.12s ease;
}

.mv-switch input:checked + .mv-track {
  background: var(--accent-primary);
}

.mv-switch input:checked + .mv-track::after {
  left: 16px;
}

.mv-switch input:focus-visible + .mv-track {
  outline: 2px solid var(--text-primary);
  outline-offset: 2px;
}

/* The engine's own groups moved in (items, effects, heat, layers): kept as they are, in the panel's width. */
.mv-moved {
  min-width: 0;
}

.mv-moved .map-tb-pop-head {
  display: none;
}

.mv-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-top: 1px solid var(--surface-border);
}

.mv-text-btn {
  height: 30px;
  padding: 0 10px;
  border: 1px solid var(--surface-border);
  border-radius: 6px;
  background: var(--surface-elevated);
  color: var(--text-primary);
  font: 500 0.75rem var(--font-sans);
  cursor: pointer;
}

.mv-link {
  margin-left: auto;
}

.mv-link-status {
  font-size: 0.6875rem;
  color: var(--text-secondary);
}

/* ---- A narrow screen (board E, below 1100 px; js/a2-shell.js fit adds .an2-body--narrow): one column that scrolls -
   the map (and in B2 its timers), the course of the match with the controls, then the panels. ---- */

@media (max-width: 1099px) {
  html.an-v2 .an-page {
    padding: 8px 12px 0;
  }

  .an2-strip {
    flex-wrap: wrap;
    gap: 8px 12px;
  }

  .an2-title {
    flex: 1 1 60%;
  }

  .an2-score {
    order: 5;
    flex: 1 1 100%;
    justify-content: center;
    margin: 0;
  }

  .an2-tabs {
    order: 6;
  }
}

.an2-body--narrow,
.an2-body--narrow.an2-body--b2 {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.an2-body--narrow .an2-map,
.an2-body--narrow .an2-center {
  order: 1;
}

.an2-body--narrow .an2-flow {
  order: 2;
}

.an2-body--narrow .an2-side,
.an2-body--narrow .an2-duel-col {
  order: 3;
  overflow: visible;
}

.an2-body--narrow #an2-side-2 {
  order: 4;
}

.an2-body--narrow .an2-side > *,
.an2-body--narrow .an2-weapons,
.an2-body--narrow .an2-killed,
.an2-body--narrow .an2-items,
.an2-body--narrow .an2-events {
  grid-column: 1 / -1;
  grid-row: auto;
}

.an2-body--narrow .an2-tiles {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.an2-body--narrow .an2-flow-head > .an2-hint {
  display: none;
}

/* the summary tab in one column too */
@media (max-width: 1099px) {
  .an2-summary .an2-sum-grid > * {
    grid-column: 1 / -1;
    grid-row: auto;
  }

  .an2-sum-tiles {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
