/* Rating pages share the broadcast workspace's surfaces and semantic colours.
   Scope these rules to the homepage and profiles, never to generic tables. */
.home-rankings,.rating-profile {
 --rating-green:#047857;--rating-green-soft:#ecfdf5;--rating-red:#b91c1c;--rating-red-soft:#fef2f2;
 --rating-ink:#172333;--rating-muted:#64748b;--rating-border:#dbe3eb;--rating-surface:#f8fafc;--rating-card:#fff;
 --rating-classical:#64748b;--rating-rapid:#60a5fa;--rating-rapid-ink:#2563eb;--rating-rapid-soft:#eff6ff;
 --rating-blitz:#0369a1;--rating-blitz-soft:#f0f9ff;--rating-neutral:#f1f5f9;
}
/* Homepage: a compact label and context keep the rankings near the top. */
#main-content main>div:has(>.home-rankings) {padding-top:16px;}
.home-rankings {--rating-view-accent:var(--rating-green);}
.home-rankings[data-rating-view="classical"],.home-rankings[data-rating-view="uscfclassical"] {--rating-view-accent:var(--rating-classical);}
.home-rankings[data-rating-view="rapid"],.home-rankings[data-rating-view="uscfrapid"] {--rating-view-accent:var(--rating-rapid);}
.home-rankings[data-rating-view="blitz"],.home-rankings[data-rating-view="uscfblitz"] {--rating-view-accent:var(--rating-blitz);}
.home-rankings .ranking-intro {padding:0;margin:0 0 12px;border:0;border-radius:0;background:transparent;}
.home-rankings .ranking-intro h1 {font-size:1.5rem;color:var(--rating-ink);font-weight:650;}
.home-rankings .ranking-intro p {margin:4px 0 0;max-width:76ch;font-size:.8125rem;line-height:1.5;color:var(--rating-muted);}
.home-rankings .home-ranking-controls {padding:0 0 12px;margin-bottom:12px;border-color:var(--rating-border);gap:10px 18px;}
.home-rankings .ranking-federations {border:1px solid var(--rating-border);}
.home-rankings .ranking-tabs {padding:3px;border:1px solid var(--rating-border);border-radius:9px;background:#eaf0f5;gap:3px;}
.home-rankings .ranking-tabs a {min-height:40px;border:0;border-radius:6px;padding:6px 10px;gap:7px;font-size:.8125rem;}
.home-rankings .ranking-tabs a[aria-selected="true"] {background:var(--rating-card);color:var(--rating-green);box-shadow:0 1px 3px #0f172a10;}
.home-rankings .ranking-tabs :is(#rapid-tab,#uscfrapid-tab,#bliz-tab,#uscfblitz-tab)::before {content:'';width:7px;height:7px;flex:none;border-radius:50%;background:var(--rating-rapid);}
.home-rankings .ranking-tabs :is(#bliz-tab,#uscfblitz-tab)::before {background:var(--rating-blitz);}
.home-rankings .live-category {padding:3px;border:1px solid var(--rating-border);border-radius:9px;background:#eaf0f5;gap:3px;}
.home-rankings .live-category a {border:0;border-radius:6px;min-height:40px;padding:6px 14px;font-size:.8125rem;color:var(--rating-muted);}
.home-rankings .live-category a[aria-current="page"] {background:var(--rating-card);color:var(--rating-green);box-shadow:0 1px 3px #0f172a10;}
.home-rankings .live-watch {color:var(--rating-green);text-underline-offset:3px;}
.home-rankings .live-ranking-main>.live-table-scroll {border:1px solid var(--rating-border);border-top:3px solid var(--rating-view-accent);border-radius:10px;box-shadow:0 1px 2px #0f172a04;}
.home-rankings .live-table th {background:var(--rating-surface);font-size:.6875rem;font-weight:600;}
.home-rankings .live-table tbody>tr[data-live-fide-id]>td {border-color:#edf1f5;}
.home-rankings .live-table tbody>tr[data-live-fide-id]:hover {background:#f5faf8;}
.home-rankings .live-table .live-change {width:max(4rem,64px);}
.home-rankings .live-table .live-score {font-weight:700;letter-spacing:-.02em;color:var(--rating-ink);}
.home-rankings .live-table .live-games button {display:inline-flex;align-items:center;justify-content:center;min-width:30px;min-height:32px;padding:3px 7px;border:1px solid #cce4da;border-radius:6px;background:var(--rating-green-soft);color:var(--rating-green);font-size:.75rem;font-weight:600;text-decoration:none;}
.home-rankings .live-table .live-games button[aria-expanded="true"] {background:var(--rating-green);border-color:var(--rating-green);color:#fff;}
.home-rankings .live-table .live-player-expanded {box-shadow:inset 3px 0 #059669;}
.home-rankings .live-games-details-row .live-breakdown {border-top:1px solid #cce4da;}
.home-rankings .rating-change-badge,.rating-profile .profile-rating-delta {display:inline-flex;align-items:center;justify-content:center;min-width:2.6em;padding:3px 6px;border-radius:5px;line-height:1.4;font-size:.75rem;font-weight:600;white-space:nowrap;background:var(--rating-neutral);}
.home-rankings .rating-change-badge.live-gain,.rating-profile .profile-rating-delta.live-gain {color:var(--rating-green);background:var(--rating-green-soft);}
.home-rankings .rating-change-badge.live-loss,.rating-profile .profile-rating-delta.live-loss {color:var(--rating-red);background:var(--rating-red-soft);}
.home-rankings .rating-change-badge.live-muted,.rating-profile .profile-rating-delta.live-muted {color:var(--rating-muted);background:transparent;font-weight:400;}
.home-rankings .ranking-summary-grid>div {padding:18px;border:1px solid var(--rating-border);border-top:3px solid var(--rating-view-accent);border-radius:10px;background:var(--rating-card);box-shadow:0 1px 2px #0f172a04;}
.home-rankings .ranking-summary-grid h2 {font-size:1rem;font-weight:650;line-height:1.4;color:var(--rating-ink);}
.home-rankings .ranking-summary-grid li {padding-block:12px;}
.home-rankings .ranking-summary-grid .flow-root>a {display:inline-flex;align-items:center;min-height:44px;color:var(--rating-green);font-size:.8125rem;}
.home-rankings .ranking-summary-grid li>div {display:grid;grid-template-columns:1.75em minmax(0,1fr) auto auto;gap:8px;}
.home-rankings .ranking-summary-grid li>div>div {min-width:0;width:auto;margin:0;}
.home-rankings .ranking-summary-grid li>div>div:nth-child(2)>a {display:flex;max-width:100%;min-width:0;}
.home-rankings .ranking-summary-grid li>div>div:nth-child(2) p {min-width:0;max-width:100%;}
/* Match cards: type is a small accent; results retain their own meaning. */
.home-rankings .featured-heading {font-size:1rem;font-weight:650;color:var(--rating-ink);}
.home-rankings .featured-card {--match-accent:var(--rating-classical);border:1px solid var(--rating-border);border-top:3px solid var(--match-accent);border-radius:10px;background:var(--rating-card);box-shadow:0 1px 2px #0f172a04;}
.home-rankings .featured-card[data-time-control="Rapid"] {--match-accent:var(--rating-rapid);}
.home-rankings .featured-card[data-time-control="Blitz"] {--match-accent:var(--rating-blitz);}
.home-rankings .featured-card-meta>span {background:var(--rating-neutral);color:#526175;font-weight:500;}
.home-rankings .featured-card[data-time-control="Rapid"] .featured-card-meta>span {background:var(--rating-rapid-soft);color:#1d4ed8;}
.home-rankings .featured-card[data-time-control="Blitz"] .featured-card-meta>span {background:var(--rating-blitz-soft);color:var(--rating-blitz);}
.home-rankings .featured-round a {padding:3px 7px;border-radius:5px;background:var(--rating-neutral);font-size:.6875rem;font-weight:500;text-decoration:none;}
.home-rankings .featured-round[data-state="live"] a {color:var(--rating-green);background:var(--rating-green-soft);}
.home-rankings .featured-result strong {display:inline-flex;align-items:center;justify-content:center;padding:3px 6px;min-width:2.75em;border-radius:5px;background:var(--rating-neutral);color:var(--rating-ink);font-size:.75rem;}
.home-rankings .featured-result strong[data-result="Live"] {color:var(--rating-green);background:var(--rating-green-soft);}
.home-rankings .featured-result>span[data-outcome="win"] {color:var(--rating-green);font-weight:600;}
.home-rankings .featured-result>span[data-outcome="loss"] {color:var(--rating-red);}
.home-rankings .featured-result>span[data-outcome="draw"] {color:var(--rating-muted);}
.home-rankings .featured-result:hover {background:var(--rating-surface);}
/* Profiles: identity and biography lead; ratings and records are distinct cards. */
.rating-profile .profile-introduction,.rating-profile>.player-summary:first-child {border-color:var(--rating-border);border-top:3px solid #8ebdaa;border-radius:12px;box-shadow:0 1px 2px #0f172a04;background:var(--rating-card);}
.rating-profile .profile-identity-header h1 {color:var(--rating-ink);font-weight:650;}
.rating-profile .profile-title {background:#fff7df;color:#925d0a;border:1px solid #ead8aa;border-radius:5px;}
.rating-profile .profile-identifiers>div {padding:8px 10px;border:1px solid var(--rating-border);border-radius:7px;background:var(--rating-surface);}
.rating-profile .profile-identifiers {gap:8px;}
.rating-profile .profile-biography {padding-top:14px;margin-bottom:0;border-top:1px solid #edf1f5;}
.rating-profile .profile-biography-content {color:#475569;}
.rating-profile .profile-section-nav {padding:4px;margin:14px 0 18px;border:1px solid var(--rating-border);border-radius:10px;background:var(--rating-card);box-shadow:0 1px 2px #0f172a04;}
.rating-profile .profile-section-nav a {border:0;border-radius:6px;padding:8px 16px;font-size:.8125rem;}
.rating-profile .profile-section-nav a[aria-current] {color:var(--rating-green);background:var(--rating-green-soft);}
.rating-profile :is(#profile-ratings,#profile-history,#player-games,#fide-tournaments) {border:1px solid var(--rating-border);border-radius:12px;box-shadow:0 1px 2px #0f172a04;background:var(--rating-card);}
.rating-profile :is(.profile-ratings-heading,.profile-history-heading)>h2,.rating-profile #player-games h2 {font-size:1.25rem;font-weight:650;line-height:1.4;color:var(--rating-ink);}
.rating-profile .profile-rating-card {--card-accent:var(--rating-classical);padding:18px;border:1px solid var(--rating-border);border-top:3px solid var(--card-accent);border-radius:9px;background:var(--rating-surface);}
.rating-profile .profile-fide-ratings[data-rating-mode="live"] .profile-classical {--card-accent:var(--rating-green);background:#f6fcf9;}
.rating-profile .profile-rating-card.profile-rapid {--card-accent:var(--rating-rapid);background:var(--rating-rapid-soft);}
.rating-profile .profile-rating-card.profile-blitz {--card-accent:var(--rating-blitz);background:var(--rating-blitz-soft);}
.rating-profile .profile-rating-card.profile-domestic {--card-accent:#2e8b73;background:#f3faf7;}
.rating-profile .profile-rating-card h3 {display:flex;align-items:center;gap:7px;margin:0 0 12px;font-size:.8125rem;font-weight:600;line-height:1.4;color:#475569;}
.rating-profile .profile-rating-card h3::before {content:'';width:7px;height:7px;flex:none;border-radius:50%;background:var(--card-accent);}
.rating-profile .profile-rating-value {font-size:2rem;line-height:1.2;letter-spacing:-.035em;color:var(--rating-ink);}
.rating-profile .profile-rapid .profile-rating-value {color:var(--rating-rapid-ink);}
.rating-profile .profile-blitz .profile-rating-value {color:var(--rating-blitz);}
.rating-profile .profile-domestic .profile-rating-value {color:var(--rating-green);}
.rating-profile .profile-rating-source {color:var(--rating-muted);font-size:.75rem;line-height:1.5;margin-top:8px;}
.rating-profile .profile-rating-switch {background:#eaf0f5;border-color:var(--rating-border);border-radius:8px;}
.rating-profile .profile-rating-switch button[aria-pressed="true"] {background:var(--rating-card);color:var(--rating-green);box-shadow:0 1px 3px #0f172a10;}
.rating-profile .profile-record-panel {border-color:var(--rating-border);border-radius:9px;background:var(--rating-card);}
.rating-profile .profile-record-panel h3 {font-size:.9375rem;font-weight:650;color:var(--rating-ink);}
.rating-profile .profile-record-panel :is(dd[data-world-rank],dd[data-national-rank],dd[data-women-rank]) {padding:2px 8px;border-radius:5px;background:var(--rating-neutral);color:var(--rating-ink);}
.rating-profile .profile-ratings-footer {padding-top:4px;}
.rating-profile .profile-ratings-footer button {padding:8px 12px;border:1px solid #cce4da;border-radius:7px;background:var(--rating-green-soft);color:var(--rating-green);font-weight:500;font-size:.8125rem;text-decoration:none;}
.rating-profile .profile-rating-delta[hidden],.rating-profile .profile-ratings-footer [hidden] {display:none;}
/* History controls and line colours correspond to the rating cards. */
.rating-profile :is(.profile-history-sources,.profile-chart-ranges) {display:flex;flex-wrap:wrap;gap:3px;padding:3px;border:1px solid var(--rating-border);border-radius:8px;background:#eaf0f5;}
.rating-profile :is(.profile-history-sources,.profile-chart-ranges)>button {min-height:44px;border:0;border-radius:5px;font-size:.8125rem;color:var(--rating-muted);}
.rating-profile :is(.profile-history-sources,.profile-chart-ranges)>button[aria-pressed="true"] {background:var(--rating-card);color:var(--rating-green);font-weight:600;box-shadow:0 1px 3px #0f172a10;}
.rating-profile .profile-chart-types button {border-color:var(--rating-border);border-radius:6px;color:#526175;font-size:.8125rem;}
.rating-profile .profile-chart-types button[aria-pressed="true"] {background:var(--rating-neutral);color:var(--rating-ink);border-color:#94a3b8;}
.rating-profile .profile-chart-types :is([data-chart-type="rapid"],[data-cfc-kind="Q"],[data-ecf-kind="rapid"])[aria-pressed="true"] {background:var(--rating-rapid-soft);color:var(--rating-rapid-ink);border-color:var(--rating-rapid);}
.rating-profile .profile-chart-types :is([data-chart-type="blitz"],[data-ecf-kind="blitz"])[aria-pressed="true"] {background:var(--rating-blitz-soft);color:var(--rating-blitz);border-color:var(--rating-blitz);}
.rating-profile .profile-chart-types [data-chart-type="compare"][aria-pressed="true"] {background:var(--rating-green-soft);color:var(--rating-green);border-color:#8ebdaa;}
.rating-profile .profile-chart-summary {padding:8px 10px;border-radius:6px;background:var(--rating-surface);color:var(--rating-muted);font-size:.75rem;line-height:1.6;}
.rating-profile .profile-chart-table-scroll {border:1px solid var(--rating-border);border-radius:7px;}
/* Saved games use the same win/loss/draw language as broadcast boards. */
.rating-profile .game-medium-tabs {padding:3px;border:1px solid var(--rating-border);border-radius:9px;background:#eaf0f5;width:fit-content;max-width:100%;gap:3px;}
.rating-profile .game-medium-tabs a {border:0;border-radius:6px;padding:8px 12px;font-size:.8125rem;color:#526175;}
.rating-profile .game-medium-tabs a[aria-current="page"] {background:var(--rating-card);color:var(--rating-green);box-shadow:0 1px 3px #0f172a10;}
.rating-profile .game-medium-tabs span {padding:1px 5px;border-radius:4px;background:#dce5ee;font-size:.75em;}
.rating-profile .game-medium-tabs a[aria-current="page"] span {background:#d1fae5;color:#065f46;}
.rating-profile .player-games-page-links a {border:1px solid var(--rating-border);border-radius:6px;background:var(--rating-card);color:var(--rating-green);font-size:.8125rem;text-decoration:none;}
.rating-profile .player-games-page-links a:hover {background:var(--rating-green-soft);}
.rating-profile .player-games-desktop {border:1px solid var(--rating-border);border-radius:8px;}
.rating-profile #player-games-table {font-size:.8125rem;color:#526175;}
.rating-profile #player-games-table th {padding:10px 12px;text-transform:none;background:var(--rating-surface);color:#526175;font-size:.75rem;line-height:1.4;}
.rating-profile #player-games-table td {padding:10px 12px;border-color:#edf1f5;line-height:1.5;}
.rating-profile #player-games-table tbody tr:hover {background:var(--rating-surface);}
.rating-profile #player-games-table a {color:var(--rating-green);text-underline-offset:3px;}
.rating-profile #player-games-table td:last-child>a {display:inline-flex;align-items:center;justify-content:center;min-height:36px;padding:4px 9px;border:1px solid var(--rating-border);border-radius:6px;font-size:.75rem;}
.rating-profile :is(.result-win,.result-loss,.result-draw,.result-unknown) {display:inline-flex;align-items:center;justify-content:center;padding:3px 7px;border-radius:5px;font-size:.75rem;font-weight:600;white-space:nowrap;line-height:1.5;}
.rating-profile .result-win {color:var(--rating-green);background:var(--rating-green-soft);}
.rating-profile .result-loss {color:var(--rating-red);background:var(--rating-red-soft);}
.rating-profile :is(.result-draw,.result-unknown) {color:#526175;background:var(--rating-neutral);}
.rating-profile .player-games-mobile>li+li {margin-top:10px;}
.rating-profile .player-game-mobile {padding:12px;border:1px solid var(--rating-border);border-radius:8px;background:var(--rating-card);gap:8px;}
.rating-profile .player-game-mobile:hover {border-color:#8ebdaa;background:#f6fcf9;}
.rating-profile .player-game-mobile-heading {align-items:center;}
/* The same tokens cover federation-only and historical profiles. */
.national-rating-profile>.national-profile-identity {padding:20px;border:1px solid var(--rating-border);border-top:3px solid #8ebdaa;border-radius:12px;background:var(--rating-card);}
.rating-profile :is(.cfc-profile,.ecf-profile) {border-color:var(--rating-border);border-radius:12px;background:var(--rating-card);}
.rating-profile .profile-history-source :is(.cfc-profile,.ecf-profile) {border:0;border-radius:0;box-shadow:none;background:transparent;}
.rating-profile :is(.cfc-card,.ecf-card) {border-color:var(--rating-border);border-top:3px solid var(--rating-classical);border-radius:9px;background:var(--rating-surface);}
.rating-profile :is(.cfc-card.quick,.ecf-card.rapid) {border-top-color:var(--rating-rapid);background:var(--rating-rapid-soft);}
.rating-profile :is(.cfc-card.quick,.ecf-card.rapid) strong {color:var(--rating-rapid-ink);}
.rating-profile .ecf-card.blitz {border-top-color:var(--rating-blitz);background:var(--rating-blitz-soft);}
.rating-profile .ecf-card.blitz strong {color:var(--rating-blitz);}
.rating-profile .biography-player-actions a {border-radius:7px;}
.dark .home-rankings,.dark .rating-profile {--rating-ink:#f1f5f9;--rating-muted:#aab8ca;--rating-border:#3b495d;--rating-surface:#253244;--rating-card:#1f2937;--rating-neutral:#334155;--rating-green:#6ee7b7;--rating-green-soft:#103f34;--rating-red:#fda4af;--rating-red-soft:#482631;--rating-rapid:#93c5fd;--rating-rapid-ink:#93c5fd;--rating-rapid-soft:#1c3453;--rating-blitz:#7dd3fc;--rating-blitz-soft:#16384c;--rating-classical:#aab8ca;}
.dark .home-rankings :is(.ranking-tabs,.ranking-federations,.live-category),.dark .rating-profile :is(.profile-rating-switch,.profile-history-sources,.profile-chart-ranges,.game-medium-tabs) {background:#192332;border-color:var(--rating-border);}
.dark .home-rankings :is(.ranking-tabs a,.live-category a),.dark .rating-profile :is(.profile-rating-card h3,.profile-biography-content,.profile-chart-types button,.game-medium-tabs a) {color:#cbd5e1;}
.dark .home-rankings .ranking-tabs a[aria-selected="true"],.dark .home-rankings .live-category a[aria-current="page"] {color:var(--rating-green);background:#334155;}
.dark .home-rankings .live-table tbody>tr[data-live-fide-id]>td,.dark .rating-profile .profile-biography,.dark .rating-profile #player-games-table td {border-color:#334155;}
.dark .home-rankings .live-table tbody>tr[data-live-fide-id]:hover,.dark .rating-profile .player-game-mobile:hover {background:#243b37;}
.dark .home-rankings .live-table .live-games button {border-color:#285c4b;}
.dark .home-rankings .featured-card-meta>span,.dark .rating-profile :is(.result-draw,.result-unknown) {color:#cbd5e1;}
.dark .home-rankings .featured-card[data-time-control="Rapid"] .featured-card-meta>span {color:var(--rating-rapid-ink);}
.dark .rating-profile .profile-title {color:#f6cf79;background:#493d22;border-color:#73603b;}
.dark .rating-profile .profile-fide-ratings[data-rating-mode="live"] .profile-classical,.dark .rating-profile .profile-domestic {background:#17362e;}
.dark .rating-profile :is(.profile-history-sources,.profile-chart-ranges)>button[aria-pressed="true"],.dark .rating-profile .profile-rating-switch button[aria-pressed="true"] {background:#334155;color:var(--rating-green);}
.dark .rating-profile .profile-ratings-footer button {border-color:#285c4b;}
.dark .rating-profile .game-medium-tabs a[aria-current="page"] {background:#334155;color:var(--rating-green);}
.dark .rating-profile .game-medium-tabs span {background:#1f2937;}
@media(max-width:640px){
 .home-rankings .ranking-intro {padding:0;border-radius:0;}
 .home-rankings .ranking-tabs {display:none;}
 .home-rankings .live-category a {min-height:44px;padding-inline:14px;}
 .rating-profile .profile-rating-card {padding:14px;}
 .rating-profile .profile-rating-value {font-size:1.75rem;}
 .rating-profile .profile-section-nav a {padding-inline:12px;}
 .rating-profile .profile-rating-card h3 {margin-bottom:10px;}
 .rating-profile .profile-rating-delta {font-size:.75rem;}
}
@media(prefers-reduced-motion:reduce){.home-rankings *,.rating-profile * {scroll-behavior:auto;}}
