/* CRITICAL: Desktop Override - Prevent mobile controls on PC/Desktop */
@media screen and (hover: hover) and (pointer: fine) {
    .mobile-controls,
    .mobile-controls-game,
    .movement-pad,
    .move-button,
    .arcade-btn,
    .mobile-controls-text,
    .action-buttons-grid,
    .instructions-button {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
        pointer-events: none !important;
    }
    
    .desktop-controls {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
    }
}

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

body {
    background: linear-gradient(135deg, #0f0f23, #1a1a2e);
    font-family: 'Press Start 2P', 'Courier New', monospace;
    color: #00ffff;
    overflow: hidden;
    height: 100vh;
}

/* TITLE SCREEN STYLES */
#titleScreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-image: 
        linear-gradient(rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0.8)),
        url('PongTitleScreen.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    font-family: 'Press Start 2P', 'Courier New', monospace;
    overflow: hidden;
}

#titleScreen::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        radial-gradient(2px 2px at 20px 30px, #00ffff, transparent),
        radial-gradient(2px 2px at 40px 70px, #ffffff, transparent),
        radial-gradient(1px 1px at 90px 40px, #00ffff, transparent),
        radial-gradient(1px 1px at 130px 80px, #ffffff, transparent),
        radial-gradient(2px 2px at 160px 30px, #00ffff, transparent),
        radial-gradient(1px 1px at 200px 90px, #ffffff, transparent),
        radial-gradient(2px 2px at 240px 50px, #00ffff, transparent),
        radial-gradient(1px 1px at 280px 10px, #ffffff, transparent),
        radial-gradient(2px 2px at 320px 70px, #00ffff, transparent),
        radial-gradient(1px 1px at 360px 40px, #ffffff, transparent);
    background-repeat: repeat;
    background-size: 400px 100px;
    animation: starfield 20s linear infinite;
    opacity: 0.6;
    z-index: -2;
}

#titleScreen::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 40%;
    background:
        linear-gradient(to bottom, transparent 0%, rgba(0, 255, 255, 0.05) 100%);
    transform: perspective(500px) rotateX(75deg);
    transform-origin: bottom;
    z-index: -1;
}

@keyframes starfield {
    from { transform: translateX(0px); }
    to { transform: translateX(-400px); }
}

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

.main-title {
    font-size: 64px;
    font-weight: normal;
    color: #0066ff;
    text-shadow: 
        0 0 30px currentColor,
        0 0 60px currentColor,
        0 0 90px currentColor,
        4px 4px 0px #000000,
        -4px -4px 0px #000000,
        4px -4px 0px #000000,
        -4px 4px 0px #000000;
    letter-spacing: 6px;
    text-align: center;
    border: 4px solid currentColor;
    padding: 30px 50px;
    border-radius: 15px;
    background: rgba(0, 0, 0, 0.9);
    box-shadow: 
        0 0 50px rgba(0, 102, 255, 0.8),
        inset 0 0 30px rgba(0, 102, 255, 0.2);
    animation: 
        titlePulse 4s ease-in-out infinite,
        titleGlow 2s ease-in-out infinite alternate,
        titleFloat 6s ease-in-out infinite;
    margin-bottom: 50px;
    position: relative;
    font-family: 'Press Start 2P', 'Courier New', monospace;
}

.main-title::before {
    content: '★ ★ ★';
    position: absolute;
    top: -45px;
    left: 50%;
    transform: translateX(-50%);
    color: inherit;
    font-size: 20px;
    animation: sparkle 2s ease-in-out infinite alternate;
    font-family: 'Press Start 2P', 'Courier New', monospace;
    text-shadow: 0 0 15px currentColor;
}

.main-title::after {
    content: '';
    position: absolute;
    top: -8px;
    left: -8px;
    right: -8px;
    bottom: -8px;
    background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    border-radius: 20px;
    animation: shimmer 4s linear infinite;
    z-index: -1;
}

.credits-text {
    font-size: 14px;
    color: #00ffff;
    text-shadow: 
        0 0 20px #00ffff,
        2px 2px 0px #000000,
        -2px -2px 0px #000000,
        2px -2px 0px #000000,
        -2px 2px 0px #000000;
    text-align: center;
    margin-bottom: 60px;
    background: rgba(0, 0, 0, 0.9);
    padding: 20px 30px;
    border-radius: 10px;
    font-family: 'Press Start 2P', 'Courier New', monospace;
}

.start-prompt {
    font-size: 20px;
    color: #ffff00;
    text-shadow: 
        0 0 20px currentColor,
        2px 2px 0px #000000,
        -2px -2px 0px #000000,
        2px -2px 0px #000000,
        -2px 2px 0px #000000;
    text-align: center;
    animation: spacebarTransitional 4s ease-in-out infinite;
    background: rgba(0, 0, 0, 0.8);
    padding: 20px 30px;
    border-radius: 10px;
    font-family: 'Press Start 2P', 'Courier New', monospace;
    position: relative;
    z-index: 1001;
}

/* Spacebar animation overlay */
.spacebar-animation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: radial-gradient(circle at center, rgba(0,255,255,0.4) 0%, rgba(0,255,255,0.2) 30%, rgba(255,255,255,0.1) 50%, transparent 70%);
    opacity: 0;
    pointer-events: none;
    z-index: 9999;
    display: none;
}

.spacebar-animation.active {
    display: block;
    animation: spacebarPulse 0.8s ease-out forwards;
}

@keyframes spacebarPulse {
    0% { 
        opacity: 0;
        transform: scale(0.2);
    }
    25% { 
        opacity: 0.8;
        transform: scale(0.8);
    }
    50% { 
        opacity: 1;
        transform: scale(1.2);
    }
    75% { 
        opacity: 0.6;
        transform: scale(1.8);
    }
    100% { 
        opacity: 0;
        transform: scale(2.5);
    }
}

@keyframes titlePulse {
    0% { 
        color: #0066ff;
        box-shadow: 
            0 0 50px rgba(0, 102, 255, 0.8),
            inset 0 0 30px rgba(0, 102, 255, 0.2);
        transform: scale(1);
    }
    33% { 
        color: #ff3366;
        box-shadow: 
            0 0 50px rgba(255, 51, 102, 0.8),
            inset 0 0 30px rgba(255, 51, 102, 0.2);
        transform: scale(1.02);
    }
    66% { 
        color: #ffffff;
        box-shadow: 
            0 0 50px rgba(255, 255, 255, 0.8),
            inset 0 0 30px rgba(255, 255, 255, 0.2);
        transform: scale(1.05);
    }
    100% { 
        color: #0066ff;
        box-shadow: 
            0 0 50px rgba(0, 102, 255, 0.8),
            inset 0 0 30px rgba(0, 102, 255, 0.2);
        transform: scale(1);
    }
}

@keyframes titleGlow {
    0% { 
        filter: brightness(1) saturate(1);
    }
    100% { 
        filter: brightness(1.3) saturate(1.5);
    }
}

@keyframes titleFloat {
    0%, 100% { 
        transform: translateY(0px) rotate(0deg);
    }
    50% { 
        transform: translateY(-10px) rotate(0.5deg);
    }
}

@keyframes sparkle {
    0% { 
        opacity: 0.5; 
        transform: translateX(-50%) scale(0.8);
        text-shadow: 0 0 10px currentColor;
    }
    100% { 
        opacity: 1; 
        transform: translateX(-50%) scale(1.2);
        text-shadow: 0 0 25px currentColor, 0 0 35px #ffffff;
    }
}

@keyframes shimmer {
    0% { transform: rotate(0deg) scale(1); opacity: 0.3; }
    50% { transform: rotate(180deg) scale(1.05); opacity: 0.7; }
    100% { transform: rotate(360deg) scale(1); opacity: 0.3; }
}

@keyframes spacebarTransitional {
    0% { 
        color: #0066ff;
        text-shadow: 
            0 0 20px currentColor,
            2px 2px 0px #000000,
            -2px -2px 0px #000000,
            2px -2px 0px #000000,
            -2px 2px 0px #000000;
    }
    33% { 
        color: #ff3366;
        text-shadow: 
            0 0 20px currentColor,
            2px 2px 0px #000000,
            -2px -2px 0px #000000,
            2px -2px 0px #000000,
            -2px 2px 0px #000000;
    }
    66% { 
        color: #ffffff;
        text-shadow: 
            0 0 20px currentColor,
            2px 2px 0px #000000,
            -2px -2px 0px #000000,
            2px -2px 0px #000000,
            -2px 2px 0px #000000;
    }
    100% {
        color: #0066ff;
        text-shadow:
            0 0 20px currentColor,
            2px 2px 0px #000000,
            -2px -2px 0px #000000,
            2px -2px 0px #000000,
            -2px 2px 0px #000000;
    }
}

/* GAME SCREEN STYLES */
#gameScreen {
    display: none;
    text-align: center;
    padding: 20px;
    height: 100vh;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    font-family: 'Press Start 2P', 'Courier New', monospace;
    position: relative;
}

/* Ensure mobile controls are visible when game screen is active */
#gameScreen.active ~ .mobile-controls,
body[data-screen="game"] .mobile-controls {
    display: flex !important;
}

#gameCanvas {
    border: 3px solid #00ffff;
    box-shadow: 0 0 30px rgba(0, 255, 255, 0.5);
    background: #000;
}

.score {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 18px;
    margin: 0;
    text-shadow: 0 0 15px #00ffff;
    font-family: 'Press Start 2P', 'Courier New', monospace;
    background: rgba(0, 0, 0, 0.4);
    padding: 8px 16px;
    border-radius: 8px;
    border: 1px solid rgba(0, 255, 255, 0.5);
    z-index: 1001;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

.controls {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 8px;
    color: #00ffff;
    font-family: 'Press Start 2P', 'Courier New', monospace;
    line-height: 1.4;
    background: rgba(0, 0, 0, 0.4);
    padding: 6px 12px;
    border-radius: 6px;
    border: 1px solid rgba(0, 255, 255, 0.3);
    z-index: 1001;
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    text-align: center;
}

.fullscreen-indicator {
    position: absolute;
    top: 15px;
    right: 15px;
    color: #00ffff;
    font-size: 10px;
    text-shadow: 0 0 10px #00ffff;
    font-family: 'Press Start 2P', 'Courier New', monospace;
}

.instructions-button {
    position: absolute;
    top: 15px;
    left: 15px;
    color: #ffaa00;
    font-size: 10px;
    text-shadow: 0 0 10px #ffaa00;
    font-family: 'Press Start 2P', 'Courier New', monospace;
    background: rgba(0, 0, 0, 0.4);
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid rgba(255, 170, 0, 0.3);
    cursor: pointer;
    display: none;
    transition: all 0.3s;
    z-index: 1002;
}

.instructions-button:hover {
    background: rgba(255, 170, 0, 0.2);
    color: #ffffff;
    border-color: #ffffff;
    box-shadow: 0 0 15px rgba(255, 170, 0, 0.6);
    transform: scale(1.05);
}

/* Instructions Popup */
#instructionsPopup {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.8);
    z-index: 10000;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

.instructions-content {
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.95), rgba(20, 20, 60, 0.95));
    border: 3px solid #ffaa00;
    border-radius: 15px;
    padding: 25px;
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 0 40px rgba(255, 170, 0, 0.8);
    animation: instructionsSlide 0.3s ease-out;
    font-family: 'Press Start 2P', 'Courier New', monospace;
}

@keyframes instructionsSlide {
    from {
        opacity: 0;
        transform: scale(0.8) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.instructions-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 2px solid #ffaa00;
    padding-bottom: 15px;
}

.instructions-header h3 {
    color: #ffaa00;
    font-size: 16px;
    text-shadow: 0 0 15px #ffaa00;
    margin: 0;
}

.close-btn {
    background: none;
    border: 2px solid #ff4444;
    color: #ff4444;
    font-size: 20px;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: Arial, sans-serif;
    transition: all 0.3s;
}

.close-btn:hover {
    background: #ff4444;
    color: #ffffff;
    box-shadow: 0 0 15px rgba(255, 68, 68, 0.6);
    transform: scale(1.1);
}

.instructions-body {
    color: #ffffff;
}

.control-section {
    margin-bottom: 20px;
}

.control-section h4 {
    color: #00ffff;
    font-size: 12px;
    margin-bottom: 10px;
    text-shadow: 0 0 10px #00ffff;
}

.control-section p {
    font-size: 10px;
    margin: 5px 0;
    line-height: 1.4;
    text-shadow: 0 0 5px #ffffff;
}

/* COUNTDOWN STYLES */
#countdown {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.95);
    padding: 60px 80px;
    border: 4px solid #00ffff;
    border-radius: 20px;
    text-align: center;
    display: none;
    box-shadow: 0 0 60px rgba(0, 255, 255, 0.8);
    z-index: 999;
}

.countdown-number {
    font-size: 80px;
    color: #00ffff;
    text-shadow: 0 0 40px #00ffff;
    margin: 0;
    font-family: 'Press Start 2P', 'Courier New', monospace;
}

/* GAME OVER STYLES */
#gameOver {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.95);
    padding: 60px;
    border: 4px solid #0066ff;
    border-radius: 20px;
    text-align: center;
    display: none;
    box-shadow: 0 0 60px rgba(0, 102, 255, 0.8);
    z-index: 999;
    font-family: 'Press Start 2P', 'Courier New', monospace;
    animation: gameOverBorderPulse 4s ease-in-out infinite;
}

#gameOver h2 {
    font-size: 24px;
    margin: 0 0 30px 0;
    color: #0066ff;
    text-shadow:
        0 0 30px currentColor,
        0 0 60px currentColor,
        0 0 90px currentColor,
        2px 2px 0px #000000,
        -2px -2px 0px #000000,
        2px -2px 0px #000000,
        -2px 2px 0px #000000;
    font-family: 'Press Start 2P', 'Courier New', monospace;
    animation:
        gameOverTextPulse 4s ease-in-out infinite,
        gameOverTextGlow 2s ease-in-out infinite alternate,
        gameOverTextFloat 6s ease-in-out infinite;
}

.menu-container {
    margin-top: 30px;
}

.menu-option {
    background: rgba(0, 0, 0, 0.8);
    color: #0066ff;
    border: 2px solid #0066ff;
    padding: 15px 25px;
    font-size: 12px;
    cursor: pointer;
    border-radius: 8px;
    margin: 10px;
    font-family: 'Press Start 2P', 'Courier New', monospace;
    text-transform: uppercase;
    text-shadow:
        0 0 15px currentColor,
        2px 2px 0px #000000,
        -2px -2px 0px #000000,
        2px -2px 0px #000000,
        -2px 2px 0px #000000;
    transition: all 0.3s;
    display: block;
    width: 300px;
    margin: 10px auto;
}

.menu-option:hover,
.menu-option.selected {
    background: rgba(0, 102, 255, 0.3) !important;
    color: #ffffff !important;
    border-color: #ffffff !important;
    box-shadow: 0 0 20px rgba(0, 102, 255, 0.8) !important;
    transform: scale(1.05) !important;
    text-shadow:
        0 0 15px #ffffff,
        2px 2px 0px #000000,
        -2px -2px 0px #000000,
        2px -2px 0px #000000,
        -2px 2px 0px #000000 !important;
}

@keyframes gameOverBorderPulse {
    0% {
        border-color: #0066ff;
        box-shadow: 0 0 60px rgba(0, 102, 255, 0.8);
    }
    33% {
        border-color: #ff3366;
        box-shadow: 0 0 60px rgba(255, 51, 102, 0.8);
    }
    66% {
        border-color: #ffffff;
        box-shadow: 0 0 60px rgba(255, 255, 255, 0.8);
    }
    100% {
        border-color: #0066ff;
        box-shadow: 0 0 60px rgba(0, 102, 255, 0.8);
    }
}

@keyframes gameOverTextPulse {
    0% {
        color: #0066ff;
        transform: scale(1);
    }
    33% {
        color: #ff3366;
        transform: scale(1.02);
    }
    66% {
        color: #ffffff;
        transform: scale(1.05);
    }
    100% {
        color: #0066ff;
        transform: scale(1);
    }
}

@keyframes gameOverTextGlow {
    0% {
        filter: brightness(1) saturate(1);
    }
    100% {
        filter: brightness(1.3) saturate(1.5);
    }
}

@keyframes gameOverTextFloat {
    0%, 100% {
        transform: translateY(0px) rotate(0deg) scale(1);
    }
    50% {
        transform: translateY(-5px) rotate(0.2deg) scale(1.02);
    }
}

/* HIGH SCORES STYLES */
#highScores {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.95), rgba(20, 20, 60, 0.95));
    padding: 40px;
    border: 4px solid #ffaa00;
    border-radius: 20px;
    text-align: center;
    display: none;
    box-shadow: 0 0 60px rgba(255, 170, 0, 0.8);
    z-index: 999;
    font-family: 'Press Start 2P', 'Courier New', monospace;
    width: 600px;
    max-height: 80vh;
    overflow: hidden;
    transition: all 0.5s ease;
}

