/* ===========================================================================
   ზღაპრული ღამე — the home page design layer
   ---------------------------------------------------------------------------
   Loaded after main.css, inline-extracted.css and base.css on index.html. It owns
   the look of the browse page (header, hero, search, filters, cards, rails,
   bottom nav, footer) and gives the reader a lighter touch. main.css still
   carries everything this file does not mention.

   The palette keeps the brand blue and leans it toward violet for the magic,
   with a warm gold for stars, the moon and the one playful call to action.
   Every text/background pair below was checked against WCAG AA (4.5:1).
   =========================================================================== */

/* Tokens, base, the theme toggle and the footer are in base.css, shared with
   every other page. What follows is the home page only. */

:root {
    --topbar-h: 88px;
}

/* ── Base ─────────────────────────────────────────────────────────────────── */

html {
    scroll-padding-top: calc(var(--topbar-h) + 12px);
}

.content-wrapper {
    padding: 0 16px 56px;
}

/* ── Top bar ─────────────────────────────────────────────────────────────── */

.top-bar {
    max-width: var(--container);
    min-height: var(--topbar-h);
    margin: 0 auto 8px;
    padding: 8px 12px 8px 20px;
    border-radius: 0 0 24px 24px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-top: 0;
    box-shadow: var(--shadow-sm);
}

/* logo.webp is 720x392 with the artwork in the middle ~45%; the negative
   margins trim that transparent border so the mark itself reads at size. */
.nav-logo-link {
    display: inline-flex;
    overflow: hidden;
    border-radius: 14px;
}

.nav-logo-link img {
    height: 100px;
    margin: -13px -45px;
    filter: none;
    transition: transform 0.3s var(--ease-spring);
}

.nav-logo-link img:hover {
    transform: rotate(-3deg) scale(1.04);
}

.nav-actions {
    gap: 10px;
}

.auth-btn,
.user-profile-btn {
    min-height: 44px;
    padding: 0 20px;
    border-radius: 999px;
    font-size: 0.95rem;
    font-family: inherit;
    letter-spacing: 0;
    transition: transform 0.2s var(--ease-out), box-shadow 0.2s, filter 0.2s;
}

.auth-btn {
    background: var(--primary-gradient);
    box-shadow: var(--shadow-primary);
}

.auth-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 26px rgba(79, 70, 229, 0.38);
}

.auth-btn:active {
    transform: translateY(0) scale(0.97);
}

#login-trigger-btn .i {
    width: 18px;
    height: 18px;
    margin-right: 4px;
}

