/* Funnel Labs Members — primitives mapped to Design System V1. */
:root {
  --bg0: var(--surface-0); --bg1: var(--surface-1); --surface: var(--surface-2);
  --line: var(--hair-2); --line-strong: var(--hair-4);
  --text: var(--ink-1); --text-dim: var(--ink-2); --muted: var(--ink-3); --faint: var(--ink-2);
  --yellow: var(--accent); --yellow-deep: var(--accent-deep); --yellow-soft: var(--accent-soft);
  --green: var(--ok); --green-soft: var(--ok-soft); --orange: var(--accent); --navy: var(--surface-4); --blue: var(--info);
  --radius: var(--radius-control); --radius-lg: var(--radius-surface);
  --shadow-card: var(--elev-1); --shadow-pop: var(--elev-3);
  --glow-yellow: var(--glow-accent); --header-h: 64px; --ease-snap: var(--ease);
  --bottom-nav-h: 64px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

/* `hidden` vence qualquer display de componente (.btn, .playlist, main em grid) */
[hidden] { display: none !important; }

html { scroll-behavior: smooth; }

body {
  background: var(--bg0);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15.5px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  min-height: 100svh;
  text-wrap: pretty;
}

html:not([data-role="admin"]) a[href^="admin.html"],
html:not([data-role="admin"]) a[href^="/admin.html"] { display: none !important; }

/* Grid técnico de fundo (blueprint) */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    linear-gradient(var(--grid-dot-color) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-dot-color) 1px, transparent 1px),
    radial-gradient(1200px 600px at 80% -10%, var(--accent-soft), transparent 60%),
    radial-gradient(900px 500px at -10% 20%, var(--accent-quiet), transparent 55%);
  background-size: 44px 44px, 44px 44px, auto, auto;
  mask-image: linear-gradient(#000, #000);
}

main, header, footer, .layer { position: relative; z-index: 1; }

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, textarea, select { font-family: inherit; color: inherit; }

:where(a, button, input, textarea, select, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--focus-inner);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px var(--focus-outer);
  border-radius: inherit;
}
/* O campo de busca é um wrapper: o anel precisa nascer nele, não no <input>. */
.search-box:focus-within {
  outline: 2px solid var(--focus-inner);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px var(--focus-outer);
}
.search-box input:focus-visible { outline: none; box-shadow: none; }

.skip-link {
  position: fixed;
  z-index: 1000;
  top: 10px;
  left: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-control);
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 800;
  transform: translateY(-150%);
}
.skip-link:focus { transform: translateY(0); }

::selection { background: var(--accent); color: var(--accent-ink); }

/* Scrollbar */
html { scrollbar-color: var(--scrollbar-thumb) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--scrollbar-thumb); border-radius: var(--radius-pill); border: 2px solid var(--bg0); }
::-webkit-scrollbar-thumb:hover { background: var(--hair-4); }

/* Nenhum heading com linha órfã; parágrafo com quebra decente. */
h1, h2, h3, h4 { text-wrap: balance; }
p, li, dd { text-wrap: pretty; }
/* Cabeçalho fixo não come âncora. */
[id] { scroll-margin-top: calc(var(--header-h) + var(--s-4)); }

/* ---------- Tipografia utilitária ---------- */
.display {
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.05;
}

.tag-mono {
  font-family: var(--font-mono);
  font-size: var(--t-label);
  font-weight: 500;
  letter-spacing: var(--track-label);
  text-transform: uppercase;
  color: var(--accent-text);
}

.tag-mono.dim { color: var(--muted); }

/* O h1 da home repete o que o header já diz e empurraria o hero para fora da
   primeira dobra: fica para leitor de tela, sem sair do documento. */
.home-title {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* Playfair só acima de 28px: em 19px a didone perde traço e parece frágil. */
.section-title {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: var(--t-section);
  line-height: 1.25;
  letter-spacing: -0.01em;
}

/* Título de ITEM dentro de lista ou linha de card: mesma família e peso do
   .section-title, um degrau abaixo. O nome da integração em "API e webhooks"
   usa .section-title hoje e fica com 19px numa linha que também carrega pill,
   switch e lixeira — 15px é a medida do item. */
.item-title {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: var(--t-card);
  line-height: 1.3;
  letter-spacing: -0.005em;
  min-width: 0;
  overflow-wrap: anywhere;
}

/* ---------- Fita zebrada (assinatura visual) ---------- */
.hazard {
  height: 6px;
  background: repeating-linear-gradient(
    -45deg,
    var(--accent) 0 14px,
    var(--surface-2) 14px 28px
  );
  border-radius: var(--radius-pill);
  opacity: 0.9;
}

/* ---------- Botões ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 14.5px;
  letter-spacing: 0.01em;
  padding: 12px 22px;
  border-radius: var(--radius-control);
  transition: transform var(--dur-control) var(--ease), box-shadow var(--dur-control) var(--ease),
              background-color var(--dur-micro), border-color var(--dur-micro), color var(--dur-micro);
  white-space: nowrap;
}
.btn:active { transform: translateY(1px) scale(0.99); }

.btn-primary {
  background: var(--btn-primary-gradient);
  color: var(--accent-ink);
  box-shadow: var(--shadow-btn-primary);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: var(--shadow-btn-primary-hover); }

.btn-ghost {
  background: var(--surface-3);
  color: var(--text);
  border: 1px solid var(--hair-3);
}
.btn-ghost:hover { background: var(--surface-4); border-color: var(--hair-4); transform: translateY(-2px); }

.btn-danger { background: var(--state-danger-soft); color: var(--state-danger); border: 1px solid var(--state-danger); }

.btn-sm { padding: 8px 14px; font-size: 13px; border-radius: var(--radius-control); }

/* Estados completos de todo elemento clicável. */
.btn:disabled, .btn[disabled], .btn[aria-disabled="true"] {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
  filter: grayscale(0.3);
  box-shadow: none;
}
.btn.is-loading {
  position: relative;
  pointer-events: none;
  color: transparent;
}
.btn.is-loading::after {
  content: "";
  position: absolute; inset: 0; margin: auto;
  width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid currentColor;
  border-top-color: transparent;
  color: var(--accent-ink);
  animation: btn-spin 0.7s linear infinite;
}
.btn-ghost.is-loading::after { color: var(--ink-1); }
@keyframes btn-spin { to { transform: rotate(360deg); } }

/* ---------- Header do mentorado ---------- */
.site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 0 32px;
  z-index: 50;
  background: var(--topbar-solid);
  border-bottom: 1px solid var(--line);
}
/* P17: blur custa caro em GPU de celular — vidro só onde há folga. */
@media (min-width: 1024px) {
  .site-header { background: var(--topbar-bg); backdrop-filter: blur(14px); }
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.brand img { height: 34px; width: auto; }
.brand-word {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 19px;
  letter-spacing: -0.01em;
  line-height: 1;
}
.brand-word small {
  display: block;
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 8.5px;
  letter-spacing: 0.34em;
  color: var(--yellow);
  text-transform: uppercase;
  margin-top: 3px;
}

.main-nav { display: flex; gap: 4px; }
.main-nav a {
  padding: 8px 14px;
  border-radius: var(--radius-control);
  font-weight: 600;
  font-size: 14.5px;
  color: var(--muted);
  transition: color 0.15s, background 0.15s;
}
.main-nav a:hover { color: var(--text); background: var(--surface-3); }
.main-nav a.active { color: var(--text); background: var(--surface-3); box-shadow: 0 -2px 0 var(--accent) inset; }

.header-spacer { flex: 1; }

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface-3);
  border: 1px solid var(--hair-3);
  border-radius: var(--radius-control);
  padding: 8px 14px;
  width: 240px;
  color: var(--muted);
  font-size: 13.5px;
  transition: border-color 0.15s, background 0.15s;
}
.search-box:focus-within { border-color: var(--accent); background: var(--surface-4); }
.search-box input { background: none; border: none; outline: none; width: 100%; font-size: 13.5px; }
.search-box input::placeholder { color: var(--faint); }
.search-box kbd {
  font-family: var(--font-mono);
  font-size: 10px;
  border: 1px solid var(--hair-3);
  border-radius: var(--r-1);
  padding: 1px 6px;
  color: var(--ink-4);
}