.highscores-title {
    font-size: 28px;
    color: #ffaa00;
    text-shadow:
        0 0 30px currentColor,
        0 0 60px currentColor,
        4px 4px 0px #000000,
        -4px -4px 0px #000000,
        4px -4px 0px #000000,
        -4px 4px 0px #000000;
    margin-bottom: 30px;
    animation: titlePulse 4s ease-in-out infinite;
}

.scores-container {
    padding: 20px 0;
    margin: 20px 0;
    height: 450px;
    overflow: hidden;
    position: relative;
}

.scores-scrolling {
    position: absolute;
    top: 80px; /* Start well below the header */
    left: 0;
    right: 0;
    animation: scoreScroll 18s linear forwards; /* Faster animation */
    z-index: 1; /* Below header */
}

.score-header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10; /* Keep header above scrolling content */
    background: rgba(0, 0, 0, 1); /* Solid black background */
    padding: 15px 0;
    border-bottom: 2px solid #ffaa00;
}

.thank-you-message {
    text-align: center;
    margin-top: 50px;
    font-size: 24px;
    color: #ffaa00;
    text-shadow:
        0 0 20px #ffaa00,
        0 0 40px #ffaa00,
        2px 2px 0px #000000,
        -2px -2px 0px #000000,
        2px -2px 0px #000000,
        -2px 2px 0px #000000;
    animation: titlePulse 3s ease-in-out infinite;
}

/* Galaga-style explosion debris */
.galaga-debris {
    position: absolute;
    pointer-events: none;
    z-index: 10000;
}

@keyframes scoreScroll {
    0% {
        transform: translateY(0); /* Start at top */
    }
    100% {
        transform: translateY(-70%); /* Consistent speed to bottom */
    }
}

.score-header {
    display: grid;
    grid-template-columns: 60px 200px 120px;
    gap: 20px;
    padding: 15px;
    border-bottom: 2px solid #00ffff;
    margin-bottom: 15px;
    font-size: 14px;
    color: #00ffff;
    text-shadow: 0 0 10px #00ffff;
}

