:root {
    --bg: #f7fbff;
    --ink: #18324a;
    --muted: #64748b;
    --panel: #ffffff;
    --line: #dbeafe;
    --green: #58cc02;
    --green-dark: #45a901;
    --pink: #ff6b9a;
    --blue: #2f80ed;
    --shadow: 0 18px 42px rgba(24, 50, 74, 0.12);
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    background:
        radial-gradient(circle at top left, rgba(255, 191, 71, 0.2), transparent 28rem),
        linear-gradient(180deg, #f7fbff 0%, #eef8f2 100%);
    color: var(--ink);
    font-family: "Nunito", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
a {
    font: inherit;
}

.app-shell {
    width: min(1120px, calc(100% - 32px));
    margin: 0 auto;
    padding: 22px 0 34px;
}

.topbar,
.hero,
.lesson-panel,
.curriculum-panel,
.auth-layout,
.auth-panel {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    border-radius: 24px;
    padding: 16px;
}

.eyebrow {
    margin: 0 0 4px;
    color: var(--blue);
    font-size: 0.8rem;
    font-weight: 900;
    letter-spacing: 0;
    text-transform: uppercase;
}

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

h1 {
    margin-bottom: 0;
    font-size: clamp(1.55rem, 4vw, 2.5rem);
    line-height: 1.05;
}

.stats {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.stats span {
    min-width: 78px;
    padding: 10px 12px;
    border: 2px solid #e0f2fe;
    border-radius: 18px;
    background: #f0f9ff;
    color: var(--muted);
    text-align: center;
}

.stats strong {
    display: block;
    color: var(--ink);
    font-size: 1.1rem;
}

.hero {
    display: grid;
    grid-template-columns: minmax(180px, 0.75fr) 1.25fr;
    gap: 24px;
    align-items: center;
    margin-top: 18px;
    border-radius: 30px;
    padding: clamp(20px, 4vw, 40px);
}

.mascot {
    display: grid;
    place-items: center;
    aspect-ratio: 1;
    border-radius: 34% 46% 40% 44%;
    background: linear-gradient(145deg, #83e660, #58cc02);
    box-shadow: inset 0 -14px 0 rgba(0, 0, 0, 0.08), 0 20px 34px rgba(88, 204, 2, 0.28);
}

.face {
    position: relative;
    width: 64%;
    aspect-ratio: 1;
    border-radius: 999px;
    background: #fafff4;
}

.eye {
    position: absolute;
    top: 34%;
    width: 16%;
    aspect-ratio: 1;
    border-radius: 999px;
    background: var(--ink);
}

.eye.left {
    left: 27%;
}

.eye.right {
    right: 27%;
}

.smile {
    position: absolute;
    left: 31%;
    bottom: 27%;
    width: 38%;
    height: 18%;
    border-bottom: 7px solid var(--pink);
    border-radius: 0 0 999px 999px;
}

.hero h2,
.lesson-panel h2 {
    margin-bottom: 10px;
    font-size: clamp(1.9rem, 5vw, 3.3rem);
    line-height: 1.02;
}

.hero p {
    max-width: 58ch;
    color: var(--muted);
    font-size: 1.05rem;
    line-height: 1.55;
}

.primary-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 54px;
    min-width: 148px;
    padding: 0 24px;
    border-radius: 18px;
    background: var(--green);
    box-shadow: 0 6px 0 var(--green-dark);
    color: #fff;
    font-weight: 900;
    text-decoration: none;
    border: 0;
    cursor: pointer;
}

.primary-action.full {
    width: 100%;
}

.auth-layout {
    display: grid;
    grid-template-columns: 0.9fr 1.1fr;
    gap: 22px;
    align-items: stretch;
    min-height: calc(100vh - 68px);
    border-radius: 30px;
    padding: clamp(16px, 4vw, 34px);
}

.auth-brand {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 14px;
    min-width: 0;
}

.auth-brand p:not(.eyebrow) {
    max-width: 42ch;
    color: var(--muted);
    font-size: 1.08rem;
    line-height: 1.5;
}

.mascot.small {
    width: min(210px, 64vw);
}

.auth-panel {
    align-self: center;
    border-radius: 24px;
    padding: clamp(16px, 4vw, 26px);
}

.auth-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 16px;
    padding: 6px;
    border-radius: 18px;
    background: #eef6ff;
}

.auth-tab {
    min-height: 48px;
    border: 0;
    border-radius: 14px;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    font-weight: 900;
}

.auth-tab.is-active {
    background: #fff;
    color: var(--ink);
    box-shadow: 0 8px 18px rgba(24, 50, 74, 0.1);
}

.auth-form {
    display: none;
    gap: 14px;
}

.auth-form.is-active {
    display: grid;
}

.auth-form label {
    display: grid;
    gap: 7px;
    color: var(--ink);
    font-weight: 900;
}

.auth-form input,
.auth-form select {
    width: 100%;
    min-height: 54px;
    border: 2px solid #dbeafe;
    border-radius: 16px;
    background: #fff;
    color: var(--ink);
    font: inherit;
    font-weight: 800;
    padding: 0 14px;
    outline: none;
}

.auth-form input:focus,
.auth-form select:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 4px rgba(47, 128, 237, 0.12);
}

.alert {
    margin: 0 0 10px;
    padding: 12px 14px;
    border-radius: 14px;
    background: #e0f2fe;
    color: #075985;
    font-weight: 900;
}

.alert.error {
    background: #fff0f5;
    color: #be185d;
}

.logout-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 78px;
    min-height: 54px;
    padding: 0 14px;
    border: 2px solid #e2e8f0;
    border-radius: 18px;
    background: #fff;
    color: var(--muted);
    cursor: pointer;
    font-weight: 900;
    text-decoration: none;
}

