/* RWC Replay Analyzer -- brand styling matched to rhinowaspcult.com
   (see rhinowaspcult_com/index.html and access.html for the source tokens:
   obsidian/smoke/ash surfaces, bone text, gold accent, Bebas Neue display
   type, DM Mono for the "bureau readout" labels). Same external font
   @import the live site already uses -- not a new dependency, and the
   fonts will likely already be warm in cache from other site pages. */

@import url('https://fonts.googleapis.com/css2?family=Bebas+Neue&family=DM+Mono:wght@300;400&family=DM+Sans:wght@400;500;700&family=Instrument+Sans:ital,wght@0,400;0,500;1,400&display=swap');

:root {
  /* Build this stylesheet belongs to. app.js compares it to APP_VERSION and
     warns about a stale cached copy. Bump with APP_VERSION. */
  --rwc-build: "0.15.5";
  --obsidian: #0a0a0a;
  --smoke: #111111;
  --ash: #2a2a2a;
  --ash-light: #333333;
  --bone: #e8e4dc;
  --bone-dim: #a09c94;
  --gold: #b8933a;
  --gold-dim: #7a6025;
  --text-dim: #4a4a4a;
  --text-mid: #6a6a6a;

  /* Status colors are functional, not brand decoration -- reserved and
     distinct from the gold accent so a win/lose badge never reads as "just
     another gold thing." Green matches the site's own .panel-val.active. */
  --status-good: #4caf7d;
  --status-bad: #b5524a;
  --unconfirmed: #c17a3a;

  --radius: 0; /* the brand has no rounded corners anywhere */
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 1.25rem 1rem 4rem;
  background: var(--obsidian);
  color: var(--bone);
  font-family: 'Instrument Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.4;
}

/* Wider than the old 960px: the Home screen and stat grids are about showing
   more data per screen, and 1120 still reads comfortably on a laptop. */
main {
  max-width: 1120px;
  margin: 0 auto;
}

/* Title row: brand heading on the left, the privacy promise on the right.
   Wraps to two lines on narrow screens. */
.title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.25rem 1.5rem;
  margin-bottom: 0.75rem;
}

h1 {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 2.1rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--bone);
  margin: 0;
  line-height: 0.95;
}

.subtitle {
  color: var(--text-mid);
  margin-top: 0;
  margin-bottom: 1rem;
}

/* Once a profile exists the subtitle is redundant: the data explains itself. */
body.has-profile .subtitle {
  display: none;
}

/* The privacy promise stays on the page at all times (it's a promise, not a
   default), but as one quiet line instead of a banner. */
.privacy-note {
  margin: 0;
  color: var(--status-good);
  font-size: 0.75rem;
  opacity: 0.85;
  max-width: 62ch;
}

#dropzone {
  border: 1px dashed var(--ash);
  border-radius: var(--radius);
  padding: 2.5rem 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  background: var(--smoke);
}

#dropzone:hover,
#dropzone.dragover {
  border-color: var(--gold-dim);
  background: rgba(184, 147, 58, 0.06);
}

#dropzone p {
  margin: 0.25rem 0;
}

#dropzone .dz-main {
  font-size: 1.05rem;
  color: var(--bone);
}

#dropzone .dz-sub {
  color: var(--text-mid);
  font-size: 0.85rem;
}

.btn-picker {
  display: inline-block;
  margin-top: 0.75rem;
  padding: 0.55rem 1.2rem;
  background: var(--gold);
  color: var(--obsidian);
  border-radius: var(--radius);
  font-family: 'DM Mono', monospace;
  font-size: 0.75rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  border: none;
  cursor: pointer;
  transition: background 0.2s ease;
}

.btn-picker:hover {
  background: var(--bone);
}

.btn-picker:disabled {
  opacity: 0.5;
  cursor: default;
}

/* With a profile, the dropzone is a slim one-line bar: still the drop target
   and still clickable, but it no longer pushes the data off the first screen. */
body.has-profile #dropzone {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 0.35rem 1rem;
  margin-top: 0.5rem;
}

body.has-profile #dropzone .dz-main {
  font-size: 0.8rem;
  color: var(--text-mid);
}

body.has-profile #dropzone .dz-main::before {
  content: "Single replays: ";
  color: var(--bone-dim);
}

body.has-profile #dropzone .dz-sub {
  display: none;
}

body.has-profile #dropzone .btn-picker {
  margin-top: 0;
  padding: 0.3rem 0.8rem;
  font-size: 0.65rem;
}

/* Local profile bar: a one-line toolbar (status, account scope, Library menu).
   Hidden until the profile module decides there is something to say. */
#profile-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
  padding: 0.5rem 0.9rem;
  background: var(--smoke);
  border: 1px solid var(--ash);
  border-radius: var(--radius);
}

#profile-bar[hidden] {
  display: none;
}

#profile-bar p {
  margin: 0;
}

/* Status is one line with an ellipsis; the full sentence is on hover (title). */
#profile-status {
  flex: 1 1 260px;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* First run (no profile yet): let the status wrap, it's the instructions.
   Same for errors and notices: anything the user must act on is shown whole. */
body:not(.has-profile) #profile-status,
#profile-status.profile-bad,
#profile-status.profile-notice {
  white-space: normal;
  flex-basis: 100%;
}

.profile-notice {
  color: var(--unconfirmed);
}

#profile-actions,
.profile-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

#profile-actions .btn-picker {
  margin-top: 0;
}

/* Library menu: every profile action behind one button once a profile exists. */
.lib-menu {
  position: relative;
}

.lib-menu-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  z-index: 30;
  min-width: 260px;
  display: flex;
  flex-direction: column;
  background: var(--smoke);
  border: 1px solid var(--gold-dim);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
  padding: 0.3rem 0;
}

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

.lib-menu-item {
  background: none;
  border: none;
  text-align: left;
  padding: 0.5rem 0.9rem;
  color: var(--bone);
  font-family: 'DM Mono', monospace;
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  cursor: pointer;
}

.lib-menu-item:hover,
.lib-menu-item:focus-visible {
  background: rgba(184, 147, 58, 0.12);
  color: var(--gold);
  outline: none;
}

.lib-menu-item:disabled {
  opacity: 0.5;
  cursor: default;
}

.lib-menu-item.lib-menu-danger {
  color: var(--status-bad);
}

.lib-menu-sep {
  border-top: 1px solid var(--ash);
  margin: 0.3rem 0;
}

.lib-menu-note {
  padding: 0.3rem 0.9rem 0.4rem;
  margin: 0;
  max-width: 300px;
}

/* .btn-picker carries a top margin of its own for the dropzone layout, so the
   flex row only needs to not add a second one. */
#profile-actions:empty {
  display: none;
}

/* Full-width note inside the button flex row, so it sits on its own line
   under the buttons rather than being squeezed between them. */
.profile-hint {
  flex-basis: 100%;
  margin: 0.1rem 0 0;
}

/* Long-term record reminders (0.15.1): one quiet line each, with its action. */
.profile-reminders {
  flex-basis: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  margin: 0.15rem 0 0;
}
.profile-reminder {
  margin: 0;
  color: var(--unconfirmed);
}
.profile-reminder .btn-inline {
  margin-left: 0.5rem;
}

.profile-bad {
  color: var(--status-bad);
}

/* Games list + manual winner correction */
.games-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-top: 0.5rem;
}

.game-row {
  display: grid;
  grid-template-columns: 120px 1fr auto auto;
  align-items: center;
  gap: 0.6rem 0.9rem;
  padding: 0.5rem 0.7rem;
  border: 1px solid var(--ash);
  border-radius: var(--radius);
  background: var(--obsidian);
}

.game-meta {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  font-family: 'DM Mono', monospace;
  font-size: 0.72rem;
}
/* Badges in the stacked date column keep their own width instead of
   stretching across it (0.8.2). */
.game-meta > .game-ranked,
.game-meta > .game-simulated,
.game-meta > .game-corrected { align-self: flex-start; margin-left: 0; }
.game-date { color: var(--text-mid); }
.game-mode { color: var(--faint, var(--text-mid)); letter-spacing: 0.08em; text-transform: uppercase; font-size: 0.66rem; }
.game-corrected {
  color: var(--gold);
  border: 1px solid var(--gold-dim);
  border-radius: var(--radius);
  padding: 0 0.3rem;
  font-size: 0.6rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-left: 0.4rem;
  white-space: nowrap;
}

/* Authoritative result from the ranked match log. Green to read as a trusted,
   positive provenance, distinct from the gold "corrected" (set by hand). */
.game-ranked {
  color: #3fa34d;
  border: 1px solid rgba(63, 163, 77, 0.5);
  border-radius: var(--radius);
  padding: 0 0.3rem;
  font-size: 0.6rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-left: 0.4rem;
  white-space: nowrap;
}

/* 0.8.2: the winner from a re-run in the game's own engine (the sim mod).
   Blue: trusted like the log's green, but a different source. */
.game-simulated {
  color: #5b9ee8;
  border: 1px solid rgba(91, 158, 232, 0.5);
  border-radius: var(--radius);
  padding: 0 0.3rem;
  font-size: 0.6rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-left: 0.4rem;
  white-space: nowrap;
}

.game-matchup {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
}
.game-vs { color: var(--text-mid); font-size: 0.72rem; }
.game-side { color: var(--text-mid); }
.game-side-won { color: var(--bone); font-weight: 600; }
.game-tick { color: var(--status-good); margin-right: 0.25rem; }

.game-result {
  font-family: 'DM Mono', monospace;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius);
}
.game-won { color: var(--status-good); background: rgba(76, 175, 125, 0.12); }
.game-lost { color: var(--status-bad); background: rgba(181, 82, 74, 0.12); }
.game-undet { color: var(--text-mid); background: rgba(255, 255, 255, 0.05); }

.game-actions { justify-self: end; display: flex; gap: 0.8rem; align-items: center; }
/* 0.9.7: a row opens the game's breakdown. */
.game-row-link { cursor: pointer; }
.game-row-link:hover { border-color: var(--gold-dim); }
.game-open { text-decoration: none; }

