/* styles.css - Upgradat pentru grafică modernă: neumorphism, glows, particles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    width: 100%;
    height: 100%; height: 100dvh;
    overflow: hidden;
    padding-bottom: env(safe-area-inset-bottom, 0);
    position: fixed;
    top: 0;
    left: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: #0a0a1e;
    color: white;
    touch-action: manipulation;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

#game-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%; height: 100dvh;
    height: 100dvh; /* Dynamic viewport height - fixes mobile browser bars */
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

#gameCanvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%; height: 100dvh;
    touch-action: none;
}

#ui-overlay {
    position: absolute;
    top: env(safe-area-inset-top, 5px);
    left: env(safe-area-inset-left, 5px);
    right: env(safe-area-inset-right, 5px);
    padding: 5px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    z-index: 10;
    pointer-events: none;
}

#score-display {
    font-size: clamp(14px, 4vw, 20px);
    font-weight: bold;
    text-shadow: 0 0 15px #4ecdc4, 0 0 5px #4ecdc4;
    background: rgba(78,205,196,0.1);
    padding: 6px 12px;
    border-radius: 15px;
    backdrop-filter: blur(10px);
}

#combo {
    color: gold;
    font-size: clamp(14px, 4vw, 20px);
    margin-left: 10px;
    animation: comboGlow 1s infinite alternate;
}

@keyframes comboGlow {
    from { text-shadow: 0 0 10px gold; }
    to { text-shadow: 0 0 20px gold; }
}

#height-display {
    font-size: clamp(11px, 3vw, 14px);
    background: rgba(0,0,0,0.6);
    padding: 6px 12px;
    border-radius: 15px;
    backdrop-filter: blur(15px);
    box-shadow: inset 0 2px 4px rgba(255,255,255,0.1);
}

#wind-indicator {
    background: linear-gradient(45deg, rgba(255,100,100,0.9), rgba(255,50,50,0.7));
    padding: 8px 12px;
    border-radius: 20px;
    font-weight: bold;
    animation: windPulse 0.8s infinite;
    box-shadow: 0 0 10px rgba(255,100,100,0.5);
    font-size: clamp(12px, 3vw, 16px);
}

#wind-arrow {
    margin-right: 5px;
    font-size: clamp(16px, 4vw, 24px);
}

@keyframes windPulse {
    0%, 100% { opacity: 0.8; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.05); }
}

.screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%; height: 100dvh;
    background: rgba(10,10,30,0.95);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 20;
    pointer-events: all;
    backdrop-filter: blur(5px);
    padding: env(safe-area-inset-top, 20px) env(safe-area-inset-right, 20px) env(safe-area-inset-bottom, 20px) env(safe-area-inset-left, 20px);
    overflow-y: auto;
}

.screen h1, .screen h2 {
    font-size: clamp(2em, 8vw, 3.5em);
    margin-bottom: 15px;
    text-shadow: 0 0 25px #4ecdc4, 0 0 10px #4ecdc4;
    text-align: center;
}

.screen p {
    font-size: clamp(0.9em, 3.5vw, 1.2em);
    text-align: center;
}

.instructions {
    text-align: center;
    margin: 20px 0;
    font-size: clamp(0.9em, 3.5vw, 1.3em);
    max-width: 90%;
    text-shadow: 0 0 5px rgba(255,255,255,0.5);
}

.instructions p {
    margin: 8px 0;
}

