@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@500;800&family=Poppins:wght@400;600&display=swap');

#flight-game-wrapper {
    position: relative;
    width: 100%;
    height: 600px;
    background: linear-gradient(to bottom, #0f172a, #1e293b);
    border-radius: 20px;
    overflow: hidden;
    font-family: 'Poppins', sans-serif;
    box-shadow: 0 15px 40px rgba(0,0,0,0.3);
}

#flight-game-wrapper:fullscreen {
    width: 100vw; height: 100vh; border-radius: 0;
}

#fg-canvas {
    display: block; width: 100%; height: 100%;
}

#flight-game-wrapper.playing {
    cursor: none;
}

/* ÉCRANS ET CARTES */
.fg-screen {
    position: absolute; inset: 0;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(5px);
    display: flex; justify-content: center; align-items: center;
    z-index: 50; transition: opacity 0.3s;
}
.fg-screen.hidden { display: none !important; opacity: 0; }
.fg-screen.active { display: flex !important; opacity: 1; animation: popIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275); }

.fg-card {
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.1);
    padding: 40px; border-radius: 25px; text-align: center;
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
    width: 90%; max-width: 450px;
}

.fg-title {
    font-family: 'Orbitron', sans-serif; font-size: 2.2rem; margin: 0 0 10px 0;
    background: linear-gradient(135deg, #00d2ff 0%, #3a7bd5 100%);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}

.fg-btn-primary {
    background: linear-gradient(135deg, #00d2ff 0%, #3a7bd5 100%);
    color: white; border: none; padding: 15px 40px; border-radius: 50px;
    font-size: 1.2rem; font-weight: bold; font-family: 'Orbitron', sans-serif;
    cursor: pointer; transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 10px 20px rgba(0, 210, 255, 0.3);
}
.fg-btn-primary:hover { transform: translateY(-3px) scale(1.05); box-shadow: 0 15px 25px rgba(0, 210, 255, 0.5); }

/* BOUTON PLEIN ÉCRAN PERMANENT */
.fg-fullscreen-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    z-index: 100;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.3rem;
    cursor: pointer;
    transition: all 0.3s;
    backdrop-filter: blur(5px);
}

.fg-fullscreen-btn:hover {
    background: rgba(0, 210, 255, 0.3);
    border-color: #00d2ff;
    transform: scale(1.1);
    box-shadow: 0 0 15px rgba(0, 210, 255, 0.5);
}

#flight-game-wrapper:fullscreen .fg-fullscreen-btn {
    top: 10px;
    right: 10px;
    opacity: 0.7;
}

#flight-game-wrapper:fullscreen .fg-fullscreen-btn:hover {
    opacity: 1;
}

/* MODE FULLSCREEN iOS (simulation) */
#flight-game-wrapper.ios-fullscreen {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    height: 100dvh !important;
    border-radius: 0 !important;
    z-index: 9999 !important;
    margin: 0 !important;
    box-shadow: none !important;
}

/* Ajustement pour le safe area sur iPhone X et suivants (encoche) */
@supports (padding-top: env(safe-area-inset-top)) {
    #flight-game-wrapper.ios-fullscreen {
        padding-top: env(safe-area-inset-top) !important;
        padding-bottom: env(safe-area-inset-bottom) !important;
    }
}

#flight-game-wrapper.ios-fullscreen .fg-fullscreen-btn {
    top: calc(10px + env(safe-area-inset-top)) !important;
    right: calc(10px + env(safe-area-inset-right)) !important;
    background: rgba(0, 0, 0, 0.5);
}

/* HUD */
#fg-hud {
    position: absolute; top: 0; left: 0; width: 100%;
    display: flex; justify-content: space-between; align-items: center;
    padding: 15px 25px;
    padding-right: 70px;
    z-index: 20; pointer-events: none;
}
#fg-hud.hidden { display: none !important; }

.fg-stat-box { display: flex; flex-direction: column; align-items: center; }
.fg-label { font-size: 0.7rem; color: #94a3b8; font-weight: bold; letter-spacing: 2px; }
.fg-value { font-family: 'Orbitron', sans-serif; font-size: 1.8rem; font-weight: 800; color: white; text-shadow: 0 2px 10px rgba(0,0,0,0.5); }

/* SCORE CIRCLE */
.fg-score-circle {
    width: auto; 
    min-width: 150px;
    height: 150px;
    border-radius: 75px; 
    padding: 0 30px;
    background: linear-gradient(135deg, #00d2ff, #3a7bd5); color: white;
    display: flex; flex-direction: column; justify-content: center; align-items: center;
    margin: 20px auto; border: 4px solid #fff; box-shadow: 0 10px 30px rgba(0,210,255,0.4);
}
.fg-score-circle span {
    font-size: clamp(1.8rem, 6vw, 3.5rem); 
    font-weight: 900; font-family: 'Orbitron', sans-serif;
    line-height: 1; word-break: break-all;
}
.fg-score-circle small { font-size: 1rem; font-weight: 400; opacity: 0.8; margin-top: 5px; }

#fg-game-over-screen p {
    color: #e2e8f0;
}

@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
@keyframes popIn { from { transform: scale(0.8); opacity: 0; } to { transform: scale(1); opacity: 1; } }

@media(max-width: 600px) {
    .fg-value { font-size: 1.2rem; }
    .fg-card { padding: 25px; }
    .fg-title { font-size: 1.8rem; }
}