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

body {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    font-family: 'Segoe UI', Arial, sans-serif;
    padding: 20px;
}

#game-container {
    background: #2d3436;
    border-radius: 20px;
    padding: 25px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.8);
    border: 2px solid #4a5568;
    max-width: 650px;
    width: 100%;
}

#game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding: 0 5px;
}

#game-header h1 {
    color: #ffd93d;
    font-size: 24px;
    text-shadow: 0 2px 10px rgba(255, 217, 61, 0.3);
}

#score-info {
    display: flex;
    gap: 20px;
    color: #dfe6e9;
    font-size: 16px;
    font-weight: bold;
}

#score-info span {
    background: rgba(255,255,255,0.1);
    padding: 5px 15px;
    border-radius: 20px;
}

#score-info span span {
    background: none;
    padding: 0;
    color: #ffd93d;
}

canvas {
    display: block;
    border-radius: 12px;
    border: 3px solid #4a5568;
    background: #2d3436;
    width: 100%;
    height: auto;
    aspect-ratio: 1/1;
    cursor: pointer;
    touch-action: none;
}

#controls {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 15px;
    flex-wrap: wrap;
}

#controls button {
    padding: 12px 30px;
    border: none;
    border-radius: 12px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 120px;
}

#upBtn {
    background: linear-gradient(135deg, #00b894, #00a381);
    color: white;
    box-shadow: 0 4px 15px rgba(0, 184, 148, 0.4);
}

#upBtn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(0, 184, 148, 0.6);
}

#upBtn:active {
    transform: translateY(0px);
}

.hub-btn {
    display: inline-block;
    background: linear-gradient(135deg, #6c5ce7, #5a4bd1);
    color: white;
    padding: 12px 30px;
    border: none;
    box-shadow: 0 4px 15px rgba(108, 92, 231, 0.4);
    border-radius: 12px;
    font-size: 18px;
    font-weight: bold;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 120px;
    text-align: center;
}

.hub-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(108, 92, 231, 0.6);
}

.hub-btn:active {
    transform: translateY(0px);
}

#instructions {
    text-align: center;
    margin-top: 12px;
    color: #b2bec3;
    font-size: 14px;
}

#instructions strong {
    color: #ffd93d;
}

/* ===== MODAL ===== */
#gameOverModal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
}

#modalContent {
    background: #2d3436;
    padding: 40px 50px;
    border-radius: 20px;
    text-align: center;
    max-width: 450px;
    width: 90%;
    border: 2px solid #4a5568;
    animation: popIn 0.3s ease;
}

@keyframes popIn {
    0% {
        transform: scale(0.8);
        opacity: 0;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

#modalContent h2 {
    color: #ff6b6b;
    font-size: 32px;
    margin-bottom: 15px;
}

#modalContent p {
    color: #dfe6e9;
    font-size: 18px;
    margin-bottom: 25px;
}

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

.modal-buttons button {
    padding: 12px 30px;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
}

#playAgainBtn {
    background: linear-gradient(135deg, #00b894, #00a381);
    color: white;
}

#playAgainBtn:hover {
    transform: scale(1.05);
}

#quitBtn {
    background: linear-gradient(135deg, #e17055, #d63031);
    color: white;
}

#quitBtn:hover {
    transform: scale(1.05);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 500px) {
    #game-container {
        padding: 15px;
    }
    
    #game-header {
        flex-direction: column;
        gap: 10px;
    }
    
    #game-header h1 {
        font-size: 20px;
    }
    
    #score-info {
        font-size: 14px;
        gap: 10px;
    }
    
    #controls button {
        padding: 10px 20px;
        font-size: 16px;
        min-width: 100px;
    }
    
    #modalContent {
        padding: 30px 20px;
    }
    
    #modalContent h2 {
        font-size: 26px;
    }
}

/* Touch-friendly */
@media (pointer: coarse) {
    #controls button {
        padding: 14px 25px;
        font-size: 18px;
        min-height: 55px;
    }
}