/* =====================================================================
   VARIÁVEIS GLOBAIS — Tema escuro com acentos dourados (Farol da Fluência)
   Cada um dos 9 apps tem trio de cores: principal, escura (gradiente),
   glow (rgba transparente para sombra/halo).
   ===================================================================== */
:root {
  --bg: #0a1628;
  --bg-deep: #050d18;
  --surface: #11233b;
  --border: rgba(255, 255, 255, 0.08);
  --text: #f5f1e8;
  --text-muted: #a6b1c2;
  --text-dim: #7a8aa3;
  --green: #4ade80;

  --c-dna:    #6366f1; --c-dna-2:    #3730a3; --c-dna-glow:    rgba(99,102,241,.30);
  --c-level:  #0d9488; --c-level-2:  #115e59; --c-level-glow:  rgba(13,148,136,.30);
  --c-ebook:  #38bdf8; --c-ebook-2:  #1e6ea8; --c-ebook-glow:  rgba(56,189,248,.28);
  --c-book:   #f4b942; --c-book-2:   #d99a2c; --c-book-glow:   rgba(244,185,66,.28);
  --c-cards:  #f87171; --c-cards-2:  #c0463d; --c-cards-glow:  rgba(248,113,113,.25);
  --c-subs:   #a78bfa; --c-subs-2:   #6d52d9; --c-subs-glow:   rgba(167,139,250,.26);
  --c-radio:  #34d399; --c-radio-2:  #138a64; --c-radio-glow:  rgba(52,211,153,.24);
  --c-voice:  #ec4899; --c-voice-2:  #a8326a; --c-voice-glow:  rgba(236,72,153,.26);
  --c-shadow: #fb923c; --c-shadow-2: #b85e1a; --c-shadow-glow: rgba(251,146,60,.26);
  --c-speak:  #22d3ee; --c-speak-2:  #0e7490; --c-speak-glow:  rgba(34,211,238,.26);
  --c-daily:  #a3e635; --c-daily-2:  #4d7c0f; --c-daily-glow:  rgba(163,230,53,.24);
  --c-meet:   #fb7185; --c-meet-2:   #be123c; --c-meet-glow:   rgba(251,113,133,.26);

  --header-h: 56px;

  /* Cor "ativa" — muda dinamicamente quando um app é aberto */
  --active-color: var(--c-book);
  --active-glow:  var(--c-book-glow);
}

/* =====================================================================
   RESET — sem highlight azul do iOS, sem margens, box-sizing global
   ===================================================================== */
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { background: var(--bg); height: 100%; }

body {
  font-family: 'DM Sans', system-ui, sans-serif;
  color: var(--text);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  height: 100dvh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Atmosfera: dois radial-gradients (dourado no topo + sky no canto inferior) */
body::before {
  content: '';
  position: fixed; inset: 0;
  background:
    radial-gradient(ellipse 90% 50% at 50% -10%, rgba(244,185,66,.10), transparent 55%),
    radial-gradient(ellipse 70% 40% at 110% 110%, rgba(56,189,248,.08), transparent 55%);
  pointer-events: none;
  z-index: 0;
}

/* Grain SVG sutil para textura */
body::after {
  content: '';
  position: fixed; inset: 0;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)' opacity='1'/></svg>");
  opacity: 0.025;
  pointer-events: none;
  z-index: 0;
  mix-blend-mode: overlay;
}

/* =====================================================================
   HEADER — sticky com backdrop blur, respeita safe-area-inset-top
   Logo dourada à esquerda · breadcrumb central (modo app) · ações direita
   ===================================================================== */
header {
  flex-shrink: 0;
  height: calc(var(--header-h) + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) 14px 0;
  background: rgba(10, 22, 40, 0.92);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
  position: relative;
  z-index: 100;
}

.logo {
  display: flex; align-items: center; gap: 10px;
  font-family: 'Fraunces', serif;
  font-variation-settings: 'opsz' 14;
  font-weight: 500;
  font-size: 16px;
  letter-spacing: -0.02em;
  cursor: pointer;
  flex-shrink: 0;
  padding: 6px 6px 6px 0;
  border-radius: 8px;
  background: none; border: 0;
  color: inherit;
}
.logo:active { transform: scale(0.96); }

