/* GameMind Arena UI. Tokens live in theme.css.
   Order: 1 base · 2 shell · 3 components · 4 public pages · 5 workspace · 6 data import · 7 responsive */

/* ---------- 1. Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100vh; display: flex; flex-direction: column; background: var(--glow) no-repeat, var(--bg); color: var(--text); font-family: var(--font); font-size: var(--fs-md); line-height: 1.5; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[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; }
h1, h2, h3, h4, h5, p { margin-top: 0; }
h1 { margin: 0 0 var(--sp-2); font-size: clamp(24px, 2.6vw, var(--fs-3xl)); line-height: 1.15; font-weight: 800; letter-spacing: -.02em; }
h1 em { color: var(--blue); font-style: normal; }
h2 { font-size: var(--fs-xl); line-height: 1.25; font-weight: 700; letter-spacing: -.01em; }
h3 { font-size: var(--fs-lg); line-height: 1.3; font-weight: 700; }
a { color: var(--blue); text-decoration: none; text-underline-offset: 3px; border-radius: var(--r-sm); }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
button, a, input, select, textarea, summary, .leaderboard-table tbody tr, .upload-drop-zone, .search-select-option { transition: background-color var(--ease), border-color var(--ease), color var(--ease), box-shadow var(--ease); }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible, [tabindex]:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
::selection { background: var(--primary); color: var(--on-primary); }
* { scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; } }

/* ---------- 2. Shell ---------- */
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: var(--sp-6); min-height: 60px; padding: 0 clamp(16px, 3vw, 40px); border-bottom: 1px solid var(--topbar-line); background: var(--topbar-bg); color: var(--topbar-text); backdrop-filter: saturate(160%) blur(12px); }
.brand { display: flex; flex: 0 0 auto; align-items: center; gap: var(--sp-2); color: var(--text); }
.brand:hover { text-decoration: none; }
.brand img { width: 28px; height: 28px; object-fit: contain; }
.brand-name { color: var(--topbar-text); font-size: var(--fs-lg); font-weight: 800; letter-spacing: -.01em; }
.brand-divider { width: 1px; height: 18px; margin: 0 2px; background: var(--topbar-line); }
.arena-word { color: var(--brand); font-size: var(--fs-2xs); font-weight: 800; letter-spacing: .18em; }
.platform-nav { display: flex; flex: 1 1 auto; align-items: stretch; align-self: stretch; gap: var(--sp-1); min-width: 0; overflow-x: auto; scrollbar-width: none; }
.platform-nav::-webkit-scrollbar { display: none; }
.platform-nav a { position: relative; display: flex; flex: 0 0 auto; align-items: center; padding: 0 var(--sp-3); color: var(--topbar-muted); font-size: var(--fs-sm); font-weight: 600; white-space: nowrap; border-radius: 0; }
.platform-nav a:hover { color: var(--topbar-text); text-decoration: none; }
.platform-nav a[aria-current="page"] { color: var(--brand); }
.platform-nav a[aria-current="page"]::after { content: ""; position: absolute; left: var(--sp-3); right: var(--sp-3); bottom: 0; height: 2px; border-radius: 2px 2px 0 0; background: var(--brand); box-shadow: 0 0 12px rgb(255 204 0 / .55); }
.topbar-right { display: flex; flex: 0 0 auto; align-items: center; gap: var(--sp-2); min-width: 0; margin-left: auto; color: var(--muted); }
.ui-controls { display: inline-flex; flex: 0 0 auto; align-items: center; gap: var(--sp-2); }
.ui-language { display: block; margin: 0; }
.ui-language select, .ui-theme-button { width: auto; min-width: 0; height: 34px; min-height: 34px; padding: 0 10px; border: 1px solid var(--topbar-line); border-radius: var(--r-md); background: transparent; color: var(--topbar-muted); font-size: var(--fs-xs); font-weight: 600; }
.ui-language select { padding-right: 26px; }
.ui-language select:hover, .ui-theme-button:hover { border-color: var(--brand); background: var(--topbar-hover); color: var(--topbar-text); }

main { flex: 1 0 auto; width: min(var(--page-width), calc(100% - 48px)); margin: 0 auto; }
footer { display: flex; justify-content: space-between; align-items: center; gap: var(--sp-4); min-height: 56px; margin-top: var(--sp-10); padding: 0 clamp(16px, 3vw, 40px); border-top: 1px solid var(--line-soft); }
footer span, .footnote span { color: var(--quiet); font-size: var(--fs-2xs); font-weight: 700; letter-spacing: .12em; }

.hero { padding: var(--sp-8) 0 var(--sp-6); }
.hero-copy-block { min-width: 0; flex: 1 1 55%; }
.hero-copy { max-width: 70ch; margin: 0; color: var(--muted); font-size: var(--fs-md); }
.hero h1 br { display: none; }
.page-heading { display: flex; justify-content: space-between; align-items: end; gap: var(--sp-6); }
.page-actions { display: flex; flex: 0 0 auto; flex-wrap: wrap; gap: var(--sp-2); }
.eyebrow, .section-kicker { color: var(--quiet); font-size: var(--fs-2xs); font-weight: 700; letter-spacing: .14em; text-transform: uppercase; }
.eyebrow { display: flex; align-items: center; gap: var(--sp-2); margin-bottom: var(--sp-2); }
.eyebrow i { width: 4px; height: 4px; border-radius: 50%; background: var(--primary); }
.breadcrumbs, .hierarchy-breadcrumbs { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); margin-bottom: var(--sp-3); color: var(--quiet); font-size: var(--fs-sm); }
.hierarchy-breadcrumbs { margin: 0 0 var(--sp-4); }
.hierarchy-breadcrumbs > a + a::before { content: "/"; margin-right: var(--sp-2); color: var(--quiet); }
.hierarchy-breadcrumbs [aria-current="page"] { color: var(--text); font-weight: 600; }
.analytics { padding: 0 0 var(--sp-8); }
.hero + .analytics, .hero ~ #stats-page .analytics { padding-top: 0; }
main > .analytics:first-child { padding-top: var(--sp-8); }

/* ---------- 3. Components ---------- */
/* Surfaces */
.panel { border: 1px solid var(--line-soft); border-radius: var(--r-lg); background: var(--panel); box-shadow: var(--shadow-sm); }
.analysis-section { margin-top: var(--sp-4); padding: var(--sp-5); scroll-margin-top: 80px; }
.section-header h2, .section-header h3 { margin: var(--sp-1) 0; font-size: var(--fs-xl); }
.section-header h3 span { color: var(--blue); }
.section-header p, .section-note { margin: 0; color: var(--muted); font-size: var(--fs-sm); line-height: 1.55; }

/* Buttons */
.button, .small-button, .quiet-button { display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2); border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface-low); color: var(--text); font-weight: 600; white-space: nowrap; text-decoration: none; }
.button { min-height: var(--control-h); padding: 0 var(--sp-4); font-size: var(--fs-sm); }
.small-button, .quiet-button { min-height: var(--control-h-sm); padding: 0 var(--sp-3); font-size: var(--fs-xs); }
.quiet-button { border-color: var(--line-soft); background: transparent; color: var(--muted); }
.button:hover, .small-button:hover, .quiet-button:hover { border-color: var(--blue); background: var(--surface-hover); color: var(--text); text-decoration: none; }
.button span { font-size: var(--fs-lg); line-height: 0; }
.button-primary, .small-button.button-primary, .records-review-next { border-color: var(--primary); background: var(--primary); color: var(--on-primary); }
.button-primary:hover, .small-button.button-primary:hover, .records-review-next:hover { border-color: var(--primary-hover); background: var(--primary-hover); color: var(--on-primary); }
.danger-button, .small-button.danger-button { border-color: var(--danger); background: var(--danger); color: var(--on-danger); }
.danger-button:hover, .small-button.danger-button:hover { border-color: var(--danger-hover); background: var(--danger-hover); color: var(--on-danger); }
.full-button { width: 100%; }
.icon-button { display: inline-grid; place-items: center; flex: 0 0 auto; width: 36px; height: 36px; padding: 0; border: 1px solid var(--line-soft); border-radius: var(--r-md); background: transparent; color: var(--muted); }
.icon-button:hover { border-color: var(--line); background: var(--surface-hover); color: var(--text); }
button:not(:disabled):active, .button:active { transform: translateY(1px); }
button[aria-pressed="true"]:not(.ui-theme-button) { border-color: var(--primary); background: var(--primary); color: var(--on-primary); }
button[aria-pressed="true"]:not(.ui-theme-button):hover { border-color: var(--primary-hover); background: var(--primary-hover); color: var(--on-primary); }
:root button:disabled, :root button:disabled:hover, :root .button:disabled, :root .button:disabled:hover { border-color: var(--line-soft); background: var(--surface-low); color: var(--quiet); box-shadow: none; cursor: not-allowed; opacity: .7; transform: none; }

/* Forms */
input, select, textarea { width: 100%; min-width: 0; font-weight: 400; letter-spacing: 0; height: var(--control-h); padding: 0 var(--sp-3); border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface-low); color: var(--text); font-size: var(--fs-sm); outline: none; }
textarea { height: auto; min-height: 84px; padding: var(--sp-2) var(--sp-3); line-height: 1.5; resize: vertical; }
input:hover, select:hover, textarea:hover { border-color: var(--quiet); }
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 28%, transparent); }
input::placeholder, textarea::placeholder { color: var(--quiet); }
input:disabled, select:disabled, textarea:disabled { cursor: not-allowed; opacity: .6; }
input[type="checkbox"], input[type="radio"] { width: 16px; height: 16px; padding: 0; margin: 0; accent-color: var(--primary); box-shadow: none; }
input[type="file"] { height: auto; padding: 6px; font-size: var(--fs-xs); }
input[type="file"]::file-selector-button { height: 28px; margin-right: var(--sp-3); padding: 0 var(--sp-3); border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--panel-raised); color: var(--text); font: inherit; font-weight: 600; cursor: pointer; }
label { color: var(--muted); font-size: var(--fs-xs); font-weight: 600; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-3); }
.form-row > div { min-width: 0; }
.name-correction-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: var(--sp-3); align-items: end; }
.name-correction-form label, .ranking-controls label, .compare-controls label, .analytics-filter label { display: grid; gap: 6px; color: var(--quiet); font-size: var(--fs-2xs); font-weight: 700; letter-spacing: .06em; }
.name-correction-form input, .name-correction-form select, .name-correction-form textarea { letter-spacing: 0; font-weight: 400; }
.name-correction-form > button, .name-correction-form > .button { justify-self: start; }
progress { display: block; width: 100%; height: 8px; overflow: hidden; border: 0; border-radius: var(--r-pill); accent-color: var(--primary); background: var(--panel-raised); }
progress::-webkit-progress-bar { background: var(--panel-raised); border-radius: var(--r-pill); }
progress::-webkit-progress-value { background: var(--primary); border-radius: var(--r-pill); }
progress::-moz-progress-bar { background: var(--primary); border-radius: var(--r-pill); }

/* Feedback: notices, empty, loading */
.notice { grid-column: 1 / -1; margin: var(--sp-3) 0 0; padding: 10px var(--sp-3); border: 1px solid color-mix(in srgb, var(--blue) 35%, transparent); border-radius: var(--r-md); background: var(--blue-soft); color: var(--text); font-size: var(--fs-sm); line-height: 1.5; overflow-wrap: anywhere; }
.notice:empty { display: none; }
.error-notice { border-color: color-mix(in srgb, var(--red) 45%, transparent) !important; background: var(--red-soft) !important; color: var(--red) !important; }
a.notice { display: block; }
.top-players-empty { margin: 0; color: var(--muted); font-size: var(--fs-sm); }
.stats-empty, .extraction-empty, .notification-empty { margin: 0; padding: var(--sp-8) var(--sp-5); color: var(--muted); font-size: var(--fs-sm); line-height: 1.6; text-align: center; }
.stats-empty:empty { display: none; }
.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--sp-2); min-height: 220px; padding: var(--sp-6); border: 1px dashed var(--line); border-radius: var(--r-lg); color: var(--muted); text-align: center; }
.empty-state strong { color: var(--text); font-size: var(--fs-lg); }
.empty-state span { font-size: var(--fs-sm); }
.empty-icon { display: grid; place-items: center; width: 44px; height: 44px; margin-bottom: var(--sp-1); border: 1px solid var(--line); border-radius: 50%; background: var(--panel-raised); color: var(--blue); font-size: 22px; }
@keyframes ui-pulse { from { opacity: .45; } to { opacity: 1; } }
@keyframes ui-slide { from { transform: translateX(-100%); } to { transform: translateX(400%); } }
@keyframes ui-spin { to { transform: rotate(360deg); } }
[aria-busy="true"] { position: relative; overflow: hidden; }
[aria-busy="true"]::before { content: ""; position: absolute; top: 0; left: 0; width: 25%; height: 2px; background: var(--primary); animation: ui-slide 1.1s ease-in-out infinite; }
.skeleton { display: block; height: 14px; border-radius: var(--r-sm); background: var(--panel-raised); animation: ui-pulse .9s ease-in-out infinite alternate; }
.spinner { display: inline-block; width: 16px; height: 16px; border: 2px solid var(--line); border-top-color: var(--primary); border-radius: 50%; animation: ui-spin .7s linear infinite; }
/* Leaderboard rows are replaced by script; an empty body with no empty or error message means "loading". */
.leaderboard-panel:has(#player-table:empty):not(:has(#stats-empty:not([hidden]))) .leaderboard-scroll::after { content: ""; display: block; height: 264px; background: linear-gradient(var(--panel-raised) 14px, transparent 0) var(--sp-4) 15px / calc(100% - 32px) 44px repeat-y; animation: ui-pulse .9s ease-in-out infinite alternate; }
#stats-error:not([hidden]) ~ .analytics-layout .leaderboard-scroll::after { display: none; }

/* Chips and badges */
.directory-chip, .filter-chip, .count-pill, .tier-chip, .team-tag, .accepted-pill, .scoreboard-status, .badge, .upload-file-state, .map-outcome, .review-policy-mode { display: inline-flex; align-items: center; gap: 6px; min-height: 24px; padding: 2px 10px; border: 1px solid var(--line-soft); border-radius: var(--r-pill); background: var(--surface-low); color: var(--muted); font-size: var(--fs-2xs); font-weight: 700; line-height: 1.4; white-space: nowrap; }
.directory-chip, .filter-chip, .tier-chip, .team-tag, .count-pill { border-color: color-mix(in srgb, var(--blue) 30%, transparent); background: var(--blue-soft); color: var(--blue); }
.count-pill { justify-content: center; min-width: 28px; margin-left: auto; }
.filter-chip { overflow-wrap: anywhere; white-space: normal; }
.filter-chip button { padding: 0 3px; border: 0; background: transparent; color: inherit; font: inherit; }
.accepted-pill, .badge-new, .badge-promoted, .scoreboard-status.status-accepted, .upload-file-state.is-ready, .upload-file-state.is-complete, .map-outcome-won { border-color: color-mix(in srgb, var(--green) 40%, transparent); background: var(--green-soft); color: var(--green); }
.badge-conflict, .scoreboard-status.status-rejected, .upload-file-state.is-error, .map-outcome-lost { border-color: color-mix(in srgb, var(--red) 40%, transparent); background: var(--red-soft); color: var(--red); }
.badge-staged, .scoreboard-status.status-needs_review, .scoreboard-status.status-pending_ocr, .scoreboard-status.status-ready_for_review, .upload-file-state.is-warning { border-color: color-mix(in srgb, var(--yellow) 40%, transparent); background: var(--yellow-soft); color: var(--yellow); }
.badge-info, .upload-file-state.is-processing { border-color: color-mix(in srgb, var(--blue) 30%, transparent); background: var(--blue-soft); color: var(--blue); }
.scoreboard-status { text-transform: capitalize; }
.accepted-pill { text-transform: uppercase; }

/* Tables */
.leaderboard-scroll, .extraction-table-scroll, .compare-results, .table-scroll { max-width: 100%; overflow-x: auto; }
.leaderboard-table, .compare-table, .data-table { width: 100%; border-collapse: collapse; text-align: left; }
.leaderboard-table th, .data-table th { padding: 10px var(--sp-3); border-bottom: 1px solid var(--line-soft); background: var(--surface-low); color: var(--quiet); font-size: var(--fs-2xs); font-weight: 700; letter-spacing: .06em; white-space: nowrap; }
.leaderboard-table td, .data-table td { padding: var(--sp-3); border-bottom: 1px solid var(--line-soft); color: var(--muted); font-size: var(--fs-sm); font-variant-numeric: tabular-nums; white-space: nowrap; }
.data-table td { white-space: normal; overflow-wrap: anywhere; vertical-align: top; }
.leaderboard-table tbody tr:hover, .data-table tbody tr:hover { background: var(--surface-hover); }
.leaderboard-table tbody tr.selected, .leaderboard-table tbody tr[aria-selected="true"] { background: var(--blue-soft); }
.leaderboard-table tr.selected .rank-cell { box-shadow: inset 3px 0 0 var(--primary); }
.leaderboard-table tbody tr:last-child td, .data-table tbody tr:last-child td { border-bottom: 0; }
.rank-cell { color: var(--quiet) !important; font-weight: 700; }
.team-roster-chips { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin: var(--sp-2) 0 var(--sp-4); }
.team-transfers { margin-top: var(--sp-6); }
.transfer-list .split-row { gap: var(--sp-3); }
.roster-suggestions, .roster-sale { margin-top: var(--sp-4); }
.roster-sale-players { display: flex; flex-wrap: wrap; gap: var(--sp-2) var(--sp-4); }
.roster-sale-player { display: inline-flex; align-items: center; gap: 6px; }
.team-mode-card { display: grid; gap: 4px; color: var(--text); }
a.team-mode-card:hover { border-color: var(--blue); background: var(--panel-raised); text-decoration: none; }
.team-mode-card.is-selected { border-color: var(--brand); box-shadow: inset 0 -3px 0 var(--brand), var(--shadow-sm); }
.team-mode-maps { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: var(--sp-2); margin: var(--sp-3) 0 var(--sp-5); }
.team-map-list { display: grid; gap: 4px; margin: var(--sp-2) 0 0; padding: 0; list-style: none; }
.team-map-list li { display: flex; justify-content: space-between; gap: var(--sp-2); color: var(--muted); font-size: var(--fs-sm); }
.team-map-list li:first-child { color: var(--text); font-weight: 700; }
.team-map-list b { font-variant-numeric: tabular-nums; }
.team-mode-card > span { color: var(--quiet); font-size: var(--fs-2xs); font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.team-mode-card strong { color: var(--text); font-size: var(--fs-lg); }
.team-mode-card small { color: var(--muted); }
.team-mode-card .team-mode-map { color: var(--text); font-weight: 700; }
.team-table .player-link { font-size: var(--fs-md); }
.team-table td.win-rate { min-width: 150px; }
.win-rate-bar { display: inline-block; width: 90px; height: 6px; margin-right: var(--sp-2); overflow: hidden; border-radius: 999px; background: var(--line-soft); vertical-align: middle; }
.win-rate-fill { display: block; height: 100%; border-radius: inherit; background: var(--brand); }
.win-rate-value { color: var(--text); font-weight: 700; vertical-align: middle; }
.team-titles, .team-earnings, .team-series { color: var(--text) !important; font-weight: 700; }
.low-sample { display: inline-block; margin-left: 6px; padding: 1px 6px; border: 1px solid var(--line-soft); border-radius: 999px; color: var(--quiet); font-size: var(--fs-2xs); font-weight: 700; vertical-align: middle; }
.player-link { display: inline; padding: 0; border: 0; background: none; color: var(--text); font-size: var(--fs-sm); font-weight: 700; text-align: left; }
.player-link:hover, .player-link:focus-visible { color: var(--blue); text-decoration: underline; }
/* Player and team names that open their page: they read as the name, and show they are links on hover or focus. */
.entity-link { color: inherit; font: inherit; text-decoration: none; cursor: pointer; border-radius: 4px; text-underline-offset: 3px; }
.entity-link:hover, .entity-link:focus-visible { color: var(--blue); text-decoration: underline; }
a.meta-chip.entity-link:hover { border-color: var(--blue); text-decoration: none; }
.ranking-coverage { display: block; margin-top: 2px; color: var(--quiet); font-size: var(--fs-2xs); font-weight: 500; }

/* Tabs */
.view-tabs, .review-editor-tabs, .workspace-management-tabs, .dossier-tabs, .tournament-view-toggle { display: flex; align-items: center; gap: var(--sp-1); min-width: 0; margin: 0 0 var(--sp-4); padding: var(--sp-1); overflow-x: auto; border: 1px solid var(--line-soft); border-radius: var(--r-lg); background: var(--surface-low); }
.tournament-view-toggle { width: fit-content; max-width: 100%; margin: 0 0 var(--sp-4); }
.view-tabs > button, .view-tabs > a, .review-editor-tabs > button, .workspace-management-tabs > button, .dossier-tabs > button, .tournament-view-toggle > .button { flex: 0 0 auto; min-height: 34px; padding: 0 var(--sp-4); border: 1px solid transparent; border-radius: var(--r-md); background: transparent; color: var(--muted); font-size: var(--fs-sm); font-weight: 600; }
.view-tabs > a { display: inline-flex; align-items: center; gap: var(--sp-2); }
.view-tabs > button:hover, .view-tabs > a:hover, .review-editor-tabs > button:hover, .workspace-management-tabs > button:hover, .dossier-tabs > button:hover, .tournament-view-toggle > .button:hover { background: var(--surface-hover); color: var(--text); text-decoration: none; }
.view-tabs [aria-selected="true"], .view-tabs [aria-current="page"], .review-editor-tabs [aria-selected="true"], .workspace-management-tabs [aria-selected="true"], .dossier-tabs [aria-selected="true"], .tournament-view-toggle > .button-primary { border-color: var(--line-soft); background: var(--panel); color: var(--text); box-shadow: inset 0 -2px 0 var(--brand), var(--shadow-sm); }
.review-editor-panel, .workspace-management-view, .dossier-view { min-width: 0; }

/* Dialogs and menus */
.ui-dialog, .upload-dialog { max-height: calc(100dvh - 48px); padding: 0; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--panel); color: var(--text); box-shadow: var(--shadow); }
.ui-dialog { width: min(880px, calc(100% - 32px)); }
.ui-dialog[open], .upload-dialog[open] { display: flex; flex-direction: column; }
.ui-dialog::backdrop, .upload-dialog::backdrop { background: var(--backdrop); backdrop-filter: blur(2px); }
.dialog-header { display: flex; flex: 0 0 auto; justify-content: space-between; align-items: start; gap: var(--sp-4); padding: var(--sp-5); border-bottom: 1px solid var(--line-soft); }
.dialog-header h2, .dialog-header h3 { margin: 0; font-size: var(--fs-xl); line-height: 1.25; overflow-wrap: anywhere; }
.dialog-header p { margin: var(--sp-1) 0 0; color: var(--muted); font-size: var(--fs-sm); }
.dialog-body { min-width: 0; min-height: 0; padding: var(--sp-5); overflow-y: auto; overscroll-behavior: contain; }
.dialog-actions { display: flex; flex: 0 0 auto; flex-wrap: wrap; justify-content: flex-end; gap: var(--sp-2); padding: var(--sp-4) var(--sp-5); border-top: 1px solid var(--line-soft); border-radius: 0 0 var(--r-lg) var(--r-lg); background: var(--surface-low); }
.dialog-body .create-panel { padding: 0; border: 0; background: transparent; box-shadow: none; }
.dialog-body .correction-editor { margin-top: 0; }
.action-menu { position: relative; display: inline-block; }
.action-menu-panel { position: absolute; z-index: 35; top: calc(100% + 6px); right: 0; display: grid; gap: 2px; width: max-content; min-width: 200px; max-width: min(360px, calc(100vw - 32px)); padding: 6px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--panel); box-shadow: var(--shadow); }
.action-menu-panel > button, .action-menu-panel > a { justify-content: flex-start; min-height: 36px; padding: var(--sp-2) var(--sp-3); border-color: transparent; background: transparent; text-align: left; white-space: normal; }
.action-menu-panel .danger-button { border-color: transparent; background: transparent; color: var(--red); }
.action-menu-panel .danger-button:hover { background: var(--red-soft); color: var(--red); }

