:root {
    --pink: #ffe8f0;
    --pink-dark: #ffb6cc;
    --hot-pink: #f477a3;
    --purple: #a78bdb;
    --yellow: #ffe49b;
    --white: #fffdfd;
    --ink: #514052;
    --green: #9bd9b5;
    --red: #ff9b9b;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Trebuchet MS", "Myanmar Text", "Padauk", Arial, sans-serif;
    background: var(--pink);
    color: var(--ink);
    min-height: 100vh;
}

button {
    font: inherit;
    cursor: pointer;
    border: none;
}

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

.topbar {
    background: var(--white);
    border-bottom: 4px solid var(--pink-dark);
    padding: 18px 5%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.brand {
    color: var(--hot-pink);
    font-size: clamp(27px, 5vw, 42px);
    font-weight: 1000;
    letter-spacing: 2px;
    text-shadow: 2px 3px 0 #ffe0e9;
}

.player-info {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: bold;
}

.level-pill,
.score-pill {
    background: #fff0b8;
    padding: 9px 15px;
    border-radius: 30px;
    border: 2px solid #f5d77e;
}

.hero {
    text-align: center;
    padding: 25px 15px 12px;
}

.hero-animals {
    font-size: clamp(28px, 6vw, 48px);
    letter-spacing: 8px;
    margin-bottom: 8px;
}

.hero p {
    margin: 8px auto;
    max-width: 650px;
    line-height: 1.6;
    color: #806a7b;
}

.progress-wrap {
    max-width: 700px;
    margin: 20px auto;
    padding: 0 18px;
}

.progress-label {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    font-weight: bold;
    margin-bottom: 7px;
}

.progress-track {
    height: 13px;
    background: #fff;
    border-radius: 30px;
    overflow: hidden;
}

.progress-fill {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, #ff9fbd, #b99be9);
    border-radius: 30px;
    transition: width .3s;
}

.main {
    max-width: 1100px;
    padding: 10px 18px 60px;
    margin: auto;
}

.section-heading {
    text-align: center;
    margin: 28px 0 18px;
    font-size: 23px;
}

.game-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 18px;
}

.game-card {
    background: var(--white);
    border: 3px solid white;
    border-radius: 25px;
    padding: 22px 18px;
    box-shadow: 0 6px 0 #f4c4d4;
    transition: transform .2s, box-shadow .2s;
    position: relative;
    overflow: hidden;
}

.game-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 0 #f4c4d4;
}

.game-card .animal {
    font-size: 45px;
}

.game-card h3 {
    margin: 10px 0 6px;
    font-size: 19px;
}

.game-card p {
    font-size: 13px;
    line-height: 1.5;
    color: #897789;
    min-height: 40px;
}

.game-tag {
    display: inline-block;
    font-size: 11px;
    padding: 5px 10px;
    background: #f4eaff;
    border-radius: 20px;
    margin-bottom: 12px;
}

.play-btn,
.primary-btn {
    background: var(--hot-pink);
    color: white;
    border-radius: 14px;
    padding: 11px 18px;
    font-weight: bold;
    box-shadow: 0 4px 0 #d95c87;
    transition: .15s;
}

.play-btn:hover,
.primary-btn:hover {
    filter: brightness(1.04);
    transform: translateY(-2px);
}

.play-btn:active,
.primary-btn:active {
    transform: translateY(2px);
    box-shadow: none;
}

.game-area {
    display: none;
    background: var(--white);
    border: 3px solid white;
    border-radius: 26px;
    padding: clamp(18px, 4vw, 32px);
    margin-top: 25px;
    box-shadow: 0 7px 0 #f4c4d4;
}

.game-area.active {
    display: block;
}

.game-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    border-bottom: 2px dashed #f4ccda;
    padding-bottom: 15px;
    margin-bottom: 20px;
}

.game-top h2 {
    margin: 0;
    color: var(--hot-pink);
}

.close-btn {
    background: #f4eaff;
    color: #8468a8;
    border-radius: 12px;
    padding: 9px 13px;
    font-weight: bold;
}

.instruction {
    background: #fff4d4;
    border-radius: 15px;
    padding: 13px 16px;
    line-height: 1.8;
    margin-bottom: 18px;
}

