/* ═══════════════════════════════════════════════
   DoramaQueen — Design System & Styles
   Mobile-first, dark theme, glassmorphism
   ═══════════════════════════════════════════════ */

/* ─── CSS Variables ─── */
:root {
  /* Paleta turca: vermelho, preto e branco. Sem gradiente em lugar nenhum —
     além do visual mais limpo, gradiente é uma superfície a mais para o
     navegador pintar, e o alvo aqui inclui TV Android antiga.

     Os vermelhos são os mesmos da landing (landing.css), de propósito: quem
     vem do anúncio e entra no app tem que sentir que é o mesmo produto. */
  --bg-primary: #0b0605;      /* preto quente, igual ao --ink da landing */
  --bg-secondary: #140d0c;
  --bg-tertiary: #1d1412;
  --bg-card: #140d0c;
  --bg-card-hover: #241816;
  /* "glass" ficou só no nome: sem blur (ver a nota sobre backdrop-filter mais
     abaixo), o que sobra é fundo sólido. Renomear tocaria em 30 lugares. */
  --bg-glass: #100a09;
  --bg-glass-strong: #0d0706;

  --accent-primary: #e8323d;   /* --crimson-bright da landing */
  --accent-secondary: #c81f2e; /* --crimson da landing */
  --accent-glow: rgba(232, 50, 61, 0.3);

  --text-primary: #f4f1ef;     /* branco levemente quente: branco puro num
                                  preto quente vibra e cansa a vista */
  --text-secondary: #b0a5a1;
  --text-tertiary: #756a67;
  --text-accent: #e8323d;

  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-accent: rgba(232, 50, 61, 0.4);

  --danger: #f87171;
  --success: #4ade80;
  --warning: #fbbf24;

  /* Spacing */
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --header-height: 56px;

  /* Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 20px var(--accent-glow);

  /* Transitions */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --duration-fast: 150ms;
  --duration-normal: 250ms;
  --duration-slow: 400ms;

  /* Typography */
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-display: 'Outfit', 'Inter', sans-serif;
}

/* ─── Reset & Base ─── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  min-height: 100dvh;
}

#app {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* Remove default focus outline, add custom */
:focus {
  outline: none;
}

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

input, button, textarea {
  font-family: inherit;
  font-size: inherit;
  border: none;
  background: none;
  color: inherit;
}

/* ═══════════════════════════════════════
   SPLASH SCREEN
   ═══════════════════════════════════════ */
.splash-screen {
  position: fixed;
  top: 0; right: 0; bottom: 0; left: 0;
  z-index: 9999;
  background: var(--bg-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.5s var(--ease-out), visibility 0.5s;
}

.splash-screen.fade-out {
  opacity: 0;
  visibility: hidden;
}

.splash-content {
  text-align: center;
  animation: splashIn 0.8s var(--ease-spring);
}

.splash-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 12px;
}

.logo-icon {
  font-size: 3rem;
  filter: drop-shadow(0 0 20px rgba(232, 50, 61, 0.5));
  animation: crownFloat 2s ease-in-out infinite;
}

/* Logo quadrado do app (login, splash e tela de bloqueio). A marca já traz o
   nome escrito, então dispensa o texto ao lado que existia com o emoji. */
.logo-mark {
  width: 112px;
  height: 112px;
  display: block;
  filter: drop-shadow(0 8px 28px rgba(0, 0, 0, 0.55));
}

.splash-logo .logo-mark {
  width: 128px;
  height: 128px;
  animation: crownFloat 2s ease-in-out infinite;
}

@media (max-width: 360px) {
  .logo-mark,
  .splash-logo .logo-mark { width: 92px; height: 92px; }
}

.logo-text {
  font-family: var(--font-display);
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--accent-primary);
  letter-spacing: -0.5px;
}

.splash-tagline {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-bottom: 32px;
  font-weight: 300;
  letter-spacing: 1px;
}

.splash-loader {
  width: 120px;
  height: 3px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
  margin: 0 auto;
  overflow: hidden;
}

.loader-bar {
  height: 100%;
  width: 40%;
  background: var(--accent-primary);
  border-radius: var(--radius-full);
  animation: loaderSlide 1.2s ease-in-out infinite;
}

@keyframes splashIn {
  from { opacity: 0; transform: scale(0.9) translateY(20px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes crownFloat {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-6px) rotate(3deg); }
}

@keyframes loaderSlide {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(350%); }
}

/* ═══════════════════════════════════════
   LOGIN SCREEN (código de 4 dígitos)
   ═══════════════════════════════════════ */
.login-screen {
  position: fixed;
  top: 0; right: 0; bottom: 0; left: 0;
  z-index: 10000;
  background: var(--bg-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  padding-top: calc(24px + var(--safe-top));
  padding-bottom: calc(24px + var(--safe-bottom));
  transition: opacity 0.5s var(--ease-out), visibility 0.5s;
}

/* Ancorado no rodapé em vez de entrar no fluxo: .login-screen é um flex
   centralizado, e um irmão de .login-content viraria uma segunda coluna e
   tiraria o formulário do centro. */
.login-footer {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(14px + var(--safe-bottom));
  text-align: center;
  font-size: 0.78rem;
}

.login-footer a {
  color: var(--text-secondary);
  opacity: 0.65;
  text-decoration: none;
  padding: 8px 12px; /* alvo de toque confortável apesar da fonte pequena */
}

.login-footer a:hover,
.login-footer a:focus-visible {
  opacity: 1;
  text-decoration: underline;
}

.login-screen.fade-out {
  opacity: 0;
  visibility: hidden;
}

.login-content {
  width: 100%;
  max-width: 360px;
  text-align: center;
  animation: splashIn 0.8s var(--ease-spring);
}

.login-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 12px;
}

