/* ================================================================
   CZSK TIERLIST — Modern Redesign
   ================================================================ */

/* ================================================================
   CSS VARIABLES
   ================================================================ */
:root {
    --accent: #eecd14;
    --accent-rgb: 238, 205, 20;
    --accent-dim: rgba(238, 205, 20, 0.12);

    --bg-deep:    #0d0e14;
    --bg-main:    #131420;
    --bg-card:    #1a1b27;
    --bg-surface: #20222f;
    --bg-elevated:#282a38;

    --text-primary:   #ffffff;
    --text-secondary: rgba(255,255,255,0.58);
    --text-muted:     rgba(255,255,255,0.28);

    --border-subtle: rgba(255,255,255,0.06);
    --border-accent: rgba(238, 205, 20, 0.22);

    --radius-xs:  6px;
    --radius-sm:  10px;
    --radius-md:  16px;
    --radius-lg:  22px;
    --radius-xl:  28px;
    --radius-pill:100px;

    --shadow-sm:   0 2px 8px rgba(0,0,0,0.32);
    --shadow-md:   0 4px 24px rgba(0,0,0,0.44);
    --shadow-lg:   0 8px 48px rgba(0,0,0,0.56);
    --shadow-glow: 0 0 24px rgba(238, 205, 20, 0.22);

    /* Tier colours (must match JS tierInfo values) */
    --tier-1:        #FFCF4A;
    --tier-1-lt:     #D5B355;
    --tier-2:        #A4B3C7;
    --tier-2-lt:     #888D95;
    --tier-3:        #8F5931;
    --tier-3-lt:     #B56326;
    --tier-45:       #655B79;

    /* Tier RGB components for rgba() usage */
    --tier-1-rgb:    255, 207, 74;
    --tier-1-lt-rgb: 213, 179, 85;
    --tier-2-rgb:    164, 179, 199;
    --tier-2-lt-rgb: 136, 141, 149;
    --tier-3-rgb:    143, 89, 49;
    --tier-3-lt-rgb: 181, 99, 38;
    --tier-45-rgb:   101, 91, 121;
}

/* ================================================================
   RESET & BASE
   ================================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
html, body { max-width: 100vw; overflow-x: hidden; }

body {
    font-family: 'Poppins', sans-serif;
    background-color: var(--bg-main);
    background-image:
        radial-gradient(ellipse 140% 55% at 50% -8%, rgba(238,205,20,0.055) 0%, transparent 60%),
        radial-gradient(ellipse 80% 50% at 90% 110%, rgba(238,205,20,0.025) 0%, transparent 50%);
    background-attachment: fixed;
    color: var(--text-primary);
    min-height: 100vh;
    padding: 0 0 48px;
    -webkit-font-smoothing: antialiased;
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

/* ================================================================
   HEADER
   ================================================================ */
.main-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    height: 66px;
    background: rgba(13,14,20,0.92);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-subtle);
    position: sticky;
    top: 0;
    z-index: 200;
    gap: 16px;
}

.main-header::after {
    content: '';
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent 0%, var(--accent) 50%, transparent 100%);
    opacity: 0.35;
}

.main-title {
    font-size: 1.55em;
    font-weight: 800;
    letter-spacing: 2.5px;
    text-transform: uppercase;
    background: linear-gradient(135deg, #fff 20%, var(--accent) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    white-space: nowrap;
    user-select: none;
    pointer-events: none;
    flex-shrink: 0;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    justify-content: flex-end;
}

/* Player count */
.header-player-count {
    display: flex;
    align-items: center;
    justify-content: flex-start;  /* lock the count badge to the left edge */
    /* Pin it near the start of the header regardless of DOM insertion order —
       player-count.js appends this element wherever .main-header happens to be
       in its lifecycle when the script runs, which differs page to page and
       otherwise lets it drift to the right on kit pages. */
    order: -1;
}

.player-count-badge {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 5px 13px;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-pill);
    font-family: 'Poppins', sans-serif;
}

.player-count-icon { display: flex; color: var(--accent); opacity: 0.7; }
.player-count-num  { font-size: 1.1em; font-weight: 800; color: var(--accent); }
.player-count-label{
    font-size: 0.7em;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

/* Auth */
.header-auth { display: flex; align-items: center; }

.auth-login-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--accent-dim);
    border: 1px solid var(--border-accent);
    border-radius: var(--radius-pill);
    padding: 6px 14px;
    font-family: 'Poppins', sans-serif;
    font-size: 0.82em;
    font-weight: 600;
    color: var(--accent);
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.auth-login-btn:hover {
    background: rgba(238,205,20,0.18);
    border-color: rgba(238,205,20,0.38);
    transform: translateY(-1px);
}

/* Přihlášení jde od 2026-09-04 jen přes Discord, takže tlačítko nese jeho
   barvu — je to jediná akce a má být poznat na první pohled, co udělá. */
.auth-login-btn.auth-discord {
    background: #5865F2;
    border-color: #5865F2;
    color: #fff;
}
.auth-login-btn.auth-discord:hover {
    background: #4752C4;
    border-color: #4752C4;
}

.auth-user {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--accent-dim);
    border: 1px solid var(--border-accent);
    border-radius: var(--radius-pill);
    padding: 4px 12px 4px 6px;
}

.auth-admin-link {
    display: inline-flex; align-items: center; justify-content: center;
    width: 24px; height: 24px; border-radius: 6px;
    color: var(--text-secondary); text-decoration: none; font-size: 15px;
    transition: color .15s, background .15s;
}
.auth-admin-link:hover { color: var(--accent); background: rgba(255,255,255,0.06); }

.auth-avatar { width: 26px; height: 26px; border-radius: 6px; image-rendering: pixelated; }
.auth-nick   { font-size: 0.82em; font-weight: 700; color: var(--text-primary); }

.auth-profile-link {
    display: inline-flex; align-items: center; gap: 8px;
    text-decoration: none; transition: opacity 0.2s;
}
.auth-profile-link:hover { opacity: 0.8; }

.auth-logout-btn {
    display: flex; align-items: center;
    background: none; border: none;
    color: var(--text-secondary);
    cursor: pointer; padding: 4px;
    border-radius: 6px; transition: all 0.2s;
    margin-left: 2px;
}
.auth-logout-btn:hover { color: #f87171; background: rgba(220,38,38,0.14); }

/* Discord link */
.discord-link {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: #7289da;
    font-weight: 600;
    font-size: 0.86em;
    padding: 7px 15px;
    border-radius: var(--radius-pill);
    background: rgba(114,137,218,0.1);
    border: 1px solid rgba(114,137,218,0.2);
    transition: all 0.2s ease;
    white-space: nowrap;
}
.discord-link:hover {
    background: rgba(88,101,242,0.18);
    border-color: rgba(88,101,242,0.38);
    color: #a5b4ff;
    transform: translateY(-1px);
}
.discord-icon {
    height: 20px;
    width: auto;            /* preserve the source 2000×1512 (~1.32:1) ratio — no squish */
    object-fit: contain;    /* stay undistorted even if the asset ratio changes */
    flex: 0 0 auto;         /* don't let the flex row shrink/stretch it */
}

/* Time Machine */
.time-machine-wrap { position: relative; }

.time-machine-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 13px;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-pill);
    color: var(--text-secondary);
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    font-size: 0.82em;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}
.time-machine-btn:hover { border-color: var(--border-accent); color: var(--accent); }
.tm-label { font-size: 0.9em; }

.time-machine-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 16px;
    min-width: 230px;
    box-shadow: var(--shadow-lg);
    z-index: 300;
}
.tm-dropdown-header {
    font-size: 0.75em;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 10px;
}
.tm-date-input {
    width: 100%;
    padding: 8px 12px;
    background: var(--bg-deep);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: 'Poppins', sans-serif;
    font-size: 0.88em;
    margin-bottom: 10px;
    outline: none;
    transition: border-color 0.2s;
}
.tm-date-input:focus { border-color: var(--border-accent); }
.tm-date-input { cursor: pointer; }

.tm-actions { display: flex; gap: 8px; }
.tm-apply {
    flex: 1; padding: 8px;
    background: var(--accent); color: var(--bg-deep);
    border: none; border-radius: var(--radius-sm);
    font-family: 'Poppins', sans-serif; font-weight: 700; font-size: 0.84em;
    cursor: pointer; transition: opacity 0.2s;
}
.tm-apply:hover { opacity: 0.85; }
.tm-reset {
    flex: 1; padding: 8px;
    background: var(--bg-elevated); color: var(--text-secondary);
    border: 1px solid var(--border-subtle); border-radius: var(--radius-sm);
    font-family: 'Poppins', sans-serif; font-weight: 600; font-size: 0.84em;
    cursor: pointer; transition: all 0.2s;
}
.tm-reset:hover { color: var(--text-primary); }
.tm-info { margin-top: 8px; font-size: 0.78em; color: var(--accent); text-align: center; }

/* Time Machine active state on button */
.time-machine-btn.tm-active {
    border-color: var(--border-accent);
    color: var(--accent);
    background: var(--accent-dim);
}

/* Banner shown below nav when time machine is active */
.tm-banner {
    display: flex; align-items: center; justify-content: center; gap: 10px;
    background: rgba(238,205,20,0.09);
    border-bottom: 1px solid rgba(238,205,20,0.22);
    padding: 10px 16px;
    font-size: 0.82em; font-weight: 600; color: var(--accent);
    gap: 8px;
}
.tm-banner svg { flex-shrink: 0; }
.tm-banner-close {
    background: none; border: none; cursor: pointer;
    color: var(--accent); font-size: 1em; padding: 2px 5px;
    border-radius: 4px; transition: background 0.15s;
    margin-left: 8px;
}
.tm-banner-close:hover { background: rgba(238,205,20,0.15); }

.tm-active-banner {
    background: rgba(238,205,20,0.07);
    border: 1px solid rgba(238,205,20,0.18);
    border-radius: var(--radius-sm);
    padding: 9px 14px;
    text-align: center;
    font-size: 0.8em;
    color: var(--accent);
    font-weight: 600;
    margin-bottom: 14px;
}

/* ================================================================
   SEARCH BOX
   ================================================================ */
.search-box {
    position: relative;
    display: flex;
    align-items: center;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-pill);
    padding: 0 13px;
    height: 38px;
    min-width: 190px;
    gap: 8px;
    transition: all 0.2s ease;
    z-index: 10001;
}
.search-box:focus-within {
    border-color: var(--border-accent);
    box-shadow: 0 0 0 3px rgba(238,205,20,0.07);
    background: var(--bg-card);
}
.search-icon { display: flex; align-items: center; color: var(--text-muted); flex-shrink: 0; }
.search-icon svg circle { stroke: currentColor; }
.search-icon svg line  { stroke: currentColor; }

#search-input {
    background: transparent; border: none; outline: none;
    color: var(--text-primary);
    font-family: 'Poppins', sans-serif; font-size: 0.88em;
    flex: 1; min-width: 0;
}
#search-input::placeholder { color: var(--text-muted); }

.search-shortcut {
    font-size: 0.72em; color: var(--text-muted);
    background: var(--bg-elevated);
    padding: 2px 6px; border-radius: 4px; font-weight: 600; user-select: none;
}

/* Autocomplete */
.search-suggestions {
    position: absolute;
    top: calc(100% + 6px); left: 0; right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    max-height: 300px; overflow-y: auto;
    display: none; z-index: 10000;
    box-shadow: var(--shadow-lg);
}
.search-suggestions.active { display: block; }

.search-suggestion-item {
    padding: 10px 14px;
    display: flex; align-items: center; gap: 12px;
    cursor: pointer; transition: background 0.15s ease;
    border-bottom: 1px solid var(--border-subtle);
}
.search-suggestion-item:last-child { border-bottom: none; }
.search-suggestion-item:hover,
.search-suggestion-item.selected { background: rgba(238,205,20,0.06); }

.search-suggestion-item .player-avatar {
    width: 34px; height: 34px;
    border-radius: var(--radius-xs);
    border: 1px solid var(--border-subtle);
    image-rendering: pixelated; flex-shrink: 0;
}
.search-suggestion-item .player-details { flex: 1; min-width: 0; }
.search-suggestion-item .player-details .name {
    font-weight: 600; color: var(--text-primary); font-size: 0.88em;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.search-suggestion-item .player-details .score {
    font-size: 0.73em; color: var(--text-muted);
}

.search-suggestions::-webkit-scrollbar { width: 5px; }
.search-suggestions::-webkit-scrollbar-track { background: transparent; }
.search-suggestions::-webkit-scrollbar-thumb { background: var(--bg-elevated); border-radius: 3px; }

.search-suggestions-empty {
    padding: 14px 16px;
    font-size: 0.83em; color: var(--text-muted); text-align: center;
}

/* ================================================================
   NAVIGATION
   ================================================================ */
nav {
    position: sticky;
    top: 66px; z-index: 150;
    background: rgba(13,14,20,0.88);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border-subtle);
}

nav ul {
    list-style: none;
    display: flex; align-items: center; gap: 3px;
    padding: 9px 12px;
    overflow-x: auto; scrollbar-width: none;
    max-width: 1440px; margin: 0 auto;
}
nav ul::-webkit-scrollbar { display: none; }
nav ul li { flex-shrink: 0; }

.nav-btn {
    display: flex; align-items: center; gap: 7px;
    padding: 7px 15px;
    border-radius: var(--radius-pill);
    font-weight: 600; font-size: 0.84em;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.18s ease;
    white-space: nowrap;
    border: 1px solid transparent;
}
.nav-btn:hover {
    color: var(--text-primary);
    background: var(--bg-surface);
    border-color: var(--border-subtle);
}
.nav-btn.active {
    background: var(--accent);
    color: var(--bg-deep) !important;
    font-weight: 700;
    border-color: transparent;
    box-shadow: 0 2px 14px rgba(238,205,20,0.32);
    transform: none;
    animation: none;
}
.nav-btn.active img { filter: brightness(0.1); transform: none; }

