@import url("https://fonts.googleapis.com/css2?family=Nunito:wght@600;700;800;900&display=swap");

:root {
    color-scheme: light;
    --green: #58cc02;
    --green-dark: #46a302;
    --blue: #1cb0f6;
    --blue-dark: #168fc4;
    --red: #ff4b4b;
    --gold: #ffc800;
    --ink: #243b53;
    --muted: #718096;
    --line: #dce8ee;
    --page: #f3faff;
}

* {
    box-sizing: border-box;
}

body {
    min-height: 100vh;
    margin: 0;
    padding: 28px clamp(14px, 3vw, 42px) 48px;
    background:
        radial-gradient(circle at 8% 7%, #dff8ff 0, transparent 26rem),
        radial-gradient(circle at 94% 24%, #fff5c8 0, transparent 24rem),
        var(--page);
    color: var(--ink);
    font-family: "Nunito", sans-serif;
}

button {
    color: inherit;
    font: inherit;
}

button:focus-visible,
a:focus-visible {
    outline: 3px solid var(--blue);
    outline-offset: 3px;
}

.game-shell {
    width: min(100%, 1380px);
    margin: 0 auto;
}

.page-header {
    margin: 0 auto 34px;
    text-align: center;
}

.back-link,
.text-button {
    color: #197ba8;
    font-weight: 900;
    text-decoration: none;
}

.back-link {
    display: inline-block;
    margin-bottom: 20px;
}

.back-link:hover,
.text-button:hover {
    text-decoration: underline;
}

.eyebrow {
    margin: 0 0 7px;
    color: #2585a8;
    font-size: 0.78rem;
    font-weight: 900;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

h1 {
    margin-bottom: 8px;
    font-size: clamp(2rem, 5vw, 3.2rem);
    font-weight: 900;
    letter-spacing: -0.04em;
}

.intro {
    margin: 0;
    color: var(--muted);
}

.screen {
    padding: clamp(20px, 3vw, 36px);
    border: 2px solid #e3edf3;
    border-bottom-width: 6px;
    border-radius: 26px;
    background: #fff;
    box-shadow: 0 18px 45px rgb(38 91 126 / 10%);
}

.hidden {
    display: none !important;
}

.section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 22px;
}

.section-heading h2,
.exercise-heading h2,
.results-screen h2 {
    margin: 0;
    font-size: clamp(1.45rem, 3vw, 2rem);
    font-weight: 900;
}

.step-badge {
    display: grid;
    width: 52px;
    height: 52px;
    flex: 0 0 auto;
    place-items: center;
    border-radius: 17px;
    background: #e6f8ff;
    color: #177da7;
    font-weight: 900;
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 225px), 1fr));
    gap: 16px;
}

.choice-card {
    display: flex;
    min-height: 185px;
    flex-direction: column;
    align-items: flex-start;
    gap: 9px;
    padding: 20px;
    border: 2px solid var(--line);
    border-bottom-width: 6px;
    border-radius: 20px;
    background: #fff;
    cursor: pointer;
    text-align: left;
    transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}

.choice-card:hover {
    transform: translateY(-3px);
    border-color: var(--blue);
    background: #f4fcff;
}

.choice-card strong {
    font-size: 1.18rem;
    font-weight: 900;
    text-transform: capitalize;
}

.card-mark {
    display: grid;
    width: 42px;
    height: 42px;
    place-items: center;
    border-radius: 14px;
    background: #fff2bd;
    color: #997200;
    font-size: 0.83rem;
    font-weight: 900;
}

.card-detail {
    color: var(--muted);
    line-height: 1.45;
}

.card-prompt {
    margin-top: auto;
    color: var(--blue-dark);
    font-size: 0.8rem;
    font-weight: 900;
    text-transform: uppercase;
}

.text-button {
    padding: 4px 0;
    border: 0;
    background: transparent;
    cursor: pointer;
}

.exercise-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 12px;
}

