/* ------------------------------------------------------------------ theme (#79 visuals: "Dark esports")
   Dark by default (<html data-bs-theme="dark">), light on request (theme switch in the name menu). The --bi-* tokens are
   the palette; ThemeTests checks every text token against every surface for WCAG AA (4.5:1) in both themes.
   Colour carries meaning only: the accent, Win / Loss and the rank tiers. */
/* Brand palette (BattleIndex brand assets, wwwroot/brand). The theme tokens below repeat these values as plain hex because ThemeTests reads them literally; the brand chrome (navbar) uses the variables. */
:root {
  --bi-orange: #ff6a1a;
  --bi-orange-light: #ff7a33;
  --bi-orange-hover: #ff8848;
  --bi-orange-dark: #c2410c;
  --bi-bg-deep: #08090c;
  --bi-surface-1: #161a21;
  --bi-surface-2: #1d222b;
  --bi-brand-border: #2a303b;
  --bi-brand-text: #e6e8ec;
  --bi-brand-muted: #9aa3b2;
  --bi-light-bg: #f4f5f7;
  --bi-light-text: #14171c;
}

[data-bs-theme=dark] {
  --bi-bg: #0e1014;
  --bi-surface: #161a21;
  --bi-raised: #1d222b;
  --bi-border: #2a303b;
  --bi-text: #e6e8ec;
  --bi-muted: #9aa3b2;
  --bi-accent: #ff6a1a;
  --bi-accent-text: #ff7a33;
  --bi-on-accent: #111317;
  --bi-accent-hover: #ff8848;
  --bi-win-text: #4ade80;
  --bi-loss-text: #f87171;
  --bi-renamed-text: #fbbf24;
  --bi-nav: #08090c;
}

[data-bs-theme=light] {
  --bi-bg: #f4f5f7;
  --bi-surface: #ffffff;
  --bi-raised: #eceef2;
  --bi-border: #d5d9e0;
  --bi-text: #14171c;
  --bi-muted: #545d6c;
  --bi-accent: #c2410c;
  --bi-accent-text: #b43c0b;
  --bi-on-accent: #ffffff;
  --bi-accent-hover: #a5370a;
  --bi-win-text: #166534;
  --bi-loss-text: #b91c1c;
  --bi-renamed-text: #92400e;
  --bi-nav: #08090c;
}

/* Bootstrap 5.3 reads these, so its components follow the palette. */
[data-bs-theme] {
  --bs-body-bg: var(--bi-bg);
  --bs-body-color: var(--bi-text);
  --bs-emphasis-color: var(--bi-text);
  --bs-secondary-color: var(--bi-muted);
  --bs-secondary-bg: var(--bi-raised);
  --bs-tertiary-bg: var(--bi-raised);
  --bs-border-color: var(--bi-border);
  --bs-link-color: var(--bi-accent-text);
  --bs-link-color-rgb: var(--bi-accent-rgb);
  --bs-link-hover-color: var(--bi-accent);
  --bs-primary: var(--bi-accent);
  --bs-primary-rgb: var(--bi-accent-rgb);
  --bs-focus-ring-color: color-mix(in srgb, var(--bi-accent) 45%, transparent);
  --bs-body-font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --bi-display-font: 'Barlow Condensed', 'Arial Narrow', sans-serif;
  --bi-radius: .5rem;
}
[data-bs-theme=dark] { --bi-accent-rgb: 255, 122, 51; }
[data-bs-theme=light] { --bi-accent-rgb: 180, 60, 11; }

body {
  background: var(--bi-bg);
}

h1, h2, h3, .h1, .h2, .h3, .brand, .display-font {
  font-family: var(--bi-display-font);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .03em;
}
h4, h5, .h4, .h5 { font-weight: 600; }

/* Numbers line up in tables, stats and scores. */
.table, .stat-value, .score-big, .display-6 { font-variant-numeric: tabular-nums; }
.display-6 { font-family: var(--bi-display-font); font-weight: 700; }

