:root {
    --bg1: #0f3d2e;
    --bg2: #1f6f54;
    --bg3: #2fa37a;
    --bg4: #6fd6b2;
    --white: #f7f7fb;
    --light-card: #f3f1f6;
    --light-item: #ece9f3;
    --text-dark: #2e355f;
    --text-soft: #596384;
    --purple: #2fa37a;
    --purple-dark: #0f3d2e;
    --yellow: #f8c332;
    --yellow-deep: #ebad0a;
    --green: #27c380;
    --green-soft: #d4f3e4;
    --red: #ff6a7b;
    --red-soft: #ffe4e7;
    --shadow: 0 28px 70px rgba(5, 40, 30, 0.35);
}

* { box-sizing: border-box; }
html, body { min-height: 100%; margin: 0; }
body {
    font-family: 'Nunito', sans-serif;
    background: radial-gradient(circle at top left, rgba(255, 202, 98, 0.18), transparent 16%),
                radial-gradient(circle at right center, rgba(111, 196, 255, 0.16), transparent 18%),
                linear-gradient(130deg, var(--bg1), var(--bg2) 56%, var(--bg4));
    color: #fff;
    overflow-x: hidden;
}
button { font: inherit; }
img { max-width: 100%; display: block; }
.hidden { display: none !important; }

