/* Base Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body, html {
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    background-color: #050508; /* Deep dark background */
    font-family: 'Outfit', sans-serif;
    color: #fff;
    user-select: none;
}

/* Canvas */
#gameCanvas {
    display: block;
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
    background: radial-gradient(circle at center, #0f0f1c 0%, #030308 100%);
}

/* UI Layer */
#uiLayer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    pointer-events: none; /* Let clicks pass through by default */
}

.hidden {
    display: none !important;
}

/* Menus (Start / Game Over) */
.menu-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: linear-gradient(135deg, rgba(10, 10, 20, 0.7) 0%, rgba(5, 5, 10, 0.92) 100%);
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 24px;
    padding: 40px;
    text-align: center;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.8), inset 0 1px 0 rgba(255, 255, 255, 0.05);
    pointer-events: auto;
    min-width: 380px;
    transition: all 0.3s ease;
    overflow: hidden;
}

/* Cinematic Transitions */
.cinematic-fade-out {
    opacity: 0.3 !important;
    filter: blur(8px) !important;
    transition: opacity 3s ease-in-out, filter 3s ease-in-out !important;
}

/* Splash Background */
#splashBackground {
    position: absolute;
    top: 0; left: 0;
    width: 100vw; height: 100vh;
    background-image: url('../assets/splash.png');
    background-size: cover;
    background-position: center;
    z-index: -1;
    transition: opacity 0.8s ease-in-out;
}

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

.powered-by {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    color: rgba(255, 255, 255, 0.7);
    font-family: 'Outfit', sans-serif;
    letter-spacing: 2px;
    z-index: 2;
    text-shadow: 0 2px 10px rgba(0,0,0,0.8);
}

.powered-text {
    font-size: 0.9rem;
    font-weight: 700;
    text-transform: uppercase;
    color: #a855f7;
    text-shadow: 0 0 10px rgba(168, 85, 247, 0.4);
}

.powered-email {
    font-size: 0.8rem;
    color: #aaa;
    letter-spacing: 1px;
}

/* Split Menu Layout for Start Screen */
.menu-container.split-menu {
    width: 800px;
    display: flex;
    flex-direction: row;
    align-items: center;
    padding: 40px;
    gap: 40px;
}

.menu-left {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.menu-right {
    flex: 1;
    border-left: 1px solid rgba(255, 255, 255, 0.1);
    padding-left: 40px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    height: 100%;
}

.menu-container::before {
    content: '';
    position: absolute;
    top: 0; left: -50%;
    width: 200%; height: 100%;
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0.08) 0%, transparent 40%);
    pointer-events: none;
}

.glow-text {
    font-size: 3.2rem;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 0 10px rgba(168, 85, 247, 0.6), 0 0 20px rgba(123, 47, 247, 0.4);
    margin-bottom: 5px;
}

.glow-text-red {
    font-size: 3rem;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 0 10px rgba(255, 50, 50, 0.8), 0 0 20px rgba(255, 50, 50, 0.5);
    margin-bottom: 5px;
}

.subtitle {
    font-size: 1.2rem;
    color: #aaa;
    margin-bottom: 25px;
    letter-spacing: 2px;
    text-transform: uppercase;
}

/* Skin Selector */
#skinSelector {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-bottom: 25px;
}

.skin-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    font-size: 1.2rem;
    cursor: pointer;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    transition: all 0.2s;
    backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    padding-right: 3px; /* visual center for arrows */
}

.skin-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: #7b2ff7;
    box-shadow: 0 0 10px rgba(123, 47, 247, 0.5);
    transform: scale(1.1);
}

.preview-container {
    width: 160px;
    height: 80px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: inset 0 5px 15px rgba(0,0,0,0.5);
    overflow: hidden;
}

#previewCanvas {
    display: block;
    width: 100%;
    height: 100%;
}

input[type="text"] {
    width: 100%;
    padding: 15px;
    margin-bottom: 25px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    color: #fff;
    font-size: 1.1rem;
    font-family: inherit;
    outline: none;
    transition: all 0.3s;
    text-align: center;
    backdrop-filter: blur(10px);
    box-shadow: inset 0 2px 5px rgba(0,0,0,0.2);
}

