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

body {
    font-family: 'Orbitron', monospace;
    background: linear-gradient(135deg, #0a0a0a, #1a1a2e, #16213e);
    color: #00ffff;
    overflow: hidden;
    cursor: none;
}

#gameContainer {
    width: 100vw;
    height: 100vh;
    position: relative;
    overflow: hidden;
    padding-top: 60px;
}

#gameCanvas {
    width: 100%;
    height: calc(100vh - 60px);
    background: radial-gradient(ellipse at center, #1a1a2e 0%, #0a0a0a 100%);
    display: block;
}

/* Game UI */
#gameUI {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 100;
}

#topBar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 10px;
    margin-top: 60px;
    background: linear-gradient(180deg, rgba(0,255,255,0.1) 0%, transparent 100%);
    pointer-events: none;
    position: relative;
}

/* New persistent header styles */
#persistentHeader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 60px;
    background: linear-gradient(135deg, rgba(0,0,0,0.8), rgba(26,26,46,0.8));
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(0, 255, 255, 0.3);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    z-index: 200;
    box-shadow: 0 2px 20px rgba(0, 255, 255, 0.1);
}

.app-title {
    font-family: 'Orbitron', monospace;
    font-size: 24px;
    font-weight: 900;
    background: linear-gradient(45deg, #00ffff, #ff0080, #ffff00, #00ffff);
    background-size: 300% 300%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: neonFlow 3s ease-in-out infinite;
    text-shadow: 0 0 20px rgba(0, 255, 255, 0.5);
    letter-spacing: 2px;
    display: flex;
    align-items: center;
    gap: 8px;
    pointer-events: all; /* Make title clickable for long press */
    user-select: none; /* Prevent selection during long press */
    -webkit-user-select: none;
    touch-action: manipulation; /* Improves responsiveness on touch devices */
}

.app-title .by-text {
    font-size: 10px;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.6);
    background: none;
    -webkit-background-clip: initial;
    -webkit-text-fill-color: initial;
    background-clip: initial;
    animation: none;
    text-shadow: none;
    letter-spacing: 1px;
    pointer-events: all; /* Make "By DSK" clickable for long press */
    user-select: none; /* Prevent selection during long press */
    -webkit-user-select: none;
    touch-action: manipulation; /* Improves responsiveness on touch devices */
}

@keyframes neonFlow {
    0%, 100% { 
        background-position: 0% 50%;
        filter: brightness(1);
    }
    25% { 
        background-position: 100% 50%;
        filter: brightness(1.2);
    }
    50% { 
        background-position: 50% 100%;
        filter: brightness(0.8);
    }
    75% { 
        background-position: 100% 0%;
        filter: brightness(1.1);
    }
}

/* New styles for long press feedback */
.app-title.long-press-active,
.app-title .by-text.long-press-active {
    filter: brightness(1.5) hue-rotate(30deg);
    animation: none; /* Disable normal neonFlow during long press */
    text-shadow: 0 0 30px rgba(255, 255, 255, 0.8);
    transform: scale(1.05);
    transition: all 0.2s ease-out;
}

/* Ensure original styles return after long press ends */
.app-title:not(.long-press-active) {
    animation: neonFlow 3s ease-in-out infinite;
}

/* New style for the centering container in the top bar */
.top-bar-center {
    display: none;
}

.gauge {
    width: 80px;
    height: 80px;
    border: 3px solid #00ffff;
    border-radius: 50%;
    position: relative;
    box-shadow: 0 0 20px #00ffff;
    background: rgba(0,255,255,0.1);
}

.gauge-fill {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: conic-gradient(from 0deg, #ff0080 0%, #00ffff 0%);
    transition: background 0.3s ease;
}

.speed-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 14px;
    font-weight: bold;
    text-shadow: 0 0 10px #00ffff;
}

#speedometer, #playerCount, #score {
    text-align: center;
}

#speedometer label, #playerCount label, #score label {
    display: block;
    font-size: 12px;
    margin-top: 5px;
    opacity: 0.8;
}

.count, .score-value {
    font-size: 24px;
    font-weight: bold;
    text-shadow: 0 0 10px #00ffff;
}

/* Leaderboard */
#leaderboard {
    position: absolute;
    top: 120px;
    right: 20px;
    width: 200px;
    background: rgba(0,255,255,0.1);
    border: 1px solid #00ffff;
    border-radius: 10px;
    padding: 15px;
    backdrop-filter: blur(10px);
    box-shadow: 0 0 20px rgba(0,255,255,0.3);
    transition: opacity 0.3s ease;
}