.nav-btn img, #kit, .kit-nav-icon {
    width: 20px; height: 20px; max-width: 20px;
    object-fit: contain;
    filter: none; transition: filter 0.18s;
}
.nav-btn.active .kit-nav-icon { filter: brightness(0.1); }

/* ================================================================
   GUILD TOGGLE & OVERLAYS
   ================================================================ */
.guild-toggle {
    position: relative;
    display: flex; align-items: center;
    background: var(--bg-deep);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-pill);
    padding: 3px;
    flex-shrink: 0;
    overflow: hidden;
    order: -2; /* stays leftmost; player-count (order: -1) sits right after it */
}
.guild-toggle-btn {
    position: relative; z-index: 1;
    background: none; border: none;
    padding: 5px 13px;
    border-radius: var(--radius-pill);
    font-family: 'Poppins', sans-serif; font-weight: 600; font-size: 0.78em;
    color: var(--text-muted); cursor: pointer;
    transition: color 0.25s ease;
    white-space: nowrap;
}
.guild-toggle-btn.active { color: var(--bg-deep); }
.guild-toggle-btn:not(.active):hover { color: var(--text-secondary); }
.guild-toggle-label { pointer-events: none; }
.guild-toggle-slider {
    position: absolute; top: 3px; bottom: 3px; left: 3px;
    background: var(--accent);
    border-radius: var(--radius-pill);
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1), width 0.28s ease;
    pointer-events: none;
}

/* Full-screen guild switch overlay */
.guild-overlay {
    position: fixed; inset: 0; z-index: 9999;
    background: var(--bg-deep);
    display: flex; flex-direction: column;
    align-items: center; justify-content: center; gap: 18px;
    pointer-events: none;
}
.guild-overlay.active { pointer-events: all; }
.guild-overlay-text {
    font-size: 2.2em; font-weight: 800;
    color: var(--ov-accent, var(--accent));
    letter-spacing: 2px;
}
.guild-overlay-spinner {
    display: flex; flex-direction: column; align-items: center; gap: 10px;
}
.guild-overlay-spinner p { font-size: 0.85em; color: var(--text-muted); }

/* Page sweep transition */
.page-sweep {
    position: fixed; top: 0; left: -100%; right: 100%; height: 3px; z-index: 8000;
    background: var(--accent); opacity: 0;
    transition: left 0.4s ease, right 0.4s ease, opacity 0.1s;
}
.page-sweep.active {
    left: 0; right: 0; opacity: 1;
}

/* ================================================================
   MAIN CONTENT AREA
   ================================================================ */
#tabulky {
    max-width: 1440px;
    margin: 20px auto;
    padding: 0 14px;
}

.table-container {
    width: 100%; position: relative;
    overflow-x: visible;
    padding: 0 0 0 0;
}

.tabulka { display: none; width: 100%; overflow: visible !important; }
.tabulka.active { display: block; }

/* Loading / error */
.loading-indicator {
    text-align: center; padding: 80px 20px; color: var(--text-muted);
}
.spinner {
    width: 38px; height: 38px;
    border: 3px solid var(--bg-elevated);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    margin: 0 auto 14px;
}
@keyframes spin { to { transform: rotate(360deg); } }

.error-message { text-align: center; padding: 60px 20px; color: var(--text-secondary); }
.error-icon { font-size: 2em; margin-bottom: 12px; }
.error-message h3 { color: var(--text-primary); margin-bottom: 8px; font-size: 1.05em; }
.error-message p  { margin-bottom: 20px; }
.retry-btn {
    padding: 10px 24px; background: var(--accent); color: var(--bg-deep);
    border: none; border-radius: var(--radius-pill);
    font-family: 'Poppins', sans-serif; font-weight: 700; font-size: 0.88em;
    cursor: pointer; transition: opacity 0.2s;
}
.retry-btn:hover { opacity: 0.85; }

.tabulka-loading { min-height: 160px; }

/* ================================================================
   RECENTLY TESTED
   ================================================================ */
.recently-tested { margin-bottom: 20px; }
.recent-header {
    font-size: 0.72em; font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase; letter-spacing: 1.4px;
    margin-bottom: 10px;
}
.recent-cards {
    display: flex; gap: 8px;
    overflow-x: auto; padding: 8px 0 4px;
    scrollbar-width: none;
}
.recent-cards::-webkit-scrollbar { display: none; }

