@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700&family=Press+Start+2P&display=swap');

/*
 * CYBERPUNK SNAKE - Mobile-First CSS
 * 
 * This CSS follows mobile-first responsive design principles:
 * 1. Base styles are optimized for mobile devices (small screens)
 * 2. Progressive enhancement for larger screens using min-width media queries
 * 3. Mobile-optimized colors, spacing, and touch targets
 * 4. Desktop enhancements added progressively
 * 
 * Breakpoints:
 * - Mobile: 0px - 768px (base styles)
 * - Desktop: 769px+ (enhanced styles)
 * - Large Desktop: 1200px+ (premium styles)
 */
:root {
    --primary-cyan: #00ffff;    /* Mobile-first: bright neon cyan */
    --primary-yellow: #ffff00;  /* Mobile-first: bright neon yellow */
    --primary-pink: #ff0080;    /* Mobile-first: bright neon pink */
    --primary-green: #00ff80;   /* Mobile-first: bright neon green */
    --primary-red: #ff0040;     /* Mobile-first: bright neon red */
    --dark-bg: #0a0a1a;
    --darker-bg: #050510;
    --grid-size: 20px;
    --desktop-cyan: #00ffff;    /* Desktop: same bright colors */
    --desktop-yellow: #ffff00;  /* Desktop: same bright colors */
    --desktop-pink: #ff0080;    /* Desktop: same bright colors */
    --desktop-green: #00ff80;   /* Desktop: same bright colors */
    --desktop-red: #ff0040;     /* Desktop: same bright colors */
}

* {
    box-sizing: border-box;
}

html {
    overflow: hidden;
    height: 100%;
    width: 100%;
}

body {
    font-family: 'Orbitron', sans-serif;
    background: linear-gradient(135deg, var(--dark-bg) 0%, #0f0f2a 25%, #1a1a3a 50%, #0f0f2a 75%, var(--dark-bg) 100%);
    color: var(--primary-cyan);
    overflow: hidden;
    position: relative;
    margin: 0;
    padding: 10px; /* Mobile-first: smaller padding */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    height: 100vh;
    width: 100vw;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 20% 80%, rgba(0, 255, 255, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(255, 255, 0, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 40% 40%, rgba(0, 150, 255, 0.05) 0%, transparent 50%);
    pointer-events: none;
    z-index: -1;
}

/* Mobile-first container sizing */
.game-container {
    position: relative;
    border: 2px solid var(--primary-cyan); /* Mobile-first: thinner border */
    box-shadow: 
        0 0 15px var(--primary-cyan), 
        inset 0 0 15px var(--primary-cyan),
        0 0 30px rgba(0, 230, 230, 0.3);
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    margin: 5px; /* Mobile-first: smaller margin */
    max-width: 98vw; /* Mobile-first: use more viewport width */
    max-height: 70vh; /* Mobile-first: use more viewport height */
    overflow: hidden;
}

.game-container::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(45deg, var(--primary-cyan), #0080ff, var(--primary-yellow), var(--primary-cyan));
    background-size: 400% 400%;
    animation: borderGlow 3s ease-in-out infinite;
    z-index: -1;
    border-radius: 2px;
}

@keyframes borderGlow {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

/* Mobile-responsive canvas */
#game-canvas {
    background: radial-gradient(circle at center, rgba(0, 20, 40, 0.8) 0%, rgba(0, 0, 0, 0.95) 100%);
    width: 100%;
    height: 100%;
    display: block;
}

/* Mobile-optimized game overlays */
.game-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 10, 26, 0.95);
    backdrop-filter: blur(15px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 10;
    border: 1px solid rgba(0, 255, 255, 0.3);
    padding: 20px;
    text-align: center;
}

.pixel {
    position: absolute;
    border-radius: 2px;
}

.snake {
    background: linear-gradient(135deg, #00ffff, #0080ff);
    box-shadow: 0 0 15px #00ffff;
    z-index: 2;
}

.food {
    background: radial-gradient(circle, #ffff00, #ffaa00);
    box-shadow: 0 0 20px #ffff00, 0 0 40px rgba(255, 255, 0, 0.5);
    border-radius: 50%;
    z-index: 1;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { transform: scale(0.95); opacity: 0.8; box-shadow: 0 0 20px #ffff00, 0 0 40px rgba(255, 255, 0, 0.5); }
    50% { transform: scale(1.1); opacity: 1; box-shadow: 0 0 30px #ffff00, 0 0 60px rgba(255, 255, 0, 0.8); }
    100% { transform: scale(0.95); opacity: 0.8; box-shadow: 0 0 20px #ffff00, 0 0 40px rgba(255, 255, 0, 0.5); }
}

.glitch {
    text-shadow: 
        2px 2px 0 var(--primary-cyan), 
        -2px -2px 0 var(--primary-yellow),
        4px 4px 0 rgba(0, 255, 255, 0.5);
    animation: glitch 2s infinite;
    color: var(--primary-cyan);
    position: relative;
}

.glitch::before,
.glitch::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0.8;
}

.glitch::before {
    animation: glitch-1 0.4s infinite;
    color: #ff0080;
    z-index: -1;
    clip: rect(44px, 450px, 56px, 0);
}

.glitch::after {
    animation: glitch-2 0.4s infinite;
    color: #00ff80;
    z-index: -2;
    clip: rect(44px, 450px, 56px, 0);
}

@keyframes glitch-1 {
    0% { clip: rect(20px, 450px, 30px, 0); }
    20% { clip: rect(40px, 450px, 50px, 0); }
    40% { clip: rect(10px, 450px, 20px, 0); }
    60% { clip: rect(60px, 450px, 70px, 0); }
    80% { clip: rect(25px, 450px, 35px, 0); }
    100% { clip: rect(20px, 450px, 30px, 0); }
}

@keyframes glitch-2 {
    0% { clip: rect(60px, 450px, 70px, 0); }
    20% { clip: rect(10px, 450px, 20px, 0); }
    40% { clip: rect(40px, 450px, 50px, 0); }
    60% { clip: rect(20px, 450px, 30px, 0); }
    80% { clip: rect(50px, 450px, 60px, 0); }
    100% { clip: rect(60px, 450px, 70px, 0); }
}

@keyframes glitch {
    0% { 
        text-shadow: 2px 2px 0 #00ffff, -2px -2px 0 #ffff00, 4px 4px 0 rgba(0, 255, 255, 0.5);
        transform: translate(0);
    }
    25% { 
        text-shadow: -2px -2px 0 #00ffff, 2px 2px 0 #ffff00, -4px -4px 0 rgba(0, 255, 255, 0.5);
        transform: translate(-2px, 1px);
    }
    50% { 
        text-shadow: 2px -2px 0 #00ffff, -2px 2px 0 #ffff00, 4px -4px 0 rgba(0, 255, 255, 0.5);
        transform: translate(1px, -1px);
    }
    75% { 
        text-shadow: -2px 2px 0 #00ffff, 2px -2px 0 #ffff00, -4px 4px 0 rgba(0, 255, 255, 0.5);
        transform: translate(-1px, 2px);
    }
    100% { 
        text-shadow: 2px 2px 0 #00ffff, -2px -2px 0 #ffff00, 4px 4px 0 rgba(0, 255, 255, 0.5);
        transform: translate(0);
    }
}

.scanline {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        to bottom,
        transparent 0%,
        rgba(0, 255, 255, 0.1) 50%,
        transparent 100%
    );
    background-size: 100% 8px;
    pointer-events: none;
    z-index: 3;
    animation: scan 4s linear infinite;
}

@keyframes scan {
    0% { background-position: 0 0; }
    100% { background-position: 0 100%; }
}

.grid-line {
    position: absolute;
    background: rgba(0, 255, 255, 0.1);
    pointer-events: none;
}

.terminal-text {
    color: var(--primary-cyan);
    text-shadow: 0 0 8px var(--primary-cyan), 0 0 16px rgba(0, 255, 255, 0.5);
    font-weight: 700;
    position: relative;
}

.terminal-text::before {
    content: '>';
    color: #ffff00;
    margin-right: 8px;
    animation: blink 1s infinite;
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

/* Mobile-first button styles */
button {
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    background: transparent;
    border: 2px solid;
    font-family: 'Orbitron', sans-serif;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: clamp(8px, 2vw, 12px) clamp(16px, 4vw, 24px); /* Mobile-first: smaller padding */
    font-size: clamp(0.7rem, 2.5vw, 1rem); /* Mobile-first: smaller font */
    min-height: 36px; /* Mobile-first: smaller height */
    cursor: pointer;
    border-radius: 4px;
    text-align: center;
    white-space: nowrap;
    text-overflow: ellipsis;
}

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

button:hover::before {
    left: 100%;
}

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

/* Mobile-optimized button colors with neon glow */
#start-btn {
    border-color: var(--primary-pink);
    color: var(--primary-pink);
    box-shadow: 0 0 15px rgba(255, 0, 128, 0.5);
}

#start-btn:hover {
    background: rgba(255, 0, 128, 0.1);
    box-shadow: 0 0 25px rgba(255, 0, 128, 0.8);
}

#restart-btn {
    border-color: var(--primary-cyan);
    color: var(--primary-cyan);
    box-shadow: 0 0 15px rgba(0, 255, 255, 0.5);
}

#restart-btn:hover {
    background: rgba(0, 255, 255, 0.1);
    box-shadow: 0 0 25px rgba(0, 255, 255, 0.8);
}

#leaderboard-btn, #game-over-leaderboard-btn {
    border-color: var(--primary-cyan);
    color: var(--primary-cyan);
    box-shadow: 0 0 15px rgba(0, 255, 255, 0.5);
}