.login-tagline {
  color: var(--text-secondary);
  font-size: 1.05rem;
  margin-bottom: 32px;
  font-weight: 400;
}

.login-form {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.login-digits {
  display: flex;
  gap: 14px;
  justify-content: center;
}

.login-digit {
  width: 64px;
  height: 76px;
  text-align: center;
  font-family: var(--font-display);
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--text-primary);
  background: var(--bg-tertiary);
  border: 2px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  transition: border-color var(--duration-normal) var(--ease-out), box-shadow var(--duration-normal) var(--ease-out);
}

.login-digit:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 4px var(--accent-glow);
}

.login-digit.filled {
  border-color: var(--border-accent);
}

.login-error {
  color: var(--danger);
  font-size: 0.95rem;
  font-weight: 500;
}

.login-submit {
  font-size: 1.1rem;
  padding: 18px 24px;
}

.login-trial {
  margin-top: 12px;
  padding: 14px 24px;
  font-size: 0.95rem;
  background: #25d366;
  color: #fff;
  text-decoration: none;
}

.login-trial:hover {
  background: #2fe075;
}

/* Botão de verdade, não link sublinhado: boa parte do público tem 60+ e texto
   sublinhado no meio da tela não se lê como "aperte aqui" — fica parecendo
   aviso. Vem junto com .btn .btn-ghost .btn-lg .btn-block no HTML; aqui só o
   espaçamento e o contraste, que o cinza padrão do ghost não entrega. */
.login-support {
  margin-top: 12px;
  color: var(--text-primary);
  border-color: var(--text-tertiary);
}

.login-support:hover,
.login-support:focus-visible {
  color: var(--text-primary);
  border-color: var(--accent-primary);
}

/* Separa o secundário do bloco de ações principais logo acima. */
.login-support--afastado {
  margin-top: 24px;
}

/* ═══════════════════════════════════════
   TRIAL EXPIRADO (bloqueio de acesso)
   ═══════════════════════════════════════ */
.trial-expired-overlay {
  position: fixed;
  top: 0; right: 0; bottom: 0; left: 0;
  z-index: 10000;
  background: var(--bg-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  padding-top: calc(24px + var(--safe-top));
  padding-bottom: calc(24px + var(--safe-bottom));
}

.trial-expired-overlay.hidden {
  display: none;
}

.trial-expired-card {
  width: 100%;
  max-width: 360px;
  text-align: center;
  animation: splashIn 0.8s var(--ease-spring);
}

.trial-expired-title {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-top: 20px;
  margin-bottom: 12px;
}

.trial-expired-text {
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.6;
  margin-bottom: 28px;
}

/* ═══════════════════════════════════════
   HEADER
   ═══════════════════════════════════════ */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-height);
  padding: 0 16px;
  padding-top: var(--safe-top);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-glass-strong);
  border-bottom: 1px solid var(--border-subtle);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-logo {
  font-size: 1.5rem;
  line-height: 1;
}

.header-title {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--accent-primary);
}

/* Wordmark horizontal no header do app. Altura fixa e largura automática:
   a arte é 980x250, então travar a altura preserva a proporção sozinha.
   O teto é o header de 56px: acima de ~36px a marca encosta nas bordas, e a
   largura (3,9x a altura) começa a disputar espaço com o botão de suporte. */
.header-wordmark {
  height: 34px;
  width: auto;
  display: block;
}

@media (max-width: 380px) {
  .header-wordmark { height: 28px; }
}

.header-right {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ─── Trial countdown / plan-expiry bar ───
   Fica FORA do .app-header, como uma faixa própria de largura total —
   dentro do header não sobra espaço ao lado do botão de suporte em telas
   de celular comuns (~390px), o que empurrava o CTA pra fora da viewport
   (body tem overflow-x: hidden, então ficava inacessível). */
.trial-bar {
  position: sticky;
  top: var(--header-height);
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 8px 16px;
  background: var(--bg-glass-strong);
  border-bottom: 1px solid var(--border-subtle);
}

.trial-bar.hidden {
  display: none;
}

.trial-countdown {
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  white-space: nowrap;
}

.trial-buy-btn {
  display: flex;
  align-items: center;
  height: 32px;
  padding: 0 12px;
  border-radius: var(--radius-full);
  background: var(--accent-primary);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  text-decoration: none;
  white-space: nowrap;
  transition: filter var(--duration-fast) ease;
}

.trial-buy-btn:hover,
.trial-buy-btn:active {
  filter: brightness(1.1);
}

/* ─── Aviso de vencimento (planos pagos) ─── */
.plan-expiry-text {
  color: var(--warning);
}

.plan-expiry-text--urgent {
  color: var(--danger);
}

/* ─── Support Button (WhatsApp) ─── */
.support-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 14px;
  border-radius: var(--radius-full);
  background: rgba(37, 211, 102, 0.15);
  color: #25d366;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: all var(--duration-fast) ease;
}

