:root {
    --navy: #06224a;
    --navy-2: #0b356b;
    --navy-3: #092a58;
    --gold: #f4b74c;
    --gold-2: #ffd98c;
    --teal: #09a6a0;
    --teal-dark: #078880;
    --coral: #f36a4b;
    --cream: #fffaf0;
    --paper: #fff7e9;
    --ink: #142344;
    --muted: #66708a;
    --line: rgba(25, 38, 68, 0.12);
    --shadow: 0 22px 46px rgba(2, 18, 44, 0.18);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: "Nunito", sans-serif;
    color: var(--ink);
    background:
        radial-gradient(circle at 8% 8%, rgba(244, 183, 76, 0.16), transparent 20%),
        linear-gradient(180deg, #f7efe1 0%, #fff7e9 42%, #f3e2c8 100%);
}

body.screen-shake {
    animation: screen-shake 420ms ease-in-out 2;
}

button {
    font: inherit;
}

.app-shell {
    width: min(1480px, calc(100vw - 14px));
    margin: 0 auto;
    padding: 10px 0 16px;
}

.top-nav {
    position: sticky;
    top: 0;
    z-index: 20;
    display: grid;
    grid-template-columns: 260px 1fr 260px;
    align-items: stretch;
    min-height: 92px;
    border-radius: 8px 8px 0 0;
    overflow: hidden;
    background:
        linear-gradient(135deg, rgba(244, 183, 76, 0.08), transparent 18%),
        linear-gradient(90deg, #09264e 0%, #06214b 52%, #082b62 100%);
    box-shadow: 0 12px 28px rgba(2, 18, 44, 0.22);
}

.brand-lockup {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 22px;
    color: #fff;
}

.brand-mascot {
    display: grid;
    place-items: center;
    width: 58px;
    height: 58px;
    border-radius: 14px;
    background: transparent;
    color: var(--navy);
    font-size: 2rem;
    box-shadow: inset 0 -5px 0 rgba(244, 183, 76, 0.38);
}

.brand-name {
    font-family: "Fredoka", sans-serif;
    font-size: 1.55rem;
    font-weight: 700;
    color: var(--gold-2);
}

.brand-subtitle {
    margin-top: 2px;
    font-size: 0.82rem;
    font-weight: 800;
    color: rgba(255, 255, 255, 0.74);
}

.main-tabs {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    justify-items: center;
    align-items: end;
}

.nav-tab {
    width: 100%;
    height: 100%;
    min-height: 92px;
    border: 0;
    border-left: 1px solid rgba(255, 255, 255, 0.06);
    background: transparent;
    color: rgba(255, 255, 255, 0.72);
    cursor: pointer;
}

.nav-tab span {
    display: block;
    margin-bottom: 8px;
    font-size: 1.25rem;
}

.nav-tab strong {
    display: block;
    font-size: 0.92rem;
}

.nav-tab.is-active {
    color: #fff;
    background: linear-gradient(180deg, rgba(244, 183, 76, 0.08), rgba(244, 183, 76, 0.2));
    box-shadow: inset 0 0 0 1px rgba(244, 183, 76, 0.8);
}

.profile-chip {
    display: grid;
    grid-template-columns: 54px 1fr 26px;
    align-items: center;
    gap: 10px;
    margin: 16px 18px 16px 8px;
    padding: 8px 12px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 28px;
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    cursor: pointer;
}

.profile-avatar {
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    border-radius: 18px;
    background: #ffe0a8;
    font-size: 1.65rem;
}

.profile-chip strong,
.profile-chip small {
    display: block;
    text-align: left;
}

.profile-chip strong {
    font-size: 0.88rem;
}

.profile-chip small {
    color: rgba(255, 255, 255, 0.72);
}

.learning-board {
    display: grid;
    grid-template-columns: 350px minmax(0, 1fr);
    gap: 18px;
    min-height: 780px;
    background: linear-gradient(90deg, #07244d 0 350px, rgba(255, 251, 243, 0.96) 350px);
    border-radius: 0 0 8px 8px;
    box-shadow: var(--shadow);
}

.story-library {
    position: relative;
    overflow: hidden;
    padding: 28px 24px;
    color: #fff;
    background:
        radial-gradient(circle at 82% 20%, rgba(244, 183, 76, 0.18), transparent 18%),
        radial-gradient(circle at 92% 82%, rgba(244, 94, 67, 0.2), transparent 17%),
        linear-gradient(180deg, #0b315f 0%, #06214b 100%);
}

.story-library::before,
.app-footer::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: 0.18;
    background-image:
        linear-gradient(45deg, transparent 47%, rgba(255, 215, 140, 0.8) 48%, transparent 49%),
        radial-gradient(circle at 14px 14px, rgba(255, 215, 140, 0.55) 1px, transparent 2px);
    background-size: 64px 64px, 28px 28px;
}

.library-header {
    position: relative;
    z-index: 1;
    margin-bottom: 22px;
}

.library-header span {
    color: var(--gold-2);
    font-size: 0.95rem;
    font-weight: 900;
}

.library-header h1 {
    margin: 8px 0 0;
    font-family: "Fredoka", sans-serif;
    font-size: 1.72rem;
    line-height: 1.05;
}

.level-pill,
.library-more {
    position: relative;
    z-index: 1;
    width: 100%;
    display: grid;
    grid-template-columns: 34px 1fr 20px;
    align-items: center;
    gap: 10px;
    padding: 13px 18px;
    border: 1px solid rgba(244, 183, 76, 0.42);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.07);
    color: var(--gold-2);
    text-align: left;
    cursor: pointer;
}

.library-list {
    position: relative;
    z-index: 1;
    display: grid;
    gap: 12px;
    margin: 18px 0;
}

.library-empty {
    padding: 16px 18px;
    border: 1px dashed rgba(255, 255, 255, 0.26);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.9);
    font-weight: 800;
    line-height: 1.45;
}

.library-item {
    display: grid;
    grid-template-columns: 74px 1fr 28px;
    gap: 12px;
    align-items: center;
    min-height: 86px;
    padding: 9px;
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
    cursor: pointer;
}

.library-item.is-active {
    background: linear-gradient(135deg, #ffe9aa, #ffd176);
    color: var(--navy);
    border-color: #fff1b9;
}

.library-thumb {
    width: 70px;
    height: 64px;
    border-radius: 8px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.18);
}

.library-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.library-item strong,
.library-item small {
    display: block;
    text-align: left;
}

.library-item strong {
    font-size: 0.92rem;
    line-height: 1.15;
}

.library-item small {
    margin-top: 5px;
    opacity: 0.78;
}

.signal-bars {
    display: flex;
    align-items: end;
    gap: 3px;
    justify-content: center;
}

.signal-bars span {
    display: block;
    width: 4px;
    border-radius: 8px;
    background: var(--gold);
}

.signal-bars span:nth-child(1) { height: 7px; }
.signal-bars span:nth-child(2) { height: 12px; }
.signal-bars span:nth-child(3) { height: 18px; }

.mentor-card {
    position: relative;
    z-index: 1;
    min-height: 210px;
    margin-top: 32px;
}

.mentor-panda {
    position: absolute;
    left: 10px;
    bottom: 0;
    font-size: 6.6rem;
    filter: drop-shadow(0 14px 20px rgba(0, 0, 0, 0.25));
}

.mentor-bubble {
    position: absolute;
    right: 0;
    top: 16px;
    width: 150px;
    padding: 14px;
    border-radius: 18px;
    background: transparent;
    color: var(--ink);
    font-size: 0.78rem;
    font-weight: 800;
    line-height: 1.35;
}

.reader-panel {
    padding: 18px 18px 18px 0;
}

.reader-frame {
    position: relative;
    min-height: 780px;
    padding: 34px 36px 28px;
    border: 1px solid rgba(194, 147, 67, 0.34);
    border-radius: 8px;
    background:
        radial-gradient(circle at 8% 8%, rgba(244, 183, 76, 0.12), transparent 18%),
        linear-gradient(180deg, #fffdf8 0%, #fff7e9 100%);
    box-shadow: 0 12px 26px rgba(10, 28, 59, 0.12);
}

.reader-corners::before,
.reader-corners::after {
    content: "";
    position: absolute;
    top: 12px;
    color: rgba(198, 139, 42, 0.62);
    font-size: 2rem;
}

.reader-corners::before { left: 18px; }
.reader-corners::after { right: 18px; transform: scaleX(-1); }

.reader-header {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 24px;
    align-items: start;
}

.story-kicker {
    margin: 0 0 10px;
    color: #f05b7b;
    font-size: 0.82rem;
    font-weight: 900;
}

.story-title {
    margin: 0;
    font-family: "Fredoka", sans-serif;
    font-size: 3rem;
    line-height: 1;
    color: #09264e;
}

.story-summary {
    margin: 12px 0 0;
    color: #52607a;
    font-size: 1rem;
    font-weight: 800;
}

.meta-strip {
    display: grid;
    grid-template-columns: repeat(3, 106px);
    gap: 14px;
}

.meta-pill {
    min-height: 108px;
    padding: 18px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.72);
    text-align: center;
}

.meta-pill span {
    display: block;
    color: var(--teal);
    font-size: 0.78rem;
    font-weight: 900;
    text-transform: uppercase;
}

.meta-pill:nth-child(2) span { color: var(--coral); }
.meta-pill:nth-child(3) span { color: #4c6de8; }

.meta-pill strong {
    display: block;
    margin-top: 8px;
    font-family: "Fredoka", sans-serif;
    font-size: 2rem;
    color: var(--teal);
}

.meta-pill:nth-child(2) strong { color: var(--coral); }
.meta-pill:nth-child(3) strong { color: #4c6de8; }

.hero-stage {
    position: relative;
    aspect-ratio: 1536 / 782;
    height: auto;
    margin-top: 12px;
    border-radius: 8px;
    overflow: hidden;
    background: #d7f3ff;
    box-shadow: 0 16px 30px rgba(10, 28, 59, 0.12);
}

.hero-artwork {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center center;
}

.audio-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 260px;
    gap: 18px;
    margin-top: 22px;
}

.audio-grid--hero {
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
    margin-top: 8px;
    margin-bottom: 8px;
}

.audio-grid--hero .story-player--compact {
    min-height: 0;
}

.audio-grid--hero .story-player {
    grid-template-columns: 48px 1fr;
    gap: 12px;
    padding: 10px 16px;
    min-height: 0;
}

.audio-grid--hero .story-play-button {
    width: 44px;
    height: 44px;
    font-size: 1.1rem;
}

.audio-grid--hero .story-player-top {
    margin-bottom: 6px;
}

.audio-grid--hero .waveform span {
    height: 18px;
}

.story-player,
.word-focus-card,
.word-strip,
.speed-toolbar,
.story-pages,
.dashboard-row > article {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.74);
    box-shadow: 0 10px 20px rgba(10, 28, 59, 0.07);
}

.story-player {
    display: grid;
    grid-template-columns: 78px 1fr;
    align-items: center;
    gap: 18px;
    padding: 24px 28px;
}

.story-play-button {
    display: grid;
    place-items: center;
    width: 66px;
    height: 66px;
    border: 0;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--teal), #14c7b8);
    color: #fff;
    font-size: 1.55rem;
    cursor: pointer;
    box-shadow: 0 16px 24px rgba(9, 166, 160, 0.28);
}