.user-profile-btn {
    align-items: center;
    background: var(--card-bg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    font-weight: 800;
}

.user-profile-btn:hover {
    transform: translateY(-2px);
    border-color: var(--primary-color);
    box-shadow: var(--shadow-md);
}

.logout-btn {
    min-height: 44px;
    border-radius: 999px;
    font-family: inherit;
}

.streak-display {
    padding: 0 14px;
    min-height: 44px;
    margin-right: 0;
    gap: 6px;
    font-size: 1rem;
    background: var(--card-bg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    color: var(--streak-color);
}

html[data-theme="dark"] .streak-display {
    color: var(--streak-color);
}

.streak-display .i {
    width: 18px;
    height: 18px;
    fill: rgba(249, 115, 22, 0.25);
}

/* ── Hero: a small night sky ─────────────────────────────────────────────── */

.hero-intro,
.benefits-section,
.browse-section,
.hero-featured-section,
.site-footer,
.empty-state,
.weekly-pill {
    box-sizing: border-box;
}

.hero-intro {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    max-width: var(--container);
    margin: 16px auto 28px;
    padding: 64px 32px 40px;
    border-radius: 32px;
    color: #fff;
    text-align: center;
    background:
        radial-gradient(120% 90% at 85% -10%, rgba(109, 74, 255, 0.55) 0%, transparent 55%),
        radial-gradient(90% 80% at 0% 100%, rgba(37, 99, 235, 0.45) 0%, transparent 60%),
        linear-gradient(165deg, #0B1026 0%, #151B52 50%, #231C66 100%);
    box-shadow: 0 30px 60px -24px rgba(35, 28, 102, 0.55);
    animation: heroIn 0.7s var(--ease-out) both;
}

html[data-theme="dark"] .hero-intro {
    border: 1px solid rgba(163, 171, 255, 0.14);
    box-shadow: 0 30px 70px -20px rgba(0, 0, 0, 0.6);
}

@keyframes heroIn {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: none; }
}

.hero-sky {
    position: absolute;
    inset: 0;
    z-index: -1;
    pointer-events: none;
}

.hero-stars {
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(1.6px 1.6px at 22px 34px, #fff 50%, transparent 52%),
        radial-gradient(1px 1px at 74px 110px, rgba(255, 255, 255, 0.85) 50%, transparent 52%),
        radial-gradient(1.2px 1.2px at 140px 60px, rgba(255, 255, 255, 0.9) 50%, transparent 52%),
        radial-gradient(1px 1px at 190px 150px, rgba(255, 255, 255, 0.7) 50%, transparent 52%),
        radial-gradient(1.8px 1.8px at 250px 22px, #FFF3C4 50%, transparent 52%),
        radial-gradient(1px 1px at 300px 95px, rgba(255, 255, 255, 0.8) 50%, transparent 52%);
    background-size: 320px 180px;
    opacity: 0.85;
}

.hero-stars-2 {
    background-image:
        radial-gradient(1.4px 1.4px at 40px 80px, #fff 50%, transparent 52%),
        radial-gradient(1px 1px at 120px 20px, rgba(255, 255, 255, 0.8) 50%, transparent 52%),
        radial-gradient(2px 2px at 210px 120px, #FFE9A8 50%, transparent 52%),
        radial-gradient(1px 1px at 330px 60px, rgba(255, 255, 255, 0.75) 50%, transparent 52%);
    background-size: 420px 240px;
    background-position: 60px 20px;
    /* The sky moves for the first half-minute, then holds still — a welcome,
       not something tugging at the eye while a parent reads. */
    animation: twinkle 4.5s ease-in-out 5 alternate;   /* odd count: ends lit, */
    opacity: 1;                                          /* on its resting value */
}

@keyframes twinkle {
    from { opacity: 0.25; }
    to   { opacity: 1; }
}

.hero-moon {
    position: absolute;
    top: 34px;
    right: 7%;
    width: 76px;
    height: 76px;
    border-radius: 50%;
    background:
        radial-gradient(circle at 64% 38%, rgba(214, 160, 50, 0.35) 0 7px, transparent 8px),
        radial-gradient(circle at 36% 64%, rgba(214, 160, 50, 0.28) 0 10px, transparent 11px),
        radial-gradient(circle at 70% 70%, rgba(214, 160, 50, 0.22) 0 5px, transparent 6px),
        radial-gradient(circle at 35% 30%, #FFF8DC 0%, #FFE08A 45%, #FFC247 100%);
    box-shadow:
        0 0 36px 8px rgba(255, 214, 107, 0.35),
        0 0 120px 40px rgba(255, 194, 71, 0.14);
    animation: moonFloat 7s ease-in-out 4;
}

@keyframes moonFloat {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-8px); }
}

.hero-shooting-star {
    position: absolute;
    top: 18%;
    left: 10%;
    width: 110px;
    height: 2px;
    border-radius: 2px;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.9));
    opacity: 0;
    transform: rotate(-18deg);
    animation: shoot 9s ease-in 3s 3;
}

@keyframes shoot {
    0%       { opacity: 0; transform: translate(0, 0) rotate(-18deg); }
    3%       { opacity: 1; }
    9%, 100% { opacity: 0; transform: translate(260px, 90px) rotate(-18deg); }
}

.hero-hills {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 120px;
}

.hero-hills .hill-back  { fill: rgba(9, 12, 38, 0.55); }
.hero-hills .hill-front { fill: rgba(7, 9, 28, 0.75); }

.hero-inner {
    position: relative;
    max-width: 760px;
    margin: 0 auto;
}

.hero-greeting {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 18px;
    padding: 7px 16px 7px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.18);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    font-size: 0.92rem;
    font-weight: 700;
    color: #fff;
}

.hero-greeting .i {
    width: 18px;
    height: 18px;
    color: var(--gold);
}

.hero-intro .main-title {
    margin: 0 0 14px;
    color: #fff;
    font-size: clamp(2.3rem, 6vw, 4.1rem);
    line-height: 1.12;
    letter-spacing: -0.02em;
}

.hero-intro .main-title span {
    background: linear-gradient(90deg, #FFE7A3 0%, #FFC247 45%, #FF9F6E 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: none;
    filter: drop-shadow(0 4px 22px rgba(255, 194, 71, 0.35));
}

.hero-intro .subtitle {
    max-width: 600px;
    margin: 0 auto 28px;
    color: rgba(236, 240, 255, 0.86);
    font-size: clamp(1rem, 2vw, 1.18rem);
    font-weight: 500;
    line-height: 1.65;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
    margin-bottom: 26px;
}

.hero-cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 54px;
    padding: 0 26px;
    border-radius: 999px;
    border: 1px solid transparent;
    font-family: inherit;
    font-size: 1.02rem;
    font-weight: 800;
    cursor: pointer;
    transition: transform 0.2s var(--ease-out), box-shadow 0.2s, background 0.2s, border-color 0.2s;
}

.hero-cta .i {
    width: 22px;
    height: 22px;
}

.hero-cta:active {
    transform: scale(0.96);
}

.hero-cta-gold {
    background: linear-gradient(135deg, #FFE08A 0%, #FFC247 55%, #FFB547 100%);
    color: #1B1F3B;                                  /* 10:1 on the gold */
    box-shadow: 0 10px 28px rgba(255, 194, 71, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.hero-cta-gold:hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 34px rgba(255, 194, 71, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.hero-cta-glass {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.28);
    color: #fff;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.hero-cta-glass:hover {
    background: rgba(255, 255, 255, 0.18);
    transform: translateY(-2px);
}

.hero-cta-glass .i {
    color: var(--gold);
}

/* In the evening the bedtime button is the obvious one. */
.hero-intro.is-evening .hero-cta-glass,
.hero-cta-glass[aria-pressed="true"] {
    background: rgba(255, 214, 107, 0.16);
    border-color: rgba(255, 214, 107, 0.65);
    box-shadow: 0 0 0 4px rgba(255, 214, 107, 0.12);
}

.hero-cta-glass[aria-pressed="true"]::after {
    content: '✓';
    font-weight: 900;
    color: var(--gold);
}

.hero-cta.rolling .i,
.nav-center-bubble.rolling .i {
    animation: diceRoll 0.6s var(--ease-out);
}

@keyframes diceRoll {
    0%   { transform: rotate(0) scale(1); }
    40%  { transform: rotate(200deg) scale(0.8); }
    100% { transform: rotate(360deg) scale(1); }
}

.hero-facts {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px 22px;
    margin: 0;
    padding: 0;
    list-style: none;
    color: rgba(236, 240, 255, 0.82);
    font-size: 0.9rem;
    font-weight: 600;
}

.hero-facts li {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.hero-facts strong {
    color: #fff;
    font-weight: 900;
}

.hero-facts .i {
    width: 18px;
    height: 18px;
    color: var(--gold);
}

/* Weekly challenge, now a quiet glass strip at the foot of the hero. */
.weekly-pill {
    display: flex;
    align-items: center;
    gap: 14px;
    max-width: 440px;
    margin: 28px auto 0;
    padding: 12px 16px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.16);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    text-align: left;
}

.weekly-ico {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    border-radius: 12px;
    background: rgba(255, 194, 71, 0.18);
    color: var(--gold);
}

.weekly-ico .i {
    width: 22px;
    height: 22px;
}

.weekly-body {
    flex: 1;
    min-width: 0;
}

.weekly-top {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 10px;
    margin-bottom: 8px;
    font-size: 0.85rem;
}

.weekly-top strong {
    color: #fff;
    font-weight: 800;
}

#weekly-progress-text {
    color: rgba(236, 240, 255, 0.82);
    font-weight: 700;
    white-space: nowrap;
}

.weekly-track {
    height: 8px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.14);
    overflow: hidden;
}

#weekly-progress-bar {
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #FFE08A, #FFB547);
    box-shadow: 0 0 12px rgba(255, 194, 71, 0.6);
    transition: width 0.6s var(--ease-out);
}

/* ── Daily pick ──────────────────────────────────────────────────────────── */

.hero-featured-section {
    width: 100%;
    max-width: var(--container);
    margin: 0 auto 32px;
    border-radius: 28px;
    box-shadow: var(--shadow-lg);
    background: #0B1026;
    transition: transform 0.35s var(--ease-out), box-shadow 0.35s;
}

.hero-featured-section:hover {
    transform: translateY(-4px);
    box-shadow: 0 24px 56px rgba(27, 31, 59, 0.2);
}

.hero-featured-bg {
    height: 360px;
    transition: transform 0.8s var(--ease-out);
}

.hero-featured-section:hover .hero-featured-bg {
    transform: scale(1.04);
}

.hero-featured-overlay {
    align-items: flex-start;
    justify-content: center;
    padding: 40px 48px;
    text-align: left;
    background: linear-gradient(90deg, rgba(8, 10, 32, 0.9) 0%, rgba(8, 10, 32, 0.6) 42%, rgba(8, 10, 32, 0) 78%);
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 14px;
    padding: 7px 14px;
    background: rgba(255, 194, 71, 0.16);
    border: 1px solid rgba(255, 194, 71, 0.5);
    color: #FFE08A;
    font-size: 0.78rem;
    letter-spacing: 0.06em;
}

.hero-badge .i {
    width: 15px;
    height: 15px;
    color: var(--gold);
}

.hero-title {
    max-width: 520px;
    margin: 0 0 10px;
    font-size: clamp(1.8rem, 3.6vw, 2.8rem);
    line-height: 1.15;
}

.hero-meta {
    margin: 0 0 22px;
    color: rgba(236, 240, 255, 0.85);
    font-size: 0.95rem;
    font-weight: 600;
}

.hero-btn {
    min-height: 50px;
    padding: 0 26px;
    font-family: inherit;
    font-size: 1rem;
    color: #1B1F3B;
    transition: transform 0.2s var(--ease-out), box-shadow 0.2s, background 0.2s, color 0.2s;
}

.hero-btn .i {
    width: 20px;
    height: 20px;
}

.hero-btn:hover {
    transform: translateY(-2px);
    background: var(--primary-gradient);
    color: #fff;
}

/* ── Rails ───────────────────────────────────────────────────────────────── */

#continue-section,
#recommended-section {
    max-width: var(--container);
    margin: 0 auto 28px;
    padding: 0;
    text-align: left;
}

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

.rec-section-title {
    margin: 0 0 12px;
    font-size: 1.25rem;
    font-weight: 900;
    letter-spacing: -0.01em;
    gap: 10px;
}

.rail-head .rec-section-title {
    margin: 0;
}

.rec-section-title .i {
    width: 22px;
    height: 22px;
    color: var(--primary-text);
}

.rail-nav {
    display: none;
    gap: 8px;
}

@media (hover: hover) and (pointer: fine) {
    .rail-nav:not([hidden]) {
        display: flex;
    }
}

.rail-btn {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--card-bg);
    color: var(--text-main);
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s var(--ease-out), border-color 0.2s, opacity 0.2s;
}

