:root {
  color-scheme: dark;
  --bg: #0d1117;
  --bg-soft: #11161d;
  --panel: #161b22;
  --panel-raised: #1b2230;
  --border: #30363d;
  --border-soft: #232a33;
  --text: #e6edf3;
  --muted: #9198a1;
  --accent: #58a6ff;
  --accent-soft: rgba(88, 166, 255, 0.14);
  --green: #3fb950;
  --green-soft: rgba(63, 185, 80, 0.16);
  --red: #f85149;
  --red-soft: rgba(248, 81, 73, 0.14);
  --amber: #d29922;
  --amber-soft: rgba(210, 153, 34, 0.16);

  /* semantic aliases: use these instead of raw values */
  --on-accent: #0d1117;
  --accent-hover: #79b8ff;
  --tag-text: #b8c7da;
  --kind-cotd-text: #8cc8ff;
  --kind-cotn-text: #d2a8ff;
  --kind-totd-text: #7ee2c4;
  --kind-totd-soft: rgba(45, 212, 191, 0.12);
  --kind-totd-border: rgba(45, 212, 191, 0.38);
  --kind-campaign-text: #a9b4c2;
  --kind-campaign-soft: rgba(148, 163, 184, 0.12);
  --kind-campaign-border: rgba(148, 163, 184, 0.32);
  --accent-border: rgba(88, 166, 255, 0.35);
  --amber-text: #ffd28a;
  --amber-border: rgba(210, 153, 34, 0.45);

  /* type scale (target; older rules are migrated as touched) */
  --text-2xs: 0.68rem;
  --text-xs: 0.72rem;
  --text-sm: 0.78rem;
  --text-md: 0.82rem;
  --text-base: 0.86rem;
  --text-lg: 0.95rem;
  --text-xl: 1.1rem;

  /* spacing scale (target; older rules are migrated as touched) */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;

  --radius: 12px;
  --radius-sm: 7px;
  --radius-pill: 999px;

  --shadow-pop: 0 18px 40px rgba(0, 0, 0, 0.55);
  --shadow-tip: 0 10px 28px rgba(0, 0, 0, 0.5);

  /* Measured by syncTabsHeight() so sticky table headers dock below the bars. */
  --nav-h: 0px;
  --tabs-h: 0px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

.col-hidden {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

html {
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(1100px 520px at 18% -12%, rgba(88, 166, 255, 0.11), transparent 60%),
    radial-gradient(900px 480px at 95% 0%, rgba(63, 185, 80, 0.07), transparent 55%),
    var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

code {
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 0.92em;
  background: var(--bg-soft);
  border: 1px solid var(--border-soft);
  border-radius: 5px;
  padding: 0.08em 0.34em;
}

.page {
  width: min(1500px, 100%);
  margin: 0 auto;
  padding: 28px 24px 40px;
}

.site-header {
  padding-bottom: 22px;
  border-bottom: 1px solid var(--border-soft);
}

.site-nav {
  position: sticky;
  top: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-height: 48px;
  padding: var(--space-2) max(24px, calc((100% - 1500px) / 2 + 24px));
  background: rgba(13, 17, 23, 0.94);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.site-nav-brand {
  display: flex;
  flex: 0 1 auto;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
}

.brand-icon {
  flex: none;
  width: 28px;
  height: 28px;
}

.site-nav-wordmark {
  overflow: hidden;
  font-size: var(--text-sm);
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.site-nav-links {
  display: flex;
  flex: 1 1 auto;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-1);
  min-width: 0;
  margin: 0 0 0 auto;
  padding: 0;
  list-style: none;
}

.site-nav-link {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  color: var(--muted);
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  font-size: var(--text-base);
  font-weight: 600;
  white-space: nowrap;
}

.site-nav-link:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
  text-decoration: none;
}

.site-nav-link[aria-current="page"] {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: var(--accent-border);
}

.site-nav-link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.header-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px 28px;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 6px;
  font-size: clamp(1.7rem, 3vw, 2.5rem);
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.subline {
  margin-bottom: 3px;
  color: var(--muted);
  font-size: var(--text-base);
}

.header-meta {
  max-width: 620px;
  color: var(--muted);
  font-size: var(--text-base);
  text-align: right;
}

.header-meta p {
  margin-bottom: 4px;
}

.counts {
  color: var(--text);
  font-size: var(--text-lg);
  font-weight: 600;
}

.credit {
  color: var(--muted);
}

.player-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  margin-bottom: 10px;
}

.data-source {
  color: var(--green);
  font-size: var(--text-sm);
}

.data-source.is-error {
  color: var(--red);
}

.data-source.is-muted {
  color: var(--muted);
}

.data-source.is-loading {
  color: var(--accent);
  animation: tagstats-pulse 1.6s ease-in-out infinite;
}

.kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin: 22px 0 18px;
}

.kpi {
  background: linear-gradient(180deg, var(--panel-raised), var(--panel));
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 14px 16px;
}

.kpi-label {
  margin-bottom: 6px;
  overflow: hidden;
  color: var(--muted);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.kpi-value {
  margin: 0;
  font-size: clamp(1.35rem, 2.2vw, 1.8rem);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

.kpi-sub {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: var(--text-sm);
  font-variant-numeric: tabular-nums;
}

.controls {
  display: grid;
  grid-template-columns: minmax(190px, 1.1fr) auto minmax(160px, 1fr) 84px minmax(170px, 1fr);
  align-items: start;
  gap: 14px 22px;
  padding: 16px 18px;
  background: var(--panel);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
}

/*
 * TOTD, Campaign and Overall hide the Cup type control, so the four remaining
 * controls keep COTD's proportions: Timeframe sizes to its content (`auto`,
 * like COTD's Timeframe track), Min runs keeps its 84px column, and Search
 * keeps one of the three flexible shares COTD splits between Cup type, Search
 * and Extras. The freed Cup-type share joins the trailing Extras/Columns track
 * (2.1fr = COTD's 1.1fr + 1fr), so Search keeps its COTD width and the buttons
 * stay flush right.
 */
.controls[data-has-kind="false"] {
  grid-template-columns: auto minmax(160px, 1fr) 84px minmax(170px, 2.1fr);
}

.control {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.control-label {
  color: var(--muted);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.07em;
  line-height: 1;
  text-transform: uppercase;
}

.control-row {
  display: flex;
  align-items: baseline;
  min-width: 0;
  min-height: 36px;
}

.switch {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  color: var(--text);
  font-size: var(--text-base);
  font-weight: 400;
  letter-spacing: 0;
  line-height: 1.3;
  text-transform: none;
  cursor: pointer;
}

.control-row .switch {
  min-height: 36px;
}

.switch input {
  flex: none;
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--accent);
}

.columns-control {
  align-items: flex-start;
  margin-left: auto;
}

.columns-control .control-row {
  gap: 8px;
}

.columns-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 12px;
}

.columns-count {
  min-width: 1.5em;
  padding: 0 5px;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
  border-radius: var(--radius-pill);
  font-size: var(--text-2xs);
  font-variant-numeric: tabular-nums;
  line-height: 1.6;
  text-align: center;
}

.columns-popover {
  position: fixed;
  z-index: 200;
  width: 320px;
  max-width: calc(100vw - 16px);
  max-height: calc(100vh - 16px);
  padding: 14px;
  overflow-y: auto;
  color: var(--text);
  background: var(--panel-raised);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow-pop);
  font-size: var(--text-md);
}

.columns-note {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: var(--text-sm);
  line-height: 1.4;
}

.columns-group {
  margin: 0 0 10px;
  padding: 0;
  border: 0;
}

.columns-group legend {
  margin-bottom: 6px;
  padding: 0;
  color: var(--muted);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.columns-options {
  columns: 2;
  column-gap: 8px;
}

.columns-options .chip {
  display: inline-block;
  width: 100%;
  margin: 0 0 5px;
  font-size: var(--text-xs);
  text-align: center;
  break-inside: avoid;
}

.extras-popover {
  position: fixed;
  z-index: 200;
  width: 250px;
  max-width: calc(100vw - 16px);
  max-height: calc(100vh - 16px);
  padding: 14px;
  overflow-y: auto;
  color: var(--text);
  background: var(--panel-raised);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow-pop);
  font-size: var(--text-md);
}

.extras-options {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.extras-options .chip {
  width: 100%;
  font-size: var(--text-sm);
  text-align: center;
}

.kpi-action {
  cursor: pointer;
}

.kpi-action:hover {
  border-color: var(--accent);
}

.kpi-action:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.columns-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 2px;
  padding-top: 10px;
  border-top: 1px solid var(--border-soft);
}

input[type="search"],
input[type="number"] {
  width: 150px;
  padding: 7px 10px;
  color: var(--text);
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: var(--text-base);
}

input[type="search"] {
  width: 210px;
}

input[type="number"] {
  width: 84px;
}

.control input[type="search"],
.control input[type="number"] {
  height: 36px;
}

.control input[type="search"] {
  width: 100%;
  min-width: 0;
}

.control input[type="number"] {
  width: 84px;
}

input:focus-visible,
button:focus-visible,
a:focus-visible,
.has-tip:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  min-height: 36px;
  gap: 6px;
}

