/* =======================================================
   QUIZ PAGE RESET
======================================================= */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --quiz-green: #1e7e34;
    --quiz-green-dark: #17672a;
    --quiz-green-light: #eaf7ee;

    --quiz-surface: #ffffff;
    --quiz-background: #f3f6f4;

    --quiz-text: #171917;
    --quiz-muted: #66706a;

    --quiz-border: #dde6df;
    --quiz-border-dark: #c9d6cc;

    --quiz-correct: #18864b;
    --quiz-correct-soft: #e9f8ef;

    --quiz-incorrect: #c53838;
    --quiz-incorrect-soft: #fff0f0;

    --quiz-radius-large: 24px;
    --quiz-radius-medium: 16px;
    --quiz-radius-small: 11px;

    --quiz-shadow:
        0 12px 34px rgba(22, 58, 31, 0.09);
}

body {
    min-height: 100vh;

    background: var(--quiz-background);
    color: var(--quiz-text);

    font-family:
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;
}

/* =======================================================
   PAGE LAYOUT
======================================================= */

.quiz-page {
    width: 100%;
    min-height: 100vh;

    padding: 28px;
}

.quiz-shell {
    width: 100%;
    max-width: 1180px;

    margin: 0 auto;
}

/* =======================================================
   BRANDED QUIZ BANNER
======================================================= */

.quiz-header {
    position: relative;
    overflow: hidden;

    min-height: 170px;
    margin-bottom: 24px;
    padding: 30px 34px;

    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 30px;

    color: white;

    background:
        radial-gradient(
            circle at 85% 20%,
            rgba(255, 255, 255, 0.2),
            transparent 28%
        ),
        linear-gradient(
            135deg,
            #17672a 0%,
            #21883f 52%,
            #48b96d 100%
        );

    border-radius: var(--quiz-radius-large);

    box-shadow:
        0 14px 34px rgba(30, 126, 52, 0.18);
}

.quiz-header::after {
    content: "📝";

    position: absolute;
    right: 22%;
    bottom: -76px;

    font-size: 180px;
    line-height: 1;

    opacity: 0.08;

    transform: rotate(-13deg);

    pointer-events: none;
}

.quiz-header-main {
    position: relative;
    z-index: 1;

    display: flex;
    align-items: center;
    gap: 22px;

    min-width: 0;
}

.quiz-header-icon {
    flex: 0 0 auto;

    width: 84px;
    height: 84px;

    display: grid;
    place-items: center;

    background: white;

    border: 5px solid rgba(255, 255, 255, 0.35);
    border-radius: 50%;

    font-size: 39px;

    box-shadow:
        0 10px 26px rgba(0, 0, 0, 0.15);
}

.quiz-header-copy {
    min-width: 0;
}

.quiz-eyebrow {
    margin: 0 0 7px;

    color: rgba(255, 255, 255, 0.8);

    font-size: 13px;
    font-weight: 850;

    text-transform: uppercase;
    letter-spacing: 0.11em;
}

.quiz-header h1 {
    margin: 0 0 8px;

    color: white;

    font-size: clamp(29px, 4vw, 43px);
    line-height: 1.08;
}

.quiz-meta {
    margin: 0;

    color: rgba(255, 255, 255, 0.9);

    font-size: 15px;
    font-weight: 650;
    line-height: 1.5;
}

.quiz-header-stat {
    position: relative;
    z-index: 1;

    flex: 0 0 auto;

    min-width: 122px;
    padding: 18px 20px;

    background: rgba(255, 255, 255, 0.14);

    border: 1px solid rgba(255, 255, 255, 0.24);
    border-radius: 16px;

    text-align: center;

    backdrop-filter: blur(8px);
}

.quiz-header-stat strong {
    display: block;

    color: white;

    font-size: 28px;
    line-height: 1;
}

.quiz-header-stat span {
    display: block;

    margin-top: 7px;

    color: rgba(255, 255, 255, 0.84);

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

/* =======================================================
   QUIZ PROGRESS
======================================================= */

.quiz-progress-panel {
    margin-bottom: 22px;
    padding: 18px 22px;

    background: white;

    border: 1px solid var(--quiz-border);
    border-radius: var(--quiz-radius-medium);

    box-shadow:
        0 5px 16px rgba(0, 0, 0, 0.045);
}

.quiz-progress-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 18px;

    margin-bottom: 12px;
}