.rail-btn:hover:not(:disabled) {
    border-color: var(--primary-color);
    color: var(--primary-text);
    transform: scale(1.06);
}

.rail-btn:disabled {
    opacity: 0.35;
    cursor: default;
}

.rec-scroll-row {
    gap: 14px;
    margin: 0 -16px;
    padding: 4px 16px 12px;
    scroll-padding-left: 16px;
    cursor: auto;
}

/* The covers have their titles painted into the artwork, so the cards show
   the art uncropped and put the name underneath instead of over it. */
.rec-card {
    flex: 0 0 188px;
    height: auto;
    border-radius: 18px;
    overflow: visible;
    box-shadow: none;
    background: transparent;
}

.rec-card-img {
    width: 100%;
    height: auto;
    aspect-ratio: 4 / 3;
    border-radius: 18px;
    box-shadow: var(--shadow-md);
    background: var(--surface-2);
    transition: transform 0.3s var(--ease-out), box-shadow 0.3s;
}

.rec-card:active {
    transform: scale(0.97);
}

@media (hover: hover) {
    .rec-card:hover {
        transform: none;
        box-shadow: none;
    }

    .rec-card:hover .rec-card-img {
        transform: translateY(-4px);
        box-shadow: var(--shadow-lg);
    }
}

.rec-card-overlay {
    position: static;
    padding: 10px 2px 0;
    background: none;
}

.rec-card-title {
    color: var(--text-main);
    font-size: 0.92rem;
    font-weight: 800;
    text-shadow: none;
}

.rec-card-rating {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: 4px;
    color: var(--gold-text);
    font-size: 0.82rem;
    font-weight: 800;
}

.rec-card-rating .i {
    width: 14px;
    height: 14px;
    color: var(--gold);
}

.rec-continue-bar {
    height: 5px;
    margin-top: 8px;
    border-radius: 999px;
    background: var(--surface-2);
}

.rec-continue-fill {
    border-radius: 999px;
    background: var(--primary-gradient);
}

.rec-card .story-link,
.rec-card .story-link:focus-visible {
    border-radius: 18px;
}

/* ── Browse: toolbar ─────────────────────────────────────────────────────── */

.browse-section {
    max-width: var(--container);
    margin: 0 auto;
    text-align: left;
    scroll-margin-top: calc(var(--topbar-h) + 4px);
}

.controls-container {
    position: sticky;
    top: calc(var(--topbar-h) + 8px);
    z-index: 99;
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 10px;
    max-width: none;
    margin: 0 -8px 18px;
    padding: 8px;
    border: 1px solid transparent;
    border-radius: 24px;
    transition: background 0.25s, box-shadow 0.25s, border-color 0.25s;
}

.controls-container.stuck {
    max-width: none;
    margin: 0 -8px 18px;
    padding: 8px;
    transform: none;
    border-radius: 24px;
    background: var(--glass-bg);
    border-color: var(--glass-border);
    box-shadow: var(--shadow-md);
}

.search-container {
    flex: 1;
    min-width: 0;
}

.search-input {
    height: 56px;
    padding: 0 92px 0 52px;
    border-radius: 18px;
    border: 1.5px solid var(--border);
    background: var(--card-bg);
    box-shadow: var(--shadow-sm);
    font-size: 1rem;
    font-weight: 600;
    transition: border-color 0.2s, box-shadow 0.2s;
    -webkit-appearance: none;
    appearance: none;
}

.search-input {
    text-overflow: ellipsis;
}

.search-input::placeholder {
    color: var(--text-muted);
    opacity: 1;
    text-overflow: ellipsis;
}

.search-input:focus {
    transform: none;
    border-color: var(--primary-color);
    box-shadow: var(--ring), var(--shadow-sm);
}

.search-input::-webkit-search-cancel-button,
.search-input::-webkit-search-decoration {
    -webkit-appearance: none;
    display: none;
}

.search-icon {
    left: 18px;
    width: 20px;
    height: 20px;
    font-size: 1rem;
    opacity: 1;
    color: var(--text-muted);
    pointer-events: none;
    vertical-align: 0;
}

.search-kbd {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    min-width: 24px;
    padding: 2px 7px;
    border-radius: 7px;
    border: 1px solid var(--border-strong);
    background: var(--surface-2);
    color: var(--text-muted);
    font: 700 0.8rem/1.4 ui-monospace, SFMono-Regular, Menlo, monospace;
    text-align: center;
    pointer-events: none;
}

.search-input:focus ~ .search-kbd,
.search-input:not(:placeholder-shown) ~ .search-kbd {
    display: none;
}

@media (hover: none) {
    .search-kbd {
        display: none;
    }
}

.search-clear {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 12px;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.search-clear[hidden] {
    display: none;
}

.search-clear:hover {
    background: var(--surface-2);
    color: var(--text-main);
}

.filter-toggle {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 56px;
    padding: 0 20px;
    flex-shrink: 0;
    border-radius: 18px;
    border: 1.5px solid var(--border);
    background: var(--card-bg);
    color: var(--text-main);
    box-shadow: var(--shadow-sm);
    font-family: inherit;
    font-size: 0.98rem;
    font-weight: 800;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s, color 0.2s, transform 0.15s;
}

.filter-toggle:hover {
    border-color: var(--primary-color);
}

.filter-toggle:active {
    transform: scale(0.97);
}

.filter-toggle.has-filters {
    border-color: var(--primary-color);
    background: var(--primary-soft);
    color: var(--primary-text);
}

.filter-count {
    display: inline-grid;
    place-items: center;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    border-radius: 999px;
    background: var(--primary-fill);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 900;
}

.filter-count[hidden] {
    display: none;
}

/* Suggestions */
.search-autocomplete {
    top: calc(100% + 8px);
    padding: 6px;
    border-radius: 18px;
    border: 1px solid var(--border);
    background: var(--card-bg);
    box-shadow: var(--shadow-lg);
    text-align: left;
    animation: popDown 0.18s var(--ease-out);
}

@keyframes popDown {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: none; }
}

.autocomplete-item {
    gap: 12px;
    padding: 8px 10px;
    border-radius: 12px;
    font-weight: 700;
}

.autocomplete-item:hover,
.autocomplete-item.is-active {
    background: var(--surface-2);
}

.ac-thumb {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    border-radius: 10px;
    object-fit: cover;
    background: var(--surface-2);
}

.ac-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.ac-title {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-main);
}

.ac-meta {
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 600;
}

.autocomplete-item mark {
    padding: 0 1px;
    border-radius: 3px;
    background: rgba(255, 194, 71, 0.35);
    color: inherit;
}

