:root {
  --primary: #e50914; --primary-text: #fff;
  --bg: #0b0d12; --surface: #151922; --surface2: #1e2430;
  --text: #eef1f6; --muted: #8a93a6; --radius: 10px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--text);
  font-family: Inter, "Segoe UI", Roboto, Arial, sans-serif; font-size: 15px;
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; }
input, select { font: inherit; }
.muted { color: var(--muted); }
.center { text-align: center; }
.error { color: #ff6b6b; }

.btn { background: var(--surface2); border: 0; border-radius: var(--radius); padding: 11px 18px; font-weight: 600; }
.btn.primary { background: var(--primary); color: var(--primary-text); }
.btn:hover { filter: brightness(1.1); }
.icon-btn { background: transparent; border: 0; font-size: 20px; padding: 6px 10px; border-radius: 8px; }
.icon-btn:hover { background: var(--surface2); }
:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }

/* LOGIN */
#login { min-height: 100%; display: grid; place-items: center; padding: 24px 16px;
  background: radial-gradient(1200px 600px at 20% -10%, color-mix(in srgb, var(--primary) 25%, transparent), transparent), var(--bg); }
.login-card { width: 100%; max-width: 420px; background: var(--surface); border-radius: 16px; padding: 32px 28px; box-shadow: 0 20px 60px rgba(0,0,0,.5); }
.brand-logo { height: 34px; display: block; }
.brand-logo.big { height: 56px; margin: 0 auto 8px; }
.tagline { text-align: center; color: var(--muted); margin: 0 0 22px; }
.tabs { display: flex; background: var(--surface2); border-radius: var(--radius); padding: 4px; margin-bottom: 18px; }
.tab { flex: 1; background: transparent; border: 0; padding: 9px; border-radius: 8px; color: var(--muted); font-weight: 600; }
.tab.active { background: var(--primary); color: var(--primary-text); }
.login-form { display: grid; gap: 14px; }
.login-form label { display: grid; gap: 6px; font-size: 13px; color: var(--muted); }
.login-form input, select { background: var(--bg); border: 1px solid var(--surface2); color: var(--text); border-radius: 8px; padding: 11px 12px; }
.login-form input:focus { border-color: var(--primary); outline: none; }
.disclaimer { font-size: 12px; color: var(--muted); text-align: center; margin: 18px 0 0; }

/* APP */
#app { height: 100%; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 18px; padding: 12px 20px; background: var(--surface); border-bottom: 1px solid var(--surface2); }
.sections { display: flex; gap: 4px; }
.sections button { background: transparent; border: 0; padding: 8px 14px; border-radius: 8px; color: var(--muted); font-weight: 600; }
.sections button.active { color: var(--text); background: var(--surface2); box-shadow: inset 0 -2px 0 var(--primary); }
.search { flex: 1; display: flex; justify-content: flex-end; }
.search input { width: 100%; max-width: 320px; background: var(--bg); border: 1px solid var(--surface2); color: var(--text); border-radius: 999px; padding: 9px 16px; }
.layout { flex: 1; display: flex; min-height: 0; }
.sidebar { width: 260px; flex: none; overflow-y: auto; background: var(--surface); border-right: 1px solid var(--surface2); }
.sidebar ul { list-style: none; margin: 0; padding: 8px; }
.sidebar li button { width: 100%; text-align: left; background: transparent; border: 0; padding: 9px 12px; border-radius: 8px; display: flex; justify-content: space-between; gap: 8px; color: var(--muted); }
.sidebar li button span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar li button.active, .sidebar li button:hover { background: var(--surface2); color: var(--text); }
.sidebar li button.active { box-shadow: inset 3px 0 0 var(--primary); }
.content { flex: 1; overflow-y: auto; padding: 20px; }
.content-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 16px; }
.content-head h1 { font-size: 22px; margin: 0; }

