:root {
    color-scheme: dark;
    --color-background: #1e1e24;
    --color-on-background: #ffffff;
    --color-background-hover: #1e1e24;
    --color-on-background-hover: white;
    --color-primary: #ff8c00;
    --color-primary-disabled: #3d2304;
    --color-on-primary: #ffffff;
    --color-error: #ef4444;
    --color-on-error: #ffffff;
    --color-surface: rgba(30, 30, 36, 0.45);
    --color-surface-border: rgba(255, 255, 255, 0.05);
    --glass-blur: blur(12px);
    --glass-border: 1px solid rgba(255, 255, 255, 0.06);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

.gradient-text {
    background: linear-gradient(to right, #ffffff 0%, var(--level-color, var(--color-primary)) 50%, #ffffff 100%);
    background-size: 200% auto;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: shine 5s linear infinite;
    display: inline-block;
    padding-top: 0.1em;
    padding-bottom: 0.1em;
    margin-top: -0.1em;
    margin-bottom: -0.1em;
    vertical-align: middle;
    overflow: visible !important;
}

.gradient-text::before,
.gradient-text::after {
    display: none !important;
}

.pfp:hover,
.pfp-link:hover .pfp,
.sidebar-leaderboard .user button:hover .pfp {
    transform: scale(1.1) rotate(5deg);
    box-shadow: 0 0 15px var(--color-primary);
    border-color: var(--color-primary);
}

@keyframes shine {
    to {
        background-position: 200% center;
    }
}

.float {
    animation: floating 3s ease-in-out infinite;
}

@keyframes floating {
    0% {
        transform: translateY(0px);
    }

    50% {
        transform: translateY(-5px);
    }

    100% {
        transform: translateY(0px);
    }
}

html,
body {
    height: 100vh;
    overflow: hidden;
}

body {
    display: flex;
    flex-direction: column;
    margin: 0;
    background-color: var(--color-background);
    background-image: radial-gradient(circle at var(--bg-x1, 15%) var(--bg-y1, 50%),
            rgba(255, 140, 0, 0.08),
            transparent 25%),
        radial-gradient(circle at var(--bg-x2, 85%) var(--bg-y2, 30%),
            rgba(255, 140, 0, 0.05),
            transparent 25%);
    background-size: cover;
    background-attachment: fixed;
    transition: background-color 0.3s ease;
    animation: background-drift 20s ease-in-out infinite alternate;
}

@keyframes background-drift {
    0% {
        --bg-x1: 15%;
        --bg-y1: 50%;
        --bg-x2: 85%;
        --bg-y2: 30%;
    }

    100% {
        --bg-x1: 25%;
        --bg-y1: 40%;
        --bg-x2: 75%;
        --bg-y2: 45%;
    }
}

::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: var(--color-background);
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 140, 0, 0.2);
    border-radius: 10px;
    transition: background 0.3s ease;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--color-primary);
}

a,
button,
[role="button"],
input,
select {
    outline: none !important;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

a:focus-visible,
button:focus-visible,
input:focus,
select:focus {
    box-shadow: 0 0 0 2px var(--color-primary), 0 0 15px rgba(255, 140, 0, 0.3);
}

.type-label-lg.link:hover {
    color: var(--color-primary);
    text-shadow: 0 0 8px rgba(255, 140, 0, 0.4);
}

header,
main {
    grid-template-columns: minmax(20rem, 1fr) minmax(24rem, 2fr) minmax(17rem,
            1fr);
    column-gap: 2rem;
}

header {
    position: sticky;
    top: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 3rem;
    padding-top: calc(1.5rem + 3px);
    z-index: 1000;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    background: transparent;
    border-bottom: 1px solid transparent;
}

header.scrolled {
    background-color: rgba(30, 30, 36, 0.7);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.3);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

header.dark {
    background: linear-gradient(135deg,
            rgba(30, 30, 36, 0.85),
            rgba(25, 25, 30, 0.9));
    border-bottom: 1px solid var(--color-surface-border);
}

@media screen and (min-width: 1366px) {
    header {
        display: grid;
        padding-inline: 0;
    }
}

@media screen and (min-width: 1366px) and (max-width: 1535px) {
    header,
    main {
        grid-template-columns: minmax(18rem, 1fr) minmax(22rem, 2fr) minmax(16rem, 1fr);
        column-gap: 1.5rem;
    }

    header {
        padding-inline: 1.5rem;
        display: flex;
    }
}

header .logo {
    justify-self: end;
    align-self: center;
    display: flex;
    align-items: flex-end;
    gap: 1rem;
}

header .nav {
    flex: 1;
}

main {
    display: grid;
    grid-template-rows: minmax(0, 1fr);
    column-gap: 2rem;
    flex: 1;
    min-height: 0;
}

main>div {
    overflow-y: auto;
}

.spinner {
    display: flex;
    align-items: center;
    justify-content: center;
    grid-column: span 3;
}

input[type="checkbox"] {
    height: 1.25rem;
    width: 1.25rem;
    cursor: pointer;
    margin: 0;
}

.author {
    cursor: pointer;
    transition: color 0.2s ease;
}

.author:hover {
    color: var(--color-primary);
    text-decoration: underline;
}

.player-meta .link {
    color: inherit;
    text-decoration: none;
    transition: color 0.2s ease;
}

.player-meta .link:hover {
    color: var(--color-primary);
    text-decoration: underline;
}

.scroll-progress-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    z-index: 1001;
    pointer-events: none;
}