.story-play-button.is-paused {
    background: linear-gradient(135deg, #4aa6ff, #5d7dff);
    box-shadow: 0 16px 24px rgba(76, 109, 232, 0.22);
}

.story-player-top {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
    color: #43506a;
    font-size: 0.88rem;
    font-weight: 900;
}

.waveform {
    display: flex;
    align-items: center;
    gap: 4px;
    height: 38px;
}

.waveform span {
    flex: 1;
    max-width: 7px;
    min-width: 3px;
    border-radius: 8px;
    background: #13b6b0;
}

.waveform span:nth-child(2n) { height: 20px; }
.waveform span:nth-child(3n) { height: 34px; }
.waveform span:nth-child(4n) { height: 14px; background: #d9dde4; }
.waveform span:nth-child(5n) { height: 28px; }

.word-focus-card {
    position: relative;
    padding: 22px;
    text-align: center;
}

.word-focus-card > div:first-child {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--teal);
    font-size: 0.86rem;
    font-weight: 900;
}

.tiny-icon,
.focus-arrows button {
    border: 1px solid rgba(9, 166, 160, 0.28);
    border-radius: 50%;
    background: #f5fffd;
    color: var(--teal);
    cursor: pointer;
}

.tiny-icon {
    width: 32px;
    height: 32px;
}

.word-focus-card strong {
    display: block;
    margin-top: 18px;
    color: var(--teal-dark);
    font-family: "Fredoka", sans-serif;
    font-size: 1.8rem;
}

.word-focus-card small {
    display: block;
    margin-top: 8px;
    color: var(--muted);
    font-size: 1rem;
}

.focus-arrows {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 14px;
}

.focus-arrows button {
    width: 30px;
    height: 30px;
}

.word-strip {
    margin-top: 20px;
    padding: 18px;
    background: linear-gradient(180deg, rgba(255, 248, 232, 0.9), rgba(255, 252, 246, 0.82));
}

.word-focus-row {
    display: flex;
    justify-content: flex-end;
    margin-top: 12px;
}

.word-focus-row .word-focus-card {
    width: min(260px, 100%);
}

.sentence-list {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
}

.sentence-empty {
    width: 100%;
    padding: 18px 20px;
    border: 1px dashed rgba(12, 188, 177, 0.32);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.72);
    color: #42506a;
    font-weight: 800;
    line-height: 1.45;
    text-align: center;
}

