:root {
    --panel-bg: 20, 20, 30;
    --panel-opacity: 0.6;
    --text-main: rgba(255, 255, 255, 0.9);
    --text-muted: rgba(255, 255, 255, 0.4);
    --accent-gold: #ffd700;
    --error-red: #ff5f5f;
    --font-modern: 'JetBrains Mono', monospace;
    --font-retro: 'Pixelify Sans', monospace;
    --font-retro: 'Pixelify Sans', monospace;
    --font-clean: 'Outfit', sans-serif;
    --font-serif: 'Playfair Display', serif;
    --font-typewriter: 'Courier Prime', monospace;
    --font-hand: 'Caveat', cursive;
    --font-main: var(--font-modern);
}

body {
    font-family: var(--font-main);
    background-color: #14141e;
    transition: background-image 0.3s ease-in-out;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
    margin: 0;
    overflow: hidden;
    color: var(--text-main);
}

body::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.3);
    z-index: -1;
    pointer-events: none;
}

#hidden-input {
    opacity: 0;
    position: absolute;
    pointer-events: none;
}

/* --- BACKGROUND VIDEO --- */
#bg-video {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    object-fit: cover;
    z-index: -2;
    transition: opacity 1s ease;
}

.fade-out {
    opacity: 0 !important;
}

/* --- PARTICLE CANVAS --- */
#particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    pointer-events: none;
}

#keypress-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 50;
    pointer-events: none;
}

/* --- MAIN PANEL --- */
.glass-panel {
    background: rgba(var(--panel-bg), var(--panel-opacity));
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    padding: 60px;
    width: 90%;
    max-width: 1000px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    position: relative;
    transition: all 0.3s ease;
}

/* --- ICON BUTTONS (settings + sound) --- */
/* --- ICON BUTTONS (settings + sound) --- */
.glass-icon,
#settings-btn,
#zen-btn,
#sound-btn {
    position: absolute;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 100;
    top: 2rem;
}

/* --- TOP NAV BUTTONS CONTAINER --- */
#top-nav-buttons {
    position: absolute;
    top: 2rem;
    right: 3rem;
    display: flex;
    gap: 1rem;
    align-items: center;
    z-index: 500;
}

/* Reset partial positioning for children */
#top-nav-buttons .glass-icon,
#settings-btn,
#leaderboard-btn,
#login-btn,
#sound-btn,
#zen-btn {
    position: relative;
    /* Override absolute */
    top: auto;
    right: auto;
    left: auto;
    bottom: auto;
    margin: 0;
}

#sound-btn.muted {
    opacity: 0.5;
    background: rgba(255, 50, 50, 0.1);
    border-color: rgba(255, 50, 50, 0.2);
}

.glass-icon:hover,
#settings-btn:hover,
#sound-btn:hover,
#zen-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.25);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

/* Specific icons size fix */
.glass-icon i {
    font-size: 1.2rem;
}

/* --- ZEN MODE --- */
/* Panel stays visible in Zen Mode */

body.zen-mode .stats-bar,
body.zen-mode .footer-hint,
body.zen-mode #sound-btn,
body.zen-mode #settings-btn,
body.zen-mode #track-selector,
body.zen-mode #combo-display,
body.zen-mode #app-header,
body.zen-mode .site-footer,
body.zen-mode #login-btn,
body.zen-mode #leaderboard-btn,
body.zen-mode #wallpaper-sound-btn {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s ease;
}

body.zen-mode #zen-btn {
    opacity: 0.3;
    transition: opacity 0.3s;
}

body.zen-mode #zen-btn:hover {
    opacity: 1;
}

/* --- STATS BAR --- */
.stats-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

/* --- TIME MODE BUTTONS --- */
.time-modes {
    display: flex;
    gap: 6px;
    background: rgba(255, 255, 255, 0.05);
    padding: 4px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.time-btn {
    padding: 4px 14px;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: 'JetBrains Mono', monospace;
}

.time-btn:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.08);
}

.time-btn.active {
    color: #111;
    background: var(--accent-gold);
    box-shadow: 0 0 12px rgba(255, 215, 0, 0.4);
}

/* --- COMBO COUNTER --- */
#combo-display {
    text-align: center;
    margin-bottom: 0.75rem;
    transition: all 0.3s ease;
    min-height: 2rem;
}

#combo-display.combo-hidden {
    opacity: 0;
    transform: scale(0.8);
}

#combo-display.combo-visible {
    opacity: 1;
    transform: scale(1);
}

#combo-count {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--accent-gold);
    text-shadow: 0 0 20px rgba(255, 215, 0, 0.5);
    margin-right: 6px;
}

#combo-label {
    font-size: 0.65rem;
    letter-spacing: 0.2em;
    color: var(--text-muted);
    font-weight: 700;
}

#combo-display.combo-pop {
    animation: comboPop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes comboPop {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.3);
    }

    100% {
        transform: scale(1);
    }
}

/* High combo glow */
#combo-display.combo-fire #combo-count {
    color: #ff6b35;
    text-shadow: 0 0 25px rgba(255, 107, 53, 0.7);
}

#combo-display.combo-electric #combo-count {
    color: #00d4ff;
    text-shadow: 0 0 25px rgba(0, 212, 255, 0.7);
}

/* 25 Streak - Savage */
#combo-display.combo-savage #combo-count {
    color: #ff2a6d;
    /* Cyberpunk Pink/Red */
    text-shadow: 0 0 30px rgba(255, 42, 109, 0.8);
}

/* 50 Streak - Godlike */
#combo-display.combo-godlike #combo-count {
    color: #ffffff;
    text-shadow: 0 0 35px rgba(255, 255, 255, 0.8), 0 0 10px rgba(255, 215, 0, 0.8);
    /* White with Gold Glow */
}

/* --- CYBER THEME --- */
/* 5 Streak - Charged */
#combo-display.combo-charged #combo-count {
    color: #39ff14;
    /* Neon Green */
    text-shadow: 0 0 20px rgba(57, 255, 20, 0.7);
}

/* 10 Streak - System Override */
#combo-display.combo-system #combo-count {
    color: #bc13fe;
    /* Neon Violet */
    text-shadow: 0 0 25px rgba(188, 19, 254, 0.7);
}

/* 25 Streak - Glitch God */
#combo-display.combo-glitch #combo-count {
    color: #ff00ff;
    /* Magenta */
    text-shadow: 2px 2px 0px rgba(0, 255, 255, 0.7), -2px -2px 0px rgba(255, 0, 0, 0.7), 0 0 25px rgba(255, 0, 255, 0.8);
}

/* 50 Streak - Singularity */
#combo-display.combo-singularity #combo-count {
    color: #10b981;
    /* Emerald */
    text-shadow: 0 0 35px rgba(16, 185, 129, 0.9), 0 0 15px rgba(255, 255, 255, 0.5);
}

/* --- SCREEN SHAKE --- */
@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    20% {
        transform: translateX(-4px);
    }

    40% {
        transform: translateX(4px);
    }

    60% {
        transform: translateX(-3px);
    }

    80% {
        transform: translateX(2px);
    }
}

.shake {
    animation: shake 0.3s ease !important;
}

