/* ==========================================================
   TypingTutor.Online
   Lesson Results Screen
========================================================== */

.results-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 20px;

    background-color: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(5px);
}

.results-modal.hidden {
    display: none;
}

.results-card {
    width: 100%;
    max-width: 560px;

    padding: 36px;

    background-color: #ffffff;
    border-radius: 20px;

    text-align: center;

    box-shadow:
        0 30px 80px rgba(15, 23, 42, 0.3);

    animation: resultsCardOpen 0.25s ease;
}

.results-icon {
    margin-bottom: 10px;
    font-size: 52px;
}

.results-card h2 {
    margin: 0 0 10px;

    font-size: 32px;
    color: #0f172a;
}

.results-message {
    margin: 0 0 28px;

    font-size: 16px;
    color: #64748b;
}

.results-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;

    margin-bottom: 24px;
}

.result-item {
    padding: 20px;

    background-color: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
}

.result-label {
    display: block;

    margin-bottom: 8px;

    font-size: 14px;
    font-weight: 700;

    color: #64748b;
}

.result-value {
    display: block;

    font-size: 28px;
    font-weight: 800;

    color: #2563eb;
}

.result-grade {
    margin-bottom: 26px;

    font-size: 18px;
    color: #475569;
}

#resultGrade {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    min-width: 44px;
    height: 44px;

    margin-left: 8px;

    background-color: #dcfce7;
    border-radius: 50%;

    font-size: 21px;
    color: #15803d;
}

.results-actions {
    display: flex;
    justify-content: center;
    gap: 12px;
}

.result-button {
    min-width: 160px;

    padding: 13px 20px;

    border: 0;
    border-radius: 10px;

    font-size: 15px;
    font-weight: 700;

    cursor: pointer;

    transition:
        transform 0.15s ease,
        box-shadow 0.15s ease;
}

.result-button:hover {
    transform: translateY(-2px);
}

.primary-button {
    background-color: #2563eb;
    color: #ffffff;

    box-shadow:
        0 8px 20px rgba(37, 99, 235, 0.25);
}

.secondary-button {
    background-color: #e2e8f0;
    color: #0f172a;
}

@keyframes resultsCardOpen {

    from {
        opacity: 0;
        transform: translateY(16px) scale(0.97);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }

}

@media (max-width: 600px) {

    .results-card {
        padding: 26px 20px;
    }

    .results-grid {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    .result-item {
        padding: 15px 10px;
    }

    .result-value {
        font-size: 23px;
    }

    .results-actions {
        flex-direction: column;
    }

    .result-button {
        width: 100%;
    }

}

/* ==========================================================
   KEYBOARD-ACTIVE COMPLETION SCREEN v3.4
========================================================== */

.results-actions {
    position: relative;
}

.result-button:focus-visible {
    outline: 4px solid rgba(37, 99, 235, 0.22);
    outline-offset: 3px;
    transform: translateY(-2px);
}

.results-card::after {
    content:
        "Keyboard: ← → choose   •   Enter select   •   R retry   •   N next";

    display: block;

    margin-top: 18px;

    color: #64748b;

    font-size: 12px;
    font-weight: 600;
}

@media (max-width: 600px) {

    .results-card::after {
        content:
            "Enter select • R retry • N next";

        font-size: 11px;
    }

}


/* ==========================================================
   PERFORMANCE ADVICE v5.4
========================================================== */

#resultAdvice {
    max-width: 520px;
    margin-inline: auto;
    padding: 10px 14px;

    border: 1px solid transparent;
    border-radius: 10px;

    font-size: 13px;
    font-weight: 600;
    line-height: 1.5;
}

#resultAdvice[data-level="excellent"] {
    color: #166534;
    background: #f0fdf4;
    border-color: #bbf7d0;
}

#resultAdvice[data-level="good"] {
    color: #1d4ed8;
    background: #eff6ff;
    border-color: #bfdbfe;
}