.icon-btn {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border-radius: var(--radius-control);
  color: var(--muted);
  transition: background-color var(--dur-micro), color var(--dur-micro);
  position: relative;
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.icon-btn .dot {
  position: absolute; top: 8px; right: 9px;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--yellow);
  box-shadow: 0 0 0 3px var(--bg0);
}

.avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: grid; place-items: center;
  /* Iniciais em Inter: Playfair abaixo de 28 px fere a regra S4 (QF-V-10). */
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.02em;
  background: var(--accent-soft);
  color: var(--ink-1);
  border: 2px solid var(--hair-accent);
  flex-shrink: 0;
}
.avatar:empty { visibility: hidden; }
/* Uma família só: o avatar varia em intensidade de laranja, nunca em matiz. */
.avatar.yellow { background: var(--btn-primary-gradient); color: var(--accent-ink); border-color: transparent; }
.avatar.green { background: var(--accent-quiet); color: var(--ink-1); border-color: var(--hair-3); }
.avatar.orange { background: var(--accent-soft); color: var(--ink-1); border-color: var(--hair-accent); }

/* ---------- Esteiras (shelf) ---------- */
.shelf { margin-bottom: var(--s-8); }
.shelf-head {
  display: flex;
  align-items: baseline;
  gap: 14px;
  margin-bottom: var(--s-4);
  padding: 0 var(--s-7);
}
.shelf-head .count { font-family: var(--font-mono); font-size: 11px; color: var(--faint); letter-spacing: 0.08em; }
.shelf-head .shelf-nav { margin-left: auto; display: flex; gap: 6px; }
.shelf-nav button {
  width: 32px; height: 32px;
  border-radius: var(--radius-control);
  border: 1px solid var(--line);
  color: var(--muted);
  display: grid; place-items: center;
  transition: all 0.15s;
}
.shelf-nav button:hover { border-color: var(--accent); color: var(--accent-text); }

.shelf-track {
  display: flex;
  gap: 18px;
  overflow-x: auto;
  scroll-behavior: smooth;
  padding: 14px var(--s-7) 22px;
  scrollbar-width: none;
}
.shelf-track::-webkit-scrollbar { display: none; }
/* Corte seco na borda vira convite: o fade só aparece quando há mais para ver. */
.shelf-track.has-overflow {
  -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 64px), transparent);
  mask-image: linear-gradient(90deg, #000 calc(100% - 64px), transparent);
}

/* ---------- Capa vertical (2:3) ---------- */
.cover {
  position: relative;
  flex: 0 0 208px;
  aspect-ratio: 2 / 3;
  border-radius: var(--radius-surface);
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--elev-1);
  transition: transform var(--dur-control) var(--ease), box-shadow var(--dur-control) var(--ease), border-color var(--dur-micro);
  isolation: isolate;
}
.cover:hover {
  transform: translateY(-8px) scale(1.025);
  border-color: transparent;
  box-shadow: var(--elev-2), var(--elev-accent);
  z-index: 2;
}

.cover-art {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  padding: 18px;
}

.cover-badge {
  align-self: flex-start;
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.2em;
  padding: 5px 9px;
  border-radius: 6px;
  background: var(--on-art-chip);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: var(--on-art);
}

.cover-logo {
  flex: 1;
  display: grid;
  place-items: center;
  padding: 12px 4px;
}
.cover-logo img { max-height: 96px; max-width: 82%; object-fit: contain; filter: drop-shadow(0 6px 18px rgba(0,0,0,0.5)); }

.cover-code {
  flex: 1;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 52px;
  letter-spacing: -0.04em;
  opacity: 0.94;
  text-shadow: 0 8px 30px rgba(0, 0, 0, 0.55);
}

.cover-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 17.5px;
  line-height: 1.14;
  letter-spacing: -0.01em;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.6);
}
.cover-sub { font-size: 12px; color: var(--on-art-dim); margin-top: 5px; line-height: 1.35; }

/* Véu inferior pra legibilidade */
.cover-art::after {
  content: "";
  position: absolute;
  inset: 55% 0 0 0;
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.62));
  z-index: -1;
}

/* Overlay de hover */
.cover-hover {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 10px;
  padding: 18px;
  background: linear-gradient(180deg, transparent 0%, rgba(6, 5, 4, 0.92) 52%);
  color: var(--on-art);
  opacity: 0;
  transition: opacity 0.22s;
}
.cover:hover .cover-hover { opacity: 1; }
.cover-hover .meta { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.08em; color: var(--on-art-dim); }
.cover-hover .btn { width: 100%; }

/* Capa importada: a arte vem pronta como imagem (pôster completo) */
.cover.has-img { background-size: cover; background-position: center top; }
.cover.has-img .cover-art { display: none; }
.cover.has-img .cover-hover .meta { font-size: 12px; letter-spacing: 0; font-family: var(--font-body); font-weight: 600; }