.logo-mark {
  width: 32px; height: 32px;
  border-radius: 9px;
  background: linear-gradient(140deg, var(--c-book), var(--c-book-2));
  display: grid; place-items: center;
  box-shadow: 0 6px 16px var(--c-book-glow), inset 0 1px 0 rgba(255,255,255,.25);
  color: var(--bg-deep);
  flex-shrink: 0;
  transition: background 0.3s, box-shadow 0.3s;
}

/* Quando um app está ativo, o farol pega a cor do app */
body[data-mode="app"] .logo-mark {
  background: linear-gradient(140deg, var(--active-color), var(--active-color));
  box-shadow: 0 6px 16px var(--active-glow), inset 0 1px 0 rgba(255,255,255,.25);
}

.logo-text strong { color: var(--c-book); font-weight: 600; transition: color 0.3s; }
.logo-text { font-weight: 400; }
body[data-mode="app"] .logo-text strong { color: var(--active-color); }

/* Breadcrumb central — fade/slide-in quando entra em modo app */
.crumb {
  flex: 1; min-width: 0;
  display: flex; align-items: center; gap: 8px;
  opacity: 0;
  transform: translateX(-6px);
  transition: opacity 0.25s, transform 0.25s;
  pointer-events: none;
  overflow: hidden;
}
body[data-mode="app"] .crumb {
  opacity: 1;
  transform: translateX(0);
  pointer-events: auto;
}

.crumb-sep { color: var(--text-dim); font-size: 14px; flex-shrink: 0; }

.crumb-name {
  font-family: 'Fraunces', serif;
  font-variation-settings: 'opsz' 14;
  font-size: 15px;
  font-weight: 500;
  color: var(--active-color);
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-actions { display: flex; align-items: center; gap: 6px; margin-left: auto; }

.icon-btn {
  width: 36px; height: 36px;
  border-radius: 10px;
  display: grid; place-items: center;
  background: rgba(255,255,255,.04);
  border: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
}
.icon-btn:hover { background: rgba(255,255,255,.08); color: var(--text); }
.icon-btn:active { transform: scale(0.94); }
body[data-mode="home"] .icon-btn.app-only { display: none; }

.avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #4a7ba7, #2c5282);
  display: grid; place-items: center;
  font-family: 'Fraunces', serif;
  font-weight: 600;
  color: white;
  cursor: pointer;
  border: 1px solid var(--border);
  font-size: 14px;
  flex-shrink: 0;
}

/* =====================================================================
   MAIN — duas views absolutas sobrepostas, alternadas por body[data-mode]
   ===================================================================== */
main { flex: 1; min-height: 0; position: relative; overflow: hidden; }

#home-view {
  position: absolute; inset: 0;
  overflow-y: auto; overflow-x: hidden;
  transition: opacity 0.25s;
  z-index: 2;
}
body[data-mode="app"] #home-view { opacity: 0; pointer-events: none; }

#app-view {
  position: absolute; inset: 0;
  background: #fff;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
  z-index: 1;
}
body[data-mode="app"] #app-view { opacity: 1; pointer-events: auto; z-index: 3; }

.frame-wrap { position: relative; width: 100%; height: 100%; background: var(--bg); }
#app-frame { width: 100%; height: 100%; border: 0; background: white; display: block; }

/* Loader — spinner colorido com a cor do app ativo */
.frame-loader {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  background: var(--bg);
  z-index: 2;
  transition: opacity 0.4s;
  pointer-events: none;
}
.frame-loader[data-done="true"] { opacity: 0; }

.frame-loader-inner {
  display: flex; flex-direction: column;
  align-items: center; gap: 16px;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
}

.spinner {
  width: 32px; height: 32px;
  border-radius: 50%;
  border: 2.5px solid var(--border);
  border-top-color: var(--active-color);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Fallback — aparece se o iframe não carregar em 7s (X-Frame-Options/CSP) */
.frame-fallback {
  position: absolute; inset: 0;
  display: none;
  flex-direction: column;
  align-items: center; justify-content: center;
  padding: 32px;
  background: var(--bg);
  text-align: center;
  z-index: 4;
  gap: 16px;
}
.frame-fallback[data-show="true"] { display: flex; }

.frame-fallback h3 {
  font-family: 'Fraunces', serif;
  font-variation-settings: 'opsz' 80;
  font-size: 22px;
  font-weight: 500;
  color: var(--text);
  letter-spacing: -0.01em;
  line-height: 1.2;
}
.frame-fallback p {
  font-size: 14px;
  color: var(--text-muted);
  max-width: 320px;
  line-height: 1.55;
}
.frame-fallback a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 20px;
  border-radius: 10px;
  background: var(--active-color);
  color: var(--bg-deep);
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
  margin-top: 4px;
}