/* Searchable select (ui.js) */
.search-select { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: start; gap: 6px; width: 100%; min-width: 0; font-size: var(--fs-sm); letter-spacing: 0; }
.search-select-native { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: 0 !important; overflow: hidden; clip: rect(0, 0, 0, 0); clip-path: inset(50%); white-space: nowrap; }
.search-select-trigger { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); width: 100%; min-width: 0; min-height: var(--control-h); padding: 0 var(--sp-3); border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface-low); color: var(--text); font: inherit; font-weight: 400; text-align: left; }
.search-select-trigger > span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-select-chevron { color: var(--quiet); font-size: var(--fs-lg); }
.search-select-trigger:hover, .search-select-trigger[aria-expanded="true"] { border-color: var(--blue); }
.search-select-trigger[aria-invalid="true"] { border-color: var(--red); }
.search-select-clear { min-height: var(--control-h); padding: 0 var(--sp-3); border: 1px solid var(--line-soft); border-radius: var(--r-md); background: transparent; color: var(--blue); font: inherit; font-weight: 600; }
.search-select-panel { grid-column: 1 / -1; min-width: 0; padding: var(--sp-2); border: 1px solid var(--line); border-radius: var(--r-md); background: var(--panel); box-shadow: var(--shadow-sm); }
.search-select-panel > input { height: 36px; margin-bottom: var(--sp-2); }
.search-select-results { max-height: 216px; overflow-y: auto; overscroll-behavior: contain; }
.search-select-option { display: flex; align-items: center; gap: var(--sp-2); min-height: 36px; padding: var(--sp-2); border-radius: var(--r-sm); color: var(--text); cursor: pointer; font-size: var(--fs-sm); font-weight: 500; overflow-wrap: anywhere; }
.search-select-option > span:not(.search-select-check) { flex: 1; min-width: 0; }
.search-select-option small { color: var(--quiet); font-size: var(--fs-2xs); }
.search-select-option[aria-selected="true"] { background: var(--blue-soft); }
.search-select-option:hover, .search-select-option.is-active { background: var(--surface-hover); }
.search-select-option[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
.search-select-check { display: inline-grid; flex: 0 0 auto; place-items: center; width: 16px; height: 16px; border: 1px solid var(--line); border-radius: 4px; font-size: var(--fs-xs); }
.search-select-option[aria-selected="true"] .search-select-check { border-color: var(--primary); background: var(--primary); color: var(--on-primary); }
.search-select-status { grid-column: 1 / -1; color: var(--muted); font-size: var(--fs-xs); font-weight: 500; }
.search-select-status:empty { display: none; }
.search-select:has([aria-invalid="true"]) .search-select-status { color: var(--red); }

/* Month picker (player-stats.js) */
.month-filter { position: relative; min-width: 0; }
.month-trigger { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); width: 100%; height: var(--control-h); padding: 0 var(--sp-3); border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface-low); color: var(--text); font: inherit; font-size: var(--fs-sm); text-align: left; }
.month-trigger:hover, .month-trigger[aria-expanded="true"] { border-color: var(--blue); }
.month-trigger .month-placeholder { color: var(--quiet); }
.month-trigger svg { flex: 0 0 16px; color: var(--quiet); }
.month-popover { position: absolute; z-index: 20; top: calc(100% + 6px); left: 0; width: min(280px, calc(100vw - 48px)); padding: var(--sp-3); border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--panel); box-shadow: var(--shadow); }
.month-popover-header { display: grid; grid-template-columns: 34px 1fr 34px; align-items: center; gap: var(--sp-2); }
.month-popover-header input { height: 34px; text-align: center; font-weight: 700; }
.month-popover-header button, .month-grid button, .month-clear { border: 1px solid var(--line-soft); border-radius: var(--r-sm); background: var(--surface-low); color: var(--text); }
.month-popover-header button { height: 34px; font-size: var(--fs-lg); }
.month-popover button:hover { border-color: var(--blue); }
.month-popover button:disabled { opacity: .4; cursor: not-allowed; }
.month-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: var(--sp-3) 0; }
.month-grid button { min-height: 34px; font-size: var(--fs-xs); }
.month-clear { width: 100%; min-height: 34px; font-size: var(--fs-xs); font-weight: 600; }
.month-popover-note { margin: 0 0 var(--sp-2); color: var(--muted); font-size: var(--fs-xs); }

/* ---------- 4. Public pages ---------- */
/* Filters */
.filter-panel { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--sp-3); padding: var(--sp-4); border: 1px solid var(--line-soft); border-radius: var(--r-lg); background: var(--panel); box-shadow: var(--shadow-sm); }
.filter-heading { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: center; gap: var(--sp-3); }
.filter-heading h2 { margin: 0; color: var(--text); font-size: var(--fs-md); }
.filter-heading-actions { display: flex; align-items: center; flex-wrap: wrap; gap: var(--sp-2); }
.filter-panel .analytics-filter, .filter-panel .tournament-selector, .filter-panel .ranking-controls { display: contents; }
.filter-panel .tournament-search-form { grid-column: 1 / -1; margin: 0; }
.filter-panel > .filter-summary { grid-column: 1 / -1; padding: 0; min-height: 0; }
.analytics-heading { display: flex; justify-content: space-between; align-items: end; gap: var(--sp-5); margin-bottom: var(--sp-5); }
.analytics-heading h1, .analytics-heading h2 { margin: var(--sp-1) 0; }
.analytics-heading p { margin: 0; color: var(--muted); }
.analytics-filter { width: min(100%, 420px); min-width: 0; }
.analytics-filter label { display: block; margin-bottom: 6px; }
.tournament-selector { display: flex; align-items: end; flex-wrap: wrap; gap: var(--sp-2); }
.tournament-selector > div { flex: 1 1 110px; min-width: 0; }
.tournament-search-form { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); margin-top: var(--sp-2); }
.tournament-search-form input { flex: 1 1 140px; height: var(--control-h-sm); }
.tournament-search-form span { flex-basis: 100%; color: var(--muted); font-size: var(--fs-xs); }
.tournament-search-form span:empty { display: none; }
.ranking-controls { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--sp-3); }
.ranking-controls .map-filter > label, .ranking-controls .month-filter > label { display: block; margin-bottom: 6px; }
.insights-filters { margin-bottom: var(--sp-3); }
.map-filter { min-width: 0; }
.map-selector { display: flex; gap: 6px; }
.map-selector select { flex: 1 1 auto; }
.map-search-panel { display: grid; gap: 6px; margin-top: 6px; }
.map-search-panel input { height: 34px; }
.map-search-panel span { color: var(--muted); font-size: var(--fs-xs); }
.map-search-results { display: grid; max-height: 180px; overflow-y: auto; }
.map-search-results button { padding: var(--sp-2) var(--sp-3); border: 1px solid var(--line-soft); background: var(--surface-low); color: var(--text); text-align: left; }
.map-search-results button:hover { border-color: var(--blue); }
#stats-more-filters { display: grid; grid-column: 1 / -1; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--sp-3); padding-top: var(--sp-3); border-top: 1px solid var(--line-soft); }
.filter-summary { display: flex; align-items: center; flex-wrap: wrap; gap: var(--sp-2); min-height: 32px; padding: var(--sp-3) 0; color: var(--muted); font-size: var(--fs-xs); }
.filter-summary:empty { display: none; }

/* Metrics */
.metric-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: var(--sp-3); margin: var(--sp-4) 0; }
#mode-leaders { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-bottom: 0; }
.metric-card { position: relative; min-width: 0; padding: var(--sp-4) var(--sp-5); border: 1px solid var(--line-soft); border-radius: var(--r-lg); background: var(--panel); box-shadow: var(--shadow-sm); }
.metric-card > span { display: block; color: var(--quiet); font-size: var(--fs-2xs); font-weight: 700; letter-spacing: .08em; }
.metric-card strong { display: block; margin: var(--sp-2) 0 var(--sp-1); color: var(--text); font-size: 28px; line-height: 1.1; font-weight: 800; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.metric-card > small { display: block; color: var(--muted); font-size: var(--fs-xs); }
.metric-card b { position: absolute; top: var(--sp-4); right: var(--sp-4); color: var(--quiet); font-size: var(--fs-2xs); }
.metric-accent strong { color: var(--muted); }
.mode-leader-card { display: block; color: var(--text); }
.mode-leader-card:hover { border-color: var(--blue); background: var(--panel-raised); text-decoration: none; }
.metric-card .mode-card-link { margin-top: var(--sp-4); color: var(--blue); font-size: var(--fs-xs); letter-spacing: 0; }

/* Leaderboard */
.analytics-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--sp-4); align-items: start; }
.leaderboard-panel, .player-panel { min-width: 0; overflow: hidden; }
.leaderboard-heading { display: flex; justify-content: space-between; align-items: center; gap: var(--sp-4); padding: var(--sp-5); }
.leaderboard-heading h3 { margin: var(--sp-1) 0 2px; font-size: var(--fs-xl); }
.leaderboard-heading h3 span { color: var(--blue); }
.leaderboard-heading p { margin: 0; color: var(--muted); font-size: var(--fs-sm); }
.leaderboard-heading .search-wrap { flex: 0 1 280px; min-width: 0; }
.search-wrap { display: block; }
.search-wrap input { width: 100%; }
.leaderboard-top-three { flex: 1 1 520px; min-width: 320px; max-width: 620px; }
.top-players-list { display: grid; gap: var(--sp-2); color: var(--muted); font-size: var(--fs-sm); }
.leaderboard-top-three .top-players-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.top-player { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; align-items: center; gap: 2px var(--sp-2); min-width: 0; padding: var(--sp-2) var(--sp-3); border: 1px solid var(--line-soft); border-radius: var(--r-md); background: var(--surface-low); color: var(--text); }
.top-player:hover { border-color: var(--blue); background: var(--surface-hover); text-decoration: none; }
.top-player-avatar { position: relative; grid-column: 1; grid-row: 1 / 3; display: grid; place-items: center; width: 36px; height: 36px; overflow: hidden; border: 1px solid var(--line); border-radius: 50%; background: var(--panel-raised); color: var(--blue); font-size: var(--fs-md); font-weight: 800; }
.top-player-avatar img { position: absolute; width: 100%; height: 100%; object-fit: cover; }
.top-player-rank, .top-player-value { color: var(--blue); font-weight: 700; }
.top-player-rank { grid-column: 3; grid-row: 1; font-size: var(--fs-2xs); }
.top-player-name { grid-column: 2; grid-row: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--fs-sm); font-weight: 700; }
.top-player-value { grid-column: 2 / 4; grid-row: 2; font-size: var(--fs-xs); }
.top-player > .ranking-coverage { grid-column: 2 / 4; overflow-wrap: anywhere; }
.top-player-photo-error { grid-column: 2 / 4; color: var(--red); }
.ranking-context { margin: 0 var(--sp-5) var(--sp-3); color: var(--muted); font-size: var(--fs-xs); line-height: 1.5; }
.ranking-context:empty { display: none; }
.public-player-table { min-width: 1040px; }
.public-player-table th, .public-player-table td { text-align: right; }
.public-player-table th:nth-child(-n+2), .public-player-table td:nth-child(-n+2) { text-align: left; }
.public-player-table td:nth-child(4) { color: var(--text); font-weight: 700; }
.public-player-name { min-width: 170px; }
.leaderboard-footer { display: flex; justify-content: space-between; gap: var(--sp-3); padding: var(--sp-3) var(--sp-5); border-top: 1px solid var(--line-soft); color: var(--quiet); font-size: var(--fs-2xs); font-weight: 700; letter-spacing: .06em; }
.duplicate-notice { margin: var(--sp-3) 0; padding: var(--sp-3) var(--sp-4); border: 1px solid color-mix(in srgb, var(--yellow) 40%, transparent); border-radius: var(--r-md); background: var(--yellow-soft); color: var(--yellow); font-size: var(--fs-sm); overflow-wrap: anywhere; }
.duplicate-notice p { margin: 6px 0; color: var(--text); }
.duplicate-notice ul { margin: 0; padding-left: 18px; }
.rating-explainer { margin-top: var(--sp-4); padding: var(--sp-4) var(--sp-5); border: 1px solid var(--line-soft); border-radius: var(--r-lg); background: var(--panel); color: var(--muted); }
.rating-explainer summary { display: flex; justify-content: space-between; cursor: pointer; color: var(--muted); font-size: var(--fs-xs); font-weight: 700; letter-spacing: .06em; }
.rating-explainer summary span { color: var(--blue); }
.rating-explainer p { max-width: 80ch; margin: var(--sp-3) 0 0; font-size: var(--fs-sm); line-height: 1.6; }

