/* ==========================================================================
   EnkuQuest Kids — main stylesheet
   Mobile-first. Sections:
   1. Tokens   2. Base   3. Layout & header/nav   4. Buttons & UI bits
   5. Home     6. Story cards   7. Reader   8. Quiz   9. Rewards
   10. Footer  11. Animations   12. Breakpoints
   ========================================================================== */

/* 1. Tokens ---------------------------------------------------------------- */
:root {
    --cream:        #FFF8EC;
    --cream-2:      #FBEFD9;
    --cream-3:      #F5E3C1;
    --paper:        #FFFDF8;
    --green:        #1F5E3B;
    --green-2:      #2E7D4F;
    --green-soft:   #E3F1E7;
    --blue:         #2348A8;
    --blue-2:       #3A63D0;
    --blue-soft:    #E4EBFB;
    --gold:         #E3A72F;
    --gold-2:       #F5C451;
    --gold-deep:    #B9801C;
    --gold-soft:    #FDF1D3;
    --red:          #C8452E;
    --red-soft:     #FBE6E1;
    --ink:          #2A2118;
    --ink-2:        #5C4E3E;
    --ink-3:        #8C7B66;
    --line:         #EADBC0;

    --font-display: 'Fredoka', 'Noto Sans Ethiopic', system-ui, sans-serif;
    --font-body:    'Nunito', 'Noto Sans Ethiopic', system-ui, -apple-system, 'Segoe UI', sans-serif;

    --radius-sm: 12px;
    --radius:    20px;
    --radius-lg: 28px;
    --radius-xl: 36px;
    --shadow-sm: 0 2px 6px rgba(74, 52, 20, .08);
    --shadow:    0 10px 28px -10px rgba(74, 52, 20, .25);
    --shadow-lg: 0 24px 50px -18px rgba(74, 52, 20, .35);
    --ease-bounce: cubic-bezier(.34, 1.56, .64, 1);

    --nav-h: 68px;
    --safe-b: env(safe-area-inset-bottom, 0px);

    --accent:      var(--green);
    --accent-2:    var(--green-2);
    --accent-soft: var(--green-soft);
}

.theme-green { --accent: var(--green); --accent-2: var(--green-2); --accent-soft: var(--green-soft); }
.theme-blue  { --accent: var(--blue);  --accent-2: var(--blue-2);  --accent-soft: var(--blue-soft); }
.theme-gold  { --accent: #A86A10;      --accent-2: var(--gold);    --accent-soft: var(--gold-soft); }
.theme-royal { --accent: #5B3A9E;      --accent-2: #7A55C4;        --accent-soft: #EEE7FA; }

/* 2. Base ------------------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
    margin: 0;
    min-height: 100vh;
    font-family: var(--font-body);
    font-size: 1rem;
    line-height: 1.6;
    color: var(--ink);
    background-color: var(--cream);
    background-image: url('../images/patterns/meskel-pattern.svg');
    background-size: 96px 96px;
    padding-bottom: calc(var(--nav-h) + var(--safe-b));
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

/* Amharic reads better slightly larger with more line height. */
.lang-am { --font-display: 'Noto Sans Ethiopic', 'Fredoka', system-ui, sans-serif; --font-body: 'Noto Sans Ethiopic', 'Nunito', system-ui, sans-serif; line-height: 1.75; }
.lang-am h1, .lang-am h2, .lang-am h3 { letter-spacing: 0; }

img { max-width: 100%; display: block; }
a { color: var(--blue); text-decoration-thickness: 2px; text-underline-offset: 3px; }
h1, h2, h3 { font-family: var(--font-display); line-height: 1.2; margin: 0 0 .5em; color: var(--ink); font-weight: 700; }
p { margin: 0 0 1em; }
button { font: inherit; }
[hidden] { display: none !important; }

:focus-visible { outline: 3px solid var(--blue-2); outline-offset: 3px; border-radius: 8px; }

.skip-link {
    position: absolute; left: 12px; top: -60px; z-index: 100;
    background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 12px;
    transition: top .2s;
}
.skip-link:focus { top: 12px; }

.icon { width: 22px; height: 22px; flex-shrink: 0; }
.icon-sm { width: 18px; height: 18px; }
.text-center { text-align: center; }

/* 3. Layout, header & nav -------------------------------------------------- */
.container { width: 100%; max-width: 1160px; margin: 0 auto; padding: 0 16px; }

.site-header {
    position: sticky; top: 0; z-index: 40;
    background: var(--cream);
    /* No backdrop-filter here on mobile: it would become the containing block
       for the fixed bottom nav. The blur is enabled at the desktop breakpoint. */
}
.header-inner { display: flex; align-items: center; gap: 12px; min-height: 64px; }

.tibeb-band {
    height: 12px;
    background: url('../images/patterns/tibeb.svg') repeat-x center / auto 12px;
}

.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--green); margin-right: auto; }
.brand-mark { width: 38px; height: 38px; display: grid; place-items: center; background: var(--green); border-radius: 12px; box-shadow: var(--shadow-sm); transform: rotate(-6deg); transition: transform .4s var(--ease-bounce); }
.brand-mark svg { width: 26px; height: 26px; }
.brand:hover .brand-mark { transform: rotate(6deg) scale(1.06); }
.brand-text { font-family: 'Fredoka', sans-serif; font-weight: 600; font-size: 1.3rem; letter-spacing: -.01em; line-height: 1; }
.brand-text b { color: var(--gold-deep); font-weight: 700; }
.brand-text small { font-size: .62em; background: var(--blue); color: #fff; border-radius: 999px; padding: 3px 8px; margin-left: 2px; vertical-align: middle; font-weight: 600; }

.lang-switch { display: flex; background: var(--cream-2); border: 2px solid var(--line); border-radius: 999px; padding: 3px; }
.lang-option {
    min-width: 42px; text-align: center; padding: 5px 10px; border-radius: 999px;
    font-weight: 800; font-size: .85rem; color: var(--ink-2); text-decoration: none;
    transition: background .2s, color .2s;
}
.lang-option[lang="am"] { font-family: 'Noto Sans Ethiopic', sans-serif; }
.lang-option.is-active { background: var(--green); color: #fff; box-shadow: var(--shadow-sm); }
.lang-option:not(.is-active):hover { color: var(--green); }

/* Mobile: bottom tab bar (also ideal for Telegram Mini Apps) */
.main-nav {
    position: fixed; z-index: 50; left: 0; right: 0; bottom: 0;
    display: grid; grid-template-columns: repeat(5, 1fr);
    height: calc(var(--nav-h) + var(--safe-b));
    padding: 6px 8px var(--safe-b);
    background: var(--paper);
    border-top: 2px solid var(--line);
    box-shadow: 0 -8px 24px -12px rgba(74, 52, 20, .25);
}
.nav-link {
    position: relative;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    font-size: .75rem; font-weight: 800; color: var(--ink-3); text-decoration: none;
    border-radius: 16px; transition: color .2s, background .2s;
}
.nav-link .nav-icon { width: 24px; height: 24px; transition: transform .3s var(--ease-bounce); }
.nav-link.is-active { color: var(--green); background: var(--green-soft); }
.nav-link.is-active .nav-icon { transform: translateY(-2px) scale(1.1); }
.nav-badge {
    position: absolute; top: 4px; left: calc(50% + 6px);
    min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px;
    background: var(--gold); color: var(--ink); font-size: .7rem; line-height: 18px; text-align: center;
}

.site-main { display: block; }

/* 4. Buttons & UI bits ----------------------------------------------------- */
.btn {
    --btn-bg: var(--cream-2); --btn-fg: var(--ink); --btn-shadow: var(--line);
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    min-height: 48px; padding: 12px 22px;
    font-family: var(--font-display); font-weight: 600; font-size: 1.02rem; line-height: 1.1;
    color: var(--btn-fg); background: var(--btn-bg);
    border: 0; border-radius: 999px; cursor: pointer; text-decoration: none;
    box-shadow: 0 4px 0 var(--btn-shadow);
    transition: transform .15s ease, box-shadow .15s ease, filter .2s;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 6px 0 var(--btn-shadow); filter: brightness(1.04); }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--btn-shadow); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; box-shadow: 0 4px 0 var(--btn-shadow); }