/* 0.9.7: the breakdown's army summary and per-game techs. */
.army-kv { gap: 0.35rem 1rem; }
.army-kv dt { font-size: 0.62rem; }
.army-kv dd { font-size: 0.85rem; overflow-wrap: anywhere; }
.army-sub { font-family: 'DM Sans', sans-serif; letter-spacing: 0; color: var(--text-mid); }
.army-boosts { margin-top: 0.75rem; font-size: 0.8rem; }
.army-boosts summary { cursor: pointer; color: var(--gold); }
.army-boosts ul { margin: 0.4rem 0 0; padding-left: 1.1rem; }
.tech-rows { display: flex; flex-direction: column; gap: 0.45rem; }
.tech-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; }
.tech-pick { display: inline-flex; align-items: center; gap: 0.2rem; }
.round-cell-top { flex-wrap: wrap; }
/* 0.11.0: light playback. */
.playback-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; margin: 0.6rem 0; }
.playback-slider { flex: 1 1 160px; accent-color: var(--gold); }
.playback-label { font-family: 'DM Mono', monospace; font-size: 0.75rem; color: var(--gold); letter-spacing: 0.06em; }
.playback-wrap { border: 1px solid var(--ash); background: #000; }
/* 0.12.6 (Kris): as large as fits the window's width AND height, so the whole
   board and the controls above it are on screen without scrolling. --ar is the
   board's width / height (set per board in renderPlayback). */
.playback-board {
  display: block; height: auto; aspect-ratio: var(--ar, 1.15); margin: 0 auto;
  width: min(100%, calc((100vh - 7.5rem) * var(--ar, 1.15)));
  width: min(100%, calc((100svh - 7.5rem) * var(--ar, 1.15)));
}
.playback-controls { scroll-margin-top: 0.5rem; }
.pb-bg { fill: #0b0b0b; }
.pb-grid { stroke: rgba(255, 255, 255, 0.06); stroke-width: 1; }
.pb-mid { stroke: rgba(255, 255, 255, 0.35); stroke-width: 1.5; stroke-dasharray: 8 6; }
.pb-tower { fill: #8a8577; stroke: var(--bone); stroke-width: 1.5; }
.pb-unit { fill-opacity: 0.35; stroke-width: 1; }
.pb-item { fill: var(--gold); stroke: #000; stroke-width: 1; }
.pb-device { fill: rgba(232, 226, 208, 0.85); stroke-width: 2.5; }
.pb-spell { fill: none; stroke-width: 2; stroke-dasharray: 5 4; }
.pb-redeploy { stroke-width: 2.5; stroke-dasharray: 6 4; stroke-linecap: round; }
.pb-beacon-oval { fill-opacity: 0.14; stroke-width: 2; stroke-dasharray: 6 4; }
.pb-beacon-chevron { fill: none; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.pb-beacon-end { stroke-width: 2.5; }
.pb-beacon-mid { stroke: #000; stroke-width: 1; }
.pb-hp { font-family: 'DM Mono', monospace; font-weight: 600; paint-order: stroke; stroke: #000; stroke-width: 4px; stroke-linejoin: round; pointer-events: auto; }
.pb-spell-label { font-family: 'DM Mono', monospace; font-size: 13px; paint-order: stroke; stroke: #000; stroke-width: 3px; }
.playback-note { margin: 0.3rem 0 0; }
.playback-note:empty { display: none; }
.playback-info { display: flex; flex-direction: column; gap: 0.3rem; margin-top: 0.6rem; }
/* What-if (0.12.0): under the playback board. */
.whatif { margin-top: 1rem; padding-top: 0.8rem; border-top: 1px solid rgba(255, 255, 255, 0.08); }
.whatif-title { margin: 0 0 0.5rem; }
.whatif-q { margin: 0.8rem 0 0.2rem; }
.whatif-verdict { margin: 0 0 0.4rem; }
.whatif-ask { display: flex; flex-wrap: wrap; gap: 0.6rem 1.6rem; margin: 0.4rem 0 0.6rem; }
.whatif-player { display: flex; flex-direction: column; gap: 0.25rem; min-width: 14rem; }
.whatif-choice { font-size: 0.9rem; cursor: pointer; }
.whatif-choice:hover { color: var(--gold, #d4a017); }
.pb-hi .pb-unit { stroke: #fff; stroke-width: 4; fill-opacity: 0.9; }
.whatif-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin: 0.6rem 0 0.3rem; }
.playback-side { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; font-size: 0.85rem; }
.playback-legend { display: flex; flex-wrap: wrap; gap: 0.9rem; margin-top: 0.5rem; font-size: 0.8rem; color: var(--text-mid); }
.playback .sw { display: inline-block; width: 11px; height: 11px; margin-right: 0.35rem; vertical-align: -1px; }

/* 0.9.9: build order card. */
.build-chips { display: flex; flex-wrap: wrap; gap: 0.3rem; margin: 0.5rem 0; }
.build-total { margin: 0.4rem 0 0.6rem; }

.game-picker {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  padding-top: 0.5rem;
  margin-top: 0.35rem;
  border-top: 1px dashed var(--ash);
}

.match-fix { margin-left: 0.6rem; }
.match-fix .game-picker { border-top: none; padding-top: 0; margin-top: 0.4rem; }

@media (max-width: 620px) {
  .game-row { grid-template-columns: 1fr auto; }
  .game-meta { grid-row: 1; }
  .game-matchup { grid-column: 1 / -1; grid-row: 2; }
}

.app-footer {
  margin-top: 2.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--ash);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0.55rem;
  font-family: 'DM Mono', monospace;
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-mid);
}

.app-footer:empty {
  display: none;
}

.footer-link {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  color: var(--text-mid);
  cursor: pointer;
  transition: color 0.15s;
}
.footer-link:hover { color: var(--gold); }
.footer-link:focus-visible { outline: 1px solid var(--gold); outline-offset: 3px; }
.footer-sep { color: var(--ash); }
/* 0.12.10: own line under the links, not uppercase. */
.footer-copy { flex-basis: 100%; text-align: center; text-transform: none; letter-spacing: 0.04em; color: var(--text-mid); opacity: 0.8; }

/* --- Info modal (What's new / Help) --- */
.info-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.2rem;
}
.info-modal[hidden] { display: none; }

.info-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.66);
  backdrop-filter: blur(2px);
}

.info-modal-panel {
  position: relative;
  width: min(640px, 100%);
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  background: var(--smoke);
  border: 1px solid var(--line-strong, var(--ash));
  border-radius: var(--radius);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.5);
}

.info-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.3rem;
  border-bottom: 1px solid var(--ash);
}
.info-modal-head h2 {
  margin: 0;
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1.4rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--gold);
}
.info-modal-close {
  background: none;
  border: none;
  color: var(--text-mid);
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 0.3rem;
}
.info-modal-close:hover { color: var(--bone); }

.info-modal-body {
  padding: 1.1rem 1.3rem 1.4rem;
  overflow-y: auto;
}

/* What's new */
.whatsnew-rel { margin-bottom: 1.4rem; }
.whatsnew-rel:last-child { margin-bottom: 0; }
.whatsnew-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
}
.whatsnew-ver {
  font-family: 'DM Mono', monospace;
  font-weight: 500;
  color: var(--bone);
}
.whatsnew-live {
  font-family: 'DM Mono', monospace;
  font-size: 0.6rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--obsidian);
  background: var(--gold);
  border-radius: var(--radius);
  padding: 0.05rem 0.35rem;
}
.whatsnew-tag { color: var(--gold-dim); font-size: 0.85rem; }
.whatsnew-date {
  margin-left: auto;
  font-family: 'DM Mono', monospace;
  font-size: 0.72rem;
  color: var(--text-mid);
}
.whatsnew-rel ul {
  margin: 0;
  padding-left: 1.2rem;
  color: var(--text-mid);
  font-size: 0.88rem;
}
.whatsnew-rel li { margin-bottom: 0.35rem; }

/* Help */
.help-section {
  border-bottom: 1px solid var(--ash);
  padding: 0.2rem 0;
}
.help-section:last-child { border-bottom: none; }
.help-section summary {
  cursor: pointer;
  padding: 0.6rem 0;
  color: var(--bone);
  font-weight: 500;
}
.help-section summary:hover { color: var(--gold); }
.help-section p {
  margin: 0 0 0.7rem;
  color: var(--text-mid);
  font-size: 0.88rem;
  line-height: 1.55;
}

/* Identity: which accounts are mine, and which one I am looking at. Rendered
   inline in the profile toolbar: `display: contents` lets the compact summary
   sit on the toolbar line while the account picker (when open) drops to its
   own full-width row underneath. */
#profile-identity {
  display: contents;
}

#profile-identity[hidden] {
  display: none;
}

.identity-summary {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.identity-picker {
  flex-basis: 100%;
  order: 10;
}

/* Account scope dropdown ("Viewing ..."), replacing the old row of chips. */
.scope-select {
  background: var(--obsidian);
  color: var(--bone);
  border: 1px solid var(--ash);
  border-radius: var(--radius);
  font-family: 'DM Mono', monospace;
  font-size: 0.75rem;
  padding: 0.25rem 0.4rem;
  max-width: 220px;
  cursor: pointer;
}

.scope-select:hover,
.scope-select:focus {
  border-color: var(--gold-dim);
  outline: none;
}

.identity-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
}

.identity-label {
  font-family: 'DM Mono', monospace;
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-mid);
  margin-right: 0.2rem;
}

.btn-inline {
  background: none;
  border: none;
  padding: 0;
  color: var(--gold);
  font-family: 'DM Mono', monospace;
  font-size: 0.75rem;
  text-decoration: underline;
  cursor: pointer;
}

.btn-inline:hover {
  color: var(--bone);
}

.scope-chip {
  padding: 0.28rem 0.7rem;
  background: transparent;
  border: 1px solid var(--ash);
  border-radius: var(--radius);
  color: var(--text-mid);
  font-family: 'DM Mono', monospace;
  font-size: 0.72rem;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.scope-chip:hover {
  border-color: var(--gold-dim);
  color: var(--bone);
}

/* The selected scope carries a fill AND a border change, not colour alone. */
.scope-chip-on,
.scope-chip-on:hover {
  background: var(--gold);
  border-color: var(--gold);
  color: var(--obsidian);
}

.identity-picker {
  border: 1px solid var(--ash);
  border-radius: var(--radius);
  padding: 0.75rem 0.9rem;
  background: rgba(0, 0, 0, 0.25);
}

.identity-picker p {
  margin: 0 0 0.5rem;
}

.identity-search {
  width: 100%;
  padding: 0.4rem 0.6rem;
  margin-bottom: 0.5rem;
  background: var(--obsidian);
  border: 1px solid var(--ash);
  border-radius: var(--radius);
  color: var(--bone);
  font-family: 'DM Mono', monospace;
  font-size: 0.8rem;
}

.identity-search:focus {
  outline: none;
  border-color: var(--gold-dim);
}

.identity-list {
  max-height: 15rem;
  overflow-y: auto;
}

.identity-group {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 0.95rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gold);
  margin-top: 0.75rem;
  padding-bottom: 0.2rem;
  border-bottom: 1px solid var(--ash);
}