.score-entry {
    display: grid;
    grid-template-columns: 60px 200px 120px;
    gap: 20px;
    padding: 12px 15px;
    margin: 5px 0;
    border-radius: 8px;
    font-size: 12px;
    transition: all 0.3s;
    animation: scoreEntryTransition 6s ease-in-out infinite;
    border: 1px solid transparent;
}

.score-entry:nth-child(odd) {
    background: rgba(0, 255, 255, 0.1);
}

.score-entry:nth-child(even) {
    background: rgba(255, 170, 0, 0.1);
}

.score-entry.new-entry {
    background: rgba(255, 255, 0, 0.3) !important;
    box-shadow: 0 0 20px rgba(255, 255, 0, 0.6);
    border: 1px solid #ffff00;
    animation: newEntryPulse 2s ease-in-out infinite;
}

.score-rank {
    color: #ffaa00;
    text-shadow: 0 0 10px #ffaa00;
    font-weight: bold;
    animation: rankTransition 8s ease-in-out infinite;
}

.score-name {
    color: #00ffff;
    text-shadow: 0 0 10px #00ffff;
    animation: nameTransition 8s ease-in-out infinite;
}

.score-wins {
    color: #ffffff;
    text-shadow: 0 0 10px #ffffff;
    animation: winsTransition 8s ease-in-out infinite;
}

@keyframes scoreEntryTransition {
    0%, 100% {
        filter: brightness(1);
        border-color: transparent;
    }
    25% {
        filter: brightness(1.3);
        border-color: rgba(0, 255, 255, 0.5);
    }
    50% {
        filter: brightness(1.1);
        border-color: rgba(255, 170, 0, 0.5);
    }
    75% {
        filter: brightness(1.3);
        border-color: rgba(255, 255, 255, 0.3);
    }
}

