/* ===========================================
   Bumpush - Styles
   =========================================== */

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

body {
    overflow: hidden;
    font-family: 'Segoe UI', Tahoma, sans-serif;
    background: #1a1a2e;
}

/* Game Container */
#game-container {
    position: relative;
    width: 100vw;
    height: 100vh;
}

canvas {
    display: block;
}

/* UI Overlay */
#ui-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

#ui-overlay button,
#ui-overlay input {
    pointer-events: auto;
}

/* Top Bar */
#top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 25px;
}

#player-info {
    padding: 10px 20px;
    border-radius: 12px;
    font-size: 24px;
    color: white;
    background: linear-gradient(135deg, #4a9eff, #1a5a9f);
    box-shadow: 0 4px 15px rgba(74, 158, 255, 0.3);
}

#enemy-count {
    padding: 10px 20px;
    border-radius: 10px;
    font-size: 20px;
    color: white;
    background: rgba(255, 70, 70, 0.8);
    box-shadow: 0 4px 15px rgba(255, 70, 70, 0.3);
}

#stage-info {
    padding: 10px 20px;
    border-radius: 10px;
    font-size: 16px;
    color: #ffd700;
    background: rgba(0, 0, 0, 0.5);
    font-weight: bold;
}

#timer {
    padding: 8px 16px;
    border-radius: 10px;
    font-size: 18px;
    color: #fff;
    background: rgba(0, 0, 0, 0.5);
    font-variant-numeric: tabular-nums;
}

/* Message */
#message {
    position: absolute;
    top: 45%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 52px;
    font-weight: bold;
    color: #fff;
    text-shadow: 0 0 30px rgba(74, 158, 255, 0.8), 0 4px 8px rgba(0, 0, 0, 0.5);
    opacity: 0;
    transition: opacity 0.4s ease;
    text-align: center;
}

/* Powerup Display */
#powerup-display {
    position: absolute;
    top: 35%;
    left: 50%;
    transform: translateX(-50%);
    font-size: 28px;
    color: #ffd700;
    text-shadow: 0 0 15px #ffd700;
    opacity: 0;
    transition: opacity 0.3s;
}

#powerup-bar {
    position: absolute;
    bottom: 120px;
    left: 50%;
    transform: translateX(-50%);
    width: 200px;
    height: 8px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 4px;
    opacity: 0;
    transition: opacity 0.3s;
    overflow: hidden;
}

#powerup-fill {
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, #ffff00, #ffee00);
    border-radius: 4px;
    transition: width 0.1s linear;
}

/* Boost Bar */
#boost-bar-container {
    position: absolute;
    bottom: 85px;
    left: 50%;
    transform: translateX(-50%);
    width: 200px;
    height: 12px;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 6px;
    overflow: hidden;
    border: 2px solid rgba(255, 215, 0, 0.3);
}

#boost-fill {
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, #ffd700, #ffaa00);
    transition: width 0.1s;
    border-radius: 4px;
}

/* Instructions */
#instructions {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255, 255, 255, 0.6);
    font-size: 13px;
    text-align: center;
    background: rgba(0, 0, 0, 0.4);
    padding: 8px 20px;
    border-radius: 20px;
}

/* Result Screen */
#result {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(20, 20, 40, 0.95);
    padding: 40px 60px;
    border-radius: 20px;
    text-align: center;
    display: none;
    box-shadow: 0 0 50px rgba(74, 158, 255, 0.3);
    border: 2px solid rgba(74, 158, 255, 0.3);
    pointer-events: auto;
}

#result h1 {
    font-size: 42px;
    margin-bottom: 20px;
}

#result p {
    font-size: 18px;
    color: #aaa;
}

#result button {
    margin-top: 25px;
    padding: 12px 50px;
    font-size: 18px;
    cursor: pointer;
    background: linear-gradient(135deg, #4a9eff, #1a5a9f);
    color: white;
    border: none;
    border-radius: 25px;
    transition: transform 0.2s, box-shadow 0.2s;
}

#result button:hover {
    transform: scale(1.05);
    box-shadow: 0 0 25px rgba(74, 158, 255, 0.5);
}