/* --- SETTINGS MODAL --- */
#settings-modal,
#auth-modal,
#leaderboard-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999 !important;
    /* Force high z-index to fix persistent overlay issues */
    opacity: 1;
    transition: opacity 0.3s ease;
    /* Force light text in settings modal regardless of theme */
    --text-main: rgba(255, 255, 255, 0.9);
    --text-muted: rgba(255, 255, 255, 0.4);
}

#settings-modal.hidden,
#auth-modal.hidden,
#leaderboard-modal.hidden {
    opacity: 0;
    pointer-events: none;
}

.settings-content {
    width: 620px;
    max-height: 82vh;
    padding: 0;
    background: linear-gradient(165deg, rgba(18, 18, 28, 0.98), rgba(10, 10, 16, 0.99));
    display: flex;
    flex-direction: column;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow:
        0 25px 60px -15px rgba(0, 0, 0, 0.6),
        0 0 1px 0 rgba(255, 215, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
    animation: modalSlideIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    overflow-y: auto;
    /* Allow scrolling for overflowing content */
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
}

/* Custom Scrollbar for Settings/Modals */
.settings-content::-webkit-scrollbar {
    width: 6px;
}

.settings-content::-webkit-scrollbar-track {
    background: transparent;
}

.settings-content::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 20px;
}

.settings-content::-webkit-scrollbar-thumb:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

@keyframes modalSlideIn {
    from {
        transform: translateY(16px) scale(0.97);
        opacity: 0;
    }

    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

/* --- SETTINGS HEADER --- */
.settings-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 22px 28px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    background: linear-gradient(180deg, rgba(255, 215, 0, 0.03) 0%, transparent 100%);
}

.settings-header-left {
    display: flex;
    align-items: center;
    gap: 14px;
}

.settings-icon-wrap {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.15), rgba(255, 180, 0, 0.05));
    border: 1px solid rgba(255, 215, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    color: var(--accent-gold);
}

.settings-title {
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    color: rgba(255, 255, 255, 0.92);
    margin: 0;
    line-height: 1.2;
}

.settings-subtitle {
    font-size: 0.68rem;
    color: var(--text-muted);
    letter-spacing: 0.06em;
    margin: 2px 0 0 0;
}

/* --- SETTINGS TABS --- */
.settings-tabs {
    display: flex;
    padding: 0 28px;
    gap: 4px;
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.settings-tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    transition: all 0.25s ease;
    position: relative;
    border-bottom: 2px solid transparent;
}

.settings-tab i {
    font-size: 1rem;
    transition: transform 0.2s ease;
}

.settings-tab:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.03);
}

.settings-tab:hover i {
    transform: scale(1.1);
}

.settings-tab.active {
    color: var(--accent-gold);
    border-bottom-color: var(--accent-gold);
    background: rgba(255, 215, 0, 0.04);
}

.settings-tab.active i {
    filter: drop-shadow(0 0 4px rgba(255, 215, 0, 0.4));
}

/* --- TAB PANES --- */
.tab-pane {
    display: none;
    animation: tabFadeIn 0.25s ease;
}

.tab-pane.active {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    /* Enable scrolling for all tabs */
}

/* Custom Scrollbar for tab panes */
.tab-pane::-webkit-scrollbar {
    width: 4px;
}

.tab-pane::-webkit-scrollbar-track {
    background: transparent;
}

.tab-pane::-webkit-scrollbar-thumb {
    background: rgba(255, 215, 0, 0.2);
    border-radius: 4px;
}

.tab-pane::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 215, 0, 0.35);
}

#tab-typing {
    padding: 20px 28px;
}

@keyframes tabFadeIn {
    from {
        opacity: 0;
        transform: translateY(6px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.close-btn {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.04);
    color: rgba(255, 255, 255, 0.4);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    transition: all 0.2s ease;
}

.close-btn:hover {
    background: rgba(255, 80, 80, 0.15);
    border-color: rgba(255, 80, 80, 0.3);
    color: #ff6b6b;
    transform: rotate(90deg);
}

/* --- WALLPAPER SECTION --- */
.wallpaper-section {
    flex-grow: 1;
    overflow-y: auto;
    padding: 20px 28px;
}

.wallpaper-section::-webkit-scrollbar {
    width: 4px;
}

.wallpaper-section::-webkit-scrollbar-track {
    background: transparent;
}

.wallpaper-section::-webkit-scrollbar-thumb {
    background: rgba(255, 215, 0, 0.2);
    border-radius: 4px;
}

.wallpaper-section::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 215, 0, 0.35);
}

.section-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.section-icon {
    font-size: 0.85rem;
    color: var(--accent-gold);
    opacity: 0.7;
}

.section-label {
    font-size: 0.68rem;
    letter-spacing: 0.15em;
    color: var(--text-muted);
    font-weight: 700;
    display: block;
    margin: 0;
}

/* --- WALLPAPER CATEGORY TABS --- */
.wallpaper-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-bottom: 14px;
    padding: 4px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.category-tab {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 6px 11px;
    border-radius: 8px;
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    color: var(--text-muted);
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all 0.25s ease;
    font-family: 'JetBrains Mono', monospace;
    white-space: nowrap;
    flex-shrink: 0;
}

.category-tab i {
    font-size: 0.8rem;
    transition: transform 0.2s ease;
}

.category-tab:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.06);
}

.category-tab:hover i {
    transform: scale(1.15);
}

.category-tab.active {
    color: #111;
    background: linear-gradient(135deg, var(--accent-gold), #ffb800);
    box-shadow: 0 2px 12px rgba(255, 215, 0, 0.25);
}

.category-tab.active .tab-count {
    background: rgba(0, 0, 0, 0.2);
    color: #111;
}

.tab-count {
    font-size: 0.55rem;
    padding: 1px 5px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-muted);
    font-weight: 700;
    min-width: 15px;
    text-align: center;
    transition: all 0.2s ease;
}

/* --- EMPTY CATEGORY STATE --- */
.empty-category {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 35px 20px;
    color: var(--text-muted);
    gap: 6px;
    border: 1px dashed rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.01);
}

.empty-category i {
    font-size: 1.8rem;
    opacity: 0.2;
    margin-bottom: 4px;
    color: var(--accent-gold);
}

.empty-category span {
    font-size: 0.72rem;
    letter-spacing: 0.08em;
}

.empty-hint {
    font-size: 0.58rem !important;
    opacity: 0.35;
}

/* --- WALLPAPER GRID --- */
.wallpaper-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.wallpaper-thumb {
    height: 90px;
    border-radius: 12px;
    cursor: pointer;
    background-size: cover;
    background-position: center;
    border: 2px solid transparent;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    opacity: 0.65;
    position: relative;
    overflow: hidden;
}

.wallpaper-thumb::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 10px;
    background: linear-gradient(180deg, transparent 50%, rgba(0, 0, 0, 0.5) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.wallpaper-thumb:hover {
    transform: translateY(-3px) scale(1.03);
    opacity: 1;
    box-shadow: 0 8px 24px -6px rgba(0, 0, 0, 0.5);
}

.wallpaper-thumb:hover::after {
    opacity: 1;
}

.wallpaper-thumb.active {
    border-color: var(--accent-gold);
    opacity: 1;
    box-shadow: 0 0 0 1px rgba(255, 215, 0, 0.3), 0 4px 20px -4px rgba(255, 215, 0, 0.3);
}

/* --- EFFECTS SECTION --- */
.effects-section {
    padding: 20px 28px;
}

.effect-options {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.effect-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 12px 8px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.25s ease;
    font-family: 'JetBrains Mono', monospace;
}

.effect-btn i {
    font-size: 1.15rem;
    transition: transform 0.2s ease, color 0.2s ease;
}

.effect-btn span {
    font-size: 0.62rem;
    font-weight: 600;
    letter-spacing: 0.08em;
}

.effect-btn:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.15);
    color: var(--text-main);
    transform: translateY(-2px);
}