input[type="text"]:focus {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(123, 47, 247, 0.6);
    box-shadow: 0 0 15px rgba(123, 47, 247, 0.3), inset 0 2px 5px rgba(0,0,0,0.2);
}

.btn-glow {
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, #7b2ff7 0%, #1e6fff 100%);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    color: #fff;
    font-size: 1.2rem;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: all 0.2s ease;
    box-shadow: 0 8px 25px rgba(123, 47, 247, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.2);
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.btn-glow:hover {
    transform: scale(1.03) translateY(-1px);
    box-shadow: 0 12px 35px rgba(123, 47, 247, 0.65), inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.btn-glow:active {
    transform: scale(0.97) translateY(0);
}

/* Game Over Buttons Container */
.gameover-buttons {
    display: flex;
    gap: 12px;
    width: 100%;
    margin-bottom: 5px;
}

.gameover-buttons .btn-glow {
    flex: 1;
}

.btn-home {
    background: linear-gradient(135deg, #2d3748 0%, #1a202c 100%) !important;
    box-shadow: 0 8px 25px rgba(45, 55, 72, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.1) !important;
}

.btn-home:hover {
    box-shadow: 0 12px 35px rgba(45, 55, 72, 0.65), inset 0 1px 0 rgba(255, 255, 255, 0.2) !important;
}

.instructions {
    margin-top: 25px;
    font-size: 0.9rem;
    color: #888;
}

.instructions p {
    margin: 5px 0;
}

/* Hall of Fame */
.hall-of-fame {
    margin-top: 25px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 15px;
    padding: 15px;
    border: 1px solid rgba(255, 215, 0, 0.2);
    box-shadow: inset 0 0 20px rgba(0,0,0,0.5);
    backdrop-filter: blur(5px);
}

.hall-of-fame-start {
    margin-top: 0;
    text-align: left;
    width: 100%;
}

.hall-of-fame-start h3 {
    color: #00ffcc;
    margin-bottom: 8px;
    font-size: 1.2rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    text-align: center;
    text-shadow: 0 0 10px rgba(0, 255, 204, 0.5);
}

.hall-of-fame-start ul {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: none; /* Let it show all 10 items naturally */
    overflow-y: visible;
}

/* Premium Hall of Fame Items */
.hof-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 10px;
    margin-bottom: 3px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: transform 0.2s, background 0.2s;
    font-size: 0.85rem;
}
.hof-item:hover {
    transform: translateX(5px);
    background: rgba(255, 255, 255, 0.08);
}
.hof-rank {
    font-weight: bold;
    color: #666;
    width: 25px;
    text-align: center;
    font-size: 0.9rem;
}
.hof-name {
    flex: 1;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 0 15px;
    color: #ddd;
}
.hof-score {
    color: #00ffcc;
    font-weight: bold;
    font-family: monospace;
    font-size: 0.95rem;
    text-shadow: 0 0 5px rgba(0, 255, 204, 0.4);
}

/* Podium Styling */
.hof-item.rank-1 {
    background: linear-gradient(90deg, rgba(255, 215, 0, 0.15) 0%, rgba(255, 215, 0, 0.02) 100%);
    border-color: rgba(255, 215, 0, 0.4);
    transform: scale(1.03);
    margin-bottom: 4px;
    box-shadow: 0 4px 10px rgba(255, 215, 0, 0.1);
}
.hof-item.rank-1:hover { transform: scale(1.05) translateX(5px); }
.hof-item.rank-1 .hof-name { color: #FFD700; font-weight: bold; text-shadow: 0 0 5px rgba(255, 215, 0, 0.3); }
.hof-item.rank-1 .hof-score { color: #FFD700; text-shadow: 0 0 10px rgba(255, 215, 0, 0.6); }

.hof-item.rank-2 {
    background: linear-gradient(90deg, rgba(192, 192, 192, 0.15) 0%, rgba(192, 192, 192, 0.02) 100%);
    border-color: rgba(192, 192, 192, 0.4);
    transform: scale(1.01);
    margin-bottom: 4px;
}
.hof-item.rank-2:hover { transform: scale(1.02) translateX(5px); }
.hof-item.rank-2 .hof-name { color: #e0e0e0; font-weight: bold; }
.hof-item.rank-2 .hof-score { color: #e0e0e0; text-shadow: 0 0 8px rgba(192, 192, 192, 0.5); }

.hof-item.rank-3 {
    background: linear-gradient(90deg, rgba(205, 127, 50, 0.15) 0%, rgba(205, 127, 50, 0.02) 100%);
    border-color: rgba(205, 127, 50, 0.4);
    transform: scale(1.00);
    margin-bottom: 6px;
}
.hof-item.rank-3:hover { transform: scale(1.01) translateX(5px); }
.hof-item.rank-3 .hof-name { color: #CD7F32; font-weight: bold; }
.hof-item.rank-3 .hof-score { color: #CD7F32; text-shadow: 0 0 8px rgba(205, 127, 50, 0.5); }

.hall-of-fame h3 {
    color: #ffd700;
    font-size: 1.1rem;
    margin-bottom: 10px;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.hof-list {
    list-style: none;
    font-size: 0.85rem;
    max-height: none; /* Removed fixed height to prevent inner scrolling */
    overflow-y: visible;
    text-align: left;
}

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

.hof-list::-webkit-scrollbar-thumb {
    background: rgba(255, 215, 0, 0.5);
    border-radius: 3px;
}

.hall-of-fame ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

/* In-game HUD Hall of Fame Items */
.hof-hud-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 4px;
    font-size: 0.9rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 3px;
}
.hof-hud-item .hof-rank { width: 25px; text-align: left; }
.hof-hud-item .hof-name { flex: 1; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hof-hud-item .hof-score { font-family: monospace; }
.hof-hud-item.rank-1 { color: #FFD700; text-shadow: 0 0 5px rgba(255, 215, 0, 0.5); }
.hof-hud-item.rank-2 { color: #C0C0C0; text-shadow: 0 0 5px rgba(192, 192, 192, 0.5); }
.hof-hud-item.rank-3 { color: #CD7F32; text-shadow: 0 0 5px rgba(205, 127, 50, 0.5); }

/* Minimap */li:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.hof-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 150px;
}

.hof-score {
    font-weight: bold;
    color: #fff;
}

/* HUD Elements */
#hud {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

#scoreBoard {
    position: absolute;
    bottom: 25px;
    left: 25px;
    background: linear-gradient(135deg, rgba(20, 20, 30, 0.6), rgba(10, 10, 15, 0.8));
    backdrop-filter: blur(15px);
    padding: 15px 25px;
    border-radius: 15px;
    font-size: 1.3rem;
    font-weight: 500;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

#currentScore {
    font-weight: 700;
    color: #00ffcc;
    text-shadow: 0 0 10px rgba(0, 255, 204, 0.5);
}

#leaderboard {
    position: absolute;
    top: 25px;
    right: 25px;
    width: 220px;
    background: linear-gradient(135deg, rgba(20, 20, 30, 0.6), rgba(10, 10, 15, 0.8));
    backdrop-filter: blur(15px);
    border-radius: 15px;
    padding: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

#leaderboard h3 {
    text-align: center;
    font-size: 1rem;
    color: #ccc;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

#leaderboardList {
    list-style: none;
    font-size: 0.95rem;
}

#leaderboardList li {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
    padding-bottom: 5px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

#leaderboardList li:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.leaderboard-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 120px;
}

.leaderboard-score {
    font-weight: bold;
}

.is-player {
    color: #00ffcc;
    font-weight: bold;
}

.is-remote-player {
    color: #ffaa00; /* Rich orange-gold for premium live player look */
    font-weight: bold;
    animation: gold-pulse 2s infinite ease-in-out;
}

@keyframes gold-pulse {
    0%, 100% {
        text-shadow: 0 0 4px rgba(255, 170, 0, 0.4);
        color: #ffaa00;
    }
    50% {
        text-shadow: 0 0 10px rgba(255, 170, 0, 0.8), 0 0 15px rgba(255, 170, 0, 0.4);
        color: #ffcc00; /* Swell color slightly */
    }
}

#minimapContainer {
    position: absolute;
    bottom: 25px;
    right: 25px;
    width: 160px;
    height: 160px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.15);
    background: linear-gradient(135deg, rgba(20, 20, 30, 0.6), rgba(10, 10, 15, 0.8));
    backdrop-filter: blur(15px);
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0,0,0,0.6), inset 0 0 20px rgba(255,255,255,0.05);
}

#minimapCanvas {
    width: 100%;
    height: 100%;
    display: block;
}

/* Virtual Joystick */
#joystickZone {
    position: absolute;
    top: 0; left: 0;
    width: 100vw; height: 100vh;
    pointer-events: none; /* Touches handled globally, this is just visual container */
    z-index: 5;
    overflow: hidden;
}

#joystickBase {
    position: absolute;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(0, 255, 204, 0.3);
    box-shadow: inset 0 0 20px rgba(0, 255, 204, 0.1);
    transform: translate(-50%, -50%);
    opacity: 0;
    transition: opacity 0.3s ease-out;
    pointer-events: none;
}

#joystickBase.active {
    opacity: 1;
    transition: opacity 0.1s ease-in;
}

#joystickBase.joystick-death-fade {
    opacity: 0 !important;
    transition: opacity 1s ease-out !important;
}