.exercise-topbar .eyebrow {
    margin: 0;
    text-align: right;
}

.exercise-heading {
    margin-bottom: 20px;
    text-align: center;
}

.exercise-heading > p:last-child {
    margin: 8px 0 0;
    color: var(--muted);
}

.exercise-stage {
    display: grid;
    grid-template-columns: minmax(112px, 1fr) minmax(0, 5fr) minmax(112px, 1fr);
    grid-template-rows: minmax(120px, 1fr) minmax(120px, 1fr);
    align-items: stretch;
    gap: clamp(8px, 1.5vw, 18px);
}

.image-frame {
    display: flex;
    min-width: 0;
    min-height: 400px;
    grid-column: 2;
    grid-row: 1 / 3;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: clamp(8px, 1.5vw, 18px);
    border: 2px solid #e4eef4;
    border-radius: 22px;
    background: #f8fcff;
}

.image-frame img {
    display: block;
    width: 100%;
    height: min(66vh, 760px);
    min-height: 370px;
    object-fit: contain;
}

.image-frame figcaption {
    padding-top: 8px;
    color: var(--muted);
    font-size: 0.9rem;
    font-weight: 800;
    text-transform: capitalize;
}

.noun-audio-button {
    display: grid;
    width: 52px;
    height: 52px;
    place-items: center;
    margin-top: 10px;
    padding: 0;
    border: 2px solid #cceaf6;
    border-radius: 50%;
    background: #eaf8ff;
    color: #176f98;
    cursor: pointer;
    transition: border-color 0.14s ease, background 0.14s ease, transform 0.14s ease;
}

.noun-audio-button:hover {
    transform: translateY(-2px);
    border-color: var(--blue);
    background: #def4ff;
}

.noun-audio-button .audio-icon {
    grid-row: auto;
}

.drop-zone {
    display: flex;
    min-width: 0;
    min-height: 120px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 12px 8px;
    border: 2px dashed #b6d2de;
    border-radius: 17px;
    background: #f8fcff;
    cursor: pointer;
    text-align: center;
    transition: background 0.14s ease, border-color 0.14s ease, transform 0.14s ease;
}

.drop-zone.top-left {
    grid-column: 1;
    grid-row: 1;
}

.drop-zone.top-right {
    grid-column: 3;
    grid-row: 1;
}

.drop-zone.bottom-left {
    grid-column: 1;
    grid-row: 2;
}

.drop-zone.bottom-right {
    grid-column: 3;
    grid-row: 2;
}

