:root {
    --ink: #263d32;
    --muted: #53675a;
    --cream: #fffaf1;
    --paper: #fffefa;
    --forest: #287047;
    --forest-dark: #194d32;
    --yellow: #ffc857;
    --green: #28784d;
    --blue: #356d85;
    --orange: #aa5a23;
    --red: #aa443e;
    --shadow: 0 18px 45px rgba(48, 80, 52, 0.14);
}

* {
    box-sizing: border-box;
}

body {
    min-height: 100vh;
    margin: 0;
    color: var(--ink);
    background:
        radial-gradient(circle at 8% 14%, rgba(236, 193, 103, 0.22) 0 65px, transparent 66px),
        radial-gradient(circle at 92% 38%, rgba(117, 177, 115, 0.18) 0 85px, transparent 86px),
        linear-gradient(145deg, #fffdf4 0%, #edf5e6 56%, #e0efe0 100%);
    font-family: "Nunito", sans-serif;
}

@media (min-width: 851px) {
    body {
        background:
            url("../images/woodland-tree.svg") 2% 14% / clamp(70px, 7vw, 100px) auto no-repeat,
            url("../images/woodland-tree.svg") 98% 38% / clamp(90px, 9vw, 130px) auto no-repeat,
            linear-gradient(145deg, #fffdf4 0%, #edf5e6 56%, #e0efe0 100%);
    }
}

button,
input {
    font: inherit;
}

button {
    color: inherit;
}

button:focus-visible,
input:focus-visible {
    outline: 4px solid rgba(40, 112, 71, 0.4);
    outline-offset: 3px;
}

.name-dialog {
    width: min(440px, calc(100% - 28px));
    padding: 0;
    border: 0;
    border-radius: 26px;
    color: var(--ink);
    background: var(--paper);
    box-shadow: 0 24px 70px rgba(35, 57, 39, 0.3);
}

.finish-dialog,
.streak-dialog {
    width: min(680px, calc(100% - 28px));
    max-height: min(84vh, 760px);
    padding: 0;
    border: 0;
    border-radius: 28px;
    color: var(--ink);
    background: var(--paper);
    box-shadow: 0 24px 70px rgba(35, 57, 39, 0.3);
}

.finish-dialog::backdrop,
.streak-dialog::backdrop {
    background: rgba(28, 47, 31, 0.56);
    backdrop-filter: blur(5px);
}

.finish-content {
    padding: 30px clamp(20px, 5vw, 42px) 34px;
    text-align: center;
}

.celebration-stars {
    margin-bottom: 12px;
    color: #f2a900;
    font-size: 1.65rem;
    letter-spacing: 0.08em;
    line-height: 1.25;
    text-shadow: 0 3px 0 #d99000;
}

.finish-content h2 {
    font-size: clamp(1.7rem, 5vw, 2.35rem);
}

.finish-star-total {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    margin: 20px 0 10px;
    padding: 10px 26px;
    border-radius: 22px;
    background: #fff4c9;
}

.finish-star-total span {
    color: #f2a900;
    font-size: 3rem;
    line-height: 1;
}

.finish-star-total strong {
    color: #6f4700;
    font-family: "Fredoka", sans-serif;
    font-size: 2.8rem;
}

.finish-message {
    color: var(--muted);
    font-weight: 800;
}

.results-list-heading {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-top: 24px;
    border-bottom: 2px solid #dcebd8;
    text-align: left;
}

.results-list-heading h3 {
    margin-bottom: 8px;
    font-family: "Fredoka", sans-serif;
}

#results-summary {
    color: var(--muted);
    font-size: 0.85rem;
    font-weight: 800;
}

.results-list {
    max-height: 230px;
    margin: 0;
    padding: 0;
    overflow-y: auto;
    list-style: none;
    text-align: left;
}

.result-row {
    display: grid;
    grid-template-columns: 32px 1fr auto;
    align-items: center;
    gap: 12px;
    padding: 11px 4px;
    border-bottom: 1px solid #e4ebdf;
}

.result-icon {
    display: grid;
    width: 30px;
    height: 30px;
    place-items: center;
    border-radius: 50%;
    color: white;
    background: var(--green);
    font-weight: 800;
}

.result-row.incorrect .result-icon {
    background: var(--red);
}

.result-question {
    font-weight: 800;
}

.result-answer {
    color: var(--muted);
    font-size: 0.85rem;
}

.result-status {
    color: #246843;
    font-size: 0.8rem;
    font-weight: 800;
}

.result-row.incorrect .result-status {
    color: #a63d38;
}

.empty-results {
    padding: 22px 4px;
    color: var(--muted);
    text-align: center;
}

.finish-actions {
    display: grid;
    gap: 10px;
    margin-top: 24px;
}

.finish-actions .submit-button {
    margin: 0 auto;
}

.streak-dialog {
    width: min(500px, calc(100% - 28px));
}

.streak-content {
    padding: 34px clamp(24px, 6vw, 42px);
    text-align: center;
}

.streak-celebration {
    display: block;
    margin-bottom: 14px;
    color: #f2a900;
    font-size: 4rem;
    line-height: 1;
    text-shadow: 0 3px 0 #d99000, 0 0 18px rgba(255, 200, 61, .55);
}

.streak-content h2 {
    margin-bottom: 12px;
    font-family: "Fredoka", sans-serif;
    font-size: clamp(1.55rem, 5vw, 2rem);
}

.streak-content p {
    margin: 0;
    color: var(--muted);
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1.5;
}

.streak-actions {
    display: grid;
    gap: 12px;
    margin-top: 24px;
}

.streak-actions .submit-button {
    margin-inline: auto;
}

.name-dialog::backdrop {
    background: rgba(28, 47, 31, 0.56);
    backdrop-filter: blur(5px);
}

.name-form {
    padding: 36px clamp(24px, 7vw, 42px) 40px;
    text-align: center;
}

.welcome-star {
    display: grid;
    width: 72px;
    height: 72px;
    margin: 0 auto 18px;
    place-items: center;
    border-radius: 22px;
    color: #8a5a00;
    background: #fff1bd;
    font-size: 3rem;
    transform: rotate(-6deg);
}

.name-form h2 {
    margin-bottom: 8px;
    font-size: 2rem;
}

.name-form > p:not(.eyebrow, .name-error, .privacy-note) {
    margin-bottom: 22px;
    color: var(--muted);
    font-size: 1.05rem;
    font-weight: 700;
}

.name-form label {
    display: block;
    margin-bottom: 7px;
    font-weight: 800;
    text-align: left;
}

#player-name {
    width: 100%;
    height: 58px;
    padding: 10px 16px;
    border: 3px solid #a9c7a6;
    border-radius: 15px;
    color: var(--forest-dark);
    font-family: "Fredoka", sans-serif;
    font-size: 1.4rem;
    text-align: center;
}