.effect-btn:hover i {
    transform: scale(1.2);
}

.effect-btn.active {
    border-color: var(--accent-gold);
    background: rgba(255, 215, 0, 0.08);
    color: var(--accent-gold);
    box-shadow: 0 0 16px rgba(255, 215, 0, 0.1), inset 0 0 12px rgba(255, 215, 0, 0.03);
}

.effect-btn.active i {
    color: var(--accent-gold);
    filter: drop-shadow(0 0 6px rgba(255, 215, 0, 0.5));
}

/* --- SOUND SECTION --- */
.sound-section {
    padding: 20px 28px;
}

.sound-options {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.sound-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 12px 8px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.25s ease;
    font-family: 'JetBrains Mono', monospace;
}

.sound-btn i {
    font-size: 1.15rem;
    transition: transform 0.2s ease, color 0.2s ease;
}

.sound-btn span {
    font-size: 0.62rem;
    font-weight: 600;
    letter-spacing: 0.08em;
}

.sound-btn:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.15);
    color: var(--text-main);
    transform: translateY(-2px);
}

.sound-btn:hover i {
    transform: scale(1.2);
}

.sound-btn.active {
    border-color: var(--accent-gold);
    background: rgba(255, 215, 0, 0.08);
    color: var(--accent-gold);
    box-shadow: 0 0 16px rgba(255, 215, 0, 0.1), inset 0 0 12px rgba(255, 215, 0, 0.03);
}

.sound-btn.active i {
    color: var(--accent-gold);
    filter: drop-shadow(0 0 6px rgba(255, 215, 0, 0.5));
}

/* --- COLOR PRESETS --- */
.color-presets {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.color-dot {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.12);
    background: var(--dot-color);
    cursor: pointer;
    transition: all 0.25s ease;
    position: relative;
    padding: 0;
}

.color-dot::after {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 2px solid transparent;
    transition: all 0.25s ease;
}

.color-dot:hover {
    transform: scale(1.15);
    border-color: white;
    box-shadow: 0 0 15px currentColor;
}

.color-btn.active {
    transform: scale(1.15);
    border-color: white;
    box-shadow: 0 0 15px currentColor;
}

.color-dot.active {
    border-color: white;
    transform: scale(1.1);
    box-shadow: 0 0 16px var(--dot-color);
}

.color-dot.active::after {
    border-color: var(--dot-color);
}

.color-picker-wrap {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    position: relative;
    cursor: pointer;
    background: conic-gradient(#ff0000, #ffff00, #00ff00, #00ffff, #0000ff, #ff00ff, #ff0000);
    border: 2px solid rgba(255, 255, 255, 0.12);
    transition: all 0.25s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.color-picker-wrap:hover {
    transform: scale(1.15);
    border-color: rgba(255, 255, 255, 0.3);
    box-shadow: 0 0 12px rgba(255, 255, 255, 0.3);
}

.color-picker-wrap input[type="color"] {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    border: none;
    padding: 0;
}

.color-picker-wrap i {
    font-size: 0.7rem;
    color: white;
    pointer-events: none;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
}

/* --- SETTINGS CONTROLS FOOTER --- */
.settings-controls {
    padding: 20px 28px 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    flex-direction: column;
    gap: 18px;
    background: linear-gradient(0deg, rgba(255, 215, 0, 0.02) 0%, transparent 100%);
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.control-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.control-label-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
}

.control-value {
    font-size: 0.72rem;
    font-family: 'JetBrains Mono', monospace;
    color: var(--accent-gold);
    font-weight: 600;
    background: rgba(255, 215, 0, 0.08);
    padding: 2px 10px;
    border-radius: 6px;
    letter-spacing: 0.05em;
}

/* --- RANGE SLIDER --- */
.slider-track {
    padding: 4px 0;
}

.styled-slider {
    width: 100%;
    height: 5px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
}

.styled-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    background: var(--accent-gold);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.3);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.styled-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 0 16px rgba(255, 215, 0, 0.5);
}

/* --- TINT BUTTONS --- */
.tint-options {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 8px;
    scrollbar-width: thin;
}

.tint-options::-webkit-scrollbar {
    height: 4px;
}

.tint-options::-webkit-scrollbar-track {
    background: transparent;
}

.tint-options::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 4px;
}

.tint-btn {
    flex: 0 0 auto;
    width: 82px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 14px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.03);
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    transition: all 0.25s ease;
}

.tint-preview {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.15);
    transition: all 0.25s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.tint-name {
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    font-family: 'JetBrains Mono', monospace;
}

.tint-btn:hover {
    background: rgba(255, 255, 255, 0.06);
    transform: translateY(-2px);
    border-color: rgba(255, 255, 255, 0.15);
}

.tint-btn.active {
    border-color: var(--accent-gold);
    background: rgba(255, 215, 0, 0.06);
    color: white;
}

.tint-btn.active .tint-preview {
    border-color: var(--accent-gold);
    box-shadow: 0 0 12px rgba(255, 215, 0, 0.3);
}

/* --- GAME UI --- */
#words-wrapper {
    position: relative;
    min-height: 120px;
}

#words-container {
    position: relative;
    font-size: 1.8rem;
    line-height: 1.6;
    display: flex;
    flex-wrap: wrap;
    gap: 0.6em;
    user-select: none;
    max-height: 200px;
    overflow: hidden;
    padding-top: 25px;
    padding-bottom: 25px;
    box-sizing: border-box;
    mask-image: linear-gradient(to bottom, transparent 0%, black 15%, black 85%, transparent 100%);
    -webkit-mask-image: linear-gradient(to bottom, transparent 0%, black 15%, black 85%, transparent 100%);
}

.word {
    display: flex;
    color: var(--text-muted);
    position: relative;
}

.letter {
    position: relative;
    transition: color 0.1s ease;
}

.letter.correct {
    color: var(--text-main);
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

.letter.incorrect {
    color: var(--error-red);
    text-decoration: underline;
}

/* --- CARET + TRAIL --- */
#caret {
    position: absolute;
    width: 3px;
    height: 1.8rem;
    background: var(--accent-gold);
    margin-top: 0.3rem;
    margin-left: -1px;
    border-radius: 2px;
    transition: transform 0.1s cubic-bezier(0.2, 0, 0, 1);
    animation: blink 1s infinite;
    top: 0;
    left: 0;
    pointer-events: none;
    z-index: 10;
}

#caret-trail {
    position: absolute;
    width: 3px;
    height: 1.8rem;
    background: var(--accent-gold);
    margin-top: 0.3rem;
    margin-left: -1px;
    border-radius: 2px;
    opacity: 0.3;
    filter: blur(4px);
    transition: transform 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    top: 0;
    left: 0;
    pointer-events: none;
    z-index: 9;
    display: none;
    /* Hidden globally as per user request */
}