.sentence-card {
    display: contents;
}

.sentence-scene,
.sentence-tag,
.sentence-play {
    display: none;
}

.sentence-content {
    display: contents;
}

.sentence-line {
    display: contents;
}

.word-button {
    min-width: 72px;
    min-height: 42px;
    border: 1px solid rgba(9, 166, 160, 0.26);
    border-radius: 8px;
    padding: 8px 14px;
    background: #f4fffd;
    color: #127d78;
    font-size: 1rem;
    font-weight: 900;
    cursor: pointer;
}

.word-button:nth-child(3n) {
    border-color: rgba(244, 183, 76, 0.5);
    color: #c77611;
    background: #fff7e4;
}

.word-button:nth-child(4n) {
    border-color: rgba(240, 91, 123, 0.35);
    color: #b33462;
    background: #fff1f5;
}

.word-button.is-active {
    color: #fff;
    background: var(--teal);
}

.word-button.is-speaking-word {
    color: #fff;
    background: linear-gradient(135deg, #ff7d62, #ef4a57);
    border-color: rgba(239, 74, 87, 0.75);
    box-shadow: 0 8px 18px rgba(239, 74, 87, 0.22);
    transform: translateY(-1px);
}

.word-hint {
    margin-top: 14px;
    text-align: center;
    color: #7a6d61;
    font-weight: 800;
}

.speed-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-top: 16px;
    padding: 14px 18px;
}

.speed-toolbar:not(.speed-toolbar--inline) {
    display: none;
}

.speed-toolbar--inline {
    margin-top: 0;
    margin-left: auto;
    padding: 8px 12px;
    gap: 12px;
    background: rgba(255, 255, 255, 0.86);
}

.speed-toolbar--inline .speed-icon {
    width: 28px;
    height: 28px;
}

.speed-toolbar--inline .speed-label {
    font-size: 0.88rem;
}

.speed-toolbar--inline .speed-options {
    flex-wrap: wrap;
    justify-content: flex-end;
}

.speed-toolbar--inline .speed-option {
    padding: 8px 14px;
    font-size: 0.8rem;
}

.speed-label-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 900;
}

.speed-icon {
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: transparent;
}

.speed-options {
    display: flex;
    gap: 10px;
}

.speed-option {
    border: 0;
    padding: 9px 16px;
    border-radius: 999px;
    background: transparent;
    color: #6d5a92;
    font-size: 0.86rem;
    font-weight: 900;
    cursor: pointer;
}

.speed-option.is-active {
    color: #fff;
    background: linear-gradient(135deg, #ffb850, #ff8a57);
}

.story-pages {
    margin-top: 20px;
    padding: 18px;
}

.reader-frame > .story-pages:last-of-type {
    display: block;
}

.section-title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
    gap: 16px;
    flex-wrap: wrap;
}