/* Player and team dossier */
/* (The player page Back link is the shared .back-button in the page header.) */
.player-panel-head { display: flex; justify-content: space-between; padding: var(--sp-5); border-bottom: 1px solid var(--line-soft); }
.panel-indicator { color: var(--red); font-size: var(--fs-2xs); }
.player-placeholder { min-height: 250px; padding: var(--sp-8) var(--sp-5); }
.player-placeholder > span { color: var(--blue); font-size: 28px; }
.player-placeholder h3 { margin: var(--sp-6) 0 var(--sp-2); font-size: var(--fs-xl); }
.player-placeholder p, .dossier-caption { color: var(--muted); font-size: var(--fs-sm); line-height: 1.5; }
.player-detail { margin-top: var(--sp-4); padding: var(--sp-6); }
.dossier-title { display: flex; justify-content: space-between; align-items: start; gap: var(--sp-3); }
.dossier-title h3 { margin: 6px 0; overflow-wrap: anywhere; font-size: var(--fs-2xl); }
.dossier-rating { text-align: right; }
.dossier-rating strong { display: block; color: var(--blue); font-size: 28px; line-height: 1.1; }
.dossier-rating small { color: var(--quiet); font-size: var(--fs-2xs); font-weight: 700; letter-spacing: .06em; }
.dossier-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: var(--sp-2); margin: var(--sp-5) 0; }
.dossier-metric { display: flex; flex-direction: column; gap: var(--sp-1); min-width: 0; padding: var(--sp-3); border: 1px solid var(--line-soft); border-radius: var(--r-md); background: var(--surface-low); }
.dossier-metric small, .dossier-metric span { color: var(--quiet); font-size: var(--fs-2xs); }
.dossier-metric strong { font-size: var(--fs-lg); font-variant-numeric: tabular-nums; }
.history-title, .history-row { display: flex; justify-content: space-between; align-items: center; gap: var(--sp-2); }
.history-title small { color: var(--quiet); font-size: var(--fs-2xs); }
.player-history { max-height: 400px; margin-top: var(--sp-2); overflow-y: auto; }
.history-item { padding: var(--sp-3) 0; border-top: 1px solid var(--line-soft); }
.history-row strong { font-size: var(--fs-xs); text-transform: uppercase; }
.history-row b { color: var(--blue); font-size: var(--fs-sm); }
.history-item p, .history-item small { display: block; margin: var(--sp-1) 0 0; color: var(--muted); font-size: var(--fs-xs); line-height: 1.4; }
.history-warning { display: block; margin-top: 6px; color: var(--yellow); font-size: var(--fs-xs); }
.split-list { margin: var(--sp-2) 0 var(--sp-4); }
.split-row { display: flex; justify-content: space-between; gap: var(--sp-3); padding: var(--sp-2) 0; border-bottom: 1px solid var(--line-soft); font-size: var(--fs-sm); }
.split-row strong { overflow-wrap: anywhere; }
.split-row span { color: var(--muted); white-space: nowrap; }

/* Comparison */
.compare-controls { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: end; gap: var(--sp-3); margin: var(--sp-5) 0; }
.compare-versus { padding-bottom: 10px; color: var(--quiet); font-size: var(--fs-xs); font-weight: 800; }
.compare-results { color: var(--muted); font-size: var(--fs-sm); }
.compare-table { table-layout: fixed; }
.compare-table th, .compare-table td { padding: 10px var(--sp-3); border-bottom: 1px solid var(--line-soft); text-align: left; overflow-wrap: anywhere; }
.compare-table thead th { background: var(--surface-low); color: var(--text); }
.compare-table tbody th { color: var(--muted); font-size: var(--fs-xs); font-weight: 600; }
.compare-table td { color: var(--text); font-weight: 700; font-variant-numeric: tabular-nums; }
.compare-table td.compare-better { color: var(--green); }
.compare-table td.compare-weaker { color: var(--red); }
.compare-results .section-note { margin-top: var(--sp-3); }
.comparison-verdict { margin-top: var(--sp-4); padding: var(--sp-4); border: 1px solid var(--line-soft); border-radius: var(--r-md); background: var(--surface-low); color: var(--text); }
.comparison-verdict p { margin: var(--sp-2) 0 0; }

/* Tournament directory */
.directory-toolbar { display: flex; justify-content: space-between; align-items: center; gap: var(--sp-4); margin-bottom: var(--sp-4); }
.directory-toolbar .search-wrap { flex: 0 1 520px; min-width: 0; }
.stats-directory { gap: var(--sp-5); }
.stats-sidebar { display: grid; gap: var(--sp-4); min-width: 0; }
.sidebar-note { padding: var(--sp-5); border: 1px solid var(--line-soft); border-radius: var(--r-lg); background: var(--surface-low); }
.sidebar-note h3 { margin: var(--sp-3) 0; font-size: var(--fs-xl); }
.sidebar-note p { margin-bottom: var(--sp-4); color: var(--muted); font-size: var(--fs-sm); line-height: 1.6; }
.sidebar-note a { font-size: var(--fs-sm); font-weight: 600; }
.public-hierarchy { margin-top: 0; }
.public-hierarchy-head { display: flex; justify-content: space-between; align-items: center; gap: var(--sp-4); }
.public-hierarchy-head h2 { margin: var(--sp-1) 0 0; }
.hierarchy-heading h2 { margin: 0; font-size: var(--fs-xl); }
.hierarchy-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: var(--sp-3); margin-top: var(--sp-4); }
.hierarchy-grid:empty { display: none; }
.hierarchy-card { min-width: 0; padding: var(--sp-4) var(--sp-5); border: 1px solid var(--line-soft); border-radius: var(--r-lg); background: var(--surface-low); color: var(--text); }
a.hierarchy-card { display: block; }
a.hierarchy-card:hover { border-color: var(--blue); background: var(--surface-hover); text-decoration: none; }
.hierarchy-card h3 { margin: 0 0 var(--sp-2); font-size: var(--fs-lg); }
.hierarchy-card .section-note { margin: 0; }
.hierarchy-series-card { display: flex; flex-direction: column; gap: var(--sp-3); }
.hierarchy-series-title { color: var(--text); font-size: var(--fs-lg); font-weight: 700; }
.hierarchy-open, .hierarchy-review-next { display: inline-flex; align-self: flex-start; width: auto; margin-top: var(--sp-2); }
.hierarchy-summary, .public-hierarchy-values { display: flex; flex-wrap: wrap; gap: var(--sp-1) var(--sp-3); color: var(--muted); font-size: var(--fs-xs); }
.public-hierarchy-values { color: var(--text); font-weight: 600; }
.public-hierarchy-card { display: flex !important; flex-direction: column; gap: var(--sp-2); }
.public-hierarchy-card h3 { margin-bottom: 0; }
.hierarchy-score { margin: 0; padding: var(--sp-3); }
.hierarchy-score > .series-score-line { flex: 1; min-width: min(100%, 250px); }
.hierarchy-score > .hierarchy-summary, .hierarchy-score > .section-note { flex-basis: 100%; }
.hierarchy-series-card .hierarchy-score { padding: 0; border: 0; background: transparent; }
.hierarchy-series-card .series-score-control { margin-top: var(--sp-1); }
.public-tournament-stats { padding: 0; overflow: hidden; }
.public-tournament-stats > .section-header { padding: var(--sp-5); }
.public-tournament-stats > .notice { margin: 0 var(--sp-5) var(--sp-4); }
.public-statistics-summary { margin: 0 0 var(--sp-4); padding: 0 var(--sp-5); }
.public-statistics-summary:empty { display: none; }
.tournament-index { margin-top: 0; padding: 0; }
.tournament-index-note { padding: var(--sp-3) var(--sp-5); }
.tournament-records { min-width: 1050px; }
.tournament-records td:first-child { min-width: 200px; max-width: 320px; white-space: normal; overflow-wrap: anywhere; }
.tournament-records td:nth-child(3), .tournament-records td:nth-child(6), .tournament-records td:nth-child(7), .tournament-records td:nth-child(9) { white-space: normal; overflow-wrap: anywhere; }
.tournament-records a { font-weight: 700; }
.directory-mobile-detail { display: none; }
.public-series-list { display: grid; gap: var(--sp-3); margin-top: var(--sp-4); }
.public-series-card { overflow: hidden; border: 1px solid var(--line-soft); border-radius: var(--r-lg); background: var(--surface-low); }
.public-series-head { display: flex; justify-content: space-between; gap: var(--sp-3); padding: var(--sp-3) var(--sp-4); border-bottom: 1px solid var(--line-soft); }
.public-series-head span { color: var(--muted); font-size: var(--fs-xs); }
.public-series-maps { display: grid; }
.public-map-card { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: var(--sp-4); padding: var(--sp-3) var(--sp-4); border-top: 1px solid var(--line-soft); border-radius: 0; color: var(--text); }
.public-map-card:first-child { border-top: 0; }
.public-map-card:hover { background: var(--surface-hover); text-decoration: none; }
.public-map-card small { display: block; margin-top: 2px; color: var(--muted); overflow-wrap: anywhere; }
.public-map-score { color: var(--blue); font-weight: 800; font-variant-numeric: tabular-nums; }
.public-scoreboard { margin-top: var(--sp-4); }
.public-scoreboard-head { padding-bottom: var(--sp-3); border-bottom: 1px solid var(--line-soft); }
.public-scoreboard-head h2 { margin: var(--sp-1) 0; }
.public-scoreboard-score { display: flex; justify-content: center; align-items: center; gap: var(--sp-4); padding: var(--sp-5); font-size: 28px; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.public-scoreboard-score .score-blue { color: var(--side-blue); }
.public-scoreboard-score .score-red { color: var(--red); }
.public-scoreboard-sides { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-3); margin-bottom: var(--sp-3); }
.public-scoreboard-table { min-width: 560px; }
.public-scoreboard-table caption { padding: var(--sp-2) var(--sp-3); color: var(--quiet); font-size: var(--fs-2xs); font-weight: 700; letter-spacing: .08em; text-align: left; }
.public-scoreboard-table .history-warning { margin-top: 3px; }
.public-scoreboard .issue-list { margin-top: var(--sp-3); }

/* ---------- 5. Workspace ---------- */
/* Sign-in */
.access-panel { display: grid; grid-template-columns: 1fr minmax(300px, 440px); align-items: center; gap: var(--sp-6); margin: 0 0 var(--sp-10); padding: var(--sp-6); }
.access-panel h2 { margin: var(--sp-1) 0; font-size: var(--fs-2xl); }
.access-panel p { margin-bottom: 0; color: var(--muted); font-size: var(--fs-sm); }
.access-form { display: flex; flex-wrap: wrap; align-items: end; gap: var(--sp-2); }
.access-form > label:not(.sr-only) { display: grid; gap: 6px; flex: 1 1 100%; }
.access-form > input { flex: 1 1 180px; min-width: 0; }
.access-form > button { flex: 0 0 auto; }
.account-status { margin: var(--sp-3) 0; color: var(--muted); font-size: var(--fs-sm); }
.account-status-actions { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-top: var(--sp-2); }

/* Tournament list */
.workspace-heading { display: flex; justify-content: space-between; align-items: end; gap: var(--sp-4); margin: var(--sp-2) 0 var(--sp-4); }
.workspace-heading h2 { margin: var(--sp-1) 0 0; font-size: var(--fs-2xl); }
.local-badge { display: flex; align-items: center; gap: var(--sp-2); color: var(--quiet); font-size: var(--fs-2xs); font-weight: 700; letter-spacing: .1em; }
.local-badge i { width: 6px; height: 6px; border-radius: 50%; background: var(--green); }
.admin-actions-link { margin-top: var(--sp-3); }
#pending-removals-link { display: block; }
.workspace-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--sp-4); align-items: start; }
.create-panel, .tournament-panel { padding: var(--sp-5); }
.panel-heading { display: flex; align-items: center; gap: var(--sp-3); margin-bottom: var(--sp-4); }
.panel-heading h3 { margin: 2px 0 0; font-size: var(--fs-lg); }
.step-number { display: none; }
.create-panel label { display: block; margin: 0 0 6px; }
.create-panel > input, .create-panel > select, .form-row { margin-bottom: var(--sp-4); }
.create-panel > .section-note { margin-bottom: var(--sp-4); }
.tournament-panel > .create-panel { margin: var(--sp-4) 0; background: var(--surface-low); box-shadow: none; }
.cancel-tournament-create { margin-top: var(--sp-2); }
.tournament-list { display: grid; gap: var(--sp-3); margin-top: var(--sp-4); }
.tournament-list:empty { display: none; }
.tournament-card { padding: var(--sp-5); border: 1px solid var(--line-soft); border-radius: var(--r-lg); background: var(--surface-low); }
.tournament-card.is-openable { cursor: pointer; }
.tournament-card.is-openable:hover { border-color: var(--blue); background: var(--surface-hover); }
.tournament-card-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: start; gap: var(--sp-3); }
.tournament-card-head > div:first-child { min-width: 0; flex: 1; }
.tournament-card h4 { margin: 0 0 var(--sp-1); font-size: var(--fs-lg); }
.tournament-open { color: var(--text); }
.tournament-meta { color: var(--muted); font-size: var(--fs-sm); }
.tournament-actions-button { margin-left: auto; }
.tournament-task-links { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin: var(--sp-4) 0; }
.task-link { display: inline-flex; align-items: center; min-height: var(--control-h-sm); padding: 0 var(--sp-3); border: 1px solid var(--line-soft); border-radius: var(--r-md); background: var(--panel); font-size: var(--fs-sm); font-weight: 600; }
.task-link:hover, .task-link[aria-current="page"] { border-color: var(--blue); background: var(--blue-soft); text-decoration: none; }
.task-back, .admin-back { display: inline-block; font-size: var(--fs-sm); font-weight: 600; }
.task-back { margin-bottom: var(--sp-4); }
.tournament-edit { margin-top: var(--sp-3); }
.tournament-edit summary { cursor: pointer; color: var(--blue); }
.tournament-edit .create-panel { margin-top: var(--sp-3); }
.tournament-settings { margin-top: var(--sp-4); padding: var(--sp-3); border: 1px solid var(--line-soft); border-radius: var(--r-md); }
.tournament-settings > summary { cursor: pointer; color: var(--text); font-weight: 700; }
.tournament-settings > .submission-actions { margin-top: var(--sp-3); }
.tournament-focused.unlocked .hero, .tournament-focused #tournament-workspace > .workspace-heading, .tournament-focused .tournament-panel > .panel-heading { display: none; }
.tournament-focused main { padding-top: var(--sp-6); }
.tournament-focused .workspace-grid { display: block; }
.tournament-focused .tournament-panel { padding: 0; border: 0; background: transparent; box-shadow: none; }
.tournament-focused .tournament-card { margin: 0; background: var(--panel); }
.tournament-focused .tournament-card-head h1 { margin: 0; font-size: var(--fs-2xl); line-height: 1.2; }
.footnote { margin: var(--sp-6) 0 0; padding: var(--sp-4) 0; border-top: 1px solid var(--line-soft); }
.footnote p { margin: 6px 0 0; color: var(--muted); font-size: var(--fs-sm); }

/* Admin */
.admin-navigation { margin: 0 0 var(--sp-4); padding: var(--sp-5); }
.admin-navigation h2 { margin: var(--sp-3) 0 var(--sp-1); font-size: var(--fs-2xl); }
.admin-navigation p { color: var(--muted); font-size: var(--fs-sm); }
#admin-action-links { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: var(--sp-2); }
#admin-action-links a { display: flex; justify-content: space-between; align-items: center; gap: var(--sp-3); padding: var(--sp-4); border: 1px solid var(--line-soft); border-radius: var(--r-md); background: var(--surface-low); color: var(--text); font-weight: 600; }
#admin-action-links a:hover { border-color: var(--blue); background: var(--surface-hover); text-decoration: none; }
#admin-action-links a span { color: var(--blue); }
.name-corrections, .admin-section { margin: 0 0 var(--sp-4); padding: var(--sp-5); border: 1px solid var(--line-soft); border-radius: var(--r-lg); background: var(--panel); box-shadow: var(--shadow-sm); }
.admin-section > h2, .admin-section-heading, .name-corrections > h2 { margin: 0 0 var(--sp-2); font-size: var(--fs-xl); }
.admin-section h3 { margin: var(--sp-6) 0 var(--sp-2); }
.name-corrections > p, .admin-section > p, .name-preview { margin: 0 0 var(--sp-4); color: var(--muted); font-size: var(--fs-sm); line-height: 1.55; }
.name-corrections summary { cursor: pointer; color: var(--text); font-size: var(--fs-sm); font-weight: 700; }
.name-corrections summary span { float: right; color: var(--blue); }
.name-preview strong { color: var(--text); }
.name-preview ul { padding-left: 18px; overflow-wrap: anywhere; }
.name-corrections .name-correction-form + .name-correction-form, #team-account-panel .name-correction-form { margin-bottom: var(--sp-4); }
#team-list, #membership-list, #account-list, #organizer-token-list { margin: var(--sp-3) 0 var(--sp-5); }
.organizer-token-value { display: block; margin-top: var(--sp-2); padding: var(--sp-2) var(--sp-3); border-radius: var(--r-sm); background: var(--surface-low); font-family: ui-monospace, Consolas, monospace; overflow-wrap: anywhere; user-select: all; }
#account-list .split-row, #team-account-roster-list .split-row, .account-rows .split-row { min-width: 0; flex-wrap: wrap; align-items: center; }
#account-list .split-row > span, #team-account-roster-list .split-row > span, .account-rows .split-row > span { flex: 1 1 160px; min-width: 0; white-space: normal; overflow-wrap: anywhere; }
#account-list .split-row form, #team-account-roster-list .submission-actions, .account-rows .submission-actions { max-width: 100%; flex-wrap: wrap; }
.confirm-correction { border-color: var(--blue); color: var(--blue); }
.management-layout { display: grid; grid-template-columns: minmax(220px, .8fr) minmax(0, 1.2fr); gap: var(--sp-5); align-items: start; }
.management-record-list { display: grid; gap: var(--sp-2); max-height: 480px; overflow-y: auto; }
.management-record { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); padding: var(--sp-3); border: 1px solid var(--line-soft); border-radius: var(--r-md); background: var(--surface-low); overflow-wrap: anywhere; }
.management-record[aria-selected="true"] { border-color: var(--blue); background: var(--blue-soft); }
.selected-player-aliases { display: grid; gap: var(--sp-3); margin-top: var(--sp-3); padding: var(--sp-3); border: 1px solid var(--line-soft); border-radius: var(--r-md); background: var(--surface-low); }
.selected-player-aliases > form { min-width: 0; }