/* Capa bloqueada (produto fora da assinatura do mentorado) */
.cover.is-locked .cover-art { filter: grayscale(0.55) brightness(0.62); }
/* Capa com imagem escurece por véu — o cadeado fica nítido por cima */
.cover.is-locked.has-img::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(7, 6, 4, 0.55);
  z-index: 1;
}
.cover.is-locked:hover { transform: none; }
.cover-lock {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: linear-gradient(180deg, rgba(5, 6, 9, 0.28), rgba(5, 6, 9, 0.72));
  z-index: 2;
  text-align: center;
  padding: 16px;
}
.cover-lock .lock-ico {
  width: 44px; height: 44px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: var(--on-art-chip);
  border: 1px solid rgba(255, 255, 255, 0.24);
  color: var(--accent-hover);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}
.cover-lock .lock-label {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--on-art);
  background: var(--on-art-chip);
  border: 1px solid rgba(255, 255, 255, 0.18);
  padding: 5px 10px;
  border-radius: var(--radius-pill);
  opacity: 0;
  transition: opacity 0.2s;
}
.cover.is-locked:hover .lock-label { opacity: 1; }
/* Touch: sem hover — o rótulo do cadeado fica sempre visível */
@media (hover: none) {
  .cover-lock .lock-label { opacity: 1; }
}

/* Esteiras longas: só renderiza o que está perto do viewport */
.shelf { content-visibility: auto; contain-intrinsic-size: auto 480px; }

/* Banner divisório da vitrine (seção estilo Curseduca) */
.v-banner {
  display: block;
  /* Base = ritmo entre seções (64 px): o título da esteira seguinte ficava a 12 px (QF-V-11). */
  margin: var(--s-7) 0 var(--s-8);
  border-radius: var(--radius-surface);
  overflow: hidden;
  border: 1px solid var(--line);
  box-shadow: var(--elev-2);
}
/* Uma imagem só, escolhida pelo <picture> em (max-width: 900px) — esconder a
   segunda com display:none não impedia o download das duas. */
.v-banner picture { display: block; }
.v-banner img { width: 100%; height: auto; display: block; aspect-ratio: 1600 / 448; }
a.v-banner { transition: transform 0.25s var(--ease-snap), box-shadow 0.25s; }
a.v-banner:hover { transform: translateY(-3px); box-shadow: var(--elev-2), var(--elev-accent); }

/* Card largo (capa horizontal — mesma proporção da Curseduca) */
.cover.is-wide { flex: 0 0 372px; aspect-ratio: 16 / 9; }
.cover.is-wide.has-img { background-position: center; }
@media (max-width: 720px) {
  .cover.is-wide { flex-basis: 300px; }
}

/* Barra de progresso na capa */
.cover-progress {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 4px;
  background: rgba(255, 255, 255, 0.18);
}
.cover-progress i {
  display: block; height: 100%;
  background: linear-gradient(90deg, var(--accent-deep), var(--accent));
}

/* ----- Artes por produto (fundos das capas) -----
   Quatro texturas da marca (hachura, anéis, grade, radial) no lugar das 12
   paletas herdadas em verde/azul/teal/vermelho. A diferença é de matéria,
   não de matiz — preto e laranja nos dois temas. */
.cv-mentoria, .cv-estrategia, .cv-pratica,
.cv-biblioteca, .cv-apostilas, .cv-workshop,
.cv-automacao, .cv-simulados, .cv-plantao,
.cv-operacao, .cv-ferramentas, .cv-raiox, .cv-maratona, .cv-mapas, .cv-planilha {
  background: radial-gradient(circle at 78% 12%, rgba(255, 90, 0, 0.30), transparent 55%),
              linear-gradient(165deg, #151210 0%, #0A0908 60%, #060505 100%);
}
.cv-mentoria::before, .cv-estrategia::before, .cv-pratica::before {
  content: ""; position: absolute; inset: 0;
  background: repeating-linear-gradient(-45deg, transparent 0 34px, rgba(255, 90, 0, 0.10) 34px 44px);
}
.cv-biblioteca::before, .cv-apostilas::before, .cv-workshop::before {
  content: ""; position: absolute; inset: 0;
  background: repeating-radial-gradient(circle at 50% 118%, transparent 0 26px, rgba(255, 90, 0, 0.11) 26px 28px);
}
.cv-automacao::before, .cv-simulados::before, .cv-plantao::before {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(rgba(253, 253, 253, 0.06) 1px, transparent 1px),
              linear-gradient(90deg, rgba(253, 253, 253, 0.06) 1px, transparent 1px);
  background-size: 26px 26px;
  -webkit-mask-image: radial-gradient(circle at 50% 40%, #000, transparent 78%);
  mask-image: radial-gradient(circle at 50% 40%, #000, transparent 78%);
}
.cv-operacao::before, .cv-ferramentas::before, .cv-raiox::before,
.cv-maratona::before, .cv-mapas::before, .cv-planilha::before {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(circle at 22% 84%, rgba(255, 90, 0, 0.26), transparent 52%);
}

/* Selo AO VIVO pulsante */
.live-pill {
  display: inline-flex; align-items: center; gap: 7px;
  font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.18em;
  color: var(--accent-text);
}
.live-pill::before {
  content: ""; width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent);
  animation: pulse 1.6s infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 var(--accent-soft); }
  60% { box-shadow: 0 0 0 8px rgba(255, 90, 0, 0); }
}

/* ---------- Cards genéricos ---------- */
.card {
  background: var(--card-gradient);
  border: 1px solid var(--line);
  border-radius: var(--radius-surface);
  box-shadow: var(--elev-1);
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 13px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--hair-3);
  background: var(--surface-3);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dim);
  transition: background-color var(--dur-micro), border-color var(--dur-micro), color var(--dur-micro);
  cursor: pointer;
}
.chip:hover { border-color: var(--hair-4); background: var(--surface-4); color: var(--text); }
.chip.active { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0;
  background: var(--overlay-bg);
  display: grid; place-items: center;
  z-index: 90;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s;
}
.modal-backdrop.open { opacity: 1; pointer-events: auto; }
.modal {
  position: relative;
  width: min(480px, calc(100vw - 40px));
  max-height: calc(100svh - 48px);
  overflow-y: auto;
  background: var(--card-gradient);
  border: 1px solid var(--hair-3);
  border-radius: var(--radius-surface);
  box-shadow: var(--elev-3);
  padding: 30px;
  transform: translateY(14px) scale(0.97);
  transition: transform 0.24s var(--ease-snap);
}
.modal-backdrop.open .modal { transform: none; }
.modal-close {
  position: absolute; top: 14px; right: 14px;
  width: 44px; height: 44px; border-radius: var(--radius-control);
  display: grid; place-items: center;
  color: var(--muted);
}
.modal-close:hover { background: var(--surface-3); color: var(--text); }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  bottom: 28px; left: 50%;
  transform: translate(-50%, 80px);
  background: var(--surface-3);
  border: 1px solid var(--hair-3);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-control);
  padding: 13px 20px;
  font-size: 14px;
  font-weight: 600;
  box-shadow: var(--elev-3);
  z-index: 120;
  transition: transform 0.3s var(--ease-snap);
  white-space: nowrap;
}
.toast.show { transform: translate(-50%, 0); }