.section-title-row h3,
.dashboard-row h3 {
    margin: 0;
    color: #213259;
    font-family: "Fredoka", sans-serif;
    font-size: 1.22rem;
}

.ghost-link,
.soft-button {
    border: 0;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.76);
    color: #2a3b66;
    font-weight: 900;
    cursor: pointer;
}

.ghost-link {
    padding: 8px 12px;
}

.page-card-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.mini-page-card {
    position: relative;
    min-height: 0;
    padding: 0 0 8px;
    border: 1px solid rgba(244, 183, 76, 0.35);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.82);
    overflow: hidden;
    cursor: pointer;
}

.mini-page-card--empty {
    display: grid;
    gap: 10px;
    align-content: start;
}

.mini-page-empty {
    min-height: 120px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    background: linear-gradient(135deg, #f5f7fb, #eef5f0);
    color: #5d6a82;
    font-weight: 900;
    text-align: center;
    padding: 18px;
}

.mini-page-card.is-active {
    border-color: #ffb64f;
    box-shadow: 0 10px 22px rgba(244, 183, 76, 0.22);
}

.mini-page-card.is-reading {
    border-color: #ef4a57;
    box-shadow: 0 10px 24px rgba(239, 74, 87, 0.18);
}

.mini-page-card img {
    display: block;
    width: 100%;
    aspect-ratio: 1536 / 782;
    height: auto;
    object-fit: cover;
    object-position: center center;
    border-radius: 8px 8px 0 0;
    background: transparent;
}

.mini-page-card .page-num {
    position: absolute;
    left: 12px;
    top: 12px;
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: var(--teal);
    color: #fff;
    font-weight: 900;
}

.mini-page-card p {
    margin: 0 14px 0;
    min-height: 0;
    color: #273957;
    font-size: 0.92rem;
    font-weight: 900;
    line-height: 1.25;
}

.mini-sentence-row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin: 0 14px 0;
}

.mini-sentence-row p {
    flex: 1;
    margin: 0;
}

.mini-page-card .page-audio-button {
    flex: 0 0 auto;
    margin: 0;
    padding: 0;
    width: 18px;
    height: 18px;
    display: grid;
    place-items: center;
    font-size: 0.68rem;
    line-height: 1;
    color: var(--teal);
    background: transparent;
    border: 0;
    transform: translateY(1px);
}

.mini-sentence-text .sentence-word {
    display: inline-block;
    border-radius: 5px;
    padding: 1px 3px;
    border-bottom: 3px solid transparent;
    transition: color 120ms ease, background 120ms ease, border-color 120ms ease, box-shadow 120ms ease, transform 120ms ease;
}

.mini-sentence-text .sentence-word.is-spoken-word {
    color: inherit;
    border-color: transparent;
}

.mini-page-card.is-karaoke-running .mini-sentence-text .sentence-word {
    animation: karaokeWordPulse var(--karaoke-hold, 0.7s) ease-in-out var(--karaoke-delay, 0s) 1 both;
}

.mini-page-card.is-karaoke-paused .mini-sentence-text .sentence-word {
    animation-play-state: paused;
}

.mini-sentence-text .sentence-word.is-speaking-word {
    color: #fff;
    background: #ef4a57;
    border-color: #ef4a57;
    box-shadow: 0 3px 8px rgba(239, 74, 87, 0.2);
    transform: translateY(-2px) scale(1.06);
    animation: karaokeWordPop 360ms ease both;
}

@keyframes karaokeWordPop {
    0% {
        transform: translateY(0) scale(1);
    }
    45% {
        transform: translateY(-3px) scale(1.08);
    }
    100% {
        transform: translateY(-2px) scale(1.06);
    }
}

@keyframes karaokeWordPulse {
    0%,
    100% {
        color: #273957;
        background: transparent;
        border-color: transparent;
        box-shadow: none;
        transform: translateY(0) scale(1);
    }
    12%,
    82% {
        color: #fff;
        background: #ef4a57;
        border-color: #ef4a57;
        box-shadow: 0 5px 12px rgba(239, 74, 87, 0.26);
        transform: translateY(-2px) scale(1.07);
    }
}

.mini-page-card button {
    display: block;
    margin: 0 auto;
    border: 0;
    background: transparent;
    color: var(--teal);
    cursor: pointer;
}

