/* =============================================================================
   MATRIX DODGER - Game Styles
   Version: 1.0
   ============================================================================= */

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

body {
    font-family: 'Inter', sans-serif;
    background: #000;
    color: #fff;
    overflow: hidden;
    position: relative;
}

/* --- MATRIX BACKGROUND --- */
#matrix-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
}

/* --- GAME CONTAINER --- */
.game-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 10px 20px 20px 20px;
}

/* --- GAME HEADER --- */
.game-header {
    width: 100%;
    max-width: 800px;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    margin-bottom: 10px;
    flex-wrap: wrap;
    gap: 10px;
    position: relative;
    min-height: 50px;
}

.back-btn {
    background: rgba(26, 26, 26, 0.8);
    color: #ff5555;
    padding: 8px 16px;
    border-radius: 5px;
    text-decoration: none;
    font-weight: 700;
    font-size: 0.85rem;
    border: 1px solid #ff5555;
    transition: all 0.3s ease;
    position: absolute;
    left: 0;
    top: 0;
}

.back-btn:hover {
    background: rgba(255, 85, 85, 0.2);
    box-shadow: 0 0 15px rgba(255, 85, 85, 0.3);
}

.game-title {
    font-size: 1.8rem;
    color: #ff5555;
    text-shadow: 0 0 20px rgba(255, 85, 85, 0.8);
    text-align: center;
    width: 100%;
    margin-top: 0;
}

.game-stats {
    display: flex;
    gap: 20px;
    background: rgba(26, 26, 26, 0.8);
    padding: 10px 20px;
    border-radius: 5px;
    border: 1px solid #ff5555;
    justify-content: center;
    width: 100%;
    max-width: 400px;
    margin: 0 auto 15px auto;
}

.stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.stat-label {
    font-size: 0.8rem;
    color: #aaa;
    text-transform: uppercase;
}

.stat-value {
    font-size: 1.2rem;
    font-weight: 700;
    color: #ff5555;
    transition: transform 0.3s ease, color 0.3s ease;
}

.lives-stat .stat-value {
    font-size: 1rem;
}

/* --- GAME CANVAS --- */
#gameCanvas {
    background: rgba(0, 0, 0, 0.9);
    border: 3px solid #ff5555;
    border-radius: 10px;
    box-shadow: 0 0 30px rgba(255, 85, 85, 0.5);
    display: block;
    max-width: 100%;
}

/* --- MOBILE CONTROLS --- */
.mobile-controls {
    display: none;
    flex-direction: column;
    gap: 12px;
    margin-top: 15px;
    width: 100%;
    max-width: 400px;
    padding-bottom: 20px;
}

.control-row {
    display: flex;
    justify-content: center;
    gap: 10px;
    align-items: center;
}

.control-row.top-row {
    justify-content: space-between;
    padding: 0 20px;
}

.control-row.middle-row {
    justify-content: center;
}

.control-row.bottom-row {
    justify-content: center;
}

.control-btn {
    background: rgba(255, 85, 85, 0.3);
    border: 2px solid #ff5555;
    color: #fff;
    padding: 14px 24px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 95px;
    text-align: center;
    user-select: none;
    touch-action: manipulation;
}

.control-btn.pause-btn {
    min-width: 70px;
    padding: 12px 16px;
    font-size: 0.85rem;
}

.control-btn.jump-btn {
    min-width: 110px;
    padding: 16px 28px;
    font-size: 1rem;
}

.control-btn:active {
    background: rgba(255, 85, 85, 0.6);
    box-shadow: 0 0 20px rgba(255, 85, 85, 0.8);
    transform: scale(0.95);
}

/* --- DESKTOP INSTRUCTIONS --- */
.desktop-instructions {
    margin-top: 15px;
    text-align: center;
    color: #888;
    font-size: 0.9rem;
}