#leaderboard.single-player {
    opacity: 0;
    pointer-events: none;
}

#playerCount {
    display: none;
}

#score {
    position: relative;
    text-align: center;
}

.player-entry {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 0;
    border-bottom: 1px solid rgba(0,255,255,0.2);
}

.player-entry:last-child {
    border-bottom: none;
}

.player-name {
    font-size: 12px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    max-width: 120px;
}

.player-score {
    font-size: 12px;
    font-weight: bold;
}

/* Power-up Indicator - Hide it */
#powerupIndicator {
    display: none;
}

/* Game Messages */
#gameMessages {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    font-size: 24px;
    font-weight: bold;
    text-shadow: 0 0 20px #00ffff;
    opacity: 0;
    transition: opacity 0.5s ease;
    pointer-events: none;
}

#gameMessages.show {
    opacity: 1;
}

/* Mobile Controls */
#mobileControls {
    display: none;
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 200px;
    pointer-events: none;
    z-index: 150;
}

#joystick {
    position: absolute;
    bottom: 30px;
    left: 30px;
    width: 105px;
    height: 105px;
    pointer-events: all;
    background: rgba(0, 255, 255, 0.1);
    border: 2px solid rgba(0, 255, 255, 0.3);
    border-radius: 50%;
    backdrop-filter: blur(5px);
}

body.right-handed #joystick {
    left: auto;
    right: 30px;
}

#boostButton {
    position: absolute;
    /* Calculate position relative to joystick's top-right/top-left corner */
    bottom: calc(30px + 105px - 25px); /* Joystick bottom + height - half button height */
    left: calc(30px + 105px - 25px); /* Joystick left + width - half button width */
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: 3px solid #ff0080;
    background: rgba(255, 0, 128, 0.2);
    color: #ff0080;
    font-family: 'Orbitron', monospace;
    font-weight: bold;
    font-size: 10px;
    cursor: pointer;
    backdrop-filter: blur(10px);
    pointer-events: all;
    transition: all 0.2s ease;
    box-shadow: 0 0 20px rgba(255, 0, 128, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
}

body.right-handed #boostButton {
    left: auto;
    right: calc(30px + 105px - 25px); /* Joystick right + width - half button width */
}

#boostButton:active {
    transform: scale(0.95);
    box-shadow: 0 0 30px #ff0080;
    background: rgba(255, 0, 128, 0.4);
}

#boostButton.disabled {
    opacity: 0.5;
    border-color: #666;
    color: #666;
    box-shadow: none;
}

/* Loading Screen */
#loadingScreen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #0a0a0a, #1a1a2e);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    transition: opacity 0.5s ease;
}

.loader {
    position: relative;
    width: 100px;
    height: 100px;
    margin-bottom: 30px;
}

.neon-ring {
    position: absolute;
    border: 2px solid transparent;
    border-top: 2px solid #00ffff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.neon-ring:nth-child(1) {
    width: 100px;
    height: 100px;
    animation-duration: 1s;
}

.neon-ring:nth-child(2) {
    width: 70px;
    height: 70px;
    top: 15px;
    left: 15px;
    border-top-color: #ff0080;
    animation-duration: 0.8s;
    animation-direction: reverse;
}

.neon-ring:nth-child(3) {
    width: 40px;
    height: 40px;
    top: 30px;
    left: 30px;
    border-top-color: #ffff00;
    animation-duration: 0.6s;
}

/* Welcome Screen */
#welcomeScreen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(0,0,0,0.9), rgba(26,26,46,0.9));
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 999;
    backdrop-filter: blur(10px);
}

.welcome-content {
    text-align: center;
    max-width: 500px;
    padding: 40px;
    background: rgba(0,255,255,0.1);
    border: 1px solid #00ffff;
    border-radius: 20px;
    box-shadow: 0 0 30px rgba(0,255,255,0.3);
}