.chip {
  padding: 5px 11px;
  color: var(--muted);
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  font: inherit;
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
}

.chip:hover {
  border-color: var(--accent);
  color: var(--text);
}

.chip.active {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: rgba(88, 166, 255, 0.55);
}

.chip.is-locked {
  cursor: default;
}

.panel {
  margin-top: 20px;
  background: var(--panel);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  /* clip (not hidden) so sticky table headers can use the viewport scrollport */
  overflow: clip;
}

.panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border-soft);
}

.panel-head h2 {
  margin-bottom: 2px;
  font-size: var(--text-xl);
  letter-spacing: -0.01em;
}

.panel-sub {
  margin: 0;
  color: var(--muted);
  font-size: var(--text-sm);
}

/*
 * TOTD/Campaign without records: one explanation panel replaces the shared
 * tab strip, filters and table panels. app.js toggles the class at render
 * time, so COTD gets the same markup back unchanged.
 */
#app.is-records-placeholder .tabs-bar,
#app.is-records-placeholder #section-filters,
#app.is-records-placeholder .tabpanel {
  display: none;
}

.records-placeholder-body {
  display: grid;
  gap: 10px;
  padding: 16px 18px 18px;
}

.records-placeholder-body p {
  margin: 0;
  max-width: 68ch;
  overflow-wrap: anywhere;
}