#leaderboard-btn:hover, #game-over-leaderboard-btn:hover {
    background: rgba(0, 255, 255, 0.1);
    box-shadow: 0 0 25px rgba(0, 255, 255, 0.8);
}

#save-score-btn {
    border-color: var(--primary-green);
    color: var(--primary-green);
    box-shadow: 0 0 15px rgba(0, 255, 128, 0.5);
}

#save-score-btn:hover {
    background: rgba(0, 255, 128, 0.1);
    box-shadow: 0 0 25px rgba(0, 255, 128, 0.8);
}

#skip-score-btn {
    border-color: #888;
    color: #888;
    box-shadow: 0 0 15px rgba(136, 136, 136, 0.5);
}

#skip-score-btn:hover {
    background: rgba(136, 136, 136, 0.1);
    box-shadow: 0 0 25px rgba(136, 136, 136, 0.8);
}

#back-btn {
    border-color: var(--primary-green);
    color: var(--primary-green);
    box-shadow: 0 0 15px rgba(0, 255, 128, 0.5);
}

#back-btn:hover {
    background: rgba(0, 255, 128, 0.1);
    box-shadow: 0 0 25px rgba(0, 255, 128, 0.8);
}

/* Additional cyberpunk elements */
.cyber-grid {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        linear-gradient(rgba(0, 255, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 255, 255, 0.03) 1px, transparent 1px);
    background-size: 50px 50px;
    pointer-events: none;
    z-index: -2;
    animation: gridMove 20s linear infinite;
}

.cyber-grid::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        linear-gradient(rgba(0, 255, 255, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 255, 255, 0.05) 1px, transparent 1px);
    background-size: 100px 100px;
    animation: gridMove 15s linear infinite reverse;
}

.cyber-grid::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        linear-gradient(rgba(255, 255, 0, 0.02) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 0, 0.02) 1px, transparent 1px);
    background-size: 75px 75px;
    animation: gridMove 25s linear infinite;
}

@keyframes gridMove {
    0% { 
        background-position: 0 0;
        opacity: 0.3;
    }
    25% { 
        opacity: 0.6;
    }
    50% { 
        background-position: 50px 50px;
        opacity: 0.8;
    }
    75% { 
        opacity: 0.6;
    }
    100% { 
        background-position: 100px 100px;
        opacity: 0.3;
    }
}

/* Moving light beams */
.light-beam {
    position: fixed;
    width: 2px;
    height: 100%;
    background: linear-gradient(to bottom, transparent, rgba(0, 255, 255, 0.8), transparent);
    pointer-events: none;
    z-index: -1;
    animation: lightSweep 8s linear infinite;
}

.light-beam:nth-child(1) {
    left: 10%;
    animation-delay: 0s;
    animation-duration: 12s;
}

.light-beam:nth-child(2) {
    left: 30%;
    animation-delay: 3s;
    animation-duration: 10s;
}

.light-beam:nth-child(3) {
    left: 50%;
    animation-delay: 6s;
    animation-duration: 14s;
}

.light-beam:nth-child(4) {
    left: 70%;
    animation-delay: 9s;
    animation-duration: 11s;
}

.light-beam:nth-child(5) {
    left: 90%;
    animation-delay: 12s;
    animation-duration: 13s;
}

@keyframes lightSweep {
    0% {
        opacity: 0;
        transform: translateY(-100%);
    }
    10% {
        opacity: 0.8;
    }
    90% {
        opacity: 0.8;
    }
    100% {
        opacity: 0;
        transform: translateY(100%);
    }
}

/* Pulsing grid nodes */
.grid-node {
    position: fixed;
    width: 4px;
    height: 4px;
    background: #00ffff;
    border-radius: 50%;
    pointer-events: none;
    z-index: -1;
    animation: nodePulse 4s ease-in-out infinite;
}

.grid-node:nth-child(6) {
    top: 20%;
    left: 15%;
    animation-delay: 0s;
}

.grid-node:nth-child(7) {
    top: 40%;
    left: 85%;
    animation-delay: 1s;
}

.grid-node:nth-child(8) {
    top: 60%;
    left: 25%;
    animation-delay: 2s;
}