.identity-list > .identity-group:first-child {
  margin-top: 0;
}

.identity-group-note {
  margin: 0.35rem 0 0.4rem;
}

/* How many replays this account saved into the folder. The shortlist signal:
   an account you play on records its own games. */
.pf-recorded {
  font-family: 'DM Mono', monospace;
  font-size: 0.6rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--status-good);
  border: 1px solid rgba(76, 175, 125, 0.45);
  border-radius: var(--radius);
  padding: 0 0.3rem;
  margin-left: 0.35rem;
}

/* Flags an account that has used more than one display name, so a merged row
   never looks like a mistake. */
.pf-alias {
  font-family: 'DM Mono', monospace;
  font-size: 0.6rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gold-dim);
  border: 1px solid var(--gold-dim);
  border-radius: var(--radius);
  padding: 0 0.3rem;
  margin-left: 0.35rem;
}

#error-box {
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  background: rgba(181, 82, 74, 0.12);
  border: 1px solid rgba(181, 82, 74, 0.4);
  color: var(--status-bad);
  font-size: 0.9rem;
}

.card {
  background: var(--smoke);
  border: 1px solid var(--ash);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  margin-top: 1.5rem;
}

.card h3 {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1.3rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--gold);
  margin-top: 0;
  margin-bottom: 0.75rem;
}

.header-card h2 {
  margin-top: 0;
  font-size: 1.05rem;
  word-break: break-all;
  color: var(--text-mid);
  font-weight: 400;
  font-family: 'DM Mono', monospace;
}

.kv-grid {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.5rem 1.5rem;
  margin: 0;
}

.kv-grid dt {
  color: var(--text-mid);
  font-family: 'DM Mono', monospace;
  font-size: 0.7rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  padding-top: 0.15rem;
}

.kv-grid dd {
  margin: 0;
  font-family: 'DM Mono', monospace;
  font-size: 0.9rem;
  letter-spacing: 0.03em;
  color: var(--gold);
  font-weight: 400;
}

.table-scroll {
  overflow-x: auto;
}

table.round-table {
  border-collapse: collapse;
  width: 100%;
  min-width: 480px;
}

table.round-table th,
table.round-table td {
  border: 1px solid var(--ash);
  padding: 0.5rem 0.6rem;
  vertical-align: top;
  text-align: left;
  font-size: 0.85rem;
}

table.round-table th {
  background: var(--obsidian);
  font-family: 'DM Mono', monospace;
  font-size: 0.7rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-mid);
  font-weight: 400;
}

.round-num {
  font-family: 'DM Mono', monospace;
  font-weight: 700;
  color: var(--gold);
  text-align: center;
  white-space: nowrap;
}

.round-cell-top {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.hp-value {
  color: var(--text-mid);
  font-family: 'DM Mono', monospace;
  font-size: 0.75rem;
}

/* HP-over-time chart */
.chart-wrapper {
  position: relative;
}

.hp-chart-svg {
  width: 100%;
  height: auto;
  display: block;
}

.chart-gridline {
  stroke: var(--ash);
  stroke-width: 1;
}

.chart-axis-baseline {
  stroke: var(--text-dim);
  stroke-width: 1;
}

.chart-axis-label {
  fill: var(--text-mid);
  font-family: 'DM Mono', monospace;
  font-size: 10px;
}

.chart-line {
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chart-end-dot {
  stroke: var(--smoke);
  stroke-width: 2;
}

.chart-series-label {
  fill: var(--bone);
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  font-weight: 400;
}

.chart-crosshair {
  stroke: var(--text-mid);
  stroke-width: 1;
  stroke-dasharray: 3 3;
  pointer-events: none;
}

.chart-hit-rect {
  fill: transparent;
  cursor: crosshair;
}

.chart-tooltip {
  position: absolute;
  background: var(--obsidian);
  border: 1px solid var(--ash);
  border-radius: var(--radius);
  padding: 0.5rem 0.65rem;
  font-size: 0.8rem;
  pointer-events: none;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.6);
  min-width: 140px;
  z-index: 5;
}

.chart-tooltip-title {
  font-family: 'DM Mono', monospace;
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 400;
  color: var(--gold);
  margin-bottom: 0.4rem;
}

.chart-tooltip-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0.15rem 0;
}

.chart-tooltip-key {
  width: 10px;
  height: 2px;
  display: inline-block;
  flex-shrink: 0;
}

.chart-tooltip-name {
  color: var(--text-mid);
  font-family: 'DM Mono', monospace;
  font-size: 0.75rem;
  flex: 1;
}

.chart-tooltip-value {
  color: var(--bone);
  font-family: 'DM Mono', monospace;
  font-weight: 700;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 0.5rem;
  font-family: 'DM Mono', monospace;
  font-size: 0.7rem;
  letter-spacing: 0.05em;
  color: var(--text-mid);
}

.chart-legend-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.chart-legend-key {
  width: 14px;
  height: 2px;
  display: inline-block;
  flex-shrink: 0;
}

/* Bar/area marks get a rect swatch, not a line-key -- legends mirror the
   mark type (used by the weight-class stacked bar). */
.chart-legend-key-rect {
  width: 10px;
  height: 10px;
  display: inline-block;
  flex-shrink: 0;
}

/* Match highlights */
.highlights-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  align-items: flex-start;
}

.stat-tile {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  min-width: 200px;
}

.stat-label {
  color: var(--text-mid);
  font-family: 'DM Mono', monospace;
  font-size: 0.7rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.stat-value {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 2.4rem;
  letter-spacing: 0.02em;
  color: var(--gold);
  line-height: 1;
}

.stat-sub {
  color: var(--text-mid);
  font-size: 0.8rem;
}

.meter-label {
  color: var(--text-mid);
  font-family: 'DM Mono', monospace;
  font-size: 0.65rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  margin-bottom: 0.4rem;
}

.spells-devices-gap {
  margin-top: 0.75rem;
}

.upgrade-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.level-badge {
  display: inline-block;
  background: transparent;
  color: var(--gold);
  border: 1px solid var(--ash);
  border-radius: var(--radius);
  padding: 0.05rem 0.5rem;
  font-family: 'DM Mono', monospace;
  font-size: 0.75rem;
}

.gospel-checklist {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.gospel-criterion {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--bone);
}

.gospel-check {
  font-family: 'DM Mono', monospace;
  width: 1rem;
  flex-shrink: 0;
  text-align: center;
}

.gospel-met {
  color: var(--status-good);
}

.gospel-unmet {
  color: var(--text-mid);
}

.badge {
  display: inline-block;
  padding: 0.1rem 0.5rem;
  border-radius: var(--radius);
  font-family: 'DM Mono', monospace;
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  font-weight: 400;
  text-transform: uppercase;
}

.badge-win {
  background: rgba(76, 175, 125, 0.14);
  color: var(--status-good);
}

.badge-lose {
  background: rgba(181, 82, 74, 0.16);
  color: var(--status-bad);
}

.badge-unknown {
  background: rgba(160, 156, 148, 0.14);
  color: var(--bone-dim);
}

.unit-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.unit-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
}

.chip-count {
  color: var(--text-mid);
  font-family: 'DM Mono', monospace;
  font-size: 0.7rem;
}

.tag {
  display: inline-block;
  background: rgba(184, 147, 58, 0.1);
  color: var(--bone);
  border: 1px solid rgba(184, 147, 58, 0.35);
  border-radius: var(--radius);
  padding: 0.05rem 0.45rem;
  font-family: 'DM Mono', monospace;
  font-size: 0.75rem;
}

.tag-unconfirmed {
  background: rgba(193, 122, 58, 0.12);
  border: 1px dashed rgba(193, 122, 58, 0.6);
  color: var(--unconfirmed);
  cursor: help;
}

.tag-empty {
  background: transparent;
  border: none;
  color: var(--text-mid);
}

.player-columns {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.5rem;
}

.player-column h4 {
  font-family: 'DM Mono', monospace;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--bone);
  margin: 0 0 0.6rem;
}

.player-tech-summary {
  cursor: pointer;
  user-select: none;
}

.player-tech-summary h4 {
  display: inline;
  margin: 0;
}

.weight-rows {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  margin-bottom: 0.75rem;
}

.weight-row-label {
  font-family: 'DM Mono', monospace;
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--bone);
  margin-bottom: 0.35rem;
}

.weight-bar {
  display: flex;
  height: 20px;
  border-radius: var(--radius);
  overflow: hidden;
  gap: 2px;
  background: var(--obsidian);
}

.weight-segment {
  height: 100%;
}

.bar-chart {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.bar-row {
  display: grid;
  grid-template-columns: 100px 1fr 24px;
  align-items: center;
  gap: 0.5rem;
}

.bar-track {
  background: var(--obsidian);
  border: 1px solid var(--ash);
  border-radius: var(--radius);
  height: 10px;
  overflow: hidden;
}

.bar-fill {
  background: var(--gold);
  height: 100%;
}

.bar-count {
  color: var(--text-mid);
  font-family: 'DM Mono', monospace;
  font-size: 0.75rem;
  text-align: right;
}

.roster-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.roster-row {
  border-bottom: 1px solid var(--ash);
  padding-bottom: 0.5rem;
}

.roster-unit {
  margin-bottom: 0.3rem;
  cursor: pointer;
  user-select: none;
}

.roster-row[open] .roster-unit {
  margin-bottom: 0.5rem;
}

.roster-row .tech-tag-list {
  padding-left: 0.1rem;
}

.card ul {
  margin: 0.5rem 0 0;
  padding-left: 1.25rem;
  color: var(--text-mid);
  font-size: 0.8rem;
}

.card ul li {
  margin-bottom: 0.2rem;
  font-family: 'DM Mono', monospace;
}

.tech-tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

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

.small {
  font-size: 0.8rem;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  border-bottom: 1px solid var(--ash);
  margin-bottom: 1.25rem;
}

.tab-btn {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-mid);
  font-family: 'DM Mono', monospace;
  font-size: 0.75rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  padding: 0.6rem 0.9rem;
  cursor: pointer;
  margin-bottom: -1px;
  transition: color 0.2s ease;
}

