/* Roboto and the 16/24, 14/20, 20/28 type scale follow Companion's text variants. */
body { background: var(--page); font: 16px/24px var(--sans); font-variant-numeric: tabular-nums; }
.masthead, main { width: min(1240px, calc(100% - 48px)); }
.site-header { background: var(--navy); color: #fff; border-bottom: 1px solid var(--line); }
.masthead { min-height: 68px; padding: 0; border: 0; display: flex; gap: 32px; align-items: center; }
.brand { font: 900 26px/32px var(--sans); color: #fff; letter-spacing: 0; }
.masthead nav { margin: 0; gap: 0; font-size: 16px; font-weight: 500; }
.masthead nav a, .masthead nav a:first-child { display: flex; align-items: center; padding: 0 18px; min-height: 68px; color: #dde4ef; border-block: 3px solid transparent; }
.candidates-page .masthead nav a:first-child { display: flex; }
.masthead nav a:hover, .masthead nav [aria-current=page] { background: var(--hover); color: #fff; border-bottom-color: var(--brand); text-decoration: none; }
.site-header a:focus-visible { outline-color: #d9eaff; outline-offset: -4px; }
main { padding: 0; border: 0; background: transparent; }
h1, h2, .archive-heading h2, dialog h2 { font-family: var(--sans); font-weight: 700; letter-spacing: 0; }
h1, dialog h2 { font-size: 24px; line-height: 32px; }
h2, .section-heading h2, .archive-heading h2, .rival-section .section-heading h2, .profile-section h2 { font-size: 20px; line-height: 28px; }
.intro { padding: 20px 0; border: 0; margin: 0; gap: 20px; min-height: 84px; }
.facts { font-size: 14px; line-height: 20px; }
.facts b { font-weight: 700; }
.facts span { margin-inline: 8px; color: var(--muted); }
.sync { font-size: 14px; line-height: 20px; gap: 12px; }
* { scrollbar-width: thin; scrollbar-color: #546079 transparent; }
select, input, .refresh, .page-button { background: var(--input); color: var(--ink); border: 1px solid var(--rule); border-radius: 4px; }
input, select { font-family: var(--sans); font-size: 16px; line-height: 24px; min-height: 44px; padding: 9px 12px; }
.main-filters input, .main-filters select, .player-picker>input { font-size: 16px; line-height: 24px; }
select { padding-right: 28px; }
select option { background: var(--input); color: var(--ink); }
input::placeholder { color: var(--muted); }
.refresh { font-size: 14px; min-height: 40px; padding: 8px 12px; gap: 8px; }
.refresh span { font-size: 22px; }
.refresh:hover, .page-button:hover:not(:disabled) { border-color: #697da8; background: var(--hover); }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.overview { grid-template-columns: minmax(0,1.55fr) minmax(360px,1fr); gap: 24px; margin-bottom: 28px; align-items: start; }
.ladder-section, .rival-section, .profile-section { min-width: 0; background: var(--paper); border: 1px solid var(--line); border-radius: 6px; padding: 20px; }
.section-heading { min-height: 44px; }
.ladder-section .section-heading { border: 0; padding: 0; margin-bottom: 16px; }
.section-heading select { font-size: 16px; min-height: 44px; max-width: 220px; }
.roster-search { margin-bottom: 16px; }
.standings-table th { background: var(--surface); border-block: 1px solid var(--line); font-size: 14px; line-height: 20px; padding: 10px 8px; }
.standings-table th:first-child { width: 32px; }
.standings-table th:nth-child(2) { width: 40%; }
.standings-table th:nth-child(3) { width: 16%; }
.standings-table th:nth-child(4) { width: 22%; }
.standings-table td { height: 64px; padding: 12px 8px; }
.standings-table td:first-child { font-size: 14px; }
.standings-table .person-name { font-size: 16px; line-height: 24px; font-weight: 500; color: var(--ink); }
.standings-table .person-name:hover { color: var(--accent); }
.standings-table .elo { font: 500 18px/26px var(--sans); letter-spacing: 0; }
.standings-table tbody tr:first-child .elo { color: var(--ink); }
.standings-table tbody tr:hover { background: var(--hover); }
.standings-table small, .standings-table .elo small { font: 400 12px/16px var(--sans); letter-spacing: 0; margin-top: 2px; }
.standings-table .rating-meta { display: none; }
.record, .streak { font: 400 14px/20px var(--sans); }
.negative, .form-chip.loss { color: var(--red); }
.form-chip.loss { border-color: var(--red); }
.table-note { font-size: 14px; line-height: 20px; }
.roster-pagination, .pagination { font: 400 14px/20px var(--sans); margin-top: 16px; flex-wrap: wrap; }
.page-button { font-size: 14px; line-height: 20px; min-height: 40px; padding: 9px 14px; }
.rival-section { color: var(--ink); }
.rival-section .section-heading { margin: 0 0 16px; min-height: 44px; }
.rival-section select, .pair-picker .player-picker>input { background: var(--input); border-color: var(--rule); color: var(--ink); }
.pair-picker .player-picker>input { font-size: 16px; font-weight: 500; }
.versus { color: var(--muted); font-size: 18px; }
.rival-controls { gap: 12px; margin-bottom: 16px; }
.rival-controls select { font-size: 16px; margin-top: 6px; }
.rival-controls label, .player-field>label, .main-filters label, .profile-controls label, .profile-history-filters>label, .candidate-filters label { font-size: 14px; line-height: 20px; }
.score-lines { margin-top: 16px; display: block; }
.score-line { display: grid; border-color: var(--line); grid-template-columns: minmax(0,1fr) 112px; padding: 20px 0; }
.score { font: 700 36px/40px var(--sans); letter-spacing: 0; color: var(--muted); }
.score .leading { color: var(--ink); }
.score i { font: 400 24px/32px var(--sans); color: var(--muted); }
.score-label { color: var(--ink); font-size: 16px; line-height: 24px; }
.score-label small, .encounter small, .rival-section .result-note { color: var(--muted); font-size: 14px; line-height: 20px; min-height: 0; }
.encounters, .rival-all { border-color: var(--line); }
.encounters h3 { color: var(--muted); font-size: 14px; line-height: 20px; font-weight: 500; text-transform: none; letter-spacing: 0; margin-bottom: 8px; }
.encounter { padding-block: 12px; border-bottom: 1px solid var(--line); color: var(--ink); font-size: 16px; line-height: 24px; }
.encounter:last-child { border-bottom: 0; }
.encounter .winner { color: var(--accent); font-size: 14px; }
.encounter:hover, .rival-all:hover { color: var(--accent); }
.rival-all { color: var(--accent); font-size: 14px; line-height: 20px; margin-top: 8px; padding-top: 14px; }
.rival-section .empty, .rival-section .load-error { color: var(--muted); }
.archive { min-width: 0; border: 0; background: transparent; padding: 0; }
.archive-heading { padding: 0 0 16px; }
.archive-heading>span { font-size: 14px; line-height: 20px; }
.archive-tabs { display: flex; width: fit-content; max-width: 100%; gap: 4px; padding: 4px; border: 1px solid var(--line); border-radius: 6px; background: var(--input); margin-bottom: 20px; }
.archive-tabs button { padding: 10px 16px; border: 0; border-radius: 4px; font-size: 16px; line-height: 24px; white-space: nowrap; }
.archive-tabs button[aria-pressed=true] { background: var(--hover); color: var(--brand); font-weight: 500; }
.main-filters select, .main-filters input, .player-picker>input, .month-filter input { background: var(--input); }
.main-filters { gap: 16px; grid-template-columns: 1fr 1fr 1fr 1.5fr; align-items: end; }
.main-filters .search-label { gap: 6px; }
.filters { margin-bottom: 20px; padding: 20px; border: 1px solid var(--line); border-radius: 6px; background: var(--paper); }
.filter-details { margin-top: 14px; }
.filter-details>summary { color: var(--accent); font-size: 14px; line-height: 20px; cursor: pointer; width: fit-content; padding-block: 6px; }
.extra-filters { gap: 14px; padding: 16px; margin-top: 8px; background: var(--surface); border-radius: 4px; }
.extra-filters select { border: 1px solid var(--rule); padding: 9px 28px 9px 12px; font-size: 16px; min-height: 44px; color: var(--ink); }
.month-filter { font-size: 14px; line-height: 20px; }
.month-filter input { min-height: 44px; font-size: 16px; }
.text-button { font-size: 14px; line-height: 20px; min-height: 40px; }
#matches { display: grid; gap: 12px; }
.match-head { display: none; }
.match-card { display: grid; grid-template-columns: minmax(220px,.9fr) minmax(0,2fr) 110px; align-items: center; gap: 24px; padding: 20px; border: 1px solid var(--line); border-radius: 6px; background: var(--paper); min-height: 132px; }
.match-card:hover { background: #1c2231; border-color: #3c4760; }
.match-card .match-map { display: flex; align-items: center; gap: 16px; min-width: 0; }
.match-map>div { min-width: 0; }
.match-map b { display: block; font: 700 18px/26px var(--sans); overflow-wrap: anywhere; }
.map-thumbnail { display: block; width: 80px; height: 80px; flex: 0 0 80px; object-fit: contain; border-radius: 4px; background: var(--input); }
.map-thumbnail--unknown { display: grid; place-items: center; color: #6e7b97; }
.map-thumbnail--unknown svg { width: 36px; height: 36px; }
.match-map small { margin-top: 6px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; font-size: 14px; line-height: 20px; }
.queue-badge { padding: 2px 8px; border-radius: 3px; background: #26334e; color: #bfd1ff; }
.queue-badge.custom { background: var(--surface); color: var(--muted); }
.match-sides { display: grid; grid-template-columns: minmax(0,1fr) 24px minmax(0,1fr); gap: 10px; align-items: center; min-width: 0; }
.match-side { min-width: 0; padding: 12px; border: 1px solid var(--line); border-radius: 4px; background: var(--input); }
.match-side--win { border-left: 2px solid #426d58; }
.match-side--loss { border-left: 2px solid #744a52; }
.match-side .result-label { position: static; display: block; width: auto; height: auto; overflow: visible; clip-path: none; white-space: normal; text-transform: none; letter-spacing: 0; font-size: 14px; line-height: 20px; margin: 0 0 8px; }
.match-side--unknown { grid-column: 1 / -1; }
.match-side--unknown .result-label { color: var(--muted); }
.match-versus { text-align: center; color: var(--muted); font-size: 14px; }
.match-side .player-line { display: grid; gap: 10px; }
.player-line { font-size: 16px; line-height: 24px; color: var(--ink); }
.player-line a, .match-link { color: var(--accent); }
.match-player { display: flex; align-items: center; gap: 10px; min-width: 0; font-size: 16px; line-height: 24px; }
.match-player>span { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.match-player a, .match-player b { color: var(--ink); font-size: 16px; font-weight: 500; }
.match-player a:hover { color: var(--accent); }
.match-player small { display: block; font-size: 14px; line-height: 20px; color: var(--muted); margin-top: 2px; }
.match-player .civ-emblem { width: 32px; height: 32px; flex: 0 0 32px; margin: 0; }
.match-player .player-rating { font-size: 16px; color: var(--muted); flex: 0 0 auto; font-weight: 400; }
.match-card .match-action { text-align: right; }
.match-card .match-date { display: block; font-size: 14px; line-height: 20px; color: var(--muted); }
.match-card .match-date small { display: block; font-size: 14px; line-height: 20px; margin-top: 2px; }
.match-link, .match-card .match-link { min-height: 40px; padding: 8px 0; font-size: 14px; line-height: 20px; font-weight: 500; }
.match-id, .match-card .match-id { font: 400 12px/16px var(--sans); }
.player-options { background: var(--paper); border-color: var(--rule); box-shadow: 0 8px 20px #0005; border-radius: 4px; }
.player-choice { color: var(--ink); font-size: 16px; line-height: 24px; padding: 12px; }
.player-choice.active, .player-choice:hover { background: var(--hover); }
.player-choice small { color: var(--muted); font-size: 12px; line-height: 16px; }
.player-no-results { font-size: 14px; line-height: 20px; }
.player-picker::after { top: 12px; }
dialog { border: 1px solid var(--rule); border-radius: 6px; background: var(--paper); }
dialog::backdrop { background: #0e1017cc; }
.dialog-top { letter-spacing: 0; font-size: 14px; line-height: 20px; }
.close { width: 44px; height: 44px; font-size: 28px; }
#about-dialog p { color: var(--muted); font-size: 16px; line-height: 26px; }
.match-meta, .team h3, .team-player .delta, .setting, .source-link { font-size: 14px; line-height: 20px; }
.team-player { font-size: 16px; line-height: 24px; }
.team-player small, .setting small, .match-note, .unknown-note, .match-sources .muted { font-size: 14px; line-height: 20px; }
.civ-emblem { width: 32px; height: 32px; object-fit: contain; vertical-align: middle; margin-right: 8px; }
.team-player>.civ-emblem { width: 36px; height: 36px; margin-right: 0; flex-shrink: 0; }
.team-player>div { min-width: 0; overflow-wrap: anywhere; }
.section-label { font-size: 18px; line-height: 26px; }
.empty, .loading-state, .load-error, .notice { font-size: 16px; line-height: 24px; }
footer { flex-wrap: wrap; padding: 0 0 24px; margin-top: 28px; border: 0; gap: 12px 20px; }
.footer-brand { font: 700 16px/24px var(--sans); letter-spacing: 0; color: var(--muted); }
footer p, footer .game-credit { font-size: 14px; line-height: 20px; color: var(--muted); }
footer .game-credit { flex-basis: 100%; }
.game-credit summary { width: fit-content; cursor: pointer; }
.game-credit p { padding-top: 8px; max-width: 850px; line-height: 24px; }
.game-credit a { text-decoration: underline; }
#profile-content { max-width: 1240px; }
.profile-heading, .candidate-intro { padding-block: 28px; border-bottom: 1px solid var(--line); }
.profile-heading h1, .candidate-intro h1 { font: 900 36px/40px var(--sans); letter-spacing: 0; }
.profile-heading .back-link { font-size: 14px; line-height: 20px; margin-bottom: 12px; }
.profile-controls { padding-block: 20px; border: 0; }
.profile-totals { background: var(--paper); padding: 24px; border: 1px solid var(--line); border-radius: 6px; margin-bottom: 28px; }
.profile-totals strong { font: 700 32px/40px var(--sans); letter-spacing: 0; }
.profile-totals span, .profile-totals small { font-size: 14px; line-height: 20px; }
.profile-section { margin-bottom: 28px; }
.profile-splits { gap: 24px; }
.profile-section .section-heading { padding: 0 0 16px; }
.stat-table { font-size: 16px; line-height: 24px; }
.stat-table th { background: var(--surface); font-size: 14px; line-height: 20px; }
.stat-table small { font-size: 12px; line-height: 16px; }
.stat-table th:first-child, .stat-table td:first-child { padding-left: 8px; }
.stat-table th:last-child, .stat-table td:last-child { padding-right: 8px; }
.stat-table tbody tr:hover { background: var(--hover); }
.stat-table button { color: var(--accent); }
.form-chip { background: var(--surface); border-radius: 3px; font: 500 16px/24px var(--sans); min-width: 40px; height: 44px; }
.form-chip.win { background: #1b332a; }
.form-chip.loss { background: #352429; }
.elo-summary { font: 500 24px/32px var(--sans); }
.elo-summary small, .elo-svg text { font: 400 14px/20px var(--sans); }
.game-civ { display: inline-flex; align-items: center; gap: 8px; }
.game-civ .civ-emblem { width: 28px; height: 28px; margin: 0; }
.profile-game { background: var(--paper); padding: 16px; margin-top: 12px; border: 1px solid var(--line); border-radius: 6px; font-size: 16px; line-height: 24px; grid-template-columns: 112px 100px minmax(0,1.1fr) minmax(0,1.5fr) 76px; gap: 20px; }
.profile-game small, .profile-game .game-result { font-size: 14px; line-height: 20px; }
.profile-game .game-players a { color: var(--accent); font-weight: 500; }
.candidate-lede { font-size: 16px; line-height: 24px; }
.candidate-summary { font-size: 14px; line-height: 24px; }
.candidate-name { font-size: 16px; line-height: 24px; font-weight: 500; }
.candidate-head { background: var(--surface); font-size: 14px; line-height: 20px; }
.candidate-row { background: var(--paper); min-height: 100px; }
.candidate-row:hover, .candidate-row:has(input:checked) { background: var(--hover); }
.candidate-meta, .candidate-aliases, .candidate-country { font-size: 12px; line-height: 16px; }
.candidate-partners, .candidate-partners small, .candidate-links, .candidate-stat small, .list-tools { font-size: 14px; line-height: 20px; }
.candidate-links { gap: 12px; }
.candidate-filters input, .candidate-filters select { background: var(--input); }
.selection-bar { background: var(--paper); border-top: 1px solid var(--rule); box-shadow: none; }
.copy-button { background: var(--accent); border-color: var(--accent); color: var(--page); border-radius: 4px; font-size: 14px; line-height: 20px; font-weight: 500; min-height: 44px; }
.copy-button:hover:not(:disabled) { background: #bcd0ff; }
.selection-inner { max-width: 1240px; width: calc(100% - 48px); }
.selection-inner strong, .selection-bar .text-button, #selection-message { font-size: 14px; line-height: 20px; }
#selection-dialog textarea { font: 400 16px/24px var(--sans); }

@media(max-width:1050px) {
  .masthead, main { width: calc(100% - 32px); }
  .ladder-section, .rival-section, .profile-section { padding: 20px 16px; }
  .standings-table th:nth-child(2) { width: 38%; }
  .main-filters { grid-template-columns: 1fr 1fr; }
}
@media(max-width:1000px) {
  .overview { grid-template-columns: 1fr; gap: 24px; }
  .match-card { grid-template-columns: minmax(0,1fr) 110px; gap: 16px; }
  .match-card .match-map { grid-column: 1; grid-row: 1; }
  .match-card .match-action { grid-column: 2; grid-row: 1; }
  .match-sides { grid-column: 1 / -1; grid-row: 2; }
  .profile-game { grid-template-columns: 112px minmax(0,1fr) 76px; gap: 12px 16px; }
  .profile-game .game-result { grid-row: 2; grid-column: 1; }
  .profile-game .game-players { grid-row: 2; grid-column: 2 / 4; }
  .profile-game .match-link { grid-row: 1; grid-column: 3; }
}
@media(max-width:800px) {
  .profile-controls { flex-wrap: wrap; }
  .profile-totals { gap: 16px; }
  .profile-splits { grid-template-columns: 1fr; }
  .candidate-intro { flex-wrap: wrap; gap: 16px; }
  .candidate-summary { text-align: left; }
  .candidate-head { display: none; }
  .candidate-row { grid-template-columns: 24px minmax(0,1fr) 96px; gap: 12px 16px; padding: 20px 0; }
  .candidate-check { grid-column: 1; grid-row: 1 / 3; align-self: start; }
  .candidate-person { grid-column: 2; grid-row: 1; }
  .candidate-links { grid-column: 3; grid-row: 1; align-self: start; }
  .candidate-stat { grid-column: 2; grid-row: 2; text-align: left; display: flex; gap: 6px; align-items: baseline; flex-wrap: wrap; font-size: 18px; }
  .candidate-stat.total { grid-column: 3; grid-row: 2; display: flex; flex-direction: column; gap: 2px; font-size: 18px; }
  .candidate-stat small { display: inline; }
  .candidate-partners { grid-column: 2 / -1; grid-row: 3; color: var(--muted); }
  .selection-inner { width: calc(100% - 32px); gap: 12px; }
  .selection-actions .page-button { display: none; }
}
@media(max-width:600px) {
  .masthead, main { width: calc(100% - 24px); }
  .masthead { flex-wrap: wrap; gap: 0; min-height: 112px; padding-top: 16px; }
  .masthead nav { flex-basis: 100%; margin: 12px 0 0; justify-content: space-between; }
  .masthead nav a, .masthead nav a:first-child { min-height: 48px; padding: 0 10px; font-size: 16px; }
  .masthead nav a:first-child { padding-left: 0; }
  .masthead nav a:last-child { padding-right: 0; }
  .intro { padding: 20px 0; align-items: flex-start; flex-direction: column; gap: 12px; }
  .facts { max-width: none; }
  .facts span { margin-inline: 4px; }
  .sync { width: 100%; min-width: 0; flex-direction: row; justify-content: space-between; align-items: center; gap: 12px; }
  .sync>span { max-width: none; text-align: left; }
  .ladder-section, .rival-section, .profile-section { padding: 16px 12px; }
  .ladder-section .section-heading { gap: 12px; flex-wrap: wrap; }
  .section-heading select { max-width: 180px; }
  .standings-table th:first-child { width: 24px; }
  .standings-table th:nth-child(2) { width: 38%; }
  .standings-table th:nth-child(3) { width: 16%; }
  .standings-table th:nth-child(4) { width: 23%; }
  .standings-table td, .standings-table th { padding-inline: 4px; }
  .standings-table td { height: 64px; }
  .main-filters { gap: 16px; grid-template-columns: 1fr; }
  .main-filters .search-label, .main-filters>label:nth-child(3) { grid-column: auto; }
  .archive-tabs { width: 100%; gap: 2px; }
  .archive-tabs button { flex: 1; padding: 10px 6px; font-size: 14px; line-height: 20px; white-space: normal; }
  .filters { padding: 16px 12px; }
  .extra-filters { padding: 12px; }
  .extra-filters select, .month-filter { width: 100%; }
  .month-filter { flex-wrap: wrap; }
  .month-filter input { max-width: none; width: auto; flex: 1; }
  .match-card { padding: 16px 12px; gap: 16px; grid-template-columns: minmax(0,1fr) 94px; }
  .match-card .match-map { gap: 12px; }
  .map-thumbnail { width: 64px; height: 64px; flex-basis: 64px; }
  .match-sides { grid-template-columns: minmax(0,1fr); gap: 10px; }
  .match-versus { display: none; }
  .profile-heading h1, .candidate-intro h1 { font-size: 32px; line-height: 40px; }
  .profile-controls label { flex: 1; }
  .profile-controls select { min-width: 0; width: 100%; }
  .profile-totals { grid-template-columns: 1fr 1fr; gap: 24px; padding: 20px; }
  .profile-totals>div+div { border: 0; padding: 0; }
  .profile-game { grid-template-columns: 92px minmax(0,1fr) 70px; gap: 12px; padding: 16px 12px; }
  .stat-table th, .stat-table td { padding: 12px 6px; }
  .stat-table td:first-child { width: 38%; }
  .candidate-filters { grid-template-columns: 1fr; gap: 16px; }
  .candidate-filters>label:last-child { grid-column: auto; }
  .candidate-summary { margin-top: 12px; white-space: normal; }
  .candidate-row { grid-template-columns: 24px minmax(0,1fr) 82px; gap: 12px; }
  .candidate-partners small { display: block; margin: 4px 0 0; }
  .list-tools { align-items: flex-start; gap: 12px; padding: 8px 0 16px; flex-direction: column; }
  .list-tools>div { gap: 20px; flex-wrap: wrap; }
  .list-tools button { font-size: 14px; }
  .selection-inner { width: calc(100% - 24px); flex-wrap: wrap; gap: 10px; }
  .selection-inner>div:first-child { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 12px; }
  .selection-actions { width: 100%; justify-content: flex-end; gap: 12px; }
  .selection-actions .text-button, .selection-inner>div:first-child .text-button { font-size: 14px; }
  .copy-button { font-size: 14px; padding: 10px 14px; }
  .candidates-page { padding-bottom: 160px; }
  footer p { order: 3; width: 100%; }
  footer .game-credit { order: 4; }
}


