/* ==============================================
   RESULT SCREEN STYLES
   Stage completion and game over screens
   ============================================== */

/* Result screen container */
.result-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

/* Level complete and game over base styles */
.level-complete, .game-over {
    display: none;
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: 10;
}

/* Scrollable content wrapper - contains everything including header */
.result-content {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    text-align: center;
    padding: 20px;
    overflow-y: auto;
    overflow-x: hidden;
    gap: 20px;
    z-index: 1;
}

/* Result header - back button and title on same row */
.result-header {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 16px;
    flex-shrink: 0;
}

.result-header #result-title {
    margin: 0;
    font-size: 1.8em;
}

/* Back button */
.level-complete .back-btn {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.level-complete .back-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateX(-2px);
}

.level-complete .back-btn svg {
    width: 20px;
    height: 20px;
    color: rgba(255, 255, 255, 0.9);
}

[data-theme="light"] .level-complete .back-btn {
    background: rgba(14, 18, 53, 0.06);
    border-color: rgba(14, 18, 53, 0.12);
}

[data-theme="light"] .level-complete .back-btn:hover {
    background: rgba(14, 18, 53, 0.12);
}

[data-theme="light"] .level-complete .back-btn svg {
    color: #0e1235;
}

.level-complete.elevated-panel {
    padding: 64px 72px;
    background: linear-gradient(135deg, rgba(14, 22, 53, 0.8), rgba(16, 28, 68, 0.92));
    box-shadow: 0 40px 80px rgba(8, 12, 34, 0.5);
    gap: 32px;
}

[data-theme="light"] .level-complete.elevated-panel {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.92), rgba(237, 241, 255, 0.98));
    box-shadow: 0 30px 60px rgba(131, 149, 213, 0.35);
}

/* Result hero section */
.result-hero {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 28px;
    align-items: center;
    width: 100%;
}

.result-hero__copy {
    text-align: left;
}

.result-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.15);
    font-size: 0.85rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

[data-theme="light"] .result-pill {
    background: rgba(14, 18, 53, 0.08);
    color: #0e1235;
}

.result-subtitle {
    color: var(--text-secondary);
    font-size: 1rem;
    margin: 0px;
}

.result-highlight {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.result-highlight__label {
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 0.12em;
    color: rgba(255, 255, 255, 0.65);
}

.result-highlight__value {
    display: block;
    font-size: clamp(2.8rem, 5vw, 3.6rem);
    font-weight: 800;
    line-height: 1.1;
}

[data-theme="light"] .result-highlight__label {
    color: rgba(14, 18, 53, 0.55);
}

/* Level stats grid */
.level-stats {
    width: 100%;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 18px;
    width: 100%;
}

.stat-card {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 18px;
    padding: 18px 20px;
    text-align: left;
    border: 1px solid rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(16px);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

[data-theme="light"] .stat-card {
    background: rgba(14, 18, 53, 0.04);
    border-color: rgba(14, 18, 53, 0.08);
}

.stat-label {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: rgba(255, 255, 255, 0.7);
}

[data-theme="light"] .stat-label {
    color: rgba(14, 18, 53, 0.65);
}

.stat-value {
    font-size: 1.6rem;
    font-weight: 700;
    color: #a5b4fc;
}

[data-theme="light"] .stat-value {
    color: #4c51bf;
}

.stat-value--muted {
    opacity: 0.45;
}

/* Result actions */
.result-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    width: 100%;
    flex-wrap: wrap;
}

.result-meta {
    padding: 10px 18px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    font-size: 0.95rem;
    letter-spacing: 0.04em;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

[data-theme="light"] .result-meta {
    background: rgba(14, 18, 53, 0.06);
    color: #0f1538;
}

.result-actions .button-group {
    margin-bottom: 0;
}

/* Game over specific */
.game-over h2 {
    color: var(--text-color);
    margin-bottom: 20px;
    font-size: 2em;
    position: relative;
    z-index: 5;
}

.level-complete h2 {
    font-size: 2.2em;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 0;
    margin-top: 0;
}

.game-over p, .level-complete p {
    margin-bottom: 5px;
    color: var(--text-secondary);
    font-size: 1.1em;
}

.final-stats {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin: 15px 0;
    padding: 25px 35px;
    background: rgba(102, 126, 234, 0.1);
    border-radius: 16px;
    backdrop-filter: blur(10px);
    min-width: 300px;
    position: relative;
    z-index: 5;
}

.final-stats p {
    margin: 0;
    font-size: 1.15em;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 30px;
}

.final-stats span {
    font-weight: 700;
    font-size: 1.5em;
    color: #667eea;
    letter-spacing: 0.5px;
}

[data-theme="dark"] .final-stats span {
    color: #a5b4fc;
}

/* Responsive mobile styles */
@media (max-width: 768px) {
    .level-complete .back-btn {
        top: 16px;
        left: 16px;
        width: 40px;
        height: 40px;
    }

    .level-complete.elevated-panel {
        padding: 56px 24px 32px;
        border-radius: 24px;
    }

    .result-hero {
        grid-template-columns: 1fr;
        gap: 20px;
        text-align: center;
    }

    .result-hero__copy {
        text-align: center;
    }

    .result-highlight {
        text-align: center;
    }

    .result-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .result-meta {
        width: 100%;
        justify-content: center;
        text-align: center;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
}
