:root {
  --bg: #0d0e10;        /* preto */
  --panel: #1c1e21;     /* chumbo escuro */
  --panel2: #26292d;    /* chumbo */
  --line: #33363b;
  --text: #f1f1f1;
  --muted: #8f9399;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text);
  font: 14px/1.4 -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif; }
body { display: flex; overflow: hidden; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.small { font-size: 12px; color: var(--muted); }

/* lateral */
.side { width: 210px; background: var(--panel); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; padding: 18px 12px; flex-shrink: 0; }
.brand { font-size: 22px; font-weight: 800; letter-spacing: .5px; padding: 0 10px 18px; }
.brand span { color: var(--muted); font-weight: 400; }
nav { display: flex; flex-direction: column; gap: 2px; }
nav button { text-align: left; background: none; border: 0; padding: 10px 12px; border-radius: 8px; color: var(--muted); }
nav button:hover { background: var(--panel2); color: var(--text); }
nav button.on { background: var(--panel2); color: var(--text); font-weight: 600; }
.side-bottom { margin-top: auto; display: flex; flex-direction: column; gap: 8px; padding: 0 4px; }
select, input { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; width: 100%; outline: none; }
input:focus, select:focus { border-color: #6b6f75; }
.ghost { background: transparent; border: 1px solid var(--line); border-radius: 8px; padding: 7px 12px; }
.ghost:hover { background: var(--panel2); }
.primary { background: var(--text); color: #111; border: 0; border-radius: 8px; padding: 10px 14px; font-weight: 600; }

/* principal */
main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.top { display: flex; align-items: center; gap: 16px; padding: 14px 20px; border-bottom: 1px solid var(--line); }
.top h1 { font-size: 18px; margin: 0; flex: 1; }
.top input { max-width: 320px; }
.body { flex: 1; display: flex; min-height: 0; }
.groups { list-style: none; margin: 0; padding: 8px; width: 230px; overflow-y: auto; border-right: 1px solid var(--line); flex-shrink: 0; }
.groups li { padding: 8px 10px; border-radius: 6px; cursor: pointer; color: var(--muted);
  display: flex; justify-content: space-between; gap: 8px; }
.groups li span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.groups li:hover { background: var(--panel); color: var(--text); }
.groups li.on { background: var(--panel2); color: var(--text); }
.content { flex: 1; overflow-y: auto; padding: 16px 20px; }
.empty { color: var(--muted); padding: 40px 0; text-align: center; }

/* lista de canais */
.rows { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 8px; }
.row { display: flex; align-items: center; gap: 12px; padding: 8px 10px; background: var(--panel);
  border: 1px solid transparent; border-radius: 8px; cursor: pointer; }
.row:hover { border-color: var(--line); background: var(--panel2); }
.row img, .row .ph { width: 44px; height: 44px; object-fit: contain; border-radius: 6px; background: var(--bg); flex-shrink: 0; }
.row .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* cartazes */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 14px; }
.card { cursor: pointer; }
.card .poster { aspect-ratio: 2/3; background: var(--panel); border-radius: 8px; overflow: hidden; position: relative; }
.card img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.card .ph { display: flex; align-items: center; justify-content: center; height: 100%; padding: 10px; text-align: center; color: var(--muted); }
.card:hover .poster { outline: 2px solid var(--text); }
.card .nm { margin-top: 6px; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar { position: absolute; left: 0; bottom: 0; height: 3px; background: var(--text); }
.more { display: block; margin: 18px auto; }

/* episódios */
.ep-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.ep-head h2 { margin: 0; font-size: 18px; }
.show { display: flex; gap: 16px; align-items: flex-start; }
.seasons { list-style: none; margin: 0; padding: 0; width: 200px; flex-shrink: 0; position: sticky; top: 0; display: flex; flex-direction: column; gap: 4px; }
.seasons li { display: flex; justify-content: space-between; padding: 12px 14px; border-radius: 8px; background: var(--panel); color: var(--muted); cursor: pointer; border: 1px solid transparent; }
.seasons li:hover { color: var(--text); border-color: var(--line); }
.seasons li.on { background: var(--panel2); color: var(--text); font-weight: 600; border-color: #6b6f75; }
.episodes { list-style: none; margin: 0; padding: 0; flex: 1; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.episodes li { display: flex; align-items: center; gap: 14px; padding: 12px 14px; border-radius: 8px; background: var(--panel); cursor: pointer; border: 1px solid transparent; }
.episodes li:hover { background: var(--panel2); border-color: var(--line); }
.ep-n { width: 28px; text-align: right; color: var(--muted); font-weight: 600; flex-shrink: 0; }
.ep-nm { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ep-bar { width: 80px; height: 3px; background: var(--line); border-radius: 2px; flex-shrink: 0; }
.ep-bar i { display: block; height: 100%; background: var(--text); border-radius: 2px; }

/* player */
.overlay { position: fixed; inset: 0; background: rgba(0,0,0,.92); z-index: 10; display: flex; flex-direction: column; }
.player-bar { display: flex; align-items: center; gap: 10px; padding: 12px 16px; background: var(--panel); border-bottom: 1px solid var(--line); }
.p-title-wrap { flex: 1; min-width: 0; position: relative; }
.p-title { max-width: 100%; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  background: none; border: 1px solid transparent; border-radius: 8px; padding: 7px 10px; text-align: left; cursor: default; }
.p-title.has-menu { cursor: pointer; border-color: var(--line); }
.p-title.has-menu:hover { background: var(--panel2); }
.p-title .caret { margin-left: 6px; color: var(--muted); }
.ep-menu { position: absolute; top: calc(100% + 6px); left: 0; z-index: 5; display: flex; width: min(720px, 90vw); height: min(460px, 70vh);
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 16px 40px rgba(0,0,0,.6); overflow: hidden; }
.ep-menu ul { list-style: none; margin: 0; padding: 6px; overflow-y: auto; }
#epSeasons { width: 190px; flex-shrink: 0; border-right: 1px solid var(--line); }
#epSeasons li { display: flex; justify-content: space-between; padding: 10px 12px; border-radius: 8px; cursor: pointer; color: var(--muted); }
#epSeasons li:hover, #epSeasons li.on { background: var(--panel2); color: var(--text); }
#epList { flex: 1; min-width: 0; }
#epList li { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 8px; cursor: pointer; }
#epList li:hover { background: var(--panel2); }
#epList li.on { background: var(--panel2); outline: 1px solid #6b6f75; font-weight: 600; }
video { width: 100%; height: 100%; background: #000; display: block; }
.p-main { flex: 1; display: flex; min-height: 0; }
.p-stage { flex: 1; position: relative; min-width: 0; background: #000; }
.tv-panel { width: 340px; flex-shrink: 0; background: var(--panel); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 8px; padding: 12px; min-height: 0; }
.tv-list { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: 3px; }
.tv-list li { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 8px; cursor: pointer; border: 1px solid transparent; }
.tv-list li:hover { background: var(--panel2); }
.tv-list li.on { background: var(--panel2); border-color: #6b6f75; font-weight: 600; }
.tv-list img, .tv-list .ph { width: 38px; height: 38px; object-fit: contain; border-radius: 6px; background: var(--bg); flex-shrink: 0; }
.tv-list .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tv-list .n { color: var(--muted); font-size: 12px; width: 30px; text-align: right; flex-shrink: 0; }
#player.no-panel .tv-panel, #player:not(.live) .tv-panel, #player:not(.live) #pPanel { display: none; }
#player:fullscreen .player-bar, #player:fullscreen .tv-panel { display: none; }
.p-msg { position: absolute; left: 50%; top: 45%; transform: translate(-50%,-50%); color: var(--muted); pointer-events: none; text-align: center; }

/* modal playlists */
#plModal { align-items: center; justify-content: center; }
.modal { width: min(520px, 92vw); max-height: 90vh; overflow-y: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 20px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; }
.modal h2 { margin: 0; font-size: 18px; } .modal h3 { font-size: 14px; margin: 20px 0 10px; }
.pl-list { list-style: none; padding: 0; margin: 14px 0 0; display: flex; flex-direction: column; gap: 6px; }
.pl-list li { display: flex; align-items: center; gap: 8px; background: var(--bg); border-radius: 8px; padding: 8px 10px; }
.pl-list li div { flex: 1; min-width: 0; }
.tabs2 { display: flex; gap: 6px; margin-bottom: 10px; }
.tabs2 button { flex: 1; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 7px; color: var(--muted); }
.tabs2 button.on { color: var(--text); border-color: #6b6f75; }
form { display: flex; flex-direction: column; gap: 8px; }
form div { display: flex; flex-direction: column; gap: 8px; }
::-webkit-scrollbar { width: 10px; } ::-webkit-scrollbar-thumb { background: var(--line); border-radius: 5px; }

.star.on { color: #fff; border-color: #6b6f75; background: var(--panel2); }
.ep-head h2 { margin-right: 4px; }
.season-title { margin: 6px 0 12px; color: var(--muted); font-weight: 600; }
.grid + .season-title { margin-top: 24px; }

.tools { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.row { position: relative; }
.rm { position: absolute; top: 6px; right: 6px; width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--line);
  background: rgba(13,14,16,.85); color: var(--text); font-size: 13px; line-height: 1; opacity: 0; transition: opacity .15s; z-index: 2; }
.row .rm { top: 50%; transform: translateY(-50%); }
.card:hover .rm, .row:hover .rm { opacity: 1; }
.rm:hover { background: #fff; color: #111; }

.groups li.locked { color: var(--muted); border: 1px dashed var(--line); margin-top: 6px; }
.pin-box { width: 320px; display: flex; flex-direction: column; gap: 10px; text-align: center; }
.pin-box input { font-size: 28px; letter-spacing: 14px; text-align: center; }
.pin-actions { display: flex; gap: 8px; } .pin-actions button { flex: 1; }
.err { color: #ff8a8a; min-height: 16px; }
#pinModal { align-items: center; justify-content: center; z-index: 30; }
#parModal { align-items: center; justify-content: center; z-index: 20; }
.switch { display: flex; align-items: center; gap: 10px; margin: 16px 0 6px; font-weight: 600; }
.switch input { width: auto; }
.par-groups { list-style: none; padding: 0; margin: 10px 0 0; max-height: 260px; overflow-y: auto; }
.par-groups li { padding: 5px 4px; } .par-groups input { width: auto; margin-right: 8px; }

/* ---------- contas ---------- */
.auth { position: fixed; inset: 0; z-index: 40; background: var(--bg); display: flex; align-items: center; justify-content: center; padding: 20px; }
.auth-box { width: min(360px, 100%); display: flex; flex-direction: column; gap: 12px; }
.auth-box form { display: flex; flex-direction: column; gap: 10px; }
.auth-box input { padding: 12px 14px; font-size: 16px; }
.brand.big { font-size: 34px; text-align: center; padding-bottom: 10px; }
.who { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding-bottom: 6px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.who span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link { background: none; border: 0; color: var(--muted); text-decoration: underline; padding: 0; }
.modal.wide { width: min(640px, 94vw); }
.user-edit { background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 14px; margin-top: 14px; display: flex; flex-direction: column; gap: 10px; }
.user-edit form { flex-direction: row; } .user-edit form input { flex: 1; }
.row-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.danger { color: #ff8a8a; border-color: #5a2a2a; }
.group-select { display: none; }
.more-btn { display: none; }
#usersModal { align-items: center; justify-content: center; z-index: 20; }

/* ---------- celular e tablet ---------- */
@media (hover: none) { .rm { opacity: 1; } }
@media (max-width: 760px) {
  body { flex-direction: column; }
  input, select { font-size: 16px; }          /* evita zoom automático no iPhone */
  .side { position: fixed; left: 0; right: 0; bottom: 0; width: auto; z-index: 8; flex-direction: row; align-items: center;
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); border-right: 0; border-top: 1px solid var(--line); }
  .side .brand { display: none; }
  nav { flex-direction: row; flex: 1; gap: 0; }
  nav button { flex: 1; text-align: center; padding: 10px 2px; font-size: 12px; }
  .more-btn { display: block; background: none; border: 0; color: var(--muted); font-size: 12px; padding: 10px 6px; }
  .side-bottom { display: none; position: fixed; left: 8px; right: 8px; bottom: calc(58px + env(safe-area-inset-bottom));
    background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 14px; box-shadow: 0 -10px 40px rgba(0,0,0,.6); }
  .side-bottom.open { display: flex; }
  main { height: 100%; padding-bottom: calc(56px + env(safe-area-inset-bottom)); }
  .top { flex-wrap: wrap; gap: 8px; padding: calc(10px + env(safe-area-inset-top)) 12px 10px; }
  .top h1 { font-size: 17px; }
  .top input { max-width: none; flex: 1 1 100%; order: 3; }
  .group-select { display: block; flex: 1 1 100%; order: 2; }
  .group-select.hidden { display: none !important; }
  .groups { display: none; }
  .content { padding: 12px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(105px, 1fr)); gap: 10px; }
  .rows { grid-template-columns: 1fr; }
  .tools { flex-direction: column; align-items: stretch; }
  .tools .small { display: none; }
  .ep-head { flex-wrap: wrap; }
  .show { flex-direction: column; }
  .seasons { position: static; width: 100%; flex-direction: row; overflow-x: auto; }
  .seasons li { flex-shrink: 0; gap: 8px; }
  /* player */
  .player-bar { flex-wrap: wrap; gap: 6px; padding: calc(8px + env(safe-area-inset-top)) 8px 8px; }
  .player-bar .ghost { padding: 6px 9px; font-size: 13px; }
  #pCopy { display: none; }
  .p-title-wrap { order: -1; flex: 1 1 100%; }
  .p-main { flex-direction: column; }
  .p-stage { flex: 0 0 auto; aspect-ratio: 16 / 9; order: -1; }
  .tv-panel { width: auto; flex: 1; border-right: 0; border-top: 1px solid var(--line); }
  .ep-menu { position: fixed; left: 8px; right: 8px; top: 110px; width: auto; height: 60vh; flex-direction: column; }
  #epSeasons { width: auto; display: flex; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); flex-shrink: 0; }
  #epSeasons li { flex-shrink: 0; }
  #epSeasons li span { display: none; }
  .modal { max-height: 85vh; }
  .user-edit form { flex-direction: column; }
}

/* ---------- ícones e Início ---------- */
nav svg, .more-btn svg, .entry svg { fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
nav button { display: flex; align-items: center; gap: 10px; }
nav svg { width: 18px; height: 18px; flex-shrink: 0; }
.mob-only { display: none; }
.hello { margin: 0 0 14px; color: var(--muted); font-size: 15px; }
.entries { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 26px; }
.entry { position: relative; overflow: hidden; display: flex; flex-direction: column; align-items: flex-start; gap: 4px;
  padding: 18px 16px 16px; min-height: 128px; border-radius: 14px; border: 1px solid var(--line); text-align: left;
  background: linear-gradient(145deg, #2c2f34 0%, #1a1c1f 70%); color: var(--text); transition: transform .15s, border-color .15s; }
.entry:hover { border-color: #6b6f75; transform: translateY(-2px); }
.entry svg { width: 34px; height: 34px; margin-bottom: auto; opacity: .95; }
.entry b { font-size: 17px; letter-spacing: .2px; margin-top: 14px; }
.entry small { color: var(--muted); font-size: 12px; }
.entry::after { content: ''; position: absolute; right: -30px; top: -30px; width: 110px; height: 110px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,.08), transparent 70%); }
.row-sec { margin-bottom: 22px; }
.row-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 10px; }
.row-head h3 { margin: 0; font-size: 16px; font-weight: 700; }
.link-more { background: none; border: 0; color: var(--muted); font-size: 13px; padding: 0; }
.link-more:hover { color: var(--text); }
.strip { display: flex; gap: 10px; overflow-x: auto; scroll-snap-type: x proximity; padding-bottom: 6px; scrollbar-width: none; }
.strip::-webkit-scrollbar { display: none; }
.strip .card { flex: 0 0 128px; width: 128px; min-width: 0; scroll-snap-align: start; }
.strip .card .ph { word-break: break-word; font-size: 12px; }
.tile { flex: 0 0 150px; height: 84px; border-radius: 10px; background: var(--panel); border: 1px solid var(--line); cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 8px; scroll-snap-align: start; }
.tile img { max-width: 70%; max-height: 40px; object-fit: contain; }
.tile span { font-size: 12px; color: var(--muted); text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.tile:hover { border-color: #6b6f75; }
.sheet-links { display: none; flex-direction: column; gap: 8px; }

@media (max-width: 760px) {
  .desk-only { display: none !important; }
  .mob-only, .sheet-links.mob-only { display: flex; }
  nav button { flex-direction: column; gap: 3px; padding: 6px 2px; font-size: 10.5px; background: none !important; }
  nav button.on { color: var(--text); }
  nav svg { width: 22px; height: 22px; }
  .more-btn { display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 10.5px; padding: 6px 8px; }
  .more-btn svg { width: 22px; height: 22px; }
  .on-home .top h1 { font-size: 24px; font-weight: 800; letter-spacing: .5px; }
  .entries { gap: 8px; margin-bottom: 22px; }
  .entry { min-height: 112px; padding: 14px 12px 12px; border-radius: 12px; }
  .entry svg { width: 28px; height: 28px; }
  .entry b { font-size: 14px; margin-top: 10px; }
  .entry small { font-size: 11px; }
  .strip .card { flex-basis: 108px; width: 108px; }
  .tile { flex-basis: 128px; height: 74px; }
}

.row-acts { display: flex; gap: 14px; align-items: baseline; }
.tile { position: relative; }
.tile .rm { top: 4px; right: 4px; width: 24px; height: 24px; font-size: 11px; }
.tile:hover .rm { opacity: 1; }

/* player: fundo sólido (não deixa a tela de trás aparecer) */
#player { background: #000; }
@media (max-width: 760px) {
  /* filmes e séries: vídeo no meio da tela */
  #player:not(.live) .p-main { justify-content: center; }
  .player-bar { padding-top: calc(10px + env(safe-area-inset-top)); }
  .p-msg { width: 86%; font-size: 14px; line-height: 1.4; }
}

.resume { position: absolute; left: 50%; top: 62%; transform: translateX(-50%); z-index: 3;
  background: #fff; color: #111; border: 0; border-radius: 999px; padding: 12px 26px; font-weight: 700; font-size: 16px; }

[hidden] { display: none !important; }