.support-btn:hover,
.support-btn:active {
  background: rgba(37, 211, 102, 0.28);
  color: #2fe075;
}

/* ─── Icon Button ─── */
.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--duration-fast) ease;
  position: relative;
  overflow: hidden;
}

.icon-btn::before {
  content: '';
  position: absolute;
  top: 0; right: 0; bottom: 0; left: 0;
  border-radius: inherit;
  background: rgba(232, 50, 61, 0.12);
  opacity: 0;
  transition: opacity var(--duration-fast) ease;
}

.icon-btn:hover,
.icon-btn:active {
  color: var(--text-primary);
}

.icon-btn:hover::before,
.icon-btn:active::before {
  opacity: 1;
}

.icon-btn:active {
  transform: scale(0.92);
}

/* ═══════════════════════════════════════
   SEARCH BAR
   ═══════════════════════════════════════ */
.search-bar {
  padding: 8px 16px 12px;
  background: var(--bg-glass-strong);
  animation: slideDown var(--duration-normal) var(--ease-out);
}

.search-bar.hidden {
  display: none;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

.search-input-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  padding: 10px 16px;
  transition: border-color var(--duration-fast) ease;
}

.search-input-wrap:focus-within {
  border-color: var(--border-accent);
  box-shadow: 0 0 0 3px rgba(232, 50, 61, 0.1);
}

.search-icon {
  color: var(--text-tertiary);
  flex-shrink: 0;
}

.search-input-wrap input {
  flex: 1;
  font-size: 0.9rem;
  color: var(--text-primary);
  min-width: 0;
}

.search-input-wrap input::placeholder {
  color: var(--text-tertiary);
}

.search-clear {
  cursor: pointer;
  color: var(--text-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2px;
  transition: color var(--duration-fast) ease;
}

.search-clear:hover {
  color: var(--text-primary);
}

/* ═══════════════════════════════════════
   MAIN CONTENT
   ═══════════════════════════════════════ */
.main-content {
  flex: 1;
  padding: 0 0 calc(24px + var(--safe-bottom));
  overflow-y: auto;
}

/* ─── Empty State ─── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 60px 32px;
  min-height: calc(100vh - var(--header-height) - 40px);
  min-height: calc(100dvh - var(--header-height) - 40px);
  animation: fadeInUp 0.6s var(--ease-out);
}

.empty-state.hidden {
  display: none;
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: translateY(0); }
}

.empty-illustration {
  margin-bottom: 28px;
}

.empty-circle {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: rgba(232, 50, 61, 0.12);
  border: 1px solid var(--border-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-primary);
  animation: pulse 3s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 var(--accent-glow); }
  50% { transform: scale(1.05); box-shadow: 0 0 30px var(--accent-glow); }
}

.empty-title {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 10px;
  color: var(--text-primary);
}

.empty-desc {
  color: var(--text-secondary);
  font-size: 0.9rem;
  max-width: 320px;
  line-height: 1.6;
  margin-bottom: 32px;
}

.empty-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  max-width: 280px;
}

/* ─── Buttons ─── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 600;
  /* Metade dos botões do app é <a> (checkout, WhatsApp), e link sublinhado
     dentro de um botão vermelho não vira "mais clicável" — vira ruído, ainda
     mais pra quem tem 60+. Cada .btn que é link zerava isso por conta
     própria, ou esquecia. */
  text-decoration: none;
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--duration-normal) var(--ease-out);
  white-space: nowrap;
  position: relative;
  overflow: hidden;
}

.btn:active {
  transform: scale(0.97);
}

.btn-sm {
  padding: 8px 16px;
  font-size: 0.8rem;
}

.btn-md {
  padding: 10px 20px;
  font-size: 0.875rem;
}

.btn-lg {
  padding: 14px 24px;
  font-size: 0.95rem;
}

.btn-block {
  width: 100%;
}

.btn-primary {
  background: var(--accent-primary);
  color: #fff;
  font-weight: 700;
  box-shadow: var(--shadow-glow);
}

.btn-primary:hover {
  box-shadow: 0 0 30px var(--accent-glow);
  transform: translateY(-1px);
}

.btn-primary:active {
  transform: scale(0.97) translateY(0);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
}

.btn-ghost:hover {
  color: var(--text-primary);
  border-color: var(--border-accent);
  background: rgba(232, 50, 61, 0.12);
}

/* ─── Category Tabs ─── */
.category-tabs {
  padding: 12px 0 4px;
  border-bottom: 1px solid var(--border-subtle);
}

.category-tabs.hidden {
  display: none;
}

.tabs-scroll {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  padding: 0 16px 8px;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.tabs-scroll::-webkit-scrollbar {
  display: none;
}

.tab-btn {
  flex-shrink: 0;
  padding: 8px 18px;
  border-radius: var(--radius-full);
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-tertiary);
  cursor: pointer;
  transition: all var(--duration-fast) ease;
  background: transparent;
  border: 1px solid transparent;
}

.tab-btn:hover {
  color: var(--text-secondary);
  background: var(--bg-tertiary);
}

.tab-btn.active {
  color: #fff;
  background: var(--accent-primary);
  border-color: transparent;
  box-shadow: var(--shadow-glow);
  font-weight: 600;
}

/* ─── Channel Grid ─── */
.channel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
  padding: 16px;
}

