:root {
    --font-scale: 1;
    --bg-1: #133c55;
    --bg-2: #1f6f78;
    --bg-3: #f8c630;
    --surface: rgba(255, 255, 255, 0.14);
    --surface-strong: rgba(255, 255, 255, 0.24);
    --ink: #f7fbff;
    --muted: rgba(247, 251, 255, 0.76);
    --accent: #f4a261;
    --success: #62c370;
    --danger: #ff6b6b;
    --shadow: 0 24px 60px rgba(5, 18, 32, 0.18);
}

body {
    min-height: 100vh;
    font-family: "Nunito", sans-serif;
    font-size: calc(1rem * var(--font-scale));
    color: var(--ink);
    background:
        radial-gradient(circle at top left, rgba(255, 255, 255, 0.15), transparent 24%),
        radial-gradient(circle at bottom right, rgba(248, 198, 48, 0.22), transparent 30%),
        linear-gradient(145deg, var(--bg-1), var(--bg-2) 52%, var(--bg-3));
}

.theme-ocean {
    --bg-1: #023047;
    --bg-2: #219ebc;
    --bg-3: #8ecae6;
    --accent: #ffb703;
}

.theme-space {
    --bg-1: #1b1f3b;
    --bg-2: #533a7b;
    --bg-3: #ff7b54;
    --accent: #ffd166;
}

.theme-sunrise {
    --bg-1: #8c1c13;
    --bg-2: #bf4342;
    --bg-3: #f4d35e;
    --accent: #faf0ca;
}

.high-contrast {
    --surface: rgba(0, 0, 0, 0.82);
    --surface-strong: rgba(0, 0, 0, 0.94);
    --ink: #ffffff;
    --muted: #ffffff;
}

.site-header,
.site-footer {
    background: rgba(0, 0, 0, 0.12);
    backdrop-filter: blur(12px);
}

.brand {
    color: var(--ink);
}

.brand-mark {
    display: inline-grid;
    place-items: center;
    width: 3rem;
    height: 3rem;
    border-radius: 1rem;
    font-family: "Baloo 2", cursive;
    font-size: 1.2rem;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.9), rgba(244, 162, 97, 0.85));
    color: #143042;
}

.skip-link {
    position: absolute;
    left: -9999px;
}

.skip-link:focus {
    left: 1rem;
    top: 1rem;
    z-index: 999;
    padding: 0.75rem 1rem;
    background: #fff;
    color: #000;
}

.hero-shell,
.auth-shell,
.dashboard-shell {
    padding-inline: 0.75rem;
}

.playground-card,
.sidebar-card,
.dashboard-card,
.form-card {
    background: var(--surface);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 2rem;
    box-shadow: var(--shadow);
    padding: 2rem;
    backdrop-filter: blur(18px);
}

.display-title,
.sidebar-title,
.form-card h1,
.dashboard-card h1 {
    font-family: "Baloo 2", cursive;
    line-height: 1;
}

.display-title {
    font-size: clamp(2.5rem, 6vw, 4.5rem);
    max-width: 10ch;
}

.eyebrow,
.sentence-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.8rem;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    background: rgba(255, 255, 255, 0.14);
}

.lead-copy {
    color: var(--muted);
    max-width: 34rem;
}

.reader-game {
    display: grid;
    gap: 1.5rem;
}

.word-target {
    display: flex;
    flex-wrap: wrap;
    gap: 0.85rem;
}

.slot {
    width: min(5.4rem, calc(25vw - 1rem));
    aspect-ratio: 1 / 1.05;
    border-radius: 1.35rem;
    border: 2px dashed rgba(255, 255, 255, 0.5);
    display: grid;
    place-items: center;
    font-size: 2.1rem;
    font-family: "Baloo 2", cursive;
    background: rgba(255, 255, 255, 0.08);
}

.slot.is-filled {
    border-style: solid;
    border-color: rgba(255, 255, 255, 0.85);
    background: rgba(98, 195, 112, 0.25);
    transform: translateY(-2px);
}