.question-number {
    color: #a18bb4;
    font-weight: bold;
    font-size: 13px;
    margin-bottom: 8px;
}

.question {
    font-size: clamp(18px, 3vw, 23px);
    font-weight: bold;
    line-height: 1.8;
    margin: 10px 0 20px;
}

.options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
}

.option-btn {
    background: #fff0f5;
    border: 2px solid #ffd0df;
    border-radius: 16px;
    padding: 15px;
    color: var(--ink);
    font-size: 16px;
    font-weight: bold;
    text-align: left;
    transition: .15s;
    line-height: 1.6;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.option-btn:hover {
    background: #ffe1ec;
    transform: translateY(-2px);
}

.option-btn.correct {
    background: #e4f8eb;
    border-color: #8bcda5;
}

.option-btn.wrong {
    background: #ffe7e7;
    border-color: #ff9b9b;
}

.option-label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 26px;
    height: 26px;
    border-radius: 50%;
    background: #ffffff;
    border: 2px solid #ffd0df;
    color: var(--hot-pink);
    font-size: 14px;
    font-weight: 900;
    flex-shrink: 0;
}

.option-btn.correct .option-label {
    border-color: #8bcda5;
    color: #2f8a57;
}

.option-btn.wrong .option-label {
    border-color: #ff9b9b;
    color: #cf4f5c;
}

.feedback {
    min-height: 28px;
    font-weight: bold;
    margin: 17px 0 5px;
    line-height: 1.6;
}

.feedback.good {
    color: #319b62;
}

.feedback.bad {
    color: #df6b76;
}

.next-btn {
    display: none;
    background: var(--purple);
    color: white;
    padding: 12px 22px;
    border-radius: 14px;
    font-weight: bold;
    margin-top: 12px;
}

.next-btn.show {
    display: inline-block;
}

.teacher-box {
    margin-top: 18px;
    padding: 14px;
    background: #f4efff;
    border-radius: 15px;
    line-height: 1.8;
}

.teacher-box summary {
    cursor: pointer;
    font-weight: bold;
    color: #8b6db8;
}

.teacher-script {
    margin-top: 12px;
    line-height: 1.8;
}

.word-large {
    font-size: clamp(25px, 5vw, 38px);
    color: var(--hot-pink);
    text-align: center;
    margin: 18px 0;
    font-weight: 900;
}

.chunk-card {
    background: #fff2f7;
    padding: 16px;
    border-radius: 16px;
    margin: 10px 0;
    text-align: center;
    font-size: 20px;
    font-weight: bold;
}

.answer-input {
    width: 100%;
    padding: 14px;
    border: 2px solid #f4c4d4;
    border-radius: 14px;
    font-size: 17px;
    color: var(--ink);
    margin: 8px 0;
}

.answer-input:focus {
    outline: 2px solid var(--purple);
}

.result-panel {
    display: none;
    text-align: center;
    background: #fff4d4;
    padding: 25px;
    border-radius: 20px;
    margin-top: 20px;
}

.result-panel.show {
    display: block;
}

.result-panel .big-emoji {
    font-size: 55px;
}

.result-panel h3 {
    font-size: 25px;
    color: var(--hot-pink);
}

.restart-btn {
    background: var(--green);
    color: #315f47;
    padding: 12px 20px;
    border-radius: 14px;
    font-weight: bold;
    margin-top: 10px;
}

/* TTS & navigation additions */
.audio-btn {
    background: #e9dbff;
    border: 2px solid #c5aaff;
    border-radius: 40px;
    padding: 10px 20px;
    font-weight: bold;
    color: #4c3570;
    margin: 8px 6px 8px 0;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: .15s;
}

.audio-btn:hover {
    background: #dcc9ff;
}

.audio-btn:active {
    transform: translateY(2px);
}

.nav-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 18px;
    justify-content: center;
    align-items: center;
}

.nav-btn {
    padding: 12px 24px;
    border-radius: 30px;
    font-weight: bold;
    background: #ffffff;
    border: 2px solid var(--pink-dark);
    color: var(--ink);
    box-shadow: 0 3px 0 #e7b8ca;
    transition: .15s;
}