.records-placeholder-link {
  font-size: var(--text-sm);
}

.panel-action {
  flex: none;
  padding: 5px 10px;
  color: var(--muted);
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: var(--text-sm);
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}

.panel-action:hover {
  color: var(--text);
  border-color: var(--accent);
}

.tabs-bar {
  position: sticky;
  top: var(--nav-h, 0px);
  z-index: 50;
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 8px;
  margin-top: 18px;
  padding: 8px;
  background: rgba(13, 17, 23, 0.92);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.tabs {
  display: flex;
  flex: 1 1 auto;
  flex-wrap: nowrap;
  gap: 4px;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: thin;
}

.tabs-bar .collapse-rows {
  flex: none;
}

.tab {
  display: inline-flex;
  flex: none;
  align-items: baseline;
  gap: 8px;
  padding: 7px 13px;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  font: inherit;
  font-size: var(--text-base);
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}

.tab:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
}

.tab[aria-selected="true"] {
  color: var(--text);
  background: var(--panel-raised);
  border-color: var(--border);
  box-shadow: inset 0 0 0 1px rgba(88, 166, 255, 0.15);
}

.tab-count {
  flex: none;
  min-width: 1.7em;
  padding: 0 6px;
  color: var(--muted);
  background: var(--bg-soft);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-pill);
  font-size: var(--text-xs);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.7;
  text-align: center;
}

.tab[aria-selected="true"] .tab-count {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: var(--accent-border);
}

[role="tabpanel"][hidden] {
  display: none !important;
}

[role="tabpanel"] {
  margin-top: 12px;
}

[role="tabpanel"]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.panel-actions {
  display: flex;
  flex: none;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.runs-page-size {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 30px;
  color: var(--muted);
  font-size: var(--text-sm);
}

.runs-page-size label {
  color: var(--muted);
  font-size: var(--text-sm);
  font-weight: 600;
  white-space: nowrap;
}

select.panel-action {
  height: 36px;
  padding: 0 8px;
  color: var(--muted);
  cursor: pointer;
}

select.panel-action:hover {
  color: var(--text);
  border-color: var(--accent);
}

.section-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  color: var(--muted);
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: var(--text-sm);
  line-height: 1;
  cursor: pointer;
}

.section-toggle:hover {
  color: var(--text);
  border-color: var(--accent);
}

.section-chevron {
  display: inline-block;
  flex: none;
  transition: transform 0.12s ease;
}

.section-toggle[aria-expanded="true"] .section-chevron {
  transform: rotate(90deg);
}

.section.is-collapsed .panel-head {
  border-bottom: 0;
}

.section.is-collapsed .section-body {
  display: none;
}

.section-body.kpis {
  margin: 0;
  padding: 16px 18px 18px;
}

.section-body.controls {
  border: 0;
  border-radius: 0;
}

.override-notes {
  display: grid;
  gap: 4px;
  padding: 12px 18px 0;
}

.override-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px 20px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-soft);
}

.override-search {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.override-search label {
  color: var(--muted);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.override-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.override-admin {
  display: flex;
  flex: 1 1 300px;
  flex-wrap: wrap;
  align-items: center;
  align-self: flex-start;
  gap: 6px 8px;
}

.override-admin > label {
  color: var(--muted);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.override-admin-row {
  display: flex;
  flex: 1 1 180px;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

input[type="password"].override-admin-input {
  flex: 1 1 140px;
  width: 170px;
  min-width: 0;
  padding: 6px 9px;
  color: var(--text);
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: var(--text-base);
}

.override-admin-hint {
  flex-basis: 100%;
  margin: 0;
  font-size: var(--text-xs);
}

.override-hint {
  font-size: var(--text-xs);
}

#body-manual.is-dropping {
  outline: 2px dashed var(--accent);
  outline-offset: -8px;
}

.override-warning {
  margin: 0;
  padding: 10px 18px;
  color: var(--amber-text);
  background: var(--amber-soft);
  border-bottom: 1px solid rgba(210, 153, 34, 0.4);
  font-size: var(--text-md);
}

.override-status {
  margin: 0;
  padding: 10px 18px 0;
  font-size: var(--text-sm);
}

.override-status:empty {
  display: none;
}

.override-empty {
  margin: 0;
  padding: 18px;
  font-size: var(--text-md);
}

.override-row {
  padding: 14px 18px;
  border-top: 1px solid var(--border-soft);
}

.override-list > .override-row:first-child {
  border-top: 0;
}

.override-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 8px;
}

.override-name {
  font-weight: 600;
}

.override-source {
  margin: 4px 0 8px;
  color: var(--muted);
  font-size: var(--text-sm);
}

.override-effective {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px;
  margin-bottom: 8px;
  font-size: var(--text-sm);
}

.override-effective-label {
  margin-right: 4px;
  color: var(--muted);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.tag-editable {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding-right: 3px;
}

.tag-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 12px;
  height: 12px;
  margin-left: 4px;
  padding: 0;
  color: var(--muted);
  background: none;
  border: 0;
  border-radius: 50%;
  font: inherit;
  font-size: var(--text-base);
  line-height: 1;
  cursor: pointer;
}

.tag-remove:hover {
  color: var(--red);
  background: var(--red-soft);
}

.tag-remove svg {
  display: block;
  flex: none;
}

.override-add-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
}

.override-add-row .panel-action {
  padding: 6px 9px;
  font-size: var(--text-base);
}

input[type="text"].override-add-input {
  width: 170px;
  padding: 6px 9px;
  color: var(--text);
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: var(--text-base);
}

.override-reset {
  margin-left: auto;
}

.override-move-note {
  margin: 8px 0 0;
  color: var(--amber);
  font-size: var(--text-xs);
}

.detail-note {
  margin: 0 0 10px;
}

.table-wrap {
  max-width: 100%;
}

/* The metric tables need a horizontal scrollbar only when they don't fit;
   keeping overflow visible above that width lets the header stick to the page.
   The Overall table is responsive: it fits the viewport at every supported
   width, so its wrapper must not become a scroll container (that would stop
   the header from pinning below the two bars). */
@media (max-width: 1139px) {
  .table-wrap {
    overflow-x: auto;
  }

  #body-overall.table-wrap,
  #body-overall-combos.table-wrap,
  #body-overall-pairs.table-wrap {
    overflow-x: clip;
  }
}