/* ---------- Formulários ---------- */
.field { position: relative; }
.field label {
  display: block;
  font-family: var(--font-mono);
  font-size: var(--t-label);
  letter-spacing: var(--track-label);
  text-transform: uppercase;
  color: var(--ink-4);
  margin-bottom: 7px;
}
.field input, .field textarea, .field select {
  width: 100%;
  background: var(--surface-3);
  border: 1px solid var(--hair-3);
  border-radius: var(--radius-control);
  padding: 12px 15px;
  font-size: 14.5px;
  outline: none;
  transition: border-color var(--dur-micro), background-color var(--dur-micro), box-shadow var(--dur-micro);
}
.field input:focus, .field textarea:focus, .field select:focus {
  border-color: var(--accent);
  background: var(--surface-4);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.field input::placeholder, .field textarea::placeholder { color: var(--ink-3); }
.field + .field { margin-top: var(--s-4); }

/* Erro mora no campo, não só numa frase vermelha solta. */
.field.has-error input, .field.has-error textarea, .field.has-error select,
.field input[aria-invalid="true"], .field textarea[aria-invalid="true"] {
  border-color: var(--state-danger);
  box-shadow: 0 0 0 3px var(--state-danger-soft);
}
.field-error {
  display: flex; align-items: center; gap: 7px;
  margin-top: 7px;
  font-size: 13px;
  color: var(--state-danger);
}
.field-error::before {
  content: "";
  width: 14px; height: 14px; flex-shrink: 0;
  border-radius: 50%;
  border: 1.5px solid currentColor;
  background: linear-gradient(currentColor, currentColor) center/1.5px 6px no-repeat;
}
.field-error:empty { display: none; }

/* Campo de senha: rótulo, campo+olho e dica em três linhas de grid — o botão
   fica no centro exato do input sem depender da altura do rótulo. */
.field-password { display: grid; grid-template-columns: minmax(0, 1fr); }
.field-password > label { grid-area: 1 / 1; }
.field-password > input { grid-area: 2 / 1; padding-right: 52px; }
.field-password > .field-hint { grid-area: 3 / 1; }
.field-password > .pw-toggle {
  grid-area: 2 / 1;
  justify-self: end;
  align-self: center;
  width: 44px; height: 44px;
  margin-right: 2px;
  display: grid; place-items: center;
  border-radius: var(--radius-control);
  color: var(--ink-3);
  transition: color var(--dur-micro), background-color var(--dur-micro);
}
.field-password > .pw-toggle:hover { color: var(--ink-1); background: var(--surface-4); }
.field-password > .pw-toggle[aria-pressed="true"] { color: var(--accent-text); }
.field-hint {
  display: block;
  margin-top: 7px;
  font-size: var(--t-body-sm);
  color: var(--ink-3);
}

/* Ação em forma de texto (abre painel, não navega). */
.link-btn {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 4px 0;
  font-size: var(--t-body-sm);
  font-weight: 600;
  color: var(--accent-text);
  text-decoration: underline;
  text-underline-offset: 4px;
  text-decoration-thickness: 1px;
}
.link-btn:hover { color: var(--ink-1); }

/* ---------- Assistente (assistente flutuante) ---------- */
.fl-assistant-fab {
  position: fixed;
  right: var(--s-5); bottom: var(--s-5);
  width: 62px; height: 62px;
  border-radius: 50%;
  background: var(--btn-primary-gradient);
  box-shadow: var(--elev-3);
  display: grid; place-items: center;
  z-index: 80;
  transition: transform 0.2s var(--ease-snap);
}
.fl-assistant-fab:hover { transform: scale(1.08) rotate(-4deg); }
.fl-assistant-fab img { width: 46px; height: 46px; border-radius: 50%; object-fit: cover; object-position: top; }
.fl-assistant-fab::after {
  content: "";
  position: absolute; inset: -4px;
  border-radius: 50%;
  border: 2px solid var(--hair-accent-strong);
  animation: fl-assistant-ring 2.6s 3;
}
@keyframes fl-assistant-ring {
  0% { transform: scale(1); opacity: 1; }
  70%, 100% { transform: scale(1.35); opacity: 0; }
}
.fl-assistant-fab .fl-assistant-hint {
  position: absolute;
  right: 74px;
  background: var(--surface-3);
  border: 1px solid var(--hair-3);
  color: var(--text);
  font-size: 12.5px;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: var(--radius-control);
  white-space: nowrap;
  box-shadow: var(--shadow-card);
  opacity: 0;
  transform: translateX(8px);
  transition: all 0.2s;
  pointer-events: none;
}
.fl-assistant-fab:hover .fl-assistant-hint { opacity: 1; transform: none; }

.fl-assistant-panel {
  position: fixed;
  right: var(--s-5); bottom: 102px;
  width: min(390px, calc(100vw - 40px));
  /* Altura fixa deixava 220px de vazio com uma mensagem só: o painel cresce. */
  height: auto;
  max-height: min(560px, calc(100svh - 140px));
  background: var(--card-gradient);
  border: 1px solid var(--hair-3);
  border-radius: var(--radius-surface);
  box-shadow: var(--elev-3);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 85;
  opacity: 0;
  transform: translateY(16px) scale(0.96);
  transform-origin: bottom right;
  pointer-events: none;
  transition: opacity 0.22s, transform 0.24s var(--ease-snap);
}
.fl-assistant-panel.open { opacity: 1; transform: none; pointer-events: auto; }

.fl-assistant-head {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--accent-quiet);
}
.fl-assistant-head img { width: 42px; height: 42px; border-radius: 50%; object-fit: cover; object-position: top; border: 2px solid var(--accent); background: var(--surface-3); }
.fl-assistant-head .who strong { font-family: var(--font-display); font-size: 15.5px; display: block; }
.fl-assistant-head .who span { font-size: 12px; color: var(--ink-3); display: inline-flex; align-items: center; gap: 6px; }
.fl-assistant-head .who span::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }

.fl-assistant-body {
  flex: 0 1 auto;
  overflow-y: auto;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.fl-assistant-msg {
  max-width: 84%;
  padding: 11px 15px;
  border-radius: var(--radius-surface);
  font-size: 13.8px;
  line-height: 1.5;
  animation: fl-assistant-in 0.25s var(--ease-snap);
}
@keyframes fl-assistant-in { from { opacity: 0; transform: translateY(8px); } }
.fl-assistant-msg.bot {
  align-self: flex-start;
  background: var(--surface-3);
  border: 1px solid var(--line);
  border-bottom-left-radius: 4px;
}
.fl-assistant-msg.me {
  align-self: flex-end;
  background: var(--accent-soft);
  color: var(--ink-1);
  font-weight: 500;
  border-bottom-right-radius: 4px;
}
.fl-assistant-typing { display: inline-flex; gap: 5px; padding: 14px 16px; }
.fl-assistant-typing i {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--muted);
  animation: fl-assistant-b 1.1s infinite;
}
.fl-assistant-typing i:nth-child(2) { animation-delay: 0.15s; }
.fl-assistant-typing i:nth-child(3) { animation-delay: 0.3s; }
@keyframes fl-assistant-b { 0%, 60%, 100% { transform: none; opacity: 0.4; } 30% { transform: translateY(-5px); opacity: 1; } }

.fl-assistant-sugs { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 18px 12px; }
.fl-assistant-sugs button {
  font-size: 12px;
  font-weight: 600;
  padding: 7px 12px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--hair-accent);
  color: var(--accent-text);
  background: var(--accent-quiet);
  transition: background-color var(--dur-micro), color var(--dur-micro), border-color var(--dur-micro);
}
.fl-assistant-sugs button:hover { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

.fl-assistant-input {
  display: flex; gap: 10px;
  padding: 14px 16px;
  border-top: 1px solid var(--line);
}
.fl-assistant-input input {
  flex: 1;
  background: var(--surface-3);
  border: 1px solid var(--hair-3);
  border-radius: var(--radius-control);
  padding: 11px 14px;
  font-size: 13.5px;
  outline: none;
}
.fl-assistant-input input:focus { border-color: var(--accent); }
.fl-assistant-input button {
  width: 44px; border-radius: var(--radius-control);
  background: var(--btn-primary-gradient);
  color: var(--accent-ink);
  display: grid; place-items: center;
}

/* ---------- Pop-up promocional ---------- */
.promo-pop .hazard { margin: -30px -30px 22px; border-radius: var(--radius-surface) var(--radius-surface) 0 0; height: 8px; }
.promo-pop h3 { font-family: var(--font-display); font-size: 24px; font-weight: 800; letter-spacing: -0.02em; margin-bottom: 10px; }
.promo-pop p { color: var(--text-dim); font-size: 14.5px; margin-bottom: 22px; }

/* ---------- Animações de entrada ---------- */
.reveal { opacity: 0; transform: translateY(14px); animation: reveal var(--dur-reveal) var(--ease) forwards; }
.reveal.d1 { animation-delay: 0.07s; }
.reveal.d2 { animation-delay: 0.14s; }
.reveal.d3 { animation-delay: 0.21s; }
.reveal.d4 { animation-delay: 0.28s; }
@keyframes reveal { to { opacity: 1; transform: none; } }

/* ---------- Navegação inferior (mobile app-like) ---------- */
.mobile-nav { display: none; }

.session-logout {
  padding: 7px 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-control);
  color: var(--text-dim);
  font-size: 12px;
}
.session-logout:hover { color: var(--text); background: var(--surface-3); }
.session-logout:disabled { opacity: 0.55; cursor: wait; }

.service-error {
  position: fixed;
  inset: 0;
  z-index: 999;
  display: grid;
  place-items: center;
  padding: 24px;
  background: radial-gradient(circle at 50% 0%, var(--accent-soft), transparent 60%), var(--bg0);
}
.service-error-card {
  width: min(560px, 100%);
  padding: clamp(28px, 6vw, 52px);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-pop);
}
.service-error-card h1 { font: 800 clamp(26px, 5vw, 38px)/1.08 var(--font-display); margin: 14px 0; }
.service-error-card p { color: var(--text-dim); margin-bottom: 24px; }
.service-error-card small { display: block; margin-top: 18px; color: var(--muted); font-family: var(--font-mono); font-size: 12px; word-break: break-all; }
.service-error-card .row { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- Estados de carregamento e vazio ---------- */
.is-hidden { display: none !important; }

.page-skeleton {
  position: relative;
  z-index: 1;
  padding: calc(var(--header-h) + 34px) 48px 60px;
  max-width: 1320px;
  margin: 0 auto;
}
.page-skeleton.tight { padding-top: calc(var(--header-h) + 26px); }
.sk {
  border-radius: var(--radius-control);
  background: var(--skeleton-base) linear-gradient(90deg, transparent 0%, var(--skeleton-shine) 45%, transparent 90%);
  background-size: 220% 100%;
  animation: sk-shimmer 1.4s ease-in-out infinite;
  margin-bottom: 14px;
}
.sk.title { height: 34px; width: min(420px, 70%); }
.sk.text { height: 14px; width: min(560px, 90%); }
.sk.text.short { width: min(320px, 55%); }
.sk.block { height: clamp(200px, 32vh, 340px); width: 100%; border-radius: var(--radius-surface); margin: 24px 0 34px; }
.sk-row { display: flex; gap: 18px; overflow: hidden; }
.sk-row .sk { flex: 0 0 208px; aspect-ratio: 2 / 3; height: auto; margin: 0; }
.sk-row.wide .sk { flex-basis: 292px; aspect-ratio: 16 / 10; }
@keyframes sk-shimmer { from { background-position: 120% 0; } to { background-position: -120% 0; } }
@media (prefers-reduced-motion: reduce) { .sk { animation: none; background-image: none; } }

/* Um componente só para todo estado vazio do produto. */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--s-2);
  padding: var(--s-5);
  border: 1px solid var(--hair-2);
  border-radius: var(--radius-surface);
  background: var(--surface-3);
  color: var(--ink-3);
  font-size: var(--t-body-sm);
  line-height: 1.55;
}
.empty-state > svg { width: 32px; height: 32px; color: var(--ink-4); flex-shrink: 0; }
.empty-state strong {
  display: block;
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--t-card);
  font-weight: 600;
  line-height: 1.35;
}
.empty-state p { max-width: 54ch; }
.empty-state .btn { margin-top: var(--s-2); }
/* Tracejado só onde há ação a fazer — caso contrário parece stub quebrado. */
.empty-state.is-action { border-style: dashed; border-color: var(--hair-3); background: none; }
.empty-state.is-centered { align-items: center; text-align: center; }
.empty-state.inline { padding: var(--s-4); background: none; border-color: var(--hair-2); }
/* Vazio dentro de uma esteira: precisa de largura, senão colapsa no flex. */
.empty-state.cw-empty {
  flex: 0 0 min(420px, calc(100vw - 2 * var(--s-7)));
  min-width: 260px;
  padding: var(--s-5);
}
.empty-state.badges-empty { grid-column: 1 / -1; }
.empty-state.chart-empty, .empty-state.comments-empty { margin-top: var(--s-3); }
.empty-state.search-empty { margin-bottom: var(--s-8); }
@media (max-width: 900px) {
  .empty-state.cw-empty { flex-basis: min(300px, calc(100vw - 2 * var(--s-4))); }
}