.recent-card {
    display: flex; align-items: center; gap: 10px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 10px 14px;
    min-width: 155px; flex-shrink: 0;
    cursor: pointer;
    transition: border-color 0.2s, transform 0.2s;
}
.recent-card:hover {
    border-color: var(--border-accent);
    transform: translateY(-2px);
}
.recent-avatar { width: 32px; height: 32px; border-radius: 6px; image-rendering: pixelated; flex-shrink: 0; }
.recent-info   { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.recent-nick   { font-weight: 700; font-size: 0.86em; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.recent-date   { font-size: 0.7em; color: var(--text-muted); }
.recent-kit-badge { display: flex; align-items: center; gap: 4px; font-size: 0.7em; font-weight: 600; margin-top: 2px; }
.recent-badge  { font-weight: 700; font-size: 0.78em; padding: 2px 9px; border-radius: 6px; white-space: nowrap; margin-left: auto; }
.recent-kit-icon { width: 20px; height: 20px; object-fit: contain; margin-left: auto; flex-shrink: 0; border-radius: 4px; }
.recent-kit-icon + .recent-badge { margin-left: 6px; }
.recent-dir  { font-size: 0.78em; line-height: 1; }
.recent-up   { color: #4ade80; }
.recent-dn   { color: #f87171; }

/* ================================================================
   OVERALL LEADERBOARD
   ================================================================ */
#overall-tabulka {
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: center;
    padding: 12px 0;
    max-width: 1100px;
    width: 100%;
    margin: 0 auto;
    overflow: visible;
}

#overall-tabulka:empty,
#overall-tabulka.tabulka-loading {
    background: none; border-color: transparent;
    box-shadow: none; padding: 0;
}

/* Player card */
.player-card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
    padding: 14px 20px;
    color: var(--text-primary);
    max-width: 1100px;
    width: 100%;
    font-family: 'Poppins', sans-serif;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
    cursor: pointer;
    position: relative;
    overflow: visible;
}

.player-card:hover {
    border-color: rgba(238,205,20,0.18);
    background: var(--bg-surface);
    box-shadow: 0 4px 28px rgba(0,0,0,0.36), 0 0 0 1px rgba(238,205,20,0.1);
}

/* Card entrance animation */
.player-card.card-enter {
    animation: cardIn 0.4s cubic-bezier(0.16,1,0.3,1) calc(var(--card-i,0) * 45ms) both;
}
@keyframes cardIn {
    from { opacity: 0; transform: translateY(18px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Compact row layout */
.card-header, .compact-row {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* Rank badge */
.rank-badge {
    font-weight: 800;
    font-size: 1.2em;
    border-radius: var(--radius-sm);
    padding: 6px 14px;
    min-width: 48px;
    text-align: center;
    flex-shrink: 0;
    color: var(--bg-deep) !important;
    line-height: 1.2;
    box-shadow: 0 0 18px rgba(var(--rank-color-rgb, 238,205,20), 0.38);
}

/* Skin */
.skin-bg { flex-shrink: 0; }
.skin {
    width: 56px; height: 56px;
    border-radius: var(--radius-sm);
    image-rendering: pixelated;
    display: block;
    border: 2px solid rgba(var(--rank-color-rgb, 238,205,20), 0.30);
    box-shadow: 0 0 12px rgba(var(--rank-color-rgb, 238,205,20), 0.16);
    transition: border-color 0.2s, box-shadow 0.2s;
}
.player-card:hover .skin {
    border-color: rgba(var(--rank-color-rgb, 238,205,20), 0.55);
    box-shadow: 0 0 18px rgba(var(--rank-color-rgb, 238,205,20), 0.28);
}

/* Player info */
.player-info {
    display: flex; flex-direction: column;
    justify-content: center; min-width: 130px;
    flex-shrink: 0;
}
.player-name {
    font-size: 1.05em; font-weight: 700; color: var(--text-primary);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    margin-bottom: 3px;
}
.score-row { display: flex; align-items: center; gap: 8px; }
.score {
    font-size: 0.95em; color: var(--accent);
    font-weight: 700; font-variant-numeric: tabular-nums;
}
.score-clickable { cursor: pointer; }
.score-clickable:hover { opacity: 0.75; }
.score-title {
    font-size: 0.66em; font-weight: 700; letter-spacing: 0.4px;
    padding: 2px 9px; border-radius: 10px;
    background: color-mix(in srgb, var(--st-color,#888) 14%, transparent);
    color: var(--st-color, #888);
    border: 1px solid color-mix(in srgb, var(--st-color,#888) 28%, transparent);
}

/* Kits row */
.kits-row {
    display: flex; gap: 5px;
    align-items: flex-end;
    background: var(--bg-deep);
    border-radius: var(--radius-sm);
    padding: 8px 10px;
    overflow: visible;
    flex-wrap: wrap;
    flex: 1;
}

/* Position change */
.pos-change {
    display: flex; align-items: center;
    justify-content: center; gap: 2px;
    font-size: 0.5em; font-weight: 700; line-height: 1;
    margin-top: 2px; letter-spacing: 0.3px;
}
.pos-up   { color: #4ade80; }
.pos-down { color: #f87171; }

.pos-flash-up   { animation: posFlashUp 1.5s ease forwards; }
.pos-flash-down { animation: posFlashDown 1.5s ease forwards; }
@keyframes posFlashUp   { 0% { box-shadow: 0 0 20px rgba(74,222,128,0.28); } 100% { box-shadow: none; } }
@keyframes posFlashDown { 0% { box-shadow: 0 0 20px rgba(248,113,113,0.28); } 100% { box-shadow: none; } }

/* Time Machine blacklisted */
.tm-blacklisted { opacity: 0.45; }
.tm-blacklisted-tag {
    font-size: 0.65em; font-weight: 600;
    color: #f87171;
    background: rgba(248,113,113,0.1);
    border: 1px solid rgba(248,113,113,0.25);
    border-radius: 4px; padding: 1px 7px;
    margin-left: 6px;
}

/* Load more button */
.load-more-btn {
    padding: 11px 32px;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-pill);
    color: var(--text-secondary);
    font-family: 'Poppins', sans-serif;
    font-weight: 600; font-size: 0.88em;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 8px;
}
.load-more-btn:hover {
    border-color: var(--border-accent); color: var(--accent);
}

/* ================================================================
   KIT COLUMNS (TIER TABLE)
   ================================================================ */
.kit-title {
    font-size: 1.5em; font-weight: 800;
    letter-spacing: 2px; text-transform: uppercase;
    color: var(--text-primary);
    text-align: center;
    margin: 0 0 18px;
    padding-top: 4px;
}

.retired-toggle-wrap { text-align: center; margin-bottom: 18px; }
.retired-toggle-btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 7px 18px;
    background: var(--bg-surface);
    color: var(--text-muted);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-pill);
    font-family: 'Poppins', sans-serif; font-weight: 600; font-size: 0.8em;
    cursor: pointer; transition: all 0.18s ease;
}
.retired-toggle-btn:hover { border-color: rgba(255,107,107,0.3); color: #ff6b6b; }
.retired-toggle-btn.active {
    background: rgba(255,107,107,0.08);
    color: #ff6b6b;
    border-color: rgba(255,107,107,0.35);
}
.retired-toggle-icon { font-weight: 700; }

.kit-columns {
    display: flex !important;
    flex-direction: row !important;
    gap: 14px;
    width: 100% !important;
    overflow-x: auto;
    overflow-y: visible;
    scroll-behavior: smooth;
    scrollbar-width: thin;
    scrollbar-color: var(--bg-elevated) transparent;
    padding-bottom: 10px;
    align-items: flex-start;
    /* Center the columns when they fit; `safe` falls back to flex-start on overflow so the
       leading columns never get clipped/unreachable in the horizontal scroll area.
       The plain `center` line is a fallback for browsers that don't understand the
       `safe` keyword — without it, the whole declaration is invalid and the browser
       silently defaults to left-aligned columns instead.
       Both are !important: display/flex-direction above are already !important, which
       means the JS that builds this element likely sets inline styles on it (e.g. for
       scroll-width math) — an inline style beats a plain external rule, so width and
       justify-content need the same treatment or they'll get silently overridden. */
    justify-content: center !important;
    justify-content: safe center !important;
}
.kit-columns::-webkit-scrollbar { height: 4px; }
.kit-columns::-webkit-scrollbar-track { background: transparent; }
.kit-columns::-webkit-scrollbar-thumb { background: var(--bg-elevated); border-radius: 3px; }

/* Tier column */
.kit-tier-col {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    min-width: 205px; max-width: 205px; width: 205px;
    flex-shrink: 0;
    display: flex; flex-direction: column;
    border: 1px solid var(--border-subtle);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    scroll-snap-align: start;
    border-top: 3px solid var(--bg-elevated);
}

.kit-tier-col[data-tier="Tier 1"] { border-top-color: var(--tier-1);    box-shadow: var(--shadow-sm), 0 -4px 20px rgba(var(--tier-1-rgb), 0.25); }
.kit-tier-col[data-tier="Tier 2"] { border-top-color: var(--tier-2);    box-shadow: var(--shadow-sm), 0 -4px 16px rgba(var(--tier-2-rgb), 0.18); }
.kit-tier-col[data-tier="Tier 3"] { border-top-color: var(--tier-3-lt); box-shadow: var(--shadow-sm), 0 -4px 16px rgba(var(--tier-3-lt-rgb), 0.18); }
.kit-tier-col[data-tier="Tier 4"],
.kit-tier-col[data-tier="Tier 5"] { border-top-color: var(--tier-45);   box-shadow: var(--shadow-sm), 0 -4px 12px rgba(var(--tier-45-rgb), 0.14); }

/* Tier column headers — override JS inline styles via CSS specificity */
.kit-tier-header {
    font-size: 0.78em !important;
    font-weight: 700 !important;
    color: var(--text-primary) !important;
    text-align: center !important;
    letter-spacing: 1.4px !important;
    text-transform: uppercase !important;
    padding: 13px 12px 11px !important;
    border-bottom: 1px solid var(--border-subtle) !important;
    border-radius: 0 !important;
    background: var(--bg-surface) !important;
    box-shadow: none !important;
    text-shadow: none !important;
}

/* Per-tier header colouring */
.kit-tier-col[data-tier="Tier 1"] .kit-tier-header {
    color: var(--tier-1) !important;
    background: linear-gradient(90deg, rgba(255,207,74,0.14) 0%, rgba(255,207,74,0.05) 100%) !important;
    border-bottom-color: rgba(255,207,74,0.15) !important;
    text-shadow: 0 0 22px rgba(255,207,74,0.75) !important;
}
.kit-tier-col[data-tier="Tier 2"] .kit-tier-header {
    color: var(--tier-2) !important;
    background: linear-gradient(90deg, rgba(164,179,199,0.13) 0%, rgba(164,179,199,0.04) 100%) !important;
    border-bottom-color: rgba(164,179,199,0.15) !important;
    text-shadow: 0 0 18px rgba(164,179,199,0.65) !important;
}
.kit-tier-col[data-tier="Tier 3"] .kit-tier-header {
    color: var(--tier-3-lt) !important;
    background: linear-gradient(90deg, rgba(181,99,38,0.14) 0%, rgba(181,99,38,0.04) 100%) !important;
    border-bottom-color: rgba(181,99,38,0.16) !important;
    text-shadow: 0 0 18px rgba(181,99,38,0.65) !important;
}
.kit-tier-col[data-tier="Tier 4"] .kit-tier-header,
.kit-tier-col[data-tier="Tier 5"] .kit-tier-header {
    color: var(--tier-45) !important;
    background: linear-gradient(90deg, rgba(101,91,121,0.13) 0%, rgba(101,91,121,0.04) 100%) !important;
    border-bottom-color: rgba(101,91,121,0.14) !important;
    text-shadow: 0 0 16px rgba(101,91,121,0.6) !important;
}

.kit-tier-list {
    display: flex; flex-direction: column;
    gap: 3px; padding: 8px 7px; width: 100%;
}

/* Player cards inside tier columns */
.kit-player {
    display: flex; align-items: center; gap: 9px;
    padding: 8px 10px;
    background: transparent;
    border-radius: var(--radius-xs);
    color: var(--text-primary);
    font-weight: 600; font-size: 0.86em;
    cursor: pointer;
    transition: background 0.15s ease;
    border: 1px solid transparent;
    will-change: transform;
}
.kit-player:hover {
    background: var(--bg-surface);
    border-color: var(--border-subtle);
}

/* Per-tier hover tint */
.kit-tier-col[data-tier="Tier 1"] .kit-player:hover { background: rgba(255,207,74,0.10); border-color: rgba(255,207,74,0.20); box-shadow: 0 0 12px rgba(255,207,74,0.08); }
.kit-tier-col[data-tier="Tier 2"] .kit-player:hover { background: rgba(164,179,199,0.09); border-color: rgba(164,179,199,0.18); box-shadow: 0 0 10px rgba(164,179,199,0.08); }
.kit-tier-col[data-tier="Tier 3"] .kit-player:hover { background: rgba(181,99,38,0.10); border-color: rgba(181,99,38,0.20); box-shadow: 0 0 10px rgba(181,99,38,0.08); }
.kit-tier-col[data-tier="Tier 4"] .kit-player:hover,
.kit-tier-col[data-tier="Tier 5"] .kit-player:hover { background: rgba(101,91,121,0.10); border-color: rgba(101,91,121,0.18); box-shadow: 0 0 10px rgba(101,91,121,0.07); }

.kit-player img {
    width: 32px; height: 32px;
    border-radius: 6px;
    image-rendering: pixelated; flex-shrink: 0;
    transition: transform 0.15s ease;
}
.kit-player:hover img { transform: scale(1.08); }

.kit-player span {
    flex: 1; font-weight: 600; font-size: 0.95em;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    color: var(--text-primary);
}

/* LT players within a tier column (subtle de-emphasis vs HT) */
.kit-player-lt {
    background: rgba(255,255,255,0.03);
    opacity: 0.82;
}
.kit-player-lt:hover { opacity: 1; }

/* Tint the LT background with the column's own tier colour instead of plain
   white, so it reads as "same tier, lower half" rather than just dimmed */
.kit-tier-col[data-tier="Tier 1"] .kit-player-lt { background: rgba(var(--tier-1-lt-rgb), 0.06); }
.kit-tier-col[data-tier="Tier 2"] .kit-player-lt { background: rgba(var(--tier-2-lt-rgb), 0.07); }
.kit-tier-col[data-tier="Tier 3"] .kit-player-lt { background: rgba(var(--tier-3-lt-rgb), 0.07); }
.kit-tier-col[data-tier="Tier 4"] .kit-player-lt,
.kit-tier-col[data-tier="Tier 5"] .kit-player-lt { background: rgba(var(--tier-45-rgb), 0.08); }

/* Thin divider where the HT group ends and the LT group begins */
.kit-player:not(.kit-player-lt) + .kit-player-lt {
    margin-top: 7px;
    padding-top: 11px;
    border-top: 1px dashed var(--border-subtle);
}

/* Retired */
.kit-player-retired { opacity: 0.48; }
.kit-player-retired:hover { opacity: 0.72; }

.retired-badge {
    display: inline-flex; align-items: center;
    background: rgba(255,107,107,0.12);
    color: #ff6b6b; font-weight: 700;
    font-size: 0.66em; border-radius: 4px;
    padding: 2px 5px; flex-shrink: 0;
    border: 1px solid rgba(255,107,107,0.28);
}

/* Unique kit backgrounds (tabulky.html) — keep neutral */
.kit-cpvp, .kit-axe, .kit-sword, .kit-uhc,
.kit-npot, .kit-pot, .kit-smp, .kit-diasmp, .kit-mace { background: transparent; }

.kit-table.hidden { display: none; }

/* Kit switcher */
.kit-switcher {
    display: flex; gap: 6px; justify-content: center;
    flex-wrap: wrap; margin-bottom: 18px;
}
.kit-switcher button {
    padding: 7px 15px; border-radius: var(--radius-pill);
    border: 1px solid var(--border-subtle);
    background: var(--bg-surface); color: var(--text-secondary);
    font-family: 'Poppins', sans-serif; font-weight: 600; font-size: 0.83em;
    cursor: pointer; transition: all 0.15s ease;
}
.kit-switcher button:hover { color: var(--text-primary); border-color: var(--border-accent); }
.kit-switcher button.active {
    background: var(--accent); color: var(--bg-deep);
    border-color: transparent; font-weight: 700;
}

/* ================================================================
   KIT BADGES (shared across overall & modals)
   ================================================================ */
.kit-badge,
.kit-badge-missing {
    display: flex; flex-direction: column;
    align-items: center; gap: 2px;
    position: relative; cursor: default;
    min-width: 44px; max-width: 44px; width: 44px;
    padding: 3px;
}
.kit-badge:hover { transform: scale(1.08); z-index: 10; }

.badge-journey-clickable { cursor: pointer; }
.badge-journey-clickable:hover .kit-icon-circle {
    box-shadow: 0 0 12px var(--tier-color, rgba(238,205,20,0.4));
}

/* Icon circle */
.kit-icon-circle,
.kit-icon-missing {
    display: flex; align-items: center; justify-content: center;
    width: 34px; height: 34px;
    min-width: 34px; min-height: 34px;
    max-width: 34px; max-height: 34px;
    border-radius: 50%;
    border: 2.5px solid var(--border-subtle);
    background: var(--bg-elevated);
    margin-bottom: 3px;
    box-sizing: border-box;
    transition: transform 0.18s, border-color 0.18s;
}
.kit-icon-circle:hover { transform: scale(1.1); }
.kit-icon-missing { background: none !important; border: none !important; }

.kit-icon, .kit-icon-missing svg {
    width: 22px !important; height: 22px !important;
    display: block; image-rendering: pixelated;
    background: none; border-radius: 0;
}

.kit-icon-missing svg { margin: 0; padding: 0; }
.kit-icon-missing svg circle { stroke: #555; stroke-width: 2.5; fill: none; stroke-dasharray: 4; }

/* Tier text label */
.kit-tier-text,
.kit-tier-missing {
    display: block;
    min-width: 38px !important; max-width: 38px !important; width: 38px !important;
    padding: 3px 2px !important;
    font-size: 0.82em !important; font-weight: 700 !important;
    border-radius: 7px !important;
    text-align: center; line-height: 1.15;
    box-sizing: border-box;
    box-shadow: 0 1px 4px rgba(0,0,0,0.25);
}
.kit-tier-missing { background: var(--bg-elevated) !important; color: var(--text-muted) !important; }

/* ----------------------------------------------------------------
   TIER GLOW — kit badge icon circles + tier text labels
   Glow intensity scales with tier prestige
   ---------------------------------------------------------------- */
/* HT1 — gold, strongest glow */
.kit-badge[data-kit-tier="60"] .kit-icon-circle { box-shadow: 0 0 14px rgba(255,207,74,0.50); border-color: rgba(255,207,74,0.75) !important; }
.kit-badge[data-kit-tier="60"] .kit-tier-text   { box-shadow: 0 2px 16px rgba(255,207,74,0.60) !important; }

/* LT1 — muted gold */
.kit-badge[data-kit-tier="48"] .kit-icon-circle { box-shadow: 0 0 12px rgba(213,179,85,0.42); border-color: rgba(213,179,85,0.65) !important; }
.kit-badge[data-kit-tier="48"] .kit-tier-text   { box-shadow: 0 2px 14px rgba(213,179,85,0.50) !important; }

/* HT2 — silver */
.kit-badge[data-kit-tier="32"] .kit-icon-circle { box-shadow: 0 0 12px rgba(164,179,199,0.42); border-color: rgba(164,179,199,0.65) !important; }
.kit-badge[data-kit-tier="32"] .kit-tier-text   { box-shadow: 0 2px 13px rgba(164,179,199,0.50) !important; }

/* LT2 — silver-grey */
.kit-badge[data-kit-tier="24"] .kit-icon-circle { box-shadow: 0 0 9px rgba(136,141,149,0.38); border-color: rgba(136,141,149,0.55) !important; }
.kit-badge[data-kit-tier="24"] .kit-tier-text   { box-shadow: 0 2px 11px rgba(136,141,149,0.42) !important; }

/* HT3 — bronze dark */
.kit-badge[data-kit-tier="16"] .kit-icon-circle { box-shadow: 0 0 11px rgba(143,89,49,0.45); border-color: rgba(143,89,49,0.65) !important; }
.kit-badge[data-kit-tier="16"] .kit-tier-text   { box-shadow: 0 2px 13px rgba(143,89,49,0.50) !important; }

/* LT3 — bronze light */
.kit-badge[data-kit-tier="10"] .kit-icon-circle { box-shadow: 0 0 11px rgba(181,99,38,0.42); border-color: rgba(181,99,38,0.62) !important; }
.kit-badge[data-kit-tier="10"] .kit-tier-text   { box-shadow: 0 2px 12px rgba(181,99,38,0.48) !important; }

/* HT4, LT4, HT5, LT5 — purple, subtle */
.kit-badge[data-kit-tier="5"]  .kit-icon-circle,
.kit-badge[data-kit-tier="3"]  .kit-icon-circle,
.kit-badge[data-kit-tier="2"]  .kit-icon-circle,
.kit-badge[data-kit-tier="1"]  .kit-icon-circle { box-shadow: 0 0 8px rgba(101,91,121,0.38); border-color: rgba(101,91,121,0.55) !important; }
.kit-badge[data-kit-tier="5"]  .kit-tier-text,
.kit-badge[data-kit-tier="3"]  .kit-tier-text,
.kit-badge[data-kit-tier="2"]  .kit-tier-text,
.kit-badge[data-kit-tier="1"]  .kit-tier-text   { box-shadow: 0 2px 10px rgba(101,91,121,0.40) !important; }

/* Retired tiers — same hue, reduced glow */
.kit-badge[data-kit-tier="54"] .kit-icon-circle { box-shadow: 0 0 10px rgba(255,207,74,0.22); }
.kit-badge[data-kit-tier="43"] .kit-icon-circle { box-shadow: 0 0 8px  rgba(213,179,85,0.18); }
.kit-badge[data-kit-tier="29"] .kit-icon-circle { box-shadow: 0 0 8px  rgba(164,179,199,0.18); }
.kit-badge[data-kit-tier="22"] .kit-icon-circle { box-shadow: 0 0 6px  rgba(136,141,149,0.15); }

/* Tooltip */
.tooltip { position: relative; cursor: pointer; }
.tooltip .tooltiptext,
.kit-badge.tooltip .tooltiptext {
    visibility: hidden;
    min-width: 86px; width: max-content; max-width: 150px;
    background: var(--bg-elevated); color: var(--text-primary);
    text-align: center; border-radius: var(--radius-sm);
    padding: 6px 10px;
    position: absolute; z-index: 1000;
    /* Těsně nad badge (dřív +8px). Karty v žebříčku jsou nízké, takže
       s velkou mezerou tooltip vyletěl nad kartu a vypadal, že patří
       k řádku nad ním. Šipka níž ho navíc vizuálně přilepí k badgi. */
    bottom: calc(100% + 5px); left: 50%;
    transform: translateX(-50%);
    opacity: 0; transition: opacity 0.14s;
    font-size: 0.8em; line-height: 1.4;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-subtle);
    pointer-events: none;
    white-space: nowrap;
}
/* Šipka směřující dolů na badge */
.tooltip .tooltiptext::after,
.kit-badge.tooltip .tooltiptext::after {
    content: '';
    position: absolute; top: 100%; left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: var(--bg-elevated);
}
.tooltip:hover .tooltiptext,
.kit-badge.tooltip:hover .tooltiptext { visibility: visible; opacity: 1; }

/* Hovering a card lifts it above its neighbours, so the tooltip can never be
   painted underneath the row above it. */
.player-card:hover, .kit-player-row:hover { z-index: 20; }

/* Old kit-player-row / kit-badges (kit tabulky) */
.kit-badge-row { display: flex; flex-direction: column; gap: 0; width: 100%; align-items: center; }
.kit-player-row {
    display: flex; align-items: center;
    margin-bottom: 8px;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 18px 28px 16px;
    color: var(--text-primary);
    max-width: 1100px; width: 100%;
    border: 1px solid var(--border-subtle);
}
.kit-player-row span { font-size: 1em; font-weight: 700; color: var(--text-primary); margin-right: 14px; }
.kit-player-row .kit-badges {
    display: flex; gap: 4px; align-items: flex-end;
    background: var(--bg-deep); border-radius: var(--radius-sm); padding: 7px;
}
.kit-badge img { width: 22px; height: 22px; border-radius: 4px; image-rendering: pixelated; }
.kit-badge .kit-tier {
    font-weight: 700; font-size: 0.82em;
    padding: 2px 8px; border-radius: 5px; text-align: center;
}

/* ================================================================
   PLAYER MODAL
   ================================================================ */
.player-modal {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.72);
    display: none;
    align-items: center; justify-content: center;
    z-index: 1000; padding: 16px;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}
.player-modal[style*="display: flex"],
.player-modal[style*="display:flex"] {
    display: flex;
    animation: modalIn 0.25s ease;
}
@keyframes modalIn { from { opacity: 0; } to { opacity: 1; } }

.player-modal-content {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    padding: 0;
    min-width: 360px; max-width: 500px; width: 100%;
    color: var(--text-primary);
    position: relative; overflow: hidden;
    box-shadow: var(--shadow-lg), 0 0 0 1px var(--border-subtle);
    text-align: center;
    border: 1px solid var(--border-subtle);
    max-height: 92vh; overflow-y: auto;
    animation: modalContentIn 0.3s cubic-bezier(0.16,1,0.3,1) 0.08s both;
}
@keyframes modalContentIn {
    from { opacity: 0; transform: translateY(16px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}
.player-modal-content::-webkit-scrollbar { width: 4px; }
.player-modal-content::-webkit-scrollbar-track { background: transparent; }
.player-modal-content::-webkit-scrollbar-thumb { background: var(--bg-elevated); border-radius: 2px; }

/* Position children correctly */
.player-modal-content > *:not(.player-modal-banner):not(.player-modal-close):not(.modal-loader) {
    position: relative; z-index: 1;
}

/* Banner */
.player-modal-banner {
    height: 96px;
    background: linear-gradient(135deg, var(--bg-surface) 0%, var(--bg-elevated) 100%);
    border-radius: 0; position: absolute; top: 0; left: 0; right: 0; z-index: 0;
    pointer-events: none;
}
.player-modal-banner::after {
    content: '';
    position: absolute; bottom: 0; left: 0; right: 0; height: 48px;
    background: linear-gradient(to bottom, transparent, var(--bg-card));
}

/* Close button */
.player-modal-close {
    position: absolute; right: 14px; top: 12px;
    width: 30px; height: 30px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.2em; cursor: pointer; color: var(--text-primary);
    background: rgba(0,0,0,0.35); border-radius: 50%;
    transition: background 0.18s; z-index: 10; line-height: 1;
}
.player-modal-close:hover { background: rgba(255,255,255,0.14); }

/* Modal loader */
.modal-loader { display: none; position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%); z-index: 10; }
.player-modal-content.modal-loading .modal-loader { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.player-modal-content.modal-loading > *:not(.player-modal-close):not(.modal-loader) { opacity: 0; }
.modal-loader-spinner {
    width: 34px; height: 34px;
    border: 3px solid var(--bg-elevated); border-top-color: var(--accent);
    border-radius: 50%; animation: spin 0.7s linear infinite;
}
.modal-loader-text { font-size: 0.78em; color: var(--text-muted); }

/* Avatar wrap */
.avatar-deco-wrap {
    position: relative; display: inline-block;
    margin-top: 62px; margin-bottom: 10px;
    width: 90px; height: 90px;
    z-index: 2;
}
.avatar-deco-wrap .player-modal-skin {
    position: relative; z-index: 1; margin: 0;
}
.player-modal-skin {
    width: 90px !important; height: 90px !important;
    border-radius: var(--radius-md);
    border: 3px solid var(--bg-card);
    box-shadow: var(--shadow-md);
    image-rendering: pixelated;
    display: block;
    margin-left: auto; margin-right: auto;
}
/* When skin is direct child of modal (kit pages without avatar-deco-wrap) */
.player-modal-content > .player-modal-skin { margin-top: 28px; }
.avatar-deco-overlay {
    position: absolute; top: -10px; left: -10px;
    width: 110px; height: 110px;
    pointer-events: none; z-index: 2;
    image-rendering: auto;
}

/* Avatar deco glow layer */
.avatar-deco-wrap::before {
    content: ''; position: absolute;
    top: 2px; left: 2px; right: 2px; bottom: 2px;
    border-radius: var(--radius-md);
    pointer-events: none; z-index: 0; opacity: 0; transition: opacity 0.4s;
}

/* Decoration glows */
.avatar-deco-wrap[data-deco="diamond"]::before   { opacity: 1; box-shadow: 0 0 14px rgba(91,240,255,0.45), 0 0 34px rgba(91,240,255,0.18); animation: glowPulse 2.5s ease-in-out infinite; }
.avatar-deco-wrap[data-deco="diamond"] .player-modal-skin { border-color: rgba(91,240,255,0.45); }
.avatar-deco-wrap[data-deco="netherite"]::before { opacity: 1; box-shadow: 0 0 10px rgba(100,80,70,0.45); }
.avatar-deco-wrap[data-deco="netherite"] .player-modal-skin { border-color: rgba(80,70,65,0.6); }
.avatar-deco-wrap[data-deco="enchant"]::before   { opacity: 1; box-shadow: 0 0 16px rgba(168,85,247,0.45), 0 0 40px rgba(168,85,247,0.18); animation: glowPulse 2s ease-in-out infinite; }
.avatar-deco-wrap[data-deco="enchant"] .player-modal-skin { border-color: rgba(168,85,247,0.45); }
.avatar-deco-wrap[data-deco="fire"]::before      { opacity: 1; box-shadow: 0 0 16px rgba(255,100,30,0.45), 0 0 36px rgba(255,60,0,0.2); animation: glowPulse 1.5s ease-in-out infinite; }
.avatar-deco-wrap[data-deco="fire"] .player-modal-skin { border-color: rgba(255,80,20,0.5); }
.avatar-deco-wrap[data-deco="crown"]::before     { opacity: 1; box-shadow: 0 0 14px rgba(255,207,74,0.5), 0 0 30px rgba(255,207,74,0.2); animation: glowPulse 2s ease-in-out infinite; }
.avatar-deco-wrap[data-deco="crown"] .player-modal-skin { border-color: var(--tier-1); }
.avatar-deco-wrap[data-deco="ender"]::before     { opacity: 1; box-shadow: 0 0 14px rgba(100,50,160,0.5); animation: glowPulse 3s ease-in-out infinite; }
.avatar-deco-wrap[data-deco="ender"] .player-modal-skin { border-color: rgba(100,50,160,0.55); }
.avatar-deco-wrap[data-deco="lightning"]::before { opacity: 1; box-shadow: 0 0 20px rgba(200,220,255,0.5); animation: glowPulse 1s ease-in-out infinite; }
.avatar-deco-wrap[data-deco="catears"]::before   { opacity: 1; box-shadow: 0 0 14px rgba(255,180,220,0.4); }
.avatar-deco-wrap[data-deco="sakura"]::before    { opacity: 1; box-shadow: 0 0 14px rgba(255,170,200,0.4); }
.avatar-deco-wrap[data-deco="bedrock"]::before   { opacity: 1; box-shadow: 0 0 8px rgba(140,140,140,0.35); }
.avatar-deco-wrap[data-deco="kuromi"]::before    { opacity: 1; box-shadow: 0 0 14px rgba(120,60,160,0.4); animation: glowPulse 3s ease-in-out infinite; }

@keyframes glowPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* Name */
.player-modal-name {
    font-size: 1.45em; font-weight: 800; letter-spacing: 0.4px;
    margin: 0 24px 4px;
    color: var(--text-primary);
}

/* Name effects */
.name-effect-gradient {
    background: linear-gradient(135deg, #fff 0%, var(--accent) 100%);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.name-effect-rainbow {
    background: linear-gradient(90deg, #ff6b6b, #ffd93d, #6bcb77, #4d96ff, #c77dff);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
    background-size: 200%; animation: rainbowAnim 3s linear infinite;
}
@keyframes rainbowAnim { 0% { background-position: 0%; } 100% { background-position: 200%; } }
.name-effect-glow { text-shadow: 0 0 18px rgba(238,205,20,0.75), 0 0 36px rgba(238,205,20,0.35); }
.name-effect-glitch { animation: glitchAnim 3s step-end infinite; }
@keyframes glitchAnim {
    0%,90%,100% { clip-path: none; transform: none; }
    92% { clip-path: polygon(0 20%,100% 20%,100% 40%,0 40%); transform: translateX(-3px); }
    94% { clip-path: polygon(0 60%,100% 60%,100% 80%,0 80%); transform: translateX(3px); }
    96% { clip-path: none; transform: none; }
}
.name-effect-typewriter { overflow: hidden; white-space: nowrap; animation: typewriterAnim 2s steps(20,end) 0.3s both; }
@keyframes typewriterAnim { from { max-width: 0; } to { max-width: 100%; } }

/* Bio */
.player-modal-bio {
    font-size: 0.8em; color: var(--text-secondary);
    margin: 0 28px 10px; line-height: 1.5; font-style: italic;
    word-break: break-word;
}

/* Position row */
.player-modal-position {
    display: flex; align-items: center; justify-content: center;
    gap: 10px; margin: 0 0 8px; padding: 0 20px; flex-wrap: wrap;
}
.player-modal-rank {
    font-size: 1em; font-weight: 800;
    border-radius: var(--radius-sm); padding: 5px 14px;
    background: var(--bg-elevated); color: var(--text-secondary);
    min-width: 46px; text-align: center;
}
.player-modal-rank.rank-1 { background: rgba(255,207,74,0.16); color: var(--tier-1); box-shadow: 0 0 22px rgba(255,207,74,0.40), inset 0 0 0 1px rgba(255,207,74,0.22); }
.player-modal-rank.rank-2 { background: rgba(164,179,199,0.16); color: var(--tier-2); box-shadow: 0 0 18px rgba(164,179,199,0.35), inset 0 0 0 1px rgba(164,179,199,0.22); }
.player-modal-rank.rank-3 { background: rgba(181,99,38,0.16); color: var(--tier-3-lt); box-shadow: 0 0 16px rgba(181,99,38,0.32), inset 0 0 0 1px rgba(181,99,38,0.20); }
.player-modal-rank.rank-other { background: var(--bg-elevated); color: var(--text-muted); }

.player-modal-score { font-size: 0.9em; font-weight: 700; color: var(--text-primary); }
.player-modal-score-title { font-size: 0.78em; font-weight: 600; }

.player-modal-days { font-size: 0.75em; color: var(--text-muted); margin-bottom: 5px; }
.player-modal-favkit {
    display: flex; align-items: center; justify-content: center;
    gap: 6px; font-size: 0.8em; margin-bottom: 10px;
}
.favkit-label { color: var(--text-muted); }
.favkit-value { font-weight: 600; color: var(--text-secondary); }
.favkit-icon  { width: 15px; height: 15px; image-rendering: pixelated; }

/* Tiers & achievements */
.player-modal-tiers {
    display: flex; flex-wrap: wrap; justify-content: center; gap: 7px;
    padding: 12px 18px;
    border-top: 1px solid var(--border-subtle);
    border-bottom: 1px solid var(--border-subtle);
    margin: 6px 0;
}
.player-modal-achievements {
    display: flex; flex-wrap: wrap; justify-content: center; gap: 5px;
    padding: 10px 18px;
}

.achievement-badge {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 3px 10px; border-radius: var(--radius-pill);
    font-size: 0.7em; font-weight: 700; letter-spacing: 0.3px;
    position: relative; cursor: default;
    background: color-mix(in srgb, var(--ach-color) 12%, transparent);
    color: var(--ach-color, #fff);
    border: 1px solid color-mix(in srgb, var(--ach-color) 28%, transparent);
    --ach-color: #fff;
}
.ach-tip {
    display: none; position: absolute;
    bottom: calc(100% + 7px); left: 50%; transform: translateX(-50%);
    background: var(--bg-elevated); color: var(--text-primary);
    font-size: 0.9em; padding: 6px 11px; border-radius: var(--radius-sm);
    white-space: nowrap; border: 1px solid var(--border-subtle);
    box-shadow: var(--shadow-md); z-index: 10; font-weight: 500;
}
.achievement-badge:hover .ach-tip { display: block; }

/* Peak tier / retire progress — hodnoty počítá bot, tady se jen zobrazují */
.player-modal-peak {
    padding: 10px 18px 12px;
    border-top: 1px solid var(--border-subtle);
    display: flex; flex-direction: column; gap: 8px;
}
.peak-title {
    font-size: 0.68em; font-weight: 800; letter-spacing: 0.8px;
    text-transform: uppercase; color: var(--text-muted);
    text-align: center; margin-bottom: 1px;
}
.peak-row {
    display: flex; align-items: center; gap: 10px;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 7px 10px;
}
.peak-kit {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 0.72em; font-weight: 700; color: var(--text-secondary);
    flex: 0 0 88px; min-width: 0;
}
.peak-kit img { width: 16px; height: 16px; object-fit: contain; flex-shrink: 0; }
.peak-info {
    display: flex; flex-direction: column; gap: 4px;
    flex: 1 1 auto; min-width: 0;
}
.peak-locked {
    font-size: 0.74em; font-weight: 600;
    color: var(--text-secondary);
}
.peak-locked b { color: var(--text-primary); }
.peak-locked.peak-retire-ok { color: #4ade80; }
.peak-locked.peak-retire-ok b { color: #4ade80; }
.peak-pending {
    font-size: 0.72em; font-weight: 600; color: var(--text-secondary);
}
.peak-pending b { color: var(--accent); }
.peak-bar {
    display: block; height: 4px; width: 100%;
    background: rgba(255,255,255,0.07);
    border-radius: var(--radius-pill); overflow: hidden;
}
.peak-bar-fill {
    display: block; height: 100%;
    background: linear-gradient(90deg, rgba(var(--accent-rgb),0.55), var(--accent));
    border-radius: var(--radius-pill);
    transition: width 0.4s ease;
}
@media (max-width: 520px) {
    .peak-kit { flex-basis: 68px; font-size: 0.66em; }
    .peak-locked, .peak-pending { font-size: 0.68em; }
}

/* Actions */
.player-modal-actions {
    display: flex; gap: 8px; justify-content: center;
    padding: 10px 18px;
}
.compare-btn {
    display: flex; align-items: center; gap: 6px;
    padding: 8px 16px; border-radius: var(--radius-pill);
    border: 1px solid var(--border-subtle); background: var(--bg-surface);
    color: var(--text-secondary);
    font-family: 'Poppins', sans-serif; font-weight: 600; font-size: 0.8em;
    cursor: pointer; transition: all 0.18s ease;
}
.compare-btn:hover { border-color: var(--border-accent); color: var(--accent); background: rgba(238,205,20,0.06); }

.player-modal-journey-hint {
    display: flex; align-items: center; justify-content: center; gap: 5px;
    font-size: 0.7em; color: var(--text-muted);
    padding: 0 18px 14px;
}
.journey-hint-icon { color: var(--accent); opacity: 0.55; }

/* Modal themes */
[data-theme="neon"]      { border: 2px solid rgba(0,255,128,0.38); box-shadow: 0 0 40px rgba(0,255,128,0.12); }
[data-theme="dark"]      { background: #080810; }
[data-theme="retro"]     { font-family: 'Courier New', monospace; border: 2px solid rgba(255,165,0,0.38); }
[data-theme="minecraft"] { image-rendering: pixelated; border: 4px solid #555; border-radius: 0; }

/* Motivy karty. Vlastní barvy a tvary — ZÁMĚRNĚ nic pojmenovaného po cizí
   značce ani postavě. Estetika (pastel, sakura) je volná, jméno a podoba
   konkrétní postavy chráněné, a tenhle web je veřejný. */
[data-theme="pastel"] {
    background: linear-gradient(160deg, #2a2233 0%, #382a3d 100%);
    border: 2px solid rgba(255,183,213,0.45);
    box-shadow: 0 0 34px rgba(255,183,213,0.16);
}
[data-theme="sakura"] {
    background: linear-gradient(160deg, #2b1f28 0%, #3d2733 100%);
    border: 2px solid rgba(255,153,187,0.4);
    box-shadow: 0 0 34px rgba(255,120,170,0.14);
}
[data-theme="ocean"] {
    background: linear-gradient(160deg, #0d1f2d 0%, #123243 100%);
    border: 2px solid rgba(90,190,230,0.38);
    box-shadow: 0 0 34px rgba(60,170,220,0.16);
}
[data-theme="sunset"] {
    background: linear-gradient(160deg, #2b1a20 0%, #45241f 100%);
    border: 2px solid rgba(255,150,90,0.4);
    box-shadow: 0 0 34px rgba(255,120,60,0.16);
}
[data-theme="midnight"] {
    background: linear-gradient(160deg, #0a0c1a 0%, #141833 100%);
    border: 2px solid rgba(120,140,255,0.34);
    box-shadow: 0 0 34px rgba(90,110,255,0.16);
}
[data-theme="forest"] {
    background: linear-gradient(160deg, #101c14 0%, #1a2d1f 100%);
    border: 2px solid rgba(110,200,130,0.36);
    box-shadow: 0 0 34px rgba(80,180,110,0.14);
}
[data-theme="crimson"] {
    background: linear-gradient(160deg, #1e0d12 0%, #37141c 100%);
    border: 2px solid rgba(230,80,110,0.4);
    box-shadow: 0 0 34px rgba(220,50,90,0.16);
}
[data-theme="mono"] {
    background: #141414;
    border: 2px solid rgba(255,255,255,0.22);
    filter: saturate(0.25);
}
[data-theme="gold"] {
    background: linear-gradient(160deg, #221c0c 0%, #3a2f14 100%);
    border: 2px solid rgba(238,205,20,0.5);
    box-shadow: 0 0 40px rgba(238,205,20,0.18);
}

/* Vlastní titulek pod jménem — v modalu i v náhledu na profile.html */
.player-modal-title,
.card-title-text {
    font-size: 0.78em; font-weight: 600; letter-spacing: .3px;
    color: var(--text-secondary); margin-top: 2px;
}

/* ================================================================
   RANK HISTORY MODAL
   ================================================================ */
.rank-history-modal {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.78); display: none;
    align-items: center; justify-content: center;
    z-index: 1100; padding: 16px;
    backdrop-filter: blur(5px);
}
.rank-history-modal[style*="display: flex"],
.rank-history-modal[style*="display:flex"] { display: flex; }

.rank-history-content {
    background: var(--bg-card);
    border-radius: var(--radius-xl); padding: 24px;
    max-width: 920px; width: 100%;
    color: var(--text-primary); position: relative;
    box-shadow: var(--shadow-lg); border: 1px solid var(--border-subtle);
    max-height: 90vh; overflow: hidden;
    display: flex; flex-direction: column;
}
.rank-history-close {
    position: absolute; right: 18px; top: 14px;
    width: 30px; height: 30px; display: flex; align-items: center; justify-content: center;
    font-size: 1.15em; cursor: pointer; color: var(--text-secondary);
    border-radius: 50%; background: var(--bg-surface); transition: all 0.18s; line-height: 1;
}
.rank-history-close:hover { color: var(--text-primary); background: var(--bg-elevated); }

.rank-history-header {
    display: flex; align-items: center; gap: 12px; margin-bottom: 18px;
}
.rank-history-icon {
    width: 42px; height: 42px; flex-shrink: 0;
    background: rgba(238,205,20,0.1); border-radius: var(--radius-md);
    display: flex; align-items: center; justify-content: center;
    border: 1px solid rgba(238,205,20,0.14);
}
.rank-history-title  { font-size: 0.95em; font-weight: 700; color: var(--text-primary); }
.rank-history-player { font-size: 0.8em; color: var(--text-secondary); }

.rank-history-timeline-wrapper {
    overflow-x: auto; overflow-y: hidden; flex: 1;
    border-radius: var(--radius-md);
    background: var(--bg-deep); border: 1px solid var(--border-subtle);
    padding: 8px 0;
    scrollbar-width: thin; scrollbar-color: var(--bg-elevated) transparent;
}
.rank-history-timeline-wrapper::-webkit-scrollbar { height: 5px; }
.rank-history-timeline-wrapper::-webkit-scrollbar-track { background: transparent; }
.rank-history-timeline-wrapper::-webkit-scrollbar-thumb { background: var(--bg-elevated); border-radius: 3px; }

.rank-history-loading {
    display: flex; flex-direction: column; align-items: center;
    justify-content: center; padding: 60px; gap: 14px;
}
.rh-spinner {
    width: 34px; height: 34px;
    border: 3px solid var(--bg-elevated); border-top-color: var(--accent);
    border-radius: 50%; animation: spin 0.7s linear infinite;
}
.rh-loading-text { font-size: 0.83em; color: var(--text-muted); }
.rank-history-no-data { text-align: center; padding: 60px 20px; color: var(--text-muted); font-size: 0.88em; }

.rh-zoom-controls {
    display: flex; align-items: center; gap: 10px;
    justify-content: center; margin-bottom: 12px;
}
.rh-zoom-btn {
    width: 28px; height: 28px; border-radius: 50%;
    border: 1px solid var(--border-subtle); background: var(--bg-surface);
    color: var(--text-secondary); font-size: 1.05em; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.18s; font-family: 'Poppins', sans-serif;
}
.rh-zoom-btn:hover { border-color: var(--border-accent); color: var(--accent); }
.rh-zoom-label {
    font-size: 0.72em; color: var(--text-muted);
    font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px;
}

.rank-history-tooltip {
    background: var(--bg-elevated); border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm); padding: 7px 13px;
    pointer-events: none; z-index: 1200; text-align: center;
    min-width: 76px; box-shadow: var(--shadow-md);
}
.rank-history-tooltip-rank { font-size: 1.05em; font-weight: 800; }
.rank-history-tooltip-date { font-size: 0.73em; color: var(--text-muted); margin-top: 2px; }
.rank-history-tooltip-current { font-size: 0.68em; color: var(--accent); margin-top: 2px; }

/* ================================================================
   TIER JOURNEY MODAL
   ================================================================ */
.tier-journey-modal {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.78); display: none;
    align-items: center; justify-content: center;
    z-index: 1100; padding: 16px; backdrop-filter: blur(5px);
}
.tier-journey-modal[style*="display: flex"],
.tier-journey-modal[style*="display:flex"] { display: flex; }

.tier-journey-content {
    background: var(--bg-card); border-radius: var(--radius-xl); padding: 24px;
    max-width: 820px; width: 100%;
    color: var(--text-primary); position: relative;
    box-shadow: var(--shadow-lg); border: 1px solid var(--border-subtle);
    max-height: 90vh; overflow: hidden;
    display: flex; flex-direction: column;
}
.tier-journey-close {
    position: absolute; right: 18px; top: 14px;
    width: 30px; height: 30px; display: flex; align-items: center; justify-content: center;
    font-size: 1.15em; cursor: pointer; color: var(--text-secondary);
    border-radius: 50%; background: var(--bg-surface); transition: all 0.18s; line-height: 1;
}
.tier-journey-close:hover { color: var(--text-primary); background: var(--bg-elevated); }

.tier-journey-header {
    display: flex; align-items: center; gap: 12px; margin-bottom: 18px;
}
.tier-journey-kit-icon {
    width: 42px; height: 42px; border-radius: var(--radius-md);
    background: var(--bg-surface); padding: 8px; image-rendering: pixelated;
    border: 1px solid var(--border-subtle);
}
.tier-journey-title  { font-size: 0.95em; font-weight: 700; color: var(--text-primary); }
.tier-journey-player { font-size: 0.8em; color: var(--text-secondary); }

.tier-journey-timeline-wrapper {
    overflow-x: auto; flex: 1; border-radius: var(--radius-md);
    background: var(--bg-deep); border: 1px solid var(--border-subtle); padding: 8px 0;
    scrollbar-width: thin; scrollbar-color: var(--bg-elevated) transparent;
}
.tier-journey-timeline-wrapper::-webkit-scrollbar { height: 5px; }
.tier-journey-timeline-wrapper::-webkit-scrollbar-track { background: transparent; }
.tier-journey-timeline-wrapper::-webkit-scrollbar-thumb { background: var(--bg-elevated); border-radius: 3px; }

.tier-journey-legend {
    display: flex; flex-wrap: wrap; gap: 10px;
    justify-content: center; margin-top: 14px;
}
.journey-legend-item {
    display: flex; align-items: center; gap: 5px;
    font-size: 0.7em; color: var(--text-muted); font-weight: 600;
}
.journey-legend-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }

/* Journey tooltip (SVG hover tooltip) */
.journey-tooltip {
    position: absolute;
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 7px 11px;
    font-size: 0.77em;
    pointer-events: none;
    box-shadow: var(--shadow-md);
    z-index: 10; min-width: 100px;
    text-align: center;
}
.journey-tooltip-tier   { font-weight: 700; font-size: 1.1em; margin-bottom: 2px; }
.journey-tooltip-date   { color: var(--text-muted); font-size: 0.9em; }
.journey-tooltip-note   { color: var(--text-secondary); font-size: 0.88em; margin-top: 3px; font-style: italic; }
.journey-tooltip-current{ color: var(--accent); font-size: 0.82em; margin-top: 4px; font-weight: 600; }

/* ================================================================
   COMPARE MODAL
   ================================================================ */
.compare-modal {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.78); display: none;
    align-items: center; justify-content: center;
    z-index: 1100; padding: 16px; backdrop-filter: blur(5px);
}
.compare-modal[style*="display: flex"],
.compare-modal[style*="display:flex"] { display: flex; }

.compare-modal-content {
    background: var(--bg-card); border-radius: var(--radius-xl); padding: 24px;
    max-width: 820px; width: 100%;
    color: var(--text-primary); position: relative;
    box-shadow: var(--shadow-lg); border: 1px solid var(--border-subtle);
    max-height: 90vh; overflow-y: auto;
}
/* Vsechno na plnou sirku pod sebou, ale KITY samotne ve dvou sloupcich.
   Driv to bylo [kity | souboje] vedle sebe — jenze kdyz spolu hraci nikdy
   nehrali (bezny pripad), prava polovina zela prazdnotou a modal vypadal
   rozbite. Takhle se sirka pouzije na obsah, ktery tam vzdycky je. */
@media (min-width: 760px) {
    .compare-modal-content { max-width: 900px; }
    .compare-kits {
        display: grid; grid-template-columns: 1fr 1fr;
        gap: 0 10px; border: none; background: none;
    }
    .compare-kit-row {
        border: 1px solid var(--border-subtle);
        border-radius: var(--radius-sm);
        margin-bottom: 6px;
    }
    /* Dlouha historie soubojů scrolluje SAMA, ne cely modal. */
    .compare-h2h-list { max-height: 220px; overflow-y: auto; }
}

/* Vyhry vlevo, remizy uprostred, vyhry soupere vpravo. */
.compare-h2h-tally-grid {
    display: grid; grid-template-columns: 1fr auto 1fr;
    align-items: center; gap: 10px; margin: 10px 0 12px;
}
.compare-h2h-tally-grid .t-cell {
    display: flex; flex-direction: column; align-items: center; gap: 2px;
    padding: 8px 10px; border-radius: var(--radius-sm); background: var(--bg-surface);
    min-width: 0;
}
.compare-h2h-tally-grid .t-cell b { font-size: 1.35em; font-weight: 800; line-height: 1; }
.compare-h2h-tally-grid .t-cell span {
    font-size: 0.7em; color: var(--text-muted); max-width: 100%;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.compare-h2h-tally-grid .t-a b { color: #4ade80; }
.compare-h2h-tally-grid .t-b b { color: #f87171; }
.compare-h2h-tally-grid .t-d   { background: none; }
.compare-h2h-tally-grid .t-d b { color: var(--text-secondary); font-size: 1.05em; }

.compare-modal-content::-webkit-scrollbar { width: 4px; }
.compare-modal-content::-webkit-scrollbar-thumb { background: var(--bg-elevated); border-radius: 2px; }

.compare-modal-close {
    position: absolute; right: 18px; top: 14px;
    width: 30px; height: 30px; display: flex; align-items: center; justify-content: center;
    font-size: 1.15em; cursor: pointer; color: var(--text-secondary);
    border-radius: 50%; background: var(--bg-surface); transition: all 0.18s; line-height: 1;
}
.compare-modal-close:hover { color: var(--text-primary); background: var(--bg-elevated); }

.compare-title { font-size: 1.05em; font-weight: 700; margin-bottom: 20px; color: var(--text-primary); }
.compare-players { display: flex; align-items: center; gap: 18px; margin-bottom: 20px; }
.compare-player {
    flex: 1; text-align: center; padding: 18px;
    background: var(--bg-surface); border-radius: var(--radius-lg);
    border: 1px solid var(--border-subtle);
}
.compare-vs { font-size: 1.3em; font-weight: 900; color: var(--accent); flex-shrink: 0; }
.compare-skin {
    width: 60px; height: 60px; border-radius: var(--radius-md);
    image-rendering: pixelated; border: 2px solid var(--border-subtle); margin-bottom: 8px;
}
.compare-name { font-weight: 700; font-size: 0.92em; color: var(--text-primary); margin-bottom: 4px; }
.compare-rank { font-size: 0.78em; color: var(--text-muted); margin-bottom: 5px; }
.compare-score-row { display: flex; align-items: center; justify-content: center; gap: 6px; }
.compare-score { font-weight: 700; font-size: 0.92em; color: var(--accent); }
.compare-score-title { font-size: 0.75em; color: var(--text-muted); }
.compare-kits {
    border-radius: var(--radius-md); overflow: hidden;
    border: 1px solid var(--border-subtle); margin-bottom: 14px;
}
.compare-kit-row {
    display: flex; align-items: center;
    border-bottom: 1px solid var(--border-subtle);
    transition: background 0.15s;
}
.compare-kit-row:last-child { border-bottom: none; }
.compare-kit-row.win-left  { background: rgba(74,222,128,0.04); }
.compare-kit-row.win-right { background: rgba(248,113,113,0.04); }
.compare-kit-cell {
    flex: 1; display: flex; align-items: center; justify-content: center;
    padding: 9px 6px;
}
.compare-kit-center { flex: 0 0 48px; }
.compare-kit-icon { width: 28px; height: 28px; image-rendering: pixelated; }
.compare-tier-badge {
    font-weight: 700; font-size: 0.8em;
    padding: 3px 10px; border-radius: var(--radius-xs);
    min-width: 40px; text-align: center;
}
.compare-tier-none { background: var(--bg-elevated); color: var(--text-muted); }

.compare-score.compare-better { color: #4ade80; }
.compare-score.compare-worse  { color: #f87171; }

.compare-summary {
    padding: 11px 14px; background: var(--bg-surface);
    border-radius: var(--radius-md); font-size: 0.83em;
    color: var(--text-secondary); border: 1px solid var(--border-subtle);
    display: flex; flex-direction: column; align-items: center; gap: 6px;
}
.compare-verdict {
    font-size: 1.02em; font-weight: 700; color: var(--text-primary);
}
.compare-verdict strong { color: var(--accent); }
.compare-meta {
    display: flex; flex-wrap: wrap; justify-content: center; gap: 14px;
    font-size: 0.86em; color: var(--text-muted);
}
.compare-wins { font-weight: 700; color: var(--text-primary); }
.compare-draw { color: var(--text-muted); }
.compare-empty {
    padding: 18px; text-align: center;
    color: var(--text-muted); font-size: 0.85em;
}
/* Hvězdička u tieru, který hráč drží díky zamčenému peaku */
.compare-peak-star {
    font-size: 0.75em; margin-left: 3px; vertical-align: top;
    opacity: 0.75;
}

/* Vzájemná bilance
   Dřív to byla řádka drobných pilulek — při víc soubojích se to slilo a nešlo
   poznat, kdo zápas vyhrál. Teď je to seznam řádků: kit, skóre obarvené podle
   vítěze, jméno vítěze a datum. */
.compare-h2h {
    width: 100%; margin-top: 6px; padding-top: 12px;
    border-top: 1px solid var(--border-subtle);
    display: flex; flex-direction: column; gap: 9px;
}
.compare-h2h { margin-top: 14px; }
.compare-h2h-empty {
    font-size: 0.84em; color: var(--text-muted); text-align: center;
    padding: 10px 0;
}

.compare-h2h-head {
    display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
}
.compare-h2h-label {
    font-size: 0.78em; letter-spacing: 0.06em; text-transform: uppercase;
    color: var(--text-muted); font-weight: 700;
}
.compare-h2h-tally {
    display: inline-flex; align-items: baseline; gap: 4px;
    font-size: 1.05em; font-weight: 800; font-variant-numeric: tabular-nums;
}
.compare-h2h-tally i, .compare-h2h-score i {
    font-style: normal; color: var(--text-muted); font-weight: 600;
}
.compare-h2h-tally em {
    font-style: normal; font-size: 0.62em; font-weight: 600;
    color: var(--text-muted); margin-left: 5px;
}
/* Levý hráč zeleně, pravý červeně — stejné pořadí jako karty nahoře. */
.h2h-sa { color: #4ade80; }
.h2h-sb { color: #f87171; }

/* Poměr výher na první pohled */
.compare-h2h-bar {
    height: 5px; border-radius: 3px; overflow: hidden;
    background: rgba(248,113,113,0.55);
}
.compare-h2h-bar-a { display: block; height: 100%; background: #4ade80; }

.compare-h2h-list { display: flex; flex-direction: column; gap: 4px; }
.compare-h2h-row {
    display: grid;
    grid-template-columns: 18px minmax(62px, auto) 1fr auto;
    align-items: center; gap: 10px;
    background: var(--bg-card); border: 1px solid var(--border-subtle);
    border-left-width: 3px;
    border-radius: var(--radius-sm); padding: 6px 10px;
    font-size: 0.8em;
}
.compare-h2h-row.h2h-a { border-left-color: #4ade80; }
.compare-h2h-row.h2h-b { border-left-color: #f87171; }
.compare-h2h-row.h2h-d { border-left-color: var(--text-muted); }
.compare-h2h-kit { width: 18px; height: 18px; object-fit: contain; }
.compare-h2h-score {
    font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap;
}
.compare-h2h-winner {
    color: var(--text-secondary); font-weight: 600;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.compare-h2h-date { color: var(--text-muted); font-size: 0.9em; white-space: nowrap; }
.compare-h2h-more { font-size: 0.76em; color: var(--text-muted); text-align: center; }

@media (max-width: 520px) {
    /* Na úzkém displeji je jméno vítěze to první, co se dá obětovat. */
    .compare-h2h-row { grid-template-columns: 18px auto 1fr; gap: 8px; }
    .compare-h2h-winner { display: none; }
}

/* Peak / retire pruh nahoře v Tier Journey (pod hlavičkou, nad grafem) */
.tier-journey-peak {
    border: 1px solid var(--border-subtle);
    background: var(--bg-surface);
    border-radius: var(--radius-sm);
    padding: 9px 13px;
    margin-bottom: 12px;
}
.tier-journey-peak .peak-info { display: flex; flex-direction: column; gap: 5px; }
.tier-journey-peak .peak-locked,
.tier-journey-peak .peak-pending { font-size: 0.8em; }

/* Tlačítko zpět z detailu testu na graf */
.tj-back {
    align-self: flex-start;
    background: var(--bg-surface); color: var(--text-secondary);
    border: 1px solid var(--border-subtle); border-radius: var(--radius-pill);
    padding: 5px 13px; font-size: 0.76em; font-weight: 700; font-family: inherit;
    cursor: pointer; margin-bottom: 8px;
}
.tj-back:hover { color: var(--text-primary); border-color: var(--border-accent); }
/* Peak pruh uvnitř Tier Journey — bez horní linky, ta už je od grafu */
.tier-journey-peak { border-top: none; padding-top: 4px; }

/* Průběh testů v Tier Journey */
.tier-journey-tests { margin-top: 12px; display: flex; flex-direction: column; gap: 5px; }
/* Detail jednoho testu — rozbalí se po kliknutí na tečku v grafu */
.tj-single { animation: tjFade 0.18s ease; }
@keyframes tjFade { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.tj-test-head-static { cursor: default; padding: 8px 11px; display: flex; align-items: center; gap: 9px; font-size: 0.79em; }
.tj-test-head-static:hover { background: none; }
/* Vybraná tečka v grafu */
.journey-hit.journey-selected { }
.journey-hit { outline: none; }
/* Nápověda pod grafem */
.tier-journey-hint {
    text-align: center; font-size: 0.72em; color: var(--text-muted);
    margin-top: 8px; letter-spacing: 0.2px;
}
.tj-tests-title {
    font-size: 0.68em; font-weight: 800; letter-spacing: 0.8px;
    text-transform: uppercase; color: var(--text-muted); margin-bottom: 2px;
}
.tj-test { background: var(--bg-surface); border: 1px solid var(--border-subtle); border-radius: var(--radius-sm); overflow: hidden; }
.tj-test.tj-open { border-color: var(--border-accent); }
.tj-test-head {
    width: 100%; display: flex; align-items: center; gap: 9px;
    background: none; border: none; color: inherit; font-family: inherit;
    padding: 8px 11px; cursor: pointer; text-align: left; font-size: 0.79em;
}
.tj-test-head:hover { background: rgba(255,255,255,0.03); }
.tj-vbadge {
    width: 19px; height: 19px; flex-shrink: 0; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 0.62em; font-weight: 800;
}
.tj-v-up   { background: rgba(74,222,128,0.16);  color: #4ade80; }
.tj-v-down { background: rgba(248,113,113,0.16); color: #f87171; }
.tj-v-same { background: rgba(255,255,255,0.08); color: var(--text-secondary); }
.tj-v-ret  { background: rgba(238,205,20,0.14);  color: var(--accent); }
.tj-verdict { font-weight: 700; color: var(--text-primary); }
.tj-change  { color: var(--text-secondary); }
.tj-change b { color: var(--text-primary); }
.tj-date    { margin-left: auto; color: var(--text-muted); font-size: 0.92em; }
.tj-caret   { color: var(--text-muted); transition: transform 0.18s ease; }
.tj-open .tj-caret { transform: rotate(90deg); }
.tj-test-body { padding: 0 11px 9px; }
.tj-fights { display: flex; flex-direction: column; gap: 4px; }
.tj-fight {
    display: flex; align-items: center; gap: 8px;
    padding: 5px 9px; border-radius: var(--radius-xs);
    font-size: 0.78em; background: var(--bg-card);
    border-left: 3px solid var(--text-muted);
}
.tj-fight.tj-win  { border-left-color: #4ade80; }
.tj-fight.tj-loss { border-left-color: #f87171; }
.tj-fgroup {
    font-size: 0.78em; font-weight: 800; letter-spacing: 0.4px;
    color: var(--text-muted); min-width: 26px;
}
.tj-fscore { font-weight: 800; color: var(--text-primary); font-variant-numeric: tabular-nums; min-width: 42px; }
.tj-fopp   { color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tj-fres   { margin-left: auto; font-size: 0.9em; color: var(--text-muted); }
.tj-win .tj-fres  { color: #4ade80; }
.tj-loss .tj-fres { color: #f87171; }
.tj-fights-legacy { font-size: 0.78em; color: var(--text-secondary); padding: 6px 2px; }
.tj-legacy-note { color: var(--text-muted); font-size: 0.9em; margin-top: 3px; }

/* ================================================================
   SCORE GRAPH MODAL
   ================================================================ */
.score-graph-modal {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.78); display: none;
    align-items: center; justify-content: center;
    z-index: 1100; padding: 16px; backdrop-filter: blur(5px);
}
.score-graph-modal[style*="display: flex"],
.score-graph-modal[style*="display:flex"] { display: flex; }

.score-graph-content {
    background: var(--bg-card); border-radius: var(--radius-xl); padding: 24px;
    max-width: 720px; width: 100%;
    color: var(--text-primary); position: relative;
    box-shadow: var(--shadow-lg); border: 1px solid var(--border-subtle);
    max-height: 90vh; overflow-y: auto;
}
.score-graph-close {
    position: absolute; right: 18px; top: 14px;
    width: 30px; height: 30px; display: flex; align-items: center; justify-content: center;
    font-size: 1.15em; cursor: pointer; color: var(--text-secondary);
    border-radius: 50%; background: var(--bg-surface); transition: all 0.18s; line-height: 1;
}
.score-graph-close:hover { color: var(--text-primary); background: var(--bg-elevated); }

.score-graph-header { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.score-graph-skin {
    width: 46px; height: 46px; border-radius: var(--radius-md);
    image-rendering: pixelated; border: 1px solid var(--border-subtle);
}
.score-graph-title  { font-size: 0.95em; font-weight: 700; color: var(--text-primary); }
.score-graph-subtitle { font-size: 0.8em; color: var(--text-secondary); }
.score-graph-chart {
    overflow-x: auto; border-radius: var(--radius-md);
    background: var(--bg-deep); border: 1px solid var(--border-subtle); padding: 8px;
    scrollbar-width: thin; scrollbar-color: var(--bg-elevated) transparent;
}

/* ================================================================
   GENERIC MODAL
   ================================================================ */
.modal {
    position: fixed; inset: 0; width: 100vw; height: 100vh;
    background: rgba(0,0,0,0.7);
    display: flex; align-items: center; justify-content: center;
    z-index: 1000; backdrop-filter: blur(4px);
}
.modal-content {
    background: var(--bg-card); color: var(--text-primary);
    padding: 22px 26px; border-radius: var(--radius-lg);
    min-width: 230px; max-width: 90vw;
    box-shadow: var(--shadow-lg); border: 1px solid var(--border-subtle);
}

/* Score graph tooltip */
.score-graph-tooltip {
    position: absolute;
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 7px 12px;
    font-size: 0.77em; line-height: 1.5;
    pointer-events: none; box-shadow: var(--shadow-md);
    z-index: 10; min-width: 90px; text-align: center;
    display: none;
}

/* Compare picker (full-screen overlay for picking player B) */
.compare-picker {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.78);
    display: none; align-items: center; justify-content: center;
    z-index: 1200; padding: 16px;
    backdrop-filter: blur(5px);
}
.compare-picker[style*="display: flex"],
.compare-picker[style*="display:flex"] { display: flex; }

.compare-picker-content {
    background: var(--bg-card); border-radius: var(--radius-xl);
    padding: 24px; max-width: 480px; width: 100%;
    position: relative; box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-subtle);
    max-height: 80vh; display: flex; flex-direction: column;
}
.compare-picker-close {
    position: absolute; right: 14px; top: 12px;
    width: 30px; height: 30px; display: flex; align-items: center; justify-content: center;
    font-size: 1.2em; cursor: pointer; color: var(--text-secondary);
    background: var(--bg-surface); border-radius: 50%;
    transition: all 0.18s; line-height: 1;
}
.compare-picker-close:hover { color: var(--text-primary); background: var(--bg-elevated); }
.compare-picker-content h3 { font-size: 1em; font-weight: 700; margin-bottom: 6px; padding-right: 30px; }
.compare-picker-info { font-size: 0.82em; color: var(--text-muted); margin-bottom: 16px; }
.compare-picker-search { margin-bottom: 10px; }
.compare-picker-input {
    width: 100%; padding: 10px 14px;
    background: var(--bg-surface); border: 1px solid var(--border-subtle);
    border-radius: var(--radius-pill); color: var(--text-primary);
    font-family: 'Poppins', sans-serif; font-size: 0.88em;
    outline: none; transition: border-color 0.18s;
}
.compare-picker-input:focus { border-color: var(--border-accent); }
.compare-picker-suggestions {
    flex: 1; overflow-y: auto; min-height: 100px;
    max-height: 320px; border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle); background: var(--bg-surface);
}
.compare-picker-item {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 12px; cursor: pointer; transition: background 0.15s;
    border-bottom: 1px solid var(--border-subtle);
}
.compare-picker-item:last-child { border-bottom: none; }
.compare-picker-item:hover { background: rgba(238,205,20,0.06); }
.compare-picker-item img { width: 34px; height: 34px; border-radius: var(--radius-xs); image-rendering: pixelated; flex-shrink: 0; }
.compare-picker-player-info { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.compare-picker-nick { font-weight: 700; font-size: 0.88em; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.compare-picker-meta { font-size: 0.73em; color: var(--text-muted); }
.compare-picker-empty { padding: 20px; text-align: center; font-size: 0.83em; color: var(--text-muted); }

/* ================================================================
   FOOTER
   ================================================================ */
section { padding: 24px; text-align: center; }
#konec { color: var(--text-muted); font-size: 0.8em; }
#mctiers { color: var(--accent); text-decoration: none; font-weight: 600; }
#mctiers:hover { opacity: 0.8; }

/* ================================================================
   OLD TABLE STYLES (compatibility fallback)
   ================================================================ */
.tabulka th, .tabulka td {
    border: none; font-family: 'Poppins', sans-serif; color: var(--text-primary);
}
.tabulka thead { display: none; }
.tabulka tbody tr {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-subtle);
    margin-bottom: 8px; display: block;
    transition: border-color 0.18s, background 0.18s;
}
.tabulka tbody tr:hover {
    background: var(--bg-surface); border-color: var(--border-accent);
}
.tabulka tbody tr td { background: transparent; }
.tabulka td.rank-cell  { font-size: 1.6em; font-weight: 800; text-align: center; padding: 8px 16px; color: var(--text-primary); }
.tabulka td.player-name { font-weight: 700; color: var(--text-primary); font-size: 1em; padding: 8px 16px; }
.tabulka td.score-cell  { font-size: 1.1em; font-weight: 600; color: var(--accent); text-align: center; padding: 8px 16px; }
.tabulka td.kits-cell   { padding: 8px 16px; }
.tabulka img { max-width: 100%; height: auto; }

/* ================================================================
   TIERS LIST (fallback)
   ================================================================ */
.tiers-list {
    display: flex; flex-wrap: wrap; gap: 4px;
    justify-content: center; margin-top: 8px;
}

/* ================================================================
   RESPONSIVE
   ================================================================ */
@media (max-width: 1100px) {
    #overall-tabulka { padding: 8px 0; }
    .player-card { padding: 12px 16px; }
    .compact-row { gap: 12px; }
    .skin { width: 48px; height: 48px; }
    .player-name { font-size: 0.98em; }
    .rank-badge { font-size: 1em; padding: 5px 11px; min-width: 40px; }
    .kits-row { padding: 6px 8px; gap: 4px; }
    .kit-badge, .kit-badge-missing { min-width: 38px; max-width: 38px; width: 38px; }
    .kit-icon-circle, .kit-icon-missing { width: 28px; height: 28px; min-width: 28px; min-height: 28px; max-width: 28px; max-height: 28px; }
    .kit-icon, .kit-icon-missing svg { width: 18px !important; height: 18px !important; }
    .kit-tier-text, .kit-tier-missing { min-width: 32px !important; max-width: 32px !important; width: 32px !important; font-size: 0.72em !important; }
}

@media (max-width: 900px) {
    .main-header { padding: 0 16px; height: 58px; }
    .main-title { font-size: 1.25em; }
    .tm-label { display: none; }
    nav { top: 58px; }
    #tabulky { padding: 0 10px; }
    .kit-tier-col { min-width: 180px; max-width: 180px; width: 180px; }
}

@media (max-width: 700px) {
    .main-header { height: 56px; padding: 0 12px; gap: 10px; }
    .main-title { font-size: 1.1em; }
    .discord-link span { display: none; }
    .discord-link { padding: 7px 10px; }
    .search-box { min-width: 150px; }
    .search-shortcut { display: none; }
    nav { top: 56px; }
    .guild-toggle-btn { padding: 4px 9px; font-size: 0.72em; }
    .compact-row { flex-wrap: wrap; }
    .kits-row { width: 100%; }
    .player-info { min-width: 0; }
    .kit-tier-col { min-width: 160px; max-width: 160px; width: 160px; }
    .player-modal-content { min-width: unset; }
    .compare-players { flex-direction: column; }
    .compare-vs { transform: rotate(90deg); }
    .rank-history-content, .tier-journey-content,
    .compare-modal-content, .score-graph-content { padding: 18px 14px; }
}

@media (max-width: 480px) {
    body { font-size: 14px; }
    .main-title { display: none; }
    .guild-toggle { max-width: 140px; }
    .guild-toggle-btn { padding: 5px 8px; font-size: 0.7em; }
    .kit-tier-col { min-width: 145px; max-width: 145px; width: 145px; }
    .kit-badge, .kit-badge-missing { min-width: 34px; max-width: 34px; width: 34px; }
    .kit-icon-circle, .kit-icon-missing { width: 24px; height: 24px; min-width: 24px; min-height: 24px; max-width: 24px; max-height: 24px; }
    .kit-icon, .kit-icon-missing svg { width: 15px !important; height: 15px !important; }
    .kit-tier-text, .kit-tier-missing { min-width: 28px !important; max-width: 28px !important; width: 28px !important; font-size: 0.66em !important; }
    .player-card { padding: 10px 12px; }
    .skin { width: 42px; height: 42px; }
    .rank-badge { font-size: 0.9em; padding: 4px 9px; min-width: 34px; }
}

/* Touch scroll for kit columns */
.kit-columns { -webkit-overflow-scrolling: touch; scroll-snap-type: x mandatory; }

/* ================================================================
   PREMIUM POLISH — visual upgrade pass
   Purely additive: new tokens + new/enhanced rules layered on top of
   the existing design system. Nothing above this point is renamed or
   removed, so every class/ID the JS relies on keeps working exactly
   as before.
   ================================================================ */

:root {
    --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-smooth:   cubic-bezier(0.4, 0, 0.2, 1);
    --ease-spring:   cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ---------------------------------------------------------------
   Selection & focus — small details that read as "cared about"
   --------------------------------------------------------------- */
::selection { background: rgba(var(--accent-rgb), 0.32); color: #fff; }

a:focus-visible, button:focus-visible, input:focus-visible,
.nav-btn:focus-visible, .kit-player:focus-visible, .player-card:focus-visible,
.kit-badge:focus-visible, .search-suggestion-item:focus-visible,
.guild-toggle-btn:focus-visible, .kit-switcher button:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: var(--radius-xs);
}

/* ---------------------------------------------------------------
   Global scrollbar theming — the default OS scrollbar was the one
   remaining un-themed surface on the page
   --------------------------------------------------------------- */
html { scrollbar-color: var(--bg-elevated) var(--bg-deep); scrollbar-width: thin; }
body::-webkit-scrollbar { width: 10px; }
body::-webkit-scrollbar-track { background: var(--bg-deep); }
body::-webkit-scrollbar-thumb { background: var(--bg-elevated); border-radius: 6px; border: 2px solid var(--bg-deep); }
body::-webkit-scrollbar-thumb:hover { background: var(--bg-surface); }

/* ---------------------------------------------------------------
   Ambient depth — a very subtle film-grain layer over the existing
   radial-gradient background. Pure CSS/SVG, no image asset, and it
   sits on a fixed pseudo-element so it never affects layout or
   competes with the body's own background-image declaration.
   --------------------------------------------------------------- */
body::before {
    content: '';
    position: fixed; inset: 0; z-index: -1; pointer-events: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    opacity: 0.03;
    mix-blend-mode: overlay;
}

/* ---------------------------------------------------------------
   Header — subtle ambient glow band + tighter link/button motion
   --------------------------------------------------------------- */
.main-header {
    overflow: visible;
}
.main-header::before {
    content: '';
    position: absolute; top: -60px; left: 50%; transform: translateX(-50%);
    width: min(560px, 100%); height: 140px;
    background: radial-gradient(ellipse at center, rgba(var(--accent-rgb), 0.10) 0%, transparent 70%);
    pointer-events: none; z-index: -1;
}

.discord-link, .time-machine-btn, .nav-btn, .kit-switcher button,
.retry-btn, .tm-apply, .tm-reset, .load-more-btn, .compare-btn,
.retired-toggle-btn, .rh-zoom-btn {
    transition: all 0.2s var(--ease-smooth);
}
.discord-link:active, .time-machine-btn:active, .retry-btn:active,
.tm-apply:active, .load-more-btn:active, .compare-btn:active,
.retired-toggle-btn:active, .save-btn:active, .form-submit:active {
    transform: scale(0.96);
}

/* Nav active pill gets a touch more presence */
.nav-btn.active {
    transition: all 0.25s var(--ease-spring);
}

/* ---------------------------------------------------------------
   Player cards — smoother motion + top-3 ambient treatment.
   Targets the exact `.skin-bg.rank-1/2/3` classes script.js already
   emits (`<div class="skin-bg rank-${rank}">`) via :has(), so no JS
   changes are needed. Browsers without :has() support simply keep
   the existing (already good) card styling — pure progressive
   enhancement, nothing breaks.
   --------------------------------------------------------------- */
.player-card {
    transition: border-color 0.25s var(--ease-smooth),
                box-shadow 0.25s var(--ease-smooth),
                background 0.25s var(--ease-smooth),
                transform 0.25s var(--ease-smooth);
}
.player-card:hover { transform: translateY(-2px); }
.player-card:active { transform: translateY(-1px) scale(0.995); }

@supports selector(:has(*)) {
    .player-card:has(.skin-bg.rank-1) {
        background: linear-gradient(135deg, rgba(255,207,74,0.07) 0%, var(--bg-card) 45%);
        border-color: rgba(255,207,74,0.28);
        box-shadow: 0 4px 32px rgba(255,207,74,0.10), 0 0 0 1px rgba(255,207,74,0.10);
    }
    .player-card:has(.skin-bg.rank-1):hover {
        box-shadow: 0 8px 40px rgba(255,207,74,0.18), 0 0 0 1px rgba(255,207,74,0.20);
    }
    .player-card:has(.skin-bg.rank-2) {
        background: linear-gradient(135deg, rgba(164,179,199,0.06) 0%, var(--bg-card) 45%);
        border-color: rgba(164,179,199,0.22);
    }
    .player-card:has(.skin-bg.rank-2):hover {
        box-shadow: 0 8px 36px rgba(164,179,199,0.14), 0 0 0 1px rgba(164,179,199,0.16);
    }
    .player-card:has(.skin-bg.rank-3) {
        background: linear-gradient(135deg, rgba(181,99,38,0.06) 0%, var(--bg-card) 45%);
        border-color: rgba(181,99,38,0.22);
    }
    .player-card:has(.skin-bg.rank-3):hover {
        box-shadow: 0 8px 36px rgba(181,99,38,0.14), 0 0 0 1px rgba(181,99,38,0.16);
    }
    /* Rank badge for #1 gets a slow, subtle breathing glow */
    .player-card:has(.skin-bg.rank-1) .rank-badge {
        animation: rankOneBreathe 3s ease-in-out infinite;
    }
}
@keyframes rankOneBreathe {
    0%, 100% { box-shadow: 0 0 18px rgba(255,207,74,0.38); }
    50%      { box-shadow: 0 0 28px rgba(255,207,74,0.62); }
}

/* Kit badges get a touch more spring on hover */
.kit-badge:hover { transition: transform 0.18s var(--ease-spring); }

/* ---------------------------------------------------------------
   Loading spinner — a slightly richer dual-ring take on the same
   footprint, still pure CSS, no markup changes required.
   --------------------------------------------------------------- */
.spinner, .modal-loader-spinner, .rh-spinner, .profile-loader-spinner {
    position: relative;
}
.spinner::after, .modal-loader-spinner::after, .rh-spinner::after, .profile-loader-spinner::after {
    content: '';
    position: absolute; inset: -6px;
    border-radius: 50%;
    border: 3px solid transparent;
    border-bottom-color: rgba(var(--accent-rgb), 0.25);
    animation: spin 1.4s linear infinite reverse;
}

/* ---------------------------------------------------------------
   Modal polish — slightly smoother entrance curve
   --------------------------------------------------------------- */
.player-modal-content {
    animation: modalContentIn 0.35s var(--ease-out-expo) 0.06s both;
}
.player-modal-close, .rank-history-close, .tier-journey-close,
.compare-modal-close, .score-graph-close, .compare-picker-close {
    transition: all 0.2s var(--ease-spring);
}
.player-modal-close:hover, .rank-history-close:hover, .tier-journey-close:hover,
.compare-modal-close:hover, .score-graph-close:hover, .compare-picker-close:hover {
    transform: rotate(90deg);
}

/* ---------------------------------------------------------------
   Recent-card & kit-tier-col: a touch more lift on hover to match
   the player-card treatment above
   --------------------------------------------------------------- */
.recent-card { transition: border-color 0.2s var(--ease-smooth), transform 0.2s var(--ease-smooth), box-shadow 0.2s var(--ease-smooth); }
.recent-card:hover { box-shadow: var(--shadow-sm); }

.kit-tier-col { transition: box-shadow 0.25s var(--ease-smooth), transform 0.25s var(--ease-smooth); }
.kit-tier-col:hover { transform: translateY(-2px); }

/* ---------------------------------------------------------------
   TOP-3 PODIUM
   Pulls the first three leaderboard rows out of the vertical stack
   into a side-by-side podium — silver / gold / bronze, gold raised
   in the middle — reusing the same tier-1/2/3 color tokens the
   rank-1/2/3 :has() treatment above already uses. Pure CSS, driven
   by nth-child position, so it relies on the same "first three
   cards = rank 1-3" assumption that treatment already makes.
   Below 720px there's no room for three columns, so it falls back
   to the normal single-column list (still gets the :has() tint).
   --------------------------------------------------------------- */
@media (min-width: 720px) {
    #overall-tabulka {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        align-items: end;
        gap: 16px;
    }
    #overall-tabulka > .player-card { grid-column: 1 / -1; }

    #overall-tabulka > .player-card:nth-child(-n+3) {
        grid-row: 1;
        display: flex; flex-direction: column; align-items: center; text-align: center;
        padding: 26px 16px 20px;
    }
    #overall-tabulka > .player-card:nth-child(-n+3) .card-header,
    #overall-tabulka > .player-card:nth-child(-n+3) .compact-row { flex-direction: column; gap: 10px; }
    #overall-tabulka > .player-card:nth-child(-n+3) .player-info { align-items: center; min-width: 0; }
    #overall-tabulka > .player-card:nth-child(-n+3) .score-row,
    #overall-tabulka > .player-card:nth-child(-n+3) .kits-row { justify-content: center; }
    #overall-tabulka > .player-card:nth-child(-n+3) .skin { width: 84px; height: 84px; }
    #overall-tabulka > .player-card:nth-child(-n+3) .rank-badge { font-size: 1.3em; }

    /* Silver – Gold – Bronze, left to right, gold riser in the middle */
    #overall-tabulka > .player-card:nth-child(2) { grid-column: 1; margin-top: 26px; }
    #overall-tabulka > .player-card:nth-child(1) { grid-column: 2; margin-top: -18px; z-index: 2; }
    #overall-tabulka > .player-card:nth-child(3) { grid-column: 3; margin-top: 26px; }

    #overall-tabulka > .player-card:nth-child(2) {
        background: linear-gradient(180deg, rgba(var(--tier-2-rgb),0.16) 0%, var(--bg-card) 70%);
        border-color: rgba(var(--tier-2-rgb),0.4);
        box-shadow: 0 8px 32px rgba(var(--tier-2-rgb),0.14), var(--shadow-md);
    }
    #overall-tabulka > .player-card:nth-child(3) {
        background: linear-gradient(180deg, rgba(var(--tier-3-lt-rgb),0.16) 0%, var(--bg-card) 70%);
        border-color: rgba(var(--tier-3-lt-rgb),0.4);
        box-shadow: 0 8px 32px rgba(var(--tier-3-lt-rgb),0.14), var(--shadow-md);
    }
    #overall-tabulka > .player-card:nth-child(1) {
        background: linear-gradient(180deg, rgba(var(--tier-1-rgb),0.20) 0%, var(--bg-card) 72%);
        border-color: rgba(var(--tier-1-rgb),0.5);
        box-shadow: 0 12px 48px rgba(var(--tier-1-rgb),0.24), var(--shadow-lg);
        animation: podiumGoldGlow 3s ease-in-out infinite;
    }
    #overall-tabulka > .player-card:nth-child(1) .skin { width: 104px; height: 104px; border-width: 3px; }
    #overall-tabulka > .player-card:nth-child(1) .rank-badge { font-size: 1.5em; }

    @keyframes podiumGoldGlow {
        0%, 100% { box-shadow: 0 12px 48px rgba(var(--tier-1-rgb),0.22), var(--shadow-lg); }
        50%      { box-shadow: 0 12px 64px rgba(var(--tier-1-rgb),0.4), var(--shadow-lg); }
    }
}

/* ---------------------------------------------------------------
   Reduced motion — extend the existing global rule to the new
   animations introduced above (breathing glow, spinner ring)
   --------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
    .player-card:has(.skin-bg.rank-1) .rank-badge { animation: none; }
    .spinner::after, .modal-loader-spinner::after, .rh-spinner::after, .profile-loader-spinner::after { animation: none; }
    .player-card:hover, .player-card:active, .kit-tier-col:hover { transform: none; }
    #overall-tabulka > .player-card:nth-child(1),
    #overall-tabulka > .player-card:nth-child(1)::before { animation: none; }
}


/* ================================================================
   MOBIL — modaly a porovnani
   Karta hrace mela min-width: 360px, coz je presne sirka bezneho
   telefonu. S odsazenim overlaye se nevesla a modal precnival ven.
   ================================================================ */
@media (max-width: 560px) {
    .player-modal, .compare-modal, .score-graph-modal, .journey-modal { padding: 8px; }

    .player-modal-content {
        min-width: 0;           /* klicove — jinak modal precniva */
        max-width: 100%;
        max-height: 94vh;
    }

    .compare-modal-content, .score-graph-content { padding: 16px 12px; }

    /* Hlavicky hracu vedle sebe se na uzkem displeji nevejdou v puvodni
       velikosti; VS uprostred zustava, jen se vsechno zmensi. */
    .compare-players { gap: 8px; }
    .compare-player  { padding: 12px 8px; }
    .compare-skin    { width: 44px; height: 44px; }
    .compare-name    { font-size: 0.82em; }
    .compare-vs      { font-size: 1em; }

    .compare-h2h-tally-grid { gap: 6px; }
    .compare-h2h-tally-grid .t-cell   { padding: 6px 4px; }
    .compare-h2h-tally-grid .t-cell b { font-size: 1.1em; }
    .compare-h2h-tally-grid .t-cell span { font-size: 0.62em; }

    /* Seznam soubojů: datum jde pryc jako prvni, nick vitěze je duležitejsi. */
    .compare-h2h-date { display: none; }
}


/* ================================================================
   POROVNANI HRACU — jedna osa vlevo / uprostred / vpravo
   Driv to byly tri sekce, kazda s jinym rozlozenim, takze to
   pusobilo jako tri widgety pod sebou misto jednoho porovnani.
   Ted drzi hlavicka, vaha, kity i souboje stejnou osu.
   ================================================================ */
.compare-scale-slot { margin-bottom: 4px; }
.cmp-scale {
    margin: 0 0 16px; padding: 12px 14px;
    background: var(--bg-surface); border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
}
.cmp-scale-head {
    display: grid; grid-template-columns: 1fr auto 1fr;
    align-items: baseline; gap: 10px; margin-bottom: 7px;
}
.cmp-scale-n { font-size: 1.5em; font-weight: 800; line-height: 1; }
.cmp-scale-n.cmp-a { color: #4ade80; text-align: left; }
.cmp-scale-n.cmp-b { color: #f87171; text-align: right; }
.cmp-scale-label {
    font-size: 0.72em; color: var(--text-muted);
    text-transform: uppercase; letter-spacing: .6px; white-space: nowrap;
}
.cmp-scale-bar {
    height: 7px; border-radius: 100px; overflow: hidden;
    background: #f87171;                 /* pravy hrac = zbytek pruhu */
}
.cmp-scale-bar span {
    display: block; height: 100%; background: #4ade80;
    transition: width .35s var(--ease-out-expo, ease);
}
.cmp-scale-foot {
    display: flex; justify-content: space-between; gap: 8px;
    margin-top: 7px; font-size: 0.72em; color: var(--text-muted);
}

/* Souboje: [skore A] [kit] [skore B] — stejne jako radky kitu */
.compare-h2h-row {
    display: grid; grid-template-columns: 1fr 32px 1fr;
    align-items: center; gap: 8px;
    padding: 6px 10px; border-radius: var(--radius-xs);
}
.compare-h2h-row + .compare-h2h-row { margin-top: 3px; }
.compare-h2h-row .h2h-sa { text-align: right; font-weight: 700; }
.compare-h2h-row .h2h-sb { text-align: left;  font-weight: 700; }
.compare-h2h-row .compare-h2h-kit {
    width: 22px; height: 22px; image-rendering: pixelated; justify-self: center;
}
.compare-h2h-row.h2h-a { background: rgba(74,222,128,0.07); }
.compare-h2h-row.h2h-b { background: rgba(248,113,113,0.07); }
.compare-h2h-row.h2h-d { background: rgba(255,255,255,0.04); }
.compare-h2h-row.h2h-a .h2h-sa { color: #4ade80; }
.compare-h2h-row.h2h-b .h2h-sb { color: #f87171; }


/* Karta v "Nedávno testováno" otevírá stejný detail testu jako tečka
   v grafu kitu — vlastní rozbalování se neosvědčilo, dvě různá zobrazení
   téhož jsou horší než jedno. */
.recent-card.recent-clickable { cursor: pointer; transition: background .15s, transform .15s; }
.recent-card.recent-clickable:hover { background: var(--bg-elevated); transform: translateY(-1px); }
.recent-card:focus-visible { outline: 2px solid var(--border-accent); outline-offset: 2px; }