@keyframes rankTransition {
    0% { color: #ffaa00; text-shadow: 0 0 10px #ffaa00; }
    33% { color: #ff3366; text-shadow: 0 0 10px #ff3366; }
    66% { color: #00ffff; text-shadow: 0 0 10px #00ffff; }
    100% { color: #ffaa00; text-shadow: 0 0 10px #ffaa00; }
}

@keyframes nameTransition {
    0% { color: #00ffff; text-shadow: 0 0 10px #00ffff; }
    33% { color: #ffffff; text-shadow: 0 0 10px #ffffff; }
    66% { color: #ffaa00; text-shadow: 0 0 10px #ffaa00; }
    100% { color: #00ffff; text-shadow: 0 0 10px #00ffff; }
}

@keyframes winsTransition {
    0% { color: #ffffff; text-shadow: 0 0 10px #ffffff; }
    33% { color: #ffaa00; text-shadow: 0 0 10px #ffaa00; }
    66% { color: #ff3366; text-shadow: 0 0 10px #ff3366; }
    100% { color: #ffffff; text-shadow: 0 0 10px #ffffff; }
}

@keyframes newEntryPulse {
    0%, 100% {
        box-shadow: 0 0 20px rgba(255, 255, 0, 0.6);
    }
    50% {
        box-shadow: 0 0 30px rgba(255, 255, 0, 0.9);
    }
}

.back-btn {
    background: rgba(0, 0, 0, 0.8);
    color: #ffaa00;
    border: 2px solid #ffaa00;
    padding: 15px 25px;
    font-size: 12px;
    cursor: pointer;
    border-radius: 8px;
    margin-top: 20px;
    font-family: 'Press Start 2P', 'Courier New', monospace;
    text-transform: uppercase;
    transition: all 0.3s;
}

.back-btn:hover {
    background: rgba(255, 170, 0, 0.2);
    color: #ffffff;
    border-color: #ffffff;
    box-shadow: 0 0 20px rgba(255, 170, 0, 0.6);
}

/* ARCADE-STYLE INITIALS INPUT STYLES */
#initialsInput {
    position: fixed !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.95), rgba(20, 20, 60, 0.95));
    padding: 15px;
    border: 2px solid #ffaa00;
    border-radius: 8px;
    text-align: center;
    display: none;
    box-shadow: 0 0 60px rgba(255, 170, 0, 0.8);
    z-index: 9999 !important;
    font-family: 'Press Start 2P', 'Courier New', monospace;
    animation: titlePulse 4s ease-in-out infinite;
    width: 320px;
    height: 260px;
    margin: 0 !important;
    right: auto !important;
    bottom: auto !important;
}

#initialsInput h2 {
    font-size: 12px;
    color: #ffaa00;
    text-shadow:
        0 0 30px currentColor,
        0 0 60px currentColor,
        4px 4px 0px #000000,
        -4px -4px 0px #000000,
        4px -4px 0px #000000,
        -4px 4px 0px #000000;
    margin-bottom: 8px;
    animation: titlePulse 4s ease-in-out infinite;
}

#initialsInput p {
    color: #00ffff;
    font-size: 10px;
    margin-bottom: 15px;
    text-shadow: 0 0 15px #00ffff;
}

.current-initials {
    font-size: 16px;
    color: #ffffff;
    text-shadow: 0 0 20px #ffffff;
    margin: 8px 0;
    letter-spacing: 4px;
    border: 1px solid #00ffff;
    padding: 6px 16px;
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.8);
}

.alphabet-grid {
    display: grid;
    grid-template-columns: repeat(7, 32px);
    gap: 4px;
    margin: 10px auto;
    width: 252px;
    justify-content: center;
    align-items: center;
}

.alphabet-letter {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    border: 1px solid #00ffff;
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.8);
    cursor: pointer;
    transition: all 0.3s;
    font-family: 'Press Start 2P', 'Courier New', monospace;
    animation: letterTransition 4s ease-in-out infinite;
}

.alphabet-letter:hover,
.alphabet-letter.selected {
    background: rgba(0, 255, 255, 0.3) !important;
    color: #ffffff !important;
    border-color: #ffffff !important;
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.8) !important;
    transform: scale(1.1) !important;
    text-shadow: 0 0 15px #ffffff !important;
}

.alphabet-letter.end-option {
    font-size: 12px !important;
    padding: 2px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    word-break: break-all;
    letter-spacing: -1px;
}

.alphabet-letter.end-option {
    width: 32px;
    height: 32px;
    background: rgba(255, 170, 0, 0.2);
    border-color: #ffaa00;
    color: #ffaa00;
    font-size: 8px;
}

.alphabet-letter.end-option:hover,
.alphabet-letter.end-option.selected {
    background: rgba(255, 170, 0, 0.4) !important;
    color: #ffffff !important;
    border-color: #ffffff !important;
    box-shadow: 0 0 20px rgba(255, 170, 0, 0.8) !important;
}

@keyframes letterTransition {
    0% {
        color: #00ffff;
        text-shadow: 0 0 10px #00ffff;
    }
    33% {
        color: #ff3366;
        text-shadow: 0 0 10px #ff3366;
    }
    66% {
        color: #ffaa00;
        text-shadow: 0 0 10px #ffaa00;
    }
    100% {
        color: #00ffff;
        text-shadow: 0 0 10px #00ffff;
    }
}

.initials-instructions {
    font-size: 10px;
    color: #ffffff;
    text-shadow: 0 0 10px #ffffff;
    margin-top: 20px;
    line-height: 1.5;
}

/* Explosion effect styles */
.explosion-particle {
    position: absolute;
    width: 8px;
    height: 8px;
    background: #ffff00;
    border-radius: 50%;
    pointer-events: none;
    opacity: 0;
}

.explosion-active .main-title {
    animation: titleExplode 1.2s ease-out forwards;
}

.explosion-active .credits-text {
    animation: creditsExplode 1.2s ease-out forwards;
}

.explosion-active .start-prompt {
    animation: promptExplode 1.2s ease-out forwards;
}

.explosion-active #titleScreen::before {
    animation: backgroundShake 1.2s ease-out forwards;
}

@keyframes titleExplode {
    0% {
        transform: translateY(0px) rotate(0deg) scale(1);
        opacity: 1;
    }
    30% {
        transform: translateY(-20px) rotate(-5deg) scale(1.1);
        opacity: 0.8;
    }
    100% {
        transform: translateY(-200px) rotate(-45deg) scale(0.3);
        opacity: 0;
    }
}

@keyframes creditsExplode {
    0% {
        transform: translateX(0px) rotate(0deg) scale(1);
        opacity: 1;
    }
    20% {
        transform: translateX(-10px) rotate(2deg) scale(1.05);
        opacity: 0.9;
    }
    100% {
        transform: translateX(-300px) rotate(25deg) scale(0.2);
        opacity: 0;
    }
}

@keyframes promptExplode {
    0% {
        transform: translateX(0px) rotate(0deg) scale(1);
        opacity: 1;
    }
    25% {
        transform: translateX(15px) rotate(-3deg) scale(1.08);
        opacity: 0.7;
    }
    100% {
        transform: translateX(400px) rotate(-30deg) scale(0.1);
        opacity: 0;
    }
}

@keyframes backgroundShake {
    0%, 100% { transform: translateX(0px) translateY(0px); }
    10% { transform: translateX(-5px) translateY(2px); }
    20% { transform: translateX(5px) translateY(-3px); }
    30% { transform: translateX(-3px) translateY(4px); }
    40% { transform: translateX(4px) translateY(-2px); }
    50% { transform: translateX(-6px) translateY(3px); }
    60% { transform: translateX(3px) translateY(-4px); }
    70% { transform: translateX(-4px) translateY(2px); }
    80% { transform: translateX(2px) translateY(-3px); }
    90% { transform: translateX(-2px) translateY(4px); }
}

@keyframes particleExplode {
    0% {
        opacity: 1;
        transform: scale(1);
    }
    100% {
        opacity: 0;
        transform: scale(0.1);
    }
}

@keyframes screenShake {
    0%, 100% { transform: translate(0px, 0px) rotate(0deg); }
    10% { transform: translate(-3px, 1px) rotate(-0.5deg); }
    20% { transform: translate(3px, -2px) rotate(0.5deg); }
    30% { transform: translate(-2px, 3px) rotate(-0.3deg); }
    40% { transform: translate(2px, -1px) rotate(0.3deg); }
    50% { transform: translate(-4px, 2px) rotate(-0.6deg); }
    60% { transform: translate(2px, -3px) rotate(0.4deg); }
    70% { transform: translate(-3px, 1px) rotate(-0.2deg); }
    80% { transform: translate(1px, -2px) rotate(0.2deg); }
    90% { transform: translate(-1px, 3px) rotate(-0.1deg); }
}

/* Electricity effect styles */
.electricity-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
}

.electricity-bolt {
    position: absolute;
    background: linear-gradient(90deg, transparent, #00ffff, #ffffff, #00ffff, transparent);
    height: 3px;
    opacity: 0;
    pointer-events: none;
}

.electricity-active .electricity-bolt {
    animation: electricityFlash 0.1s ease-in-out infinite;
}

@keyframes electricityFlash {
    0%, 100% {
        opacity: 0;
        transform: scaleY(1);
    }
    50% {
        opacity: 1;
        transform: scaleY(3);
    }
}

/* Plasma Shield Styles */
@keyframes shieldPulse {
    0% {
        transform: scale(1);
        opacity: 0.6;
    }
    50% {
        transform: scale(1.05);
        opacity: 0.8;
    }
    100% {
        transform: scale(1);
        opacity: 0.6;
    }
}

@keyframes shieldRipple {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    100% {
        transform: scale(1.3);
        opacity: 0;
    }
}

@keyframes shieldSparkle {
    0%, 100% {
        opacity: 0.3;
        transform: scale(0.8);
    }
    50% {
        opacity: 1;
        transform: scale(1.2);
    }
}

/* Vibrant button pulse animations */
@keyframes redPulse {
    0% {
        box-shadow: 0 6px 25px rgba(255, 20, 60, 0.6), inset 0 2px 4px rgba(255, 255, 255, 0.3), 0 0 20px rgba(255, 20, 60, 0.4);
        transform: scale(1);
    }
    100% {
        box-shadow: 0 8px 35px rgba(255, 20, 60, 0.8), inset 0 2px 4px rgba(255, 255, 255, 0.4), 0 0 30px rgba(255, 20, 60, 0.6);
        transform: scale(1.05);
    }
}

@keyframes bluePulse {
    0% {
        box-shadow: 0 6px 25px rgba(20, 140, 255, 0.6), inset 0 2px 4px rgba(255, 255, 255, 0.3), 0 0 20px rgba(20, 140, 255, 0.4);
        transform: scale(1);
    }
    100% {
        box-shadow: 0 8px 35px rgba(20, 140, 255, 0.8), inset 0 2px 4px rgba(255, 255, 255, 0.4), 0 0 30px rgba(20, 140, 255, 0.6);
        transform: scale(1.05);
    }
}

@keyframes yellowPulse {
    0% {
        box-shadow: 0 6px 25px rgba(255, 215, 0, 0.6), inset 0 2px 4px rgba(255, 255, 255, 0.4), 0 0 20px rgba(255, 215, 0, 0.4);
        transform: scale(1);
    }
    100% {
        box-shadow: 0 8px 35px rgba(255, 215, 0, 0.8), inset 0 2px 4px rgba(255, 255, 255, 0.5), 0 0 30px rgba(255, 215, 0, 0.6);
        transform: scale(1.05);
    }
}

@keyframes cyanPulse {
    0% {
        box-shadow: 0 6px 20px rgba(0, 255, 255, 0.7), inset 0 2px 4px rgba(255, 255, 255, 0.4), 0 0 15px rgba(0, 255, 255, 0.5);
        transform: scale(1);
    }
    100% {
        box-shadow: 0 8px 30px rgba(0, 255, 255, 0.9), inset 0 2px 4px rgba(255, 255, 255, 0.5), 0 0 25px rgba(0, 255, 255, 0.7);
        transform: scale(1.05);
    }
}

@keyframes joystickGlow {
    0% {
        box-shadow: 0 0 35px rgba(0, 255, 255, 0.6), inset 0 0 20px rgba(0, 255, 255, 0.2), 0 0 15px rgba(0, 255, 255, 0.3);
        border-color: rgba(0, 255, 255, 1);
    }
    100% {
        box-shadow: 0 0 50px rgba(0, 255, 255, 0.8), inset 0 0 25px rgba(0, 255, 255, 0.3), 0 0 25px rgba(0, 255, 255, 0.5);
        border-color: rgba(100, 255, 255, 1);
    }
}

/* Mobile Touch Controls - Translucent Overlay */
.mobile-controls {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 1000;
    pointer-events: none;
    background: transparent;
}

/* Force show mobile controls on touch devices - OUTSIDE media query */
.touch-device .mobile-controls,
.touch-device .mobile-controls-game,
.phone-device .mobile-controls,
.phone-device .mobile-controls-game,
body[data-mobile="true"] .mobile-controls,
body[data-mobile="true"] .mobile-controls-game {
    display: flex !important;
    visibility: visible !important;
}

/* Fallback for any touch-capable devices */
@media (hover: none) and (pointer: coarse) {
    .mobile-controls,
    .mobile-controls-game {
        display: flex !important;
        visibility: visible !important;
    }
}

/* Mobile Phone Layout - Portrait and Small Landscape */
@media (hover: none) and (pointer: coarse) and (max-width: 768px) {
    /* Shrink game area to make room for side controls */
    #gameCanvas {
        width: 60% !important;
        height: auto !important;
        margin: 0 auto !important;
        display: block !important;
    }
    
    #gameScreen {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        padding: 10px !important;
    }
    
    .touch-control-left,
    .touch-control-right {
        position: fixed !important;
        top: 50% !important;
        transform: translateY(-50%) !important;
    }
    
    .touch-control-left {
        left: 5px !important;
    }
    
    .touch-control-right {
        right: 5px !important;
    }
}

/* Tablet Layout - Better positioning */
@media (hover: none) and (pointer: coarse) and (min-width: 768px) {
    .touch-control-left {
        left: 50px !important;
        bottom: 100px !important;
        top: auto !important;
        transform: none !important;
    }
    
    .touch-control-right {
        right: 50px !important;
        bottom: 100px !important;
        top: auto !important;
        transform: none !important;
    }
}

.touch-control-left,
.touch-control-right {
    pointer-events: all;
}

.touch-control-left {
    position: fixed !important;
    left: 20px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    opacity: 0.9;
    transition: opacity 0.3s ease;
    z-index: 1001;
    background: rgba(0, 0, 0, 0.8) !important;
    padding: 20px !important;
    border-radius: 20px !important;
    border: 2px solid #00ffff !important;
}

.touch-control-left:hover,
.touch-control-left:active {
    opacity: 1.0;
    background: rgba(0, 0, 0, 0.9) !important;
}

.touch-control-right {
    position: fixed !important;
    right: 20px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    opacity: 0.9;
    transition: opacity 0.3s ease;
    z-index: 1001;
    background: rgba(0, 0, 0, 0.8) !important;
    padding: 15px !important;
    border-radius: 15px !important;
    border: 2px solid #00ffff !important;
}

.touch-control-right:hover,
.touch-control-right:active {
    opacity: 1.0;
    background: rgba(0, 0, 0, 0.9) !important;
}

/* Enhanced Movement Pad - Translucent Overlay Style */
.movement-pad {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: rgba(0, 0, 0, 0.3);
    border: 2px solid rgba(0, 255, 255, 0.6);
    border-radius: 20px;
    padding: 15px;
    box-shadow: 0 0 15px rgba(0, 255, 255, 0.2);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

/* Translucent Joystick Container */
.movement-pad {
    position: relative;
    background: rgba(42, 42, 42, 0.7);
    border: 2px solid rgba(0, 255, 255, 0.8);
    border-radius: 50%;
    width: 90px;
    height: 90px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 
        0 0 20px rgba(0, 255, 255, 0.2),
        inset 0 2px 4px rgba(0, 0, 0, 0.3),
        inset 0 -2px 4px rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.movement-pad::before {
    content: '';
    position: absolute;
    top: 10px;
    left: 10px;
    right: 10px;
    bottom: 10px;
    border: 2px solid #666;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, #333, #1a1a1a);
}

/* Joystick Stick */
.movement-pad::after {
    content: '';
    position: absolute;
    width: 24px;
    height: 60px;
    background: linear-gradient(180deg, #666 0%, #444 50%, #222 100%);
    border-radius: 12px;
    border: 2px solid #888;
    box-shadow: 
        0 4px 8px rgba(0, 0, 0, 0.5),
        inset 0 1px 2px rgba(255, 255, 255, 0.3);
    z-index: 10;
}

/* Joystick Buttons */
.move-button {
    position: absolute;
    background: linear-gradient(145deg, rgba(0, 255, 255, 0.6), rgba(0, 200, 200, 0.4));
    border: 3px solid #00ffff;
    border-radius: 50%;
    width: 35px;
    height: 35px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    touch-action: manipulation;
    user-select: none;
    font-family: 'Press Start 2P', 'Courier New', monospace;
    box-shadow: 
        0 4px 12px rgba(0, 255, 255, 0.4), 
        inset 0 1px 0 rgba(255, 255, 255, 0.4);
    transition: all 0.1s ease;
    cursor: pointer;
    z-index: 20;
}

.move-button.move-up {
    top: -15px;
    left: 50%;
    transform: translateX(-50%);
}

.move-button.move-down {
    bottom: -15px;
    left: 50%;
    transform: translateX(-50%);
}

.move-button:active {
    background: linear-gradient(145deg, rgba(0, 255, 255, 1), rgba(0, 220, 220, 0.9));
    transform: translateX(-50%) scale(0.9);
    box-shadow: 
        0 2px 6px rgba(0, 255, 255, 0.6), 
        inset 0 2px 4px rgba(0, 0, 0, 0.3);
}

.move-button.move-down:active {
    transform: translateX(-50%) scale(0.9);
}

.button-label {
    font-size: 12px;
    color: #ffffff;
    text-shadow: 0 0 8px #00ffff, 1px 1px 2px rgba(0, 0, 0, 0.8);
    line-height: 1;
    margin: 0;
    padding: 0;
}

.button-text {
    font-size: 3px;
    color: #ffffff;
    text-shadow: 0 0 6px #00ffff;
    margin-top: 2px;
    margin-bottom: 0;
    font-weight: bold;
    letter-spacing: 0.3px;
}

.movement-divider {
    position: absolute;
    bottom: -25px;
    left: 50%;
    transform: translateX(-50%);
    color: #00ffff;
    font-size: 6px;
    text-align: center;
    font-family: 'Press Start 2P', 'Courier New', monospace;
    text-shadow: 0 0 8px #00ffff;
    letter-spacing: 1px;
    background: rgba(0, 0, 0, 0.7);
    padding: 4px 8px;
    border-radius: 8px;
    border: 1px solid #00ffff;
    white-space: nowrap;
}

/* Arcade-Style Action Buttons - Street Fighter Layout */
.action-buttons-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(2, 1fr);
    gap: 10px;
    max-width: 180px;
}

/* Arcade Game Color Scheme: Red, Blue, Yellow, White */
.arcade-btn {
    border-radius: 50%;
    width: 45px;
    height: 45px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    touch-action: manipulation;
    user-select: none;
    font-family: 'Press Start 2P', 'Courier New', monospace;
    transition: all 0.1s ease;
    position: relative;
    overflow: hidden;
    border: 3px solid;
    cursor: pointer;
}

/* Red buttons (1st and 4th) - VIBRANT */
.arcade-btn:nth-child(1),
.arcade-btn:nth-child(4) {
    background: linear-gradient(145deg, rgba(255, 20, 60, 0.5), rgba(220, 20, 60, 0.3));
    border: 3px solid rgba(255, 20, 60, 1);
    box-shadow: 0 6px 25px rgba(255, 20, 60, 0.6), inset 0 2px 4px rgba(255, 255, 255, 0.3), 0 0 20px rgba(255, 20, 60, 0.4);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    animation: redPulse 2s ease-in-out infinite alternate;
}

.arcade-btn:nth-child(1):active,
.arcade-btn:nth-child(4):active {
    background: linear-gradient(145deg, rgba(220, 38, 38, 1), rgba(185, 28, 28, 0.9));
    box-shadow: 0 3px 12px rgba(239, 68, 68, 0.6), inset 0 2px 4px rgba(0, 0, 0, 0.2);
    transform: scale(0.95);
}

/* Blue buttons (2nd and 5th) - VIBRANT */
.arcade-btn:nth-child(2),
.arcade-btn:nth-child(5) {
    background: linear-gradient(145deg, rgba(20, 140, 255, 0.5), rgba(20, 100, 255, 0.3));
    border: 3px solid rgba(20, 140, 255, 1);
    box-shadow: 0 6px 25px rgba(20, 140, 255, 0.6), inset 0 2px 4px rgba(255, 255, 255, 0.3), 0 0 20px rgba(20, 140, 255, 0.4);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    animation: bluePulse 2s ease-in-out infinite alternate;
}

.arcade-btn:nth-child(2):active,
.arcade-btn:nth-child(5):active {
    background: linear-gradient(145deg, rgba(37, 99, 235, 1), rgba(29, 78, 216, 0.9));
    box-shadow: 0 3px 12px rgba(59, 130, 246, 0.6), inset 0 2px 4px rgba(0, 0, 0, 0.2);
    transform: scale(0.95);
}

/* Yellow buttons (3rd and 6th) - VIBRANT */
.arcade-btn:nth-child(3),
.arcade-btn:nth-child(6) {
    background: linear-gradient(145deg, rgba(255, 215, 0, 0.5), rgba(255, 185, 0, 0.3));
    border: 3px solid rgba(255, 215, 0, 1);
    box-shadow: 0 6px 25px rgba(255, 215, 0, 0.6), inset 0 2px 4px rgba(255, 255, 255, 0.4), 0 0 20px rgba(255, 215, 0, 0.4);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    animation: yellowPulse 2s ease-in-out infinite alternate;
}

.arcade-btn:nth-child(3):active,
.arcade-btn:nth-child(6):active {
    background: linear-gradient(145deg, rgba(245, 158, 11, 1), rgba(217, 119, 6, 0.9));
    box-shadow: 0 3px 12px rgba(250, 204, 21, 0.6), inset 0 2px 4px rgba(0, 0, 0, 0.2);
    transform: scale(0.95);
}

/* White buttons - add if needed as 7th+ buttons or override specific positions */
.arcade-btn.white-btn {
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.95), rgba(241, 245, 249, 0.8));
    border-color: #ffffff;
    box-shadow: 0 6px 20px rgba(255, 255, 255, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.arcade-btn.white-btn:active {
    background: linear-gradient(145deg, rgba(241, 245, 249, 1), rgba(226, 232, 240, 0.9));
    box-shadow: 0 3px 12px rgba(255, 255, 255, 0.4), inset 0 2px 4px rgba(0, 0, 0, 0.1);
    transform: scale(0.95);
}

.arcade-btn::before {
    content: '';
    position: absolute;
    top: 8px;
    left: 8px;
    right: 8px;
    height: 15px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    border-radius: 50%;
    opacity: 0.7;
    pointer-events: none;
}

.btn-letter {
    font-size: 10px;
    color: #ffffff;
    font-weight: bold;
    line-height: 1;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
    margin: 0;
    padding: 0;
}

/* Text colors for different button types */
.arcade-btn:nth-child(3) .btn-letter,
.arcade-btn:nth-child(6) .btn-letter,
.arcade-btn.white-btn .btn-letter {
    color: #1f2937;
    text-shadow: 1px 1px 2px rgba(255, 255, 255, 0.6);
}

.btn-name {
    font-size: 4px;
    color: #ffffff;
    margin-top: 2px;
    margin-bottom: 0;
    letter-spacing: 0.3px;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
    line-height: 1;
    text-transform: uppercase;
}

/* Text colors for button names */
.arcade-btn:nth-child(3) .btn-name,
.arcade-btn:nth-child(6) .btn-name,
.arcade-btn.white-btn .btn-name {
    color: #1f2937;
    text-shadow: 1px 1px 2px rgba(255, 255, 255, 0.6);
}

.desktop-controls {
    display: block;
}

.mobile-controls-text {
    display: none;
}

/* Mobile Instructions Styling */
.mobile-instructions-title {
    color: #00ffff;
    font-size: 14px;
    font-family: 'Press Start 2P', 'Courier New', monospace;
    text-align: center;
    margin-bottom: 10px;
    text-shadow: 0 0 10px #00ffff;
}

.mobile-instructions-content {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.instruction-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 10px;
    font-family: 'Press Start 2P', 'Courier New', monospace;
}

.control-type {
    color: #ffaa00;
    font-weight: bold;
    min-width: 80px;
    text-shadow: 0 0 8px #ffaa00;
}

.control-desc {
    color: #ffffff;
    text-shadow: 0 0 5px #00ffff;
    line-height: 1.3;
}

.mobile-controls-game {
    position: absolute;
    bottom: 20px;
    left: 0;
    right: 0;
    display: none !important;
}

/* Android device viewport fix */
@supports (-webkit-touch-callout: none) {
    body {
        min-height: 100vh;
        min-height: -webkit-fill-available;
    }
}

/* Fix for Android Chrome address bar */
body {
    min-height: 100vh;
    min-height: calc(var(--vh, 1vh) * 100);
}

/* Tablet-Specific Styles (768px to 1024px) */
@media screen and (min-width: 768px) and (max-width: 1024px) and (hover: none) and (pointer: coarse) {
    .mobile-controls,
    .mobile-controls-game {
        display: flex !important;
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        width: 100vw !important;
        height: 100vh !important;
        background: transparent !important;
        border: none !important;
        z-index: 1002 !important;
        pointer-events: none !important;
        padding: 0 !important;
        justify-content: flex-start !important;
        align-items: center !important;
    }
    
    .touch-control-left,
    .touch-control-right {
        pointer-events: all !important;
    }
    
    .instructions-button {
        display: block !important;
    }
    
    .touch-control-left {
        position: absolute !important;
        left: 25px !important;
        top: 50% !important;
        transform: translateY(-50%) !important;
    }
    
    .touch-control-right {
        position: absolute !important;
        right: 25px !important;
        top: 50% !important;
        transform: translateY(-50%) !important;
    }
    
    .desktop-controls {
        display: none !important;
    }
    
    .mobile-controls-text {
        display: none !important;
    }
    
    .fullscreen-indicator {
        display: none;
    }
    
    /* Smaller canvas for tablet */
    #gameCanvas {
        width: calc(100vw - 100px) !important;
        height: calc(100vh - 60px) !important;
        max-width: 700px !important;
        max-height: 400px !important;
        margin: 30px auto !important;
        position: relative !important;
        top: auto !important;
        left: auto !important;
        bottom: auto !important;
        right: auto !important;
        transform: none !important;
        z-index: 1 !important;
        display: block !important;
    }
    
    /* Larger tablet controls - Translucent like mobile */
    .move-button {
        width: 90px;
        height: 90px;
        margin: 12px 0;
        background: linear-gradient(145deg, rgba(0, 255, 255, 0.7), rgba(0, 200, 200, 0.5)) !important;
        backdrop-filter: blur(8px) !important;
        -webkit-backdrop-filter: blur(8px) !important;
    }
    
    .button-label {
        font-size: 32px;
    }
    
    .button-text {
        font-size: 7px;
        margin-top: 4px;
    }
    
    .movement-pad {
        padding: 22px;
        background: rgba(42, 42, 42, 0.4) !important;
        border: 3px solid rgba(68, 68, 68, 0.7) !important;
        backdrop-filter: blur(8px) !important;
        -webkit-backdrop-filter: blur(8px) !important;
        width: 160px !important;
        height: 160px !important;
    }
    
    .movement-divider {
        font-size: 10px;
        padding: 16px 12px;
    }
    
    .arcade-btn {
        width: 65px;
        height: 65px;
        border-width: 4px;
    }
    
    .btn-letter {
        font-size: 20px;
        margin: 0;
        padding: 0;
    }
    
    .btn-name {
        font-size: 6px;
        margin-top: 3px;
        margin-bottom: 0;
        line-height: 1;
    }
    
    .action-buttons-grid {
        gap: 12px;
        max-width: 280px;
        display: grid !important;
        grid-template-columns: repeat(3, 1fr) !important;
        grid-template-rows: repeat(2, 1fr) !important;
    }
    
    /* Ensure tablet buttons are visible and styled - More translucent */
    .arcade-btn {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        border-radius: 50% !important;
        backdrop-filter: blur(5px) !important;
        -webkit-backdrop-filter: blur(5px) !important;
        touch-action: manipulation !important;
        cursor: pointer !important;
    }
    
    /* Red buttons (1st and 4th) - More translucent for tablet */
    .arcade-btn:nth-child(1),
    .arcade-btn:nth-child(4) {
        background: rgba(239, 68, 68, 0.6) !important;
        border: 3px solid rgba(239, 68, 68, 0.8) !important;
        box-shadow: 0 4px 15px rgba(239, 68, 68, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.2) !important;
    }
    
    /* Blue buttons (2nd and 5th) - More translucent for tablet */
    .arcade-btn:nth-child(2),
    .arcade-btn:nth-child(5) {
        background: rgba(59, 130, 246, 0.6) !important;
        border: 3px solid rgba(59, 130, 246, 0.8) !important;
        box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.2) !important;
    }
    
    /* Yellow buttons (3rd and 6th) - More translucent for tablet */
    .arcade-btn:nth-child(3),
    .arcade-btn:nth-child(6) {
        background: rgba(250, 204, 21, 0.6) !important;
        border: 3px solid rgba(250, 204, 21, 0.8) !important;
        box-shadow: 0 4px 15px rgba(250, 204, 21, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.2) !important;
    }
    
    .mobile-instructions-title {
        font-size: 16px;
    }
    
    .instruction-row {
        font-size: 12px;
    }
}

/* Mobile and Tablet Responsiveness */
/* PRIORITY: Force mobile controls on ALL touch devices - Multiple detection methods */
@media (hover: none) and (pointer: coarse), 
       screen and (max-width: 1200px) and (pointer: coarse),
       screen and (max-height: 800px) and (orientation: landscape) and (pointer: coarse) {
    .mobile-controls,
    .mobile-controls-game {
        display: flex !important;
        visibility: visible !important;
        opacity: 1 !important;
        position: fixed !important;
        z-index: 9999 !important;
    }
    
    .desktop-controls {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
    }
    
    .mobile-controls-text {
        display: none !important; /* Hide text, show visual controls instead */
    }
}

/* Additional mobile detection fallback - Wide phones like Galaxy S21 */
@media screen and (max-width: 1200px) and (pointer: coarse),
       screen and (max-height: 1000px) and (orientation: landscape) and (hover: none) {
    .mobile-controls,
    .mobile-controls-game {
        display: flex !important;
        visibility: visible !important;
        opacity: 1 !important;
    }
    
    .touch-control-left {
        position: absolute !important;
        left: 25px !important;
        top: 50% !important;
        transform: translateY(-50%) !important;
    }
    
    .desktop-controls {
        display: none !important;
    }
}

/* Touch capability detection */
@media (max-width: 1024px) {
    .touch-device .mobile-controls,
    .touch-device .mobile-controls-game,
    .tablet-device .mobile-controls,
    .tablet-device .mobile-controls-game,
    .phone-device .mobile-controls,
    .phone-device .mobile-controls-game {
        display: flex !important;
        visibility: visible !important;
        opacity: 1 !important;
        position: fixed !important;
    }
}
    
    /* Force show visual joystick and arcade buttons */
    .movement-pad {
        display: flex !important;
        visibility: visible !important;
        opacity: 1 !important;
        position: relative !important;
        background: linear-gradient(145deg, #2a2a2a, #1a1a1a) !important;
        border: 6px solid #444 !important;
        border-radius: 50% !important;
        width: 140px !important;
        height: 140px !important;
    }
    
    .move-button {
        display: flex !important;
        visibility: visible !important;
        opacity: 1 !important;
        position: absolute !important;
        background: linear-gradient(145deg, rgba(0, 255, 255, 0.9), rgba(0, 200, 200, 0.7)) !important;
        border: 3px solid #00ffff !important;
        border-radius: 50% !important;
        width: 45px !important;
        height: 45px !important;
    }
    
    .arcade-btn {
        display: flex !important;
        visibility: visible !important;
        opacity: 1 !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        border-radius: 50% !important;
        width: 55px !important;
        height: 55px !important;
        border: 3px solid !important;
    }
    
    .action-buttons-grid {
        display: grid !important;
        visibility: visible !important;
        opacity: 1 !important;
        grid-template-columns: repeat(3, 1fr) !important;
        grid-template-rows: repeat(2, 1fr) !important;
        gap: 10px !important;
    }
    
    /* Hide fullscreen indicator on mobile since F key doesn't work */
    .fullscreen-indicator {
        display: none;
    }
}

/* JavaScript-driven touch device detection */
.touch-device .mobile-controls,
.touch-device .mobile-controls-game {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.touch-device .desktop-controls {
    display: none !important;
}

.touch-device .mobile-controls-text {
    display: block !important;
}

/* Fallback for devices that might not get detected properly */
.tablet-device .mobile-controls,
.tablet-device .mobile-controls-game,
.phone-device .mobile-controls,
.phone-device .mobile-controls-game {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Additional robust fallbacks for mobile control visibility */
body[data-mobile="true"] .mobile-controls,
body[data-mobile="true"] .mobile-controls-game,
body[data-tablet="true"] .mobile-controls,
body[data-tablet="true"] .mobile-controls-game {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Force show on known mobile user agents */
@supports (touch-action: manipulation) {
    @media (hover: none) and (pointer: coarse) {
        .mobile-controls,
        .mobile-controls-game {
            display: flex !important;
            visibility: visible !important;
            opacity: 1 !important;
        }
        
        .desktop-controls {
            display: none !important;
        }
        
        .mobile-controls-text {
            display: block !important;
        }
    }
}

@media screen and (max-width: 1024px) {
    /* Tablet styles */
    .touch-control-left {
        position: absolute !important;
        left: 25px !important;
        top: 50% !important;
        transform: translateY(-50%) !important;
    }
    
    .main-title {
        font-size: 48px;
        padding: 20px 35px;
        letter-spacing: 4px;
    }
    
    .start-prompt {
        font-size: 16px;
        padding: 15px 25px;
    }
    
    .credits-text {
        font-size: 12px;
        padding: 15px 25px;
    }
    
    #gameCanvas {
        width: 80vw;
        max-width: 600px;
        height: auto;
    }
    
    .controls {
        font-size: 9px;
        padding: 0 10px;
        line-height: 1.6;
    }
    
    .score {
        font-size: 16px;
    }
    
    #highScores {
        width: 90vw;
        max-width: 500px;
        padding: 30px 20px;
    }
    
    .highscores-title {
        font-size: 24px;
    }
    
    .score-header,
    .score-entry {
        grid-template-columns: 50px 180px 100px;
        gap: 15px;
        font-size: 11px;
    }
    
    /* Show mobile controls on tablets too */
    .mobile-controls {
        display: flex !important;
    }
    
    .desktop-controls {
        display: none;
    }
    
    .mobile-controls-text {
        display: none !important; /* Force hide text, show visual joystick instead */
    }
}

@media screen and (max-width: 768px) and (hover: none) and (pointer: coarse) {
    /* SIMPLE MOBILE DESIGN - Start from scratch */
    body {
        font-size: 12px;
        overflow: hidden;
    }
    
    .mobile-controls {
        display: flex !important;
        position: fixed !important;
        bottom: 15px !important;
        left: 10px !important;
        right: 10px !important;
        height: 100px !important;
        background: rgba(0, 0, 0, 0.7) !important;
        border-radius: 15px !important;
        border: 2px solid #00ffff !important;
        z-index: 1002 !important;
        justify-content: space-between !important;
        align-items: center !important;
        padding: 10px !important;
        pointer-events: all !important;
    }
    
    .touch-control-left,
    .touch-control-right {
        pointer-events: all !important;
    }
    
    .desktop-controls {
        display: none !important;
    }
    
    .mobile-controls-text {
        display: none !important;
    }
    
    .instructions-button {
        display: block !important;
        font-size: 8px !important;
        padding: 4px 8px !important;
    }
    
    .main-title {
        font-size: 32px;
        padding: 15px 25px;
        letter-spacing: 2px;
        margin-bottom: 30px;
    }
    
    .main-title::before {
        font-size: 14px;
        top: -35px;
    }
    
    .start-prompt {
        font-size: 12px;
        padding: 12px 20px;
        line-height: 1.4;
    }
    
    .credits-text {
        font-size: 10px;
        padding: 12px 20px;
        margin-bottom: 40px;
    }
    
    #gameScreen {
        padding: 0;
        height: 100vh;
        width: 100vw;
        position: fixed;
        top: 0;
        left: 0;
    }
    
    #gameCanvas {
        width: calc(100vw - 20px) !important;
        height: calc(100vh - 155px) !important;
        max-width: none !important;
        max-height: none !important;
        border: 1px solid #00ffff !important;
        margin: 0 !important;
        display: block !important;
        position: fixed !important;
        top: 20px !important;
        left: 10px !important;
        right: 10px !important;
        bottom: 135px !important;
        transform: none !important;
        z-index: 1 !important;
    }
    
    .controls {
        display: none; /* Hide on mobile - overlay controls are used instead */
    }
    
    .score {
        font-size: 16px;
        top: 15px;
    }
    
    .controls {
        font-size: 6px;
        margin-top: 5px;
        margin-bottom: 10px;
        line-height: 1.2;
    }
    
    .fullscreen-indicator {
        font-size: 8px;
        top: 10px;
        right: 10px;
    }
    
    #countdown {
        padding: 40px 50px;
        border: 3px solid #00ffff;
    }
    
    .countdown-number {
        font-size: 60px;
    }
    
    #gameOver {
        padding: 40px 30px;
        width: 90vw;
        max-width: 400px;
        border: 3px solid #0066ff;
    }
    
    #gameOver h2 {
        font-size: 18px;
        margin-bottom: 20px;
    }
    
    .menu-option {
        width: 100%;
        max-width: 280px;
        font-size: 10px;
        padding: 12px 20px;
        margin: 8px auto;
    }
    
    #highScores {
        width: 95vw;
        max-width: 350px;
        padding: 20px 15px;
        height: auto;
        max-height: 90vh;
    }
    
    .highscores-title {
        font-size: 18px;
        margin-bottom: 20px;
    }
    
    .scores-container {
        height: 300px;
    }
    
    .score-header,
    .score-entry {
        grid-template-columns: 40px 150px 80px;
        gap: 10px;
        font-size: 9px;
        padding: 8px 10px;
    }
    
    .back-btn {
        font-size: 10px;
        padding: 12px 20px;
    }
    
    #initialsInput {
        width: 90vw;
        max-width: 280px;
        padding: 12px;
        height: auto;
    }
    
    #initialsInput h2 {
        font-size: 10px;
    }
    
    #initialsInput p {
        font-size: 8px;
    }
    
    .current-initials {
        font-size: 14px;
        padding: 5px 12px;
    }
    
    .alphabet-grid {
        grid-template-columns: repeat(6, 28px);
        gap: 3px;
        width: auto;
    }
    
    .alphabet-letter {
        width: 28px;
        height: 28px;
        font-size: 8px;
    }
    
    .alphabet-letter.end-option {
        width: 28px;
        height: 28px;
        font-size: 7px;
    }
    
    .initials-instructions {
        font-size: 8px;
        margin-top: 15px;
    }
}