.channel-grid.hidden {
  display: none;
}

.channel-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
  transition: all var(--duration-normal) var(--ease-out);
  animation: cardIn 0.4s var(--ease-out) both;
  position: relative;
}

.channel-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md), 0 0 20px rgba(232, 50, 61, 0.1);
}

.channel-card:active {
  transform: scale(0.97);
}

@keyframes cardIn {
  from { opacity: 0; transform: scale(0.92) translateY(12px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.card-thumb {
  width: 100%;
  aspect-ratio: 3 / 4;
  background: var(--bg-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card-thumb-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--text-tertiary);
  font-size: 0.7rem;
  padding: 8px;
  text-align: center;
}

.card-thumb-placeholder svg {
  opacity: 0.4;
}

.card-play-overlay {
  position: absolute;
  top: 0; right: 0; bottom: 0; left: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity var(--duration-fast) ease;
}

.channel-card:hover .card-play-overlay {
  opacity: 1;
}

.card-play-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--accent-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: var(--shadow-glow);
}

.card-info {
  padding: 10px 12px 12px;
}

.card-title {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-primary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.3;
  margin-bottom: 4px;
}

.card-group {
  font-size: 0.7rem;
  color: var(--text-tertiary);
  display: flex;
  align-items: center;
  gap: 4px;
}

.card-group-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent-primary);
  opacity: 0.6;
}

/* ─── Category Upsell Grid (quadrados: desbloqueado pula pra categoria,
       bloqueado leva ao checkout) ─── */
/* Régua horizontal em vez de grade. Com grid, telas estreitas quebravam os
   quadrados em duas linhas desalinhadas — e a última linha ficava com um
   quadrado solto. Arrastando de lado, cabe qualquer quantidade de categorias
   em qualquer largura. */
.category-section {
  padding: 14px 0 0;
}

.category-section.hidden {
  display: none;
}

.category-section-title {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
  padding: 0 16px;
  margin-bottom: 10px;
}

.category-upsell-grid {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  /* O padding lateral entra aqui, e não no pai: assim o primeiro e o último
     quadrado encostam na borda da tela ao rolar, em vez de parar antes. */
  padding: 0 16px 4px;
  scroll-snap-type: x proximity;
  /* Sem isto o snap alinha o primeiro quadrado à borda do contêiner e engole o
     padding-left: a régua nasce rolada em 16px e o primeiro quadrado encosta
     na tela, desalinhado do título. */
  scroll-padding-left: 16px;
  -webkit-overflow-scrolling: touch;
  /* Esconde a barra: no celular ela não aparece, e no desktop pesava mais que
     ajudava num trecho de cinco itens. */
  scrollbar-width: none;
}

.category-upsell-grid::-webkit-scrollbar {
  display: none;
}

.category-upsell-grid > * {
  /* Largura fixa: sem isto o flex espreme os quadrados para caberem todos, que
     é justamente o que a régua existe para evitar. */
  flex: 0 0 108px;
  scroll-snap-align: start;
}

@media (max-width: 380px) {
  .category-upsell-grid > * { flex-basis: 96px; }
}

.category-tile {
  position: relative;
  display: block;
  aspect-ratio: 1 / 1;
  padding: 0;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
  background-color: var(--bg-tertiary);
  background-size: cover;
  background-position: center;
  cursor: pointer;
  text-decoration: none;
  transition: transform var(--duration-fast) ease, box-shadow var(--duration-fast) ease;
}

.category-tile:active {
  transform: scale(0.96);
}

.category-tile.active {
  border-color: transparent;
  box-shadow: var(--shadow-glow);
}

.category-tile-label {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 8px 6px 7px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.85) 15%, transparent 100%);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.25;
  text-align: center;
}

.category-tile.locked {
  filter: grayscale(0.35);
}

.category-tile.locked .category-tile-label {
  color: var(--text-secondary);
}

.category-tile-lock {
  position: absolute;
  top: 0; right: 0; bottom: 0; left: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(11, 6, 5, 0.55);
}

.category-tile-lock svg {
  color: #fff;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.5));
}

/* ─── Content Type Nav (Xtream: Ao Vivo / Filmes / Séries) ─── */
.content-type-nav {
  display: flex;
  gap: 8px;
  padding: 16px 16px 0;
}

.content-type-nav.hidden {
  display: none;
}

.type-btn {
  flex: 1;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-tertiary);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: all var(--duration-fast) ease;
}

.type-btn:hover {
  color: var(--text-secondary);
}

.type-btn.active {
  color: #fff;
  background: var(--accent-primary);
  border-color: transparent;
  box-shadow: var(--shadow-glow);
}

/* ─── Grid loading state ─── */
.grid-loading {
  grid-column: 1/-1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 60px 20px;
  color: var(--text-secondary);
  font-size: 0.85rem;
}

/* ─── Card type badge (Xtream series) ─── */
.card-type-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  background: var(--bg-glass-strong);
  color: var(--accent-primary);
  border: 1px solid var(--border-accent);
}

/* ─── Xtream connected panel (in modal) ─── */
.xtream-connected-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.xtream-connected-panel.hidden {
  display: none;
}

.xtream-connected-text {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.xtream-connected-text strong {
  color: var(--text-primary);
}

.xtream-focus-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  border-radius: var(--radius-md);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
}