.scroll-progress-bar {
    height: 100%;
    background: linear-gradient(to right, var(--color-primary), #ff6b00);
    width: 0%;
    box-shadow: 0 0 10px rgba(255, 140, 0, 0.5);
    transition: none;
}

.skeleton {
    background: linear-gradient(90deg,
            rgba(255, 255, 255, 0.03) 25%,
            rgba(255, 255, 255, 0.08) 37%,
            rgba(255, 255, 255, 0.03) 63%);
    background-size: 400% 100%;
    animation: skeleton-shimmer 1.4s ease infinite;
    border-radius: 8px;
}

.skeleton-text {
    height: 1rem;
    width: 100%;
    margin-bottom: 0.5rem;
}

@keyframes skeleton-shimmer {
    0% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

.level-item {
    position: relative;
    overflow: hidden;
}

.level-item::after {
    content: "";
    position: absolute;
    top: 0;
    left: -150%;
    width: 100%;
    height: 100%;
    background: linear-gradient(120deg,
            transparent,
            rgba(255, 255, 255, 0.05),
            transparent);
    transition: all 0.6s ease;
    pointer-events: none;
}

.level-item:hover::after {
    left: 150%;
}

.nav__cta {
    position: relative;
    overflow: hidden;
    box-shadow: 0 0 10px rgba(255, 140, 0, 0.2);
    animation: btn-pulse 3s infinite;
}

.nav__cta::after {
    content: "";
    position: absolute;
    top: 0;
    left: -150%;
    width: 100%;
    height: 100%;
    background: linear-gradient(120deg,
            transparent,
            rgba(255, 255, 255, 0.2),
            transparent);
    transition: all 0.6s ease;
}

.nav__cta:hover::after {
    left: 150%;
}

@keyframes btn-pulse {
    0% {
        box-shadow: 0 0 10px rgba(255, 140, 0, 0.2);
    }

    50% {
        box-shadow: 0 0 20px rgba(255, 140, 0, 0.5);
    }

    100% {
        box-shadow: 0 0 10px rgba(255, 140, 0, 0.2);
    }
}

.score-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.verified-badge {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    background: linear-gradient(
        90deg,
        #b8860b 0%,
        #ffd700 25%,
        #ffec80 40%,
        #ffd700 55%,
        #b8860b 70%,
        #ffd700 85%,
        #b8860b 100%
    );
    background-size: 200% auto;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: verified-shine 3s linear infinite;
    text-shadow: none;
    filter: drop-shadow(0 0 4px rgba(255, 215, 0, 0.6)) drop-shadow(0 0 8px rgba(255, 215, 0, 0.3));
    padding: 0.15em 0.4em;
    border-radius: 4px;
    border: 1px solid rgba(255, 215, 0, 0.3);
    white-space: nowrap;
}

@keyframes verified-shine {
    0% {
        background-position: -200% center;
        filter: drop-shadow(0 0 4px rgba(255, 215, 0, 0.6)) drop-shadow(0 0 8px rgba(255, 215, 0, 0.3));
    }

    50% {
        filter: drop-shadow(0 0 6px rgba(255, 215, 0, 0.8)) drop-shadow(0 0 12px rgba(255, 215, 0, 0.5));
    }

    100% {
        background-position: 200% center;
        filter: drop-shadow(0 0 4px rgba(255, 215, 0, 0.6)) drop-shadow(0 0 8px rgba(255, 215, 0, 0.3));
    }
}

/* ===== Mobile / Tablet (≤ 1365px) ===== */
@media screen and (max-width: 1365px) {
    html,
    body {
        height: auto;
        overflow: auto;
        overflow-x: hidden;
    }

    body {
        display: block;
    }

    header {
        display: flex;
        padding: 1rem 1.25rem;
        padding-top: calc(1rem + env(safe-area-inset-top, 0px));
        position: sticky;
        top: 0;
    }

    header .logo h2 {
        font-size: 1.25rem;
    }

    main {
        display: block;
        flex: none;
    }

    main > div {
        overflow-y: visible;
    }

    .spinner {
        grid-column: auto;
    }

    h1 {
        font-size: 2rem;
        letter-spacing: -1px;
    }

    .gradient-text {
        padding-top: 0.05em;
        padding-bottom: 0.05em;
    }
}