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

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

body {
    background: linear-gradient(135deg, #0a0a0a 0%, #1a1a2e 50%, #16213e 100%);
    font-family: 'Orbitron', monospace;
    color: #11be3c;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: auto;
    padding: 10px;
}

.game-container {
    text-align: center;
    background: rgba(0, 0, 0, 0.8);
    border: 2px solid #00ff41;
    border-radius: 10px;
    padding: 15px;
    box-shadow: 
        0 0 20px #00ff41,
        inset 0 0 20px rgba(0, 255, 65, 0.1);
    animation: glow 2s ease-in-out infinite alternate;
    max-width: 90vw;
    max-height: 90vh;
    overflow-y: auto;
    margin: auto;
    display: flex;
    flex-direction: column;
}

@keyframes glow {
    from { box-shadow: 0 0 20px #00ff41, inset 0 0 20px rgba(0, 255, 65, 0.1); }
    to { box-shadow: 0 0 30px #00ff41, inset 0 0 30px rgba(0, 255, 65, 0.2); }
}

.header {
    margin-bottom: 15px;
}

.title {
    font-size: 2.5rem;
    font-weight: 900;
    text-shadow: 0 0 10px #00ff41;
    margin-bottom: 8px;
    letter-spacing: 4px;
}

.score-board {
    display: flex;
    justify-content: space-between;
    font-size: 1rem;
    font-weight: 700;
    gap: 10px;
}

.score, .high-score, .speed {
    padding: 6px 12px;
    border: 2px solid #00ff41;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.8);
    text-shadow: 0 0 10px #00ff41;
    box-shadow: 
        0 0 15px rgba(0, 255, 65, 0.4),
        inset 0 0 15px rgba(0, 255, 65, 0.1);
    flex: 1;
    min-width: 0;
}

/* Game Screen Specific Adjustments */
.game-screen {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.game-screen .header {
    margin-bottom: 5px;
    flex-shrink: 0;
}

.game-screen .title {
    font-size: 1.5rem;
    margin-bottom: 3px;
    letter-spacing: 2px;
}

.game-screen .score-board {
    font-size: 0.8rem;
}

.game-screen .score, 
.game-screen .high-score, 
.game-screen .speed {
    padding: 3px 6px;
}

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

.menu-btn, .control-btn {
    background: rgba(0, 0, 0, 0.8);
    color: #00ff41;
    border: 2px solid #00ff41;
    padding: 15px 30px;
    font-size: 1.2rem;
    font-family: 'Orbitron', monospace;
    font-weight: 700;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 2px;
    text-shadow: 0 0 10px #00ff41;
    box-shadow: 
        0 0 20px rgba(0, 255, 65, 0.5),
        inset 0 0 20px rgba(0, 255, 65, 0.1);
}

.menu-btn:hover, .control-btn:hover {
    background: rgba(0, 255, 65, 0.1);
    box-shadow: 
        0 0 30px rgba(0, 255, 65, 0.8),
        inset 0 0 30px rgba(0, 255, 65, 0.2);
    color: #fff;
    text-shadow: 0 0 15px #00ff41;
    transform: translateY(-2px);
}

.menu-btn:active, .control-btn:active {
    transform: translateY(0);
    box-shadow: 
        0 0 15px rgba(0, 255, 65, 0.6),
        inset 0 0 15px rgba(0, 255, 65, 0.3);
}

.game-area {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 600px;
    margin: 0 auto;
    width: 100%;
    flex: 1;
    min-height: 0;
}

.top-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 10px;
}

.back-btn, .pause-btn {
    padding: 8px 16px !important;
    font-size: 1rem !important;
    min-width: 100px;
}

.back-btn {
    background: rgba(0, 0, 0, 0.8) !important;
    border: 2px solid #ff3333 !important;
    color: #ff3333 !important;
    text-shadow: 0 0 10px #ff3333 !important;
    box-shadow: 
        0 0 20px rgba(255, 51, 51, 0.5),
        inset 0 0 20px rgba(255, 51, 51, 0.1) !important;
    border-radius: 8px !important;
    font-weight: 700 !important;
    letter-spacing: 1px !important;
    text-transform: uppercase !important;
}

.back-btn:hover {
    background: rgba(255, 51, 51, 0.1) !important;
    box-shadow: 
        0 0 30px rgba(255, 51, 51, 0.8),
        inset 0 0 30px rgba(255, 51, 51, 0.2) !important;
    color: #fff !important;
    text-shadow: 0 0 15px #ff3333 !important;
}

.pause-btn {
    background: rgba(0, 0, 0, 0.8) !important;
    border: 2px solid #ff6b35 !important;
    color: #ff6b35 !important;
    text-shadow: 0 0 10px #ff6b35 !important;
    box-shadow: 
        0 0 20px rgba(255, 107, 53, 0.5),
        inset 0 0 20px rgba(255, 107, 53, 0.1) !important;
    border-radius: 8px !important;
    font-weight: 700 !important;
    letter-spacing: 1px !important;
    text-transform: uppercase !important;
}

.pause-btn:hover {
    background: rgba(255, 107, 53, 0.1) !important;
    box-shadow: 
        0 0 30px rgba(255, 107, 53, 0.8),
        inset 0 0 30px rgba(255, 107, 53, 0.2) !important;
    color: #fff !important;
    text-shadow: 0 0 15px #ff6b35 !important;
}

.canvas-container {
    position: relative;
    display: flex;
    justify-content: center;
    padding: 10px;
    background: linear-gradient(135deg, #001100 0%, #002200 100%);
    border: 2px solid #00ff41;
    border-radius: 8px;
    box-shadow: 0 0 10px rgba(0, 255, 65, 0.3);
    flex: 1;
    min-height: 0;
}

#gameCanvas {
    border: 2px solid #00ff41;
    border-radius: 5px;
    background: #000;
    box-shadow: 0 0 5px rgba(0, 255, 65, 0.2);
    display: block;
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
}

.bottom-controls {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 0 10px;
    border-top: 2px solid #00ff41;
    padding-top: 10px;
    background: rgba(0, 255, 65, 0.05);
    border-radius: 0 0 8px 8px;
}

.ai-hint {
    font-size: 1rem;
    font-weight: 700;
    padding: 8px 15px;
    border: 2px solid #ff6b35;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.8);
    color: #ff6b35;
    text-shadow: 0 0 5px #ff6b35;
    text-align: center;
    box-shadow: 0 0 10px rgba(255, 107, 53, 0.3);
    text-transform: uppercase;
    letter-spacing: 1px;
}

#hintDirection {
    font-size: 1.8rem;
    margin-left: 10px;
    display: inline-block;
    animation: pulse 1s infinite;
}

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

.game-controls {
    display: flex;
    gap: 15px;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
}

.control-info {
    font-size: 0.9rem;
    color: #00ff41;
    padding: 8px 15px;
    border: 1px solid #00ff41;
    border-radius: 5px;
    background: rgba(0, 0, 0, 0.6);
    text-shadow: 0 0 8px #00ff41;
    box-shadow: 
        0 0 10px rgba(0, 255, 65, 0.3),
        inset 0 0 10px rgba(0, 255, 65, 0.05);
    opacity: 0.8;
}

.control-btn {
    padding: 10px 20px;
    font-size: 1rem;
}

/* CRT Monitor Game Over Screen */
.game-over {
    position: relative;
    background: linear-gradient(135deg, #2a2a2a 0%, #1a1a1a 50%, #0a0a0a 100%);
    border: 15px solid #3a3a3a;
    border-radius: 20px;
    padding: 60px 40px;
    margin: 20px;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.6);
    overflow: hidden;
}



.crt-screen {
    position: relative;
    background: #000;
    border: 2px solid #00ff41;
    border-radius: 8px;
    padding: 40px;
    box-shadow: 0 0 5px rgba(0, 255, 65, 0.4);
    overflow: hidden;
}

.crt-screen::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 2px,
            rgba(0, 255, 65, 0.02) 2px,
            rgba(0, 255, 65, 0.02) 4px
        );
    pointer-events: none;
}