/* Top bar: near-black, the condensed brand, an accent line under the current page. */
.site-navbar { background: var(--bi-nav); border-bottom: 1px solid #1c2028; }

.site-navbar .brand-logo { display: block; height: auto; object-fit: contain; }
.site-navbar .brand-logo-compact { display: none; }
@media (max-width: 767.98px) { .site-navbar .brand-logo-full { display: none; } .site-navbar .brand-logo-compact { display: block; } }
.site-navbar .navbar-brand { padding: 0; margin-right: 1rem; }
/* Centred branding (sign-in, sign-up): the stacked logo on the dark theme, the light horizontal logo on the light one. */
/* The Raging Demon door on the sign-in page (armRagingDemon in battleindex.js): Akuma's kanji in the accent colour, no effects. */
.akuma-kanji { text-align: center; font-size: 4rem; line-height: 1; margin-bottom: 1rem; color: var(--bi-accent-text); animation: akuma-in .6s ease-out; }
@keyframes akuma-in { from { opacity: 0; transform: scale(1.25); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .akuma-kanji { animation: none; } }
.auth-logo img { max-width: 100%; height: auto; object-fit: contain; }
.auth-logo .brand-logo-light { display: none; }
[data-bs-theme=light] .auth-logo .brand-logo-stacked { display: none; }
[data-bs-theme=light] .auth-logo .brand-logo-light { display: inline-block; }
.site-navbar .nav-link { font-weight: 500; color: #c3c9d4; border-bottom: 2px solid transparent; }
.site-navbar .nav-link:hover { color: #ffffff; }
.site-navbar .nav-link.active { color: #ffffff; border-bottom-color: var(--bi-orange); }
/* Phones: filter forms put two short fields side by side instead of one long column. */
@media (max-width: 575.98px) {
  form.card > .row > .col-sm-6,
  form.card > .row > [class*="col-md-2"], form.card > .row > [class*="col-md-3"], form.card > .row > [class*="col-md-4"] { flex: 0 0 auto; width: 50%; }
}
/* Phones: tighter grid cells so more columns fit before the table scrolls sideways. */
@media (max-width: 575.98px) {
  .bi-grid > thead > tr > *, .bi-grid > tbody > tr > * { padding-left: .35rem; padding-right: .35rem; font-size: .86rem; }
}
@media (max-width: 767.98px) {
  .site-navbar .nav-link.active { border-bottom-color: transparent; border-left: 2px solid var(--bi-orange); padding-left: .5rem; }
}

/* Page header: condensed title with a short accent rule under it. */
.page-header { position: relative; padding-bottom: .55rem; }
.page-header::after {
  content: ""; position: absolute; left: 0; bottom: 0; width: 3rem; height: 3px; border-radius: 2px; background: var(--bi-accent);
}

/* Surfaces */
.card {
  --bs-card-bg: var(--bi-surface);
  --bs-card-border-color: var(--bi-border);
  --bs-card-cap-bg: var(--bi-raised);
  --bs-card-border-radius: var(--bi-radius);
}
.card h2.h6, .card .card-title.h6 { font-family: var(--bi-display-font); font-size: 1.05rem; text-transform: uppercase; letter-spacing: .04em; }
.modal { --bs-modal-bg: var(--bi-surface); --bs-modal-border-color: var(--bi-border); }
.dropdown-menu { --bs-dropdown-link-hover-bg: color-mix(in srgb, var(--bi-text) 9%, transparent); --bs-dropdown-link-hover-color: var(--bi-text); --bs-dropdown-bg: var(--bi-raised); --bs-dropdown-border-color: var(--bi-border); --bs-dropdown-link-active-bg: var(--bi-accent); --bs-dropdown-link-active-color: var(--bi-on-accent); }
.list-group { --bs-list-group-bg: var(--bi-surface); --bs-list-group-border-color: var(--bi-border); --bs-list-group-action-hover-bg: var(--bi-raised); }
.nav-tabs { --bs-nav-tabs-link-active-bg: var(--bi-bg); --bs-nav-tabs-link-active-color: var(--bi-text); --bs-nav-tabs-border-color: var(--bi-border); --bs-nav-tabs-link-active-border-color: var(--bi-border) var(--bi-border) var(--bi-bg); }
.nav-tabs .nav-link { color: var(--bi-muted); font-weight: 500; }
.nav-tabs .nav-link.active { box-shadow: inset 0 2px 0 var(--bi-accent); }

/* Tables: no fill of their own, subtle lines and hover, a raised sticky header. */
.table {
  --bs-table-bg: transparent;
  --bs-table-color: var(--bi-text);
  --bs-table-border-color: var(--bi-border);
  --bs-table-hover-bg: color-mix(in srgb, var(--bi-text) 8%, transparent);
  --bs-table-hover-color: var(--bi-text);
  /* Grids alternate their rows (owner, 2026-11-21: "just lil bit darker or lighter"): a touch of the text colour, so
     lighter in the dark theme and darker in the light one, and still under the hover. Close to --bi-raised, which
     ThemeTests checks every text colour against. */
  --bs-table-striped-bg: color-mix(in srgb, var(--bi-text) 4.5%, transparent);
  --bs-table-striped-color: var(--bi-text);
}
/* The match stats table is not a grid, so it alternates its rows by hand, like the grids (owner, 2026-11-21: "I don't see stripes in the
   grid for match stats"): inside each group the first row stays plain (the group's header row is child 1). The report has its own, stronger tint. */
.stat-table tbody tr:nth-child(2n+3) > * { --bs-table-bg: var(--bs-table-striped-bg); }
.table > thead th {
  background: var(--bi-raised); color: var(--bi-muted); font-size: .85rem; /* labels as written ("Score", "Actions"): no all caps */
  font-weight: 600;
}
/* The match page's header row (Whole match / Round N and the two names) is bigger than the rows below it (owner, 2026-11-21: "the font is smaller than the data"). */
.stat-table > thead th { font-size: 1.35rem; font-weight: 700; color: var(--bi-text); }
.stat-table > thead th:first-child { color: var(--bi-muted); }

/* Buttons: primary = the accent (dark text on orange in dark mode, white on dark orange in light mode). */
.btn-primary {
  --bs-btn-bg: var(--bi-accent); --bs-btn-border-color: var(--bi-accent); --bs-btn-color: var(--bi-on-accent);
  --bs-btn-hover-bg: var(--bi-accent-hover); --bs-btn-hover-border-color: var(--bs-btn-hover-bg); --bs-btn-hover-color: var(--bi-on-accent);
  --bs-btn-active-bg: color-mix(in srgb, var(--bi-accent) 80%, #000); --bs-btn-active-border-color: var(--bs-btn-active-bg); --bs-btn-active-color: var(--bi-on-accent);
  --bs-btn-disabled-bg: var(--bi-accent); --bs-btn-disabled-border-color: var(--bi-accent); --bs-btn-disabled-color: var(--bi-on-accent);
  font-weight: 600;
}
.btn-outline-primary {
  --bs-btn-color: var(--bi-accent-text); --bs-btn-border-color: var(--bi-accent);
  --bs-btn-hover-bg: var(--bi-accent); --bs-btn-hover-border-color: var(--bi-accent); --bs-btn-hover-color: var(--bi-on-accent);
  --bs-btn-active-bg: var(--bi-accent); --bs-btn-active-border-color: var(--bi-accent); --bs-btn-active-color: var(--bi-on-accent);
}
.btn-link { --bs-btn-color: var(--bi-accent-text); --bs-btn-hover-color: var(--bi-accent); }
.btn-outline-primary { --bs-btn-disabled-color: var(--bi-muted); --bs-btn-disabled-border-color: var(--bi-border); }
/* Bootstrap 5.3 buttons ignore the colour mode: the grey outline buttons get the palette. */
.btn-outline-secondary {
  --bs-btn-color: var(--bi-muted); --bs-btn-border-color: var(--bi-border);
  --bs-btn-hover-bg: var(--bi-raised); --bs-btn-hover-color: var(--bi-text); --bs-btn-hover-border-color: var(--bi-border);
  --bs-btn-active-bg: var(--bi-raised); --bs-btn-active-color: var(--bi-text); --bs-btn-active-border-color: var(--bi-border);
  --bs-btn-disabled-color: var(--bi-muted); --bs-btn-disabled-border-color: var(--bi-border);
}
/* Text utilities with fixed colours: the readable Win / Loss tones. */
.text-danger { color: var(--bi-loss-text) !important; }
.text-success { color: var(--bi-win-text) !important; }
/* A selected table row (e.g. the range in "Confirm as set"). */
.row-selected > * { --bs-table-bg-state: color-mix(in srgb, var(--bi-accent) 18%, transparent); }
/* "Confirm as set": the match list is picked by clicking / dragging. The ends of a finished range are tinted more, a
   start still waiting for its end gets an accent outline. */
.cs-pick [data-cs-row] { cursor: pointer; user-select: none; }
.cs-pick [data-cs-row]:focus-visible { outline: 2px solid var(--bi-accent); outline-offset: -2px; }
.cs-pick .row-end > * { --bs-table-bg-state: color-mix(in srgb, var(--bi-accent) 34%, transparent); font-weight: 600; }
.cs-pick .row-anchor > * { box-shadow: inset 0 2px 0 var(--bi-accent), inset 0 -2px 0 var(--bi-accent); }
/* Focused fields keep their surface and get the accent, not Bootstrap's blue. */
.form-control:focus, .form-select:focus {
  background-color: var(--bi-surface); border-color: var(--bi-accent); box-shadow: 0 0 0 .2rem var(--bs-focus-ring-color);
}
.form-check-input:focus { border-color: var(--bi-accent); box-shadow: 0 0 0 .2rem var(--bs-focus-ring-color); }
.pagination { --bs-pagination-focus-box-shadow: 0 0 0 .2rem var(--bs-focus-ring-color); }
.form-control, .form-select { background-color: var(--bi-surface); }
.form-check-input:checked { background-color: var(--bi-accent); border-color: var(--bi-accent); }
.pagination {
  --bs-pagination-bg: var(--bi-surface); --bs-pagination-border-color: var(--bi-border); --bs-pagination-color: var(--bi-text);
  --bs-pagination-hover-bg: var(--bi-raised); --bs-pagination-hover-color: var(--bi-text); --bs-pagination-disabled-bg: var(--bi-surface);
  --bs-pagination-active-bg: var(--bi-accent); --bs-pagination-active-border-color: var(--bi-accent); --bs-pagination-active-color: var(--bi-on-accent);
}

/* Win / Loss always say so in words; the colour only backs it up. */
.result-badge { border-radius: 50rem; font-weight: 600; }

/* Rank tiers, coloured by level (tierBadge): the same in both themes, each readable on its own fill. */
.tier-badge { font-family: var(--bi-display-font); font-size: .82rem; letter-spacing: .05em; text-transform: uppercase; border: 1px solid var(--bi-border); background: var(--bi-raised); color: var(--bi-text); } /* a tier without its own colour stays readable */
.tier-1 { background: #5a3a22; color: #f3d2b8; border-color: #8a5a34; }
.tier-2 { background: #3f4650; color: #e3e7ec; border-color: #6b7480; }
.tier-3 { background: #5c4a12; color: #fde68a; border-color: #a3831f; }
.tier-4 { background: #134e4a; color: #a7f3d0; border-color: #1f8a7f; }
.tier-5 { background: #1e3a6e; color: #bfdbfe; border-color: #3b6fc4; }
.tier-6 { background: #4c1d6e; color: #e9d5ff; border-color: #8b3fc4; }
.tier-7 { background: #6b1414; color: #fecaca; border-color: #b52a2a; }
.tier-8 { background: #ff6a1a; color: #111317; border-color: #ffb187; }
.tier-placement { background: transparent; color: var(--bi-muted); border-color: var(--bi-border); }

/* Keyboard focus is always visible. */
:focus-visible { outline: 2px solid var(--bi-accent); outline-offset: 2px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

/* A panel on the card surface (grids). */
.surface { background: var(--bi-surface); }

/* ------------------------------------------------------------------ layout and components */

html {
  font-size: 14px;
}

@media (min-width: 768px) {
  html {
    font-size: 15px;
  }
}

.flash-area {
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  z-index: 1080;
  width: min(28rem, calc(100vw - 2rem));
}

.table td,
.table th {
  vertical-align: middle;
}

.chars {
  font-size: 0.8rem;
  color: var(--bs-secondary-color);
}

.winner {
  font-weight: 700;
}

/* Who is who in a row (mineWrap in battleindex.js): an accent bar on the left of the name of the player in context. It stays one unit with the name, so a centred cell stays centred. */
.bi-focus {
  display: inline-block;
  border-left: 3px solid var(--bi-accent);
  padding-left: 0.45rem;
  text-align: left;
}

.score-big {
  font-size: 2.25rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.stat-value {
  font-size: 1.6rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.rounds-input {
  width: 3.75rem;
}

.match-card .form-select-sm,
.match-card .form-control-sm {
  min-width: 0;
}

.round-table select {
  min-width: 7rem;
}

/* Searchable picker */
.combo-menu {
  top: 100%;
  left: 0;
  width: 100%;
  max-height: 18rem;
  overflow-y: auto;
}

.combo-menu .dropdown-item {
  white-space: normal;
}

.combo-menu mark {
  padding: 0;
  background: color-mix(in srgb, var(--bi-accent) 35%, transparent);
  color: inherit;
}

.combo-detail {
  color: var(--bs-secondary-color);
}

.combo-menu .active .combo-detail {
  color: inherit;
}

/* Sortable grid headers */
.sort-btn {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  font-weight: 700;
  color: inherit;
  white-space: nowrap;
}

.sort-btn:hover,
.sort-btn:focus-visible {
  color: var(--bi-accent-text);
}

.sort-ind {
  margin-left: 0.25rem;
  color: var(--bi-accent-text);
}

.sort-ind.inactive {
  color: var(--bs-border-color);
}

[aria-busy="true"] {
  opacity: 0.6;
  transition: opacity 0.15s;
}

/* Match history (results, CFN opponents) */
.result-badge {
  cursor: help;
  font-size: 0.8rem;
}

/* A result that opens its match page (#180): a link, so it underlines on hover (clickable looks clickable). */
a.result-link { cursor: pointer; text-decoration: none; }
a.result-link:hover, a.result-link:focus-visible { text-decoration: underline; }
a.result-link:hover { filter: brightness(1.12); }
/* The match has replay stats (#180): a small chart next to its result. Not a link itself (the result is), so not the accent. */
.capture-mark { color: var(--bi-muted); }
/* Every result keeps the icon's room, filled or not, so the badges line up from row to row (owner, 2026-11-21). */
[data-capture-for] { display: inline-block; width: 1.1rem; margin-left: .35rem; text-align: left; vertical-align: -.15em; }

[data-copy-cfn] {
  cursor: copy;
}

/* Rounds tooltip: "Round 1  Player  SA (6)" columns */
.tooltip-inner {
  max-width: 22rem;
}

.tt-round {
  display: inline-block;
  min-width: 4.5rem;
}

.tt-who {
  display: inline-block;
  min-width: 7rem;
  font-weight: 700;
}

.card-title-sm {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--bs-secondary-color);
}

/* Match statistics: compact win/loss bar, character usage donut (plain CSS, no chart library) */
.wl-bar {
  height: 0.35rem;
  min-width: 4rem;
  margin-top: 0.15rem;
}
/* The Home "Your player" card's progress to the next tier: the accent, not Bootstrap's blue. */
.tier-progress .progress-bar { background-color: var(--bi-accent); }

.usage-donut {
  width: 7rem;
  height: 7rem;
  border-radius: 50%;
  -webkit-mask: radial-gradient(circle, transparent 45%, #000 46%);
  mask: radial-gradient(circle, transparent 45%, #000 46%);
  flex-shrink: 0;
}

.legend-dot {
  display: inline-block;
  width: 0.65rem;
  height: 0.65rem;
  border-radius: 50%;
  margin-right: 0.25rem;
  vertical-align: middle;
}

/* Compact summary beside related content (player profile tabs) */
.summary-panel dl > div + div {
  border-top: 1px solid var(--bs-border-color);
  padding-top: 0.2rem;
  margin-top: 0.2rem;
}

.summary-panel dd {
  font-weight: 600;
}

/* Country flags (flag-icons, #44): a thin outline so white flags stay visible. */
.country-flag {
    border-radius: 2px;
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--bi-text) 22%, transparent);
}
/* The chosen item's flag before a combo picker's input. */
.combo-prefix {
    min-width: 2.5rem;
    justify-content: center;
}

/* Staff area (#79): the sidebar next to staff pages; on phones it opens from the "Staff menu" button. */
.staff-nav .nav-link { padding-top: .2rem; padding-bottom: .2rem; }
.staff-nav .nav-link { color: var(--bi-muted); border-left: 2px solid transparent; padding-left: .6rem !important; }
.staff-nav .nav-link:hover { color: var(--bi-text); }
.staff-nav .nav-link.active { color: var(--bi-text); border-left-color: var(--bi-accent); background: var(--bi-raised); border-radius: 0 .3rem .3rem 0; }
.staff-group { letter-spacing: .04em; margin-bottom: .25rem; }
@media (min-width: 768px) {
  .staff-nav { position: sticky; top: 1rem; border-right: 1px solid var(--bs-border-color); padding-right: 1rem; }
}
/* Phones: the closed button says where you are and the open list is a framed card with finger-sized rows. */
@media (max-width: 767.98px) {
  .staff-toggle { display: flex; align-items: center; justify-content: space-between; text-align: left; padding-top: .55rem; padding-bottom: .55rem; }
  .staff-toggle-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .staff-toggle-here { color: var(--bi-text); font-weight: 600; }
  .staff-toggle-caret { margin-left: .5rem; transition: transform .15s; }
  .staff-toggle[aria-expanded="true"] .staff-toggle-caret { transform: rotate(180deg); }
  .staff-nav { margin-top: .5rem; padding: .6rem .85rem .85rem; border: 1px solid var(--bs-border-color); border-radius: .5rem; background: var(--bi-surface); }
  .staff-nav .nav-link { padding-top: .6rem; padding-bottom: .6rem; }
  .staff-nav .staff-back { padding: .3rem 0 .5rem; }
  .staff-nav .staff-group { margin-bottom: .1rem; }
}
@media (prefers-reduced-motion: reduce) { .staff-toggle-caret { transition: none; } }

/* Links (#79 visuals): part of the design, not plain underlined links. Prose (Help, notes) keeps the underline. */
a { text-decoration: none; }
a:hover { text-decoration: underline; }
.help-article a, .alert a, p > a { text-decoration: underline; text-underline-offset: .15em; }
/* Clickable looks clickable (owner rule): links and link-buttons are the accent colour, underlined on hover;
   names in grids and card lists are bold too. Plain text is never the accent. */
a:not(.btn):not(.nav-link):not(.dropdown-item):not(.list-group-item):not(.navbar-brand):not(.badge), .btn-link, [data-copy-cfn] { color: var(--bi-accent-text); }
.table a:not(.btn), .dash-list a { font-weight: 600; }
/* A badge that is a link (a match result opens its match page) keeps the badge's own colours: it is a pill button. */
a:not(.btn):hover:not(.badge), .btn-link:hover, [data-copy-cfn]:hover { color: var(--bi-accent); text-decoration: underline; text-underline-offset: .15em; }
/* Home / Needs attention card lists: one row per item. */
.dash-list li { border-bottom: 1px solid var(--bi-border); padding-top: .45rem !important; padding-bottom: .45rem !important; }
.dash-list li:last-child { border-bottom: 0; }
/* A card's "see all" link: small, uppercase, the accent. */
.card h2.h6 > a { font-family: var(--bs-body-font-family); font-size: .78rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--bi-accent-text); }


/* Grids (createGrid / serverGrid) centre their content, headers included (owner rule, 2026-11-17). */
.bi-grid > thead > tr > *, .bi-grid > tbody > tr > * { text-align: center !important; }
.bi-grid .d-flex { justify-content: center; }

/* #101: skip link (visible only when focused) and the page title that receives focus after a page change. */
.skip-link { position: absolute; left: 1rem; top: .5rem; z-index: 1100; padding: .5rem .75rem; border-radius: .3rem;
  background: var(--bi-accent); color: var(--bi-on-accent) !important; font-weight: 600; }
h1[tabindex="-1"]:focus { outline: none; }

/* The Mode filter (a dropdown of checkboxes): the menu is at least as wide as its button; a long summary is cut. */
.mode-filter > .form-select { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mode-filter-menu { min-width: 100%; }

/* A set's round lines: rows of the matches table under their match (who won the round and how), tight and
   without lines between them; the last one closes the match. */
.table > tbody > tr.set-round > td { padding-block: .1rem; border-bottom-width: 0; }
.table > tbody > tr:has(+ tr.set-round) > td { border-bottom-width: 0; }
.table > tbody > tr.set-round:not(:has(+ tr.set-round)) > td { border-bottom-width: var(--bs-border-width); padding-bottom: .4rem; }

/* Footer (#85, #123): privacy, terms and the contact link, visible signed out too. Links keep the accent colour (--bs-link-color) and underline on hover. */
.site-footer { border-top: 1px solid var(--bi-border); margin-top: 1rem; padding: 1.25rem 0 2rem; color: var(--bi-muted); font-size: .9rem; }
.site-footer-inner { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: .5rem 1.5rem; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: .25rem 1.25rem; }
/* The website host's own error pages (404, 500 ...), outside the single-page app. */
.status-page { max-width: 36rem; padding: 3rem 0; }
.status-page a { text-decoration: underline; text-underline-offset: .15em; }

/* Inbox bell (#63): the unread count next to the bell in the top menu. */
.inbox-bell .badge { font-size: .7em; vertical-align: top; }

/* Win rate over time (milestone 16): the line chart is inline SVG; every colour is a --bi-* token, so it follows the
   theme and prints in the light palette. A gap in the line = a period without decided matches; a hollow dot = small sample. */
.wr-svg { display: block; width: 100%; height: auto; }
.wr-grid { stroke: var(--bi-border); stroke-width: 1; }
.wr-mid { stroke: var(--bi-muted); stroke-width: 1; stroke-dasharray: 6 5; }
.wr-axis { stroke: var(--bi-muted); stroke-width: 1; }
.wr-tick { fill: var(--bi-muted); font-size: 12px; }
.wr-line { fill: none; stroke: var(--bi-accent); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.wr-dot { fill: var(--bi-accent); stroke: var(--bi-surface); stroke-width: 2; }
.wr-dot.is-small { fill: var(--bi-surface); stroke: var(--bi-accent); }
.wr-hit { fill: transparent; }
.wr-empty { fill: color-mix(in srgb, var(--bi-muted) 14%, transparent); }
.wr-point:hover .wr-hit { fill: color-mix(in srgb, var(--bi-accent) 10%, transparent); }
.wr-tip {
  position: absolute; z-index: 5; transform: translateX(-50%); pointer-events: none; white-space: nowrap;
  padding: .25rem .5rem; border-radius: var(--bi-radius); font-size: .8rem;
  background: var(--bi-raised); color: var(--bi-text); border: 1px solid var(--bi-border);
}
.wr-key { display: inline-block; vertical-align: middle; width: 1.4rem; height: 0; border-top: 2.5px solid var(--bi-accent); margin-right: .25rem; }
.wr-key-mid { border-top: 1px dashed var(--bi-muted); }
.wr-key-empty { width: .9rem; height: .9rem; border: 0; background: color-mix(in srgb, var(--bi-muted) 25%, transparent); }
.wr-key-small { width: .65rem; height: .65rem; border: 2px solid var(--bi-accent); border-radius: 50%; background: var(--bi-surface); }
#print-report .wr-svg { max-height: 20cm; }

/* Save as PDF (#181): the print view. #print-report is filled by printReport() and never shows on screen; printing
   hides the whole app and prints only it, always in the light palette (it carries data-bs-theme="light"). */
#print-report { display: none; }
/* The report is a layout table so the browser repeats its thead (brand + title) and tfoot (bottom margin) on every
   printed page; that is what lets @page have no margin, so the browser prints no date / title / URL of its own. */
.report-frame { width: 100%; border-collapse: collapse; }
.report-frame > thead > tr > td { padding: 12mm 12mm 3mm; }
.report-frame > tbody > tr > td { padding: 0 12mm; }
.report-spacer { height: 12mm; }
.report-run { display: flex; align-items: center; gap: .5rem; border-bottom: 2px solid var(--bi-accent); padding-bottom: .4rem; font-size: 1.15rem; }
/* The "A vs B" title is repeated on every sheet: big (owner, 2026-11-21: "bigger font"), but a long one drops a size so it stays on one line. */
.report-run-title { margin-left: auto; font-weight: 700; text-align: right; font-size: 1.5rem; line-height: 1.15; }
.report-run-title.is-long { font-size: 1.15rem; }
.report-url { margin-top: .25rem; font-size: .7rem; color: var(--bi-muted); word-break: break-all; } /* the page's address, on every printed page */
/* Two players, two colours, like "Battle" + "Index" in the brand: left = the text colour, right = the accent; by position, never by who won. */
#print-report .vs-one { color: var(--bi-text); } /* #print-report: a table heading's own colour would win otherwise */
#print-report .vs-two { color: var(--bi-accent-text); }
#print-report .vs-sep { color: var(--bi-muted); font-size: .8em; font-weight: 400; text-transform: lowercase; }
.report-mark { display: inline-block; width: .4rem; height: 1.2rem; background: var(--bi-accent); transform: skewX(-15deg); }
.report-intro { margin: .4rem 0 .7rem; }
.report-sub { color: var(--bi-muted); margin-bottom: .15rem; font-size: 1.1rem; }
/* The result line of a match report: "Alpha (Ryu) 2-1 Bravo (Ken)". */
.report-score { font-size: 1.4rem; font-weight: 600; line-height: 1.25; margin-bottom: .5rem; }
.report-section { margin-bottom: 1.25rem; }
.report-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); gap: .5rem; margin-bottom: 1rem; }
.report-card { border: 1px solid var(--bi-border); border-radius: var(--bi-radius); padding: .4rem .6rem; }
.report-table th, .report-table td { text-align: center; vertical-align: middle; } /* like the grids on screen */
/* Alternate rows, like the grids on screen (a tint of the text colour; a little stronger than on screen so it shows on paper). */
.report-table tbody tr:nth-child(even) > * { --bs-table-bg: color-mix(in srgb, var(--bi-text) 6%, transparent); }
/* A little more brand: the slanted mark before section titles, an accent line on cards and table headings. */
#print-report .report-section > h2::before { content: ""; display: inline-block; width: .3rem; height: .95em; margin-right: .5rem; background: var(--bi-accent); transform: skewX(-15deg); vertical-align: -.1em; }
#print-report .report-card { border-top: 3px solid var(--bi-accent); }
#print-report .report-table thead th { border-bottom: 2px solid var(--bi-accent); }
/* The stat table (match page): rows alternate inside each group (the group's header row is child 1, so its first row stays
   plain), and each group is a band with a rail that its rows share, so a row visibly belongs to its group. One accent, no
   colour per group: colour keeps its meaning. */
#print-report .stat-table tbody tr:nth-child(2n+3) > * { --bs-table-bg: color-mix(in srgb, var(--bi-text) 6%, transparent); }
/* Compact rows, so the whole match fits one sheet with room to spare (Letter is 18 mm shorter than A4 and real headers wrap). */
#print-report .stat-table { font-size: 13.5pt; } /* the match stats are the point of that report: as big as the page allows (owner, 2026-11-21); 13pt while there were two grey rows, back to 14pt with the one */
/* No header row in the report (owner, 2026-11-21: "take away that row with gray background saying round 1, round 2"): each round page already has its "Round N · X won" title, and every group band carries the two names. */
#print-report .stat-table thead { display: none; }
#print-report .stat-table > :not(caption) > * > * { padding-top: .06rem; padding-bottom: .06rem; }
/* Group bands: the title is bigger than the rows (owner, 2026-11-21: "the body of the table font is bigger than the subtitle"), and the band
   repeats the two players' names over their columns, in their colours, so each group reads on its own. */
#print-report .stat-table .stat-group { background: color-mix(in srgb, var(--bi-accent) 12%, white); }
#print-report .stat-table th.stat-group {
  color: var(--bi-accent-text); border-left: 4px solid var(--bi-accent); font-family: var(--bi-display-font); font-size: 1.45rem; line-height: 1.15;
  font-weight: 700; letter-spacing: .1em; text-transform: uppercase; text-align: left; padding: .12rem .6rem;
}
#print-report .stat-table td.stat-group-name { font-size: 1.05rem; line-height: 1.15; font-weight: 700; text-align: center; padding: .12rem .4rem; }
#print-report .stat-table tbody + tbody .stat-group { border-top: .4rem solid var(--bi-surface); }
#print-report .stat-table th[scope=row] { border-left: 4px solid color-mix(in srgb, var(--bi-accent) 40%, white); }
/* The numbers carry the table: bold, with a hairline between the columns, so the space around them has structure instead of feeling empty. */
#print-report .stat-table tbody td { font-weight: 700; border-left: 1px solid var(--bi-border); }

@media print {
  @page { size: A4; margin: 0; }
  body > *:not(#print-report) { display: none !important; }
  html, body { background: #fff !important; }
  #print-report {
    display: block;
    background: #fff;
    color: var(--bi-text);
    font-size: 10pt;
  }
  /* Bars, the usage donut, badges and flags are backgrounds: browsers drop them unless asked. */
  #print-report, #print-report * {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  #print-report a { color: inherit; text-decoration: none; }
  #print-report thead { display: table-header-group; }
  #print-report tfoot { display: table-footer-group; }
  /* Rows of the data tables stay whole; the layout table's one big row (the whole report) must be allowed to split. */
  #print-report .table tr, #print-report .report-card, #print-report .usage-donut { break-inside: avoid; }
  #print-report .report-page { break-before: page; } /* e.g. one round of a match per page */
  #print-report .report-page > h2 { font-size: 1.75rem; } /* "Round 1 · X won (SA)": big (owner, 2026-11-21) */
  #print-report h1, #print-report h2 { break-after: avoid; }
}

/* A player renamed in the last 14 days (owner, 2026-11-23): a small amber dot after their name wherever it links to the player,
   with the former names in the link's tooltip. Added by markRenamedPlayers() in battleindex.js; no text changes, so copying a name is unaffected. */
/* A row's action buttons in fixed-width slots, so a button is in the same place in every row (#241). */
.bi-action-slot { display: inline-block; text-align: end; vertical-align: middle; }
.bi-slot-set { min-width: 3rem; }
.bi-slot-group { min-width: 6.6rem; }
.bi-slot-h2h { min-width: 3.3rem; }

.bi-renamed-dot {
  margin-left: .3em;
  font-size: .55em;
  vertical-align: .4em;
  color: var(--bi-renamed-text);
}

a.bi-renamed::after {
  content: "\25CF";
  display: inline-block;
  margin-left: .3em;
  font-size: .55em;
  vertical-align: .4em;
  color: var(--bi-renamed-text);
  text-decoration: none;
}

/* Sizes that used to be inline style attributes: the Content-Security-Policy allows no inline styles (style-src 'self'). */
.w-currency { max-width: 5.5rem; }
.w-select-sm { max-width: 8.5rem; }
.min-w-14 { min-width: 14rem; }
.min-w-16 { min-width: 16rem; }
.w-position { width: 1.5rem; }
.pre-wrap { white-space: pre-wrap; }
.qr-code { background: #fff; padding: .5rem; } /* a QR code is read on white, in the dark theme too */