.grid-node:nth-child(9) {
    top: 80%;
    left: 75%;
    animation-delay: 3s;
}

.grid-node:nth-child(10) {
    top: 30%;
    left: 65%;
    animation-delay: 0.5s;
}

.grid-node:nth-child(11) {
    top: 70%;
    left: 45%;
    animation-delay: 1.5s;
}

@keyframes nodePulse {
    0%, 100% {
        opacity: 0.3;
        transform: scale(0.5);
        box-shadow: 0 0 5px #00ffff;
    }
    50% {
        opacity: 1;
        transform: scale(1.2);
        box-shadow: 0 0 20px #00ffff, 0 0 40px rgba(0, 255, 255, 0.5);
    }
}

/* Neon text effect for score displays */
#score, #high-score, #final-score {
    color: var(--primary-yellow);
    text-shadow: 
        0 0 5px var(--primary-yellow),
        0 0 10px var(--primary-yellow),
        0 0 15px var(--primary-yellow),
        0 0 20px rgba(255, 255, 0, 0.5);
    font-weight: bold;
    animation: scoreGlow 2s ease-in-out infinite alternate;
}

@keyframes scoreGlow {
    0% {
        text-shadow: 
            0 0 5px #ffff00,
            0 0 10px #ffff00,
            0 0 15px #ffff00,
            0 0 20px rgba(255, 255, 0, 0.5);
    }
    100% {
        text-shadow: 
            0 0 10px #ffff00,
            0 0 20px #ffff00,
            0 0 30px #ffff00,
            0 0 40px rgba(255, 255, 0, 0.8);
    }
}

/* Dystopian overlay effects */
.dystopian-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: -1;
    opacity: 0.1;
    background: 
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 2px,
            rgba(255, 0, 0, 0.1) 2px,
            rgba(255, 0, 0, 0.1) 4px
        );
    animation: flicker 0.15s infinite linear;
}

@keyframes flicker {
    0%, 100% { opacity: 0.1; }
    50% { opacity: 0.05; }
}

/* Enhanced title with more glitch effects */
h1.glitch, h2.glitch {
    text-shadow: 
        2px 2px 0 #00ffff,
        -2px -2px 0 #ffff00,
        4px 4px 0 rgba(0, 255, 255, 0.5),
        0 0 20px rgba(0, 255, 255, 0.8);
    animation: titleGlitch 3s infinite;
}

/* Leaderboard styling */
.leaderboard-placeholder {
    color: rgba(0, 255, 255, 0.5);
    font-style: italic;
    padding: 20px;
    text-align: center;
}

/* Initials input styling */
.initials-input-container {
    text-align: center;
    margin-bottom: 1.5rem;
}

.initials-input-row {
    display: flex;
    justify-content: center;
    gap: clamp(0.5rem, 2vw, 1rem);
    margin-bottom: 0.75rem;
}

.initial-input {
    width: clamp(40px, 10vw, 60px);
    height: clamp(40px, 10vw, 60px);
    text-align: center;
    font-size: clamp(1.2rem, 4vw, 2rem);
    font-weight: bold;
    font-family: 'Orbitron', sans-serif;
    background: rgba(0, 0, 0, 0.8);
    border: 2px solid var(--primary-cyan);
    color: var(--primary-cyan);
    border-radius: 8px;
    outline: none;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.initial-input:focus {
    border-color: var(--primary-yellow);
    box-shadow: 
        0 0 20px rgba(255, 255, 0, 0.5),
        0 0 40px rgba(255, 255, 0, 0.3);
    transform: scale(1.05);
}

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

.initial-input:valid {
    border-color: var(--primary-green);
    box-shadow: 0 0 15px rgba(0, 255, 128, 0.4);
}

/* Enhanced leaderboard with initials */
.leaderboard-initials {
    font-weight: bold;
    color: var(--primary-pink);
    text-shadow: 0 0 10px var(--primary-pink);
    font-size: 1.1em;
    letter-spacing: 1px;
}



@keyframes titleGlitch {
    0%, 90%, 100% {
        transform: translate(0);
        text-shadow: 
            2px 2px 0 #00ffff,
            -2px -2px 0 #ffff00,
            4px 4px 0 rgba(0, 255, 255, 0.5),
            0 0 20px rgba(0, 255, 255, 0.8);
    }
    10% {
        transform: translate(-2px, 2px);
        text-shadow: 
            -2px 2px 0 #ff0080,
            2px -2px 0 #00ff80,
            -4px -4px 0 rgba(255, 0, 128, 0.5),
            0 0 20px rgba(255, 0, 128, 0.8);
    }
    20% {
        transform: translate(2px, -2px);
        text-shadow: 
            2px -2px 0 #ff0080,
            -2px 2px 0 #00ff80,
            4px 4px 0 rgba(255, 0, 128, 0.5),
            0 0 20px rgba(255, 0, 128, 0.8);
    }
    30% {
        transform: translate(-2px, -2px);
        text-shadow: 
            -2px -2px 0 #ff0080,
            2px 2px 0 #00ff80,
            -4px 4px 0 rgba(255, 0, 128, 0.5),
            0 0 20px rgba(255, 0, 128, 0.8);
    }
}

#back-btn:hover {
    background: rgba(0, 255, 128, 0.1);
    box-shadow: 0 0 25px rgba(0, 255, 128, 0.8);
}

/* Clear leaderboard button styling */
#clear-leaderboard-btn {
    border-color: var(--primary-red);
    color: var(--primary-red);
    box-shadow: 0 0 15px rgba(255, 0, 64, 0.5);
    font-size: clamp(0.7rem, 2.5vw, 0.9rem);
    padding: clamp(8px, 2vw, 12px) clamp(12px, 3vw, 16px);
}

#clear-leaderboard-btn:hover {
    background: rgba(255, 0, 64, 0.1);
    box-shadow: 0 0 25px rgba(255, 0, 64, 0.8);
    transform: translateY(-1px);
}

#clear-leaderboard-btn:active {
    transform: translateY(0);
}

/* Mobile-first button layouts */
.button-group {
    display: flex;
    flex-direction: column;
    gap: clamp(0.75rem, 2vw, 1rem);
    width: 100%;
    max-width: 280px;
}

.button-group button {
    width: 100%;
}

/* Mobile button sizing */
@media (max-width: 768px) {
    button {
        padding: clamp(6px, 1.5vw, 10px) clamp(12px, 3vw, 18px);
        font-size: clamp(0.6rem, 2vw, 0.8rem);
        min-height: 36px;
    }
    
    .button-group {
        max-width: 240px;
        gap: 0.6rem;
    }
    
    .button-group button {
        padding: clamp(5px, 1.2vw, 8px) clamp(10px, 2.5vw, 16px);
        font-size: clamp(0.55rem, 1.8vw, 0.7rem);
        min-height: 32px;
    }
}

