:root {
  --ui-scale: 1;
  --ui-virtual-width: 1920px;
  --ui-virtual-height: 1080px;
  --bg: #07090c;
  --panel: #0f1318;
  --panel-2: #151a20;
  --panel-3: #1b2128;
  --text: #eef1f4;
  --muted: #99a2ad;
  --line: rgba(255,255,255,.09);
  --accent: #e50914;
  --accent-2: #ff2530;
  --sidebar: 210px;
  --radius: 14px;
  --focus: #ff2634;
}
* { box-sizing: border-box; }
html, body { width: 100%; min-height: 100%; margin: 0; background: var(--bg); color: var(--text); font-family: Arial, Helvetica, sans-serif; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
body { overflow: hidden; }

/*
 * Viewport adaptativo para TVs/STBs.
 * O JavaScript calcula uma escala tomando 1920x1080 como referência.
 * A interface inteira é renderizada em um viewport virtual e depois
 * escalada para ocupar exatamente a área disponível da TV/dispositivo.
 * O player fica fora deste wrapper para não interferir no fullscreen.
 */
#ui-viewport {
  position: fixed;
  left: 0;
  top: 0;
  width: var(--ui-virtual-width);
  height: var(--ui-virtual-height);
  -webkit-transform: scale(var(--ui-scale));
  transform: scale(var(--ui-scale));
  -webkit-transform-origin: 0 0;
  transform-origin: 0 0;
  overflow: hidden;
  background: var(--bg);
  will-change: transform;
}

button, input { font: inherit; }
button { color: inherit; }
.hidden { display: none !important; }