/*
 * By tag, Tag combos and Tag pairs share one fixed column grid, so switching
 * tabs never moves a column. The widths are declared once here and apply to
 * every .metric-table, including rows added by app.js.
 */
.metric-table {
  table-layout: fixed;
  width: 100%;
  min-width: 1080px;
}

.metric-table > thead > tr > th {
  vertical-align: bottom;
}

.metric-table > thead > tr > th:nth-child(1) {
  width: 22%;
}

.metric-table > thead > tr > th:nth-child(2),
.metric-table > thead > tr > th:nth-child(3),
.metric-table > thead > tr > th:nth-child(4),
.metric-table > thead > tr > th:nth-child(5),
.metric-table > thead > tr > th:nth-child(6) {
  width: 5%;
}

.metric-table > thead > tr > th:nth-child(7),
.metric-table > thead > tr > th:nth-child(8) {
  width: 7%;
}

.metric-table > thead > tr > th:nth-child(9),
.metric-table > thead > tr > th:nth-child(10),
.metric-table > thead > tr > th:nth-child(11),
.metric-table > thead > tr > th:nth-child(12) {
  width: 8%;
}

.metric-table > thead > tr > th:nth-child(13) {
  width: 7%;
}

.metric-table > thead > tr > th,
.metric-table > thead > tr > th button.sort {
  white-space: normal;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

/*
 * Narrow numeric columns cannot afford the global 12 px inset at the 1080 px
 * minimum width, so the metric tables use one shared 8 px inset for header
 * and body. This keeps header labels whole and keeps header/body right edges
 * aligned.
 *
 * Only the outer table's rows are targeted: an expanded row contains its own
 * .detail-table, which must keep the normal table styles.
 */
.metric-table > thead > tr > th button.sort {
  padding-left: 8px;
  padding-right: 8px;
}

.metric-table > tbody > tr:not(.detail-row):not(.empty-row) > td {
  padding-left: 8px;
  padding-right: 8px;
}

.metric-table > tbody > tr.empty-row > td {
  padding: 22px 18px;
}

.metric-table > tbody > tr.detail-row > td.detail-cell {
  padding: 0;
}

.metric-table > tbody > tr > td.label-cell,
.overall-table > tbody > tr > td.label-cell {
  max-width: none;
  overflow: visible;
  white-space: normal;
  text-overflow: clip;
  /*
   * No strut: the inline-flex toggle becomes the whole line box, so the cell's
   * vertical-align:middle centres it exactly. With the inherited 20.64px strut
   * the button sat ~1px low (more space above the text than below).
   */
  line-height: 0;
}

.metric-table > tbody > tr > td.label-cell .expand-toggle,
.overall-table > tbody > tr > td.label-cell .expand-toggle {
  align-items: center;
}

/*
 * The flex line box centres on the font's ascent/descent, but the visible
 * cap height sits 1 px lower, so nudge the icon to match the text ink.
 * position (not transform) keeps the expanded rotate() working.
 */
.metric-table > tbody > tr > td.label-cell .expand-chevron,
.overall-table > tbody > tr > td.label-cell .expand-chevron {
  position: relative;
  top: 1px;
}

.metric-table > tbody > tr > td.label-cell .expand-label,
.overall-table > tbody > tr > td.label-cell .expand-label {
  overflow: visible;
  white-space: normal;
  text-overflow: clip;
  overflow-wrap: anywhere;
  /*
   * An integer line box keeps the 10 px chevron on whole-pixel gaps (5/5 for
   * one line, 15/15 for two). The inherited 1.5 line-height computed to
   * 20.64 px, which made the gap alternate by a pixel between rows.
   */
  line-height: 20px;
}

/*
 * Where supported, trim the line box down to cap height + baseline so the
 * text box IS the visible text. Flex centring then lands on the optical
 * centre without the 1 px cheat above. Chrome 133+, Firefox 154+, Safari 18.2+.
 */
@supports (text-box-trim: trim-both) {
  .metric-table > tbody > tr > td.label-cell .expand-label,
  .overall-table > tbody > tr > td.label-cell .expand-label {
    text-box-trim: trim-both;
    text-box-edge: cap alphabetic;
  }

  .metric-table > tbody > tr > td.label-cell .expand-chevron,
  .overall-table > tbody > tr > td.label-cell .expand-chevron {
    /*
     * Match the trimmed cap box exactly: same box => same centre. The 10 px
     * fallback box was 0.36 px taller, which rounded differently per row.
     */
    top: 0;
    width: 1cap;
    height: 1cap;
  }
}

/* Zebra columns, applied by applyColumnStripes() after hidden columns. */
.metric-table > thead > tr > th.is-striped,
.overall-table > thead > tr > th.is-striped,
#body-runs thead > tr > th.is-striped {
  background-image: linear-gradient(
    rgba(255, 255, 255, 0.035),
    rgba(255, 255, 255, 0.035)
  );
}