.course-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    margin-top: 18px;
}

.course-card {
    display: grid;
    gap: 14px;
    min-height: 236px;
    padding: 18px;
    border: 1px solid color-mix(in srgb, var(--accent), #ffffff 55%);
    border-radius: 22px;
    background: linear-gradient(180deg, #fff, color-mix(in srgb, var(--accent), #ffffff 82%));
    box-shadow: 0 12px 28px rgba(24, 50, 74, 0.08);
}

.course-icon {
    display: grid;
    place-items: center;
    width: 58px;
    height: 58px;
    border-radius: 18px;
    background: var(--accent);
    color: #102338;
    font-size: 1.35rem;
    font-weight: 900;
}

.course-card h3 {
    margin-bottom: 6px;
    font-size: 1.3rem;
}

.course-card p,
.lesson-panel p {
    color: var(--muted);
    line-height: 1.45;
}

.progress {
    align-self: end;
    height: 12px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(24, 50, 74, 0.1);
}

.progress span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: var(--accent);
}

.lesson-panel {
    margin-top: 18px;
    border-radius: 28px;
    padding: clamp(18px, 4vw, 34px);
}

.curriculum-panel {
    margin-top: 18px;
    border-radius: 28px;
    padding: clamp(18px, 4vw, 30px);
}

.section-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 16px;
}

.section-head h2 {
    margin-bottom: 0;
    font-size: clamp(1.45rem, 4vw, 2.15rem);
    line-height: 1.08;
}

.section-head a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 0 14px;
    border-radius: 14px;
    background: #f0f9ff;
    color: var(--blue);
    font-weight: 900;
    text-decoration: none;
}

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

.curriculum-card {
    min-width: 0;
    padding: 16px;
    border: 1px solid #dbeafe;
    border-radius: 18px;
    background: #fff;
}

.curriculum-card h3 {
    margin-bottom: 12px;
    font-size: 1.2rem;
}

.unit-list {
    display: grid;
    gap: 10px;
}

.unit-item {
    display: grid;
    gap: 8px;
    padding: 12px;
    border-radius: 16px;
    background: #f8fbff;
}

.unit-item strong,
.unit-item span {
    display: block;
}

.unit-item span {
    color: var(--muted);
    font-size: 0.92rem;
    font-weight: 800;
}

.unit-item p {
    margin-bottom: 0;
    color: var(--muted);
    font-size: 0.95rem;
}

.unit-item b {
    color: var(--ink);
}

.lesson-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.sound-button {
    display: grid;
    place-items: center;
    width: 52px;
    height: 52px;
    border: 0;
    border-radius: 999px;
    background: #e0f2fe;
    color: var(--blue);
    cursor: pointer;
    font-weight: 900;
}

.answer-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-top: 18px;
}

.answer-card {
    min-height: 92px;
    border: 3px solid #dbeafe;
    border-radius: 20px;
    background: #fff;
    color: var(--ink);
    cursor: pointer;
    font-size: 1.25rem;
    font-weight: 900;
    transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.answer-card:active {
    transform: translateY(3px);
}

.answer-card.is-correct {
    border-color: var(--green);
    background: #ecffd8;
}

.answer-card.is-wrong {
    border-color: #ff9dbb;
    background: #fff0f5;
}

.feedback {
    min-height: 32px;
    margin: 16px 0 0;
    font-weight: 900;
}

@media (max-width: 820px) {
    .hero,
    .course-grid,
    .answer-grid,
    .curriculum-grid,
    .auth-layout {
        grid-template-columns: 1fr;
    }

    .auth-layout {
        min-height: auto;
    }

    .mascot {
        width: min(260px, 76vw);
        justify-self: center;
    }

    .course-card {
        min-height: 0;
    }
}

@media (max-width: 520px) {
    .app-shell {
        width: min(100% - 20px, 1120px);
        padding-top: 10px;
    }

    .topbar {
        align-items: flex-start;
        flex-direction: column;
        border-radius: 20px;
    }

    .stats {
        width: 100%;
        justify-content: stretch;
    }

    .stats span {
        flex: 1;
    }

    .hero,
    .lesson-panel,
    .curriculum-panel {
        border-radius: 22px;
    }

    .section-head {
        align-items: stretch;
        flex-direction: column;
    }

    .answer-card {
        min-height: 78px;
    }
}
