/* ============================================================================
   Kinfable — estilos
   Marca: navy #1F2A52 · cream #FBF3E4 · dourado #E8A33D
   Acentos lúdicos: coral, rosa, teal, lavanda (vindos do ícone da marca)
   Tipografia: Fredoka (display) + Nunito (texto)
   ============================================================================ */

:root {
    --navy: #1F2A52;
    --navy-700: #17203f;
    --navy-900: #0f1630;
    --cream: #FBF3E4;
    --cream-200: #f5ead2;
    --gold: #E8A33D;
    --gold-600: #d18d28;
    --coral: #F2756B;
    --pink: #E98CA8;
    --teal: #4FB7B3;
    --lav: #9B8BD0;
    --ink: #2b2f38;
    --muted: #6b7180;
    --white: #ffffff;
    --danger: #b3261e;
    --success: #1e7d4f;

    --radius: 18px;
    --radius-lg: 28px;
    --shadow-sm: 0 4px 14px rgba(31, 42, 82, 0.08);
    --shadow: 0 14px 40px rgba(31, 42, 82, 0.14);
    --shadow-lg: 0 28px 70px rgba(31, 42, 82, 0.22);
    --container: 1120px;

    --font-display: "Fredoka", "Segoe UI", system-ui, sans-serif;
    --font-body: "Nunito", "Segoe UI", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
[x-cloak] { display: none !important; }

html, body { margin: 0; padding: 0; overflow-x: hidden; max-width: 100%; }

body {
    font-family: var(--font-body);
    color: var(--ink);
    background: var(--cream);
    line-height: 1.65;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

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

.container {
    width: 100%;
    max-width: var(--container);
    margin: 0 auto;
    padding: 0 22px;
}

.site-main { flex: 1 0 auto; }

a { color: var(--navy); }

/* ── Botões ─────────────────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 0;
    border-radius: 999px;
    padding: 12px 24px;
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: transform .12s ease, box-shadow .12s ease, background .15s ease;
    white-space: nowrap;
}
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0); }
.btn--primary {
    background: linear-gradient(135deg, var(--gold), var(--coral));
    color: #fff;
    box-shadow: 0 8px 22px rgba(242, 117, 107, 0.4);
}
.btn--primary:hover { box-shadow: 0 12px 28px rgba(242, 117, 107, 0.5); }
.btn--secondary {
    background: var(--cream);
    color: var(--navy-700);
    box-shadow: var(--shadow-sm);
}
.btn--ghost {
    background: transparent;
    color: var(--cream);
    border: 1.5px solid rgba(251, 243, 228, 0.45);
}
.btn--ghost:hover { background: rgba(251, 243, 228, 0.12); }
.btn--text {
    background: transparent;
    color: var(--navy);
    padding: 12px 8px;
}
.btn--text:hover { color: var(--coral); }
.btn--lg { padding: 16px 34px; font-size: 1.12rem; }
.btn--sm { padding: 9px 16px; font-size: .92rem; }

/* ── Header ─────────────────────────────────────────────────────────────── */
.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgba(31, 42, 82, 0.92);
    backdrop-filter: saturate(140%) blur(8px);
    color: var(--cream);
    box-shadow: 0 2px 18px rgba(15, 22, 48, 0.25);
}
.site-header__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 22px;
}
.site-header__brand { display: inline-flex; align-items: center; gap: 11px; text-decoration: none; }
.site-header__icon { height: 40px; width: 40px; border-radius: 11px; display: block; box-shadow: var(--shadow-sm); }
.site-header__wordmark {
    font-family: var(--font-display);
    color: var(--cream);
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: .3px;
}
.site-header__nav { display: flex; align-items: center; gap: 14px; }
.nav-link { color: var(--cream); text-decoration: none; font-weight: 600; }
.nav-link:hover { text-decoration: underline; }
.nav-user { display: inline-flex; align-items: center; gap: 8px; color: var(--cream); font-size: .95rem; }
.nav-user__avatar { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; border: 2px solid rgba(255,255,255,.4); }
.nav-logout { margin: 0; }

