:root {
  --bg: #0c0c10;
  --bg-2: #14141a;
  --bg-3: #1c1c24;
  --line: #2a2a34;
  --text: #f1f0f4;
  --muted: #9a98a6;
  --accent: #ff5a36;
  --accent-2: #ff8a3d;
  --good: #3ddc97;
  --mid: #f5c542;
  --bad: #ff5d6c;
  --radius: 12px;
  --nav-w: 84px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 Manrope, system-ui, sans-serif; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }
svg { width: 1em; height: 1em; fill: currentColor; flex: none; }
h1, h2 { margin: 0; letter-spacing: -0.02em; }
code { background: var(--bg-3); padding: 1px 6px; border-radius: 5px; font-size: .9em; }
.muted { color: var(--muted); }
.hidden { display: none !important; }
body.playing { overflow: hidden; }

/* Espaçamento entre itens de flex sem usar "gap" (não suportado em WebViews antigos de TV box):
   fileira sem quebra de linha → margem no vizinho seguinte; fileira que quebra → margem em
   volta de cada item + margem negativa no contêiner para cancelar a borda externa. */

/* ---------- navegação ---------- */
.nav { position: fixed; top: 0; right: auto; bottom: 0; left: 0; width: var(--nav-w); display: flex; flex-direction: column; align-items: center; padding: 18px 0; z-index: 20; background: linear-gradient(90deg, rgba(12,12,16,.96), rgba(12,12,16,.75)); backdrop-filter: blur(10px); }
.nav > * + * { margin-top: 22px; }
.brand svg { width: 40px; height: 40px; }
.brand rect { fill: var(--accent); }
.brand path { fill: #fff; }
.nav nav { display: flex; flex-direction: column; }
.nav nav > * + * { margin-top: 6px; }
.nav nav a { display: flex; flex-direction: column; align-items: center; width: 64px; padding: 10px 0; border-radius: 12px; color: var(--muted); font-size: 11px; font-weight: 600; transition: .15s; }
.nav nav a > * + * { margin-top: 3px; }
.nav nav a svg { width: 24px; height: 24px; }
.nav nav a:hover { color: var(--text); background: var(--bg-3); }
.nav nav a.on { color: var(--text); background: var(--bg-3); }
.nav nav a.on svg { color: var(--accent); }

.topbar { position: fixed; top: 0; left: var(--nav-w); right: 0; height: 72px; display: flex; align-items: center; padding: 0 36px; z-index: 15; background: linear-gradient(180deg, rgba(12,12,16,.92), rgba(12,12,16,0)); pointer-events: none; }
.searchbox { pointer-events: auto; display: flex; align-items: center; width: min(520px, 100%); height: 44px; padding: 0 16px; border-radius: 22px; background: rgba(28,28,36,.85); border: 1px solid var(--line); backdrop-filter: blur(8px); transition: .15s; }
.searchbox > * + * { margin-left: 10px; }
.searchbox:focus-within { border-color: var(--accent); background: var(--bg-3); }
.searchbox svg { width: 20px; height: 20px; color: var(--muted); }
.searchbox input { flex: 1; background: none; border: 0; outline: 0; color: var(--text); font: inherit; }
#search-icon { display: flex; }

main { margin-left: var(--nav-w); min-height: 100vh; }
.page { padding: 88px 36px 60px; }
.page-head { margin-bottom: 20px; }
.page-head h1 { font-size: 30px; }
h2.sec { font-size: 18px; margin: 28px 0 14px; }

/* ---------- botões ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; height: 40px; padding: 0 18px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg-3); font-weight: 700; transition: .15s; white-space: nowrap; }
.btn > * + * { margin-left: 8px; }
.btn:hover { border-color: #444352; background: #24242e; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: #ff6d4d; }
.btn.big { height: 50px; padding: 0 26px; font-size: 16px; border-radius: 12px; }
.btn.big svg { width: 20px; height: 20px; }
.btn.ghost { background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.12); backdrop-filter: blur(6px); }
.btn.small { height: 32px; padding: 0 12px; font-size: 13px; }
.icon-btn { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; border: 0; background: transparent; transition: .15s; }
.icon-btn svg { width: 22px; height: 22px; }
.icon-btn:hover { background: rgba(255,255,255,.1); }
.tag { display: inline-flex; align-items: center; padding: 1px 8px; border-radius: 6px; background: rgba(255,255,255,.1); font-size: 11px; font-weight: 700; font-style: normal; letter-spacing: .02em; }
.tag.ok { background: rgba(61,220,151,.16); color: var(--good); }
.tag.warn { background: rgba(245,197,66,.16); color: var(--mid); }
.tag.bad { background: rgba(255,93,108,.16); color: var(--bad); }

.spinner { width: 42px; height: 42px; border-radius: 50%; border: 3px solid rgba(255,255,255,.15); border-top-color: var(--accent); animation: spin .8s linear infinite; }
.spinner.tiny { display: inline-block; width: 16px; height: 16px; border-width: 2px; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-inline { display: grid; place-items: center; padding: 120px 0; }
.empty { padding: 40px; text-align: center; color: var(--muted); background: var(--bg-2); border-radius: var(--radius); }
.empty.small { padding: 16px; }
.center { text-align: center; margin-top: 24px; }

/* ---------- home ---------- */
.home { padding: 0 0 60px; }
.hero { position: relative; height: min(72vh, 680px); background: var(--bg-2) center / cover no-repeat; display: flex; align-items: flex-end; }
.hero::before { content: ''; position: absolute; top: 0; right: 0; bottom: 0; left: 0; background: linear-gradient(90deg, rgba(12,12,16,.95) 0%, rgba(12,12,16,.55) 45%, rgba(12,12,16,.1) 75%), linear-gradient(0deg, var(--bg) 0%, rgba(12,12,16,0) 35%); }
.hero.skeleton { background: linear-gradient(110deg, var(--bg-2) 30%, var(--bg-3) 50%, var(--bg-2) 70%); background-size: 200% 100%; animation: shimmer 1.4s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }
.hero-in { position: relative; padding: 0 36px 56px; max-width: 640px; }
.hero h1 { font-size: 52px; line-height: 1.05; }
.hero p { color: #cfcdd8; font-size: 16px; margin: 12px 0 24px; }
.logo { max-width: min(420px, 100%); max-height: 150px; object-fit: contain; object-position: left bottom; display: block; margin-bottom: 14px; }
.meta-line { color: #cfcdd8; font-weight: 600; margin-top: 8px; }
.imdb { color: var(--mid); }
.actions { display: flex; flex-wrap: wrap; margin: -6px; }
.actions > * { margin: 6px; }
.rows { padding: 0 36px; margin-top: -8px; position: relative; }
.banner { display: flex; align-items: center; justify-content: space-between; padding: 22px 26px; margin: 10px 0 20px; border-radius: var(--radius); background: linear-gradient(120deg, rgba(255,90,54,.18), rgba(255,138,61,.06)); border: 1px solid rgba(255,90,54,.35); }
.banner > * + * { margin-left: 24px; }
.banner p { margin: 4px 0 0; color: var(--muted); }

.row { margin: 26px 0; }
.row header { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 12px; }
.row h2 { font-size: 19px; }
.row header a { color: var(--muted); font-size: 13px; font-weight: 700; }
.row header a:hover { color: var(--text); }
.row-scroll { display: grid; grid-auto-flow: column; grid-auto-columns: 158px; gap: 16px; overflow-x: auto; padding: 6px 2px 14px; scroll-snap-type: x proximity; scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
.row-scroll.wide { grid-auto-columns: 300px; }
.card { scroll-snap-align: start; display: block; }
.card-img { position: relative; aspect-ratio: 2 / 3; border-radius: 10px; overflow: hidden; background: var(--bg-3) center / cover; transition: transform .2s, box-shadow .2s; }
.card.wide .card-img { aspect-ratio: 16 / 9; }
.card-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card:hover .card-img { transform: translateY(-4px); box-shadow: 0 12px 30px rgba(0,0,0,.5), 0 0 0 2px var(--accent); }
.card-name { margin-top: 8px; font-weight: 700; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-sub { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.noimg { display: grid; place-items: center; height: 100%; padding: 12px; text-align: center; color: var(--muted); font-weight: 700; }
.rating { position: absolute; top: 8px; left: 8px; padding: 2px 7px; border-radius: 6px; background: rgba(0,0,0,.7); font-size: 11px; font-weight: 800; color: var(--mid); }
.bar { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: rgba(255,255,255,.2); }
.bar i { display: block; height: 100%; background: var(--accent); }
.play-dot { position: absolute; top: 0; right: 0; bottom: 0; left: 0; margin: auto; width: 48px; height: 48px; display: grid; place-items: center; border-radius: 50%; background: rgba(0,0,0,.55); opacity: 0; transition: .2s; }
.play-dot svg { width: 22px; height: 22px; }
.card:hover .play-dot, .ep:hover .play-dot { opacity: 1; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 22px 16px; }
.chips { display: flex; flex-wrap: wrap; margin: 0 0 18px -4px; }
.chips > * { margin: 4px; }
.chip { padding: 6px 14px; border-radius: 20px; background: var(--bg-3); border: 1px solid var(--line); font-size: 13px; font-weight: 600; color: var(--muted); }
.chip:hover { color: var(--text); }
.chip.on { background: var(--text); color: var(--bg); border-color: var(--text); }

/* ---------- detalhe ---------- */
.detail { padding: 0; position: relative; min-height: 100vh; }
.backdrop { position: fixed; top: 0; right: 0; bottom: 0; left: var(--nav-w); background: center / cover no-repeat; }
.backdrop::after { content: ''; position: absolute; top: 0; right: 0; bottom: 0; left: 0; background: linear-gradient(90deg, rgba(12,12,16,.97) 0%, rgba(12,12,16,.8) 45%, rgba(12,12,16,.55) 100%), linear-gradient(0deg, rgba(12,12,16,.9), rgba(12,12,16,0) 50%); }
.detail-in { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 520px); gap: 48px; padding: 110px 36px 60px; }
.detail-in.movie { grid-template-columns: minmax(0, 1fr); }
.detail-main { max-width: 640px; }
.detail-main h1 { font-size: 46px; line-height: 1.05; }
.genres { display: flex; flex-wrap: wrap; margin: 10px 0 10px -4px; }
.genres > * { margin: 4px; }
.genres span { padding: 3px 10px; border-radius: 6px; background: rgba(255,255,255,.1); font-size: 12px; font-weight: 700; }
.desc { color: #d6d4de; font-size: 16px; line-height: 1.6; }
.people { color: var(--muted); font-size: 14px; margin: 6px 0; }
.people b { color: var(--text); margin-right: 6px; }
.detail .actions { margin: 26px -6px 12px; }
.prefs-chip { display: inline-flex; align-items: center; margin-top: 6px; padding: 7px 14px; border-radius: 20px; background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.12); font-size: 13px; font-weight: 600; color: #d6d4de; }
.prefs-chip > * + * { margin-left: 8px; }
.prefs-chip:hover { border-color: var(--accent); color: var(--text); }
.prefs-chip svg { width: 16px; height: 16px; color: var(--accent); }

.episodes { background: rgba(20,20,26,.78); border: 1px solid var(--line); border-radius: 16px; backdrop-filter: blur(14px); overflow: hidden; align-self: start; max-height: calc(100vh - 140px); display: flex; flex-direction: column; }
.season-tabs { display: flex; padding: 10px; overflow-x: auto; border-bottom: 1px solid var(--line); flex: none; }
.season-tabs > * + * { margin-left: 4px; }
.season-tabs button { padding: 7px 14px; border-radius: 8px; border: 0; background: none; color: var(--muted); font-weight: 700; white-space: nowrap; }
.season-tabs button.on { background: var(--text); color: var(--bg); }
.ep-list { overflow-y: auto; padding: 8px; }
.ep { display: grid; grid-template-columns: 150px 1fr; gap: 14px; width: 100%; padding: 8px; border: 0; border-radius: 10px; background: none; text-align: left; transition: .15s; }
.ep:hover { background: rgba(255,255,255,.06); }
.ep.future { opacity: .45; cursor: default; }
.ep-thumb { position: relative; aspect-ratio: 16 / 9; border-radius: 8px; background: var(--bg-3) center / cover; overflow: hidden; }
.ep-info b { display: block; font-size: 14px; }
.ep-info small { color: var(--muted); font-size: 12px; }
.ep-info p { margin: 4px 0 0; font-size: 12.5px; color: #bcbac6; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.seen { position: absolute; top: 6px; right: 6px; width: 22px; height: 22px; display: grid; place-items: center; border-radius: 50%; background: var(--good); color: #000; }
.seen svg { width: 14px; height: 14px; }

/* ---------- painel de fontes ---------- */
.sheet-wrap { position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 50; display: grid; place-items: center; background: rgba(0,0,0,.6); backdrop-filter: blur(6px); animation: fade .15s; padding: 20px; }
@keyframes fade { from { opacity: 0; } }
.sheet { position: relative; width: min(680px, 100%); max-height: calc(100vh - 40px); overflow-y: auto; background: var(--bg-2); border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 30px 80px rgba(0,0,0,.6); animation: rise .2s ease-out; }
@keyframes rise { from { transform: translateY(16px); opacity: 0; } }
.sheet-close { position: absolute; top: 12px; right: 12px; }
.sheet-head { display: flex; align-items: center; padding: 22px 60px 18px 22px; border-bottom: 1px solid var(--line); }
.sheet-head > * + * { margin-left: 18px; }
.sheet-poster { width: 96px; aspect-ratio: 16 / 10; border-radius: 8px; background: var(--bg-3) center / cover; flex: none; }
.sheet-head small { color: var(--muted); font-weight: 700; }
.sheet-head h2 { font-size: 21px; margin-bottom: 4px; }
.sheet-body { padding: 18px 22px 22px; }
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; font-size: 14px; }
.steps li { display: flex; align-items: center; color: var(--muted); }
.steps li > * + * { margin-left: 10px; }
.steps li::before { content: ''; width: 16px; height: 16px; border-radius: 50%; flex: none; border: 2px solid var(--line); }
.steps li.active { color: var(--text); }
.steps li.active::before { border-color: rgba(255,255,255,.2); border-top-color: var(--accent); animation: spin .8s linear infinite; }
.steps li.done::before { border-color: var(--good); background: var(--good); box-shadow: inset 0 0 0 3px var(--bg-2); }
.steps li.fail { color: var(--bad); }
.steps li.fail::before { border-color: var(--bad); background: var(--bad); box-shadow: inset 0 0 0 3px var(--bg-2); }
.steps li.sub { padding-left: 26px; font-size: 13px; }
.steps li.sub::before { width: 8px; height: 8px; border-width: 0; background: var(--line); box-shadow: none; }
.steps li.sub.done::before { background: var(--good); }
.steps li.sub.fail::before { background: var(--bad); }
.steps li small { color: var(--muted); }
.steps.collapsed { font-size: 12.5px; gap: 3px; opacity: .75; margin-bottom: 16px; }

.best { padding: 20px; border-radius: 14px; background: linear-gradient(160deg, rgba(255,90,54,.13), rgba(255,255,255,.02) 55%); border: 1px solid rgba(255,90,54,.4); }
.best-label { display: flex; align-items: center; font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; color: var(--accent-2); }
.best-label > * + * { margin-left: 6px; }
.best-line { display: flex; flex-wrap: wrap; margin: 8px -4px 6px; }
.best-line > * { margin: 4px; }
.best-line span, .alt-line span { padding: 3px 10px; border-radius: 7px; background: rgba(255,255,255,.1); font-weight: 800; font-size: 14px; }
.best-line span:first-child { background: var(--text); color: var(--bg); }
.best-health { display: flex; flex-wrap: wrap; align-items: center; margin: -3px -8px; font-size: 14px; }
.best-health > * { margin: 3px 8px; }
.health { display: inline-flex; align-items: center; }
.health > * + * { margin-left: 6px; }
.health svg { width: 16px; height: 16px; }
.health.good b { color: var(--good); }
.health.mid b { color: var(--mid); }
.health.bad b { color: var(--bad); }
.reasons { list-style: none; padding: 0; margin: 10px -3px; display: flex; flex-wrap: wrap; }
.reasons > * { margin: 3px; }
.reasons li { padding: 3px 10px; border-radius: 20px; font-size: 12.5px; font-weight: 600; }
.reasons li.good { background: rgba(61,220,151,.1); color: #8ff0c4; }
.reasons li.bad { background: rgba(255,93,108,.1); color: #ffa3ad; }
.best-title { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 16px; font-family: ui-monospace, Consolas, monospace; }
.alts { display: grid; gap: 6px; margin-top: 14px; }
.alt { display: grid; gap: 4px; padding: 12px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg-3); text-align: left; transition: .15s; }
.alt:hover { border-color: var(--accent); }
.alt-line { display: flex; flex-wrap: wrap; margin: -3px; }
.alt-line > * { margin: 3px; }
.alt-line span { font-size: 12.5px; padding: 1px 8px; }
.alt-health { font-size: 13px; color: var(--muted); }
.alt small { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-family: ui-monospace, Consolas, monospace; }

/* ---------- configurações ---------- */
.settings { max-width: 980px; }
.card-sec { background: var(--bg-2); border: 1px solid var(--line); border-radius: 16px; padding: 24px 26px; margin-bottom: 20px; }
.card-sec h2 { font-size: 19px; }
.card-sec > p.muted { margin: 6px 0 18px; }
.presets { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px; margin-bottom: 22px; }
.preset { display: grid; gap: 2px; text-align: left; padding: 14px 16px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg-3); transition: .15s; }
.preset:hover { border-color: var(--accent); }
.preset small { color: var(--muted); }
.form { display: grid; gap: 18px; }
.f-row { display: grid; grid-template-columns: 120px 1fr; gap: 16px; align-items: start; }
.f-row > label { font-weight: 700; padding-top: 8px; color: #d6d4de; }
.f-col { display: grid; gap: 10px; }
.f-inline { display: flex; flex-wrap: wrap; align-items: center; margin: -5px; color: var(--muted); font-size: 14px; }
.f-inline > * { margin: 5px; }
.f-inline .gap { width: 20px; }
input[type=number], input[type=text], input:not([type]), select { height: 38px; padding: 0 12px; border-radius: 9px; border: 1px solid var(--line); background: var(--bg-3); color: var(--text); font: inherit; outline: 0; }
input:focus, select:focus { border-color: var(--accent); }
input[type=number] { width: 90px; }
.seg { display: inline-flex; flex-wrap: wrap; padding: 4px; border-radius: 11px; background: var(--bg-3); border: 1px solid var(--line); margin: -2px; }
.seg button { padding: 6px 14px; border-radius: 8px; border: 0; background: none; color: var(--muted); font-weight: 700; font-size: 14px; margin: 2px; }
.seg button.on { background: var(--accent); color: #fff; }
.toggle { display: flex; align-items: flex-start; cursor: pointer; font-weight: 600; }
.toggle > * + * { margin-left: 12px; }
.toggle input { display: none; }
.toggle > span { position: relative; width: 40px; height: 23px; border-radius: 12px; background: var(--line); flex: none; transition: .15s; margin-top: 1px; }
.toggle > span::after { content: ''; position: absolute; top: 3px; left: 3px; width: 17px; height: 17px; border-radius: 50%; background: #fff; transition: .15s; }
.toggle input:checked + span { background: var(--accent); }
.toggle input:checked + span::after { left: 20px; }
.toggle small { display: block; color: var(--muted); font-weight: 500; font-size: 13px; }
.toggle.mini { align-items: center; }
.lang-order { display: flex; flex-wrap: wrap; align-items: center; margin: -4px; color: var(--muted); }
.lang-order > * { margin: 4px; }
.providers { display: grid; gap: 8px; margin-bottom: 14px; }
.provider { display: flex; align-items: center; padding: 12px 14px; border-radius: 12px; background: var(--bg-3); border: 1px solid var(--line); }
.provider > * + * { margin-left: 14px; }
.pv-info { flex: 1; min-width: 0; }
.pv-info b { display: block; }
.pv-info small { color: var(--muted); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.add-provider { display: flex; flex-wrap: wrap; align-items: center; margin: -4px; }
.add-provider > * { margin: 4px; }
.add-provider input[name=url] { flex: 1; min-width: 240px; }
.add-provider small { flex-basis: 100%; }
.howto { margin-top: 16px; color: #cfcdd8; }
.howto summary { cursor: pointer; font-weight: 700; }
.howto li { margin: 6px 0; }
.sys { display: block; }
.save-state { position: fixed; bottom: 20px; right: 28px; font-weight: 700; color: var(--good); }

/* ---------- toasts ---------- */
#toasts { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 100; display: grid; gap: 8px; justify-items: center; pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: center; padding: 11px 16px; border-radius: 12px; background: rgba(28,28,36,.96); border: 1px solid var(--line); box-shadow: 0 10px 30px rgba(0,0,0,.5); font-weight: 600; font-size: 14px; animation: rise .2s; transition: opacity .35s; max-width: 90vw; }
.toast > * + * { margin-left: 14px; }
.toast.warn { border-color: rgba(245,197,66,.5); }
.toast button { border: 0; background: var(--accent); color: #fff; font-weight: 700; padding: 5px 12px; border-radius: 8px; }
.toast.out { opacity: 0; }

/* ---------- player ---------- */
.player { position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 80; background: #000; outline: 0; cursor: none; user-select: none; }
.player.ui, .player.paused { cursor: default; }
.player video { position: absolute; top: 0; right: 0; bottom: 0; left: 0; width: 100%; height: 100%; object-fit: contain; background: #000; }
.p-subs { position: absolute; left: 5%; right: 5%; bottom: var(--sub-pos, 8%); text-align: center; pointer-events: none; font-size: calc(clamp(18px, 2.7vw, 44px) * var(--sub-size, 1)); line-height: 1.3; font-weight: 600; color: var(--sub-color, #fff); text-shadow: 0 0 4px #000, 0 2px 3px #000, 0 0 1px #000; transition: bottom .2s; z-index: 2; }
.player.ui .p-subs { bottom: max(var(--sub-pos, 8%), 118px); }
.p-subs span { display: inline; padding: .05em .35em; background: var(--sub-bg, rgba(0,0,0,.55)); border-radius: 4px; -webkit-box-decoration-break: clone; box-decoration-break: clone; }

.p-loading { position: absolute; top: 0; right: 0; bottom: 0; left: 0; display: grid; place-items: center; z-index: 3; }
.p-poster { position: absolute; top: 0; right: 0; bottom: 0; left: 0; background: center / cover; filter: blur(24px) brightness(.35); transform: scale(1.1); }
.p-loading-box { position: relative; display: grid; justify-items: center; gap: 16px; max-width: 560px; padding: 20px; text-align: center; font-weight: 600; font-size: 17px; }
.p-loading-box small { display: block; margin-top: 6px; color: var(--muted); font-size: 12px; font-family: ui-monospace, Consolas, monospace; word-break: break-all; }
.p-loading-stats { display: flex; align-items: center; color: #cfcdd8; font-size: 14px; }
.p-loading-stats > * + * { margin-left: 6px; }
.p-loading-stats svg, .p-stats svg { width: 15px; height: 15px; vertical-align: -2px; margin-right: 3px; }
.p-loading.error .spinner { display: none; }
.p-err-actions { display: flex; flex-wrap: wrap; margin: 6px -5px 0; }
.p-err-actions > * { margin: 5px; }
.player.buffering:not(.paused) .p-bigplay { display: none; }
.player.buffering::after { content: ''; position: absolute; top: 0; right: 0; bottom: 0; left: 0; margin: auto; width: 54px; height: 54px; border-radius: 50%; border: 4px solid rgba(255,255,255,.15); border-top-color: var(--accent); animation: spin .8s linear infinite; pointer-events: none; z-index: 2; }

.p-top, .p-bottom { position: absolute; left: 0; right: 0; z-index: 4; opacity: 0; transition: opacity .25s; pointer-events: none; }
.player.ui .p-top, .player.ui .p-bottom, .player.paused .p-top, .player.paused .p-bottom { opacity: 1; pointer-events: auto; }
.p-top { top: 0; display: flex; align-items: center; padding: 18px 24px 40px; background: linear-gradient(180deg, rgba(0,0,0,.8), transparent); }
.p-top > * + * { margin-left: 12px; }
.p-title { flex: 1; font-size: 18px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.p-title em { font-style: normal; color: #cfcdd8; font-weight: 600; margin-left: 8px; }
.p-source-badge { display: flex; }
.p-source-badge > * + * { margin-left: 6px; }
.p-bottom { bottom: 0; padding: 50px 24px 14px; background: linear-gradient(0deg, rgba(0,0,0,.85), transparent); }
.p-bigplay { position: absolute; top: 0; right: 0; bottom: 0; left: 0; margin: auto; width: 84px; height: 84px; border-radius: 50%; border: 0; background: rgba(255,90,54,.92); display: none; place-items: center; z-index: 4; box-shadow: 0 10px 40px rgba(0,0,0,.5); }
.p-bigplay svg { width: 38px; height: 38px; margin-left: 4px; }
.player.paused .p-bigplay { display: grid; }
.p-timeline { position: relative; padding: 10px 0; cursor: pointer; touch-action: none; }
.p-track { position: relative; height: 5px; border-radius: 3px; background: rgba(255,255,255,.18); transition: height .15s; }
.p-timeline:hover .p-track { height: 8px; }
.p-buffer { position: absolute; top: 0; right: 0; bottom: 0; left: 0; border-radius: 3px; }
.p-played { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 3px; background: var(--accent); }
.p-thumb { position: absolute; top: 50%; width: 15px; height: 15px; margin: -7.5px 0 0 -7.5px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 4px rgba(255,90,54,.4); transform: scale(0); transition: transform .15s; }
.p-timeline:hover .p-thumb { transform: scale(1); }
.p-hover-time { position: absolute; bottom: 26px; transform: translateX(-50%); padding: 3px 8px; border-radius: 6px; background: rgba(0,0,0,.85); font-size: 13px; font-weight: 700; opacity: 0; transition: opacity .15s; pointer-events: none; }
.p-timeline:hover .p-hover-time { opacity: 1; }
.p-controls { display: flex; align-items: center; }
.p-controls > * + * { margin-left: 4px; }
.p-controls .spacer { flex: 1; }
.p-controls .icon-btn.on { background: rgba(255,90,54,.25); color: var(--accent-2); }
.p-time { margin-left: 10px; font-weight: 700; font-variant-numeric: tabular-nums; font-size: 14px; }
.p-stats { margin-left: 18px; color: #bcbac6; font-size: 13px; }
.p-volume { display: flex; align-items: center; }
.p-vol { width: 0; opacity: 0; transition: .2s; accent-color: var(--accent); }
.p-volume:hover .p-vol { width: 90px; opacity: 1; margin: 0 8px 0 2px; }

.p-panel { position: absolute; right: 24px; bottom: 96px; z-index: 5; width: min(420px, calc(100vw - 48px)); max-height: calc(100vh - 180px); display: flex; flex-direction: column; border-radius: 14px; background: rgba(20,20,26,.96); border: 1px solid var(--line); box-shadow: 0 20px 60px rgba(0,0,0,.6); backdrop-filter: blur(12px); overflow: hidden; cursor: default; }
.p-panel[data-kind=subs] { width: min(720px, calc(100vw - 48px)); }
.p-panel-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.p-panel-head > * + * { margin-left: 10px; }
.p-panel-head small { color: var(--muted); }
.p-cols { display: grid; grid-template-columns: 1fr 260px; min-height: 0; }
.p-list { overflow-y: auto; padding: 8px; min-height: 0; max-height: calc(100vh - 250px); }
.p-group { padding: 10px 10px 4px; font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.p-group small { font-weight: 600; }
.p-item { display: grid; gap: 2px; width: 100%; padding: 9px 12px; border: 0; border-radius: 9px; background: none; text-align: left; }
.p-item:hover { background: rgba(255,255,255,.07); }
.p-item.on { background: rgba(255,90,54,.18); box-shadow: inset 3px 0 0 var(--accent); }
.p-item small { color: var(--muted); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.p-item .tag { margin-left: 4px; }
.p-item.src .src-main { display: flex; align-items: center; }
.p-item.src .src-main > * + * { margin-left: 6px; }
.src-health { font-size: 13px; color: #cfcdd8; }
.src-health .good { color: var(--good); } .src-health .mid { color: var(--mid); } .src-health .bad { color: var(--bad); }
.p-empty { padding: 20px; text-align: center; color: var(--muted); }
.p-adjust { border-left: 1px solid var(--line); padding: 14px 16px; display: grid; gap: 16px; align-content: start; }
.p-field { display: grid; gap: 7px; }
.p-field > span { font-weight: 700; font-size: 13px; color: #cfcdd8; }
.p-field small { color: var(--muted); font-size: 11.5px; }
.p-field input[type=range] { accent-color: var(--accent); width: 100%; }
.stepper { display: flex; align-items: center; }
.stepper > * + * { margin-left: 6px; }
.stepper button { width: 34px; height: 32px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg-3); font-weight: 800; font-size: 16px; }
.stepper output { flex: 1; text-align: center; font-weight: 800; font-variant-numeric: tabular-nums; }
.swatches { display: flex; }
.swatches > * + * { margin-left: 8px; }
.swatches button { width: 28px; height: 28px; border-radius: 50%; border: 2px solid transparent; }
.swatches button.on { border-color: var(--accent); box-shadow: 0 0 0 2px var(--bg-2) inset; }
.p-panel .seg button { padding: 5px 10px; font-size: 13px; }
.p-info { padding: 14px 16px; display: grid; gap: 16px; overflow-y: auto; }
.p-info dl { display: grid; grid-template-columns: 110px 1fr; gap: 6px 12px; margin: 0; font-size: 13px; }
.p-info dt { color: var(--muted); }
.p-info dd { margin: 0; word-break: break-all; }
.p-keys { font-size: 12px; color: var(--muted); line-height: 1.6; }
.p-toast-area { position: absolute; top: 90px; left: 50%; transform: translateX(-50%); padding: 8px 16px; border-radius: 10px; background: rgba(0,0,0,.75); font-weight: 700; opacity: 0; transition: opacity .2s; z-index: 6; pointer-events: none; }
.p-toast-area.show { opacity: 1; }
.p-next { position: absolute; right: 24px; bottom: 110px; z-index: 5; display: flex; align-items: center; padding: 14px 16px; border-radius: 14px; background: rgba(20,20,26,.95); border: 1px solid var(--line); }
.p-next > * + * { margin-left: 16px; }
.p-next small { display: block; color: var(--muted); font-weight: 700; }

@media (max-width: 900px) {
  :root { --nav-w: 0px; }
  .nav { top: auto; right: 0; bottom: 0; left: 0; width: auto; height: 64px; flex-direction: row; justify-content: center; padding: 0; }
  .nav > * + * { margin-top: 0; margin-left: 22px; }
  .nav .brand { display: none; }
  .nav nav { flex-direction: row; }
  .nav nav > * + * { margin-top: 0; margin-left: 6px; }
  .topbar { padding: 0 16px; }
  .page, .rows { padding-left: 16px; padding-right: 16px; }
  .detail-in { grid-template-columns: 1fr; padding: 90px 16px 90px; }
  .hero-in { padding: 0 16px 40px; }
  .hero h1 { font-size: 36px; }
  .p-stats, .p-volume .p-vol { display: none; }
  .p-cols { grid-template-columns: 1fr; }
  .p-adjust { border-left: 0; border-top: 1px solid var(--line); }
  .f-row { grid-template-columns: 1fr; gap: 6px; }
}

@media (max-width: 1150px) {
  .detail-in { grid-template-columns: minmax(0, 1fr); }
  .episodes { max-height: none; }
}

/* ---------- corrida entre fontes / buffer ---------- */
.race { text-align: left; min-width: min(560px, 90vw); }
.race p { margin: 4px 0 12px; font-size: 13px; font-weight: 500; }
.race table { width: 100%; border-collapse: collapse; font-size: 13px; font-weight: 500; }
.race td { padding: 8px 6px; border-top: 1px solid rgba(255,255,255,.08); vertical-align: top; }
.race td:first-child { font-weight: 700; }
.race td small { display: block; color: var(--muted); font-weight: 500; font-family: inherit; margin: 0; font-size: 11.5px; word-break: normal; }
.race td:last-child { text-align: right; white-space: nowrap; }
.race tr.winner td { color: var(--text); background: rgba(61,220,151,.08); }
.race tr.discarded, .race tr.failed, .race tr.dropped { opacity: .55; }
.good { color: var(--good); } .mid { color: var(--mid); } .bad { color: var(--bad); }
.gate { display: grid; gap: 10px; min-width: min(420px, 85vw); }
.gate-bar { height: 8px; border-radius: 4px; background: rgba(255,255,255,.12); overflow: hidden; }
.gate-bar i { display: block; height: 100%; background: var(--accent); transition: width .8s ease; }
.gate-line { font-size: 14px; color: #d6d4de; }
.gate-rates { font-size: 13px; font-weight: 700; }
.gate-actions { display: flex; flex-wrap: wrap; justify-content: center; margin: 4px -4px 0; }
.gate-actions > * { margin: 4px; }
.p-loading.soft .p-poster { display: none; }
.p-loading.soft { background: rgba(0,0,0,.55); }
.p-loading:has(.gate) .spinner, .p-loading:has(.race) .spinner { display: none; }

/* ---------- aviso de pareamento (no computador) ---------- */
.pair-req { position: fixed; right: 24px; bottom: 24px; z-index: 120; width: min(360px, calc(100vw - 32px)); display: grid; gap: 10px; padding: 20px; border-radius: 16px; background: var(--bg-2); border: 1px solid var(--accent); box-shadow: 0 20px 60px rgba(0,0,0,.6); animation: rise .2s; }
.pair-req small { display: block; color: var(--accent-2); font-weight: 800; text-transform: uppercase; letter-spacing: .08em; font-size: 11px; }
.pair-req b { font-size: 18px; margin-right: 8px; }
.pair-req p { margin: 0; font-size: 13px; }
.pair-code { font-size: 40px; font-weight: 800; letter-spacing: .1em; font-variant-numeric: tabular-nums; }
.lan-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; margin-bottom: 18px; }
.lan-info h3 { font-size: 15px; margin: 0 0 8px; }
.howto-list { margin: 0; padding-left: 20px; display: grid; gap: 6px; color: #d6d4de; }
.lan-info code { user-select: all; }
.admin-new { padding: 12px 14px; margin-bottom: 12px; border-radius: 10px; background: rgba(61,220,151,.1); border: 1px solid rgba(61,220,151,.35); font-size: 14px; }
.admin-new code { user-select: all; font-size: 15px; }

/* ---------- modo TV (controle remoto) ---------- */
body.tv { cursor: none; }
body.tv :focus { outline: none; }
body.tv :focus-visible, body.tv a:focus, body.tv button:focus, body.tv input:focus, body.tv select:focus, body.tv label:focus-within {
  outline: 3px solid #fff; outline-offset: 3px; border-radius: 10px;
}
body.tv .card:focus { outline: none; }
body.tv .card:focus .card-img { transform: scale(1.07); box-shadow: 0 14px 34px rgba(0,0,0,.6), 0 0 0 4px #fff; }
body.tv .card:focus .card-name { color: #fff; }
body.tv .card:focus .play-dot, body.tv .ep:focus .play-dot { opacity: 1; }
body.tv .ep:focus { background: rgba(255,255,255,.12); outline: 3px solid #fff; }
body.tv .nav a:focus { background: var(--accent); color: #fff; outline: none; }
body.tv .nav a:focus svg { color: #fff; }
body.tv .btn:focus { transform: scale(1.05); }
body.tv .btn.primary:focus { box-shadow: 0 0 0 4px #fff, 0 10px 30px rgba(255,90,54,.5); outline: none; }
body.tv .alt:focus, body.tv .p-item:focus, body.tv .preset:focus, body.tv .provider button:focus { outline: 3px solid #fff; background: rgba(255,90,54,.2); }
body.tv .season-tabs button:focus { outline: 3px solid #fff; }
body.tv .row-scroll { scroll-snap-type: none; overflow-x: hidden; padding-left: 6px; padding-right: 6px; }
body.tv .grid { gap: 26px 18px; }
/* margem de segurança: TVs cortam as bordas da imagem (overscan) */
body.tv .page, body.tv .rows { padding-left: 48px; padding-right: 48px; }
body.tv .hero-in { padding-left: 48px; }
/* espaçamento maior entre os elementos: dedo no controle é menos preciso que o mouse */
body.tv .p-controls > * + * { margin-left: 10px; }
body.tv .p-top > * + * { margin-left: 18px; }
body.tv .actions > * { margin: 8px; }
body.tv .chips > *, body.tv .genres > * { margin: 6px; }
/* player: controles maiores e foco bem visível */
body.tv .p-controls .icon-btn { width: 52px; height: 52px; }
body.tv .p-controls .icon-btn svg { width: 28px; height: 28px; }
body.tv .p-controls .icon-btn:focus, body.tv .p-top .icon-btn:focus { background: var(--accent); outline: none; transform: scale(1.12); }
body.tv .p-volume .p-vol { display: none; }
body.tv .p-bottom { padding: 60px 48px 28px; }
body.tv .p-top { padding: 28px 48px 40px; }
body.tv .p-panel { right: 48px; bottom: 120px; }
body.tv .p-toast-area { font-size: 22px; padding: 12px 22px; }
