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

body {
    background: #0a0a0a;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-family: 'Press Start 2P', monospace;
    color: #00CED1;
    overflow: hidden;
}

#game-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    width: 100%;
    max-width: 800px;
    padding: 10px;
}

/* Screens */
#loading-screen,
#start-screen,
#game-screen,
#game-over-screen,
#victory-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
    text-align: center;
    width: 100%;
}

.title {
    font-size: clamp(24px, 6vw, 48px);
    text-shadow: 
        0 0 10px #00CED1,
        0 0 20px #00CED1,
        0 0 40px #008B8B;
    letter-spacing: 4px;
    animation: pulse 2s ease-in-out infinite;
}

.title.glow {
    animation: glow 1.5s ease-in-out infinite alternate;
}

.title.red {
    color: #FF6347;
    text-shadow: 
        0 0 10px #FF6347,
        0 0 20px #FF6347;
}

.title.gold {
    color: #FFD700;
    text-shadow: 
        0 0 10px #FFD700,
        0 0 20px #FFA500;
}

@keyframes glow {
    from {
        text-shadow: 
            0 0 10px #00CED1,
            0 0 20px #00CED1;
    }
    to {
        text-shadow: 
            0 0 20px #00FFFF,
            0 0 40px #00FFFF,
            0 0 60px #008B8B;
    }
}

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

.subtitle {
    font-size: clamp(8px, 2vw, 12px);
    color: #888;
    letter-spacing: 2px;
}

.blink {
    font-size: clamp(8px, 2vw, 12px);
    animation: blink 1s step-end infinite;
}

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

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

.menu-btn {
    font-family: 'Press Start 2P', monospace;
    font-size: clamp(10px, 2.5vw, 14px);
    padding: 15px 30px;
    background: transparent;
    border: 3px solid #00CED1;
    color: #00CED1;
    cursor: pointer;
    transition: all 0.2s;
}

.menu-btn:hover {
    background: #00CED1;
    color: #000;
    box-shadow: 0 0 20px #00CED1;
}

.level-select {
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: clamp(10px, 2vw, 14px);
}

.arrow-btn {
    font-family: 'Press Start 2P', monospace;
    font-size: 16px;
    width: 40px;
    height: 40px;
    background: transparent;
    border: 2px solid #00CED1;
    color: #00CED1;
    cursor: pointer;
    transition: all 0.2s;
}

.arrow-btn:hover {
    background: #00CED1;
    color: #000;
}

.high-score {
    font-size: clamp(8px, 2vw, 10px);
    color: #FFD700;
    margin-top: 20px;
}

/* Loading */
.loading-bar-container {
    width: 80%;
    max-width: 300px;
    height: 20px;
    border: 2px solid #00CED1;
    background: #111;
}

.loading-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #00CED1, #00FFFF);
    transition: width 0.3s;
}

#loading-text {
    font-size: 10px;
    color: #888;
}

/* Game screen */
#game-screen {
    gap: 10px;
}

#hud {
    display: flex;
    justify-content: space-between;
    width: 100%;
    max-width: 640px;
    padding: 10px 20px;
    background: #111;
    border: 2px solid #333;
    font-size: clamp(8px, 2vw, 12px);
}

#hud span {
    display: flex;
    gap: 5px;
}

#canvas {
    border: 3px solid #333;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    max-width: 100%;
    height: auto;
    background: #000;
}

#controls-hint {
    font-size: clamp(6px, 1.5vw, 10px);
    color: #666;
    padding: 10px;
}

.desktop-controls {
    display: block;
}

.mobile-controls {
    display: none;
}

#mobile-controls {
    display: none;
    flex-direction: column;
    gap: 5px;
    margin-top: 10px;
}

.control-row {
    display: flex;
    justify-content: center;
    gap: 5px;
}

.ctrl-btn {
    font-family: 'Press Start 2P', monospace;
    font-size: 12px;
    width: 50px;
    height: 50px;
    background: #222;
    border: 2px solid #00CED1;
    color: #00CED1;
    cursor: pointer;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
}

.ctrl-btn:active {
    background: #00CED1;
    color: #000;
}

.dig-btn {
    width: 80px;
    font-size: 10px;
}

.dig-row {
    margin-top: 10px;
}

/* Footer */
footer {
    padding: 15px;
    text-align: center;
}

footer a {
    font-family: 'Press Start 2P', monospace;
    font-size: 8px;
    color: #666;
    text-decoration: none;
    transition: color 0.2s;
}

footer a:hover {
    color: #00CED1;
}

/* Mobile */
@media (max-width: 768px) {
    .desktop-controls {
        display: none;
    }
    
    .mobile-controls {
        display: block;
    }
    
    #mobile-controls {
        display: flex;
    }
    
    #hud {
        font-size: 8px;
        padding: 8px 15px;
    }
    
    .ctrl-btn {
        width: 45px;
        height: 45px;
        font-size: 10px;
    }
    
    .dig-btn {
        width: 70px;
        font-size: 8px;
    }
}

@media (max-width: 480px) {
    #game-container {
        padding: 5px;
    }
    
    .ctrl-btn {
        width: 40px;
        height: 40px;
        font-size: 8px;
    }
    
    .dig-btn {
        width: 60px;
        font-size: 7px;
    }
}