.game-over-title {
    font-family: 'Courier New', monospace;
    font-size: 4rem;
    font-weight: bold;
    color: #00ff41;
    text-shadow: 0 0 3px #00ff41;
    margin-bottom: 30px;
    letter-spacing: 8px;
    text-align: center;
    position: relative;
}



.final-score-display {
    font-family: 'Courier New', monospace;
    font-size: 2rem;
    color: #00ff41;
    text-shadow: 0 0 2px #00ff41;
    margin-bottom: 40px;
    text-align: center;
    position: relative;
    letter-spacing: 3px;
}

.crt-buttons {
    display: flex;
    flex-direction: column;
    gap: 20px;
    align-items: center;
    position: relative;
}

.crt-button {
    font-family: 'Courier New', monospace;
    font-size: 1.5rem;
    font-weight: bold;
    background: transparent;
    color: #00ff41;
    border: 2px solid #00ff41;
    padding: 15px 40px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 2px;
    position: relative;
    text-shadow: 0 0 2px #00ff41;
}

.crt-button:hover {
    background: rgba(0, 255, 65, 0.05);
    box-shadow: 0 0 5px rgba(0, 255, 65, 0.5);
    text-shadow: 0 0 4px #00ff41;
}

.crt-button:active {
    transform: scale(0.98);
    background: rgba(0, 255, 65, 0.1);
}

