/* 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=Instrument+Sans:ital,wght@0,400;0,500;1,400&display=swap');

:root {
  --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: 2rem 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;
}

main {
  max-width: 960px;
  margin: 0 auto;
}

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

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

.privacy-note {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(76, 175, 125, 0.1);
  border: 1px solid rgba(76, 175, 125, 0.35);
  color: var(--status-good);
  padding: 0.5rem 0.9rem;
  border-radius: var(--radius);
  font-size: 0.85rem;
  margin-bottom: 1.5rem;
}

#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;
}

/* Local profile bar. Sits between the dropzone and the results, and is
   hidden until the profile module decides there is something to say. */
#profile-bar {
  margin-top: 1rem;
  padding: 0.9rem 1.1rem;
  background: var(--smoke);
  border: 1px solid var(--ash);
  border-radius: var(--radius);
}

#profile-bar p {
  margin: 0;
}

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

/* .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;
}

.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;
}
.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;
}

.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; }

.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); }

/* --- 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. */
#profile-identity {
  margin: 0.75rem 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.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;
}

/* Player filter (batch view): frequency-sorted checkboxes to scope every
   stat to one player (or several, for alt accounts). */
.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 */
.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;
}

.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: 0;
  z-index: 10;
  background: var(--obsidian);
  padding-top: 0.75rem;
  margin-top: 1.5rem;
}

.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;
}

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