.mission-page-card {
    background: linear-gradient(160deg, #fff8dc, #ffe0a9 52%, #ffd0cb);
}

.mission-comic-panel {
    position: relative;
    display: grid;
    place-items: center;
    height: 230px;
    overflow: hidden;
    border-radius: 8px 8px 0 0;
    background:
        radial-gradient(circle at 18% 18%, rgba(255, 255, 255, 0.9) 0 10%, transparent 11%),
        radial-gradient(circle at 80% 24%, rgba(255, 255, 255, 0.72) 0 8%, transparent 9%),
        linear-gradient(145deg, #62d6cf, #ffe873 58%, #ff9b6c);
    color: #082650;
    font-family: "Fredoka", sans-serif;
    font-size: 1.45rem;
}

.mission-comic-panel::before,
.mission-comic-panel::after {
    content: "";
    position: absolute;
    border-radius: 999px;
}

.mission-comic-panel::before {
    width: 170px;
    height: 74px;
    left: -30px;
    bottom: 22px;
    background: rgba(12, 119, 108, 0.22);
}

.mission-comic-panel::after {
    width: 110px;
    height: 110px;
    right: -24px;
    bottom: -18px;
    background: rgba(255, 88, 111, 0.28);
}

.mission-star {
    position: absolute;
    left: 16%;
    top: 22%;
    color: #ffb72d;
    font-size: 3rem;
    text-shadow: 0 6px 0 rgba(8, 38, 80, 0.08);
}

.mission-ball {
    position: absolute;
    right: 22%;
    top: 28%;
    width: 58px;
    height: 58px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 25%, #fff 0 8%, #ff5a59 9% 100%);
    box-shadow: 0 12px 18px rgba(8, 38, 80, 0.16);
}

.dashboard-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1.2fr;
    gap: 16px;
    margin-top: 16px;
}

.dashboard-row > article {
    min-height: 190px;
    padding: 22px;
    background: linear-gradient(180deg, rgba(255, 252, 246, 0.95), rgba(255, 244, 226, 0.9));
}

.progress-content {
    display: grid;
    grid-template-columns: 112px 1fr;
    gap: 20px;
    align-items: center;
}

.progress-ring {
    display: grid;
    place-items: center;
    width: 104px;
    height: 104px;
    border-radius: 50%;
    background: conic-gradient(var(--teal) 0 75%, #e7ecee 75% 100%);
}

.progress-ring span {
    display: grid;
    place-items: center;
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: #fffaf0;
    color: var(--teal-dark);
    font-family: "Fredoka", sans-serif;
    font-size: 1.8rem;
}

.progress-card ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

.progress-card li {
    display: flex;
    justify-content: space-between;
    margin: 8px 0;
    color: #4f5a73;
    font-weight: 800;
}

.practice-panel {
    display: grid;
    gap: 12px;
}

.practice-summary,
.practice-note,
.support-copy {
    margin: 0;
    color: #536078;
    font-weight: 800;
    line-height: 1.4;
}

.practice-task-list {
    display: grid;
    gap: 10px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.practice-task {
    display: grid;
    gap: 8px;
    padding: 12px 14px;
    border: 1px solid rgba(25, 38, 68, 0.1);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.72);
}

.practice-task > div {
    display: flex;
    justify-content: space-between;
    gap: 12px;
}

.practice-task strong,
.practice-task small,
.practice-task span {
    display: block;
}

.practice-task strong {
    color: var(--navy);
}

.practice-task small,
.practice-task span {
    color: #64718a;
    font-weight: 800;
}

.practice-task.is-done {
    border-color: rgba(9, 166, 160, 0.3);
    background: rgba(9, 166, 160, 0.09);
}

.practice-review-items,
.review-actions,
.reward-facts,
.report-metrics,
.placement-options,
.placement-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.review-chip,
.inline-action,
.review-action,
.placement-grade,
.placement-close {
    border: 1px solid rgba(9, 166, 160, 0.22);
    border-radius: 999px;
    padding: 8px 12px;
    background: transparent;
    color: var(--navy);
    font-weight: 900;
    cursor: pointer;
}

.inline-action,
.review-action,
.placement-grade.is-active,
.placement-close {
    background: linear-gradient(135deg, rgba(9, 166, 160, 0.16), rgba(244, 183, 76, 0.14));
}

.review-actions {
    margin-top: 10px;
}

.review-actions--compact {
    margin-top: 14px;
}

.review-action {
    min-width: 0;
}

.review-action--soft,
.soft-button--alt {
    background: transparent;
    color: var(--teal-dark);
}

.practice-footer,
.report-foot {
    display: grid;
    gap: 12px;
    margin-top: 14px;
}

.soft-button {
    width: 100%;
    margin-top: 12px;
    padding: 10px 14px;
}

.soft-button--small {
    width: auto;
    margin-top: 0;
    white-space: nowrap;
}

.soft-button--alt {
    border: 1px solid rgba(9, 166, 160, 0.18);
}

.stars-total {
    margin: 18px 0 10px;
    font-size: 2.1rem;
}

.stars-card p {
    margin: 0 0 18px;
    color: #536078;
    font-weight: 800;
}

.reward-meter {
    height: 18px;
    border-radius: 999px;
    background: #f1d99a;
    overflow: hidden;
}

.reward-meter span {
    display: block;
    width: 85%;
    height: 100%;
    background: linear-gradient(90deg, #ffd85b, #ff9f43);
}

.reward-facts {
    margin-top: 16px;
}

.reward-facts div {
    flex: 1 1 30%;
    min-width: 92px;
    padding: 12px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.72);
}

.reward-facts span,
.reward-facts strong {
    display: block;
}

.reward-facts span {
    color: #6c7388;
    font-size: 0.74rem;
    font-weight: 900;
}

.reward-facts strong {
    margin-top: 6px;
    color: var(--navy);
}

.badge-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.badge-row div {
    text-align: center;
}

.badge-row span {
    display: block;
    font-size: 2.6rem;
}

.badge-row strong,
.badge-row small {
    display: block;
}

.badge-row strong {
    margin-top: 8px;
    color: #273957;
    font-size: 0.86rem;
}

.badge-row small {
    margin-top: 4px;
    color: #6c7388;
    font-size: 0.76rem;
}

.badge-earned,
.badge-locked {
    padding: 12px 10px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.72);
}

.badge-earned {
    box-shadow: inset 0 0 0 1px rgba(244, 183, 76, 0.6);
}

.badge-locked {
    opacity: 0.72;
}

.support-grid {
    display: grid;
    grid-template-columns: 1.15fr 0.85fr;
    gap: 16px;
    margin-top: 16px;
}

.support-card {
    padding: 22px;
    border-radius: 8px;
    background: linear-gradient(180deg, rgba(255, 252, 246, 0.95), rgba(255, 244, 226, 0.9));
    box-shadow: var(--shadow);
}

.support-card-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 14px;
}