.xtream-focus-row {
  display: flex;
  gap: 8px;
}

.xtream-focus-row select {
  flex: 1;
  padding: 10px 12px;
  font-size: 0.85rem;
}

.xtream-focus-active {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: rgba(232, 50, 61, 0.12);
  border: 1px solid var(--border-accent);
}

.xtream-focus-active.hidden {
  display: none;
}

.xtream-focus-active span {
  font-size: 0.78rem;
  color: var(--text-secondary);
}

/* ═══════════════════════════════════════
   SERIES DETAIL VIEW
   ═══════════════════════════════════════ */
.series-detail {
  padding: 16px;
  animation: fadeInUp 0.3s var(--ease-out);
}

.series-detail.hidden {
  display: none;
}

.series-back-btn {
  margin-bottom: 16px;
}

.series-detail-header {
  display: flex;
  gap: 16px;
  margin-bottom: 20px;
}

.series-detail-cover {
  width: 110px;
  aspect-ratio: 3/4;
  object-fit: cover;
  border-radius: var(--radius-lg);
  background: var(--bg-tertiary);
  flex-shrink: 0;
  border: 1px solid var(--border-subtle);
}

.series-detail-info {
  flex: 1;
  min-width: 0;
}

.series-detail-title {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--text-primary);
}

.series-detail-meta {
  font-size: 0.78rem;
  color: var(--accent-primary);
  font-weight: 600;
  margin-bottom: 8px;
}

.series-detail-plot {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 5;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.season-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 12px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--border-subtle);
  scrollbar-width: none;
}

.season-tabs::-webkit-scrollbar {
  display: none;
}

.episode-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.episode-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: all var(--duration-fast) ease;
}

.episode-row:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-accent);
}

.episode-row:active {
  transform: scale(0.98);
}

.episode-play-icon {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  border-radius: 50%;
  background: rgba(232, 50, 61, 0.12);
  color: var(--accent-primary);
  display: flex;
  align-items: center;
  justify-content: center;
}

.episode-info {
  min-width: 0;
}

.episode-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.episode-sub {
  font-size: 0.72rem;
  color: var(--text-tertiary);
  margin-top: 2px;
}

/* ─── Channel count badge ─── */
.channel-count {
  padding: 12px 16px;
  color: var(--text-tertiary);
  font-size: 0.78rem;
  font-weight: 500;
  display: none;
}

.channel-count.visible {
  display: block;
}

/* ═══════════════════════════════════════
   PLAYER OVERLAY
   ═══════════════════════════════════════ */
.player-overlay {
  position: fixed;
  top: 0; right: 0; bottom: 0; left: 0;
  z-index: 200;
  background: var(--bg-primary);
  display: flex;
  flex-direction: column;
  animation: playerIn 0.35s var(--ease-out);
}

.player-overlay.hidden {
  display: none;
}

@keyframes playerIn {
  from { opacity: 0; transform: translateY(100%); }
  to { opacity: 1; transform: translateY(0); }
}

.player-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  padding-top: calc(8px + var(--safe-top));
  background: var(--bg-glass-strong);
  border-bottom: 1px solid var(--border-subtle);
  min-height: 52px;
  transition: opacity 0.25s var(--ease-out);
}

/* In fullscreen, controls auto-hide after a few seconds of inactivity
   (see StreamPlayer._scheduleControlsHide) instead of staying on top of
   the video permanently. */
.player-overlay.controls-hidden .player-header,
.player-overlay.controls-hidden .player-controls {
  opacity: 0;
  pointer-events: none;
}

.player-overlay.controls-hidden .player-video-wrap {
  cursor: none;
}

/* Tela cheia de verdade: header e controles passam a flutuar sobre o vídeo.
   No fluxo normal da coluna eles comem altura fixa — num celular deitado isso
   sobrava metade da tela pro vídeo, e a "tela cheia" não preenchia nada. */
.player-overlay.is-fullscreen .player-header,
.player-overlay.is-fullscreen .player-controls {
  position: absolute;
  left: 0;
  right: 0;
  z-index: 2;
  border: 0;
  /* Fallback antes do max(): TV antiga descarta a linha e ficaria sem padding. */
  padding-left: 12px;
  padding-right: 12px;
  padding-left: max(12px, env(safe-area-inset-left, 0px));
  padding-right: max(12px, env(safe-area-inset-right, 0px));
}

.player-overlay.is-fullscreen .player-header {
  top: 0;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.75), transparent);
}

.player-overlay.is-fullscreen .player-controls {
  bottom: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.75), transparent);
}

.player-info {
  flex: 1;
  min-width: 0;
}

.player-title {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.player-group {
  font-size: 0.72rem;
  color: var(--text-tertiary);
}

.player-video-wrap {
  flex: 1;
  position: relative;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

#video-player {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

#player-iframe {
  width: 100%;
  height: 100%;
  border: 0;
}

.player-loading {
  position: absolute;
  top: 0; right: 0; bottom: 0; left: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  color: var(--text-secondary);
  font-size: 0.85rem;
  background: rgba(0, 0, 0, 0.6);
}

.player-loading.hidden {
  display: none;
}

.player-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--bg-tertiary);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.player-error {
  position: absolute;
  top: 0; right: 0; bottom: 0; left: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--danger);
  text-align: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.8);
}

.player-error.hidden {
  display: none;
}