.quiz-progress {
    margin: 0;

    color: var(--quiz-green);

    font-size: 15px;
    font-weight: 850;
}

.quiz-timer {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    min-width: 82px;
    padding: 7px 12px;

    background: var(--quiz-green-light);
    color: var(--quiz-green);

    border-radius: 999px;

    font-size: 14px;
    font-weight: 850;
}

.quiz-timer::before {
    content: "⏱";
    margin-right: 6px;
}

.progress-bar {
    width: 100%;
    height: 10px;

    overflow: hidden;

    background: #e7ece8;

    border-radius: 999px;
}

.progress {
    height: 100%;

    background:
        linear-gradient(
            90deg,
            #1e7e34,
            #47b972
        );

    border-radius: 999px;

    transition: width 0.3s ease;
}

.timer-warning {
    background: #fff5d9;
    color: #9a6700;
}

.timer-danger {
    background: #fff0f0;
    color: var(--quiz-incorrect);

    animation: timerPulse 0.8s infinite alternate;
}

@keyframes timerPulse {
    from {
        transform: scale(1);
    }

    to {
        transform: scale(1.04);
    }
}

/* =======================================================
   QUESTION CARD
======================================================= */

.quiz-question-card {
    padding: 30px 32px;

    background: var(--quiz-surface);

    border: 1px solid var(--quiz-border);
    border-radius: var(--quiz-radius-large);

    box-shadow: var(--quiz-shadow);
}

.quiz-question-wrap {
    transition:
        background-color 0.25s ease,
        border-color 0.25s ease;
}

.quiz-question {
    margin-bottom: 22px;

    color: var(--quiz-text);

    font-size: clamp(21px, 2.2vw, 29px);
    font-weight: 700;
    line-height: 1.42;
}

/* =======================================================
   QUESTION IMAGE
======================================================= */

.quiz-image-wrap {
    margin: 22px 0 28px;
    padding: 18px;

    background: #f8faf8;

    border: 1px solid var(--quiz-border);
    border-radius: var(--quiz-radius-medium);

    text-align: center;
}

.quiz-question-image {
    display: block;

    width: auto;
    max-width: 100%;
    max-height: 480px;

    margin: 0 auto;

    background: white;

    border-radius: 10px;

    object-fit: contain;
}

/* =======================================================
   DATA TABLE
======================================================= */

.quiz-data-table {
    width: 100%;

    margin: 24px 0 28px;

    overflow: hidden;

    background: white;

    border-collapse: separate;
    border-spacing: 0;

    border: 1px solid var(--quiz-border);
    border-radius: 14px;
}

.quiz-data-table th,
.quiz-data-table td {
    padding: 13px 15px;

    border-right: 1px solid var(--quiz-border);
    border-bottom: 1px solid var(--quiz-border);

    text-align: center;
}

.quiz-data-table th:last-child,
.quiz-data-table td:last-child {
    border-right: none;
}

.quiz-data-table tbody tr:last-child td {
    border-bottom: none;
}

.quiz-data-table th {
    background: #edf6ef;
    color: #194f29;

    font-size: 14px;
    font-weight: 800;
}

.quiz-data-table td {
    color: #3d433f;

    font-size: 14px;
}

/* =======================================================
   ANSWER OPTIONS
======================================================= */

.quiz-options {
    display: flex;
    flex-direction: column;
    gap: 13px;

    margin: 26px 0 22px;
}

.quiz-option-btn {
    width: 100%;
    min-height: 66px;

    display: grid;
    grid-template-columns: 42px minmax(0, 1fr);
    align-items: center;
    gap: 14px;

    padding: 11px 18px;

    background: white;
    color: var(--quiz-text);

    border: 2px solid var(--quiz-border);
    border-radius: 14px;

    font: inherit;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.45;

    text-align: left;

    cursor: pointer;

    transition:
        transform 0.18s ease,
        border-color 0.18s ease,
        background-color 0.18s ease,
        box-shadow 0.18s ease;
}

.quiz-option-btn:hover:not(:disabled) {
    transform: translateY(-2px);

    background: #f7fbf8;

    border-color: #97c6a3;

    box-shadow:
        0 7px 18px rgba(30, 126, 52, 0.08);
}

