/* ========================================
   SNAKE ARCADE - Main Stylesheet
   AAA-Quality Cyber Aesthetic
   ======================================== */

/* CSS Variables */
:root {
    /* Colors */
    --primary-cyan: #00f0ff;
    --primary-magenta: #ff00ff;
    --primary-green: #00ff88;
    --primary-orange: #ff6600;
    --primary-yellow: #ffff00;

    --bg-dark: #0a0a0f;
    --bg-darker: #050508;
    --glass-bg: rgba(8, 12, 20, 0.85);
    /* Slightly darker for better UI contrast */
    --glass-border: rgba(0, 240, 255, 0.3);

    /* Typography */
    --font-display: 'Orbitron', sans-serif;
    --font-body: 'Rajdhani', sans-serif;

    /* Effects */
    --glow-cyan: 0 0 20px rgba(0, 240, 255, 0.5), 0 0 40px rgba(0, 240, 255, 0.3);
    --glow-magenta: 0 0 20px rgba(255, 0, 255, 0.5), 0 0 40px rgba(255, 0, 255, 0.3);
    --glow-green: 0 0 20px rgba(0, 255, 136, 0.5), 0 0 40px rgba(0, 255, 136, 0.3);
}

/* Reset */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html,
body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: transparent !important;
    /* Force transparency */
    font-family: var(--font-body);
    color: #fff;
}

#game-background {
    position: fixed;
    inset: 0;
    background: linear-gradient(rgba(0, 0, 0, 0.4), rgba(0, 0, 0, 0.4)), url('background.jpg');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    z-index: -10;
}

.hidden {
    display: none !important;
}

#game-container {
    position: fixed;
    inset: 0;
    z-index: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    background: transparent !important;
}

#game-container canvas {
    background: transparent !important;
    display: block;
    /* Removed shadow as requested */
}

#loading-screen {
    position: fixed;
    inset: 0;
    background: var(--bg-darker);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.snake-loader {
    display: flex;
    gap: 8px;
    margin-bottom: 30px;
}

.snake-segment {
    width: 20px;
    height: 20px;
    background: linear-gradient(135deg, #4285F4, #2196F3);
    border-radius: 50%;
    animation: snake-bounce 1.2s ease-in-out infinite;
    box-shadow: 0 0 15px rgba(66, 133, 244, 0.6);
}

.snake-segment:nth-child(1) {
    animation-delay: 0s;
}

.snake-segment:nth-child(2) {
    animation-delay: 0.1s;
}

.snake-segment:nth-child(3) {
    animation-delay: 0.2s;
}

.snake-segment:nth-child(4) {
    animation-delay: 0.3s;
}

.snake-segment:nth-child(5) {
    animation-delay: 0.4s;
}

@keyframes snake-bounce {

    0%,
    100% {
        transform: translateY(0) scale(1);
        background: linear-gradient(135deg, #4285F4, #2196F3);
    }

    50% {
        transform: translateY(-25px) scale(1.2);
        background: linear-gradient(135deg, #00f0ff, #00ff88);
    }
}

.loader-text {
    font-family: var(--font-display);
    font-size: 1rem;
    color: var(--primary-cyan);
    letter-spacing: 5px;
    animation: pulse 1s ease-in-out infinite;
    margin-bottom: 20px;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 0.5;
    }

    50% {
        opacity: 1;
    }
}

.loading-progress {
    width: 200px;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--primary-cyan), var(--primary-magenta));
    border-radius: 2px;
    animation: loading-progress 2s ease-out forwards;
}

@keyframes loading-progress {
    to {
        width: 100%;
    }
}

/* ========================================
   AUTH SCREEN
   ======================================== */
#auth-screen {
    position: fixed;
    inset: 0;
    background: transparent !important;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.auth-container {
    text-align: center;
    padding: 40px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    backdrop-filter: blur(20px);
    max-width: 380px;
    width: 90%;
}

.auth-title {
    font-family: var(--font-display);
    font-size: 2rem;
    color: var(--primary-cyan);
    margin-bottom: 30px;
    letter-spacing: 3px;
    text-shadow: var(--glow-cyan);
}

.form-title {
    font-family: var(--font-display);
    font-size: 1.2rem;
    color: #fff;
    margin-bottom: 25px;
    letter-spacing: 2px;
}

.input-group {
    margin-bottom: 20px;
    text-align: left;
}

.input-group label {
    display: block;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 8px;
    letter-spacing: 1px;
}

.input-group input {
    width: 100%;
    padding: 14px 16px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    color: #fff;
    font-family: var(--font-body);
    font-size: 1rem;
    outline: none;
    transition: all 0.3s ease;
}

.input-group input:focus {
    border-color: var(--primary-cyan);
    box-shadow: 0 0 15px rgba(0, 240, 255, 0.2);
}

.checkbox-group {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 25px;
}

.checkbox-group input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary-cyan);
}

.checkbox-group label {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.8);
}

.auth-btn {
    width: 100%;
    padding: 14px 24px;
    background: linear-gradient(135deg, var(--primary-cyan), #0088aa);
    border: none;
    border-radius: 10px;
    color: #000;
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    letter-spacing: 2px;
}

.auth-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--glow-cyan);
}

.auth-error {
    color: #ff4444;
    font-size: 0.85rem;
    margin-top: 15px;
}

.auth-switch {
    margin-top: 25px;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.6);
}

.auth-switch a {
    color: var(--primary-cyan);
    text-decoration: none;
}

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

/* ========================================
   LEADERBOARD MODAL
   ======================================== */
.leaderboard-modal {
    max-width: 400px;
}

.leaderboard-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
}

.tab-btn {
    flex: 1;
    padding: 10px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.7);
    font-family: var(--font-display);
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.3s ease;
    letter-spacing: 1px;
}

.tab-btn:hover {
    background: rgba(255, 255, 255, 0.15);
}

.tab-btn.active {
    background: var(--primary-cyan);
    color: #000;
    border-color: var(--primary-cyan);
}

.leaderboard-content {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 20px;
    min-height: 200px;
}

.leaderboard-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.leaderboard-item {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    gap: 15px;
}

.rank {
    font-family: var(--font-display);
    font-size: 1.2rem;
    font-weight: 700;
    width: 30px;
    text-align: center;
}

.rank-1 {
    color: #FFD700;
}

.rank-2 {
    color: #C0C0C0;
}

.rank-3 {
    color: #CD7F32;
}

.player-name {
    flex: 1;
    font-size: 1rem;
    color: #fff;
}

.player-score {
    font-family: var(--font-display);
    font-size: 1rem;
    color: var(--primary-cyan);
}

.loading-text {
    text-align: center;
    color: rgba(255, 255, 255, 0.5);
    padding: 50px 0;
}

.no-scores {
    text-align: center;
    color: rgba(255, 255, 255, 0.4);
    padding: 50px 0;
    font-style: italic;
}

/* ========================================
   MAIN MENU
   ======================================== */
#main-menu {
    position: fixed;
    inset: 0;
    background: transparent !important;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.menu-container {
    text-align: center;
    padding: 60px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 30px;
    backdrop-filter: blur(20px);
    box-shadow:
        0 25px 50px rgba(0, 0, 0, 0.5),
        inset 0 0 100px rgba(0, 240, 255, 0.03);
}

.game-title {
    font-family: var(--font-display);
    font-size: 4rem;
    font-weight: 900;
    margin-bottom: 10px;
    line-height: 1;
}

.title-snake {
    display: block;
    background: linear-gradient(135deg, var(--primary-cyan), var(--primary-green));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: var(--glow-cyan);
    filter: drop-shadow(0 0 30px rgba(0, 240, 255, 0.5));
}

.title-arcade {
    display: block;
    font-size: 2.5rem;
    background: linear-gradient(135deg, var(--primary-magenta), var(--primary-orange));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    font-family: var(--font-display);
    font-size: 0.9rem;
    letter-spacing: 8px;
    color: var(--primary-cyan);
    opacity: 0.8;
    margin-bottom: 50px;
}

.menu-options {
    display: flex;
    flex-direction: column;
    gap: 25px;
    align-items: center;
}

.ai-selector {
    width: 100%;
}

.ai-selector label {
    display: block;
    font-family: var(--font-display);
    font-size: 0.75rem;
    letter-spacing: 3px;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 15px;
}

.difficulty-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.diff-btn {
    padding: 12px 20px;
    font-family: var(--font-display);
    font-size: 0.75rem;
    letter-spacing: 2px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    transition: all 0.3s ease;
}

.diff-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.diff-btn.active {
    background: linear-gradient(135deg, rgba(0, 240, 255, 0.2), rgba(0, 255, 136, 0.2));
    border-color: var(--primary-cyan);
    color: var(--primary-cyan);
    box-shadow: var(--glow-cyan);
}

.diff-btn[data-level="hard"].active {
    background: linear-gradient(135deg, rgba(255, 0, 255, 0.2), rgba(255, 102, 0, 0.2));
    border-color: var(--primary-magenta);
    color: var(--primary-magenta);
    box-shadow: var(--glow-magenta);
}

/* Menu Secondary Buttons - Minimalistic */
.menu-secondary-buttons {
    display: flex;
    gap: 30px;
    margin-top: 25px;
    justify-content: center;
}

.menu-secondary-buttons .neon-btn {
    padding: 10px 20px;
    font-size: 0.75rem;
    letter-spacing: 2px;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.6);
    border-radius: 6px;
}

.menu-secondary-buttons .neon-btn:hover {
    border-color: var(--primary-cyan);
    color: var(--primary-cyan);
    background: rgba(0, 240, 255, 0.05);
    box-shadow: none;
}

/* Neon Buttons */
.neon-btn {
    position: relative;
    padding: 18px 50px;
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 3px;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    overflow: hidden;
    transition: all 0.3s ease;
}

.neon-btn.primary {
    background: linear-gradient(135deg, var(--primary-cyan), var(--primary-green));
    color: #000;
    /* Force black text for contrast on bright button */
    box-shadow: var(--glow-cyan);
}

.neon-btn.primary:hover {
    transform: translateY(-3px);
    box-shadow:
        0 0 30px rgba(0, 240, 255, 0.6),
        0 0 60px rgba(0, 240, 255, 0.4),
        0 10px 30px rgba(0, 0, 0, 0.3);
}

.neon-btn.secondary {
    background: transparent;
    border: 2px solid var(--primary-magenta);
    color: var(--primary-magenta);
}

.neon-btn.secondary:hover {
    background: rgba(255, 0, 255, 0.1);
    box-shadow: var(--glow-magenta);
}

.btn-glow {
    position: absolute;
    inset: -50%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.3) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.3s;
}

.neon-btn:hover .btn-glow {
    opacity: 1;
    animation: btn-glow-move 1s ease infinite;
}

@keyframes btn-glow-move {

    0%,
    100% {
        transform: translate(-20%, -20%);
    }

    50% {
        transform: translate(20%, 20%);
    }
}

.menu-footer {
    margin-top: 50px;
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.3);
    letter-spacing: 2px;
}

/* ========================================
   GAME HUD
   ======================================== */
#game-hud {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 50;
    padding: 20px;
}

#game-hud>* {
    pointer-events: auto;
}

/* ========================================
   TOP STATS BAR - BIG & PROMINENT
   ======================================== */
.hud-stats-bar {
    display: flex;
    justify-content: center;
    align-items: stretch;
    gap: 15px;
    flex-wrap: wrap;
    max-width: 900px;
    margin: 80px auto 0;
    /* Properly placed near game board for livestream */
    padding: 10px;
}

.stat-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 140px;
    padding: 15px 25px;
    background: rgba(10, 15, 25, 0.7);
    /* More transparent for forest */
    border: 2px solid rgba(0, 240, 255, 0.3);
    border-radius: 16px;
    backdrop-filter: blur(15px);
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.1),
        0 0 20px rgba(0, 200, 255, 0.15);
    transition: all 0.3s ease;
}