@keyframes blink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

/* --- RESULTS OVERLAY --- */
#results-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 50;
    opacity: 1;
    transition: opacity 0.3s ease;
    /* Force light text in results overlay regardless of theme */
    --text-main: rgba(255, 255, 255, 0.9);
    --text-muted: rgba(255, 255, 255, 0.4);
}

#results-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.results-content {
    text-align: center;
    max-width: 500px;
    background: rgba(20, 20, 30, 0.9);
    animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    /* Force light text locally */
    --text-main: rgba(255, 255, 255, 0.9);
    --text-muted: rgba(255, 255, 255, 0.4);
    color: var(--text-main);
}

.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin: 30px 0;
}

.stat-item {
    display: flex;
    flex-direction: column;
}

.stat-item .label {
    font-size: 0.8rem;
    letter-spacing: 2px;
    color: var(--text-muted);
}

.stat-item .value {
    font-size: 3rem;
    font-weight: 700;
    color: var(--accent-gold);
}

.footer-hint {
    margin-top: 2rem;
    font-size: 0.75rem;
    letter-spacing: 0.2em;
    color: var(--text-muted);
    text-align: center;
}

.key {
    background: rgba(255, 255, 255, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* --- LOADING OVERLAY --- */
#loading-overlay {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 300;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 20px 40px;
    border-radius: 50px;
    display: flex;
    align-items: center;
    gap: 15px;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

#loading-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.loader-text {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    letter-spacing: 0.1em;
    color: #fff;
    font-weight: bold;
}

.loader-spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #ffd700;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* --- CARET STYLES --- */
#caret {
    background: var(--caret-color, var(--accent-gold));
    transition: transform 0.08s ease-out, width 0.2s, height 0.2s, background-color 0.2s, border 0.2s;
    position: absolute;
    pointer-events: none;
    z-index: 10;
}

/* Default / Line */
body[data-caret="line"] #caret {
    width: 2px;
    height: 1.4em;
    opacity: 1;
}

/* Block */
body[data-caret="block"] #caret {
    width: 1ch;
    height: 1.4em;
    opacity: 0.5;
}

/* Underline */
body[data-caret="underline"] #caret {
    width: 1ch;
    height: 3px;
    margin-top: 1.2em;
    opacity: 1;
}

/* Outline */
body[data-caret="outline"] #caret {
    width: 1ch;
    height: 1.4em;
    background: transparent;
    border: 2px solid var(--caret-color, var(--accent-gold));
    opacity: 1;
}

/* Blade */
body[data-caret="blade"] #caret {
    background: transparent !important;
    width: 1ch;
    box-shadow: none;
    /* Removed transform: none override to allow JS positioning */
}

body[data-caret="blade"] #caret::after {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 3px;
    background: var(--caret-color, var(--accent-gold));
    transform: skewX(-20deg);
    box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    border-radius: 1px;
}

body[data-caret="blade"] #caret-trail {
    display: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
}

/* Glow */
body[data-caret="glow"] #caret {
    width: 3px;
    height: 1.4em;
    opacity: 1;
    background: var(--caret-color, var(--accent-gold));
    box-shadow:
        0 0 10px var(--caret-color, var(--accent-gold)),
        0 0 20px var(--caret-color, var(--accent-gold)),
        0 0 40px var(--caret-color, var(--accent-gold));
    border-radius: 2px;
}

/* Beam */
body[data-caret="beam"] #caret {
    width: 10px !important;
    height: 1.3em;
    background: transparent !important;
    border-top: 3px solid var(--caret-color, var(--accent-gold));
    border-bottom: 3px solid var(--caret-color, var(--accent-gold));
    border-radius: 1px;
}

body[data-caret="beam"] #caret::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--caret-color, var(--accent-gold));
    transform: translateX(-50%);
}

/* Off */
body[data-caret="off"] #caret {
    display: none;
}

/* --- TYPING TAB STYLES --- */
.caret-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
    gap: 12px;
    margin-top: 16px;
}

.font-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
    gap: 12px;
    margin-top: 24px;
    /* Increased top margin for separation */
}

.caret-btn,
.font-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 16px 12px;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.03) 0%, rgba(255, 255, 255, 0.01) 100%);
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.caret-btn:hover,
.font-btn:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-main);
    transform: translateY(-2px);
    border-color: rgba(255, 255, 255, 0.15);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.caret-btn.active,
.font-btn.active {
    background: var(--accent-gold);
    color: #000;
    border-color: var(--accent-gold);
    transform: translateY(-2px);
    box-shadow: 0 4px 25px rgba(255, 215, 0, 0.4);
}

.btn-icon {
    font-size: 1.2rem;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.caret-btn.active .btn-icon,
.font-btn.active .btn-icon {
    opacity: 1;
}

.btn-label {
    opacity: 0.8;
}

.caret-btn.active .btn-label,
.font-btn.active .btn-label {
    opacity: 1;
    font-weight: 800;
}

/* Font UI */
/* Removed redundant font-btn block as it's merged above */

/* --- PARTICLE CONTROLS --- */
.switch {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.switch input {
    display: none;
}

.slider {
    position: relative;
    width: 44px;
    height: 24px;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.slider::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 18px;
    height: 18px;
    background-color: rgba(255, 255, 255, 0.6);
    border-radius: 50%;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

input:checked+.slider {
    background-color: var(--accent-gold);
    border-color: var(--accent-gold);
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.3);
}

input:checked+.slider::before {
    transform: translateX(20px);
    background-color: #111;
}

/* Color Picker */
.color-options {
    display: flex;
    gap: 12px;
    margin-top: 10px;
}

.color-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.1);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
}

.color-btn:hover {
    transform: scale(1.1);
    border-color: rgba(255, 255, 255, 0.5);
}

.color-btn.active {
    transform: scale(1.15);
    border-color: white;
    box-shadow: 0 0 15px currentColor;
}

/* Track Selector - Top Right */
#track-selector {
    position: relative;
    top: auto;
    right: auto;
    /* Aligns with new button spacing */
    z-index: 50;
    font-family: 'Outfit', sans-serif;
}

#track-selector.hidden {
    display: none;
}

.current-track {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 0.6rem 1rem;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    width: 200px;
    /* Fixed width for stability */
    justify-content: space-between;
}

.current-track:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.25);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

.current-track i:first-child {
    font-size: 1.1rem;
    color: #34d399;
    /* Matches theme accent */
}

.current-track i:last-child {
    font-size: 1.1rem;
    opacity: 0.6;
    transition: transform 0.3s ease;
}

#track-selector:hover .current-track i:last-child {
    transform: rotate(180deg);
}

