@import url('https://fonts.googleapis.com/css2?family=Baloo+2:wght@600;700;800&family=Nunito:wght@500;700;800;900&display=swap');

:root {
    --bg-0: #0a1324;
    --bg-1: #101f36;
    --bg-2: #1a2f4d;
    --surface: #12253d;
    --surface-soft: #1a3355;
    --surface-strong: #0f2038;
    --surface-light: #f6fbff;
    --line: #2b4a72;
    --line-soft: #31577f;
    --ink: #f1f8ff;
    --ink-soft: #bed6f0;
    --accent: #7ee137;
    --accent-strong: #67ca21;
    --accent-ink: #173103;
    --gold: #ffd84d;
    --coral: #ff6b7a;
    --sky: #5dc6ff;
    --mint: #4be2a6;
    --violet: #9d88ff;
    --radius-xl: 30px;
    --radius-lg: 24px;
    --radius-md: 18px;
    --radius-sm: 14px;
    --shadow-lg: 0 18px 45px rgba(5, 12, 24, 0.44);
    --shadow-md: 0 10px 24px rgba(4, 10, 22, 0.3);
    --font-body: 'Nunito', 'Trebuchet MS', sans-serif;
    --font-display: 'Baloo 2', 'Nunito', sans-serif;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: var(--font-body);
    background:
        radial-gradient(1100px 500px at 8% -10%, rgba(126, 225, 55, 0.14), transparent 60%),
        radial-gradient(800px 500px at 98% 6%, rgba(93, 198, 255, 0.15), transparent 55%),
        linear-gradient(180deg, var(--bg-1) 0%, var(--bg-0) 100%);
    color: var(--ink);
    position: relative;
    overflow-x: hidden;
}

.bg-orb {
    position: fixed;
    pointer-events: none;
    border-radius: 999px;
    filter: blur(40px);
    z-index: 0;
    opacity: 0.65;
}

.orb-a {
    width: 320px;
    height: 320px;
    background: rgba(126, 225, 55, 0.26);
    top: -140px;
    left: -120px;
}

.orb-b {
    width: 360px;
    height: 360px;
    background: rgba(93, 198, 255, 0.22);
    right: -150px;
    top: 200px;
}

.orb-c {
    width: 360px;
    height: 360px;
    background: rgba(157, 136, 255, 0.2);
    left: -160px;
    bottom: -150px;
}

.orb-d {
    width: 420px;
    height: 420px;
    background: rgba(255, 216, 77, 0.18);
    right: -180px;
    bottom: -180px;
}

img {
    max-width: 100%;
    display: block;
}

a {
    text-decoration: none;
    color: inherit;
}

.container {
    width: min(1120px, calc(100% - 2rem));
    margin: 0 auto;
    padding: 1rem 0 2.2rem;
    position: relative;
    z-index: 1;
}

.container-narrow {
    width: min(900px, calc(100% - 1.2rem));
}

.game-topbar,
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.1rem;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 0.8rem;
    font-weight: 800;
}

.brand strong {
    font-family: var(--font-display);
    letter-spacing: 0.03em;
    font-size: 1.2rem;
}