@media screen and (max-width: 480px) {
    /* Small mobile styles */
    .main-title {
        font-size: 24px;
        padding: 12px 20px;
        letter-spacing: 1px;
        margin-bottom: 20px;
    }
    
    .main-title::before {
        font-size: 12px;
        top: -30px;
    }
    
    .start-prompt {
        font-size: 10px;
        padding: 10px 15px;
    }
    
    .credits-text {
        font-size: 8px;
        padding: 10px 15px;
        margin-bottom: 30px;
    }
    
    #gameScreen {
        padding: 5px;
        justify-content: flex-start;
        padding-top: 10px;
    }
    
    #gameCanvas {
        width: calc(100vw - 40px);
        max-width: 500px;
        max-height: calc(100vh - 160px);
        margin: 20px auto;
        display: block;
        position: relative;
        z-index: 1;
    }
    
    .score {
        font-size: 12px;
        margin-bottom: 8px;
    }
    
    .controls {
        font-size: 7px;
        text-align: center;
        margin-top: 5px;
        line-height: 1.2;
    }
    
    .countdown-number {
        font-size: 40px;
    }
    
    #countdown {
        padding: 30px 40px;
    }
    
    #gameOver {
        padding: 25px 15px;
        max-width: 90vw;
    }
    
    #gameOver h2 {
        font-size: 14px;
        margin-bottom: 15px;
    }
    
    .menu-option {
        font-size: 8px;
        padding: 10px 15px;
        margin: 6px auto;
        max-width: 260px;
    }
    
    .highscores-title {
        font-size: 14px;
    }
    
    #highScores {
        width: 98vw;
        max-width: 320px;
        padding: 15px 10px;
    }
    
    .score-header,
    .score-entry {
        grid-template-columns: 30px 110px 60px;
        gap: 6px;
        font-size: 7px;
        padding: 6px 8px;
    }
}