.btn-primary, .btn-secondary {
    background: linear-gradient(45deg, #4ecdc4, #44a08d);
    border: none;
    color: white;
    padding: clamp(14px, 3vw, 18px) clamp(25px, 5vw, 35px);
    font-size: clamp(1em, 4vw, 1.3em);
    border-radius: 50px;
    cursor: pointer;
    margin: 8px;
    box-shadow: 0 10px 20px rgba(78,205,196,0.4), inset 0 2px 4px rgba(255,255,255,0.3);
    transition: all 0.2s;
    min-width: 160px;
    touch-action: manipulation;
}

.btn-primary:active, .btn-secondary:active {
    transform: scale(0.95);
}

.btn-secondary {
    background: linear-gradient(45deg, #ff6b6b, #ee5a52);
}

.stats {
    background: rgba(0,0,0,0.8);
    padding: clamp(20px, 4vw, 35px);
    border-radius: 20px;
    margin: 15px;
    text-align: center;
    font-size: clamp(1em, 4vw, 1.4em);
    box-shadow: 0 10px 20px rgba(0,0,0,0.5);
    width: 90%;
    max-width: 350px;
}

.stats p {
    margin: 8px 0;
}

.mode-select {
    display: flex;
    gap: 8px;
    margin-top: 15px;
    flex-wrap: wrap;
    justify-content: center;
    max-width: 95%;
}

.mode-btn {
    background: rgba(78,205,196,0.3);
    border: 2px solid #4ecdc4;
    box-shadow: 0 5px 10px rgba(78,205,196,0.2);
    padding: clamp(10px, 2.5vw, 18px) clamp(15px, 3vw, 35px);
    font-size: clamp(0.85em, 3vw, 1.3em);
    border-radius: 50px;
    color: white;
    cursor: pointer;
    min-width: auto;
    transition: all 0.2s;
    touch-action: manipulation;
}

.mode-btn.active {
    background: linear-gradient(45deg, #4ecdc4, #44a08d);
    transform: scale(1.02);
}

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

.hidden {
    display: none !important;
}

#perfect-effect {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: clamp(3em, 12vw, 5em);
    color: gold;
    text-shadow: 0 0 40px gold, 0 0 20px orange;
    pointer-events: none;
    z-index: 15;
    animation: perfectAnim 1.2s ease-out forwards;
}

@keyframes perfectAnim {
    0% { opacity: 0; transform: translate(-50%, -50%) scale(0.5) rotate(-10deg); }
    50% { opacity: 1; transform: translate(-50%, -50%) scale(1.3) rotate(0); }
    100% { opacity: 0; transform: translate(-50%, -50%) scale(1) rotate(10deg); }
}

/* Ad banner - bottom safe area */
#ad-banner {
    position: fixed;
    bottom: env(safe-area-inset-bottom, 0);
    left: 0;
    right: 0;
    height: 60px;
    background: rgba(0,0,0,0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 50;
}
#ad-banner.hidden { display: none; }

.btn-reward {
    background: linear-gradient(135deg, #ffd700, #ffaa00) !important;
    color: #1a1a2e !important;
    padding: clamp(12px, 3vw, 15px) clamp(20px, 4vw, 25px) !important;
    font-size: clamp(0.9em, 3.5vw, 1.1em) !important;
    border-radius: 12px !important;
    font-weight: bold !important;
    animation: pulse 2s infinite;
    margin-bottom: 10px !important;
    border: none;
    cursor: pointer;
    touch-action: manipulation;
}

/* Mobile Portrait Optimizations */
@media (max-width: 600px) {
    #ui-overlay {
        flex-direction: row;
        justify-content: space-between;
        gap: 8px;
        padding: 8px;
    }
    
    #score-display, #height-display {
        padding: 6px 12px;
    }
    
    .screen {
        padding: 15px;
    }
    
    .mode-select {
        gap: 6px;
    }
    
    .mode-btn {
        padding: 10px 14px;
        min-width: 80px;
    }
}

/* Mobile Landscape Optimizations */
@media (max-height: 500px) and (orientation: landscape) {
    .screen {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        align-content: center;
        gap: 15px;
    }
    
    .screen h1, .screen h2 {
        width: 100%;
        font-size: 1.8em;
        margin-bottom: 5px;
    }
    
    .instructions {
        display: none;
    }
    
    .stats {
        padding: 15px 25px;
        margin: 5px;
    }
    
    .mode-select {
        margin-top: 10px;
    }
    
    .btn-primary, .btn-secondary {
        padding: 12px 25px;
        margin: 5px;
    }
}

/* iPhone X+ notch support */
@supports (padding: max(0px)) {
    #ui-overlay {
        padding-top: max(10px, env(safe-area-inset-top));
        padding-left: max(10px, env(safe-area-inset-left));
        padding-right: max(10px, env(safe-area-inset-right));
    }
    
    .screen {
        padding-bottom: max(20px, env(safe-area-inset-bottom));
    }
}

/* Tap highlight for touch feedback */
.btn-primary, .btn-secondary, .mode-btn {
    -webkit-tap-highlight-color: rgba(78, 205, 196, 0.3);
}

/* Disable text selection on game elements */
#game-container, .screen, button {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* Loading indicator */
#loading {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: #0a0a1e;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

#loading.hidden { display: none; }

.loader {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(78,205,196,0.3);
    border-top-color: #4ecdc4;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}



/* Safe area for iOS notch and home indicator */
.game-over-modal,
.menu-modal {
    padding-bottom: max(20px, env(safe-area-inset-bottom));
}

#ui-overlay {
    padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

/* Fullscreen button for mobile */
#fullscreen-btn {
    position: fixed;
    bottom: max(10px, env(safe-area-inset-bottom));
    right: 10px;
    width: 44px;
    height: 44px;
    background: rgba(0,0,0,0.5);
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 20px;
    cursor: pointer;
    z-index: 1000;
    display: none;
}

@media (max-width: 768px) {
    #fullscreen-btn {
        display: flex;
        align-items: center;
        justify-content: center;
    }
}

/* Hide when in fullscreen */
:fullscreen #fullscreen-btn,
:-webkit-full-screen #fullscreen-btn {
    display: none;
}