.track-list {
    position: absolute;
    top: 100%;
    right: 0;
    width: 100%;
    margin-top: 0.5rem;
    background: rgba(20, 20, 20, 0.85);
    /* Darker for list */
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    max-height: 300px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

.track-list::-webkit-scrollbar {
    width: 6px;
}

.track-list::-webkit-scrollbar-track {
    background: transparent;
    margin: 4px 0;
}

.track-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.track-list::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

#track-selector:hover .track-list {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.track-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.8rem;
    border-radius: 10px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.track-item:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.track-item.active {
    background: rgba(52, 211, 153, 0.15);
    color: #34d399;
}

.track-item i {
    font-size: 1rem;
    opacity: 0.8;
}

/* --- TRACK LOADING INDICATOR --- */
/* --- TRACK LOADING INDICATOR --- */
@keyframes shine {
    0% {
        background-position: -200% center;
    }

    100% {
        background-position: 200% center;
    }
}

.track-loading {
    background: linear-gradient(90deg,
            rgba(255, 255, 255, 0.5) 0%,
            #34d399 50%,
            rgba(255, 255, 255, 0.5) 100%);
    background-size: 200% auto;
    color: transparent !important;
    -webkit-background-clip: text;
    background-clip: text;
    animation: shine 2s linear infinite;
    font-family: 'JetBrains Mono', monospace;
    font-weight: 800;
    letter-spacing: 0.1em;
}

/* --- AUTH & LEADERBOARD MODALS --- */
#auth-modal,
#leaderboard-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 210;
    /* Above settings modal */
    opacity: 1;
    transition: opacity 0.3s ease;
}

#auth-modal.hidden,
#leaderboard-modal.hidden {
    opacity: 0;
    pointer-events: none;
}

.auth-content {
    width: 480px;
    /* Widened from 420px for better leaderboard spacing */
    height: auto;
    max-height: 90vh;
}

.auth-body {
    padding: 30px 35px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}


.auth-heading {
    font-size: 1.5rem;
    font-weight: 700;
    color: #fff;
    margin: 0;
    text-align: center;
    margin-bottom: 6px;
}

.auth-sub {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-align: center;
    margin: 0 0 25px 0;
}

/* Social Button */
.social-btn {
    width: 100%;
    padding: 12px;
    border-radius: 12px;
    background: #fff;
    color: #111;
    border: none;
    font-size: 0.9rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.social-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 255, 255, 0.15);
}

.divider {
    display: flex;
    align-items: center;
    gap: 15px;
    margin: 20px 0;
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 600;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
}

/* Form Inputs */
.input-group {
    position: relative;
    margin-bottom: 12px;
}

.input-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 1.1rem;
    pointer-events: none;
    transition: color 0.2s ease;
}

.input-group input {
    width: 100%;
    padding: 12px 12px 12px 42px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
    font-size: 0.95rem;
    outline: none;
    transition: all 0.2s ease;
}

.input-group input:focus {
    border-color: var(--accent-gold);
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 0 4px rgba(255, 215, 0, 0.1);
}

.submit-btn {
    width: 100%;
    padding: 14px;
    border-radius: 12px;
    background: linear-gradient(135deg, #ffd700 0%, #ffc000 100%);
    color: #000;
    border: none;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 5px 20px rgba(255, 215, 0, 0.3);
    margin-top: 10px;
}

.submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(255, 215, 0, 0.4);
}

/* Leaderboard Specifics */
/* --- LEADERBOARD (MEGA PREMIUM) --- */
/* --- LEADERBOARD (MEGA PREMIUM REDESIGN) --- */
.leaderboard-list {
    margin-top: 1.5rem;
    max-height: 500px;
    overflow-y: auto;
    padding: 0 20px 10px;
    /* Removed top padding to pull items up */
    /* More horizontal padding */
    display: flex;
    flex-direction: column;
    gap: 16px;
    /* Increased gap */
}

/* Custom Scrollbar for Leaderboard */
.leaderboard-list::-webkit-scrollbar {
    width: 6px;
}

.leaderboard-list::-webkit-scrollbar-track {
    background: transparent;
}

.leaderboard-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

.leaderboard-list::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

.leaderboard-item {
    display: grid;
    grid-template-columns: 80px 1fr 70px;
    /* Match header columns */
    column-gap: 15px;
    /* Added explicit gap */
    /* Fixed layout: [Rank/Avatar] [Info] [WPM] */
    align-items: center;
    padding: 1rem 1.5rem;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.04);
    backdrop-filter: blur(10px);
    transition: all 0.2s ease;
    cursor: pointer;

    /* Animation In */
    opacity: 0;
    transform: translateY(10px);
    animation: slideUpFade 0.4s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

@keyframes slideUpFade {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.leaderboard-item:hover {
    transform: translateY(-2px);
    background: rgba(255, 255, 255, 0.07);
    border-color: rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

/* New Layout Sections */
.l-left,
.l-info,
.l-right {
    position: relative;
    z-index: 2;
    /* Ensure text is above shine */
}

.l-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.l-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: center;
}


/* Rank & Avatar */
.l-rank {
    font-size: 1rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.2);
    font-family: 'JetBrains Mono', monospace;
    width: 24px;
    text-align: center;
}

.l-avatar {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: #eee;
    font-size: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

/* Rank Specific Styles (Subtle & Premium) */
/* 1st Place - Gold */
.leaderboard-item.gold {
    background: linear-gradient(90deg, rgba(255, 215, 0, 0.08) 0%, rgba(20, 20, 20, 0.6) 100%);
    border: 1px solid rgba(255, 215, 0, 0.3);
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.05);
}

.leaderboard-item.gold .l-rank {
    color: #ffd700;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
    font-size: 1.2rem;
}

.leaderboard-item.gold .l-avatar {
    background: #ffd700;
    color: #000;
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.4);
    border: none;
}

.leaderboard-item.gold .l-wpm {
    color: #ffd700;
    text-shadow: 0 0 15px rgba(255, 215, 0, 0.4);
}

/* 2nd Place - Silver */
.leaderboard-item.silver {
    background: linear-gradient(90deg, rgba(224, 224, 224, 0.08) 0%, rgba(20, 20, 20, 0.6) 100%);
    border: 1px solid rgba(224, 224, 224, 0.3);
}

.leaderboard-item.silver .l-rank {
    color: #e0e0e0;
    font-size: 1.1rem;
}

.leaderboard-item.silver .l-avatar {
    background: #e0e0e0;
    color: #000;
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.2);
    border: none;
}

/* 3rd Place - Bronze */
.leaderboard-item.bronze {
    background: linear-gradient(90deg, rgba(205, 127, 50, 0.08) 0%, rgba(20, 20, 20, 0.6) 100%);
    border: 1px solid rgba(205, 127, 50, 0.3);
}

.leaderboard-item.bronze .l-rank {
    color: #ffa07a;
    font-size: 1.1rem;
}

.leaderboard-item.bronze .l-avatar {
    background: #cd7f32;
    color: #000;
    box-shadow: 0 0 15px rgba(205, 127, 50, 0.2);
    border: none;
}

/* Info & Stats */
.l-info {
    padding-left: 15px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    overflow: hidden;
    /* Ensure text truncation works */
}

.l-name {
    font-size: 1rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-family: 'Outfit', sans-serif;
}

.l-stats {
    display: flex;
    gap: 8px;
}

.l-stat-pill {
    font-size: 0.7rem;
    background: rgba(255, 255, 255, 0.05);
    padding: 2px 8px;
    border-radius: 4px;
    color: rgba(255, 255, 255, 0.5);
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: 'JetBrains Mono', monospace;
}

/* WPM Display */
.l-wpm {
    font-size: 1.6rem;
    font-weight: 700;
    color: #fff;
    line-height: 1;
    font-family: 'JetBrains Mono', monospace;
}

