/* Lume | design system dark cinema
   bg #000 | superfície #15130d | AMARELO da marca #FFC107 | texto #F8FAFC */

:root {
  --bg: #000000;
  --surface: #16140e;
  --surface-2: #211e14;
  --text: #F8FAFC;
  --muted: #a3a091;
  --glow-a: #FFD84A;
  --glow-b: #FFC107;
  --on-accent: #171204;
  --grad: linear-gradient(135deg, #FFD84A 0%, #FFB300 100%);
  --radius: 16px;
  --rail-w: 64px;
  --col-half: min(50vw, 28.2dvh);
}

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

/* hidden perde pra display explícito (flex/grid) sem isso */
[hidden] { display: none !important; }

html {
  background: var(--bg);
  height: 100%;
  overscroll-behavior: none;
}

body {
  font-family: 'Inter', -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  height: 100%;
  overflow: hidden;
}

/* paginador estilo TikTok: a página não rola, o trilho desliza */
#feed {
  position: fixed;
  inset: 0;
  overflow: hidden;
  touch-action: none;
}

#track {
  height: 100%;
  will-change: transform;
  transition: transform .45s cubic-bezier(.22, .9, .32, 1);
}

#track.dragging { transition: none; }

/* modo imersivo: a interface some enquanto assiste, volta no toque */
.topbar, .rail, .mute-hint, .ep-info { transition: opacity .35s ease; }
body.ui-hidden .topbar,
body.ui-hidden .rail,
body.ui-hidden .mute-hint,
body.ui-hidden .ep-info { opacity: 0; pointer-events: none; }

h1, h2, h3, .brand span { font-family: 'Outfit', 'Inter', sans-serif; }

button { font-family: inherit; border: 0; background: none; color: inherit; cursor: pointer; }

/* ---------- topbar ---------- */

.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: calc(env(safe-area-inset-top, 0px) + 14px) 20px 28px;
  background: linear-gradient(to bottom, rgba(0,0,0,.75), rgba(0,0,0,0));
  pointer-events: none;
}

.brand { display: flex; align-items: center; gap: 8px; }
.brand svg { width: 28px; height: 28px; }
.brand span {
  font-family: 'Quicksand', 'Outfit', sans-serif;
  font-size: 21px;
  font-weight: 700;
  letter-spacing: .01em;
  color: #FFC107;
}

