/* ============================================================
   Clube Mente Brilhante - PWA (estetica "Aconchego")
   Tokens travados a partir dos mockups aprovados.
   ============================================================ */
:root {
  /* superficies quentes (creme/papel) */
  --bg: #FBF3E3;
  --bg-2: #F6E9D2;
  --cream: #FFFCF5;
  --cream-2: #FBF1DC;
  --honey-surface: #FBEFD3;

  /* tinta (marrom quente) */
  --ink: #4A3826;
  --ink-soft: #8A745A;
  --title: #6B4A24;

  /* terracota (acao primaria, marca) */
  --accent: #B45E34;
  --accent-deep: #8F4A28;
  --accent-soft: #F2DBC6;

  /* mel / ambar (destaque, anel, medalha) */
  --gold: #E0AC4B;
  --gold-deep: #C4912F;
  --honey: #EBD2A0;

  /* sage (sucesso, progresso) */
  --green: #82A062;
  --green-deep: #5F7E45;
  --green-soft: #DFE7CB;

  /* estrutura */
  --line: #ECDCC0;
  --line-strong: #E0CBA6;
  --locked: #C9B79B;

  /* focos (acentos suaves de orientacao) */
  --foco-atencao: #C0653A;
  --foco-memoria: #7FA06A;
  --foco-raciocinio: #D2A23F;
  --foco-coordenacao: #6E93A0;
  --foco-autocontrole: #C57E8C;

  /* raios */
  --r-sm: 12px;
  --r-md: 18px;
  --r-lg: 26px;
  --r-xl: 34px;
  --r-pill: 999px;

  /* sombras quentes e macias */
  --sh-sm: 0 2px 8px rgba(120, 80, 40, .08);
  --sh-md: 0 8px 22px rgba(120, 80, 40, .10);
  --sh-lg: 0 18px 40px rgba(120, 80, 40, .14);
  --sh-press: 0 2px 6px rgba(120, 80, 40, .14);

  /* fontes */
  --serif: 'Fraunces', Georgia, 'Times New Roman', serif;
  --sans: 'Quicksand', 'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif;

  /* layout */
  --frame-max: 460px;
  --tabbar-h: 76px;
  --pad: 18px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--sans);
  font-weight: 600;
  color: var(--ink);
  background: var(--bg-2);
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1, h2, h3 { font-family: var(--serif); color: var(--title); margin: 0; line-height: 1.08; }
h1 { font-weight: 600; font-variation-settings: 'opsz' 120, 'SOFT' 60, 'wght' 600; letter-spacing: .2px; }
h2 { font-weight: 600; font-variation-settings: 'opsz' 60, 'SOFT' 50, 'wght' 600; }
h3 { font-weight: 600; font-variation-settings: 'opsz' 30, 'SOFT' 40, 'wght' 600; }
p { margin: 0; line-height: 1.5; }
button { font-family: var(--sans); cursor: pointer; }
img { display: block; max-width: 100%; }
a { color: var(--accent-deep); }

.skip-link {
  position: absolute; left: -999px; top: 8px; z-index: 100;
  background: var(--accent); color: #fff; padding: 10px 14px; border-radius: var(--r-sm);
}
.skip-link:focus { left: 8px; }

:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 8px; }

/* ---------- frame / app shell ---------- */
#app {
  min-height: 100dvh;
  display: flex; justify-content: center; align-items: stretch;
  background:
    radial-gradient(1100px 520px at 50% -8%, #FFF7E6 0%, rgba(255,247,230,0) 60%),
    var(--bg-2);
}
.app-frame {
  width: 100%; max-width: var(--frame-max);
  background: var(--bg);
  min-height: 100dvh;
  position: relative;
  box-shadow: var(--sh-lg);
  overflow: hidden;
}
#root { display: block; min-height: 100dvh; outline: none; }

.screen {
  padding: calc(env(safe-area-inset-top, 0px) + 18px) var(--pad)
           calc(var(--tabbar-h) + var(--safe-b) + 24px);
  animation: fade .32s ease both;
}
.screen.no-tabs { padding-bottom: calc(var(--safe-b) + 28px); }
@keyframes fade { from { opacity: 0; transform: scale(.992); } to { opacity: 1; transform: none; } }

/* reveal: conteudo sobe suave ao entrar na tela (via IntersectionObserver) */
.reveal.armed { opacity: 0; transform: translateY(15px); will-change: opacity, transform; }
.reveal.armed.in { opacity: 1; transform: none; transition: opacity .6s ease, transform .6s cubic-bezier(.2,.75,.2,1); }

