/* Easy Purple — visual moderno, escuro, roxo. Sem fontes externas (mais rápido). */
:root {
  --bg: #0f0a1a;
  --bg-2: #150e24;
  --surface: #1c1430;
  --surface-2: #251a3e;
  --surface-3: #30234f;
  --line: rgba(255, 255, 255, .08);
  --text: #f5f2fb;
  --text-2: #c2b8d8;
  --text-3: #8d82a6;
  --accent: #8b5cf6;
  --accent-2: #a78bfa;
  --accent-3: #6d28d9;
  --accent-soft: rgba(139, 92, 246, .16);
  --danger: #f05252;
  --ok: #34d399;
  --gold: #fbbf24;
  --r-s: 10px;
  --r: 14px;
  --r-l: 20px;
  --top: calc(56px + env(safe-area-inset-top));
  --tabs: calc(64px + env(safe-area-inset-bottom));
  --pad: 16px;
  --rail: 0px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); }
body {
  margin: 0; min-height: 100vh; min-height: 100dvh;
  background: radial-gradient(1200px 600px at 10% -10%, rgba(124, 58, 237, .22), transparent 60%), var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
input, select { font: inherit; color: inherit; }
img { display: block; }
h1, h2, h3, p { margin: 0; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }

.ic { width: 24px; height: 24px; flex: none; }
.ic-xs { width: 16px; height: 16px; vertical-align: -3px; }
.ic-xl { width: 44px; height: 44px; }
.accent { color: var(--accent-2); }
.muted { color: var(--text-3); }
.danger-text { color: var(--danger) !important; }
.grow { flex: 1; }
.mt { margin-top: 16px; }
.mt-s { margin-top: 10px; }
.mb { margin-bottom: 12px; }

/* ---------- arranque ---------- */
#boot { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; background: var(--bg); }
.boot-logo, .brand-mark {
  width: 64px; height: 64px; border-radius: 18px;
  background: url("../icons/icon.svg") center / cover no-repeat;
  box-shadow: 0 10px 40px rgba(139, 92, 246, .45);
}
.boot-logo { animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(.92); opacity: .8; } }

/* ---------- barra superior ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 8px;
  height: var(--top); padding: env(safe-area-inset-top) calc(var(--pad) - 6px) 0 calc(var(--pad) - 6px + var(--rail));
  background: rgba(15, 10, 26, .78);
  -webkit-backdrop-filter: saturate(160%) blur(18px); backdrop-filter: saturate(160%) blur(18px);
  border-bottom: 1px solid var(--line);
}
.topbar-title { flex: 1; min-width: 0; font-size: 18px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-left: 6px; }
.topbar-actions { display: flex; align-items: center; gap: 6px; }
body.busy .topbar::after {
  content: ""; position: absolute; left: 0; bottom: -1px; height: 2px; width: 40%;
  background: linear-gradient(90deg, transparent, var(--accent-2), transparent);
  animation: busy 1.1s linear infinite;
}
@keyframes busy { from { transform: translateX(-100%); } to { transform: translateX(250vw); } }
.brand-inline { display: inline-flex; align-items: center; gap: 10px; font-weight: 600; letter-spacing: -.01em; }
.brand-inline b { color: var(--accent-2); font-weight: 800; }
.brand-mark.sm { width: 30px; height: 30px; border-radius: 9px; box-shadow: none; }
.acc-pill { font-size: 13px; color: var(--text-2); background: var(--surface-2); padding: 5px 10px; border-radius: 99px; max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clock { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.05; }
.clock small { font-size: 11px; color: var(--text-3); text-transform: capitalize; }
.clock b { font-size: 17px; font-variant-numeric: tabular-nums; }

.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; color: var(--text);
  transition: background .15s;
}
.icon-btn:active { background: var(--surface-2); }

/* ---------- conteúdo ---------- */
#view { padding: 12px var(--pad) calc(var(--tabs) + 24px) calc(var(--pad) + var(--rail)); outline: none; }
body.no-tabs #view { padding-bottom: calc(32px + env(safe-area-inset-bottom)); }
#view.narrow > * { max-width: 640px; margin-left: auto; margin-right: auto; }