/* ── Seletor de idioma ──────────────────────────────────────────────────── */
.lang-switch { position: relative; }
.lang-switch__btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.12);
    color: var(--cream);
    border: 0;
    border-radius: 999px;
    padding: 7px 12px;
    cursor: pointer;
    font-family: var(--font-body);
    font-weight: 700;
    font-size: .9rem;
}
.lang-switch__btn:hover { background: rgba(255, 255, 255, 0.2); }
.lang-switch__caret { font-size: .7rem; opacity: .8; }
.lang-switch__menu {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    background: var(--white);
    border-radius: 14px;
    box-shadow: var(--shadow);
    padding: 6px;
    min-width: 168px;
    z-index: 60;
}
.lang-switch__item {
    display: block;
    padding: 10px 14px;
    border-radius: 10px;
    color: var(--ink);
    text-decoration: none;
    font-weight: 600;
}
.lang-switch__item:hover { background: var(--cream); }
.lang-switch__item.is-active { background: var(--cream-200); color: var(--navy); }

/* ── Alertas / flash ────────────────────────────────────────────────────── */
.alert {
    max-width: var(--container);
    margin: 18px auto;
    padding: 13px 20px;
    border-radius: var(--radius);
    font-weight: 700;
}
.alert--success { background: #e3f3ea; color: var(--success); }
.alert--error   { background: #fbe6e4; color: var(--danger); }

/* ── Hero ───────────────────────────────────────────────────────────────── */
.hero {
    position: relative;
    overflow: hidden;
    background:
        radial-gradient(1200px 500px at 80% -10%, rgba(233, 140, 168, .25), transparent 60%),
        radial-gradient(900px 500px at 0% 10%, rgba(79, 183, 179, .22), transparent 55%),
        linear-gradient(165deg, #fff7ea 0%, var(--cream) 45%, #f6e6cf 100%);
    padding: 72px 0 96px;
}
.hero__inner {
    position: relative;
    z-index: 2;
    display: grid;
    grid-template-columns: 1.15fr .85fr;
    gap: 48px;
    align-items: center;
}
.hero__badge {
    display: inline-block;
    background: rgba(255, 255, 255, .75);
    color: var(--navy);
    font-weight: 700;
    font-size: .9rem;
    padding: 7px 16px;
    border-radius: 999px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 18px;
}
.hero__title {
    font-size: clamp(2.2rem, 4.6vw, 3.5rem);
    font-weight: 700;
    color: var(--navy);
    margin: 0 0 18px;
}
.hero__subtitle {
    font-size: 1.2rem;
    color: #5a5f6e;
    margin: 0 0 30px;
    max-width: 560px;
}
.hero__actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.hero__hint { margin-top: 18px; color: var(--muted); font-weight: 600; }

.hero__art { display: flex; justify-content: center; }
.hero__logo {
    display: block;
    max-width: 100%;
    height: auto;
    filter: drop-shadow(0 24px 40px rgba(31, 42, 82, 0.22));
    animation: heroFloat 6s ease-in-out infinite;
}
@keyframes heroFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-12px); }
}
@media (prefers-reduced-motion: reduce) { .hero__logo { animation: none; } }

/* Formas decorativas flutuantes */
.hero__decor { position: absolute; inset: 0; z-index: 1; pointer-events: none; }
.blob { position: absolute; border-radius: 50%; filter: blur(8px); opacity: .5; animation: float 9s ease-in-out infinite; }
.blob--1 { width: 130px; height: 130px; background: var(--pink);  top: 12%; left: 8%; animation-delay: 0s; }
.blob--2 { width: 90px;  height: 90px;  background: var(--teal);  bottom: 18%; left: 22%; animation-delay: 1.5s; }
.blob--3 { width: 110px; height: 110px; background: var(--gold);  top: 22%; right: 12%; animation-delay: .8s; }
.spark { position: absolute; color: var(--gold); font-size: 1.6rem; opacity: .8; animation: twinkle 3s ease-in-out infinite; }
.spark--1 { top: 18%; left: 40%; color: var(--coral); animation-delay: 0s; }
.spark--2 { bottom: 26%; right: 30%; color: var(--teal); animation-delay: .7s; font-size: 1.2rem; }
.spark--3 { top: 34%; right: 6%; color: var(--lav); animation-delay: 1.4s; }
.spark--4 { bottom: 14%; left: 46%; color: var(--gold); animation-delay: 2s; font-size: 2rem; }