.tab-btn:hover {
  color: var(--bone);
}

.tab-btn.active {
  color: var(--gold);
  border-bottom-color: var(--gold);
}

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

/* Compact library header: one line of title + chips instead of a card with a
   four-row table. */
.batch-headline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.6rem;
  margin: 1rem 0 0.5rem;
}

.batch-headline h2 {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1.35rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin: 0 0.4rem 0 0;
  color: var(--gold);
}

.stat-chip {
  font-family: 'DM Mono', monospace;
  font-size: 0.72rem;
  color: var(--bone-dim);
  border: 1px solid var(--ash);
  padding: 0.12rem 0.5rem;
  white-space: nowrap;
}

.stat-chip b {
  color: var(--bone);
  font-weight: 400;
}

.stat-chip-warn {
  border-color: rgba(193, 122, 58, 0.6);
  color: var(--unconfirmed);
}

/* Current ranked rating: the one headline number people look for first. */
.stat-chip-rating {
  border-color: var(--gold-dim);
}

.stat-chip-rating b {
  color: var(--gold);
}

.batch-headline details {
  flex-basis: 100%;
}

/* Filter bar: one sticky summary line; the full controls open beneath it.
   The tab bar sticks directly below it (see .batch-tabs top offset, set from
   the bar's measured height via --filterbar-h). */
.filter-bar {
  position: sticky;
  top: 0;
  z-index: 12;
  background: var(--obsidian);
  border: 1px solid var(--ash);
  padding: 0;
  margin-bottom: 0;
}

.filter-bar-summary {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.45rem 0.8rem;
  background: var(--smoke);
}

/* My games / Everyone (0.12.3). */
.seg-toggle { display: inline-flex; flex-shrink: 0; border: 1px solid var(--ash); border-radius: var(--radius); overflow: hidden; }
.seg-btn { font: inherit; font-size: 0.75rem; padding: 0.2rem 0.6rem; background: transparent; color: var(--text-mid); border: 0; cursor: pointer; white-space: nowrap; }
.seg-btn + .seg-btn { border-left: 1px solid var(--ash); }
.seg-btn:hover { color: var(--gold); }
.seg-btn.active { background: var(--gold); color: #000; cursor: default; }

.filter-bar-label {
  font-family: 'DM Mono', monospace;
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold);
  flex-shrink: 0;
}

.filter-bar-desc {
  flex: 1;
  min-width: 0;
  margin: 0;
  font-size: 0.8rem;
  color: var(--bone-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.filter-bar-toggle {
  flex-shrink: 0;
}

.filter-bar-body {
  padding: 0.6rem 0.8rem 0.8rem;
  border-top: 1px solid var(--ash);
  max-height: 60vh;
  overflow-y: auto;
}

.filter-bar-body[hidden] {
  display: none;
}

.pf-search {
  width: 100%;
  max-width: 320px;
  margin-top: 0.4rem;
  background: var(--obsidian);
  color: var(--bone);
  border: 1px solid var(--ash);
  padding: 0.35rem 0.5rem;
  font-family: inherit;
  font-size: 0.8rem;
}

.pf-search:focus {
  border-color: var(--gold-dim);
  outline: none;
}

/* ---- Home tab ---------------------------------------------------------- */
.home-session {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.6rem;
  margin: 0.25rem 0 1rem;
}

.home-session-label {
  font-family: 'DM Mono', monospace;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold);
  margin-right: 0.3rem;
}

/* Snapshot | latest game, side by side on desktop, stacked on narrow screens. */
.home-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}

.home-grid > .card {
  margin: 0;
}

@media (max-width: 860px) {
  .home-grid {
    grid-template-columns: 1fr;
  }
}

.home-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.5rem;
  margin: 0.5rem 0 0.9rem;
}

.home-stat {
  border: 1px solid var(--ash);
  padding: 0.55rem 0.6rem;
  background: var(--obsidian);
}

.home-stat-val {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 2rem;
  line-height: 1;
  color: var(--bone);
}

.home-stat-label {
  font-family: 'DM Mono', monospace;
  font-size: 0.66rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold);
  margin-top: 0.2rem;
}

.home-stat-sub {
  font-size: 0.72rem;
  color: var(--text-mid);
}

.home-line {
  margin: 0.45rem 0;
  font-size: 0.85rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 0.6rem;
}

.home-line-label {
  font-family: 'DM Mono', monospace;
  font-size: 0.66rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-mid);
  min-width: 7.5rem;
}

/* Ranked rating, one row per account in view. */
.home-ratings {
  flex-direction: column;
  align-items: flex-start;
}

.home-rating-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.15rem 0.6rem;
}

.home-rating-acct {
  color: var(--bone);
  min-width: 11rem;
}

.home-units-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 0.75rem;
  margin: 0.8rem 0 0.6rem;
}

.home-units {
  list-style: none;
  padding: 0;
  margin: 0.35rem 0 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.home-units li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
}

.home-unit-delta {
  font-family: 'DM Mono', monospace;
  font-size: 0.8rem;
}

/* Keep icon + unit name together on one line. */
.home-units li .tag {
  white-space: nowrap;
  flex-shrink: 0;
}

.home-units li .muted {
  white-space: nowrap;
}

@media (max-width: 560px) {
  .home-units-grid {
    grid-template-columns: 1fr;
  }
}

.home-latest-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.6rem;
  margin: 0.4rem 0;
  font-size: 0.8rem;
}

.home-matchup {
  margin: 0.3rem 0 0.6rem;
  color: var(--bone-dim);
}

.home-matchup-me {
  color: var(--bone);
  font-weight: 600;
}

.home-story {
  font-family: 'Instrument Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  margin: 0 0 1rem;
  padding-left: 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  font-size: 0.88rem;
  line-height: 1.5;
}

/* Insights feed: one plain sentence per pattern, under the snapshot grid. */
.home-insights {
  margin-top: 1rem;
}

.home-insight-list {
  font-family: 'Instrument Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  margin: 0 0 0.75rem;
  padding-left: 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  font-size: 0.88rem;
  line-height: 1.5;
}

/* A latest game whose scored result disagrees with the reactor lead. */
.home-latest-check {
  border-color: rgba(193, 122, 58, 0.55);
}

/* "Open full breakdown" + "Result wrong? Correct it", with the side picker
   wrapping onto its own line underneath. */
.home-latest-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

.home-latest-actions .game-picker {
  flex-basis: 100%;
}

.library-back {
  margin: 0.5rem 0 0.75rem;
}

/* Unit icons (dev-supplied art, tier = in-game level colour). Sized to the
   text they label; the 96px source covers 2x screens. */
.unit-icon {
  width: 1.5em;
  height: 1.5em;
  vertical-align: middle;
  margin-right: 0.35em;
  flex-shrink: 0;
}

.tag .unit-icon {
  width: 1.35em;
  height: 1.35em;
  margin: -0.2em 0.3em -0.2em -0.15em;
}

/* Player filter (batch view): frequency-sorted checkboxes to scope every
   stat to one player (or several, for alt accounts). */
.patch-pick { margin: 0.35rem 0 0; }
.patch-pick summary { cursor: pointer; }

.player-filter-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 0.15rem 1rem;
  max-height: 240px;
  overflow-y: auto;
  margin: 0.75rem 0;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--ash);
  border-radius: var(--radius);
  background: var(--obsidian);
}

.player-filter-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.2rem 0.1rem;
  cursor: pointer;
  font-size: 0.85rem;
}

.player-filter-item input {
  accent-color: var(--gold);
  cursor: pointer;
  flex-shrink: 0;
}

.player-filter-item .pf-name {
  color: var(--bone);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.player-filter-item .pf-count {
  margin-left: auto;
  color: var(--text-mid);
  font-family: 'DM Mono', monospace;
  font-size: 0.75rem;
  padding-left: 0.5rem;
}

/* Win/loss streak "recent form" strip */
.home-form-rate { white-space: nowrap; }

.form-strip {
  display: inline-flex;
  gap: 2px;
  flex-wrap: wrap;
}

.form-strip span {
  display: inline-block;
  width: 14px;
  text-align: center;
  font-family: 'DM Mono', monospace;
  font-size: 0.65rem;
  line-height: 1.4;
  border-radius: var(--radius);
}

.form-w {
  background: rgba(65, 160, 116, 0.18);
  color: var(--status-good);
}

.form-l {
  background: rgba(181, 82, 74, 0.18);
  color: var(--status-bad);
}

.filter-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
  padding: 0.4rem 0.75rem;
  border: 1px solid var(--ash);
  border-radius: var(--radius);
  background: var(--obsidian);
  margin-bottom: 0.25rem;
}

.filter-chip-row .player-filter-item .pf-count {
  margin-left: 0.35rem;
}

.team-toggle {
  margin-top: 0.6rem;
  color: var(--bone-dim);
}

.pf-clear {
  margin-top: 0.75rem;
}

/* Batch visualizations (bars / scatter / columns / radar) */
.batch-chart-svg {
  width: 100%;
  height: auto;
  display: block;
  overflow: visible;
}

.batch-bar {
  transition: opacity 0.12s ease;
}

.batch-bar:hover {
  opacity: 0.82;
}

/* A reference line (50% break-even, median pick rate) reads stronger than a
   gridline but stays quieter than the data. */
.chart-ref-line {
  stroke: var(--gold-dim);
  stroke-width: 1;
  stroke-dasharray: 4 3;
}

.chart-axis-title {
  fill: var(--text-mid);
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.scatter-dot {
  stroke: var(--smoke);
  stroke-width: 2;
  transition: r 0.1s ease;
}

.scatter-dot:hover {
  r: 8;
}

.scatter-label {
  fill: var(--bone-dim);
  font-family: 'DM Mono', monospace;
  font-size: 10px;
}

.radar-svg {
  max-width: 480px;
  margin: 0 auto;
}

.heatmap-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 1.6rem;
  align-items: flex-end;
  margin-bottom: 1rem;
}

.heatmap-control-label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.heatmap-control-label > span {
  font-family: 'DM Mono', monospace;
  font-size: 0.66rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-mid);
}

.heatmap-select {
  background: var(--obsidian);
  border: 1px solid var(--ash);
  border-radius: var(--radius);
  color: var(--bone);
  font-family: 'DM Mono', monospace;
  font-size: 0.8rem;
  padding: 0.4rem 0.6rem;
  min-width: 180px;
}
.heatmap-select:focus { outline: none; border-color: var(--gold-dim); }

