/* Browser controls and responsive layout for the ranking views. */
:root { --gradient-angle: 180deg; --gradient-midpoint: 50%; }
html { min-height: 100%; background: #111827; }
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; }
button, input, select { font: inherit; color: var(--text); }
button, select { cursor: pointer; }
button:focus-visible, a:focus-visible, select:focus-visible { 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; }
.view-tabs { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 26px; margin-bottom: 24px; padding-bottom: 12px; border-bottom: 1px solid #ffffff20; }
.view-tabs button { padding: 4px 0 8px; border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--muted); font-size: 14px; font-weight: 500; line-height: 1.5; }
.view-tabs button[aria-pressed=true] { color: var(--accent); border-bottom-color: var(--accent); }
.view-tabs button:hover { color: var(--text); }
.controls { margin-top: 24px; padding: 12px 0; border-top: 1px solid #ffffff20; border-bottom: 1px solid #ffffff20; }
.control-bar, .context-controls, .control-tools, .date-controls { display: flex; align-items: center; }
.control-bar { justify-content: space-between; gap: 16px; }
.context-controls { flex-wrap: wrap; gap: 12px 18px; min-width: 0; }
.mode-toggle { display: flex; flex-shrink: 0; padding: 3px; border: 1px solid #ffffff18; border-radius: 7px; background: var(--panel); }
.mode-toggle button { padding: 7px 10px; border: 0; border-radius: 4px; background: transparent; font-size: 14px; line-height: 20px; white-space: nowrap; }
.mode-toggle button[aria-pressed=true] { background: #30291f; color: var(--accent); }
.mode-toggle button:hover { color: var(--accent); }
.date-controls { flex-wrap: wrap; gap: 10px 16px; }
.date-controls label { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; 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: 142px; border-color: transparent; background-color: transparent; padding-top: 9px; padding-bottom: 9px; }
.date-controls .comparison-control select { width: 190px; }
.date-controls select:hover { border-color: #ffffff20; background-color: var(--panel); }
.control-tools { flex-shrink: 0; }
.search-label { display: flex; align-items: center; gap: 8px; width: 200px; 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; border: 0; border-radius: 0; background: transparent; padding: 10px 0; 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, .result-count { font-size: 14px; line-height: 1.5; color: var(--muted); }
.status { margin-top: 12px; }
.status:empty, .result-count:empty { display: none; }
.current { margin-top: 24px; }
.current[aria-busy=true] { opacity: .45; }
.result-count { margin-top: 6px; }
.rank-position { margin-right: 4px; }
.rank-delta { white-space: nowrap; }
.new-marker { margin-left: 5px; }
.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: 1200px) {
    .control-bar { flex-wrap: wrap; gap: 12px; }
    .context-controls, .control-tools { flex: 1 1 100%; }
    .search-label { flex: 1; width: auto; }
}
@media (max-width: 1100px) {
    .infographic { padding: 24px 44px 26px; }
    .player-table-heading, .player-row { grid-template-columns: 60px minmax(0, 1fr) 130px 145px; gap: 16px; padding-left: 20px; padding-right: 20px; }
}
@media (max-width: 750px) {
    .infographic { padding: 16px 24px 24px; }
    .view-tabs { gap: 6px 18px; margin-bottom: 20px; padding-bottom: 10px; }
    h1 { font-size: 36px; margin-top: 20px; }
    .source, .player-total { font-size: 20px; }
    .description, .cutoff-line { font-size: 17px; }
    .section-heading { flex-wrap: wrap; gap: 12px; }
    h2 { font-size: 17px; }
    .legend { font-size: 13px; }
    .context-controls { gap: 12px; }
    .mode-toggle { width: 100%; }
    .mode-toggle button { flex: 1; }
    .date-controls { width: 100%; display: grid; grid-template-columns: minmax(0, 1fr) minmax(160px, 1.3fr); gap: 12px; }
    .date-controls label { min-width: 0; display: grid; gap: 2px; font-size: 12px; }
    .date-controls select, .date-controls .comparison-control select { width: 100%; padding-left: 0; padding-right: 24px; padding-top: 7px; padding-bottom: 7px; background-position: right 4px center; }
    .date-controls select:hover { background-color: transparent; border-color: transparent; }
    .control-tools { min-width: 0; width: 100%; }
    .search-label input { min-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 95px; 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 { font-size: 24px; }
    .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: 16px 18px 22px; }
    h1 { font-size: 30px; }
    .source, .player-total { font-size: 18px; }
    .description, .cutoff-line { font-size: 16px; }
    .current { margin-top: 24px; }
    .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 67px; gap: 8px; padding: 10px 8px; }
    .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: 30px; height: 36px; flex-basis: 30px; }
    .player-identity .icon-fallback { height: 36px; font-size: 14px; }
    .player-character-name { font-size: 14px; }
    .global-position { font-size: 15px; }
    .player-rating { font-size: 20px; }
    .player-rating small { display: block; font-size: 12px; }
    .player-row .rank-delta { font-size: 12px; }
    .world-position, .player-rating { gap: 4px; }
    .departed { margin-top: 36px; }
    .departed-player-row { grid-template-columns: 1fr; gap: 6px; }
}