.support-kicker {
    display: inline-block;
    color: var(--teal);
    font-size: 0.76rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.support-card h3 {
    margin: 8px 0 0;
    color: var(--navy);
    font-family: "Fredoka", sans-serif;
    font-size: 1.5rem;
}

.report-metrics {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-top: 16px;
}

.report-metrics div,
.placement-result-card,
.placement-result-panel {
    padding: 14px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.76);
}

.report-metrics span,
.report-metrics strong,
.placement-result-card strong,
.placement-result-card small {
    display: block;
}

.report-metrics span,
.placement-result-card small {
    color: #6c7388;
    font-size: 0.78rem;
    font-weight: 900;
}

.report-metrics strong,
.placement-result-card strong {
    margin-top: 6px;
    color: var(--navy);
    font-size: 1rem;
}

.placement-summary {
    margin-top: 18px;
}

.placement-modal {
    width: min(760px, 100%);
    max-height: calc(100vh - 48px);
    overflow: auto;
    padding: 24px;
    border-radius: 8px;
    background: #fff8e9;
    box-shadow: 0 24px 70px rgba(6, 18, 42, 0.24);
}

.placement-modal-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 14px;
}

.placement-steps {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 18px;
}

.placement-step {
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(9, 166, 160, 0.08);
    color: #64718a;
    font-size: 0.76rem;
    font-weight: 900;
    text-transform: capitalize;
}

.placement-step.is-active {
    background: linear-gradient(135deg, rgba(9, 166, 160, 0.16), rgba(244, 183, 76, 0.16));
    color: var(--navy);
}

.placement-body {
    margin-top: 18px;
}

.placement-intro {
    margin: 0 0 14px;
    color: #536078;
    font-weight: 800;
}

.placement-grade-grid,
.placement-question-list {
    display: grid;
    gap: 12px;
}

.placement-question {
    padding: 14px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.78);
}

.placement-question strong {
    display: block;
    margin-bottom: 10px;
    color: var(--navy);
}

.placement-options label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 999px;
    background: rgba(9, 166, 160, 0.08);
    font-weight: 800;
}

.placement-result-panel h4 {
    margin: 10px 0 8px;
    color: var(--navy);
    font-family: "Fredoka", sans-serif;
    font-size: 1.9rem;
}

.mini-toast {
    position: fixed;
    left: 50%;
    bottom: 24px;
    z-index: 55;
    transform: translateX(-50%);
    padding: 12px 16px;
    border-radius: 999px;
    background: rgba(6, 34, 74, 0.94);
    color: #fff;
    font-weight: 900;
    box-shadow: 0 18px 36px rgba(2, 18, 44, 0.28);
}

.mini-toast.hidden {
    display: none;
}