/* ===========================================
   Game Guide Modal
   =========================================== */

#game-guide-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(10, 10, 25, 0.95);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

#game-guide {
    background: linear-gradient(145deg, rgba(30, 30, 60, 0.95), rgba(20, 20, 45, 0.98));
    border: 2px solid rgba(74, 158, 255, 0.4);
    border-radius: 24px;
    padding: 35px 45px;
    max-width: 680px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow:
        0 0 60px rgba(74, 158, 255, 0.2),
        0 20px 50px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    animation: slideUp 0.6s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

#game-guide h1 {
    text-align: center;
    font-size: 36px;
    color: #fff;
    margin-bottom: 10px;
    text-shadow: 0 0 20px rgba(74, 158, 255, 0.6);
    letter-spacing: 2px;
}

#game-guide .guide-subtitle {
    text-align: center;
    font-size: 16px;
    color: #aabbd0;
    margin-bottom: 25px;
    font-style: italic;
}

.guide-section {
    margin-bottom: 22px;
    padding: 18px;
    background: rgba(0, 0, 0, 0.25);
    border-radius: 14px;
    border-left: 4px solid rgba(74, 158, 255, 0.6);
}

.guide-section h2 {
    font-size: 18px;
    color: #4a9eff;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.guide-section p {
    color: #c8d4e0;
    line-height: 1.7;
    font-size: 14px;
}

.guide-section ul {
    list-style: none;
    padding: 0;
}

.guide-section li {
    color: #c8d4e0;
    padding: 6px 0;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.guide-section li strong {
    display: inline-block;
    min-width: 80px;
    padding: 4px 10px;
    background: rgba(74, 158, 255, 0.2);
    border-radius: 6px;
    color: #fff;
    font-family: 'Courier New', monospace;
    text-align: center;
}

.powerup-speed {
    color: #ffff00;
    font-weight: bold;
    text-shadow: 0 0 8px rgba(255, 255, 0, 0.5);
}

.powerup-power {
    color: #ff6600;
    font-weight: bold;
    text-shadow: 0 0 8px rgba(255, 102, 0, 0.5);
}

.powerup-shield {
    color: #00ffff;
    font-weight: bold;
    text-shadow: 0 0 8px rgba(0, 255, 255, 0.5);
}

.guide-rule {
    margin-top: 12px;
    padding: 10px 14px;
    background: rgba(255, 170, 0, 0.15);
    border: 1px solid rgba(255, 170, 0, 0.4);
    border-radius: 8px;
    color: #ffcc66;
    font-size: 13px;
}

.guide-rule.danger {
    background: rgba(255, 50, 50, 0.15);
    border: 1px solid rgba(255, 50, 50, 0.5);
    color: #ff6666;
}

#start-game-btn {
    display: block;
    width: 100%;
    margin-top: 25px;
    padding: 18px 40px;
    font-size: 22px;
    font-weight: bold;
    cursor: pointer;
    background: linear-gradient(135deg, #4a9eff, #1a6adf);
    color: white;
    border: none;
    border-radius: 30px;
    transition: all 0.3s ease;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    box-shadow:
        0 6px 20px rgba(74, 158, 255, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

#start-game-btn:hover {
    transform: scale(1.03) translateY(-2px);
    box-shadow:
        0 10px 30px rgba(74, 158, 255, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
    background: linear-gradient(135deg, #5aaeFF, #2a7aef);
}

#start-game-btn:active {
    transform: scale(0.98);
}

/* Hide guide when game starts */
#game-guide-overlay.hidden {
    display: none;
}

/* Mobile/Desktop control guide visibility */
#controls-mobile {
    display: none;
}

@media (max-width: 1024px),
(pointer: coarse) {
    #controls-desktop {
        display: none;
    }

    #controls-mobile {
        display: block;
    }

    /* Adjust UI for mobile */
    #top-bar {
        padding: 10px 15px;
    }

    #player-info,
    #enemy-count {
        font-size: 18px;
        padding: 8px 14px;
    }

    #stage-info h2 {
        font-size: 16px;
    }

    #timer {
        font-size: 14px;
    }

    #controls-help {
        display: none;
    }
}