@keyframes float {
    0%, 100% { transform: translateY(0) translateX(0); }
    50% { transform: translateY(-22px) translateX(10px); }
}
@keyframes twinkle {
    0%, 100% { transform: scale(1); opacity: .35; }
    50% { transform: scale(1.4) rotate(15deg); opacity: .95; }
}
@media (prefers-reduced-motion: reduce) {
    .blob, .spark { animation: none; }
}

.hero__wave { position: absolute; left: 0; right: 0; bottom: -1px; z-index: 2; line-height: 0; }
.hero__wave svg { width: 100%; height: 70px; display: block; }
.hero__wave path { fill: var(--cream); }

/* ── Cabeçalho de seção ─────────────────────────────────────────────────── */
.section-head { text-align: center; max-width: 680px; margin: 0 auto 44px; }
.section-title { font-size: clamp(1.7rem, 3.2vw, 2.4rem); color: var(--navy); margin: 0 0 10px; }
.section-subtitle { font-size: 1.15rem; color: var(--muted); margin: 0; }

/* ── Como funciona (passos) ─────────────────────────────────────────────── */
.how { padding: 80px 0; }
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 26px; }
.step {
    position: relative;
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 40px 28px 30px;
    box-shadow: var(--shadow-sm);
    text-align: center;
    transition: transform .18s ease, box-shadow .18s ease;
}
.step:hover { transform: translateY(-6px); box-shadow: var(--shadow); }
.step__num {
    width: 56px; height: 56px;
    margin: -68px auto 16px;
    display: grid; place-items: center;
    font-family: var(--font-display);
    font-size: 1.6rem; font-weight: 700; color: #fff;
    background: linear-gradient(135deg, var(--teal), var(--lav));
    border-radius: 50%;
    box-shadow: var(--shadow);
    border: 5px solid var(--cream);
}
.step:nth-child(2) .step__num { background: linear-gradient(135deg, var(--gold), var(--coral)); }
.step:nth-child(3) .step__num { background: linear-gradient(135deg, var(--pink), var(--lav)); }
.step__title { color: var(--navy); margin: 0 0 10px; font-size: 1.25rem; }
.step__text { color: var(--muted); margin: 0; }