.stat-box:hover {
    transform: translateY(-3px);
    box-shadow:
        0 12px 40px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.15),
        0 0 30px rgba(0, 200, 255, 0.25);
}

.stat-box-label {
    font-family: var(--font-display);
    font-size: 0.85rem;
    font-weight: 500;
    letter-spacing: 3px;
    color: rgba(255, 255, 255, 0.7);
    text-transform: uppercase;
    margin-bottom: 8px;
}

.stat-box-value {
    font-family: var(--font-display);
    font-size: 2.8rem;
    font-weight: 900;
    color: #fff;
    text-shadow:
        0 0 20px rgba(0, 240, 255, 0.5),
        0 2px 4px rgba(0, 0, 0, 0.3);
    line-height: 1;
}

/* Score box special styling */
.score-box {
    border-color: rgba(0, 255, 136, 0.4);
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.1),
        0 0 25px rgba(0, 255, 136, 0.2);
}

.score-box .stat-box-label {
    color: var(--primary-green);
}

.score-highlight {
    color: var(--primary-green);
    text-shadow:
        0 0 25px rgba(0, 255, 136, 0.6),
        0 0 50px rgba(0, 255, 136, 0.3),
        0 2px 4px rgba(0, 0, 0, 0.3);
}

.ai-mode-indicator {
    position: absolute;
    top: -40px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 240, 255, 0.2);
    border: 1px solid var(--primary-cyan);
    color: var(--primary-cyan);
    padding: 5px 15px;
    border-radius: 20px;
    font-family: var(--font-display);
    font-size: 0.8rem;
    letter-spacing: 2px;
    text-shadow: 0 0 10px rgba(0, 240, 255, 0.5);
    animation: flash 1s infinite;
    z-index: 100;
}

@keyframes flash {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

/* Highscore box special styling */
.highscore-box {
    border-color: rgba(255, 215, 0, 0.4);
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.1),
        0 0 25px rgba(255, 215, 0, 0.2);
}

.highscore-box .stat-box-label {
    color: #FFD700;
}

.highscore-highlight {
    color: #FFD700;
    text-shadow:
        0 0 25px rgba(255, 215, 0, 0.6),
        0 0 50px rgba(255, 215, 0, 0.3),
        0 2px 4px rgba(0, 0, 0, 0.3);
}

/* Combo HUD - Stable Bottom Center */
.combo-hud {
    position: fixed;
    left: 50%;
    bottom: 100px;
    display: flex;
    flex-direction: column;
    align-items: center;
    pointer-events: none;
    z-index: 100;
    /* Use margin for centering to avoid transform conflicts with animations */
    margin-left: -140px;
    width: 280px;
}

.combo-text {
    font-family: var(--font-display);
    font-size: 1.7rem;
    font-weight: 900;
    letter-spacing: 4px;
    text-shadow:
        0 0 20px rgba(0, 0, 0, 0.8),
        0 0 40px currentColor,
        0 4px 8px rgba(0, 0, 0, 0.5);
    margin-bottom: 0;
    text-align: center;
}

.combo-multiplier {
    font-family: var(--font-display);
    font-size: 3.8rem;
    font-weight: 900;
    color: #fff;
    text-shadow:
        0 0 30px rgba(255, 255, 255, 0.8),
        0 0 60px currentColor,
        0 4px 8px rgba(0, 0, 0, 0.5);
    line-height: 1;
    text-align: center;
}

.combo-timer-container {
    width: 160px;
    height: 8px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 4px;
    margin-top: 10px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

.combo-timer-bar {
    height: 100%;
    width: 100%;
    background: var(--primary-cyan);
    box-shadow: 0 0 20px var(--primary-cyan);
    transition: width 0.1s linear;
}

/* Combo Animations - Use scale only, no translate */
.combo-pop {
    animation: combo-pop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes combo-pop {
    0% {
        opacity: 0;
    }

    50% {
        opacity: 1;
    }

    100% {
        opacity: 1;
    }
}

.combo-shake {
    animation: combo-shake 0.1s ease-in-out infinite;
}

@keyframes combo-shake {

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

    25% {
        transform: translate(-2px, 2px);
    }

    50% {
        transform: translate(2px, -2px);
    }

    75% {
        transform: translate(-2px, -2px);
    }
}

.combo-glow {
    animation: combo-glow 1s ease-in-out infinite alternate;
}

@keyframes combo-glow {
    from {
        border-color: inherit;
        filter: brightness(1) drop-shadow(0 0 5px currentColor);
    }

    to {
        border-color: inherit;
        filter: brightness(1.5) drop-shadow(0 0 20px currentColor);
    }
}

.ai-status {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 25px;
    backdrop-filter: blur(10px);
}

.ai-indicator {
    width: 10px;
    height: 10px;
    background: var(--primary-green);
    border-radius: 50%;
    box-shadow: 0 0 10px var(--primary-green);
    animation: ai-blink 1s ease infinite;
}

@keyframes ai-blink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

#ai-mode {
    font-family: var(--font-display);
    font-size: 0.8rem;
    letter-spacing: 2px;
    color: var(--primary-green);
}

.hud-right {
    position: absolute;
    right: 25px;
    top: 50%;
    transform: translateY(-50%);
}

.powerup-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.powerup-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 15px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    backdrop-filter: blur(10px);
}

.powerup-icon {
    font-size: 1.5rem;
}

.powerup-bar {
    width: 60px;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    overflow: hidden;
}

.powerup-fill {
    height: 100%;
    background: var(--primary-cyan);
    border-radius: 3px;
    transition: width 0.1s linear;
}

.hud-bottom {
    position: absolute;
    bottom: 25px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 15px;
}

.control-btn {
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

/* ========================================
   PREMIUM MOBILE CONTROL DOCK
   ======================================== */
#mobile-controls {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 100;
    padding: 15px 20px;
    padding-bottom: calc(15px + env(safe-area-inset-bottom, 10px));
    background: linear-gradient(180deg,
            rgba(10, 10, 20, 0.85) 0%,
            rgba(15, 15, 30, 0.98) 100%);
    border-top: 1px solid rgba(0, 240, 255, 0.2);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.mobile-dock {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 400px;
    margin: 0 auto;
    gap: 15px;
}

/* Utility Button Columns */
.dock-column {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.dock-btn {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 14px;
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    transition: all 0.15s ease;
    -webkit-tap-highlight-color: transparent;
}

.dock-btn svg {
    width: 22px;
    height: 22px;
}

.dock-btn:active {
    background: rgba(0, 240, 255, 0.25);
    border-color: rgba(0, 240, 255, 0.6);
    color: #00f0ff;
    transform: scale(0.92);
    box-shadow: 0 0 15px rgba(0, 240, 255, 0.3);
}

/* Premium D-Pad */
.dpad-container {
    flex: 0 0 auto;
}

.dpad-base {
    position: relative;
    width: 140px;
    height: 140px;
    background: radial-gradient(circle,
            rgba(30, 30, 50, 0.9) 0%,
            rgba(20, 20, 35, 0.95) 70%);
    border-radius: 50%;
    border: 2px solid rgba(0, 240, 255, 0.15);
    box-shadow:
        0 0 30px rgba(0, 0, 0, 0.5),
        inset 0 0 20px rgba(0, 0, 0, 0.3);
}

.dpad-btn {
    position: absolute;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(145deg,
            rgba(60, 60, 80, 0.9) 0%,
            rgba(40, 40, 55, 0.9) 100%);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    color: rgba(255, 255, 255, 0.9);
    cursor: pointer;
    transition: all 0.1s ease;
    -webkit-tap-highlight-color: transparent;
}

.dpad-btn svg {
    width: 20px;
    height: 20px;
}

.dpad-btn:active {
    background: linear-gradient(145deg,
            rgba(0, 200, 255, 0.7) 0%,
            rgba(0, 150, 200, 0.8) 100%);
    border-color: #00f0ff;
    transform: scale(0.9);
    box-shadow: 0 0 20px rgba(0, 240, 255, 0.5);
}

/* D-Pad Button Positions */
.dpad-up {
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
}

.dpad-down {
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
}

.dpad-left {
    left: 8px;
    top: 50%;
    transform: translateY(-50%);
}

.dpad-right {
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
}

.dpad-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 30px;
    height: 30px;
    background: radial-gradient(circle,
            rgba(0, 240, 255, 0.3) 0%,
            transparent 70%);
    border-radius: 50%;
}

/* ========================================
   SKIN MODAL
   ======================================== */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    backdrop-filter: blur(10px);
}

.modal-content {
    background: linear-gradient(135deg, rgba(20, 20, 40, 0.95), rgba(30, 30, 60, 0.95));
    border: 2px solid rgba(0, 200, 255, 0.3);
    border-radius: 20px;
    padding: 30px;
    text-align: center;
    max-width: 360px;
    width: 90%;
    max-height: min(86vh, 760px);
    overflow-y: auto;
}

.modal-title {
    font-family: var(--font-display);
    font-size: 1.5rem;
    color: var(--primary-cyan);
    margin-bottom: 25px;
    letter-spacing: 3px;
}

.skin-options {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 20px;
}

.skin-option {
    width: 100%;
    min-height: 76px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.skin-icon {
    font-size: 1.5rem;
}

.skin-name {
    font-size: 0.55rem;
    font-weight: 600;
    letter-spacing: 1px;
    color: rgba(255, 255, 255, 0.9);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.skin-option:hover,
.skin-option.selected {
    border-color: #00f0ff;
    transform: scale(1.05);
    box-shadow: 0 0 15px rgba(0, 200, 255, 0.4);
}

/* ========================================
   GAME OVER SCREEN
   ======================================== */
#game-over {
    position: fixed;
    inset: 0;
    background: transparent !important;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    backdrop-filter: blur(10px);
}

.game-over-container {
    text-align: center;
    padding: 50px 80px;
    background: var(--glass-bg);
    border: 1px solid rgba(255, 0, 100, 0.3);
    border-radius: 30px;
    backdrop-filter: blur(20px);
    animation: game-over-appear 0.5s ease;
}

@keyframes game-over-appear {
    from {
        opacity: 0;
        transform: scale(0.8);
    }

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

.game-over-title {
    font-family: var(--font-display);
    font-size: 3rem;
    font-weight: 900;
    background: linear-gradient(135deg, #ff0066, #ff6600);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 40px;
}

.final-stats {
    display: flex;
    gap: 40px;
    margin-bottom: 40px;
}

.final-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.final-label {
    font-size: 0.7rem;
    letter-spacing: 2px;
    color: rgba(255, 255, 255, 0.5);
    margin-bottom: 8px;
}

.final-value {
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 700;
    color: #fff;
}

.game-over-buttons {
    display: flex;
    gap: 20px;
    justify-content: center;
}

/* ========================================
   PAUSE SCREEN
   ======================================== */
#pause-screen {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 150;
    backdrop-filter: blur(5px);
}

.pause-container {
    text-align: center;
    padding: 50px;
}

.pause-container h2 {
    font-family: var(--font-display);
    font-size: 3rem;
    color: var(--primary-cyan);
    text-shadow: var(--glow-cyan);
    margin-bottom: 10px;
}

.pause-container p {
    font-size: 0.9rem;
    letter-spacing: 3px;
    color: rgba(255, 255, 255, 0.5);
    margin-bottom: 30px;
}

/* ========================================
   GAME CONTAINER
   ======================================== */
/* Game container duplicate removed - consolidated at top */


#game-container canvas {
    display: block;
    /* Size is set by JavaScript for 1:1 aspect ratio */
}

/* Live Leaderboard Panel */
.live-leaderboard {
    position: fixed;
    top: 80px;
    /* Positioned near top */
    right: 50px;
    /* Moved away from extreme edge */
    width: 380px;
    background: rgba(15, 20, 30, 0.4);
    /* Much more transparent */
    border: 1px solid rgba(0, 240, 255, 0.4);
    border-radius: 20px;
    padding: 20px;
    z-index: 50;
    backdrop-filter: blur(40px) saturate(180%);
    /* Strong Liquid Blur */
    box-shadow:
        0 20px 50px rgba(0, 0, 0, 0.5),
        inset 0 1px 1px rgba(255, 255, 255, 0.1),
        /* Top glass highlight */
        0 0 20px rgba(0, 240, 255, 0.1);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.live-leaderboard:hover {
    background: rgba(15, 20, 30, 0.5);
    border-color: var(--primary-cyan);
    transform: translateX(-5px) scale(1.02);
}

.lb-title {
    font-family: var(--font-display);
    font-size: 1.1rem;
    color: var(--primary-cyan);
    text-align: center;
    margin: 0 0 12px 0;
    letter-spacing: 2px;
    text-shadow: 0 0 10px rgba(0, 240, 255, 0.5);
}

.lb-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 10px;
}

.lb-tab {
    flex: 1;
    padding: 8px 6px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.7);
    font-family: var(--font-display);
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
    letter-spacing: 1px;
}