.brand-badge {
    width: 56px;
    height: 56px;
    border-radius: 18px;
    display: grid;
    place-items: center;
    background: linear-gradient(180deg, #1a3355, #122641);
    border: 2px solid #2e4e77;
    box-shadow: var(--shadow-md);
}

.brand-badge img {
    width: 32px;
    height: 32px;
}

.topbar-actions,
.summary-pills,
.inline-actions {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    flex-wrap: wrap;
}

.pill,
.link-pill,
.score-pill,
.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    border-radius: 999px;
    padding: 0.56rem 0.95rem;
    border: 2px solid var(--line-soft);
    background: linear-gradient(180deg, #163055, #122847);
    color: var(--ink);
    font-weight: 800;
    font-size: 0.95rem;
    box-shadow: var(--shadow-md);
}

.pill-stats {
    border-color: #426e9e;
}

.link-pill {
    transition: transform 0.16s ease, border-color 0.16s ease;
}

.link-pill:hover,
.link-pill:focus-visible {
    transform: translateY(-1px);
    border-color: #7ab0e8;
}

.badge {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    border: 2px solid #476f96;
    padding: 0.35rem 0.72rem;
    font-weight: 800;
    font-size: 0.85rem;
    background: #15355c;
    color: #dceeff;
}

.badge-bright {
    background: linear-gradient(180deg, #7ee137, #6ad12a);
    border-color: #8cf250;
    color: #163300;
}

.notice {
    border-radius: var(--radius-md);
    border: 2px solid #4f7caa;
    background: linear-gradient(180deg, #18365d, #143055);
    color: #e6f4ff;
    padding: 0.9rem 1rem;
    margin-bottom: 1rem;
    font-weight: 700;
}

.notice.error {
    border-color: #d45f6d;
    background: linear-gradient(180deg, #471f35, #35192a);
    color: #ffdce2;
}

.hero-card,
.panel,
.rule-card,
.step-card,
.result-hero,
.review-item,
.progress-block,
.mission-card {
    border-radius: var(--radius-xl);
    border: 2px solid var(--line);
    background: linear-gradient(180deg, var(--surface) 0%, var(--surface-strong) 100%);
    box-shadow: var(--shadow-lg);
}

h1,
h2,
h3 {
    font-family: var(--font-display);
    margin: 0;
    line-height: 1.1;
}

p {
    margin: 0;
}

.muted,
.small-text {
    color: var(--ink-soft);
}

.onboarding-grid {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 1rem;
    margin-bottom: 1.2rem;
}

.hero-card-main {
    padding: 1.5rem;
}

.hero-card-main h1 {
    margin: 0.8rem 0 0.65rem;
    font-size: clamp(2rem, 4.6vw, 3.1rem);
}

.hero-card-main > p {
    font-size: 1.07rem;
    color: var(--ink-soft);
    margin-bottom: 1rem;
}

.hero-card-main.compact h1 {
    font-size: clamp(1.7rem, 4.2vw, 2.5rem);
}

.hero-side {
    display: grid;
    gap: 1rem;
}

.mascot {
    padding: 1.2rem;
    display: grid;
    place-items: center;
    text-align: center;
}

.mascot-dark {
    background:
        radial-gradient(circle at 15% 18%, rgba(93, 198, 255, 0.2), transparent 32%),
        radial-gradient(circle at 85% 20%, rgba(126, 225, 55, 0.26), transparent 30%),
        linear-gradient(180deg, #18345a, #142c4d);
}

.rocket-wrap {
    display: grid;
    gap: 0.7rem;
    justify-items: center;
}

.rocket-wrap img {
    width: 100px;
    height: 100px;
    filter: drop-shadow(0 8px 14px rgba(4, 10, 20, 0.34));
    animation: floaty 3s ease-in-out infinite;
}

@keyframes floaty {
    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-8px);
    }
}

.form-card {
    padding: 1.2rem;
}

.form-card-game h2 {
    margin: 0 0 0.9rem;
}

.start-form,
.form-card form {
    display: grid;
    gap: 0.8rem;
}

label {
    font-weight: 800;
    display: inline-block;
    margin-bottom: 0.35rem;
}

input[type="text"] {
    width: 100%;
    border-radius: var(--radius-sm);
    border: 2px solid #4a6d95;
    background: #f7fcff;
    color: #163151;
    padding: 0.9rem 1rem;
    font: inherit;
    font-size: 1rem;
    font-weight: 700;
}

input[type="text"]:focus {
    outline: none;
    border-color: #6ba7da;
    box-shadow: 0 0 0 5px rgba(93, 198, 255, 0.22);
}

.button {
    border: 0;
    border-radius: 16px;
    padding: 0.92rem 1.2rem;
    font-family: var(--font-body);
    font-weight: 900;
    font-size: 1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.55rem;
    cursor: pointer;
    transition: transform 0.18s ease, filter 0.18s ease;
    box-shadow: 0 6px 0 rgba(0, 0, 0, 0.2);
}

.button:hover,
.button:focus-visible {
    transform: translateY(-2px);
    filter: brightness(1.03);
}

.button:active {
    transform: translateY(0);
}

.button-primary {
    background: linear-gradient(180deg, var(--accent), var(--accent-strong));
    color: var(--accent-ink);
}

.button-success {
    background: linear-gradient(180deg, #8cf15a, #71d83a);
    color: #173100;
}

.button-secondary {
    background: linear-gradient(180deg, #214268, #1a3557);
    color: var(--ink);
    border: 2px solid #3c638b;
    box-shadow: 0 6px 0 rgba(4, 12, 22, 0.4);
}

.button-xl {
    padding: 1rem 1.3rem;
    font-size: 1.05rem;
}

.button[aria-disabled="true"],
.button:disabled {
    opacity: 0.58;
    pointer-events: none;
    filter: grayscale(0.2);
}

.inline-icon {
    width: 24px;
    height: 24px;
}

.hero-points {
    display: grid;
    gap: 0.65rem;
    margin-top: 1rem;
}

.hero-point {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    border-radius: var(--radius-md);
    background: linear-gradient(180deg, #16355b, #142d4d);
    border: 2px solid #315680;
    padding: 0.8rem;
}

.hero-point p {
    margin-top: 0.15rem;
    color: var(--ink-soft);
}

.icon-dot {
    flex: 0 0 40px;
    width: 40px;
    height: 40px;
    border-radius: 13px;
    display: grid;
    place-items: center;
    background: linear-gradient(180deg, #274d76, #1b3a61);
    border: 2px solid #436d9a;
    font-size: 1.05rem;
}

.how-panel {
    padding: 1.2rem;
}

.section-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.8rem;
    margin-bottom: 0.75rem;
}

.mini-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.75rem;
}

.glow-step {
    padding: 1rem;
    border-radius: var(--radius-md);
    border: 2px solid #335b85;
    background: linear-gradient(180deg, #17345a, #132c49);
}

.glow-step h3 {
    margin-bottom: 0.35rem;
}

.glow-step p {
    color: var(--ink-soft);
}

.dashboard-head {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

.focus-panel {
    padding: 1.2rem;
}

.focus-panel h3 {
    margin-bottom: 0.75rem;
}

.progress-shell {
    width: 100%;
    border-radius: 999px;
    height: 14px;
    background: #0f2139;
    border: 2px solid #365d87;
    overflow: hidden;
    margin-top: 0.85rem;
}

.progress-bar {
    width: 0;
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--gold), #ffe88a);
    box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.15);
}

.path-section {
    margin-top: 1.2rem;
}

.mission-path {
    display: grid;
    gap: 0.9rem;
}

.mission-node {
    display: flex;
    position: relative;
}

.mission-node::after {
    content: '';
    position: absolute;
    width: 2px;
    background: repeating-linear-gradient(to bottom, #4776a4 0 12px, transparent 12px 22px);
    top: calc(100% + 6px);
    bottom: -8px;
    left: 47px;
    opacity: 0.9;
}

.mission-node:last-child::after {
    display: none;
}

.mission-node.left {
    justify-content: flex-start;
}

.mission-node.right {
    justify-content: flex-end;
}

.mission-core {
    width: min(760px, 100%);
    display: grid;
    grid-template-columns: 78px 1fr;
    gap: 0.8rem;
    align-items: stretch;
}

.mission-orb {
    width: 78px;
    height: 78px;
    border-radius: 999px;
    border: 4px solid #436d98;
    background: linear-gradient(180deg, #1f3f67, #17314f);
    display: grid;
    place-items: center;
    box-shadow: var(--shadow-md);
}

.mission-orb img {
    width: 40px;
    height: 40px;
}

.mission-card {
    padding: 0.95rem 1rem;
}

.mission-card-head {
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 0.5rem;
}

.mission-card h3 {
    margin-bottom: 0.35rem;
}

.mission-card p {
    color: var(--ink-soft);
    margin-bottom: 0.55rem;
}

.unit-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem;
    margin-bottom: 0.7rem;
    font-size: 0.95rem;
}

.is-locked {
    opacity: 0.64;
}

.is-open .mission-orb {
    border-color: #8de45a;
    box-shadow: 0 0 0 6px rgba(126, 225, 55, 0.12), var(--shadow-md);
}

.stars {
    display: inline-flex;
    gap: 0.2rem;
    align-items: center;
}

.star-bubble {
    width: 27px;
    height: 27px;
    border-radius: 999px;
    display: grid;
    place-items: center;
    background: #ffe283;
    border: 2px solid #ffeeb8;
    color: #775400;
    font-size: 0.88rem;
}

.star-bubble.off {
    opacity: 0.4;
}

.focus-list,
.review-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 0.55rem;
}

.focus-list li,
.review-item {
    border-radius: var(--radius-md);
    border: 2px solid #365b82;
    background: #183456;
    padding: 0.72rem 0.82rem;
    display: grid;
    gap: 0.25rem;
}

/* Lesson screen */
.lesson-header {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: start;
    gap: 0.8rem;
    margin-bottom: 0.95rem;
}

.close-link {
    width: 44px;
    height: 44px;
    border-radius: 999px;
    border: 2px solid #3b638c;
    display: grid;
    place-items: center;
    background: #183355;
    font-size: 1.4rem;
    font-weight: 900;
    line-height: 1;
}

.lesson-title-wrap h1 {
    font-size: clamp(1.45rem, 3.2vw, 2rem);
    margin: 0.35rem 0;
}

.rule-card {
    padding: 1rem 1.1rem;
}

.rule-card-game {
    margin-bottom: 0.9rem;
}

.rule-card-game strong {
    display: inline-block;
    margin-bottom: 0.28rem;
}

.rule-card-game p {
    color: var(--ink-soft);
}

.progress-block {
    padding: 0.9rem 1rem;
    margin-bottom: 0.9rem;
}

.progress-block-game {
    border-radius: var(--radius-lg);
}

.lesson-status-row {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    flex-wrap: wrap;
    margin-bottom: 0.6rem;
}

.hearts-pill {
    border-color: #ca6b7a;
    background: linear-gradient(180deg, #47283c, #331d2d);
}

.streak-pill {
    border-color: #d6a74a;
    background: linear-gradient(180deg, #4f3a16, #3d2c10);
}

.step-shell {
    display: grid;
}

.step-card {
    padding: 1.2rem;
    display: none;
}

.step-card.active {
    display: block;
    animation: riseIn 0.26s ease;
}

.step-card.needs-answer {
    border-color: #d76b79;
    box-shadow: 0 0 0 4px rgba(215, 107, 121, 0.24), var(--shadow-lg);
    animation: shakeX 0.28s ease;
}

@keyframes riseIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes shakeX {
    0%,
    100% {
        transform: translateX(0);
    }

    30% {
        transform: translateX(-5px);
    }

    60% {
        transform: translateX(5px);
    }
}

.step-card h3 {
    margin: 0.7rem 0 0.65rem;
    font-size: 1.22rem;
}

.question-prompt {
    font-size: clamp(1.16rem, 2.5vw, 1.5rem);
    line-height: 1.45;
    font-weight: 900;
    margin-bottom: 0.85rem;
}

.question-clue {
    display: inline-flex;
    border-radius: 999px;
    padding: 0.4rem 0.78rem;
    border: 2px solid #537ba8;
    background: #173459;
    color: #d7ecff;
    font-weight: 800;
    margin-bottom: 0.85rem;
}

.choice-grid {
    display: grid;
    gap: 0.7rem;
}

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

.choice-option {
    border-radius: var(--radius-md);
    border: 2px solid #3c638d;
    background: #173355;
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.95rem;
    cursor: pointer;
    font-weight: 800;
    transition: transform 0.16s ease, border-color 0.16s ease;
    min-height: 62px;
}

.choice-option:hover,
.choice-option:focus-within {
    transform: translateY(-1px);
    border-color: #71a8df;
}

.choice-option input {
    width: 20px;
    height: 20px;
    accent-color: #6dd32e;
    flex: 0 0 auto;
}

.choice-option.is-selected,
.choice-option input:checked + .choice-label-text {
    color: #0f2a00;
}

.choice-option.is-selected {
    background: linear-gradient(180deg, #8ae651, #79d83e);
    border-color: #a7ff70;
}

.choice-label-text {
    display: inline-block;
}

.quiz-nav {
    display: flex;
    justify-content: space-between;
    gap: 0.7rem;
    flex-wrap: wrap;
    margin-top: 0.95rem;
}

.quiz-nav .button {
    min-width: 140px;
}

.quiz-nav-sticky {
    position: sticky;
    bottom: 0.5rem;
    background: linear-gradient(180deg, rgba(10, 19, 36, 0), rgba(10, 19, 36, 0.96) 34%);
    padding-top: 0.7rem;
}

/* Result screen */
.result-hero {
    padding: 1.2rem;
    margin-bottom: 1rem;
}

.result-hero-grid {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 1rem;
    align-items: center;
    margin: 0.75rem 0 0.9rem;
}

.result-number {
    width: 122px;
    height: 122px;
    border-radius: 32px;
    display: grid;
    place-items: center;
    font-size: 2.2rem;
    font-weight: 900;
    box-shadow: var(--shadow-md);
}

.success-ring {
    border-color: #489463;
    background: linear-gradient(180deg, #153a2b, #142f23);
}

.success-ring.result-number {
    color: #bbffc7;
    border: 2px solid #6fd08d;
    background: linear-gradient(180deg, #234f39, #173826);
}

.warning-ring {
    border-color: #a57f3f;
    background: linear-gradient(180deg, #3f3219, #302512);
}

.warning-ring.result-number {
    color: #ffe9a7;
    border: 2px solid #d4af62;
    background: linear-gradient(180deg, #5b4720, #3f3116);
}

.danger-ring {
    border-color: #9d5160;
    background: linear-gradient(180deg, #3f1c2b, #311521);
}

.danger-ring.result-number {
    color: #ffd4dc;
    border: 2px solid #ca7689;
    background: linear-gradient(180deg, #5b2838, #401c29);
}

.result-hero h1 {
    margin-bottom: 0.35rem;
}

.result-hero p {
    margin-bottom: 0.35rem;
}

.result-grid {
    display: grid;
    grid-template-columns: 0.8fr 1.2fr;
    gap: 1rem;
}

.radar-panel,
.review-panel {
    padding: 1rem;
}

.review-item p {
    margin: 0;
    color: #d6e9ff;
}

.review-item strong {
    color: #ffffff;
}

.answer-good {
    color: #a7ff70;
    font-weight: 900;
}

.answer-bad {
    color: #ff8d9d;
    font-weight: 900;
}

.empty-state {
    border-radius: var(--radius-md);
    border: 2px solid #3f668f;
    background: #18375f;
    padding: 0.95rem;
    display: flex;
    gap: 0.8rem;
    align-items: center;
}

.empty-state img {
    width: 44px;
    height: 44px;
}

.footer-note {
    margin-top: 1.35rem;
    text-align: center;
    color: #9db9d8;
    font-weight: 700;
    font-size: 0.92rem;
}

@media (max-width: 980px) {
    .onboarding-grid,
    .dashboard-head,
    .result-grid {
        grid-template-columns: 1fr;
    }

    .mission-node.right,
    .mission-node.left {
        justify-content: flex-start;
    }

    .mission-core {
        width: 100%;
    }
}

@media (max-width: 760px) {
    .container {
        width: min(100% - 0.85rem, 980px);
        padding-top: 0.7rem;
    }

    .topbar,
    .game-topbar,
    .lesson-header {
        grid-template-columns: 1fr;
        display: grid;
        align-items: stretch;
    }

    .topbar-actions,
    .summary-pills,
    .inline-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .mini-grid,
    .choice-grid-game {
        grid-template-columns: 1fr;
    }

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

    .mission-core {
        grid-template-columns: 64px 1fr;
    }

    .mission-orb {
        width: 64px;
        height: 64px;
    }

    .mission-node::after {
        left: 39px;
    }

    .result-hero-grid {
        grid-template-columns: 1fr;
        justify-items: center;
        text-align: center;
    }

    .lesson-status-row {
        align-items: stretch;
    }

    .quiz-nav .button {
        flex: 1 1 auto;
    }
}

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