.letter-bank {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.letter-token {
    position: relative;
    border: none;
    width: min(5rem, calc(25vw - 1rem));
    aspect-ratio: 1;
    border-radius: 1.5rem;
    font-family: "Baloo 2", cursive;
    font-size: 2rem;
    color: #17324a;
    background: linear-gradient(180deg, #fff4c6, #f4a261);
    box-shadow: 0 12px 26px rgba(0, 0, 0, 0.18);
    transition: transform 180ms ease, box-shadow 180ms ease;
}

.letter-token::before,
.letter-token::after {
    content: "";
    position: absolute;
    top: 0.9rem;
    width: 0.7rem;
    height: 0.7rem;
    background: #17324a;
    border-radius: 50%;
}

.letter-token::before { left: 1.05rem; }
.letter-token::after { right: 1.05rem; }

.letter-token:hover,
.letter-token:focus-visible,
.word-chip:hover,
.word-chip:focus-visible {
    transform: translateY(-4px) rotate(-3deg);
    box-shadow: 0 18px 30px rgba(0, 0, 0, 0.24);
}

.letter-token.is-used {
    opacity: 0.35;
    pointer-events: none;
}

.feedback-strip,
.context-panel,
.support-card,
.empty-state {
    border-radius: 1.5rem;
    padding: 1.25rem;
    background: rgba(0, 0, 0, 0.16);
}

.context-panel.revealed {
    animation: riseIn 320ms ease forwards;
}

.context-sentence {
    font-size: 1.35rem;
    font-weight: 700;
}

.meaning-word {
    display: inline-block;
    padding: 0.15rem 0.45rem;
    border-radius: 0.8rem;
    background: rgba(255, 255, 255, 0.22);
    animation: pulseWord 800ms ease-in-out infinite alternate;
}

.word-list {
    display: grid;
    gap: 0.85rem;
}

.word-chip {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    width: 100%;
    padding: 1rem 1.1rem;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 1.3rem;
    background: rgba(255, 255, 255, 0.08);
    color: var(--ink);
}

.word-chip.active {
    background: rgba(255, 255, 255, 0.22);
}

.btn-soft {
    background: rgba(255, 255, 255, 0.12);
    color: var(--ink);
    border: 1px solid rgba(255, 255, 255, 0.14);
}

.metric-card strong {
    display: block;
    margin-top: 0.35rem;
    font-size: 2.3rem;
    font-family: "Baloo 2", cursive;
}

.achievement-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.achievement-pill,
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.55rem 0.9rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.1);
}

.achievement-pill.earned {
    background: rgba(98, 195, 112, 0.26);
}

.status-mastered { background: rgba(98, 195, 112, 0.26); }
.status-learning { background: rgba(244, 162, 97, 0.28); }
.status-new { background: rgba(255, 255, 255, 0.12); }

.progress-table {
    color: var(--ink);
}

.support-list {
    padding-left: 1rem;
}

.landing-shell {
    padding-inline: 0.75rem;
}

.landing-title {
    max-width: 14ch;
}

.hero-illustration {
    border-radius: 2rem;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.14);
    box-shadow: var(--shadow);
}

.download-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.85rem;
}

.download-card,
.feature-panel,
.progress-pill,
.lang-panel {
    border-radius: 1.2rem;
    background: rgba(0, 0, 0, 0.16);
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.download-card {
    display: block;
    color: var(--ink);
    text-decoration: none;
    padding: 1rem;
}

.download-card:hover {
    color: var(--ink);
    transform: translateY(-2px);
}

.download-card strong,
.download-card small {
    display: block;
}

.feature-panel {
    padding: 1rem;
    height: 100%;
}

.progress-pill {
    display: inline-flex;
    align-items: center;
    font-weight: 700;
    padding: 0.5rem 0.9rem;
}

.lang-panel {
    padding: 0.75rem;
    min-width: 17rem;
}

.lang-panel .form-label {
    font-weight: 700;
}

.lang-panel .form-select {
    background: rgba(255, 255, 255, 0.92);
    color: #1a2a36;
}

@keyframes riseIn {
    from {
        opacity: 0;
        transform: translateY(16px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulseWord {
    from { transform: scale(1); }
    to { transform: scale(1.08) rotate(2deg); }
}

@media (max-width: 767px) {
    .playground-card,
    .sidebar-card,
    .dashboard-card,
    .form-card {
        padding: 1.35rem;
        border-radius: 1.5rem;
    }

    .display-title {
        max-width: 100%;
    }

    .slot,
    .letter-token {
        width: calc(20vw + 0.5rem);
    }

    .download-grid {
        grid-template-columns: 1fr;
    }

    .lang-panel {
        min-width: 100%;
    }
}