.heatmap-outcome { gap: 0.3rem; }

.heatmap-flank { margin-top: 0.4rem; }
.heatmap-flank strong { color: var(--bone); }

.heatmap-svg {
  width: 100%;
  max-width: 520px;
  height: auto;
  display: block;
  margin: 0 auto;
}

.heatmap-cell {
  stroke: rgba(255, 255, 255, 0.04);
  stroke-width: 1;
}

.heatmap-frame {
  fill: none;
  stroke: var(--ash);
  stroke-width: 1;
}

.heatmap-midline {
  stroke: var(--bone-dim);
  stroke-width: 1;
  stroke-dasharray: 4 3;
  opacity: 0.7;
}

.heatmap-axis {
  fill: var(--text-mid);
  font-family: 'DM Mono', monospace;
  font-size: 9px;
  letter-spacing: 0.04em;
}

.heatmap-axis-end {
  text-anchor: end;
}

.heatmap-axis-mid {
  text-anchor: middle;
}

.radar-ring {
  fill: none;
  stroke: var(--ash);
  stroke-width: 1;
}

.radar-spoke {
  stroke: var(--ash);
  stroke-width: 1;
}

.radar-axis-label {
  fill: var(--text-mid);
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.04em;
}

.radar-area {
  fill-opacity: 0.14;
  stroke-width: 2;
  stroke-linejoin: round;
}

.radar-dot {
  stroke: var(--smoke);
  stroke-width: 1.5;
}

/* Batch view: the tab bar sticks to the top so it stays reachable while
   scrolling a long tab (the panels can be many cards tall). The solid
   obsidian background keeps scrolling content from showing through it. */
.batch-tabs {
  position: sticky;
  top: var(--filterbar-h, 0px);
  z-index: 10;
  background: var(--obsidian);
  padding-top: 0.5rem;
  margin-top: 0.5rem;
}

/* On a phone the tab bar would wrap to four rows and, being sticky, cover a
   third of the screen while scrolling. One horizontally scrollable row instead. */
@media (max-width: 720px) {
  .batch-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .batch-tabs::-webkit-scrollbar {
    display: none;
  }
  .batch-tabs .tab-btn {
    flex-shrink: 0;
    padding: 0.55rem 0.7rem;
  }
}
/* 0.9.4: nine tabs (Explorer added) need ~850px at full spacing; tighten it
   so they stay on one row down to the phone layout. */
@media (max-width: 1000px) and (min-width: 721px) {
  .batch-tabs .tab-btn { padding: 0.6rem 0.55rem; letter-spacing: 0.1em; }
}

.download-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.4rem;
}

.btn {
  background: var(--gold);
  color: var(--obsidian);
  border: none;
  padding: 0.6rem 1.2rem;
  border-radius: var(--radius);
  font-family: 'DM Mono', monospace;
  font-size: 0.75rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.2s ease;
}

.btn:hover {
  background: var(--bone);
}