.welcome-content h1 {
    font-size: 48px;
    font-weight: 900;
    margin-bottom: 10px;
    text-shadow: 0 0 20px #00ffff;
    background: linear-gradient(45deg, #00ffff, #ff0080);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.welcome-content p {
    font-size: 18px;
    margin-bottom: 30px;
    opacity: 0.8;
}

.game-rules {
    text-align: left;
    margin: 30px 0;
    padding: 20px;
    background: rgba(0,0,0,0.3);
    border-radius: 10px;
    border: 1px solid rgba(0,255,255,0.3);
}

.game-rules h3 {
    font-size: 16px;
    margin-bottom: 15px;
    text-align: center;
}

.game-rules ul {
    list-style: none;
    font-size: 14px;
    line-height: 1.8;
}

/* New styles for How to Play content in modal */
.how-to-play-content {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(0, 25, 51, 0.95), rgba(26, 26, 46, 0.95));
    border-radius: 15px;
    padding: 0;
    display: none; /* Hidden by default */
    flex-direction: column;
    justify-content: flex-start;
    align-items: stretch;
    text-align: left;
    box-sizing: border-box;
    animation: fadeIn 0.3s ease-out;
    overflow: hidden;
}

.how-to-play-content.show {
    display: flex;
}

.how-to-play-header {
    position: sticky;
    top: 0;
    background: linear-gradient(135deg, rgba(0, 25, 51, 0.98), rgba(26, 26, 46, 0.98));
    border-bottom: 1px solid rgba(0, 255, 255, 0.3);
    padding: 20px 30px 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 10;
    backdrop-filter: blur(10px);
}

.how-to-play-header h3 {
    font-size: 20px;
    margin: 0;
    color: #00ffff;
    text-shadow: 0 0 10px #00ffff;
    font-weight: bold;
}

.how-to-play-scrollable {
    flex: 1;
    overflow-y: auto;
    padding: 20px 30px 30px 30px;
    scrollbar-width: thin;
    scrollbar-color: #00ffff rgba(0, 255, 255, 0.1);
}

.how-to-play-scrollable::-webkit-scrollbar {
    width: 8px;
}

.how-to-play-scrollable::-webkit-scrollbar-track {
    background: rgba(0, 255, 255, 0.1);
    border-radius: 4px;
}

.how-to-play-scrollable::-webkit-scrollbar-thumb {
    background: #00ffff;
    border-radius: 4px;
    box-shadow: 0 0 5px rgba(0, 255, 255, 0.5);
}

.how-to-play-scrollable::-webkit-scrollbar-thumb:hover {
    background: #ff0080;
    box-shadow: 0 0 10px rgba(255, 0, 128, 0.5);
}

.how-to-play-section {
    margin-bottom: 25px;
}

.how-to-play-section h4 {
    font-size: 16px;
    color: #ff0080;
    text-shadow: 0 0 8px #ff0080;
    margin: 0 0 12px 0;
    font-weight: bold;
    border-bottom: 1px solid rgba(255, 0, 128, 0.3);
    padding-bottom: 5px;
}

.how-to-play-section ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.how-to-play-section li {
    font-size: 14px;
    margin-bottom: 8px;
    line-height: 1.6;
    color: #ffffff;
    opacity: 0.9;
    padding-left: 15px;
    position: relative;
}

.how-to-play-section li:before {
    content: "▶";
    position: absolute;
    left: 0;
    color: #00ffff;
    font-size: 10px;
    top: 2px;
}

.how-to-play-section .key-combo {
    background: rgba(0, 255, 255, 0.2);
    color: #00ffff;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Orbitron', monospace;
    font-weight: bold;
    font-size: 12px;
    border: 1px solid rgba(0, 255, 255, 0.4);
}

.how-to-play-content .close-button {
    position: static;
    background: rgba(255, 0, 128, 0.2);
    border: 1px solid #ff0080;
    border-radius: 50%;
    color: #ff0080;
    font-size: 18px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.how-to-play-content .close-button:hover {
    background: rgba(255, 0, 128, 0.4);
    box-shadow: 0 0 15px rgba(255, 0, 128, 0.4);
    transform: scale(1.1);
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1001;
}

.modal-overlay.show {
    display: flex;
}

.modal-content {
    background: linear-gradient(135deg, rgba(0, 25, 51, 0.9), rgba(26, 26, 46, 0.9));
    border: 2px solid #00ffff;
    border-radius: 15px;
    padding: 30px;
    max-width: 300px;
    width: 90%;
    box-shadow: 0 0 30px rgba(0, 255, 255, 0.3);
    animation: modalSlideIn 0.3s ease;
    position: relative;
}

@keyframes modalSlideIn {
    from {
        transform: translateY(-50px) scale(0.9);
        opacity: 0;
    }
    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 1px solid rgba(0, 255, 255, 0.3);
    padding-bottom: 15px;
}

.modal-header h2 {
    font-size: 24px;
    font-weight: bold;
    color: #00ffff;
    text-shadow: 0 0 10px #00ffff;
}

.close-button {
    background: none;
    border: none;
    color: #ff0080;
    font-size: 28px;
    cursor: pointer;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.close-button:hover {
    color: #ffffff;
    text-shadow: 0 0 10px #ff0080;
}

.modal-body {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* New styles for confirmation modal */
#confirmationMessage {
    font-size: 16px;
    text-align: center;
    margin-bottom: 15px;
    line-height: 1.6;
    color: #ffffff;
    opacity: 0.9;
}

.confirmation-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
}

#confirmYes {
    background-color: rgba(0, 255, 128, 0.2);
    border-color: #00ff80;
    color: #00ff80;
}