.play-again-btn {
    border-color: #00ff41;
    color: #00ff41;
}

.back-to-menu-btn {
    font-size: 1.2rem;
    padding: 12px 30px;
    border-color: #00ff41;
    color: #00ff41;
}

/* Mobile Touch Controls */
.mobile-controls {
    display: none;
    text-align: center;
    padding: 10px;
    border: 2px solid #00ff41;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.8);
    margin: 5px 0;
}

.control-instructions {
    font-size: 0.8rem;
    color: #00ff41;
    margin-bottom: 10px;
    text-shadow: 0 0 5px #00ff41;
}

.touch-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.touch-row {
    display: flex;
    gap: 8px;
    justify-content: center;
}

.touch-btn {
    width: 50px;
    height: 50px;
    background: rgba(0, 0, 0, 0.9);
    border: 2px solid #00ff41;
    border-radius: 8px;
    color: #00ff41;
    font-size: 1.2rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    text-shadow: 0 0 5px #00ff41;
    box-shadow: 0 0 8px rgba(0, 255, 65, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.touch-btn:active {
    background: rgba(0, 255, 65, 0.2);
    box-shadow: 0 0 15px rgba(0, 255, 65, 0.5);
    transform: scale(0.95);
}

.touch-btn:hover {
    background: rgba(0, 255, 65, 0.1);
    box-shadow: 0 0 15px rgba(0, 255, 65, 0.4);
}

.desktop-info, .mobile-info {
    display: inline;
}

/* Pixel-style animations */
@keyframes pixelPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.pixel-animation {
    animation: pixelPulse 0.5s infinite;
}

/* Standard Windows monitor (1366x768, 1920x1080) */
@media (min-width: 1024px) and (max-height: 900px) {
    .game-container {
        max-height: 80vh;
        padding: 15px;
    }
    
    .header {
        margin-bottom: 10px;
    }
    
    .title {
        font-size: 2.2rem;
        margin-bottom: 5px;
        letter-spacing: 3px;
    }
    
    .score-board {
        font-size: 0.95rem;
    }
    
    .score, .high-score, .speed {
        padding: 5px 10px;
    }
    
    .game-area {
        gap: 6px;
    }
    
    .canvas-container {
        padding: 8px;
    }
    
    #gameCanvas {
        width: 450px;
        height: 450px;
    }
    
    .bottom-controls {
        gap: 6px;
        padding-top: 8px;
    }
    
    .ai-hint {
        font-size: 0.9rem;
        padding: 6px 12px;
    }
    
    .control-info {
        font-size: 0.8rem;
    }
}

/* Desktop responsive design */
@media (min-width: 1024px) {
    .game-container {
        max-width: 700px;
        max-height: 85vh;
        padding: 20px;
    }
    
    .game-area {
        max-width: 600px;
        gap: 10px;
    }
    
    .canvas-container {
        padding: 15px;
    }
    
    #gameCanvas {
        width: 500px;
        height: 500px;
    }
    
    .bottom-controls {
        gap: 10px;
        padding-top: 12px;
    }
    
    .ai-hint {
        font-size: 1rem;
        padding: 8px 15px;
    }
    
    .title {
        font-size: 2.8rem;
        letter-spacing: 4px;
    }
    
    .score-board {
        font-size: 1.1rem;
    }
}