.name-error {
    min-height: 23px;
    margin: 6px 0;
    color: #a63d38;
    font-weight: 800;
}

.name-error:empty {
    display: none;
}

.privacy-note {
    margin: 10px 0 0;
    color: var(--muted);
    font-size: 0.8rem;
    line-height: 1.4;
    text-align: left;
}

.name-submit {
    margin-top: 7px;
}

.page-shell {
    width: min(1120px, calc(100% - 32px));
    margin: 0 auto;
    padding: 42px 0 24px;
}

.hero {
    margin-bottom: 28px;
    text-align: center;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 16px;
}

.logo {
    width: 68px;
    height: 68px;
    object-fit: contain;
    filter: drop-shadow(0 6px 7px rgba(48, 80, 52, 0.18));
}

.eyebrow {
    margin: 0 0 3px;
    color: var(--forest);
    font-size: 0.77rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

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

h1,
h2,
.level-number {
    font-family: "Fredoka", sans-serif;
}

h1 {
    margin-bottom: 0;
    font-size: clamp(2.6rem, 7vw, 4.5rem);
    line-height: 0.95;
    letter-spacing: -0.045em;
}

h1 span {
    color: var(--forest);
}

.level-picker {
    margin-bottom: 22px;
}

.section-heading {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 20px;
}

.section-heading {
    padding: 0 6px 12px;
}

.section-heading.level-path-collapsed {
    display: none;
}

.level-picker.level-collapsed {
    margin-bottom: 0;
}

h2 {
    margin-bottom: 0;
    font-size: 1.35rem;
}

.level-summary {
    margin-bottom: 2px;
    color: var(--muted);
    font-weight: 700;
}

.change-level-button {
    min-height: 44px;
    flex-shrink: 0;
    margin: 0;
    padding: 8px 16px;
    border: 2px solid var(--forest);
    border-radius: 12px;
    color: var(--forest-dark);
    background: #eaf4e5;
    cursor: pointer;
    font-weight: 800;
}

.change-level-button:hover {
    background: #d7ead2;
}

.level-buttons {
    position: relative;
    isolation: isolate;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    align-items: center;
    gap: 12px;
    min-height: 250px;
    padding: 38px 22px;
    overflow: hidden;
    border: 2px solid #a9ce9d;
    border-radius: 24px;
    background: #e1f1d0 url("../images/woodland-trail.svg") center / 100% 100% no-repeat;
}

.level-buttons[hidden] {
    display: none;
}

.quest-trail {
    position: absolute;
    z-index: -1;
    inset: 25px 0;
    width: 100%;
    height: calc(100% - 50px);
    overflow: visible;
}

.quest-trail path {
    fill: none;
    stroke-linecap: round;
    vector-effect: non-scaling-stroke;
}

.quest-trail .quest-trail-road {
    stroke: #f3d9a6;
    stroke-width: 42;
}

.quest-trail .quest-trail-dashes {
    stroke: #b69055;
    stroke-width: 4;
    stroke-dasharray: 8 12;
}

.quest-decorations {
    position: absolute;
    z-index: -1;
    inset: 0;
    pointer-events: none;
    color: #94723d;
    font-family: "Fredoka", sans-serif;
    font-weight: 700;
}

.quest-star {
    position: absolute;
    top: 10px;
    left: 14px;
    color: #f2a900;
    font-size: 2rem;
    line-height: 1;
    text-shadow: 0 3px 0 #d99000;
}

.quest-mark {
    position: absolute;
    font-size: 1.4rem;
    opacity: 0.65;
}

.quest-mark-one { top: 12%; left: 24%; }
.quest-mark-two { bottom: 10%; left: 35%; }
.quest-mark-three { top: 9%; left: 51%; }
.quest-mark-four { bottom: 9%; left: 72%; }
.quest-mark-five { top: 15%; right: 3%; }

.level-button:nth-of-type(even) {
    transform: translateY(-30px);
}

.level-button:nth-of-type(odd) {
    transform: translateY(30px);
}

.level-button {
    display: flex;
    min-width: 0;
    min-height: 96px;
    align-items: center;
    gap: 11px;
    padding: 12px;
    border: 2px solid #e1d3b6;
    border-radius: 18px;
    background: #fffdf6;
    box-shadow: 0 7px 20px rgba(48, 80, 52, 0.08);
    cursor: pointer;
    text-align: left;
    transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.level-button:hover {
    box-shadow: 0 10px 24px rgba(48, 80, 52, 0.14);
}

.level-button:nth-of-type(even):hover { transform: translateY(-33px); }
.level-button:nth-of-type(odd):hover { transform: translateY(27px); }

.level-button.active {
    border-color: var(--forest);
    background: #eaf4e5;
    box-shadow: 0 9px 24px rgba(40, 112, 71, 0.17);
}

.level-number {
    display: grid;
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    place-items: center;
    border: 3px solid white;
    border-radius: 50%;
    color: white;
    background: var(--level-colour, var(--forest));
    box-shadow: 0 0 0 2px var(--level-colour, var(--forest));
    font-size: 1.35rem;
    font-weight: 600;
}

.level-button:nth-of-type(1) { --level-colour: #28784d; }
.level-button:nth-of-type(2) { --level-colour: #356d85; }
.level-button:nth-of-type(3) { --level-colour: #aa5a23; }
.level-button:nth-of-type(4) { --level-colour: #aa443e; }
.level-button:nth-of-type(5) { --level-colour: #665485; }

.level-button strong,
.level-button small {
    display: block;
}

.level-button strong {
    font-size: 0.92rem;
}

.level-button small {
    margin-top: 2px;
    color: var(--muted);
    font-size: 0.75rem;
}

.game-card {
    display: grid;
    grid-template-columns: 270px minmax(0, 1fr);
    overflow: hidden;
    border: 1px solid rgba(40, 112, 71, 0.15);
    border-radius: 28px;
    background: var(--paper);
    box-shadow: var(--shadow);
}

.game-card[hidden] {
    display: none;
}

.operation-panel {
    padding: 34px 24px;
    background: #eaf3e4;
}

.operation-panel h2 {
    margin-bottom: 24px;
}

.operation-buttons {
    display: grid;
    gap: 12px;
}

.operation-button {
    display: flex;
    align-items: center;
    gap: 13px;
    width: 100%;
    padding: 10px 14px;
    border: 2px solid transparent;
    border-radius: 15px;
    background: white;
    box-shadow: 0 4px 10px rgba(48, 80, 52, 0.08);
    cursor: pointer;
    font-weight: 800;
    transition: transform 140ms ease, border-color 140ms ease, background 140ms ease;
}

.operation-button:hover:not(:disabled) {
    transform: translateX(3px);
}

.operation-button.active {
    border-color: currentColor;
    background: #fff;
}

.operation-button:disabled {
    opacity: 0.38;
    cursor: not-allowed;
    filter: grayscale(0.6);
}

.operation-button[hidden] {
    display: none;
}

.operation-symbol {
    display: grid;
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
    place-items: center;
    border-radius: 12px;
    color: white;
    font-family: "Fredoka", sans-serif;
    font-size: 1.8rem;
}

.operation-add { color: #28784d; }
.operation-add .operation-symbol { background: var(--green); }
.operation-subtract { color: #356d85; }
.operation-subtract .operation-symbol { background: var(--blue); }
.operation-multiply { color: #aa5a23; }
.operation-multiply .operation-symbol { background: var(--orange); }
.operation-divide { color: #aa443e; }
.operation-divide .operation-symbol { background: var(--red); }

.challenge-panel {
    position: relative;
    padding: 22px clamp(24px, 6vw, 70px) 30px;
    text-align: center;
}

.game-status {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 8px;
    text-align: left;
}

.game-level-status {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 12px;
}

.game-level-status .level-summary {
    margin: 0;
}

.star-counter {
    display: grid;
    width: max-content;
    grid-template-columns: auto auto;
    align-items: center;
    column-gap: 10px;
    padding: 10px 16px;
    border: 2px solid #f2ca5c;
    border-radius: 18px;
    color: #8a5a00;
    background: linear-gradient(135deg, #fff8dc, #ffeaa1);
    box-shadow: 0 7px 18px rgba(138, 90, 0, 0.13);
    white-space: nowrap;
    margin-left: auto;
}

.star-counter[hidden] {
    display: none;
}

.finish-button {
    min-height: 44px;
    padding: 7px 10px;
    border: 0;
    border-radius: 10px;
    color: var(--forest-dark);
    background: #e3f0de;
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 800;
}

.finish-button:hover {
    background: #d1e6cb;
}

.star-counter .big-star {
    color: #f2a900;
    font-size: 2.8rem;
    line-height: 0.8;
    text-shadow: 0 3px 0 #d99000;
}

.star-counter > div {
    text-align: left;
}

.star-counter #score {
    display: block;
    color: #6f4700;
    font-family: "Fredoka", sans-serif;
    font-size: 2rem;
    line-height: 1;
}

.star-counter .streak-label {
    grid-column: 1 / -1;
    margin-top: 7px;
    padding-top: 6px;
    border-top: 1px solid rgba(138, 90, 0, 0.18);
    font-size: 0.75rem;
    text-align: center;
}

.question-area {
    display: flex;
    min-height: 146px;
    align-items: center;
    justify-content: center;
    gap: clamp(8px, 2.5vw, 22px);
    margin: 0 0 18px;
    font-family: "Fredoka", sans-serif;
    font-size: clamp(2.5rem, 6vw, 4.5rem);
    font-weight: 600;
}

.operator {
    color: var(--forest);
}

.equals {
    color: #718273;
}

.answer-label {
    display: block;
}

.answer-control {
    display: flex;
    align-items: center;
    gap: 12px;
}

#answer-box {
    width: clamp(90px, 13vw, 148px);
    height: 88px;
    border: 3px dashed #82ad80;
    border-radius: 18px;
    color: var(--forest-dark);
    background: #f5faf1;
    font-family: "Fredoka", sans-serif;
    font-size: clamp(2.2rem, 5vw, 3.5rem);
    font-weight: 600;
    text-align: center;
}

#answer-box:focus {
    border-style: solid;
    background: white;
}

#answer-box::-webkit-inner-spin-button,
#answer-box::-webkit-outer-spin-button {
    margin: 0;
    appearance: none;
}

.submit-button {
    width: min(100%, 390px);
    padding: 15px 24px;
    border: 0;
    border-radius: 16px;
    color: white;
    background: linear-gradient(135deg, var(--forest), var(--forest-dark));
    box-shadow: 0 8px 0 #123a25, 0 12px 22px rgba(31, 84, 48, 0.22);
    cursor: pointer;
    font-size: 1.05rem;
    font-weight: 800;
    transition: transform 100ms ease, box-shadow 100ms ease;
}

.submit-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 0 #123a25, 0 14px 25px rgba(31, 84, 48, 0.25);
}

.submit-button:active {
    transform: translateY(6px);
    box-shadow: 0 2px 0 #123a25;
}

.answer-submit {
    display: grid;
    width: 68px;
    height: 68px;
    flex: 0 0 68px;
    place-items: center;
    padding: 0;
    border-radius: 50%;
    font-family: "Fredoka", sans-serif;
    font-size: 2.3rem;
}

.answer-submit[hidden] {
    display: none;
}

.next-button {
    padding: 7px;
    color: white;
    background: linear-gradient(135deg, #4b86a0, #265d75);
    box-shadow: 0 8px 0 #174253, 0 12px 22px rgba(38, 93, 117, .22);
    font-family: "Nunito", sans-serif;
    font-size: 0.68rem;
    line-height: 1.05;
}

.next-button:hover {
    box-shadow: 0 10px 0 #174253, 0 14px 25px rgba(38, 93, 117, .25);
}

.next-button:active {
    box-shadow: 0 2px 0 #174253;
}

.flying-star {
    position: fixed;
    z-index: 1000;
    color: #ffc83d;
    font-size: 2.8rem;
    line-height: 1;
    pointer-events: none;
    text-shadow: 0 0 8px #fff3a8, 0 2px 0 #d99000, 0 0 18px rgba(255, 200, 61, 0.85);
    will-change: transform, opacity;
}

.star-counter.star-caught .big-star {
    animation: star-caught 480ms ease-out;
}

@keyframes star-caught {
    0%, 100% { transform: scale(1) rotate(0); }
    35% { transform: scale(1.45) rotate(-10deg); }
    65% { transform: scale(0.92) rotate(8deg); }
}

.feedback {
    min-height: 24px;
    margin: 23px 0 8px;
    color: var(--muted);
    font-size: 1.08rem;
    font-weight: 800;
}

.feedback.correct {
    color: #246843;
}

.feedback.incorrect {
    color: #a63d38;
}

.challenge-panel.no-help .feedback:empty {
    display: none;
}

.challenge-panel.no-help .feedback:not(:empty) {
    min-height: 0;
    margin: 16px 0 0;
}

.hint-button {
    border: 0;
    color: #8a5a00;
    background: transparent;
    cursor: pointer;
    font-size: 0.92rem;
    font-weight: 800;
    text-decoration: underline;
    text-decoration-style: dotted;
    text-underline-offset: 4px;
}

.hint-button[hidden] {
    display: none !important;
}

.hint-box[hidden] {
    display: none !important;
}

.hint-box {
    max-width: 520px;
    margin: 16px auto 0;
    padding: 14px 18px;
    border: 1px solid #f5d57b;
    border-radius: 14px;
    background: #fff9e8;
    text-align: left;
}

.hint-box strong {
    color: #8a5a00;
}

.hint-box p {
    margin: 4px 0 0;
    color: #5f5a4a;
    line-height: 1.45;
}

#hint-text {
    white-space: pre-line;
}

#hint-text:empty {
    display: none;
}

.visual-counter {
    margin-top: 14px;
    text-align: center;
}

.counter-label {
    display: block;
    margin-bottom: 9px;
    color: #416244;
    font-family: "Fredoka", sans-serif;
    font-size: 1.1rem;
    font-weight: 600;
}

.counter-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
    max-width: 310px;
    margin: 0 auto;
}

.ten-frames {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.ten-frame {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    width: min(100%, 220px);
    border-top: 2px solid #849d77;
    border-left: 2px solid #849d77;
    background: #fff;
}

.ten-frame-cell {
    position: relative;
    display: grid;
    aspect-ratio: 1;
    place-items: center;
    border-right: 2px solid #849d77;
    border-bottom: 2px solid #849d77;
}

.ten-frame-cell .counter {
    width: min(34px, 85%);
    height: auto;
    aspect-ratio: 1;
}

.group-outline-top::after,
.group-outline-bottom::after,
.group-outline-left::after,
.group-outline-right::after {
    position: absolute;
    z-index: 1;
    inset: -2px;
    border: 0 solid #c62828;
    pointer-events: none;
    content: "";
}

.group-outline-top::after { border-top-width: 3px; }
.group-outline-bottom::after { border-bottom-width: 3px; }
.group-outline-left::after { border-left-width: 3px; }
.group-outline-right::after { border-right-width: 3px; }

.counter {
    display: grid;
    width: 34px;
    height: 34px;
    place-items: center;
    padding: 0;
    border: 2px solid #b8bec8;
    border-radius: 50%;
    color: #727b8c;
    background: #e2e6eb;
    cursor: pointer;
    font-size: 0;
    box-shadow: inset 0 -3px 0 rgba(68, 75, 87, 0.1);
    transition: transform 100ms ease, background 140ms ease, border-color 140ms ease;
}

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

.counter:active {
    transform: scale(0.94);
}

.counter.selected {
    border-color: #238e69;
    background: #72d7ac;
    box-shadow: inset 0 -3px 0 rgba(23, 116, 82, 0.2);
}

.counter.second-addend.selected {
    border-color: #187653;
    background: #36aa7b;
}

.counter.taken {
    border-color: #c84954;
    color: #bd4a55;
    background: #ffb9c0;
    box-shadow: none;
    font-size: 1.15rem;
    font-weight: 800;
}

.counter-progress {
    min-height: 22px;
    margin: 9px 0 0;
    color: #5f5a4a;
    font-weight: 800;
    text-align: center;
}

.counter-group {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 7px 10px;
    border-radius: 12px;
    background: #eaf3e4;
}

.counter-group + .counter-group {
    margin-top: 7px;
}

.counter-group .group-icon {
    color: var(--forest);
    font-size: 1.45rem;
}

.counter-group strong {
    font-size: 1.15rem;
}

.score-area {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    margin: 20px 0 14px;
}

.reset-button {
    padding: 10px 12px;
    border: 0;
    color: var(--muted);
    background: transparent;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.footer-message {
    margin-bottom: 0;
    color: var(--muted);
    font-size: 0.85rem;
    text-align: center;
}

.footer-message span {
    color: #e8a400;
}

.footer-message a {
    color: var(--forest);
    font-weight: 800;
}

.footer-message a:hover {
    color: var(--forest-dark);
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

@media (max-width: 850px) {
    .level-buttons {
        gap: 8px;
        padding-inline: 14px;
    }

    .level-button {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .game-card {
        grid-template-columns: 220px minmax(0, 1fr);
    }

}

@media (max-width: 680px) {
    .page-shell {
        width: min(100% - 20px, 560px);
        padding-top: 24px;
    }

    .section-heading {
        display: block;
    }

    .level-summary {
        margin-top: 5px;
    }

    .level-buttons {
        grid-template-columns: 1fr;
        gap: 10px;
        min-height: 0;
        padding: 48px 46px 22px 30px;
        background-image: url("../images/woodland-trail-mobile.svg");
    }

    .level-buttons::before {
        position: absolute;
        z-index: -1;
        top: 64px;
        bottom: 50px;
        left: 39px;
        width: 40px;
        border-radius: 20px;
        background: #f3d9a6;
        content: "";
    }

    .level-buttons::after {
        position: absolute;
        z-index: -1;
        top: 64px;
        bottom: 50px;
        left: 57px;
        border-left: 4px dashed #b69055;
        content: "";
    }

    .quest-trail {
        display: none;
    }

    .level-button,
    .level-button:nth-of-type(n),
    .level-button:nth-of-type(n):hover {
        flex-direction: row;
        min-height: 68px;
        text-align: left;
        transform: none;
    }

    .quest-mark-one { top: 20%; left: auto; right: 5%; }
    .quest-mark-two { bottom: 57%; left: auto; right: 5%; }
    .quest-mark-three { top: 51%; left: auto; right: 5%; }
    .quest-mark-four { bottom: 23%; left: auto; right: 5%; }
    .quest-mark-five { top: auto; bottom: 5%; right: 5%; }

    .game-card {
        grid-template-columns: 1fr;
    }

    .operation-panel {
        padding: 22px 18px;
    }

    .operation-panel h2 {
        margin-bottom: 14px;
    }

    .operation-buttons {
        grid-template-columns: repeat(4, 1fr);
        gap: 7px;
    }

    .operation-button {
        flex-direction: column;
        gap: 5px;
        padding: 8px 4px;
        font-size: 0.75rem;
    }

    .operation-symbol {
        width: 38px;
        height: 38px;
        flex-basis: 38px;
    }

    .challenge-panel {
        padding: 24px 16px 28px;
    }

    .game-status {
        align-items: flex-start;
        gap: 10px;
    }

    .game-level-status {
        align-items: flex-start;
        flex-direction: column;
        gap: 6px;
    }

    .question-area {
        min-height: 120px;
        gap: 8px;
        margin: 0 0 18px;
        padding: 0;
    }

    #answer-box {
        height: 72px;
    }

    .score-area {
        flex-wrap: wrap;
    }
}

@media (max-width: 390px) {
    .game-level-status .change-level-button {
        padding-inline: 8px;
        font-size: 0.8rem;
    }

    .game-level-status .level-summary {
        font-size: 0.8rem;
    }

    .brand {
        gap: 9px;
    }

    .logo {
        width: 54px;
        height: 54px;
    }

    .question-area {
        flex-wrap: wrap;
    }

    .answer-control {
        flex-basis: 100%;
        justify-content: center;
        margin-top: 4px;
    }

    #answer-box {
        height: 62px;
    }

    .star-counter {
        column-gap: 4px;
        padding: 6px 8px;
    }

    .star-counter .big-star {
        font-size: 1.5rem;
    }

    .star-counter #score {
        font-size: 1.3rem;
    }

    .star-counter .streak-label {
        margin-top: 4px;
        padding-top: 3px;
        font-size: 0.65rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition: none !important;
    }

    .star-counter.star-caught .big-star {
        animation-duration: 1ms;
    }
}