/* Extra small phones - 360px and below */
@media screen and (max-width: 360px) {
    .main-title {
        font-size: 20px;
        padding: 10px 15px;
    }
    
    #gameScreen {
        padding: 2px;
        padding-bottom: 10px; /* Minimal padding since controls are now positioned absolutely */
    }
    
    .score {
        font-size: 11px;
    }
    
    .controls {
        font-size: 6px;
    }
    
    .mobile-controls {
        bottom: 5px;
        padding: 0 5px;
    }
    
    .move-button {
        width: 50px;
        height: 50px;
        margin: 4px 0;
    }
    
    .button-label {
        font-size: 18px;
    }
    
    .button-text {
        font-size: 6px;
    }
    
    .movement-pad {
        padding: 5px;
        width: 80px !important;
        height: 80px !important;
        background: rgba(0, 255, 255, 0.15) !important;
        border: 2px solid rgba(0, 255, 255, 0.6) !important;
        border-radius: 50% !important;
        backdrop-filter: blur(3px) !important;
        -webkit-backdrop-filter: blur(3px) !important;
    }
    
    .movement-divider {
        font-size: 8px;
        padding: 6px 10px;
        background: rgba(0, 255, 255, 0.8) !important;
        color: #000000 !important;
        border-radius: 12px !important;
        font-weight: bold !important;
        text-shadow: none !important;
        box-shadow: 0 2px 8px rgba(0, 255, 255, 0.6) !important;
        border: 1px solid rgba(255, 255, 255, 0.3) !important;
    }
    
    .arcade-btn {
        width: 35px;
        height: 35px;
        border-width: 2px !important;
        border-radius: 50% !important;
    }
    
    .btn-letter {
        font-size: 14px;
    }
    
    .btn-name {
        font-size: 4px;
    }
    
    .action-buttons-grid {
        gap: 5px;
        max-width: 120px;
        grid-template-columns: repeat(3, 1fr) !important;
        grid-template-rows: repeat(2, 1fr) !important;
        padding: 8px !important;
        background: rgba(0, 0, 0, 0.4) !important;
        border-radius: 10px !important;
        border: 1px solid rgba(255, 255, 255, 0.2) !important;
    }
    
    #gameCanvas {
        width: calc(100vw - 60px);
        max-width: 450px;
        max-height: calc(100vh - 140px);
        margin: 10px auto;
        position: relative;
        z-index: 1;
    }
}