/* =====================================================================
   HOME VIEW — hero + section header + lista de cards
   ===================================================================== */
.home-container {
  width: 100%;
  max-width: 540px;
  margin: 0 auto;
  padding: 0 18px 28px;
  position: relative; z-index: 2;
}

.hero { padding: 28px 0 16px; }

.greeting {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--c-book);
  font-weight: 700;
  margin-bottom: 14px;
}
.greeting::before { content: ''; width: 24px; height: 1px; background: var(--c-book); }

h1 {
  font-family: 'Fraunces', serif;
  font-variation-settings: 'opsz' 144;
  font-weight: 400;
  font-size: 34px;
  letter-spacing: -0.03em;
  line-height: 1.04;
  margin-bottom: 12px;
}
h1 em { font-style: italic; color: var(--c-book); font-weight: 300; }

.hero-sub {
  font-size: 15px;
  color: var(--text-muted);
  line-height: 1.55;
  max-width: 460px;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: end;
  margin: 24px 0 14px;
}

.section-title {
  font-family: 'Fraunces', serif;
  font-variation-settings: 'opsz' 80;
  font-weight: 500;
  font-size: 20px;
  letter-spacing: -0.01em;
}

.section-meta {
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-weight: 600;
}

.apps-list { display: flex; flex-direction: column; gap: 12px; }

/* =====================================================================
   APP CARD — anatomia comum: ícone + body (head + name + estado)
   ===================================================================== */
.app-card {
  position: relative;
  display: flex;
  gap: 16px;
  align-items: stretch;
  background: linear-gradient(180deg, var(--surface), var(--bg-deep));
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 18px;
  cursor: pointer;
  overflow: hidden;
  color: inherit;
  text-decoration: none;
  transition: transform 0.25s cubic-bezier(.2,.8,.2,1), border-color .25s, box-shadow .3s;
  text-align: left;
  width: 100%;
  font-family: inherit;
}

.app-card:active { transform: scale(0.98); }
.app-card:hover { border-color: var(--card-color); box-shadow: 0 18px 40px -12px rgba(0,0,0,.5); }

/* Glow radial colorido no canto superior-direito */
.app-card::before {
  content: '';
  position: absolute;
  top: -40%; right: -30%;
  width: 70%; height: 180%;
  background: radial-gradient(ellipse at center, var(--card-glow), transparent 65%);
  opacity: 0.45;
  pointer-events: none;
  transition: opacity 0.3s;
}
.app-card:hover::before { opacity: 0.75; }

/* Faixa colorida vertical na borda esquerda */
.app-card::after {
  content: '';
  position: absolute;
  left: 0; top: 18px; bottom: 18px;
  width: 3px;
  background: linear-gradient(180deg, var(--card-color), var(--card-color-2));
  border-radius: 0 3px 3px 0;
  opacity: 0.7;
}

.app-icon {
  width: 60px; height: 60px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--card-color), var(--card-color-2));
  display: grid; place-items: center;
  color: var(--bg-deep);
  flex-shrink: 0;
  box-shadow: 0 8px 20px var(--card-glow), inset 0 1px 0 rgba(255,255,255,.25);
  position: relative; z-index: 1;
  align-self: flex-start;
}

.app-body {
  flex: 1; min-width: 0;
  position: relative; z-index: 1;
  display: flex; flex-direction: column; gap: 5px;
}

.app-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }

.app-tag {
  font-size: 10.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--card-color);
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.app-tag .pin {
  background: var(--card-glow);
  color: var(--card-color);
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 9.5px;
  letter-spacing: 0.12em;
  font-weight: 700;
}