.lb-tab:hover {
    background: rgba(255, 255, 255, 0.15);
}

.lb-tab.active {
    background: var(--primary-cyan);
    color: #000;
}

.lb-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 380px;
    /* Reduced height to keep it from being "too long" */
    overflow-y: auto;
    padding-right: 8px;
}

/* Custom scrollbar */
.lb-list::-webkit-scrollbar {
    width: 6px;
}

.lb-list::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
}

.lb-list::-webkit-scrollbar-thumb {
    background: rgba(0, 240, 255, 0.3);
    border-radius: 3px;
}

.lb-item {
    display: flex;
    align-items: center;
    padding: 14px 18px;
    /* Larger cards */
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    gap: 15px;
    transition: all 0.3s ease;
}

.lb-item:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(0, 240, 255, 0.3);
    transform: translateX(-5px);
}

.lb-rank {
    font-family: var(--font-display);
    font-size: 1.4rem;
    /* Larger rank */
    font-weight: 700;
    width: 40px;
    text-align: center;
}

.lb-rank-1 {
    color: #FFD700;
}

.lb-rank-2 {
    color: #C0C0C0;
}

.lb-rank-3 {
    color: #CD7F32;
}

.lb-rank-4,
.lb-rank-5 {
    color: rgba(255, 255, 255, 0.5);
}

.lb-name {
    flex: 1;
    font-size: 1.1rem;
    /* Larger text */
    font-weight: 500;
    color: #fff;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.lb-score {
    font-family: var(--font-display);
    font-size: 1.2rem;
    /* Larger score */
    font-weight: 700;
    color: var(--primary-cyan);
    text-shadow: 0 0 12px rgba(0, 240, 255, 0.5);
}

.lb-loading,
.lb-empty {
    text-align: center;
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.9rem;
    padding: 30px 0;
}

/* ========================================
   RESPONSIVE - PREMIUM MOBILE
   ======================================== */
@media (max-width: 768px) {

    /* Show premium mobile dock */
    #mobile-controls {
        display: block;
    }

    /* Game container - positioned between HUD and controls */
    #game-container {
        top: 50px;
        /* Below HUD */
        bottom: 140px;
        /* Above controls dock */
        left: 0;
        right: 0;
    }

    /* Mobile leaderboard - centered below game, above controls */
    .live-leaderboard {
        position: fixed;
        bottom: 150px;
        left: 50%;
        transform: translateX(-50%);
        right: auto;
        width: 90%;
        max-width: 320px;
        padding: 12px;
        border-radius: 12px;
    }

    .lb-title {
        font-size: 0.95rem;
        margin-bottom: 8px;
    }

    .lb-tabs {
        gap: 6px;
        margin-bottom: 8px;
    }

    .lb-tab {
        padding: 6px 4px;
        font-size: 0.7rem;
    }

    .lb-list {
        max-height: 120px;
        gap: 4px;
    }

    .lb-item {
        padding: 8px 10px;
        gap: 8px;
    }

    .lb-rank {
        font-size: 0.9rem;
        width: 24px;
    }

    .lb-name {
        font-size: 0.85rem;
    }

    .lb-score {
        font-size: 0.85rem;
    }

    .lb-loading,
    .lb-empty {
        padding: 20px 0;
        font-size: 0.8rem;
    }

    /* Premium HUD for mobile */
    #game-hud {
        padding: 0;
    }

    .hud-top {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        padding: 12px 20px;
        background: linear-gradient(180deg,
                rgba(10, 10, 20, 0.95) 0%,
                rgba(10, 10, 20, 0.7) 80%,
                transparent 100%);
        border-bottom: 1px solid rgba(0, 240, 255, 0.1);
        z-index: 50;
    }

    .score-container {
        gap: 3px;
    }

    .score-label {
        font-size: 0.5rem;
        letter-spacing: 2px;
        color: rgba(255, 255, 255, 0.5);
    }

    .score-value {
        font-size: 1.4rem;
        color: #fff;
    }

    .combo-hud {
        position: fixed;
        top: 8px;
        right: 20px;
        left: auto;
        transform: none;
        align-items: flex-end;
    }

    .combo-text {
        font-size: 0.6rem;
    }

    .combo-multiplier {
        font-size: 1.5rem;
    }

    .combo-timer-container {
        width: 60px;
        height: 3px;
    }

    /* Hide desktop HUD elements */
    .hud-left,
    .hud-right,
    .hud-bottom {
        display: none;
    }

    /* Menu adjustments */
    .game-title {
        font-size: 2.2rem;
    }

    .title-arcade {
        font-size: 1.3rem;
    }

    .menu-container {
        padding: 20px 15px;
        margin: 10px;
        border-radius: 16px;
    }

    .difficulty-buttons {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        gap: 8px;
    }

    .diff-btn {
        padding: 8px 12px;
        font-size: 0.6rem;
    }

    .neon-btn {
        padding: 10px 25px;
        font-size: 0.75rem;
    }

    /* Game over - compact */
    .game-over-container {
        padding: 20px 25px;
        margin: 10px;
    }

    .game-over-title {
        font-size: 1.8rem;
    }

    .final-stats {
        flex-direction: column;
        gap: 10px;
    }

    .final-value {
        font-size: 1.2rem;
    }

    .game-over-buttons {
        flex-direction: column;
        gap: 8px;
    }

    .game-over-buttons .neon-btn {
        width: 100%;
        padding: 10px 15px;
    }
}

/* Extra small screens (phones in portrait like iPhone SE) */
@media (max-width: 480px) {

    /* Game area even more compact */
    #game-container {
        top: 50px;
        bottom: 170px;
        left: 5px;
        right: 5px;
    }

    .game-title {
        font-size: 1.5rem;
    }

    .title-arcade {
        font-size: 0.85rem;
    }

    .subtitle {
        font-size: 0.5rem;
        letter-spacing: 2px;
    }

    .menu-container {
        padding: 12px 10px;
        margin: 5px;
    }

    .score-value {
        font-size: 1.1rem;
    }

    .score-label {
        font-size: 0.4rem;
    }

    /* Smaller D-pad for small phones */
    .dpad-base {
        width: 120px;
        height: 120px;
    }

    .dpad-btn {
        width: 38px;
        height: 38px;
    }

    .dpad-btn svg {
        width: 16px;
        height: 16px;
    }

    /* Smaller utility buttons */
    .dock-btn {
        width: 42px;
        height: 42px;
    }

    .dock-btn svg {
        width: 18px;
        height: 18px;
    }

    #mobile-controls {
        padding: 10px 12px;
        padding-bottom: calc(10px + env(safe-area-inset-bottom, 8px));
    }

    .dock-column {
        gap: 8px;
    }
}

/* ========================================
   ANIMATIONS
   ======================================== */
@keyframes float {

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

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

@keyframes glow-pulse {

    0%,
    100% {
        box-shadow: 0 0 20px rgba(0, 240, 255, 0.3);
    }

    50% {
        box-shadow: 0 0 40px rgba(0, 240, 255, 0.6);
    }
}

/* Spectator mode - hide all UI */
body.spectator-mode #game-hud {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s ease;
}

/* =============================================
   CHAT PANEL - Minimalistic Design
============================================= */
.chat-toggle {
    display: none;
    /* Hide toggle button */
}

.chat-panel {
    position: fixed;
    top: auto;
    bottom: 24px;
    right: 24px;
    width: 320px;
    max-height: 250px;
    background: rgba(15, 20, 30, 0.4);
    /* Much more transparent */
    border: 1px solid rgba(0, 240, 255, 0.4);
    border-radius: 16px;
    z-index: 100;
    display: flex !important;
    flex-direction: column;
    backdrop-filter: blur(40px) saturate(180%);
    /* Strong Liquid Blur */
    box-shadow:
        0 20px 50px rgba(0, 0, 0, 0.5),
        inset 0 1px 1px rgba(255, 255, 255, 0.1),
        /* Top glass highlight */
        0 0 20px rgba(0, 240, 255, 0.1);
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.chat-panel:hover {
    background: rgba(15, 20, 30, 0.5);
    border-color: var(--primary-cyan);
    transform: translateX(-5px) scale(1.02);
}

.chat-panel.hidden {
    display: none !important;
}

.chat-header {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    background: rgba(0, 240, 255, 0.1);
    border-bottom: 1px solid rgba(0, 240, 255, 0.2);
}

.chat-title {
    font-family: var(--font-display);
    font-size: 0.95rem;
    color: var(--primary-cyan);
    letter-spacing: 2px;
}

.online-count {
    margin-left: auto;
    font-family: var(--font-body);
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.6);
}

.chat-close {
    margin-left: 10px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.5);
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.chat-close:hover {
    border-color: #ff4444;
    color: #ff4444;
}

.chat-messages {
    flex: 1;
    padding: 8px;
    overflow-y: auto;
    max-height: 150px;
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 240, 255, 0.3) transparent;
}

.chat-messages::-webkit-scrollbar {
    width: 4px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: rgba(0, 240, 255, 0.3);
    border-radius: 2px;
}

.chat-message {
    margin-bottom: 8px;
    font-size: 0.88rem;
    line-height: 1.35;
}

.chat-message .chat-user {
    color: var(--primary-cyan);
    font-weight: 600;
    margin-right: 6px;
}

.chat-message .chat-text {
    color: rgba(255, 255, 255, 0.85);
}