/* ── Browse: heading, categories, active filters ─────────────────────────── */

.browse-head {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 6px 12px;
    margin: 6px 0 12px;
}

.browse-title {
    margin: 0;
    font-size: clamp(1.35rem, 2.6vw, 1.7rem);
    font-weight: 900;
    letter-spacing: -0.015em;
    color: var(--text-main);
}

.results-count {
    color: var(--text-muted);
    font-size: 0.95rem;
    font-weight: 700;
}

.online-badge {
    margin-left: auto;
    color: var(--text-muted);
    font-size: 0.82rem;
    font-weight: 700;
}

.filter-container {
    flex-wrap: nowrap;
    justify-content: flex-start;
    gap: 8px;
    max-width: none;
    margin: 0 -16px 14px;
    padding: 4px 16px 8px;
    overflow-x: auto;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}

.filter-container::-webkit-scrollbar {
    display: none;
}

.filter-btn,
.mood-chip,
.access-btn,
.age-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 44px;
    padding: 0 18px;
    border-radius: 999px;
    border: 1.5px solid var(--border);
    background: var(--card-bg);
    color: var(--text-main);
    box-shadow: none;
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 0;
    white-space: nowrap;
    cursor: pointer;
    scroll-snap-align: start;
    transform: none;
    transition: background 0.2s, color 0.2s, border-color 0.2s, box-shadow 0.2s, transform 0.15s;
}

.filter-btn:hover,
.mood-chip:hover,
.access-btn:hover:not(.active),
.age-btn:hover {
    transform: none;
    border-color: var(--primary-color);
    background: var(--card-bg);
    color: var(--text-main);
    box-shadow: none;
}

.filter-btn:active,
.mood-chip:active,
.access-btn:active,
.age-btn:active {
    transform: scale(0.96);
}

.filter-btn.active,
.mood-chip.active,
.access-btn.active,
.age-btn.active {
    background: var(--primary-gradient);
    border-color: transparent;
    color: #fff;
    box-shadow: var(--shadow-primary);
    transform: none;
}

.access-btn[data-access="free"].active {
    background: linear-gradient(135deg, #0F8A66 0%, #0B6E52 100%);
    box-shadow: 0 8px 20px rgba(15, 138, 102, 0.3);
}

.access-btn[data-access="premium"].active {
    background: linear-gradient(135deg, #FFE08A 0%, #FFB547 100%);
    color: #1B1F3B;
    box-shadow: 0 8px 20px rgba(255, 181, 71, 0.35);
}

.active-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin: -4px 0 18px;
}

.active-filters[hidden] {
    display: none;
}

.af-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 36px;
    padding: 0 10px 0 14px;
    border-radius: 999px;
    border: 1px solid rgba(37, 99, 235, 0.25);
    background: var(--primary-soft);
    color: var(--primary-text);
    font-family: inherit;
    font-size: 0.88rem;
    font-weight: 800;
    cursor: pointer;
    animation: chipIn 0.2s var(--ease-out);
    transition: background 0.2s, border-color 0.2s;
}

.af-chip .i {
    width: 16px;
    height: 16px;
}

.af-chip:hover {
    border-color: var(--primary-color);
    background: rgba(37, 99, 235, 0.14);
}

@keyframes chipIn {
    from { opacity: 0; transform: scale(0.9); }
    to   { opacity: 1; transform: none; }
}

.af-clear {
    min-height: 36px;
    padding: 0 8px;
    border: 0;
    background: none;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 0.88rem;
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: 3px;
    cursor: pointer;
}

.af-clear:hover {
    color: var(--text-main);
}

/* ── Filter sheet ────────────────────────────────────────────────────────── */

html.sheet-open {
    overflow: hidden;
}

.filter-sheet {
    width: min(520px, calc(100vw - 32px));
    max-width: none;
    max-height: min(86vh, 760px);
    margin: auto;
    padding: 0;
    border: 0;
    border-radius: 28px;
    background: transparent;
    color: var(--text-main);
    overflow: visible;
}

.filter-sheet::backdrop {
    background: rgba(8, 10, 32, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    animation: fadeIn 0.2s ease;
}

.filter-sheet[open] .fs-panel {
    animation: sheetIn 0.28s var(--ease-out);
}

.filter-sheet.closing .fs-panel {
    animation: sheetOut 0.18s ease-in forwards;
}

.filter-sheet.closing::backdrop {
    opacity: 0;
    transition: opacity 0.18s;
}

@keyframes sheetIn {
    from { opacity: 0; transform: translateY(16px) scale(0.98); }
    to   { opacity: 1; transform: none; }
}

@keyframes sheetOut {
    to { opacity: 0; transform: translateY(12px) scale(0.98); }
}

.fs-panel {
    display: flex;
    flex-direction: column;
    max-height: min(86vh, 760px);
    border-radius: 28px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    box-shadow: 0 30px 80px rgba(8, 10, 32, 0.35);
    text-align: left;
    overflow: hidden;
}

.fs-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 20px 8px 24px;
}

.fs-head h2 {
    margin: 0;
    font-size: 1.35rem;
    font-weight: 900;
}

.fs-close {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 50%;
    background: var(--surface-2);
    color: var(--text-main);
    cursor: pointer;
    transition: background 0.2s, transform 0.15s;
}

.fs-close:hover {
    background: var(--border-strong);
}

.fs-body {
    padding: 8px 24px 16px;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.fs-group {
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
}

.fs-group:last-child {
    border-bottom: 0;
}

.fs-label {
    display: block;
    margin: 0 0 10px;
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.filter-sheet .age-filter-container,
.filter-sheet .mood-chips-container,
.filter-sheet .access-filter-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 8px;
    max-width: none;
    width: auto;
    margin: 0;
    padding: 0;
}

.filter-sheet .duration-filter-container {
    width: 100%;
    max-width: none;
    margin: 0;
    background: var(--surface-2);
    border: 0;
    box-shadow: none;
    border-radius: 18px;
}

.filter-sheet .dur-btn {
    min-height: 60px;
    border-radius: 14px;
    color: var(--text-muted);
    font-size: 0.82rem;
}

.filter-sheet .dur-btn:hover:not(.active) {
    background: var(--card-bg);
    color: var(--text-main);
}

.filter-sheet .dur-btn.active {
    background: var(--card-bg);
    color: var(--primary-text);
    box-shadow: var(--shadow-sm), inset 0 0 0 2px var(--primary-color);
    transform: none;
}

.fs-select-wrap {
    position: relative;
}

.filter-sheet .sort-select {
    width: 100%;
    height: 52px;
    padding: 0 48px 0 16px;
    border-radius: 14px;
    border: 1.5px solid var(--border);
    background-color: var(--surface-2);
    background-position: right 18px center;
    box-shadow: none;
    font-size: 1rem;
    font-weight: 700;
    transform: none;
}

.filter-sheet .sort-select:hover,
.filter-sheet .sort-select:focus {
    transform: none;
    box-shadow: none;
    border-color: var(--primary-color);
}

.fs-foot {
    display: flex;
    gap: 10px;
    padding: 14px 20px calc(16px + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid var(--border);
    background: var(--card-bg);
}

.fs-reset {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 52px;
    padding: 0 18px;
    border-radius: 16px;
    border: 1.5px solid var(--border);
    background: transparent;
    color: var(--text-main);
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 800;
    cursor: pointer;
}

.fs-reset:hover {
    border-color: var(--border-strong);
    background: var(--surface-2);
}

.fs-apply {
    flex: 1;
    min-height: 52px;
    padding: 0 12px;
    white-space: nowrap;
    border: 0;
    border-radius: 16px;
    background: var(--primary-gradient);
    color: #fff;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 900;
    cursor: pointer;
    box-shadow: var(--shadow-primary);
    transition: transform 0.15s, filter 0.2s;
}

.fs-apply:hover {
    filter: brightness(1.06);
}

.fs-apply:active {
    transform: scale(0.98);
}

/* ── Story grid & cards ──────────────────────────────────────────────────── */

.stories-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 24px;
    max-width: none;
    margin: 0;
    padding-bottom: 12px;
}

/* Until this deploy, ui.js set these containers to display:flex inline. A
   visitor whose service worker still holds that copy gets it for one load;
   keep the grid a grid for them too. */
.stories-grid[style*="flex"] {
    display: grid !important;
}

.stories-grid > p,
.stories-grid > .empty-state {
    grid-column: 1 / -1;
}

.story-card {
    width: auto;
    max-width: none;
    border-radius: 24px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    text-align: left;
    animation: cardIn 0.45s var(--ease-out) backwards;
    animation-delay: calc(min(var(--i, 0), 12) * 35ms);
    transition: transform 0.3s var(--ease-out), box-shadow 0.3s, border-color 0.3s;
}

@keyframes cardIn {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: none; }
}