.metric-table > tbody > tr:not(.detail-row) > td.is-striped,
.overall-table > tbody > tr:not(.detail-row) > td.is-striped,
#body-runs tbody > tr > td.is-striped {
  background-image: linear-gradient(
    rgba(255, 255, 255, 0.018),
    rgba(255, 255, 255, 0.018)
  );
}

/* Row stripes are a background colour, so they compose with the column
   background-image; the hover rule needs the same specificity to win. */
.metric-table > tbody > tr.is-row-striped > td,
.overall-table > tbody > tr.is-row-striped > td,
#body-runs tbody > tr.is-row-striped > td {
  background-color: rgba(255, 255, 255, 0.014);
}

.metric-table > tbody > tr.is-row-striped:hover > td,
.overall-table > tbody > tr.is-row-striped:hover > td,
#body-runs tbody > tr.is-row-striped:hover > td {
  background-color: rgba(255, 255, 255, 0.045);
}

.runs-wrap {
  max-height: 74vh;
  overflow-y: auto;
}

/* Fixed widths keep the columns steady while paginating. */
#body-runs table {
  table-layout: fixed;
  min-width: 980px;
}

#body-runs th[data-col="date"] {
  width: 108px;
}

#body-runs th[data-col="kind"] {
  width: 96px;
}

#body-runs th.map-col {
  width: 240px;
}

#body-runs th[data-col="tags"] {
  width: 230px;
}

#body-runs th[data-col="div"] {
  width: 64px;
}

#body-runs th[data-col="divRank"] {
  width: 86px;
}

#body-runs th[data-col="rank"] {
  width: 74px;
}

#body-runs th[data-col="qualRank"] {
  width: 88px;
}

#body-runs th[data-col="totalPlayers"] {
  width: 82px;
}

#body-runs th[data-col="rankPct"] {
  width: 84px;
}

#body-runs th[data-col="creator"] {
  width: 150px;
}

#body-runs td {
  overflow: hidden;
  text-overflow: ellipsis;
}

.runs-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  padding: 10px 18px;
  color: var(--muted);
  border-top: 1px solid var(--border-soft);
  font-size: var(--text-sm);
  font-variant-numeric: tabular-nums;
}

.runs-footer p {
  margin: 0;
}

.runs-footer-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
}

.runs-footer select.panel-action {
  height: 30px;
}

.runs-pager {
  display: flex;
  align-items: center;
  gap: 8px;
}

.runs-pager .panel-action {
  padding: 3px 10px;
}

.runs-pager button:disabled {
  color: var(--muted);
  border-color: var(--border);
  opacity: 0.45;
  cursor: default;
}

.runs-pager button:disabled:hover {
  color: var(--muted);
  border-color: var(--border);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-base);
  white-space: nowrap;
}

thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 0;
  background: var(--panel-raised);
  /* A collapsed border can disappear on a sticky header; the inset shadow
     is painted with the cell and survives scrolling. */
  box-shadow: inset 0 -1px 0 var(--border);
  color: var(--muted);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-align: left;
  text-transform: uppercase;
}

thead th.num {
  text-align: right;
}

.metric-table > thead > tr > th {
  top: calc(var(--nav-h, 0px) + var(--tabs-h, 0px));
}

/*
 * The Overall comparison table has five fixed columns rather than the shared
 * metric grid. It still pins its header below the nav and tabs.
 */
.overall-table {
  table-layout: fixed;
  width: 100%;
  min-width: 560px;
}

.overall-table > thead > tr > th {
  top: calc(var(--nav-h, 0px) + var(--tabs-h, 0px));
}

.overall-table > thead > tr > th:first-child {
  width: 34%;
}

.overall-table > thead > tr > th:nth-child(n + 2) {
  width: 16.5%;
}

.overall-table > tbody > tr > td.overall-tag {
  font-weight: 600;
  overflow-wrap: anywhere;
  white-space: normal;
}

.overall-table > thead > tr > th button.sort {
  overflow-wrap: anywhere;
  white-space: normal;
}

.overall-table > tbody > tr > td.overall-total {
  font-weight: 700;
}

