/* css/dragon_flight.css */

:root {
    --dragon-color-primary: #ff4d4d;
    --dragon-color-secondary: #cc0000;
    --dragon-color-belly: #ffcc00;
    --sky-top: #1a2a6c;
    --sky-mid: #b21f1f;
    --sky-bottom: #fdbb2d;
}

#dragon-flight-container {
    position: relative;
    width: 100%;
    min-height: 600px;
    /* Force minimum height */
    height: 100%;
    overflow: hidden;
    background-image: url('../assets/backgrounds/bg_drake_lvl.png');
    background-size: auto 100%;
    /* Ensure background height fits and allow width to repeat */
    background-repeat: repeat-x;
    background-position: 0px 0px;
    font-family: 'Outfit', sans-serif;
    color: white;
    border: 8px solid #ffd700;
    /* Majestic golden frame */
    box-shadow: 0 0 30px rgba(255, 215, 0, 0.4), inset 0 0 20px rgba(0, 0, 0, 0.5);
    border-radius: 12px;
}

/* Ensure body has a consistent background when this scene is active */
body.background-dragonFlight {
    background-image: url('../assets/backgrounds/lvl1_bg.jpg');
    background-size: cover;
    background-attachment: fixed;
}

/* Clouds and Parallax Background */
.cloud {
    position: absolute;
    background: white;
    filter: blur(10px);
    opacity: 0.6;
    border-radius: 50%;
    z-index: 1;
}

.dragon-player {
    position: absolute;
    width: 140px;
    /* Bigger dragon */
    height: 110px;
    left: 15%;
    bottom: 50%;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    filter: drop-shadow(0 5px 15px rgba(0, 0, 0, 0.3));
}

.dragon-sprite-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: transform 0.2s ease;
}

/* Gates / Obstacles */
.gate-pair {
    position: absolute;
    right: -100px;
    width: 100px;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    pointer-events: none;
    z-index: 5;
}

.flight-gate {
    width: 90px;
    height: 250px;
    /* Fixed height for gates */
    background: rgba(255, 215, 0, 0.2);
    backdrop-filter: blur(8px);
    border: 4px solid #ffd700;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    font-weight: 900;
    color: #fff;
    text-shadow: 0 0 15px rgba(0, 0, 0, 0.8), 0 0 10px #ffd700;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.3);
    transition: all 0.3s;
}

.top-gate {
    border-top: none;
    border-radius: 0 0 20px 20px;
}

.bot-gate {
    border-bottom: none;
    border-radius: 20px 20px 0 0;
}

.flight-gate.correct-hit {
    background: rgba(0, 255, 0, 0.8) !important;
    border-color: #00ff00 !important;
    box-shadow: 0 0 40px #00ff00, inset 0 0 15px #ffffff;
    color: #000 !important;
    transform: scale(1.1);
}

.flight-gate.wrong-hit {
    background: rgba(244, 67, 54, 0.6);
    border-color: #f44336;
    animation: shake 0.5s;
}

/* UI Elements */
.flight-top-control-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    max-width: 1200px;
    padding: 10px 15px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 12px 12px 0 0;
    margin-bottom: -4px;
    z-index: 50;
    backdrop-filter: blur(8px);
    border: 2px solid rgba(255, 215, 0, 0.3);
    border-bottom: none;
}

.flight-external-btn {
    padding: 8px 18px;
    border-radius: 8px;
    border: 2px solid #ffd700;
    background: #1a1a1a;
    color: #ffd700;
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 8px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.flight-external-btn:hover {
    background: #ffd700;
    color: #000;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 215, 0, 0.3);
}

.flight-external-btn.quit-btn {
    border-color: #ff4d4d;
    color: #ff4d4d;
}

.flight-external-btn.quit-btn:hover {
    background: #ff4d4d;
    color: white;
    box-shadow: 0 4px 12px rgba(255, 77, 77, 0.3);
}

.flight-external-btn.is-paused {
    background: #ffd700;
    color: #000;
    animation: pulse-glow 1.5s infinite;
}

@keyframes pulse-glow {
    0% {
        box-shadow: 0 0 0px #ffd700;
    }

    50% {
        box-shadow: 0 0 20px #ffd700;
    }

    100% {
        box-shadow: 0 0 0px #ffd700;
    }
}

.flight-ui {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    pointer-events: none;
    z-index: 20;
}

.flight-stats-top-new {
    width: 100%;
    padding: 12px 20px;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    /* Central column is mathematically centered */
    align-items: start;
    gap: 15px;
}

/* Capsules styling - Miniaturized */
.stat-capsule {
    background: rgba(0, 0, 0, 0.75);
    padding: 4px 12px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(6px);
    width: fit-content;
}

.hp-capsule {
    justify-self: start;
}

.score-capsule {
    justify-self: end;
}

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

.stat-value {
    font-size: 1.1rem;
    font-weight: 800;
    color: white;
}

.equation-capsule {
    background: #0a0e14;
    padding: 6px 20px;
    border-radius: 0 0 12px 12px;
    border: 2px solid #ffcc00;
    border-top: none;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.7);
    margin-top: -12px;
}

.equation-capsule .target-val {
    color: #ffcc00;
    font-size: 2rem;
    font-weight: 900;
    text-shadow: 0 0 8px rgba(255, 204, 0, 0.3);
}

.equation-operator,
.equation-equal {
    color: #fff;
    font-size: 1.4rem;
    font-weight: 700;
}

.equation-blank {
    color: #ffd700;
    font-size: 1.8rem;
    font-weight: 800;
    border-bottom: 2px solid #fff;
    padding: 0 6px;
    min-width: 30px;
    text-align: center;
}

.equation-target {
    color: #fff;
    font-size: 1.8rem;
    font-weight: 800;
}

/* Animations */
@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-10px);
    }

    75% {
        transform: translateX(10px);
    }
}

.dragon-hit {
    animation: hit-flash 0.5s;
}

@keyframes hit-flash {
    0% {
        filter: brightness(1) drop-shadow(0 0 0 red);
    }

    50% {
        filter: brightness(2) drop-shadow(0 0 20px red);
    }

    100% {
        filter: brightness(1) drop-shadow(0 0 0 red);
    }
}

/* Intro & Endings */
.dragon-flight-intro {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 100;
    text-align: center;
    padding: 20px;
}

.intro-box {
    background: rgba(20, 20, 20, 0.8);
    padding: 40px;
    border-radius: 25px;
    border: 3px solid #ffd700;
    backdrop-filter: blur(15px);
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.8);
    max-width: 500px;
}

.dragon-flight-intro h1 {
    font-size: 3.5rem;
    color: #ffd700;
    text-shadow: 0 0 25px rgba(255, 215, 0, 0.6);
    margin-bottom: 25px;
    font-weight: 900;
}

.intro-box p {
    font-size: 1.3rem;
    margin: 15px 0;
    color: #eee;
    line-height: 1.6;
}