/* =========================================================
   KitabuEneo — design system
   Kid-friendly, CBC-aligned, dependency free.
   ========================================================= */
:root {
    --ink: #0f172a;
    --ink-soft: #334155;
    --muted: #64748b;
    --line: #e2e8f0;
    --line-strong: #cbd5e1;
    --bg: #f5f8fa;
    --card: #ffffff;
    --brand: #0d9488;
    --brand-dark: #0f766e;
    --brand-soft: #ccfbf1;
    --amber: #f59e0b;
    --amber-soft: #fef3c7;
    --blue: #2563eb;
    --blue-soft: #dbeafe;
    --rose: #e11d48;
    --rose-soft: #ffe4e6;
    --violet: #7c3aed;
    --violet-soft: #ede9fe;
    --green: #16a34a;
    --green-soft: #dcfce7;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, .06);
    --shadow: 0 10px 30px -12px rgba(15, 23, 42, .18);
    --shadow-lg: 0 24px 60px -24px rgba(15, 23, 42, .3);
    --radius: 16px;
    --radius-sm: 10px;
    --radius-lg: 26px;
    --font: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    font-family: var(--font);
    color: var(--ink);
    background: var(--bg);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

img, svg { max-width: 100%; }

a { color: var(--brand-dark); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { line-height: 1.2; margin: 0 0 .5rem; letter-spacing: -.02em; }
h1 { font-size: clamp(1.85rem, 4vw, 2.75rem); }
h2 { font-size: clamp(1.4rem, 2.6vw, 1.9rem); }
h3 { font-size: 1.2rem; }
p { margin: 0 0 1rem; }
small { font-size: .82rem; }

.shell { width: min(1160px, 100% - 2.5rem); margin-inline: auto; }
.narrow { width: min(760px, 100% - 2.5rem); margin-inline: auto; }
.center { text-align: center; }
.muted { color: var(--muted); }
.tiny { font-size: .78rem; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.stack { display: grid; gap: 1rem; }
.stack-lg { display: grid; gap: 1.75rem; }
.row { display: flex; gap: .75rem; flex-wrap: wrap; align-items: center; }
.row-between { display: flex; gap: 1rem; justify-content: space-between; align-items: center; flex-wrap: wrap; }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: .5rem; } .mt-2 { margin-top: 1rem; } .mt-3 { margin-top: 1.75rem; } .mt-4 { margin-top: 2.5rem; }
.mb-0 { margin-bottom: 0; } .mb-2 { margin-bottom: 1rem; } .mb-3 { margin-bottom: 1.75rem; }

.skip-link {
    position: absolute; left: -999px; top: 0; background: var(--brand-dark); color: #fff;
    padding: .6rem 1rem; z-index: 200; border-radius: 0 0 8px 0;
}
.skip-link:focus { left: 0; }

/* ---------------- Header ---------------- */
.site-header {
    background: rgba(255, 255, 255, .92);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--line);
    position: sticky; top: 0; z-index: 50;
}
.header-inner { display: flex; align-items: center; gap: 1.25rem; padding: .7rem 0; }
.brand { display: flex; align-items: center; gap: .65rem; text-decoration: none; color: var(--ink); flex-shrink: 0; }
.brand:hover { text-decoration: none; }
.brand-mark {
    width: 42px; height: 42px; display: grid; place-items: center;
    border-radius: 13px; background: linear-gradient(140deg, var(--brand) 0%, #14b8a6 100%);
    color: #fff; font-weight: 800; font-size: .95rem; letter-spacing: .02em;
    box-shadow: 0 6px 16px -6px rgba(13, 148, 136, .8);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.05; }
.brand-text strong { font-size: 1.12rem; letter-spacing: -.02em; }
.brand-text strong span { color: var(--brand); }
.brand-text small { font-size: .68rem; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); }

.site-nav { display: flex; gap: .2rem; margin-left: auto; flex-wrap: wrap; }
.site-nav a {
    padding: .5rem .72rem; border-radius: 9px; color: var(--ink-soft);
    font-size: .92rem; font-weight: 600; text-decoration: none;
}
.site-nav a:hover { background: #f1f5f9; color: var(--ink); }
.site-nav a.is-active { background: var(--brand-soft); color: var(--brand-dark); }

.header-actions { display: flex; align-items: center; gap: .5rem; }
.user-chip { display: flex; align-items: center; gap: .55rem; padding: .3rem .6rem .3rem .35rem; border-radius: 999px; border: 1px solid var(--line); text-decoration: none; color: var(--ink); background: #fff; }
.user-chip:hover { border-color: var(--brand); text-decoration: none; }
.avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand-dark); font-weight: 700; font-size: .9rem; }
.user-meta { display: flex; flex-direction: column; line-height: 1.1; }
.user-meta strong { font-size: .85rem; }
.user-meta small { font-size: .7rem; color: var(--muted); }
.inline-form { display: inline; margin: 0; }

.nav-toggle { display: none; margin-left: auto; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: .5rem .6rem; cursor: pointer; }
.nav-toggle span { display: block; width: 20px; height: 2px; background: var(--ink); margin: 4px 0; border-radius: 2px; }

/* ---------------- Buttons ---------------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
    padding: .7rem 1.15rem; border-radius: 11px; border: 1px solid transparent;
    font-weight: 700; font-size: .93rem; cursor: pointer; font-family: inherit;
    text-decoration: none; transition: transform .12s ease, box-shadow .15s ease, background .15s ease;
    line-height: 1.2;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:focus-visible { outline: 3px solid rgba(13, 148, 136, .35); outline-offset: 2px; }
.btn-primary { background: var(--brand); color: #fff; box-shadow: 0 8px 20px -10px rgba(13, 148, 136, .9); }
.btn-primary:hover { background: var(--brand-dark); }
.btn-amber { background: var(--amber); color: #3b2600; }
.btn-amber:hover { background: #d97706; color: #fff; }
.btn-dark { background: var(--ink); color: #fff; }
.btn-outline { background: #fff; border-color: var(--line-strong); color: var(--ink); }
.btn-outline:hover { border-color: var(--brand); color: var(--brand-dark); background: #f0fdfa; }
.btn-ghost { background: transparent; color: var(--ink-soft); }
.btn-ghost:hover { background: #f1f5f9; }
.btn-danger { background: var(--rose-soft); color: #9f1239; }
.btn-sm { padding: .42rem .75rem; font-size: .82rem; border-radius: 9px; }
.btn-lg { padding: .95rem 1.5rem; font-size: 1rem; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: not-allowed; transform: none; }

/* ---------------- Flash ---------------- */
.flash-stack { margin-top: 1rem; display: grid; gap: .5rem; }
.flash {
    display: flex; justify-content: space-between; align-items: center; gap: 1rem;
    padding: .8rem 1rem; border-radius: 12px; font-size: .92rem; border: 1px solid transparent;
}
.flash button { background: none; border: 0; font-size: 1.2rem; line-height: 1; cursor: pointer; color: inherit; opacity: .6; }
.flash-success { background: var(--green-soft); border-color: #bbf7d0; color: #14532d; }
.flash-info { background: var(--blue-soft); border-color: #bfdbfe; color: #1e3a8a; }
.flash-error { background: var(--rose-soft); border-color: #fecdd3; color: #9f1239; }

/* ---------------- Cards & surfaces ---------------- */
.card {
    background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 1.35rem; box-shadow: var(--shadow-sm);
}
.card-pad-lg { padding: 1.75rem; }
.card-flat { box-shadow: none; }
.card-hover { transition: box-shadow .18s ease, transform .18s ease, border-color .18s ease; }
.card-hover:hover { box-shadow: var(--shadow); transform: translateY(-2px); border-color: var(--line-strong); }
.card-accent { border-top: 4px solid var(--brand); }

.grid { display: grid; gap: 1.1rem; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-auto { grid-template-columns: repeat(auto-fill, minmax(255px, 1fr)); }

/* ---------------- Hero / landing ---------------- */
.hero {
    position: relative; overflow: hidden;
    background: radial-gradient(1100px 460px at 12% -10%, #ecfeff 0%, transparent 60%),
                linear-gradient(160deg, #064e4a 0%, #0f766e 55%, #115e59 100%);
    color: #fff; padding: clamp(2.5rem, 6vw, 4.5rem) 0;
}
.hero::after {
    content: ""; position: absolute; inset: auto -10% -60% 45%; height: 380px;
    background: radial-gradient(closest-side, rgba(251, 191, 36, .35), transparent);
    pointer-events: none;
}
.hero-grid { position: relative; display: grid; grid-template-columns: 1.15fr .85fr; gap: 3rem; align-items: center; z-index: 1; }
.hero .eyebrow {
    display: inline-flex; align-items: center; gap: .5rem; padding: .35rem .8rem; border-radius: 999px;
    background: rgba(255, 255, 255, .14); border: 1px solid rgba(255, 255, 255, .22);
    font-size: .78rem; letter-spacing: .08em; text-transform: uppercase; font-weight: 700; margin-bottom: 1.1rem;
}
.hero h1 { color: #fff; margin-bottom: .9rem; }
.hero h1 em { font-style: normal; color: #fde68a; }
.hero-lede { font-size: clamp(1rem, 1.6vw, 1.15rem); color: #ccfbf1; max-width: 44ch; }
.hero-actions { display: flex; gap: .75rem; flex-wrap: wrap; margin-top: 1.6rem; }
.hero-stats { display: flex; gap: 2rem; margin-top: 2.2rem; flex-wrap: wrap; }
.hero-stats strong { display: block; font-size: 1.5rem; }
.hero-stats span { font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: #99f6e4; }

.hero-card {
    background: rgba(255, 255, 255, .97); color: var(--ink); border-radius: var(--radius-lg);
    padding: 1.5rem; box-shadow: var(--shadow-lg); transform: rotate(-1.2deg);
}
.hero-card h3 { font-size: 1.05rem; }
.hero-card ul { list-style: none; margin: 0; padding: 0; display: grid; gap: .65rem; }
.hero-card li { display: flex; gap: .65rem; align-items: flex-start; font-size: .9rem; }
.hero-card .dot { width: 26px; height: 26px; border-radius: 9px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand-dark); font-size: .85rem; flex-shrink: 0; }

.section { padding: clamp(2.5rem, 5vw, 4rem) 0; }
.section-head { max-width: 60ch; margin-bottom: 2rem; }
.section-head h2 { margin-bottom: .4rem; }
.section-tint { background: #fff; border-block: 1px solid var(--line); }

/* ---------------- Feature / step blocks ---------------- */
.feature { display: grid; gap: .6rem; }
.feature .feature-icon { width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center; font-size: 1.35rem; background: var(--brand-soft); }
.feature h3 { margin: 0; font-size: 1.05rem; }
.feature p { margin: 0; font-size: .9rem; color: var(--muted); }

.steps { counter-reset: step; display: grid; gap: 1rem; grid-template-columns: repeat(3, 1fr); }
.step { position: relative; padding: 1.3rem 1.3rem 1.3rem 3.4rem; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); }
.step::before {
    counter-increment: step; content: counter(step);
    position: absolute; left: 1.1rem; top: 1.2rem; width: 30px; height: 30px; border-radius: 50%;
    display: grid; place-items: center; background: var(--brand); color: #fff; font-weight: 800; font-size: .9rem;
}
.step h3 { font-size: 1rem; margin-bottom: .25rem; }
.step p { margin: 0; font-size: .88rem; color: var(--muted); }

/* ---------------- Page header ---------------- */
.page-head { padding: 2rem 0 1.4rem; }
.page-head h1 { margin-bottom: .35rem; }
.page-head p { color: var(--muted); max-width: 68ch; margin: 0; }
.breadcrumb { display: flex; gap: .45rem; flex-wrap: wrap; font-size: .82rem; color: var(--muted); margin-bottom: .7rem; }
.breadcrumb a { color: var(--brand-dark); }
.breadcrumb span::before { content: "/"; margin-right: .45rem; color: var(--line-strong); }

/* ---------------- Badges, pills, chips ---------------- */
.badge {
    display: inline-flex; align-items: center; gap: .35rem; padding: .2rem .6rem; border-radius: 999px;
    font-size: .74rem; font-weight: 700; letter-spacing: .02em; background: #f1f5f9; color: var(--ink-soft);
}
.badge-brand { background: var(--brand-soft); color: var(--brand-dark); }
.badge-amber { background: var(--amber-soft); color: #92400e; }
.badge-blue { background: var(--blue-soft); color: #1e40af; }
.badge-rose { background: var(--rose-soft); color: #9f1239; }
.badge-green { background: var(--green-soft); color: #166534; }
.badge-violet { background: var(--violet-soft); color: #5b21b6; }

.chip-row { display: flex; gap: .5rem; flex-wrap: wrap; }
.chip {
    padding: .42rem .85rem; border-radius: 999px; border: 1px solid var(--line); background: #fff;
    font-size: .84rem; font-weight: 600; color: var(--ink-soft); text-decoration: none;
}
.chip:hover { border-color: var(--brand); color: var(--brand-dark); text-decoration: none; }
.chip.is-active { background: var(--ink); border-color: var(--ink); color: #fff; }

/* ---------------- Learning area cards ---------------- */
.area-card { display: flex; flex-direction: column; gap: .55rem; padding: 1.2rem; text-decoration: none; color: inherit; position: relative; }
.area-card:hover { text-decoration: none; }
.area-card .area-icon { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; font-size: 1.3rem; background: #f0fdfa; }
.area-card h3 { font-size: 1rem; margin: .2rem 0 0; }
.area-card p { margin: 0; font-size: .84rem; color: var(--muted); }
.area-card .area-foot { margin-top: auto; display: flex; justify-content: space-between; align-items: center; font-size: .78rem; color: var(--muted); padding-top: .4rem; }

/* ---------------- Tables ---------------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
table.table { width: 100%; border-collapse: collapse; font-size: .9rem; min-width: 520px; }
table.table th, table.table td { padding: .8rem 1rem; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.table thead th { background: #f8fafc; font-size: .76rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; }
table.table tbody tr:last-child td { border-bottom: 0; }
table.table tbody tr:hover { background: #fbfdfd; }
.table-num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------------- Forms ---------------- */
.form-grid { display: grid; gap: 1rem; }
label.field { display: grid; gap: .35rem; font-size: .87rem; font-weight: 600; color: var(--ink-soft); }
.field input, .field select, .field textarea, .input {
    width: 100%; padding: .72rem .85rem; border: 1px solid var(--line-strong); border-radius: 10px;
    font-family: inherit; font-size: .94rem; background: #fff; color: var(--ink);
}
.field textarea { min-height: 110px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus, .input:focus {
    outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(13, 148, 136, .15);
}
.field-hint { font-size: .78rem; font-weight: 400; color: var(--muted); }
.form-error { background: var(--rose-soft); color: #9f1239; border: 1px solid #fecdd3; padding: .7rem .9rem; border-radius: 10px; font-size: .88rem; }
.form-split { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

/* ---------------- Progress + charts ---------------- */
.bar { height: 9px; background: #eef2f6; border-radius: 999px; overflow: hidden; }
.bar > span { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, #14b8a6, #0d9488); }
.bar.bar-amber > span { background: linear-gradient(90deg, #fbbf24, #f59e0b); }
.bar.bar-rose > span { background: linear-gradient(90deg, #fb7185, #e11d48); }
.bar.bar-blue > span { background: linear-gradient(90deg, #60a5fa, #2563eb); }
.ring { width: 74px; height: 74px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 1.05rem; color: var(--brand-dark); background: conic-gradient(var(--brand) calc(var(--value) * 1%), #e8eef2 0); position: relative; }
.ring::before { content: ""; position: absolute; inset: 7px; background: #fff; border-radius: 50%; }
.ring span { position: relative; }

.stat-tile { display: grid; gap: .2rem; padding: 1.1rem 1.2rem; background: #fff; border: 1px solid var(--line); border-radius: 14px; }
.stat-tile strong { font-size: 1.55rem; letter-spacing: -.02em; }
.stat-tile span { font-size: .8rem; color: var(--muted); }

.sparkline { width: 100%; height: 150px; }
.sparkline .axis { stroke: #e2e8f0; stroke-width: 1; }
.sparkline .line { fill: none; stroke: var(--brand); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.sparkline .dot { fill: #fff; stroke: var(--brand); stroke-width: 2.5; }

.level-pill { font-size: .72rem; font-weight: 800; padding: .15rem .5rem; border-radius: 6px; letter-spacing: .04em; }
.level-ee { background: #dcfce7; color: #166534; }
.level-me { background: #dbeafe; color: #1e40af; }
.level-ae { background: #fef3c7; color: #92400e; }
.level-be { background: #ffe4e6; color: #9f1239; }

/* ---------------- Tabs ---------------- */
.tabs { display: flex; gap: .3rem; border-bottom: 1px solid var(--line); margin-bottom: 1.5rem; overflow-x: auto; }
.tabs a { padding: .65rem .95rem; font-size: .9rem; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a:hover { color: var(--ink); text-decoration: none; }
.tabs a.is-active { color: var(--brand-dark); border-color: var(--brand); }

/* ---------------- Landing specific ---------------- */
.grade-strip { display: flex; gap: .5rem; flex-wrap: wrap; }
.grade-pill { padding: .5rem .85rem; border-radius: 10px; background: #fff; border: 1px solid var(--line); font-weight: 700; font-size: .85rem; color: var(--ink-soft); }
.grade-pill:hover { border-color: var(--brand); color: var(--brand-dark); text-decoration: none; }

.game-card { text-decoration: none; color: inherit; display: flex; flex-direction: column; gap: .5rem; overflow: hidden; position: relative; }
.game-card:hover { text-decoration: none; }
.game-card .game-art {
    height: 116px; display: grid; place-items: center; font-size: 2.6rem;
    border-radius: 12px; margin: -.35rem -.35rem .4rem;
}
.art-munchers { background: linear-gradient(135deg, #0f172a, #134e4a); color: #5eead4; }
.art-sudoku { background: linear-gradient(135deg, #1e1b4b, #4c1d95); color: #ddd6fe; }
.art-typing { background: linear-gradient(135deg, #7c2d12, #b45309); color: #fde68a; }
.game-card h3 { margin: 0; font-size: 1.02rem; }
.game-card p { margin: 0; font-size: .85rem; color: var(--muted); }
.game-card .game-meta { display: flex; justify-content: space-between; font-size: .78rem; color: var(--muted); padding-top: .45rem; border-top: 1px dashed var(--line); margin-top: auto; }

/* ---------------- Quiz ---------------- */
.quiz-shell { max-width: 820px; margin-inline: auto; }
.quiz-topbar { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 1rem; flex-wrap: wrap; }
.quiz-progress { flex: 1; min-width: 180px; }
.quiz-progress .bar { height: 8px; }
.quiz-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 1.75rem; box-shadow: var(--shadow-sm); }
.quiz-card h2 { font-size: 1.25rem; line-height: 1.45; margin-bottom: 1.25rem; }
.options { display: grid; gap: .65rem; }
.option {
    display: flex; gap: .8rem; align-items: center; width: 100%; text-align: left;
    padding: .85rem 1rem; border: 1.5px solid var(--line); border-radius: 12px; background: #fff;
    font-size: .95rem; cursor: pointer; font-family: inherit; color: var(--ink); transition: border-color .15s, background .15s, transform .12s;
}
.option:hover:not([disabled]) { border-color: var(--brand); background: #f0fdfa; }
.option .key {
    width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center;
    background: #f1f5f9; font-weight: 800; font-size: .82rem; color: var(--ink-soft); flex-shrink: 0;
}
.option.is-correct { border-color: #16a34a; background: #f0fdf4; }
.option.is-correct .key { background: #16a34a; color: #fff; }
.option.is-wrong { border-color: var(--rose); background: #fff1f2; }
.option.is-wrong .key { background: var(--rose); color: #fff; }
.option .tick { margin-left: auto; font-weight: 700; }
.quiz-feedback { margin-top: 1.1rem; padding: .95rem 1.1rem; border-radius: 12px; font-size: .9rem; }
.quiz-feedback.ok { background: #f0fdf4; border: 1px solid #bbf7d0; color: #14532d; }
.quiz-feedback.no { background: #fff1f2; border: 1px solid #fecdd3; color: #9f1239; }
.quiz-nav { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-top: 1.3rem; flex-wrap: wrap; }
.quiz-timer { font-variant-numeric: tabular-nums; font-weight: 700; }
.quiz-dots { display: flex; gap: .3rem; flex-wrap: wrap; }
.quiz-dot { width: 26px; height: 6px; border-radius: 999px; background: #e2e8f0; }
.quiz-dot.done { background: var(--brand); }
.quiz-dot.flag { background: var(--amber); }

.result-hero { text-align: center; padding: 2rem 1rem; }
.result-hero .score-big { font-size: clamp(2.6rem, 7vw, 4rem); font-weight: 800; letter-spacing: -.04em; line-height: 1; }

/* ---------------- Lesson / reading ---------------- */
.lesson-body { font-size: 1.02rem; line-height: 1.75; color: #1e293b; }
.lesson-body h2 { font-size: 1.3rem; margin: 2rem 0 .6rem; }
.lesson-body h3 { font-size: 1.08rem; margin: 1.5rem 0 .5rem; color: var(--brand-dark); }
.lesson-body ul, .lesson-body ol { padding-left: 1.3rem; margin: 0 0 1rem; }
.lesson-body li { margin-bottom: .4rem; }
.lesson-body blockquote {
    margin: 1.2rem 0; padding: 1rem 1.2rem; background: #f0fdfa; border-left: 4px solid var(--brand);
    border-radius: 0 10px 10px 0; font-size: .95rem;
}
.lesson-body .example { background: #fffbeb; border: 1px solid #fde68a; border-radius: 12px; padding: 1rem 1.2rem; margin: 1.2rem 0; }
.lesson-body .example strong { color: #92400e; }
.lesson-body table { width: 100%; border-collapse: collapse; margin: 1rem 0; font-size: .92rem; }
.lesson-body th, .lesson-body td { border: 1px solid var(--line); padding: .55rem .7rem; text-align: left; }
.lesson-body th { background: #f8fafc; }
.outcome-list { list-style: none; padding: 0; margin: 0; display: grid; gap: .5rem; }
.outcome-list li { display: flex; gap: .55rem; font-size: .9rem; align-items: flex-start; }
.outcome-list li::before { content: "✓"; color: var(--brand); font-weight: 800; }

/* ---------------- Translator ---------------- */
.translator-grid { display: grid; grid-template-columns: 1fr auto 1fr; gap: 1rem; align-items: start; }
.translator-pane { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.translator-pane header { display: flex; justify-content: space-between; align-items: center; padding: .7rem 1rem; border-bottom: 1px solid var(--line); background: #f8fafc; font-size: .85rem; font-weight: 700; }
.translator-pane textarea { border: 0; width: 100%; min-height: 180px; padding: 1rem; font-size: 1.02rem; font-family: inherit; resize: vertical; }
.translator-pane textarea:focus { outline: none; }
.translator-out { padding: 1rem; min-height: 180px; font-size: 1.02rem; white-space: pre-wrap; }
.swap-btn { align-self: center; width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--line-strong); background: #fff; cursor: pointer; font-size: 1.1rem; }
.swap-btn:hover { border-color: var(--brand); color: var(--brand-dark); }
.gloss { display: flex; flex-wrap: wrap; gap: .35rem; }
.gloss-item { background: #f8fafc; border: 1px solid var(--line); border-radius: 8px; padding: .2rem .5rem; font-size: .82rem; }
.gloss-item b { color: var(--brand-dark); }
.gloss-item.unknown { border-style: dashed; color: var(--muted); }

/* ---------------- Games ---------------- */
.game-stage { background: #0b1220; border-radius: var(--radius); padding: 1.2rem; color: #e2e8f0; box-shadow: var(--shadow-lg); }
.game-hud { display: flex; justify-content: space-between; gap: 1rem; align-items: center; flex-wrap: wrap; margin-bottom: .9rem; font-size: .85rem; }
.game-hud .hud-item { display: flex; gap: .4rem; align-items: center; }
.game-hud strong { color: #5eead4; font-variant-numeric: tabular-nums; }

.muncher-prompt {
    background: #0f766e; border-radius: 10px; padding: .7rem 1rem; text-align: center;
    font-weight: 700; font-size: 1rem; color: #f0fdfa; margin-bottom: .8rem;
}
.muncher-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: .45rem; }
.muncher-cell {
    aspect-ratio: 1 / 1; display: grid; place-items: center; border-radius: 10px;
    background: #1e293b; color: #e2e8f0; font-weight: 700; font-size: clamp(.85rem, 2vw, 1.15rem);
    border: 1px solid #334155; font-family: inherit; cursor: pointer; user-select: none;
}
.muncher-cell:focus-visible { outline: 3px solid #fbbf24; outline-offset: 1px; }
.muncher-cell.has-muncher { background: #14b8a6; border-color: #5eead4; color: #04211f; box-shadow: 0 0 0 3px rgba(94, 234, 212, .35); }
.muncher-cell.troggle { background: #7f1d1d; border-color: #f87171; color: #fecaca; }
.muncher-cell.eaten { opacity: .18; }
.muncher-cell.wrong-flash { background: #9f1239; border-color: #fda4af; }
.muncher-cell.right-flash { background: #16a34a; border-color: #86efac; }
.game-note { font-size: .8rem; color: #94a3b8; margin-top: .7rem; text-align: center; }

.sudoku-board { display: grid; grid-template-columns: repeat(9, 1fr); width: min(520px, 100%); margin: 0 auto; background: #0f172a; border: 3px solid #5eead4; border-radius: 8px; overflow: hidden; }
.sudoku-cell {
    aspect-ratio: 1/1; display: grid; place-items: center; font-size: clamp(1rem, 3.4vw, 1.5rem);
    background: #111c2e; color: #e2e8f0; border: 1px solid #1e293b; cursor: pointer;
    font-family: inherit; font-weight: 600; position: relative; padding: 0;
}
.sudoku-cell.given { color: #fbbf24; font-weight: 800; background: #0b1220; }
.sudoku-cell.selected { background: #134e4a; box-shadow: inset 0 0 0 2px #5eead4; }
.sudoku-cell.peer { background: #16283d; }
.sudoku-cell.same { color: #5eead4; }
.sudoku-cell.invalid { color: #fda4af; }
.sudoku-cell.b3-right { border-right: 2px solid #475569; }
.sudoku-cell.b3-bottom { border-bottom: 2px solid #475569; }
.sudoku-cell .notes { font-size: .5rem; line-height: 1; color: #93c5fd; display: grid; grid-template-columns: repeat(3, 1fr); width: 100%; height: 100%; padding: 1px; }
.sudoku-pad { display: grid; grid-template-columns: repeat(5, 1fr); gap: .4rem; margin-top: .8rem; }
.sudoku-pad button { padding: .7rem 0; border-radius: 9px; background: #1e293b; color: #e2e8f0; border: 1px solid #334155; font-weight: 700; font-size: 1.05rem; cursor: pointer; font-family: inherit; }
.sudoku-pad button:hover { background: #334155; }

.typing-text { font-size: 1.35rem; line-height: 1.9; letter-spacing: .01em; font-family: "Consolas", ui-monospace, monospace; color: #64748b; padding: .5rem 0; outline: none; }
.typing-text .ok { color: #5eead4; background: rgba(20, 184, 166, .14); border-radius: 3px; }
.typing-text .bad { color: #fda4af; background: rgba(225, 29, 72, .2); border-radius: 3px; text-decoration: underline wavy #fb7185; }
.typing-text .cur { background: #fbbf24; color: #0b1220; border-radius: 3px; box-shadow: 0 0 0 2px rgba(251, 191, 36, .4); }
.typing-input { position: absolute; opacity: 0; pointer-events: none; }
.key-heat { display: grid; gap: .25rem; }
.key-heat .krow { display: flex; gap: .25rem; justify-content: center; }
.key-heat .k { width: 34px; height: 34px; border-radius: 7px; display: grid; place-items: center; font-size: .75rem; font-weight: 700; color: #0b1220; }

/* ---------------- Admin ---------------- */
.admin-shell { display: grid; grid-template-columns: 230px 1fr; gap: 1.5rem; align-items: start; }
.admin-nav { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: .6rem; display: grid; gap: .15rem; position: sticky; top: 84px; }
.admin-nav a { padding: .6rem .8rem; border-radius: 9px; font-size: .9rem; font-weight: 600; color: var(--ink-soft); }
.admin-nav a:hover { background: #f1f5f9; text-decoration: none; }
.admin-nav a.is-active { background: var(--brand-soft); color: var(--brand-dark); }
.mono { font-family: "Consolas", ui-monospace, monospace; font-size: .85rem; }

/* ---------------- Auth ---------------- */
.auth-wrap { display: grid; grid-template-columns: 1fr 1fr; min-height: calc(100vh - 70px); }
.auth-side { background: linear-gradient(160deg, #064e4a, #0f766e 60%, #115e59); color: #fff; padding: 3rem; display: flex; flex-direction: column; justify-content: center; gap: 1rem; }
.auth-side h2 { color: #fff; font-size: 1.8rem; }
.auth-side p { color: #ccfbf1; }
.auth-side ul { list-style: none; padding: 0; display: grid; gap: .8rem; }
.auth-side li { display: flex; gap: .7rem; align-items: flex-start; font-size: .92rem; color: #e6fffb; }
.auth-side li b { color: #fde68a; }
.auth-form { display: flex; align-items: center; justify-content: center; padding: 2.5rem 1.5rem; }
.auth-card { width: min(430px, 100%); }

/* ---------------- Misc ---------------- */
.empty { text-align: center; padding: 3rem 1.5rem; color: var(--muted); }
.empty .empty-icon { font-size: 2.6rem; margin-bottom: .6rem; }
.alert { padding: .9rem 1.1rem; border-radius: 12px; border: 1px solid var(--line); background: #fff; font-size: .9rem; }
.alert-info { background: var(--blue-soft); border-color: #bfdbfe; color: #1e3a8a; }
.alert-warn { background: var(--amber-soft); border-color: #fde68a; color: #92400e; }
.alert-success { background: var(--green-soft); border-color: #bbf7d0; color: #14532d; }
.divider { height: 1px; background: var(--line); margin: 1.5rem 0; border: 0; }
.kbd { display: inline-block; padding: .1rem .4rem; border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 5px; font-size: .78rem; font-family: "Consolas", monospace; background: #fff; }

.site-footer { background: #0b1220; color: #94a3b8; margin-top: 4rem; padding: 3rem 0 1.5rem; }
.footer-grid { display: grid; grid-template-columns: 1.5fr 1fr 1fr 1fr; gap: 2rem; }
.footer-grid h4 { color: #e2e8f0; font-size: .8rem; text-transform: uppercase; letter-spacing: .1em; margin-bottom: .8rem; }
.footer-grid ul { list-style: none; padding: 0; margin: 0; display: grid; gap: .45rem; }
.footer-grid a { color: #94a3b8; font-size: .88rem; }
.footer-grid a:hover { color: #5eead4; }
.brand-footer .brand-text strong { color: #fff; }
.brand-footer .brand-text small { color: #64748b; }
.footer-note { font-size: .84rem; margin-top: .9rem; line-height: 1.7; max-width: 38ch; }
.footer-bottom { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-top: 2.5rem; padding-top: 1.2rem; border-top: 1px solid #1e293b; font-size: .78rem; }

/* ---------------- Analytics heat map ---------------- */
.heat-frame { background: linear-gradient(145deg, #f0fdfa, #f8fafc); border: 1px solid var(--line); border-radius: 18px; padding: 1rem; margin-top: .8rem; }
#heat-canvas { display: block; width: 100%; height: auto; border-radius: 12px; background: #fff; box-shadow: 0 8px 24px rgba(15, 23, 42, .08); }
.heat-legend { display: flex; align-items: center; gap: .6rem; margin-top: .65rem; font-size: .74rem; color: var(--muted); }
.heat-gradient { flex: 1; max-width: 240px; height: 8px; border-radius: 99px; background: linear-gradient(90deg, #fef3c7, #f59e0b, #ef4444); }

/* ---------------- Game layout ---------------- */
.game-layout { grid-template-columns: minmax(0, 1fr) 300px; align-items: start; }

/* ---------------- Responsive ---------------- */
@media (max-width: 980px) {
    .hero-grid { grid-template-columns: 1fr; gap: 2rem; }
    .hero-card { transform: none; }
    .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .steps { grid-template-columns: 1fr; }
    .footer-grid { grid-template-columns: 1fr 1fr; }
    .admin-shell { grid-template-columns: 1fr; }
    .admin-nav { position: static; grid-auto-flow: column; overflow-x: auto; }
    .auth-wrap { grid-template-columns: 1fr; }
    .auth-side { display: none; }
}
@media (max-width: 760px) {
    .nav-toggle { display: block; }
    .site-nav {
        display: none; position: absolute; left: 0; right: 0; top: 100%;
        background: #fff; border-bottom: 1px solid var(--line); padding: .8rem 1.2rem 1rem;
        flex-direction: column; gap: .15rem; box-shadow: var(--shadow);
    }
    .site-nav.is-open { display: flex; }
    .site-nav a { padding: .7rem .8rem; }
    .header-inner { position: relative; flex-wrap: wrap; }
    .header-actions { margin-left: auto; }
    .user-meta { display: none; }
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
    .form-split { grid-template-columns: 1fr; }
    .translator-grid { grid-template-columns: 1fr; }
    .swap-btn { justify-self: center; transform: rotate(90deg); }
    .muncher-grid { gap: .3rem; }
    .muncher-cell { font-size: .8rem; border-radius: 7px; }
    .card { padding: 1.1rem; }
    .hero-stats { gap: 1.4rem; }
    .footer-grid { grid-template-columns: 1fr; gap: 1.5rem; }
    .quiz-card { padding: 1.2rem; }
    .sudoku-cell .notes { font-size: .38rem; }
}
@media (max-width: 760px) {
    .game-layout { grid-template-columns: 1fr; }
    .game-layout > * { min-width: 0; }
    .game-stage { padding: .95rem; }
    .typing-text { overflow-wrap: anywhere; }
    .key-heat .krow { gap: .18rem; }
    .key-heat .k { width: calc((100% - 1.62rem) / 10); height: auto; aspect-ratio: 1 / 1; font-size: .62rem; }
    .nav-toggle { min-width: 44px; min-height: 44px; display: grid; place-content: center; }
    .header-actions .btn-sm { min-height: 44px; }
    .game-hud .btn,
    .game-stage .btn-sm,
    .math-chip,
    .sudoku-pad button { min-height: 44px; }
    .game-stage .btn-sm { min-width: 44px; }
    .math-chip { padding: .55rem .85rem; }
    .sudoku-pad button { padding: .8rem 0; }
    .muncher-grid { gap: .3rem; }
    .muncher-cell { min-width: 0; }
}
@media print {
    .site-header, .site-footer, .btn, .nav-toggle { display: none !important; }
    body { background: #fff; }
    .card { box-shadow: none; }
}

/* Live translator, picture words and speech controls */
.translator-status { font-size: .72rem; font-weight: 600; letter-spacing: 0; text-transform: none; color: var(--muted); }
.translator-out.is-placeholder { color: var(--muted); }
.translator-out.is-busy { opacity: .55; }
.image-strip { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: .55rem; margin-top: .6rem; }
.image-card { display: flex; align-items: center; gap: .5rem; border: 1px solid var(--line); border-radius: 10px; background: #fff; padding: .45rem .5rem; }
.image-card img { width: 44px; height: 44px; flex: 0 0 auto; }
.image-card-text { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.image-card-text strong { font-size: .82rem; word-break: break-word; }
.image-card-text span { font-size: .78rem; color: var(--brand-dark); }
.speak-btn { cursor: pointer; }
.image-card .speak-btn { margin-left: auto; border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: .28rem .4rem; font-size: .85rem; line-height: 1; }
.image-card .speak-btn:hover { border-color: var(--brand); }
.image-card .speak-btn[hidden] { display: none; }

/* Word sounds, audio recording and SVG uploads (admin + translator) */
.gloss-item { display: inline-flex; align-items: center; gap: .28rem; }
.gloss-item .gloss-audio { border: 0; background: transparent; padding: 0 .08rem; font-size: .82rem; line-height: 1; color: var(--brand-dark); }
.gloss-item .gloss-audio:hover { color: var(--brand); }
.image-card .speak-btn { margin-left: auto; }
.image-card .speak-btn.image-audio { border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: .3rem .34rem; font-size: .6rem; font-weight: 800; letter-spacing: .02em; line-height: 1; margin-left: 0; }
.image-card .speak-btn.image-audio:hover { border-color: var(--brand); color: var(--brand-dark); }
.audio-field .row { flex-wrap: wrap; }
.audio-field.is-recording [data-record] { background: #ffe4e6; border-color: #fda4af; color: #9f1239; }
.audio-preview { width: 100%; margin-top: .4rem; height: 34px; }

/* Math Sprint */
.game-art.art-math { background: linear-gradient(135deg, #7c2d12, #f59e0b 60%, #fbbf24); }
.math-chips { display: flex; flex-wrap: wrap; gap: .4rem; justify-content: center; margin-top: .2rem; }
.math-chip { border: 1px solid #334155; background: #111c2e; color: #cbd5e1; border-radius: 999px; padding: .34rem .72rem; font-size: .76rem; font-weight: 700; cursor: pointer; font-family: inherit; }
.math-chip:hover { border-color: #5eead4; color: #e2e8f0; }
.math-chip.is-active { background: #fbbf24; border-color: #fbbf24; color: #0b1220; }
.math-overlay { text-align: center; padding: 1.4rem .6rem; }
.math-overlay h3 { color: #fff; margin: 0 0 .4rem; }
.math-overlay p { color: #94a3b8; font-size: .9rem; max-width: 46ch; margin: 0 auto .9rem; }
.math-question { text-align: center; font-size: clamp(2rem, 6vw, 3.4rem); font-weight: 800; color: #f8fafc; padding: 1.2rem 0 .8rem; font-variant-numeric: tabular-nums; letter-spacing: .01em; }
.math-answer-row { display: flex; gap: .5rem; justify-content: center; align-items: stretch; }
.math-answer { width: min(220px, 62%); font-size: 1.5rem; text-align: center; font-weight: 800; font-family: inherit; padding: .65rem .7rem; border-radius: 12px; border: 2px solid #334155; background: #0f172a; color: #e2e8f0; font-variant-numeric: tabular-nums; }
.math-answer:focus { outline: none; border-color: #5eead4; box-shadow: 0 0 0 3px rgba(94, 234, 212, .18); }
.math-feedback { min-height: 1.5rem; text-align: center; font-size: .9rem; font-weight: 700; color: #94a3b8; margin: .55rem 0 0; }
.math-feedback.ok { color: #5eead4; }
.math-feedback.bad { color: #fda4af; }
.math-score-big { font-size: 2.6rem; font-weight: 800; color: #fbbf24; margin: 0 0 .3rem; }
.math-save { min-height: 1.3rem; color: #5eead4; font-weight: 600; }

/* Math Sprint */
.game-art.art-math { background: linear-gradient(135deg, #7c2d12, #f59e0b 60%, #fbbf24); }
.math-chips { display: flex; flex-wrap: wrap; gap: .4rem; justify-content: center; margin-top: .2rem; }
.math-chip { border: 1px solid #334155; background: #111c2e; color: #cbd5e1; border-radius: 999px; padding: .34rem .72rem; font-size: .76rem; font-weight: 700; cursor: pointer; font-family: inherit; }
.math-chip:hover { border-color: #5eead4; color: #e2e8f0; }
.math-chip.is-active { background: #fbbf24; border-color: #fbbf24; color: #0b1220; }
.math-overlay { text-align: center; padding: 1.4rem .6rem; }
.math-overlay h3 { color: #fff; margin: 0 0 .4rem; }
.math-overlay p { color: #94a3b8; font-size: .9rem; max-width: 46ch; margin: 0 auto .9rem; }
.math-question { text-align: center; font-size: clamp(2rem, 6vw, 3.4rem); font-weight: 800; color: #f8fafc; padding: 1.2rem 0 .8rem; font-variant-numeric: tabular-nums; letter-spacing: .01em; }
.math-answer-row { display: flex; gap: .5rem; justify-content: center; align-items: stretch; }
.math-answer { width: min(220px, 62%); font-size: 1.5rem; text-align: center; font-weight: 800; font-family: inherit; padding: .65rem .7rem; border-radius: 12px; border: 2px solid #334155; background: #0f172a; color: #e2e8f0; font-variant-numeric: tabular-nums; }
.math-answer:focus { outline: none; border-color: #5eead4; box-shadow: 0 0 0 3px rgba(94, 234, 212, .18); }
.math-feedback { min-height: 1.5rem; text-align: center; font-size: .9rem; font-weight: 700; color: #94a3b8; margin: .55rem 0 0; }
.math-feedback.ok { color: #5eead4; }
.math-feedback.bad { color: #fda4af; }
.math-score-big { font-size: 2.6rem; font-weight: 800; color: #fbbf24; margin: 0 0 .3rem; }
.math-save { min-height: 1.3rem; color: #5eead4; font-weight: 600; }