.l-label {
    font-size: 0.65rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.3);
    letter-spacing: 0.1em;
    margin-top: 4px;
}

/* --- LEADERBOARD HEADER --- */
.leaderboard-header {
    display: grid;
    grid-template-columns: 80px 1fr 70px;
    /* Increased first col to 80px */
    column-gap: 15px;
    padding: 5px 1.5rem 5px;
    /* Reduced vertical padding */
    margin: 5px 20px 0;
    /* Reduced top margin */
    /* Match list padding */
    margin-bottom: 0.2rem;
    /* Reduced gap between header and list */
    font-size: 0.7rem;
    /* Slightly smaller */
    color: rgba(255, 255, 255, 0.3);
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    /* Wider spacing for aesthetics */
    font-family: 'JetBrains Mono', monospace;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    /* Subtle separator */
}

.lh-rank {
    text-align: left;
    /* Aligned left to match #1 icon */
    padding-left: 5px;
    /* Micro-adjustment */
}

.lh-wpm {
    text-align: center;
}

.lh-user {
    padding-left: 15px;
}

/* Header Glows */
.lh-rank {
    color: #ffd700;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.6);
}

.lh-user {
    color: #ffffff;
    /* White Glow */
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.8);
}

.lh-wpm {
    color: #e056fd;
    text-shadow: 0 0 10px rgba(224, 86, 253, 0.6);
    padding-left: 15px;
    /* Nudged right */
}

/* --- RANK APPEARANCE (CLEAN & HIGH CONTRAST) --- */

/* 1st Place - Gold */
.leaderboard-item.gold {
    background: linear-gradient(90deg, rgba(255, 215, 0, 0.15) 0%, rgba(20, 20, 20, 0.6) 100%);
    border: 1px solid rgba(255, 215, 0, 0.6);
    box-shadow: 0 0 25px rgba(255, 215, 0, 0.15);
}

/* 2nd Place - Silver */
.leaderboard-item.silver {
    background: linear-gradient(90deg, rgba(224, 224, 224, 0.15) 0%, rgba(20, 20, 20, 0.6) 100%);
    border: 1px solid rgba(224, 224, 224, 0.6);
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.1);
}

/* 3rd Place - Bronze */
.leaderboard-item.bronze {
    background: linear-gradient(90deg, rgba(205, 127, 50, 0.15) 0%, rgba(20, 20, 20, 0.6) 100%);
    border: 1px solid rgba(205, 127, 50, 0.6);
    box-shadow: 0 0 20px rgba(205, 127, 50, 0.1);
}

.leaderboard-item.gold:hover,
.leaderboard-item.silver:hover,
.leaderboard-item.bronze:hover {
    transform: translateY(-2px);
    background: rgba(255, 255, 255, 0.1);
    z-index: 5;
}

/* Content z-index is 2 (from previous block) */

.leaderboard-item.gold:hover,
.leaderboard-item.silver:hover,
.leaderboard-item.bronze:hover {
    transform: scale(1.02) translateY(-2px);
    z-index: 20;
}


/* --- PROFILE EDIT REDESIGN --- */
.avatar-edit-btn {
    position: absolute;
    bottom: -2px;
    right: -2px;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: rgba(20, 20, 20, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    backdrop-filter: blur(4px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.avatar-edit-btn:hover {
    background: var(--accent-gold);
    color: #000;
    transform: scale(1.1);
}

/* Profile Inputs */
.profile-input {
    background: transparent;
    border: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    font-family: 'JetBrains Mono', monospace;
    padding: 4px 0;
    outline: none;
    transition: all 0.2s;
    text-align: center;
}

.profile-input:focus {
    border-bottom-color: var(--accent-gold);
}

.profile-input.name-input {
    font-size: 1.5rem;
    /* Match h3 size */
    font-weight: 700;
    width: 100%;
    max-width: 250px;
}

.profile-input.bio-input {
    font-size: 0.9rem;
    /* Match p size */
    opacity: 0.8;
    width: 100%;
    max-width: 300px;
}

/* --- SKILL BADGES --- */
.badges-container {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.badge {
    font-size: 0.75rem;
    padding: 4px 10px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
    transition: all 0.3s ease;
    cursor: default;
}

.badge:hover {
    transform: translateY(-2px);
}

/* Tier Styles */
.badge-godlike {
    background: linear-gradient(135deg, rgba(255, 0, 255, 0.1), rgba(128, 0, 128, 0.2));
    border-color: rgba(255, 0, 255, 0.4);
    color: #ff00ff;
    box-shadow: 0 0 10px rgba(255, 0, 255, 0.2);
}

.badge-rocket {
    background: linear-gradient(135deg, rgba(255, 69, 0, 0.1), rgba(255, 140, 0, 0.2));
    border-color: rgba(255, 69, 0, 0.4);
    color: #ff4500;
    box-shadow: 0 0 8px rgba(255, 69, 0, 0.2);
}

.badge-sprinter {
    background: linear-gradient(135deg, rgba(0, 191, 255, 0.1), rgba(30, 144, 255, 0.2));
    border-color: rgba(0, 191, 255, 0.4);
    color: #00bfff;
}

.badge-master {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.1), rgba(218, 165, 32, 0.2));
    border-color: rgba(255, 215, 0, 0.4);
    color: #ffd700;
    box-shadow: 0 0 8px rgba(255, 215, 0, 0.15);
}

.badge-veteran {
    background: linear-gradient(135deg, rgba(192, 192, 192, 0.1), rgba(169, 169, 169, 0.2));
    border-color: rgba(192, 192, 192, 0.4);
    color: #e0e0e0;
}

.badge-regular {
    background: linear-gradient(135deg, rgba(205, 127, 50, 0.1), rgba(160, 82, 45, 0.2));
    border-color: rgba(205, 127, 50, 0.4);
    color: #cd7f32;
}

.badge-cyber {
    background: linear-gradient(135deg, rgba(0, 255, 255, 0.1), rgba(0, 139, 139, 0.2));
    border-color: rgba(0, 255, 255, 0.4);
    color: #00ffff;
    box-shadow: 0 0 8px rgba(0, 255, 255, 0.15);
}

.badge-titan {
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.4), rgba(50, 50, 50, 0.6));
    border-color: rgba(255, 255, 255, 0.6);
    color: #ffffff;
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.2);
}

.badge-elite {
    background: linear-gradient(135deg, rgba(255, 0, 0, 0.1), rgba(139, 0, 0, 0.2));
    border-color: rgba(255, 0, 0, 0.4);
    color: #ff3333;
}

.badge-grinder {
    background: linear-gradient(135deg, rgba(46, 204, 113, 0.1), rgba(39, 174, 96, 0.2));
    border-color: rgba(46, 204, 113, 0.4);
    color: #2ecc71;
}