#joystickStick {
    position: absolute;
    top: 50%; left: 50%;
    width: 50px; height: 50px;
    border-radius: 50%;
    background: radial-gradient(circle at center, rgba(0, 255, 204, 0.8), rgba(0, 150, 150, 0.8));
    transform: translate(-50%, -50%);
    box-shadow: 0 0 15px rgba(0, 255, 204, 0.5);
    pointer-events: none;
}

/* Control Selector (Desktop) */
.control-selector-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    margin-bottom: 25px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    padding: 10px 15px;
    border-radius: 12px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: inset 0 0 10px rgba(255, 255, 255, 0.02);
}

.control-label {
    font-size: 0.95rem;
    font-weight: 500;
    color: #aaa;
    letter-spacing: 0.5px;
}

.control-options {
    display: flex;
    gap: 8px;
}

.control-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #ccc;
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s ease;
    outline: none;
}

.control-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    border-color: rgba(123, 47, 247, 0.4);
    transform: translateY(-1px);
}

.control-btn.active {
    background: linear-gradient(135deg, #7b2ff7, #1e6fff);
    color: #fff;
    font-weight: 700;
    border: 1px solid rgba(123, 47, 247, 0.4);
    box-shadow: 0 4px 15px rgba(123, 47, 247, 0.35);
    transform: translateY(0);
}

.control-btn.active:hover {
    color: #fff;
    border-color: rgba(123, 47, 247, 0.6);
    transform: none;
}

/* Mobile Responsiveness */
@media (max-width: 900px), (max-height: 600px) {
    .control-selector-container {
        display: none !important;
    }

    .menu-container.split-menu {
        flex-direction: column;
        width: 90%;
        max-width: 450px;
        padding: 25px;
        gap: 15px;
        height: auto;
        max-height: 75vh;
        overflow-y: auto;
    }
    
    .instructions {
        display: none;
    }
    
    .menu-right {
        border-left: none;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
        padding-left: 0;
        padding-top: 20px;
        width: 100%;
        height: auto;
    }
    
    .glow-text {
        font-size: 2.2rem;
    }
    
    .subtitle {
        font-size: 1rem;
        margin-bottom: 15px;
    }

    #skinSelector {
        margin-bottom: 15px;
    }
    
    .preview-container {
        width: 140px;
        height: 70px;
    }

    input[type="text"] {
        padding: 10px;
        margin-bottom: 15px;
    }
    
    .btn-glow {
        padding: 10px;
        font-size: 1.1rem;
    }
    
    #minimapContainer {
        width: 100px;
        height: 100px;
        bottom: 15px;
        right: 15px;
    }
    
    #scoreBoard {
        bottom: 15px;
        left: 15px;
        padding: 10px 15px;
        font-size: 1.1rem;
    }
    
    #leaderboard {
        top: 15px;
        right: 15px;
        width: 160px;
        padding: 10px;
        opacity: 0.4; /* 60% transparent */
    }
    
    .hof-hud-item {
        font-size: 0.8rem;
    }
    .hof-hud-item .hof-rank { width: 20px; }
    
    .hall-of-fame-start h3 {
        font-size: 1.2rem;
        margin-bottom: 10px;
    }
    .hof-item {
        padding: 3px 6px;
        margin-bottom: 3px;
        font-size: 0.8rem;
    }
    .hof-score {
        font-size: 0.85rem;
    }
}