.page-empty {
  min-height: calc(100svh - var(--header-h));
  display: grid;
  place-items: center;
  padding: calc(var(--header-h) + 40px) 24px 80px;
  text-align: center;
}
.page-empty img { margin-inline: auto; }
.page-empty .tag-mono { display: block; margin-bottom: 14px; }
.page-empty h1 { font: 800 clamp(26px, 4vw, 36px)/1.1 var(--font-display); letter-spacing: -0.02em; margin-bottom: 12px; }
.page-empty p { color: var(--text-dim); max-width: 46ch; margin: 0 auto 24px; }

/* ---------- Card único (capa 2:3 / larga 16:9 / aula 16:9 + corpo) ---------- */
.card-lesson {
  position: relative;
  flex: 0 0 292px;
  display: flex; flex-direction: column;
  border-radius: var(--radius-surface);
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--elev-1);
  transition: transform var(--dur-control) var(--ease), border-color var(--dur-micro), box-shadow var(--dur-control) var(--ease);
}
.card-lesson:hover { transform: translateY(-4px); border-color: transparent; box-shadow: var(--elev-2), var(--elev-accent); }

/* "Continue aqui" e "Começar aqui": mesma gramática do marco atual da trilha.
   O texto chega em caixa normal; a caixa alta é decisão de estilo. */
.card-lesson.is-next, .lesson-row.is-next { border-color: var(--hair-accent); }
.card-lesson.is-next { box-shadow: var(--elev-1), var(--elev-accent); }
.tag-continue, .tag-start {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-mono);
  font-size: 9.5px; font-weight: 600;
  letter-spacing: var(--track-label);
  text-transform: uppercase;
  padding: 5px 9px;
  border-radius: var(--radius-pill);
  background: var(--accent);
  color: var(--accent-ink);
  white-space: nowrap;
}
/* No card, o selo fica sobre a arte, no canto de cima. */
.card-lesson .thumb .tag-continue {
  position: absolute; left: 10px; top: 10px; z-index: 2;
  box-shadow: 0 6px 18px -8px rgba(0, 0, 0, .8);
}
.card-lesson .thumb .tag-continue ~ .done-mark,
.card-lesson .thumb .done-mark:not(:first-child) { left: auto; right: 10px; }
/* Na lista vertical do curso, ele acompanha o título. */
.lesson-row .tag-continue { margin-left: 8px; vertical-align: 1px; }
.lesson-row.is-next { background: var(--accent-quiet); }
.lesson-row.is-next .lr-title { color: var(--text); }
/* No corpo do card, "Começar aqui" é o próprio estado da aula. */
.card-lesson .state .tag-start { margin-top: 1px; }
.card-lesson .thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  display: grid; place-items: center;
  overflow: hidden;
}
/* Fallback tipográfico: só aparece quando a thumb não tem arte própria.
   Com imagem, o título repetido duas vezes era o defeito H1 da auditoria. */