.story-card:hover,
.story-card:has(.story-link:focus-visible) {
    transform: translateY(-6px);
    box-shadow: var(--shadow-lg);
    border-color: transparent;
}

.story-card:active {
    transform: translateY(-2px) scale(0.99);
}

.story-image-wrapper {
    height: auto;
    aspect-ratio: 31 / 24;           /* the -sm.webp covers are 620x480 */
    border-radius: 0;
    background: var(--surface-2);
}

.story-card:hover .story-image {
    transform: scale(1.05);
}

.story-image-wrapper::after {
    content: '';
    position: absolute;
    inset: 55% 0 0;
    z-index: 1;
    background: linear-gradient(to bottom, rgba(8, 10, 32, 0), rgba(8, 10, 32, 0.45));
    pointer-events: none;
}

.category-badge {
    top: 12px;
    left: 12px;
    padding: 6px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.92);
    color: #1B1F3B;
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0;
    box-shadow: 0 2px 8px rgba(8, 10, 32, 0.15);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.badges-container-right {
    top: 12px;
    right: 12px;
    gap: 6px;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0;
    box-shadow: 0 2px 8px rgba(8, 10, 32, 0.18);
}

.status-badge .i {
    width: 14px;
    height: 14px;
}

.badge-premium {
    background: linear-gradient(135deg, #FFE08A 0%, #FFB547 100%);
    color: #1B1F3B;
}

.badge-locked {
    background: rgba(27, 31, 59, 0.78);
    color: #fff;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.badge-new {
    background: linear-gradient(135deg, #34D399 0%, #10B981 100%);
    color: #06281D;
    border: 0;
    box-shadow: 0 2px 10px rgba(16, 185, 129, 0.4);
    text-transform: none;
    letter-spacing: 0;
}

.badge-parents-choice {
    background: #fff;
    color: #9A5B00;
    border: 0;
    text-shadow: none;
}

.card-duration {
    position: absolute;
    left: 12px;
    bottom: 12px;
    z-index: 3;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    border-radius: 999px;
    background: rgba(8, 10, 32, 0.62);
    color: #fff;
    font-size: 0.78rem;
    font-weight: 800;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.card-duration .i {
    width: 14px;
    height: 14px;
}

/* A round play button in the corner of the art, always there (touch screens
   have no hover to reveal it), a little livelier under the pointer. */
.overlay-play {
    top: auto;
    left: auto;
    right: 12px;
    bottom: 12px;
    z-index: 3;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.95);
    color: var(--violet);
    opacity: 1;
    backdrop-filter: none;
    box-shadow: 0 6px 18px rgba(8, 10, 32, 0.3);
    transition: transform 0.25s var(--ease-spring), background 0.2s, color 0.2s;
}

.overlay-play .i,
.overlay-play svg {
    width: 20px;
    height: 20px;
    margin-left: 3px;
    fill: currentColor;
    filter: none;
    transform: none;
}

.story-card:hover .overlay-play,
.story-card:has(.story-link:focus-visible) .overlay-play {
    opacity: 1;
    transform: scale(1.1);
    background: var(--primary-gradient);
    color: #fff;
}

.story-card:hover .overlay-play svg {
    transform: none;
}

.card-progress-track {
    z-index: 4;
    height: 5px;
    background: rgba(255, 255, 255, 0.3);
}

.card-progress-fill {
    background: linear-gradient(90deg, #FFE08A, #FFB547);
}

.story-content {
    padding: 16px 18px 18px;
    gap: 8px;
}

.card-head {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.story-title {
    flex: 1;
    min-width: 0;
    margin: 0;
    font-size: 1.12rem;
    line-height: 1.35;
    letter-spacing: -0.005em;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.fav-btn {
    position: relative;
    top: auto;
    right: auto;
    z-index: 1;
    width: 44px;
    height: 44px;
    margin: -6px -8px 0 0;
    flex-shrink: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--text-muted);
    box-shadow: none;
    font-size: 1rem;
    transition: transform 0.25s var(--ease-spring), color 0.2s, background 0.2s;
}

.fav-btn .i {
    width: 22px;
    height: 22px;
    transition: fill 0.2s;
}

.fav-btn:hover {
    transform: scale(1.1);
    background: rgba(239, 68, 68, 0.08);
    color: #DC2626;
    box-shadow: none;
}

.fav-btn.fav-active {
    color: #E11D48;
}

.fav-btn.fav-active .i {
    fill: currentColor;
    animation: heartPop 0.35s var(--ease-spring);
}

@keyframes heartPop {
    0%   { transform: scale(0.6); }
    100% { transform: scale(1); }
}

.card-meta {
    margin: 0;
}

.cm-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 14px;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 700;
}

.cm-item {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.cm-item .i {
    width: 15px;
    height: 15px;
}

.cm-rating {
    color: var(--gold-text);
    font-weight: 800;
}

.cm-rating .i {
    color: var(--gold);
}

.cm-rating small {
    color: var(--text-muted);
    font-size: 0.8em;
    font-weight: 600;
}

.cm-age {
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--surface-2);
    color: var(--text-main);
    font-size: 0.78rem;
}

.card-tags-container {
    justify-content: flex-start;
    gap: 6px;
    margin: 2px 0 0;
}

.card-tags-container:empty {
    display: none;
}

.card-tag {
    min-height: 28px;
    padding: 3px 10px;
    border-radius: 999px;
    background: var(--primary-soft);
    color: var(--primary-text);
    font-size: 0.75rem;
    font-weight: 700;
    position: relative;
}

/* The tags are small on purpose; their tap area isn't. */
.card-tag::before {
    content: '';
    position: absolute;
    inset: -8px -3px;
}

.card-tag:hover {
    background: var(--primary-fill);
    color: #fff;
}

.story-link,
.story-link:focus-visible {
    border-radius: 24px;
}

/* Skeletons match the new cards so nothing jumps when the real ones land. */
.skeleton-card {
    width: auto;
    height: auto;
    border-radius: 24px;
    border: 1px solid var(--border);
    box-shadow: none;
    opacity: 1;
}

.skeleton-img {
    height: auto;
    aspect-ratio: 31 / 24;
}

.skeleton-text {
    height: 16px;
    margin: 16px 18px 0;
}

.skeleton-text.short {
    margin-top: 10px;
}

.skeleton-btn {
    height: 16px;
    width: 30%;
    margin: 12px 18px 20px;
    background: var(--skeleton-base);
    border-radius: 8px;
}

.skeleton-card[style*="display:none"] {
    display: flex !important;
}

/* Empty state */
.empty-state {
    padding: 48px 20px 56px;
    border-radius: 28px;
    border: 1.5px dashed var(--border-strong);
    background: var(--card-bg);
    text-align: center;
}

.empty-illo {
    display: inline-grid;
    place-items: center;
    width: 88px;
    height: 88px;
    margin-bottom: 14px;
    border-radius: 50%;
    background: var(--surface-2);
    font-size: 2.6rem;
}

.empty-state h3 {
    margin: 0 0 8px;
    font-size: 1.3rem;
    font-weight: 900;
}

.empty-state p {
    max-width: 420px;
    margin: 0 auto 22px;
    color: var(--text-muted);
    line-height: 1.6;
}

.empty-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 48px;
    padding: 0 22px;
    border: 0;
    border-radius: 999px;
    background: var(--primary-gradient);
    color: #fff;
    font-family: inherit;
    font-size: 0.98rem;
    font-weight: 800;
    cursor: pointer;
    box-shadow: var(--shadow-primary);
}

/* Pager */
.main-pagination-container {
    gap: 10px;
    margin: 28px auto 48px;
}

.main-page-btn {
    min-height: 48px;
    padding: 0 22px;
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    border: 1.5px solid var(--border);
    background: var(--card-bg);
    box-shadow: var(--shadow-sm);
    font-size: 1rem;
    font-weight: 800;
}

.main-page-btn:hover:not(:disabled):not(.is-disabled) {
    transform: translateY(-2px);
    border-color: transparent;
    box-shadow: var(--shadow-primary);
}

.main-page-info {
    padding: 10px 18px;
    border-radius: 999px;
    background: var(--primary-soft);
    color: var(--primary-text);
    font-size: 1rem;
    font-variant-numeric: tabular-nums;
}

/* ── Benefits & parent voice ─────────────────────────────────────────────── */

.benefits-section {
    max-width: var(--container);
    margin: 48px auto 32px;
    padding: 56px 32px;
    border-radius: 32px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

html[data-theme="dark"] .benefits-section {
    background: var(--card-bg);
}

.benefits-title {
    margin-bottom: 10px;
    color: var(--text-main);
    font-size: clamp(1.7rem, 3.4vw, 2.4rem);
    letter-spacing: -0.02em;
}

.benefits-subtitle {
    margin-bottom: 32px;
    font-size: 1.08rem;
}

.benefits-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
    gap: 12px;
    max-width: 920px;
}

.benefit-card-new,
html[data-theme="dark"] .benefit-card-new {
    padding: 0;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: var(--bg-color);
    box-shadow: none;
    transition: border-color 0.2s, background 0.2s;
}

.benefit-card-new:hover {
    transform: none;
    border-color: var(--primary-color);
    box-shadow: none;
}

.benefit-card-new[open] {
    background: var(--card-bg);
    border-color: var(--primary-color);
    box-shadow: var(--shadow-md);
}

.benefit-card-new summary {
    gap: 14px;
    min-height: 64px;
    padding: 12px 18px 12px 14px;
    justify-content: flex-start;
    color: var(--text-main);
    font-size: 1.02rem;
    font-weight: 800;
    cursor: pointer;
    border-radius: 20px;
}

.benefit-card-new summary > span:nth-child(2) {
    flex: 1;
}

.benefit-card-new summary::after {
    content: '';
    width: 10px;
    height: 10px;
    margin-right: 4px;
    border-right: 2.5px solid var(--text-muted);
    border-bottom: 2.5px solid var(--text-muted);
    transform: rotate(45deg) translateY(-3px);
    transition: transform 0.25s var(--ease-out);
}

.benefit-card-new[open] summary::after {
    transform: rotate(225deg) translateY(-3px);
    border-color: var(--primary-color);
}

.bf-ico {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    flex-shrink: 0;
    border-radius: 14px;
    background: var(--primary-soft);
    font-size: 1.3rem;
}

.benefit-card-new p {
    margin: 0;
    padding: 0 20px 18px 70px;
    color: var(--text-muted);
    font-size: 0.98rem;
    line-height: 1.7;
}

.parent-voice-block,
html[data-theme="dark"] .parent-voice-block {
    display: flex;
    align-items: flex-start;
    gap: 20px;
    max-width: 920px;
    margin-top: 28px;
    padding: 28px;
    border-radius: 24px;
    background:
        radial-gradient(120% 120% at 100% 0%, rgba(255, 194, 71, 0.25), transparent 55%),
        linear-gradient(135deg, #2A1E6E 0%, #4B2FB8 100%);
    box-shadow: 0 20px 44px -16px rgba(75, 47, 184, 0.55);
}

.pv-ico {
    display: grid;
    place-items: center;
    width: 56px;
    height: 56px;
    flex-shrink: 0;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.14);
    color: var(--gold);
}

.pv-ico .i {
    width: 28px;
    height: 28px;
}

.parent-voice-block h3,
html[data-theme="dark"] .parent-voice-block h3 {
    margin: 0 0 8px;
    color: #fff;
    font-size: 1.35rem;
}

.parent-voice-block p,
html[data-theme="dark"] .parent-voice-block p {
    margin: 0;
    color: rgba(236, 240, 255, 0.88);
    font-size: 1rem;
    line-height: 1.7;
}

.parent-voice-block strong {
    color: #FFE08A;
}

/* ── Floating things ─────────────────────────────────────────────────────── */

#scrollTopBtn {
    width: 48px;
    height: 48px;
    right: 24px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    color: var(--text-main);
    box-shadow: var(--shadow-md);
    transition: opacity 0.25s, visibility 0.25s, transform 0.25s var(--ease-out), background 0.2s, color 0.2s;
}

#scrollTopBtn .i {
    width: 22px;
    height: 22px;
}