/* --- PAUSE BUTTON --- */
.pause-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(255, 85, 85, 0.3);
    border: 2px solid #ff5555;
    color: #fff;
    padding: 8px 16px;
    border-radius: 5px;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 100;
}

.pause-btn:hover {
    background: rgba(255, 85, 85, 0.5);
    box-shadow: 0 0 15px rgba(255, 85, 85, 0.5);
}

.pause-btn:active {
    transform: scale(0.95);
}

.pause-btn-mobile {
    display: none;
    background: rgba(255, 85, 85, 0.3);
    border: 2px solid #ff5555;
    color: #fff;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    margin: 8px auto;
    width: 100%;
    max-width: 200px;
}

.pause-btn-mobile:active {
    background: rgba(255, 85, 85, 0.6);
    transform: scale(0.95);
}

/* --- START SCREEN --- */
.start-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.start-content {
    background: rgba(26, 26, 26, 0.9);
    border: 3px solid #ff5555;
    border-radius: 15px;
    padding: 40px;
    max-width: 500px;
    text-align: center;
    box-shadow: 0 0 40px rgba(255, 85, 85, 0.5);
}

.start-title {
    font-size: 2.5rem;
    color: #ff5555;
    text-shadow: 0 0 20px rgba(255, 85, 85, 0.8);
    margin-bottom: 25px;
}

.start-instructions {
    color: #ddd;
    line-height: 1.8;
    font-size: 1.1rem;
    margin-bottom: 20px;
}

.start-tip {
    color: #ff5555;
    font-style: italic;
    margin-bottom: 30px;
}

.start-btn {
    font-size: 1.2rem;
    padding: 15px 40px;
}

/* --- GAME OVER SCREEN --- */
.game-over-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.game-over-screen.active {
    display: flex;
}

.game-over-content {
    background: rgba(26, 26, 26, 0.9);
    border: 3px solid #ff5555;
    border-radius: 15px;
    padding: 40px;
    max-width: 500px;
    text-align: center;
    box-shadow: 0 0 40px rgba(255, 85, 85, 0.5);
}

.game-over-title {
    font-size: 2.5rem;
    color: #ff5555;
    text-shadow: 0 0 20px rgba(255, 85, 85, 0.8);
    margin-bottom: 25px;
}

.final-score,
.final-level {
    font-size: 1.5rem;
    color: #fff;
    margin-bottom: 15px;
}

.final-score span,
.final-level span {
    color: #ff5555;
    font-weight: 700;
}

.game-over-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 30px;
}

.game-btn {
    background: #ff5555;
    color: #fff;
    padding: 12px 30px;
    border-radius: 8px;
    border: none;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
}

.game-btn:hover {
    background: #ff7777;
    box-shadow: 0 0 20px rgba(255, 85, 85, 0.6);
    transform: scale(1.05);
}

.game-btn.secondary {
    background: #333;
    border: 2px solid #ff5555;
}

.game-btn.secondary:hover {
    background: #444;
}

.high-score-notice {
    margin-top: 20px;
    padding: 15px;
    background: rgba(255, 215, 0, 0.2);
    border: 2px solid gold;
    border-radius: 8px;
    color: gold;
    font-weight: 700;
    display: none;
}

.high-score-notice.active {
    display: block;
}

/* --- SCORE SUBMISSION FORM --- */
.score-submit-form {
    margin: 20px 0;
    padding: 20px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
    border: 1px solid #ff5555;
}

.player-name-input {
    width: 100%;
    padding: 12px;
    margin-bottom: 15px;
    background: rgba(26, 26, 26, 0.8);
    border: 2px solid #ff5555;
    border-radius: 5px;
    color: #fff;
    font-size: 1rem;
    font-family: 'Inter', sans-serif;
    text-align: center;
}

.player-name-input::placeholder {
    color: #888;
}

.player-name-input:focus {
    outline: none;
    border-color: #ff7777;
    box-shadow: 0 0 10px rgba(255, 85, 85, 0.3);
}