.chat-input-wrapper {
    display: flex;
    padding: 8px;
    gap: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.chat-input {
    flex: 1;
    padding: 8px 10px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: #fff;
    font-size: 0.8rem;
    font-family: var(--font-body);
}

.chat-input::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

.chat-input:focus {
    outline: none;
    border-color: var(--primary-cyan);
}

.chat-send {
    padding: 8px 12px;
    background: linear-gradient(135deg, var(--primary-cyan), var(--primary-green));
    border: none;
    border-radius: 8px;
    color: var(--bg-dark);
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.chat-send:hover {
    transform: scale(1.05);
}

/* Mobile adjustments */
@media (max-width: 768px) {
    .chat-panel {
        top: 10px;
        width: 95%;
        max-width: none;
        max-height: 120px;
        border-radius: 6px;
    }

    .chat-header {
        padding: 6px 10px;
    }

    .chat-title {
        font-size: 0.7rem;
    }

    .online-count {
        font-size: 0.6rem;
    }

    .chat-messages {
        max-height: 60px;
        padding: 6px;
    }

    .chat-message {
        font-size: 0.68rem;
        margin-bottom: 4px;
    }

    .chat-input-wrapper {
        padding: 6px;
        gap: 6px;
    }

    .chat-input {
        padding: 6px 8px;
        font-size: 0.7rem;
    }

    .chat-send {
        padding: 6px 10px;
        font-size: 0.85rem;
    }
}

/* Chat Minimized (Chat Head) State */
.chat-panel.chat-minimized {
    width: 46px !important;
    height: 46px !important;
    max-height: 46px !important;
    border-radius: 50% !important;
    padding: 0 !important;
    cursor: pointer;
    transition: all 0.3s ease;
    background: linear-gradient(145deg, #0a0a14, #151525) !important;
    border: 2px solid #00f0ff !important;
    box-shadow: 0 0 15px rgba(0, 240, 255, 0.4);
}

.chat-panel.chat-minimized:hover {
    box-shadow: 0 0 25px rgba(0, 240, 255, 0.7);
    transform: scale(1.05);
}

.chat-panel.chat-minimized .chat-header {
    justify-content: center;
    align-items: center;
    padding: 0;
    height: 100%;
    border-radius: 50%;
    background: transparent !important;
}

.chat-panel.chat-minimized .chat-title {
    font-size: 0;
    letter-spacing: 0;
}

/* Show snake icon when minimized */
.chat-panel.chat-minimized .chat-title::before {
    content: '';
    display: block;
    width: 24px;
    height: 24px;
    background: linear-gradient(135deg, #00f0ff, #00cc88);
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-1 17.93c-3.95-.49-7-3.85-7-7.93 0-.62.08-1.21.21-1.79L9 15v1c0 1.1.9 2 2 2v1.93zm6.9-2.54c-.26-.81-1-1.39-1.9-1.39h-1v-3c0-.55-.45-1-1-1H8v-2h2c.55 0 1-.45 1-1V7h2c1.1 0 2-.9 2-2v-.41c2.93 1.19 5 4.06 5 7.41 0 2.08-.8 3.97-2.1 5.39z'/%3E%3C/svg%3E") center/contain no-repeat;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-1 17.93c-3.95-.49-7-3.85-7-7.93 0-.62.08-1.21.21-1.79L9 15v1c0 1.1.9 2 2 2v1.93zm6.9-2.54c-.26-.81-1-1.39-1.9-1.39h-1v-3c0-.55-.45-1-1-1H8v-2h2c.55 0 1-.45 1-1V7h2c1.1 0 2-.9 2-2v-.41c2.93 1.19 5 4.06 5 7.41 0 2.08-.8 3.97-2.1 5.39z'/%3E%3C/svg%3E") center/contain no-repeat;
}

.chat-panel.chat-minimized .online-count,
.chat-panel.chat-minimized .chat-close,
.chat-panel.chat-minimized .chat-messages,
.chat-panel.chat-minimized .chat-input-wrapper {
    display: none !important;
}

/* iPhone SE and smaller devices */
@media (max-width: 768px) {
    .chat-panel {
        top: 10px;
        right: 10px;
        left: auto;
        transform: none;
        width: 280px;
        max-height: 150px;
        border-radius: 8px;
    }

    .chat-header {
        padding: 4px 8px;
    }

    .chat-title {
        font-size: 0.65rem;
        letter-spacing: 1px;
    }

    .online-count {
        font-size: 0.55rem;
    }

    .chat-messages {
        max-height: 120px;
        padding: 6px;
        display: block !important;
        /* Show messages on mobile */
        overflow-y: auto;
    }

    .chat-message {
        font-size: 0.65rem;
        margin-bottom: 3px;
    }

    .chat-input-wrapper {
        padding: 4px 6px;
        gap: 4px;
    }

    .chat-input {
        padding: 5px 6px;
        font-size: 0.65rem;
        border-radius: 4px;
    }

    .chat-send {
        padding: 5px 8px;
        font-size: 0.8rem;
        border-radius: 4px;
    }

    /* Auth Screen - Make it compact on iPhone SE */
    #auth-screen {
        padding: 0;
        overflow-y: auto;
    }

    .auth-container {
        max-width: 100%;
        padding: 10px 15px;
        margin: 0;
        transform: none;
    }

    .auth-title {
        font-size: 1.3rem;
        margin-bottom: 15px;
    }

    .form-title {
        font-size: 1rem;
        margin-bottom: 12px;
    }

    .input-group {
        margin-bottom: 10px;
    }

    .input-group label {
        font-size: 0.7rem;
        margin-bottom: 4px;
    }

    .input-group input {
        padding: 8px 10px;
        font-size: 0.8rem;
    }

    .checkbox-group {
        margin: 8px 0;
    }

    .checkbox-group label {
        font-size: 0.75rem;
    }

    .auth-btn {
        padding: 10px;
        font-size: 0.85rem;
        margin-top: 10px;
    }

    .auth-switch {
        font-size: 0.75rem;
        margin-top: 12px;
    }

    .auth-error {
        font-size: 0.7rem;
        margin-top: 8px;
    }

    /* Menu Container - Compact for iPhone SE */
    .menu-container {
        padding: 15px 10px;
        margin-top: 20px;
        /* Move up to center */
    }

    .game-title {
        font-size: 1.8rem;
        margin-bottom: 5px;
    }

    .title-arcade {
        font-size: 1.2rem;
    }

    .subtitle {
        font-size: 0.6rem;
        margin-bottom: 12px;
    }

    .ai-selector label {
        font-size: 0.7rem;
        margin-bottom: 6px;
    }

    .difficulty-buttons {
        gap: 6px;
    }

    .diff-btn {
        padding: 6px 12px;
        font-size: 0.65rem;
    }

    #start-btn {
        padding: 10px 30px;
        font-size: 0.9rem;
        margin: 12px 0;
    }

    .menu-secondary-buttons {
        gap: 8px;
        margin-top: 10px;
    }

    .menu-secondary-buttons .neon-btn {
        padding: 6px 12px;
        font-size: 0.7rem;
    }

    .menu-footer {
        margin-top: 10px;
        font-size: 0.6rem;
    }
}

/* ============================================ */
/* LIVE LEADERBOARD - Minimalistic Design      */
/* ============================================ */

.live-leaderboard {
    position: fixed;
    top: 20px;
    right: 20px;
    left: auto;
    transform: none;
    background: rgba(10, 15, 25, 0.9);
    /* Darker for forest background */
    border: 2px solid #ffd700;
    border-radius: 16px;
    padding: 15px 20px;
    z-index: 90;
    backdrop-filter: blur(20px);
    /* Increased blur */
    width: 450px;
    /* Expanded width for visibility */
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8), 0 0 30px rgba(255, 215, 0, 0.2);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.live-leaderboard .lb-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
}

.live-leaderboard .lb-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #ffd700;
    margin: 0;
    letter-spacing: 2px;
}

.live-leaderboard .lb-minimize {
    background: transparent;
    border: none;
    color: #00f0ff;
    font-size: 1rem;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    transition: all 0.2s;
}

.live-leaderboard .lb-minimize:hover {
    background: rgba(0, 240, 255, 0.2);
}

.live-leaderboard .lb-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 6px;
}

.live-leaderboard .lb-tab {
    flex: 1;
    padding: 8px 10px;
    font-size: 0.85rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(0, 240, 255, 0.2);
    color: #aaa;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.live-leaderboard .lb-tab.active {
    background: rgba(0, 240, 255, 0.2);
    color: #00f0ff;
    border-color: #00f0ff;
}

.live-leaderboard .lb-list {
    max-height: 400px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 215, 0, 0.3) transparent;
}