#scrollTopBtn:hover {
    transform: translateY(-3px);
    background: var(--primary-gradient);
    color: #fff;
    box-shadow: var(--shadow-primary);
}

.facebook-floating-btn {
    right: 24px;
    padding: 0 18px;
    min-height: 44px;
    background: #1877F2;
    border: 0;
    box-shadow: 0 8px 22px rgba(24, 119, 242, 0.35);
}

.facebook-floating-btn:hover {
    transform: translateY(-3px);
    background: #166FE5;
}

.pwa-banner {
    position: fixed;
    left: 50%;
    bottom: calc(var(--bottom-nav-h) + var(--float-gap) + env(safe-area-inset-bottom, 0px));
    transform: translateX(-50%);
    z-index: 1500;
    display: flex;
    align-items: center;
    gap: 12px;
    width: min(420px, calc(100vw - 24px));
    padding: 12px 10px 12px 12px;
    border-radius: 22px;
    border: 1px solid var(--border);
    background: var(--card-bg);
    box-shadow: var(--shadow-lg);
    text-align: left;
    animation: slideUpIn 0.35s var(--ease-out);
}

@keyframes slideUpIn {
    from { opacity: 0; transform: translate(-50%, 16px); }
    to   { opacity: 1; transform: translate(-50%, 0); }
}