/* Wide mobile phones - Use same simple design */
@media screen and (min-width: 769px) and (max-width: 1200px) and (hover: none) and (pointer: coarse) {
    .mobile-controls {
        display: flex !important;
        position: fixed !important;
        bottom: 10px !important;
        left: 10px !important;
        right: 10px !important;
        height: 100px !important;
        background: rgba(0, 0, 0, 0.7) !important;
        border-radius: 15px !important;
        border: 2px solid #00ffff !important;
        z-index: 1002 !important;
        justify-content: space-between !important;
        align-items: center !important;
        padding: 10px !important;
        pointer-events: all !important;
    }
    
    #gameCanvas {
        width: calc(100vw - 20px) !important;
        height: calc(100vh - 155px) !important;
        max-width: none !important;
        max-height: none !important;
        border: 1px solid #00ffff !important;
        margin: 0 !important;
        display: block !important;
        position: fixed !important;
        top: 20px !important;
        left: 10px !important;
        right: 10px !important;
        bottom: 135px !important;
        transform: none !important;
        z-index: 1 !important;
    }
    
    .desktop-controls {
        display: none !important;
    }
    
    .instructions-button {
        display: block !important;
        font-size: 8px !important;
        padding: 4px 8px !important;
    }
}

/* Touch-friendly button styles */
@media (hover: none) and (pointer: coarse) {
    .menu-option,
    .back-btn,
    .alphabet-letter {
        min-height: 44px;
        touch-action: manipulation;
    }
    
    .menu-option:active,
    .back-btn:active,
    .alphabet-letter:active {
        transform: scale(0.95);
        background: rgba(0, 255, 255, 0.4) !important;
    }
}