.app-arrow {
  flex-shrink: 0;
  width: 28px; height: 28px;
  border-radius: 50%;
  display: grid; place-items: center;
  color: var(--card-color);
  background: rgba(255,255,255,.04);
  transition: transform .25s, background .25s, color .25s;
}

.app-card:hover .app-arrow {
  transform: translateX(3px);
  background: var(--card-color);
  color: var(--bg-deep);
}

.app-name {
  font-family: 'Fraunces', serif;
  font-variation-settings: 'opsz' 36;
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -0.018em;
  line-height: 1.1;
}

.app-current {
  font-size: 14px;
  color: var(--text);
  line-height: 1.4;
  margin-top: 3px;
  letter-spacing: -0.005em;
}
.app-current strong { color: var(--text); font-weight: 600; }
.app-current .meta { color: var(--text-muted); font-weight: 400; }

/* Barra de progresso genérica (usada por ebook, book, level, subs) */
.progress {
  display: flex; align-items: center; gap: 12px;
  margin-top: 7px;
  font-size: 12px;
  color: var(--text-dim);
  font-feature-settings: "tnum" 1, "lnum" 1;
  font-variant-numeric: tabular-nums lining-nums;
}
.progress-bar { flex: 1; height: 4px; background: rgba(255,255,255,.06); border-radius: 999px; overflow: hidden; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--card-color), var(--card-color-2)); border-radius: 999px; box-shadow: 0 0 10px var(--card-glow); }
.progress-num { color: var(--card-color); font-weight: 600; }

/* Badges (usados em flashcards: 🔥 7 dias / + 4 novas) */
.badge-row { display: flex; gap: 8px; margin-top: 7px; flex-wrap: wrap; }
.badge {
  font-size: 11.5px;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,.04);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-weight: 500;
}
.badge.hot { background: var(--card-glow); color: var(--card-color); border-color: transparent; font-weight: 600; }

/* Chips de versão (Longman 3000 / Oxford 5000) */
.version-chips {
  display: flex;
  gap: 6px;
  margin-top: 7px;
  flex-wrap: wrap;
}
.vchip {
  font-size: 10.5px;
  letter-spacing: 0.04em;
  padding: 3px 9px;
  border-radius: 6px;
  background: rgba(255,255,255,.04);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.vchip[data-active="true"] {
  background: var(--card-glow);
  color: var(--card-color);
  border-color: transparent;
}
.vchip-dot {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.7;
}

/* DNA modes — 3 mini-barras (Visual / Auditivo / Prático) */
.dna-modes {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}
.dna-mode {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.dna-mode-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-dim);
  font-weight: 600;
}
.dna-mode-head strong {
  font-feature-settings: "tnum" 1, "lnum" 1;
  font-variant-numeric: tabular-nums lining-nums;
  font-size: 11px;
  color: var(--text-muted);
}
.dna-mode[data-strong="true"] .dna-mode-head { color: var(--card-color); }
.dna-mode[data-strong="true"] .dna-mode-head strong { color: var(--card-color); }
.dna-mode-bar {
  height: 4px;
  background: rgba(255,255,255,.06);
  border-radius: 999px;
  overflow: hidden;
}
.dna-mode-fill {
  height: 100%;
  background: rgba(255,255,255,.18);
  border-radius: 999px;
  transition: width 0.6s cubic-bezier(.2,.8,.2,1);
}
.dna-mode[data-strong="true"] .dna-mode-fill {
  background: linear-gradient(90deg, var(--card-color), var(--card-color-2));
  box-shadow: 0 0 8px var(--card-glow);
}

/* CEFR badge (B1+) — selo gradiente com check */
.cefr-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px 3px 4px;
  border-radius: 6px;
  background: linear-gradient(135deg, var(--card-color), var(--card-color-2));
  color: var(--bg-deep);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.02em;
  box-shadow: 0 4px 10px var(--card-glow), inset 0 1px 0 rgba(255,255,255,.25);
}
.cefr-badge::before {
  content: '';
  width: 14px; height: 14px;
  border-radius: 4px;
  background: rgba(255,255,255,.25);
  display: grid;
  place-items: center;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23050d18' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'><polyline points='20 6 9 17 4 12'/></svg>");
  background-size: 80%;
  background-position: center;
  background-repeat: no-repeat;
}

