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

:root {
    --green: #58cc02;
    --green-shadow: #46a302;
    --blue: #1cb0f6;
    --red: #ff4b4b;
    --gold: #ffc800;
    --ink: #243b53;
    --muted: #718096;
    --line: #e5e5e5;
    --page: #f4faff;
}

* {
    box-sizing: border-box;
}

body {
    min-height: 100vh;
    margin: 0;
    padding: 32px 18px;
    background: radial-gradient(circle at top, #e2f7ff, var(--page) 62%);
    color: var(--ink);
    font-family: "Nunito", sans-serif;
}

button {
    font: inherit;
}

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

.back-link {
    display: inline-block;
    margin: 0 0 16px 4px;
    color: #2572a8;
    font-weight: 800;
    text-decoration: none;
}

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

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

.game-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 28px;
}

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

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

h1 {
    margin-bottom: 5px;
    font-size: clamp(1.8rem, 5vw, 2.5rem);
    font-weight: 900;
}

.intro,
.how-to-play {
    margin-bottom: 0;
    color: var(--muted);
}

.game-mark {
    display: grid;
    width: 74px;
    height: 74px;
    flex: 0 0 auto;
    place-items: center;
    border: 3px solid #f2c000;
    border-radius: 23px;
    background: #fff3b0;
    color: #947000;
    font-size: 2rem;
    font-weight: 900;
    transform: rotate(5deg);
}

#setup-screen h2,
.results-screen h2 {
    margin-bottom: 16px;
    font-size: 1.25rem;
    font-weight: 900;
}

.level-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 18px;
}

.level-option {
    display: flex;
    min-height: 150px;
    flex-direction: column;
    align-items: flex-start;
    gap: 7px;
    padding: 16px;
    border: 2px solid var(--line);
    border-bottom-width: 5px;
    border-radius: 17px;
    background: #fff;
    color: var(--ink);
    cursor: pointer;
    text-align: left;
    transition: border-color 0.15s, background 0.15s, transform 0.15s;
}

.level-option:hover {
    transform: translateY(-2px);
}

.level-option.selected {
    border-color: var(--blue);
    background: #f0faff;
}

.level-option strong {
    font-weight: 900;
}

.level-option > span:last-child {
    color: var(--muted);
    font-size: 0.88rem;
    line-height: 1.4;
}

.level-icon {
    display: grid;
    width: 37px;
    height: 37px;
    place-items: center;
    border-radius: 12px;
    background: #e2f6ff;
    color: #1688bf;
    font-weight: 900;
}

.how-to-play {
    line-height: 1.5;
}

.primary-button {
    width: 100%;
    margin-top: 16px;
    padding: 14px 18px;
    border: 0;
    border-radius: 14px;
    background: var(--green);
    box-shadow: 0 4px 0 var(--green-shadow);
    color: #fff;
    cursor: pointer;
    font-weight: 900;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    transition: filter 0.15s, transform 0.15s;
}

.secondary-button {
    margin: 0 0 12px;
    padding: 8px 12px;
    border: 2px solid var(--line);
    border-radius: 10px;
    background: #fff;
    color: #2572a8;
    cursor: pointer;
    font-weight: 800;
}

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

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

.primary-button:disabled {
    cursor: wait;
    opacity: 0.72;
}

.primary-button:focus-visible,
.level-option:focus-visible,
.answer-slot:focus-visible,
.word-tile:focus-visible,
.back-link:focus-visible {
    outline: 3px solid var(--blue);
    outline-offset: 3px;
}

.progress-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    color: var(--muted);
    font-size: 0.85rem;
    font-weight: 900;
}

.progress-track {
    height: 14px;
    flex: 1;
    overflow: hidden;
    border-radius: 20px;
    background: #e8edf1;
}

.progress-fill {
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: var(--green);
    transition: width 0.25s ease;
}

.score {
    min-width: 52px;
    color: #ad8500;
    text-align: right;
}

.level-title {
    margin-bottom: 17px;
    color: #2585bd;
    font-size: 1rem;
    font-weight: 900;
}

.column-labels,
.answer-slots {
    display: grid;
    grid-template-columns: repeat(var(--slot-count, 3), minmax(0, 1fr));
    gap: 8px;
}

