/* ============================================
   SAHIRA — In-Game UI
   Minimalist dialogue + colorful accents
   ============================================ */

/* ── Game Screen ── */
#screen-game {
    background: var(--bg-deep);
}

/* ── Background Layer ── */
.game-bg {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    transition: opacity 0.8s var(--ease-in-out);
    z-index: 0;
}

/* ── Character Sprites ── */
.game-characters {
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
}

.char-sprite {
    position: absolute;
    bottom: 0;
    width: 40%;
    height: 85%;
    background-size: contain;
    background-position: bottom center;
    background-repeat: no-repeat;
    opacity: 0;
    transition: all 0.6s var(--ease-out);
}

.char-sprite.visible {
    opacity: 1;
}

.char-left { left: 5%; }
.char-center {
    left: 50%;
    transform: translateX(-50%);
}
.char-center.visible { transform: translateX(-50%); }
.char-right { right: 5%; }

.char-sprite.entering-left {
    animation: slideFromLeft 0.6s var(--ease-out) forwards;
}
.char-sprite.entering-right {
    animation: slideFromRight 0.6s var(--ease-out) forwards;
}

/* ══════════════════════════════════════════
   Dialogue Box
   ══════════════════════════════════════════ */

.dialogue-box {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    min-height: 165px;
    padding: var(--space-lg) max(var(--space-2xl), env(safe-area-inset-right)) max(var(--space-md), env(safe-area-inset-bottom)) max(var(--space-2xl), env(safe-area-inset-left));
    background: var(--bg-dialogue);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-top: 1px solid rgba(255, 255, 255, 0.04);
    z-index: 10;
    cursor: pointer;
    opacity: 0;
    transition: opacity var(--transition-normal);
}

.dialogue-box.visible {
    opacity: 1;
}

/* Colorful rainbow shimmer on top edge */
.dialogue-box::before {
    content: '';
    position: absolute;
    top: -1px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--gradient-rainbow);
    background-size: 200% 100%;
    animation: shimmer 3s linear infinite;
}

/* Subtle gradient glow behind dialogue */
.dialogue-box::after {
    content: '';
    position: absolute;
    top: -40px;
    left: 0;
    right: 0;
    height: 40px;
    background: linear-gradient(to top, rgba(10, 10, 30, 0.5), transparent);
    pointer-events: none;
}

