/* Browser controls and responsive layout for the ranking views. */
:root { --gradient-angle: 180deg; --gradient-midpoint: 50%; --control-gap: 14px; }
html { min-height: 100%; background: #111827; scrollbar-gutter: stable; }
body { min-height: 100vh; background: linear-gradient(var(--gradient-angle, 180deg), #111827, var(--gradient-midpoint, 50%), #25151d); }
.infographic { width: 100%; max-width: 1450px; min-height: 100vh; margin: 0 auto; padding-top: 26px; }
button, input, select { font: inherit; color: var(--text); }
button, select { cursor: pointer; }
button:focus-visible, a:focus-visible, select:focus { outline: 2px solid var(--accent); outline-offset: 4px; }
[hidden] { display: none !important; }
.entity-link { color: inherit; text-decoration: none; }
.entity-link:hover { text-decoration: underline; text-underline-offset: .16em; }
.character-icon-link { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; line-height: 0; }
.global-navigation { width: 100%; background: #151d2a; border-bottom: 1px solid #ffffff20; }
.global-navigation-inner { display: flex; align-items: flex-end; max-width: 1450px; min-height: 64px; margin: 0 auto; padding: 0 88px; }
.ranking-parameters { position: relative; min-width: 0; margin-bottom: 26px; }
.view-tabs { position: relative; isolation: isolate; display: flex; flex-wrap: wrap; align-items: center; min-width: 0; gap: 0 12px; }
.view-tabs button { position: relative; z-index: 1; padding: 12px 8px 10px; border: 0; border-bottom: 2px solid transparent; border-radius: 5px; background: transparent; color: var(--muted); font-size: 14px; font-weight: 500; line-height: 1.5; transition: color 180ms ease, background-color 140ms ease; }
.view-tabs button[aria-pressed=true] { color: var(--accent); border-bottom-color: var(--accent); }
.view-tabs[data-indicator-ready] button[aria-pressed=true] { border-bottom-color: transparent; }
.selection-indicator { position: absolute; top: 0; left: 0; z-index: 0; pointer-events: none; opacity: 0; }
[data-indicator-ready] > .selection-indicator { opacity: 1; transition: transform 280ms cubic-bezier(.22, 1, .36, 1), width 280ms cubic-bezier(.22, 1, .36, 1), height 280ms cubic-bezier(.22, 1, .36, 1); }
.view-tabs > .selection-indicator { background: var(--accent); border-radius: 2px; }
.controls { min-width: 0; }
.context-controls { position: absolute; right: 0; top: 50%; transform: translateY(-50%); width: max-content; max-width: 100%; }
.ranking-footer { display: block; margin-top: 24px; padding-top: 16px; border-top: 1px solid #ffffff15; }
.ranking-help-toggle { display: inline-flex; align-items: center; height: auto; padding: 0; border: 0; background: transparent; color: #aeb7c5; font: inherit; font-size: 12px; line-height: 19px; text-decoration: underline; text-decoration-color: #aeb7c54a; text-underline-offset: 3px; }
.ranking-help-toggle:hover:enabled { color: var(--text); text-decoration-color: currentColor; }
.ranking-help-toggle:active:enabled { color: var(--accent); }
.ranking-help-toggle:disabled { opacity: .4; cursor: default; }
.ranking-help { position: fixed; inset: auto; top: 64px; left: 16px; width: min(360px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); overflow: auto; margin: 0; padding: 18px 20px; border: 1px solid #ffffff25; border-radius: 10px; background: #1b2230; color: var(--text); box-shadow: 0 14px 40px #0007; }
.ranking-help h2 { padding-right: 22px; font-size: 14px; }
.ranking-help p { margin-top: 10px; color: var(--muted); font-size: 14px; line-height: 1.55; }
.ranking-help-close { position: absolute; top: 10px; right: 10px; display: grid; place-items: center; width: 28px; height: 28px; padding: 0; border: 0; border-radius: 5px; background: transparent; color: var(--muted); font-size: 22px; line-height: 1; }
.ranking-help-close:hover { background: #ffffff0d; color: var(--text); }
.ranking-help-close:active { background: #ffffff1a; }
.mode-toggle { position: relative; isolation: isolate; display: inline-flex; gap: var(--control-gap); padding: 2px; border: 1px solid #ffffff18; border-radius: 6px; background: var(--panel); }
.mode-toggle button { position: relative; z-index: 1; padding: 4px 12px; border: 0; border-radius: 4px; background: transparent; color: var(--muted); font-size: 13px; line-height: 20px; white-space: nowrap; transition: color 180ms ease, background-color 140ms ease, box-shadow 140ms ease; }
.mode-toggle button[aria-pressed=true] { background: #30291f; color: var(--accent); }
.mode-toggle[data-indicator-ready] button[aria-pressed=true] { background: transparent; }
.mode-toggle > .selection-indicator { background: #30291f; border-radius: 4px; box-shadow: inset 0 0 0 1px #f4b54412; }
.view-tabs button:active, .view-tabs button[aria-pressed=true]:active, .mode-toggle button:active { color: #ffd18a; background-color: #f4b54420; box-shadow: inset 0 1px 3px #0003; }
.mode-toggle[data-indicator-ready] button[aria-pressed=true]:active { background-color: #f4b54420; }
.date-controls { display: flex; align-items: center; gap: var(--control-gap); }
.date-controls label { display: flex; align-items: center; min-width: 0; gap: 8px; }
.date-caption { color: #bdc7d5; font-size: 12px; line-height: 16px; white-space: nowrap; }
input, select { min-width: 0; width: 100%; border: 1px solid #ffffff20; border-radius: 6px; background-color: var(--panel); padding: 10px 12px; font-size: 14px; line-height: 20px; }
input::placeholder { color: var(--muted); opacity: 1; }
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%23aeb7c5' stroke-width='1.5'%3E%3Cpath d='m4 6 4 4 4-4'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 34px; }
option { background: var(--panel); }
select:disabled { cursor: default; opacity: .7; }
.date-controls select { width: 134px; height: 32px; padding: 5px 28px 5px 10px; background-color: transparent; background-position: right 8px center; font-size: 13px; font-weight: 500; font-variant-numeric: tabular-nums; }
.date-controls .comparison-control select { width: 150px; }
.date-controls select:hover:enabled { background-color: #ffffff06; }
.date-controls select:focus { outline-offset: 2px; }
.character-filter { display: block; min-width: 0; }
.results-heading-row { align-items: center; }
.results-heading { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 20px; }
.list-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.list-tools .character-filter select { width: 174px; height: 34px; padding-top: 6px; padding-bottom: 6px; font-size: 13px; }
.search-label { display: flex; align-items: center; gap: 8px; width: 214px; height: 34px; min-width: 0; border: 1px solid #ffffff20; border-radius: 6px; background: var(--panel); padding: 0 10px; }
.search-label:focus-within { border-color: var(--accent); }
.search-label svg { width: 16px; height: 16px; flex-shrink: 0; fill: none; stroke: var(--muted); stroke-width: 1.6; }
.search-label input { appearance: none; min-width: 0; height: 32px; border: 0; border-radius: 0; background: transparent; padding: 6px 0; font-size: 13px; outline: none; box-shadow: none; }
.search-label input:focus, .search-label input:focus-visible { outline: none; box-shadow: none; }
.error-box button { background: var(--panel); border: 1px solid #ffffff20; border-radius: 8px; padding: 10px 16px; font-size: 16px; line-height: 1.4; }
.status { font-size: 14px; line-height: 1.5; color: var(--muted); }
.status { margin-top: 12px; }
.status:empty { display: none; }
.ranking-content { position: relative; }
.ranking-content:has(.current[aria-busy=true]) { min-height: 260px; }
.ranking-loading { position: absolute; inset: 0; z-index: 2; display: flex; justify-content: center; align-items: flex-start; padding: 96px 16px 0; pointer-events: none; }
.loading-indicator { display: grid; justify-items: center; gap: 12px; color: var(--text); font-size: 14px; line-height: 20px; }
.loading-spinner { width: 32px; height: 32px; border: 3px solid #ffffff20; border-top-color: var(--accent); border-radius: 50%; animation: loading-spin 800ms linear infinite; }
@keyframes loading-spin { to { transform: rotate(360deg); } }
.current { margin-top: 0; }
.current[aria-busy=true] { opacity: .18; pointer-events: none; }
#empty { text-align: center; }
.rank-position { margin-right: 4px; }
.rank-delta { white-space: nowrap; }
.new-marker { margin-left: 5px; }
.new-filter { padding: 5px 10px; border: 1px solid #72d9a050; border-radius: 6px; background: #72d9a00b; color: var(--new); font-size: 12px; font-weight: 500; line-height: 20px; white-space: nowrap; transition: color 160ms ease, background-color 140ms ease, border-color 140ms ease, box-shadow 100ms ease, transform 100ms ease; }
.new-filter[aria-pressed=true] { background: #72d9a026; border-color: var(--new); }
.new-filter:focus-visible { outline-color: var(--new); }
.new-filter:active:enabled { color: #c7f8dd; border-color: #a4e9bf; background: #72d9a044; box-shadow: inset 0 1px 3px #0004; transform: translateY(1px); }
.new-filter[aria-pressed=true]:active:enabled { background: #72d9a055; }
.new-filter:disabled { opacity: .45; cursor: default; }
@media (hover: hover) {
    .view-tabs button:hover { color: var(--text); background-color: #ffffff08; }
    .view-tabs button[aria-pressed=true]:hover { color: #ffd18a; background-color: #f4b5440c; }
    .mode-toggle button:hover { color: var(--text); background-color: #ffffff0a; }
    .mode-toggle[data-indicator-ready] button[aria-pressed=true]:hover { color: #ffd18a; background-color: #ffffff08; }
    .view-tabs button:active, .view-tabs button[aria-pressed=true]:active, .mode-toggle button:active,
    .mode-toggle[data-indicator-ready] button[aria-pressed=true]:active { color: #ffd18a; background-color: #f4b54420; }
    .new-filter:hover:enabled { color: #acf1c9; border-color: #72d9a0a0; background: #72d9a01c; }
    .new-filter[aria-pressed=true]:hover:enabled { background: #72d9a038; }
    .new-filter:active:enabled { color: #c7f8dd; border-color: #a4e9bf; background: #72d9a044; }
    .new-filter[aria-pressed=true]:active:enabled { background: #72d9a055; }
}
.player-table { display: block; border-collapse: collapse; }
.player-table thead, .player-table tbody { display: block; }
.player-table th { text-align: left; font-weight: 500; }
.player-table-heading { text-transform: uppercase; }
.player-row:nth-child(odd), .player-row:nth-child(2) { background: transparent; }
.player-row:nth-child(even) { background: #ffffff03; }
.player-row:first-child { background: #30291f; }
.player-row td { padding: 0; }
.player-row .rank-delta { font-size: 13px; }
.player-identity .icon-fallback { height: 56px; }
.departed-player-row .character-icon { object-fit: contain; }
.error-box { margin-top: 24px; border-left: 4px solid var(--departure); padding: 16px 20px; background: var(--panel); }
.error-box p { margin-bottom: 14px; font-size: 16px; }
.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; }
.skip-link { position: fixed; top: 8px; left: 8px; z-index: 10; padding: 10px 18px; background: var(--accent); color: #111827; transform: translateY(-150%); }
.skip-link:focus { transform: translateY(0); }
@media (max-width: 1100px) {
    .infographic { padding: 26px 44px 26px; }
    .global-navigation-inner { padding-inline: 44px; }
    .player-table-heading, .player-row { grid-template-columns: 48px minmax(0, 1fr) 110px 110px; gap: 16px; padding-left: 16px; padding-right: 16px; }
}
@media (max-width: 900px) {
    .context-controls { position: static; transform: none; width: 100%; margin-top: 12px; }
    .mode-toggle { display: flex; width: 100%; }
    .mode-toggle > button { flex: 1 1 0; min-width: 0; }
}
@media (max-width: 750px) {
    :root { --control-gap: 10px; }
    .infographic { padding: 20px 24px 24px; }
    .global-navigation-inner { display: block; min-height: 0; padding: 8px 24px 0; }
    .view-tabs { gap: 0 6px; }
    .view-tabs button { padding: 10px 6px 9px; }
    .ranking-parameters { margin-bottom: 22px; }
    .new-filter { padding-block: 2px; line-height: 16px; }
    .controls { width: 100%; }
    .date-controls { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .date-controls label { display: grid; gap: 5px; }
    .date-controls select, .date-controls .comparison-control select { width: 100%; }
    .section-heading { flex-wrap: wrap; gap: 12px; }
    h2 { font-size: 17px; }
    .legend { font-size: 13px; }
    .list-tools { width: 100%; }
    .list-tools .character-filter { flex: 1 1 100%; }
    .list-tools .character-filter select { width: 100%; height: 44px; font-size: 16px; }
    .search-label { flex: 1 1 100%; width: 100%; height: 44px; }
    .search-label input { height: 42px; font-size: 16px; }
    .character-row { grid-template-columns: 48px minmax(0, 1fr); gap: 14px; padding: 10px 14px; }
    .character-icon { width: 48px; height: 48px; }
    h3 { font-size: 20px; }
    .player-table-heading, .player-row { grid-template-columns: 38px minmax(0, 1fr) 78px 78px; gap: 10px; padding: 10px 12px; }
    .player-identity { gap: 10px; }
    .player-identity .character-icon { width: 44px; height: 44px; flex-basis: 44px; }
    .player-identity .icon-fallback { height: 44px; }
    .player-name { font-size: 18px; }
    .local-position { font-size: 18px; }
    .global-position { font-size: 16px; }
    .player-rating { flex-direction: column; gap: 4px; font-size: 16px; }
    .rating-icon { width: 28px; height: 28px; }
    .departed-player-row { padding: 10px 0; gap: 14px; }
    .player-character { gap: 10px; }
    .player-character .character-icon { width: 44px; height: 44px; flex-basis: 44px; }
}
@media (max-width: 480px) {
    .infographic { padding: 20px 18px 22px; }
    .global-navigation-inner { padding-inline: 18px; }
    .character-row { grid-template-columns: 42px minmax(0, 1fr); gap: 12px; padding: 10px 12px; }
    .character-icon { width: 42px; height: 42px; }
    h3 { font-size: 19px; }
    .player-table-heading, .player-row { grid-template-columns: 24px minmax(0, 1fr) 57px 60px; gap: 8px; padding: 10px 8px; }
    .player-table-heading > :nth-child(2), .player-row > :nth-child(2) { padding-left: 4px; }
    .player-table-heading { overflow-wrap: anywhere; letter-spacing: 0; }
    #local-heading { font-size: 0; }
    #local-heading::after { content: "№"; font-size: 12px; }
    .local-position { font-size: 17px; }
    .player-name { font-size: 16px; }
    .player-identity { gap: 6px; }
    .player-identity .character-icon { width: 36px; height: 36px; flex-basis: 36px; }
    .player-identity .icon-fallback { height: 36px; font-size: 14px; }
    .player-character-name { font-size: 14px; }
    .global-position { font-size: 15px; }
    .player-rating { font-size: 15px; }
    .player-row .rank-delta { font-size: 12px; }
    .departed { margin-top: 36px; }
    .departed-player-row { grid-template-columns: 1fr; gap: 6px; }
}
@media (prefers-reduced-motion: reduce) {
    .loading-spinner { animation: none; }
    [data-indicator-ready] > .selection-indicator,
    .view-tabs button, .mode-toggle button, .new-filter { transition: none; }
    .new-filter:active:enabled { transform: none; }
}