/* Registration */
.registration-rosters { display: grid; gap: var(--sp-3); margin-top: var(--sp-3); }
.registration-team-card { padding: 0; overflow: hidden; }
.registration-team-summary { display: flex; align-items: center; gap: var(--sp-3); width: 100%; padding: var(--sp-3) var(--sp-4); cursor: pointer; list-style: none; }
.registration-team-summary::-webkit-details-marker { display: none; }
.registration-team-summary::after { content: "+"; color: var(--blue); font-size: var(--fs-xl); font-weight: 600; }
.registration-team-card[open] { display: block; }
.registration-team-card[open] > .registration-team-summary { border-bottom: 1px solid var(--line-soft); background: var(--panel-raised); }
.registration-team-card[open] > .registration-team-summary::after { content: "−"; }
.registration-team-icon { display: grid; place-items: center; flex: 0 0 40px; width: 40px; height: 40px; border: 1px solid color-mix(in srgb, var(--blue) 40%, transparent); border-radius: 50%; background: var(--blue-soft); color: var(--blue); font-weight: 800; }
.registration-team-summary .team-identity { flex: 1 1 auto; min-width: 0; }
.registration-team-summary .team-identity h3 { margin: 0 0 2px; }
.registration-team-count { color: var(--muted); font-size: var(--fs-xs); white-space: nowrap; }
.registration-team-body { display: grid; gap: var(--sp-2); padding: var(--sp-3) var(--sp-4) var(--sp-4); }
.registration-player-row { padding: var(--sp-2) 0; border-top: 1px solid var(--line-soft); }
.registration-player-form { width: 100%; margin-top: var(--sp-3); padding-top: var(--sp-3); border-top: 1px solid var(--line-soft); }
.registration-advanced, .registration-alias-details { grid-column: 1 / -1; padding: var(--sp-2) var(--sp-3); border: 1px solid var(--line-soft); border-radius: var(--r-md); background: var(--surface-low); }
.registration-advanced summary, .registration-alias-details summary { cursor: pointer; color: var(--muted); font-size: var(--fs-xs); font-weight: 600; }
.registration-advanced[open] summary, .registration-alias-details[open] summary { margin-bottom: var(--sp-2); }
.registration-advanced label { display: block; margin-top: var(--sp-2); }
.registration-simple-team-form { align-items: end; }
.team-identity { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); }
.team-assignment { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: end; gap: var(--sp-2); }
.team-assignment label { flex: 1 1 140px; }
.tag-suggestions { grid-column: 1 / -1; padding: var(--sp-3); border: 1px solid var(--line-soft); border-radius: var(--r-md); background: var(--surface-low); }
.tag-suggestions > strong { display: block; margin-bottom: var(--sp-2); color: var(--text); font-size: var(--fs-sm); }
.tag-suggestion-side { display: grid; gap: 6px; margin-top: var(--sp-2); }
.tag-suggestion-label { color: var(--quiet); font-size: var(--fs-2xs); font-weight: 700; letter-spacing: .08em; }
.tag-suggestion { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); color: var(--text); overflow-wrap: anywhere; }
.tag-suggestion-empty, .tag-suggestion-note { color: var(--muted); }
.tag-suggestion-note { margin: var(--sp-3) 0 0; font-size: var(--fs-xs); }

/* Upload */
.upload-form { margin-top: var(--sp-4); padding-top: var(--sp-4); border-top: 1px solid var(--line-soft); }
.upload-controls { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-2); align-items: center; }
.upload-day { display: flex; align-items: center; gap: var(--sp-2); color: var(--muted); font-size: var(--fs-xs); }
.upload-drop-zone { grid-column: 1 / -1; min-width: 0; padding: var(--sp-5); border: 2px dashed var(--line); border-radius: var(--r-lg); background: var(--surface-low); }
.upload-drop-zone.is-dragging { border-color: var(--primary); background: var(--blue-soft); }
.upload-drop-hint, .upload-drop-notice, .upload-selection { margin: 0 0 var(--sp-2); color: var(--muted); font-size: var(--fs-xs); overflow-wrap: anywhere; }
.upload-selection, .upload-drop-notice { margin: var(--sp-2) 0 0; }
.upload-drop-notice { color: var(--text); }
.upload-previews { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: var(--sp-2); margin-top: var(--sp-2); }
.upload-previews:empty { display: none; }
.upload-preview { min-width: 0; padding: 6px; border: 1px solid var(--line-soft); border-radius: var(--r-md); background: var(--panel); }
.upload-preview img, .upload-preview-error { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: contain; border-radius: var(--r-sm); background: var(--surface-low); }
.upload-preview-error { padding: 6px; color: var(--muted); font-size: var(--fs-xs); }
.upload-preview-name { display: block; margin: 6px 0; overflow-wrap: anywhere; color: var(--text); font-size: var(--fs-xs); }
.upload-preview .small-button { width: 100%; }
.upload-file-controls { display: flex; align-items: center; gap: var(--sp-2); min-width: 0; }
.upload-file-controls input[type=file] { flex: 1 1 auto; width: 0; }
.upload-file-controls .small-button { flex: 0 0 auto; }
.upload-retention { display: flex; align-items: center; gap: var(--sp-2); margin: var(--sp-3) 0 var(--sp-1); color: var(--text); font-size: var(--fs-sm); }
.upload-status { margin: var(--sp-3) 0 0; color: var(--muted); font-size: var(--fs-xs); }
.prize-rows { display: grid; gap: var(--sp-2); margin-bottom: var(--sp-2); }
.prize-row { display: grid; grid-template-columns: auto 5rem minmax(0, 1fr) 5rem auto; gap: var(--sp-2); align-items: center; }
.prize-row input { min-width: 0; }
.prize-place { color: var(--muted); font-size: var(--fs-xs); text-transform: uppercase; }
.upload-progress-open { margin-top: var(--sp-2); }
.upload-dialog { width: min(720px, calc(100% - 32px)); padding: var(--sp-5); overflow-y: auto; }
.upload-dialog > * { flex: 0 0 auto; }
.upload-dialog .section-note { margin: 0; }
.upload-dialog-heading { display: flex; align-items: start; justify-content: space-between; gap: var(--sp-4); }
.upload-dialog-heading h2 { margin: var(--sp-1) 0; font-size: var(--fs-2xl); }
.upload-dialog-heading p { margin: 0; color: var(--muted); font-size: var(--fs-sm); overflow-wrap: anywhere; }
.upload-steps { display: flex; gap: var(--sp-3); margin: var(--sp-4) 0; padding: 0; list-style: none; }
.upload-steps li { display: flex; flex: 1 1 0; align-items: center; gap: var(--sp-2); padding-bottom: var(--sp-3); border-bottom: 2px solid var(--line-soft); color: var(--quiet); font-size: var(--fs-sm); font-weight: 600; }
.upload-steps li > span { display: grid; place-items: center; width: 24px; height: 24px; border: 1px solid var(--line); border-radius: 50%; font-size: var(--fs-xs); }
.upload-steps li[aria-current="step"], .upload-steps li.is-complete { border-color: var(--primary); color: var(--text); }
.upload-steps li[aria-current="step"] > span { border-color: var(--primary); background: var(--primary); color: var(--on-primary); }
.upload-steps li.is-complete > span { border-color: var(--green); color: var(--green); }
.upload-transfer { padding: var(--sp-3); border: 1px solid var(--line-soft); border-radius: var(--r-md); background: var(--surface-low); }
.upload-transfer progress, .upload-processing progress { margin-bottom: var(--sp-2); }
.upload-progress-heading { display: flex; justify-content: space-between; gap: var(--sp-4); margin-bottom: var(--sp-2); font-size: var(--fs-sm); }
.upload-progress-heading > span { color: var(--blue); font-weight: 700; font-variant-numeric: tabular-nums; }
.ocr-progress { margin-block: var(--sp-3); }
.ocr-progress progress { margin-bottom: var(--sp-2); }
.ocr-task-progress { flex: 1 1 160px; }
.upload-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--sp-3); margin: var(--sp-3) 0; }
.upload-summary > div { min-width: 0; padding: var(--sp-3); border: 1px solid var(--line-soft); border-radius: var(--r-md); background: var(--surface-low); }
.upload-summary strong { display: block; margin-bottom: 2px; color: var(--text); font-size: var(--fs-xl); font-variant-numeric: tabular-nums; }
.upload-summary span { display: block; color: var(--quiet); font-size: var(--fs-2xs); font-weight: 700; letter-spacing: .06em; }
.upload-processing { margin-bottom: var(--sp-3); }
.upload-dialog-files { flex: 1 1 auto; min-height: 64px; max-height: 240px; margin: 0; padding: 0; overflow-y: auto; list-style: none; }
.upload-file-row { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-4); padding: var(--sp-3) 0; border-bottom: 1px solid var(--line-soft); }
.upload-file-name { min-width: 0; color: var(--text); font-size: var(--fs-sm); overflow-wrap: anywhere; }
.upload-file-state { flex: 0 0 auto; }
.upload-dialog-footer { position: sticky; bottom: 0; display: grid; gap: var(--sp-3); padding-top: var(--sp-3); border-top: 1px solid var(--line-soft); background: var(--panel); }
.upload-dialog-footer .page-actions { justify-content: flex-end; }

/* Submission records */
.scoreboard-list { margin-top: var(--sp-4); }
.submission-list { margin: var(--sp-5) 0 0; padding: 0; list-style: none; }
.submission-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--sp-2); padding: var(--sp-3) 0; border-top: 1px solid var(--line-soft); color: var(--muted); font-size: var(--fs-sm); }
.submission-summary { display: flex; flex-direction: column; gap: var(--sp-1); min-width: 0; }
.submission-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: var(--sp-2); }
.submission-list small { color: var(--blue); white-space: nowrap; }
.submission-list details { margin: var(--sp-2) 0 var(--sp-2) var(--sp-3); }
.submission-list summary { padding: var(--sp-2) 0; cursor: pointer; color: var(--text); }
.records-heading { display: flex; justify-content: space-between; align-items: end; gap: var(--sp-3); margin-bottom: var(--sp-3); }
.records-kicker, .records-group-label, .series-review-label { color: var(--quiet); font-size: var(--fs-2xs); font-weight: 700; letter-spacing: .1em; }
.records-heading h5 { margin: 2px 0 0; color: var(--text); font-size: var(--fs-lg); line-height: 1.25; }
.records-total { color: var(--muted); font-size: var(--fs-sm); white-space: nowrap; }
.records-heading-actions { display: flex; align-items: center; flex-wrap: wrap; justify-content: flex-end; gap: var(--sp-2); }
.submission-list .records-group { margin: 0 0 var(--sp-2); overflow: hidden; border: 1px solid var(--line-soft); border-radius: var(--r-lg); background: var(--panel); }
.submission-list .records-group-summary, .submission-list .scoreboard-card-summary { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-3) var(--sp-4); list-style: none; cursor: pointer; color: var(--text); }
.submission-list .records-group-summary::-webkit-details-marker, .submission-list .scoreboard-card-summary::-webkit-details-marker { display: none; }
.submission-list .records-group-summary:hover, .submission-list .scoreboard-card-summary:hover { background: var(--surface-hover); }
.records-group-title { display: grid; gap: 2px; flex: 1 1 auto; min-width: 0; }
.records-group-title strong { font-size: var(--fs-md); overflow-wrap: anywhere; }
.records-group-subtitle { color: var(--muted); font-size: var(--fs-xs); line-height: 1.4; overflow-wrap: anywhere; }
.records-group-count { flex: 0 0 auto; color: var(--muted); font-size: var(--fs-xs); }
.records-chevron { flex: 0 0 auto; color: var(--quiet); font-size: 22px; line-height: 1; transition: transform var(--ease); }
details[open] > summary > .records-chevron, details[open] > summary .scoreboard-card-meta > .records-chevron { transform: rotate(90deg); }
.records-group-body { padding: 0 var(--sp-2) var(--sp-2); }
.submission-list .records-day { background: var(--surface-low); }
.submission-list .records-series { background: var(--panel-raised); }
.submission-list .submission-item { display: block; margin: 0 0 6px; padding: 0; overflow: hidden; border: 1px solid var(--line-soft); border-radius: var(--r-md); background: var(--surface-low); }
.scoreboard-card-info { display: grid; gap: 2px; flex: 1 1 auto; min-width: 0; }
.scoreboard-card-title { color: var(--text); font-size: var(--fs-sm); font-weight: 600; text-transform: capitalize; }
.scoreboard-card-filename { color: var(--muted); font-size: var(--fs-xs); overflow-wrap: anywhere; }
.scoreboard-card-meta { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: var(--sp-2); }
.scoreboard-map-score { color: var(--text); font-size: var(--fs-md); font-weight: 800; white-space: nowrap; font-variant-numeric: tabular-nums; }
.scoreboard-card-body { display: grid; gap: var(--sp-3); padding: var(--sp-3) var(--sp-4); border-top: 1px solid var(--line-soft); }
.scoreboard-card-body > .submission-actions { justify-content: flex-start; }
.scoreboard-card-body .submission-summary { font-size: var(--fs-sm); }
.scoreboard-card-body > .extraction-details { margin: 0; }
.submission-list .scoreboard-advanced { margin: 0; padding: var(--sp-2) var(--sp-3); border: 1px solid var(--line-soft); border-radius: var(--r-md); }
.submission-list .scoreboard-advanced > summary { padding: var(--sp-1); color: var(--blue); }
.scoreboard-advanced > :not(summary) { margin-top: var(--sp-2); }
.archive-header { display: flex; justify-content: space-between; align-items: center; gap: var(--sp-4); }
.archive-item { border-top: 1px solid var(--line-soft); }
.archive-item summary { display: flex; justify-content: space-between; align-items: center; gap: var(--sp-3); padding: var(--sp-3) 0; cursor: pointer; list-style: none; }
.archive-item summary strong { color: var(--text); font-size: var(--fs-sm); text-transform: uppercase; }
.archive-item summary small { display: block; margin-top: 4px; color: var(--muted); font-size: var(--fs-xs); }
.archive-item summary b { color: var(--blue); white-space: nowrap; }
.archive-meta { color: var(--muted); font-size: var(--fs-xs); overflow-wrap: anywhere; }
.archive-item .evidence-control { margin-bottom: var(--sp-3); }