/* ── Features ───────────────────────────────────────────────────────────── */
.features { padding: 30px 0 80px; }
.features__grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 26px; }
.feature-card {
    background: linear-gradient(180deg, #fff, #fffdf8);
    border: 1px solid rgba(31, 42, 82, .06);
    border-radius: var(--radius-lg);
    padding: 32px 28px;
    box-shadow: var(--shadow-sm);
    transition: transform .18s ease, box-shadow .18s ease;
}
.feature-card:hover { transform: translateY(-6px); box-shadow: var(--shadow); }
.feature-card h3 { color: var(--navy); margin: 0 0 12px; font-size: 1.3rem; }
.feature-card p { color: var(--muted); margin: 0; }

/* ── Preços (teaser) ────────────────────────────────────────────────────── */
.pricing {
    background:
        radial-gradient(600px 300px at 50% 0%, rgba(79,183,179,.18), transparent 70%),
        var(--cream-200);
    padding: 76px 0;
}
.pricing__inner { text-align: center; max-width: 720px; }
.pricing__subtitle { font-size: 1.15rem; color: #5a5f6e; margin: 14px 0 18px; }
.pricing__free {
    display: inline-block;
    background: #fff;
    color: var(--navy);
    font-weight: 700;
    padding: 10px 20px;
    border-radius: 999px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 26px;
}

/* ── CTA final ──────────────────────────────────────────────────────────── */
.cta {
    background:
        radial-gradient(700px 300px at 80% 0%, rgba(233,140,168,.3), transparent 60%),
        linear-gradient(135deg, var(--navy), var(--navy-900));
    color: var(--cream);
    padding: 76px 0;
    text-align: center;
}
.cta__title { font-size: clamp(1.7rem, 3.4vw, 2.4rem); margin: 0 0 26px; color: #fff; }

/* ── Footer ─────────────────────────────────────────────────────────────── */
.site-footer {
    background: var(--navy-900);
    color: var(--cream-200);
    padding: 34px 0;
    font-size: .95rem;
}
.site-footer__inner { display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.site-footer__brand { display: flex; align-items: center; gap: 12px; }
.site-footer__icon { width: 42px; height: 42px; border-radius: 12px; }
.site-footer__brand strong { display: block; font-family: var(--font-display); color: #fff; font-size: 1.1rem; }
.site-footer__tagline { color: var(--cream-200); opacity: .8; font-size: .88rem; }
.site-footer__nav a { color: var(--cream-200); margin-left: 18px; text-decoration: none; }
.site-footer__nav a:first-child { margin-left: 0; }
.site-footer__nav a:hover { text-decoration: underline; }
.site-footer__copy { opacity: .7; }

/* ── Dashboard ──────────────────────────────────────────────────────────── */
.dashboard { padding: 54px 22px; }
.dashboard__greeting { color: var(--navy); font-size: 2rem; }
.dashboard__cards { display: grid; grid-template-columns: repeat(2, 1fr); gap: 24px; margin: 24px 0 42px; }
.dash-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 26px;
    box-shadow: var(--shadow-sm);
    display: flex; flex-direction: column; align-items: flex-start; gap: 8px;
}
.dash-card__label { color: var(--muted); font-weight: 700; font-size: .9rem; }
.dash-card__value { font-family: var(--font-display); font-size: 2.1rem; font-weight: 700; color: var(--navy); }
.dash-card .btn { margin-top: 8px; }
.dashboard__section h2 { color: var(--navy); }
.muted { color: var(--muted); }

/* ── Botão de perigo + utilitários ──────────────────────────────────────── */
.btn--danger { background: #fbe6e4; color: var(--danger); }
.btn--danger:hover { background: #f6d3d0; }
.sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* ── Páginas internas ───────────────────────────────────────────────────── */
.page { padding: 40px 22px 70px; }
.page--narrow { max-width: 600px; }
.page__head {
    display: flex; align-items: center; justify-content: space-between;
    gap: 18px; flex-wrap: wrap; margin-bottom: 28px;
}
.page__head-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.page__title { color: var(--navy); font-size: clamp(1.6rem, 3vw, 2.2rem); margin: 0; }
.back-link { display: inline-block; color: var(--muted); text-decoration: none; font-weight: 700; margin-bottom: 14px; }
.back-link:hover { color: var(--coral); }

/* ── Estado vazio ───────────────────────────────────────────────────────── */
.empty-state {
    text-align: center; background: var(--white); border-radius: var(--radius-lg);
    padding: 56px 28px; box-shadow: var(--shadow-sm);
}
.empty-state__emoji { font-size: 3.4rem; }
.empty-state__title { font-family: var(--font-display); font-size: 1.4rem; color: var(--navy); margin: 12px 0 6px; }
.empty-state .btn { margin-top: 18px; }

/* ── Grade de famílias ──────────────────────────────────────────────────── */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 22px; }
.family-card {
    background: var(--white); border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm); overflow: hidden;
    transition: transform .18s ease, box-shadow .18s ease;
}
.family-card:hover { transform: translateY(-5px); box-shadow: var(--shadow); }
.family-card__main {
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    padding: 30px 18px 18px; text-decoration: none; text-align: center;
    background: linear-gradient(180deg, #fff7ea, #fff);
}
.family-card__icon { font-size: 2.6rem; }
.family-card__name { font-family: var(--font-display); font-size: 1.3rem; color: var(--navy); font-weight: 700; }
.family-card__meta { color: var(--muted); font-size: .9rem; }
.family-card__actions { display: flex; justify-content: space-between; gap: 8px; padding: 14px 16px; border-top: 1px solid rgba(31,42,82,.06); }
.family-card__actions form { margin: 0; }

/* ── Grade de personagens ───────────────────────────────────────────────── */
.char-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 22px; }
.char-card {
    background: var(--white); border-radius: var(--radius-lg); padding: 18px;
    box-shadow: var(--shadow-sm); text-align: center;
    transition: transform .18s ease, box-shadow .18s ease;
}
.char-card:hover { transform: translateY(-5px); box-shadow: var(--shadow); }
.char-card__avatar { display: flex; justify-content: center; }
.avatar { display: block; border-radius: 22px; max-width: 100%; height: auto; }
.char-card__name { font-family: var(--font-display); color: var(--navy); margin: 10px 0 2px; font-size: 1.2rem; }
.char-card__relation { color: var(--muted); font-size: .9rem; }
.char-card__traits { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin: 12px 0; }
.tag {
    background: var(--cream-200); color: var(--navy-700);
    border-radius: 999px; padding: 3px 11px; font-size: .8rem; font-weight: 700;
}
.char-card__actions { display: flex; justify-content: center; gap: 8px; margin-top: 6px; }
.char-card__actions form { margin: 0; }

/* ── CTA "criar história" na tela da família ────────────────────────────── */
.family-cta {
    margin-top: 30px; text-align: center;
    background: linear-gradient(135deg, #fff7ea, var(--cream-200));
    border-radius: var(--radius-lg); padding: 30px 24px; box-shadow: var(--shadow-sm);
}
.family-cta p { color: var(--muted); margin: 0 0 16px; }

/* ── Formulários ────────────────────────────────────────────────────────── */
.form-card { background: var(--white); border-radius: var(--radius-lg); padding: 28px; box-shadow: var(--shadow-sm); }
.field { display: block; margin-bottom: 18px; }
.field__label { display: block; font-weight: 700; color: var(--navy); margin-bottom: 7px; }
.field__input {
    width: 100%; border: 2px solid #e6ddca; border-radius: 12px;
    padding: 12px 14px; font-family: var(--font-body); font-size: 1rem; background: #fffdf8;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.field__input:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(232,163,61,.2); }
.field__hint { display: block; color: var(--muted); font-size: .86rem; margin-top: 6px; }
.form-actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 10px; flex-wrap: wrap; }

/* ── Criador de personagem ──────────────────────────────────────────────── */
.creator__intro { margin-top: -6px; margin-bottom: 22px; }
.creator__layout { display: grid; grid-template-columns: 320px 1fr; gap: 30px; align-items: start; }
.creator__preview { position: sticky; top: 88px; }
.preview-card {
    background: linear-gradient(180deg, #fff, #fff7ea);
    border-radius: var(--radius-lg); padding: 22px; box-shadow: var(--shadow);
    text-align: center; border: 6px solid #fff;
}
.preview-card__label { font-weight: 700; color: var(--muted); font-size: .85rem; text-transform: uppercase; letter-spacing: .5px; }
.preview-card__avatar { margin: 12px 0; }
.avatar--live { width: 100%; max-width: 240px; height: auto; margin: 0 auto; }
.preview-card__name { font-family: var(--font-display); font-size: 1.5rem; color: var(--navy); margin: 6px 0 0; }
.preview-card__relation { margin: 2px 0 0; }

.creator__controls { background: var(--white); border-radius: var(--radius-lg); padding: 26px; box-shadow: var(--shadow-sm); }
.control-section {
    font-size: 1.2rem; color: var(--navy); margin: 26px 0 14px;
    padding-bottom: 8px; border-bottom: 2px dashed #ece2cd;
}
.control-block { margin-bottom: 18px; }
.control-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.control-label { display: block; font-weight: 700; color: var(--navy); margin-bottom: 8px; font-size: .95rem; }

/* Swatches de cor */
.swatch-row { display: flex; gap: 10px; flex-wrap: wrap; }
.swatch {
    width: 38px; height: 38px; border-radius: 50%; cursor: pointer;
    border: 3px solid #fff; box-shadow: 0 0 0 1px rgba(31,42,82,.12);
    transition: transform .12s ease, box-shadow .12s ease;
}
.swatch:hover { transform: scale(1.1); }
.swatch.is-active { box-shadow: 0 0 0 3px var(--gold); transform: scale(1.12); }

/* Chips de opção */
.chip-row { display: flex; gap: 10px; flex-wrap: wrap; }
.chip-row--wrap { gap: 9px; }
.chip {
    border: 2px solid #e6ddca; background: #fffdf8; color: var(--navy-700);
    border-radius: 999px; padding: 9px 16px; cursor: pointer;
    font-family: var(--font-body); font-weight: 700; font-size: .92rem;
    transition: all .14s ease;
}
.chip:hover { border-color: var(--gold); }
.chip.is-active {
    background: linear-gradient(135deg, var(--gold), var(--coral));
    color: #fff; border-color: transparent;
    box-shadow: 0 6px 16px rgba(242,117,107,.35);
}

@media (max-width: 820px) {
    .creator__layout { grid-template-columns: 1fr; }
    .creator__preview { position: static; max-width: 320px; margin: 0 auto; }
    .control-grid { grid-template-columns: 1fr; }
}

/* ── Criação de história ────────────────────────────────────────────────── */
.story-form__layout { display: grid; grid-template-columns: 1fr 320px; gap: 30px; align-items: start; }
.story-form__main { background: var(--white); border-radius: var(--radius-lg); padding: 26px; box-shadow: var(--shadow-sm); }
.story-form__summary { position: sticky; top: 88px; }
.pick-row, .layers { display: flex; flex-direction: column; gap: 10px; }
.pick-row { flex-direction: row; flex-wrap: wrap; }
select.field__input { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%231F2A52' stroke-width='2' fill='none'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 16px center; }

.layer-row {
    display: flex; align-items: center; gap: 12px;
    background: #fffdf8; border: 2px solid #ece2cd; border-radius: 14px; padding: 14px 16px; cursor: pointer;
}
.layer-row input { width: 20px; height: 20px; accent-color: var(--gold); }
.layer-row__label { font-weight: 700; color: var(--navy); flex: 1; }
.layer-row__cost { font-weight: 700; color: var(--coral); }
.layer-row--disabled { opacity: .6; cursor: not-allowed; background: #f6f2e9; }
.badge-soon { background: var(--lav); color: #fff; border-radius: 999px; padding: 3px 11px; font-size: .76rem; font-weight: 700; }

.cost-card {
    background: linear-gradient(180deg, #fff, #fff7ea);
    border-radius: var(--radius-lg); padding: 24px; box-shadow: var(--shadow);
    text-align: center; border: 6px solid #fff;
}
.cost-card__label { font-weight: 700; color: var(--muted); font-size: .85rem; text-transform: uppercase; letter-spacing: .5px; }
.cost-card__total { font-family: var(--font-display); font-size: 3rem; font-weight: 700; color: var(--navy); margin: 6px 0; }
.cost-card__free { font-family: var(--font-display); font-size: 1.5rem; color: var(--success); margin: 14px 0; }
.cost-card__balance { color: var(--muted); margin: 4px 0 14px; }
.cost-card__warn { color: var(--danger); font-size: .9rem; margin-bottom: 12px; }
.cost-card__warn a { font-weight: 700; }
.cost-card__btn { width: 100%; }
.cost-card__btn:disabled { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; }

/* ── Tela "gerando história" (assíncrona) ───────────────────────────────── */
.generating { text-align: center; padding: 70px 20px; }
.generating__spinner { font-size: 2rem; color: var(--gold); display: flex; gap: 14px; justify-content: center; margin-bottom: 18px; }
.generating__spinner span { animation: twinkle 1.4s ease-in-out infinite; }
.generating__spinner span:nth-child(2) { animation-delay: .25s; color: var(--coral); }
.generating__spinner span:nth-child(3) { animation-delay: .5s; color: var(--teal); }
.generating__title { color: var(--navy); font-size: 1.8rem; margin: 0 0 10px; }
.progress { max-width: 460px; margin: 28px auto 0; }
.progress__bar { height: 14px; border-radius: 999px; background: var(--cream-200); overflow: hidden; box-shadow: inset 0 1px 3px rgba(31,42,82,.12); }
.progress__fill {
    display: block; height: 100%; border-radius: 999px;
    background: linear-gradient(90deg, var(--gold), var(--coral));
    transition: width .6s ease;
}
.progress__meta { display: flex; justify-content: space-between; margin-top: 10px; font-weight: 700; }
.progress__step { color: var(--navy); }
.progress__pct { color: var(--coral); }

/* Grid de seções do painel */
.dashboard__grid { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
.dashboard__grid .dashboard__section {
    background: var(--white); border-radius: var(--radius-lg); padding: 26px; box-shadow: var(--shadow-sm);
}
@media (max-width: 680px) { .dashboard__grid { grid-template-columns: 1fr; } }

/* ── Leitor de história (livro com flip de páginas) ─────────────────────── */
.story-reader { padding-top: 24px; }
.reader-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.reader-bar .back-link { margin-bottom: 0; }

.book-stage {
    display: flex; align-items: center; justify-content: center; gap: 12px;
    perspective: 2200px;
}
.leaf {
    position: relative;
    flex: 1; max-width: 680px; min-height: 560px;
    background: linear-gradient(180deg, #fffdf8, #fff7ea);
    border-radius: 6px 16px 16px 6px;
    box-shadow: var(--shadow-lg), inset 8px 0 18px -10px rgba(31,42,82,.25);
    border-left: 6px solid #efe2c8;
    padding: 38px 40px;
    transform-origin: left center;
    transition: transform .22s ease-in;
    transform-style: preserve-3d;
    backface-visibility: hidden;
}
.book-page { animation: pageIn .3s ease; }
@keyframes pageIn { from { opacity: 0; } to { opacity: 1; } }

.book-page--cover, .book-page--end { text-align: center; display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 480px; }
.book-page__cover-img { width: 100%; max-width: 360px; border-radius: 16px; box-shadow: var(--shadow); margin-bottom: 20px; }
.book-page__title { font-size: 2.1rem; color: var(--navy); margin: 0 0 6px; }
.book-page__by { color: var(--muted); font-style: italic; margin: 0; }

.book-page__chapter { display: block; font-size: .76rem; letter-spacing: 1.5px; text-transform: uppercase; color: var(--gold); font-weight: 700; }
.book-page__heading { color: var(--navy); font-size: 1.6rem; margin: 4px 0 14px; }
.book-page__img { width: 100%; max-width: 420px; display: block; margin: 0 auto 18px; border-radius: 14px; box-shadow: var(--shadow-sm); }
.book-page__text { font-size: 1.12rem; line-height: 1.9; }
.book-page--end .book-page__end-mark { font-size: 2.4rem; color: var(--gold); }
.book-page--end .btn { margin-top: 18px; }

.book-arrow {
    flex: 0 0 auto; width: 52px; height: 52px; border-radius: 50%;
    border: 0; background: var(--white); color: var(--navy);
    font-size: 1.8rem; line-height: 1; cursor: pointer; box-shadow: var(--shadow-sm);
    transition: transform .12s ease, background .15s ease;
}
.book-arrow:hover:not(:disabled) { transform: scale(1.1); background: var(--cream); }
.book-arrow:disabled { opacity: .3; cursor: default; }
.book-counter { text-align: center; color: var(--muted); margin-top: 18px; font-weight: 700; }

@media (max-width: 720px) {
    .leaf { padding: 26px 22px; min-height: 460px; }
    .book-arrow { width: 42px; height: 42px; font-size: 1.5rem; }
    .book-stage { gap: 6px; }
}

/* ── Cards de história (lista) ──────────────────────────────────────────── */
.story-card {
    display: block; background: var(--white); border-radius: var(--radius-lg);
    overflow: hidden; box-shadow: var(--shadow-sm); text-decoration: none;
    transition: transform .18s ease, box-shadow .18s ease;
}
.story-card:hover { transform: translateY(-5px); box-shadow: var(--shadow); }
.story-card__cover { position: relative; aspect-ratio: 1 / 1; background: var(--cream-200); display: grid; place-items: center; }
.story-card__cover img { width: 100%; height: 100%; object-fit: cover; }
.story-card__placeholder { font-size: 3rem; }
.story-card__badge--fail { position: absolute; top: 10px; right: 10px; width: 26px; height: 26px; border-radius: 50%; background: var(--danger); color: #fff; display: grid; place-items: center; font-weight: 700; }
.story-card__title { display: block; padding: 14px 16px; font-family: var(--font-display); font-weight: 700; color: var(--navy); }

/* ── Créditos ───────────────────────────────────────────────────────────── */
.balance-chip { background: var(--cream-200); border-radius: 999px; padding: 8px 18px; font-weight: 700; color: var(--navy); }
.balance-chip strong { color: var(--coral); }
.plan-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 22px; }
.plan-card {
    position: relative; background: var(--white); border-radius: var(--radius-lg);
    padding: 28px; box-shadow: var(--shadow-sm); text-align: center; border: 2px solid transparent;
}
.plan-card--featured { border-color: var(--gold); box-shadow: var(--shadow); }
.plan-card__tag { position: absolute; top: -12px; left: 50%; transform: translateX(-50%); background: linear-gradient(135deg, var(--gold), var(--coral)); color: #fff; border-radius: 999px; padding: 4px 14px; font-size: .78rem; font-weight: 700; }
.plan-card__name { color: var(--navy); margin: 6px 0; }
.plan-card__price { font-family: var(--font-display); font-size: 2.2rem; color: var(--navy); font-weight: 700; }
.plan-card__price small { font-size: 1rem; color: var(--muted); font-weight: 400; }
.plan-card__credits { color: var(--coral); font-weight: 700; margin: 8px 0 18px; }
.pack-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 22px; }
.pack-card { background: var(--white); border-radius: var(--radius-lg); padding: 24px; box-shadow: var(--shadow-sm); text-align: center; }
.pack-card__name { color: var(--navy); margin: 0 0 4px; }
.pack-card__credits { color: var(--coral); font-weight: 700; margin: 0 0 8px; }
.pack-card__price { font-family: var(--font-display); font-size: 1.7rem; color: var(--navy); font-weight: 700; margin-bottom: 16px; }

@media (max-width: 820px) {
    .story-form__layout { grid-template-columns: 1fr; }
    .story-form__summary { position: static; }
}

/* ── Página de login ────────────────────────────────────────────────────── */
.login-card {
    max-width: 440px; margin: 40px auto; text-align: center;
    background: linear-gradient(180deg, #fff, #fff7ea);
    border-radius: var(--radius-lg); padding: 40px 32px; box-shadow: var(--shadow);
    border: 6px solid #fff;
}
.login-card__icon { width: 72px; height: 72px; border-radius: 18px; box-shadow: var(--shadow-sm); }
.login-card__title { color: var(--navy); font-size: 1.7rem; margin: 16px 0 6px; }
.login-card__btn { display: flex; justify-content: center; margin: 26px 0; min-height: 44px; }
.login-card__legal { font-size: .82rem; color: var(--muted); margin-top: 18px; }
.login-card__legal a { color: var(--coral); font-weight: 700; text-decoration: none; }

/* ── Páginas legais (Privacidade / Termos) ──────────────────────────────── */
.legal { line-height: 1.8; }
.legal h1 { color: var(--navy); font-size: 2rem; margin-bottom: 4px; }
.legal__meta { color: var(--muted); font-size: .9rem; margin-top: 0; margin-bottom: 24px; }
.legal h2 { color: var(--navy); font-size: 1.25rem; margin-top: 28px; }
.legal ul { padding-left: 22px; }
.legal li { margin-bottom: 8px; }
.legal a { color: var(--coral); font-weight: 700; }

/* ── Página de erro ─────────────────────────────────────────────────────── */
.error-page { text-align: center; padding: 90px 20px; }
.error-page h1 { font-size: 5rem; color: var(--navy); margin: 0; }

/* ── Responsivo ─────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
    .hero__inner { grid-template-columns: 1fr; text-align: center; }
    .hero__actions { justify-content: center; }
    .hero__subtitle { margin-left: auto; margin-right: auto; }
    .hero__art { order: -1; margin-bottom: 8px; }
    .steps, .features__grid { grid-template-columns: 1fr; }
    .step__num { margin-top: -56px; }
    .dashboard__cards { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
    .site-header__inner { padding-left: 14px; padding-right: 14px; gap: 8px; }
    .site-header__brand { gap: 8px; min-width: 0; }
    .site-header__wordmark { font-size: 1.15rem; }
    .site-header__icon { height: 34px; width: 34px; }
    .site-header__nav { gap: 8px; min-width: 0; }
    .nav-user { display: none; }
    /* Botão de login enxuto para não estourar a largura no mobile */
    .site-header__nav .btn--primary { padding: 9px 14px; font-size: .92rem; }
    .lang-switch__btn { padding: 7px 9px; }
    .site-footer__inner { flex-direction: column; text-align: center; align-items: center; }
}
@media (max-width: 380px) {
    .site-header__wordmark { display: none; } /* só o ícone, libera espaço */
}