#confirmYes:hover {
    background-color: rgba(0, 255, 128, 0.4);
    box-shadow: 0 0 15px rgba(0, 255, 128, 0.4);
}

#confirmNo {
    background-color: rgba(255, 0, 128, 0.2);
    border-color: #ff0080;
    color: #ff0080;
}

#confirmNo:hover {
    background-color: rgba(255, 0, 128, 0.4);
    box-shadow: 0 0 15px rgba(255, 0, 128, 0.4);
}

.menu-button {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 15px;
    background: rgba(0, 255, 255, 0.1);
    border: 1px solid #00ffff;
    border-radius: 10px;
    color: #00ffff;
    font-family: 'Orbitron', monospace;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: left;
    width: 100%;
}

.menu-button:hover {
    background: rgba(0, 255, 255, 0.2);
    box-shadow: 0 0 15px rgba(0, 255, 255, 0.3);
    transform: translateX(5px);
}

.menu-button.focused {
    background: rgba(0, 255, 255, 0.2);
    box-shadow: 0 0 15px rgba(0, 255, 255, 0.3);
    transform: translateX(5px);
}

.menu-icon {
    font-size: 20px;
    width: 25px;
    text-align: center;
}

#soundStatus, #musicStatus {
    font-weight: bold;
    color: #ff0080;
}

/* Main Menu Screen */
.main-menu-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(0,0,0,0.95), rgba(26,26,46,0.95));
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 999;
    backdrop-filter: blur(10px);
    padding: 20px;
    box-sizing: border-box;
}

.main-menu-content {
    text-align: center;
    max-width: 500px;
    width: 100%;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.main-menu-content h1 {
    font-size: 48px;
    font-weight: 900;
    margin-bottom: 10px;
    text-shadow: 0 0 20px #00ffff;
    background: linear-gradient(45deg, #00ffff, #ff0080, #ffff00, #00ffff);
    background-size: 300% 300%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: neonFlow 3s ease-in-out infinite;
    letter-spacing: 3px;
}

.main-menu-content p {
    font-size: 18px;
    margin-bottom: 40px;
    opacity: 0.8;
    color: #ffffff;
}

#gameLogo {
    width: 150px;
    height: auto;
    margin: 20px auto 40px auto;
    filter: drop-shadow(0 0 20px rgba(0, 255, 255, 0.6)) brightness(1.2);
    animation: pulseGlow 2s infinite alternate;
    border-radius: 100%;
}

@keyframes pulseGlow {
    0% {
        filter: drop-shadow(0 0 15px rgba(0, 255, 255, 0.4)) brightness(1);
    }
    100% {
        filter: drop-shadow(0 0 30px rgba(0, 255, 255, 0.8)) brightness(1.3);
    }
}

.menu-options {
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 100%;
    margin-bottom: 40px;
}

.main-menu-btn {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 20px 30px;
    background: rgba(0, 255, 255, 0.1);
    border: 2px solid #00ffff;
    border-radius: 15px;
    color: #00ffff;
    font-family: 'Orbitron', monospace;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: left;
    width: 100%;
    backdrop-filter: blur(5px);
    text-decoration: none;
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.2);
}

.main-menu-btn:hover {
    background: rgba(0, 255, 255, 0.2);
    box-shadow: 0 0 30px rgba(0, 255, 255, 0.4);
    transform: translateY(-3px);
    border-color: #ff0080;
}

.btn-icon {
    font-size: 32px;
    min-width: 40px;
    text-align: center;
}

.btn-content h3 {
    font-size: 18px;
    font-weight: bold;
    margin: 0 0 5px 0;
    color: #ffffff;
}