/* Premium Settings Menu Styles */
.settings-gear-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    width: 44px;
    height: 44px;
    font-size: 1.4rem;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: transform 0.6s cubic-bezier(0.2, 0.8, 0.2, 1), background-color 0.2s, box-shadow 0.2s;
    outline: none;
    z-index: 100;
}

.settings-gear-btn:hover {
    transform: rotate(180deg) scale(1.1);
    background: rgba(255, 255, 255, 0.12);
    border-color: #a855f7;
    box-shadow: 0 0 15px rgba(168, 85, 247, 0.5);
}

.start-menu-settings-btn {
    position: absolute;
    top: 20px;
    right: 20px;
}

.in-game-settings-btn {
    position: absolute;
    top: 25px;
    left: 25px;
    pointer-events: auto;
}

/* Cinematic Canvas Blur & Darken Transition */
#gameCanvas {
    transition: filter 0.5s cubic-bezier(0.25, 0.8, 0.25, 1);
}

#gameCanvas.blurred {
    filter: blur(12px) brightness(0.4) saturate(0.8);
}

/* Premium Zoom & Fade Animations for Settings Modal */
#settingsModal {
    opacity: 0;
    visibility: hidden;
    transform: translate(-50%, -45%) scale(0.95);
    transition: opacity 0.4s cubic-bezier(0.25, 0.8, 0.25, 1), 
                visibility 0.4s cubic-bezier(0.25, 0.8, 0.25, 1), 
                transform 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
}