/* Never on top of a story or a dialog. */
body:has(.modal.open) .pwa-banner,
html.sheet-open .pwa-banner {
    display: none !important;
}

.pwa-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    flex-shrink: 0;
}

.pwa-text {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
}

.pwa-text strong {
    color: var(--text-main);
    font-size: 0.95rem;
}

.pwa-text span {
    color: var(--text-muted);
    font-size: 0.82rem;
    font-weight: 600;
}

.pwa-install {
    min-height: 44px;
    padding: 0 16px;
    border: 0;
    border-radius: 14px;
    background: var(--primary-gradient);
    color: #fff;
    font-family: inherit;
    font-weight: 800;
    cursor: pointer;
    white-space: nowrap;
}

.pwa-close {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 12px;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
}

.pwa-close:hover {
    background: var(--surface-2);
}

#mini-player {
    border-radius: 22px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

.mini-player-btn {
    width: 44px;
    height: 44px;
    background: var(--primary-gradient);
}

.mini-player-close-btn {
    background: transparent;
}

.resume-bar {
    border-radius: 22px;
    border-color: var(--border);
    box-shadow: var(--shadow-lg);
}

.resume-icon {
    background: var(--primary-gradient);
}

.resume-text span {
    color: var(--primary-text);
}

.resume-close {
    width: 40px;
    height: 40px;
}

/* Modals keep their layout from main.css; the scrim gets deeper and the
   corners and buttons join the new system. */
.modal {
    background-color: rgba(8, 10, 32, 0.55);
}

.auth-submit-btn,
.comment-submit-btn {
    background: var(--primary-gradient);
    box-shadow: var(--shadow-primary);
}

.auth-input:focus,
.comment-input:focus {
    border-color: var(--primary-color);
    box-shadow: var(--ring);
}

/* ── Reader polish ───────────────────────────────────────────────────────── */

.book-modal-content {
    border-left-color: transparent;
    background-image: linear-gradient(var(--card-bg), var(--card-bg)), var(--primary-gradient);
    background-origin: border-box;
    background-clip: padding-box, border-box;
}

/* Story text in a serif reads like a book; the UI around it stays sans. */
.book-text {
    font-family: 'Noto Serif Georgian', 'Noto Sans Georgian', serif;
    line-height: 1.95;
}

.book-title {
    letter-spacing: -0.015em;
}

.star-rating-container .star {
    transition: transform 0.2s var(--ease-spring), color 0.2s;
}

.star-rating-container .star:hover {
    transform: scale(1.18);
}

.play-btn {
    background: var(--primary-gradient);
    box-shadow: 0 12px 30px rgba(79, 70, 229, 0.4);
}

.progress-bar {
    background: var(--primary-gradient);
}

.share-btn-aesthetic {
    min-height: 40px;
    border-radius: 999px;
}

/* The nine player extras used to be a sideways-scrolling strip on phones
   with most of them off screen. A wrapping grid shows every one of them. */
@media (max-width: 600px) {
    .player-extra-controls {
        display: grid !important;
        grid-template-columns: repeat(auto-fill, minmax(76px, 1fr));
        gap: 8px;
        overflow: visible;
        padding: 8px 0 12px;
    }

    .player-extra-controls .player-control-btn {
        width: auto;
        height: 72px;
        gap: 6px;
        border-radius: 18px;
        border: 1px solid var(--border);
        box-shadow: none;
        font-size: 1.4em;
    }

    .player-extra-controls .player-control-btn span {
        font-size: 0.5em;
        letter-spacing: 0;
        text-transform: none;
    }

    .book-img {
        max-height: 220px;
        object-fit: cover;
    }

    /* The play row is pulled up between the two time labels; as 85px tiles
       the skip buttons covered them. */
    .player-main-controls .skip-time-btn {
        width: 52px;
        height: 52px;
        border-radius: 50%;
        border: 0;
        background: var(--surface-2);
        box-shadow: none;
        font-size: 1em;
    }

    .player-main-controls .skip-time-btn svg {
        width: 26px;
        height: 26px;
    }
}

/* ── Bottom nav (phones) ─────────────────────────────────────────────────── */

.nav-items-container {
    box-sizing: border-box;
    height: 68px;
    padding: 0 6px;
}

.nav-item {
    min-width: 0;
    height: 100%;
    padding: 6px 2px 0;
    gap: 4px;
    border: 0;
    background: none;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 1rem;
    transition: color 0.2s, transform 0.2s var(--ease-out);
}

.nav-item .i {
    width: 24px;
    height: 24px;
}

.nav-item span {
    font-size: 0.68rem;
    font-weight: 800;
    text-transform: none;
    letter-spacing: 0;
    opacity: 1;
    white-space: nowrap;
}

.nav-item.active {
    color: var(--primary-text);
    transform: none;
}

.nav-item.active .i {
    stroke-width: 2.4;
}

.nav-item.active::after {
    bottom: auto;
    top: 0;
    width: 24px;
    height: 3px;
    border-radius: 0 0 3px 3px;
    box-shadow: none;
    background: var(--primary-gradient);
}

.nav-item:active {
    transform: scale(0.92);
}

/* The raised dice sits 26px above the bar, so hiding the bar has to go further. */
.mobile-bottom-nav.nav-hidden {
    transform: translateY(calc(100% + 40px));
}

.nav-item-center {
    justify-content: flex-end;
    padding-bottom: 8px;
}

.nav-item-center::after {
    display: none;
}

.nav-center-bubble {
    display: grid;
    place-items: center;
    width: 56px;
    height: 56px;
    margin-top: -26px;
    border-radius: 20px;
    background: linear-gradient(135deg, #FFE08A 0%, #FFB547 100%);
    color: #1B1F3B;
    box-shadow: 0 10px 24px rgba(255, 181, 71, 0.45), 0 0 0 5px var(--nav-bg);
    transform: rotate(-6deg);
    transition: transform 0.25s var(--ease-spring);
}

.nav-center-bubble .i {
    width: 26px;
    height: 26px;
}

.nav-item-center:hover .nav-center-bubble {
    transform: rotate(0deg) scale(1.04);
}

.nav-item-center span:last-child {
    color: var(--text-main);
}

/* ── Kids mode: the new browse furniture goes too ────────────────────────── */

.kids-mode-active .browse-head,
.kids-mode-active .active-filters,
.kids-mode-active .filter-sheet,
.kids-mode-active #hero-section-container,
.kids-mode-active .pwa-banner {
    display: none !important;
}

/* ── Tablet ──────────────────────────────────────────────────────────────── */

@media (max-width: 1024px) {
    .stories-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 20px;
    }
}

@media (max-width: 768px) {
    .hero-featured-bg {
        height: 300px;
    }

    .hero-featured-overlay {
        justify-content: flex-end;
        padding: 24px;
        background: linear-gradient(180deg, rgba(8, 10, 32, 0) 25%, rgba(8, 10, 32, 0.88) 100%);
    }

    .benefits-grid {
        grid-template-columns: 1fr;
    }

    /* Facebook lives in the footer and the profile on phones; the floating
       bubble fought the bottom nav, the mini player and scroll-to-top for
       the same corner. */
    .facebook-floating-btn {
        display: none;
    }

    #scrollTopBtn {
        bottom: calc(var(--bottom-nav-h) + var(--float-gap) + var(--resume-stack)) !important;
        right: 16px;
    }
}