.btn-content p {
    font-size: 14px;
    margin: 0;
    opacity: 0.7;
    color: #cccccc;
}

.game-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.game-info span {
    font-size: 12px;
    opacity: 0.8;
    color: #ffff00;
}

.continue-btn {
    border-color: #ffff00;
    color: #ffff00;
}

.continue-btn:hover {
    background: rgba(255, 255, 0, 0.2);
    box-shadow: 0 0 30px rgba(255, 255, 0, 0.4);
    border-color: #ff0080;
}

.game-preview-rules {
    display: none;
}

.game-preview-rules h3 {
    font-size: 16px;
    margin-bottom: 15px;
    text-align: center;
    color: #00ffff;
    text-shadow: 0 0 10px #00ffff;
}

.game-preview-rules ul {
    list-style: none;
    padding: 0;
    margin: 0;
    text-align: left;
}

.game-preview-rules li {
    font-size: 14px;
    margin-bottom: 8px;
    line-height: 1.5;
    color: #ffffff;
    opacity: 0.9;
}

.app-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 15px 20px;
    background: linear-gradient(180deg, transparent 0%, rgba(0,0,0,0.8) 100%);
    text-align: center;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(5px);
    z-index: 1000;
}

.app-footer a {
    color: #00ffff;
    text-decoration: none;
    text-shadow: 0 0 5px #00ffff;
    transition: all 0.3s ease;
}

.app-footer a:hover {
    color: #ff0080;
    text-shadow: 0 0 10px #ff0080;
}

/* Update hamburger menu positioning */
.hamburger-menu {
    position: static;
    top: auto;
    left: auto;
    transform: none;
    width: 30px;
    height: 25px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    cursor: pointer;
    pointer-events: all;
    z-index: 200;
    margin-bottom: 0;
}

.hamburger-line {
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, #00ffff, #ff0080, #00ffff);
    border-radius: 3px;
    box-shadow: 0 0 5px #00ffff, 0 0 10px #ff0080;
    transition: all 0.3s ease;
}

.hamburger-menu:hover .hamburger-line {
    box-shadow: 0 0 10px #00ffff, 0 0 20px #ff0080;
}

/* Animations */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: translateX(-50%) scale(1); }
    50% { opacity: 0.7; transform: translateX(-50%) scale(1.1); }
}

@keyframes glow {
    0%, 100% { box-shadow: 0 0 5px currentColor; }
    50% { box-shadow: 0 0 20px currentColor; }
}