/* Large desktop screens */
@media (min-width: 1440px) {
    .game-container {
        max-width: 800px;
        max-height: 90vh;
    }
    
    .game-area {
        max-width: 700px;
    }
    
    #gameCanvas {
        width: 600px;
        height: 600px;
    }
    
    .title {
        font-size: 3rem;
        letter-spacing: 5px;
    }
    
    .score-board {
        font-size: 1.2rem;
    }
}

/* Responsive design */
@media (max-width: 768px) {
    .game-container {
        padding: 15px;
        margin: 10px;
        max-width: 95vw;
    }
    
    .title {
        font-size: 2rem;
        letter-spacing: 2px;
    }
    
    .game-area {
        max-width: 100%;
    }
    
    .canvas-container {
        padding: 10px;
    }
    
    #gameCanvas {
        width: 100%;
        max-width: 400px;
        height: auto;
    }
    
    .score-board {
        flex-direction: column;
        gap: 10px;
        font-size: 1rem;
    }
    
    .top-controls {
        flex-direction: row;
        gap: 10px;
    }
    
    .back-btn, .pause-btn {
        min-width: 80px;
        padding: 6px 12px !important;
        font-size: 0.9rem !important;
    }
    
    .game-controls {
        flex-direction: column;
        align-items: center;
        gap: 10px;
    }
    
    .control-info {
        font-size: 0.8rem;
        text-align: center;
    }
    
    .ai-hint {
        font-size: 1rem;
        padding: 10px 15px;
    }
    
    #hintDirection {
        font-size: 1.5rem;
    }
    
    /* Mobile Controls */
    .mobile-controls {
        display: block;
    }
    
    .touch-btn {
        width: 50px;
        height: 50px;
        font-size: 1.2rem;
    }
    
    /* CRT Game Over Responsive */
    .game-over {
        margin: 10px;
        padding: 30px 20px;
        border-width: 10px;
    }
    
    .crt-screen {
        padding: 25px;
    }
    
    .game-over-title {
        font-size: 2.5rem;
        letter-spacing: 4px;
        margin-bottom: 20px;
    }
    
    .final-score-display {
        font-size: 1.5rem;
        letter-spacing: 2px;
        margin-bottom: 30px;
    }
    
    .crt-button {
        font-size: 1.2rem;
        padding: 12px 30px;
        letter-spacing: 1px;
    }
    
    .back-to-menu-btn {
        font-size: 1rem;
        padding: 10px 25px;
    }
}

@media (max-width: 480px) {
    .game-container {
        padding: 10px;
        margin: 5px;
    }
    
    .title {
        font-size: 1.5rem;
        letter-spacing: 1px;
    }
    
    .canvas-container {
        padding: 8px;
    }
    
    #gameCanvas {
        max-width: 320px;
    }
    
    .score-board {
        font-size: 0.9rem;
    }
    
    .menu-btn, .control-btn {
        padding: 12px 20px;
        font-size: 1rem;
    }
    
    /* Mobile Controls for small screens */
    .touch-btn {
        width: 45px;
        height: 45px;
        font-size: 1rem;
    }
    
    .control-instructions {
        font-size: 0.8rem;
    }
    
    /* CRT Game Over Mobile */
    .game-over {
        margin: 5px;
        padding: 20px 15px;
        border-width: 8px;
    }
    
    .crt-screen {
        padding: 20px;
    }
    
    .game-over-title {
        font-size: 2rem;
        letter-spacing: 2px;
        margin-bottom: 15px;
    }
    
    .final-score-display {
        font-size: 1.2rem;
        letter-spacing: 1px;
        margin-bottom: 25px;
    }
    
    .crt-button {
        font-size: 1rem;
        padding: 10px 25px;
        letter-spacing: 1px;
    }
    
    .back-to-menu-btn {
        font-size: 0.9rem;
        padding: 8px 20px;
    }
}

/* Game Screen Specific - Ultra Compact Layout for Gameplay */
#gameScreen {
    display: flex;
    flex-direction: column;
    height: 100%;
}

#gameScreen .header {
    margin-bottom: 3px;
    flex-shrink: 0;
}

#gameScreen .title {
    font-size: 1.4rem;
    margin-bottom: 2px;
    letter-spacing: 1px;
}

#gameScreen .score-board {
    font-size: 0.75rem;
    gap: 4px;
}

#gameScreen .score, 
#gameScreen .high-score, 
#gameScreen .speed {
    padding: 2px 4px;
}