.boot-loading, .global-loading {
  position: fixed; left: 0; top: 0; right: 0; bottom: 0; z-index: 5000; display: -webkit-flex; display: flex; -webkit-flex-direction: column; flex-direction: column; -webkit-align-items: center; align-items: center; -webkit-justify-content: center; justify-content: center;
  gap: 16px; background: #07090c; color: #cfd5dc; font-size: 16px;
}
.global-loading { background: rgba(7,9,12,.72); }
.spinner { width: 42px; height: 42px; border: 4px solid rgba(255,255,255,.16); border-top-color: #fff; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.login-view { position: absolute; left: 0; top: 0; right: 0; bottom: 0; width: 100%; height: 100%; display: -webkit-flex; display: flex; -webkit-align-items: center; align-items: center; -webkit-justify-content: center; justify-content: center; background: #07090c; overflow: hidden; }
.login-bg { position: absolute; left: 0; top: 0; right: 0; bottom: 0; background: radial-gradient(circle at 75% 25%, rgba(229,9,20,.14), transparent 32%), radial-gradient(circle at 15% 80%, rgba(117,67,255,.10), transparent 30%), linear-gradient(135deg,#080b0f 0%,#10151b 45%,#07090c 100%); }
.login-card { position: relative; width: 430px; padding: 42px; background: rgba(14,18,23,.96); border: 1px solid var(--line); border-radius: 20px; box-shadow: 0 26px 80px rgba(0,0,0,.45); }
.login-logo { display: block; width: 160px; max-height: 70px; object-fit: contain; object-position: left center; margin: 0 0 28px; }
.login-card h1 { margin: 0 0 8px; font-size: 32px; }
.login-card p { margin: 0 0 28px; color: var(--muted); line-height: 1.5; }
.login-card label { display: block; margin: 14px 0 7px; color: #d8dde3; font-size: 14px; }
.login-card input { width: 100%; height: 52px; border: 1px solid #2d343d; border-radius: 10px; padding: 0 14px; color: #fff; background: #0b0f13; outline: none; }
.primary-btn { width: 100%; min-height: 52px; margin-top: 20px; border: 0; border-radius: 10px; background: var(--accent); color: #fff; font-weight: 700; cursor: pointer; }
.form-error { min-height: 20px; margin-top: 14px; color: #ff6670; font-size: 14px; }

:focus { outline: none; }
[data-focusable="1"]:focus {
  outline: 0;
  border-color: var(--focus) !important;
  box-shadow: 0 0 0 3px var(--focus), 0 0 0 7px rgba(229,9,20,.20), 0 8px 28px rgba(0,0,0,.48);
}


.app-shell { width: 100%; height: 100%; display: flex; background: var(--bg); }
.sidebar { width: var(--sidebar); flex: 0 0 var(--sidebar); height: 100%; background: #080a0d; border-right: 1px solid rgba(255,255,255,.06); display: flex; flex-direction: column; padding: 18px 12px; z-index: 20; }
.brand-wrap { height: 110px; display: flex; align-items: center; padding: 0 20px; }
.brand-logo { width: 135px; max-height: 60px; object-fit: contain; object-position: left center; }
.side-nav { display: flex; flex-direction: column; gap: 7px; }
.nav-btn { width: 100%; height: 58px; padding: 0 16px; border: 0; border-radius: 12px; background: transparent; display: flex; align-items: center; gap: 14px; color: #d4d9df; text-align: left; font-weight: 700; cursor: pointer; }
.nav-btn:hover { background: rgba(255,255,255,.05); }
.nav-btn.active { background: linear-gradient(90deg,rgba(229,9,20,.22),rgba(255,255,255,.055)); box-shadow: inset 4px 0 0 var(--accent); color: #fff; }
.nav-btn.small { height: 52px; }
.nav-icon { width: 27px; height: 27px; flex: 0 0 27px; display: -webkit-flex; display: flex; -webkit-align-items: center; align-items: center; -webkit-justify-content: center; justify-content: center; }
.nav-icon svg { width: 26px; height: 26px; fill: currentColor; }
.side-bottom { margin-top: auto; }
.clock { padding: 0 14px 14px; color: #8d98a4; font-size: 14px; font-weight: 700; }
.main { flex: 1 1 auto; min-width: 0; height: 100%; overflow: hidden; }
.view-root { width: 100%; height: 100%; overflow-y: auto; overflow-x: hidden; scrollbar-width: thin; scrollbar-color: #2a3139 transparent; }
.view-root::-webkit-scrollbar { width: 8px; }
.view-root::-webkit-scrollbar-thumb { background: #2a3139; border-radius: 6px; }

/* Home */
.home-view { min-height: 100%; padding-bottom: 60px; }
.hero { position: relative; height: 430px; overflow: hidden; background: #10141a; }
.hero-art { position: absolute; left: 0; top: 0; right: 0; bottom: 0; background-size: cover; background-position: center 25%; opacity: .55; transform: scale(1.02); }
.hero-shade { position: absolute; left: 0; top: 0; right: 0; bottom: 0; background: linear-gradient(90deg,#07090c 0%,rgba(7,9,12,.94) 22%,rgba(7,9,12,.55) 55%,rgba(7,9,12,.15) 78%), linear-gradient(0deg,#07090c 0%,transparent 42%); }
.hero-content { position: relative; z-index: 2; width: 58%; height: 100%; padding: 74px 56px 48px; display: flex; flex-direction: column; justify-content: center; }
.eyebrow { color: #d7dce1; text-transform: uppercase; font-size: 13px; letter-spacing: .26em; font-weight: 700; }
.hero-title { margin: 10px 0 10px; font-size: 56px; line-height: .98; letter-spacing: -.035em; }
.hero-meta { color: #d1d6dc; font-size: 15px; margin-bottom: 13px; }
.hero-description { max-width: 720px; margin: 0 0 22px; color: #d9dde1; line-height: 1.55; font-size: 16px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.hero-actions { display: flex; gap: 12px; }
.action-btn { min-width: 150px; height: 48px; border: 1px solid rgba(255,255,255,.22); border-radius: 9px; background: rgba(29,34,41,.86); color: #fff; padding: 0 20px; font-weight: 700; cursor: pointer; }
.action-btn.primary { background: #fff; color: #080a0d; border-color: #fff; }
.home-body { margin-top: -20px; position: relative; z-index: 3; padding: 0 0 30px; }
.home-row { margin: 0 0 28px; }
.row-head { padding: 0 34px 12px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.row-title { margin: 0; font-size: 21px; }
.row-link { border: 0; background: transparent; color: #cfd4da; padding: 8px 10px; cursor: pointer; }
.rail { display: flex; gap: 12px; overflow-x: auto; overflow-y: visible; padding: 4px 34px 10px; scrollbar-width: none; }
.rail::-webkit-scrollbar { display: none; }

.media-card { position: relative; flex: 0 0 188px; width: 188px; height: 270px; border: 0; padding: 0; border-radius: 10px; overflow: hidden; background: #171c22; cursor: pointer; text-align: left; transition: transform .12s ease; }
.media-card.landscape { flex-basis: 290px; width: 290px; height: 164px; }
.media-card.channel { flex-basis: 250px; width: 250px; height: 130px; }
.media-card:focus { -webkit-transform: none; transform: none; z-index: 5; }
.card-img { position: absolute; left: 0; top: 0; right: 0; bottom: 0; width: 100%; height: 100%; object-fit: cover; background: #171c22; }
.card-img.logo { object-fit: contain; padding: 26px; background: #151a20; }
.card-fallback { position: absolute; left: 0; top: 0; right: 0; bottom: 0; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg,#20262d,#0f1318); color: #6f7984; font-size: 42px; }
.card-shade { position: absolute; left: 0; top: 0; right: 0; bottom: 0; background: linear-gradient(0deg,rgba(0,0,0,.98) 0%,rgba(0,0,0,.82) 24%,transparent 64%); }
.card-info { position: absolute; left: 0; right: 0; bottom: 0; padding: 13px; }
.card-name { color: #f4f5f6; font-size: 15px; line-height: 1.28; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-shadow: 0 2px 4px rgba(0,0,0,.95); }
.card-meta { margin-top: 5px; color: #c2c8cf; font-size: 12px; }
.progress-track { height: 4px; margin-top: 10px; border-radius: 3px; background: rgba(255,255,255,.28); overflow: hidden; }
.progress-bar { height: 100%; background: var(--accent); }
.empty-row { margin: 0 34px; padding: 28px; border: 1px solid var(--line); border-radius: 12px; color: var(--muted); background: var(--panel); }

/* List views */
.page { min-height: 100%; padding: 24px 28px 60px; }
.page-header { position: -webkit-sticky; position: sticky; top: 0; z-index: 12; background: linear-gradient(#07090c 75%,rgba(7,9,12,.88) 90%,transparent); padding: 0 0 22px; }
.header-top { display: flex; align-items: center; min-height: 58px; gap: 14px; }
.back-btn { width: 46px; height: 46px; border-radius: 10px; border: 1px solid var(--line); background: #11161b; color: #fff; font-size: 23px; cursor: pointer; }
.page-title-wrap { min-width: 0; flex: 1; }
.page-title { margin: 0; font-size: 28px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.page-subtitle { margin-top: 4px; color: var(--muted); font-size: 13px; }
.search-tools { display: flex; align-items: center; gap: 8px; width: 520px; max-width: 42vw; }
.search-box { height: 46px; flex: 1; min-width: 0; border: 1px solid #2d343d; border-radius: 10px; padding: 0 14px; color: #fff; background: #12171c; outline: none; }
.keyboard-toggle { width: 48px; height: 46px; border: 1px solid var(--line); border-radius: 10px; background: #151a20; color: #fff; cursor: pointer; }
.virtual-keyboard { margin: 12px -3px 0; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: #0d1116; display: -webkit-flex; display: flex; -webkit-flex-wrap: wrap; flex-wrap: wrap; }
.key-btn { width: calc(10% - 6px); height: 42px; min-width: 0; margin: 3px; border: 1px solid #2d343d; border-radius: 8px; background: #171d23; color: #fff; font-weight: 700; cursor: pointer; }
.key-btn.wide { width: calc(20% - 6px); }

/* Compatibilidade com navegadores antigos de Smart TV/Smart UP: sem CSS Grid. */
.category-grid { display: -webkit-flex; display: flex; -webkit-flex-wrap: wrap; flex-wrap: wrap; margin: -7px; }
.category-card { width: calc(16.666666% - 14px); -webkit-flex: 0 0 calc(16.666666% - 14px); flex: 0 0 calc(16.666666% - 14px); height: 92px; margin: 7px; border: 1px solid var(--line); border-radius: 13px; background: linear-gradient(135deg,#151a20,#0e1217); padding: 0 18px; color: #fff; text-align: left; font-weight: 700; cursor: pointer; display: -webkit-flex; display: flex; -webkit-align-items: center; align-items: center; -webkit-justify-content: space-between; justify-content: space-between; }
.category-card .count { color: #707b86; font-weight: 400; }

.content-grid { display: -webkit-flex; display: flex; -webkit-flex-wrap: wrap; flex-wrap: wrap; -webkit-align-items: stretch; align-items: stretch; margin: -7px; }
.grid-card { position: relative; width: calc(12.5% - 14px); -webkit-flex: 0 0 calc(12.5% - 14px); flex: 0 0 calc(12.5% - 14px); height: 270px; min-height: 0; margin: 7px; border: 0; border-radius: 10px; padding: 0; overflow: hidden; background: #171c22; cursor: pointer; text-align: left; }
.content-grid.live-grid { display: -webkit-flex; display: flex; }
.live-grid .grid-card { width: calc(16.666666% - 14px); -webkit-flex: 0 0 calc(16.666666% - 14px); flex: 0 0 calc(16.666666% - 14px); height: 150px; min-height: 0; }
.grid-card:focus { -webkit-transform: none; transform: none; z-index: 8; }
.grid-card .card-img.logo { padding: 28px; }
.grid-card .card-info { padding: 12px; }
.rating-pill { position: absolute; top: 9px; right: 9px; background: rgba(0,0,0,.78); border-radius: 6px; padding: 5px 8px; font-size: 12px; font-weight: 700; }
.load-more { width: 100%; height: 52px; margin-top: 20px; border: 1px solid var(--line); border-radius: 10px; background: #151a20; color: #fff; cursor: pointer; font-weight: 700; }
.empty-state { padding: 70px 20px; text-align: center; color: var(--muted); }
.empty-state strong { display: block; color: #fff; font-size: 23px; margin-bottom: 10px; }

/* Details */
.detail-page { min-height: 100%; position: relative; overflow: hidden; }
.detail-bg { position: absolute; left: 0; top: 0; right: 0; height: 520px; background-size: cover; background-position: center 25%; opacity: .34; }
.detail-shade { position: absolute; left: 0; top: 0; right: 0; bottom: 0; background: linear-gradient(90deg,#07090c 5%,rgba(7,9,12,.88) 46%,rgba(7,9,12,.36)), linear-gradient(0deg,#07090c 8%,transparent 62%); }
.detail-content { position: relative; z-index: 2; padding: 30px 34px 70px; }
.detail-back { margin-bottom: 32px; }
.detail-hero { display: -webkit-flex; display: flex; -webkit-align-items: flex-start; align-items: flex-start; min-height: 360px; }
.detail-poster { -webkit-flex: 0 0 240px; flex: 0 0 240px; margin-right: 32px; width: 240px; height: 350px; border-radius: 12px; object-fit: cover; background: #151a20; box-shadow: 0 18px 44px rgba(0,0,0,.35); }
.detail-info { -webkit-flex: 1 1 auto; flex: 1 1 auto; min-width: 0; padding-top: 22px; max-width: 900px; }
.detail-info h1 { margin: 0 0 10px; font-size: 44px; line-height: 1.02; }
.detail-meta { color: #d1d6dc; font-size: 15px; margin-bottom: 18px; }
.detail-plot { color: #d7dce1; line-height: 1.6; max-width: 850px; }
.detail-credits { color: #aeb6c0; line-height: 1.55; font-size: 14px; }
.detail-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 24px 0; }
.detail-actions .action-btn { min-width: 170px; }
.section-title { margin: 34px 0 15px; font-size: 22px; }
.season-tabs { display: flex; gap: 9px; overflow-x: auto; padding-bottom: 8px; }
.season-btn { min-width: 120px; height: 44px; border: 1px solid var(--line); border-radius: 9px; background: #151a20; color: #fff; cursor: pointer; }
.season-btn.active { background: var(--accent); border-color: var(--accent); }
.episodes { display: -webkit-flex; display: flex; -webkit-flex-wrap: wrap; flex-wrap: wrap; margin: 8px -6px 0; }
.episode-card { width: calc(33.333333% - 12px); -webkit-flex: 0 0 calc(33.333333% - 12px); flex: 0 0 calc(33.333333% - 12px); margin: 6px; min-height: 100px; border: 1px solid var(--line); border-radius: 11px; background: #11161b; padding: 14px 16px; color: #fff; text-align: left; cursor: pointer; }
.episode-card strong { display: block; margin-bottom: 6px; }
.episode-card span { color: var(--muted); font-size: 13px; }

/* Favorites/history/settings */
.settings-panel { max-width: 760px; }
.setting-row { border-bottom: 1px solid var(--line); padding: 18px 0; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.setting-label strong { display: block; margin-bottom: 5px; }
.setting-label span { color: var(--muted); font-size: 13px; }
.select-like { display: flex; gap: 7px; }
.select-like button { height: 42px; border: 1px solid var(--line); border-radius: 8px; background: #151a20; color: #fff; padding: 0 14px; cursor: pointer; }
.select-like button.active { background: var(--accent); border-color: var(--accent); }
.danger-btn { height: 44px; border: 1px solid rgba(255,80,90,.35); border-radius: 9px; background: rgba(229,9,20,.12); color: #ff8188; padding: 0 18px; cursor: pointer; }

/* Player: it does not exist visually until a stream is opened */
.player-view { position: fixed; left: 0; top: 0; right: 0; bottom: 0; width: 100%; height: 100%; z-index: 1000; background: #000; display: flex; flex-direction: column; }
.player-topbar { height: 70px; flex: 0 0 70px; padding: 10px 16px; display: flex; align-items: center; gap: 14px; background: #090b0e; border-bottom: 1px solid rgba(255,255,255,.08); }
.player-back { height: 44px; border: 1px solid var(--line); border-radius: 9px; background: #151a20; color: #fff; padding: 0 16px; cursor: pointer; font-weight: 700; }
.player-title-wrap { flex: 1; min-width: 0; }
.player-title { font-size: 16px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player-subtitle { color: #9fa8b2; margin-top: 3px; font-size: 12px; }
.player-actions { display: flex; gap: 7px; }
.player-mode { height: 42px; padding: 0 12px; border: 1px solid var(--line); border-radius: 8px; background: #151a20; color: #fff; cursor: pointer; }
.player-mode.active { background: var(--accent); border-color: var(--accent); }
.video-stage { position: relative; flex: 1; min-height: 0; display: -webkit-flex; display: flex; -webkit-align-items: center; align-items: center; -webkit-justify-content: center; justify-content: center; background: #000; }
#video { width: 100%; height: 100%; max-width: 100%; max-height: 100%; object-fit: contain !important; object-position: center center; background: #000; transform: none !important; }
.video-loading, .video-error { position: absolute; left: 0; top: 0; right: 0; bottom: 0; display: -webkit-flex; display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 14px; background: rgba(0,0,0,.64); }
.video-error strong { font-size: 20px; }
.video-error span { color: #aeb6c0; }


/* Próximo episódio: compatível com WebViews antigos de Smart TV. */
.next-episode-overlay {
  position: absolute; right: 28px; bottom: 28px; z-index: 40; width: 390px;
  padding: 20px; border: 1px solid rgba(255,255,255,.18); border-radius: 12px;
  background: rgba(10,13,17,.96); box-shadow: 0 16px 50px rgba(0,0,0,.55);
}
.next-episode-kicker { color: #aeb6c0; font-size: 12px; text-transform: uppercase; letter-spacing: .16em; margin-bottom: 7px; }
.next-episode-overlay strong { display: block; font-size: 19px; line-height: 1.25; margin-bottom: 7px; }
.next-episode-overlay > span { display: block; color: #d5dbe1; font-size: 14px; margin-bottom: 16px; }
.next-episode-actions { display: -webkit-flex; display: flex; }
.next-episode-actions button {
  height: 44px; margin-right: 8px; padding: 0 16px; border: 1px solid var(--line);
  border-radius: 8px; background: #171d23; color: #fff; font-weight: 700; cursor: pointer;
}
.next-episode-actions button:first-child { background: #fff; color: #080a0d; border-color: #fff; }

.toast { position: fixed; left: 50%; bottom: 34px; z-index: 6000; transform: translateX(-50%); padding: 12px 18px; border-radius: 9px; background: #20262d; color: #fff; box-shadow: 0 10px 30px rgba(0,0,0,.35); }


/* Fullscreen ajustado: sempre mostra o quadro inteiro, sem zoom ou corte. */
#video:fullscreen,
#video:-webkit-full-screen,
#video:-moz-full-screen {
  width: 100vw !important;
  height: 100vh !important;
  max-width: 100vw !important;
  max-height: 100vh !important;
  object-fit: contain !important;
  object-position: center center !important;
  transform: none !important;
  margin: 0 !important;
  background: #000 !important;
}

.player-view:fullscreen,
.player-view:-webkit-full-screen,
.player-view:-moz-full-screen {
  width: 100vw !important;
  height: 100vh !important;
  background: #000 !important;
}
.player-view:fullscreen .player-topbar,
.player-view:-webkit-full-screen .player-topbar,
.player-view:-moz-full-screen .player-topbar { display: none !important; }
.player-view:fullscreen .video-stage,
.player-view:-webkit-full-screen .video-stage,
.player-view:-moz-full-screen .video-stage {
  width: 100vw !important;
  height: 100vh !important;
  min-height: 100vh !important;
}
.player-view:fullscreen #video,
.player-view:-webkit-full-screen #video,
.player-view:-moz-full-screen #video {
  width: 100vw !important;
  height: 100vh !important;
  max-width: 100vw !important;
  max-height: 100vh !important;
  object-fit: contain !important;
}

/*
 * As antigas media queries por largura foram removidas de propósito.
 * Em TVs 720p/1080p/1440p/4K, a escala adaptativa mantém o mesmo
 * tamanho relativo de menus, cards e fontes, evitando "duplo encolhimento".
 */

/*
 * Ajustes responsivos sem recursos CSS modernos, pensando em Smart UP/webOS antigos.
 * Como a interface virtual trabalha perto de 1920x1080, os percentuais abaixo
 * preservam o mesmo desenho do PC: 6 categorias por linha, 8 posters por linha
 * e 6 canais por linha.
 */
@media (max-width: 1550px) {
  .category-card { width: calc(20% - 14px); -webkit-flex-basis: calc(20% - 14px); flex-basis: calc(20% - 14px); }
  .grid-card { width: calc(14.285714% - 14px); -webkit-flex-basis: calc(14.285714% - 14px); flex-basis: calc(14.285714% - 14px); }
  .live-grid .grid-card { width: calc(20% - 14px); -webkit-flex-basis: calc(20% - 14px); flex-basis: calc(20% - 14px); }
}
@media (max-width: 1150px) {
  .category-card { width: calc(25% - 14px); -webkit-flex-basis: calc(25% - 14px); flex-basis: calc(25% - 14px); }
  .grid-card { width: calc(20% - 14px); -webkit-flex-basis: calc(20% - 14px); flex-basis: calc(20% - 14px); height: 245px; }
  .live-grid .grid-card { width: calc(25% - 14px); -webkit-flex-basis: calc(25% - 14px); flex-basis: calc(25% - 14px); height: 140px; }
  .episode-card { width: calc(50% - 12px); -webkit-flex-basis: calc(50% - 12px); flex-basis: calc(50% - 12px); }
}
@media (max-width: 850px) {
  .category-card { width: calc(33.333333% - 14px); -webkit-flex-basis: calc(33.333333% - 14px); flex-basis: calc(33.333333% - 14px); }
  .grid-card { width: calc(25% - 14px); -webkit-flex-basis: calc(25% - 14px); flex-basis: calc(25% - 14px); height: 230px; }
  .live-grid .grid-card { width: calc(33.333333% - 14px); -webkit-flex-basis: calc(33.333333% - 14px); flex-basis: calc(33.333333% - 14px); height: 130px; }
}

/* Login V5.1 - código único do cliente */
#login-code {
  text-align: center;
  font-size: 25px;
  font-weight: 800;
  letter-spacing: 8px;
  padding-left: 22px;
}


/* V5.4 - navegação/rolagem por controle em Smart TV */
@media (min-width: 981px) {
  .view-root { scroll-behavior: auto; }
  .page-header { -webkit-transform: translateZ(0); transform: translateZ(0); }
  .grid-card:focus, .category-card:focus { z-index: 8; }
}

/* V5.5 - Pesquisa própria para controle remoto / Smart TV */
.search-trigger {
  width: 50px;
  height: 50px;
  -webkit-flex: 0 0 50px;
  flex: 0 0 50px;
  border: 0;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 30px;
  line-height: 50px;
  text-align: center;
  cursor: pointer;
  font-weight: 800;
}
.search-trigger:focus {
  background: var(--accent-2);
  -webkit-transform: none;
  transform: none;
  box-shadow: 0 0 0 3px #ff3b47, 0 0 0 7px rgba(229,9,20,.22), 0 0 22px rgba(229,9,20,.35);
}
.search-overlay {
  position: fixed;
  left: var(--sidebar);
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 4500;
  display: -webkit-flex;
  display: flex;
  -webkit-align-items: center;
  align-items: center;
  -webkit-justify-content: center;
  justify-content: center;
  background: rgba(4,6,9,.93);
  padding: 46px;
}
.search-panel {
  width: 920px;
  max-width: 94%;
  padding: 28px;
  border: 1px solid #2d343d;
  border-radius: 18px;
  background: #0d1116;
  box-shadow: 0 30px 90px rgba(0,0,0,.62);
}
.search-panel-head {
  display: -webkit-flex;
  display: flex;
  -webkit-align-items: center;
  align-items: center;
  -webkit-justify-content: space-between;
  justify-content: space-between;
  margin-bottom: 18px;
}
.search-panel-head strong {
  display: block;
  font-size: 28px;
}
.search-panel-head span {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 14px;
}
.search-close {
  width: 48px;
  height: 48px;
  border: 1px solid #303740;
  border-radius: 50%;
  background: #171d23;
  color: #fff;
  font-size: 28px;
  cursor: pointer;
}
.search-modal-input {
  width: 100%;
  height: 58px;
  margin-bottom: 16px;
  padding: 0 18px;
  border: 2px solid #343c46;
  border-radius: 11px;
  background: #080b0f;
  color: #fff;
  font-size: 22px;
  outline: none;
}
.search-modal-input:focus { border-color: var(--accent); }
.search-overlay .virtual-keyboard {
  margin: 0;
  padding: 12px;
}
.search-overlay .key-btn {
  height: 48px;
  font-size: 16px;
}


/* V5.6 - foco TV mais nítido, lupa SVG e favoritos por OK longo */
.search-trigger {
  display: -webkit-flex;
  display: flex;
  -webkit-align-items: center;
  align-items: center;
  -webkit-justify-content: center;
  justify-content: center;
  line-height: normal;
}
.search-trigger svg { width: 27px; height: 27px; fill: none; stroke: #fff; stroke-width: 3; stroke-linecap: round; }
.search-close:focus, .back-btn:focus, .action-btn:focus, .season-btn:focus, .episode-card:focus,
.load-more:focus, .key-btn:focus, .nav-btn:focus, .category-card:focus {
  background-color: #252b32;
}
.action-btn.primary:focus { background: #f4f4f4; color: #080a0d; }
.nav-btn:focus { color: #fff; }
.grid-card, .media-card { transition: box-shadow .10s ease, border-color .10s ease; }
.grid-card:focus .card-name, .media-card:focus .card-name { color: #fff; text-shadow: 0 2px 5px #000; }
.favorite-star {
  display: none;
  position: absolute;
  top: 9px;
  left: 9px;
  z-index: 9;
  min-width: 31px;
  height: 31px;
  padding: 0 7px;
  border-radius: 16px;
  background: rgba(229,9,20,.96);
  color: #fff;
  font-size: 20px;
  line-height: 31px;
  text-align: center;
  box-shadow: 0 3px 12px rgba(0,0,0,.55);
}
.favorite-star.visible { display: block; }
.favorite-pulse { box-shadow: 0 0 0 4px #ff2634, 0 0 28px rgba(255,38,52,.75) !important; }
.page-title, .row-title, .detail-info h1, .section-title { color: #f2f4f6; text-shadow: 0 1px 2px rgba(0,0,0,.65); }
.page-subtitle, .detail-meta, .detail-plot, .detail-credits, .episode-card span { color: #b8c0c8; }
@media (min-width: 981px) {
  /* Evita rasterização borrada por animação/transform do item focado em WebViews de TV. */
  .media-card:focus, .grid-card:focus, .search-trigger:focus, .category-card:focus,
  .episode-card:focus, .action-btn:focus, .nav-btn:focus, .back-btn:focus {
    -webkit-transform: none !important;
    transform: none !important;
  }
}


/* V5.7 - modal de pesquisa travado + controles de player para Smart TV */
.search-overlay:not(.hidden) { pointer-events: auto; }
.search-overlay:not(.hidden) ~ * { pointer-events: none; }

.player-controls-overlay {
  position: absolute;
  left: 50%;
  bottom: 42px;
  z-index: 120;
  width: 660px;
  max-width: 88%;
  margin-left: -330px;
  padding: 18px 20px 16px;
  border: 1px solid rgba(255,255,255,.20);
  border-radius: 14px;
  background: rgba(8,11,15,.94);
  box-shadow: 0 18px 60px rgba(0,0,0,.65);
}
.player-controls-hint {
  margin-bottom: 12px;
  color: #c8d0d8;
  font-size: 13px;
  text-align: center;
}
.player-controls-row {
  display: -webkit-flex;
  display: flex;
  -webkit-align-items: center;
  align-items: center;
  -webkit-justify-content: center;
  justify-content: center;
  gap: 10px;
}
.player-control-btn {
  min-width: 120px;
  height: 52px;
  padding: 0 18px;
  border: 2px solid #3a424c;
  border-radius: 10px;
  background: #171d23;
  color: #f2f4f6;
  font-size: 17px;
  font-weight: 800;
  cursor: pointer;
}
.player-control-btn.primary { background: #f2f4f6; color: #080a0d; border-color: #f2f4f6; }
.player-control-btn:focus {
  border-color: #ff2634 !important;
  box-shadow: 0 0 0 3px #ff2634, 0 0 0 7px rgba(255,38,52,.22), 0 8px 26px rgba(0,0,0,.55) !important;
  -webkit-transform: none !important;
  transform: none !important;
}
.player-time {
  margin-top: 12px;
  color: #d9dfe5;
  font-size: 14px;
  font-weight: 700;
  text-align: center;
}
.player-view:fullscreen .player-controls-overlay,
.player-view:-webkit-full-screen .player-controls-overlay,
.player-view:-moz-full-screen .player-controls-overlay { display: block; }
.player-view:fullscreen .player-controls-overlay.hidden,
.player-view:-webkit-full-screen .player-controls-overlay.hidden,
.player-view:-moz-full-screen .player-controls-overlay.hidden { display: none !important; }


/* Fullscreen interno do portal: mantém o JavaScript com controle das setas. */
.player-view.tv-fullscreen .player-topbar { display: none !important; }
.player-view.tv-fullscreen .video-stage {
  width: 100vw !important;
  height: 100vh !important;
  min-height: 100vh !important;
  -webkit-flex: 1 1 100vh;
  flex: 1 1 100vh;
}
.player-view.tv-fullscreen #video {
  width: 100vw !important;
  height: 100vh !important;
  max-width: 100vw !important;
  max-height: 100vh !important;
  object-fit: contain !important;
  object-position: center center !important;
}
.player-view.tv-fullscreen .player-controls-overlay { display: block; }
.player-view.tv-fullscreen .player-controls-overlay.hidden { display: none !important; }


/* V5.8 - tipografia maior e mais nítida para Smart TV / uso à distância.
 * Apenas textos são ampliados: a grade, as capas e a estrutura permanecem iguais.
 */
html.tv-readable-text,
html.tv-readable-text body {
  -webkit-font-smoothing: subpixel-antialiased;
  text-rendering: optimizeLegibility;
}
html.tv-readable-text .nav-btn { font-size: 20px; font-weight: 800; }
html.tv-readable-text .clock { font-size: 17px; color: #c1c8d0; }

html.tv-readable-text .eyebrow { font-size: 16px; font-weight: 800; }
html.tv-readable-text .hero-title { font-size: 64px; }
html.tv-readable-text .hero-meta { font-size: 19px; font-weight: 700; color: #eef1f4; }
html.tv-readable-text .hero-description { font-size: 20px; line-height: 1.48; color: #f0f2f4; }
html.tv-readable-text .action-btn { font-size: 18px; font-weight: 800; }
html.tv-readable-text .row-title { font-size: 27px; font-weight: 800; }
html.tv-readable-text .row-link { font-size: 18px; font-weight: 700; color: #f0f2f4; }

html.tv-readable-text .card-name {
  font-size: 19px;
  line-height: 1.24;
  font-weight: 800;
  color: #fff;
  text-shadow: 0 2px 5px #000, 0 0 2px #000;
}
html.tv-readable-text .card-meta { font-size: 15px; font-weight: 700; color: #e0e5ea; }
html.tv-readable-text .rating-pill { font-size: 15px; }
html.tv-readable-text .category-card { font-size: 19px; font-weight: 800; }
html.tv-readable-text .category-card .count { font-size: 16px; color: #c0c8d0; }
html.tv-readable-text .load-more { font-size: 18px; font-weight: 800; }
html.tv-readable-text .empty-state { font-size: 18px; }
html.tv-readable-text .empty-state strong { font-size: 27px; }

html.tv-readable-text .back-btn { font-size: 27px; font-weight: 800; }
html.tv-readable-text .page-title { font-size: 35px; font-weight: 800; color: #fff; }
html.tv-readable-text .page-subtitle { font-size: 17px; font-weight: 700; color: #d0d6dc; }
html.tv-readable-text .search-panel-head strong { font-size: 33px; }
html.tv-readable-text .search-panel-head span { font-size: 17px; color: #d0d6dc; }
html.tv-readable-text .search-modal-input { font-size: 25px; font-weight: 700; }
html.tv-readable-text .search-overlay .key-btn { font-size: 19px; font-weight: 800; }

html.tv-readable-text .detail-info h1 { font-size: 52px; color: #fff; }
html.tv-readable-text .detail-meta { font-size: 19px; font-weight: 700; color: #eef1f4; }
html.tv-readable-text .detail-plot { font-size: 19px; line-height: 1.55; color: #f0f2f4; }
html.tv-readable-text .detail-credits { font-size: 17px; color: #d6dce2; }
html.tv-readable-text .section-title { font-size: 28px; }
html.tv-readable-text .season-btn { font-size: 17px; font-weight: 800; }
html.tv-readable-text .episode-card strong { font-size: 19px; line-height: 1.3; }
html.tv-readable-text .episode-card span { font-size: 16px; line-height: 1.35; color: #d3d9df; }

html.tv-readable-text .setting-label strong { font-size: 19px; }
html.tv-readable-text .setting-label span { font-size: 16px; line-height: 1.35; color: #d0d6dc; }
html.tv-readable-text .select-like button,
html.tv-readable-text .danger-btn { font-size: 17px; font-weight: 800; }

html.tv-readable-text .player-back,
html.tv-readable-text .player-mode { font-size: 17px; font-weight: 800; }
html.tv-readable-text .player-title { font-size: 21px; font-weight: 800; }
html.tv-readable-text .player-subtitle { font-size: 15px; color: #cbd2d9; }
html.tv-readable-text .player-controls-hint { font-size: 16px; }
html.tv-readable-text .player-control-btn { font-size: 19px; }
html.tv-readable-text .player-time { font-size: 17px; }
html.tv-readable-text .next-episode-kicker { font-size: 15px; }
html.tv-readable-text .next-episode-overlay strong { font-size: 23px; }
html.tv-readable-text .next-episode-overlay > span { font-size: 17px; }
html.tv-readable-text .next-episode-actions button { font-size: 17px; }
html.tv-readable-text .toast { font-size: 18px; font-weight: 700; }

html.tv-readable-text .login-card h1 { font-size: 38px; }
html.tv-readable-text .login-card p { font-size: 18px; color: #d1d7dd; }
html.tv-readable-text .login-card label { font-size: 17px; font-weight: 700; }
html.tv-readable-text .login-card input { font-size: 20px; font-weight: 700; }
html.tv-readable-text #login-code { font-size: 31px; }
html.tv-readable-text .primary-btn { font-size: 19px; font-weight: 800; }
html.tv-readable-text .form-error { font-size: 17px; }