.card-lesson .thumb .frame-title {
  font-family: var(--font-display); font-weight: 800;
  font-size: 17px; line-height: 1.25; letter-spacing: -0.01em;
  text-align: center; padding: 0 18px;
  color: var(--on-art);
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
  overflow: hidden;
  text-shadow: 0 6px 24px rgba(0, 0, 0, 0.55);
}
.card-lesson .thumb.has-img .frame-title,
.card-lesson .thumb[style*="url"] .frame-title { display: none; }
.card-lesson .thumb .dur {
  position: absolute; right: 10px; bottom: 10px;
  font-family: var(--font-mono); font-size: 11px;
  font-variant-numeric: tabular-nums;
  background: var(--on-art-chip);
  color: var(--on-art);
  border: 1px solid rgba(255, 255, 255, 0.14);
  padding: 3px 8px; border-radius: var(--r-2);
}
.card-lesson .thumb .play {
  position: absolute; inset: 0; display: grid; place-items: center;
  background: linear-gradient(180deg, transparent 0%, rgba(6, 5, 4, 0.72) 100%);
  opacity: 0; transition: opacity 0.2s;
}
.card-lesson:hover .thumb .play { opacity: 1; }
.card-lesson .thumb .play i {
  width: 50px; height: 50px; border-radius: 50%;
  background: var(--accent); color: var(--accent-ink);
  display: grid; place-items: center;
  box-shadow: var(--elev-accent);
}
.card-lesson .done-mark {
  position: absolute; left: 10px; top: 10px;
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--on-art-chip);
  display: grid; place-items: center;
  color: var(--state-done);
  border: 1.5px solid currentColor;
}
.card-lesson .body { padding: 13px 15px 15px; flex: 1; }
.card-lesson .kicker { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-lesson :is(h3, h4) {
  font-family: var(--font-body); font-size: var(--t-card); font-weight: 600; line-height: 1.35;
  letter-spacing: -0.005em;
  display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  min-height: calc(var(--t-card) * 1.35 * 2);
  text-wrap: initial;
}
.card-lesson .kicker { font-variant-numeric: tabular-nums; }
.card-lesson .state { font-size: 12px; color: var(--muted); margin-top: 7px; }
.card-lesson .state.doing { color: var(--accent-text); font-weight: 600; }

/* Capa com imagem em touch: o título vira texto sobre a imagem */
.cover-caption {
  display: none;
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 26px 12px 12px;
  color: var(--on-art);
  background: linear-gradient(180deg, transparent, rgba(6, 5, 4, 0.9));
  font-family: var(--font-display); font-weight: 700; font-size: 13px; line-height: 1.25;
  z-index: 1;
}
.cover-caption span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
@media (hover: none) {
  .cover.has-img .cover-caption { display: block; }
  /* QF-V-03 — a arte já traz o título (classe `art-titled`, marcada no JS):
     a legenda sai da tela, mas continua na árvore de acessibilidade e segue
     dando nome ao link. Capa enviada sem a classe mantém a legenda. */
  .cover.art-titled .cover-caption {
    position: absolute;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
    background: none;
  }
}

/* ---------- Prompt "Próxima aula" ---------- */
.next-prompt {
  position: fixed; right: 18px; bottom: 18px; z-index: 90;
  width: min(320px, calc(100vw - 20px));
  background: var(--surface-3);
  border: 1px solid var(--hair-accent-strong);
  border-radius: var(--radius-surface);
  padding: 14px 16px;
  box-shadow: var(--elev-3);
}
.next-prompt .np-count { font-size: 12px; color: var(--muted); margin-bottom: 5px; }
.next-prompt .np-count b { color: var(--accent-text); font-variant-numeric: tabular-nums; }
.next-prompt .np-title { font-weight: 700; font-size: 13.5px; margin-bottom: 10px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.next-prompt .np-row { display: flex; gap: 8px; }
/* O bloco recebe foco programático ao abrir: anel discreto, sem susto. */
.next-prompt:focus-visible { outline: 2px solid var(--focus-outer); outline-offset: 3px; box-shadow: none; }
body.has-next-prompt .fl-assistant-fab { display: none; }

/* ---------- Busca mobile (bloco abaixo do header) ---------- */
.m-search { display: none; }

/* QF-V-04 — até 520 px o "Voltar ao início/curso" do header vira só a seta:
   com o toggle de tema, o rótulo por extenso empurrava avatar e "Sair" para
   fora da tela. O texto fica no DOM (font-size 0) e segue dando nome ao link;
   o alvo de toque mantém 44 px. */
@media (max-width: 520px) {
  .site-header [data-back] {
    font-size: 0;
    gap: 0;
    padding: 0;
    min-width: 44px;
    min-height: 44px;
    flex-shrink: 0;
  }
}

/* ---------- Responsivo global ---------- */
@media (max-width: 900px) {
  .search-box { display: none; }
  .main-nav { display: none; }
  .shelf-head, .shelf-track { padding-left: var(--s-4); padding-right: var(--s-4); }
  /* Eyebrow e título nunca dividem a linha em 390px. */
  .shelf-head { flex-direction: column; align-items: flex-start; gap: var(--s-2); }
  .shelf-head .count { order: 3; }
  .cover { flex-basis: 164px; }

  .site-header { padding: 0 14px; gap: 10px; height: 58px; }
  :root { --header-h: 58px; }
  .brand img { height: 28px; }
  .brand-word { font-size: 16px; }
  .session-logout { padding: 6px 10px; font-size: 11px; min-height: 44px; min-width: 44px; display: inline-flex; align-items: center; justify-content: center; }
  /* Alvo de toque de 44px sem inflar o desenho do logo nem do avatar. */
  .brand, .avatar { position: relative; }
  .brand::after, .avatar::after {
    content: "";
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: max(100%, 44px); height: 44px;
  }

  /* iOS não dá zoom em campo com fonte >= 16px */
  input, textarea, select { font-size: 16px; }
  .search-box input { font-size: 16px; }

  .m-search { display: block; padding: 14px 16px 2px; }
  .m-search .search-box { display: flex; width: 100%; min-height: 44px; }
  .m-search kbd { display: none; }

  .page-skeleton { padding-left: 16px; padding-right: 16px; }
  .sk-row .sk { flex-basis: 164px; }
  .card-lesson { flex-basis: 252px; }

  .next-prompt {
    right: 10px; left: 10px; width: auto;
    bottom: calc(84px + env(safe-area-inset-bottom));
  }
  body.has-next-prompt .toast { bottom: calc(200px + env(safe-area-inset-bottom)); }

  /* A tabbar é fixa: o corpo reserva a altura dela mais folga de leitura. */
  body.with-tabbar { padding-bottom: calc(var(--bottom-nav-h) + var(--s-5) + env(safe-area-inset-bottom)); }

  .mobile-nav {
    display: flex;
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 70;
    background: var(--bottom-nav-solid);
    border-top: 1px solid var(--hair-3);
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
  }
  .mobile-nav a {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    min-height: 48px;
    padding: 6px 0 4px;
    border-radius: var(--radius-control);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.03em;
    color: var(--muted);
  }
  .mobile-nav a.active { color: var(--accent-text); }
  .mobile-nav a:active { background: var(--surface-3); }
  .mobile-nav a:focus-visible { outline-offset: -3px; }

  /* Assistente acima da tab bar */
  /* O FAB sobe acima da tabbar E da linha de ação da aula ("Anotar"). */
  .fl-assistant-fab {
    width: 54px; height: 54px;
    right: 14px;
    bottom: calc(var(--bottom-nav-h) + var(--s-6) + env(safe-area-inset-bottom));
  }
  .fl-assistant-fab img { width: 40px; height: 40px; }
  .fl-assistant-fab .fl-assistant-hint { display: none; }
  .fl-assistant-panel {
    right: 10px; left: 10px;
    width: auto;
    bottom: calc(var(--bottom-nav-h) + 96px + env(safe-area-inset-bottom));
    max-height: min(480px, calc(100svh - 240px));
  }

  .toast {
    white-space: normal;
    max-width: calc(100vw - 28px);
    width: max-content;
    text-align: center;
    bottom: calc(84px + env(safe-area-inset-bottom));
    font-size: 13px;
  }

  .modal { padding: 22px; }
  .shelf-head .shelf-nav { display: none; } /* touch: arrasta a esteira */
  .section-title { font-size: 17.5px; }
}

@media (max-width: 480px) {
  .cover { flex-basis: 148px; }
  .cover-title { font-size: 15.5px; }
  .cover-code { font-size: 42px; }
  .btn { padding: 11px 18px; font-size: 14px; }
}

/* Touch: sem hover — overlay das capas vira informação permanente ao tocar */
@media (hover: none) {
  .cover-hover { display: none; }
  .card-lesson .thumb .play { opacity: 1; background: none; }
  .card-lesson .thumb .play i { width: 44px; height: 44px; opacity: 0.92; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1 !important; transform: none !important; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .reveal { opacity: 1; transform: none; }
}

/* =====================================================================
   LAPIDAÇÃO 16/09/2026 — componentes novos compartilhados.
   Marcação correspondente é dos agentes de HTML/JS; o CSS já está de pé.
   ===================================================================== */

/* Texto só para leitor de tela (nome acessível de link sem rótulo visível). */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* ---------- Alternador de tema (header do mentorado e do admin) ---------- */
.theme-toggle {
  position: relative;
  width: 36px; height: 36px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border-radius: var(--radius-control);
  border: 1px solid var(--hair-3);
  background: transparent;
  color: var(--ink-2);
  transition: background-color var(--dur-micro), border-color var(--dur-micro), color var(--dur-micro);
}
/* Área de toque de 44px sem inflar o desenho do botão.
   A caixa de referência é o padding box (36px menos 2px de borda = 34px),
   por isso o recuo é de 5px de cada lado. */
.theme-toggle::before {
  content: "";
  position: absolute;
  inset: -5px;
}
.theme-toggle:hover { background: var(--surface-3); border-color: var(--hair-4); color: var(--ink-1); }
.theme-toggle:active { background: var(--surface-4); }
.theme-toggle svg {
  grid-area: 1 / 1;
  width: 16px; height: 16px;
  transition: opacity 220ms var(--ease), transform 220ms var(--ease);
}
/* Escuro ligado: oferece o sol. Claro ligado: oferece a lua. */
.theme-toggle .icon-sun { opacity: 1; transform: rotate(0deg) scale(1); }
.theme-toggle .icon-moon { opacity: 0; transform: rotate(90deg) scale(0.7); }
.theme-toggle[aria-pressed="true"] .icon-sun { opacity: 0; transform: rotate(-90deg) scale(0.7); }
.theme-toggle[aria-pressed="true"] .icon-moon { opacity: 1; transform: rotate(0deg) scale(1); }

@media (prefers-reduced-motion: reduce) {
  .theme-toggle svg { transition: opacity 120ms linear; transform: none !important; }
}
/* No header mobile (58px) o botão cresce para 40 e fecha os 44 de toque. */
@media (max-width: 900px) {
  .theme-toggle { width: 40px; height: 40px; }
  .theme-toggle::before { inset: -3px; }
}

/* ---------- Selo de estado (terceira stat do curso, status de item) ---------- */
.tag-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: var(--t-data);
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 5px 11px;
  border-radius: var(--radius-pill);
  background: var(--accent-soft);
  border: 1px solid var(--hair-accent);
  color: var(--accent-text);
  font-variant-numeric: tabular-nums;
}
.tag-status::before {
  content: "";
  width: 7px; height: 7px;
  border-radius: 50%;
  background: currentColor;
}
.tag-status.is-done { background: var(--state-done-soft); border-color: var(--state-done); color: var(--state-done); }
.tag-status.is-idle { background: var(--surface-3); border-color: var(--hair-3); color: var(--ink-3); }
.tag-status.is-idle::before { background: none; box-shadow: inset 0 0 0 1.5px currentColor; }

/* ---------- Linha de apoio do rodapé ---------- */
.foot-note {
  font-family: var(--font-body);
  font-size: var(--t-body-sm);
  letter-spacing: normal;
  color: var(--ink-3);
  max-width: 62ch;
  line-height: 1.6;
}

/* ---------- Pop-up de boas-vindas ---------- */
.popup.is-welcome { max-width: min(520px, calc(100vw - 32px)); }
.popup.is-welcome h3 {
  font-family: var(--font-display);
  font-size: var(--t-h2);
  font-weight: 700;
  letter-spacing: -0.015em;
  margin: var(--s-3) 0 var(--s-2);
}
.popup.is-welcome > p { color: var(--ink-3); font-size: var(--t-body-sm); }

.welcome-steps {
  list-style: none;
  margin: var(--s-5) 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}
.welcome-steps li {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-3) var(--s-4);
  border: 1px solid var(--hair-2);
  border-radius: var(--radius-control);
  background: var(--surface-3);
  font-size: var(--t-body-sm);
  line-height: 1.45;
  color: var(--ink-2);
}
.welcome-steps li > span:last-child { min-width: 0; }
/* "· feito" não quebra sozinho (QF-V-14): o texto ocupa a linha e o estado
   fica à direita, alinhado à primeira linha. */
.welcome-steps li.is-done > span:last-child {
  flex: 1;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s-3);
}
.welcome-steps li.is-done small { flex-shrink: 0; white-space: nowrap; }
.welcome-steps .step-state {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 1.5px solid var(--ink-5);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-4);
  font-variant-numeric: tabular-nums;
}
.welcome-steps .step-state svg { width: 12px; height: 12px; }
.welcome-steps li.is-done { color: var(--ink-3); }
.welcome-steps li.is-done .step-state { border-color: var(--state-done); color: var(--state-done); }
.welcome-steps li.is-done small { color: var(--ink-4); font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; }
.welcome-steps li.is-pending:first-of-type,
.welcome-steps li.is-current {
  border-color: var(--hair-accent);
  background: var(--accent-soft);
  color: var(--ink-1);
  font-weight: 600;
}
.welcome-steps li.is-pending:first-of-type .step-state,
.welcome-steps li.is-current .step-state { border-color: var(--accent); color: var(--accent-text); }
.popup.is-welcome .row { display: flex; flex-wrap: wrap; gap: var(--s-3); }

/* ---------- Ranking: a linha do próprio mentorado ----------
   Fora do top 5 ela vem como bloco solto, abaixo da lista. */
.rank-me {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: var(--s-1) var(--s-3);
  margin-top: var(--s-3);
  padding: var(--s-3) var(--s-4);
  border: 1px solid var(--hair-accent);
  border-radius: var(--radius-control);
  background: var(--accent-soft);
}
.rank-me strong {
  font-family: var(--font-mono);
  font-size: var(--t-data);
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--accent-text);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.rank-me span { font-size: var(--t-body-sm); color: var(--ink-2); }
/* Quando o mentorado está entre os cinco, o destaque é na própria linha. */
.rank-row.me, .rk.rank-me { border-color: var(--hair-accent); background: var(--accent-soft); }