/* ---------- barra de separadores ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: flex; height: var(--tabs); padding-bottom: env(safe-area-inset-bottom);
  background: rgba(21, 14, 36, .86);
  -webkit-backdrop-filter: saturate(160%) blur(18px); backdrop-filter: saturate(160%) blur(18px);
  border-top: 1px solid var(--line);
}
body.no-tabs .tabbar { display: none; }
.tab { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--text-3); font-size: 11px; font-weight: 600; }
.tab .ic { width: 25px; height: 25px; }
.tab.active { color: var(--accent-2); }
.tab.active .ic { filter: drop-shadow(0 0 8px rgba(167, 139, 250, .55)); }

/* Ecrãs largos (iPad, telemóvel deitado): separadores à esquerda */
@media (min-width: 760px) {
  :root { --rail: 84px; --pad: 24px; }
  .tabbar { top: 0; right: auto; width: var(--rail); height: auto; flex-direction: column; justify-content: center; gap: 6px; padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom) env(safe-area-inset-left); border-top: 0; border-right: 1px solid var(--line); }
  .tab { flex: none; height: 64px; }
  #view { padding-bottom: 32px; }
  body.no-tabs { --rail: 0px; }
}

/* ---------- botões ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px; border-radius: var(--r); font-weight: 600; font-size: 15px;
  transition: transform .1s, background .15s, opacity .15s; white-space: nowrap;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .6; }
.btn-lg { min-height: 52px; font-size: 16px; }
.btn-block { display: flex; width: 100%; }
.btn-primary { background: linear-gradient(135deg, var(--accent), var(--accent-3)); color: #fff; box-shadow: 0 6px 20px rgba(124, 58, 237, .35); }
.btn-secondary { background: var(--surface-2); }
.btn-ghost { color: var(--text-2); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-icon { width: 52px; padding: 0; min-height: 52px; }
.btn.on, .star.on { color: var(--gold); }
.btn.on .ic, .star.on .ic { fill: currentColor; }
.btn-block + .btn-block { margin-top: 10px; }

/* ---------- formulários ---------- */
.form { display: grid; gap: 14px; }
.form label { display: grid; gap: 6px; font-size: 14px; color: var(--text-2); font-weight: 500; }
.input {
  width: 100%; height: 50px; padding: 0 14px; border-radius: var(--r);
  background: var(--surface); border: 1px solid var(--line); font-size: 16px; color: var(--text);
  transition: border-color .15s, background .15s;
}
.input:focus { outline: none; border-color: var(--accent); background: var(--surface-2); }
.pw { position: relative; display: block; }
.pw .input { padding-right: 50px; }
.pw-toggle { position: absolute; right: 4px; top: 4px; width: 42px; height: 42px; opacity: .7; }
.form-err { color: #fca5a5; font-size: 14px; min-height: 1px; }
.form-err:empty { display: none; }
.hint { display: flex; gap: 12px; margin-top: 20px; padding: 14px; border-radius: var(--r); background: var(--surface); color: var(--text-2); font-size: 14px; }
.hint .ic { color: var(--accent-2); }
.hint p + p { margin-top: 8px; }
.brand-hero { text-align: center; padding: 20px 0 24px; }
.brand-hero .brand-mark { margin: 0 auto 14px; width: 76px; height: 76px; border-radius: 22px; }
.brand-hero h1 { font-size: 26px; letter-spacing: -.02em; }
.brand-hero p { color: var(--text-2); margin-top: 8px; }

/* ---------- listas de reprodução ---------- */
.stack { display: grid; gap: 10px; }
.pl-card { display: flex; align-items: center; gap: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); padding: 6px 6px 6px 0; }
.pl-card.current { border-color: rgba(139, 92, 246, .55); background: linear-gradient(135deg, rgba(139, 92, 246, .14), var(--surface)); }
.pl-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; padding: 8px 12px; text-align: left; }
.pl-avatar { display: grid; place-items: center; flex: none; width: 44px; height: 44px; border-radius: 14px; background: linear-gradient(135deg, var(--accent), var(--accent-3)); font-weight: 800; font-size: 18px; }
.pl-avatar.lg { width: 56px; height: 56px; border-radius: 18px; font-size: 22px; }
.pl-text { flex: 1; min-width: 0; display: grid; }
.pl-text b, .pl-text small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pl-text small { color: var(--text-3); font-size: 13px; }

