/* DarkTV — webOS TV UI (1280x720 base, escala para 1920x1080) */
* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #08080a;
  --surface: #16161a;
  --text: #f5f5f7;
  --muted: #a1a1aa;
  --brand: #e50914;
  --brand-glow: rgba(229, 9, 20, 0.55);
  --radius: 6px;
  --focus: 0 0 0 4px #ffffff, 0 12px 40px rgba(0, 0, 0, 0.8);
}

html, body {
  width: 100%; height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

#app { position: relative; width: 100%; height: 100%; }

.screen {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;

  width: 100%;
  height: 100%;

  display: none;
  overflow: hidden;
}
.screen.active { display: block; }

.brand { font-size: 44px; font-weight: 800; letter-spacing: -1px; color: var(--text); }
.brand span { color: var(--brand); }
.brand.small { font-size: 26px; }

/* ---------- LOGIN ---------- */
.login-bg {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background:
    radial-gradient(1200px 600px at 20% 10%, rgba(229, 9, 20, 0.28), transparent 60%),
    radial-gradient(900px 500px at 90% 90%, rgba(120, 0, 10, 0.35), transparent 60%),
    linear-gradient(160deg, #0b0b0f, #000);
}
.login-card {
  position: relative;
  width: 480px; margin: 6vh auto 0;
  background: rgba(15, 15, 18, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 34px 38px 30px;
}
.login-sub { color: var(--muted); margin: 6px 0 22px; font-size: 15px; }
.field { display: block; margin-bottom: 14px; }
.field span { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 1px; }
input[type="text"], input[type="password"] {
  width: 100%; height: 46px; padding: 0 14px;
  background: #202024; border: 2px solid transparent; border-radius: var(--radius);
  color: var(--text); font-size: 16px; outline: none;
}
input.focused { border-color: #fff; background: #2a2a30; }
.login-msg { min-height: 20px; margin-top: 12px; font-size: 14px; color: #ff6b6b; }

.btn {
  height: 46px; padding: 0 26px; border: 0; border-radius: var(--radius);
  font-size: 16px; font-weight: 700; color: var(--text); cursor: pointer;
  background: rgba(255, 255, 255, 0.16);
}
.btn.primary { width: 100%; background: var(--brand); margin-top: 8px; }
.btn.play { background: #fff; color: #000; }
.btn.ghost { background: rgba(120, 120, 130, 0.6); }
.btn.focused { box-shadow: var(--focus); transform: scale(1.04); }

/* ---------- TOPBAR ---------- */
.topbar {
  position: absolute; top: 0; left: 0; right: 0; height: 74px; z-index: 30;
  display: flex; align-items: center; gap: 34px; padding: 0 48px;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.9), rgba(0, 0, 0, 0));
}
.tabs { display: flex; gap: 8px; }
.tab {
  background: transparent; border: 0; color: var(--muted);
  font-size: 17px; font-weight: 600; padding: 8px 16px; border-radius: 40px; cursor: pointer;
}
.tab.active { color: var(--text); }
.tab.focused { background: #fff; color: #000; box-shadow: var(--focus); }
.user-chip { margin-left: auto; color: var(--muted); font-size: 14px; }
.grid-title { font-size: 22px; font-weight: 700; }

/* ---------- BILLBOARD ---------- */
.billboard { position: relative; height: 62%; }
.bb-art {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
}
.bb-art img { width: 100%; height: 100%; object-fit: cover; opacity: 0.75; }
.bb-fade {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background:
    linear-gradient(90deg, rgba(8, 8, 10, 0.97) 20%, rgba(8, 8, 10, 0.4) 60%, rgba(8, 8, 10, 0.1)),
    linear-gradient(0deg, var(--bg) 2%, rgba(8, 8, 10, 0) 45%);
}
.bb-info { position: absolute; left: 48px; bottom: 8%; width: 46%; }
.bb-kicker { color: var(--brand); font-weight: 800; letter-spacing: 3px; font-size: 13px; text-transform: uppercase; }
.bb-info h1 { font-size: 46px; line-height: 1.05; margin: 10px 0 12px; text-shadow: 0 4px 24px rgba(0, 0, 0, 0.8); }
.bb-info p {
  color: #d4d4d8; font-size: 16px; line-height: 1.45; max-height: 68px; overflow: hidden;
}
.bb-actions { display: flex; gap: 12px; margin-top: 20px; }

/* ---------- ROWS ---------- */
.rows { position: absolute; left: 0; right: 0; top: 58%; bottom: 0; padding-bottom: 40px; overflow: hidden; }
.row { margin-bottom: 26px; }
.row h2 { font-size: 20px; margin: 0 0 10px 48px; font-weight: 700; }
.row-track { display: flex; gap: 12px; padding: 6px 48px 14px; transition: transform 0.25s ease; }

.card {
  position: relative; flex: 0 0 auto; width: 208px; height: 118px;
  background: #1c1c22; border-radius: var(--radius); overflow: hidden;
  transition: transform 0.16s ease;
}
.card.poster { width: 148px; height: 222px; }
.card img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card .ph {
  display: flex; align-items: center; justify-content: center; height: 100%;
  font-size: 13px; color: var(--muted); text-align: center; padding: 8px; line-height: 1.3;
}
.card .cap {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 18px 8px 6px;
  background: linear-gradient(0deg, rgba(0, 0, 0, 0.92), transparent);
  font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.card.focused { transform: scale(1.12); box-shadow: var(--focus); z-index: 5; }

/* ---------- GRID (estilo lateral + pôsteres, como Assist+) ---------- */
.grid-bg {
  position: absolute; top: 0; right: 0; bottom: 0; left: 0;
  background:
    radial-gradient(900px 500px at 75% 30%, rgba(210, 40, 60, 0.28), transparent 70%),
    linear-gradient(160deg, #1a0b10 0%, #0d0d12 55%, #08080a 100%);
}
.grid-wrap { position: absolute; top: 0; left: 0; right: 0; bottom: 0; display: flex; }
.cats { width: 330px; flex: 0 0 330px; padding: 40px 14px 40px 22px; overflow: hidden; }
.cat {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  background: rgba(12, 12, 16, 0.86); border: 0; color: var(--text);
  font-size: 15px; font-weight: 700; padding: 11px 14px; margin-bottom: 8px;
  border-radius: 10px; cursor: pointer; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}
.cat .ico { width: 20px; height: 20px; flex: 0 0 20px; }
.cat .cat-name { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-transform: uppercase; letter-spacing: 0.2px; }
.cat-search .cat-name, .cat.active .cat-name { text-transform: none; }
.cat .cat-count { color: #d4d4d8; font-weight: 700; font-size: 14px; }
.cat.active { background: #fff; color: #111; }
.cat.active .cat-count { color: #111; }
.cat.focused { background: #fff; color: #000; box-shadow: var(--focus); transform: translateX(6px); }
.cat.focused .cat-count { color: #000; }
.grid-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 34px 0 0 20px;
}
.grid-title { font-size: 34px; font-weight: 800; margin: 0 0 14px; }

/* ERICKTV_GRID_SPACING_V76
 * 4 conteúdos por linha, nomes em uma linha com reticências e espaço seguro abaixo dos cards.
 */
.grid {
  flex: 1;
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  justify-content: space-between;
  column-gap: 0;
  row-gap: 0;
  padding: 10px 8px 60px 8px;
  overflow: hidden;
}

/*
 * Grade fixa de pôsteres:
 * todos os gêneros usam exatamente a mesma caixa, mesmo quando a imagem
 * original vem horizontal, quadrada ou com proporção errada.
 */
.grid .card,
.grid .card.poster {
  flex: 0 0 calc((100% - 132px) / 4);
  width: calc((100% - 132px) / 4);
  min-width: 0;
  height: 372px;
  margin-bottom: 0;
  padding-bottom: 44px;
  background: transparent;
  border-radius: 0;
  overflow: visible;
  box-sizing: border-box;
}

.grid .card.poster img,
.grid .card.poster .ph {
  display: block;
  width: 100% !important;
  height: 300px !important;
  min-height: 300px;
  max-height: 300px;
  object-fit: cover;
  border-radius: 8px;
  background: #1c1c22;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
}

.grid .card:not(.poster) {
  height: 192px;
}
.grid .card:not(.poster) img,
.grid .card:not(.poster) .ph {
  display: block;
  width: 100% !important;
  height: 120px !important;
  min-height: 120px;
  max-height: 120px;
  object-fit: cover;
  border-radius: 8px;
  background: #1c1c22;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
}

.grid .card .cap {
  position: static;
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  background: none;
  padding: 8px 2px 0;
  height: 28px;
  line-height: 20px;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  word-break: normal !important;
  overflow-wrap: normal !important;
  font-size: 15px;
  font-weight: 700;
  color: #f4f4f5;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.6);
}
.grid .card.focused { transform: scale(1.04); box-shadow: none; }
.grid .card.focused img, .grid .card.focused .ph { box-shadow: var(--focus); }

/* Aproxima levemente o 4º card do 3º sem alterar o tamanho dos pôsteres. */
/* Grade de categorias: 4 colunas reais.
 * Assim uma última fileira incompleta ocupa as primeiras colunas,
 * sem jogar o último item para a borda e criar um buraco no meio.
 */
#screen-grid .grid {
  display: grid;
  grid-template-columns: repeat(4, calc((100% - 132px) / 4));
  justify-content: start;
  align-content: start;
  column-gap: 44px;
  row-gap: 44px;
}

#screen-grid .grid .card,
#screen-grid .grid .card.poster {
  width: 100%;
  flex: none;
  height: 328px;
  margin: 0;
  padding-bottom: 0;
}

#screen-grid .grid .card:not(.poster) {
  height: 148px;
}

/* Nome sempre em uma linha; nomes longos terminam em reticências. */
#screen-grid .grid .card .cap {
  display: block;
  width: 100%;
  max-width: 100%;
  height: 28px;
  line-height: 20px;
  padding: 8px 2px 0;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  word-break: normal !important;
  overflow-wrap: normal !important;
  box-sizing: border-box;
}
#screen-search .grid { position: absolute; top: 150px; left: 0; right: 0; bottom: 0; padding-left: 40px; }

/* ---------- SEARCH ---------- */
.search-box { position: absolute; top: 86px; left: 40px; right: 40px; }
.search-box input { height: 52px; font-size: 18px; }

/* ---------- DETALHE ---------- */
.detail-art { position: absolute; inset: 0 0 auto 0; height: 60%; }
.detail-art img { width: 100%; height: 100%; object-fit: cover; opacity: 0.55; }
.detail-body {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  padding: 20% 48px 40px; overflow: hidden;
  background:
    linear-gradient(90deg, rgba(8, 8, 10, 0.96) 25%, rgba(8, 8, 10, 0.55) 65%, rgba(8, 8, 10, 0.25)),
    linear-gradient(0deg, var(--bg) 30%, rgba(8, 8, 10, 0) 75%);
}
.detail-body h1 { font-size: 40px; margin-bottom: 10px; }
.dt-meta { color: var(--muted); font-size: 14px; margin-bottom: 12px; }
.dt-desc { color: #d4d4d8; max-width: 60%; font-size: 15px; line-height: 1.5; max-height: 90px; overflow: hidden; }
.seasons { display: flex; gap: 8px; margin: 22px 0 14px; flex-wrap: wrap; }
.season {
  background: rgba(255, 255, 255, 0.12); border: 0; color: var(--text);
  padding: 8px 18px; border-radius: 40px; font-size: 14px; font-weight: 600; cursor: pointer;
}
.season.active { background: var(--brand); }
.season.focused { background: #fff; color: #000; box-shadow: var(--focus); }
/* Episódios em trilha horizontal (passa pelo lado, sem cortar) */
.episodes {
  position: relative;
  overflow: hidden;
  padding: 4px 0 30px;
}
.ep-track {
  display: flex; flex-wrap: nowrap; gap: 12px;
  padding: 6px 8px 14px;
}

.ep {
  flex: 0 0 auto; width: 230px; background: var(--surface); border-radius: var(--radius);
  padding: 12px 14px; text-align: left; border: 0; color: var(--text); cursor: pointer;
}
.ep b { display: block; font-size: 14px; margin-bottom: 4px; }
.ep small { color: var(--muted); font-size: 12px; }
.ep.focused { box-shadow: var(--focus); background: #26262c; }

/* Botão Atualizar transparente, como as abas */
#btn-refresh {
  background: transparent;
  color: var(--muted);
  font-size: 17px;
  font-weight: 600;
  height: auto;
  padding: 8px 16px;
  border-radius: 40px;
}
#btn-refresh.focused { background: #fff; color: #000; }

/* Botões do OSD do player */
.osd-buttons { display: flex; gap: 12px; margin-top: 14px; }
.osd-btn {
  background: rgba(255, 255, 255, 0.16); border: 0; color: var(--text);
  padding: 10px 20px; border-radius: 40px; font-size: 15px; font-weight: 700; cursor: pointer;
}
.osd-btn.hidden { display: none; }
.osd-btn.sel { background: #fff; color: #000; box-shadow: var(--focus); }
.osd { pointer-events: none; }
.osd.show { pointer-events: auto; }

/* ---------- PLAYER ---------- */
.screen.player { background: #000; }
#video { width: 100%; height: 100%; background: #000; object-fit: contain; }
.osd {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  opacity: 0;
  transition: opacity 0.25s ease;
  pointer-events: none;
  background: linear-gradient(0deg, rgba(0, 0, 0, 0.85), transparent 30%, transparent 70%, rgba(0, 0, 0, 0.8));
}
.osd.show { opacity: 1; }
.osd-top { padding: 34px 48px; }
.osd-title { font-size: 28px; font-weight: 700; }
.osd-bottom { position: absolute; left: 48px; right: 48px; bottom: 44px; }
.bar { height: 6px; background: rgba(255, 255, 255, 0.25); border-radius: 4px; overflow: hidden; }
.bar-fill { height: 100%; width: 0%; background: var(--brand); }
.osd-times { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); margin-top: 8px; }
.osd-hint { margin-top: 10px; font-size: 13px; color: var(--muted); }

.spinner {
  position: absolute; top: 50%; left: 50%; width: 64px; height: 64px; margin: -32px 0 0 -32px;
  border: 5px solid rgba(255, 255, 255, 0.18); border-top-color: var(--brand); border-radius: 50%;
  animation: spin 0.9s linear infinite; display: none;
}
.spinner.show { display: block; }
@keyframes spin { to { transform: rotate(360deg); } }

.player-error {
  position: absolute; top: 50%; left: 0; right: 0; text-align: center; font-size: 18px;
  color: #ff8a8a; display: none; padding: 0 60px;
}
.player-error.show { display: block; }

/* ---------- TOAST ---------- */
.toast {
  position: absolute; bottom: 40px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: rgba(20, 20, 24, 0.96); border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 12px 22px; border-radius: 40px; font-size: 15px; opacity: 0;
  transition: all 0.25s ease; z-index: 99; pointer-events: none;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* Escala para TVs 1080p */
@media (min-width: 1900px) {
  html { font-size: 24px; }
  body { zoom: 1.5; }
}


/* WEBOS_LEGACY_LAYOUT_FIX
 * Compatibilidade com engines antigas de LG webOS.
 */
html,
body,
#app {
  width: 100%;
  height: 100%;
  min-width: 100%;
  min-height: 100%;
}

#screen-home,
#screen-grid,
#screen-search,
#screen-detail,
#screen-player {
  width: 100%;
  height: 100%;
}


/* DARKTV_SEEK_BAR */
.bar {
  cursor: pointer;
}

.bar:hover {
  transform: scaleY(1.6);
}

.bar-fill {
  pointer-events: none;
}

/* Botão Sair, mesmo estilo transparente do Atualizar */
#btn-logout {
  background: transparent;
  color: var(--muted);
  font-size: 17px;
  font-weight: 600;
  height: auto;
  padding: 8px 16px;
  border-radius: 40px;
}
#btn-logout.focused { background: #fff; color: #000; }

/* Modos de ajuste de imagem do player */
#video.fit-contain { object-fit: contain !important; transform: none !important; }
#video.fit-cover { object-fit: cover !important; transform: none !important; }
#video.fit-fill { object-fit: fill !important; transform: none !important; }
#video.fit-zoom { object-fit: contain !important; transform: scale(1.18) !important; }


/* ---------------- Perfil ---------------- */
.profile-wrap {
  position: absolute; top: 100px; left: 60px; right: 60px; bottom: 40px;
  display: flex; gap: 40px;
}
.profile-card {
  width: 320px; padding: 34px 24px; border-radius: 18px;
  background: rgba(255,255,255,0.05); text-align: center;
  border: 1px solid rgba(255,255,255,0.08);
}
.profile-avatar {
  width: 120px; height: 120px; margin: 0 auto 18px; border-radius: 16px;
  background: var(--brand, #e50914); color: #fff;
  font-size: 60px; font-weight: 800; line-height: 120px;
}
.profile-name { font-size: 26px; font-weight: 800; }
.profile-status { margin-top: 6px; color: var(--muted, #a1a1aa); font-size: 17px; }
.profile-info { flex: 1; }
.pf-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 8px; border-bottom: 1px solid rgba(255,255,255,0.08);
  font-size: 19px;
}
.pf-row span { color: var(--muted, #a1a1aa); }
.pf-row b { font-weight: 700; }
.pf-actions { display: flex; gap: 16px; margin-top: 28px; flex-wrap: wrap; }
.pf-actions .btn {
  background: transparent; color: var(--muted, #a1a1aa);
  font-size: 18px; font-weight: 600; padding: 12px 22px; border-radius: 40px; height: auto;
}
.pf-actions .btn.focused { background: #fff; color: #000; }
.pf-note { margin-top: 22px; color: #71717a; font-size: 15px; }

/* ---------------- MENU PRINCIPAL (launcher) ---------------- */
#screen-menu { background: #0a0a0d; }
.menu-bg {
  position: absolute; top: 0; right: 0; bottom: 0; left: 0;
  background:
    radial-gradient(900px 520px at 18% 12%, rgba(229, 9, 20, 0.30), transparent 62%),
    radial-gradient(900px 520px at 88% 88%, rgba(90, 0, 8, 0.42), transparent 62%),
    linear-gradient(160deg, #101015, #050506);
}
.menu-top {
  position: absolute; top: 0; left: 0; right: 0; height: 84px; z-index: 5;
  display: flex; align-items: center; padding: 0 48px;
}
.menu-tools { margin-left: auto; display: flex; gap: 12px; }
.tool {
  width: 52px; height: 52px; border: 1px solid rgba(255,255,255,0.18);
  background: rgba(255,255,255,0.08); color: var(--text);
  border-radius: 12px; font-size: 22px; cursor: pointer;
}
.tool.focused { background: #fff; color: #000; box-shadow: var(--focus); }

.menu-tiles {
  position: absolute; top: 22%; left: 0; right: 0; z-index: 5;
  display: flex; justify-content: center; gap: 26px;
}
.tile {
  width: 190px; height: 190px; border-radius: 18px; cursor: pointer;
  border: 1px solid rgba(255,255,255,0.22);
  background: rgba(255,255,255,0.07);
  color: var(--text);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  transition: transform 0.16s ease;
}
.tile-ico { font-size: 62px; line-height: 1; }
.tile-name { font-size: 20px; font-weight: 700; }
.tile.focused {
  transform: scale(1.08); background: rgba(229, 9, 20, 0.28);
  border-color: #fff; box-shadow: var(--focus);
}

.menu-strip { position: absolute; left: 0; right: 0; bottom: 74px; z-index: 5; }
.menu-strip h2 { font-size: 19px; font-weight: 700; margin: 0 0 10px 48px; }
.menu-strip .row-track { padding: 4px 48px 8px; }
.menu-strip.empty { display: none; }

.menu-foot {
  position: absolute; left: 48px; right: 48px; bottom: 22px; z-index: 5;
  display: flex; gap: 40px; color: var(--muted); font-size: 14px;
}

/* --- Ícones vetoriais (webOS não tem fonte de emoji) --- */
.ico { width: 26px; height: 26px; display: block; }
.tool { display: flex; align-items: center; justify-content: center; }
.tool + .tool { margin-left: 12px; }
.tile-ico .ico { width: 62px; height: 62px; }

/* --- Rodapé do menu: espaçamento sem depender de gap --- */
.menu-foot { flex-wrap: wrap; align-items: center; }
.menu-foot > span { margin-right: 18px; white-space: nowrap; }
.menu-foot .foot-sep { color: rgba(255,255,255,0.35); }
.menu-tiles > .tile + .tile { margin-left: 26px; }

/* --- Tela de listas --- */
.lists-wrap { position: absolute; top: 120px; left: 64px; right: 64px; bottom: 48px; overflow: auto; }
.lists-grid { display: flex; flex-wrap: wrap; }
.list-card {
  width: 340px; min-height: 132px; margin: 0 20px 20px 0; padding: 18px 20px;
  border-radius: 16px; text-align: left; cursor: pointer; color: var(--text);
  border: 1px solid rgba(255,255,255,0.18); background: rgba(255,255,255,0.07);
}
.list-card.active { border-color: rgba(229,9,20,0.9); background: rgba(229,9,20,0.16); }
.list-card.focused { background: #fff; color: #000; box-shadow: var(--focus); }
.list-card .lc-name { font-size: 22px; font-weight: 800; margin-bottom: 6px; }
.list-card .lc-host { font-size: 14px; opacity: 0.75; word-break: break-all; }
.list-card .lc-tag { margin-top: 10px; font-size: 13px; font-weight: 700; opacity: 0.9; }
.list-remove {
  margin-top: 12px; font-size: 13px; padding: 6px 10px; border-radius: 8px; cursor: pointer;
  border: 1px solid rgba(255,255,255,0.28); background: transparent; color: inherit;
}
.list-remove.focused { background: #e50914; color: #fff; box-shadow: var(--focus); }
#lists-add { margin-top: 8px; width: auto; display: inline-block; padding: 14px 28px; }
#screen-search .grid .card, #screen-search .grid .card.poster { width: calc((100% - 100px) / 6); }
#screen-search .grid .card img, #screen-search .grid .card .ph { height: 260px; }


/* ERICKTV_ACCESS_MODAL_V1 */
.access-gate {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 999999;
  display: block;
  background:
    radial-gradient(900px 500px at 50% 25%, rgba(229, 9, 20, 0.24), transparent 68%),
    rgba(0, 0, 0, 0.98);
  pointer-events: auto;
  opacity: 1;
  transition: opacity 0.2s ease;
}

.access-gate.unlocked { opacity: 0; }

.access-modal {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 440px;
  transform: translate(-50%, -50%);
  overflow: visible;
  padding: 18px 30px 20px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 18px;
  background: rgba(15, 15, 18, 0.98);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.85);
  text-align: center;
}

.access-brand {
  font-size: 28px;
  font-weight: 900;
  letter-spacing: -0.7px;
}

.access-brand span { color: var(--brand); }

.access-title {
  margin-top: 4px;
  color: #d4d4d8;
  font-size: 15px;
  font-weight: 700;
}

.access-price {
  margin: 8px 0 10px;
  color: #fff;
  font-size: 32px;
  font-weight: 900;
}

.access-qr {
  display: block;
  width: 220px;
  height: auto;
  max-width: 220px;
  margin: 0 auto 12px;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: #fff;
  image-rendering: pixelated;
}

.access-label {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.access-copy {
  width: 100%;
  height: 42px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 9px;
  background: #202024;
  color: #fff;
  font-size: 15px;
  text-align: center;
}

.access-payment-status {
  min-height: 34px;
  color: #d4d4d8;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.35;
}

.access-device-box {
  margin-top: 14px;
  padding: 11px 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
}

.access-device-id {
  color: #fff;
  font-family: monospace;
  font-size: 20px;
  font-weight: 900;
  letter-spacing: 2px;
}

.access-status {
  margin-top: 14px;
  color: #f7b955;
  font-size: 14px;
  font-weight: 800;
}


.access-permanent .access-gate {
  display: none !important;
}

/* Popup de favoritos (clique longo no conteúdo) */
.fav-pop {
  position: fixed; inset: 0; z-index: 500; display: none;
  align-items: center; justify-content: center;
  background: rgba(0, 0, 0, 0.72);
}
.fav-pop.show { display: flex; }
.fav-box {
  width: 520px; max-width: 90vw; padding: 32px 36px;
  background: #18181b; border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px; box-shadow: 0 24px 80px rgba(0, 0, 0, 0.7);
  display: flex; flex-direction: column; gap: 12px;
}
.fav-label { color: #a1a1aa; font-size: 14px; text-transform: uppercase; letter-spacing: 1px; }
.fav-title { color: #fff; font-size: 24px; font-weight: 700; margin-bottom: 8px; line-height: 1.2; }
.fav-box .btn { width: 100%; margin-top: 0; text-align: center; }


/* DARKTV_TCL_ANDROID_SAFE_AREA_V1 */
/*
 * Ajuste exclusivo do APK Android TV.
 * A classe android-tv-safe é adicionada pela MainActivity depois do carregamento.
 * Evita zoom excessivo em TCL/Google TV e mantém informações dentro da safe area.
 */
html.android-tv-safe body {
  zoom: 1 !important;
}

/* Mantém os elementos de navegação longe das bordas que algumas TVs recortam. */
html.android-tv-safe .topbar {
  padding-left: 64px;
  padding-right: 64px;
}

html.android-tv-safe .bb-info {
  left: 64px;
  width: 44%;
}

html.android-tv-safe .row h2 {
  margin-left: 64px;
}

html.android-tv-safe .row-track {
  padding-left: 64px;
  padding-right: 64px;
}

html.android-tv-safe .cats {
  padding-left: 36px;
  padding-bottom: 48px;
}

html.android-tv-safe .grid-main {
  padding-right: 36px;
}

/* Tela de detalhe: sobe o conteúdo e reserva bordas para 720p/1080p/4K. */
html.android-tv-safe .detail-body {
  padding-left: 64px;
  padding-right: 64px;
  padding-bottom: 52px;
}

html.android-tv-safe .detail-body h1 {
  max-width: 82%;
}

/* Player: pequena moldura preta invisível no fundo preto para evitar overscan. */
html.android-tv-safe #video {
  position: absolute;
  left: 28px;
  top: 18px;
  width: calc(100% - 56px);
  height: calc(100% - 36px);
  object-fit: contain !important;
  transform: none;
}

html.android-tv-safe .osd-top {
  padding: 44px 68px;
}

html.android-tv-safe .osd-bottom {
  left: 68px;
  right: 68px;
  bottom: 58px;
}

html.android-tv-safe .player-error {
  left: 32px;
  right: 32px;
}

/* Modal PIX/MAC: sempre inteiro dentro da tela da TCL. */
html.android-tv-safe .access-gate {
  overflow: hidden;
}

html.android-tv-safe .access-modal {
  width: 420px;
  max-width: calc(100% - 96px);
  max-height: calc(100% - 64px);
  padding: 14px 26px 16px;
  overflow: hidden;
}

html.android-tv-safe .access-brand {
  font-size: 25px;
}

html.android-tv-safe .access-title {
  margin-top: 2px;
  font-size: 14px;
}

html.android-tv-safe .access-price {
  margin: 5px 0 7px;
  font-size: 28px;
}

html.android-tv-safe .access-qr {
  width: 190px;
  max-width: 190px;
  margin-bottom: 8px;
}

html.android-tv-safe .access-label {
  margin-bottom: 4px;
  font-size: 11px;
}

html.android-tv-safe .access-device-box {
  margin-top: 9px;
  padding: 8px 10px;
}

html.android-tv-safe .access-device-id {
  font-size: 18px;
  letter-spacing: 1px;
  white-space: nowrap;
}

html.android-tv-safe .access-status {
  margin-top: 9px;
  font-size: 13px;
}

/* TCLs que entregam viewport de 1280x720: layout ainda mais compacto na altura. */
@media (max-height: 800px) {
  html.android-tv-safe .detail-body {
    padding-top: 108px;
    padding-left: 64px;
    padding-right: 64px;
    padding-bottom: 38px;
  }

  html.android-tv-safe .detail-body h1 {
    font-size: 34px;
    margin-bottom: 7px;
  }

  html.android-tv-safe .dt-meta {
    margin-bottom: 8px;
  }

  html.android-tv-safe .dt-desc {
    max-width: 64%;
    max-height: 62px;
    font-size: 14px;
    line-height: 1.35;
  }

  html.android-tv-safe .bb-actions {
    margin-top: 12px;
  }

  html.android-tv-safe .seasons {
    margin: 14px 0 10px;
  }

  html.android-tv-safe .episodes {
    padding-bottom: 16px;
  }

  html.android-tv-safe .access-modal {
    width: 400px;
    max-height: calc(100% - 52px);
    padding-top: 11px;
    padding-bottom: 12px;
  }

  html.android-tv-safe .access-qr {
    width: 172px;
    max-width: 172px;
    margin-bottom: 6px;
  }

  html.android-tv-safe .access-price {
    font-size: 25px;
  }

  html.android-tv-safe .access-device-box {
    margin-top: 7px;
    padding-top: 6px;
    padding-bottom: 6px;
  }

  html.android-tv-safe .access-status {
    margin-top: 7px;
  }
}
