.result-card { --result-correct: #45cc83; --result-correct-solid: #c8e6c9; --result-incorrect: #ef7777; --result-incorrect-solid: #f5cccc; max-width: 760px; margin: 24px auto; background: #fff; border: 1px solid #dbe4ef; border-radius: 22px; overflow: hidden; box-shadow: 0 14px 40px #15345714; text-align: center; }
.result-card .result-hero { background: linear-gradient(120deg, #102f50, #225582); color: #fff; padding: 28px 24px; }
.result-card .result-eyebrow { margin: 0 0 10px; color: #b9daf7; font-size: 11px; font-weight: 700; letter-spacing: 2px; text-transform: uppercase; }
.result-card .result-hero h1 { margin: 0 0 12px; font-size: clamp(24px, 4vw, 32px); color: #fff; }
.result-card .result-score { font-size: clamp(48px, 8vw, 64px); font-weight: 800; line-height: 1.1; margin: 12px 0; color: #fff; font-variant-numeric: tabular-nums; }
.result-card .result-status { display: inline-block; background: var(--result-correct-solid); color: #1b5e20; border: 2px solid var(--result-correct); padding: 10px 28px; border-radius: 32px; font-size: 18px; line-height: 1.2; font-weight: 900; letter-spacing: 1px; }
.result-card .result-status.fail { background: var(--result-incorrect-solid); color: #9b1c1c; border-color: var(--result-incorrect); }
.result-card .result-encouragement { margin: 16px 0 0; color: #e0edfa; font-size: 15px; }
.result-card .result-body { padding: 24px; }
.result-card .result-table { width: 100%; border-collapse: separate; border-spacing: 0; text-align: left; border: 1px solid #dce5ee; border-radius: 12px; overflow: hidden; }
.result-table caption { text-align: left; color: #223c58; font-weight: 700; padding: 0 0 12px; }
.result-table thead { background: #eaf0f7; color: #223c58; font-size: 15px; font-weight: 800; text-transform: uppercase; letter-spacing: .8px; }
.result-table th, .result-table td { padding: 13px 18px; border-bottom: 1px solid #fff; }
.result-table tbody th { font-size: 14px; font-weight: 600; }
.result-table td, .result-table thead th:last-child { text-align: right; font-variant-numeric: tabular-nums; }
.result-table tbody td { font-size: 18px; font-weight: 750; }
.result-card .result-table tbody > .result-correct { background: var(--result-correct-solid); color: #1b5e20; }
.result-card .result-table tbody > .result-incorrect { background: var(--result-incorrect-solid); color: #9b1c1c; }
.result-card .result-table tbody > .result-unanswered { background: #fff8e4; color: #7c5a16; }
.result-table tfoot { background: #edf2fa; color: #223c58; font-weight: 700; }
.result-card .result-note { font-size: 13px; color: #62738a; margin: 18px 0; line-height: 1.6; }
.result-card .result-actions { display: flex; justify-content: center; flex-wrap: wrap; gap: 12px; margin-top: 22px; }
.result-actions .button { margin: 0; }
.result-review { max-width: 960px; margin: 2px auto; border: 1px solid #dbe4ef; border-radius: 12px; background: white; color: #243b53; padding: 16px 20px; text-align: left; scroll-margin-top: 90px; }
.result-navigation { max-width: 960px; margin: 10px auto 0; }
main:has(.result-card) { margin-top: 0; margin-bottom: 0; }
main:has(.result-card) { padding-top: 0 !important; padding-bottom: 0 !important; }
.container:has(.result-card) { padding-top: 0 !important; padding-bottom: 0 !important; }
html body:has(.result-card) { padding-bottom: 0 !important; }
html body:has(.result-card) { overflow-y: hidden; }
html body:has(.result-card):has(.result-review[open]) { overflow-y: auto; }
.result-review > summary { cursor: pointer; font-weight: 700; color: #17456d; }
.review-question { margin-top: 14px; padding: 14px; background: #f6f8fb; border: 1px solid #dce5ee; border-radius: 8px; }
.review-question > summary { cursor: pointer; font-weight: 600; }
.review-status { display: inline-block; padding: 3px 9px; border-radius: 12px; background: #eaf0f7; color: #334e68; font-size: 12px; font-weight: 700; }
.review-status[data-outcome="correct"] { background: #e9f7ef; color: #1b6140; }
.review-status[data-outcome="incorrect"] { background: #fff0ed; color: #933e36; }
.review-status[data-outcome="unanswered"] { background: #f1f4f7; color: #455a64; }
.review-question p { margin: 10px 0; line-height: 1.5; }
.review-stem { font-weight: 600; }
.review-stem, .review-explanation { white-space: pre-wrap; }
.review-question { background: #f6f7fa; border: 1px solid #cdd2e4; border-radius: 0; padding: 16px; }
.review-question > summary { font-size: 14px; }
.review-question .review-stem { font-weight: 400; margin: 16px 0 22px; }
.review-answer-card { border: 1px solid #cdd2e4; background: white; padding: 18px 20px; margin: 12px 0; color: #536580; }
.review-answer-card.is-correct { background: #e8f5e9; border-color: #4caf50; color: #173e35; }
.review-answer-card.is-incorrect { background: #ffebee; border-color: #f44336; color: #722929; }
.review-answer-tag { display: inline-block; padding: 4px 8px; font-size: 11px; font-weight: 750; background: #a9dfc8; color: #164a37; margin-bottom: 12px; }
.is-incorrect .review-answer-tag { background: #ffc4bf; color: #8e2020; }
.review-answer-tag[hidden] { display: none; }
.review-question [hidden] { display: none !important; }
.review-answer-content { display: flex; align-items: flex-start; gap: 16px; line-height: 1.5; font-size: 14px; }
.review-answer-mark { flex: 0 0 18px; text-align: center; }
.review-feedback { border: 2px solid #f44336; border-radius: 9px; background: #ffebee; padding: 16px; margin-top: 24px; }
.review-feedback[data-outcome="correct"] { background: #e8f5e9; border-color: #4caf50; }
.review-feedback[data-outcome="unanswered"] { background: #f1f4f7; border-color: #9aa9b8; }
.review-feedback-status { display: inline-block; padding: 6px 12px; border-radius: 4px; background: #f44336; color: white; font-size: 12px; }
[data-outcome="correct"] > .review-feedback-status { background: #4caf50; }
[data-outcome="unanswered"] > .review-feedback-status { background: #607d8b; }
.review-explanation-panel { background: #f5f5f5; border: 1px solid #ddd; padding: 20px; border-radius: 9px; margin-top: 24px; }
.review-feedback[data-outcome="correct"] .review-explanation-panel { background: #e8f5e9; border-color: #4caf50; }
.review-feedback[data-outcome="incorrect"] .review-explanation-panel { background: #ffebee; border-color: #f44336; }
.review-explanation-panel h4 { color: #2e7d32; font-size: 14px; margin: 0 0 12px; }
.review-correct-explanation { background: #fff4f4; border-left: 4px solid #4caf50; border-radius: 4px; padding: 10px 14px; }
.review-feedback[data-outcome="correct"] .review-correct-explanation { background: #f1fbf2 !important; border-left-color: #4caf50 !important; }
.review-feedback[data-outcome="incorrect"] .review-correct-explanation { background: #fff4f4 !important; border-left-color: #4caf50 !important; }
.review-other-options { padding: 10px 14px; border-left: 4px solid #f44336; background: #fff4f4; border-radius: 4px; }
.review-feedback[data-outcome="correct"] .review-other-options { border-left-color: #f44336 !important; background: #f1fbf2 !important; }
.review-feedback[data-outcome="incorrect"] .review-other-options { border-left-color: #f44336 !important; background: #fff4f4 !important; }
.review-feedback[data-outcome="unanswered"] .review-explanation-panel,
.review-feedback[data-outcome="unanswered"] .review-correct-explanation,
.review-feedback[data-outcome="unanswered"] .review-other-options { background: #f1f4f7 !important; border-color: #9aa9b8 !important; }
.review-feedback[data-outcome="unanswered"] .review-correct-explanation,
.review-feedback[data-outcome="unanswered"] .review-other-options { border-left-color: #9aa9b8 !important; }
.review-explanation-panel .review-other-heading { color: #a33c38; margin-top: 20px; }
[data-review="other-options"] { background: #fff4f4; border-left: 4px solid #f44336; border-radius: 4px; padding: 10px 14px; }
.review-other-option { padding: 0; margin: 0 0 16px; }
.review-other-option:last-child { margin-bottom: 0; }
.result-card .result-donut { --correct-pct: 0; --incorrect-pct: 0; --result-donut-size: clamp(142px, 18vw, 190px); width: var(--result-donut-size); height: var(--result-donut-size); min-height: var(--result-donut-size); flex-shrink: 0; aspect-ratio: 1; border-radius: 50%; margin: 12px auto; padding: 16px; box-sizing: border-box; background: conic-gradient(var(--result-correct-solid) 0% calc(var(--correct-pct) * 1%), var(--result-incorrect-solid) calc(var(--correct-pct) * 1%) calc((var(--correct-pct) + var(--incorrect-pct)) * 1%), #a9b8cd calc((var(--correct-pct) + var(--incorrect-pct)) * 1%) 100%); }
.result-donut-center { width: 100%; height: 100%; background: #163d61; border-radius: 50%; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.result-card .result-donut .result-score { font-size: 42px; margin: 0; }
.result-donut-center > span { font-size: 12px; color: #d4e4f4; }
.result-legend { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin: 0 0 14px; font-size: 10px; color: #e0edfa; }
.result-legend span { display: inline-flex; align-items: center; gap: 4px; }
.result-legend i { width: 8px; height: 8px; border-radius: 2px; }
.legend-correct { background: var(--result-correct-solid); } .legend-incorrect { background: var(--result-incorrect-solid); } .legend-unanswered { background: #a9b8cd; }
@media (min-width: 700px) {
    .result-card { display: grid; grid-template-columns: minmax(220px, .85fr) minmax(320px, 1.4fr); max-width: 960px; margin: 0 auto; }
    .result-card .result-hero { display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 24px 20px; }
    .result-card .result-body { padding: 20px; }
    .result-card .result-score { font-size: 56px; margin: 10px 0; }
    .result-card .result-hero h1 { font-size: 26px; }
    .result-card .result-encouragement { font-size: 14px; line-height: 1.45; }
    .result-card .result-actions { margin-top: 16px; gap: 8px; }
    .result-card .result-actions .button { padding: 10px 14px; font-size: 14px; }
    main:has(> .result-card) { margin: 0 auto; padding: 4px 12px; }
    .result-card .result-note { margin: 8px 0; }
}
@media (max-height: 800px) {
    .result-card .result-hero { padding: 16px; }
    .result-card .result-body { padding: 16px; }
    .result-table th, .result-table td { padding: 9px 14px; }
    .result-card .result-score { font-size: 46px; }
    .result-card .result-donut { --result-donut-size: 142px; margin: 8px auto; padding: 12px; }
    .result-card .result-donut .result-score { font-size: 36px; }
    .result-card .result-eyebrow { margin-bottom: 6px; }
    .result-card .result-encouragement { margin-top: 10px; }
}
@media (min-height: 801px) and (max-height: 950px) {
    .result-card .result-hero { padding: 18px 16px; }
    .result-card .result-body { padding: 14px 16px; }
    .result-card .result-score { font-size: 50px; margin: 6px 0; }
    .result-card .result-donut { --result-donut-size: 150px; margin: 6px auto; padding: 12px; }
    .result-card .result-donut .result-score { font-size: 38px; }
    .result-card .result-eyebrow { margin-bottom: 5px; }
    .result-card .result-status { padding: 8px 22px; }
    .result-card .result-encouragement { margin-top: 8px; }
    .result-table th, .result-table td { padding: 8px 12px; }
    .result-card .result-note { margin: 8px 0; }
    .result-card .result-actions { margin-top: 10px; }
}
.quiz-celebration { position: fixed; inset: 0; z-index: 3000; pointer-events: none; display: grid; place-items: center; overflow: hidden; }
.quiz-celebration strong { position: relative; z-index: 1; padding: 16px 26px; border-radius: 16px; color: #fff; background: #124e3eef; font: 800 clamp(24px, 5vw, 44px) system-ui, sans-serif; box-shadow: 0 8px 35px #0003; animation: quiz-badge 3.8s both; }
.quiz-spark { position: absolute; left: 50%; top: 45%; width: 8px; height: 12px; border-radius: 2px; animation: quiz-spark 2.2s ease-out both; }
@keyframes quiz-spark { from { transform: translate(0, 0) rotate(0); opacity: 1; } to { transform: translate(var(--x), var(--y)) rotate(540deg); opacity: 0; } }
@keyframes quiz-badge { 0%, 100% { opacity: 0; transform: scale(.9); } 15%, 80% { opacity: 1; transform: scale(1); } }
.result-animated .result-status { animation: result-pill-pop 1.4s ease-out, result-pill-glow 3s ease-in-out 1.4s 2; }
.result-animated .result-status.fail { animation: result-pill-pop 1.4s ease-out, result-pill-red 3s ease-in-out 1.4s 1; }
.result-screen-pass { background: radial-gradient(ellipse at center, transparent 45%, #2aae701a); }
.result-screen-fail { background: radial-gradient(ellipse at center, transparent 35%, #bd363624); animation: result-screen-glow 3.8s ease-out both; }
.result-screen-fail strong { background: #fff1f2f5; color: #b91c1c; font-size: clamp(20px, 4vw, 32px); font-weight: 900; border: 0; border-radius: 0; padding: 24px 36px; filter: drop-shadow(0 5px 6px #772f3533); clip-path: polygon(0 0, 42% 0, 45% 13%, 48% 0, 100% 0, 100% 38%, 96% 46%, 100% 52%, 100% 100%, 61% 100%, 58% 86%, 55% 100%, 0 100%, 0 64%, 4% 57%, 0 49%); animation-duration: 7s; }
.result-screen-fail strong::after { content: ''; position: absolute; inset: 8px; border: 2px dashed #d4777f; pointer-events: none; clip-path: polygon(0 0, 40% 0, 40% 15%, 51% 15%, 51% 0, 100% 0, 100% 100%, 63% 100%, 63% 85%, 52% 85%, 52% 100%, 0 100%); }
.result-card:has(.result-status.fail) .result-encouragement { background: var(--result-incorrect-solid); color: #9b1c1c; padding: 8px 12px; border-radius: 6px; font-weight: 800; }
.quiz-sorry-particle { position: absolute; top: -12px; width: 5px; height: 9px; border-radius: 50%; opacity: 0; animation: result-sorry-fall 3s ease-in both; }
@keyframes result-sorry-fall { 0% { opacity: 0; transform: translate(0, 0) rotate(-15deg); } 20% { opacity: .7; } 100% { opacity: 0; transform: translate(var(--drift), 65vh) rotate(30deg); } }
@keyframes result-pill-pop { from { transform: scale(.8); opacity: .4; } 65% { transform: scale(1.08); } to { transform: scale(1); opacity: 1; } }
@keyframes result-pill-glow { 50% { box-shadow: 0 0 0 8px #45b87522, 0 0 28px #45b87577; } }
@keyframes result-pill-red { 50% { box-shadow: 0 0 0 7px #ef777722, 0 0 24px #ef777766; } }
@keyframes result-screen-glow { 0%, 100% { opacity: 0; } 30%, 70% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .quiz-celebration { display: none; } .result-animated .result-status { animation: none !important; } }
@media(max-width: 480px) { .result-card { margin: 12px auto; border-radius: 16px; } .result-card .result-body { padding: 16px; } .result-table th, .result-table td { padding: 12px; } .result-actions .button { width: 100%; } }

/* An expanded review breaks out of its container to the full viewport width (the collapsed
   panel keeps matching the score card); on phones nested padding is also trimmed so
   explanations wrap onto fewer lines. */
.result-review[open] { --review-gutter: 8px; --review-width: calc(100vw - 2 * var(--review-gutter)); max-width: none; width: var(--review-width); margin-left: calc(50% - var(--review-width) / 2); margin-right: 0; }
@media (min-width: 601px) { .result-review[open] { --review-gutter: 16px; } }
/* Desktop: widen only halfway between the 960px score-card width and the full viewport. */
@media (min-width: 1001px) { .result-review[open] { --review-width: calc((960px + 100vw - 2 * var(--review-gutter)) / 2); } }
/* The results screen zeroes the body's footer clearance; restore it while the review is open
   so the end of the panel can scroll clear of the fixed footer. */
html body:has(.result-card):has(.result-review[open]) { padding-bottom: calc(var(--site-footer-height, 65px) + var(--cookie-banner-height, 0px) + 16px) !important; }
@media (max-width: 600px) {
    .result-review[open] { padding: 12px 8px; }
    .result-review[open] > summary { padding: 0 6px; }
    .result-review[open] .review-question { padding: 10px 8px; }
    .result-review[open] .review-answer-card { padding: 12px 10px; }
    .result-review[open] .review-answer-content { gap: 10px; }
    .result-review[open] .review-feedback { padding: 10px 8px; margin-top: 16px; }
    .result-review[open] .review-explanation-panel { padding: 10px 8px; margin-top: 14px; }
    .result-review[open] .review-correct-explanation,
    .result-review[open] .review-other-options,
    .result-review[open] [data-review="other-options"] { padding: 8px 10px; }
}

.review-answer-card.is-neutral { background: white; border-color: #cdd2e4; color: #536580; }
.is-neutral .review-answer-tag { background: #eaf0f7; color: #334e68; }
.is-incorrect .review-answer-tag { font-style: italic; font-weight: 400; }
.review-feedback[data-outcome="unanswered"] h4 { color: #607d8b; }

/* The result owns every explanation background; left bars retain option meaning. */
.review-feedback { --review-background: #ffebee; }
.review-feedback[data-outcome="correct"] { --review-background: #e8f5e9; }
.review-feedback[data-outcome="unanswered"] { --review-background: #f1f4f7; }
.review-feedback .review-explanation-panel,
.review-feedback .review-correct-explanation,
.review-feedback .review-other-options { background: var(--review-background) !important; }

/* Score review filter: chips with counts, compact one-line question previews. */
.review-filter { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 4px; }
.review-filter[hidden] { display: none; }
.review-chip { font: inherit; font-size: 13px; font-weight: 600; min-height: 36px; padding: 6px 14px; border: 1px solid #bdd5ec; border-radius: 999px; background: #fff; color: #17456d; cursor: pointer; }
.review-chip:hover { background: #eef5fb; }
.review-chip[aria-pressed="true"] { background: #17456d; border-color: #17456d; color: #fff; }
.review-chip:focus-visible { outline: 2px solid #1976d2; outline-offset: 2px; }
.review-question[hidden] { display: none; }
.review-snippet { display: block; margin-top: 4px; font-size: 13px; font-weight: 400; color: #52667a; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.review-question[open] > summary .review-snippet { display: none; }
.result-card .result-share { margin: 22px 0 0; padding: 16px 18px; border: 1px solid #cfe6d6; border-left: 4px solid #2e7d32; border-radius: 8px; background: #f1fbf2; text-align: left; }
.result-card .result-share[hidden] { display: none; }
.result-card .result-share h2 { font-size: 16px; margin: 0 0 8px; color: #1b5e20; }
.result-card .result-share-text { font-size: 14px; line-height: 1.5; margin: 0 0 12px; color: #1f3347; user-select: all; }
.result-card .result-share-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.result-card .result-share-actions .button { margin: 0; }
.result-card .result-share-or { font-size: 13px; color: #536580; }
.result-card .result-share-icon { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border: 1px solid #b9d3c0; border-radius: 50%; background: #fff; color: #1f3347; }
.result-card .result-share-icon:hover, .result-card .result-share-icon:focus-visible { background: #1f3347; color: #fff; outline: none; }
.result-card .result-share-icon:focus-visible { outline: 2px solid #2e7d32; outline-offset: 2px; }
.result-card .result-share-icon svg { width: 20px; height: 20px; fill: currentColor; }
.result-card .result-share-status { font-size: 13px; margin: 10px 0 0; color: #1b5e20; min-height: 1em; }