@media (max-width: 480px) {
    button {
        padding: clamp(5px, 1.2vw, 8px) clamp(10px, 2.5vw, 16px);
        font-size: clamp(0.5rem, 1.8vw, 0.65rem);
        min-height: 32px;
    }
    
    .button-group {
        max-width: 220px;
        gap: 0.5rem;
    }
    
    .button-group button {
        padding: clamp(4px, 1vw, 6px) clamp(8px, 2vw, 12px);
        font-size: clamp(0.5rem, 1.6vw, 0.6rem);
        min-height: 28px;
    }
}

/* Mobile-first controls info */
.controls-info {
    text-align: center;
    margin-top: 1rem;
    font-size: clamp(0.8rem, 3vw, 1rem);
    color: rgba(0, 255, 255, 0.8);
}

.controls-info p {
    margin: 0.5rem 0;
}

/* Mobile-first game description */
.game-description {
    text-align: center;
    margin-bottom: 1.5rem;
    font-size: clamp(0.85rem, 3vw, 1rem);
    line-height: 1.5;
    max-width: 95vw;
    padding: 0 0.5rem;
    color: rgba(0, 255, 255, 0.9);
}

/* Mobile-first footer */
.footer {
    text-align: center;
    margin-top: 1rem;
    font-size: clamp(0.7rem, 2.5vw, 0.9rem);
    color: rgba(0, 255, 255, 0.7);
}

.footer p {
    margin: 0.25rem 0;
}

/* Footer content layout */
.footer-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

/* Studio logo styling */
.studio-logo {
    display: inline-block;
    transition: all 0.3s ease;
    filter: drop-shadow(0 0 10px rgba(0, 255, 255, 0.5));
}

.studio-logo:hover {
    filter: drop-shadow(0 0 20px rgba(0, 255, 255, 0.8));
    transform: scale(1.05);
}

.studio-logo svg {
    width: 60px;
    height: 20px;
    transition: all 0.3s ease;
}

/* Desktop footer enhancements */
@media (min-width: 769px) {
    .footer-content {
        flex-direction: row;
        justify-content: center;
        align-items: center;
        gap: 1rem;
        margin-top: 1rem;
    }
    
    .studio-logo svg {
        width: 75px;
        height: 25px;
    }
    
    .studio-logo:hover {
        transform: scale(1.1);
        filter: drop-shadow(0 0 25px rgba(0, 255, 255, 0.9));
    }
}

/* Large desktop footer enhancements */
@media (min-width: 1200px) {
    .footer-content {
        gap: 1.5rem;
    }
    
    .studio-logo svg {
        width: 90px;
        height: 30px;
    }
    
    .studio-logo:hover {
        transform: scale(1.15);
        filter: drop-shadow(0 0 30px rgba(0, 255, 255, 1));
    }
}

/* Enhanced mobile touch targets */
@media (max-width: 768px) {
    .game-container {
        margin: 5px;
        max-width: 98vw;
        max-height: 75vh;
    }
    
    .game-overlay {
        padding: 15px;
    }
    
    .button-group {
        max-width: 280px;
    }
    
    .initials-input-row {
        gap: 0.5rem;
    }
    
    .leaderboard-entry {
        grid-template-columns: 50px 1fr 70px 80px;
        gap: clamp(10px, 2.5vw, 15px);
        padding: clamp(8px, 2vw, 12px) clamp(12px, 3vw, 20px);
        font-size: 0.8rem;
        min-width: 280px;
        max-width: 400px;
        background: rgba(0, 255, 255, 0.1);
        border: 1px solid rgba(0, 255, 255, 0.3);
    }
    
    .leaderboard-rank {
        min-width: 40px;
    }
    
    #leaderboard-list {
        max-width: 400px;
    }
}

@media (max-width: 480px) {
    body {
        background: linear-gradient(135deg, var(--dark-bg) 0%, #0f0f2a 25%, #1a1a3a 50%, #0f0f2a 75%, var(--dark-bg) 100%) !important;
    }
    
    body::before {
        background: 
            radial-gradient(circle at 20% 80%, rgba(0, 230, 230, 0.1) 0%, transparent 50%),
            radial-gradient(circle at 80% 20%, rgba(230, 230, 0, 0.1) 0%, transparent 50%),
            radial-gradient(circle at 40% 40%, rgba(0, 150, 230, 0.05) 0%, transparent 50%) !important;
    }
    
    .game-container {
        margin: 2px;
        max-width: 99vw;
        max-height: 80vh;
    }
    
    .game-overlay {
        padding: 10px;
    }
    
    .button-group {
        max-width: 240px;
    }
    
    .initials-input-row {
        gap: 0.25rem;
    }
    
    .initial-input {
        width: 45px;
        height: 45px;
        font-size: 1.2rem;
    }
    
    .leaderboard-entry {
        grid-template-columns: 40px 1fr 55px 65px;
        gap: 6px;
        padding: 6px 10px;
        font-size: 0.75rem;
        min-width: 240px;
        max-width: 320px;
        background: rgba(0, 255, 255, 0.1);
        border: 1px solid rgba(0, 255, 255, 0.3);
    }
    
    .leaderboard-rank {
        min-width: 30px;
    }
    
    #leaderboard-list {
        max-width: 320px;
    }
}

@media (max-width: 360px) {
    body {
        background: linear-gradient(135deg, var(--dark-bg) 0%, #0f0f2a 25%, #1a1a3a 50%, #0f0f2a 75%, var(--dark-bg) 100%) !important;
    }
    
    body::before {
        background: 
            radial-gradient(circle at 20% 80%, rgba(0, 230, 230, 0.1) 0%, transparent 50%),
            radial-gradient(circle at 80% 20%, rgba(230, 230, 0, 0.1) 0%, transparent 50%),
            radial-gradient(circle at 40% 40%, rgba(0, 150, 230, 0.05) 0%, transparent 50%) !important;
    }
    
    body {
        padding: 5px;
    }
    
    .game-container {
        margin: 2px;
        max-width: 99.5vw;
        max-height: 85vh;
    }
    
    h1.glitch {
        font-size: clamp(1.5rem, 7vw, 2rem);
        margin-bottom: 0.75rem;
    }
    
    h2.glitch {
        font-size: clamp(1.2rem, 5vw, 1.5rem);
        margin-bottom: 1rem;
    }
    
    .button-group {
        gap: 0.75rem;
        max-width: 240px;
    }
    
    .score-container {
        gap: 0.5rem;
        margin-bottom: 1rem;
    }
    
    .game-description {
        font-size: clamp(0.75rem, 2.5vw, 0.9rem);
        margin-bottom: 1rem;
    }
    
    .leaderboard-entry {
        grid-template-columns: 35px 1fr 50px 60px;
        gap: 4px;
        padding: 4px 6px;
        font-size: 0.65rem;
        min-width: 220px;
        max-width: 300px;
    }
    
    .leaderboard-rank {
        min-width: 25px;
        font-size: 0.7rem;
    }
    
    .leaderboard-score {
        font-size: 0.7rem;
    }
    
    .leaderboard-date {
        font-size: 0.6rem;
    }
    
    .leaderboard-initials {
        font-size: 0.75rem;
    }
    
    #leaderboard-list {
        max-width: 300px;
    }
    
    .button-group {
        max-width: 220px;
        gap: 0.5rem;
    }
    
    .button-group button {
        padding: clamp(4px, 1vw, 6px) clamp(8px, 2vw, 12px);
        font-size: clamp(0.55rem, 1.8vw, 0.65rem);
        min-height: 30px;
    }
}