/* Live dot (radio) — bolinha pulsante */
.live-dot {
  display: inline-block;
  width: 6px; height: 6px;
  background: var(--card-color);
  border-radius: 50%;
  animation: livePulse 1.4s infinite;
}
@keyframes livePulse {
  0%   { box-shadow: 0 0 0 0 var(--card-glow); }
  70%  { box-shadow: 0 0 0 6px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}

/* Waveform (radio) — 10 barrinhas verticais animadas */
.waveform { display: flex; align-items: center; gap: 3px; height: 18px; margin-top: 7px; }
.waveform span {
  display: block; width: 3px;
  background: linear-gradient(180deg, var(--card-color), var(--card-color-2));
  border-radius: 2px;
  animation: wave 1s ease-in-out infinite;
  opacity: .85;
}
.waveform span:nth-child(1)  { animation-delay: 0.0s; }
.waveform span:nth-child(2)  { animation-delay: 0.1s; }
.waveform span:nth-child(3)  { animation-delay: 0.2s; }
.waveform span:nth-child(4)  { animation-delay: 0.3s; }
.waveform span:nth-child(5)  { animation-delay: 0.4s; }
.waveform span:nth-child(6)  { animation-delay: 0.15s; }
.waveform span:nth-child(7)  { animation-delay: 0.25s; }
.waveform span:nth-child(8)  { animation-delay: 0.35s; }
.waveform span:nth-child(9)  { animation-delay: 0.05s; }
.waveform span:nth-child(10) { animation-delay: 0.45s; }
@keyframes wave { 0%,100% { height: 4px; } 50% { height: 16px; } }

/* Mapeamento das classes de cor para cada card (id → trio de variáveis) */
.app-card.dna    { --card-color: var(--c-dna);    --card-color-2: var(--c-dna-2);    --card-glow: var(--c-dna-glow); }
.app-card.level  { --card-color: var(--c-level);  --card-color-2: var(--c-level-2);  --card-glow: var(--c-level-glow); }
.app-card.ebook  { --card-color: var(--c-ebook);  --card-color-2: var(--c-ebook-2);  --card-glow: var(--c-ebook-glow); }
.app-card.book   { --card-color: var(--c-book);   --card-color-2: var(--c-book-2);   --card-glow: var(--c-book-glow);  }
.app-card.cards  { --card-color: var(--c-cards);  --card-color-2: var(--c-cards-2);  --card-glow: var(--c-cards-glow); }
.app-card.subs   { --card-color: var(--c-subs);   --card-color-2: var(--c-subs-2);   --card-glow: var(--c-subs-glow);  }
.app-card.radio  { --card-color: var(--c-radio);  --card-color-2: var(--c-radio-2);  --card-glow: var(--c-radio-glow); }
.app-card.voice  { --card-color: var(--c-voice);  --card-color-2: var(--c-voice-2);  --card-glow: var(--c-voice-glow); }
.app-card.shadow { --card-color: var(--c-shadow); --card-color-2: var(--c-shadow-2); --card-glow: var(--c-shadow-glow); }
.app-card.speak  { --card-color: var(--c-speak);  --card-color-2: var(--c-speak-2);  --card-glow: var(--c-speak-glow); }
.app-card.daily  { --card-color: var(--c-daily);  --card-color-2: var(--c-daily-2);  --card-glow: var(--c-daily-glow); }
.app-card.meet   { --card-color: var(--c-meet);   --card-color-2: var(--c-meet-2);   --card-glow: var(--c-meet-glow); }

/* WIP — visualmente mais discreto (volta ao normal no hover) */
.app-card[data-wip="true"] { opacity: 0.78; }
.app-card[data-wip="true"]:hover { opacity: 1; }

.pin-soon {
  background: rgba(255,255,255,.06);
  color: var(--text-muted);
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 9.5px;
  letter-spacing: 0.14em;
  font-weight: 700;
  border: 1px dashed rgba(255,255,255,.15);
}

/* POC — prova de conceito: selo colorido tracejado com a cor do card */
.pin-poc {
  background: var(--card-glow);
  color: var(--card-color);
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 9.5px;
  letter-spacing: 0.14em;
  font-weight: 700;
  border: 1px dashed var(--card-color);
}

.app-desc {
  font-size: 13.5px;
  color: var(--text-muted);
  line-height: 1.5;
  margin-top: 3px;
}

/* =====================================================================
   TOAST (em breve) — aparece no clique de cards/tabs WIP
   ===================================================================== */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom) + 24px);
  transform: translate(-50%, 20px);
  background: linear-gradient(180deg, var(--surface), var(--bg-deep));
  border: 1px solid var(--toast-color, var(--c-book));
  border-radius: 14px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 18px 40px -12px rgba(0,0,0,.6),
              0 0 0 4px var(--toast-glow, transparent);
  z-index: 200;
  max-width: calc(100% - 32px);
  width: 360px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s, transform 0.3s cubic-bezier(.2,.8,.2,1);
}