.nav-btn:hover {
    background: #fff4fa;
}

.nav-btn.home {
    background: #ffe9a7;
    border-color: #e6c45c;
    color: #604d2a;
}

.nav-btn:active {
    transform: translateY(2px);
    box-shadow: none;
}

.nav-btn[disabled] {
    opacity: 0.4;
    pointer-events: none;
}

/* Blind Dictation game styles */
.dictation-layout {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 18px;
    margin-top: 10px;
}

.dictation-panel {
    background: #fffaf5;
    border: 2px solid #f6b4cf;
    border-radius: 22px;
    padding: 18px;
    box-shadow: 0 7px 0 #f3bfd4;
}

.dictation-panel h2 {
    font-size: 1.1rem;
    margin: 0 0 12px;
    color: #b84f7b;
}

.round-list {
    display: grid;
    gap: 9px;
}

.round-btn {
    border: 1px solid #f0b4ce;
    background: #fff;
    border-radius: 14px;
    padding: 12px;
    text-align: left;
    color: var(--ink);
    font-weight: 700;
    cursor: pointer;
    transition: .15s;
}

.round-btn.active,
.round-btn:hover {
    background: #ffe1ed;
    border: 2px solid #e978a3;
}

.round-btn small {
    display: block;
    font-weight: 500;
    color: #94677d;
    margin-top: 3px;
}

.dictation-game {
    background: #fffaf5;
    border: 2px solid #f6b4cf;
    border-radius: 22px;
    padding: 18px;
    box-shadow: 0 7px 0 #f3bfd4;
}

.dictation-game h2 {
    margin: 0;
    color: #b84f7b;
    font-size: 1.55rem;
}

.dictation-meta {
    color: #96677d;
    font-size: .92rem;
    margin: 5px 0 14px;
}

.dictation-instructions {
    background: #fff0f6;
    border-radius: 14px;
    padding: 12px;
    margin: 12px 0;
}

.dictation-controls {
    display: flex;
    gap: 9px;
    flex-wrap: wrap;
    margin: 12px 0;
}

.dictation-action {
    background: #e978a3;
    color: white;
    border: 0;
    border-radius: 12px;
    padding: 10px 15px;
    font-weight: 700;
    cursor: pointer;
}

.dictation-action.secondary {
    background: #f5d7e5;
    color: #80415e;
}

.dictation-action:disabled {
    opacity: .45;
    cursor: not-allowed;
}

.dictation-textarea {
    width: 100%;
    min-height: 150px;
    border: 2px solid #efb2cb;
    border-radius: 14px;
    padding: 13px;
    font: 1.05rem/1.8 system-ui;
    background: #fff;
    resize: vertical;
    color: #382431;
}

.dictation-textarea:focus {
    outline: 3px solid #ffd0e2;
}

.dictation-stats {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin: 12px 0;
}

.dictation-stat {
    background: #fff0f6;
    border-radius: 12px;
    padding: 9px 12px;
    font-weight: 700;
}

.dictation-result {
    display: none;
    margin-top: 14px;
    padding: 14px;
    border-radius: 14px;
    background: #f5efff;
    line-height: 1.8;
}

.dictation-result.show {
    display: block;
}

.dictation-answer {
    white-space: pre-wrap;
    background: #fff;
    border-radius: 10px;
    padding: 12px;
    margin-top: 8px;
}

.dictation-feedback {
    font-weight: 700;
    color: #8b4263;
}

.dictation-progress {
    height: 10px;
    background: #f8d5e4;
    border-radius: 99px;
    overflow: hidden;
    margin: 10px 0 18px;
}

.dictation-progress span {
    display: block;
    height: 100%;
    background: #e978a3;
    width: 0;
    transition: width .3s;
}

@media (max-width: 600px) {
    .topbar {
        justify-content: center;
    }

    .player-info {
        width: 100%;
        justify-content: center;
    }

    .game-card {
        padding: 18px;
    }

    .dictation-layout {
        grid-template-columns: 1fr;
    }

    .round-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .round-btn {
        font-size: .9rem;
        padding: 10px;
    }
}