/* Mobile Responsive updates */
@media (max-width: 768px) {
    body {
        cursor: auto;
    }
    
    #mobileControls {
        display: block;
    }
    
    #topBar {
        padding: 15px 5px;
        flex-wrap: nowrap;
        justify-content: space-between;
        background: linear-gradient(180deg, rgba(0,255,255,0.15) 0%, transparent 100%);
        margin-top: 50px;
    }
    
    #persistentHeader {
        height: 50px;
        padding: 0 15px;
    }
    
    .app-title {
        font-size: 18px;
        letter-spacing: 1px;
    }
    
    #gameContainer {
        padding-top: 50px;
    }
    
    #gameCanvas {
        height: calc(100vh - 50px);
    }
    
    #leaderboard {
        width: 180px;
        top: 80px;
        right: 10px;
        padding: 10px;
        font-size: 12px;
    }
    
    #leaderboard h3 {
        font-size: 12px;
        margin-bottom: 8px;
    }
    
    .player-entry {
        padding: 3px 0;
    }
    
    .player-name, .player-score {
        font-size: 10px;
    }
    
    .welcome-content {
        margin: 10px;
        padding: 20px;
        max-width: 90vw;
    }
    
    .welcome-content h1 {
        font-size: 28px;
        margin-bottom: 15px;
    }
    
    .welcome-content p {
        font-size: 14px;
        margin-bottom: 20px;
    }
    
    .game-rules {
        margin: 20px 0;
        padding: 15px;
    }
    
    .game-rules h3 {
        font-size: 14px;
    }
    
    .game-rules ul {
        font-size: 12px;
    }
    
    .how-to-play-header {
        padding: 15px 20px 12px 20px;
    }
    
    .how-to-play-header h3 {
        font-size: 18px;
    }
    
    .how-to-play-scrollable {
        padding: 15px 20px 25px 20px;
    }
    
    .how-to-play-section {
        margin-bottom: 15px;
    }
    
    .how-to-play-section h4 {
        font-size: 15px;
        margin-bottom: 10px;
    }
    
    .how-to-play-section li {
        font-size: 13px;
        margin-bottom: 6px;
        padding-left: 12px;
    }
    
    .how-to-play-section .key-combo {
        font-size: 11px;
        padding: 1px 4px;
    }
    
    .how-to-play-content .close-button {
        width: 28px;
        height: 28px;
        font-size: 16px;
    }
    
    .neon-button {
        padding: 12px 30px;
        font-size: 16px;
    }
    
    #powerupIndicator {
        display: none;
    }
    
    .powerup-text {
        font-size: 10px;
    }
    
    .powerup-icon {
        width: 15px;
        height: 15px;
    }
    
    #gameMessages {
        font-size: 18px;
        max-width: 90vw;
        word-wrap: break-word;
    }
    
    .mode-selection-content {
        margin: 10px;
        padding: 20px;
        max-width: 90vw;
    }
    
    .mode-selection-content h1 {
        font-size: 28px;
        margin-bottom: 15px;
    }
    
    .mode-selection-content p {
        font-size: 14px;
        margin-bottom: 20px;
    }
    
    .mode-buttons {
        flex-direction: column;
        gap: 15px;
    }
    
    .mode-button {
        padding: 20px 15px;
        min-width: auto;
    }
    
    .mode-icon {
        font-size: 36px;
        margin-bottom: 10px;
    }
    
    .mode-button h3 {
        font-size: 16px;
        margin: 10px 0 8px 0;
    }
    
    .mode-button p {
        font-size: 12px;
    }
    
    .main-menu-content h1 {
        font-size: 36px;
        letter-spacing: 2px;
    }
    
    .main-menu-content p {
        font-size: 16px;
        margin-bottom: 30px;
    }

    #gameLogo {
        width: 120px;
        margin: 15px auto 30px auto;
    }
    
    .main-menu-btn {
        padding: 18px 20px;
        gap: 15px;
    }
    
    .btn-icon {
        font-size: 28px;
        min-width: 35px;
    }
    
    .btn-content h3 {
        font-size: 16px;
    }
    
    .btn-content p {
        font-size: 13px;
    }
    
    .game-info span {
        font-size: 11px;
    }
    
    .game-preview-rules {
        padding: 15px;
    }
    
    .game-preview-rules h3 {
        font-size: 14px;
        margin-bottom: 12px;
    }
    
    .game-preview-rules li {
        font-size: 13px;
        margin-bottom: 6px;
    }
    
    .app-footer {
        padding: 12px 15px;
        font-size: 11px;
    }
}

@media (max-height: 600px) {
    #topBar {
        padding: 8px 5px;
        margin-top: 60px;
    }
    
    #leaderboard {
        top: 60px;
        max-height: 150px;
        overflow-y: auto;
    }
    
    #powerupIndicator {
        display: none;
    }
    
    #joystick {
        bottom: 15px;
        width: 70px;
        height: 70px;
        left: 15px;
    }
    
    #boostButton {
        /* Calculate position relative to joystick's top-right/top-left corner for small screens */
        bottom: calc(15px + 70px - 20px); /* Joystick bottom + height - half button height */
        left: calc(15px + 70px - 20px); /* Joystick left + width - half button width */
        width: 40px;
        height: 40px;
        font-size: 8px;
    }

    body.right-handed #joystick {
        left: auto;
        right: 15px;
    }

    body.right-handed #boostButton {
        left: auto;
        right: calc(15px + 70px - 20px); /* Joystick right + width - half button width */
    }
    
    #gameLogo {
        width: 90px;
        margin: 10px auto 20px auto;
    }
    
    .modal-content {
        max-width: 250px;
        padding: 20px;
    }
    
    .modal-header h2 {
        font-size: 20px;
    }
    
    .menu-button {
        padding: 12px;
        font-size: 12px;
    }
    
    .how-to-play-header {
        padding: 10px 15px 8px 15px;
    }
    
    .how-to-play-header h3 {
        font-size: 16px;
    }
    
    .how-to-play-scrollable {
        padding: 10px 15px 20px 15px;
    }
    
    .how-to-play-section {
        margin-bottom: 15px;
    }
    
    .how-to-play-section h4 {
        font-size: 14px;
        margin-bottom: 8px;
    }
    
    .how-to-play-section li {
        font-size: 12px;
        margin-bottom: 5px;
    }
}