.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.grid.live { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.card { position: relative; background: var(--surface); border: 0; border-radius: var(--radius); padding: 0; overflow: hidden; text-align: left; transition: transform .15s, box-shadow .15s; }
.card:hover, .card:focus-visible { transform: translateY(-3px); box-shadow: 0 10px 30px rgba(0,0,0,.5); }
.card .thumb { width: 100%; aspect-ratio: 2/3; background: var(--surface2) center/cover no-repeat; display: grid; place-items: center; color: var(--muted); font-size: 28px; font-weight: 700; }
.grid.live .card .thumb { aspect-ratio: 16/9; background-size: contain; background-origin: content-box; padding: 14px; }
.card .name { padding: 9px 10px; font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .fav { position: absolute; top: 6px; right: 6px; background: rgba(0,0,0,.55); border: 0; border-radius: 999px; width: 30px; height: 30px; font-size: 15px; color: #fff; opacity: 0; transition: opacity .15s; }
.card:hover .fav, .card .fav.on { opacity: 1; }
.card .fav.on { color: #ffcc00; }
#sentinel { height: 1px; }

/* LOADING */
.loading { position: fixed; inset: 0; background: rgba(11,13,18,.85); display: grid; place-content: center; justify-items: center; z-index: 50; }
.spinner { width: 46px; height: 46px; border: 4px solid var(--surface2); border-top-color: var(--primary); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* OVERLAYS */
.overlay { position: fixed; inset: 0; background: rgba(0,0,0,.8); z-index: 40; display: grid; place-items: center; padding: 16px; }
.player-box { width: 100%; max-width: 1200px; background: #000; border-radius: 12px; overflow: hidden; }
.player-top { display: flex; align-items: center; gap: 8px; padding: 8px 10px; background: var(--surface); }
.player-title { flex: 1; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#video { width: 100%; aspect-ratio: 16/9; background: #000; display: block; max-height: 80vh; }
#player-error { padding: 12px; margin: 0; }

.series-box, .account-box { position: relative; width: 100%; max-width: 820px; max-height: 90vh; overflow-y: auto; background: var(--surface); border-radius: 14px; padding: 24px; }
.account-box { max-width: 460px; }
.close { position: absolute; top: 12px; right: 12px; }
.series-head { display: flex; gap: 20px; margin-bottom: 18px; }
.series-head img { width: 150px; aspect-ratio: 2/3; object-fit: cover; border-radius: var(--radius); background: var(--surface2); flex: none; }
.series-head h2 { margin: 0 32px 8px 0; }
.series-head p { max-height: 7.5em; overflow: hidden; }
.episodes { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.episodes button { width: 100%; text-align: left; background: var(--surface2); border: 0; border-radius: 8px; padding: 12px 14px; display: flex; gap: 12px; }
.episodes button:hover { background: color-mix(in srgb, var(--primary) 30%, var(--surface2)); }
.episodes .num { color: var(--primary); font-weight: 700; min-width: 2.5em; }
#account-info { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; }
#account-info dt { color: var(--muted); }
#account-info dd { margin: 0; word-break: break-all; }
.row { display: flex; gap: 10px; margin-top: 20px; }

/* App Android / TV: foco bem visível para o controle remoto */
.in-app :focus { outline: 3px solid var(--primary); outline-offset: 2px; }
.in-app .card:focus { transform: scale(1.06); box-shadow: 0 0 0 3px var(--primary), 0 12px 30px rgba(0,0,0,.6); z-index: 1; }
.in-app .card:focus .fav { opacity: 1; }

.only-mobile { display: none; }
@media (max-width: 820px) {
  .only-mobile { display: inline-block; }
  .topbar { flex-wrap: wrap; gap: 10px; padding: 10px 16px; }
  .sections { order: 3; width: 100%; overflow-x: auto; }
  .search { order: 4; width: 100%; }
  .search input { max-width: none; }
  .sidebar { position: fixed; top: 0; bottom: 0; left: 0; z-index: 30; transform: translateX(-100%); transition: transform .2s; box-shadow: 10px 0 40px rgba(0,0,0,.6); }
  .sidebar.open { transform: none; }
  .content { padding: 16px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; }
  .grid.live { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .series-head { flex-direction: column; }
  .overlay { padding: 0; }
  .player-box { border-radius: 0; }
}
.in-app .app-link { display: none; }