.live-leaderboard .lb-item {
    display: flex;
    align-items: center;
    padding: 6px 0;
    font-size: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.live-leaderboard .lb-item:last-child {
    border-bottom: none;
}

.live-leaderboard .lb-rank {
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-weight: 700;
    font-size: 0.55rem;
    margin-right: 8px;
}

.live-leaderboard .lb-rank-1 {
    background: linear-gradient(135deg, #ffd700, #ff8c00);
    color: #000;
}

.live-leaderboard .lb-rank-2 {
    background: linear-gradient(135deg, #c0c0c0, #888);
    color: #000;
}

.live-leaderboard .lb-rank-3 {
    background: linear-gradient(135deg, #cd7f32, #8b4513);
    color: #fff;
}

.live-leaderboard .lb-name {
    flex: 1;
    color: #fff;
    text-transform: uppercase;
}

.live-leaderboard .lb-score {
    color: #00f0ff;
    font-weight: 700;
}

/* Minimized State */
.live-leaderboard.lb-minimized {
    padding: 6px 10px;
    width: auto;
    max-width: 120px;
}

.live-leaderboard.lb-minimized .lb-title {
    font-size: 0.6rem;
}

.live-leaderboard.lb-minimized .lb-tabs,
.live-leaderboard.lb-minimized .lb-list {
    display: none;
}

.live-leaderboard.lb-minimized .lb-minimize {
    transform: rotate(180deg);
}

/* Mobile adjustments for stats bar */
@media (max-width: 600px) {
    .hud-stats-bar {
        gap: 8px;
        padding: 5px;
    }

    .stat-box {
        min-width: 70px;
        padding: 8px 12px;
        border-radius: 10px;
    }

    .stat-box-label {
        font-size: 0.6rem;
        letter-spacing: 1px;
        margin-bottom: 4px;
    }

    .stat-box-value {
        font-size: 1.4rem;
    }
}

@media (max-width: 400px) {
    .hud-stats-bar {
        gap: 5px;
        padding: 3px;
    }

    .stat-box {
        min-width: 55px;
        padding: 6px 8px;
        border-radius: 8px;
    }

    .stat-box-label {
        font-size: 0.5rem;
        letter-spacing: 0.5px;
        margin-bottom: 2px;
    }

    .stat-box-value {
        font-size: 1.1rem;
    }

    .combo-hud {
        top: 100px;
    }

    .combo-text {
        font-size: 1rem;
    }

    .combo-multiplier {
        font-size: 2rem;
    }
}

/* Mobile adjustments for leaderboard */
@media (max-width: 400px) {
    .live-leaderboard {
        bottom: 90px;
        padding: 6px 10px;
        max-width: 280px;
    }

    .live-leaderboard .lb-title {
        font-size: 0.6rem;
    }

    .live-leaderboard .lb-tab {
        font-size: 0.5rem;
        padding: 3px 4px;
    }

    .live-leaderboard .lb-item {
        font-size: 0.6rem;
    }

    .live-leaderboard .lb-list {
        max-height: 60px;
    }
}

/* ========================================
   GAME OVER SCREEN - LIVESTREAM VISIBLE
   ======================================== */
#game-over {
    position: fixed;
    inset: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    z-index: 200;
}

.game-over-container {
    text-align: center;
    padding: 40px 60px;
    background: linear-gradient(145deg, rgba(20, 25, 35, 0.95), rgba(10, 15, 25, 0.98));
    border: 2px solid rgba(255, 50, 100, 0.5);
    border-radius: 24px;
    box-shadow: 0 0 60px rgba(255, 50, 100, 0.3);
}

.game-over-title {
    font-family: var(--font-display);
    font-size: 4rem;
    font-weight: 900;
    color: #ff3366;
    text-transform: uppercase;
    letter-spacing: 8px;
    text-shadow:
        0 0 30px rgba(255, 51, 102, 0.8),
        0 0 60px rgba(255, 51, 102, 0.4);
    margin-bottom: 30px;
}

.final-stats {
    display: flex;
    justify-content: center;
    gap: 50px;
    margin-bottom: 40px;
}

.final-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.final-label {
    font-family: var(--font-display);
    font-size: 1.6rem;
    /* Even larger labels for game over */
    color: rgba(255, 255, 255, 0.8);
    letter-spacing: 4px;
    margin-bottom: 12px;
    text-transform: uppercase;
}

.final-value {
    font-family: var(--font-display);
    font-size: 4.5rem;
    /* Massive values for livestream */
    font-weight: 900;
    color: #fff;
    text-shadow: 0 0 30px rgba(255, 255, 255, 0.6);
}

.game-over-buttons {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
}

.game-over-buttons .neon-btn {
    padding: 16px 32px;
    font-size: 1.1rem;
    border-radius: 12px;
    font-weight: 700;
    letter-spacing: 2px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.game-over-buttons .neon-btn.primary {
    background: linear-gradient(135deg, #00f0ff, #00cc88);
    border: none;
    color: #000;
}

.game-over-buttons .neon-btn.secondary {
    background: transparent;
    border: 2px solid #ff00ff;
    color: #ff00ff;
}

.game-over-buttons .neon-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(0, 240, 255, 0.3);
}

/* ========================================
   MOBILE PLAYABILITY OVERRIDES
   ======================================== */
@media (max-width: 768px) {
    #live-leaderboard {
        display: none !important;
    }

    #mobile-controls {
        padding: 6px 8px !important;
        padding-bottom: calc(6px + env(safe-area-inset-bottom, 6px)) !important;
    }

    .mobile-dock {
        max-width: 352px !important;
        gap: 8px !important;
    }

    .dpad-base {
        width: 114px !important;
        height: 114px !important;
    }

    .dpad-btn {
        width: 36px !important;
        height: 36px !important;
    }

    .dpad-btn svg {
        width: 15px !important;
        height: 15px !important;
    }

    .dock-btn {
        width: 40px !important;
        height: 40px !important;
    }

    #game-container {
        top: 40px !important;
        bottom: 112px !important;
        left: 1px !important;
        right: 1px !important;
    }

    #game-container canvas {
        max-width: 100vw !important;
        max-height: calc(100vh - 152px) !important;
    }

    #main-menu {
        align-items: center !important;
        justify-content: center !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch;
        padding-top: max(8px, env(safe-area-inset-top, 0px)) !important;
        padding-bottom: max(8px, env(safe-area-inset-bottom, 0px)) !important;
        padding-left: 8px !important;
        padding-right: 8px !important;
    }

    .menu-container {
        width: min(420px, 96vw) !important;
        max-width: 100% !important;
        max-height: calc(100vh - 24px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)) !important;
        overflow-y: auto !important;
        margin: 6px auto !important;
        padding: 14px 12px !important;
        border-radius: 14px !important;
    }

    .menu-options {
        gap: 12px !important;
    }

    .menu-footer {
        margin-top: 8px !important;
    }

    .combo-hud {
        top: auto !important;
        right: auto !important;
        left: 50% !important;
        bottom: calc(160px + env(safe-area-inset-bottom, 0px)) !important;
        margin-left: -104px !important;
        transform: none !important;
        width: 208px !important;
        align-items: center !important;
        z-index: 118 !important;
        padding: 6px 10px 5px !important;
        border-radius: 12px !important;
        border: 1px solid rgba(0, 240, 255, 0.28) !important;
        background: linear-gradient(180deg,
                rgba(6, 12, 20, 0.74) 0%,
                rgba(6, 12, 20, 0.36) 100%) !important;
        backdrop-filter: blur(6px) !important;
        box-shadow:
            0 8px 18px rgba(0, 0, 0, 0.34),
            0 0 14px rgba(0, 240, 255, 0.18) !important;
    }

    .combo-text {
        font-size: 0.92rem !important;
        font-weight: 800 !important;
        letter-spacing: 1.5px !important;
        text-shadow:
            0 2px 10px rgba(0, 0, 0, 0.9),
            0 0 20px rgba(0, 240, 255, 0.45) !important;
    }

    .combo-multiplier {
        font-size: 2.15rem !important;
        text-shadow:
            0 2px 12px rgba(0, 0, 0, 0.9),
            0 0 24px rgba(0, 240, 255, 0.5) !important;
    }

    .combo-timer-container {
        width: 120px !important;
        height: 4px !important;
        margin-top: 3px !important;
        background: rgba(0, 0, 0, 0.56) !important;
    }

    #chat-panel {
        display: flex !important;
        top: calc(56px + env(safe-area-inset-top, 0px)) !important;
        left: auto !important;
        right: 8px !important;
        bottom: auto !important;
        width: min(74vw, 236px) !important;
        max-height: 132px !important;
        border-radius: 12px !important;
        z-index: 125 !important;
    }

    #chat-panel.chat-minimized {
        right: 8px !important;
        top: calc(56px + env(safe-area-inset-top, 0px)) !important;
        bottom: auto !important;
        width: 42px !important;
        height: 42px !important;
        max-height: 42px !important;
        border-radius: 12px !important;
        background: linear-gradient(160deg, rgba(14, 24, 36, 0.92), rgba(8, 14, 26, 0.88)) !important;
        border: 1px solid rgba(0, 240, 255, 0.42) !important;
        box-shadow:
            0 6px 16px rgba(0, 0, 0, 0.42),
            0 0 12px rgba(0, 240, 255, 0.2) !important;
        backdrop-filter: blur(8px) !important;
    }

    #chat-panel.chat-in-game {
        top: calc(56px + env(safe-area-inset-top, 0px)) !important;
        bottom: auto !important;
        right: 8px !important;
    }

    #chat-panel.chat-minimized.chat-in-game {
        top: calc(56px + env(safe-area-inset-top, 0px)) !important;
        bottom: auto !important;
    }

    #chat-panel.chat-in-menu {
        top: calc(56px + env(safe-area-inset-top, 0px)) !important;
        bottom: auto !important;
        right: 8px !important;
    }

    #chat-panel.chat-minimized.chat-in-menu {
        top: calc(56px + env(safe-area-inset-top, 0px)) !important;
        bottom: auto !important;
    }

    #chat-panel.hidden {
        display: none !important;
    }

    #chat-toggle {
        display: none !important;
    }

    .chat-panel:hover {
        transform: none !important;
    }

    #chat-panel.chat-minimized:hover {
        transform: none !important;
        background: linear-gradient(160deg, rgba(16, 34, 54, 0.96), rgba(10, 22, 40, 0.92)) !important;
        border-color: rgba(0, 240, 255, 0.68) !important;
        box-shadow:
            0 8px 18px rgba(0, 0, 0, 0.48),
            0 0 18px rgba(0, 240, 255, 0.35) !important;
    }

    .chat-header {
        padding: 5px 8px !important;
    }

    #chat-panel.chat-minimized .chat-header {
        display: flex !important;
        width: 100% !important;
        padding: 0 !important;
        height: 100% !important;
        border: none !important;
        background: transparent !important;
        justify-content: center !important;
    }

    .chat-title {
        font-size: 0.58rem !important;
        letter-spacing: 1px !important;
    }

    #chat-panel.chat-minimized .chat-title {
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        font-size: 0 !important;
        line-height: 0 !important;
        width: 100% !important;
        height: 100% !important;
        overflow: hidden !important;
        color: transparent !important;
        text-indent: -9999px !important;
        letter-spacing: 0 !important;
    }

    #chat-panel.chat-minimized .chat-title::before {
        content: '\1F4AC' !important;
        width: auto !important;
        height: auto !important;
        margin: 0 !important;
        text-indent: 0 !important;
        font-size: 18px !important;
        line-height: 1 !important;
        color: #f2feff !important;
        background: none !important;
        filter: drop-shadow(0 0 6px rgba(0, 240, 255, 0.55)) !important;
        mask: none !important;
        -webkit-mask: none !important;
    }

    .online-count {
        font-size: 0.48rem !important;
    }

    .chat-messages {
        max-height: 52px !important;
        padding: 5px !important;
    }

    .chat-message {
        font-size: 0.56rem !important;
        line-height: 1.2 !important;
        margin-bottom: 2px !important;
    }

    .chat-input-wrapper {
        padding: 4px 5px !important;
        gap: 4px !important;
    }

    .chat-input {
        font-size: 0.6rem !important;
        padding: 5px 6px !important;
    }

    .chat-send {
        font-size: 0.66rem !important;
        padding: 5px 7px !important;
    }

    #game-over {
        align-items: flex-start !important;
        overflow-y: auto !important;
        padding: 10px 8px 14px !important;
    }

    .game-over-container {
        width: min(94vw, 420px) !important;
        max-height: calc(100vh - 24px) !important;
        overflow-y: auto !important;
        padding: 18px 14px !important;
        margin: 0 auto !important;
        border-radius: 14px !important;
    }

    .game-over-title {
        font-size: 1.45rem !important;
        letter-spacing: 2px !important;
        margin-bottom: 12px !important;
    }

    .final-stats {
        gap: 8px !important;
        margin-bottom: 12px !important;
    }

    .final-label {
        font-size: 0.72rem !important;
        letter-spacing: 1px !important;
        margin-bottom: 4px !important;
    }

    .final-value {
        font-size: 1.9rem !important;
    }

    .game-over-buttons {
        gap: 6px !important;
    }

    .game-over-buttons .neon-btn {
        padding: 9px 12px !important;
        font-size: 0.8rem !important;
    }
}

@media (max-width: 380px) {
    #game-container {
        bottom: 108px !important;
        left: 1px !important;
        right: 1px !important;
    }

    .combo-hud {
        bottom: calc(142px + env(safe-area-inset-bottom, 0px)) !important;
        width: 186px !important;
        margin-left: -93px !important;
        padding: 5px 8px 4px !important;
    }

    .combo-text {
        font-size: 0.82rem !important;
        letter-spacing: 1.2px !important;
    }

    .combo-multiplier {
        font-size: 1.9rem !important;
    }

    .combo-timer-container {
        width: 102px !important;
    }

    #chat-panel.chat-in-game,
    #chat-panel.chat-minimized.chat-in-game,
    #chat-panel.chat-in-menu,
    #chat-panel.chat-minimized.chat-in-menu,
    #chat-panel.chat-minimized {
        top: calc(50px + env(safe-area-inset-top, 0px)) !important;
        bottom: auto !important;
    }

    .game-title {
        font-size: 1.45rem !important;
    }

    .title-arcade {
        font-size: 0.95rem !important;
    }

    .subtitle {
        font-size: 0.5rem !important;
        letter-spacing: 2px !important;
        margin-bottom: 10px !important;
    }

    .difficulty-buttons {
        gap: 4px !important;
    }

    .diff-btn {
        padding: 5px 8px !important;
        font-size: 0.58rem !important;
    }

    #start-btn {
        width: 100% !important;
        max-width: 220px !important;
        padding: 9px 10px !important;
        font-size: 0.8rem !important;
    }

    .menu-secondary-buttons {
        flex-wrap: wrap !important;
        justify-content: center !important;
        gap: 6px !important;
    }
}
/* ========================================
   HEADER CHAT DOCK (CANONICAL OVERRIDES)
   ======================================== */
#hud-header-right {
    position: fixed;
    top: calc(10px + env(safe-area-inset-top, 0px));
    right: calc(10px + env(safe-area-inset-right, 0px));
    width: min(78vw, 320px);
    display: flex;
    justify-content: flex-end;
    align-items: flex-start;
    z-index: 130;
    pointer-events: auto;
}

#hud-header-right #chat-panel,
#chat-panel.chat-docked {
    position: relative !important;
    top: auto !important;
    right: auto !important;
    bottom: auto !important;
    left: auto !important;
    width: min(78vw, 320px) !important;
    max-height: min(42vh, 280px) !important;
    border-radius: 14px !important;
    margin: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    z-index: 131 !important;
    transform: none !important;
}

#hud-header-right #chat-panel.hidden,
#chat-panel.chat-docked.hidden {
    display: none !important;
}

#hud-header-right #chat-panel.chat-minimized,
#chat-panel.chat-docked.chat-minimized {
    width: 48px !important;
    height: 48px !important;
    max-height: 48px !important;
    border-radius: 14px !important;
    overflow: hidden !important;
    border: 1px solid rgba(0, 240, 255, 0.6) !important;
    background: linear-gradient(160deg, rgba(14, 24, 36, 0.95), rgba(8, 14, 26, 0.9)) !important;
    box-shadow:
        0 8px 18px rgba(0, 0, 0, 0.45),
        0 0 14px rgba(0, 240, 255, 0.24) !important;
}

#hud-header-right #chat-panel.chat-minimized .chat-header,
#chat-panel.chat-docked.chat-minimized .chat-header {
    width: 100% !important;
    height: 100% !important;
    padding: 0 !important;
    border: none !important;
    background: transparent !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