.app-footer {
    position: relative;
    overflow: hidden;
    margin-top: 14px;
    padding: 20px 24px;
    border-radius: 8px;
    background: linear-gradient(90deg, #082650, #0a315f);
    color: var(--gold-2);
    text-align: center;
    font-family: "Fredoka", sans-serif;
    font-size: 1.45rem;
}

.player-status {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

.mission-card {
    position: fixed;
    right: 24px;
    bottom: 28px;
    z-index: 35;
    width: min(520px, calc(100vw - 32px));
    max-height: calc(100vh - 48px);
    overflow: auto;
    padding: 20px;
    border: 1px solid rgba(244, 183, 76, 0.4);
    border-radius: 8px;
    background:
        radial-gradient(circle at 12% 10%, rgba(255, 255, 255, 0.75), transparent 22%),
        linear-gradient(135deg, #fff8e9, #fff2d6 58%, #ffe0cd);
    color: #17315d;
    box-shadow: 0 20px 44px rgba(2, 18, 44, 0.24);
}

.mission-card.hidden,
.celebration-overlay.hidden {
    display: none;
}

.mission-badge {
    display: inline-block;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(12, 188, 177, 0.14);
    color: var(--teal);
    font-size: 0.74rem;
    font-weight: 900;
}

.mission-card-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.mission-card h3 {
    margin: 10px 0 0;
    color: var(--navy);
    font-family: "Fredoka", sans-serif;
    font-size: 1.55rem;
}

.mission-score {
    border-radius: 999px;
    padding: 8px 12px;
    background: transparent;
    color: #c77611;
    font-weight: 900;
    box-shadow: 0 8px 18px rgba(8, 38, 80, 0.08);
}

.mission-question {
    margin: 16px 0 8px;
    font-size: 1.08rem;
    font-weight: 900;
    line-height: 1.35;
}

.mission-hint,
.mission-feedback {
    margin: 8px 0 0;
    color: #6f6475;
    font-weight: 800;
    line-height: 1.35;
}

.mission-answer-form {
    margin-top: 16px;
}

.mission-answer-form label {
    color: #273957;
    font-weight: 900;
}

.mission-answer-row {
    display: flex;
    gap: 10px;
    margin-top: 8px;
}

.mission-answer-row input {
    flex: 1;
    min-width: 0;
    border: 1px solid rgba(12, 188, 177, 0.34);
    border-radius: 8px;
    padding: 12px 14px;
    background: transparent;
    color: #17315d;
    font: inherit;
    font-weight: 900;
}

.mission-answer-row button {
    border: 0;
    border-radius: 999px;
    padding: 10px 14px;
    background: linear-gradient(135deg, var(--teal), #18c5bb);
    color: #fff;
    font-weight: 900;
    cursor: pointer;
}

.mission-feedback {
    border-radius: 8px;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.72);
}

.report-copy-fallback {
    width: 100%;
    min-height: 132px;
    margin-top: 12px;
    border: 1px solid rgba(12, 188, 177, 0.28);
    border-radius: 8px;
    padding: 12px;
    background: transparent;
    color: #17315d;
    font: inherit;
    line-height: 1.45;
    resize: vertical;
}

.mission-feedback[data-tone="success"] {
    color: #0b756e;
    background: rgba(12, 188, 177, 0.13);
}

.mission-feedback[data-tone="retry"] {
    color: #b45c19;
    background: rgba(255, 183, 45, 0.16);
}

.mission-close {
    margin-top: 14px;
    border: 0;
    border-radius: 999px;
    padding: 10px 14px;
    background: transparent;
    color: #c4543c;
    font-weight: 900;
    cursor: pointer;
}

.celebration-overlay {
    position: fixed;
    inset: 0;
    z-index: 40;
    display: grid;
    place-items: center;
    padding: 24px;
    background: rgba(6, 18, 42, 0.52);
    backdrop-filter: blur(10px);
}

.celebration-card {
    width: min(520px, 100%);
    padding: 24px;
    border-radius: 8px;
    background: #fff8e9;
    text-align: center;
    box-shadow: 0 24px 70px rgba(6, 18, 42, 0.24);
    animation: celebration-pop 360ms ease-out;
}

.celebration-scene {
    position: relative;
    height: 160px;
    border-radius: 8px;
    overflow: hidden;
    background: linear-gradient(180deg, #8bd9ff 0%, #e8fbff 48%, #b9e98d 49%, #70c37a 100%);
}

.celebration-ball {
    position: absolute;
    left: 50%;
    top: 48%;
    width: 72px;
    height: 72px;
    margin-left: -36px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, #ffe7df, #f23d49 72%);
    animation: reward-bounce 1.2s ease-in-out infinite;
}

.celebration-star {
    position: absolute;
    width: 18px;
    height: 18px;
    background: #ffdf5d;
    clip-path: polygon(50% 0%, 61% 36%, 100% 36%, 68% 58%, 79% 100%, 50% 72%, 21% 100%, 32% 58%, 0% 36%, 39% 36%);
    animation: star-twinkle 1.4s ease-in-out infinite;
}

.star-a { left: 24%; top: 30%; }
.star-b { right: 22%; top: 24%; animation-delay: 180ms; }
.star-c { right: 34%; top: 52%; animation-delay: 320ms; }

.celebration-card[data-theme="ball"] .celebration-scene,
.celebration-card[data-theme="try-ball"] .celebration-scene {
    background: linear-gradient(180deg, #9ae7ff 0%, #e8fbff 48%, #b9e98d 49%, #67c67a 100%);
}

.celebration-card[data-theme="rain"] .celebration-scene,
.celebration-card[data-theme="try-rain"] .celebration-scene {
    background: linear-gradient(180deg, #9cc9ff 0%, #dfefff 48%, #ffd86b 49%, #ffad57 100%);
}

.celebration-card[data-theme="cat"] .celebration-scene,
.celebration-card[data-theme="try-cat"] .celebration-scene {
    background: linear-gradient(180deg, #ffe6f0 0%, #fff8fb 48%, #e6f5c9 49%, #9fd487 100%);
}

.celebration-card[data-theme="seed"] .celebration-scene,
.celebration-card[data-theme="try-seed"] .celebration-scene {
    background: linear-gradient(180deg, #daf6ff 0%, #efffff 48%, #cda173 49%, #8bd071 100%);
}

.celebration-card[data-theme="bike"] .celebration-scene,
.celebration-card[data-theme="try-bike"] .celebration-scene {
    background: linear-gradient(180deg, #a7e6ff 0%, #eefcff 48%, #e5e7ff 49%, #92c8ff 100%);
}

.celebration-card[data-theme="fish"] .celebration-scene,
.celebration-card[data-theme="try-fish"] .celebration-scene {
    background: linear-gradient(180deg, #5ad7e8 0%, #96f3ff 48%, #34a9d9 49%, #1777b9 100%);
}

.celebration-card[data-theme="kite"] .celebration-scene,
.celebration-card[data-theme="try-kite"] .celebration-scene {
    background: linear-gradient(180deg, #8bd9ff 0%, #f4fbff 56%, #d7ef93 57%, #83c56f 100%);
}

.celebration-card[data-theme="book"] .celebration-scene,
.celebration-card[data-theme="try-book"] .celebration-scene {
    background: linear-gradient(180deg, #b6f4df 0%, #f3fff8 48%, #ffe8a8 49%, #ffc66f 100%);
}

.celebration-card[data-theme="bread"] .celebration-scene,
.celebration-card[data-theme="try-bread"] .celebration-scene {
    background: linear-gradient(180deg, #ffe5b8 0%, #fff6df 48%, #eec58d 49%, #c68d53 100%);
}

.celebration-card[data-theme="night"] .celebration-scene,
.celebration-card[data-theme="try-night"] .celebration-scene {
    background: linear-gradient(180deg, #13275d 0%, #27447c 58%, #ffd98a 59%, #f4b86a 100%);
}

.celebration-card[data-theme^="try-"] .celebration-ball {
    animation-name: reward-wiggle;
    background: radial-gradient(circle at 30% 30%, #fff7ce, #ff9a4d 72%);
}

.celebration-card[data-theme="rain"] .celebration-ball,
.celebration-card[data-theme="try-rain"] .celebration-ball {
    border-radius: 48% 48% 12px 12px;
    background: radial-gradient(circle at 30% 25%, #fff7c2, #ffd44f 72%);
}

.celebration-card[data-theme="fish"] .celebration-ball,
.celebration-card[data-theme="try-fish"] .celebration-ball {
    border-radius: 58% 42% 58% 42%;
    background: radial-gradient(circle at 30% 30%, #fff4cf, #ff9f25 72%);
}

.celebration-card[data-theme="kite"] .celebration-ball,
.celebration-card[data-theme="try-kite"] .celebration-ball {
    border-radius: 8px;
    transform: rotate(45deg);
    background: linear-gradient(135deg, #ff5c78 0 50%, #16b8b0 51% 100%);
}

.celebration-card[data-theme="book"] .celebration-ball,
.celebration-card[data-theme="try-book"] .celebration-ball {
    width: 86px;
    border-radius: 8px;
    background: linear-gradient(90deg, #19b69f 0 48%, #fff7d7 49% 52%, #39c49d 53% 100%);
}

.celebration-card[data-theme="night"] .celebration-star,
.celebration-card[data-theme="try-night"] .celebration-star {
    background: #fff4a3;
}

.celebration-title {
    margin: 12px 0 8px;
    color: var(--navy);
    font-family: "Fredoka", sans-serif;
    font-size: 1.8rem;
}

.celebration-kicker,
.celebration-copy {
    color: #63708c;
}

.celebration-close {
    margin-top: 16px;
    border: 0;
    border-radius: 999px;
    padding: 12px 18px;
    background: linear-gradient(135deg, var(--teal), #18c5bb);
    color: #fff;
    font-weight: 900;
    cursor: pointer;
}

@keyframes celebration-pop {
    0% { transform: scale(0.88) translateY(16px); opacity: 0; }
    100% { transform: scale(1) translateY(0); opacity: 1; }
}

@keyframes reward-bounce {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    35% { transform: translateY(-18px) rotate(-6deg); }
    65% { transform: translateY(-6px) rotate(6deg); }
}

@keyframes reward-wiggle {
    0%, 100% { transform: translateX(0) rotate(0deg); }
    25% { transform: translateX(-8px) rotate(-5deg); }
    50% { transform: translateX(8px) rotate(5deg); }
    75% { transform: translateX(-4px) rotate(-3deg); }
}

@keyframes star-twinkle {
    0%, 100% { transform: scale(1); opacity: 0.65; }
    50% { transform: scale(1.28); opacity: 1; }
}

@keyframes screen-shake {
    0%, 100% { transform: translate3d(0, 0, 0); }
    20% { transform: translate3d(-8px, 3px, 0); }
    40% { transform: translate3d(7px, -3px, 0); }
    60% { transform: translate3d(-6px, -2px, 0); }
    80% { transform: translate3d(6px, 2px, 0); }
}

@media (max-width: 1180px) {
    .top-nav {
        grid-template-columns: 1fr;
        position: static;
    }

    .main-tabs {
        grid-template-columns: repeat(5, minmax(88px, 1fr));
        overflow-x: auto;
    }

    .profile-chip {
        margin: 10px 16px 16px;
    }

    .learning-board {
        grid-template-columns: 1fr;
        background: #fff7e9;
    }

    .story-library {
        display: none;
    }

    .reader-panel {
        padding: 14px;
    }

    .reader-header,
    .audio-grid,
    .dashboard-row,
    .support-grid {
        grid-template-columns: 1fr;
    }

    .meta-strip {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 760px) {
    .app-shell {
        width: 100%;
        padding: 0;
    }

    .top-nav,
    .learning-board,
    .reader-frame,
    .app-footer {
        border-radius: 0;
    }

    .brand-lockup {
        padding: 14px;
    }

    .nav-tab {
        min-height: 76px;
        min-width: 0;
    }

    .main-tabs {
        width: 100%;
        min-width: 0;
        grid-template-columns: repeat(5, minmax(0, 1fr));
        overflow-x: clip;
    }

    .reader-frame {
        padding: 22px 14px;
    }

    .reader-panel {
        min-width: 0;
    }

    .hero-stage {
        width: 100%;
        max-width: 100%;
    }

    .support-card {
        min-width: 0;
    }

    .dashboard-row {
        grid-template-columns: 1fr;
    }

    .dashboard-row > article {
        min-width: 0;
    }

    .progress-content {
        grid-template-columns: 1fr;
    }

    .practice-task > div {
        flex-direction: column;
        align-items: flex-start;
    }

    .story-title {
        font-size: 2.25rem;
    }

    .hero-stage {
        height: 230px;
    }

    .page-card-row {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .speed-toolbar,
    .story-player {
        grid-template-columns: 1fr;
    }

    .speed-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .speed-options {
        justify-content: space-between;
    }

    .mission-card {
        right: 12px;
        left: 12px;
        bottom: 12px;
        width: auto;
        padding: 16px;
    }

    .mission-card-top,
    .mission-answer-row,
    .support-card-head,
    .placement-modal-head,
    .placement-actions {
        flex-direction: column;
    }

    .report-metrics {
        grid-template-columns: 1fr;
    }

    .placement-modal {
        padding: 18px;
    }

    .player-status {
        display: none;
    }
}