#resultAdvice[data-level="practice"] {
    color: #9a3412;
    background: #fff7ed;
    border-color: #fed7aa;
}

#resultAdvice[data-level="retry"] {
    color: #991b1b;
    background: #fef2f2;
    border-color: #fecaca;
}

html[data-theme="dark"] #resultAdvice[data-level="excellent"] {
    color: #bbf7d0;
    background: rgba(22, 101, 52, .22);
    border-color: #166534;
}

html[data-theme="dark"] #resultAdvice[data-level="good"] {
    color: #bfdbfe;
    background: rgba(29, 78, 216, .20);
    border-color: #1d4ed8;
}

html[data-theme="dark"] #resultAdvice[data-level="practice"] {
    color: #fed7aa;
    background: rgba(154, 52, 18, .22);
    border-color: #9a3412;
}

html[data-theme="dark"] #resultAdvice[data-level="retry"] {
    color: #fecaca;
    background: rgba(153, 27, 27, .22);
    border-color: #991b1b;
}

@media (prefers-color-scheme: dark) {

    html[data-theme="system"] #resultAdvice[data-level="excellent"] {
        color: #bbf7d0;
        background: rgba(22, 101, 52, .22);
        border-color: #166534;
    }

    html[data-theme="system"] #resultAdvice[data-level="good"] {
        color: #bfdbfe;
        background: rgba(29, 78, 216, .20);
        border-color: #1d4ed8;
    }

    html[data-theme="system"] #resultAdvice[data-level="practice"] {
        color: #fed7aa;
        background: rgba(154, 52, 18, .22);
        border-color: #9a3412;
    }

    html[data-theme="system"] #resultAdvice[data-level="retry"] {
        color: #fecaca;
        background: rgba(153, 27, 27, .22);
        border-color: #991b1b;
    }

}


/* ==========================================================
   10-MINUTE LESSON PRACTICE v6.3
========================================================== */

.result-practice-status {
    margin: 0 0 20px;
    padding: 13px 15px;

    text-align: left;

    background: #f8fafc;
    border: 1px solid #dbe4f0;
    border-radius: 12px;
}

.result-practice-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;

    margin-bottom: 8px;
}

.result-practice-heading strong {
    color: #0f172a;
    font-size: 13px;
}

#resultPracticeTime {
    color: #2563eb;
    font-size: 13px;
    font-weight: 800;
}

.result-practice-track {
    overflow: hidden;

    height: 9px;
    margin-bottom: 8px;

    background: #e2e8f0;
    border-radius: 999px;
}

#resultPracticeFill {
    display: block;

    width: 0;
    height: 100%;

    background:
        linear-gradient(
            90deg,
            #2563eb,
            #22c55e
        );

    border-radius: inherit;

    transition: width .3s ease;
}

#resultPracticeNote {
    display: block;

    color: #64748b;
    font-size: 11px;
    line-height: 1.45;
}

.result-button[hidden] {
    display: none !important;
}

.results-actions .primary-button {
    min-width: 220px;
}

html[data-theme="dark"] .result-practice-status {
    background: #172033;
    border-color: #334155;
}

html[data-theme="dark"] .result-practice-heading strong {
    color: #f8fafc;
}

html[data-theme="dark"] .result-practice-track {
    background: #2b394d;
}

html[data-theme="dark"] #resultPracticeNote {
    color: #cbd5e1;
}

@media (prefers-color-scheme: dark) {

    html[data-theme="system"] .result-practice-status {
        background: #172033;
        border-color: #334155;
    }

    html[data-theme="system"] .result-practice-heading strong {
        color: #f8fafc;
    }

    html[data-theme="system"] .result-practice-track {
        background: #2b394d;
    }

    html[data-theme="system"] #resultPracticeNote {
        color: #cbd5e1;
    }

}

@media (max-width: 600px) {

    .result-practice-heading {
        align-items: flex-start;
        flex-direction: column;
        gap: 4px;
    }

    .results-actions .primary-button {
        min-width: 0;
    }

}