/* overflow:clip keeps sticky working but does not round child backgrounds,
   so applyColumnStripes() marks the first/last visible cells of each table. */
.metric-table thead > tr > th.is-edge-first,
.overall-table thead > tr > th.is-edge-first,
#body-runs thead > tr > th.is-edge-first {
  border-top-left-radius: calc(var(--radius) - 1px);
}

.metric-table thead > tr > th.is-edge-last,
.overall-table thead > tr > th.is-edge-last,
#body-runs thead > tr > th.is-edge-last {
  border-top-right-radius: calc(var(--radius) - 1px);
}

.metric-table tbody > tr > td.is-edge-first,
.overall-table tbody > tr > td.is-edge-first,
#body-runs tbody > tr > td.is-edge-first {
  border-bottom-left-radius: calc(var(--radius) - 1px);
}

.metric-table tbody > tr > td.is-edge-last,
.overall-table tbody > tr > td.is-edge-last,
#body-runs tbody > tr > td.is-edge-last {
  border-bottom-right-radius: calc(var(--radius) - 1px);
}

thead th:not(:first-child) {
  text-align: right;
}

/*
 * The All runs table is not a sortable metric table: only the four numeric
 * columns are right-aligned. The sort button already supplies the 11/12 px
 * inset, so the th must not add it a second time (that made the header tall).
 */
#panel-runs thead th {
  padding: 0;
  text-align: left;
}

#panel-runs thead th.num {
  text-align: right;
}

button.sort {
  width: 100%;
  padding: 11px 12px;
  color: inherit;
  background: none;
  border: 0;
  font: inherit;
  font-size: inherit;
  font-weight: inherit;
  letter-spacing: inherit;
  text-align: inherit;
  text-transform: inherit;
  cursor: pointer;
}

button.sort:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.03);
}

button.sort.active {
  color: var(--accent);
}

.metric-table > thead > tr > th button.sort[data-dir="1"],
.metric-table > thead > tr > th button.sort[data-dir="-1"] {
  white-space: nowrap;
}

button.sort[data-dir="1"]::after {
  content: "";
  display: inline-block;
  width: 0;
  height: 0;
  margin-left: 3px;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-bottom: 5px solid currentColor;
  vertical-align: middle;
}

button.sort[data-dir="-1"]::after {
  content: "";
  display: inline-block;
  width: 0;
  height: 0;
  margin-left: 3px;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid currentColor;
  vertical-align: middle;
}

tbody td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-soft);
  vertical-align: middle;
}

tbody tr:last-child td {
  border-bottom: 0;
}

tbody tr:hover td {
  background: rgba(255, 255, 255, 0.025);
}

td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.stat-cell .num-main {
  display: block;
  /* Integer line boxes keep the table rows on whole pixels. */
  line-height: 18px;
}

.stat-cell .num-sub {
  line-height: 14px;
}

.num-sub {
  display: block;
  color: var(--muted);
  font-size: var(--text-xs);
  font-weight: 400;
  line-height: 1.2;
}

.label-cell {
  max-width: 360px;
  overflow: hidden;
  font-weight: 600;
  text-overflow: ellipsis;
  cursor: pointer;
}

.expand-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 100%;
  padding: 0;
  color: inherit;
  background: none;
  border: 0;
  font: inherit;
  font-weight: inherit;
  text-align: left;
  cursor: pointer;
}

.expand-toggle.has-tip {
  cursor: pointer;
}

.expand-chevron {
  display: block;
  flex: none;
  width: 10px;
  height: 10px;
  color: var(--muted);
  transition: transform 0.12s ease;
}

.expand-toggle[aria-expanded="true"] .expand-chevron {
  transform: rotate(90deg);
}