/* Landscape mobile optimization */
@media (max-height: 500px) and (orientation: landscape) {
    .game-container {
        max-height: 85vh;
    }
    
    h1.glitch {
        font-size: clamp(1.5rem, 6vw, 2.5rem);
        margin-bottom: 0.5rem;
    }
    
    h2.glitch {
        font-size: clamp(1.2rem, 4vw, 2rem);
        margin-bottom: 1rem;
    }
    
    .game-overlay {
        padding: 10px;
    }
    
    .button-group {
        flex-direction: row;
        gap: 1rem;
        max-width: none;
    }
    
    .button-group button {
        width: auto;
        min-width: 120px;
    }
}

/* Mobile-optimized text rendering - using bright neon colors */
@media (max-width: 768px) {
    body {
        color: var(--primary-cyan);
        background: linear-gradient(135deg, var(--dark-bg) 0%, #0f0f2a 25%, #1a1a3a 50%, #0f0f2a 75%, var(--dark-bg) 100%) !important;
    }
    
    body::before {
        background: 
            radial-gradient(circle at 20% 80%, rgba(0, 255, 255, 0.1) 0%, transparent 50%),
            radial-gradient(circle at 80% 20%, rgba(255, 255, 0, 0.1) 0%, transparent 50%),
            radial-gradient(circle at 40% 40%, rgba(0, 150, 255, 0.05) 0%, transparent 50%) !important;
    }
    
    .terminal-text {
        color: var(--primary-cyan);
        text-shadow: 0 0 6px var(--primary-cyan), 0 0 12px rgba(0, 255, 255, 0.5);
    }
    
    .glitch {
        color: var(--primary-cyan);
        text-shadow: 
            1px 1px 0 var(--primary-cyan), 
            -1px -1px 0 var(--primary-yellow),
            2px 2px 0 rgba(0, 255, 255, 0.5);
    }
    
    #score, #high-score, #final-score {
        color: var(--primary-yellow);
        text-shadow: 
            0 0 4px var(--primary-yellow),
            0 0 8px var(--primary-yellow),
            0 0 12px rgba(255, 255, 0, 0.5);
    }
    
    button {
        border-color: var(--primary-cyan);
        color: var(--primary-cyan);
    }
    
    #start-btn {
        border-color: var(--primary-pink);
        color: var(--primary-pink);
    }
    
    #save-score-btn {
        border-color: var(--primary-green);
        color: var(--primary-green);
    }
    
    #back-btn {
        border-color: var(--primary-green);
        color: var(--primary-green);
    }
    
    .initial-input {
        border-color: var(--primary-cyan);
        color: var(--primary-cyan);
    }
    
    .initial-input:focus {
        border-color: var(--primary-yellow);
    }
    
    .initial-input:valid {
        border-color: var(--primary-green);
    }
    
    /* Ensure leaderboard backgrounds show properly on mobile */
    .leaderboard-entry {
        background: rgba(0, 255, 255, 0.1) !important;
        border-color: rgba(0, 255, 255, 0.3) !important;
    }
    
    .leaderboard-entry:hover {
        background: rgba(0, 255, 255, 0.2) !important;
        border-color: rgba(0, 255, 255, 0.6) !important;
    }
    
    .leaderboard-rank {
        color: var(--primary-yellow);
        text-shadow: 0 0 8px var(--primary-yellow);
    }
    
    .leaderboard-score {
        color: var(--primary-cyan);
        text-shadow: 0 0 8px var(--primary-cyan);
    }
    
    .leaderboard-date {
        color: rgba(0, 255, 255, 0.7);
    }
    
    .leaderboard-initials {
        color: var(--primary-pink);
        text-shadow: 0 0 8px var(--primary-pink);
    }
}

/* Enhanced mobile touch feedback */
@media (max-width: 768px) {
    button:active {
        transform: scale(0.95);
        transition: transform 0.1s ease;
    }
    
    .initial-input:focus {
        transform: scale(1.05);
    }
    
    /* Better mobile shadows */
    .game-container {
        box-shadow: 
            0 0 15px var(--mobile-cyan), 
            inset 0 0 15px var(--mobile-cyan),
            0 0 30px rgba(0, 230, 230, 0.3);
    }
    
    /* Improved mobile grid visibility */
    .cyber-grid {
        background-image: 
            linear-gradient(rgba(0, 230, 230, 0.05) 1px, transparent 1px),
            linear-gradient(90deg, rgba(0, 230, 230, 0.05) 1px, transparent 1px);
    }
    
    .cyber-grid::before {
        background-image: 
            linear-gradient(rgba(0, 230, 230, 0.08) 1px, transparent 1px),
            linear-gradient(90deg, rgba(0, 230, 230, 0.08) 1px, transparent 1px);
    }
    
    .cyber-grid::after {
        background-image: 
            linear-gradient(rgba(230, 230, 0, 0.04) 1px, transparent 1px),
            linear-gradient(90deg, rgba(230, 230, 0, 0.04) 1px, transparent 1px);
    }
}

/* Mobile performance optimizations */
@media (max-width: 768px) {
    .light-beam {
        animation-duration: 12s; /* Slower animation for better performance */
    }
    
    .grid-node {
        animation-duration: 6s; /* Slower animation for better performance */
    }
    
    .scanline {
        animation-duration: 6s; /* Slower animation for better performance */
    }
    
    /* Reduce complex effects on mobile */
    .dystopian-overlay {
        opacity: 0.05;
    }
    
    /* Keep glitch effects but reduce complexity on mobile */
    .glitch::before,
    .glitch::after {
        opacity: 0.6; /* Reduce opacity instead of hiding completely */
    }
}

/* High contrast mode for accessibility */
@media (prefers-contrast: high) {
    :root {
        --primary-cyan: #00cccc;
        --primary-yellow: #cccc00;
        --primary-pink: #cc0066;
        --primary-green: #00cc66;
        --primary-red: #cc0033;
    }
    
    .game-container {
        border-width: 4px;
        box-shadow: 
            0 0 25px var(--primary-cyan), 
            inset 0 0 25px var(--primary-cyan),
            0 0 50px rgba(0, 204, 204, 0.5);
    }
    
    button {
        border-width: 3px;
        font-weight: 900;
    }
    
    .terminal-text::before {
        color: var(--primary-yellow);
        font-weight: 900;
    }
}