/* ── Phones ──────────────────────────────────────────────────────────────── */

@media (max-width: 600px) {
    :root {
        --topbar-h: 64px;
        --bottom-nav-h: calc(68px + env(safe-area-inset-bottom, 0px));
    }

    body {
        padding-bottom: calc(76px + env(safe-area-inset-bottom, 0px));
    }

    /* The top bar scrolls away on phones, so nothing needs clearing above
       the search bar when something scrolls to it. */
    html {
        scroll-padding-top: 8px;
    }

    .browse-section {
        scroll-margin-top: 0;
    }

    .content-wrapper {
        padding: 0 12px 40px;
    }

    /* Scrolls away with the page; the search bar is what stays. */
    .top-bar {
        position: relative !important;
        min-height: var(--topbar-h);
        margin: 0 -12px;
        padding: 6px 12px 6px 16px;
        border-radius: 0 0 22px 22px;
        border-left: 0;
        border-right: 0;
    }

    .nav-logo-link img {
        height: 68px;
        margin: -8px -30px;
    }

    .header-section.hero-intro {
        margin-top: 12px !important;
        margin-bottom: 22px !important;
        padding: 40px 18px 24px;
        border-radius: 26px;
    }

    .hero-moon {
        top: 18px;
        right: 16px;
        width: 46px;
        height: 46px;
    }

    .hero-greeting {
        margin-bottom: 14px;
        font-size: 0.82rem;
    }

    .hero-intro .subtitle {
        margin-bottom: 22px;
        font-size: 0.98rem;
    }

    .hero-actions {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        margin-bottom: 20px;
    }

    .hero-cta {
        width: 100%;
    }

    .hero-facts {
        gap: 8px 14px;
        font-size: 0.8rem;
    }

    .hero-facts li:nth-child(3) {
        display: none;
    }

    .weekly-pill {
        margin-top: 20px;
        padding: 10px 12px;
        gap: 12px;
    }

    .weekly-top {
        flex-direction: column;
        align-items: flex-start;
        gap: 2px;
        margin-bottom: 6px;
    }

    #weekly-progress-text {
        font-size: 0.78rem;
        white-space: normal;
    }

    .hero-featured-section {
        border-radius: 22px;
        margin-bottom: 26px;
    }

    .hero-featured-bg {
        height: 240px;
    }

    .hero-title {
        font-size: 1.55rem;
    }

    .hero-meta {
        margin-bottom: 14px;
        font-size: 0.85rem;
    }

    .hero-btn {
        min-height: 44px;
        padding: 0 18px;
        font-size: 0.92rem;
    }

    .rec-scroll-row {
        margin: 0 -12px;
        padding: 4px 12px 10px;
        gap: 12px;
    }

    .rec-card {
        flex-basis: 150px;
    }

    .controls-container,
    .controls-container.stuck {
        top: 8px;
        margin: 0 -6px 14px;
        padding: 6px;
        border-radius: 22px;
    }

    .search-input {
        height: 52px;
        padding-right: 48px;
        font-size: 16px;                  /* below 16px iOS zooms on focus */
    }

    .filter-toggle {
        width: 52px;
        height: 52px;
        padding: 0;
        justify-content: center;
    }

    .filter-toggle-label {
        display: none;
    }

    .filter-count {
        position: absolute;
        top: -6px;
        right: -6px;
        box-shadow: 0 0 0 2px var(--bg-color);
    }

    .filter-container {
        margin: 0 -12px 12px;
        padding: 4px 12px 8px;
    }

    .filter-btn {
        min-height: 40px;
        padding: 0 16px;
        font-size: 0.9rem;
    }

    /* Two cards a row: a phone screen now shows four stories, not one. */
    .stories-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
    }

    .story-card {
        border-radius: 18px;
    }

    .story-link,
    .story-link:focus-visible {
        border-radius: 18px;
    }

    .story-card:hover,
    .story-card:has(.story-link:focus-visible) {
        transform: none;
    }

    .category-badge {
        top: 8px;
        left: 8px;
        max-width: calc(100% - 16px);
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        padding: 4px 9px;
        font-size: 0.68rem;
    }

    /* On a half-width card the status badges would cover the art, so they
       drop to the top-right corner as compact icons. */
    .badges-container-right {
        top: auto;
        bottom: 8px;
        right: 8px;
        flex-direction: row;
    }

    .badges-container-right .badge-new,
    .badges-container-right .badge-parents-choice {
        display: none;
    }

    .status-badge {
        padding: 5px;
        font-size: 0;
        gap: 0;
    }

    .status-badge .i {
        width: 14px;
        height: 14px;
    }

    .card-duration {
        left: 8px;
        bottom: 8px;
        padding: 4px 8px;
        font-size: 0.7rem;
    }

    .overlay-play {
        display: none;
    }

    .story-content {
        padding: 10px 10px 12px 12px;
        gap: 6px;
    }

    .story-title {
        font-size: 0.95rem;
        line-height: 1.35;
    }

    .fav-btn {
        width: 40px;
        height: 40px;
        margin: -8px -6px 0 -4px;
    }

    .fav-btn .i {
        width: 20px;
        height: 20px;
    }

    .cm-row {
        gap: 4px 10px;
        font-size: 0.75rem;
    }

    .cm-age {
        display: none;
    }

    .card-tags-container {
        display: none;
    }

    .skeleton-card {
        border-radius: 18px;
    }

    .browse-head {
        margin-top: 2px;
    }

    .online-badge {
        display: none;
    }

    .benefits-section {
        margin: 36px auto 24px;
        padding: 36px 16px;
        border-radius: 26px;
    }

    .benefit-card-new p {
        padding: 0 16px 16px;
    }

    .parent-voice-block,
    html[data-theme="dark"] .parent-voice-block {
        flex-direction: column;
        padding: 22px;
    }

    .filter-sheet {
        width: 100vw;
        max-width: 100vw;
        max-height: 88vh;
        margin: auto 0 0;
        border-radius: 28px 28px 0 0;
    }

    .fs-panel {
        max-height: 88vh;
        border-radius: 28px 28px 0 0;
        border-bottom: 0;
    }

    .fs-panel::before {
        content: '';
        display: block;
        width: 44px;
        height: 5px;
        margin: 10px auto 0;
        border-radius: 999px;
        background: var(--border-strong);
    }

    .fs-head {
        padding-top: 8px;
    }

    @keyframes sheetIn {
        from { transform: translateY(100%); }
        to   { transform: none; }
    }

    @keyframes sheetOut {
        to { transform: translateY(100%); }
    }

    .fs-foot {
        padding-left: 16px;
        padding-right: 16px;
    }

    .fs-reset {
        padding: 0 14px;
        font-size: 0.9rem;
    }

    .pwa-banner {
        bottom: calc(var(--bottom-nav-h) + 10px);
    }

    #mini-player {
        bottom: calc(var(--bottom-nav-h) + 10px);
    }

    .site-footer {
        border-radius: 26px 26px 0 0;
    }
}

@media (max-width: 359px) {
    .stories-grid {
        grid-template-columns: 1fr;
    }

    .nav-item span {
        font-size: 0.6rem;
    }
}

/* ── Motion off ──────────────────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
    .hero-shooting-star {
        display: none;
    }
}