/* Extraction and review */
.extraction-details { grid-column: 1 / -1; padding: var(--sp-3); border: 1px solid var(--line-soft); border-radius: var(--r-md); background: var(--surface-low); }
.extraction-details summary { color: var(--blue); cursor: pointer; font-size: var(--fs-sm); font-weight: 600; }
.extraction-empty { padding: var(--sp-3) 0 0; text-align: left; }
.evidence-button { margin-top: var(--sp-2); }
.evidence-image { display: block; width: 100%; height: auto; margin-top: var(--sp-2); border-radius: var(--r-sm); }
.correction-editor { margin-top: var(--sp-3); }
.correction-editor form { margin-top: var(--sp-2); }
.correction-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: var(--sp-2); }
.correction-field { display: grid; gap: 4px; }
.correction-field input, .correction-field select { height: 34px; }
.correction-rows fieldset { margin: var(--sp-3) 0; padding: var(--sp-3); border: 1px solid var(--line-soft); border-radius: var(--r-md); }
.correction-rows legend { padding: 0 6px; color: var(--blue); font-size: var(--fs-xs); font-weight: 700; }
.correction-checkbox { display: flex; align-items: center; gap: 6px; margin-top: var(--sp-2); }
.extraction-overview { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: var(--sp-2); margin: var(--sp-3) 0; }
.extraction-overview dt { color: var(--quiet); font-size: var(--fs-2xs); font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.extraction-overview dd { margin: 2px 0 0; color: var(--text); font-size: var(--fs-sm); }
.extraction-table { width: 100%; border-collapse: collapse; font-size: var(--fs-xs); }
.extraction-table th, .extraction-table td { padding: 6px; border-top: 1px solid var(--line-soft); text-align: left; }
.extraction-table th { color: var(--quiet); font-size: var(--fs-2xs); font-weight: 700; white-space: nowrap; }
.extraction-table td:not(.extraction-player) { white-space: nowrap; font-variant-numeric: tabular-nums; }
.extraction-sides { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-3); }
.extraction-side { min-width: 0; padding: var(--sp-3); border: 1px solid var(--line-soft); border-radius: var(--r-md); background: var(--panel); }
.extraction-side-blue { border-top: 3px solid var(--side-blue); }
.extraction-side-red { border-top: 3px solid var(--red); }
.extraction-side-unknown { grid-column: 1 / -1; }
.extraction-side-heading { display: flex; justify-content: space-between; align-items: center; gap: var(--sp-2); margin: 0 0 var(--sp-2); color: var(--text); font-size: var(--fs-sm); }
.extraction-side-blue .extraction-side-heading { color: var(--side-blue); }
.extraction-side-red .extraction-side-heading { color: var(--red); }
.extraction-side-score { font-size: var(--fs-lg); font-variant-numeric: tabular-nums; }
.extraction-issue-title { display: block; margin-top: var(--sp-2); color: var(--muted); font-size: var(--fs-xs); }
.extraction-issues { margin: 4px 0 0; padding-left: 18px; color: var(--muted); font-size: var(--fs-xs); }
.extraction-player { min-width: 105px; }
.extraction-player-name { display: block; overflow-wrap: anywhere; font-weight: 600; }
.extraction-player-name.identity-trigger { min-height: 0; padding: 1px 6px; border: 1px solid var(--line-soft); border-radius: var(--r-sm); background: var(--surface-low); color: var(--text); font: inherit; font-weight: 600; text-align: left; }
.extraction-player-name.identity-trigger:hover { border-color: var(--blue); background: var(--blue-soft); }
.extraction-player-name.identity-trigger.is-verified { color: var(--green); }
.extraction-player .identity-controls { display: contents; }
.extraction-player-meta { display: block; margin: 2px 0; color: var(--muted); font-size: var(--fs-2xs); }
.identity-controls { margin-top: 3px; }
.identity-controls > summary { color: var(--blue); font-size: var(--fs-2xs); cursor: pointer; }
.identity-controls[open] { min-width: 155px; }
.identity-controls[open] > span, .identity-raw-name { display: block; margin-top: 6px; overflow-wrap: anywhere; color: var(--muted); font-size: var(--fs-2xs); }
.identity-controls select { height: 32px; margin: 6px 0; font-size: var(--fs-xs); }
.extraction-team-tag, .series-team-tag { color: inherit; font-weight: 700; }
.player-mvp { color: var(--yellow); font-weight: 800; }
.map-outcome { margin: 0 0 6px; }
.submission-list .focused-review { margin-left: 0; }
.focused-review .scoreboard-card-summary .records-chevron { display: none; }
.focused-review .submission-summary { flex-direction: row; flex-wrap: wrap; gap: var(--sp-2) var(--sp-4); }
.focused-review .submission-summary > :first-child { display: none; }
.focused-review .status-accepted { border-color: var(--line-soft); background: var(--surface-low); color: var(--text); }
.review-comparison { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-3); align-items: start; }
.review-comparison > *, .review-results .extraction-details { min-width: 0; max-width: 100%; }
.review-original { position: sticky; top: 72px; min-width: 0; padding: var(--sp-3); border: 1px solid var(--line-soft); border-radius: var(--r-md); background: var(--panel); }
.review-panel-heading { margin: 0 0 var(--sp-2); color: var(--text); font-size: var(--fs-sm); }
.review-original-heading { display: flex; justify-content: space-between; align-items: center; gap: var(--sp-2); }
.review-original-heading .review-panel-heading { margin: 0; }
.review-original .evidence-control { max-height: calc(100dvh - 230px); overflow: auto; }
.review-original .evidence-image { max-height: calc(100dvh - 180px); object-fit: contain; }
.review-original.is-zoomed .evidence-image { width: auto; max-width: none; max-height: none; }
.review-original .section-note { margin-bottom: 0; }
.review-results { min-width: 0; }
.submission-list .review-results > .extraction-details { margin: 0; }
.review-results .extraction-sides { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
.review-results .extraction-side-unknown { grid-column: 1 / -1; }
.review-results .extraction-side { padding: var(--sp-2) 6px; }
.review-results .extraction-table-scroll { min-width: 0; max-width: 100%; overflow-x: auto; }
.review-results .extraction-table { min-width: 300px; }
.review-results .extraction-table th, .review-results .extraction-table td { padding: 5px 4px; vertical-align: top; }
.review-navigation { position: sticky; bottom: 0; z-index: 2; padding: var(--sp-3) var(--sp-4); border: 1px solid var(--line-soft); border-radius: var(--r-md); background: var(--panel-raised); box-shadow: var(--shadow); }
.review-navigation-actions { display: flex; align-items: center; gap: var(--sp-3); }
.review-progress { flex: 1; color: var(--muted); font-size: var(--fs-sm); text-align: center; }
.review-navigation .section-note { margin: var(--sp-2) 0 0; }
.review-navigation .notice { margin-bottom: 0; }
.submission-list .review-extra-controls { margin-left: 0; }
.review-toolbar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: var(--sp-2); margin-bottom: var(--sp-3); padding: var(--sp-3) var(--sp-4); border: 1px solid var(--line-soft); border-radius: var(--r-md); background: var(--panel); }
.review-toolbar .section-note { flex: 1 1 220px; }
.review-toolbar > .accepted-note, .review-toolbar > .review-attention { flex: 1 1 100%; border-top: 1px solid var(--line-soft); }
.review-warning-summary { margin: var(--sp-2) 0; padding: var(--sp-2) var(--sp-3); border: 1px solid color-mix(in srgb, var(--yellow) 45%, transparent); border-radius: var(--r-md); background: var(--yellow-soft); color: var(--yellow); font-size: var(--fs-sm); line-height: 1.5; overflow-wrap: anywhere; }
.accepted-note, .review-attention { display: flex; align-items: center; flex-wrap: wrap; gap: 6px var(--sp-2); min-width: 0; padding: 6px 0; font-size: var(--fs-sm); }
.accepted-note { color: var(--muted); }
.review-attention { color: var(--text); }
.review-attention > span { font-weight: 700; }
.review-issue-dialog { width: min(520px, calc(100vw - 24px)); }
.review-issue-dialog .dialog-body { display: flex; flex-direction: column; align-items: flex-start; gap: var(--sp-2); }
.review-issue-dialog .dialog-body > p { margin: 0; }
.review-issue-context, .review-issue-message { overflow-wrap: anywhere; line-height: 1.5; }
.review-issue-context { color: var(--muted); font-size: var(--fs-sm); }
.review-issue-raw { width: 100%; min-width: 0; color: var(--muted); font-size: var(--fs-xs); }
.review-issue-raw pre { max-height: 180px; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; }
.issue-navigation { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: var(--sp-2); width: 100%; color: var(--muted); font-size: var(--fs-sm); }
.review-map-teams { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: var(--sp-2) var(--sp-4); margin: 0 0 var(--sp-3); padding: var(--sp-3) var(--sp-4); border: 1px solid var(--line-soft); border-radius: var(--r-md); background: var(--surface-low); }
.review-map-teams a { color: var(--side-blue); font-weight: 700; }
.review-map-teams a:last-child { color: var(--red); }
.review-field-warning { border-color: var(--yellow); background: var(--yellow-soft); }
.review-field-warning input, input.review-field-warning { border-color: var(--yellow); }
.review-field-marker { display: inline-block; margin-left: 5px; color: var(--yellow); font-size: var(--fs-xs); font-weight: 800; }
.review-policy { display: grid; gap: var(--sp-2); margin: var(--sp-3) 0; padding: var(--sp-3) var(--sp-4); border: 1px solid var(--line-soft); border-radius: var(--r-md); background: var(--panel); }
.review-policy-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); }
.review-policy .section-note, .review-policy .notice { margin: 0; }
.review-policy-toggle { display: inline-flex; align-items: center; gap: var(--sp-2); }
.review-policy-toggle[aria-pressed="true"] .review-policy-mode { border-color: var(--on-primary); background: transparent; color: var(--on-primary); }
.review-policy-rules { display: grid; gap: var(--sp-3); margin: 0; padding-left: 20px; color: var(--muted); line-height: 1.5; }
.scoreboard-review main { width: min(1920px, calc(100% - 24px)); }
.scoreboard-review .tournament-card { padding: var(--sp-3); }
.scoreboard-review .tournament-card, .scoreboard-review .focused-review, .scoreboard-review .scoreboard-card-body { overflow: visible; }
.scoreboard-review .review-comparison { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); }
.scoreboard-review .review-original .evidence-image { width: 100%; height: auto; max-height: none; }
.scoreboard-review .review-original:not(.is-zoomed) .evidence-control { max-height: none; overflow: visible; }
.scoreboard-review .review-original.is-zoomed .evidence-image { width: auto; max-width: none; }
.scoreboard-review .review-results .extraction-table { width: 100%; min-width: 0; table-layout: fixed; }
.scoreboard-review .review-results .extraction-table-scroll { overflow-x: visible; }
.scoreboard-review .review-results .extraction-table th { white-space: normal; overflow-wrap: anywhere; }
.scoreboard-review .review-results .extraction-table th:nth-child(1) { width: 7%; }
.scoreboard-review .review-results .extraction-table th:nth-child(2) { width: 44%; }
.scoreboard-review .review-results .extraction-table th:nth-child(3) { width: 20%; }
.scoreboard-review .review-results .extraction-table th:nth-child(4) { width: 29%; }
.scoreboard-review .review-results .extraction-player { min-width: 0; }
.scoreboard-review .review-results .extraction-table td { white-space: normal; overflow-wrap: anywhere; }
.scoreboard-review .extraction-player-meta { display: flex; flex-wrap: wrap; gap: 2px 5px; white-space: normal; color: var(--muted); }
.scoreboard-review .extraction-player-meta > span { white-space: normal; }

/* Series */
.series-score-control { display: grid; gap: var(--sp-2); min-width: 0; }
.series-score-line { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: var(--sp-3); }
.series-review-result .series-score-control, .series-review-preview > .series-score-line { flex: 1; min-width: min(100%, 260px); }
.series-review-preview > .series-review-state, .series-review-preview > .section-note { flex-basis: 100%; margin: 0; }
.series-team-tag { font-size: var(--fs-lg); overflow-wrap: anywhere; }
.series-team-tag:first-child { color: var(--side-blue); }
.series-team-tag:last-child { color: var(--red); text-align: right; }
.series-preview-score { font-size: var(--fs-2xl); font-weight: 800; font-variant-numeric: tabular-nums; }
.series-score-button { padding: var(--sp-2) var(--sp-3); border: 1px dashed var(--blue); border-radius: var(--r-md); background: var(--panel); color: var(--text); font: inherit; font-size: var(--fs-lg); font-weight: 700; text-align: left; }
.series-score-button:hover { background: var(--surface-hover); }
.series-score-control .section-note { margin: 0; }
.series-score-editor:not([hidden]) { display: flex; flex-wrap: wrap; align-items: end; gap: var(--sp-2); }
.series-score-editor label { display: grid; gap: 4px; }
.series-score-editor input { width: 100px; height: 34px; }
.series-score-row { flex-wrap: wrap; }
.series-score-row > span { flex-basis: 100%; }
.series-review-result { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2) var(--sp-3); margin-bottom: var(--sp-2); padding: var(--sp-3) var(--sp-4); border: 1px solid var(--line-soft); border-radius: var(--r-md); background: var(--surface-low); box-shadow: inset 3px 0 0 var(--primary); }
.series-review-score { color: var(--text); font-size: var(--fs-lg); overflow-wrap: anywhere; }
.series-review-state { flex: 1 1 180px; color: var(--muted); font-size: var(--fs-xs); }
.series-dq-panel { padding: var(--sp-2) var(--sp-3); border: 1px solid var(--line-soft); border-radius: var(--r-md); }
.series-dq-panel summary { cursor: pointer; color: var(--yellow); font-weight: 700; }
.series-dq-form { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2) var(--sp-4); }
.series-dq-option { color: var(--text); font-size: var(--fs-sm); }

/* Notifications */
.notification-control { position: relative; }
.notification-control > .icon-button { position: relative; }
.notification-badge { position: absolute; top: -6px; right: -6px; display: grid; place-items: center; min-width: 18px; height: 18px; padding: 0 4px; border: 2px solid var(--bg); border-radius: var(--r-pill); background: var(--primary); color: var(--on-primary); font-size: 10px; font-weight: 800; }
.notification-panel { position: absolute; z-index: 40; top: calc(100% + 10px); right: 0; width: min(380px, calc(100vw - 32px)); overflow: hidden; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--panel); box-shadow: var(--shadow); }
.notification-heading { display: flex; justify-content: space-between; align-items: center; gap: var(--sp-2); padding: var(--sp-4); }
.notification-heading h2 { margin: 0; font-size: var(--fs-lg); }
.notification-status { margin: 0; padding: var(--sp-3) var(--sp-4); border-top: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft); background: var(--surface-low); color: var(--muted); font-size: var(--fs-sm); }
.notification-list { max-height: min(60vh, 400px); margin: 0; padding: 0; overflow-y: auto; list-style: none; }
.notification-group { padding: var(--sp-2) var(--sp-4); background: var(--panel-raised); color: var(--quiet); font-size: var(--fs-2xs); font-weight: 700; letter-spacing: .1em; }
.notification-item { border-bottom: 1px solid var(--line-soft); box-shadow: inset 3px 0 0 transparent; }
.notification-item.is-unread { box-shadow: inset 3px 0 0 var(--primary); }
.notification-link { display: grid; gap: 4px; width: 100%; padding: var(--sp-3) var(--sp-4); border: 0; border-radius: 0; background: transparent; color: var(--text); text-align: left; }
.notification-link:hover { background: var(--surface-hover); text-decoration: none; }
.notification-link strong { font-size: var(--fs-sm); }
.notification-link span, .notification-link small { color: var(--muted); font-size: var(--fs-xs); line-height: 1.5; overflow-wrap: anywhere; }
.notification-link .notification-warning { color: var(--yellow); }
.notification-empty { text-align: left; padding: var(--sp-5) var(--sp-4); }