.quiz-option-letter {
    width: 38px;
    height: 38px;

    display: grid;
    place-items: center;

    background: #edf2ee;
    color: #4b554e;

    border-radius: 10px;

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

    transition:
        background-color 0.18s ease,
        color 0.18s ease;
}

.quiz-option-btn.selected {
    background: var(--quiz-green-light);

    border-color: var(--quiz-green);

    box-shadow:
        0 0 0 3px rgba(30, 126, 52, 0.09);
}

.quiz-option-btn.selected .quiz-option-letter {
    background: var(--quiz-green);
    color: white;
}

.quiz-option-btn.correct {
    background: var(--quiz-correct-soft);
    color: #155c35;

    border-color: var(--quiz-correct);
}

.quiz-option-btn.correct .quiz-option-letter {
    background: var(--quiz-correct);
    color: white;
}

.quiz-option-btn.incorrect {
    background: var(--quiz-incorrect-soft);
    color: #8d2525;

    border-color: var(--quiz-incorrect);
}

.quiz-option-btn.incorrect .quiz-option-letter {
    background: var(--quiz-incorrect);
    color: white;
}

.quiz-option-btn:disabled {
    cursor: default;
}

/* =======================================================
   FEEDBACK
======================================================= */

.quiz-feedback {
    margin: 20px 0 4px;
    padding: 18px 20px;

    border-radius: 14px;

    text-align: left;
}

.quiz-feedback strong {
    display: block;

    margin-bottom: 6px;

    font-size: 16px;
}

.quiz-feedback p {
    margin: 0;

    font-size: 14px;
    line-height: 1.6;
}

.feedback-correct {
    background: var(--quiz-correct-soft);
    color: #155c35;

    border: 1px solid #a8dfbd;
}

.feedback-incorrect {
    background: var(--quiz-incorrect-soft);
    color: #8d2525;

    border: 1px solid #efb4b4;
}

/* =======================================================
   BUTTONS
======================================================= */

.quiz-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;

    margin-top: 26px;
    padding-top: 22px;

    border-top: 1px solid var(--quiz-border);
}

.continue-button,
.profile-link-btn {
    min-height: 48px;

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

    padding: 12px 24px;

    border-radius: 11px;

    font: inherit;
    font-size: 15px;
    font-weight: 800;

    text-decoration: none;

    cursor: pointer;

    transition:
        transform 0.18s ease,
        background-color 0.18s ease,
        box-shadow 0.18s ease;
}

.continue-button {
    background: var(--quiz-green);
    color: white;

    border: 2px solid var(--quiz-green);
}

.continue-button:hover {
    background: var(--quiz-green-dark);

    transform: translateY(-2px);

    box-shadow:
        0 8px 18px rgba(30, 126, 52, 0.2);
}

.profile-link-btn {
    background: white;
    color: #555d58;

    border: 2px solid #cfd8d1;
}

.profile-link-btn:hover {
    background: #f3f6f4;
    color: #252925;

    transform: translateY(-2px);
}

/* =======================================================
   FLASH RESULT EFFECT
======================================================= */

.flash-correct {
    animation: correctFlash 0.65s ease;
}

.flash-incorrect {
    animation: incorrectFlash 0.65s ease;
}

@keyframes correctFlash {
    0% {
        background: transparent;
    }

    45% {
        background: var(--quiz-correct-soft);
    }

    100% {
        background: transparent;
    }
}

@keyframes incorrectFlash {
    0% {
        background: transparent;
    }

    45% {
        background: var(--quiz-incorrect-soft);
    }

    100% {
        background: transparent;
    }
}

/* =======================================================
   SUMMARY SCREEN
======================================================= */

.quiz-summary {
    max-width: 980px;

    margin: 40px auto;
    padding: 34px;

    background: white;

    border: 1px solid var(--quiz-border);
    border-radius: var(--quiz-radius-large);

    box-shadow: var(--quiz-shadow);

    text-align: center;
}

.summary-icon {
    width: 82px;
    height: 82px;

    display: grid;
    place-items: center;

    margin: 0 auto 18px;

    background: var(--quiz-green-light);

    border-radius: 50%;

    font-size: 39px;
}

.quiz-summary h2 {
    margin: 0 0 12px;

    color: var(--quiz-text);

    font-size: 32px;
}

.summary-score {
    margin: 18px 0;

    color: var(--quiz-green);

    font-size: 42px;
    font-weight: 850;
}