#hud-header-right #chat-panel.chat-minimized .chat-title,
#chat-panel.chat-docked.chat-minimized .chat-title {
    font-size: 0 !important;
    color: transparent !important;
    text-indent: -9999px !important;
    width: 100% !important;
    height: 100% !important;
    line-height: 0 !important;
}

#hud-header-right #chat-panel.chat-minimized .chat-title::before,
#chat-panel.chat-docked.chat-minimized .chat-title::before {
    content: '\1F4AC' !important;
    text-indent: 0 !important;
    font-size: 20px !important;
    line-height: 1 !important;
    color: #f2feff !important;
    filter: drop-shadow(0 0 8px rgba(0, 240, 255, 0.6)) !important;
}

#hud-header-right #chat-panel.chat-minimized .online-count,
#hud-header-right #chat-panel.chat-minimized .chat-close,
#hud-header-right #chat-panel.chat-minimized .chat-messages,
#hud-header-right #chat-panel.chat-minimized .chat-input-wrapper,
#chat-panel.chat-docked.chat-minimized .online-count,
#chat-panel.chat-docked.chat-minimized .chat-close,
#chat-panel.chat-docked.chat-minimized .chat-messages,
#chat-panel.chat-docked.chat-minimized .chat-input-wrapper {
    display: none !important;
}

#hud-header-right #chat-panel .chat-header,
#chat-panel.chat-docked .chat-header {
    padding: 7px 9px !important;
}

#hud-header-right #chat-panel .chat-title,
#chat-panel.chat-docked .chat-title {
    font-size: 0.62rem !important;
    letter-spacing: 1.1px !important;
}

#hud-header-right #chat-panel .online-count,
#chat-panel.chat-docked .online-count {
    font-size: 0.56rem !important;
}

#hud-header-right #chat-panel .chat-messages,
#chat-panel.chat-docked .chat-messages {
    max-height: min(22vh, 120px) !important;
    padding: 6px !important;
}

#hud-header-right #chat-panel .chat-message,
#chat-panel.chat-docked .chat-message {
    font-size: 0.62rem !important;
    margin-bottom: 3px !important;
    line-height: 1.25 !important;
}

#hud-header-right #chat-panel .chat-input-wrapper,
#chat-panel.chat-docked .chat-input-wrapper {
    padding: 5px 6px !important;
    gap: 5px !important;
}

#hud-header-right #chat-panel .chat-input,
#chat-panel.chat-docked .chat-input {
    font-size: 0.64rem !important;
    padding: 6px 7px !important;
}

#hud-header-right #chat-panel .chat-send,
#chat-panel.chat-docked .chat-send {
    font-size: 0.7rem !important;
    padding: 6px 8px !important;
}

.chat-unread-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    border-radius: 999px;
    background: #ff3f6d;
    color: #fff;
    font-size: 0.58rem;
    font-family: var(--font-display);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, 0.6);
    box-shadow: 0 0 10px rgba(255, 63, 109, 0.45);
    z-index: 132;
    pointer-events: none;
}

@media (max-width: 768px) {
    #hud-header-right {
        top: calc(6px + env(safe-area-inset-top, 0px));
        right: calc(8px + env(safe-area-inset-right, 0px));
        width: min(76vw, 248px);
    }

    #hud-header-right #chat-panel,
    #chat-panel.chat-docked {
        width: min(76vw, 248px) !important;
        max-height: min(34vh, 220px) !important;
    }

    #hud-header-right #chat-panel.chat-minimized,
    #chat-panel.chat-docked.chat-minimized {
        width: 44px !important;
        height: 44px !important;
        max-height: 44px !important;
        border-radius: 12px !important;
    }

    #hud-header-right #chat-panel .chat-messages,
    #chat-panel.chat-docked .chat-messages {
        max-height: min(18vh, 92px) !important;
    }
}
/* ========================================
   PLAYFIELD SCALE OVERRIDES
   ======================================== */
@media (max-width: 768px) {
    #game-container {
        top: 28px !important;
        bottom: 96px !important;
        left: 0 !important;
        right: 0 !important;
    }

    #game-container canvas {
        max-height: calc(100vh - 124px) !important;
        max-width: 100vw !important;
    }

    #mobile-controls {
        padding: 4px 8px !important;
        padding-bottom: calc(4px + env(safe-area-inset-bottom, 6px)) !important;
    }

    .mobile-dock {
        max-width: 340px !important;
        gap: 6px !important;
    }

    .dpad-base {
        width: 106px !important;
        height: 106px !important;
    }

    .dpad-btn {
        width: 34px !important;
        height: 34px !important;
    }

    .dock-btn {
        width: 38px !important;
        height: 38px !important;
    }
}

@media (max-width: 380px) {
    #game-container {
        top: 24px !important;
        bottom: 92px !important;
    }

    #game-container canvas {
        max-height: calc(100vh - 116px) !important;
    }
}
/* ========================================
   MOBILE HUD + COMBO SAFETY OVERRIDES
   ======================================== */
@media (max-width: 768px) {
    #game-hud {
        padding: 0 4px !important;
        z-index: 118 !important;
    }

    .hud-stats-bar {
        margin: 6px auto 0 !important;
        max-width: min(96vw, 350px) !important;
        gap: 6px !important;
        padding: 2px !important;
    }

    .stat-box {
        min-width: 74px !important;
        padding: 6px 8px !important;
        border-radius: 10px !important;
    }

    .stat-box-label {
        font-size: 0.5rem !important;
        letter-spacing: 0.8px !important;
        margin-bottom: 2px !important;
    }

    .stat-box-value {
        font-size: 1.1rem !important;
    }

    #game-container {
        top: 62px !important;
        bottom: 92px !important;
    }

    #game-container canvas {
        max-height: calc(100vh - 154px) !important;
        max-width: 100vw !important;
    }

    .combo-hud {
        bottom: calc(128px + env(safe-area-inset-bottom, 0px)) !important;
        width: 198px !important;
        margin-left: -99px !important;
        padding: 6px 9px 5px !important;
        z-index: 124 !important;
    }

    .combo-text {
        font-size: 0.86rem !important;
        letter-spacing: 1.4px !important;
    }

    .combo-multiplier {
        font-size: 1.95rem !important;
        line-height: 1 !important;
    }

    .combo-timer-container {
        width: 112px !important;
    }
}

@media (max-width: 400px) {
    .hud-stats-bar {
        max-width: 98vw !important;
        gap: 4px !important;
    }

    .stat-box {
        min-width: 66px !important;
        padding: 5px 7px !important;
    }

    .stat-box-label {
        font-size: 0.46rem !important;
    }

    .stat-box-value {
        font-size: 1rem !important;
    }

    #game-container {
        top: 58px !important;
        bottom: 90px !important;
    }

    #game-container canvas {
        max-height: calc(100vh - 148px) !important;
    }

    .combo-hud {
        bottom: calc(120px + env(safe-area-inset-bottom, 0px)) !important;
        width: 182px !important;
        margin-left: -91px !important;
    }

    .combo-text {
        font-size: 0.78rem !important;
    }

    .combo-multiplier {
        font-size: 1.72rem !important;
    }
}
/* ========================================
   FINAL UX REVAMP (DESKTOP + MOBILE)
   ======================================== */
@media (min-width: 769px) {
    #game-container {
        top: 88px !important;
        bottom: 24px !important;
        left: 8px !important;
        right: 8px !important;
    }

    .hud-stats-bar {
        position: fixed !important;
        top: 14px !important;
        left: 50% !important;
        transform: translateX(-50%) !important;
        margin: 0 !important;
        max-width: 760px !important;
        gap: 10px !important;
        padding: 2px !important;
        z-index: 126 !important;
    }

    .stat-box {
        min-width: 116px !important;
        padding: 10px 16px !important;
        border-radius: 12px !important;
    }

    .stat-box-label {
        font-size: 0.64rem !important;
        letter-spacing: 1.4px !important;
        margin-bottom: 4px !important;
    }

    .stat-box-value {
        font-size: 1.7rem !important;
    }

    .combo-hud {
        bottom: 34px !important;
        width: 246px !important;
        margin-left: -123px !important;
    }

    .combo-text {
        font-size: 1.2rem !important;
        letter-spacing: 2px !important;
    }

    .combo-multiplier {
        font-size: 2.6rem !important;
    }
}

@media (max-width: 768px) {
    #game-hud {
        padding: 0 !important;
    }

    .hud-stats-bar {
        position: fixed !important;
        top: calc(8px + env(safe-area-inset-top, 0px)) !important;
        left: 50% !important;
        transform: translateX(-50%) !important;
        margin: 0 !important;
        max-width: min(96vw, 350px) !important;
        gap: 6px !important;
        padding: 2px !important;
        z-index: 126 !important;
    }

    .stat-box {
        min-width: 74px !important;
        padding: 6px 8px !important;
        border-radius: 10px !important;
    }

    .stat-box-label {
        font-size: 0.5rem !important;
        letter-spacing: 0.8px !important;
        margin-bottom: 2px !important;
    }

    .stat-box-value {
        font-size: 1.1rem !important;
        line-height: 1 !important;
    }

    #game-container {
        top: calc(72px + env(safe-area-inset-top, 0px)) !important;
        bottom: calc(118px + env(safe-area-inset-bottom, 0px)) !important;
        left: 0 !important;
        right: 0 !important;
    }

    #game-container canvas {
        max-height: calc(100vh - 190px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)) !important;
        max-width: 100vw !important;
    }

    .combo-hud {
        bottom: calc(138px + env(safe-area-inset-bottom, 0px)) !important;
        width: 194px !important;
        margin-left: -97px !important;
        padding: 6px 8px 5px !important;
        z-index: 124 !important;
    }

    .combo-text {
        font-size: 0.82rem !important;
        letter-spacing: 1.2px !important;
    }

    .combo-multiplier {
        font-size: 1.9rem !important;
    }

    .combo-timer-container {
        width: 108px !important;
    }

    #mobile-controls {
        padding: 5px 10px !important;
        padding-bottom: calc(5px + env(safe-area-inset-bottom, 6px)) !important;
    }

    .mobile-dock {
        max-width: 350px !important;
        gap: 7px !important;
    }

    .dpad-base {
        width: 108px !important;
        height: 108px !important;
    }

    .dpad-btn {
        width: 35px !important;
        height: 35px !important;
    }

    .dock-btn {
        width: 39px !important;
        height: 39px !important;
    }
}

@media (max-width: 400px) {
    .hud-stats-bar {
        max-width: min(98vw, 338px) !important;
        gap: 4px !important;
    }

    .stat-box {
        min-width: 67px !important;
        padding: 5px 7px !important;
    }

    .stat-box-label {
        font-size: 0.46rem !important;
    }

    .stat-box-value {
        font-size: 1rem !important;
    }

    #game-container {
        top: calc(68px + env(safe-area-inset-top, 0px)) !important;
        bottom: calc(112px + env(safe-area-inset-bottom, 0px)) !important;
    }

    #game-container canvas {
        max-height: calc(100vh - 180px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)) !important;
    }

    .combo-hud {
        bottom: calc(132px + env(safe-area-inset-bottom, 0px)) !important;
        width: 178px !important;
        margin-left: -89px !important;
    }

    .combo-text {
        font-size: 0.76rem !important;
    }

    .combo-multiplier {
        font-size: 1.7rem !important;
    }
}

/* ========================================
   UX STABILIZATION LAYER (LATEST)
   ======================================== */
.ai-mode-indicator {
    display: none !important;
}

#chat-toggle {
    display: none !important;
}

#sound-btn {
    position: relative;
}

#sound-btn.is-muted {
    border-color: rgba(255, 106, 106, 0.7) !important;
    box-shadow:
        0 0 0 1px rgba(255, 106, 106, 0.35),
        0 0 14px rgba(255, 106, 106, 0.35) !important;
}

#sound-btn.is-muted svg {
    opacity: 0.42;
    filter: grayscale(1);
}