@media (prefers-reduced-motion: reduce) {
  .screen, .reveal, .medal .disc { animation: none !important; }
  .reveal.armed { opacity: 1 !important; transform: none !important; }
  .art-vid, .welcome-vid { display: none !important; }
  * { transition: none !important; }
}

/* ---------- home: banner de boas-vindas (video do ursinho) ---------- */
.welcome { position: relative; height: 152px; border-radius: var(--r-xl); overflow: hidden; margin-bottom: 18px;
  box-shadow: var(--sh-md); border: 1px solid var(--line); background-size: cover; background-position: center; }
.welcome-vid { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.welcome::after { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(74,56,38,.6), rgba(74,56,38,.08) 62%); }
.welcome-text { position: absolute; left: 18px; bottom: 16px; z-index: 2; color: #fff; max-width: 70%; }
.welcome-text .wk-greet { font-size: .82rem; font-weight: 800; opacity: .92; }
.welcome-text h2 { color: #fff; font-size: 1.5rem; margin-top: 2px; text-shadow: 0 1px 10px rgba(74,56,38,.45); }
.welcome-perfil { position: absolute; right: 12px; top: 12px; z-index: 3; width: 40px; height: 40px; border-radius: var(--r-pill);
  background: rgba(255,252,245,.88); display: grid; place-items: center; color: var(--accent-deep); box-shadow: var(--sh-sm); }
.welcome-perfil svg { width: 22px; height: 22px; }

/* ---------- topo ---------- */
.topbar { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.topbar .greet { font-size: .92rem; color: var(--ink-soft); font-weight: 700; }
.topbar .spacer { flex: 1; }
.avatar {
  width: 46px; height: 46px; border-radius: var(--r-pill); flex: none;
  background: var(--honey); display: grid; place-items: center; color: var(--accent-deep);
  box-shadow: var(--sh-sm); border: 2px solid #fff;
}
.avatar svg { width: 30px; height: 30px; }

.page-title { font-size: 2rem; margin: 2px 0 16px; }
.page-title.lg { font-size: 2.35rem; }
.eyebrow { display: inline-flex; align-items: center; gap: 9px; font-size: .82rem; letter-spacing: .14em; text-transform: uppercase;
  color: var(--accent-deep); font-weight: 800; margin-bottom: 4px; }
.eyebrow::before { content: ''; width: 16px; height: 2px; border-radius: 2px; background: var(--accent); opacity: .55; }

/* ---------- botoes ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  min-height: 52px; padding: 0 22px; border: none; border-radius: var(--r-pill);
  font-size: 1.02rem; font-weight: 800; color: #fff; background: var(--accent);
  box-shadow: var(--sh-md); transition: transform .12s ease, box-shadow .12s ease, background .15s;
  width: 100%; text-decoration: none;
}
.btn:hover { background: var(--accent-deep); }
.btn:active { transform: translateY(1px) scale(.995); box-shadow: var(--sh-press); }
.btn svg { width: 20px; height: 20px; }
.btn.ghost { background: var(--cream); color: var(--accent-deep); box-shadow: inset 0 0 0 2px var(--line-strong); }
.btn.ghost:hover { background: var(--cream-2); }
.btn.soft { background: var(--accent-soft); color: var(--accent-deep); box-shadow: none; }
.btn.green { background: var(--green); }
.btn.green:hover { background: var(--green-deep); }
.btn.sm { min-height: 42px; font-size: .92rem; padding: 0 16px; }
.btn.auto { width: auto; }
.btn[disabled] { opacity: .55; pointer-events: none; }

/* ---------- cards ---------- */
.card {
  background: var(--cream); border-radius: var(--r-lg); padding: 18px;
  box-shadow: var(--sh-md); border: 1px solid var(--line);
}
.card.flat { box-shadow: var(--sh-sm); }

/* ---------- pilulas / chips ---------- */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 13px; border-radius: var(--r-pill);
  background: var(--cream); color: var(--ink); border: 1.5px solid var(--line-strong);
  font-size: .82rem; font-weight: 800; white-space: nowrap;
}
.pill svg { width: 15px; height: 15px; }
.pill.meta { background: var(--bg-2); border-color: transparent; color: var(--ink-soft); }
.stars { color: var(--gold-deep); letter-spacing: 1px; font-size: .9rem; }
.stars .off { color: var(--line-strong); }

.filter-row { display: flex; gap: 9px; overflow-x: auto; padding: 2px 2px 10px; margin: 0 -2px;
  scrollbar-width: none; }
.filter-row::-webkit-scrollbar { display: none; }
.chip {
  flex: none; padding: 9px 16px; border-radius: var(--r-pill); border: 1.5px solid var(--line-strong);
  background: var(--cream); color: var(--ink); font-weight: 800; font-size: .9rem;
  transition: background .18s ease, color .18s ease, border-color .18s ease, transform .12s ease; min-height: 44px;
}
.chip:active { transform: scale(.95); }
.chip[aria-pressed="true"] { background: var(--accent); color: #fff; border-color: var(--accent); }
.chip.age[aria-pressed="true"] { background: var(--gold); border-color: var(--gold); color: #4a3414; }

/* ---------- progresso ---------- */
.bar { height: 12px; border-radius: var(--r-pill); background: var(--bg-2); overflow: hidden; box-shadow: inset 0 1px 2px rgba(120,80,40,.1); }
.bar > i { display: block; height: 100%; border-radius: var(--r-pill); background: linear-gradient(90deg, var(--accent), var(--gold)); transition: width .85s cubic-bezier(.2,.75,.2,1); }
#ringProg { transition: stroke-dashoffset 1s cubic-bezier(.2,.75,.2,1); }
.bar.green > i { background: linear-gradient(90deg, var(--green), #9fbb7e); }

/* ---------- home: ficha do dia ---------- */
.hero {
  position: relative; border-radius: var(--r-xl); overflow: hidden; color: #fff;
  background: linear-gradient(148deg, #C66B3E 0%, var(--accent) 46%, var(--gold-deep) 122%);
  box-shadow: var(--sh-lg); min-height: 226px;
  display: flex; align-items: stretch; isolation: isolate;
}
/* profundidade: brilho quente no topo e vinheta sutil embaixo */
.hero::before {
  content: ''; position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(125% 92% at 14% -8%, rgba(255,237,201,.38), rgba(255,237,201,0) 56%),
    radial-gradient(120% 80% at 100% 120%, rgba(74,40,18,.28), rgba(74,40,18,0) 60%);
}
.hero-spark { position: absolute; right: 15px; top: 13px; z-index: 2; color: rgba(255,255,255,.55); }
.hero-spark svg { width: 20px; height: 20px; }
/* com ilustracao: a ficha colorida emoldurada como papel impresso */
.hero .hero-art {
  width: 44%; flex-shrink: 0; align-self: stretch; position: relative; z-index: 1;
  display: flex; align-items: center; justify-content: center; padding: 16px 6px 16px 16px;
}
.hero .hero-art .paper {
  background: #fff; padding: 7px; border-radius: 11px; max-height: 100%;
  box-shadow: 0 12px 24px rgba(70,38,16,.34), inset 0 1px 0 rgba(255,255,255,.7);
  transform: rotate(-2.6deg); transition: transform .4s cubic-bezier(.2,.8,.2,1);
}
.hero:hover .hero-art .paper { transform: rotate(-1deg) translateY(-2px); }
.hero .hero-art .paper img {
  display: block; width: auto; height: auto; max-width: 100%; max-height: 176px;
  object-fit: contain; border-radius: 6px;
}
.hero .hero-body {
  flex: 1; padding: 20px 18px; display: flex; flex-direction: column;
  justify-content: center; min-width: 0; position: relative; z-index: 1;
}
/* sem ilustracao: fallback com motif */
.hero.no-art { padding: 20px; flex-direction: column; justify-content: space-between; }
.hero.no-art .motif { position: absolute; right: -8px; top: -6px; width: 150px; height: 150px; opacity: .18; color: #fff; }
.hero .badge {
  align-self: flex-start; display: inline-flex; align-items: center; gap: 5px; white-space: nowrap;
  background: rgba(255,255,255,.94); color: var(--accent-deep);
  font-weight: 800; font-size: .7rem; padding: 6px 12px; border-radius: var(--r-pill);
  letter-spacing: .04em; text-transform: uppercase; margin-bottom: 10px;
  box-shadow: 0 3px 9px rgba(70,38,16,.18);
}
.hero .badge svg { width: 13px; height: 13px; color: var(--gold-deep); }
.hero h2 { color: #fff; font-size: 1.55rem; margin: 0 0 12px; line-height: 1.12; text-shadow: 0 1px 8px rgba(70,38,16,.28); }
.hero .meta { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.hero .meta .pill { background: rgba(255,255,255,.2); border-color: rgba(255,255,255,.34); color: #fff; font-size: .75rem; padding: 5px 10px; backdrop-filter: blur(2px); }
.hero .btn { background: #fff; color: var(--accent-deep); box-shadow: var(--sh-md); font-size: .92rem; min-height: 46px; align-self: flex-start; padding-inline: 20px; }
.hero .btn:hover { background: #fff4e4; transform: translateY(-1px); }

/* ---------- home: focos chips ---------- */
.foco-row { display: flex; gap: 10px; overflow-x: auto; padding: 4px 2px 6px; margin: 0 -2px; scrollbar-width: none; }
.foco-row::-webkit-scrollbar { display: none; }
.foco-tile {
  flex: none; width: 84px; text-align: center; background: transparent; border: none; padding: 4px 0;
}
.foco-tile .ring { position: relative; width: 60px; height: 60px; margin: 0 auto 7px; display: grid; place-items: center; }
.foco-tile .ring .mini-ring { position: absolute; inset: 0; width: 60px; height: 60px; }
.foco-tile .ring .ring-ic { display: grid; place-items: center; }
.foco-tile .ring .ring-ic svg { width: 25px; height: 25px; }

/* ---------- icones coloridos ilustrados (webp transparente) ---------- */
.iart { display: inline-block; object-fit: contain; vertical-align: middle; }
.foco-tile .ring .ring-ic .iart { width: 35px; height: 35px; }
.foco-line .ic .iart { width: 30px; height: 30px; }
.prox-card > .iart { width: 38px; height: 38px; flex: none; }
.cert .seal .iart { width: 100%; height: 100%; }
.tabbar a .ti .iart { width: 28px; height: 28px; transition: filter .2s ease, transform .2s ease; }
.tabbar a:not([aria-current="page"]) .ti .iart { filter: saturate(.66) opacity(.78); }
.foco-tile .nm { display: block; font-size: .76rem; font-weight: 800; color: var(--ink); line-height: 1.1; }
.foco-tile .ct { display: block; margin-top: 2px; font-size: .68rem; color: var(--ink-soft); font-weight: 700; }

/* ---------- grade biblioteca ---------- */
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.tile {
  background: var(--cream); border-radius: var(--r-lg); overflow: hidden; text-align: left;
  border: 1px solid var(--line); box-shadow: var(--sh-sm); padding: 0;
  display: flex; flex-direction: column; transition: transform .14s ease, box-shadow .14s ease;
  position: relative;
}
.tile:hover { transform: translateY(-3px); box-shadow: var(--sh-md); }
.tile:active { transform: scale(.984); transition: transform .1s ease; }
.thumb {
  aspect-ratio: 4 / 3; position: relative; overflow: hidden;
  background: var(--foco, var(--honey));
}
/* com ilustracao real */
.thumb img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  opacity: 0; transition: opacity .4s ease;
}
.thumb img.in { opacity: 1; }
/* fallback (sem ilustracao): icone centrado */
.thumb .motif {
  position: absolute; inset: 0; margin: auto;
  width: 50%; height: 50%; color: #fff; opacity: .88;
}
.thumb .code {
  position: absolute; left: 8px; bottom: 8px; font-size: .66rem; font-weight: 800;
  color: #fff; background: rgba(74,56,38,.42); padding: 3px 8px; border-radius: var(--r-pill);
  letter-spacing: .03em; backdrop-filter: blur(2px);
}
.thumb .done {
  position: absolute; right: 8px; top: 8px; width: 26px; height: 26px; border-radius: var(--r-pill);
  background: var(--green); color: #fff; display: grid; place-items: center; box-shadow: var(--sh-sm);
}
.thumb .done svg { width: 16px; height: 16px; }
.thumb .badge-prem {
  position: absolute; right: 8px; bottom: 8px; background: rgba(255,255,255,.92); color: var(--gold-deep);
  border-radius: var(--r-pill); width: 24px; height: 24px; display: grid; place-items: center;
}
.thumb .badge-prem svg { width: 15px; height: 15px; }
/* destaque das versoes premium (coloridas) */
.tile--prem { box-shadow: 0 0 0 2px var(--gold), var(--sh-md); border-color: var(--honey); }
.tile--prem:hover { box-shadow: 0 0 0 2px var(--gold), var(--sh-lg); }
.thumb .prem-thumb { object-position: top center; background: #fff; }
.prem-tag {
  position: absolute; left: 8px; top: 8px; display: inline-flex; align-items: center; gap: 4px;
  background: linear-gradient(135deg, #F6D788, var(--gold)); color: #5a3d0e;
  font-weight: 800; font-size: .64rem; padding: 3px 9px 3px 7px; border-radius: var(--r-pill);
  box-shadow: var(--sh-sm); letter-spacing: .02em;
}
.prem-tag svg { width: 12px; height: 12px; }
.chip.prem { color: var(--gold-deep); border-color: var(--honey); }
.chip.prem[aria-pressed="true"] { background: var(--gold); border-color: var(--gold); color: #5a3d0e; }
.tile .info { padding: 11px 12px 13px; display: flex; flex-direction: column; gap: 5px; flex: 1; }
.tile .info h3 { font-size: 1.02rem; }
.tile .info .sub { font-size: .74rem; color: var(--ink-soft); font-weight: 700; }
.tile .info .stars { font-size: .8rem; }

.section-head { display: flex; align-items: baseline; justify-content: space-between; margin: 22px 0 12px; }
.section-head h2 { font-size: 1.5rem; }
.section-head .link { background: none; border: none; color: var(--accent-deep); font-weight: 800; font-size: .9rem; text-decoration: none; }

/* ---------- foco lista (painel) ---------- */
.foco-line { display: flex; align-items: center; gap: 12px; padding: 12px 4px; }
.foco-line + .foco-line { border-top: 1px solid var(--line); }
.foco-line .ic { width: 38px; height: 38px; border-radius: var(--r-pill); display: grid; place-items: center;
  background: var(--bg-2); flex: none; }
.foco-line .ic svg { width: 21px; height: 21px; }
.foco-line .body { flex: 1; min-width: 0; }
.foco-line .body .nm { font-weight: 800; font-size: .98rem; margin-bottom: 6px; }
.foco-line .ct { font-weight: 800; color: var(--ink-soft); font-size: .86rem; flex: none; }

/* ---------- anel de progresso ---------- */
.ring-card {
  display: flex; align-items: stretch; overflow: hidden; padding: 0;
  background: linear-gradient(135deg, var(--honey-surface) 0%, #FDF5E4 70%);
  border: 1px solid var(--line);
}
.ring-card .ring-char { width: 39%; min-width: 116px; flex: none; align-self: stretch; background: var(--honey); }
.ring-card .ring-char img { width: 100%; height: 100%; object-fit: cover; object-position: center; display: block; }
.ring-card .ring-inner {
  flex: 1; min-width: 0; display: flex; flex-direction: column;
  align-items: flex-start; justify-content: center; gap: 6px; padding: 16px 16px 16px 15px;
}
.ring-wrap { position: relative; width: 86px; height: 86px; flex: none; }
.ring-wrap svg { transform: rotate(-90deg); width: 86px; height: 86px; }
.ring-wrap .pct { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; }
.ring-wrap .pct b { font-family: var(--serif); font-size: 1.45rem; color: var(--title); font-variation-settings: 'opsz' 40,'SOFT' 40; }
.ring-card .cap h3 { font-size: 1.15rem; margin-bottom: 2px; }
.ring-card .cap p { font-size: .82rem; color: var(--ink-soft); line-height: 1.35; }

/* ---------- medalhas ---------- */
.medal-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.medal { text-align: center; }
.medal .disc {
  width: 70px; height: 70px; margin: 0 auto 7px; border-radius: var(--r-pill); display: grid; place-items: center;
  background: radial-gradient(circle at 38% 30%, #FFFDF7, #FBEFD3 80%);
  box-shadow: var(--sh-md), inset 0 0 0 2.5px rgba(224,172,75,.9); color: #6a4a12; position: relative;
}
.medal .disc svg { width: 34px; height: 34px; }
.medal .disc .iart { width: 47px; height: 47px; filter: drop-shadow(0 1px 1px rgba(80,45,20,.16)); }
.medal.locked .disc { background: var(--bg-2); color: var(--locked); box-shadow: var(--sh-sm); }
.medal .lbl { font-size: .74rem; font-weight: 800; color: var(--ink); line-height: 1.15; }
.medal.locked .lbl { color: var(--ink-soft); }
/* brilho sutil nas medalhas conquistadas */
.medal:not(.locked) .disc { animation: medalGlow 3.4s ease-in-out infinite; }
.medal:not(.locked):nth-child(2) .disc { animation-delay: .5s; }
.medal:not(.locked):nth-child(3) .disc { animation-delay: 1s; }
.medal:not(.locked):nth-child(5) .disc { animation-delay: 1.4s; }
@keyframes medalGlow {
  0%, 100% { box-shadow: var(--sh-md), inset 0 0 0 2.5px rgba(224,172,75,.9); }
  50% { box-shadow: 0 0 0 4px rgba(224,172,75,.18), 0 7px 17px rgba(224,172,75,.4), inset 0 0 0 2.5px rgba(224,172,75,1); }
}
/* proxima medalha */
.prox-card { display: flex; align-items: center; gap: 12px; background: var(--honey-surface); border: 1px solid var(--line);
  border-radius: var(--r-md); padding: 12px 14px; margin-top: 14px; }
.prox-card > svg { width: 26px; height: 26px; color: var(--gold-deep); flex: none; }
.prox-card b { display: block; font-size: .92rem; color: var(--title); }
.prox-card span { font-size: .8rem; color: var(--ink-soft); font-weight: 700; }
.streak-chip { display: inline-flex; align-items: center; gap: 8px; background: var(--accent-soft); color: var(--accent-deep);
  font-weight: 800; padding: 9px 16px; border-radius: var(--r-pill); }
.streak-chip svg { width: 18px; height: 18px; }

/* ---------- ficha detalhe ---------- */
.ficha-hero { border-radius: var(--r-xl); overflow: hidden; box-shadow: var(--sh-md); margin-bottom: 18px;
  background: var(--foco, var(--honey)); aspect-ratio: 1 / 1; display: grid; place-items: center; position: relative; }
.ficha-hero .motif { width: 44%; height: 44%; color: #fff; opacity: .95; }
.ficha-hero img { width: 100%; height: 100%; object-fit: cover; }
.ficha-hero .tag { position: absolute; left: 12px; top: 12px; }
.meta-row { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0 16px; }
.hair { height: 1px; background: var(--line); margin: 2px 0 16px; }
.back-btn { display: inline-flex; align-items: center; gap: 6px; background: var(--cream); border: 1px solid var(--line);
  border-radius: var(--r-pill); padding: 9px 15px 9px 11px; font-weight: 800; color: var(--ink); margin-bottom: 14px; box-shadow: var(--sh-sm); }
.back-btn svg { width: 18px; height: 18px; }
.action-stack { display: flex; flex-direction: column; gap: 11px; margin-top: 6px; }
.note { background: var(--honey-surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 14px 16px;
  display: flex; gap: 11px; align-items: flex-start; margin-top: 18px; }
.note svg { width: 22px; height: 22px; color: var(--accent); flex: none; margin-top: 2px; }
.note p { font-size: .9rem; }
.note b { color: var(--title); }

/* preview real da ficha (1a pagina do PDF) */
.ficha-preview { display: block; position: relative; width: 100%; max-width: 360px; aspect-ratio: 1 / 1.414;
  margin: 0 auto; border-radius: var(--r-lg); overflow: hidden; background: #fff;
  box-shadow: var(--sh-md); border: 1px solid var(--line); transition: transform .15s ease, box-shadow .15s ease; }
.ficha-preview:hover { transform: translateY(-2px); box-shadow: var(--sh-lg); }
.ficha-preview:active { transform: scale(.99); }
.preview-img { width: 100%; height: 100%; object-fit: contain; background: #fff; display: block; }
.preview-img.is-illus { object-fit: cover; }
.ficha-preview .tag { position: absolute; left: 10px; top: 10px; }
.zoom-hint { position: absolute; right: 10px; bottom: 10px; display: inline-flex; align-items: center; gap: 5px;
  background: rgba(74,56,38,.72); color: #fff; font-size: .72rem; font-weight: 800; padding: 5px 10px; border-radius: var(--r-pill); backdrop-filter: blur(2px); }
.zoom-hint svg { width: 14px; height: 14px; }

/* premium colorida (blur-up) */
.prem-img { border-radius: var(--r-md); overflow: hidden; border: 1px solid var(--line); box-shadow: var(--sh-sm); background: var(--bg-2); }
.prem-img img { width: 100%; height: auto; opacity: 0; transition: opacity .5s ease; }
.prem-img img.in { opacity: 1; }

/* ---------- login ---------- */
.login { display: flex; flex-direction: column; min-height: 100dvh; background: var(--bg); }
.login .art {
  position: relative; width: 100%; height: 40dvh; min-height: 220px; max-height: 330px;
  flex-shrink: 0; overflow: hidden; background: var(--honey-surface);
}
/* telas curtas (celular com teclado): encolhe a arte para o botao Entrar nunca sair da tela */
@media (max-height: 720px) {
  .login .art { height: 32dvh; min-height: 184px; }
  .brand .mark { width: 44px; height: 44px; margin-bottom: 4px; }
  .brand h1 { font-size: 1.9rem; }
  .brand .sub { margin-top: 5px; font-size: .9rem; }
  .field-label { margin-top: 8px; }
  .field { margin: 8px 0 8px; }
  .field input { min-height: 50px; }
}
.login .art img { position: relative; z-index: 1; width: 100%; height: 100%; object-fit: cover; object-position: center 24%; display: block; }
.login .art .art-vid { position: absolute; inset: 0; z-index: 2; width: 100%; height: 100%; object-fit: cover; object-position: center 24%; }
.login .art::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: -1px; height: 104px; z-index: 3;
  background: linear-gradient(to bottom, rgba(251,243,227,0), var(--bg)); pointer-events: none;
}
.login .art-fallback { position: absolute; inset: 0; z-index: 0; display: grid; place-items: center; color: var(--accent); }
.login .art-fallback svg { width: min(46%, 140px); height: auto; }
.login .form-area { flex: 1; padding: 2px 26px calc(var(--safe-b) + 22px); display: flex; flex-direction: column; }
.brand { text-align: center; margin: 0 0 6px; }
.brand .mark { width: 56px; height: 56px; margin: 0 auto 8px; color: var(--accent); }
.brand h1 { font-size: 2.35rem; }
.brand .sub { color: var(--ink-soft); font-size: .98rem; margin-top: 8px; font-weight: 700; }
.field-label { display: block; font-size: .9rem; font-weight: 800; color: var(--ink); margin: 14px 4px 0; line-height: 1.35; }
.field-label + .field { margin-top: 8px; }
.field { position: relative; margin: 22px 0 12px; }
.field svg { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); width: 20px; height: 20px; color: var(--ink-soft); }
.field input {
  width: 100%; min-height: 56px; border-radius: var(--r-pill); border: 1.5px solid var(--line-strong);
  background: var(--cream); padding: 0 18px 0 46px; font-family: var(--sans); font-weight: 700; font-size: 1rem; color: var(--ink);
}
.field input:focus { border-color: var(--accent); outline: none; }
.login .reassure { display: flex; align-items: center; justify-content: center; gap: 7px; color: var(--ink-soft);
  font-size: .82rem; font-weight: 700; margin-top: 14px; }
.login .reassure svg { width: 16px; height: 16px; color: var(--green-deep); }
.form-err { color: var(--accent-deep); font-size: .84rem; font-weight: 800; text-align: center; min-height: 1.1em; margin-top: 6px; }

/* ---------- tab bar ---------- */
.tabbar {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 0;
  width: 100%; max-width: var(--frame-max); height: calc(var(--tabbar-h) + var(--safe-b));
  padding-bottom: var(--safe-b);
  background: rgba(255,252,245,.92); backdrop-filter: blur(12px) saturate(1.1);
  border-top: 1px solid var(--line); display: flex; z-index: 30;
}
.tabbar a {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--ink-soft); text-decoration: none; font-weight: 800;
  transition: color .2s ease;
}
.tabbar a .ti { display: grid; place-items: center; width: 50px; height: 30px; border-radius: var(--r-pill);
  transition: background .22s ease, transform .2s cubic-bezier(.2,.8,.2,1); }
.tabbar a .ti svg { width: 25px; height: 25px; }
.tabbar a .tl { font-size: .68rem; }
.tabbar a[aria-current="page"] { color: var(--accent); }
.tabbar a[aria-current="page"] .ti { background: var(--accent-soft); }
.tabbar a:active .ti { transform: scale(.9); }

/* ---------- diversos ---------- */
.list-card { padding: 4px 16px; }
.row-link { display: flex; align-items: center; gap: 12px; width: 100%; background: none; border: none; text-align: left;
  padding: 14px 2px; color: var(--ink); font-weight: 700; }
.row-link + .row-link { border-top: 1px solid var(--line); }
.row-link .ic { width: 36px; height: 36px; border-radius: var(--r-sm); background: var(--bg-2); display: grid; place-items: center; flex: none; }
.row-link .ic svg { width: 20px; height: 20px; color: var(--accent-deep); }
.row-link .t { flex: 1; min-width: 0; }
.row-link .t b { display: block; font-weight: 800; }
.row-link .t span { font-size: .8rem; color: var(--ink-soft); }
.row-link .chev { color: var(--line-strong); }
.row-link .chev svg { width: 18px; height: 18px; }
.empty { text-align: center; color: var(--ink-soft); padding: 40px 20px; }
.empty svg { width: 54px; height: 54px; color: var(--line-strong); margin-bottom: 10px; }
.divider-label { font-weight: 800; color: var(--ink-soft); font-size: .8rem; letter-spacing: .08em; text-transform: uppercase; margin: 22px 2px 10px; }

/* perfil: cabecalho + resumo */
.profile-head { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.profile-head .avatar.lg { width: 64px; height: 64px; }
.profile-head .avatar.lg svg { width: 38px; height: 38px; }
.profile-head .eyebrow { margin-bottom: 2px; }
.ph-text { min-width: 0; }
.muted-sm { font-size: .8rem; color: var(--ink-soft); font-weight: 700; margin-top: 4px; word-break: break-word; }
.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 4px; }
.stat { background: var(--cream); border: 1px solid var(--line); border-radius: var(--r-md); padding: 13px 8px; text-align: center; box-shadow: var(--sh-sm); }
.stat b { display: block; font-family: var(--serif); font-size: 1.5rem; color: var(--title); font-variation-settings: 'opsz' 40, 'SOFT' 40; line-height: 1; }
.stat b i { font-style: normal; font-size: .85rem; color: var(--ink-soft); }
.stat span { display: block; margin-top: 5px; font-size: .72rem; color: var(--ink-soft); font-weight: 800; }
.foot-note { text-align: center; color: var(--ink-soft); font-size: .74rem; margin-top: 18px; font-weight: 700; }
.toast {
  position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + var(--safe-b) + 16px); transform: translateX(-50%) translateY(20px);
  background: var(--title); color: #fff; padding: 12px 20px; border-radius: var(--r-pill); font-weight: 800; font-size: .9rem;
  box-shadow: var(--sh-lg); opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s; z-index: 60; max-width: 84%;
  display: flex; align-items: center; gap: 9px;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast svg { width: 18px; height: 18px; color: var(--gold); }

/* ---------- certificado ---------- */
.cert {
  background:
    radial-gradient(circle at 50% 0%, #FFFDF7, var(--cream));
  border-radius: var(--r-lg); padding: 26px 22px; text-align: center; color: var(--title);
  box-shadow: var(--sh-md); position: relative; border: 2px solid var(--gold);
}
.cert::after { content: ''; position: absolute; inset: 9px; border: 1.5px solid var(--honey); border-radius: var(--r-md); pointer-events: none; }
.cert .mark { width: 46px; height: 46px; margin: 0 auto 6px; color: var(--accent); }
.cert .k { letter-spacing: .18em; text-transform: uppercase; font-size: .72rem; color: var(--accent); font-weight: 800; }
.cert h2 { font-size: 1.5rem; margin: 6px 0; }
.cert .nome { font-family: var(--serif); font-size: 2.1rem; color: var(--accent-deep); margin: 12px 0 6px;
  font-variation-settings: 'opsz' 80,'SOFT' 70,'wght' 600; border-bottom: 2px dotted var(--honey); display: inline-block; padding: 0 14px 6px; }
.cert .desc { font-size: .92rem; color: var(--ink); margin: 10px auto 0; max-width: 30ch; line-height: 1.45; }
.cert .seal { width: 78px; height: 78px; margin: 16px auto 0; }
.cert .foot { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; margin-top: 22px; }
.cert .foot-col { flex: 1; min-width: 0; }
.cert .foot-col.date { text-align: center; }
.cert .foot .line { display: block; border-top: 1.5px solid var(--line-strong); padding-top: 5px; font-size: .76rem; color: var(--ink-soft); font-weight: 700; }
.cert .sign-name { display: block; font-family: 'Assinatura', cursive; font-size: 2.7rem; line-height: .7;
  color: var(--accent-deep); text-align: center; transform: rotate(-3deg); margin: 4px 0 6px; white-space: nowrap; }
.cert .sign-name.spacer { visibility: hidden; }

/* desktop: leve respiro ao redor do frame */
@media (min-width: 720px) {
  #app { padding: 26px 0; }
  .app-frame { min-height: calc(100dvh - 52px); border-radius: 38px; border: 1px solid var(--line); }
  .tabbar { border-radius: 0 0 38px 38px; }
}

/* impressao: so o certificado */
@media print {
  .tabbar, .back-btn, .action-stack, .skip-link { display: none !important; }
  #app, .app-frame { box-shadow: none; background: #fff; max-width: none; }
  .screen { padding: 0; }
  .cert { border-color: #C4912F; box-shadow: none; page-break-inside: avoid; }
  .print-hide { display: none !important; }
}