.player-error p {
  color: var(--text-secondary);
  font-size: 0.85rem;
}

/* Player Controls */
.player-controls {
  background: var(--bg-glass-strong);
  border-top: 1px solid var(--border-subtle);
  padding: 12px 16px calc(12px + var(--safe-bottom));
  transition: opacity 0.25s var(--ease-out);
}

.player-progress-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 10px;
}

.player-progress-row.hidden {
  display: none;
}

.player-time {
  font-size: 0.7rem;
  color: var(--text-tertiary);
  font-variant-numeric: tabular-nums;
  min-width: 32px;
  text-align: center;
  flex-shrink: 0;
}

.player-seek {
  flex: 1;
  height: 4px;
  border-radius: var(--radius-full);
  appearance: none;
  -webkit-appearance: none;
  background: var(--bg-tertiary);
  outline: none;
  cursor: pointer;
}

.player-seek::-webkit-slider-thumb {
  appearance: none;
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent-primary);
  cursor: pointer;
  box-shadow: 0 0 6px var(--accent-glow);
}

.player-seek::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border: none;
  border-radius: 50%;
  background: var(--accent-primary);
  cursor: pointer;
}

.player-seek::-moz-range-track {
  height: 4px;
  border-radius: var(--radius-full);
  background: transparent;
}

.player-live-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding-bottom: 10px;
  color: var(--danger);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.player-live-row.hidden {
  display: none;
}

.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--danger);
  box-shadow: 0 0 6px var(--danger);
  animation: liveDotPulse 1.5s ease-in-out infinite;
}

@keyframes liveDotPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.controls-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.control-btn {
  width: 46px;
  height: 46px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--duration-fast) ease;
}

.control-btn:hover {
  color: var(--text-primary);
  background: var(--bg-tertiary);
}

.control-btn:active {
  transform: scale(0.9);
}

.control-btn-main {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--accent-primary);
  color: #fff;
  box-shadow: var(--shadow-glow);
}

.control-btn-main:hover {
  color: #fff;
  background: var(--accent-primary);
  box-shadow: 0 0 30px var(--accent-glow);
}

.volume-wrap {
  display: flex;
  align-items: center;
  gap: 4px;
}

.volume-slider {
  width: 70px;
  height: 4px;
  border-radius: var(--radius-full);
  appearance: none;
  -webkit-appearance: none;
  background: var(--bg-tertiary);
  outline: none;
  cursor: pointer;
}

.volume-slider::-webkit-slider-thumb {
  appearance: none;
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent-primary);
  cursor: pointer;
  box-shadow: 0 0 6px var(--accent-glow);
}

.volume-slider::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border: none;
  border-radius: 50%;
  background: var(--accent-primary);
  cursor: pointer;
}

/* Hide volume on very small mobile */
@media (max-width: 380px) {
  .volume-wrap {
    display: none;
  }
}

/* ═══════════════════════════════════════
   MODAL
   ═══════════════════════════════════════ */
.modal-overlay {
  position: fixed;
  top: 0; right: 0; bottom: 0; left: 0;
  z-index: 300;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: fadeIn var(--duration-fast) ease;
}

.modal-overlay.hidden {
  display: none;
}

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

.modal {
  width: 100%;
  max-width: 480px;
  max-height: 85vh;
  max-height: 85dvh;
  background: var(--bg-secondary);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  border: 1px solid var(--border-subtle);
  border-bottom: none;
  overflow-y: auto;
  animation: modalSlideUp 0.35s var(--ease-out);
  padding-bottom: var(--safe-bottom);
}

@keyframes modalSlideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 20px 0;
}

.modal-title {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
}

.modal-body {
  padding: 20px;
}

/* ─── Account modal (Minha Conta) ─── */
.account-info-list {
  display: flex;
  flex-direction: column;
  margin-bottom: 20px;
}

.account-info-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-subtle);
}

.account-info-row:last-child {
  border-bottom: none;
}

.account-info-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.account-info-value {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
}

/* ─── Category upsell modal (sinopse + preço de categoria bloqueada) ─── */
.category-upsell-cover {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius-lg);
  background-size: cover;
  background-position: center;
  margin-bottom: 16px;
}

.category-upsell-synopsis {
  font-size: 0.92rem;
  line-height: 1.5;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

.category-upsell-price-row {
  display: flex;
  align-items: baseline;
  justify-content: center;
  margin-bottom: 16px;
}

.category-upsell-price {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 800;
  background: var(--accent-primary);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.category-upsell-price span {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  -webkit-text-fill-color: var(--text-secondary);
}

/* Modal Tabs */
.modal-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
}

.modal-tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-tertiary);
  background: var(--bg-tertiary);
  cursor: pointer;
  transition: all var(--duration-fast) ease;
  border: 1px solid transparent;
}

.modal-tab:hover {
  color: var(--text-secondary);
}

.modal-tab.active {
  color: var(--accent-primary);
  background: rgba(232, 50, 61, 0.12);
  border-color: var(--border-accent);
}

/* Modal Tab Content */
.modal-tab-content {
  display: none;
}

.modal-tab-content.active {
  display: block;
  animation: fadeInUp 0.3s var(--ease-out);
}

/* Drop Zone */
.drop-zone {
  border: 2px dashed var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 40px 24px;
  text-align: center;
  cursor: pointer;
  transition: all var(--duration-normal) ease;
  position: relative;
  color: var(--text-tertiary);
}