/* Reduced motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    .light-beam,
    .grid-node,
    .scanline,
    .cyber-grid,
    .cyber-grid::before,
    .cyber-grid::after {
        animation: none;
    }
    
    .glitch {
        animation: none;
        text-shadow: 
            2px 2px 0 var(--primary-cyan), 
            -2px -2px 0 var(--primary-yellow),
            4px 4px 0 rgba(0, 255, 255, 0.5);
    }
    
    button::before {
        display: none;
    }
    
    button:hover {
        transform: none;
    }
}

/* Final mobile optimizations */
@media (max-width: 768px) {
    /* Ensure proper spacing on mobile */
    body {
        padding: 10px;
    }
    
    /* Better mobile button spacing */
    .button-group {
        gap: 1rem;
    }
    
    /* Improved mobile text readability */
    .game-description {
        font-size: clamp(0.85rem, 3vw, 1rem);
        line-height: 1.6;
        margin-bottom: 1.5rem;
    }
    
    /* Better mobile score display */
    .score-container {
        gap: 0.75rem;
        margin-bottom: 1.5rem;
    }
    
    .score-item {
        font-size: clamp(0.8rem, 3.5vw, 1rem);
    }
    
    /* Mobile-optimized footer */
    .footer {
        margin-top: 1.5rem;
    }
    
    .controls-info {
        margin-bottom: 0.5rem;
    }
    
    /* Ensure game container doesn't overflow */
    .game-container {
        overflow: hidden;
        border-radius: 8px;
    }
    
    /* Better mobile canvas rendering */
    #game-canvas {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

/* Ultra-small mobile devices */
@media (max-width: 360px) {
    body {
        padding: 5px;
    }
    
    .game-container {
        margin: 2px;
        max-width: 99.5vw;
        max-height: 85vh;
    }
    
    h1.glitch {
        font-size: clamp(1.5rem, 7vw, 2rem);
        margin-bottom: 0.75rem;
    }
    
    h2.glitch {
        font-size: clamp(1.2rem, 5vw, 1.5rem);
        margin-bottom: 1rem;
    }
    
    .button-group {
        gap: 0.75rem;
        max-width: 240px;
    }
    
    .score-container {
        gap: 0.5rem;
        margin-bottom: 1rem;
    }
    
    .game-description {
        font-size: clamp(0.75rem, 2.5vw, 0.9rem);
        margin-bottom: 1rem;
    }
}

/* Mobile landscape optimization */
@media (max-height: 500px) and (orientation: landscape) {
    .game-container {
        max-height: 90vh;
    }
    
    .score-container {
        flex-direction: row;
        gap: 2rem;
        justify-content: center;
    }
    
    .footer {
        margin-top: 0.5rem;
    }
    
    .controls-info {
        display: none; /* Hide controls info in landscape to save space */
    }
}

/* Ensure proper touch targets on all devices */
@media (hover: none) and (pointer: coarse) {
    button {
        min-height: 48px; /* Larger touch target for touch devices */
        min-width: 48px;
    }
    
    .initial-input {
        min-height: 48px;
        min-width: 48px;
    }
    
    /* Better touch feedback */
    button:active {
        background: rgba(0, 255, 255, 0.1);
        transform: scale(0.98);
    }
    
    .initial-input:focus {
        transform: scale(1.02);
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    :root {
        --dark-bg: #000000;
        --darker-bg: #000000;
    }
    
    body {
        background: linear-gradient(135deg, #000000 0%, #0a0a0a 25%, #1a1a1a 50%, #0a0a0a 75%, #000000 100%);
    }
}

/* Desktop enhancements - progressive enhancement */
@media (min-width: 769px) {
    :root {
        --primary-cyan: var(--desktop-cyan);
        --primary-yellow: var(--desktop-yellow);
        --primary-pink: var(--desktop-pink);
        --primary-green: var(--desktop-green);
        --primary-red: var(--desktop-red);
    }
    
    body {
        padding: 20px;
    }
    
    .game-container {
        border-width: 3px;
        margin: 10px;
        max-width: 95vw;
        max-height: 65vh;
        overflow: hidden;
        box-shadow: 
            0 0 20px var(--primary-cyan), 
            inset 0 0 20px var(--primary-cyan),
            0 0 40px rgba(0, 255, 255, 0.3);
    }
    
    button {
        padding: clamp(12px, 3vw, 16px) clamp(20px, 5vw, 32px);
        font-size: clamp(0.8rem, 3vw, 1.1rem);
        min-height: 44px;
        /* Ensure desktop buttons have proper neon effects */
        border-width: 2px;
        box-shadow: 0 0 15px currentColor;
    }
    
    .button-group {
        flex-direction: column !important;
        gap: 1.5rem;
        max-width: 300px;
        justify-content: center;
        align-items: center;
    }
    
    .button-group button {
        width: 100% !important;
        min-width: 200px;
        max-width: 300px;
        text-align: center;
    }
    
    /* Enhanced desktop glitch effects */
    h1.glitch, h2.glitch {
        font-size: clamp(2rem, 4vw, 3rem);
        text-shadow: 
            2px 2px 0 var(--primary-cyan),
            -2px -2px 0 var(--primary-yellow),
            4px 4px 0 rgba(0, 255, 255, 0.5),
            0 0 20px rgba(0, 255, 255, 0.8);
        animation: titleGlitch 3s infinite;
    }
    
    .glitch::before,
    .glitch::after {
        display: block; /* Re-enable glitch effects on desktop */
    }
    
    .leaderboard-entry {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 12px;
        padding: 10px 20px;
        font-size: 1rem;
        min-width: 170px;
        width: auto;
        max-width: 350px;
        /* Enhanced desktop leaderboard styling */
        background: rgba(0, 255, 255, 0.1);
        border: 1px solid rgba(0, 255, 255, 0.3);
        box-shadow: 0 0 20px rgba(0, 255, 255, 0.2);
    }
    
    .leaderboard-entry:hover {
        background: rgba(0, 255, 255, 0.2);
        border-color: rgba(0, 255, 255, 0.6);
        box-shadow: 0 0 30px rgba(0, 255, 255, 0.4);
    }
    
    .leaderboard-rank {
        min-width: 55px;
        font-size: 1em;
        color: var(--primary-yellow);
        text-shadow: 0 0 15px var(--primary-yellow);
    }
    
    .leaderboard-score {
        font-size: 1em;
        color: var(--primary-cyan);
        text-shadow: 0 0 15px var(--primary-cyan);
    }
    
    .leaderboard-date {
        font-size: 0.85em;
        color: rgba(0, 255, 255, 0.7);
    }
    
    .leaderboard-initials {
        font-size: 1.1em;
        color: var(--primary-pink);
        text-shadow: 0 0 15px var(--primary-pink);
    }
    
    #leaderboard-list {
        max-width: 85vw;
        width: 100%;
    }
    
    .game-overlay {
        padding: 30px;
    }
    
    .game-description {
        font-size: clamp(0.9rem, 3.5vw, 1.1rem);
        margin-bottom: 2rem;
        color: rgba(0, 255, 255, 0.9);
        text-shadow: 0 0 10px rgba(0, 255, 255, 0.5);
    }
    
    .score-container {
        gap: 2rem;
        margin-bottom: 2rem;
    }
    
    .score-item {
        font-size: clamp(0.8rem, 3.5vw, 1rem);
    }
    
    .footer {
        margin-top: 2rem;
        color: rgba(0, 255, 255, 0.7);
    }
    
    .controls-info {
        margin-bottom: 1rem;
        color: rgba(0, 255, 255, 0.8);
    }
    
    /* Enhanced desktop neon effects */
    .terminal-text {
        text-shadow: 0 0 10px var(--primary-cyan), 0 0 20px rgba(0, 255, 255, 0.6);
    }
    
    #score, #high-score, #final-score {
        text-shadow: 
            0 0 8px var(--primary-yellow),
            0 0 16px var(--primary-yellow),
            0 0 24px var(--primary-yellow),
            0 0 32px rgba(255, 255, 0, 0.6);
    }
    
    /* Enhanced desktop button hover effects */
    button:hover {
        transform: translateY(-3px);
        box-shadow: 0 12px 30px currentColor;
    }
    
    button::before {
        background: linear-gradient(90deg, transparent, rgba(0, 255, 255, 0.6), transparent);
    }
}

/* Large desktop enhancements */
@media (min-width: 1200px) {
    .game-container {
        max-width: 80vw;
        max-height: 60vh;
        overflow: hidden;
    }
    
    .button-group {
        flex-direction: column !important;
        gap: 2rem;
        max-width: 350px;
        justify-content: center;
        align-items: center;
    }
    
    .button-group button {
        width: 100% !important;
        min-width: 250px;
        max-width: 350px;
        text-align: center;
    }
    
    .leaderboard-entry {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 15px;
        padding: 12px 24px;
        font-size: 1.1rem;
        min-width: 200px;
        width: auto;
        max-width: 400px;
        /* Enhanced large desktop leaderboard */
        background: rgba(0, 255, 255, 0.15);
        border: 2px solid rgba(0, 255, 255, 0.4);
        box-shadow: 0 0 30px rgba(0, 255, 255, 0.3);
    }
    
    .leaderboard-entry:hover {
        background: rgba(0, 255, 255, 0.25);
        border-color: rgba(0, 255, 255, 0.8);
        box-shadow: 0 0 40px rgba(0, 255, 255, 0.5);
    }
    
    #leaderboard-list {
        max-width: 70vw;
        width: 100%;
    }
    
    /* Enhanced large desktop glitch effects */
    h1.glitch, h2.glitch {
        font-size: clamp(2.5rem, 5vw, 4rem);
        text-shadow: 
            3px 3px 0 var(--primary-cyan),
            -3px -3px 0 var(--primary-yellow),
            6px 6px 0 rgba(0, 255, 255, 0.5),
            0 0 30px rgba(0, 255, 255, 0.9);
    }
    
    /* Enhanced large desktop button effects */
    button {
        border-width: 3px;
        box-shadow: 0 0 20px currentColor;
    }
    
    button:hover {
        transform: translateY(-4px);
        box-shadow: 0 16px 40px currentColor;
    }
}