.submit-score-btn {
    width: 100%;
    margin-bottom: 10px;
}

.submit-status {
    margin-top: 10px;
    font-size: 0.9rem;
    color: #4CAF50;
    min-height: 20px;
}

.submit-status.error {
    color: #ff5555;
}

.submit-status.success {
    color: #4CAF50;
}

/* --- RESPONSIVE DESIGN --- */
@media (max-width: 768px) {
    .game-container {
        padding: 0;
        padding-top: 0;
        justify-content: flex-start;
        min-height: 100vh;
    }

    .game-header {
        margin-bottom: 2px;
        min-height: 35px;
        flex-direction: column;
        align-items: flex-start;
        padding: 0 10px;
    }

    .back-btn {
        font-size: 0.7rem;
        padding: 6px 12px;
        position: absolute;
        margin: 0;
        left: 10px;
        top: 5px;
    }

    .pause-btn {
        display: none;
    }

    .pause-btn-mobile {
        display: none;
    }

    .game-title {
        font-size: 1.2rem;
        margin-top: 5px;
        padding-top: 0;
        width: 100%;
    }

    .game-stats {
        gap: 8px;
        padding: 3px 10px;
        font-size: 0.8rem;
        margin: 1px auto 1px auto;
        max-width: 100%;
    }

    .stat-value {
        font-size: 0.95rem;
    }

    #gameCanvas {
        margin-bottom: 1px;
        max-width: 100%;
        height: auto;
    }

    .mobile-controls {
        margin-top: 2px;
        padding-bottom: 3px;
        gap: 6px;
    }

    .control-btn {
        padding: 11px 18px;
        font-size: 0.8rem;
        min-width: 80px;
    }
    
    .control-btn.pause-btn {
        min-width: 55px;
        padding: 9px 12px;
        font-size: 0.75rem;
    }
    
    .control-btn.jump-btn {
        min-width: 95px;
        padding: 13px 22px;
        font-size: 0.9rem;
    }

    .desktop-instructions {
        display: none;
    }

    .stat-value {
        font-size: 1rem;
    }

    .mobile-controls {
        display: flex;
    }

    .desktop-instructions {
        display: none;
    }

    .game-header {
        flex-direction: column;
        margin-bottom: 10px;
    }

    #gameCanvas {
        margin-bottom: 5px;
    }

    .start-content,
    .game-over-content {
        padding: 30px 20px;
        margin: 20px;
    }

    .start-title,
    .game-over-title {
        font-size: 2rem;
    }

    .start-instructions {
        font-size: 1rem;
    }

    .game-over-buttons {
        flex-direction: column;
    }

    .game-btn {
        width: 100%;
    }
}

/* --- NOTIFICATION POPUP --- */
.notification-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    background: rgba(255, 85, 85, 0.95);
    border: 4px solid #fff;
    border-radius: 15px;
    padding: 40px 60px;
    z-index: 2000;
    text-align: center;
    box-shadow: 0 0 50px rgba(255, 85, 85, 0.8);
    transition: transform 0.3s ease;
}

.notification-popup.active {
    transform: translate(-50%, -50%) scale(1);
}

.notification-popup h2 {
    font-size: 3rem;
    color: #fff;
    text-shadow: 0 0 20px rgba(0, 0, 0, 0.8);
    margin: 0;
}

.notification-popup.life-lost {
    background: rgba(139, 0, 0, 0.95);
    animation: shake 0.3s;
}

@keyframes shake {
    0%, 100% { transform: translate(-50%, -50%) translateX(0); }
    25% { transform: translate(-50%, -50%) translateX(-10px); }
    75% { transform: translate(-50%, -50%) translateX(10px); }
}

@media (max-width: 480px) {
    .game-title {
        font-size: 1.3rem;
    }

    .control-btn {
        padding: 12px 20px;
        font-size: 0.8rem;
        min-width: 80px;
    }
}