/* Clan-mode passphrase gate (soft-private; cosmetic). */
.clan-gate-row {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
}
.clan-gate-input {
  flex: 1 1 200px;
  padding: 10px 12px;
  background: var(--obsidian, #0a0a0a);
  border: 1px solid var(--ash, #2a2a2a);
  color: var(--bone, #e8e4dc);
  font-family: inherit;
  font-size: 14px;
}
.clan-gate-input:focus {
  outline: none;
  border-color: var(--gold, #b8933a);
}

/* Sortable table headers (buildSortableTable). */
.round-table th.th-sortable {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
.round-table th.th-sortable:hover,
.round-table th.th-sort-active {
  color: var(--gold, #b8933a);
}
.round-table th.th-sortable:focus-visible {
  outline: 1px solid var(--gold, #b8933a);
  outline-offset: -1px;
}
.th-sort-arrow {
  font-size: 0.8em;
  opacity: 0.9;
}

/* Idle sort icon: visible enough to say "clickable", quiet enough not to
   compete with the active column's arrow. */
.th-sort-arrow.th-sort-idle {
  font-size: 1em;
  color: var(--gold-dim);
  opacity: 1;
}

.round-table th.th-sortable:hover .th-sort-idle {
  color: var(--gold);
}

/* Delta column: signed win-rate delta vs baseline. */
.delta-pos { color: #2e9e6b; }
.delta-neg { color: #d55181; }

/* --- Collections (0.8.0) ------------------------------------------------- */
.collection-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.collection-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

.collection-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--ash);
}

.collection-row .collection-name {
  flex: 1 1 14rem;
}

.collection-name-missing {
  border-color: var(--unconfirmed);
}

/* --- Dashboard v1 (0.8.0): Kris's tournament meta layout ------------------- */
.dash-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem 0.9rem;
  margin: 0 0 0.75rem;
}

.dash-title {
  margin: 0;
}

.dash-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(330px, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
  align-items: start;
}

.dash-panel h3 {
  margin-bottom: 0.6rem;
}

.dash-band {
  margin-bottom: 0.75rem;
}

.dash-band-title {
  font-family: 'DM Mono', monospace;
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 0.25rem 0.5rem;
  margin-bottom: 0.4rem;
}

.dash-band-best .dash-band-title {
  background: rgba(46, 158, 107, 0.18);
  color: #5cc896;
}

.dash-band-worst .dash-band-title {
  background: rgba(214, 69, 65, 0.18);
  color: #e57a76;
}

.dash-band-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.75rem;
}

.dash-section-title {
  display: none; /* the table header names the column already */
}

.dash-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
}

.dash-table th {
  font-family: 'DM Mono', monospace;
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-mid);
  text-align: left;
  font-weight: 400;
  padding: 0.2rem 0.3rem;
  border-bottom: 1px solid var(--ash);
  white-space: nowrap;
}

.dash-table td {
  padding: 0.28rem 0.3rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  white-space: nowrap;
}

.dash-table td.dash-name {
  white-space: normal;
  max-width: 14rem;
}

.dash-pack {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  flex-wrap: wrap;
}

.dash-pack-name {
  margin-left: 0.2rem;
}

.dash-rate {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.dash-rate-bar {
  display: inline-block;
  width: 3.2rem;
  height: 0.5rem;
  background: rgba(255, 255, 255, 0.06);
}

.dash-rate-fill {
  display: block;
  height: 100%;
}

.dash-good { background: #41a074; }
.dash-bad { background: #b5524a; }
.dash-good-text { color: #41a074; }
.dash-bad-text { color: #b5524a; }

.dash-rate-num {
  font-variant-numeric: tabular-nums;
  min-width: 2.4rem;
}

.dash-empty {
  margin: 0.2rem 0 0.4rem;
}

.dash-foot {
  margin-top: 0;
}

.dash-grid-wide {
  grid-template-columns: repeat(auto-fit, minmax(480px, 1fr));
}

@media (max-width: 560px) {
  .dash-grid,
  .dash-grid-wide {
    grid-template-columns: 1fr;
  }
}

/* --- 0.9.0 layout ---------------------------------------------------------- */
/* Merged sections: one card, the cards inside lose their own frame and their
   titles drop to sub-headings. */
.card-group > .card,
.card-group > .dash-grid > .card {
  background: none;
  border: 0;
  padding: 0;
  margin: 1.25rem 0 0;
}
.card-group > .card + .card { border-top: 1px solid var(--ash); padding-top: 1.25rem; }
.card-group > .card > h3 {
  font-family: 'DM Mono', monospace;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  color: var(--bone-dim);
  margin-bottom: 0.5rem;
}
.card-group > h3 + .muted { margin-top: -0.4rem; }

/* "Show as table" under a chart: the same numbers, folded. */
.table-view { margin-top: 0.75rem; }
.table-view > summary {
  cursor: pointer;
  font-family: 'DM Mono', monospace;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  color: var(--gold);
  list-style: none;
}
.table-view > summary::before { content: "▸ "; }
.table-view[open] > summary::before { content: "▾ "; }
.table-view > .table-view-body {
  background: none;
  border: 0;
  padding: 0;
  margin-top: 0.5rem;
}
.table-view > .table-view-body > h3 { display: none; }

/* Games list: pages of 50. */
.games-more { display: block; margin: 1rem auto 0; }

/* Type (0.9.0, Kris chose option B): DM Sans for prose and labels, DM Mono kept
   for tables and numbers, Bebas Neue headings unchanged. The class is on <body>
   in index.html and every clan page. */
body.font-sans,
body.font-sans :is(p, li, label, span, a, button, summary, dd, dt, input, select, h2, h4, .muted, .small):not(td, th, td *, th *, .stat-chip b, .game-meta, .game-meta *, .form-strip *) {
  font-family: 'DM Sans', sans-serif;
}

/* Even-width digits in table cells so numbers line up in their columns. */
td { font-variant-numeric: tabular-nums; }

/* --- 0.9.1: filter bar (patch dropdown, player chips + search) ------------- */
.filter-select {
  background: var(--obsidian);
  color: var(--bone);
  border: 1px solid var(--ash);
  padding: 0.35rem 0.5rem;
  font-family: inherit;
  font-size: 0.8rem;
  margin-top: 0.4rem;
  max-width: 100%;
}
.filter-select:focus { border-color: var(--gold-dim); outline: none; }
.pf-chips { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.4rem; }
.pf-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  border: 1px solid var(--gold-dim);
  padding: 0.15rem 0.2rem 0.15rem 0.5rem;
  font-size: 0.8rem;
}
.pf-chip-x {
  background: none;
  border: 0;
  color: var(--bone-dim);
  cursor: pointer;
  font-size: 0.9rem;
  line-height: 1;
  padding: 0 0.3rem;
}
.pf-chip-x:hover { color: var(--gold); }
.pf-results { display: flex; flex-direction: column; max-width: 320px; }
.pf-result,
.profile-result {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--obsidian);
  color: var(--bone);
  border: 1px solid var(--ash);
  border-top: 0;
  padding: 0.35rem 0.5rem;
  font: inherit;
  font-size: 0.8rem;
  text-align: left;
  cursor: pointer;
}
.pf-result .pf-count { margin-left: auto; }
.pf-result:hover,
.profile-result:hover { border-color: var(--gold-dim); color: var(--gold); }
.pf-quick { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem; margin-top: 0.6rem; }
.pf-quick-add {
  background: none;
  border: 1px solid var(--ash);
  color: var(--bone-dim);
  padding: 0.15rem 0.5rem;
  font: inherit;
  font-size: 0.75rem;
  cursor: pointer;
}
.pf-quick-add:hover { border-color: var(--gold-dim); color: var(--gold); }
.pf-browse { margin-top: 0.6rem; }
.pf-browse > summary {
  cursor: pointer;
  font-size: 0.75rem;
  color: var(--gold);
  list-style: none;
}
.pf-browse > summary::before { content: "▸ "; }
.pf-browse[open] > summary::before { content: "▾ "; }

/* --- 0.9.1: player profiles (People tab) --------------------------------- */
.profile-row { border-top: 1px solid var(--ash); padding: 0.75rem 0; }
.profile-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.6rem; }
.profile-head .btn-inline { margin-left: auto; }
.profile-accts { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.4rem; }
.profile-acct {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  border: 1px solid var(--ash);
  padding: 0.1rem 0.45rem;
  font-size: 0.78rem;
}
.profile-acct .btn-inline { padding: 0 0.2rem; }
.profile-warn { color: var(--unconfirmed); margin: 0.4rem 0 0; }
.profile-actions { margin-top: 0.75rem; }
.profile-suggest { margin-top: 1rem; border-top: 1px solid var(--ash); padding-top: 0.75rem; }
.profile-suggest-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; margin: 0.3rem 0; font-size: 0.82rem; }
.profile-form .profile-results { display: flex; flex-direction: column; max-width: 360px; }

/* 0.9.2: a game type with no games in view (still listed so the option shows). */
.player-filter-item.pf-empty { opacity: 0.45; cursor: help; }

/* --- 0.9.3 design pass ------------------------------------------------------ */
/* Headline strip: the few numbers that sum up a tab (same look as Home's
   snapshot boxes). */
.headline-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.5rem;
  margin-top: 1.5rem;
}
.headline-item {
  border: 1px solid var(--ash);
  background: var(--smoke);
  padding: 0.7rem 0.8rem;
}
.headline-value {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1.9rem;
  line-height: 1;
  color: var(--bone);
}
.headline-label {
  font-family: 'DM Mono', monospace;
  font-size: 0.64rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold);
  margin-top: 0.3rem;
}
.headline-sub { font-size: 0.72rem; color: var(--text-mid); margin-top: 0.1rem; }

/* Tables: numbers right-aligned; long tables show their first rows. */
table.round-table th.num,
table.round-table td.num { text-align: right; }
.table-more { display: block; margin: 0.6rem auto 0; }
.table-more[hidden] { display: none; }

/* Long notes fold behind "More". */
.note-more {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  color: var(--gold);
  text-decoration: underline;
  cursor: pointer;
}

/* --- 0.9.3: compact header once a library exists ------------------------- */
body.has-profile .title-row { margin-bottom: 0.5rem; }
body.has-profile h1 { font-size: 1.55rem; }
/* The privacy promise stays on the page, on one line; the full sentence is
   its tooltip (title in index.html / clan pages). */
body.has-profile .privacy-note {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  font-size: 0.7rem;
}
/* One-off replays: Library menu → "Open replay files…", or drop anywhere. */
body.has-profile #dropzone { display: none; }
body.drop-active::after {
  content: "Drop replays or a backup file";
  position: fixed;
  inset: 0.75rem;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px dashed var(--gold);
  background: rgba(10, 10, 10, 0.82);
  color: var(--gold);
  font-family: 'Bebas Neue', sans-serif;
  font-size: 2rem;
  letter-spacing: 0.05em;
  pointer-events: none;
}
/* Toolbar: scope on the left, actions on the right, status line under them. */
body.has-profile #profile-bar { padding: 0.45rem 0.8rem; gap: 0.4rem 0.8rem; }
body.has-profile #profile-actions { margin-left: auto; }
body.has-profile #profile-status { order: 5; flex: 1 1 100%; font-size: 0.75rem; }
body.has-profile #profile-status:empty { display: none; }
body.has-profile .batch-headline { margin: 0.8rem 0 0.4rem; }
/* Toolbar buttons: compact, so scope + actions fit one row on a laptop. */
body.has-profile #profile-actions .btn-picker {
  padding: 0.38rem 0.8rem;
  font-size: 0.66rem;
  letter-spacing: 0.12em;
}
body.has-profile .batch-headline h2 { font-size: 1.2rem; }
/* Phone width: the Collection / Viewing / Accounts row wraps instead of
   pushing the page sideways (it overflowed to 587px at 375px wide). */
.identity-summary { flex-wrap: wrap; min-width: 0; }
@media (max-width: 520px) {
  .scope-select { max-width: 100%; }
  body.has-profile #profile-actions { margin-left: 0; }
  .headline-value { font-size: 1.6rem; }
}

/* --- 0.9.4: Explorer --------------------------------------------------------- */
.explorer-conds { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; margin-top: 0.75rem; }
.explorer-chip { gap: 0.35rem; padding-left: 0.2rem; }
.explorer-flip {
  background: var(--gold-dim);
  color: var(--obsidian);
  border: 0;
  padding: 0.1rem 0.4rem;
  font-family: 'DM Mono', monospace;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  cursor: pointer;
}
.explorer-flip.explorer-without { background: #b5524a; color: var(--bone); }
.explorer-add { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; margin-top: 0.6rem; }
.explorer-add .filter-select { margin-top: 0; }
.explorer-input { min-width: 0; width: 16rem; max-width: 100%; }
.explorer-warn { color: var(--unconfirmed); margin: 0.5rem 0 0; }
.explorer-along-head { margin-top: 1.5rem; }
.explorer-along-title {
  font-family: 'DM Mono', monospace;
  font-size: 0.7rem;
  font-weight: 400;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold);
  margin: 0 0 0.5rem;
}
.explorer-cats { display: flex; flex-wrap: wrap; gap: 0.3rem; margin-bottom: 0.5rem; }
.explorer-cat {
  background: none;
  border: 1px solid var(--ash);
  color: var(--bone-dim);
  padding: 0.2rem 0.55rem;
  font: inherit;
  font-size: 0.75rem;
  cursor: pointer;
}
.explorer-cat:hover { border-color: var(--gold-dim); color: var(--gold); }
.explorer-cat.active { border-color: var(--gold); color: var(--gold); }
.explorer-cat-empty { opacity: 0.45; }
.explorer-acts { display: inline-flex; gap: 0.25rem; }
.explorer-act {
  background: none;
  border: 1px solid var(--ash);
  color: var(--bone-dim);
  width: 1.6rem;
  height: 1.6rem;
  font: inherit;
  font-size: 0.9rem;
  line-height: 1;
  cursor: pointer;
}
.explorer-act:hover { border-color: var(--gold); color: var(--gold); }

/* ---------- Public tournament pages (tournaments.html, 0.13.0) ---------- */
:root { --medal-gold: #d4af37; --medal-silver: #b9bec4; --medal-bronze: #c27c43; }
.tn-nav { display: flex; gap: 0.25rem; flex-wrap: wrap; margin: 1rem 0 0; }
.tn-nav a { text-decoration: none; }
.tn-card { overflow: hidden; }
.tn-controls { display: flex; flex-wrap: wrap; gap: 0.5rem 1rem; align-items: center; margin: 0.25rem 0 0.75rem; }
.tn-seg { display: flex; flex-wrap: wrap; gap: 0.25rem; }
.tn-search { width: min(100%, 22rem); }
.tn-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.tn-table { width: 100%; }
.tn-table td { vertical-align: middle; }
.tn-table td.num, .tn-table th.num { text-align: right; white-space: nowrap; }
.tn-table th.th-sorted { color: var(--gold); }
.tn-nowrap { white-space: nowrap; }
/* Links: bone text like the rest of the page, gold on hover; no browser blue. */
.tn-link, .tn-link:visited { color: var(--bone); text-decoration: none; font-family: inherit; }
.tn-link:hover, .tn-link:focus-visible { color: var(--gold); text-decoration: underline; text-underline-offset: 3px; }
.tn-team { white-space: nowrap; }
.tn-rounds summary { cursor: pointer; color: var(--text-mid); }
.tn-rounds div { white-space: nowrap; font-size: 0.8rem; color: var(--bone-dim); }
.tn-h2 { font-family: 'Bebas Neue', sans-serif; font-size: 1.6rem; letter-spacing: 0.03em; margin: 1.5rem 0 0.25rem; font-weight: 400; }
.tn-strip { margin-top: 1rem; }
.tn-more { margin-top: 0.75rem; display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.tn-footer p { margin: 0.35rem 0; }
/* Place badges: the number is always shown; colour is gold / silver / bronze. */
.tn-medal { display: inline-flex; align-items: center; justify-content: center; min-width: 1.45rem; height: 1.45rem; padding: 0 0.3rem;
  border-radius: 999px; font: 600 0.75rem 'DM Mono', monospace; color: var(--bone-dim); border: 1px solid var(--ash-light); }
.tn-gold { background: var(--medal-gold); border-color: var(--medal-gold); color: #1a1406; }
.tn-silver { background: var(--medal-silver); border-color: var(--medal-silver); color: #15171a; }
.tn-bronze { background: var(--medal-bronze); border-color: var(--medal-bronze); color: #1d1007; }
.tn-top-gold td { background: rgba(212, 175, 55, 0.08); }
.tn-top-silver td { background: rgba(185, 190, 196, 0.06); }
.tn-top-bronze td { background: rgba(194, 124, 67, 0.07); }
.tn-count { display: inline-flex; align-items: center; gap: 0.15rem; margin-right: 0.6rem; white-space: nowrap; font-size: 0.85rem; }
.tn-counts { white-space: nowrap; }
.tn-badges { display: flex; gap: 0.5rem; flex-wrap: wrap; margin: 0.25rem 0; }
/* Home: card grid */
.tn-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 19rem), 1fr)); gap: 1rem; margin-top: 0.75rem; }
.tn-tcard { background: var(--smoke); border: 1px solid var(--ash); padding: 1rem 1.1rem; display: flex; flex-direction: column; gap: 0.5rem; min-width: 0; }
.tn-tcard-title, .tn-tcard-title:visited { font-family: 'Bebas Neue', sans-serif; font-size: 1.25rem; letter-spacing: 0.03em; color: var(--bone); text-decoration: none; line-height: 1.1; }
a.tn-tcard-title:hover { color: var(--gold); }
.tn-podiums { display: flex; flex-direction: column; gap: 0.6rem; }
.tn-podium-name { font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-mid); margin-bottom: 0.15rem; }
.tn-podium-row { display: flex; align-items: center; gap: 0.45rem; padding: 0.1rem 0; min-width: 0; }
.tn-podium-row .tn-team { overflow: hidden; text-overflow: ellipsis; }
.tn-toplist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.35rem; }
.tn-toplist li { display: flex; align-items: center; gap: 0.45rem; min-width: 0; }
.tn-toplist-stat { margin-left: auto; white-space: nowrap; }
.title-row .privacy-note a { color: var(--bone); text-decoration: none; }
.title-row .privacy-note a:hover { color: var(--gold); }
/* The page-wide DM Sans rule (body.font-sans) would win over these; #tn-app keeps the display fonts. */
body.font-sans #tn-app .tn-h2, body.font-sans #tn-app .tn-tcard-title { font-family: 'Bebas Neue', sans-serif; }
body.font-sans #tn-app .tn-medal { font-family: 'DM Mono', monospace; }
.tn-others { display: flex; flex-direction: column; gap: 0.25rem; border-top: 1px solid var(--ash); padding-top: 0.5rem; }
.tn-others div { display: flex; align-items: center; gap: 0.4rem; min-width: 0; font-size: 0.85rem; }
.tn-table td .tn-link, .tn-table td .tn-team { white-space: nowrap; }
.tn-pills { display: inline-flex; flex-wrap: wrap; gap: 0.25rem; }
.tn-pill { white-space: nowrap; font-size: 0.75rem; padding: 0.05rem 0.4rem; border: 1px solid var(--ash-light); color: var(--bone-dim); }
a.footer-link { text-decoration: none; }
.title-link { font-family: 'DM Mono', monospace; font-size: 0.78rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--gold); text-decoration: none; border: 1px solid var(--gold-dim); padding: 0.2rem 0.55rem; }
.title-link:hover { color: var(--bone); border-color: var(--gold); }
/* "New" tag raised on the left edge of a header link (0.14.2, Kris: make the
   tournament link easier to spot). Remove the span from index.html when it's old news. */