/* ---------- início ---------- */
.banner { display: flex; align-items: center; gap: 10px; padding: 10px 6px 10px 14px; margin-bottom: 14px; border-radius: var(--r); background: var(--accent-soft); color: var(--text-2); font-size: 14px; }
.banner span { flex: 1; }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (min-width: 760px) { .tiles { grid-template-columns: repeat(4, 1fr); } }
.tile {
  position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: flex-end; gap: 2px;
  min-height: 112px; padding: 16px; border-radius: var(--r-l);
  background: var(--surface); border: 1px solid var(--line);
  transition: transform .12s;
}
.tile:active { transform: scale(.97); }
.tile .ic { position: absolute; top: 14px; left: 14px; width: 30px; height: 30px; }
.tile b { font-size: 17px; }
.tile small { color: rgba(255, 255, 255, .7); font-size: 13px; min-height: 18px; }
.tile-live { background: linear-gradient(140deg, #7c3aed, #4c1d95); }
.tile-vod { background: linear-gradient(140deg, #9333ea, #581c87); }
.tile-series { background: linear-gradient(140deg, #6d28d9, #312e81); }
.tile-catchup { background: linear-gradient(140deg, #a855f7, #6b21a8); }
.tile::after { content: ""; position: absolute; right: -30px; top: -30px; width: 110px; height: 110px; border-radius: 50%; background: rgba(255, 255, 255, .08); }

.row { margin-top: 26px; }
.row-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.row-head h2 { font-size: 18px; font-weight: 700; letter-spacing: -.01em; }
.row-more { color: var(--text-3); }
.hscroll {
  display: grid; grid-auto-flow: column; gap: 12px; overflow-x: auto; overscroll-behavior-x: contain;
  scroll-snap-type: x proximity; margin: 0 calc(-1 * var(--pad)); padding: 0 var(--pad) 4px; scrollbar-width: none;
}
.hscroll::-webkit-scrollbar { display: none; }
.hscroll > * { scroll-snap-align: start; }

/* ---------- cartões ---------- */
.card { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.card-title { font-size: 13px; font-weight: 600; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-sub { font-size: 12px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: -4px; }
.hscroll .card-ch { width: 132px; }
.hscroll .card-poster { width: 118px; }
.hscroll .card-wide { width: 220px; position: relative; }
.card-poster { position: relative; }
.badge-rating { position: absolute; top: 6px; right: 6px; font-size: 11px; font-weight: 700; padding: 2px 6px; border-radius: 7px; background: rgba(0, 0, 0, .6); color: var(--gold); }

.thumb { position: relative; overflow: hidden; display: grid; place-items: center; background: var(--surface-2); border-radius: var(--r); }
.thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.thumb-fb { font-weight: 800; color: var(--text-3); font-size: 18px; letter-spacing: .02em; }
.thumb-logo { aspect-ratio: 16 / 10; background: linear-gradient(145deg, var(--surface-2), var(--surface)); }
.thumb-logo img { object-fit: contain; padding: 12%; }
.thumb-poster { aspect-ratio: 2 / 3; }
.thumb-wide { aspect-ratio: 16 / 9; }
.thumb.sm { width: 52px; height: 52px; aspect-ratio: auto; border-radius: 12px; flex: none; }
.thumb.sm img { padding: 6px; }
.thumb.sm .thumb-fb { font-size: 14px; }
.thumb-poster.sm { width: 64px; height: 96px; }
.thumb-poster.sm img { padding: 0; }
.play-badge { position: absolute; left: 8px; top: 8px; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: rgba(0, 0, 0, .55); }
.play-badge .ic { width: 14px; height: 14px; }
.progress { position: relative; display: block; height: 4px; border-radius: 4px; background: rgba(255, 255, 255, .15); overflow: hidden; }
.progress i { position: absolute; inset: 0 auto 0 0; background: var(--accent-2); border-radius: 4px; }
.card-wide .progress { margin-top: -10px; margin-inline: 8px; position: relative; z-index: 1; }

/* ---------- navegar ---------- */
.toolbar {
  position: sticky; top: var(--top); z-index: 10; display: flex; gap: 10px;
  margin: -12px calc(-1 * var(--pad)) 12px; padding: 10px var(--pad);
  background: linear-gradient(var(--bg) 70%, transparent);
}
.cat-btn {
  display: flex; align-items: center; gap: 6px; max-width: 46%; height: 44px; padding: 0 10px 0 14px;
  border-radius: var(--r); background: var(--surface-2); font-weight: 600; font-size: 15px;
}
.cat-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cat-count { font-size: 12px; color: var(--accent-2); background: var(--accent-soft); border-radius: 99px; padding: 1px 7px; }
.cat-btn .ic { width: 18px; height: 18px; color: var(--text-3); }
.search { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; height: 44px; padding: 0 6px 0 12px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line); }
.search .ic { width: 20px; height: 20px; color: var(--text-3); }
.search input { flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: none; font-size: 16px; }
.search input::-webkit-search-cancel-button { display: none; }
.search-clear { display: grid; place-items: center; width: 32px; height: 32px; color: var(--text-3); }
.search-clear .ic { width: 18px; height: 18px; }

.vgrid { position: relative; contain: strict; width: 100%; }
.vcell { position: absolute; left: 0; top: 0; contain: layout paint; }
.vcell > .card { height: 100%; }
.vcell .card-poster .thumb { flex: none; }
.ch-row {
  display: flex; align-items: center; gap: 12px; height: 100%; padding: 0 4px 0 8px;
  background: var(--surface); border-radius: var(--r); cursor: pointer; transition: background .12s;
}
.ch-row:active { background: var(--surface-2); }
.ch-text { flex: 1; min-width: 0; display: grid; }
.ch-name { font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ch-num { font-size: 12px; color: var(--text-3); }
.ch-days { display: flex; align-items: center; gap: 2px; padding-right: 8px; color: var(--accent-2); font-size: 13px; font-weight: 600; }
.star { color: var(--text-3); }
.star .ic { width: 22px; height: 22px; }

.empty { display: grid; justify-items: center; gap: 14px; padding: 48px 16px; text-align: center; color: var(--text-3); }
.empty p { max-width: 340px; }
.loading-block { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 48px 0; color: var(--text-3); }
.loading-block.sm { padding: 18px 0; }
.spinner { display: inline-block; width: 18px; height: 18px; border: 2px solid rgba(255, 255, 255, .2); border-top-color: var(--accent-2); border-radius: 50%; animation: spin .8s linear infinite; vertical-align: -3px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- folha inferior ---------- */
.sheet-wrap { position: fixed; inset: 0; z-index: 60; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(5, 2, 12, .6); opacity: 0; transition: opacity .2s; }
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0; max-height: 82vh; display: flex; flex-direction: column;
  background: var(--bg-2); border-radius: 24px 24px 0 0; border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
  transform: translateY(100%); transition: transform .22s cubic-bezier(.2, .8, .2, 1);
}
.sheet-full { height: 82vh; }
@media (min-width: 760px) { .sheet { left: 50%; right: auto; width: 640px; margin-left: -320px; } }
.sheet-wrap.open .sheet { transform: none; }
.sheet-wrap.open .sheet-backdrop { opacity: 1; }
.sheet-handle { width: 40px; height: 5px; border-radius: 3px; background: var(--surface-3); margin: 8px auto 0; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 6px 10px 6px 20px; }
.sheet-head h2 { font-size: 18px; }
.sheet-body { overflow-y: auto; padding: 4px 16px 16px; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.cat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
@media (max-width: 360px) { .cat-grid { grid-template-columns: 1fr; } }
.cat-item {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 50px; padding: 8px 12px;
  border-radius: var(--r); background: var(--surface); text-align: left; font-size: 14px; font-weight: 600;
}
.cat-item span { overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.cat-item small { color: var(--text-3); font-variant-numeric: tabular-nums; }
.cat-item.active { background: var(--accent-soft); color: var(--accent-2); box-shadow: inset 0 0 0 1px rgba(139, 92, 246, .5); }

/* ---------- diálogos ---------- */
.dialog-wrap { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; padding: 24px; background: rgba(5, 2, 12, .65); opacity: 0; transition: opacity .18s; }
.dialog-wrap.open { opacity: 1; }
.dialog { width: 100%; max-width: 360px; padding: 22px; border-radius: 24px; background: var(--bg-2); border: 1px solid var(--line); transform: scale(.96); transition: transform .18s; }
.dialog-wrap.open .dialog { transform: none; }
.dialog h2 { font-size: 19px; margin-bottom: 8px; }
.dialog p { color: var(--text-2); }
.dialog-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 22px; }
.pin { text-align: center; }
.pin-dots { display: flex; justify-content: center; gap: 16px; margin: 18px 0 6px; }
.pin-dots i { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--accent-2); transition: background .1s; }
.pin-dots i.on { background: var(--accent-2); }
.pin-err { min-height: 4px; }
.pin-keys { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 12px 0; }
.pin-key { height: 58px; border-radius: 16px; background: var(--surface-2); font-size: 22px; font-weight: 600; }
.pin-key:active { background: var(--surface-3); }

.toast {
  position: fixed; left: 50%; bottom: calc(var(--tabs) + 16px); z-index: 80; display: flex; align-items: center; gap: 12px;
  max-width: calc(100% - 32px); padding: 12px 16px; border-radius: var(--r); background: #2d2148; box-shadow: 0 10px 30px rgba(0, 0, 0, .4);
  font-size: 14px; font-weight: 500; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; transition: .2s;
}
.toast.show { transform: translate(-50%, 0); opacity: 1; pointer-events: auto; }
.toast-btn { color: var(--accent-2); font-weight: 700; }
body.no-tabs .toast { bottom: calc(24px + env(safe-area-inset-bottom)); }

/* ---------- fichas (filme/série) ---------- */
#view.detail { padding-top: 0; }
.hero { position: relative; height: 230px; margin: 0 calc(-1 * var(--pad)); overflow: hidden; }
.hero-bg { position: absolute; inset: -20px; background-size: cover; background-position: center 25%; filter: blur(18px) saturate(1.2); opacity: .6; transform: scale(1.1); }
.hero-fade { position: absolute; inset: 0; background: linear-gradient(transparent 20%, var(--bg)); }
.detail-body { position: relative; margin-top: -160px; max-width: 900px; }
.detail-top { display: flex; gap: 16px; align-items: flex-end; }
.detail-poster { flex: none; width: 116px; aspect-ratio: 2 / 3; border-radius: var(--r); overflow: hidden; background: var(--surface-2); box-shadow: 0 12px 30px rgba(0, 0, 0, .5); }
.detail-poster img { width: 100%; height: 100%; object-fit: cover; }
.detail-head h1, .detail-body > h1 { font-size: 22px; line-height: 1.2; letter-spacing: -.01em; }
.sub { color: var(--text-2); margin-top: 6px; font-size: 14px; }
.actions-row { display: flex; gap: 10px; margin: 18px 0 14px; }
.plot { color: var(--text-2); line-height: 1.55; }
.warn { color: #fcd34d; font-size: 14px; margin-bottom: 10px; }
.meta { display: grid; gap: 10px; margin: 16px 0; }
.meta div { display: grid; grid-template-columns: 96px 1fr; gap: 10px; font-size: 14px; }
.meta dt { color: var(--text-3); }
.meta dd { margin: 0; color: var(--text-2); }
.chips { display: flex; gap: 8px; overflow-x: auto; margin: 18px calc(-1 * var(--pad)) 12px; padding: 0 var(--pad); scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; height: 38px; padding: 0 16px; border-radius: 99px; background: var(--surface-2); font-weight: 600; font-size: 14px; white-space: nowrap; }
.chip.active { background: var(--text); color: var(--bg); }
.sticky-chips { position: sticky; top: var(--top); z-index: 5; margin-top: -12px; padding-top: 10px; padding-bottom: 10px; background: var(--bg); }
.episodes { display: grid; gap: 12px; }
@media (min-width: 760px) { .episodes { grid-template-columns: 1fr 1fr; } }
.ep { display: flex; gap: 12px; padding: 8px; border-radius: var(--r); background: var(--surface); }
.ep:active { background: var(--surface-2); }
.ep-thumb { position: relative; flex: none; width: 128px; aspect-ratio: 16 / 9; border-radius: var(--r-s); overflow: hidden; background: var(--surface-2); }
.ep-thumb img { width: 100%; height: 100%; object-fit: cover; }
.ep-thumb .progress { position: absolute; left: 6px; right: 6px; bottom: 6px; }
.ep-text { min-width: 0; display: grid; align-content: start; gap: 2px; }
.ep-text b { font-size: 14px; line-height: 1.3; }
.ep-text small { color: var(--text-3); font-size: 12px; }
.ep-text p { font-size: 12px; color: var(--text-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ---------- catch-up ---------- */
.prog-list { display: grid; gap: 6px; }
.prog { display: flex; align-items: center; gap: 14px; padding: 12px 14px; border-radius: var(--r); background: var(--surface); }
.prog:active { background: var(--surface-2); }
.prog.now { box-shadow: inset 3px 0 0 var(--accent-2); }
.prog.disabled { opacity: .5; }
.prog-time { flex: none; width: 52px; font-variant-numeric: tabular-nums; font-weight: 700; color: var(--accent-2); }
.prog-text { flex: 1; min-width: 0; display: grid; }
.prog-text b { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.prog-text small { font-size: 12px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.prog .ic { width: 18px; height: 18px; }

/* ---------- leitor ---------- */
body.is-player { background: #000; }
body.is-player .topbar { display: none; }
#view.player-view { padding: 0; }
.player { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; background: var(--bg); }
.video-box { position: sticky; top: 0; z-index: 5; background: #000; padding-top: env(safe-area-inset-top); }
.video-box video { display: block; width: 100%; aspect-ratio: 16 / 9; max-height: 70vh; background: #000; }
.player-top {
  position: absolute; left: 0; right: 0; top: env(safe-area-inset-top); display: flex; align-items: center; gap: 4px; padding: 4px;
  background: linear-gradient(rgba(0, 0, 0, .65), transparent); pointer-events: none; z-index: 2;
}
.player-top > * { pointer-events: auto; }
.player-title { flex: 1; min-width: 0; font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-shadow: 0 1px 3px #000; pointer-events: none; }
.player-msg {
  position: absolute; inset: env(safe-area-inset-top) 0 0; display: grid; place-content: center; justify-items: center; gap: 10px;
  padding: 20px; text-align: center; background: rgba(0, 0, 0, .7); font-size: 14px;
}
.big-play { display: grid; place-items: center; width: 72px; height: 72px; border-radius: 50%; background: var(--accent); box-shadow: 0 8px 30px rgba(139, 92, 246, .6); }
.big-play .ic { width: 30px; height: 30px; margin-left: 4px; }
.player-info { flex: 1; padding: 18px var(--pad) calc(24px + env(safe-area-inset-bottom)); display: grid; align-content: start; gap: 14px; max-width: 900px; width: 100%; margin: 0 auto; }
.np-head { display: flex; align-items: center; gap: 14px; }
.np-head > div { flex: 1; min-width: 0; }
.np-head h1 { font-size: 19px; line-height: 1.25; }
.np-head .thumb-logo { width: 72px; flex: none; }
.zap { display: flex; gap: 10px; }
.epg { display: grid; gap: 8px; }
.epg-item { padding: 12px 14px; border-radius: var(--r); background: var(--surface); }
.epg-item.now { background: linear-gradient(135deg, rgba(139, 92, 246, .18), var(--surface)); }
.epg-time { font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.epg-time b { color: var(--accent-2); }
.epg-title { font-weight: 600; margin: 2px 0 6px; }
.epg-desc { font-size: 13px; color: var(--text-2); margin-top: 8px; }
/* telemóvel deitado: vídeo ocupa o ecrã */
@media (orientation: landscape) and (max-height: 500px) {
  .video-box video { height: 100vh; height: 100dvh; max-height: none; aspect-ratio: auto; }
  .video-box { position: relative; padding-top: 0; }
  .player-top { top: 0; padding-left: max(4px, env(safe-area-inset-left)); }
}

/* ---------- definições ---------- */
.profile { display: flex; align-items: center; gap: 14px; padding: 14px; margin-bottom: 8px; border-radius: var(--r-l); background: var(--surface); }
.profile > span:nth-child(2) { flex: 1; display: grid; }
.profile small { color: var(--accent-2); font-size: 14px; }
.set-group { margin-top: 22px; }
.set-group h2 { font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); margin: 0 4px 8px; }
.set-card { border-radius: var(--r-l); background: var(--surface); overflow: hidden; }
.set-item, .set-row { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 54px; padding: 10px 16px; text-align: left; }
.set-item + .set-item, .set-row + .set-row, .set-row + .set-item, .set-item + .set-row { border-top: 1px solid var(--line); }
.set-item:active { background: var(--surface-2); }
.set-item .ic:first-child { color: var(--accent-2); }
.set-label { flex: 1; font-weight: 500; }
.set-value { color: var(--text-3); }
.set-row { justify-content: space-between; }
.set-row > div:not(.seg) { display: grid; }
.set-row small { color: var(--text-3); font-size: 13px; }
.set-row.col { flex-direction: column; align-items: stretch; }
.set-note { padding: 0 16px 12px; font-size: 13px; color: var(--text-3); }
.kv-val { text-align: right; overflow-wrap: anywhere; max-width: 60%; font-weight: 600; }
.seg { display: inline-flex; padding: 3px; border-radius: 12px; background: var(--bg-2); gap: 2px; flex: none; }
.seg button { padding: 7px 12px; border-radius: 9px; font-size: 14px; font-weight: 600; color: var(--text-2); }
.seg button.active { background: var(--accent); color: #fff; }
.seg-full, .set-row.col .seg { display: flex; }
.seg-full button, .set-row.col .seg button { flex: 1; }
.switch {
  -webkit-appearance: none; appearance: none; flex: none; position: relative; width: 50px; height: 30px; border-radius: 99px;
  background: var(--surface-3); transition: background .2s; cursor: pointer; margin: 0;
}
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 2px 4px rgba(0, 0, 0, .3); }
.switch:checked { background: var(--accent); }
.switch:checked::after { transform: translateX(20px); }
.status-card { display: flex; align-items: center; gap: 14px; padding: 16px; margin-bottom: 14px; border-radius: var(--r-l); background: var(--surface); }
.status-card > div { display: grid; }
.status-card small { color: var(--text-3); }
.status-card .dot { width: 12px; height: 12px; border-radius: 50%; background: var(--danger); box-shadow: 0 0 12px var(--danger); }
.status-card.ok .dot { background: var(--ok); box-shadow: 0 0 12px var(--ok); }
.prose { color: var(--text-2); line-height: 1.6; padding: 4px; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