.summary-text {
    max-width: 650px;
    margin: 0 auto 22px;

    color: var(--quiz-muted);

    font-size: 16px;
    line-height: 1.6;
}

.missed-review {
    margin-top: 30px;

    text-align: left;
}

.missed-review h3 {
    margin-bottom: 16px;

    font-size: 22px;
}

.missed-card {
    margin: 15px 0;
    padding: 20px;

    background: #f7faf8;

    border: 1px solid var(--quiz-border);
    border-radius: 14px;
}

.missed-card p {
    margin: 8px 0;

    color: #4e5550;

    font-size: 14px;
    line-height: 1.55;
}

/* =======================================================
   RESPONSIVE QUIZ
======================================================= */

@media (max-width: 800px) {
    .quiz-page {
        padding: 16px;
    }

    .quiz-header {
        align-items: flex-start;
        flex-direction: column;

        padding: 26px;
    }

    .quiz-header-main {
        align-items: flex-start;
        flex-direction: column;
    }

    .quiz-header-icon {
        width: 70px;
        height: 70px;

        font-size: 32px;
    }

    .quiz-header-stat {
        width: 100%;
    }

    .quiz-question-card {
        padding: 23px;
    }
}

@media (max-width: 560px) {
    .quiz-page {
        padding: 10px;
    }

    .quiz-header {
        border-radius: 18px;
    }

    .quiz-progress-row {
        align-items: flex-start;
        flex-direction: column;
        gap: 9px;
    }

    .quiz-question-card {
        padding: 18px;

        border-radius: 18px;
    }

    .quiz-image-wrap {
        padding: 8px;
    }

    .quiz-option-btn {
        grid-template-columns: 36px minmax(0, 1fr);

        padding: 10px 12px;

        font-size: 14px;
    }

    .quiz-option-letter {
        width: 34px;
        height: 34px;
    }

    .quiz-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .continue-button,
    .profile-link-btn {
        width: 100%;
    }

    .quiz-summary {
        margin: 15px auto;
        padding: 23px;
    }
}


/* =======================================================
   TABLE-STYLE ANSWER OPTIONS
======================================================= */

.quiz-choice-table-wrap {
    width: 100%;
    overflow-x: auto;
}

.quiz-choice-table {
    min-width: 640px;

    display: flex;
    flex-direction: column;

    border: 1px solid #dfe6e1;
    border-radius: 14px;

    overflow: hidden;
}

.quiz-choice-table-header,
.quiz-table-option {
    display: grid;

    grid-template-columns:
        76px
        repeat(
            var(--choice-columns),
            minmax(0, 1fr)
        );

    align-items: stretch;
}

.quiz-choice-table-header {
    background: #f1f7f3;
    border-bottom: 1px solid #dce5df;

    color: #344039;

    font-size: 13px;
    font-weight: 800;
}

.quiz-choice-table-header span,
.quiz-table-option > span {
    padding: 13px 15px;

    display: flex;
    align-items: center;

    border-right: 1px solid #e0e6e2;
}

.quiz-choice-table-header span:last-child,
.quiz-table-option > span:last-child {
    border-right: none;
}

.choice-letter-heading {
    justify-content: center;
}

.quiz-table-option {
    width: 100%;
    padding: 0;

    background: white;
    border: none;
    border-bottom: 1px solid #e4e9e6;
    border-radius: 0;

    color: #263029;

    text-align: left;
}

.quiz-table-option:last-child {
    border-bottom: none;
}

.quiz-table-option:hover {
    background: #f3f9f5;
}

.quiz-table-option.selected {
    background: #edf8f0;

    box-shadow:
        inset 4px 0 0 #1e7e34;
}

.quiz-table-option.correct {
    background: #eaf8ed;

    box-shadow:
        inset 4px 0 0 #2b9a49;
}

.quiz-table-option.incorrect {
    background: #fff0f0;

    box-shadow:
        inset 4px 0 0 #c94a4a;
}

.quiz-option-letter {
    justify-content: center;

    color: #1e7e34;

    font-weight: 900;
}

.quiz-table-cell {
    line-height: 1.4;
}

@media (max-width: 700px) {

    .quiz-choice-table-wrap {
        margin-right: -4px;
        padding-bottom: 6px;
    }

}

.quiz-stimulus-text {
    margin: 0 0 12px;

    color: #657069;

    font-size: 14px;
    line-height: 1.5;
}