.expand-label {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.untagged-row .label-cell {
  color: var(--muted);
  font-style: italic;
  font-weight: 500;
}

.date-cell {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.map-cell {
  max-width: 360px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.map-cell .tmx-link,
.detail-map .tmx-link,
.override-name .tmx-link {
  margin-left: 7px;
  padding: 1px 5px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: var(--text-2xs);
  font-weight: 700;
  letter-spacing: 0.05em;
  vertical-align: 1px;
}

.tags-cell {
  white-space: normal;
}

.tag {
  display: inline-block;
  margin: 1px 4px 1px 0;
  padding: 1px 7px;
  color: var(--tag-text);
  background: var(--bg-soft);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-pill);
  font-size: var(--text-xs);
}

.badge {
  display: inline-block;
  padding: 1px 7px;
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  font-size: var(--text-2xs);
  font-weight: 700;
  letter-spacing: 0.04em;
}

.badge + .badge {
  margin-left: 4px;
}

.kind-cotd {
  color: var(--kind-cotd-text);
  background: var(--accent-soft);
  border-color: rgba(88, 166, 255, 0.4);
}

.kind-cotn {
  color: var(--kind-cotn-text);
  background: rgba(188, 140, 255, 0.14);
  border-color: rgba(188, 140, 255, 0.4);
}

.kind-cotm {
  color: var(--amber-text);
  background: var(--amber-soft);
  border-color: var(--amber-border);
}

/* TOTD joins the type chips as its own green/teal treatment. */
.kind-totd {
  color: var(--kind-totd-text);
  background: var(--kind-totd-soft);
  border-color: var(--kind-totd-border);
}

/* Campaign stays deliberately quieter than the cup family. */
.kind-campaign {
  color: var(--kind-campaign-text);
  background: var(--kind-campaign-soft);
  border-color: var(--kind-campaign-border);
}


.badge.manual {
  margin-left: 6px;
  color: var(--amber-text);
  background: var(--amber-soft);
  border-color: var(--amber-border);
  font-size: var(--text-2xs);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  vertical-align: 1px;
}

.pct-label {
  min-width: 43px;
  text-align: right;
  font-weight: 600;
}

.pct-label.low {
  color: var(--green);
}

.pct-label.mid {
  color: var(--amber);
}

.pct-label.high {
  color: var(--red);
}

.qual-diff.good {
  color: var(--green);
  font-weight: 600;
}

.qual-diff.bad {
  color: var(--red);
  font-weight: 600;
}

.qual-diff.neutral {
  color: var(--muted);
}

.delta.good {
  color: var(--green);
  font-weight: 600;
}

.delta.bad {
  color: var(--red);
  font-weight: 600;
}

.delta.neutral {
  color: var(--muted);
}

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

.empty-row td {
  padding: 22px 18px;
  color: var(--muted);
  text-align: center;
}

.detail-row td.detail-cell {
  padding: 0;
  background: var(--bg-soft);
  border-bottom: 1px solid var(--border);
  white-space: normal;
}

tbody tr.detail-row:hover td {
  background: var(--bg-soft);
}

.detail-inner {
  padding: 12px 14px 14px;
}

.detail-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 3px 12px;
  margin-bottom: 10px;
}

.detail-title {
  font-size: var(--text-base);
  font-weight: 600;
}

.detail-head .num-sub {
  display: inline;
  font-size: var(--text-xs);
}

.detail-scroll {
  width: min(100%, calc(100vw - 50px));
  max-width: 100%;
  overflow-x: auto;
}

.detail-empty {
  margin: 0;
  font-size: var(--text-md);
}

.detail-table {
  width: 100%;
  min-width: 760px;
  font-size: var(--text-sm);
}

.detail-table thead th {
  position: static;
  padding: 5px 9px;
  background: var(--panel-raised);
  border-bottom: 1px solid var(--border-soft);
  letter-spacing: 0.05em;
}

.detail-table thead th:not(:first-child) {
  text-align: left;
}

.detail-table thead th.num {
  text-align: right;
}

.detail-table tbody td {
  padding: 5px 9px;
  border-bottom: 1px solid var(--border-soft);
}

.detail-table tbody tr:last-child td {
  border-bottom: 0;
}

.detail-table .detail-map {
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.detail-table .detail-tags {
  white-space: normal;
}

.search-panel {
  display: flex;
  justify-content: center;
  padding: 48px 0 28px;
}

.search-card {
  width: min(720px, 100%);
  padding: 30px 32px 28px;
  background: linear-gradient(180deg, var(--panel-raised), var(--panel));
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.28);
}

.search-card h2 {
  margin-bottom: 8px;
  font-size: clamp(1.45rem, 3vw, 2rem);
  letter-spacing: -0.02em;
}

.search-subline {
  max-width: 60ch;
  margin-bottom: 20px;
  color: var(--muted);
  font-size: var(--text-base);
}

.search-form {
  display: flex;
  align-items: stretch;
  gap: 10px;
  min-width: 0;
}

.search-form input[type="search"] {
  flex: 1 1 auto;
  width: auto;
  min-width: 0;
  height: 44px;
  padding: 9px 12px;
  font-size: var(--text-lg);
}

.search-submit {
  flex: none;
  height: 44px;
  padding: 0 18px;
  color: var(--on-accent);
  background: var(--accent);
  border-color: var(--accent);
  font-size: var(--text-base);
}

.search-submit:hover {
  color: var(--on-accent);
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.search-submit:disabled,
.search-form input:disabled {
  cursor: progress;
  opacity: 0.55;
}

.search-status {
  min-height: 1.4em;
  margin: 14px 0 0;
  color: var(--muted);
  font-size: var(--text-base);
  font-variant-numeric: tabular-nums;
}

.search-status.is-loading {
  animation: tagstats-pulse 1.6s ease-in-out infinite;
}

.search-status.is-error {
  color: var(--red);
}

.search-status.is-success {
  color: var(--green);
}

.search-candidates {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--border-soft);
}

.candidate-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.candidate-button,
.recent-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 9px 12px;
  color: var(--text);
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: var(--text-base);
  text-align: left;
  cursor: pointer;
}

.candidate-button {
  justify-content: space-between;
}

.candidate-button:hover,
.recent-chip:hover {
  border-color: var(--accent);
}