/* Em modo home, sem nav, posiciona acima da safe-area */
body[data-mode="home"] .toast {
  bottom: calc(env(safe-area-inset-bottom) + 16px);
}

.toast[data-show="true"] {
  opacity: 1;
  transform: translate(-50%, 0);
  pointer-events: auto;
}

.toast-icon {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--toast-color), var(--toast-color-2));
  display: grid; place-items: center;
  color: var(--bg-deep);
  flex-shrink: 0;
  box-shadow: 0 4px 10px var(--toast-glow), inset 0 1px 0 rgba(255,255,255,.25);
}

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

.toast-title {
  font-family: 'Fraunces', serif;
  font-variation-settings: 'opsz' 14;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
  line-height: 1.2;
}

.toast-msg {
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.4;
  margin-top: 2px;
}

.toast-close {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: rgba(255,255,255,.05);
  border: 0;
  color: var(--text-muted);
  cursor: pointer;
  display: grid; place-items: center;
  flex-shrink: 0;
  transition: background 0.2s;
}
.toast-close:hover { background: rgba(255,255,255,.1); color: var(--text); }

/* =====================================================================
   ANIMAÇÕES — fade-up dos cards na home (cascata)
   ===================================================================== */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

body[data-mode="home"] .hero,
body[data-mode="home"] .section-header,
body[data-mode="home"] .apps-list > * {
  animation: fadeUp 0.6s cubic-bezier(.2,.8,.2,1) backwards;
}

body[data-mode="home"] .hero          { animation-delay: 0.05s; }
body[data-mode="home"] .section-header { animation-delay: 0.12s; }
body[data-mode="home"] .apps-list > *:nth-child(1) { animation-delay: 0.18s; }
body[data-mode="home"] .apps-list > *:nth-child(2) { animation-delay: 0.24s; }
body[data-mode="home"] .apps-list > *:nth-child(3) { animation-delay: 0.30s; }
body[data-mode="home"] .apps-list > *:nth-child(4) { animation-delay: 0.36s; }
body[data-mode="home"] .apps-list > *:nth-child(5) { animation-delay: 0.42s; }
body[data-mode="home"] .apps-list > *:nth-child(6) { animation-delay: 0.48s; }
body[data-mode="home"] .apps-list > *:nth-child(7) { animation-delay: 0.54s; }
body[data-mode="home"] .apps-list > *:nth-child(8) { animation-delay: 0.60s; }
body[data-mode="home"] .apps-list > *:nth-child(9) { animation-delay: 0.66s; }
body[data-mode="home"] .apps-list > *:nth-child(10) { animation-delay: 0.72s; }
body[data-mode="home"] .apps-list > *:nth-child(11) { animation-delay: 0.78s; }
body[data-mode="home"] .apps-list > *:nth-child(12) { animation-delay: 0.84s; }

/* Tablet+ — relax do container */
@media (min-width: 720px) {
  .home-container { max-width: 700px; padding: 0 24px 28px; }
  h1 { font-size: 44px; }
  .hero-sub { font-size: 16px; }
}

/* =====================================================================
   MODAL DE IDENTIFICAÇÃO — gate na abertura do Player
   Fica visível por padrão; some quando :root[data-auth="ok"]
   ===================================================================== */
.auth-overlay {
  position: fixed; inset: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(env(safe-area-inset-top) + 20px) 18px calc(env(safe-area-inset-bottom) + 20px);
  background: rgba(5, 13, 24, 0.72);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  overflow-y: auto;
  animation: authFade 0.35s ease both;
}
:root[data-auth="ok"] .auth-overlay { display: none; }