.title-link-new { position: relative; margin-left: 1rem; }
.title-new { position: absolute; left: -1rem; top: -0.7rem; background: #d14b3a; color: #fff; font-family: 'DM Mono', monospace; font-size: 0.56rem;
  font-weight: 500; line-height: 1; letter-spacing: 0.08em; text-transform: uppercase; padding: 0.18rem 0.32rem; pointer-events: none; }
/* Tournament replay stats (0.13.0): unit icons, armies, meta tables */
.tn-unit { display: inline-flex; align-items: center; gap: 0.45rem; white-space: nowrap; }
.tn-unit-icon { width: 28px; height: 28px; object-fit: contain; flex: none; }
.tn-unit-blank { display: inline-block; }
.tn-army { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.tn-army-unit { display: inline-flex; align-items: center; gap: 0.3rem; padding: 0.2rem 0.45rem 0.2rem 0.2rem; border: 1px solid var(--ash-light); background: var(--obsidian); font-size: 0.85rem; }
.tn-army-n { color: var(--bone); }
.tn-army-lv { color: var(--gold); font-size: 0.75rem; }
.tn-h4 { margin: 0.75rem 0 0.4rem; font-size: 0.78rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-mid); display: flex; align-items: center; gap: 0.4rem; }
.tn-champ { margin: 0.25rem 0 0.75rem; }
.tn-champ-row { margin-bottom: 0.5rem; }
.tn-meta-tables { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr)); gap: 0.5rem 1.5rem; }
.tn-meta-details { margin: 0.25rem 0 0.75rem; }
.tn-meta-details summary { cursor: pointer; color: var(--gold); }

/* The new-look switch (look.js, 0.14.0): a slim notice under the title + a footer
   link. Styled for both looks. */
.look-notice { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; margin: 0 0 0.9rem; padding: 0.45rem 0.7rem;
  border: 1px solid var(--ash); background: var(--smoke); font-size: 0.8rem; color: var(--bone-dim); }
.look-notice .btn-inline { font-size: 0.8rem; }
.look-notice-close { margin-left: auto; background: none; border: none; color: var(--text-mid); font-size: 1.1rem; line-height: 1; cursor: pointer; padding: 0 0.2rem; }
.look-notice-close:hover { color: var(--bone); }
.look-footer-switch { background: none; border: none; cursor: pointer; padding: 0; }

/* ==========================================================================
   NEW LOOK PREVIEW (0.14.0, Kris 2026-10-20): "toned-down C", an esports
   broadcast look kept quiet on data screens. Off unless <html data-look="c">
   (set by the head script on each page: ?look=new on, ?look=old off).
   Gold rule (Kris): gold ONLY on the title's hazard stripe and the active tab.
   Everything else off-white / grey; results use a muted green. The 1st / 2nd /
   3rd place colours are data (which place), not decoration, so they stay.
   Italic display numbers never go in table columns (tables stay upright mono).
   Prefix ":root[data-look=c] body.font-sans" so these beat the page-wide
   DM Sans rule without !important.
   ========================================================================== */
:root[data-look="c"] {
  --c-head: 'Archivo', 'DM Sans', sans-serif;
  --c-panel: #141414;
  --c-line: #2a2a2a;
  --c-quiet: #8a8a8a;
  --c-win: #2f6b4c;
  --c-win-text: #e6f5ec;
  --c-loss: #6e2f2a;
  --c-loss-text: #f6e4e1;
  /* The gold rule in one place: the real gold lives in --c-gold (stripe + active
     tab only); every older "gold" accent in this stylesheet turns off-white, and
     the dim gold borders turn grey. */
  --c-gold: #b8933a;
  --gold: var(--bone);
  --gold-dim: #444;
}
/* Title: heavy italic caps + the one gold hazard stripe. */
:root[data-look="c"] body.font-sans h1 { font-family: var(--c-head); font-style: italic; font-weight: 900; font-stretch: 112%; letter-spacing: -0.005em; text-transform: uppercase; font-size: 2rem; }
:root[data-look="c"] body.font-sans .title-row { position: relative; padding-bottom: 16px; }
:root[data-look="c"] body.font-sans .title-row::after { content: ""; position: absolute; left: 0; bottom: 0; width: 120px; height: 5px;
  background: repeating-linear-gradient(-55deg, var(--c-gold) 0 5px, transparent 5px 10px); }