.speaker-name {
    display: inline-block;
    padding: 3px var(--space-md) 4px;
    margin-bottom: var(--space-sm);
    font-family: var(--font-heading);
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    color: var(--text-primary);
    background: var(--gradient-ocean);
    border-radius: var(--radius-sm);
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.speaker-name.visible {
    opacity: 1;
}

.dialogue-text {
    font-family: var(--font-body);
    font-size: 1.05rem;
    line-height: 1.7;
    color: var(--text-primary);
    min-height: 65px;
    letter-spacing: 0.01em;
}

.dialogue-indicator {
    position: absolute;
    bottom: max(var(--space-sm), env(safe-area-inset-bottom));
    right: max(var(--space-xl), env(safe-area-inset-right));
    font-size: 0.8rem;
    color: var(--pink);
    animation: bounceIndicator 1s ease-in-out infinite;
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.dialogue-indicator.visible {
    opacity: 0.7;
}

/* ══════════════════════════════════════════
   Narration Overlay
   ══════════════════════════════════════════ */

.narration-box {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(10, 10, 26, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 8;
    cursor: pointer;
    animation: fadeIn 0.5s var(--ease-out);
    padding: var(--space-md);
}

.narration-text {
    max-width: 700px;
    padding: var(--space-xl);
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-style: italic;
    line-height: 1.8;
    color: var(--text-secondary);
    text-align: center;
    letter-spacing: 0.02em;
}

/* ══════════════════════════════════════════
   Choice Buttons
   ══════════════════════════════════════════ */

.choice-container {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(10, 10, 26, 0.6);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 15;
    animation: fadeIn 0.4s var(--ease-out);
    padding: var(--space-md);
}

.choice-buttons {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
    width: 90%;
    max-width: 520px;
}

.choice-btn {
    padding: var(--space-md) var(--space-lg);
    font-family: var(--font-body);
    font-size: 1rem;
    line-height: 1.5;
    color: var(--text-primary);
    background: rgba(15, 15, 40, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-left: 3px solid transparent;
    border-radius: var(--radius-md);
    cursor: pointer;
    text-align: left;
    transition: all var(--transition-fast);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    animation: slideUp 0.4s var(--ease-out) both;
}

/* Staggered entrance */
.choice-btn:nth-child(1) { animation-delay: 0.05s; }
.choice-btn:nth-child(2) { animation-delay: 0.1s; }
.choice-btn:nth-child(3) { animation-delay: 0.15s; }
.choice-btn:nth-child(4) { animation-delay: 0.2s; }

/* Each choice glows a different color on hover */
.choice-btn:nth-child(1):hover {
    border-left-color: var(--coral);
    background: rgba(255, 107, 107, 0.1);
    box-shadow: 0 0 20px rgba(255, 107, 107, 0.15);
    transform: translateX(8px);
}
.choice-btn:nth-child(2):hover {
    border-left-color: var(--teal);
    background: rgba(0, 206, 201, 0.1);
    box-shadow: 0 0 20px rgba(0, 206, 201, 0.15);
    transform: translateX(8px);
}
.choice-btn:nth-child(3):hover {
    border-left-color: var(--purple);
    background: rgba(162, 155, 254, 0.1);
    box-shadow: 0 0 20px rgba(162, 155, 254, 0.15);
    transform: translateX(8px);
}
.choice-btn:nth-child(4):hover {
    border-left-color: var(--gold);
    background: rgba(253, 203, 110, 0.1);
    box-shadow: 0 0 20px rgba(253, 203, 110, 0.15);
    transform: translateX(8px);
}

.choice-btn:active {
    transform: translateX(4px) scale(0.98);
}

/* ══════════════════════════════════════════
   Quick Menu
   ══════════════════════════════════════════ */

.quick-menu {
    position: absolute;
    top: max(var(--space-xs), env(safe-area-inset-top));
    right: max(var(--space-xs), env(safe-area-inset-right));
    display: flex;
    gap: var(--space-xs);
    z-index: 20;
    opacity: 0.75;
    transition: opacity var(--transition-fast);
}

.quick-menu:hover {
    opacity: 1;
}

.qm-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    background: rgba(10, 10, 30, 0.75);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.qm-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.2);
    transform: scale(1.08);
}

.qm-btn.active {
    border-color: var(--teal);
    box-shadow: var(--shadow-glow-teal);
    background: rgba(0, 206, 201, 0.15);
}

/* ══════════════════════════════════════════
   Mobile Landscape Optimization (Heights <= 550px)
   ══════════════════════════════════════════ */
@media screen and (max-height: 550px) {
    .char-sprite {
        height: 95%;
        width: 32%;
    }

    .dialogue-box {
        min-height: 110px;
        padding-top: 6px;
        padding-bottom: max(6px, env(safe-area-inset-bottom));
        padding-left: max(var(--space-lg), env(safe-area-inset-left));
        padding-right: max(var(--space-lg), env(safe-area-inset-right));
    }

    .speaker-name {
        font-size: 0.75rem;
        padding: 2px 8px;
        margin-bottom: 2px;
    }

    .dialogue-text {
        font-size: 0.88rem;
        line-height: 1.45;
        min-height: 44px;
    }

    .dialogue-indicator {
        bottom: max(4px, env(safe-area-inset-bottom));
        right: max(var(--space-lg), env(safe-area-inset-right));
        font-size: 0.7rem;
    }

    .narration-text {
        font-size: 1rem;
        line-height: 1.5;
        padding: var(--space-md);
    }

    .choice-container {
        padding-top: max(var(--space-sm), env(safe-area-inset-top));
        padding-bottom: max(var(--space-sm), env(safe-area-inset-bottom));
    }

    .choice-buttons {
        max-height: 82vh;
        max-height: 82dvh;
        overflow-y: auto;
        gap: 6px;
    }

    .choice-btn {
        padding: 8px 14px;
        font-size: 0.85rem;
        line-height: 1.35;
    }

    .qm-btn {
        width: 30px;
        height: 30px;
        font-size: 0.72rem;
    }
}

/* ══════════════════════════════════════════
   Cutscene Overlay & Animations
   ══════════════════════════════════════════ */

.cutscene-container {
    position: absolute;
    inset: 0;
    z-index: 12;
    background: #000;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    animation: fadeIn 0.8s ease-in-out;
}

.cutscene-img {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    transform: scale(1.18);
}

.cutscene-container.active .cutscene-img {
    animation: cutsceneZoomOut 6.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

@keyframes cutsceneZoomOut {
    from { transform: scale(1.18); }
    to { transform: scale(1.0); }
}

.cutscene-caption {
    position: absolute;
    bottom: 8%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(10, 10, 26, 0.75);
    border: 1px solid rgba(255, 255, 255, 0.12);
    padding: var(--space-md) var(--space-xl);
    border-radius: var(--radius-lg);
    font-family: var(--font-display);
    font-size: 1.15rem;
    font-style: italic;
    color: var(--text-primary);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    max-width: 80%;
    text-align: center;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 13;
    animation: slideUp 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;
    animation-delay: 0.5s;
    letter-spacing: 0.015em;
    pointer-events: none;
}