.zone-position {
    color: #6a8292;
    font-size: 0.72rem;
    font-weight: 900;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.zone-cue {
    font-size: clamp(0.9rem, 1.3vw, 1.1rem);
    font-weight: 900;
    overflow-wrap: anywhere;
}

.drop-zone.drag-over {
    transform: scale(1.02);
    border-color: var(--blue);
    background: #e8f8ff;
}

.drop-zone.correct {
    border: 3px solid var(--green);
    background: #edffdf;
    color: #397d0b;
}

.drop-zone.wrong {
    animation: wrong-flash 0.48s ease;
}

@keyframes wrong-flash {
    0%,
    100% {
        border-color: var(--line);
        background: #f8fcff;
    }

    35%,
    70% {
        border-color: var(--red);
        background: #ffe4e4;
    }
}

.status-message {
    min-height: 1.5em;
    margin: 12px 0 18px;
    color: #476276;
    font-weight: 800;
    text-align: center;
}

.audio-area {
    padding-top: 17px;
    border-top: 2px solid #edf2f5;
    text-align: center;
}

.audio-area h3 {
    margin-bottom: 12px;
    font-size: 1rem;
    font-weight: 900;
}

.audio-choices {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.audio-choice {
    display: grid;
    width: 76px;
    height: 76px;
    place-items: center;
    justify-self: center;
    padding: 0;
    border: 2px solid #dce8ee;
    border-bottom-width: 4px;
    border-radius: 50%;
    background: #fff;
    cursor: grab;
    transition: border-color 0.14s ease, background 0.14s ease, transform 0.14s ease;
}

.audio-choice:hover {
    transform: translateY(-2px);
    border-color: var(--blue);
    background: #f4fcff;
}

.audio-choice:active {
    cursor: grabbing;
}

.audio-choice.selected {
    border-color: var(--blue);
    background: #eaf8ff;
}

.audio-choice.matched {
    border-color: var(--green);
    background: #edffdf;
    cursor: pointer;
}

.audio-icon {
    display: grid;
    width: 46px;
    height: 46px;
    place-items: center;
    border-radius: 50%;
    background: var(--blue);
    color: white;
    font-size: 1rem;
    transition: background 0.14s ease;
}

.audio-choice.matched .audio-icon {
    background: var(--green);
}

.noun-audio-button .audio-icon {
    width: 34px;
    height: 34px;
    font-size: 0.8rem;
}

.primary-button {
    display: block;
    width: min(100%, 460px);
    margin: 22px auto 0;
    padding: 15px 20px;
    border: 0;
    border-radius: 15px;
    background: var(--green);
    box-shadow: 0 4px 0 var(--green-dark);
    color: white;
    cursor: pointer;
    font-weight: 900;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    transition: filter 0.14s ease, transform 0.14s ease;
}

.primary-button:hover {
    filter: brightness(1.04);
}

.primary-button:active {
    transform: translateY(3px);
    box-shadow: 0 1px 0 var(--green-dark);
}

.results-screen {
    text-align: center;
}

.result-score {
    margin: 14px 0 4px;
    color: #1688bf;
    font-size: clamp(1.5rem, 4vw, 2.2rem);
    font-weight: 900;
}

.results-screen > p:not(.eyebrow, .result-score) {
    color: var(--muted);
}

.missed-words {
    width: min(100%, 480px);
    margin: 24px auto 0;
    padding: 18px;
    border-radius: 18px;
    background: #f6faff;
    text-align: left;
}

.missed-words h3 {
    margin-bottom: 10px;
    font-size: 1rem;
}

.missed-words ul {
    display: grid;
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.missed-words li {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    padding: 9px 11px;
    border-radius: 10px;
    background: #fff;
}

.missed-words li span {
    color: #b52e2e;
    font-weight: 800;
}

#no-misses {
    margin: 0;
    color: #397d0b;
    font-weight: 800;
}

@media (max-width: 820px) {
    .exercise-stage {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
        grid-template-rows: auto auto minmax(300px, auto);
    }

    .drop-zone.top-left {
        grid-column: 1;
        grid-row: 1;
    }

    .drop-zone.top-right {
        grid-column: 2;
        grid-row: 1;
    }

    .drop-zone.bottom-left {
        grid-column: 1;
        grid-row: 2;
    }

    .drop-zone.bottom-right {
        grid-column: 2;
        grid-row: 2;
    }

    .image-frame {
        min-height: 0;
        grid-column: 1 / 3;
        grid-row: 3;
    }

    .image-frame img {
        height: min(62vh, 700px);
        min-height: 280px;
    }
}

@media (max-width: 560px) {
    body {
        padding: 15px 10px 28px;
    }

    .page-header {
        margin-bottom: 20px;
    }

    .screen {
        padding: 17px 13px;
        border-radius: 20px;
    }

    .exercise-topbar {
        align-items: flex-start;
    }

    .exercise-topbar .eyebrow {
        max-width: 45%;
    }

    .exercise-stage {
        gap: 7px;
    }

    .drop-zone {
        min-height: 82px;
        padding: 8px 5px;
    }

    .zone-position {
        font-size: 0.62rem;
    }

    .image-frame img {
        height: min(55vh, 540px);
        min-height: 220px;
    }

    .audio-choices {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
    }

    .audio-choice {
        width: 68px;
        height: 68px;
    }

    .audio-choice .audio-icon {
        width: 42px;
        height: 42px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