/* Print styles */
@media print {
    .cyber-grid,
    .dystopian-overlay,
    .light-beam,
    .grid-node,
    .scanline {
        display: none;
    }
    
    .game-container {
        border: 2px solid #000;
        box-shadow: none;
    }
    
    button {
        border: 1px solid #000;
        color: #000;
        background: #fff;
    }
}

/* Mobile-optimized leaderboard */

/* Mobile responsive adjustments for leaderboard */
@media (max-width: 768px) {
    .leaderboard-entry {
        grid-template-columns: 50px 1fr 70px 80px;
        gap: clamp(10px, 2.5vw, 15px);
        padding: clamp(8px, 2vw, 12px) clamp(12px, 3vw, 20px);
        font-size: 0.8rem;
        min-width: 280px;
        max-width: 400px;
    }
    
    .leaderboard-rank {
        min-width: 40px;
    }
    
    #leaderboard-list {
        max-width: 400px;
    }
}

@media (max-width: 480px) {
    .leaderboard-entry {
        grid-template-columns: 40px 1fr 60px 70px;
        gap: 6px;
        padding: 6px 10px;
        font-size: 0.75rem;
        min-width: 260px;
        max-width: 350px;
    }
    
    .leaderboard-rank {
        min-width: 35px;
    }
    
    #leaderboard-list {
        max-width: 350px;
    }
}

/* Mobile-optimized leaderboard layout */
@media (max-width: 768px) {
    .leaderboard-entry {
        grid-template-columns: 40px 1fr 55px 65px;
        gap: clamp(6px, 1.5vw, 10px);
        padding: clamp(5px, 1.2vw, 8px) clamp(8px, 2vw, 12px);
        font-size: 0.7rem;
        min-width: 240px;
        max-width: 320px;
        background: rgba(0, 255, 255, 0.1);
        border: 1px solid rgba(0, 255, 255, 0.3);
    }
    
    .leaderboard-rank {
        min-width: 30px;
        font-size: 0.75rem;
    }
    
    .leaderboard-score {
        font-size: 0.75rem;
    }
    
    .leaderboard-date {
        font-size: 0.65rem;
    }
    
    .leaderboard-initials {
        font-size: 0.8rem;
    }
    
    #leaderboard-list {
        max-width: 320px;
    }
}

@media (max-width: 480px) {
    .leaderboard-entry {
        grid-template-columns: 35px 1fr 45px 55px;
        gap: 4px;
        padding: 4px 6px;
        font-size: 0.65rem;
        min-width: 200px;
        max-width: 280px;
        background: rgba(0, 255, 255, 0.1);
        border: 1px solid rgba(0, 255, 255, 0.3);
    }
    
    .leaderboard-rank {
        min-width: 25px;
        font-size: 0.7rem;
    }
    
    .leaderboard-score {
        font-size: 0.7rem;
    }
    
    .leaderboard-date {
        font-size: 0.6rem;
    }
    
    .leaderboard-initials {
        font-size: 0.75rem;
    }
    
    #leaderboard-list {
        max-width: 280px;
    }
}

/* Ultra-small mobile devices */
@media (max-width: 360px) {
    .leaderboard-entry {
        grid-template-columns: 30px 1fr 40px 50px;
        gap: 3px;
        padding: 3px 5px;
        font-size: 0.6rem;
        min-width: 180px;
        max-width: 250px;
    }
    
    .leaderboard-rank {
        min-width: 20px;
        font-size: 0.65rem;
    }
    
    .leaderboard-score {
        font-size: 0.65rem;
    }
    
    .leaderboard-date {
        font-size: 0.55rem;
    }
    
    .leaderboard-initials {
        font-size: 0.6rem;
    }
    
    #leaderboard-list {
        max-width: 250px;
    }
    
    .button-group {
        max-width: 200px;
        gap: 0.4rem;
    }
    
    .button-group button {
        padding: clamp(3px, 0.8vw, 5px) clamp(6px, 1.5vw, 10px);
        font-size: clamp(0.45rem, 1.4vw, 0.55rem);
        min-height: 26px;
    }
}