.candidate-name,
.recent-name {
  min-width: 0;
  overflow: hidden;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.candidate-id {
  flex: none;
  max-width: 52%;
  overflow: hidden;
  color: var(--muted);
  font-size: var(--text-xs);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recent-players {
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid var(--border-soft);
}

.recent-players h3 {
  margin-bottom: 10px;
  color: var(--muted);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.recent-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.recent-chip {
  gap: 8px;
  padding: 6px 10px;
}

.recent-time {
  color: var(--muted);
  font-size: var(--text-xs);
  white-space: nowrap;
}

@keyframes tagstats-pulse {
  0%,
  100% {
    opacity: 0.55;
  }
  50% {
    opacity: 1;
  }
}

.fatal {
  margin-top: 24px;
  padding: 20px 22px;
  background: var(--red-soft);
  border: 1px solid rgba(248, 81, 73, 0.45);
  border-radius: var(--radius);
}

.fatal h2 {
  margin-bottom: 8px;
  font-size: var(--text-xl);
}

.fatal pre {
  margin: 12px 0;
  padding: 12px 14px;
  overflow-x: auto;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.fatal pre code {
  padding: 0;
  background: none;
  border: 0;
}

.site-footer {
  margin-top: 30px;
  color: var(--muted);
  font-size: var(--text-sm);
  text-align: center;
}

.site-footer p {
  margin: 0;
}

.has-tip {
  cursor: help;
}

.control.has-tip .control-label,
.kpi.has-tip .kpi-label,
button.sort.has-tip,
.chip.has-tip {
  text-decoration: underline dotted;
  text-decoration-color: rgba(145, 152, 161, 0.55);
  text-underline-offset: 3px;
}

.control.has-tip input[type="search"],
.control.has-tip input[type="number"] {
  cursor: text;
}

button.sort.has-tip {
  cursor: help;
}

.chip.has-tip {
  cursor: pointer;
}

.collapse-rows.is-idle {
  visibility: hidden;
}

.build-notice {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 200;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  color: var(--text);
  background: var(--panel-raised);
  border: 1px solid var(--accent);
  border-radius: 9px;
  box-shadow: var(--shadow-tip);
  font-size: var(--text-sm);
}

.build-notice[hidden] {
  display: none;
}

.build-dismiss {
  padding: 0 2px;
  color: var(--muted);
  background: none;
  border: 0;
  font: inherit;
  font-size: var(--text-lg);
  line-height: 1;
  cursor: pointer;
}

.build-dismiss:hover {
  color: var(--text);
}

.tooltip {
  position: fixed;
  z-index: 1000;
  max-width: 320px;
  padding: 8px 10px;
  color: var(--text);
  background: var(--panel-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-tip);
  font-size: var(--text-sm);
  line-height: 1.45;
  white-space: pre-line;
  pointer-events: none;
}

@media (max-width: 1100px) {
  /*
   * `[data-has-kind]` repeats the plain selector so the narrow column count
   * also wins over the four-column no-kind template above.
   */
  .controls,
  .controls[data-has-kind] {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .header-row {
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
  }

  .search-panel {
    padding: 34px 0 22px;
  }

  .search-card {
    padding: 24px;
  }
}

@media (max-width: 760px) {
  .page {
    padding: 20px 14px 32px;
  }

  .site-nav {
    gap: var(--space-2);
    padding: 8px 14px;
  }

  .site-nav-link {
    padding: 6px 10px;
  }

  .tabs {
    gap: 2px;
  }

  .tabs-bar {
    padding: 6px;
  }

  .tab {
    padding: 6px 10px;
  }

  .overall-table {
    min-width: 0;
  }

  .overall-table > thead > tr > th button.sort,
  .overall-table > tbody > tr > td {
    padding-left: 6px;
    padding-right: 6px;
  }

  .site-header {
    gap: 12px;
  }

  .header-meta {
    text-align: left;
  }

  .panel-head {
    flex-wrap: wrap;
  }

  .panel-actions {
    margin-left: auto;
  }

  .controls {
    gap: 14px;
  }

  input[type="search"] {
    width: 100%;
  }

  .override-actions {
    width: 100%;
    margin-left: 0;
  }

  .override-search {
    flex: 1 1 100%;
  }

  .override-admin {
    flex: 1 1 100%;
  }

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

@media (max-width: 700px) {
  .controls,
  .controls[data-has-kind] {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 520px) {
  .controls,
  .controls[data-has-kind] {
    grid-template-columns: minmax(0, 1fr);
  }

  .site-nav {
    gap: var(--space-2);
    padding: 8px 14px;
  }

  .site-nav-wordmark {
    display: none;
  }

  .site-nav-link {
    padding: 5px 7px;
  }

  .overall-table > thead > tr > th button.sort,
  .overall-table > tbody > tr > td {
    padding-left: 3px;
    padding-right: 3px;
  }

  .overall-table > thead > tr > th {
    font-size: var(--text-2xs);
    letter-spacing: 0.03em;
  }

  .overall-table > thead > tr > th:first-child {
    width: 32%;
  }

  .overall-table > thead > tr > th:nth-child(n + 2) {
    width: 17%;
  }

  .overall-table > thead > tr > th button.sort {
    overflow-wrap: normal;
  }
}

@media (max-width: 500px) {
  .search-card {
    padding: 20px 16px;
  }

  .search-form {
    flex-direction: column;
  }

  .search-submit {
    width: 100%;
  }

  .candidate-button {
    flex-direction: column;
    align-items: flex-start;
    gap: 3px;
  }

  .candidate-id {
    max-width: 100%;
  }

  .player-actions {
    justify-content: flex-start;
  }
}

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