.topbar-serie {
  font-size: 13px;
  color: var(--muted);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------- aviso de som ---------- */

.mute-hint {
  position: fixed;
  top: calc(env(safe-area-inset-top, 0px) + 64px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 999px;
  background: rgba(18,18,28,.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  font-size: 13px;
  font-weight: 500;
  border: 1px solid rgba(255,255,255,.12);
  white-space: nowrap;
}
.mute-hint svg { width: 16px; height: 16px; flex-shrink: 0; }

/* ---------- feed ---------- */

.ep {
  height: 100%;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.stage {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--surface);
}

.stage video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* selo da Lume por cima da marca d'água de origem do vídeo */
.brand-patch {
  position: absolute;
  z-index: 6;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .38em;
  background: rgba(8, 8, 12, .97);
  pointer-events: none;
  font-family: 'Quicksand', 'Outfit', sans-serif;
  font-weight: 700;
  color: #FFC107;
  letter-spacing: .01em;
}
.brand-patch svg { width: 1.2em; height: 1.2em; flex-shrink: 0; }
.brand-patch.compact span { display: none; }

/* com o selo ativo, a marca da tela é o próprio selo (evita Lume duplicado) */
body.brand-patched .topbar .brand { display: none; }
body.brand-patched .topbar-serie { font-size: 14px; color: #d8d5c9; }

.ep-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: radial-gradient(120% 90% at 50% 10%, #1d1d30 0%, #0a0a12 65%);
  color: var(--muted);
  font-size: 14px;
  text-align: center;
  padding: 24px;
}
.ep-placeholder strong { color: var(--text); font-size: 18px; font-family: 'Outfit', sans-serif; }

.ep-info {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 80px 20px calc(env(safe-area-inset-bottom, 0px) + 26px);
  background: linear-gradient(to top, rgba(0,0,0,.85) 0%, rgba(0,0,0,.35) 60%, rgba(0,0,0,0) 100%);
  pointer-events: none;
}

.ep-num {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--on-accent);
  background: var(--grad);
  padding: 4px 10px;
  border-radius: 6px;
  margin-bottom: 10px;
}

.ep-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 6px;
}

/* altura reservada + reticências: o texto muda por episódio */
.ep-desc {
  font-size: 14px;
  line-height: 1.5;
  color: rgba(248,250,252,.82);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 42px;
  max-width: 480px;
}

/* barra de progresso interativa: área de toque generosa, trilho fino */
.progress {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 30px;
  display: flex;
  align-items: flex-end;
  z-index: 5;
  cursor: pointer;
  touch-action: none;
  transition: opacity .35s ease;
}
.progress-track {
  position: relative;
  width: 100%;
  height: 3px;
  background: rgba(255,255,255,.18);
  transition: height .15s ease;
}
.progress-fill {
  height: 100%;
  width: 0%;
  background: var(--grad);
}
.progress.scrubbing .progress-track,
body:not(.ui-hidden) .progress:hover .progress-track { height: 7px; }

body.ui-hidden .progress { opacity: 0; pointer-events: none; }

.play-flag {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity .18s ease;
}
.play-flag svg {
  width: 72px; height: 72px;
  filter: drop-shadow(0 4px 24px rgba(0,0,0,.6));
}
.stage.paused .play-flag { opacity: 1; }

/* ---------- bloqueado / oferta ---------- */

.locked-cover {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 24px;
  background: radial-gradient(120% 90% at 50% 0%, #1a1712 0%, #0a0a0d 70%);
  overflow: hidden;
}

/* take do episódio com blur forte por trás do popup */
.locked-cover .poster-blur {
  position: absolute;
  inset: -40px;
  background-size: cover;
  background-position: center;
  filter: blur(30px) brightness(.6) saturate(1.2);
}

.locked-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 12px;
  width: 100%;
  max-width: 332px;
  padding: 28px 20px 22px;
  border-radius: 22px;
  background: rgba(16, 15, 10, .82);
  border: 1px solid rgba(255,255,255,.1);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: 0 24px 70px rgba(0,0,0,.55);
}

.lock-badge {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: var(--grad);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 40px rgba(255,193,7,.35);
}
.lock-badge svg { width: 28px; height: 28px; }

.locked-card h2 { font-size: 21px; font-weight: 800; }
.locked-card p { font-size: 13.5px; color: var(--muted); line-height: 1.55; }
.locked-card .btn-primary { margin-top: 4px; font-size: 13.5px; padding: 14px 8px; line-height: 1.35; }
.locked-social { font-size: 13px; color: rgba(248,250,252,.75); display: flex; align-items: center; justify-content: center; gap: 6px; }
.locked-cover .btn-primary strong { white-space: nowrap; }

/* overlay do corte: o vídeo do ep de corte toca e o paywall estoura em cima */
.locked-cover.gate-overlay {
  display: none;
  z-index: 12;
  background: rgba(4,4,10,.45);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
}
.stage.gate-cut .gate-overlay {
  display: flex;
  animation: gateIn .5s cubic-bezier(.2, .9, .3, 1);
}
@keyframes gateIn {
  from { opacity: 0; transform: translateY(48px); }
  to { opacity: 1; transform: none; }
}
.stage.gate-cut .ep-info, .stage.gate-cut .progress { visibility: hidden; }
.locked-social svg { width: 14px; height: 14px; fill: #FFC107; }

/* ---------- rail lateral ---------- */

/* em episódio bloqueado a tela fica limpa: sem rail e sem aviso de som */
body.on-locked .rail,
body.on-locked .mute-hint { display: none !important; }

.rail {
  position: fixed;
  right: 12px;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 110px);
  z-index: 25;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.rail-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  width: var(--rail-w);
  color: var(--text);
}

.rail-btn > svg {
  width: 48px;
  height: 48px;
  padding: 12px;
  border-radius: 50%;
  background: rgba(18,18,28,.72);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,.1);
  transition: background .2s ease, border-color .2s ease;
}
.rail-btn:hover > svg { background: rgba(40,40,58,.85); border-color: rgba(255,255,255,.22); }

.icon-heart { fill: #fff; transition: fill .2s ease; }
.rail-btn.liked .icon-heart { fill: #FFC107; }
.rail-btn.liked > svg { border-color: rgba(255,193,7,.55); }

.rail-count { font-size: 11px; font-weight: 600; text-shadow: 0 1px 6px rgba(0,0,0,.8); }

/* ---------- drawer de episódios ---------- */

.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(0,0,0,.6);
}

.drawer {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 41;
  background: var(--surface);
  border-radius: 20px 20px 0 0;
  padding: 22px 20px calc(env(safe-area-inset-bottom, 0px) + 22px);
  max-height: 72dvh;
  overflow-y: auto;
  border-top: 1px solid rgba(255,255,255,.08);
}

.drawer-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 18px;
}
.drawer-head h2 { font-size: 18px; font-weight: 700; }
.drawer-head p { font-size: 13px; color: var(--muted); margin-top: 3px; }

.drawer-close {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .2s ease;
}
.drawer-close:hover { background: #262638; }
.drawer-close svg { width: 16px; height: 16px; }

.drawer-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 10px;
}

.ep-cell {
  position: relative;
  aspect-ratio: 1;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid rgba(255,255,255,.07);
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .2s ease, border-color .2s ease;
}
.ep-cell:hover { background: #262638; }
.ep-cell.current {
  background: rgba(255,193,7,.14);
  border-color: #FFC107;
}
.ep-cell .cell-lock {
  position: absolute;
  top: -5px; right: -5px;
  width: 18px; height: 18px;
  border-radius: 6px;
  background: var(--grad);
  display: flex;
  align-items: center;
  justify-content: center;
}
.ep-cell .cell-lock svg { width: 10px; height: 10px; }

.drawer-cta {
  margin-top: 18px;
  width: 100%;
  padding: 15px;
  border-radius: 14px;
  background: var(--grad);
  color: var(--on-accent);
  font-size: 15px;
  font-weight: 700;
  transition: filter .2s ease;
}
.drawer-cta:hover { filter: brightness(1.08); }

/* ---------- modal do paywall ---------- */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(0,0,0,.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.modal {
  position: relative;
  width: 100%;
  max-width: 440px;
  background: var(--surface);
  border-radius: 22px 22px 0 0;
  padding: 30px 24px calc(env(safe-area-inset-bottom, 0px) + 28px);
  border: 1px solid rgba(255,255,255,.08);
  max-height: 92dvh;
  overflow-y: auto;
}

.modal-close {
  position: absolute;
  top: 14px; right: 14px;
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .2s ease;
  z-index: 2;
}
.modal-close:hover { background: #262638; }
.modal-close svg { width: 16px; height: 16px; }

.pw-eyebrow {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 8px;
}

.pw-step h3 { font-size: 22px; font-weight: 800; margin-bottom: 8px; }
.pw-sub { font-size: 14px; color: var(--muted); line-height: 1.55; margin-bottom: 20px; }
.pw-sub strong { color: var(--text); }

#pwForm label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 14px;
}

#pwForm input {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 13px 14px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.12);
  background: var(--surface-2);
  color: var(--text);
  font-size: 16px;
  font-family: inherit;
  outline: none;
  transition: border-color .2s ease;
}
#pwForm input:focus { border-color: var(--glow-b); }
#pwForm input.invalid { border-color: #f43f5e; }

.field-error { display: block; color: #fb7185; font-size: 11px; margin-top: 4px; min-height: 13px; font-weight: 500; }

.pw-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.btn-primary {
  width: 100%;
  padding: 16px;
  border-radius: 14px;
  background: var(--grad);
  color: var(--on-accent);
  font-size: 16px;
  font-weight: 700;
  margin-top: 6px;
  transition: filter .2s ease, opacity .2s ease;
  box-shadow: 0 8px 30px rgba(255,193,7,.25);
}
.btn-primary:hover { filter: brightness(1.08); }
.btn-primary:disabled { opacity: .6; cursor: default; }

.btn-whats {
  width: 100%;
  margin-top: 12px;
  padding: 14px;
  border-radius: 14px;
  background: none;
  border: 1px solid rgba(255,255,255,.14);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: border-color .2s ease, background .2s ease;
}
.btn-whats:hover { border-color: #25D366; background: rgba(37,211,102,.08); }
.btn-whats svg { width: 18px; height: 18px; color: #25D366; }

/* pix */

.pix-qr {
  display: flex;
  justify-content: center;
  margin: 4px 0 16px;
}
#qrBox {
  background: #fff;
  padding: 14px;
  border-radius: 16px;
  line-height: 0;
}
#qrBox img, #qrBox canvas { width: 200px !important; height: 200px !important; }

.btn-copy {
  width: 100%;
  padding: 14px;
  border-radius: 14px;
  background: var(--surface-2);
  border: 1px solid rgba(255,255,255,.14);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: border-color .2s ease;
}
.btn-copy:hover { border-color: rgba(255,255,255,.3); }
.btn-copy svg { width: 16px; height: 16px; }

.pix-status {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 18px;
  font-size: 14px;
  color: var(--muted);
}

.pix-spinner {
  width: 16px; height: 16px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,.15);
  border-top-color: var(--glow-b);
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.pix-expira { text-align: center; font-size: 12px; color: var(--muted); margin-top: 8px; }

/* sucesso */

.pw-success { text-align: center; }
.success-burst {
  width: 84px; height: 84px;
  margin: 6px auto 18px;
  border-radius: 50%;
  background: var(--grad);
  color: var(--on-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 50px rgba(255,193,7,.4);
  animation: pop .45s cubic-bezier(.2, 1.4, .4, 1);
}
.success-burst svg { width: 38px; height: 38px; }
@keyframes pop { 0% { transform: scale(.3); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }

.pw-error {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(244,63,94,.12);
  border: 1px solid rgba(244,63,94,.35);
  color: #fda4af;
  font-size: 13px;
  line-height: 1.5;
}

/* ---------- toast ---------- */

.toast {
  position: fixed;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 28px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 60;
  background: rgba(18,18,28,.92);
  border: 1px solid rgba(255,255,255,.14);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  padding: 12px 20px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
}

/* ---------- desktop ---------- */

@media (min-width: 768px) {
  .stage {
    width: calc(var(--col-half) * 2);
    height: 100%;
    border-radius: 0;
  }

  .ep::before {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(60% 50% at 50% 40%, rgba(255,193,7,.06) 0%, rgba(0,0,0,0) 70%);
    pointer-events: none;
  }

  .rail {
    right: auto;
    left: calc(50% + var(--col-half) + 22px);
    bottom: 90px;
  }

  .modal-backdrop { align-items: center; padding: 24px; }
  .modal { border-radius: 22px; }

  .locked-cover { padding: 32px 28px; }

  .drawer {
    left: auto;
    top: 0;
    bottom: 0;
    width: 400px;
    max-height: none;
    border-radius: 0;
    border-left: 1px solid rgba(255,255,255,.08);
    padding-top: 30px;
  }

  .ep-desc { min-height: 42px; }
}

/* ---------- acessibilidade ---------- */

button:focus-visible, input:focus-visible {
  outline: 2px solid var(--glow-b);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