/* ---------- 6. Data import ---------- */
.stack { display: grid; gap: var(--sp-4); }
.cluster { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); }
.cluster-end { justify-content: flex-end; }
.spread { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--sp-3); }
.card { padding: var(--sp-5); border: 1px solid var(--line-soft); border-radius: var(--r-lg); background: var(--panel); box-shadow: var(--shadow-sm); }
.card > h2, .card > h3 { margin-bottom: var(--sp-1); }
.card-flush { padding: 0; overflow: hidden; }
.card-flush > .card-head { padding: var(--sp-4) var(--sp-5); border-bottom: 1px solid var(--line-soft); }
.muted { color: var(--muted); }
.mono { font-family: ui-monospace, Consolas, monospace; font-size: var(--fs-xs); }
.dropzone { display: grid; justify-items: center; gap: var(--sp-2); padding: var(--sp-8) var(--sp-5); border: 2px dashed var(--line); border-radius: var(--r-lg); background: var(--surface-low); color: var(--muted); text-align: center; cursor: pointer; }
.dropzone:hover, .dropzone.is-dragging, .dropzone:focus-within { border-color: var(--primary); background: var(--blue-soft); }
.dropzone strong { color: var(--text); font-size: var(--fs-lg); }
.dropzone input[type="file"] { position: absolute; width: 1px; height: 1px; opacity: 0; }
.stat-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: var(--sp-2); }
.stat-strip > div { padding: var(--sp-3) var(--sp-4); border: 1px solid var(--line-soft); border-radius: var(--r-md); background: var(--surface-low); }
.stat-strip strong { display: block; font-size: var(--fs-xl); line-height: 1.2; font-variant-numeric: tabular-nums; }
.stat-strip span { color: var(--quiet); font-size: var(--fs-2xs); font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.stat-strip .is-conflict strong { color: var(--red); }
.stat-strip .is-new strong { color: var(--green); }
.row-link { color: var(--text); font-weight: 700; }
.diff-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-3); }
.diff-side { min-width: 0; padding: var(--sp-3) var(--sp-4); border: 1px solid var(--line-soft); border-radius: var(--r-md); background: var(--surface-low); }
.diff-side h4 { margin: 0 0 var(--sp-2); color: var(--quiet); font-size: var(--fs-2xs); font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.diff-side.is-chosen { border-color: var(--green); box-shadow: inset 0 0 0 1px var(--green); }
.diff-list { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px var(--sp-3); margin: 0; font-size: var(--fs-sm); }
.diff-list dt { color: var(--muted); }
.diff-list dd { margin: 0; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.diff-list .is-different { color: var(--yellow); font-weight: 700; }
.conflict-card { display: grid; gap: var(--sp-3); padding: var(--sp-4) var(--sp-5); border: 1px solid var(--line-soft); border-radius: var(--r-lg); background: var(--panel); box-shadow: inset 3px 0 0 var(--red); }
.conflict-card.is-resolved { box-shadow: inset 3px 0 0 var(--green); }
.conflict-card h3 { margin: 0; }
.import-layout { display: grid; gap: var(--sp-4); padding: var(--sp-6) 0 var(--sp-8); }
.import-layout > .hero { padding: 0; }
.inline-form { display: flex; flex-wrap: wrap; align-items: end; gap: var(--sp-2); }
.inline-form > label { display: grid; gap: 6px; flex: 1 1 200px; min-width: 0; }
.steps { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin: 0; padding: 0; list-style: none; counter-reset: step; }
.steps li { display: flex; align-items: center; gap: var(--sp-2); color: var(--muted); font-size: var(--fs-sm); counter-increment: step; }
.steps li::before { content: counter(step); display: grid; place-items: center; width: 22px; height: 22px; border: 1px solid var(--line); border-radius: 50%; color: var(--text); font-size: var(--fs-2xs); font-weight: 700; }
.steps li + li::after { content: ""; order: -1; width: 20px; height: 1px; background: var(--line); }

/* ---------- 7. Responsive ---------- */
@media (min-width: 1600px) { .scoreboard-review .review-comparison { grid-template-columns: minmax(0, 13fr) minmax(0, 7fr); } }
@media (max-width: 1100px) {
  .page-heading { align-items: start; flex-direction: column; gap: var(--sp-4); }
  .stats-sidebar { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
}
@media (max-width: 960px) {
  .topbar { flex-wrap: wrap; gap: 0 var(--sp-3); padding-top: var(--sp-2); }
  .platform-nav { order: 3; flex: 1 0 100%; min-height: 44px; margin: 0 calc(var(--sp-3) * -1); }
  .review-comparison, .scoreboard-review .review-comparison { grid-template-columns: minmax(0, 1fr); }
  .review-original, .scoreboard-review .review-original { position: static; }
  .review-original .evidence-image { max-height: none; }
  .management-layout { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
  main { width: calc(100% - 32px); }
  .hero { padding: var(--sp-6) 0 var(--sp-5); }
  .notification-panel { position: fixed; top: 64px; right: 16px; }
  .extraction-sides { grid-template-columns: 1fr; }
  .review-results .extraction-sides { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .extraction-side-unknown { grid-column: auto; }
  .access-panel { grid-template-columns: 1fr; padding: var(--sp-5); }
  .workspace-heading, .analytics-heading, .leaderboard-heading, .directory-toolbar { align-items: stretch; flex-direction: column; }
  .analytics-filter { width: 100%; }
  #mode-leaders { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filter-panel, #stats-more-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .leaderboard-heading .search-wrap, .directory-toolbar .search-wrap { flex: 0 1 auto; }
  .leaderboard-top-three { min-width: 0; max-width: none; }
  .directory-toolbar .directory-chip { align-self: start; }
  .directory-secondary { display: none; }
  button.directory-mobile-detail { display: inline-flex; margin-top: var(--sp-2); }
  tr.directory-mobile-detail { display: table-row; }
  tr.directory-mobile-detail > td { padding: var(--sp-3); white-space: normal; background: var(--surface-low); }
  .tournament-records { min-width: 620px; }
  .ui-dialog, .upload-dialog { max-height: calc(100dvh - 24px); }
  .stats-sidebar { grid-template-columns: 1fr; }
  .diff-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 480px) {
  .topbar .brand-divider, .topbar .arena-word { display: none; }
  .ui-language select, .ui-theme-button { padding: 0 var(--sp-2); }
  .leaderboard-top-three .top-players-list { grid-template-columns: 1fr; }
  .dialog-header, .dialog-body { padding: var(--sp-4); }
  .dialog-actions { padding: var(--sp-3) var(--sp-4); }
  .dialog-actions > .button { flex: 1 1 auto; }
  .review-navigation { padding: var(--sp-2); }
  .review-navigation-actions { flex-wrap: wrap; gap: var(--sp-2); }
  .review-progress { flex-basis: 100%; order: -1; }
  .review-navigation-actions .button { flex: 1; }
  .review-results .extraction-sides, .public-scoreboard-sides { grid-template-columns: minmax(0, 1fr); }
  .upload-dialog { padding: var(--sp-4); }
  .upload-steps { gap: var(--sp-2); }
  .upload-steps li { gap: 5px; font-size: var(--fs-xs); }
  .upload-summary { gap: 6px; }
  .upload-file-row { align-items: start; flex-direction: column; gap: 6px; }
  .access-form { flex-direction: column; align-items: stretch; }
  .access-form > input, .access-form > label:not(.sr-only) { flex: none; }
  .ranking-controls, .form-row, .compare-controls, .upload-controls, .filter-panel, #stats-more-filters, #mode-leaders { grid-template-columns: minmax(0, 1fr); }
  .compare-versus { padding: 0; text-align: center; }
  .filter-heading { flex-wrap: wrap; }
  .page-actions { width: 100%; }
  .page-actions .button { flex: 1 1 auto; }
  .archive-header { align-items: stretch; flex-direction: column; }
  .upload-controls .button { width: 100%; }
  .public-hierarchy-head { align-items: flex-start; }
  .public-map-card { grid-template-columns: minmax(0, 1fr) auto; }
  .public-map-card .accepted-pill { grid-column: 1 / -1; justify-self: start; }
  .public-scoreboard-sides { overflow-x: auto; }
  footer { flex-direction: column; justify-content: center; gap: var(--sp-1); padding-block: var(--sp-3); }
}

/* ---------- 8. Brand finish (black and GameMind yellow) ---------- */
.topbar .icon-button, .topbar .quiet-button { border-color: var(--topbar-line); color: var(--topbar-muted); }
.topbar .icon-button:hover, .topbar .quiet-button:hover { border-color: var(--brand); background: var(--topbar-hover); color: var(--topbar-text); }
.topbar .notification-badge { border-color: #09090a; }
.ui-language select option { background: #131315; color: #f5f5f0; }
.panel, .card, .metric-card, .filter-panel, .admin-section, .name-corrections, .rating-explainer { background-image: linear-gradient(180deg, rgb(255 255 255 / .018), transparent 120px); }
html[data-theme="light"] .panel, html[data-theme="light"] .card, html[data-theme="light"] .metric-card, html[data-theme="light"] .filter-panel { background-image: none; }
.metric-card { overflow: hidden; }
.metric-card::before { content: ""; position: absolute; inset: 0 0 auto; height: 2px; background: linear-gradient(90deg, var(--brand), transparent 70%); }
.leaderboard-panel { box-shadow: inset 0 2px 0 var(--brand), var(--shadow-sm); }
.button-primary, .small-button.button-primary, .records-review-next { font-weight: 700; }
.button-primary:not(:disabled):hover, .small-button.button-primary:not(:disabled):hover { box-shadow: 0 6px 18px rgb(255 204 0 / .28); }
.button:not(.button-primary):not(.danger-button):not(.button-critical):hover, .small-button:not(.button-primary):not(.danger-button):not(.button-critical):hover { border-color: var(--brand); }
/* Secondary colour for critical actions: destructive or irreversible. */
.button-critical, .small-button.button-critical { border-color: var(--critical); background: var(--critical); color: var(--on-critical); font-weight: 700; }
.button-critical:hover, .small-button.button-critical:hover, .danger-button:not(:disabled):hover { border-color: var(--critical-hover); background: var(--critical-hover); color: var(--on-critical); box-shadow: 0 6px 18px rgb(225 29 72 / .32); }
.danger-button, .small-button.danger-button { font-weight: 700; }
.leaderboard-table tbody tr:nth-child(1) .rank-cell, .leaderboard-table tbody tr:nth-child(2) .rank-cell, .leaderboard-table tbody tr:nth-child(3) .rank-cell { color: var(--blue) !important; }
.top-player-avatar { border-color: var(--brand); }
h1 em { color: var(--brand); }
html[data-theme="light"] h1 em { color: var(--text); background: linear-gradient(transparent 62%, rgb(255 204 0 / .75) 62%); }
.eyebrow i { background: var(--brand); }
.local-badge i { background: var(--brand); box-shadow: 0 0 8px rgb(255 204 0 / .7); }
.steps li::before { border-color: var(--brand); color: var(--blue); }
::selection { background: var(--brand); color: var(--on-brand); }

/* ---------- 9. Success glow (accepted, verified, approved, automated) ---------- */
@keyframes success-pulse { 0%, 100% { box-shadow: var(--success-glow); } 50% { box-shadow: 0 0 0 1px rgb(52 211 153 / .65), 0 0 26px rgb(52 211 153 / .5); } }
.scoreboard-status.status-accepted, .accepted-pill, .badge-new, .badge-promoted,
.upload-file-state.is-ready, .upload-file-state.is-complete, .map-outcome-won { box-shadow: var(--success-glow); }
.extraction-player-name.identity-trigger.is-verified { border-color: color-mix(in srgb, var(--success) 55%, transparent); background: var(--green-soft); color: var(--success); box-shadow: var(--success-glow); }
.series-review-result.is-approved { border-color: color-mix(in srgb, var(--success) 50%, transparent); box-shadow: inset 3px 0 0 var(--success), var(--success-glow); }
.series-review-result.is-approved .series-review-state > span:first-child { color: var(--success); font-weight: 700; text-shadow: 0 0 10px rgb(52 211 153 / .55); }
button.review-policy-toggle[aria-pressed="true"], button.review-policy-toggle[aria-pressed="true"]:hover { border-color: var(--success); background: var(--success); color: #03140c; animation: success-pulse 2.6s ease-in-out infinite; }
.review-policy-toggle[aria-pressed="true"] .review-policy-mode { border-color: #03140c; color: #03140c; }
.conflict-card.is-resolved { box-shadow: inset 3px 0 0 var(--success), var(--success-glow); }
.diff-side.is-chosen { border-color: var(--success); box-shadow: inset 0 0 0 1px var(--success), var(--success-glow); }
.stat-strip .is-new strong, .compare-table td.compare-better { color: var(--success); text-shadow: 0 0 12px rgb(52 211 153 / .45); }
html[data-theme="light"] .stat-strip .is-new strong, html[data-theme="light"] .compare-table td.compare-better,
html[data-theme="light"] .series-review-result.is-approved .series-review-state > span:first-child { text-shadow: none; }
@media (prefers-reduced-motion: reduce) { button.review-policy-toggle[aria-pressed="true"] { animation: none; } }

/* ---------- 10. App components: meta chips, stat pills, fact tiles ---------- */
.meta-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: var(--sp-2); }
.meta-chip { display: inline-flex; align-items: center; gap: 6px; min-height: 28px; padding: 3px 10px; border: 1px solid var(--line-soft); border-radius: var(--r-pill); background: var(--surface-low); color: var(--muted); font-size: var(--fs-xs); font-weight: 600; white-space: nowrap; }
.meta-chip .ui-icon { width: 14px; height: 14px; flex: 0 0 14px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; opacity: .85; }
.meta-chip.is-brand { border-color: color-mix(in srgb, var(--brand) 45%, transparent); background: var(--blue-soft); color: var(--blue); }
.meta-chip.is-good { border-color: color-mix(in srgb, var(--success) 50%, transparent); background: var(--green-soft); color: var(--success); box-shadow: var(--success-glow); }
.meta-chip.is-warn { border-color: color-mix(in srgb, var(--yellow) 45%, transparent); background: var(--yellow-soft); color: var(--yellow); }
.meta-chip.is-bad { border-color: color-mix(in srgb, var(--red) 45%, transparent); background: var(--red-soft); color: var(--red); }
/* Long notes (an MVP with its numbers) wrap inside their card instead of running past it. */
.meta-chip.is-wrap { max-width: 100%; white-space: normal; overflow-wrap: anywhere; border-radius: 12px; line-height: 1.35; }
.stat-pills { display: inline-flex; flex-wrap: wrap; align-items: stretch; gap: 6px; }
.stat-pill { display: inline-flex; align-items: baseline; gap: 6px; min-height: 30px; padding: 4px 12px; border: 1px solid var(--line-soft); border-radius: var(--r-md); background: var(--surface-low); color: var(--muted); font-size: var(--fs-xs); font-weight: 600; white-space: nowrap; }
.stat-pill strong { color: var(--text); font-size: var(--fs-md); font-weight: 800; font-variant-numeric: tabular-nums; }
.stat-pill.is-brand strong { color: var(--blue); }
.stat-pill.is-good { border-color: color-mix(in srgb, var(--success) 40%, transparent); }
.stat-pill.is-good strong { color: var(--success); text-shadow: 0 0 10px rgb(52 211 153 / .45); }
.stat-pill.is-warn { border-color: color-mix(in srgb, var(--yellow) 40%, transparent); }
.stat-pill.is-warn strong { color: var(--yellow); }
.stat-pill.is-bad { border-color: color-mix(in srgb, var(--red) 45%, transparent); background: var(--red-soft); }
.stat-pill.is-bad strong { color: var(--red); }
html[data-theme="light"] .stat-pill.is-good strong { text-shadow: none; }
.fact-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: var(--sp-2); margin: var(--sp-4) 0 0; }
.fact-tile { min-width: 0; padding: 10px var(--sp-3); border: 1px solid var(--line-soft); border-radius: var(--r-md); background: var(--surface-low); }
.fact-tile dt { color: var(--quiet); font-size: var(--fs-2xs); font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.fact-tile dd { margin: 2px 0 0; overflow: hidden; color: var(--text); font-size: var(--fs-md); font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.ocr-progress { display: grid; gap: var(--sp-2); }
.ocr-progress progress { margin: 0; }
.upload-status:has(.stat-pills) { margin-top: var(--sp-2); }
.review-policy-summary { color: var(--muted); font-size: var(--fs-sm); }
.series-review-state { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.series-review-result.is-approved .series-review-state > .meta-chip:first-child { text-shadow: none; }
.hierarchy-card .stat-pills { margin-top: var(--sp-1); }
.submission-summary:has(.meta-chip) { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 6px; }
.dossier-counters { margin: var(--sp-3) 0 var(--sp-4); }
.dossier-modes { display: grid; gap: var(--sp-2); margin: var(--sp-4) 0; }
.account-status .meta-chips { margin: 0 0 var(--sp-2); }

/* Minimum scoreboards for ranking: a compact chip in the leaderboard header. */
.min-chip { display: inline-flex; flex: 0 0 auto; align-items: center; gap: 8px; height: var(--control-h); padding: 0 6px 0 12px; border: 1px solid color-mix(in srgb, var(--brand) 40%, transparent); border-radius: var(--r-pill); background: var(--blue-soft); color: var(--blue); font-size: var(--fs-xs); font-weight: 700; white-space: nowrap; cursor: text; }
.min-chip input { width: 48px; height: 28px; padding: 0 4px; border: 1px solid var(--line-soft); border-radius: var(--r-pill); background: var(--panel); color: var(--text); font-weight: 800; text-align: center; -moz-appearance: textfield; }
.min-chip input::-webkit-inner-spin-button, .min-chip input::-webkit-outer-spin-button { opacity: 1; }
@media (max-width: 760px) { .min-chip { align-self: flex-start; } }

/* ---------- 11. Tournament status and podium ---------- */
.podium { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 200px)); gap: var(--sp-2); margin-top: var(--sp-3); }
.podium-place { display: grid; gap: 2px; padding: 10px var(--sp-3); border: 1px solid var(--line-soft); border-radius: var(--r-md); background: var(--surface-low); }
.podium-place strong { overflow: hidden; color: var(--text); font-size: var(--fs-md); text-overflow: ellipsis; white-space: nowrap; }
.podium-rank { color: var(--quiet); font-size: var(--fs-2xs); font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.podium-place.is-1 { border-color: color-mix(in srgb, var(--brand) 60%, transparent); background: var(--blue-soft); box-shadow: 0 0 18px rgb(255 204 0 / .22); }
.podium-place.is-1 .podium-rank { color: var(--blue); }
.podium-place.is-2 .podium-rank { color: #c9ccd6; }
.podium-place.is-3 .podium-rank { color: #d39a62; }
html[data-theme="light"] .podium-place.is-1 { box-shadow: none; }
html[data-theme="light"] .podium-place.is-2 .podium-rank { color: #6b6f7a; }
html[data-theme="light"] .podium-place.is-3 .podium-rank { color: #9a5a22; }
.standings { grid-column: 1 / -1; display: grid; gap: var(--sp-2); padding-bottom: var(--sp-2); }
.standings .podium { margin-top: 0; }
.status-filter { width: fit-content; max-width: 100%; margin: 0; }
.status-filter > button[aria-pressed="true"]:not(.ui-theme-button) { border-color: var(--line-soft); background: var(--panel); color: var(--text); box-shadow: inset 0 -2px 0 var(--brand), var(--shadow-sm); }
.directory-toolbar { flex-wrap: wrap; }

/* ---------- 12. Easy-to-miss sections: yellow callouts ---------- */
.registration-advanced, .registration-alias-details, .series-dq-panel, .scoreboard-advanced, .attention-callout {
  border: 1px solid color-mix(in srgb, var(--brand) 45%, transparent) !important; border-radius: var(--r-md);
  background: linear-gradient(90deg, rgb(255 204 0 / .10), transparent 55%), var(--surface-low) !important;
  box-shadow: inset 3px 0 0 var(--brand);
}
.registration-advanced > summary, .registration-alias-details > summary, .attention-callout > summary { display: flex; align-items: center; gap: var(--sp-2); color: var(--blue) !important; font-size: var(--fs-sm) !important; font-weight: 700; }
.registration-advanced > summary::after, .registration-alias-details > summary::after, .attention-callout > summary::after {
  content: "!"; display: inline-grid; place-items: center; width: 18px; height: 18px; margin-left: auto; border-radius: 50%;
  background: var(--brand); color: var(--on-brand); font-size: 12px; font-weight: 900; box-shadow: 0 0 10px rgb(255 204 0 / .45);
}
.series-dq-panel > h3, .scoreboard-advanced > h3 { color: var(--blue); }
.tournament-actions-button { border-color: var(--brand) !important; color: var(--blue) !important; box-shadow: 0 0 0 1px rgb(255 204 0 / .2), 0 0 14px rgb(255 204 0 / .18); }
.review-attention { padding: var(--sp-2) var(--sp-3) !important; border: 1px solid color-mix(in srgb, var(--yellow) 45%, transparent); border-radius: var(--r-md); background: var(--yellow-soft); }
html[data-theme="light"] .registration-advanced, html[data-theme="light"] .registration-alias-details, html[data-theme="light"] .series-dq-panel,
html[data-theme="light"] .scoreboard-advanced, html[data-theme="light"] .attention-callout { background: linear-gradient(90deg, rgb(255 204 0 / .22), transparent 60%), var(--surface-low) !important; }

/* ---------- 13. Preview mode, chat, profiles, staff ---------- */
.preview-trigger { border-color: color-mix(in srgb, var(--brand) 55%, transparent) !important; color: var(--brand) !important; font-weight: 700; }
.preview-banner { position: sticky; top: 60px; z-index: 29; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: var(--sp-3); padding: var(--sp-2) var(--sp-4); background: var(--brand); color: var(--on-brand); font-size: var(--fs-sm); }
.preview-banner .small-button { border-color: var(--on-brand); background: var(--on-brand); color: var(--brand); }
.preview-badge { padding: 2px 8px; border: 1px solid var(--on-brand); border-radius: var(--r-pill); font-size: var(--fs-2xs); font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.preview-dialog { width: min(560px, calc(100% - 32px)); }
.preview-dialog .dialog-body { display: grid; gap: var(--sp-3); }
.preview-roles { margin: 0; }
.preview-roles > button[aria-pressed="true"]:not(.ui-theme-button) { border-color: var(--line-soft); background: var(--panel); color: var(--text); box-shadow: inset 0 -2px 0 var(--brand), var(--shadow-sm); }
.chat-button { position: relative; gap: 6px; }
.chat-unread { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: var(--r-pill); background: var(--critical); color: #fff; font-size: 10px; font-weight: 800; }
.chat-dialog { width: min(960px, calc(100% - 32px)); height: min(720px, calc(100dvh - 48px)); }
.chat-body { display: flex; flex: 1 1 auto; min-height: 0; padding: 0; overflow: hidden; }
.chat-body > .chat-thread { padding: var(--sp-4); }
.chat-layout { display: grid; grid-template-columns: minmax(200px, 260px) minmax(0, 1fr); width: 100%; min-height: 0; }
.chat-teams { display: grid; align-content: start; gap: 4px; padding: var(--sp-3); overflow-y: auto; border-right: 1px solid var(--line-soft); background: var(--surface-low); }
.chat-team { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px var(--sp-2); padding: var(--sp-2) var(--sp-3); border: 1px solid transparent; border-radius: var(--r-md); background: transparent; color: var(--text); text-align: left; }
.chat-team small { grid-column: 1; overflow: hidden; color: var(--muted); font-size: var(--fs-xs); text-overflow: ellipsis; white-space: nowrap; }
.chat-team .chat-unread { grid-column: 2; grid-row: 1 / 3; align-self: center; }
.chat-team-name { font-weight: 700; }
.chat-team:hover { background: var(--surface-hover); }
.chat-team[aria-pressed="true"]:not(.ui-theme-button) { border-color: color-mix(in srgb, var(--brand) 45%, transparent); background: var(--blue-soft); color: var(--text); }
.chat-pane { display: flex; flex-direction: column; min-width: 0; min-height: 0; padding: var(--sp-4); }
.chat-pane-head { display: flex; align-items: center; gap: var(--sp-2); padding-bottom: var(--sp-3); border-bottom: 1px solid var(--line-soft); }
.chat-thread { display: flex; flex: 1 1 auto; flex-direction: column; gap: var(--sp-3); width: 100%; min-height: 0; }
.chat-messages { display: flex; flex: 1 1 auto; flex-direction: column; gap: var(--sp-2); min-height: 120px; padding: var(--sp-2) 0; overflow-y: auto; }
.chat-message { max-width: min(76%, 560px); padding: var(--sp-2) var(--sp-3); border: 1px solid var(--line-soft); border-radius: 14px 14px 14px 4px; background: var(--panel-raised); }
.chat-message.is-mine { align-self: flex-end; border-color: color-mix(in srgb, var(--brand) 40%, transparent); border-radius: 14px 14px 4px 14px; background: var(--blue-soft); }
.chat-message p { margin: 2px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.chat-meta { display: flex; gap: var(--sp-2); color: var(--quiet); font-size: var(--fs-2xs); }
.chat-meta strong { color: var(--muted); }
.chat-composer { display: flex; align-items: end; gap: var(--sp-2); }
.chat-composer textarea { flex: 1 1 auto; min-height: 44px; }
.chat-empty { margin: auto; color: var(--muted); font-size: var(--fs-sm); text-align: center; }
.profile-card { margin: 0 0 var(--sp-4); padding: var(--sp-5); }
.profile-card > summary { cursor: pointer; font-size: var(--fs-lg); font-weight: 700; }
.profile-form { display: grid; gap: var(--sp-3); margin-top: var(--sp-3); }
.profile-form h3, .profile-staff h3, .registration-staff h3 { margin: var(--sp-2) 0 0; font-size: var(--fs-sm); color: var(--quiet); letter-spacing: .06em; text-transform: uppercase; }
.profile-form > .button-primary { justify-self: start; }
.profile-head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-4); }
.profile-logo { display: flex; align-items: center; gap: var(--sp-3); }
.profile-logo-frame { display: grid; place-items: center; width: 72px; height: 72px; overflow: hidden; border: 1px solid color-mix(in srgb, var(--brand) 45%, transparent); border-radius: 16px; background: var(--surface-low); }
.profile-logo-frame img { width: 100%; height: 100%; object-fit: cover; }
.profile-logo-empty { color: var(--quiet); font-size: 28px; font-weight: 800; }
.profile-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: var(--sp-3); }
.profile-field { display: grid; gap: 6px; }
.profile-field > span { color: var(--quiet); font-size: var(--fs-2xs); font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.accomplishment-list { display: grid; gap: var(--sp-2); }
.accomplishment-row { display: grid; grid-template-columns: minmax(0, 1fr) 110px auto; gap: var(--sp-2); }
.profile-staff, .registration-staff { display: grid; gap: var(--sp-2); margin-top: var(--sp-3); padding-top: var(--sp-3); border-top: 1px solid var(--line-soft); }
.staff-list { display: grid; gap: 6px; }
.staff-member { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); }
.staff-form { display: grid; grid-template-columns: 130px minmax(0, 1fr) minmax(0, 1fr) auto; gap: var(--sp-2); }
@media (max-width: 760px) {
  .chat-layout { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  .chat-teams { grid-auto-flow: column; grid-auto-columns: minmax(150px, 1fr); overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line-soft); }
  .staff-form, .accomplishment-row { grid-template-columns: minmax(0, 1fr); }
  .preview-banner { top: 0; }
}
.profile-form > .small-button { justify-self: start; }

/* Fact tiles that open more detail */
.fact-tile.is-action { position: relative; cursor: pointer; }
.fact-tile.is-action::after { content: "View \203A"; position: absolute; top: 10px; right: 12px; color: var(--blue); font-size: var(--fs-2xs); font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.fact-tile.is-action:hover, .fact-tile.is-action:focus-visible { border-color: var(--brand); background: var(--blue-soft); }
.registered-teams-dialog { width: min(560px, calc(100% - 32px)); }
.registered-teams-dialog .dialog-body { display: grid; gap: var(--sp-3); }
.registered-team-list { display: grid; gap: 6px; }
.registered-team { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-2) var(--sp-3); border: 1px solid var(--line-soft); border-radius: var(--r-md); background: var(--surface-low); }
.registered-team .registration-team-icon { flex: 0 0 36px; width: 36px; height: 36px; font-size: var(--fs-xs); }
.registered-team-name { display: flex; flex: 1 1 auto; flex-wrap: wrap; align-items: center; gap: var(--sp-2); min-width: 0; }
/* Registered teams on the public tournament page */
.public-registered-teams { padding-top: var(--sp-2); }
.public-registered-teams > .meta-chip { justify-self: start; }
.team-chip { gap: var(--sp-2); padding-right: 6px; color: var(--text); }
.team-chip .team-tag { min-height: 20px; padding: 0 8px; }

/* ---------- 14. Match schedule ---------- */
.match-schedule { display: grid; gap: var(--sp-3); padding: var(--sp-5); }
.match-schedule h2 { margin: 0; }
.schedule-visibility { min-width: 240px; }
.schedule-form { display: grid; grid-template-columns: minmax(120px, 1.2fr) 80px repeat(2, minmax(140px, 1fr)) minmax(180px, 1fr) minmax(120px, .8fr) auto; align-items: end; gap: var(--sp-2);
  padding: var(--sp-3); border: 1px solid var(--line-soft); border-radius: var(--r-md); background: var(--surface-low); }
.schedule-list { display: grid; gap: var(--sp-2); margin: 0; padding: 0; list-style: none; }
.schedule-item { display: grid; gap: var(--sp-2); padding: var(--sp-3) var(--sp-4); border: 1px solid var(--line-soft); border-radius: var(--r-md); background: var(--panel); }
.schedule-item.is-up_next { border-color: var(--brand); box-shadow: inset 3px 0 0 var(--brand), 0 0 18px rgb(255 204 0 / .14); }
.schedule-item.is-completed { box-shadow: inset 3px 0 0 var(--success); }
.schedule-item.is-mine { background: var(--blue-soft); }
.schedule-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.schedule-matchup { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-3); font-size: var(--fs-lg); }
.schedule-team { display: inline-flex; align-items: center; gap: var(--sp-2); }
.schedule-vs { color: var(--quiet); font-size: var(--fs-xs); font-weight: 800; text-transform: uppercase; }
.schedule-score { display: inline-grid; place-items: center; min-width: 28px; height: 28px; border-radius: var(--r-sm); background: var(--panel-raised); color: var(--text); font-weight: 800; font-variant-numeric: tabular-nums; }
.room-form { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)) auto; gap: var(--sp-2); }
.room-box { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.room-field { display: inline-flex; align-items: center; gap: var(--sp-2); padding: 6px 6px 6px 12px; border: 1px solid color-mix(in srgb, var(--brand) 50%, transparent); border-radius: var(--r-md); background: var(--blue-soft); }
.room-field > span { color: var(--quiet); font-size: var(--fs-2xs); font-weight: 800; text-transform: uppercase; }
.room-field > strong { font-family: ui-monospace, Consolas, monospace; font-size: var(--fs-lg); letter-spacing: .04em; }
.team-schedule { display: grid; gap: var(--sp-3); margin-top: var(--sp-3); }
.next-match { display: grid; gap: var(--sp-2); padding: var(--sp-4); border: 1px solid var(--brand); border-radius: var(--r-lg); background: var(--blue-soft); box-shadow: 0 0 22px rgb(255 204 0 / .2); }
.schedule-details { padding: var(--sp-2) var(--sp-3); }
.schedule-details[open] > .schedule-list { margin-top: var(--sp-2); }
.schedule-list.is-compact .schedule-item { padding: var(--sp-2) var(--sp-3); }
.schedule-list.is-compact .schedule-matchup { font-size: var(--fs-md); }
@media (max-width: 960px) { .schedule-form { grid-template-columns: repeat(2, minmax(0, 1fr)); } .room-form { grid-template-columns: minmax(0, 1fr); } }

/* Counters that open what they count */
button.stat-pill.is-action { cursor: pointer; font: inherit; font-size: var(--fs-xs); }
button.stat-pill.is-action::after { content: "\203A"; margin-left: 2px; color: var(--blue); font-weight: 900; }
button.stat-pill.is-action:hover, button.stat-pill.is-action:focus-visible { border-color: var(--brand); background: var(--blue-soft); }
.item-list-dialog { width: min(720px, calc(100% - 32px)); }
.item-list { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.item-row { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); padding: var(--sp-2) var(--sp-3); border: 1px solid var(--line-soft); border-radius: var(--r-md); background: var(--surface-low); }
.item-info { display: grid; gap: 4px; min-width: 0; }
.item-info > strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-info .meta-chips { margin: 0; }
/* Breadcrumbs on every tournament page */
.task-breadcrumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: var(--sp-3); font-size: var(--fs-sm); }
.task-breadcrumbs > a { color: var(--blue); font-weight: 600; }
.task-breadcrumbs > * + *::before { content: "\203A"; margin-right: 6px; color: var(--quiet); }
.task-breadcrumbs > [aria-current="page"] { color: var(--text); font-weight: 700; }
.task-breadcrumbs + .task-back { margin-top: 0; }
/* Community banner under the top bar */
.community-strip { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: var(--sp-2) var(--sp-4); padding: 8px 16px;
  border-bottom: 1px solid color-mix(in srgb, var(--brand) 40%, transparent); background: color-mix(in srgb, var(--brand) 12%, var(--panel)); font-size: var(--fs-sm); }
.community-strip-links { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-3); }
.community-strip-links a { color: var(--text); font-weight: 700; }
.community-strip-links a.community-strip-cta { padding: 4px 12px; border-radius: 999px; background: var(--brand); color: #000; }
/* Admin team directory */
.team-directory { display: grid; gap: var(--sp-3); }
.team-directory-list { display: grid; gap: var(--sp-2); }
.team-directory-row { display: grid; gap: var(--sp-2); padding: var(--sp-3); border: 1px solid var(--line-soft); border-radius: var(--r-md); background: var(--surface-low); }
.team-directory-main { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--sp-3); }
.team-directory-extra:empty { display: none; }
.team-merge-list { display: grid; gap: var(--sp-2); }
.team-merge p { margin: 6px 0; font-weight: 700; }
.team-login-form { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)) auto; align-items: end; gap: var(--sp-2); }
.team-login-form .notice { grid-column: 1 / -1; }
.login-result { display: grid; gap: var(--sp-2); justify-items: start; }
.community-links-settings { padding-top: var(--sp-3); border-top: 1px solid var(--line-soft); }
@media (max-width: 760px) { .team-login-form { grid-template-columns: minmax(0, 1fr); } }
/* Screenshot status card and the back-to-parent button */
.scan-summary { display: grid; gap: var(--sp-2); margin: var(--sp-3) 0; padding: var(--sp-3) var(--sp-4); border: 1px solid var(--line-soft); border-radius: var(--r-md); background: var(--surface-low); }
.scan-summary-title { margin: 0; font-size: var(--fs-sm); }
.scan-summary-row { display: grid; grid-template-columns: 88px minmax(0, 1fr); align-items: center; gap: var(--sp-3); }
.scan-summary-label { color: var(--quiet); font-size: var(--fs-2xs); font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.scan-summary .ocr-progress, .scan-summary .upload-status { margin: 0; }
.scan-summary-row:has(> .ocr-progress[hidden]) { display: none; }
.task-back { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border: 1px solid var(--line-soft); border-radius: 999px; background: var(--panel); color: var(--text); text-decoration: none; }
.task-back::before { content: "\2039"; color: var(--brand); font-size: 1.2em; font-weight: 900; line-height: 1; }
.task-back:hover, .task-back:focus-visible { border-color: var(--brand); background: var(--blue-soft); }
.hierarchy-nav { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-3); margin-bottom: var(--sp-4); }
.hierarchy-nav .task-back, .hierarchy-nav .hierarchy-breadcrumbs { margin: 0; }
@media (max-width: 640px) { .scan-summary-row { grid-template-columns: minmax(0, 1fr); gap: 4px; } }
/* DQ stamp */
.dq-bar { display: flex; flex-wrap: wrap; align-items: flex-start; gap: var(--sp-2); margin-bottom: var(--sp-3); }
.dq-toggle.is-active, .dq-choices .is-active { border-color: var(--critical); background: color-mix(in srgb, var(--critical) 18%, transparent); color: var(--text); }
.dq-toggle::before { content: "\26D4"; margin-right: 6px; }
.dq-choices { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); }
.dq-choices .section-note { flex-basis: 100%; margin: 0; }
.extraction-side { position: relative; }
.extraction-side.is-dq { overflow: hidden; }
.extraction-side.is-dq .extraction-table { opacity: .55; }
.dq-stamp { position: absolute; top: 46%; left: 50%; transform: translate(-50%, -50%) rotate(-14deg); padding: 4px 22px; border: 5px double var(--critical); border-radius: 10px;
  color: var(--critical); font-size: 2.6rem; font-weight: 900; letter-spacing: .12em; pointer-events: none; mix-blend-mode: normal; opacity: .9;
  background: color-mix(in srgb, var(--critical) 8%, transparent); text-shadow: 0 0 1px currentColor; }
/* Tournament pages: details below the work */
.tournament-about { display: grid; gap: var(--sp-3); margin-top: var(--sp-5); padding-top: var(--sp-4); border-top: 1px solid var(--line-soft); }
.tournament-about h3 { margin: 0; font-size: var(--fs-sm); color: var(--quiet); text-transform: uppercase; letter-spacing: .06em; }
.tournament-about .meta-chips { margin: 0; }
/* Auto-accept folds away */
details.review-policy > summary.review-policy-heading { display: flex; align-items: center; gap: var(--sp-2); cursor: pointer; font-weight: 700; list-style: none; }
details.review-policy > summary.review-policy-heading::-webkit-details-marker { display: none; }
details.review-policy > summary.review-policy-heading::after { content: "\203A"; margin-left: auto; color: var(--blue); font-size: 1.3em; transition: transform .15s; }
details.review-policy[open] > summary.review-policy-heading::after { transform: rotate(90deg); }
details.review-policy[open] > summary.review-policy-heading { margin-bottom: var(--sp-3); }
/* Finals MVP on the podium */
.podium-place.is-mvp { border-color: color-mix(in srgb, var(--success) 60%, transparent); background: color-mix(in srgb, var(--success) 10%, var(--panel)); box-shadow: 0 0 18px var(--success-glow); }
.podium-place.is-mvp .podium-rank { color: var(--success); }
.podium-team { color: var(--quiet); font-size: var(--fs-xs); }
.series-mvp select { min-width: min(420px, 100%); }
/* Folded secondary sections */
details.registration-section, details.danger-zone { margin-top: var(--sp-3); padding: var(--sp-3) var(--sp-4); border: 1px solid var(--line-soft); border-radius: var(--r-md); background: var(--surface-low); }
details.registration-section > summary, details.danger-zone > summary { cursor: pointer; font-weight: 700; }
details.registration-section[open] > summary, details.danger-zone[open] > summary { margin-bottom: var(--sp-3); }
details.danger-zone > summary { color: var(--critical); }
/* Stats pages: explanations fold away */
details.stats-note > summary { cursor: pointer; color: var(--quiet); font-size: var(--fs-sm); font-weight: 700; }
details.stats-note[open] > summary { margin-bottom: var(--sp-2); }
/* Mode leaders on a tournament */
.mode-leader-strip { display: grid; gap: var(--sp-2); margin: 0 0 var(--sp-4); padding: 0 var(--sp-5); }
.mode-leader-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: var(--sp-3); }
.tournament-mode-card { display: grid; gap: var(--sp-2); padding: var(--sp-4); border: 1px solid var(--line-soft); border-radius: var(--r-md); background: var(--surface-low); color: inherit; text-decoration: none; }
.tournament-mode-card:hover, .tournament-mode-card:focus-visible { border-color: var(--brand); background: var(--blue-soft); }
.mode-leader-open { color: var(--blue); font-size: var(--fs-xs); font-weight: 800; }
.mode-leader-mode { color: var(--blue); font-size: var(--fs-xs); font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.mode-leader-name { color: var(--text); font-size: var(--fs-lg); font-weight: 800; }
.tournament-mode-card .meta-chips { margin: 0; }
/* Organizer's roster-changes switch */
.roster-switch { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-3); margin-bottom: var(--sp-4); padding: var(--sp-3) var(--sp-4); }
.roster-switch .section-note { flex: 1; margin: 0; }
/* Roster opened under a team in the admin list */
.team-roster-inline { margin: 0 0 var(--sp-3); padding: var(--sp-3) var(--sp-4); border: 1px solid var(--brand); border-radius: var(--r-md); background: var(--surface-low); }
.team-roster-inline .profile-roster h3 { margin-top: 0; }
/* Scan progress percentage */
.ocr-progress-percent, .ocr-task-percent { color: var(--blue); font-size: var(--fs-sm); font-variant-numeric: tabular-nums; font-weight: 800; }
.ocr-progress { display: flex; flex-wrap: wrap; align-items: center; gap: 4px var(--sp-2); }
.ocr-progress > progress { flex: 1 1 200px; }
.ocr-progress > .ocr-progress-counts { flex-basis: 100%; }
.upload-processing > progress { width: calc(100% - 56px); vertical-align: middle; }
.upload-processing > .ocr-progress-percent { display: inline-block; width: 48px; text-align: right; }
/* Activity: scans in progress, from the top bar */
.activity-control { position: relative; }
.activity-button { display: inline-flex; align-items: center; gap: 8px; }
.activity-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--quiet); }
.activity-button.is-active { border-color: var(--brand); color: var(--brand); }
.activity-button.is-active .activity-dot { background: var(--brand); box-shadow: 0 0 0 0 rgb(255 204 0 / .6); animation: activity-pulse 1.6s infinite; }
@keyframes activity-pulse { 70% { box-shadow: 0 0 0 8px rgb(255 204 0 / 0); } 100% { box-shadow: 0 0 0 0 rgb(255 204 0 / 0); } }
@media (prefers-reduced-motion: reduce) { .activity-button.is-active .activity-dot { animation: none; } }
.activity-panel { position: absolute; right: 0; top: calc(100% + 8px); z-index: 60; width: min(420px, calc(100vw - 32px)); max-height: 70vh; overflow: auto;
  padding: var(--sp-3); border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--panel); box-shadow: 0 18px 40px rgb(0 0 0 / .45); }
.activity-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--sp-2); }
.activity-heading h2 { margin: 0; font-size: var(--fs-md); }
.activity-list { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.activity-item { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); padding: var(--sp-2) var(--sp-3); border: 1px solid var(--line-soft); border-radius: var(--r-md); background: var(--surface-low); }
.activity-item.is-scanning { border-color: color-mix(in srgb, var(--brand) 45%, transparent); }
.activity-info { display: grid; gap: 4px; min-width: 0; flex: 1; }
.activity-tournament { color: var(--quiet); font-size: var(--fs-2xs); text-transform: uppercase; letter-spacing: .05em; }
.activity-file { overflow: hidden; font-size: var(--fs-sm); text-overflow: ellipsis; white-space: nowrap; }
.activity-status { display: flex; align-items: center; gap: var(--sp-2); }
.activity-status progress { flex: 1; min-width: 60px; }
.activity-percent { color: var(--blue); font-size: var(--fs-xs); font-variant-numeric: tabular-nums; font-weight: 800; }
.upload-modes { width: fit-content; max-width: 100%; margin: 0 0 var(--sp-3); }
.video-scan { display: grid; gap: var(--sp-2); margin-top: var(--sp-3); padding: var(--sp-4); border: 1px dashed var(--line-soft); border-radius: var(--r-lg); }
.video-scan .section-note { margin: 0; }
.video-scan-form { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(110px, 0.6fr) auto auto; gap: var(--sp-2); align-items: end; }
.video-scan-field { display: grid; gap: 4px; min-width: 0; font-size: var(--fs-xs); font-weight: 600; }
.video-scan-field input { min-width: 0; }
/* Video scan progress card: heading with state, a bar over the video's length, four figures, then the series found. */
.video-progress { margin: 0; }
.video-progress-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 4px var(--sp-2); }
.video-progress-bar > progress { flex: 1 1 200px; margin: 0; }
.video-progress-head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); min-width: 0; }
.video-progress-title { flex: 1 1 200px; min-width: 0; overflow: hidden; color: var(--quiet); font-size: var(--fs-xs); text-overflow: ellipsis; white-space: nowrap; }
.video-progress-figures { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: var(--sp-2); margin: 0; }
.video-progress-figures > div { display: grid; gap: 2px; min-width: 0; padding: var(--sp-2) var(--sp-3); border: 1px solid var(--line-soft); border-radius: var(--r-md); background: var(--panel); }
.video-progress-figures dt { color: var(--quiet); font-size: var(--fs-2xs); font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.video-progress-figures dd { margin: 0; color: var(--text); font-size: var(--fs-sm); font-variant-numeric: tabular-nums; font-weight: 700; overflow-wrap: anywhere; }
.video-scan-series { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; font-size: var(--fs-xs); }
.video-series-row { display: flex; flex-wrap: wrap; align-items: center; gap: 4px var(--sp-2); padding: 6px var(--sp-3); border-radius: var(--r-md); background: var(--panel); }
.video-series-time { color: var(--quiet); font-variant-numeric: tabular-nums; }
.video-series-players { flex: 1 1 100%; color: var(--text); overflow-wrap: anywhere; }
@media (max-width: 640px) { .video-scan-form { grid-template-columns: minmax(0, 1fr); } }

/* Workspace loading: the GameMind mark inside a hexagon that traces itself, shown while a saved session is restored
   (instead of the sign-in form flashing up on every page). */
.workspace-loading { display: none; justify-items: center; gap: var(--sp-3); padding: 72px var(--sp-4); color: var(--quiet); font-size: var(--fs-sm); font-weight: 600; }
html.restoring .workspace-loading { display: grid; }
html.restoring #access-panel { display: none; }
.loader-mark { position: relative; width: 84px; height: 84px; }
.loader-mark svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.loader-mark polygon { fill: none; stroke-width: 4; stroke-linejoin: round; }
.loader-hex-track { stroke: color-mix(in srgb, var(--brand) 18%, transparent); }
.loader-hex { stroke: var(--brand); stroke-dasharray: 28 72; stroke-linecap: round; animation: loader-trace 1.1s linear infinite; }
.loader-mark img { position: absolute; inset: 22%; width: 56%; height: 56%; object-fit: contain; animation: loader-pulse 1.1s ease-in-out infinite; }
@keyframes loader-trace { to { stroke-dashoffset: -100; } }
@keyframes loader-pulse { 50% { transform: scale(0.9); opacity: 0.75; } }
@media (prefers-reduced-motion: reduce) { .loader-hex, .loader-mark img { animation: none; } }
/* The same mark over the page while an action someone started is running, with what it is doing. */
.action-loading { position: fixed; inset: 0; z-index: 1000; width: auto; height: auto; max-width: none; max-height: none; margin: 0; padding: var(--sp-4); border: 0;
  display: none; place-content: center; justify-items: center; gap: var(--sp-3); background: color-mix(in srgb, var(--bg) 72%, transparent);
  color: var(--text); font-size: var(--fs-sm); font-weight: 700; text-align: center; backdrop-filter: blur(2px); }
.action-loading.is-shown { display: grid; }
.action-loading::backdrop { background: transparent; }
.action-loading p { margin: 0; max-width: 32ch; }

/* ---------- 13. Refresh: controls, page headers, profiles ----------
   One look for every dropdown, a small Back button and a tidy header on every page, and profile sections
   that read the same everywhere. */
:root { --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23a1a1aa' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 6l4 4 4-4'/%3E%3C/svg%3E");
  --shadow-pop: 0 18px 40px -12px rgb(0 0 0 / .55), 0 2px 6px rgb(0 0 0 / .25); }
html[data-theme="light"] { --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%2352525b' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 6l4 4 4-4'/%3E%3C/svg%3E");
  --shadow-pop: 0 18px 40px -14px rgb(30 25 10 / .22), 0 2px 6px rgb(30 25 10 / .08); }

/* Dropdowns: the browser's own arrow and the searchable list share one chevron. */
select:not([multiple]):not([size]) { appearance: none; -webkit-appearance: none; padding-right: 36px; background-image: var(--chevron);
  background-repeat: no-repeat; background-position: right 12px center; background-size: 16px 16px; cursor: pointer; text-overflow: ellipsis; }
.ui-language select:not([multiple]) { padding-right: 28px; background-position: right 8px center; background-size: 14px 14px; }
.search-select-trigger { cursor: pointer; }
.search-select-chevron { flex: 0 0 16px; width: 16px; height: 16px; font-size: 0; background: var(--chevron) center / 16px 16px no-repeat; transition: transform var(--ease); }
.search-select-trigger[aria-expanded="true"] .search-select-chevron { transform: rotate(180deg); }
.search-select-trigger:focus-visible { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 28%, transparent); outline: none; }
/* The list floats over the page instead of pushing everything below it down. */
.search-select-panel { position: absolute; z-index: 45; top: calc(var(--control-h) + 6px); left: 0; right: 0; min-width: 220px; border-radius: var(--r-lg);
  box-shadow: var(--shadow-pop); animation: pop-in 120ms ease-out; }
