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

body {
    background: #050510;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    font-family: 'Press Start 2P', monospace;
    color: #fff;
    overflow: hidden;
}

#game-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding: 20px;
    width: 100%;
    max-width: 540px;
}

#header {
    text-align: center;
    width: 100%;
}

#header h1 {
    font-size: clamp(18px, 5vw, 28px);
    color: #00ff88;
    text-shadow: 
        0 0 10px #00ff88,
        0 0 20px #00ff88,
        0 0 40px #00cc66;
    margin-bottom: 12px;
    letter-spacing: 4px;
}

#score-display {
    display: flex;
    justify-content: center;
    gap: 30px;
    font-size: clamp(10px, 2.5vw, 12px);
}

#current-score {
    color: #00ff88;
}

#high-score {
    color: #ff3366;
}

#score.flash {
    animation: scoreFlash 0.2s ease-out;
}

@keyframes scoreFlash {
    0% { color: #fff; transform: scale(1.3); }
    100% { color: #00ff88; transform: scale(1); }
}

#canvas-wrapper {
    position: relative;
    border: 3px solid #00ff88;
    border-radius: 8px;
    box-shadow: 
        0 0 20px rgba(0, 255, 136, 0.3),
        inset 0 0 30px rgba(0, 255, 136, 0.1);
    background: #0a0a1a;
}

#canvas {
    display: block;
    border-radius: 5px;
}

.hidden {
    display: none !important;
}

/* Overlays */
#start-overlay,
#pause-overlay,
#gameover-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(5, 5, 16, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 5px;
}

.overlay-content {
    text-align: center;
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

.start-text,
.pause-text {
    font-size: clamp(12px, 3vw, 16px);
    color: #00ff88;
    text-shadow: 0 0 10px #00ff88;
    margin-bottom: 16px;
    animation: pulse 1.5s ease-in-out infinite;
}

.start-subtext,
.pause-subtext {
    font-size: clamp(8px, 2vw, 10px);
    color: #666;
}

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

.gameover-text {
    font-size: clamp(16px, 4vw, 24px);
    color: #ff3366;
    text-shadow: 
        0 0 10px #ff3366,
        0 0 20px #ff3366;
    margin-bottom: 20px;
    animation: shake 0.5s ease-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-10px); }
    40% { transform: translateX(10px); }
    60% { transform: translateX(-5px); }
    80% { transform: translateX(5px); }
}

#final-score {
    font-size: clamp(10px, 2.5vw, 14px);
    color: #fff;
    margin-bottom: 12px;
}

#new-record {
    font-size: clamp(10px, 2.5vw, 12px);
    color: #ffcc00;
    text-shadow: 0 0 10px #ffcc00;
    margin-bottom: 20px;
    animation: celebration 0.5s ease-out infinite alternate;
}

@keyframes celebration {
    from { transform: scale(1); }
    to { transform: scale(1.1); }
}

#restart-btn {
    font-family: 'Press Start 2P', monospace;
    font-size: clamp(10px, 2.5vw, 12px);
    padding: 12px 24px;
    background: transparent;
    border: 2px solid #00ff88;
    color: #00ff88;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s ease;
}

#restart-btn:hover {
    background: #00ff88;
    color: #050510;
    box-shadow: 0 0 20px rgba(0, 255, 136, 0.5);
}

/* Controls */
#controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
}

.control-row {
    display: flex;
    gap: 8px;
}

.control-btn {
    width: clamp(50px, 12vw, 60px);
    height: clamp(50px, 12vw, 60px);
    font-size: clamp(16px, 4vw, 20px);
    background: rgba(0, 255, 136, 0.1);
    border: 2px solid #00ff88;
    color: #00ff88;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s ease;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

.control-btn:active {
    background: #00ff88;
    color: #050510;
    transform: scale(0.95);
}

.pause-btn {
    font-size: clamp(12px, 3vw, 14px);
    border-color: #ff3366;
    color: #ff3366;
    background: rgba(255, 51, 102, 0.1);
}

.pause-btn:active {
    background: #ff3366;
    color: #050510;
}

/* Info bar */
#info {
    display: flex;
    justify-content: center;
    gap: 30px;
    font-size: clamp(8px, 2vw, 10px);
    color: #555;
}

#info span {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Footer */
footer {
    margin-top: 16px;
}

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

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

/* Desktop: hide touch controls */
@media (hover: hover) and (pointer: fine) {
    #controls {
        opacity: 0.3;
    }
    
    #controls:hover {
        opacity: 1;
    }
}

/* Mobile adjustments */
@media (max-width: 480px) {
    #game-container {
        padding: 10px;
        gap: 12px;
    }
    
    #header h1 {
        margin-bottom: 8px;
    }
    
    #controls {
        gap: 6px;
    }
    
    .control-row {
        gap: 6px;
    }
}