:root[data-look="c"] body.font-sans .title-link { color: var(--bone-dim); border-color: #3a3a3a; transform: skewX(-14deg); }
:root[data-look="c"] body.font-sans .title-link:hover { color: var(--bone); border-color: #666; }
:root[data-look="c"] body.font-sans .title-row .privacy-note a:hover { color: var(--bone); text-decoration: underline; }
/* Tabs: slanted boxes; the active one is the only gold fill. */
:root[data-look="c"] body.font-sans .tab-btn { transform: skewX(-14deg); border: 1px solid var(--c-line); margin: 0 4px 4px 0; padding: 0.4rem 0.95rem;
  font-size: 0.7rem; letter-spacing: 0.1em; color: var(--c-quiet); background: transparent; }
:root[data-look="c"] body.font-sans .tab-btn:hover:not(.active) { color: var(--bone); border-color: #444; }
:root[data-look="c"] body.font-sans .tab-btn.active { background: var(--c-gold); border-color: var(--c-gold); color: var(--obsidian); }
/* Figures: boxes with one angled edge, italic numbers. */
:root[data-look="c"] body.font-sans .headline-item { border: none; background: var(--c-panel); clip-path: polygon(0 0, 100% 0, calc(100% - 12px) 100%, 0 100%); padding: 0.7rem 1.4rem 0.7rem 0.85rem; }
:root[data-look="c"] body.font-sans .headline-value { font-family: var(--c-head); font-style: italic; font-weight: 900; font-stretch: 112%; font-size: 1.7rem; color: var(--bone); }
:root[data-look="c"] body.font-sans .headline-label { color: #7a7a7a; }
/* Card titles and headings: off-white italic caps, no gold. */
:root[data-look="c"] body.font-sans .card h3 { font-family: var(--c-head); font-style: italic; font-weight: 800; font-stretch: 112%; font-size: 1.05rem; letter-spacing: 0.02em; color: var(--bone); }
:root[data-look="c"] body.font-sans #tn-app .tn-h2,
:root[data-look="c"] body.font-sans #tn-app .tn-tcard-title { font-family: var(--c-head); font-style: italic; font-weight: 900; font-stretch: 112%; text-transform: uppercase; letter-spacing: -0.005em; }
/* Buttons and links: neutral (gold is reserved). */
:root[data-look="c"] body.font-sans .btn { background: #1c1c1c; color: var(--bone); border: 1px solid #3a3a3a; }
:root[data-look="c"] body.font-sans .btn:hover { background: #262626; border-color: #666; }
:root[data-look="c"] body.font-sans .btn-inline { background: none; border: none; color: var(--bone); }
:root[data-look="c"] body.font-sans .footer-link:hover,
:root[data-look="c"] body.font-sans .tn-link:hover,
:root[data-look="c"] body.font-sans .tn-link:focus-visible { color: var(--bone); }
:root[data-look="c"] body.font-sans .filter-select:focus { border-color: #666; }
/* Tables stay plain: no gold sort header, no tinted podium rows (the place badge says it). */
:root[data-look="c"] body.font-sans .tn-table th.th-sorted { color: var(--bone); }
:root[data-look="c"] body.font-sans .tn-top-gold td,
:root[data-look="c"] body.font-sans .tn-top-silver td,
:root[data-look="c"] body.font-sans .tn-top-bronze td { background: transparent; }
:root[data-look="c"] body.font-sans .tn-pill,
:root[data-look="c"] body.font-sans .tn-army-lv { color: var(--bone-dim); }
:root[data-look="c"] body.font-sans .tn-meta-details summary { color: var(--bone); }
/* Place badges: slanted blocks with an italic number (colour still = place). */
:root[data-look="c"] body.font-sans #tn-app .tn-medal { border-radius: 0; transform: skewX(-14deg); font-family: var(--c-head); font-style: italic; font-weight: 900; font-stretch: 112%; }
/* Lower thirds: podium rows and top-5 lists as broadcast name bars. */
:root[data-look="c"] body.font-sans .tn-podium-row,
:root[data-look="c"] body.font-sans .tn-toplist li { background: var(--c-panel); padding: 0; gap: 0; margin-bottom: 4px; align-items: stretch; }
:root[data-look="c"] body.font-sans #tn-app .tn-podium-row .tn-medal,
:root[data-look="c"] body.font-sans #tn-app .tn-toplist li .tn-medal { transform: none; height: auto; min-width: 2.1rem; border: none; padding: 0.4rem 0.75rem 0.4rem 0.55rem;
  clip-path: polygon(0 0, 100% 0, calc(100% - 7px) 100%, 0 100%); font-size: 0.95rem; }
:root[data-look="c"] body.font-sans #tn-app .tn-toplist li .tn-medal:not(.tn-gold):not(.tn-silver):not(.tn-bronze) { background: #222; color: var(--bone-dim); }
:root[data-look="c"] body.font-sans .tn-podium-row > .tn-team,
:root[data-look="c"] body.font-sans .tn-toplist li > a { padding: 0.4rem 0.7rem; align-self: center; font-weight: 600; }
:root[data-look="c"] body.font-sans .tn-toplist-stat { padding: 0 0.7rem; align-self: center; }
:root[data-look="c"] body.font-sans .tn-podium-name { margin: 0.2rem 0 0.35rem; }
:root[data-look="c"] body.font-sans h1 { font-size: clamp(1.45rem, 4.2vw, 2.1rem); line-height: 1; }
:root[data-look="c"] body.font-sans .headline-value { font-size: clamp(1.25rem, 3.2vw, 1.7rem); white-space: nowrap; }
/* Sub-selectors (mode, bracket, ...): active = quiet outline; only the main tab is gold. */
:root[data-look="c"] body.font-sans .tn-seg .tab-btn.active { background: #262626; border-color: #777; color: var(--bone); }
/* Former gold FILLS would now be bright white blocks: give them the quiet active style. */
:root[data-look="c"] body.font-sans .seg-btn.active,
:root[data-look="c"] body.font-sans .scope-chip-on,
:root[data-look="c"] body.font-sans .scope-chip-on:hover { background: #262626; border-color: #777; color: var(--bone); }
:root[data-look="c"] body.font-sans .bar-fill { background: var(--bone-dim); }
:root[data-look="c"] body.font-sans .whatsnew-live { background: #262626; color: var(--bone); }
/* Data, not decoration: items carried on the playback board stay gold. */
:root[data-look="c"] .pb-item { fill: var(--c-gold); }
/* Analyzer: figure boxes, headings and results in the same broadcast style. */
:root[data-look="c"] body.font-sans .home-stat { border: none; background: var(--c-panel); clip-path: polygon(0 0, 100% 0, calc(100% - 12px) 100%, 0 100%); padding: 0.6rem 1.3rem 0.6rem 0.75rem; }
:root[data-look="c"] body.font-sans .home-stat-val { font-family: var(--c-head); font-style: italic; font-weight: 900; font-stretch: 112%; font-size: clamp(1.3rem, 3.2vw, 1.75rem); white-space: nowrap; }
:root[data-look="c"] body.font-sans .home-stat-label { color: #7a7a7a; }
:root[data-look="c"] body.font-sans .batch-headline h2,
:root[data-look="c"] body.font-sans .info-modal-head h2 { font-family: var(--c-head); font-style: italic; font-weight: 900; font-stretch: 112%; font-size: 1.2rem; letter-spacing: 0; color: var(--bone); }
:root[data-look="c"] body.font-sans .btn-picker { background: #1c1c1c; color: var(--bone); border: 1px solid #3a3a3a; }
:root[data-look="c"] body.font-sans .btn-picker:hover { background: #262626; border-color: #666; }
/* Results: solid muted blocks with an angled end (lower-third style). */
:root[data-look="c"] body.font-sans .game-result { border-radius: 0; font-family: var(--c-head); font-style: italic; font-weight: 900; font-stretch: 112%; letter-spacing: 0.04em;
  padding: 0.15rem 0.8rem 0.15rem 0.5rem; clip-path: polygon(0 0, 100% 0, calc(100% - 6px) 100%, 0 100%); }
:root[data-look="c"] body.font-sans .game-won,
:root[data-look="c"] body.font-sans .badge-win { background: var(--c-win); color: var(--c-win-text); }
:root[data-look="c"] body.font-sans .game-lost,
:root[data-look="c"] body.font-sans .badge-lose { background: var(--c-loss); color: var(--c-loss-text); }
/* The tab strip scrolls sideways; leave room for the first tab's slant. */
:root[data-look="c"] body.font-sans .batch-tabs { padding-left: 6px; }
/* Column charts drew their plain bars in gold; in this look they are a quiet warm grey
   (the win / loss coloured bars keep their colours). */
:root[data-look="c"] rect.batch-bar[fill="var(--gold)"] { fill: #8c8778; }
/* The switch in the new look: slanted like the tabs, quiet. */
:root[data-look="c"] body.font-sans .look-notice { background: var(--c-panel); border-color: var(--c-line); }
:root[data-look="c"] body.font-sans .look-notice .btn-inline { color: var(--bone); }

/* ---- Warmth pass (Kris 2026-10-20: "a little cold") ----------------------
   Gold rule, revised: gold on the title stripe, the active tab, card / section
   headings, and the main action buttons. Body text, tables, table numbers and
   secondary links stay neutral. */
:root[data-look="c"] body.font-sans .card h3,
:root[data-look="c"] body.font-sans .batch-headline h2,
:root[data-look="c"] body.font-sans .info-modal-head h2 { color: var(--c-gold); }
/* Main actions: gold, slanted like the tabs. */
:root[data-look="c"] body.font-sans .btn,
:root[data-look="c"] body.font-sans .btn-picker { background: var(--c-gold); color: var(--obsidian); border: 1px solid var(--c-gold); transform: skewX(-12deg); font-weight: 500; }
:root[data-look="c"] body.font-sans .btn:hover,
:root[data-look="c"] body.font-sans .btn-picker:hover { background: #d1aa4c; border-color: #d1aa4c; color: var(--obsidian); }
:root[data-look="c"] body.font-sans .btn-picker:disabled { opacity: 0.5; }

/* ---- Home tab pizzazz: summaries, so broadcast flair is fine here ---- */
/* Card titles on Home (and Insights) get a small slanted gold marker. */
:root[data-look="c"] body.font-sans .home-grid .card h3::before,
:root[data-look="c"] body.font-sans .home-insights h3::before { content: ""; display: inline-block; width: 0.55rem; height: 0.85em; margin-right: 0.55rem;
  background: var(--c-gold); transform: skewX(-14deg); vertical-align: -0.05em; }
/* "Last 7 days": a broadcast kicker. */
:root[data-look="c"] body.font-sans .home-session-label { color: var(--c-gold); font-family: var(--c-head); font-style: italic; font-weight: 800; font-stretch: 112%; letter-spacing: 0.06em; }
:root[data-look="c"] body.font-sans .home-session .stat-chip { transform: skewX(-12deg); border-color: #3a3a3a; }
/* Snapshot figures: scoreboard boxes, the headline figure underlined in gold. */
:root[data-look="c"] body.font-sans .home-stats .home-stat { box-shadow: inset 0 -3px 0 #2c2c2c; }
:root[data-look="c"] body.font-sans .home-stats .home-stat:first-child { box-shadow: inset 0 -3px 0 var(--c-gold); }
:root[data-look="c"] body.font-sans .home-stats .home-stat:first-child .home-stat-label { color: var(--c-gold); }
/* Last 10 form: slanted result chips. */
:root[data-look="c"] body.font-sans .form-strip { gap: 3px; }
:root[data-look="c"] body.font-sans .form-w,
:root[data-look="c"] body.font-sans .form-l { transform: skewX(-12deg); font-family: var(--c-head); font-style: italic; font-weight: 900; border-radius: 0; }
:root[data-look="c"] body.font-sans .form-w { background: var(--c-win); color: var(--c-win-text); }
:root[data-look="c"] body.font-sans .form-l { background: var(--c-loss); color: var(--c-loss-text); }
:root[data-look="c"] body.font-sans .home-form-rate b { font-family: var(--c-head); font-style: italic; font-weight: 900; font-stretch: 112%; font-size: 1.05rem; }
/* Latest game: the matchup as a lower-third bar, a bigger result block, gold story markers. */
:root[data-look="c"] body.font-sans .home-latest .game-result { font-size: 0.85rem; padding: 0.2rem 1rem 0.2rem 0.6rem; }
:root[data-look="c"] body.font-sans .home-matchup { background: var(--c-panel); border-left: 4px solid var(--c-gold); padding: 0.55rem 0.9rem; margin: 0.6rem 0 0.8rem;
  font-family: var(--c-head); font-style: italic; font-weight: 800; font-stretch: 108%; font-size: 1.1rem; line-height: 1.25; }
:root[data-look="c"] body.font-sans .home-matchup span { font-family: inherit; }
:root[data-look="c"] body.font-sans .home-story,
:root[data-look="c"] body.font-sans .home-insight-list { list-style: none; padding-left: 0; }
:root[data-look="c"] body.font-sans .home-story li,
:root[data-look="c"] body.font-sans .home-insight-list li { position: relative; padding-left: 1.2rem; margin-bottom: 0.35rem; }
:root[data-look="c"] body.font-sans .home-story li::before,
:root[data-look="c"] body.font-sans .home-insight-list li::before { content: ""; position: absolute; left: 0.1rem; top: 0.5em; width: 0.45rem; height: 0.45rem;
  background: var(--c-gold); transform: skewX(-14deg); }
:root[data-look="c"] body.font-sans .home-latest-actions { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
/* Small secondary buttons that share .btn (tournament page "Show 50 more", the hide-my-name
   email) stay quiet: outlined, not gold. */
:root[data-look="c"] body.font-sans .btn.btn-inline { background: transparent; color: var(--bone); border: 1px solid #3a3a3a; padding: 0.3rem 0.8rem; }
:root[data-look="c"] body.font-sans .btn.btn-inline:hover { border-color: var(--c-gold); color: var(--bone); background: transparent; }
/* Header cross-links (Tournament leaderboards / Replay Analyzer): gold buttons, slanted. */
:root[data-look="c"] body.font-sans .title-link { background: var(--c-gold); color: var(--obsidian); border: 1px solid var(--c-gold); font-weight: 500; padding: 0.3rem 0.8rem; }
:root[data-look="c"] body.font-sans .title-link:hover { background: #d1aa4c; border-color: #d1aa4c; color: var(--obsidian); }
:root[data-look="c"] body.font-sans .title-new { font-family: var(--c-head); font-style: italic; font-weight: 900; font-stretch: 112%; font-size: 0.62rem; }