.search-select-option { border-radius: var(--r-md); }
@keyframes pop-in { from { opacity: 0; transform: translateY(-4px); } }

/* On/off settings read as a switch. */
.hide-low-chip { gap: 10px; padding: 0 14px 0 8px; cursor: pointer; }
.hide-low-chip input[type="checkbox"] { position: relative; flex: 0 0 34px; width: 34px; height: 20px; padding: 0; border: 0; border-radius: var(--r-pill);
  appearance: none; -webkit-appearance: none; background: var(--line); cursor: pointer; transition: background-color var(--ease); }
.hide-low-chip input[type="checkbox"]::after { content: ""; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%;
  background: var(--text); box-shadow: 0 1px 2px rgb(0 0 0 / .35); transition: transform var(--ease), background-color var(--ease); }
.hide-low-chip input[type="checkbox"]:checked { background: var(--primary); }
.hide-low-chip input[type="checkbox"]:checked::after { transform: translateX(14px); background: var(--on-primary); }

/* Expandable panels: a plus that turns into a cross when open. */
.summary-toggle { position: relative; display: inline-block; flex: 0 0 auto; width: 14px; height: 14px; transition: transform var(--ease); }
.summary-toggle::before, .summary-toggle::after { content: ""; position: absolute; top: 6px; left: 0; width: 14px; height: 2px; border-radius: 2px; background: var(--blue); }
.summary-toggle::after { transform: rotate(90deg); }
details[open] > summary .summary-toggle { transform: rotate(45deg); }
.rating-explainer summary { align-items: center; list-style: none; }
.rating-explainer summary::-webkit-details-marker { display: none; }

