.p2-quiz-result-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1090;
    display: grid;
    place-items: center;
    padding: 20px;
    background: rgba(5, 22, 34, 0.58);
    opacity: 0;
    visibility: hidden;
    transition: opacity 180ms ease, visibility 180ms ease;
}

.p2-quiz-result-backdrop.is-visible {
    opacity: 1;
    visibility: visible;
}

.p2-quiz-result-dialog {
    position: relative;
    width: min(92vw, 420px);
    padding: 28px 24px 24px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.7);
    border-radius: 24px;
    background: #fff;
    box-shadow: 0 24px 70px rgba(3, 20, 32, 0.3);
    color: #102a3a;
    text-align: center;
    transform: translateY(18px) scale(0.92);
    transition: transform 260ms cubic-bezier(.2, .85, .3, 1.25);
}

.p2-quiz-result-backdrop.is-visible .p2-quiz-result-dialog {
    transform: translateY(0) scale(1);
}

.p2-quiz-result-close {
    position: absolute;
    top: 10px;
    right: 12px;
    display: grid;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    place-items: center;
    background: #eef3f7;
    color: #3b5362;
    font-size: 1.35rem;
    cursor: pointer;
}

.p2-quiz-result-student {
    display: inline-grid;
    width: 92px;
    height: 92px;
    margin-bottom: 10px;
    border-radius: 50%;
    place-items: center;
    background: var(--p2-result-soft, #e9f2ff);
    font-size: 3.5rem;
    line-height: 1;
    transform-origin: 50% 100%;
    animation: p2-student-pop 650ms cubic-bezier(.2, .85, .3, 1.25);
}

.p2-quiz-result-title {
    margin: 0 0 6px;
    color: var(--p2-result-color, #1769e0);
    font-size: clamp(1.45rem, 5vw, 1.9rem);
    font-weight: 800;
}

.p2-quiz-result-score {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
}

.p2-quiz-result-percent {
    display: block;
    margin: 6px 0;
    color: var(--p2-result-color, #1769e0);
    font-size: clamp(2.2rem, 10vw, 3.4rem);
    font-weight: 900;
    line-height: 1;
}

.p2-quiz-result-message,
.p2-quiz-result-save {
    margin: 8px 0 0;
}

.p2-quiz-result-save {
    min-height: 1.5em;
    color: #617786;
    font-size: 0.88rem;
}

.p2-quiz-result-actions {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 20px;
}

.p2-quiz-result-button {
    min-height: 44px;
    padding: 9px 18px;
    border: 0;
    border-radius: 999px;
    background: var(--p2-result-color, #1769e0);
    color: #fff;
    font-weight: 800;
    cursor: pointer;
}

.p2-quiz-result-button.is-secondary {
    border: 1px solid #cdd9e1;
    background: #fff;
    color: #2e4655;
}

.p2-quiz-result-dialog[data-level="sad"] {
    --p2-result-color: #64748b;
    --p2-result-soft: #eef2f6;
}

.p2-quiz-result-dialog[data-level="almost"] {
    --p2-result-color: #d97706;
    --p2-result-soft: #fff3d6;
}

.p2-quiz-result-dialog[data-level="happy"] {
    --p2-result-color: #16834b;
    --p2-result-soft: #dcf7e8;
}

.p2-quiz-result-dialog[data-level="excellent"] {
    --p2-result-color: #7c3aed;
    --p2-result-soft: #eee5ff;
}

.p2-quiz-confetti {
    position: absolute;
    top: -14px;
    width: 9px;
    height: 18px;
    border-radius: 3px;
    background: var(--confetti-color);
    animation: p2-confetti-fall 1.25s ease-in forwards;
}

@keyframes p2-student-pop {
    0% { transform: translateY(28px) scale(0.45); opacity: 0; }
    58% { transform: translateY(-8px) scale(1.08); opacity: 1; }
    78% { transform: translateY(3px) scale(0.97); }
    100% { transform: translateY(0) scale(1); opacity: 1; }
}

@keyframes p2-confetti-fall {
    0% { transform: translate3d(0, -10px, 0) rotate(0); opacity: 1; }
    100% { transform: translate3d(var(--confetti-x), 440px, 0) rotate(620deg); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
    .p2-quiz-result-backdrop,
    .p2-quiz-result-dialog,
    .p2-quiz-result-student,
    .p2-quiz-confetti,
    .p2-quiz-progress-fill,
    .p2-quiz-progress-student {
        animation: none !important;
        transition: none !important;
    }
}

@media print {
    .p2-quiz-result-backdrop,
    .p2-quiz-progress-card {
        display: none !important;
    }
}

@media (max-width: 575.98px) {
    .p2-quiz-progress-card {
        padding: 15px;
    }

    .p2-quiz-progress-heading {
        align-items: center;
    }

    .p2-quiz-progress-scale span:nth-child(2) {
        display: none;
    }
}
.p2-quiz-progress-card {
    --p2-progress: 0%;
    --p2-progress-color: #64748b;
    margin: 18px 0 22px;
    padding: 18px;
    border: 1px solid #dbe5ec;
    border-radius: 18px;
    background: linear-gradient(135deg, #f8fbfd, #fff);
    box-shadow: 0 8px 24px rgba(17, 47, 65, 0.07);
}

.p2-quiz-progress-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.p2-quiz-progress-eyebrow,
.p2-quiz-progress-name {
    display: block;
}

.p2-quiz-progress-eyebrow {
    color: #607482;
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.04em;
}

.p2-quiz-progress-name {
    margin-top: 2px;
    color: #173244;
    font-size: 1.05rem;
}

.p2-quiz-progress-badge {
    padding: 6px 11px;
    border-radius: 999px;
    background: #eef2f6;
    color: var(--p2-progress-color);
    font-size: 0.8rem;
    font-weight: 800;
    white-space: nowrap;
}

.p2-quiz-progress-track-wrap {
    margin-top: 28px;
}

.p2-quiz-progress-track {
    position: relative;
    height: 13px;
    border-radius: 999px;
    background:
        linear-gradient(90deg,
            transparent 39.5%, rgba(31, 54, 67, .18) 40%, transparent 40.5%,
            transparent 59.5%, rgba(31, 54, 67, .18) 60%, transparent 60.5%,
            transparent 84.5%, rgba(31, 54, 67, .18) 85%, transparent 85.5%),
        #e6edf2;
}

.p2-quiz-progress-fill {
    position: absolute;
    inset: 0 auto 0 0;
    width: var(--p2-progress);
    border-radius: inherit;
    background: linear-gradient(90deg, #74a9ff, var(--p2-progress-color));
    transition: width 850ms cubic-bezier(.2, .8, .3, 1);
}

.p2-quiz-progress-student {
    position: absolute;
    left: var(--p2-progress);
    bottom: 3px;
    display: grid;
    width: 42px;
    height: 42px;
    border: 3px solid #fff;
    border-radius: 50%;
    place-items: center;
    background: #edf4ff;
    box-shadow: 0 5px 14px rgba(20, 52, 72, .18);
    font-size: 1.4rem;
    transform: translateX(-50%);
    transition: left 850ms cubic-bezier(.2, .8, .3, 1);
}

.p2-quiz-progress-card.is-updating .p2-quiz-progress-student {
    animation: p2-progress-hop 650ms ease;
}

.p2-quiz-progress-scale {
    display: flex;
    justify-content: space-between;
    gap: 4px;
    margin-top: 9px;
    color: #758894;
    font-size: 0.66rem;
}

.p2-quiz-progress-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-top: 15px;
}

.p2-quiz-progress-stats > div {
    padding: 9px;
    border-radius: 12px;
    background: #fff;
    text-align: center;
}

.p2-quiz-progress-stats span,
.p2-quiz-progress-stats strong {
    display: block;
}

.p2-quiz-progress-stats span {
    color: #71838e;
    font-size: 0.72rem;
}

.p2-quiz-progress-stats strong {
    margin-top: 2px;
    color: #19384a;
}

.p2-quiz-progress-note {
    margin: 12px 0 0;
    color: #607482;
    font-size: 0.84rem;
    text-align: center;
}

.p2-quiz-progress-card[data-level="almost"] {
    --p2-progress-color: #d97706;
}

.p2-quiz-progress-card[data-level="happy"] {
    --p2-progress-color: #16834b;
}

.p2-quiz-progress-card[data-level="excellent"] {
    --p2-progress-color: #7c3aed;
}

.p2-quiz-progress-card[data-state="guest"] {
    opacity: 0.84;
}

@keyframes p2-progress-hop {
    0%, 100% { transform: translateX(-50%) translateY(0) rotate(0); }
    35% { transform: translateX(-50%) translateY(-12px) rotate(-7deg); }
    65% { transform: translateX(-50%) translateY(-5px) rotate(7deg); }
}