#settingsModal.active {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%) scale(1.0);
}

.settings-title {
    font-size: 2rem;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 0 10px rgba(168, 85, 247, 0.6), 0 0 20px rgba(123, 47, 247, 0.4);
    margin-bottom: 25px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
}

.settings-content {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 30px;
    text-align: left;
    width: 100%;
}

.settings-group {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    padding: 15px 20px;
    transition: border-color 0.2s, background-color 0.2s;
}

.settings-group:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(168, 85, 247, 0.3);
}

.settings-group-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.settings-icon {
    font-size: 1.2rem;
    margin-right: 10px;
}

.settings-label {
    flex: 1;
    font-weight: 500;
    font-size: 1.1rem;
    color: #ddd;
}

/* Premium Switches */
.switch {
    position: relative;
    display: inline-block;
    width: 46px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider-round {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: rgba(255, 255, 255, 0.1);
    transition: .3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 24px;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.slider-round:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background-color: #fff;
    transition: .3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

input:checked + .slider-round {
    background: linear-gradient(135deg, #7b2ff7 0%, #1e6fff 100%);
    border-color: rgba(123, 47, 247, 0.5);
}

input:checked + .slider-round:before {
    transform: translateX(22px);
}

/* Range Slider */
.slider-container {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 8px;
}

.vol-icon {
    font-size: 0.95rem;
    color: #888;
}

.slider-range {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.1);
    outline: none;
    transition: background 0.2s;
}

.slider-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #7b2ff7;
    cursor: pointer;
    border: 2px solid #fff;
    box-shadow: 0 0 10px rgba(123, 47, 247, 0.8);
    transition: transform 0.1s;
}

.slider-range::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.vfx-status-text {
    display: block;
    font-size: 0.85rem;
    color: #888;
    margin-top: 5px;
    line-height: 1.3;
}

/* ===== Clickable Header Styles ===== */
.clickable-header {
    cursor: pointer;
    transition: color 0.2s ease, text-shadow 0.2s ease, transform 0.2s ease;
    pointer-events: auto;
    position: relative;
}

.clickable-header:hover {
    color: #00ffcc !important;
    text-shadow: 0 0 15px rgba(0, 255, 204, 0.7), 0 0 30px rgba(0, 255, 204, 0.3) !important;
    transform: scale(1.05);
}

.clickable-header::after {
    content: '▸';
    position: absolute;
    right: -18px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.8em;
    opacity: 0;
    transition: opacity 0.2s ease, right 0.2s ease;
    color: #00ffcc;
}

.clickable-header:hover::after {
    opacity: 1;
    right: -22px;
}

/* ===== Global Leaderboard Popup Overlay ===== */
.popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 200;
    display: flex;
    justify-content: center;
    align-items: center;
    pointer-events: auto;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.35s cubic-bezier(0.25, 0.8, 0.25, 1),
                visibility 0.35s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.popup-overlay.active {
    opacity: 1;
    visibility: visible;
}

.popup-overlay.hidden {
    display: none !important;
}

.popup-container {
    background: linear-gradient(135deg, rgba(12, 12, 25, 0.92) 0%, rgba(6, 6, 14, 0.96) 100%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    padding: 0;
    width: 420px;
    max-width: 92vw;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.8),
                0 0 40px rgba(123, 47, 247, 0.15),
                inset 0 1px 0 rgba(255, 255, 255, 0.05);
    transform: scale(0.92) translateY(20px);
    transition: transform 0.35s cubic-bezier(0.25, 0.8, 0.25, 1);
    overflow: hidden;
}

.popup-overlay.active .popup-container {
    transform: scale(1) translateY(0);
}

.popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 28px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    flex-shrink: 0;
}