/* Landscape orientation adjustments for mobile */
@media screen and (max-width: 768px) and (orientation: landscape) {
    .main-title {
        font-size: 28px;
        margin-bottom: 20px;
    }
    
    .start-prompt {
        font-size: 11px;
    }
    
    .credits-text {
        font-size: 9px;
        margin-bottom: 30px;
    }
    
    #gameCanvas {
        width: calc(100vw - 200px) !important;
        height: calc(100vh - 80px) !important;
        max-width: none !important;
        max-height: none !important;
        position: fixed !important;
        top: 40px !important;
        left: 50% !important;
        transform: translateX(-50%) !important;
        border: 2px solid #00ffff !important;
        z-index: 1 !important;
    }
    
    .score {
        font-size: 14px;
        top: 10px;
    }
    
    .controls {
        display: none !important;
    }
    
    .controls {
        font-size: 7px;
    }
    
    .mobile-controls {
        bottom: 15px;
        padding: 0 10px;
    }
    
    .touch-control-left {
        position: absolute !important;
        left: 15px !important;
        top: 50% !important;
        transform: translateY(-50%) !important;
    }
    
    .move-button {
        width: 30px;
        height: 30px;
        margin: 3px 0;
        background: rgba(0, 255, 255, 0.4) !important;
        border: 2px solid rgba(0, 255, 255, 0.7) !important;
        border-radius: 50% !important;
        transition: all 0.1s ease !important;
        backdrop-filter: blur(2px) !important;
        -webkit-backdrop-filter: blur(2px) !important;
    }
    
    .move-button:active {
        background: rgba(0, 255, 255, 0.9) !important;
        border: 2px solid rgba(255, 255, 255, 1) !important;
        box-shadow: 0 0 15px rgba(0, 255, 255, 0.8) !important;
        transform: scale(0.95) !important;
    }
    
    .move-button.active {
        background: rgba(0, 255, 255, 0.8) !important;
        border: 2px solid rgba(255, 255, 255, 0.9) !important;
        box-shadow: 0 0 12px rgba(0, 255, 255, 0.6) !important;
    }
    
    /* Force joystick to center-left in landscape mode */
    .mobile-controls {
        position: fixed !important;
        width: 100vw !important;
        height: 100vh !important;
        top: 0 !important;
        left: 0 !important;
        right: auto !important;
        bottom: auto !important;
        padding: 0 !important;
        justify-content: flex-start !important;
    }
    
    .touch-control-left {
        position: absolute !important;
        left: 20px !important;
        top: 50% !important;
        bottom: auto !important;
        transform: translateY(-50%) !important;
        z-index: 1001 !important;
    }
    
    .touch-control-right {
        position: absolute !important;
        right: 20px !important;
        top: 50% !important;
        bottom: auto !important;
        transform: translateY(-50%) !important;
        z-index: 1001 !important;
    }
    
    .button-label {
        font-size: 22px;
    }
    
    .button-text {
        font-size: 8px;
    }
    
    .movement-pad {
        padding: 15px;
    }
    
    .movement-divider {
        font-size: 9px;
        padding: 12px 8px;
    }
    
    .arcade-btn {
        width: 45px;
        height: 45px;
    }
    
    .btn-letter {
        font-size: 18px;
    }
    
    .btn-name {
        font-size: 6px;
    }
    
    .action-buttons-grid {
        gap: 8px;
        max-width: 180px;
        grid-template-columns: repeat(3, 1fr) !important;
        grid-template-rows: repeat(2, 1fr) !important;
    }
    
    #gameScreen {
        padding: 2px;
        justify-content: center;
        align-items: center;
        padding-top: 5px;
        padding-bottom: 5px;
        max-height: 100vh;
        overflow: hidden;
        display: flex;
        flex-direction: column;
    }
}

/* Android-specific responsive adjustments */
@media screen and (max-width: 768px) {
    /* Android portrait mode */
    body {
        overflow-x: hidden;
        position: relative;
    }
    
    #gameScreen {
        min-height: 100vh;
        min-height: calc(var(--vh, 1vh) * 100);
        overflow: hidden;
    }
    
    #gameCanvas {
        max-width: calc(100vw - 20px);
        max-height: calc(60vh - 120px);
    }
}

/* Android landscape mode specific fixes */
@media screen and (max-width: 896px) and (orientation: landscape) and (-webkit-min-device-pixel-ratio: 1) {
    body {
        overflow: hidden;
        height: 100vh;
    }
    
    #titleScreen,
    #gameScreen {
        height: 100vh;
        max-height: 100vh;
        overflow: hidden;
    }
    
    #gameCanvas {
        width: calc(95vw - 180px) !important;
        max-width: 650px !important;
        max-height: calc(90vh - 60px) !important;
        height: auto !important;
    }
    
    .mobile-controls {
        position: fixed !important;
        width: 100vw !important;
        height: 100vh !important;
        top: 0 !important;
        left: 0 !important;
        right: auto !important;
        bottom: auto !important;
        padding: 0 !important;
        justify-content: flex-start !important;
    }
    
    .touch-control-left {
        position: absolute !important;
        left: 20px !important;
        top: 50% !important;
        bottom: auto !important;
        transform: translateY(-50%) !important;
        z-index: 1001 !important;
    }
    
    .touch-control-right {
        position: absolute !important;
        right: 20px !important;
        top: 50% !important;
        bottom: auto !important;
        transform: translateY(-50%) !important;
        z-index: 1001 !important;
    }
    
    .move-button {
        width: 55px;
        height: 55px;
        margin: 6px 0;
    }
    
    .arcade-btn {
        width: 55px;
        height: 55px;
    }
    
    .btn-letter {
        font-size: 16px;
    }
    
    .btn-name {
        font-size: 5px;
    }
    
    .action-buttons-grid {
        gap: 8px;
        max-width: 200px;
        grid-template-columns: repeat(3, 1fr) !important;
        grid-template-rows: repeat(2, 1fr) !important;
    }
    
    .movement-pad {
        padding: 12px;
    }
}

/* Prevent zoom on double tap for touch devices */
@media (hover: none) and (pointer: coarse) {
    * {
        touch-action: manipulation;
    }
    
    /* Prevent text selection on mobile */
    .touch-button,
    .action-btn,
    .touch-center,
    .menu-option,
    .alphabet-letter {
        -webkit-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        user-select: none;
        -webkit-touch-callout: none;
    }
}

/* Portrait Mode Warning */
#portraitWarning {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: linear-gradient(
        135deg, 
        #ff0066 0%, 
        #0066ff 25%, 
        #00ffff 50%, 
        #ffff00 75%, 
        #ff0066 100%
    );
    background-size: 400% 400%;
    animation: gradientShift 4s ease-in-out infinite;
    z-index: 10000;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    color: #ffffff;
    font-family: 'Press Start 2P', 'Courier New', monospace;
}

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

.portrait-title {
    display: none; /* Hide the pong title as requested */
}

.portrait-message {
    background: none; /* Remove dark background to show color transition */
    padding: 20px;
    max-width: 90vw;
    text-align: center;
}

.portrait-message p {
    font-size: 20px;
    line-height: 1.3;
    margin: 15px 0;
    color: #ffffff;
    text-shadow: 
        2px 2px 4px #000000,
        -1px -1px 2px #000000,
        0 0 20px #ffffff,
        0 0 40px #ffffff;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.portrait-message strong {
    color: #ffff00;
    font-size: 24px;
    text-shadow: 
        2px 2px 4px #000000,
        -1px -1px 2px #000000,
        0 0 30px #ffff00,
        0 0 60px #ffff00;
    display: block;
    margin: 20px 0;
    animation: textGlow 2s ease-in-out infinite alternate;
}

@keyframes textGlow {
    from { 
        text-shadow: 
            4px 4px 8px #000000,
            -2px -2px 4px #000000,
            0 0 40px #ffff00,
            0 0 80px #ffff00;
    }
    to { 
        text-shadow: 
            4px 4px 8px #000000,
            -2px -2px 4px #000000,
            0 0 60px #ffff00,
            0 0 120px #ffff00,
            0 0 160px #ffff00;
    }
}

.rotate-icon {
    font-size: 64px;
    margin-bottom: 25px;
    animation: bounce 1.5s ease-in-out infinite;
    filter: drop-shadow(0 0 20px #ffffff);
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

/* Show portrait warning on mobile devices in portrait mode */
@media screen and (max-width: 768px) and (orientation: portrait) and (hover: none) and (pointer: coarse) {
    #portraitWarning {
        display: flex !important;
    }
    
    /* Hide ALL other elements */
    #titleScreen,
    #gameScreen,
    #gameOver,
    #countdown,
    #highScores,
    #initialsInput,
    .main-title,
    .credits-text,
    .start-prompt,
    .spacebar-animation {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
    }
}

/* Also show on small tablets in portrait */
@media screen and (max-width: 1024px) and (max-height: 768px) and (orientation: portrait) and (hover: none) and (pointer: coarse) {
    #portraitWarning {
        display: flex !important;
    }
    
    /* Hide ALL other elements */
    #titleScreen,
    #gameScreen,
    #gameOver,
    #countdown,
    #highScores,
    #initialsInput,
    .main-title,
    .credits-text,
    .start-prompt,
    .spacebar-animation {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
    }
}

/* High DPI / Retina display adjustments */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    #gameCanvas {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: pixelated;
    }
}