/* Page headers: trail with a small Back button, title, one line of description, then the key facts. */
.hero.page-heading { align-items: end; padding: var(--sp-6) 0 var(--sp-5); margin-bottom: var(--sp-4); border-bottom: 1px solid var(--line-soft); }
.hero.page-heading h1 { margin-bottom: var(--sp-1); overflow-wrap: anywhere; }
.breadcrumbs, .page-trail { gap: 6px var(--sp-2); margin-bottom: var(--sp-3); font-size: var(--fs-xs); font-weight: 600; }
.breadcrumbs a, .page-trail a { color: var(--muted); }
.breadcrumbs a:hover, .page-trail a:hover { color: var(--brand); text-decoration: none; }
.breadcrumbs > :last-child, .page-trail [aria-current="page"] { color: var(--text); }
.page-trail .hierarchy-breadcrumbs { display: contents; }
.page-trail .hierarchy-breadcrumbs > * + *::before { content: "/"; margin-right: var(--sp-2); color: var(--quiet); }
.back-button { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 12px 0 9px; margin-right: var(--sp-1); border: 1px solid var(--line);
  border-radius: var(--r-pill); background: var(--surface-low); color: var(--text) !important; font-size: var(--fs-xs); font-weight: 700; line-height: 1; }
.back-button::before { content: ""; width: 14px; height: 14px; background: var(--chevron) center / 14px no-repeat; transform: rotate(90deg); }
.back-button:hover { border-color: var(--brand); background: var(--surface-hover); text-decoration: none; }
.page-facts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: var(--sp-3); }
.page-facts .meta-chip { min-height: 26px; }

/* Profiles and dossiers: each part is a titled section; numbers sit in an even grid. */
.player-detail { padding: var(--sp-5) var(--sp-6) var(--sp-6); }
.dossier-section { margin-top: var(--sp-5); padding-top: var(--sp-5); border-top: 1px solid var(--line-soft); }
.dossier-section > h3, .history-title, .dossier-modes > .section-kicker { margin: 0 0 var(--sp-3); color: var(--quiet); font-size: var(--fs-2xs); font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.dossier-columns { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: var(--sp-5); }
.dossier-columns > .dossier-section { margin-top: 0; }
.dossier-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); margin: 0; }
.dossier-metric { padding: var(--sp-3) var(--sp-4); border-radius: var(--r-lg); background: var(--surface-low); }
.dossier-metric small { font-weight: 700; letter-spacing: .08em; }
.dossier-metric strong { font-size: var(--fs-xl); line-height: 1.2; }
.dossier-caption { color: var(--muted); font-size: var(--fs-sm); }
.team-mode-maps { margin: 0; }
.team-map-list { margin: var(--sp-2) 0 0; padding: 0; list-style: none; }
.team-map-list li { display: flex; justify-content: space-between; gap: var(--sp-3); padding: 6px 0; border-bottom: 1px solid var(--line-soft); font-size: var(--fs-sm); }
.team-map-list li:last-child { border-bottom: 0; }
.team-map-list li:first-child span { color: var(--text); font-weight: 700; }
.best-player-line { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--sp-2); }
.best-player-line .player-link { font-size: var(--fs-lg); }
.played-list { display: grid; margin: 0; }
.played-list a, .played-list > div { display: flex; justify-content: space-between; gap: var(--sp-3); padding: var(--sp-2) 0; border-bottom: 1px solid var(--line-soft); color: var(--text); font-size: var(--fs-sm); font-weight: 600; }
.played-list a:hover { color: var(--brand); text-decoration: none; }
.played-list span { color: var(--muted); font-weight: 500; white-space: nowrap; }
.profile-hero-rating { text-align: right; }
.profile-hero-rating strong { display: block; color: var(--blue); font-size: 34px; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.profile-hero-rating small { color: var(--quiet); font-size: var(--fs-2xs); font-weight: 800; letter-spacing: .12em; }

/* Filters on the insights pages sit in the same kind of panel as on Player stats. */
.insights-filter-panel { display: grid; gap: var(--sp-3); margin-bottom: var(--sp-4); padding: var(--sp-4); border: 1px solid var(--line-soft); border-radius: var(--r-lg); background: var(--panel); }
.insights-filter-panel .analytics-filter { width: 100%; }
.insights-filter-panel .tournament-selector { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: var(--sp-3); align-items: end; }
.insights-filter-panel .insights-filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: var(--sp-3); margin: 0; }
.insights-filter-panel .filter-heading-actions { justify-content: flex-start; }
@media (max-width: 640px) { .hero.page-heading { padding-top: var(--sp-4); } .profile-hero-rating { text-align: left; } }
.dossier-columns > .dossier-section { padding-top: 0; border-top: 0; }
#team-page #team-dossier { margin-top: 0; padding: var(--sp-1) var(--sp-2) var(--sp-2); border: 0; background: none; box-shadow: none; }
.insights-filter-panel .tournament-selector > button { justify-self: start; align-self: end; }
/* Workspace trail and Back read like the public page headers. */
.task-breadcrumbs { gap: 6px var(--sp-2); font-size: var(--fs-xs); font-weight: 600; }
.task-breadcrumbs > a { color: var(--muted); font-weight: 600; }
.task-breadcrumbs > a:hover { color: var(--brand); text-decoration: none; }
.task-breadcrumbs > * + *::before { content: "/"; margin-right: var(--sp-2); }
.task-back { height: 28px; padding: 0 12px 0 9px; border-color: var(--line); background: var(--surface-low); font-size: var(--fs-xs); font-weight: 700; }
.task-back::before { content: ""; width: 14px; height: 14px; background: var(--chevron) center / 14px no-repeat; transform: rotate(90deg); }
.leaderboard-more td { padding: var(--sp-3); text-align: center; background: var(--surface-low); }
.leaderboard-more:hover { background: transparent; }
/* The workspace review trail (Stages / Group stage / Day 7) matches the other trails. */
.hierarchy-breadcrumbs { font-size: var(--fs-xs); font-weight: 600; }
.hierarchy-breadcrumbs > a { color: var(--muted); }
.hierarchy-breadcrumbs > a:hover { color: var(--brand); text-decoration: none; }
/* Gun role picker in a roster row, and the role changes list on a profile. */
.gun-role-select:not([multiple]) { width: auto; min-width: 128px; height: var(--control-h-sm); font-size: var(--fs-xs); }
.played-list > .history-title { margin: var(--sp-4) 0 var(--sp-1); }
/* Admin pages: the way back reads like every other Back button. */
.admin-back { display: inline-flex; align-items: center; gap: 6px; width: fit-content; height: 28px; padding: 0 12px 0 9px; margin-bottom: var(--sp-3); border: 1px solid var(--line); border-radius: var(--r-pill); background: var(--surface-low); color: var(--text); font-size: var(--fs-xs); font-weight: 700; }
.admin-back:hover { border-color: var(--brand); background: var(--surface-hover); color: var(--text); text-decoration: none; }
/* Podium tiles share the width, so the MVP cards sit beside the places instead of on a row of their own. */
.podium { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
/* Series cards can be dragged into order (grip, or the ‹ › buttons for keyboard and touch). */
.hierarchy-series-card[draggable="true"] { position: relative; cursor: grab; }
.hierarchy-series-card.is-dragging { opacity: .45; outline: 2px dashed var(--brand); outline-offset: 2px; cursor: grabbing; }
.series-move { position: absolute; top: var(--sp-3); right: var(--sp-3); display: inline-flex; align-items: center; gap: 2px; }
.series-grip { width: 14px; height: 18px; margin-right: 4px; opacity: .55; background: radial-gradient(circle, var(--muted) 1.3px, transparent 1.6px) 0 0 / 7px 6px; }
.series-move-button { display: inline-grid; place-items: center; width: 24px; height: 24px; padding: 0; border: 1px solid var(--line-soft); border-radius: var(--r-sm); background: var(--surface-low); color: var(--muted); font-size: var(--fs-md); font-weight: 800; line-height: 1; }
.series-move-button:hover { border-color: var(--brand); color: var(--text); }
/* A series card lists its maps as chips; a chip can be dragged onto another series card to move that scoreboard. */
.series-map-chips { display: flex; flex-wrap: wrap; gap: 4px; margin: var(--sp-2) 0; }
.series-map-chip { display: inline-flex; align-items: center; min-height: 24px; padding: 2px 8px; border: 1px solid var(--line-soft); border-radius: var(--r-pill); background: var(--surface-low); color: var(--muted); font-size: var(--fs-2xs); font-weight: 700; letter-spacing: .02em; font-variant-numeric: tabular-nums; }
button.series-map-chip { cursor: grab; }
button.series-map-chip:hover { border-color: var(--brand); color: var(--text); }
.series-map-chip.needs-map { border-style: dashed; border-color: var(--warn, var(--brand)); color: var(--text); }
.series-map-chip.is-dragging { opacity: .45; }
.hierarchy-series-card.is-drop-target { outline: 2px solid var(--brand); outline-offset: 2px; background: var(--blue-soft); }
.series-move-option { display: flex; width: 100%; justify-content: flex-start; margin-top: var(--sp-2); }
/* Deleting from the series grid: a Delete button per series card, an × per map chip. */
.series-map-item { display: inline-flex; align-items: center; }
.series-map-item > .series-map-chip { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.series-map-remove { display: inline-grid; place-items: center; min-height: 24px; width: 22px; padding: 0; border: 1px solid var(--line-soft); border-left: 0; border-radius: 0 var(--r-pill) var(--r-pill) 0; background: var(--surface-low); color: var(--quiet); font-size: var(--fs-sm); line-height: 1; }
.series-map-remove:hover { border-color: var(--danger); background: var(--red-soft); color: var(--red); }
.series-delete { margin-top: var(--sp-2); margin-left: var(--sp-2); }
.public-team-table .team-tag { margin-left: var(--sp-2); }
.public-team-table td.is-good { color: var(--green); }
.public-team-table td.is-bad { color: var(--red); }
.public-team-table tr.is-place-1 .rank-cell { color: var(--gold, var(--accent)); font-weight: 800; }