#sound-btn.is-muted::after {
    content: '';
    position: absolute;
    width: 22px;
    height: 2px;
    background: rgba(255, 120, 120, 0.92);
    transform: rotate(-38deg);
    border-radius: 2px;
}

@media (min-width: 769px) {
    #game-container {
        top: 86px !important;
        right: 0 !important;
        bottom: 12px !important;
        left: 0 !important;
    }

    #game-container canvas {
        max-height: calc(100vh - 102px) !important;
        max-width: calc(100vw - 24px) !important;
    }

    #live-leaderboard {
        top: 92px !important;
        right: auto !important;
        left: 16px !important;
        width: min(360px, 32vw) !important;
        max-height: min(64vh, 560px) !important;
        z-index: 120 !important;
    }

    #live-leaderboard .lb-list {
        max-height: min(58vh, 500px) !important;
    }

    #hud-header-right {
        top: calc(12px + env(safe-area-inset-top, 0px)) !important;
        right: calc(14px + env(safe-area-inset-right, 0px)) !important;
        width: min(320px, 26vw) !important;
        z-index: 132 !important;
    }

    .combo-hud {
        bottom: 18px !important;
        width: 264px !important;
        margin-left: -132px !important;
        z-index: 122 !important;
    }
}

@media (max-width: 1024px) {
    #live-leaderboard {
        display: none !important;
    }
}

@media (max-width: 768px) {
    #game-hud {
        padding: 0 !important;
        z-index: 126 !important;
    }

    .hud-stats-bar {
        top: calc(8px + env(safe-area-inset-top, 0px)) !important;
        max-width: min(96vw, 334px) !important;
        gap: 4px !important;
        padding: 2px !important;
    }

    .stat-box {
        min-width: 66px !important;
        padding: 5px 7px !important;
        border-radius: 9px !important;
    }

    .stat-box-label {
        font-size: 0.46rem !important;
        letter-spacing: 0.7px !important;
        margin-bottom: 2px !important;
    }

    .stat-box-value {
        font-size: 0.98rem !important;
        line-height: 1 !important;
    }

    #game-container {
        top: calc(64px + env(safe-area-inset-top, 0px)) !important;
        right: 0 !important;
        bottom: calc(118px + env(safe-area-inset-bottom, 0px)) !important;
        left: 0 !important;
    }

    #game-container canvas {
        max-height: calc(100vh - 184px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)) !important;
        max-width: 100vw !important;
    }

    #hud-header-right {
        top: calc(8px + env(safe-area-inset-top, 0px)) !important;
        right: calc(8px + env(safe-area-inset-right, 0px)) !important;
        width: min(80vw, 250px) !important;
        z-index: 132 !important;
    }

    #hud-header-right #chat-panel,
    #chat-panel.chat-docked {
        width: min(80vw, 250px) !important;
        max-height: min(32vh, 220px) !important;
    }

    #hud-header-right #chat-panel.chat-minimized,
    #chat-panel.chat-docked.chat-minimized {
        width: 44px !important;
        height: 44px !important;
        max-height: 44px !important;
    }

    .combo-hud {
        bottom: calc(158px + env(safe-area-inset-bottom, 0px)) !important;
        width: 176px !important;
        margin-left: -88px !important;
        padding: 5px 7px 4px !important;
        z-index: 124 !important;
    }

    .combo-text {
        font-size: 0.76rem !important;
        letter-spacing: 1.1px !important;
    }

    .combo-multiplier {
        font-size: 1.64rem !important;
    }

    .combo-timer-container {
        width: 102px !important;
        margin-top: 6px !important;
    }

    #mobile-controls {
        padding: 6px 10px !important;
        padding-bottom: calc(6px + env(safe-area-inset-bottom, 6px)) !important;
    }

    .mobile-dock {
        max-width: 344px !important;
        gap: 6px !important;
    }

    .dpad-base {
        width: 104px !important;
        height: 104px !important;
    }

    .dpad-btn {
        width: 34px !important;
        height: 34px !important;
    }

    .dock-btn {
        width: 38px !important;
        height: 38px !important;
    }
}

@media (max-width: 400px) {
    #game-container {
        top: calc(62px + env(safe-area-inset-top, 0px)) !important;
        bottom: calc(110px + env(safe-area-inset-bottom, 0px)) !important;
    }

    #game-container canvas {
        max-height: calc(100vh - 172px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)) !important;
    }

    .combo-hud {
        bottom: calc(150px + env(safe-area-inset-bottom, 0px)) !important;
        width: 166px !important;
        margin-left: -83px !important;
    }

    .combo-text {
        font-size: 0.72rem !important;
    }

    .combo-multiplier {
        font-size: 1.55rem !important;
    }
}

/* ========================================
   CONTROL FEEDBACK + CHAT ICON REFINEMENT
   ======================================== */
@keyframes direction-pulse {
    from {
        box-shadow:
            0 0 0 rgba(0, 240, 255, 0),
            0 0 10px rgba(0, 240, 255, 0.2);
    }

    to {
        box-shadow:
            0 0 0 1px rgba(0, 240, 255, 0.55),
            0 0 18px rgba(0, 240, 255, 0.55);
    }
}

.dpad-btn.direction-active {
    background: linear-gradient(145deg,
            rgba(0, 196, 255, 0.74) 0%,
            rgba(0, 132, 196, 0.84) 100%) !important;
    border-color: rgba(0, 248, 255, 0.95) !important;
    color: #f3feff !important;
    animation: direction-pulse 0.34s ease-in-out infinite alternate;
}

.dpad-btn.direction-active svg {
    filter: drop-shadow(0 0 7px rgba(255, 255, 255, 0.65));
}

#hud-header-right #chat-panel.chat-minimized .chat-title::before,
#chat-panel.chat-docked.chat-minimized .chat-title::before {
    content: '' !important;
    display: block !important;
    width: 20px !important;
    height: 20px !important;
    background-repeat: no-repeat !important;
    background-position: center !important;
    background-size: contain !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23EFFFFF' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 14a4 4 0 0 1-4 4H9l-5 4v-4a4 4 0 0 1-4-4V8a4 4 0 0 1 4-4h12a4 4 0 0 1 4 4z'/%3E%3Cpath d='M8 10h8'/%3E%3Cpath d='M8 14h5'/%3E%3C/svg%3E") !important;
    filter: drop-shadow(0 0 8px rgba(0, 240, 255, 0.58)) !important;
}

@media (max-width: 768px) {
    .hud-stats-bar {
        max-width: min(98vw, 388px) !important;
        flex-wrap: nowrap !important;
        gap: 4px !important;
    }

    .stat-box {
        min-width: 62px !important;
    }
}

@media (max-width: 400px) {
    .hud-stats-bar {
        max-width: min(99vw, 360px) !important;
    }

    .stat-box {
        min-width: 56px !important;
        padding: 4px 6px !important;
    }
}

/* ========================================
   FINAL HEADER + CONTROLS REFINEMENT
   ======================================== */
#hud-header-right {
    display: flex !important;
    gap: 8px !important;
    align-items: flex-start !important;
    justify-content: flex-end !important;
    width: auto !important;
    max-width: none !important;
}

.logout-profile-btn {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    border: 1px solid rgba(0, 240, 255, 0.55);
    background: linear-gradient(160deg, rgba(10, 18, 30, 0.94), rgba(8, 13, 24, 0.9));
    color: #e8feff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.45), 0 0 12px rgba(0, 240, 255, 0.22);
    cursor: pointer;
    transition: transform 0.14s ease, box-shadow 0.14s ease, border-color 0.14s ease;
    z-index: 134;
}

.logout-profile-btn:hover {
    transform: translateY(-1px);
    border-color: rgba(0, 255, 136, 0.9);
    box-shadow: 0 10px 22px rgba(0, 0, 0, 0.5), 0 0 14px rgba(0, 255, 136, 0.3);
}

.logout-profile-btn .profile-initial {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: rgba(0, 240, 255, 0.16);
    border: 1px solid rgba(0, 240, 255, 0.35);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-display);
    font-size: 0.72rem;
    letter-spacing: 0.4px;
}

.logout-profile-btn .logout-icon {
    position: absolute;
    right: 2px;
    bottom: 1px;
    width: 12px;
    height: 12px;
    opacity: 0.88;
}

#hud-header-right #chat-panel.chat-minimized,
#chat-panel.chat-docked.chat-minimized {
    width: 42px !important;
    height: 42px !important;
    max-height: 42px !important;
}

#hud-header-right #chat-panel.chat-minimized .chat-title::before,
#chat-panel.chat-docked.chat-minimized .chat-title::before {
    width: 18px !important;
    height: 18px !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23EFFFFF' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 6.5A3.5 3.5 0 0 1 6.5 3h11A3.5 3.5 0 0 1 21 6.5v6A3.5 3.5 0 0 1 17.5 16H9l-4 4v-4.1A3.5 3.5 0 0 1 3 12.5z'/%3E%3Cpath d='M8 8.5h8'/%3E%3Cpath d='M8 12h5'/%3E%3C/svg%3E") !important;
}

@media (min-width: 769px) {
    #game-hud .hud-stats-bar {
        left: 12px !important;
        right: 128px !important;
        width: auto !important;
        max-width: none !important;
        transform: none !important;
        justify-content: flex-start !important;
        gap: 8px !important;
    }

    #game-hud .stat-box {
        min-width: 106px !important;
        padding: 9px 12px !important;
    }

    .combo-hud {
        bottom: 20px !important;
        width: 208px !important;
        margin-left: -104px !important;
        padding: 5px 8px 4px !important;
    }

    .combo-text {
        font-size: 0.98rem !important;
        letter-spacing: 1.5px !important;
    }

    .combo-multiplier {
        font-size: 2.1rem !important;
    }
}

@media (max-width: 768px) {
    #game-hud .hud-stats-bar {
        left: 6px !important;
        right: 58px !important;
        width: auto !important;
        max-width: none !important;
        transform: none !important;
        justify-content: flex-start !important;
        flex-wrap: nowrap !important;
        gap: 3px !important;
    }

    #game-hud .stat-box {
        min-width: 56px !important;
        padding: 4px 6px !important;
    }

    #game-hud .stat-box-label {
        font-size: 0.42rem !important;
        letter-spacing: 0.55px !important;
    }

    #game-hud .stat-box-value {
        font-size: 0.92rem !important;
    }

    .combo-hud {
        bottom: calc(172px + env(safe-area-inset-bottom, 0px)) !important;
        width: 148px !important;
        margin-left: -74px !important;
        padding: 4px 6px 3px !important;
    }

    .combo-text {
        font-size: 0.62rem !important;
        letter-spacing: 0.9px !important;
    }

    .combo-multiplier {
        font-size: 1.34rem !important;
    }

    .combo-timer-container {
        width: 86px !important;
        margin-top: 4px !important;
        height: 5px !important;
    }
}

/* Circular remote style to match requested controller look */
#mobile-controls .dpad-base {
    width: 126px !important;
    height: 126px !important;
    border-radius: 50% !important;
    border: 12px solid #9a9a9a !important;
    background: #e4e4e4 !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.32), inset 0 0 0 1px rgba(255, 255, 255, 0.48) !important;
}

#mobile-controls .dpad-base::before,
#mobile-controls .dpad-base::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    width: 84px;
    height: 3px;
    margin-left: -42px;
    margin-top: -1.5px;
    background: #9c9c9c;
    z-index: 0;
}

#mobile-controls .dpad-base::before {
    transform: rotate(45deg);
}

#mobile-controls .dpad-base::after {
    transform: rotate(-45deg);
}

#mobile-controls .dpad-btn {
    width: 44px !important;
    height: 44px !important;
    border: none !important;
    border-radius: 50% !important;
    background: transparent !important;
    box-shadow: none !important;
    color: #878787 !important;
    z-index: 2;
}

#mobile-controls .dpad-btn svg {
    width: 18px !important;
    height: 18px !important;
}

#mobile-controls .dpad-btn:active {
    color: #4f4f4f !important;
}