/* =======================================================
   IB-STYLE QUESTION PRESENTATION
======================================================= */

.quiz-question-wrap {
    width: 100%;
}


/* Stimulus introduction */

.quiz-stimulus-text {
    margin: 0 0 18px;

    color: #4f5953;

    font-size: 17px;
    font-weight: 400;
    line-height: 1.55;
}


/* Image now sits between the introduction and stem */

.quiz-image-wrap {
    width: 100%;
    margin: 0 0 28px;

    display: flex;
    justify-content: center;
}

.quiz-question-image {
    width: auto;
    max-width: min(100%, 760px);
    max-height: 520px;
    height: auto;

    display: block;
    object-fit: contain;

    background: white;
    border: 1px solid #dce3de;
    border-radius: 12px;
}


/* Main question stem */

.quiz-question-content {
    max-width: 1050px;
    margin: 0;
}

.quiz-question-text {
    margin: 0;

    color: #1c211e;

    font-size: 20px;
    font-weight: 400;
    line-height: 1.55;
}


/*
   Override the old large/bold quiz-question style
   in case the class is still used elsewhere.
*/

.quiz-question {
    color: #1c211e;

    font-size: 20px;
    font-weight: 400;
    line-height: 1.55;
}


/* Roman-numeral statements */

.quiz-roman-list {
    max-width: 1000px;
    margin: 22px 0 0;
}

.quiz-roman-statement {
    margin: 10px 0;

    display: grid;
    grid-template-columns: 58px minmax(0, 1fr);
    gap: 10px;
    align-items: start;

    color: #1c211e;

    font-size: 19px;
    font-weight: 400;
    line-height: 1.55;
}

.quiz-roman-number {
    text-align: right;
    white-space: nowrap;
}

.quiz-roman-text {
    min-width: 0;
}

.quiz-question-extra {
    margin: 10px 0 10px 68px;

    color: #1c211e;

    font-size: 19px;
    font-weight: 400;
    line-height: 1.55;
}


/* Tables appearing as question stimuli */

.quiz-data-table-wrap {
    width: 100%;
    margin: 0 0 28px;
    overflow-x: auto;
}


/* Mobile adjustments */

@media (max-width: 700px) {

    .quiz-stimulus-text {
        margin-bottom: 15px;
        font-size: 15px;
    }

    .quiz-image-wrap {
        margin-bottom: 22px;
    }

    .quiz-question-text,
    .quiz-question {
        font-size: 17px;
        line-height: 1.55;
    }

    .quiz-roman-list {
        margin-top: 17px;
    }

    .quiz-roman-statement {
        grid-template-columns: 42px minmax(0, 1fr);
        gap: 8px;

        font-size: 16px;
        line-height: 1.55;
    }

    .quiz-question-extra {
        margin-left: 50px;
        font-size: 16px;
    }

}

.quiz-question-card {
    padding: 34px 38px;
}

.quiz-question-wrap,
.quiz-options,
#quiz-feedback-area,
.quiz-actions {
    width: min(100%, 1120px);
    margin-left: auto;
    margin-right: auto;
}

@media (max-width: 700px) {

    .quiz-question-card {
        padding: 24px 18px;
    }

}

/* =======================================================
   IMAGE LIGHTBOX — TRUE FULL-SCREEN OVERLAY
======================================================= */

body.quiz-modal-open {
    overflow: hidden;
}