/* Mobile leaderboard screen improvements */
@media (max-width: 768px) {
    #leaderboard-screen h2.glitch {
        font-size: clamp(1.4rem, 5vw, 2rem);
        margin-bottom: 1rem;
        line-height: 1.1;
    }
    
    #leaderboard-list {
        margin-bottom: 1rem;
    }
    
    .leaderboard-entry {
        margin: 4px 0;
    }
    
    /* Better mobile leaderboard spacing */
    .game-overlay {
        padding: clamp(10px, 3vw, 20px);
    }
    
    /* Mobile-specific leaderboard text sizing */
    .leaderboard-entry {
        font-size: 0.65rem !important;
        padding: 6px 8px !important;
        gap: 4px !important;
    }
    
    .leaderboard-rank {
        font-size: 0.7rem !important;
    }
    
    .leaderboard-score {
        font-size: 0.7rem !important;
    }
    
    .leaderboard-date {
        font-size: 0.6rem !important;
    }
    
    .leaderboard-initials {
        font-size: 0.7rem !important;
    }
    
    /* Mobile leaderboard info text */
    .leaderboard-placeholder {
        font-size: 0.65rem !important;
        padding: 10px !important;
        margin: 5px 0 !important;
    }
}

@media (max-width: 480px) {
    #leaderboard-screen h2.glitch {
        font-size: clamp(1.2rem, 4vw, 1.6rem);
        margin-bottom: 0.75rem;
        line-height: 1.1;
    }
    
    #leaderboard-list {
        margin-bottom: 0.75rem;
    }
    
    .leaderboard-entry {
        margin: 3px 0;
    }
    
    .game-overlay {
        padding: clamp(8px, 2.5vw, 15px);
    }
    
    /* Ultra-compact mobile leaderboard */
    .leaderboard-entry {
        font-size: 0.6rem !important;
        padding: 4px 6px !important;
        gap: 3px !important;
    }
    
    .leaderboard-rank {
        font-size: 0.65rem !important;
    }
    
    .leaderboard-score {
        font-size: 0.65rem !important;
    }
    
    .leaderboard-date {
        font-size: 0.55rem !important;
    }
    
    .leaderboard-initials {
        font-size: 0.65rem !important;
    }
    
    .leaderboard-placeholder {
        font-size: 0.6rem !important;
        padding: 8px !important;
        margin: 4px 0 !important;
    }
}

@media (max-width: 360px) {
    #leaderboard-screen h2.glitch {
        font-size: clamp(1rem, 3.5vw, 1.4rem);
        margin-bottom: 0.5rem;
        line-height: 1.1;
    }
    
    #leaderboard-list {
        margin-bottom: 0.5rem;
    }
    
    .leaderboard-entry {
        margin: 2px 0;
    }
    
    .game-overlay {
        padding: clamp(6px, 2vw, 12px);
    }
    
    /* Ultra-compact for very small screens */
    .leaderboard-entry {
        font-size: 0.55rem !important;
        padding: 3px 5px !important;
        gap: 2px !important;
    }
    
    .leaderboard-rank {
        font-size: 0.6rem !important;
    }
    
    .leaderboard-score {
        font-size: 0.6rem !important;
    }
    
    .leaderboard-date {
        font-size: 0.5rem !important;
    }
    
    .leaderboard-initials {
        font-size: 0.6rem !important;
    }
    
    .leaderboard-placeholder {
        font-size: 0.55rem !important;
        padding: 6px !important;
        margin: 3px 0 !important;
    }
}

/* Simple mobile leaderboard */
.leaderboard-entry {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    padding: 8px 16px;
    margin: 4px 0;
    background: rgba(0, 255, 255, 0.1);
    border: 1px solid rgba(0, 255, 255, 0.3);
    border-radius: 6px;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    font-size: 0.9rem;
    min-width: 140px;
    width: auto;
    max-width: 300px;
}

.leaderboard-entry:hover {
    background: rgba(0, 255, 255, 0.2);
    border-color: rgba(0, 255, 255, 0.6);
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.3);
}

.leaderboard-rank {
    font-weight: bold;
    color: var(--primary-yellow);
    text-shadow: 0 0 10px var(--primary-yellow);
    min-width: 55px;
    text-align: center;
    font-size: 1em;
}

.leaderboard-score {
    font-weight: bold;
    color: var(--primary-cyan);
    text-shadow: 0 0 10px var(--primary-cyan);
    text-align: center;
    font-size: 1em;
}

.leaderboard-date {
    color: rgba(0, 255, 255, 0.7);
    font-size: 0.85em;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
}

.leaderboard-initials {
    font-weight: bold;
    color: var(--primary-pink);
    text-shadow: 0 0 10px var(--primary-pink);
    font-size: 1.1em;
    letter-spacing: 1px;
}

/* Simple leaderboard container */
#leaderboard-list {
    width: auto;
    max-width: 400px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Top rank highlighting for global leaderboard */
.top-rank {
    background: rgba(255, 215, 0, 0.15) !important;
    border-color: rgba(255, 215, 0, 0.6) !important;
    box-shadow: 0 0 25px rgba(255, 215, 0, 0.3) !important;
}

.top-rank .leaderboard-rank {
    color: #ffd700 !important;
    text-shadow: 0 0 15px #ffd700, 0 0 25px rgba(255, 215, 0, 0.8) !important;
    font-size: 1.2em !important;
    font-weight: 900 !important;
}

.top-rank:hover {
    background: rgba(255, 215, 0, 0.25) !important;
    border-color: rgba(255, 215, 0, 0.8) !important;
    box-shadow: 0 0 35px rgba(255, 215, 0, 0.4) !important;
}

/* Global leaderboard info styling */
.leaderboard-placeholder {
    color: rgba(0, 255, 255, 0.5);
    font-style: italic;
    padding: 20px;
    text-align: center;
}

/* Force dark background on mobile devices */
@media (max-width: 768px) {
    html, body {
        background: linear-gradient(135deg, var(--dark-bg) 0%, #0f0f2a 25%, #1a1a3a 50%, #0f0f2a 75%, var(--dark-bg) 100%) !important;
        background-attachment: fixed !important;
        background-size: cover !important;
        background-repeat: no-repeat !important;
    }
    
    /* Ensure no white backgrounds can override */
    * {
        background-color: transparent !important;
    }
    
    /* Force dark backgrounds for main elements */
    .game-container,
    .game-overlay,
    .cyber-grid,
    .dystopian-overlay {
        background-color: transparent !important;
    }
}