.btn-primary { --btn-bg: var(--accent); --btn-fg: #fff; --btn-shadow: color-mix(in srgb, var(--accent) 60%, #000); }
.btn-gold    { --btn-bg: linear-gradient(180deg, var(--gold-2), var(--gold)); --btn-fg: var(--ink); --btn-shadow: var(--gold-deep); background: var(--btn-bg); }
.btn-outline { --btn-bg: var(--paper); --btn-fg: var(--blue); --btn-shadow: #C7D3F2; border: 2px solid #C7D3F2; }
.btn-ghost   { --btn-bg: var(--paper); --btn-fg: var(--ink-2); --btn-shadow: var(--line); border: 2px solid var(--line); }
.btn-lg { min-height: 56px; padding: 14px 26px; font-size: 1.1rem; }
.btn-sm { min-height: 40px; padding: 8px 16px; font-size: .92rem; }
.btn-block { width: 100%; }
.btn-round { min-width: 56px; padding: 12px 18px; }

/* Fallback for browsers without color-mix */
@supports not (color: color-mix(in srgb, red, blue)) {
    .btn-primary { --btn-shadow: rgba(0, 0, 0, .3); }
}

.chip-link {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 6px 14px; border-radius: 999px;
    background: var(--paper); border: 2px solid var(--line);
    font-weight: 800; font-size: .9rem; color: var(--ink-2); text-decoration: none;
    transition: border-color .2s, color .2s;
}
.chip-link:hover { color: var(--green); border-color: var(--green-2); }

.eyebrow {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 6px 14px; margin-bottom: 14px; border-radius: 999px;
    background: var(--gold-soft); color: var(--gold-deep);
    font-weight: 800; font-size: .92rem;
}
.eyebrow-gold { background: rgba(245, 196, 81, .18); color: var(--gold-2); }

.progress { height: 12px; background: var(--cream-3); border-radius: 999px; overflow: hidden; }
.progress-bar {
    display: block; height: 100%; border-radius: inherit;
    background: linear-gradient(90deg, var(--gold), var(--gold-2));
    background-size: 24px 24px;
    transition: width .6s var(--ease-bounce);
}
.progress-light { background: rgba(255, 255, 255, .18); }
.progress-label { font-weight: 800; font-size: .9rem; margin: 8px 0 0; color: var(--ink-2); }

.speech {
    position: relative; display: inline-block;
    padding: 8px 14px; border-radius: 18px;
    background: var(--paper); color: var(--ink);
    font-family: var(--font-display); font-weight: 600; font-size: .95rem; line-height: 1.25;
    box-shadow: var(--shadow);
    border: 2px solid var(--line);
}
.speech::after {
    content: ''; position: absolute; bottom: -9px; left: 50%;
    width: 16px; height: 16px; background: var(--paper);
    border-right: 2px solid var(--line); border-bottom: 2px solid var(--line);
    transform: translateX(-50%) rotate(45deg);
}

/* Sections */
.section { padding: 40px 0; }
.section-tight { padding-top: 8px; }
.section-tint {
    background: linear-gradient(180deg, transparent, var(--cream-2) 18%, var(--cream-2) 82%, transparent);
}
.section-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 8px 20px; margin-bottom: 22px; }
.section-head-center { justify-content: center; text-align: center; }
.section-title { font-size: clamp(1.5rem, 4.5vw, 2.2rem); margin-bottom: .2em; }
.section-title-sm { font-size: 1.4rem; margin: 36px 0 16px; }
.section-sub { color: var(--ink-2); margin: 0; font-weight: 700; }
.link-more { display: inline-flex; align-items: center; gap: 4px; font-weight: 800; color: var(--green); text-decoration: none; }
.link-more:hover { text-decoration: underline; }

.page-hero { padding: 32px 0 20px; text-align: center; }
.page-title { font-size: clamp(1.9rem, 6vw, 2.8rem); margin-bottom: .25em; }
.page-lead { color: var(--ink-2); font-size: 1.08rem; font-weight: 700; max-width: 560px; margin: 0 auto; }

.empty-state { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 12px; }

/* 5. Home ------------------------------------------------------------------ */
.hero { position: relative; padding: 28px 0 24px; overflow: hidden; }
.hero::before {
    content: ''; position: absolute; inset: auto -20% -40% -20%; height: 70%;
    background: radial-gradient(ellipse at center, rgba(46, 125, 79, .16), transparent 65%);
    pointer-events: none;
}
.hero-inner { position: relative; display: grid; gap: 24px; align-items: center; }
.hero-copy { text-align: center; }
.hero-title { font-size: clamp(2rem, 8vw, 3.6rem); letter-spacing: -.02em; margin-bottom: .35em; }
.hl {
    color: var(--green);
    background: linear-gradient(transparent 62%, rgba(245, 196, 81, .55) 62%, rgba(245, 196, 81, .55) 92%, transparent 92%);
    padding: 0 .08em;
    -webkit-box-decoration-break: clone; box-decoration-break: clone;
}
.hero-lead { font-size: 1.08rem; color: var(--ink-2); font-weight: 600; max-width: 34em; margin: 0 auto 22px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }

.hero-stage {
    position: relative;
    display: flex; justify-content: center; align-items: flex-end; gap: 4px;
    min-height: 300px; padding: 70px 8px 16px;
    border-radius: var(--radius-xl);
    background:
        radial-gradient(circle at 50% 120%, rgba(46, 125, 79, .35), transparent 55%),
        linear-gradient(180deg, #DCE8FB 0%, #F6EED9 70%);
    border: 3px solid var(--paper);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    isolation: isolate;
}
.hero-stage::after { /* rolling hills */
    content: ''; position: absolute; left: -10%; right: -10%; bottom: -30px; height: 110px; z-index: -1;
    background: radial-gradient(ellipse 50% 70px at 30% 100%, #3E8E5E 98%, transparent 100%),
                radial-gradient(ellipse 55% 80px at 78% 100%, var(--green-2) 98%, transparent 100%);
}
.stage-sun {
    position: absolute; top: 18px; right: 22px; width: 64px; height: 64px; z-index: -1;
    border-radius: 50%;
    background: radial-gradient(circle, #FFE7A0 0 40%, var(--gold-2) 41% 60%, rgba(245, 196, 81, 0) 61%);
    box-shadow: 0 0 0 10px rgba(245, 196, 81, .18), 0 0 0 22px rgba(245, 196, 81, .1);
    animation: spin 40s linear infinite;
}
.hero-kid { position: relative; margin: 0; width: min(46%, 200px); text-align: center; }
.hero-kid img { width: 100%; height: auto; filter: drop-shadow(0 10px 10px rgba(42, 33, 24, .2)); }
.kid-happy img { animation: bob 3.6s ease-in-out infinite; }
.kid-joy img   { animation: bob 3.6s ease-in-out -1.8s infinite; }
.hero-kid figcaption {
    display: inline-block; margin-top: -8px; padding: 2px 14px; border-radius: 999px;
    font-family: var(--font-display); font-weight: 700; color: #fff;
    position: relative;
}
.kid-happy figcaption { background: var(--blue); }
.kid-joy figcaption   { background: var(--green); }
.hero-kid .speech { position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%); width: max-content; max-width: 150px; font-size: .85rem; animation: pop-in .6s var(--ease-bounce) .6s both; }
.kid-joy .speech { animation-delay: 1.1s; }
.float-deco { position: absolute; font-size: 1.6rem; animation: float 5s ease-in-out infinite; }
.deco-1 { top: 20px; left: 18px; }
.deco-2 { top: 44%; left: 6px; font-size: 1.3rem; animation-delay: -2s; }
.deco-3 { top: 40%; right: 10px; animation-delay: -3.5s; }

/* Character cards */
.character-grid { display: grid; gap: 16px; }
.character-card {
    display: grid; grid-template-columns: 110px 1fr; gap: 16px; align-items: center;
    padding: 18px; border-radius: var(--radius-lg);
    background: var(--paper); border: 2px solid var(--line); box-shadow: var(--shadow);
}
.character-portrait {
    border-radius: 24px; padding: 8px 6px 0; overflow: hidden;
    background: var(--blue-soft);
}
.character-card.tone-green .character-portrait { background: var(--green-soft); }
.character-name { font-size: 1.5rem; margin-bottom: 0; }
.character-tag { font-weight: 800; color: var(--blue); margin-bottom: 6px; font-size: .95rem; }
.character-card.tone-green .character-tag { color: var(--green-2); }
.character-bio { color: var(--ink-2); margin: 0; font-size: .97rem; }

/* Steps */
.steps { list-style: none; margin: 22px 0 0; padding: 0; display: grid; gap: 14px; counter-reset: step; }
.step {
    position: relative; display: grid; grid-template-columns: 60px 1fr; grid-template-rows: auto auto; column-gap: 14px;
    padding: 16px 18px; background: var(--paper); border: 2px solid var(--line); border-radius: var(--radius);
}
.step-icon { grid-row: span 2; width: 60px; height: 60px; display: grid; place-items: center; border-radius: 18px; font-size: 1.8rem; }
.step h3 { margin: 4px 0 0; font-size: 1.2rem; }
.step p { margin: 0; color: var(--ink-2); }
.tone-green { background: var(--green-soft); }
.tone-blue  { background: var(--blue-soft); }
.tone-gold  { background: var(--gold-soft); }

/* Treasure banner */
.treasure-banner {
    position: relative; overflow: hidden;
    display: grid; gap: 16px; justify-items: center; text-align: center;
    padding: 26px 20px; border-radius: var(--radius-xl);
    background:
        url('../images/patterns/meskel-pattern-light.svg') 0 0 / 96px 96px,
        linear-gradient(135deg, var(--blue) 0%, #1B3780 100%);
    color: #fff; box-shadow: var(--shadow-lg);
}
.treasure-banner h2 { color: #fff; font-size: 1.6rem; margin-bottom: .2em; }
.treasure-banner p { color: #DCE4FA; }
.treasure-banner .progress { background: rgba(255, 255, 255, .2); width: 100%; max-width: 360px; margin: 0 auto; }
.treasure-banner .progress-label { color: var(--gold-2); }
.treasure-art { width: 110px; height: 110px; animation: float 4s ease-in-out infinite; filter: drop-shadow(0 8px 16px rgba(0, 0, 0, .3)); }

/* 6. Story cards ----------------------------------------------------------- */
.story-grid { display: grid; gap: 18px; grid-template-columns: 1fr; }
.story-card {
    display: flex; flex-direction: column;
    background: var(--paper); border-radius: var(--radius-lg);
    border: 2px solid var(--line); box-shadow: var(--shadow);
    overflow: hidden;
    transition: transform .3s var(--ease-bounce), box-shadow .3s;
}
.story-card:hover { transform: translateY(-6px) rotate(-.4deg); box-shadow: var(--shadow-lg); }
.story-cover { position: relative; display: block; aspect-ratio: 400 / 260; background: var(--accent-soft); overflow: hidden; }
.story-cover img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s ease; }
.story-card:hover .story-cover img { transform: scale(1.06); }
.story-cover::after { /* tibeb strip under the art */
    content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 10px;
    background: url('../images/patterns/tibeb.svg') repeat-x center / auto 10px;
}
.story-status {
    position: absolute; top: 12px; right: 12px;
    display: inline-flex; align-items: center; gap: 4px;
    padding: 4px 10px; border-radius: 999px;
    background: var(--paper); color: var(--green); font-weight: 800; font-size: .8rem;
    box-shadow: var(--shadow-sm);
}
.story-body { display: flex; flex-direction: column; gap: 6px; padding: 16px 18px 18px; flex: 1; }
.story-ref { margin: 0; font-size: .8rem; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; color: var(--accent-2); }
.lang-am .story-ref { text-transform: none; letter-spacing: 0; font-size: .85rem; }
.story-title { font-size: 1.35rem; margin: 0; }
.story-title a { color: inherit; text-decoration: none; }
.story-title a:hover { color: var(--accent); }
.story-summary { color: var(--ink-2); margin: 0; font-size: .97rem; flex: 1; }
.story-meta { display: flex; gap: 14px; color: var(--ink-3); font-size: .85rem; font-weight: 800; margin: 6px 0 10px; }
.story-meta span { display: inline-flex; align-items: center; gap: 4px; }

/* 7. Reader ---------------------------------------------------------------- */
.reader { padding: 18px 0 32px; }
.reader-wrap { max-width: 760px; }
.reader-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.reader-ref { font-weight: 800; color: var(--accent-2); font-size: .9rem; }
.reader-title { text-align: center; font-size: clamp(1.7rem, 6vw, 2.5rem); margin-bottom: 12px; color: var(--accent); }
.reader-progress { margin-bottom: 18px; }
.reader-progress .progress-bar { background: linear-gradient(90deg, var(--accent), var(--accent-2)); }

.reader-book {
    position: relative;
    background: var(--paper);
    border-radius: var(--radius-xl);
    border: 3px solid var(--line);
    box-shadow: var(--shadow-lg), inset 0 0 0 6px var(--cream);
    padding: 14px;
    min-height: 380px;
}
.reader-page { padding: 4px; }
.js .reader-page { display: none; }
.js .reader-page.is-active { display: block; animation: page-in .5s var(--ease-bounce) both; }
.js .reader-page.is-active.from-left { animation-name: page-in-left; }
.reader-page + .reader-page { margin-top: 28px; } /* no-JS: pages stack */
.js .reader-page + .reader-page { margin-top: 0; }

.page-art { position: relative; border-radius: var(--radius-lg); overflow: hidden; aspect-ratio: 400 / 260; background: var(--accent-soft); }
.page-art img { width: 100%; height: 100%; object-fit: cover; }
.page-sticker {
    position: absolute; left: 50%; bottom: -2px; transform: translateX(-50%);
    width: 84px; height: 84px; display: grid; place-items: center;
    font-size: 2.6rem; background: var(--paper); border-radius: 50% 50% 0 0;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, .08);
}
.page-number {
    position: absolute; top: 12px; left: 12px; width: 38px; height: 38px;
    display: grid; place-items: center; border-radius: 50%;
    background: var(--accent); color: #fff; font-family: var(--font-display); font-weight: 700;
    box-shadow: 0 0 0 4px rgba(255, 255, 255, .7);
}
.page-text {
    margin: 18px 6px 6px; text-align: center;
    font-family: var(--font-display); font-weight: 500;
    font-size: clamp(1.2rem, 4.6vw, 1.55rem); line-height: 1.5; color: var(--ink);
}
.lang-am .page-text { line-height: 1.8; font-weight: 600; }

.reader-finish { text-align: center; padding: 22px 8px 12px; }
.finish-burst { font-size: 4rem; animation: wiggle 1.4s ease-in-out infinite; }
.reader-finish h2 { font-size: clamp(1.6rem, 6vw, 2.2rem); color: var(--accent); }
.finish-text { color: var(--ink-2); font-weight: 700; }
.verse-card {
    margin: 18px auto 22px; max-width: 520px; padding: 18px 20px; border-radius: var(--radius);
    background: var(--gold-soft); border: 2px dashed var(--gold);
    font-family: var(--font-display); font-size: 1.12rem; color: var(--ink);
}
.verse-card p { margin: 6px 0 0; }
.verse-label { display: inline-flex; align-items: center; gap: 6px; font-size: .85rem; font-weight: 700; color: var(--gold-deep); text-transform: uppercase; letter-spacing: .05em; }
.finish-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }

.reader-controls { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 18px; }
.reader-count { font-weight: 800; color: var(--ink-2); text-align: center; font-size: .95rem; }
.reader-controls .btn-label { display: none; }
.reader-dots { display: flex; justify-content: center; gap: 8px; margin-top: 16px; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--cream-3); transition: all .3s var(--ease-bounce); }
.dot.is-done { background: var(--accent-2); }
.dot.is-active { width: 28px; border-radius: 999px; background: var(--accent); }
.dot-star.is-active { background: var(--gold); }
.no-js-hidden { display: none; }
html:not(.js) .reader-controls, html:not(.js) .reader-dots, html:not(.js) .reader-progress { display: none; }

/* 8. Quiz ------------------------------------------------------------------ */
.quiz-picker { display: grid; gap: 14px; max-width: 820px; }
.quiz-tile {
    display: grid; grid-template-columns: 64px 1fr; gap: 12px 16px; align-items: center;
    padding: 16px; border-radius: var(--radius-lg);
    background: var(--paper); border: 2px solid var(--line); box-shadow: var(--shadow);
    transition: transform .3s var(--ease-bounce);
}
.quiz-tile:hover { transform: translateY(-3px); }
.quiz-tile-icon { width: 64px; height: 64px; display: grid; place-items: center; font-size: 2rem; border-radius: 20px; background: var(--accent-soft); }
.quiz-tile-body h2 { font-size: 1.25rem; margin: 0; }
.quiz-tile-body p { margin: 0; color: var(--ink-2); font-weight: 700; font-size: .92rem; }
.quiz-tile-body .story-status { position: static; margin-top: 6px; box-shadow: none; background: var(--green-soft); }
.quiz-tile .btn { grid-column: 1 / -1; }

.quiz-section { padding-top: 22px; }
.quiz-layout { display: grid; gap: 12px; max-width: 920px; }
.quiz-mascot { display: flex; align-items: center; gap: 10px; justify-content: center; }
.quiz-mascot img { width: 84px; height: auto; transition: transform .4s var(--ease-bounce); }
.quiz-mascot img.is-happy { animation: hop .6s var(--ease-bounce); }
.quiz-mascot img.is-thinking { animation: tilt .6s ease; }
.quiz-mascot .speech { order: 2; max-width: 220px; }
.quiz-mascot .speech::after { left: -8px; top: 50%; bottom: auto; transform: translateY(-50%) rotate(135deg); }

.quiz-card {
    position: relative;
    background: var(--paper); border: 3px solid var(--line); border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg); padding: 20px 16px 22px;
}
.quiz-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; }
.quiz-story, .quiz-count { margin: 0; font-weight: 800; font-size: .92rem; }
.quiz-story { color: var(--accent); }
.quiz-count { color: var(--ink-3); }
.quiz-card .progress-bar { background: linear-gradient(90deg, var(--accent), var(--accent-2)); }