.scene-bg { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
.bg-orb { position: absolute; border-radius: 999px; filter: blur(18px); opacity: .35; }
.orb-a { width: 230px; height: 230px; background: #ffbf59; top: 20px; left: 18px; }
.orb-b { width: 320px; height: 320px; background: #74c6ff; right: -40px; top: 120px; }
.orb-c { width: 260px; height: 260px; background: #ff88ca; left: 18%; bottom: -70px; }

/* .screen { width: min(1280px, calc(100% - 32px)); margin: 16px auto; position: relative; z-index: 1; } */
.screen { width: min(1320px, calc(100% - 32px)); margin: 16px auto; position: relative; z-index: 1; }
.intro-screen, .final-screen { min-height: calc(100vh - 32px); display: flex; align-items: center; }

.intro-card {
    width: 100%;
    min-height: calc(100vh - 32px);
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(320px, 420px);
    gap: 24px;
    background: linear-gradient(135deg, rgba(15, 61, 46, .96), rgba(10, 40, 32, .88));
    border-radius: 36px;
    padding: 32px;
    box-shadow: var(--shadow);
    border: 1px solid rgba(255,255,255,.10);
    overflow: hidden;
}
.intro-copy { display: flex; flex-direction: column; justify-content: center; }
.game-badge, .mission-chip, .story-tag, .panel-pill {
    display: inline-flex;
    align-items: center;
    padding: 12px 20px;
    border-radius: 999px;
    font-weight: 900;
    font-size: 1rem;
}
.game-badge { align-self: flex-start; background: rgba(255,255,255,.12); color: #fff4ac; }
.intro-copy h1, .game-header-copy h2, .question-box h3, .modal-card h3, .final-card h2 {
    font-family: 'Fredoka', sans-serif;
    line-height: 1.04;
    letter-spacing: -.02em;
}
.intro-copy h1 { font-size: clamp(2.6rem, 4.5vw, 4.4rem); margin: 18px 0 18px; }
.intro-copy p { max-width: 760px; font-size: 1.3rem; line-height: 1.65; color: rgba(255,255,255,.92); margin: 0 0 14px; }
.intro-actions { display: flex; gap: 14px; margin-top: 16px; flex-wrap: wrap; }
.intro-visual { position: relative; display: flex; align-items: center; justify-content: center; }
.intro-visual-glow {
    position: absolute; width: 320px; height: 320px; border-radius: 50%;
    background: radial-gradient(circle, rgba(255,255,255,.24), rgba(255,255,255,0));
}
.intro-mascot { width: min(100%, 360px); max-height: 500px; object-fit: contain; position: relative; z-index: 1; }

.btn {
    border: 0; cursor: pointer; border-radius: 20px; font-weight: 900;
    padding: 16px 24px; transition: transform .18s ease, box-shadow .18s ease, opacity .18s ease;
}
.btn:hover { transform: translateY(-2px); }
.btn:disabled { cursor: default; opacity: .65; transform: none; }
.btn-primary { background: var(--yellow); color: #2b2367; box-shadow: 0 14px 32px rgba(248, 195, 50, 0.28); }
.btn-secondary { background: rgba(255,255,255,.18); color: #1f225f; background: #ddd9e8; }
.btn-listen { padding: 15px 22px; border-radius: 18px; color: #22245f; background: #d8d4e4; }
.btn-hint { background: #ffe8a6; color: #40325f; }
.btn-light { background: #f0f2ff; color: #4338ca; padding-inline: 34px; }

.game-shell {
    min-height: calc(100vh - 32px);
    background: linear-gradient(135deg, rgba(15, 61, 46, .94), rgba(10, 40, 32, .88));
    border-radius: 36px;
    padding: 14px;
    box-shadow: var(--shadow);
    border: 1px solid rgba(255,255,255,.10);
}
.game-header {
    display: flex; justify-content: space-between; align-items: center; gap: 18px;
    padding: 8px 8px 18px;
}
.mission-chip { background: rgba(255,255,255,.12); color: #d7f3e7; }
.game-header-copy h2 { margin: 14px 0 0; font-size: clamp(1.8rem, 3vw, 2.9rem); }
.game-layout { display: grid; grid-template-columns: 1.12fr .96fr; gap: 18px; }
.visual-panel, .challenge-panel {
    border-radius: 32px; overflow: hidden;
}
.visual-panel { background: rgba(20, 92, 71, .60); border: 1px solid rgba(255,255,255,.08); }
.visual-panel-inner { padding: 16px; }
.visual-panel-top, .challenge-header, .challenge-tools, .visual-progress-top {
    display: flex; justify-content: space-between; align-items: center; gap: 12px;
}
.panel-pill, .story-tag { background: #1f8f6a; color: #e8fff6; }
.timer-badge, .score-badge {
    display: inline-flex; align-items: center; gap: 10px; padding: 16px 18px; border-radius: 20px;
    background: #f0b93f; color: #472f0a; font-weight: 900; min-width: 106px; justify-content: center;
}
.timer-badge.timer-ending { background: #ff7a7a; color: #fff; }
.figure-card {
    position: relative; min-height: 560px; margin: 16px 0 18px; border-radius: 28px; overflow: hidden;
    background: linear-gradient(180deg, #fff9e5, #ece9ff);
    display: flex; align-items: center; justify-content: center;
}
.target-image { width: 100%; height: 100%; object-fit: contain; position: relative; z-index: 1; padding: 22px; }
.figure-frame {
    position: absolute; inset: 0; border-radius: 28px; box-shadow: inset 0 0 0 6px rgba(255,255,255,.34); pointer-events: none;
}
.image-reveal-grid {
    position: absolute; inset: 0; z-index: 2; display: grid; grid-template-columns: repeat(4, 1fr); grid-template-rows: repeat(3, 1fr);
}
.reveal-tile { background: linear-gradient(135deg, #145c47, #2fa37a); opacity: 1; transition: opacity .24s ease, transform .24s ease; }
.reveal-tile.revealed { opacity: 0; transform: scale(.92); }
.visual-progress-box { background: rgba(11, 47, 38, .45); border-radius: 24px; padding: 18px; }
.visual-progress-top span { font-weight: 800; color: #fff; }
.visual-progress-top strong { color: #ffe79b; font-size: 1.1rem; }
.progress-track { height: 16px; border-radius: 999px; background: rgba(255,255,255,.16); margin-top: 12px; overflow: hidden; }
.progress-fill { height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, #2dd4bf, #f8c332); transition: width .25s ease; }
.progress-caption { margin-top: 10px; color: rgba(255,255,255,.82); font-weight: 700; }

.challenge-card {
    min-height: 100%; background: var(--light-card); color: var(--text-dark); border-radius: 32px; padding: 22px;
}
.question-box h3 { font-size: clamp(1.8rem, 2.8vw, 3.2rem); margin: 22px 0 14px; }
.question-text { font-size: 1.22rem; line-height: 1.55; color: #4f5982; margin: 0; }
.word-box {
    margin-top: 18px; padding: 16px; border-radius: 24px; background: #ffffff;
    box-shadow: inset 0 0 0 2px rgba(47, 163, 122, 0.08);
}
.word { display: flex; flex-wrap: wrap; gap: 12px; min-height: 86px; align-items: center; }
.word-slot, .word-space {
    width: 54px; height: 62px; border-radius: 18px; display: inline-flex; align-items: center; justify-content: center;
    font-family: 'Fredoka', sans-serif; font-size: 2rem; font-weight: 700;
}
.word-slot { background: #ece8f6; border: 3px solid #d4cdea; color: transparent; }
.word-slot.reveal { background: #fff4c6; border-color: #f8c332; color: #2f3562; }
.word-space { width: 24px; background: transparent; }
.feedback-inline {
    margin-top: 18px; padding: 18px 20px; border-radius: 22px; font-size: 1.08rem; font-weight: 800;
}
.feedback-inline.neutral { background: #e8e6ef; color: #4f5982; }
.feedback-inline.success { background: var(--green-soft); color: #0f7a47; }
.feedback-inline.error { background: var(--red-soft); color: #c53d4d; }
.challenge-tools { margin-top: 16px; }
.status-note { font-weight: 900; color: #5a6489; }
.keyboard-box { margin-top: 18px; }
.letters { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; }
.key-btn {
    border: 0; border-radius: 18px; min-height: 62px; background: #e7e4ef; color: #2f3562;
    font-family: 'Fredoka', sans-serif; font-size: 1.5rem; font-weight: 700; cursor: pointer;
    transition: transform .16s ease, box-shadow .16s ease, background .16s ease;
}
.key-btn:hover { transform: translateY(-2px); box-shadow: 0 12px 22px rgba(49, 42, 118, 0.12); }
.key-btn.correct { background: #c8f1d9; color: #0f7a47; }
.key-btn.wrong { background: #ffd6dc; color: #bf4050; }
.key-btn:disabled { cursor: default; }

.modal-overlay {
    position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; padding: 24px;
    background: rgba(10, 32, 24, .52); backdrop-filter: blur(8px);
}
.modal-card {
    width: min(100%, 700px); position: relative; border-radius: 34px; text-align: center; padding: 30px 28px 28px;
    box-shadow: 0 34px 90px rgba(10, 5, 34, 0.32);
}
.modal-card-light { background: #f6f4f8; color: var(--text-dark); }
.modal-card-dark {
    background: linear-gradient(180deg, rgba(16, 67, 52, .95), rgba(7, 28, 21, .97));
    color: #fff;
    box-shadow: 0 30px 90px rgba(0,0,0,.5);
}
.modal-card-wide { width: min(100%, 720px); }
.modal-card-small { width: min(100%, 560px); }
.modal-card-feedback { width: min(100%, 560px); }
.modal-close {
    position: absolute; top: 18px; right: 18px; width: 48px; height: 48px; border-radius: 50%; border: 0;
    background: rgba(0,0,0,.06); color: #667085; cursor: pointer; font-size: 1.5rem;
}
.modal-close-dark { background: rgba(255,255,255,.10); color: #fff; }
.modal-icon {
    width: 86px; height: 86px; border-radius: 28px; display: inline-flex; align-items: center; justify-content: center;
    font-size: 2.3rem; margin: 8px auto 18px;
}
.modal-icon-book { background: #dfe8f7; }
.modal-icon-hint { background: linear-gradient(180deg, #ffd32e, #ffb400); color: #2c2100; }
.modal-icon-positive { background: #d8f2e2; }
.modal-card h3 { font-size: clamp(2rem, 3vw, 2.7rem); margin: 4px 0 16px; }
.modal-card p { font-size: 1.2rem; line-height: 1.65; margin: 0; }
.instruction-list { display: grid; gap: 16px; margin-top: 20px; text-align: left; }
.instruction-item {
    display: flex; align-items: center; gap: 16px; background: #ece9ed; border-radius: 22px; padding: 16px 18px;
}
.instruction-item span {
    width: 46px; height: 46px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
    background: linear-gradient(180deg, #36a67d, #1f8f6a); color: #fff; font-weight: 900; font-size: 1.25rem;
    flex: 0 0 auto;
}
.instruction-item p { margin: 0; color: #49547c; font-size: 1.12rem; }
.modal-action { margin-top: 24px; min-width: 160px; }

.final-card {
    width: min(760px, 100%); margin: 0 auto; background: #f6f4f8; color: var(--text-dark); border-radius: 34px;
    padding: 32px; text-align: center; box-shadow: var(--shadow);
}
.final-card h2 { font-size: clamp(2rem, 3vw, 2.9rem); margin: 10px 0 14px; }
.final-card p { font-size: 1.15rem; line-height: 1.6; color: #55607f; }
.final-topics { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-top: 24px; margin-bottom: 24px; }
.topic-card {
    background: #ece9f3; border-radius: 18px; padding: 16px; font-weight: 900; color: #39426d;
}

@media (max-width: 1080px) {
    .game-layout, .intro-card { grid-template-columns: 1fr; }
    .intro-card, .game-shell { min-height: auto; }
    .figure-card { min-height: 420px; }
}

@media (max-width: 720px) {
    .screen { width: min(100%, calc(100% - 16px)); margin: 8px auto; }
    .intro-card, .game-shell, .challenge-card { border-radius: 24px; padding: 18px; }
    .game-header { flex-direction: column; align-items: stretch; }
    .letters { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .word-slot { width: 44px; height: 52px; font-size: 1.6rem; }
    .question-box h3 { font-size: 1.9rem; }
    .modal-card { border-radius: 24px; padding: 24px 18px; }
    .instruction-item { align-items: flex-start; }
}


:root {
    --bg1-strong: #0b2f26;
    --bg2-strong: #145c47;
    --bg3-strong: #1fa37a;
    --purple-panel: #123c32;
    --purple-panel-2: #1b5e4a;
    --page-soft: #f4f0f8;
    --title-dark: #2e326a;
    --body-dark: #536082;
    --success-soft-2: #d9f0df;
    --danger-soft-2: #f7d8dd;
    --keyboard-soft: #e9e5f1;
    --keyboard-border: #d6cfeb;
    --yellow-strong: #f2bf2d;
    --blue-chip: #1f8f6a;
}

body {
    background:
        radial-gradient(circle at 7% 17%, rgba(255, 181, 132, .34) 0%, transparent 13%),
        radial-gradient(circle at 93% 84%, rgba(106, 173, 255, .32) 0%, transparent 18%),
        radial-gradient(circle at 24% 93%, rgba(255, 124, 194, .20) 0%, transparent 14%),
        linear-gradient(130deg, var(--bg1-strong), var(--bg2-strong) 56%, var(--bg3-strong));
}

.game-shell {
    background: linear-gradient(180deg, rgba(20, 92, 71, .98), rgba(11, 47, 38, .95));
    padding: 16px;
}

.game-header {
    align-items: flex-start;
    padding: 10px 8px 20px;
}

.game-header-copy {
    flex: 1 1 auto;
    min-width: 0;
}

.game-header-copy h2 {
    font-size: clamp(2rem, 3.4vw, 3.5rem);
    color: #ffffff;
    margin-bottom: 14px;
}

.overall-progress-box {
    display: flex;
    align-items: center;
    gap: 14px;
    max-width: 560px;
}

.overall-progress-track {
    flex: 1 1 auto;
    height: 18px;
    border-radius: 999px;
    background: rgba(255,255,255,.18);
    overflow: hidden;
    box-shadow: inset 0 0 0 2px rgba(255,255,255,.06);
}

.overall-progress-fill {
    height: 100%;
    width: 0;
    border-radius: inherit;
    background: linear-gradient(90deg, #48d6c7, #8fe66c, #f2bf2d);
    transition: width .3s ease;
}

.overall-progress-text {
    font-weight: 900;
    color: rgba(255,255,255,.92);
    white-space: nowrap;
}

.visual-panel {
    background: rgba(20, 92, 71, .55);
}

.visual-panel-inner {
    background: linear-gradient(180deg, rgba(20, 92, 71, .95), rgba(11, 47, 38, .98));
    border-radius: 28px;
    padding: 16px;
    min-height: 100%;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.08);
}

.panel-pill, .story-tag {
    background: var(--blue-chip);
    color: #e8efff;
}

.figure-card {
    min-height: 520px;
    background: #dfeffe;
    border: 14px solid #f5efcf;
    box-shadow: inset 0 0 0 6px rgba(255,255,255,.34);
}

.reveal-tile {
    background: linear-gradient(180deg, rgba(11, 47, 38, 1), rgba(47, 163, 122, 1));
}

.reveal-tile:not(.revealed) {
    visibility: visible;
}


.visual-progress-box {
    background: rgba(11, 47, 38, .78);
}

.challenge-card {
    background: var(--page-soft);
    padding: 18px 18px 16px;
}

.question-box h3 {
    color: var(--title-dark);
    font-size: clamp(2.4rem, 3.2vw, 3.6rem);
    margin: 18px 0 10px;
}

.question-text {
    color: var(--body-dark);
}

.word-box {
    background: #f9f7fb;
    box-shadow: none;
}

.word-slot {
    background: #f6e7b7;
    border-color: #efbf2f;
    color: #2f3562;
}

.word-slot:empty {
    background: #e7e1f1;
    border-color: #cfc7e5;
    color: transparent;
}

.feedback-inline.neutral {
    background: #e8e6ef;
    color: #5a6283;
}

.feedback-inline.success {
    background: var(--success-soft-2);
    color: #198454;
}

.feedback-inline.error {
    background: var(--danger-soft-2);
    color: #d13f56;
}

.status-note {
    color: #5e6889;
}

.key-btn {
    background: var(--keyboard-soft);
    border: 2px solid transparent;
    color: #2f3d78;
    min-height: 58px;
}

.key-btn.correct {
    background: #bfe9cf;
    color: #158255;
}

.key-btn.wrong {
    background: #f4d9df;
    color: #cf435b;
}

.modal-overlay {
    background: rgba(10, 32, 24, .46);
    backdrop-filter: blur(9px);
}

.modal-card-light {
    background: #f6f4f8;
}

.modal-card-feedback {
    width: min(100%, 520px);
    padding-top: 18px;
}

.modal-card-feedback .modal-icon {
    width: 80px;
    height: 80px;
    border-radius: 24px;
    margin-bottom: 10px;
}

.modal-card-feedback h3 {
    color: #333d72;
    font-size: clamp(2rem, 2.8vw, 3rem);
    margin-top: 8px;
    margin-bottom: 12px;
}

.modal-card-feedback p {
    color: #57617f;
    font-size: 1.12rem;
    max-width: 400px;
    margin: 0 auto;
}

.modal-card-dark {
    width: min(100%, 560px);
    border-radius: 30px;
    padding-top: 26px;
}

.modal-card-dark h3 {
    color: #ffffff;
    margin-top: 8px;
}

.modal-card-dark p {
    color: rgba(255,255,255,.92);
    max-width: 420px;
    margin: 0 auto 20px;
}

.modal-close {
    background: rgba(0,0,0,.05);
}

.modal-close-dark {
    background: rgba(255,255,255,.12);
}

.modal-action,
.btn-light,
.btn-primary {
    border-radius: 18px;
}

.timer-badge {
    background: #ff8b8b;
    color: #ffffff;
}

.score-badge {
    background: var(--yellow-strong);
    color: #533804;
}

@media (max-width: 1080px) {
    .overall-progress-box {
        max-width: 100%;
    }

    .figure-card {
        min-height: 420px;
    }
}

@media (max-width: 720px) {
    .overall-progress-box {
        flex-direction: column;
        align-items: stretch;
    }

    .overall-progress-text {
        text-align: center;
    }
}

.visual-progress-top {
    display: none;
}

h3#questionTitle {
    display: none;
}

.question-text {
    color: var(--title-dark);
    font-size: clamp(2.4rem, 3.2vw, 3.6rem);
    margin: 18px 0 10px;
    font-size: 35px!important;
}

.status-note {
    display: none;
}