.popup-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 0 10px rgba(168, 85, 247, 0.6), 0 0 20px rgba(123, 47, 247, 0.3);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 0;
}

.popup-close-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    width: 36px;
    height: 36px;
    font-size: 1rem;
    color: #888;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.2s ease;
    outline: none;
    flex-shrink: 0;
}

.popup-close-btn:hover {
    background: rgba(255, 50, 50, 0.2);
    border-color: rgba(255, 50, 50, 0.5);
    color: #ff5050;
    transform: scale(1.1);
    box-shadow: 0 0 15px rgba(255, 50, 50, 0.3);
}

.popup-body {
    padding: 12px 28px 24px;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

/* Custom Scrollbar for Popup */
.popup-body::-webkit-scrollbar {
    width: 6px;
}

.popup-body::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.02);
    border-radius: 3px;
}

.popup-body::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, rgba(123, 47, 247, 0.6) 0%, rgba(30, 111, 255, 0.6) 100%);
    border-radius: 3px;
    transition: background 0.2s;
}

.popup-body::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, rgba(123, 47, 247, 0.9) 0%, rgba(30, 111, 255, 0.9) 100%);
}

/* Popup List Items */
.popup-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.popup-list .hof-item {
    margin-bottom: 4px;
    padding: 8px 12px;
    font-size: 0.9rem;
    border-radius: 10px;
    transition: transform 0.15s ease, background 0.15s ease;
}

.popup-list .hof-item:hover {
    transform: translateX(4px);
    background: rgba(255, 255, 255, 0.06);
}

.popup-list .hof-item.is-you {
    background: linear-gradient(90deg, rgba(0, 255, 204, 0.12) 0%, rgba(0, 255, 204, 0.02) 100%);
    border-color: rgba(0, 255, 204, 0.35);
}

.popup-list .hof-item.is-you .hof-name {
    color: #00ffcc;
    font-weight: bold;
}

.popup-list .hof-item.is-live-remote {
    border-color: rgba(255, 170, 0, 0.25);
}

.popup-list .hof-item.is-live-remote .hof-name {
    color: #ffaa00;
}

/* Mobile Popup */
@media (max-width: 900px), (max-height: 600px) {
    .popup-container {
        width: 95vw;
        max-height: 85vh;
        border-radius: 18px;
    }

    .popup-header {
        padding: 18px 20px 12px;
    }

    .popup-header h2 {
        font-size: 1.2rem;
    }

    .popup-body {
        padding: 8px 20px 18px;
    }

    .popup-list .hof-item {
        padding: 6px 8px;
        font-size: 0.82rem;
    }
    
    .clickable-header::after {
        display: none;
    }
}

/* ================================================
   ARENA DIAGNOSTICS DASHBOARD
   ================================================ */

#gameDashboard {
    position: fixed;
    top: 0;
    right: 0;
    width: 320px;
    height: 100vh;
    z-index: 50;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    padding: 20px 16px 30px;
    gap: 14px;
    pointer-events: auto;

    background: linear-gradient(160deg,
        rgba(8, 8, 20, 0.94) 0%,
        rgba(4, 4, 14, 0.97) 100%);
    backdrop-filter: blur(28px);
    -webkit-backdrop-filter: blur(28px);
    border-left: 1px solid rgba(0, 255, 204, 0.12);
    box-shadow: -8px 0 40px rgba(0,0,0,0.8),
                inset 1px 0 0 rgba(255,255,255,0.04);

    animation: dashSlideIn 0.35s cubic-bezier(0.22, 1, 0.36, 1) forwards;

    scrollbar-width: thin;
    scrollbar-color: rgba(0, 255, 204, 0.2) transparent;
}