#mobile-controls .dpad-btn.direction-active {
    color: #3f3f3f !important;
    animation: none !important;
    box-shadow: none !important;
}

#mobile-controls .dpad-center {
    width: 56px !important;
    height: 56px !important;
    border-radius: 50% !important;
    background: #9a9a9a !important;
    border: 2px solid #8a8a8a !important;
    z-index: 3;
}

#mobile-controls .dpad-center::before {
    content: 'enter';
    color: #f0f0f0;
    font-family: var(--font-body);
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.3px;
}

/* ========================================
   HOTFIX: COMBO + CHAT HEAD + REMOTE PAD
   ======================================== */
.chat-head-icon {
    display: none;
    width: 18px;
    height: 18px;
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23EFFFFF' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 6.5A3.5 3.5 0 0 1 6.5 3h11A3.5 3.5 0 0 1 21 6.5v6A3.5 3.5 0 0 1 17.5 16H9l-4 4v-4.1A3.5 3.5 0 0 1 3 12.5z'/%3E%3Cpath d='M8 8.5h8'/%3E%3Cpath d='M8 12h5'/%3E%3C/svg%3E");
}

#hud-header-right #chat-panel.chat-minimized .chat-head-icon,
#chat-panel.chat-docked.chat-minimized .chat-head-icon {
    display: inline-block !important;
    filter: drop-shadow(0 0 8px rgba(0, 240, 255, 0.6)) !important;
}

#hud-header-right #chat-panel.chat-minimized .chat-title::before,
#chat-panel.chat-docked.chat-minimized .chat-title::before {
    content: none !important;
}

@media (min-width: 769px) {
    #game-hud .hud-stats-bar {
        left: 12px !important;
        right: 118px !important;
        width: auto !important;
        max-width: none !important;
        transform: none !important;
        justify-content: flex-start !important;
    }

    .combo-hud {
        width: 188px !important;
        margin-left: -94px !important;
        padding: 4px 6px 3px !important;
    }

    .combo-text {
        font-size: 0.84rem !important;
        letter-spacing: 1.2px !important;
    }

    .combo-multiplier {
        font-size: 1.72rem !important;
    }
}

@media (max-width: 768px) {
    #game-hud .hud-stats-bar {
        left: 6px !important;
        right: 98px !important;
        width: auto !important;
        max-width: none !important;
        transform: none !important;
        justify-content: flex-start !important;
        gap: 3px !important;
        padding: 2px !important;
    }

    #game-hud .stat-box {
        min-width: 54px !important;
        padding: 4px 5px !important;
    }

    #game-hud .stat-box-label {
        font-size: 0.4rem !important;
        letter-spacing: 0.45px !important;
    }

    #game-hud .stat-box-value {
        font-size: 0.88rem !important;
    }

    #hud-header-right {
        top: calc(8px + env(safe-area-inset-top, 0px)) !important;
        right: calc(8px + env(safe-area-inset-right, 0px)) !important;
        gap: 6px !important;
    }

    #hud-header-right #chat-panel.chat-minimized,
    #chat-panel.chat-docked.chat-minimized,
    .logout-profile-btn {
        width: 38px !important;
        height: 38px !important;
        max-height: 38px !important;
        border-radius: 10px !important;
    }

    .logout-profile-btn .profile-initial {
        width: 19px !important;
        height: 19px !important;
        font-size: 0.62rem !important;
    }

    .combo-hud {
        width: 138px !important;
        margin-left: -69px !important;
        padding: 3px 5px 3px !important;
        z-index: 124 !important;
    }

    .combo-text {
        font-size: 0.56rem !important;
        letter-spacing: 0.75px !important;
    }

    .combo-multiplier {
        font-size: 1.2rem !important;
        line-height: 1 !important;
    }

    .combo-timer-container {
        width: 76px !important;
        height: 4px !important;
        margin-top: 3px !important;
    }

    #mobile-controls .dpad-base {
        width: 140px !important;
        height: 140px !important;
        border: 12px solid #9b9b9b !important;
        background: #dcdcdc !important;
        box-shadow:
            0 8px 20px rgba(0, 0, 0, 0.32),
            inset 0 0 0 1px rgba(255, 255, 255, 0.4) !important;
    }

    #mobile-controls .dpad-btn {
        inset: 12px !important;
        width: auto !important;
        height: auto !important;
        border: none !important;
        border-radius: 50% !important;
        background: #e9e9e9 !important;
        color: #8a8a8a !important;
        box-shadow: none !important;
    }

    #mobile-controls .dpad-up {
        clip-path: polygon(50% 4%, 86% 36%, 64% 56%, 36% 56%, 14% 36%) !important;
    }

    #mobile-controls .dpad-right {
        clip-path: polygon(96% 50%, 64% 14%, 44% 36%, 44% 64%, 64% 86%) !important;
    }

    #mobile-controls .dpad-down {
        clip-path: polygon(50% 96%, 86% 64%, 64% 44%, 36% 44%, 14% 64%) !important;
    }

    #mobile-controls .dpad-left {
        clip-path: polygon(4% 50%, 36% 14%, 56% 36%, 56% 64%, 36% 86%) !important;
    }

    #mobile-controls .dpad-up svg {
        transform: translateY(-24px) !important;
    }

    #mobile-controls .dpad-right svg {
        transform: translateX(24px) !important;
    }

    #mobile-controls .dpad-down svg {
        transform: translateY(24px) !important;
    }

    #mobile-controls .dpad-left svg {
        transform: translateX(-24px) !important;
    }

    #mobile-controls .dpad-btn.direction-active {
        background: #ffffff !important;
        color: #5f5f5f !important;
        box-shadow: inset 0 0 0 2px #b9b9b9 !important;
    }

    #mobile-controls .dpad-center {
        width: 70px !important;
        height: 70px !important;
        background: #9f9f9f !important;
        border: 2px solid #8f8f8f !important;
        pointer-events: none !important;
    }

    #mobile-controls .dpad-center::before {
        content: 'enter' !important;
        color: #f4f4f4 !important;
        font-size: 0.9rem !important;
        letter-spacing: 0.2px !important;
        text-transform: lowercase !important;
    }
}

/* ========================================
   FINAL D-PAD LAYOUT FIX (DO NOT OVERRIDE)
   ======================================== */
#mobile-controls .dpad-base {
    position: relative !important;
    width: 132px !important;
    height: 132px !important;
    border-radius: 50% !important;
    border: 11px solid #9a9a9a !important;
    background: #e3e3e3 !important;
    box-shadow:
        0 10px 22px rgba(0, 0, 0, 0.35),
        inset 0 0 0 1px rgba(255, 255, 255, 0.45) !important;
}

#mobile-controls .dpad-btn {
    position: absolute !important;
    inset: auto !important;
    clip-path: none !important;
    width: 42px !important;
    height: 42px !important;
    border-radius: 12px !important;
    border: 2px solid transparent !important;
    background: transparent !important;
    color: #8a8a8a !important;
    box-shadow: none !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    z-index: 3 !important;
}

#mobile-controls .dpad-btn svg {
    width: 20px !important;
    height: 20px !important;
    transform: none !important;
}

#mobile-controls .dpad-up {
    top: 8px !important;
    left: 50% !important;
    right: auto !important;
    bottom: auto !important;
    transform: translateX(-50%) !important;
}

#mobile-controls .dpad-down {
    bottom: 8px !important;
    left: 50% !important;
    right: auto !important;
    top: auto !important;
    transform: translateX(-50%) !important;
}

#mobile-controls .dpad-left {
    left: 8px !important;
    top: 50% !important;
    right: auto !important;
    bottom: auto !important;
    transform: translateY(-50%) !important;
}

#mobile-controls .dpad-right {
    right: 8px !important;
    top: 50% !important;
    left: auto !important;
    bottom: auto !important;
    transform: translateY(-50%) !important;
}

#mobile-controls .dpad-btn:active,
#mobile-controls .dpad-btn.direction-active {
    background: #f5f5f5 !important;
    color: #5c5c5c !important;
    border-color: #b6b6b6 !important;
    box-shadow: 0 0 0 1px rgba(160, 160, 160, 0.42) inset !important;
}

#mobile-controls .dpad-center {
    width: 62px !important;
    height: 62px !important;
    border-radius: 50% !important;
    background: #9f9f9f !important;
    border: 2px solid #8d8d8d !important;
    z-index: 2 !important;
}

#mobile-controls .dpad-center::before {
    content: '' !important;
    display: none !important;
}

/* ========================================
   FINAL CHAT HEAD ICON FIX
   ======================================== */
#hud-header-right #chat-panel.chat-minimized .chat-header,
#chat-panel.chat-docked.chat-minimized .chat-header {
    display: grid !important;
    place-items: center !important;
    position: relative !important;
}

#hud-header-right #chat-panel.chat-minimized .chat-title,
#chat-panel.chat-docked.chat-minimized .chat-title {
    display: none !important;
}

#hud-header-right #chat-panel.chat-minimized .chat-title::before,
#chat-panel.chat-docked.chat-minimized .chat-title::before {
    content: none !important;
}

#hud-header-right #chat-panel.chat-minimized .chat-head-icon,
#chat-panel.chat-docked.chat-minimized .chat-head-icon {
    display: block !important;
    width: 20px !important;
    height: 20px !important;
    margin: 0 !important;
    position: static !important;
    filter: drop-shadow(0 0 8px rgba(0, 240, 255, 0.65)) !important;
}

.logout-profile-btn .logout-icon {
    opacity: 0 !important;
    transform: translateY(2px) !important;
    transition: opacity 0.12s ease, transform 0.12s ease !important;
}

.logout-profile-btn:hover .logout-icon,
.logout-profile-btn:focus-visible .logout-icon {
    opacity: 0.9 !important;
    transform: translateY(0) !important;
}

/* ========================================
   FINAL HEADER STACK + BADGE FIX
   ======================================== */
#hud-header-right {
    display: flex !important;
    align-items: flex-start !important;
    justify-content: flex-end !important;
    gap: 8px !important;
}

#hud-chat-stack {
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-end !important;
    justify-content: flex-start !important;
    gap: 6px !important;
}

#header-leaderboard-btn.header-quick-btn {
    width: 42px !important;
    height: 42px !important;
    border-radius: 12px !important;
    border: 1px solid rgba(0, 240, 255, 0.55) !important;
    background: linear-gradient(160deg, rgba(10, 18, 30, 0.94), rgba(8, 13, 24, 0.9)) !important;
    color: #e8feff !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-shadow:
        0 8px 20px rgba(0, 0, 0, 0.42),
        0 0 12px rgba(0, 240, 255, 0.2) !important;
    cursor: pointer !important;
    transition: transform 0.14s ease, box-shadow 0.14s ease, border-color 0.14s ease !important;
}

#header-leaderboard-btn.header-quick-btn:hover {
    transform: translateY(-1px) !important;
    border-color: rgba(255, 215, 0, 0.9) !important;
    box-shadow:
        0 10px 24px rgba(0, 0, 0, 0.48),
        0 0 14px rgba(255, 215, 0, 0.26) !important;
}

#header-leaderboard-btn.header-quick-btn svg {
    width: 18px !important;
    height: 18px !important;
}

#hud-header-right #chat-panel #chat-unread-badge,
#chat-panel.chat-docked #chat-unread-badge {
    top: 3px !important;
    right: 3px !important;
    min-width: 16px !important;
    height: 16px !important;
    padding: 0 4px !important;
    border-radius: 999px !important;
    font-size: 0.52rem !important;
    line-height: 1 !important;
    z-index: 140 !important;
}

@media (max-width: 768px) {
    #hud-chat-stack {
        gap: 5px !important;
    }

    #header-leaderboard-btn.header-quick-btn {
        width: 38px !important;
        height: 38px !important;
        border-radius: 10px !important;
    }

    #header-leaderboard-btn.header-quick-btn svg {
        width: 16px !important;
        height: 16px !important;
    }
}