#gameScreen .game-area {
    gap: 2px;
    flex: 1;
    min-height: 0;
}

#gameScreen .top-controls {
    padding: 0 2px;
    flex-shrink: 0;
}

#gameScreen .canvas-container {
    padding: 2px;
    flex: 1;
    min-height: 0;
}

#gameScreen .bottom-controls {
    gap: 2px;
    padding-top: 2px;
    padding-bottom: 2px;
    max-height: 15vh;
    flex-shrink: 0;
}

#gameScreen .ai-hint {
    font-size: 0.65rem;
    padding: 2px 4px;
}

#gameScreen .mobile-controls {
    padding: 2px;
    margin: 1px 0;
}

#gameScreen .control-instructions {
    font-size: 0.55rem;
    margin-bottom: 2px;
}

#gameScreen .touch-btn {
    width: 30px;
    height: 30px;
    font-size: 0.8rem;
}

#gameScreen .touch-row {
    gap: 3px;
}

#gameScreen .touch-controls {
    gap: 2px;
}

#gameScreen .game-controls {
    gap: 3px;
}

#gameScreen .control-btn {
    padding: 2px 5px;
    font-size: 0.7rem;
}

#gameScreen .control-info {
    font-size: 0.55rem;
    padding: 1px 3px;
}

/* Extra compact for very small screens during gameplay */
@media (max-height: 700px) {
    #gameScreen .title {
        font-size: 1.2rem;
        margin-bottom: 1px;
    }
    
    #gameScreen .score-board {
        font-size: 0.7rem;
    }
    
    #gameScreen .bottom-controls {
        max-height: 12vh;
    }
    
    #gameScreen .touch-btn {
        width: 28px;
        height: 28px;
        font-size: 0.75rem;
    }
    
    #gameScreen .control-btn {
        padding: 1px 4px;
        font-size: 0.65rem;
    }
}
/* Mobile Game Screen Optimizations */
@media (max-width: 768px) {
    #gameScreen .title {
        font-size: 1.2rem;
        margin-bottom: 2px;
    }
    
    #gameScreen .score-board {
        font-size: 0.7rem;
        gap: 3px;
    }
    
    #gameScreen .score, 
    #gameScreen .high-score, 
    #gameScreen .speed {
        padding: 2px 3px;
    }
    
    #gameScreen .bottom-controls {
        max-height: 25vh;
    }
    
    #gameScreen .mobile-controls {
        display: block;
        padding: 3px;
    }
    
    #gameScreen .touch-btn {
        width: 35px;
        height: 35px;
        font-size: 0.9rem;
    }
    
    #gameScreen .control-instructions {
        font-size: 0.6rem;
    }
    
    #gameScreen .ai-hint {
        font-size: 0.6rem;
        padding: 2px 4px;
    }
    
    #gameScreen .control-btn {
        padding: 3px 6px;
        font-size: 0.75rem;
    }
    
    #gameScreen .control-info {
        font-size: 0.6rem;
    }
}

@media (max-width: 480px) {
    #gameScreen .title {
        font-size: 1rem;
        margin-bottom: 1px;
    }
    
    #gameScreen .score-board {
        font-size: 0.65rem;
        gap: 2px;
    }
    
    #gameScreen .score, 
    #gameScreen .high-score, 
    #gameScreen .speed {
        padding: 1px 2px;
    }
    
    #gameScreen .bottom-controls {
        max-height: 30vh;
    }
    
    #gameScreen .touch-btn {
        width: 32px;
        height: 32px;
        font-size: 0.85rem;
    }
    
    #gameScreen .control-instructions {
        font-size: 0.55rem;
    }
    
    #gameScreen .control-btn {
        padding: 2px 4px;
        font-size: 0.7rem;
    }
    
    #gameScreen .control-info {
        font-size: 0.55rem;
    }
}

/* Mobile Landscape Optimization */
@media (max-width: 768px) and (orientation: landscape) {
    #gameScreen .title {
        font-size: 1rem;
        margin-bottom: 1px;
    }
    
    #gameScreen .score-board {
        font-size: 0.6rem;
    }
    
    #gameScreen .bottom-controls {
        max-height: 35vh;
        overflow-y: auto;
    }
    
    #gameScreen .touch-btn {
        width: 30px;
        height: 30px;
        font-size: 0.8rem;
    }
}