#gameDashboard::-webkit-scrollbar { width: 4px; }
#gameDashboard::-webkit-scrollbar-thumb {
    background: rgba(0, 255, 204, 0.25);
    border-radius: 2px;
}

#gameDashboard.hidden { display: none !important; }

@keyframes dashSlideIn {
    from { transform: translateX(100%); opacity: 0; }
    to   { transform: translateX(0);    opacity: 1; }
}

.dash-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-bottom: 14px;
    border-bottom: 1px solid rgba(0, 255, 204, 0.15);
    flex-shrink: 0;
}

.dash-header-icon {
    font-size: 1.3rem;
    filter: drop-shadow(0 0 8px rgba(0, 255, 204, 0.8));
}

.dash-header-title {
    flex: 1;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 2.5px;
    text-transform: uppercase;
    color: #00ffcc;
    text-shadow: 0 0 10px rgba(0, 255, 204, 0.5);
}

.dash-close-btn {
    background: none;
    border: 1px solid rgba(255,255,255,0.12);
    color: #888;
    font-size: 0.85rem;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    font-family: inherit;
}
.dash-close-btn:hover {
    border-color: rgba(255, 80, 80, 0.6);
    color: #ff5050;
    background: rgba(255, 80, 80, 0.1);
}

.dash-section {
    background: rgba(255, 255, 255, 0.025);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 14px;
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.dash-section-label {
    font-size: 0.62rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.35);
    margin-bottom: 4px;
    font-weight: 600;
}

.dash-section-sublabel {
    font-size: 0.58rem;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.25);
    margin-top: 6px;
    margin-bottom: 2px;
}

.dash-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 22px;
}

.dash-row-total {
    border-top: 1px solid rgba(255,255,255,0.08);
    padding-top: 7px;
    margin-top: 2px;
}

.dash-key {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.5);
    font-weight: 400;
}

.dash-val {
    font-family: 'Courier New', monospace;
    font-size: 0.82rem;
    font-weight: 700;
    color: #e0e0e0;
    letter-spacing: 0.5px;
}

.dash-val-cyan  { color: #00ffcc; text-shadow: 0 0 8px rgba(0, 255, 204, 0.4); }
.dash-val-gold  { color: #ffd700; text-shadow: 0 0 8px rgba(255, 215, 0, 0.4); }
.dash-val-green { color: #4ade80; text-shadow: 0 0 8px rgba(74, 222, 128, 0.4); }
.dash-val-red   { color: #ff5555; text-shadow: 0 0 8px rgba(255, 85, 85, 0.35); }

.dash-val-rainbow {
    background: linear-gradient(90deg, #ff00cc, #00ffcc, #ffcc00);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.dash-ai-tiers {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.dash-ai-tier {
    display: grid;
    grid-template-columns: 48px 30px 1fr;
    align-items: center;
    gap: 8px;
}

.tier-label {
    font-size: 0.7rem;
    font-weight: 600;
    color: rgba(255,255,255,0.45);
    letter-spacing: 0.5px;
}

.tier-val {
    font-family: 'Courier New', monospace;
    font-size: 0.72rem;
    font-weight: 700;
    text-align: right;
    color: #ccc;
}

.tier-bar {
    height: 5px;
    background: rgba(255,255,255,0.07);
    border-radius: 3px;
    overflow: hidden;
}

.tier-fill {
    height: 100%;
    border-radius: 3px;
    width: 0%;
    transition: width 0.6s ease;
}

.fill-low  { background: linear-gradient(90deg, #4ade80, #22c55e); box-shadow: 0 0 6px rgba(74,222,128,0.5); }
.fill-mid  { background: linear-gradient(90deg, #38bdf8, #6366f1); box-shadow: 0 0 6px rgba(56,189,248,0.5); }
.fill-high { background: linear-gradient(90deg, #f97316, #ef4444); box-shadow: 0 0 6px rgba(239,68,68,0.5); }

@media (max-width: 900px), (max-height: 600px) {
    #gameDashboard { display: none !important; }
}