@keyframes authFade { from { opacity: 0; } to { opacity: 1; } }

.auth-card {
  width: 100%;
  max-width: 380px;
  margin: auto;
  background: linear-gradient(180deg, var(--surface), var(--bg-deep));
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 28px 24px 22px;
  box-shadow: 0 24px 60px -18px rgba(0,0,0,.7), inset 0 1px 0 rgba(255,255,255,.05);
  animation: authPop 0.4s cubic-bezier(.2,.8,.2,1) both;
}
@keyframes authPop {
  from { opacity: 0; transform: translateY(16px) scale(.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.auth-mark {
  width: 46px; height: 46px;
  border-radius: 13px;
  background: linear-gradient(140deg, var(--c-book), var(--c-book-2));
  display: grid; place-items: center;
  color: var(--bg-deep);
  box-shadow: 0 8px 20px var(--c-book-glow), inset 0 1px 0 rgba(255,255,255,.25);
  margin-bottom: 16px;
}

.auth-title {
  font-family: 'Fraunces', serif;
  font-variation-settings: 'opsz' 40;
  font-weight: 500;
  font-size: 24px;
  letter-spacing: -0.02em;
  line-height: 1.15;
  color: var(--text);
}
.auth-title em { font-style: italic; color: var(--c-book); }

.auth-sub {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.45;
  margin: 8px 0 22px;
}

/* Aviso de Beta + consentimento de comunicações (email/WhatsApp) */
.auth-notice {
  background: rgba(244, 185, 66, 0.08);
  border: 1px solid rgba(244, 185, 66, 0.22);
  border-radius: 12px;
  padding: 13px 15px;
  margin-bottom: 20px;
  display: grid;
  gap: 11px;
}
.auth-notice p {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-muted);
}
.auth-notice p > span:last-child { flex: 1; min-width: 0; } /* texto num bloco só, quebra normal */
.auth-notice strong { color: var(--text); font-weight: 600; }
.auth-notice-ico {
  flex-shrink: 0;
  font-size: 15px;
  line-height: 1.5; /* alinha o emoji com a 1ª linha do texto */
}

.auth-field { display: block; margin-bottom: 14px; }
.auth-label {
  display: block;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-dim);
  margin-bottom: 6px;
  letter-spacing: 0.01em;
}
.auth-field input {
  width: 100%;
  font-family: inherit;
  font-size: 16px; /* 16px evita zoom no iOS */
  color: var(--text);
  background: rgba(255,255,255,.04);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 13px 14px;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}
.auth-field input::placeholder { color: var(--text-dim); }
.auth-field input:focus {
  outline: none;
  border-color: var(--c-book);
  background: rgba(255,255,255,.06);
  box-shadow: 0 0 0 3px var(--c-book-glow);
}

.auth-extra[hidden] { display: none; }
.auth-extra {
  animation: authReveal 0.35s cubic-bezier(.2,.8,.2,1) both;
}
@keyframes authReveal {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.auth-error {
  font-size: 13px;
  color: #fca5a5;
  line-height: 1.4;
  margin: -4px 0 12px;
}
.auth-error[hidden] { display: none; }

.auth-btn {
  width: 100%;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  color: var(--bg-deep);
  background: linear-gradient(140deg, var(--c-book), var(--c-book-2));
  border: 0;
  border-radius: 12px;
  padding: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 8px 20px var(--c-book-glow);
  transition: transform 0.15s, opacity 0.2s, box-shadow 0.2s;
}
.auth-btn:active { transform: scale(0.98); }
.auth-btn:disabled { opacity: 0.65; cursor: default; }

.auth-spinner {
  width: 16px; height: 16px;
  border-radius: 50%;
  border: 2px solid rgba(5,13,24,.35);
  border-top-color: var(--bg-deep);
  display: none;
  animation: spin 0.7s linear infinite;
}
.auth-overlay[data-loading="true"] .auth-spinner { display: inline-block; }

.auth-legal {
  font-size: 11.5px;
  color: var(--text-dim);
  line-height: 1.4;
  text-align: center;
  margin-top: 16px;
}