/* --- HEATMAP --- */
.heatmap-section {
    margin-top: 20px;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.heatmap-title {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.4);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.heatmap-grid {
    display: flex;
    gap: 4px;
}

.heatmap-col {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.heatmap-cell {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.05);
    transition: all 0.2s;
}

.heatmap-cell:hover {
    transform: scale(1.3);
    z-index: 2;
}

/* Heatmap Intensities */
.heatmap-l1 {
    background: rgba(76, 175, 80, 0.3);
}

.heatmap-l2 {
    background: rgba(76, 175, 80, 0.5);
}

.heatmap-l3 {
    background: rgba(76, 175, 80, 0.7);
}

.heatmap-l4 {
    background: rgba(76, 175, 80, 1.0);
    box-shadow: 0 0 5px rgba(76, 175, 80, 0.5);
}

/* --- STAT EXPLOSIONS --- */
.p-stat {
    position: relative;
    /* Anchor for particles */
    overflow: visible;
}

.stat-particle {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 6px;
    height: 6px;
    background: var(--accent-gold);
    border-radius: 50%;
    pointer-events: none;
    transform: translate(-50%, -50%);
    animation: explode 0.8s ease-out forwards;
    z-index: 10;
}

@keyframes explode {
    0% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }

    100% {
        transform: translate(var(--tx), var(--ty)) scale(0);
        opacity: 0;
    }
}

.username-edit {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
    background: rgba(255, 255, 255, 0.05);
    padding: 8px 16px;
    border-radius: 12px;
    width: fit-content;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.username-input {
    background: transparent;
    border: none;
    border-bottom: 2px solid rgba(255, 255, 255, 0.2);
    color: white;
    font-size: 1.25rem;
    font-weight: 700;
    width: 200px;
    padding: 4px 0;
    font-family: inherit;
    transition: all 0.3s ease;
}

.username-input:focus {
    outline: none;
    border-color: var(--accent-gold);
}

.edit-icon {
    font-size: 1.1rem;
    opacity: 0.6;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text-muted);
}

.edit-icon:hover {
    opacity: 1;
    color: var(--accent-gold);
    transform: rotate(15deg);
}

/* Cleanup of malformed code */

.input-group input:focus {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--accent-gold);
    box-shadow: 0 0 0 4px rgba(255, 215, 0, 0.1);
}

.input-group input:focus+.input-icon {
    color: var(--accent-gold);
}

/* Submit Button */
.submit-btn {
    width: 100%;
    padding: 12px;
    margin-top: 10px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--accent-gold), #ffb800);
    color: #111;
    border: none;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
}

.submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(255, 215, 0, 0.25);
}

.auth-footer {
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin: 20px 0 0 0;
}

.auth-footer a {
    color: var(--accent-gold);
    text-decoration: none;
    font-weight: 600;
}

.auth-footer a:hover {
    text-decoration: underline;
}

/* Social Buttons */
.social-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px;
    background: #fff;
    color: #111;
    border: none;
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: 20px;
    position: relative;
    overflow: hidden;
}

.social-btn i {
    font-size: 1.4rem;
    color: #DB4437;
    /* Google Red */
}

.social-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 255, 255, 0.15);
}

.social-btn:active {
    transform: translateY(0);
}

.divider {
    display: flex;
    align-items: center;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.75rem;
    letter-spacing: 0.1em;
    margin: 20px 0;
    width: 100%;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.divider span {
    padding: 0 10px;
    font-weight: 600;
    text-transform: uppercase;
}

/* User Profile Styles */
.profile-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 30px;

    /* 3D Tilt Properties */
    transition: transform 0.1s ease-out;
    /* Fast response for mousemove */
    transform-style: preserve-3d;
    will-change: transform;
    perspective: 1000px;
    /* Add perspective here too just in case */
}

.avatar-large {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-gold), #ffb800);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    font-weight: 700;
    color: #111;
    margin-bottom: 15px;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.3);
}

#user-email-display {
    margin: 0;
    font-size: 1.1rem;
    color: #fff;
}

.member-since {
    margin: 4px 0 0 0;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.profile-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 30px;
}

.p-stat {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 15px 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.p-val {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--accent-gold);
}

.p-label {
    font-size: 0.6rem;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    font-weight: 600;
}

.logout-btn {
    width: 100%;
    padding: 12px;
    border-radius: 12px;
    background: rgba(255, 68, 68, 0.1);
    border: 1px solid rgba(255, 68, 68, 0.2);
    color: #ff4444;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.logout-btn:hover {
    background: rgba(255, 68, 68, 0.2);
    transform: translateY(-2px);
}

/* User Icon in Header/Login Button */
#login-btn.logged-in i {
    color: var(--accent-gold);
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

#login-btn {
    right: 15rem;
    /* Position to the left of Zen button */
}

/* Adjust positions for other buttons to accommodate login button */
#zen-btn {
    right: 11rem;
}

#sound-btn {
    right: 7rem;
}

#settings-btn {
    right: 3rem;
}

/* --- PROGRESS GRAPH --- */
.progress-section {
    margin-top: 2rem;
    margin-bottom: 1.5rem;
    width: 100%;
}

#wpm-chart {
    width: 100%;
    height: 100%;
    display: block;
}

.graph-container {
    width: 100%;
    height: 120px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 0;
    position: relative;
    overflow: hidden;
    /* Cyberpunk grid background */
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
    background-size: 20px 20px;
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.5);
}

/* --- BOTTOM SECTION GRID --- */
.profile-bottom-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    /* Heatmap takes 2/3, Streak takes 1/3 */
    gap: 15px;
    margin-top: 5px;
}

/* Heatmap Section Override */
.heatmap-section {
    margin-top: 0;
    /* Reset margin */
}

.heatmap-title {
    margin-bottom: 5px;
    /* Reduced from default */
}

.heatmap-grid {
    height: 80px;
    /* Further reduced height */
}

/* --- STREAK CARD --- */
.streak-section {
    display: flex;
    align-items: flex-end;
    /* Align bottom if height differs, or center */
    margin-top: 24px;
    /* Align with heatmap content (compensate for missing title) */
    /* actually, heatmap title is ~20px height + 5px margin = 25px.
       If we remove title from streak, we need margin to align top of card with top of heatmap grid?
       No, user said "push streak to top". So maybe align top?
       If I remove margin, it goes to top of container.
       "Activity" title is on left.
       If I set margin-top: 24px it pushes it down to match heatmap grid.
       User said "push to top".
       So I should NOT add margin.
       But if I don't, it will be higher than the heatmap grid.
       Wait, "push to top" means HIGHER up.
       So margin-top: 0 is correct. */
    margin-top: 0;
}

.streak-card {
    height: 80px;
    /* Match heatmap */
    width: 100%;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 69, 0, 0.2);
    /* Orange border */
    border-radius: 12px;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: inset 0 0 20px rgba(255, 69, 0, 0.1);
}

.streak-count {
    font-size: 2.5rem;
    font-weight: 800;
    color: #ff4500;
    text-shadow: 0 0 10px rgba(255, 69, 0, 0.6);
    z-index: 2;
    line-height: 1;
}

.streak-label {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.6);
    letter-spacing: 2px;
    margin-top: 5px;
    z-index: 2;
    font-weight: 600;
}

/* --- ANIMATED FLAME --- */
.streak-fire {
    position: absolute;
    bottom: -10px;
    width: 100%;
    height: 100%;
    opacity: 0.3;
    z-index: 1;
    pointer-events: none;
    filter: blur(5px);
}

.fire-base {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 60px;
    background: radial-gradient(circle, rgba(255, 100, 0, 0.8) 0%, transparent 70%);
    border-radius: 50%;
    animation: fire-pulse 2s infinite ease-in-out;
}