.drop-zone:hover,
.drop-zone.drag-over {
  border-color: var(--accent-primary);
  background: rgba(232, 50, 61, 0.12);
  color: var(--accent-primary);
}

.drop-zone svg {
  margin-bottom: 12px;
  opacity: 0.5;
}

.drop-zone-text {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.drop-zone-hint {
  font-size: 0.78rem;
  color: var(--text-tertiary);
}

#file-input {
  position: absolute;
  top: 0; right: 0; bottom: 0; left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

/* URL Input */
.url-input-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.url-label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.url-input {
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-size: 0.9rem;
  transition: border-color var(--duration-fast) ease;
}

.url-input::placeholder {
  color: var(--text-tertiary);
}

.url-input:focus {
  border-color: var(--border-accent);
  box-shadow: 0 0 0 3px rgba(232, 50, 61, 0.1);
}

/* Modal Status */
.modal-status {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 16px 20px;
  background: rgba(232, 50, 61, 0.12);
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.modal-status.hidden {
  display: none;
}

.status-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--bg-tertiary);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

/* ═══════════════════════════════════════
   TOAST NOTIFICATIONS
   ═══════════════════════════════════════ */
.toast-container {
  position: fixed;
  top: calc(var(--header-height) + var(--safe-top) + 8px);
  left: 16px;
  right: 16px;
  z-index: 500;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: var(--bg-glass-strong);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.85rem;
  color: var(--text-primary);
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.35s var(--ease-spring);
  pointer-events: auto;
}

.toast.toast-out {
  animation: toastOut 0.3s var(--ease-out) forwards;
}

.toast-success {
  border-left: 3px solid var(--success);
}

.toast-error {
  border-left: 3px solid var(--danger);
}

.toast-info {
  border-left: 3px solid var(--accent-primary);
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(-20px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes toastOut {
  from { opacity: 1; transform: translateY(0); }
  to { opacity: 0; transform: translateY(-20px) scale(0.9); }
}

/* ═══════════════════════════════════════
   RESPONSIVE ADJUSTMENTS
   ═══════════════════════════════════════ */

/* Tablets */
@media (min-width: 600px) {
  .channel-grid {
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 16px;
    padding: 20px;
  }

  .modal {
    border-radius: var(--radius-xl);
    border-bottom: 1px solid var(--border-subtle);
    margin: auto;
    max-height: 80vh;
    max-height: 80dvh;
  }

  .modal-overlay {
    align-items: center;
    padding: 20px;
  }

  @keyframes modalSlideUp {
    from { opacity: 0; transform: translateY(30px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
  }
}

/* Desktop */
@media (min-width: 900px) {
  .channel-grid {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 20px;
    padding: 24px;
  }

  .empty-actions {
    flex-direction: row;
    max-width: 420px;
  }

  .player-overlay {
    flex-direction: column;
  }
}

/* Large Desktop */
@media (min-width: 1200px) {
  .channel-grid {
    max-width: 1400px;
    margin: 0 auto;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  }

  .main-content {
    max-width: 1440px;
    margin: 0 auto;
    width: 100%;
  }
}

/* ─── Haptic-like touch feedback ─── */
@media (hover: none) {
  .channel-card:active {
    transform: scale(0.95);
    transition-duration: 100ms;
  }

  .card-play-overlay {
    opacity: 0 !important;
  }
}

/* ─── Utility ─── */
.hidden {
  display: none !important;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
  width: 4px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-tertiary);
}

/* ═══════════════════════════════════════
   LEVEZA EM APARELHO FRACO (TV Android antiga)
   ═══════════════════════════════════════
   Aqui existiam 15 `backdrop-filter: blur(...)`. Todos ficavam sobre
   --bg-glass-strong, que já é 92% opaco — o blur quase não aparecia e mesmo
   assim obrigava o navegador a compor uma camada do tamanho da tela a cada
   quadro. Em GPU de TV antiga é o que fazia o scroll travar. Removidos: o
   fundo sólido dá o mesmo resultado visual de graça.

   As duas regras abaixo cortam o resto do custo em quem pede menos movimento
   (o próprio sistema da TV costuma pedir) e em telas de toque grosso. */

/* Um card entrando com animação é bonito no celular; 120 deles animando ao
   mesmo tempo numa TV antiga é meio segundo de tela travada. */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* ═══════════════════════════════════════
   FOCO PARA CONTROLE REMOTO (D-pad)
   ═══════════════════════════════════════
   Num controle remoto não existe cursor: o único jeito de saber onde se está é
   o anel de foco. Ele precisa ser grosso e claro o suficiente para ser visto do
   sofá, e por isso é mais forte que o :focus-visible padrão do resto do app. */
body.tv-nav :focus-visible,
body.tv-nav .tv-focus {
  outline: 3px solid var(--accent-primary);
  outline-offset: 3px;
  border-radius: var(--radius-md);
}

body.tv-nav .channel-card:focus-visible,
body.tv-nav .category-tile:focus-visible,
body.tv-nav .banner-slide:focus-visible {
  outline-width: 4px;
  /* Sem transform/scale de propósito: mover o card obriga a repintar a fileira
     inteira a cada tecla, e a navegação por seta é rápida. */
  box-shadow: 0 0 0 4px rgba(232, 50, 61, 0.25);
}

/* ═══════════════════════════════════════
   BANNER DA HOME (slides curados no admin)
   ═══════════════════════════════════════
   Regra que vale para tudo aqui: nada de backdrop-filter, nada de animação
   contínua e nada de sombra grande. O alvo são TVs Android antigas, onde blur
   e sombra em elemento do tamanho da tela custam quadros no scroll. */
.home-banner {
  position: relative;
  margin: 0 0 18px;
}

.banner-track {
  position: relative;
  width: 100%;
  /* 16:9 é o formato do backdrop do TMDB; travar a proporção reserva o espaço
     antes da imagem chegar e evita a home pular quando ela carrega. */
  aspect-ratio: 16 / 9;
  max-height: 46vh;
  max-height: 46dvh;
  overflow: hidden;
  border-radius: var(--radius-lg);
  background: var(--bg-secondary);
}

/* Navegador antigo sem aspect-ratio: altura fixa razoável em vez de colapsar. */
@supports not (aspect-ratio: 16 / 9) {
  .banner-track { height: 210px; }
}

.banner-slide {
  position: absolute;
  top: 0; right: 0; bottom: 0; left: 0;
  cursor: pointer;
  display: block;
}

.banner-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Imagem fora do ar deixa só o gradiente — o texto continua legível. */
.banner-slide--noimg .banner-img { display: none; }
.banner-slide--noimg { background: var(--bg-tertiary); }

/* Degradê chapado (sem blur) para o texto ter contraste sobre qualquer arte. */
.banner-shade {
  position: absolute;
  top: 0; right: 0; bottom: 0; left: 0;
  background: linear-gradient(0deg, rgba(11, 6, 5, 0.95) 0%, rgba(11, 6, 5, 0.55) 32%, rgba(11, 6, 5, 0) 65%);
}

.banner-copy {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 16px 18px;
}

.banner-badge {
  display: inline-block;
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--bg-primary);
  background: var(--accent-primary);
  padding: 3px 9px;
  border-radius: var(--radius-full);
  margin-bottom: 8px;
}

.banner-title {
  font-family: var(--font-display);
  font-size: 1.5rem; /* fallback: clamp() só existe do Chrome 79 pra frente */
  font-size: clamp(1.15rem, 5vw, 1.9rem);
  font-weight: 800;
  line-height: 1.1;
  margin: 0;
  color: #fff;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.7);
}

.banner-cta {
  display: inline-block;
  margin-top: 10px;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--bg-primary);
  background: #fff;
  padding: 7px 16px;
  border-radius: var(--radius-full);
}

.banner-dots {
  display: flex;
  justify-content: center;
  gap: 7px;
  margin-top: 10px;
}

.banner-dot {
  width: 7px;
  height: 7px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: var(--text-tertiary);
  cursor: pointer;
  /* Bolinha de 7px é alvo de toque pequeno demais; a área clicável cresce sem
     mexer no desenho. */
  box-shadow: 0 0 0 7px transparent;
}

.banner-dot.active {
  background: var(--accent-primary);
  width: 20px;
  border-radius: var(--radius-full);
}

/* ─── Fallbacks de TV antiga (Samsung/LG, Firestick — Chrome 63-87) ───
   aspect-ratio só chegou no Chrome 88. Sem ele a caixa colapsa pra zero e a
   grade vira uma fileira de nada, que é como o app aparecia nessas telas.
   Altura fixa não guarda a proporção exata, mas o object-fit/background-size
   cover corta a imagem e tudo continua visível e clicável. */
@supports not (aspect-ratio: 1 / 1) {
  .card-thumb { height: 200px; }
  .category-tile { height: 108px; }        /* o flex-basis do pai é 108px */
  .series-detail-cover { height: 147px; }  /* 110px de largura em 3/4 */
  .category-upsell-cover { height: 240px; }
}

@media (min-width: 1024px) {
  @supports not (aspect-ratio: 1 / 1) {
    /* Nesta faixa a grade usa colunas de 200px+, então 200px de altura
       deixaria a capa quadrada demais. */
    .card-thumb { height: 280px; }
  }
}

/* ─── Aviso global (troca do número de suporte) ───
   Não é a faixa fininha das outras (.trial-bar): o texto é uma frase inteira
   e o público é 60+, então ela ocupa espaço de propósito e o botão tem o
   mesmo peso do "Comprar agora". Some por dispensa ou por data (ver app.js). */
.aviso-bar {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  padding: 14px 16px calc(14px + var(--safe-bottom, 0px));
  background: var(--bg-secondary);
  border-bottom: 2px solid var(--accent-primary);
}

.aviso-bar.hidden {
  display: none;
}

.aviso-texto {
  margin: 0;
  color: var(--text-primary);
  font-size: 0.95rem;
  line-height: 1.45;
  text-align: center;
}

.aviso-acao {
  width: 100%;
}

.aviso-dispensar {
  width: 100%;
  color: var(--text-secondary);
  border-color: var(--text-tertiary);
}

/* Em tela larga o texto e os botões cabem lado a lado sem virar um bloco
   gigante no topo. */
@media (min-width: 720px) {
  .aviso-bar {
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 16px;
  }
  .aviso-texto { text-align: left; }
  .aviso-acao, .aviso-dispensar { width: auto; flex-shrink: 0; }
}