.column-labels {
    margin-bottom: 8px;
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 900;
    text-align: center;
    text-transform: uppercase;
}

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

.challenge-card {
    min-width: 0;
    width: min(100%, 620px);
    margin: 0 auto;
    padding: 14px;
    border: 2px solid #d8edfa;
    border-radius: 17px;
    background: #f3fbff;
    transition: border-color 0.15s, background 0.15s;
}

.challenge-card.correct {
    border-color: var(--green);
    background: #f6ffef;
}

.challenge-card.incorrect {
    border-color: var(--red);
    background: #fff6f6;
}

.spanish-prompt {
    min-height: 48px;
    margin-bottom: 12px;
    color: #1e6086;
    font-size: 1.08rem;
    font-weight: 900;
    line-height: 1.4;
    text-align: center;
}

.answer-slot {
    min-width: 0;
    min-height: 54px;
    padding: 7px 4px;
    border: 2px dashed #9ccde6;
    border-radius: 11px;
    background: #fff;
    color: #55748a;
    cursor: pointer;
    font-size: 0.77rem;
    font-weight: 800;
    overflow-wrap: anywhere;
}

.answer-slot.filled {
    border-style: solid;
    border-color: var(--blue);
    color: var(--ink);
    font-size: 0.9rem;
}

.answer-slot:disabled {
    cursor: default;
}

.word-bank-section {
    margin-top: 22px;
    padding: 17px;
    border: 2px solid #edf0f2;
    border-radius: 16px;
    background: #fbfcfd;
}

.word-bank-heading {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.word-bank-heading h3 {
    margin-bottom: 0;
    font-size: 1rem;
    font-weight: 900;
}

.word-bank-heading span {
    color: var(--muted);
    font-size: 0.8rem;
    font-weight: 700;
}

.word-bank {
    display: flex;
    min-height: 44px;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
}

.word-tile {
    min-height: 42px;
    padding: 8px 13px;
    border: 2px solid #d9e6ed;
    border-bottom-width: 4px;
    border-radius: 12px;
    background: #fff;
    color: var(--ink);
    cursor: grab;
    font-weight: 900;
}

.word-tile:active {
    cursor: grabbing;
}

.word-tile.selected {
    border-color: var(--blue);
    background: #e8f8ff;
}

.feedback,
.answer-note {
    border-radius: 13px;
    font-weight: 800;
    line-height: 1.5;
}

.feedback {
    margin-top: 14px;
    padding: 13px 15px;
    background: #edffdf;
    color: #397d0b;
}

.feedback.incorrect {
    background: #fff0f0;
    color: #b52e2e;
}

.answer-note {
    margin: 12px 0 0;
    padding: 9px;
    font-size: 0.82rem;
}

.answer-note.correct {
    background: #edffdf;
    color: #397d0b;
}

.answer-note.incorrect {
    background: #fff0f0;
    color: #b52e2e;
}

.error-message {
    margin: 12px 0 0;
    color: #b52e2e;
    font-weight: 800;
}

.results-screen {
    padding: 16px 0 0;
    text-align: center;
}

.result-star {
    display: block;
    margin-bottom: 4px;
    color: var(--gold);
    font-size: 3.5rem;
}

.result-score {
    margin-bottom: 6px;
    color: #1688bf;
    font-size: 2.4rem;
    font-weight: 900;
}

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

.hidden {
    display: none !important;
}

@media (max-width: 700px) {
    body {
        padding: 18px 12px;
    }

    .game-card {
        border-radius: 20px;
    }

    .challenge-grid {
        grid-template-columns: 1fr;
    }

    .challenge-card {
        padding: 14px;
    }

    .spanish-prompt {
        min-height: auto;
    }

    .level-options {
        grid-template-columns: 1fr;
    }

    .level-option {
        min-height: 130px;
    }
}

@media (max-width: 420px) {
    .column-labels,
    .answer-slots {
        gap: 5px;
    }

    .answer-slot {
        font-size: 0.68rem;
    }

    .progress-row {
        gap: 7px;
        font-size: 0.72rem;
    }
}