.quiz-image-modal {
    display: none;

    position: fixed;
    inset: 0;
    z-index: 99999;

    width: 100vw;
    height: 100vh;

    padding: 32px;

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

    background: rgba(8, 15, 10, 0.92);

    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.quiz-image-modal.show {
    display: flex;
}

.quiz-image-modal-content {
    width: auto;
    max-width: min(1100px, calc(100vw - 100px));

    height: auto;
    max-height: calc(100vh - 100px);

    margin: 0;
    padding: 18px;

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

    overflow: hidden;

    background: #ffffff;
    border-radius: 18px;

    box-shadow:
        0 28px 80px rgba(0, 0, 0, 0.5);
}

.quiz-image-modal-content img {
    display: block;

    width: auto;
    max-width: 100%;

    height: auto;
    max-height: calc(100vh - 136px);

    object-fit: contain;
}

.quiz-image-modal-close {
    width: 48px;
    height: 48px;

    position: fixed;
    top: 22px;
    right: 28px;
    z-index: 100000;

    display: grid;
    place-items: center;

    padding: 0;

    background: #ffffff;
    border: none;
    border-radius: 50%;

    color: #172019;

    font-size: 32px;
    line-height: 1;

    cursor: pointer;

    box-shadow:
        0 10px 28px rgba(0, 0, 0, 0.32);
}

.quiz-image-modal-close:hover {
    background: #edf8f0;
    color: #1e7e34;
}

/* =======================================================
   IB-STYLE ROMAN-NUMERAL QUESTIONS
======================================================= */

.roman-question-card
.quiz-question-layout {
    width: min(100%, 1080px);
    margin: 0 auto;

    display: block;
}

.roman-question-card
.quiz-question-wrap {
    width: 100%;
    max-width: 100%;
}

.roman-question-card
.quiz-question-content {
    max-width: 100%;
}

.roman-question-card
.quiz-question-text {
    margin-bottom: 25px;

    font-size: 21px;
    font-weight: 400;
    line-height: 1.5;
}

.roman-question-card
.quiz-roman-list {
    max-width: 100%;
    margin: 0 0 34px 54px;
}

.roman-question-card
.quiz-roman-statement {
    margin: 14px 0;

    grid-template-columns: 64px minmax(0, 1fr);
    gap: 18px;

    font-size: 19px;
    font-weight: 400;
    line-height: 1.5;
}

.roman-question-card
.quiz-roman-number {
    text-align: left;
}

.roman-question-card
.quiz-answer-panel {
    width: 100%;
    margin-top: 8px;
    padding: 0;

    position: static;

    background: transparent;
    border: none;
}

.roman-question-card
.quiz-options {
    width: min(100%, 850px);
    margin: 0;
    gap: 12px;
}

.roman-question-card
.quiz-option-btn {
    min-height: 58px;
}

.roman-question-card
.quiz-actions {
    width: 100%;
    margin-top: 28px;
}


/* Mobile */

@media (max-width: 700px) {

    .roman-question-card
    .quiz-question-text {
        font-size: 18px;
    }

    .roman-question-card
    .quiz-roman-list {
        margin-left: 10px;
    }

    .roman-question-card
    .quiz-roman-statement {
        grid-template-columns: 42px minmax(0, 1fr);
        gap: 8px;

        font-size: 16px;
    }

}


/* =======================================================
   SHARE SCORE
======================================================= */

.quiz-summary-actions {
    margin-top: 28px;

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

    gap: 12px;
}

.share-score-button {
    min-height: 50px;
    padding: 13px 24px;

    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;

    background: white;
    border: 2px solid #1e7e34;
    border-radius: 11px;

    color: #1e7e34;

    font: inherit;
    font-size: 15px;
    font-weight: 800;

    cursor: pointer;

    transition:
        background-color 0.2s ease,
        color 0.2s ease,
        transform 0.2s ease;
}

.share-score-button:hover {
    background: #edf8f0;
    transform: translateY(-2px);
}

.share-score-button span {
    font-size: 19px;
    line-height: 1;
}

.share-score-message {
    min-height: 22px;
    margin: 16px 0 0;

    color: #1e7e34;

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

    opacity: 0;

    transition: opacity 0.2s ease;
}

.share-score-message.show {
    opacity: 1;
}

@media (max-width: 600px) {

    .quiz-summary-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .quiz-summary-actions > * {
        width: 100%;
        box-sizing: border-box;
    }

}

/* =======================================================
   CUSTOM SCORE SHARING MENU
======================================================= */

body.share-modal-open {
    overflow: hidden;
}

.score-share-modal {
    display: none;

    position: fixed;
    inset: 0;
    z-index: 100000;

    padding: 24px;

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

    background: rgba(12, 22, 15, 0.72);
    backdrop-filter: blur(5px);
}

.score-share-modal.show {
    display: flex;
}

.score-share-dialog {
    width: min(620px, 100%);
    padding: 32px;

    position: relative;

    background: white;
    border: 1px solid #dce6df;
    border-radius: 22px;

    text-align: center;

    box-shadow:
        0 28px 80px rgba(0, 0, 0, 0.32);
}

.score-share-close {
    width: 40px;
    height: 40px;

    position: absolute;
    top: 14px;
    right: 14px;

    display: grid;
    place-items: center;

    padding: 0;

    background: #f0f5f1;
    border: none;
    border-radius: 50%;

    font-size: 25px;
    cursor: pointer;
}

.score-share-eyebrow {
    margin: 0 0 7px;

    color: #1e7e34;

    font-size: 12px;
    font-weight: 850;
    letter-spacing: 0.09em;
    text-transform: uppercase;
}

.score-share-dialog h3 {
    margin: 0 0 12px;

    font-size: 28px;
}

.score-share-preview {
    margin: 0 0 24px;

    color: #5f6962;

    font-size: 15px;
    line-height: 1.55;
}

/* =======================================================
   SCORE-SHARING ICON GRID
======================================================= */

.score-share-grid {
    width: min(100%, 520px);
    margin: 28px auto 0;

    display: grid;
    grid-template-columns:
        repeat(3, minmax(0, 1fr));

    gap: 16px;
}

.social-share-button {
    min-width: 0;
    min-height: 132px;
    padding: 18px 12px 15px;

    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;

    background: #ffffff;
    border: 1px solid #cfddd2;
    border-radius: 18px;

    color: #253129;

    font: inherit;
    cursor: pointer;

    transition:
        transform 0.2s ease,
        border-color 0.2s ease,
        background-color 0.2s ease,
        box-shadow 0.2s ease;
}

.social-share-button:hover {
    background: #f5faf6;
    border-color: #1e7e34;

    transform: translateY(-4px);

    box-shadow:
        0 10px 22px rgba(30, 126, 52, 0.11);
}

.social-share-button:focus-visible {
    outline: 3px solid rgba(30, 126, 52, 0.25);
    outline-offset: 3px;
}

.social-share-icon-wrap {
    width: 58px;
    height: 58px;

    display: grid;
    place-items: center;

    background: #f2f7f3;
    border-radius: 16px;

    transition:
        transform 0.2s ease,
        background-color 0.2s ease;
}

.social-share-button:hover
.social-share-icon-wrap {
    background: #e8f5eb;
    transform: scale(1.05);
}

.social-share-icon {
    width: 34px;
    height: 34px;

    display: block;
    object-fit: contain;
}

.utility-icon-wrap {
    background: #edf3ef;
}

.utility-share-icon {
    width: 30px;
    height: 30px;
}

.social-share-label {
    color: #253129;

    font-size: 14px;
    font-weight: 800;
    line-height: 1.2;
}


/* Tablet */

@media (max-width: 650px) {

    .score-share-grid {
        grid-template-columns:
            repeat(2, minmax(0, 1fr));

        gap: 12px;
    }

    .social-share-button {
        min-height: 112px;
        padding: 14px 10px;
    }

    .social-share-icon-wrap {
        width: 52px;
        height: 52px;
    }

    .social-share-icon {
        width: 31px;
        height: 31px;
    }

}


/* Small phones */

@media (max-width: 380px) {

    .score-share-grid {
        gap: 9px;
    }

    .social-share-button {
        min-height: 102px;
    }

    .social-share-label {
        font-size: 13px;
    }

}
.quiz-choice-image { background:#fff; display:block; max-width:100%; max-height:170px; object-fit:contain; }

/* Explanations are available only after a practice answer has been submitted. */
.quiz-explanation { margin-top: 12px; color: #20362b; }
.quiz-explanation summary {
    width: fit-content; cursor: pointer; padding: 8px 0;
    color: #17633f; font-size: 15px; font-weight: 700;
}
.quiz-explanation summary:focus-visible,
.quiz-explanation-links a:focus-visible { outline: 3px solid #2876bd; outline-offset: 4px; }
.quiz-explanation-content {
    margin-top: 8px; padding: 20px; background: #fff;
    border: 1px solid #d3dfd7; border-radius: 10px;
}
.quiz-explanation-content .quiz-explanation-syllabus {
    margin-top: 16px; color: #526359; font-size: 13px;
}
.quiz-explanation-links { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.quiz-explanation-links a {
    display: inline-flex; flex-wrap: wrap; align-items: center; gap: 5px;
    padding: 10px 14px; min-height: 44px; box-sizing: border-box;
    border: 1px solid #1b7047; border-radius: 8px;
    background: #1b7047; color: #fff; font-size: 14px; font-weight: 600;
    text-decoration: none;
}
.quiz-explanation-links a + a { background: #fff; color: #17633f; }
.quiz-explanation-links a:hover { background: #125335; color: #fff; }
.quiz-new-tab { font-size: 11px; font-weight: 400; }
@media (max-width: 480px) {
    .quiz-explanation-content { padding: 16px; }
    .quiz-explanation-links { flex-direction: column; }
    .quiz-explanation-links a { justify-content: center; }
}

/* Imported comparison tables retain their column relationships on narrow screens. */
.quiz-stimulus-table-wrap { max-width: 100%; overflow-x: auto; margin-bottom: 20px; }
.quiz-stimulus-table { width: 100%; border-collapse: collapse; font-size: 16px; line-height: 1.5; color: #20362b; }
.quiz-stimulus-table th, .quiz-stimulus-table td { padding: 10px 12px; border: 1px solid #cdded2; text-align: center; vertical-align: middle; }
.quiz-stimulus-table thead th { background: #e6f1e8; font-weight: 700; }
.quiz-stimulus-table tbody th { background: #f7faf7; font-weight: 500; }
.quiz-stimulus-table th:first-child { text-align: left; width: 64%; }

/* Compact assessment heading and bounded stimulus previews. */
.quiz-header{min-height:0;padding:16px 22px;margin-bottom:16px;border-radius:18px;gap:16px}
.quiz-header::after{display:none}.quiz-header-main{gap:14px}.quiz-header-icon{width:44px;height:44px;font-size:23px;border-width:2px;box-shadow:none}.quiz-eyebrow{font-size:11px;margin-bottom:4px}.quiz-header h1{font-size:26px;margin-bottom:4px}.quiz-meta{font-size:14px}.quiz-progress-panel{padding:16px 22px;margin-bottom:18px}
.quiz-image-wrap{padding:12px;margin-bottom:18px}.quiz-image-button{display:flex;flex-direction:column;align-items:center;max-width:100%;padding:0;border:0;background:transparent;cursor:zoom-in}.quiz-image-viewport{display:block;max-width:100%;position:relative;overflow:hidden}.quiz-question-image{max-height:300px;max-width:100%;border:0;border-radius:0}.quiz-image-expand-label{display:block;margin-top:8px;font-size:13px;color:#52665b}
.quiz-image-button[data-figure="ice"] .quiz-image-viewport{width:225px;aspect-ratio:460/520}
.quiz-image-button[data-figure="loon"] .quiz-image-viewport{width:400px;aspect-ratio:880/520}
.quiz-image-button[data-figure="ice"] img{position:absolute;width:417.391%;max-width:none;max-height:none;left:-158.696%;top:-53.846%}
.quiz-image-button[data-figure="loon"] img{position:absolute;width:218.182%;max-width:none;max-height:none;left:-59.091%;top:-53.846%}
.quiz-image-button[data-figure="water-model"] .quiz-image-viewport{width:620px}.quiz-image-button[data-figure="water-model"] img{width:100%;max-height:none}
@media(max-width:600px){.quiz-header{padding:14px 16px}.quiz-header h1{font-size:23px}.quiz-header-icon{display:none}.quiz-meta{font-size:12px}.quiz-image-wrap{padding:8px}}

/* Give SVG diagrams a definite enlargement viewport, avoiding intrinsic-size collapse. */
.quiz-image-modal-content{width:min(1000px,calc(100vw - 80px));max-width:calc(100vw - 80px);min-width:0;box-sizing:border-box}
.quiz-image-modal-content img{width:100%;min-width:0;height:auto;max-height:calc(100vh - 136px);object-fit:contain}
@media(max-width:600px){.quiz-image-modal{padding:12px}.quiz-image-modal-content{width:calc(100vw - 24px);max-width:calc(100vw - 24px);padding:12px}}

/* Image attribution stays readable in both the question and enlargement. */
.quiz-image-credit{margin:10px 0 0;font-size:12px;line-height:1.5;color:#52665b;text-align:center;overflow-wrap:anywhere;max-width:100%}
.quiz-image-credit a{color:#17613c;text-decoration:underline;text-underline-offset:2px}
.quiz-image-modal-content{flex-direction:column;overflow:auto}
.quiz-image-modal-content img{flex:0 1 auto;min-height:0;max-height:calc(100vh - 210px)}
.quiz-image-modal-content .quiz-image-credit{flex:0 0 auto}

.quiz-image-wrap{flex-direction:column;align-items:center}
