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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #0c4a6e 0%, #075985 50%, #0f172a 100%);
    background-attachment: fixed;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 10px;
    overflow-x: hidden;
}

.container {
    width: 100%;
    max-width: 600px;
    padding: 20px;
}

.game-header {
    text-align: center;
    margin-bottom: 20px;
    color: white;
}

.game-header h1 {
    font-size: 2.5rem;
    margin-bottom: 15px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.score-board {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
    font-size: 1.2rem;
    font-weight: bold;
}

.score, .high-score, .lives-display, .game-time {
    background: rgba(255, 255, 255, 0.2);
    padding: 10px 20px;
    border-radius: 10px;
    backdrop-filter: blur(10px);
    white-space: nowrap;
}

.lives-display {
    background: rgba(239, 68, 68, 0.3);
    border: 2px solid rgba(239, 68, 68, 0.5);
}

.game-time {
    background: rgba(255, 193, 7, 0.3);
    border: 2px solid rgba(255, 193, 7, 0.5);
}

.game-wrapper {
    position: relative;
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    margin-bottom: 20px;
}

#gameCanvas {
    display: block;
    width: 100%;
    height: auto;
    background: #0e7490;
    touch-action: none;
}

.countdown {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 15;
}

.countdown.hidden {
    display: none;
}

.countdown-number {
    font-size: 8rem;
    font-weight: bold;
    color: white;
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.5),
                 0 0 40px rgba(34, 211, 238, 0.8);
}

@keyframes countdownPulse {
    0% {
        transform: scale(0.5);
        opacity: 0;
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes countdownGo {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    100% {
        transform: scale(2);
        opacity: 0;
    }
}


.game-over, .start-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.92);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: white;
    z-index: 10;
    overflow-y: auto;
    padding: 20px;
}

.game-over.hidden, .start-screen.hidden {
    display: none;
}

.game-over h2, .start-screen h2 {
    font-size: 2.5rem;
    margin-bottom: 20px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.game-over p, .start-screen p {
    font-size: 1.4rem;
    margin-bottom: 20px;
}

.difficulty-info {
    font-size: 1.2rem;
    margin-bottom: 10px;
}

.instructions {
    text-align: center;
    max-width: 80%;
    margin-bottom: 12px;
}

.instructions-sub {
    font-size: 1.1rem !important;
    margin-bottom: 20px;
    color: #fbbf24;
}

.difficulty-selector {
    margin: 20px 0;
    text-align: center;
    width: 100%;
}

.difficulty-selector h3 {
    font-size: 1.5rem;
    margin-bottom: 20px;
    color: white;
}

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

.difficulty-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 20px 25px;
    font-size: 1.1rem;
    font-weight: bold;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    backdrop-filter: blur(10px);
    min-width: 100px;
}

.difficulty-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.difficulty-btn.active {
    background: linear-gradient(135deg, #0ea5e9 0%, #0369a1 100%);
    border-color: white;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
}

.difficulty-btn .emoji {
    font-size: 2rem;
}


.btn {
    padding: 15px 40px;
    font-size: 1.2rem;
    font-weight: bold;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: white;
    color: #0369a1;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    margin: 5px;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

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

.btn-primary {
    background: linear-gradient(135deg, #0ea5e9 0%, #0369a1 100%);
    color: white;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 2px solid white;
}


.controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
}

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

.control-btn {
    width: 70px;
    height: 70px;
    font-size: 2rem;
    border: none;
    border-radius: 15px;
    background: rgba(255, 255, 255, 0.9);
    color: #0369a1;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    transition: all 0.2s ease;
    font-weight: bold;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: none;
}

.control-btn:active {
    transform: scale(0.95);
    background: rgba(255, 255, 255, 0.7);
}

.game-info {
    text-align: center;
    color: white;
    font-size: 1rem;
    background: rgba(255, 255, 255, 0.2);
    padding: 15px;
    border-radius: 10px;
    backdrop-filter: blur(10px);
}

.mobile-only {
    display: none;
}

.desktop-only {
    display: inline;
}

@media (max-width: 768px) {
    body {
        align-items: flex-start;
        padding: 5px;
    }

    .mobile-only {
        display: block;
    }

    .desktop-only {
        display: none;
    }

    .controls.mobile-only {
        display: flex;
    }

    .container {
        padding: 10px;
    }

    .game-header {
        margin-bottom: 15px;
    }

    .game-header h1 {
        font-size: 1.8rem;
        margin-bottom: 10px;
    }

    .score-board {
        font-size: 0.9rem;
        gap: 10px;
    }

    .score, .high-score, .lives-display, .game-time {
        padding: 8px 14px;
        font-size: 0.85rem;
    }

    .game-over h2, .start-screen h2 {
        font-size: 1.8rem;
        margin-bottom: 15px;
    }

    .game-over p, .start-screen p {
        font-size: 1.1rem;
        margin-bottom: 15px;
    }

    .instructions {
        font-size: 1rem;
        margin-bottom: 12px;
    }

    .difficulty-selector {
        margin: 15px 0;
    }

    .difficulty-selector h3 {
        font-size: 1.3rem;
        margin-bottom: 15px;
    }

    .difficulty-buttons {
        gap: 10px;
    }

    .difficulty-btn {
        padding: 15px 20px;
        font-size: 1rem;
        min-width: 90px;
    }

    .difficulty-btn .emoji {
        font-size: 1.8rem;
    }

    .countdown-number {
        font-size: 6rem;
    }
}

@media (max-width: 480px) {
    body {
        padding: 3px;
    }

    .container {
        padding: 5px;
    }

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

    .game-header h1 {
        font-size: 1.5rem;
        margin-bottom: 8px;
    }

    .score-board {
        font-size: 0.8rem;
        gap: 8px;
    }

    .score, .high-score, .lives-display, .game-time {
        padding: 6px 11px;
        font-size: 0.78rem;
    }

    .game-wrapper {
        margin-bottom: 15px;
    }

    .game-over, .start-screen {
        padding: 15px 10px;
    }

    .game-over h2, .start-screen h2 {
        font-size: 1.5rem;
        margin-bottom: 12px;
    }

    .game-over p, .start-screen p {
        font-size: 1rem;
        margin-bottom: 12px;
    }

    .instructions {
        font-size: 0.9rem;
        margin-bottom: 10px;
    }

    .difficulty-selector {
        margin: 12px 0;
    }

    .difficulty-selector h3 {
        font-size: 1.1rem;
        margin-bottom: 12px;
    }

    .difficulty-buttons {
        flex-direction: row;
        gap: 8px;
        flex-wrap: wrap;
    }

    .difficulty-btn {
        flex: 1;
        min-width: 90px;
        max-width: 110px;
        padding: 12px 15px;
        font-size: 0.9rem;
    }

    .difficulty-btn .emoji {
        font-size: 1.5rem;
    }

    .btn {
        padding: 10px 25px;
        font-size: 0.95rem;
        margin: 3px;
    }

    .controls {
        margin-bottom: 15px;
    }

    .control-btn {
        width: 60px;
        height: 60px;
        font-size: 1.5rem;
    }

    .game-info {
        padding: 10px;
        font-size: 0.9rem;
    }

    .countdown-number {
        font-size: 4rem;
    }
}

@media (min-width: 769px) {
    #gameCanvas {
        cursor: default;
    }
}
