@import url('https://fonts.googleapis.com/css2?family=Bangers&family=Permanent+Marker&family=Carter+One&family=Bungee&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Carter One', 'Permanent Marker', cursive, sans-serif;
    background: #000000;
    overflow: hidden;
    touch-action: none;
    position: fixed;
    width: 100%;
    height: 100%;
    /* iOS safe area support for devices with notches */
    padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

#game-container {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100vh;
    /* Use dvh (dynamic viewport height) for better mobile support, fallback to vh */
    height: 100dvh;
    position: relative;
    background: #000000;
    pointer-events: auto;
}

canvas {
    display: block;
    box-shadow: 0 0 40px rgba(0, 255, 128, 0.5);
    width: 100%;
    height: 100%;
    object-fit: contain;
    position: relative;
    z-index: 1;
    pointer-events: auto;
    touch-action: manipulation;
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.5);
}

::-webkit-scrollbar-thumb {
    background: #4ade80;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #22c55e;
}

/* Prevent text selection on mobile */
body, button, div {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* Loading animation */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.loading {
    animation: pulse 2s ease-in-out infinite;
}

/* Responsive text sizing */
@media (max-width: 600px) {
    body {
        font-size: 14px;
    }
}

@media (max-width: 768px) {
    /* Mobile-specific improvements */
    body {
        font-size: 14px;
        /* Prevent zoom on input focus */
        -webkit-text-size-adjust: 100%;
        text-size-adjust: 100%;
    }

    canvas {
        /* Ensure canvas doesn't overflow on mobile */
        max-width: 100vw;
        max-height: 100vh;
        max-height: 100dvh;
    }

    #game-container {
        /* Better mobile viewport handling */
        min-height: -webkit-fill-available;
    }
}

@media (orientation: landscape) and (max-height: 500px) {
    body {
        font-size: 12px;
    }
}

/* Tap to Start Screen */
#tapToStart {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(180deg, #001a00 0%, #003300 50%, #001a00 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    cursor: pointer;
    transition: opacity 0.5s ease-out;
}

#tapToStart.hidden {
    opacity: 0;
    pointer-events: none;
    display: none !important;
}

#tapToStart.fade-out {
    display: none !important;
}

.tap-content {
    text-align: center;
    animation: pulse-tap 2s infinite;
}

@keyframes pulse-tap {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.05);
        opacity: 0.85;
    }
}

.tap-icon {
    font-size: 80px;
    margin-bottom: 20px;
    animation: float-icon 3s ease-in-out infinite;
}

@keyframes float-icon {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-15px);
    }
}

.tap-title {
    font-family: 'Bangers', cursive;
    font-size: 42px;
    color: #4ade80;
    text-shadow: 0 0 20px rgba(74, 222, 128, 0.5), 0 0 40px rgba(74, 222, 128, 0.3);
    margin-bottom: 30px;
    letter-spacing: 3px;
}

.tap-instruction {
    font-family: 'Carter One', cursive;
    font-size: 22px;
    color: #86efac;
    text-shadow: 0 0 10px rgba(134, 239, 172, 0.5);
    margin-bottom: 15px;
}

.tap-hint {
    font-size: 30px;
    color: #4ade80;
    animation: bounce-hint 1.5s ease-in-out infinite;
}

@keyframes bounce-hint {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(10px);
    }
}

/* Video Intro Screen */
#videoIntro {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000000;
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1500;
    transition: opacity 1s ease-out;
}

#videoIntro.show {
    display: flex !important;
    z-index: 1500;
}

#videoIntro.hidden {
    display: none !important;
    pointer-events: none;
}

#videoIntro.fade-out {
    opacity: 0;
    pointer-events: none;
}

#videoIntro video {
    display: block;
    width: 100%;
    height: 100%;
    max-width: 100vw;
    max-height: 100vh;
    object-fit: contain;
    background: #000000;
}

/* Mobile responsive adjustments for tap screen */
@media (max-width: 768px) {
    .tap-icon {
        font-size: 60px;
    }

    .tap-title {
        font-size: 32px;
    }

    .tap-instruction {
        font-size: 18px;
        padding: 0 20px;
    }
}