.quiz-q { display: none; margin-top: 18px; }
.quiz-q.is-active { display: block; animation: page-in .45s var(--ease-bounce) both; }
.quiz-question { font-size: clamp(1.35rem, 5.4vw, 1.8rem); text-align: center; margin: 6px 0 18px; }
.quiz-options { display: grid; gap: 12px; }
.quiz-option {
    display: flex; align-items: center; gap: 12px; width: 100%;
    min-height: 60px; padding: 10px 14px; text-align: left;
    background: var(--cream); color: var(--ink);
    border: 3px solid var(--line); border-radius: var(--radius);
    font-family: var(--font-display); font-weight: 600; font-size: 1.12rem;
    cursor: pointer; box-shadow: 0 4px 0 var(--line);
    transition: transform .15s, border-color .2s, background .2s, box-shadow .15s;
    -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.quiz-option:hover:not(:disabled) { border-color: var(--accent-2); transform: translateY(-2px); }
.quiz-option:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 1px 0 var(--line); }
.quiz-option:disabled { cursor: default; }
.opt-letter {
    flex-shrink: 0; width: 38px; height: 38px; display: grid; place-items: center;
    border-radius: 12px; background: var(--paper); border: 2px solid var(--line);
    font-weight: 700; color: var(--accent);
}
.opt-text { flex: 1; }
.opt-mark { font-size: 1.4rem; }
.quiz-option.is-correct { background: var(--green-soft); border-color: var(--green-2); box-shadow: 0 4px 0 var(--green-2); animation: pop .4s var(--ease-bounce); }
.quiz-option.is-correct .opt-letter { background: var(--green-2); border-color: var(--green-2); color: #fff; }
.quiz-option.is-correct .opt-mark::after { content: '✅'; }
.quiz-option.is-wrong { background: var(--red-soft); border-color: var(--red); box-shadow: 0 4px 0 var(--red); animation: shake .45s ease; }
.quiz-option.is-wrong .opt-letter { background: var(--red); border-color: var(--red); color: #fff; }
.quiz-option.is-wrong .opt-mark::after { content: '💭'; }
.quiz-option.is-dimmed { opacity: .55; }

.quiz-feedback {
    display: flex; gap: 12px; align-items: flex-start;
    margin-top: 16px; padding: 14px 16px; border-radius: var(--radius);
    background: var(--green-soft); border: 2px solid rgba(46, 125, 79, .35);
    animation: pop-in .4s var(--ease-bounce);
}
.quiz-feedback.is-wrong { background: var(--gold-soft); border-color: rgba(227, 167, 47, .5); }
.quiz-feedback strong { font-family: var(--font-display); font-size: 1.15rem; display: block; }
.quiz-feedback p { margin: 2px 0 0; color: var(--ink-2); }
.feedback-emoji { font-size: 2rem; line-height: 1; }

.quiz-actions { display: flex; justify-content: center; margin-top: 18px; }
.quiz-actions:empty { display: none; }

.quiz-result { text-align: center; padding: 10px 4px 4px; animation: page-in .5s var(--ease-bounce) both; }
.result-badge {
    width: 120px; height: 120px; margin: 4px auto 14px; display: grid; place-items: center;
    font-size: 3.6rem; border-radius: 50%;
    background: radial-gradient(circle at 35% 30%, #FFF3C9, var(--gold-2) 55%, var(--gold) 100%);
    border: 6px solid var(--paper); box-shadow: 0 0 0 4px var(--gold), var(--shadow-lg);
    animation: medal 1s var(--ease-bounce) both;
}
.quiz-result h2 { font-size: 1.9rem; color: var(--accent); }
.result-stars { font-size: 2.2rem; letter-spacing: 6px; min-height: 1.3em; }
.result-stars .star { display: inline-block; animation: pop-in .5s var(--ease-bounce) both; }
.result-stars .star.is-empty { filter: grayscale(1); opacity: .35; }
.result-score { font-weight: 800; font-size: 1.15rem; margin: 6px 0 2px; }
.result-cheer { color: var(--ink-2); font-weight: 700; }
.result-badge-name { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: center; padding: 8px 16px; border-radius: 999px; background: var(--gold-soft); color: var(--gold-deep); font-weight: 800; margin-bottom: 18px; }
.quiz-footer-link { margin-top: 20px; }

/* 9. Rewards --------------------------------------------------------------- */
.scepter-card {
    position: relative; overflow: hidden;
    display: grid; gap: 14px; justify-items: center; text-align: center;
    padding: 26px 20px; border-radius: var(--radius-xl);
    background:
        url('../images/patterns/meskel-pattern-light.svg') 0 0 / 96px 96px,
        radial-gradient(circle at 50% 0%, #6B4BB8 0%, #3A2A78 55%, #251A52 100%);
    color: #fff; box-shadow: var(--shadow-lg);
}
.scepter-card h2 { color: #fff; font-size: clamp(1.5rem, 5vw, 2rem); }
.scepter-card p { color: #E4DCF7; }
.scepter-card .progress { width: 100%; max-width: 380px; margin: 0 auto; }
.scepter-card .progress-label { color: var(--gold-2); }
.scepter-art { position: relative; width: 170px; height: 170px; display: grid; place-items: center; }
.scepter-art img { position: relative; width: 150px; height: 150px; transition: filter .6s, transform .6s var(--ease-bounce); }
.scepter-glow { position: absolute; inset: 0; border-radius: 50%; background: radial-gradient(circle, rgba(245, 196, 81, .6), transparent 65%); opacity: 0; transition: opacity .6s; }
.scepter-lock { position: absolute; bottom: 8px; right: 8px; width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; background: rgba(0, 0, 0, .45); color: #fff; }
.scepter-card.is-locked .scepter-art img { filter: grayscale(.9) brightness(.7); }
.scepter-card.is-unlocked .scepter-lock { display: none; }
.scepter-card.is-unlocked .scepter-glow { opacity: 1; animation: pulse 2.4s ease-in-out infinite; }
.scepter-card.is-unlocked .scepter-art img { animation: float 3.6s ease-in-out infinite; }
.scepter-card.is-unlocked { box-shadow: 0 0 0 4px var(--gold-2), var(--shadow-lg); }

.badge-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.badge-card {
    display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px;
    padding: 18px 10px 14px; border-radius: var(--radius-lg);
    background: var(--paper); border: 2px solid var(--line); box-shadow: var(--shadow);
}
.badge-medal { position: relative; width: 84px; height: 84px; margin-bottom: 8px; }
.badge-icon {
    width: 100%; height: 100%; display: grid; place-items: center; font-size: 2.4rem; border-radius: 50%;
    background: radial-gradient(circle at 35% 30%, #FFF3C9, var(--gold-2) 55%, var(--gold) 100%);
    border: 4px solid var(--paper); box-shadow: 0 0 0 3px var(--gold), var(--shadow);
    transition: filter .4s, transform .4s var(--ease-bounce);
}
.badge-lock { position: absolute; right: -4px; bottom: -4px; width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%; background: var(--ink-2); color: #fff; border: 3px solid var(--paper); }
.badge-card h3 { font-size: 1.05rem; margin: 0; }
.badge-hint { font-size: .82rem; color: var(--ink-3); font-weight: 700; margin: 0 0 8px; }
.badge-stars { margin: 0 0 8px; font-size: 1.1rem; letter-spacing: 2px; }
.badge-card.is-locked .badge-icon { filter: grayscale(1) opacity(.45); box-shadow: 0 0 0 3px var(--line); background: var(--cream-2); }
.badge-card.is-unlocked .badge-lock { display: none; }
.badge-card.is-unlocked { border-color: var(--gold-2); }
.badge-card.is-unlocked:hover .badge-icon { transform: rotate(-8deg) scale(1.08); }
.badge-card .btn { margin-top: auto; }

.rewards-foot { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; margin-top: 28px; padding-top: 18px; border-top: 2px dashed var(--line); color: var(--ink-3); font-weight: 700; font-size: .9rem; }
.rewards-foot p { margin: 0; }

/* 10. Footer --------------------------------------------------------------- */
.site-footer { margin-top: 24px; background: var(--green); color: #D6EADC; }
.footer-inner { padding: 22px 16px 26px; text-align: center; }
.footer-verse { font-family: var(--font-display); font-size: 1.1rem; color: #fff; margin-bottom: 6px; }
.footer-meta { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 8px; margin: 0; font-size: .88rem; }

/* Confetti (created by core.js) */
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 90; overflow: hidden; }
.confetti i {
    position: absolute; top: -12px; width: 10px; height: 14px; border-radius: 3px;
    animation: confetti-fall var(--d, 1.8s) cubic-bezier(.2, .6, .4, 1) var(--delay, 0s) forwards;
}

/* Admin-driven toggles & notices ----------------------------------------- */
body.no-pattern { background-image: none; }
.admin-bar {
    display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; justify-content: center;
    padding: 6px 16px; background: var(--ink); color: #F5E9D3;
    font: 700 .82rem/1.4 'Nunito', system-ui, sans-serif;
}
.admin-bar a { color: var(--gold-2); text-decoration: none; }
.admin-bar a:hover { text-decoration: underline; }
.admin-bar-warn { background: var(--red); color: #fff; padding: 2px 10px; border-radius: 999px; }
.preview-banner {
    margin: 0; padding: 10px 16px; text-align: center;
    background: var(--gold-soft); color: var(--gold-deep); font-weight: 800;
    border-bottom: 2px dashed var(--gold);
}
.result-badge-name.is-missed { background: var(--blue-soft); color: var(--blue); }
.maintenance-page { padding: 0; display: grid; place-items: center; min-height: 100vh; }
.maintenance-box { padding: 40px 16px; }
.maintenance-band { width: 220px; border-radius: 6px; margin-top: 12px; }

/* Accounts, age groups & gates ------------------------------------------ */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.toast {
    position: fixed; z-index: 95; left: 50%; top: 84px; transform: translateX(-50%);
    max-width: calc(100% - 32px); padding: 12px 20px; border-radius: 999px;
    background: var(--green); color: #fff; font-weight: 800; box-shadow: var(--shadow-lg);
    animation: toast-in .5s var(--ease-bounce) both; transition: opacity .4s, transform .4s;
}
.toast-error { background: var(--red); }
.toast.is-hiding { opacity: 0; transform: translate(-50%, -12px); }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, -20px) scale(.9); } }

.story-tags { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px; }
.age-chip {
    display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: 999px;
    background: var(--accent-soft, var(--green-soft)); color: var(--accent, var(--green));
    font-size: .76rem; font-weight: 800; white-space: nowrap;
}
.age-chip-lg { font-size: .92rem; padding: 4px 14px; }
.age-banner {
    display: inline-flex; align-items: center; gap: 6px; margin: 14px auto 0; padding: 8px 18px; border-radius: 999px;
    background: var(--green-soft); color: var(--green); font-weight: 800;
}
.quiz-picker .age-banner { margin: 0 auto 4px; justify-self: center; }
.age-note { margin-bottom: 28px; }

.join-banner {
    display: grid; gap: 14px; align-items: center; justify-items: center; text-align: center;
    margin-top: 28px; padding: 26px 22px; border-radius: var(--radius-xl);
    background: linear-gradient(135deg, var(--green) 0%, #174A2E 100%); color: #fff; box-shadow: var(--shadow-lg);
}
.join-banner h2 { color: #fff; margin-bottom: .2em; font-size: 1.6rem; }
.join-banner p { color: #D6EADC; margin: 0; }

.gate-card {
    position: relative; max-width: 560px; margin: 24px auto 0; padding: 28px 22px 22px; text-align: center;
    background: var(--paper); border: 3px solid var(--gold-2); border-radius: var(--radius-xl); box-shadow: var(--shadow-lg);
}
.gate-kids { display: flex; justify-content: center; gap: 4px; margin: -8px 0 6px; }
.gate-kids img { width: 92px; height: auto; animation: bob 3.6s ease-in-out infinite; }
.gate-kids img:last-child { animation-delay: -1.8s; }
.gate-card h2 { font-size: clamp(1.4rem, 5vw, 1.9rem); }
.gate-card > p { color: var(--ink-2); font-weight: 700; }
.gate-alt { margin: 14px 0 6px; }
.gate-alt a, .auth-switch a { font-weight: 800; color: var(--blue); }
.gate-privacy { display: flex; align-items: center; justify-content: center; gap: 6px; margin: 10px 0 0; font-size: .82rem; color: var(--ink-3); font-weight: 700; }

.preview-book { position: relative; overflow: hidden; max-height: 560px; }
.preview-page { padding: 4px; }
.preview-page + .preview-page { margin-top: 20px; }
.preview-tag { position: absolute; z-index: 2; top: 22px; right: 22px; padding: 4px 12px; border-radius: 999px; background: var(--gold-2); color: var(--ink); font-weight: 800; font-size: .8rem; box-shadow: var(--shadow-sm); }
.preview-fade { position: absolute; left: 0; right: 0; bottom: 0; height: 90px; background: linear-gradient(transparent, var(--paper)); pointer-events: none; }
.preview-cover { max-width: 760px; margin: 0 auto; }

/* Auth forms */
.auth-section { padding-top: 24px; }
.auth-wrap { display: flex; justify-content: center; }
.auth-card {
    width: 100%; max-width: 560px; padding: 24px 18px; background: var(--paper);
    border: 2px solid var(--line); border-radius: var(--radius-xl); box-shadow: var(--shadow-lg);
}
.auth-card-sm { max-width: 440px; }
.auth-head { text-align: center; margin-bottom: 18px; }
.auth-head img { width: 84px; height: auto; margin: 0 auto 6px; }
.auth-head h1 { font-size: clamp(1.5rem, 6vw, 2rem); margin-bottom: .2em; }
.auth-head p { color: var(--ink-2); font-weight: 700; margin: 0; }
.auth-form { display: flex; flex-direction: column; gap: 14px; }
.auth-notice { padding: 12px 16px; border-radius: var(--radius); background: var(--red-soft); color: #8E2A17; font-weight: 800; text-align: center; }
.auth-switch { text-align: center; margin: 16px 0 0; font-weight: 700; color: var(--ink-2); }
.form-field { display: flex; flex-direction: column; gap: 6px; border: 0; padding: 0; margin: 0; min-width: 0; }
.form-label { font-weight: 800; font-size: .98rem; padding: 0; }
.form-help { font-size: .84rem; color: var(--ink-3); font-weight: 700; margin: 0; }
.form-row { display: grid; gap: 14px; }
.form-field input, .form-field select, .readonly-field {
    width: 100%; min-height: 50px; padding: 10px 16px; border-radius: 16px;
    border: 2px solid var(--line); background: #fff; color: var(--ink);
    font: 700 1.05rem var(--font-body); transition: border-color .2s, box-shadow .2s;
}
.readonly-field { display: flex; align-items: center; margin: 0; background: var(--cream-2); }
.form-field input:focus, .form-field select:focus { outline: none; border-color: var(--green-2); box-shadow: 0 0 0 4px rgba(46, 125, 79, .18); }
.has-error input { border-color: var(--red); }
.field-error { color: var(--red); font-weight: 800; font-size: .88rem; }
.field-error::before { content: '⚠ '; }
.check-field { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 16px; background: var(--gold-soft); font-weight: 700; cursor: pointer; }
.check-field input { width: 22px; height: 22px; margin-top: 1px; accent-color: var(--green); flex-shrink: 0; }
.check-field.has-error { outline: 2px solid var(--red); }
.btn-danger { --btn-bg: var(--red); --btn-fg: #fff; --btn-shadow: #8E2A17; }

.age-picker { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.age-option {
    position: relative; cursor: pointer;
    display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 12px 6px 10px;
    border-radius: 18px; border: 3px solid var(--line); background: #fff;
    transition: transform .2s var(--ease-bounce), border-color .2s, background .2s;
}
.age-option input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.age-option:hover { transform: translateY(-3px); border-color: var(--gold); }
.age-option:has(input:checked) { border-color: var(--green-2); background: var(--green-soft); transform: scale(1.04); box-shadow: 0 6px 0 var(--green-2); }
.age-option:has(input:focus-visible) { outline: 3px solid var(--blue-2); outline-offset: 2px; }
.has-error .age-option { border-color: #F0BDB4; }
.age-emoji { font-size: 1.9rem; line-height: 1.2; }
.age-range { font-family: 'Fredoka', var(--font-display); font-weight: 700; font-size: 1.15rem; text-align: center; line-height: 1.2; }
.age-unit { font-size: .74rem; font-weight: 800; color: var(--ink-3); }

/* Account */
.account-wrap { max-width: 860px; display: flex; flex-direction: column; gap: 18px; }
.profile-card {
    display: grid; grid-template-columns: auto 1fr; gap: 16px; align-items: center; position: relative;
    padding: 22px; border-radius: var(--radius-xl); background: var(--paper); border: 2px solid var(--line); box-shadow: var(--shadow);
}
.profile-avatar { width: 84px; height: 84px; display: grid; place-items: center; font-size: 2.6rem; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #FFF3C9, var(--gold-2) 60%, var(--gold)); box-shadow: 0 0 0 4px #fff, 0 0 0 7px var(--gold); }
.profile-card h1 { font-size: 1.7rem; margin: 0; }
.profile-user { margin: 0 0 6px; color: var(--ink-3); font-weight: 800; }
.profile-meta { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; font-weight: 800; color: var(--ink-2); margin-bottom: 4px; }
.profile-logout { grid-column: 1 / -1; justify-self: end; }
.account-grid { display: grid; gap: 18px; }
.account-card { display: flex; flex-direction: column; gap: 14px; align-items: flex-start; padding: 22px; border-radius: var(--radius-lg); background: var(--paper); border: 2px solid var(--line); }
.account-card .form-field { align-self: stretch; }
.account-card h2 { font-size: 1.25rem; margin: 0; }
.danger-card summary { cursor: pointer; font-weight: 800; color: var(--red); }
.danger-card form { display: flex; flex-direction: column; gap: 12px; margin-top: 12px; align-items: flex-start; }
.danger-card .form-field { align-self: stretch; }

@media (min-width: 560px) {
    .form-row { grid-template-columns: 1fr 1fr; }
    .auth-card { padding: 30px 32px; }
    .account-grid { grid-template-columns: 1fr 1fr; }
    .profile-card { grid-template-columns: auto 1fr auto; }
    .profile-logout { grid-column: auto; align-self: start; }
    .join-banner { grid-template-columns: 1fr auto; text-align: left; justify-items: start; padding: 28px 34px; }
}
@media (max-width: 359px) {
    .age-picker { grid-template-columns: repeat(2, 1fr); }
    .main-nav .nav-link span { font-size: .68rem; }
}

.tg-note { display: flex; gap: 8px; align-items: center; padding: 10px 14px; margin-bottom: 14px; border-radius: 14px; background: #E6F3FB; color: #1C6C9C; font-weight: 800; }
.tg-linked { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 6px; color: #1C6C9C; font-weight: 800; font-size: .9rem; }
.tg-linked span { display: inline-flex; gap: 4px; align-items: center; }
.btn-text { border: 0; background: none; color: var(--ink-3); text-decoration: underline; font: inherit; font-size: .85rem; cursor: pointer; padding: 0; }

/* 11. Animations ----------------------------------------------------------- */
.js .reveal { opacity: 0; transform: translateY(18px); }
.js .reveal.is-visible { animation: rise .7s var(--ease-bounce) calc(var(--i, 0) * 90ms) forwards; }

@keyframes rise     { to { opacity: 1; transform: none; } }
@keyframes bob      { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
@keyframes float    { 0%, 100% { transform: translateY(0) rotate(0); } 50% { transform: translateY(-12px) rotate(4deg); } }
@keyframes spin     { to { transform: rotate(360deg); } }
@keyframes pop-in   { from { opacity: 0; transform: translateX(-50%) scale(.6); } to { opacity: 1; transform: translateX(-50%) scale(1); } }
.quiz-feedback, .result-stars .star { animation-name: pop-in-plain; }
@keyframes pop-in-plain { from { opacity: 0; transform: scale(.6); } to { opacity: 1; transform: scale(1); } }
@keyframes pop      { 50% { transform: scale(1.05); } }
@keyframes shake    { 20%, 60% { transform: translateX(-7px); } 40%, 80% { transform: translateX(7px); } }
@keyframes wiggle   { 0%, 100% { transform: rotate(-8deg); } 50% { transform: rotate(8deg) scale(1.1); } }
@keyframes hop      { 40% { transform: translateY(-16px) rotate(-4deg); } }
@keyframes tilt     { 30% { transform: rotate(-8deg); } 70% { transform: rotate(5deg); } }
@keyframes medal    { from { transform: scale(0) rotate(-180deg); } to { transform: scale(1) rotate(0); } }
@keyframes pulse    { 0%, 100% { transform: scale(.9); opacity: .7; } 50% { transform: scale(1.1); opacity: 1; } }
@keyframes page-in  { from { opacity: 0; transform: translateX(28px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes page-in-left { from { opacity: 0; transform: translateX(-28px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes confetti-fall { to { transform: translate(var(--x, 0), 105vh) rotate(var(--r, 540deg)); } }

body.no-motion *, body.no-motion *::before, body.no-motion *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
.js body.no-motion .reveal { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
    .js .reveal { opacity: 1; transform: none; }
}

/* 12. Breakpoints ---------------------------------------------------------- */

/* Very narrow screens (small phones, compact Telegram view) */
@media (max-width: 359px) {
    .brand-text small { display: none; }
    .brand-text { font-size: 1.15rem; }
    .hero-kid .speech { font-size: .75rem; padding: 6px 10px; }
    .character-card { grid-template-columns: 1fr; text-align: center; }
    .character-portrait { max-width: 140px; margin: 0 auto; }
    .badge-grid { grid-template-columns: 1fr; }
}

@media (min-width: 560px) {
    .story-grid { grid-template-columns: repeat(2, 1fr); }
    .character-grid { grid-template-columns: repeat(2, 1fr); }
    .character-card { grid-template-columns: 1fr; text-align: center; }
    .character-portrait { max-width: 160px; margin: 0 auto; }
    .quiz-tile { grid-template-columns: 64px 1fr auto; }
    .quiz-tile .btn { grid-column: auto; }
    .reader-controls .btn-label { display: inline; }
    .reader-book { padding: 20px; }
    .quiz-card { padding: 26px 26px 28px; }
}

@media (min-width: 760px) {
    body { padding-bottom: 0; }
    .site-header {
        background: rgba(255, 248, 236, .92);
        backdrop-filter: saturate(1.4) blur(10px);
        -webkit-backdrop-filter: saturate(1.4) blur(10px);
    }
    .header-inner { min-height: 76px; gap: 20px; }
    .main-nav {
        position: static; display: flex; gap: 4px; height: auto; padding: 0;
        background: none; border: 0; box-shadow: none;
    }
    .nav-link { flex-direction: row; gap: 8px; padding: 10px 16px; font-size: .98rem; border-radius: 999px; }
    .nav-link .nav-icon { width: 20px; height: 20px; }
    .nav-link.is-active .nav-icon { transform: none; }
    .nav-link:hover:not(.is-active) { color: var(--green); background: var(--cream-2); }
    .nav-badge { position: static; }

    .section { padding: 64px 0; }
    .section-tight { padding-top: 8px; }
    .steps { grid-template-columns: repeat(3, 1fr); }
    .step { grid-template-columns: 1fr; text-align: center; justify-items: center; padding: 26px 20px; }
    .step-icon { grid-row: auto; margin-bottom: 8px; width: 72px; height: 72px; font-size: 2.2rem; }

    .treasure-banner { grid-template-columns: auto 1fr auto; text-align: left; justify-items: start; align-items: center; padding: 30px 36px; gap: 28px; }
    .treasure-banner .progress { margin: 0; }

    .scepter-card { grid-template-columns: 220px 1fr; text-align: left; justify-items: start; align-items: center; padding: 34px 40px; gap: 32px; }
    .scepter-art { width: 210px; height: 210px; }
    .scepter-art img { width: 190px; height: 190px; }
    .scepter-card .progress { margin: 0; }
    .badge-grid { grid-template-columns: repeat(4, 1fr); gap: 18px; }

    .quiz-layout { grid-template-columns: 200px 1fr; align-items: start; gap: 24px; }
    .quiz-mascot { flex-direction: column; position: sticky; top: 110px; }
    .quiz-mascot img { width: 170px; }
    .quiz-mascot .speech { order: 0; margin-bottom: 10px; }
    .quiz-mascot .speech::after { left: 50%; top: auto; bottom: -9px; transform: translateX(-50%) rotate(45deg); }
    .quiz-options { grid-template-columns: 1fr; }
}

/* Tablets: five nav items need a compact, stacked layout */
@media (min-width: 760px) and (max-width: 1079px) {
    .header-inner { gap: 12px; }
    .brand-text small { display: none; }
    .nav-link { flex-direction: column; gap: 2px; padding: 6px 10px; font-size: .78rem; border-radius: 14px; }
    .nav-link .nav-icon { width: 20px; height: 20px; }
    .nav-badge { position: absolute; top: 2px; left: calc(50% + 6px); }
}
.nav-link span { white-space: nowrap; }

@media (min-width: 960px) {
    .hero { padding: 56px 0 40px; }
    .hero-inner { grid-template-columns: 1.05fr 1fr; gap: 48px; }
    .hero-copy { text-align: left; }
    .hero-lead { margin-left: 0; }
    .hero-actions { justify-content: flex-start; }
    .hero-stage { min-height: 440px; padding-top: 90px; }
    .hero-kid { width: 220px; }
    .hero-kid .speech { font-size: .95rem; max-width: 200px; }
    .story-grid { grid-template-columns: repeat(4, 1fr); }
}