.fire-flame {
    position: absolute;
    bottom: 20px;
    left: 50%;
    width: 20px;
    height: 40px;
    background: linear-gradient(to top, #ff4500, #ffae00);
    border-radius: 50% 50% 0 0;
    transform: translateX(-50%);
    animation: fire-flicker 1.5s infinite ease-out;
}

.fire-flame:nth-child(2) {
    height: 50px;
    animation-delay: 0.2s;
    background: linear-gradient(to top, #ff0000, #ff8800);
    opacity: 0.7;
}

.fire-flame:nth-child(3) {
    height: 30px;
    animation-delay: 0.5s;
    background: linear-gradient(to top, #ffae00, #ffff00);
    opacity: 0.5;
}

@keyframes fire-pulse {

    0%,
    100% {
        transform: translateX(-50%) scale(1);
        opacity: 0.8;
    }

    50% {
        transform: translateX(-50%) scale(1.1);
        opacity: 0.5;
    }
}

@keyframes fire-flicker {
    0% {
        transform: translateX(-50%) scaleY(1);
        opacity: 1;
    }

    50% {
        transform: translateX(-50%) scaleY(1.2) translateY(-10px);
        opacity: 0.8;
    }

    100% {
        transform: translateX(-50%) scaleY(1) translateY(0);
        opacity: 1;
    }
}

/* --- RESULTS OVERLAY --- */
#results-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
    transition: opacity 0.3s ease;
}

#results-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.results-content {
    text-align: center;
    max-width: 500px;
    width: 90%;
    padding: 3rem;
    background: rgba(20, 20, 30, 0.95);
    border: 1px solid rgba(255, 215, 0, 0.1);
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    width: 100%;
    margin-top: 2rem;
}

.stat-item {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.stat-item .label {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-family: var(--font-modern);
    letter-spacing: 0.1em;
}

.stat-item .value {
    font-size: 3.5rem;
    font-weight: 800;
    color: var(--accent-gold);
    line-height: 1;
    text-shadow: 0 0 20px rgba(255, 215, 0, 0.3);
}

/* Rank Title Styles */
#rank-title {
    background: linear-gradient(to right, #fff, var(--accent-gold));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 0 10px rgba(255, 215, 0, 0.5));
    animation: fadeIn 0.8s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Stat Pop Animation */
.stat-pop {
    animation: statPop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes statPop {
    0% {
        transform: scale(0.5);
        opacity: 0;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.footer-link-pill i {
    font-size: 1rem;
}

/* --- APP HEADER (LOGO) --- */
#app-header {
    position: fixed;
    top: 30px;
    left: 40px;
    display: flex;
    align-items: center;
    gap: 15px;
    z-index: 100;
    pointer-events: auto;
    /* Enable clicks */
    opacity: 0.9;
    cursor: pointer;
    transition: opacity 0.2s ease;
}

#app-header:hover {
    opacity: 1;
}

.logo-icon {
    font-size: 2rem;
    color: var(--accent-gold);
    display: flex;
    align-items: center;
    justify-content: center;
    filter: drop-shadow(0 0 10px rgba(255, 215, 0, 0.3));
}

.logo-text {
    display: flex;
    flex-direction: column;
    justify-content: center;
    line-height: 1;
}

.logo-sub {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 500;
    letter-spacing: 0.05em;
    margin-bottom: 2px;
    font-family: 'Outfit', sans-serif;
}

.logo-main {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-main);
    margin: 0;
    font-family: 'JetBrains Mono', monospace;
    letter-spacing: -0.05em;
}

/* --- UPDATED FOOTER --- */
.site-footer {
    position: fixed;
    bottom: 25px;
    left: 25px;
    /* Further left */
    right: 30px;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    z-index: 100;
    pointer-events: none;
}

.footer-info {
    font-size: 0.75rem;
    color: var(--text-muted);
    max-width: 400px;
    line-height: 1.4;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.footer-info .copyright {
    font-weight: 600;
    color: var(--text-main);
}

.footer-info .separator {
    margin: 0 8px;
    opacity: 0.5;
}

.footer-links {
    display: flex;
    gap: 15px;
    pointer-events: auto;
    /* Re-enable clicks for buttons */
}

.footer-link-pill {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: rgba(var(--panel-bg), var(--panel-opacity));
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    color: var(--text-muted);
    font-size: 0.8rem;
    font-family: 'JetBrains Mono', monospace;
    font-weight: 600;
    text-decoration: none;
    border-radius: 12px;
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.footer-link-pill:hover {
    background: rgba(var(--panel-bg), 0.8);
    color: var(--text-main);
    transform: translateY(-2px);
    border-color: rgba(255, 255, 255, 0.15);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.support-btn:hover {
    color: #ff5f5f;
    /* Heart Red */
    border-color: rgba(255, 95, 95, 0.3);
}

.support-btn i {
    color: #ff5f5f;
    font-size: 1rem;
    animation: heartBeat 1.5s infinite;
}

@keyframes heartBeat {

    0%,
    100% {
        transform: scale(1);
    }

    15% {
        transform: scale(1.2);
    }

    30% {
        transform: scale(1);
    }

    45% {
        transform: scale(1.2);
    }
}

.footer-link-pill i {
    font-size: 1rem;
}

/* --- SUPPORT MODAL --- */
.support-content {
    margin-left: 250px;
    width: 500px !important;
    background: linear-gradient(145deg, rgba(13, 13, 18, 0.96), rgba(5, 5, 8, 0.98)) !important;
    border: 1px solid rgba(255, 69, 58, 0.15) !important;
    /* Red/Heart tint border */
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.9), 0 0 0 1px rgba(255, 69, 58, 0.05) !important;
}

.support-message {
    font-size: 0.95rem !important;
    line-height: 1.7 !important;
    color: rgba(255, 255, 255, 0.8) !important;
    font-family: 'Outfit', sans-serif;
    margin-bottom: 24px;
}

.support-message strong {
    display: block;
    font-size: 1.25rem !important;
    margin-bottom: 12px !important;
    color: #fff;
}

.support-message strong span {
    color: #ff453a;
    /* Heart Red */
    filter: drop-shadow(0 0 8px rgba(255, 69, 58, 0.5));
}

.bmc-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    background: linear-gradient(135deg, #FFDD00 0%, #FFC107 100%) !important;
    color: #000 !important;
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 1.1rem;
    padding: 16px;
    border-radius: 14px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 10px 30px -5px rgba(255, 221, 0, 0.4);
    border: none;
    margin-bottom: 24px;
    position: relative;
    overflow: hidden;
}

.bmc-btn::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    transition: 0.5s;
}

.bmc-btn:hover::after {
    left: 100%;
}

.bmc-btn:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 15px 35px -5px rgba(255, 221, 0, 0.5);
}

.bmc-btn i {
    font-size: 1.5rem;
}

.support-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-top: 15px;
}

.support-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 18px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.3);
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
}

.support-option.disabled {
    cursor: default;
    opacity: 0.6;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0.01));
}

.support-option.disabled:hover {
    border-color: rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.04);
}

.support-option i {
    font-size: 1.6rem;
    margin-bottom: 2px;
    opacity: 0.7;
}

.divider {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 20px 0 10px;
    position: relative;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
}

.divider span {
    padding: 0 15px;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.3);
    text-transform: uppercase;
    letter-spacing: 2px;
    font-weight: 600;
}