/* RFlix — Netflix-style theme */
:root {
  --bg: #141414;
  --panel: #181818;
  --panel-2: #232323;
  --line: #333;
  --text: #fff;
  --muted: #a3a3a3;
  --accent: #e50914;
  --accent-2: #f6121d;
  --good: #46d369;
  --radius: 6px;
  --pad: clamp(16px, 4vw, 60px);
}
* { box-sizing: border-box; }
html { background: var(--bg); }
body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); font: 15px/1.45 "Helvetica Neue", Helvetica, Arial, system-ui, sans-serif; -webkit-font-smoothing: antialiased; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.spacer { flex: 1; }
.brand { color: var(--accent); font-weight: 900; letter-spacing: 1px; font-size: 28px; line-height: 1; font-family: "Arial Black", "Helvetica Neue", Arial, sans-serif; text-shadow: 0 2px 6px #0006; user-select: none; }
.brand.big { font-size: 44px; margin-bottom: 8px; }

/* ---------- buttons & inputs ---------- */
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 9px 22px; border-radius: 4px; border: 0; background: var(--accent); color: #fff; font-weight: 700; font-size: 16px; line-height: 1.2; }
.btn:hover { background: var(--accent-2); }
.btn.white { background: #fff; color: #000; }
.btn.white:hover { background: #ffffffbf; }
.btn.grey { background: #6d6d6eb3; color: #fff; }
.btn.grey:hover { background: #6d6d6e66; }
.btn.small { padding: 6px 12px; font-size: 14px; }
.btn:disabled { opacity: .6; cursor: default; }
.input, .select { padding: 10px 12px; border-radius: 4px; background: #333; border: 1px solid transparent; outline: none; color: #fff; }
.input:focus { border-color: #fff; background: #454545; }
.select { background: #000; border: 1px solid #fff9; padding: 7px 10px; font-size: 14px; max-width: 100%; }
.error { color: #e87c03; font-size: 14px; min-height: 1em; }
.loading, .empty { padding: 80px 0; text-align: center; color: var(--muted); }

/* ---------- login ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: radial-gradient(900px 500px at 50% -10%, #3a0a0d 0%, #000 70%); }
.login form { width: min(440px, 100%); background: #000000bf; border-radius: 8px; padding: 44px 48px; display: grid; gap: 14px; }
.login h1 { margin: 0; font-size: 30px; }
.login label { display: grid; gap: 6px; font-size: 13px; color: var(--muted); }
.login .btn { justify-content: center; margin-top: 8px; padding: 13px; }
@media (max-width: 500px) { .login form { padding: 28px 20px; } }

/* ---------- top nav ---------- */
.nav { position: fixed; top: 0; left: 0; right: 0; z-index: 10; display: flex; align-items: center; gap: 28px; padding: 14px var(--pad); background: linear-gradient(#000b, #0000); transition: background-color .3s; }
.nav.solid { background-color: #141414; }
.links { display: flex; gap: 20px; font-size: 14px; }
.links a { color: #e5e5e5; transition: color .2s; white-space: nowrap; }
.links a:hover { color: #b3b3b3; }
.links a.on { color: #fff; font-weight: 700; }
.nav-select { display: none; background: transparent; border: 0; color: #fff; font-weight: 700; }
.nav-select option { background: #141414; }
.nav-right { margin-left: auto; display: flex; align-items: center; gap: 16px; }
.icon-plain { background: none; border: 0; padding: 4px; display: grid; place-items: center; color: #fff; }
.search-box { display: flex; align-items: center; gap: 6px; border: 1px solid transparent; padding: 2px 6px; transition: background .2s; }
.search-box input { width: 0; padding: 4px 0; border: 0; background: transparent; outline: none; color: #fff; transition: width .25s; }
.search-box.open { background: #000c; border-color: #fff; }
.search-box.open input { width: min(240px, 42vw); }
.avatar { width: 32px; height: 32px; border-radius: 4px; border: 0; background: linear-gradient(135deg, #e50914, #7a0710); color: #fff; font-weight: 800; }

/* ---------- billboard ---------- */
.billboard { position: relative; height: min(56.25vw, 82vh); min-height: 420px; overflow: hidden; }
.loading-bb { background: linear-gradient(90deg, #1a1a1a, #222, #1a1a1a); }
.bb-art { position: absolute; inset: 0; background: #000 center 20% / cover no-repeat; }
.bb-art.blur { filter: blur(24px) brightness(.6); transform: scale(1.15); }
.bb-shade { position: absolute; inset: 0; background: linear-gradient(77deg, #000000b3 0%, #0000 60%), linear-gradient(#0000 55%, var(--bg) 98%); }
.bb-content { position: absolute; left: var(--pad); bottom: 22%; width: min(560px, 80vw); }
.bb-kind { font-size: 13px; letter-spacing: 3px; color: #ddd; font-weight: 700; }
.bb-kind::before { content: "R "; color: var(--accent); font-family: "Arial Black", Arial, sans-serif; letter-spacing: 0; font-size: 16px; }
.bb-title { margin: 6px 0 10px; font-size: clamp(28px, 4.4vw, 60px); line-height: 1.05; font-weight: 800; text-shadow: 2px 2px 6px #0009; }
.bb-facts { color: #e5e5e5; font-size: 15px; margin-bottom: 10px; }
.bb-plot { margin: 0 0 18px; font-size: clamp(14px, 1.3vw, 19px); text-shadow: 1px 1px 3px #000b; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.bb-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.bb-actions .btn { font-size: clamp(15px, 1.4vw, 19px); padding: 10px 26px; }

/* ---------- rows ---------- */
.rows { position: relative; z-index: 2; margin-top: -9vw; padding-bottom: 60px; }
.billboard + .rows { margin-top: -9vw; }
.rows:first-child { margin-top: 90px; }
section.row { margin: 0 0 3vw; }
.row-title { margin: 0 var(--pad) 10px; font-size: clamp(16px, 1.5vw, 22px); font-weight: 700; color: #e5e5e5; display: flex; align-items: baseline; gap: 12px; }
.explore { font-size: 13px; color: #54b9c5; font-weight: 600; opacity: 0; transition: opacity .2s; }
section.row:hover .explore { opacity: 1; }
.row-wrap { position: relative; }
.row-track { display: flex; gap: 8px; overflow-x: auto; overflow-y: hidden; scroll-snap-type: x proximity; scroll-padding-inline: var(--pad); padding: 8px var(--pad) 16px; scrollbar-width: none; overscroll-behavior-x: contain; }
.row-track::-webkit-scrollbar { display: none; }
.row-track .card { flex: 0 0 clamp(120px, 14vw, 210px); scroll-snap-align: start; }
.row-track .card.wide { flex-basis: clamp(220px, 24vw, 340px); }
.row-arrow { position: absolute; top: 8px; bottom: 16px; width: calc(var(--pad) - 6px); min-width: 34px; z-index: 3; border: 0; background: #14141499; color: #fff; font-size: 44px; opacity: 0; transition: opacity .2s; }
.row-arrow.left { left: 0; }
.row-arrow.right { right: 0; }
.row-wrap:hover .row-arrow { opacity: 1; }
.row-arrow:hover { background: #141414cc; }
@media (hover: none) { .row-arrow { display: none; } }

/* ---------- cards ---------- */
.card { position: relative; background: none; border: 0; padding: 0; text-align: left; color: #fff; }
.poster { position: relative; aspect-ratio: 2/3; border-radius: var(--radius); background: #222 center/cover no-repeat; overflow: hidden; transition: transform .25s ease, box-shadow .25s; }
.poster img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.poster .ph { position: absolute; inset: 0; display: grid; place-items: center; padding: 10px; text-align: center; color: #bbb; font-size: 13px; font-weight: 600; }
.card:hover .poster, .card:focus-visible .poster { transform: scale(1.06); box-shadow: 0 8px 24px #000c; z-index: 2; }
.card:focus-visible { outline: none; }
.card:focus-visible .poster { outline: 3px solid #fff; }
.card-hover { position: absolute; left: 0; right: 0; bottom: 0; padding: 26px 8px 8px; background: linear-gradient(#0000, #000e); display: grid; gap: 2px; opacity: 0; transition: opacity .2s; font-size: 13px; font-weight: 700; }
.card-hover small { color: #bbb; font-weight: 400; }
.card:hover .card-hover, .card:focus-visible .card-hover { opacity: 1; }
.rating { position: absolute; top: 6px; left: 6px; z-index: 1; background: #000b; padding: 1px 6px; border-radius: 3px; font-size: 11px; font-weight: 700; }
.fav-dot { position: absolute; top: 6px; right: 6px; z-index: 1; background: #000b; border-radius: 50%; width: 20px; height: 20px; display: grid; place-items: center; font-size: 12px; }
.progress { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: #ffffff4d; z-index: 1; }
.progress > i { display: block; height: 100%; background: var(--accent); }
.poster.wide { aspect-ratio: 16/9; background-color: #222; }
.play-badge { position: absolute; inset: 0; display: grid; place-items: center; opacity: .85; }
.play-badge svg { width: 44px; height: 44px; padding: 10px; border: 2px solid #fff; border-radius: 50%; background: #0007; }
.wide-meta { display: grid; padding: 8px 2px 0; font-size: 13px; }
.wide-meta span, .wide-meta small { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.skel, .skel-line { background: linear-gradient(90deg, #222 0%, #2c2c2c 50%, #222 100%); background-size: 200% 100%; animation: shimmer 1.2s infinite linear; }
.skel-line { width: 180px; height: 20px; border-radius: 4px; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- browse pages ---------- */
.page { padding: 90px var(--pad) 60px; }
.page h1 { margin: 0 0 18px; font-size: clamp(24px, 3vw, 38px); }
.browse-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 22px; }
.browse-head h1 { margin: 0 12px 0 0; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(clamp(110px, 13vw, 190px), 1fr)); gap: 22px 10px; }
/* Off-screen cards skip layout/paint entirely — keeps long grids smooth. */
.grid > .card { content-visibility: auto; contain-intrinsic-size: auto 280px; }
.grid.wide-grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); margin-bottom: 30px; }
.page .row-title { margin: 30px 0 12px; }
.search-title { font-size: 20px !important; color: var(--muted); font-weight: 400; }

.channels { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 8px; }
.chan { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: var(--radius); background: var(--panel); border: 1px solid transparent; text-align: left; content-visibility: auto; contain-intrinsic-size: auto 58px; }
.chan:hover, .chan:focus-visible { border-color: #fff; background: #222; outline: none; }
.chan .logo-box { width: 60px; height: 40px; flex: none; display: grid; place-items: center; background: #fff1; border-radius: 4px; overflow: hidden; }
.chan .logo-box img { max-width: 100%; max-height: 100%; object-fit: contain; }
.chan-text { min-width: 0; }
.chan .cname { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chan .epg { font-size: 12px; color: var(--muted); }

/* ---------- details modal ---------- */
.modal { position: fixed; inset: 0; background: #000b; z-index: 20; overflow: auto; padding: 32px 16px; display: flex; justify-content: center; align-items: flex-start; }
.modal-card { width: min(900px, 100%); background: var(--panel); border-radius: 8px; overflow: hidden; position: relative; box-shadow: 0 10px 40px #000; }
.hero { position: relative; min-height: 300px; background: #000 center 20%/cover no-repeat; }
.hero::after { content: ""; position: absolute; inset: 0; background: linear-gradient(#0000 30%, var(--panel) 98%), linear-gradient(90deg, #000a, #0000 70%); }
.hero-inner { position: relative; z-index: 1; display: flex; gap: 22px; padding: 26px 40px; padding-top: 150px; align-items: flex-end; }
.hero-inner .poster { width: 140px; flex: none; box-shadow: 0 6px 20px #000a; }
.hero h2 { margin: 0 0 8px; font-size: clamp(24px, 3.4vw, 38px); line-height: 1.1; }
.facts { display: flex; flex-wrap: wrap; gap: 6px 14px; color: #bcbcbc; font-size: 14px; }
.facts span:first-child { color: var(--good); font-weight: 700; }
.details { padding: 4px 40px 36px; }
.details p { color: #d2d2d2; max-width: 75ch; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin: 14px 0; }
.close-x { position: absolute; top: 14px; right: 14px; z-index: 2; background: #181818; color: #fff; border: 0; width: 36px; height: 36px; border-radius: 50%; font-size: 16px; }
.seasons { display: flex; gap: 6px; flex-wrap: wrap; margin: 18px 0 14px; }
.seasons button { background: #242424; border: 1px solid #4d4d4d; border-radius: 4px; padding: 6px 14px; }
.seasons button.on { background: #fff; color: #000; border-color: #fff; font-weight: 700; }
.episodes { display: grid; }
.ep { display: grid; grid-template-columns: 34px 150px 1fr; gap: 16px; align-items: center; padding: 16px 12px; background: none; border: 0; border-bottom: 1px solid #404040; border-radius: 0; text-align: left; color: #fff; }
.ep:hover, .ep:focus-visible { background: #333; outline: none; border-radius: 4px; }
.ep .num { font-size: 22px; color: #d2d2d2; text-align: center; }
.ep .thumb { aspect-ratio: 16/9; border-radius: 4px; background: #000 center/cover no-repeat; position: relative; overflow: hidden; }
.ep .t { font-weight: 700; }
.ep .d { font-size: 13px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ---------- player (Netflix-style) ---------- */
.player { position: fixed; inset: 0; background: #000; z-index: 30; user-select: none; }
.player video { width: 100%; height: 100%; object-fit: contain; background: #000; }
.player .p-top, .player .p-bottom { position: absolute; left: 0; right: 0; transition: opacity .3s; }
.player .p-top { top: 0; display: flex; gap: 14px; align-items: center; padding: 20px 32px; background: linear-gradient(#000a, #0000); }
.player .p-bottom { bottom: 0; padding: 60px 32px 22px; background: linear-gradient(#0000, #000c 70%); }
.player.idle .p-top, .player.idle .p-bottom, .player.idle .next-up { opacity: 0; pointer-events: none; }
.player.idle { cursor: none; }
.p-icon { background: none; border: 0; padding: 0; width: 46px; height: 46px; display: grid; place-items: center; color: #fff; flex: none; transition: transform .15s; }
.p-icon svg { width: 32px; height: 32px; display: block; }
.p-icon:hover { transform: scale(1.2); }
.p-icon.on { color: #fff; }
.badge { font-size: 10px; font-weight: 700; letter-spacing: .5px; text-transform: uppercase; padding: 3px 7px; border-radius: 3px; background: #ffffff1f; color: #ddd; }
.badge:empty { display: none; }
.badge.direct { color: #7ff0bd; }
.badge.remux { color: #9ccaff; }
.badge.transcode { color: #ffd27a; }
.seek-row { display: flex; align-items: center; gap: 18px; font-variant-numeric: tabular-nums; margin-bottom: 14px; padding-left: 4px; }
.seek { flex: 1; height: 22px; position: relative; cursor: pointer; }
.seek::before, .seek-buf, .seek-fill { content: ""; position: absolute; left: 0; top: 9px; height: 4px; transition: height .1s, top .1s; }
.seek::before { right: 0; background: #ffffff40; }
.seek-buf { background: #ffffff66; width: 0; }
.seek-fill { background: var(--accent); width: 0; }
.seek .knob { position: absolute; right: -8px; top: 50%; width: 16px; height: 16px; margin-top: -8px; border-radius: 50%; background: var(--accent); transform: scale(.9); transition: transform .1s; }
.seek:hover::before, .seek:hover .seek-buf, .seek:hover .seek-fill { top: 8px; height: 6px; }
.seek:hover .knob { transform: scale(1.3); }
.seek-hover { position: absolute; bottom: 26px; transform: translateX(-50%); background: #000d; padding: 3px 8px; border-radius: 3px; font-size: 13px; pointer-events: none; }
.seek.live { pointer-events: none; }
.seek.live::before { background: var(--accent); }
.seek.live .knob { display: none; }
.t-left { font-size: 15px; min-width: 64px; text-align: right; line-height: 22px; }
.ctrl-row { display: grid; grid-template-columns: 1fr minmax(0, auto) 1fr; align-items: center; gap: 16px; }
.ctrl-left, .ctrl-right { display: flex; align-items: center; gap: 14px; min-width: 0; }
.ctrl-right { justify-content: flex-end; }
.vol { display: flex; align-items: center; gap: 6px; }
#volume { width: 0; opacity: 0; accent-color: #fff; transition: width .2s, opacity .2s; }
.vol:hover #volume, #volume:focus { width: 90px; opacity: 1; }
.p-title { min-width: 0; max-width: 46vw; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 18px; line-height: 46px; }
.p-title b { font-weight: 700; }
.p-title span { color: #ccc; margin-left: 10px; }
.next-up { position: absolute; right: 30px; bottom: 120px; display: flex; align-items: center; gap: 8px; background: #fff; color: #000; border: 0; border-radius: 4px; padding: 12px 22px; font-weight: 700; font-size: 17px; transition: opacity .3s; }
.next-up svg { width: 20px; height: 20px; }
.next-up:hover { background: #ddd; }
.flash { position: absolute; top: 50%; left: 50%; width: 96px; height: 96px; margin: -48px; border-radius: 50%; background: #0008; display: grid; place-items: center; color: #fff; opacity: 0; pointer-events: none; }
.flash svg { width: 44px; height: 44px; }
.flash.show { animation: flash .6s ease-out; }
.flash-skip { font-size: 22px; font-weight: 800; }
@keyframes flash { 0% { opacity: 1; transform: scale(.8); } 100% { opacity: 0; transform: scale(1.25); } }
.subs-layer { position: absolute; left: 5%; right: 5%; bottom: 7%; display: flex; justify-content: center; pointer-events: none; transition: bottom .3s; }
.player:not(.idle) .subs-layer { bottom: 150px; }
.subtitle { text-align: center; font-size: calc(var(--sub-scale, 1) * clamp(18px, 3.1vw, 42px)); line-height: 1.25; color: #fff; text-shadow: 0 0 5px #000, 0 0 5px #000, 2px 2px 3px #000; white-space: pre-line; font-weight: 600; }
.spinner { position: absolute; top: 50%; left: 50%; width: 60px; height: 60px; margin: -30px; border-radius: 50%; border: 4px solid #fff3; border-top-color: var(--accent); animation: spin 0.8s linear infinite; pointer-events: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.player-msg { position: absolute; top: 50%; left: 50%; transform: translate(-50%, 50px); background: #000c; padding: 8px 14px; border-radius: 4px; font-size: 14px; max-width: 80%; text-align: center; }
.menu { position: absolute; right: 26px; bottom: 100px; width: min(380px, calc(100% - 32px)); max-height: 65vh; overflow: auto; background: #262626f5; border-radius: 6px; padding: 14px; z-index: 2; box-shadow: 0 8px 30px #000a; }
.menu.menu-subs { width: min(640px, calc(100% - 32px)); }
.menu-cols { display: grid; grid-template-columns: 1fr 1.3fr; gap: 18px; }
.menu h4 { margin: 10px 8px 6px; font-size: 16px; font-weight: 700; color: #fff; }
.menu h4:first-child { margin-top: 0; }
.menu button.item { display: flex; width: 100%; gap: 10px; align-items: center; background: none; border: 0; padding: 7px 10px; border-radius: 3px; text-align: left; font-size: 15px; color: #b3b3b3; }
.menu button.item:hover { background: #ffffff14; color: #fff; }
.menu button.item.on { color: #fff; font-weight: 700; }
.menu button.item.on::before { content: "✓"; }
.menu button.item:not(.on)::before { content: ""; width: 12px; }
.menu button.item:disabled { opacity: .4; }
.menu .item small { color: #8c8c8c; margin-left: auto; font-weight: 400; }
.menu .row { display: flex; align-items: center; gap: 8px; padding: 6px 8px; font-size: 14px; flex-wrap: wrap; }
.menu .row.small { font-size: 12px; }
.menu .row.check { gap: 8px; color: #ccc; cursor: pointer; font-size: 13px; }
.menu .select { background: #111; }
.menu .delay { min-width: 54px; text-align: center; }
.pill { background: #ffffff1f; border: 0; border-radius: 3px; padding: 6px 12px; font-size: 13px; color: #fff; }
.pill:hover { background: #ffffff3d; }
.speed-row { display: flex; justify-content: space-between; gap: 6px; padding: 10px 4px 4px; }
.speed { background: none; border: 0; color: #b3b3b3; display: grid; justify-items: center; gap: 8px; font-size: 13px; }
.speed i { width: 14px; height: 14px; border-radius: 50%; border: 2px solid #b3b3b3; }
.speed.on { color: #fff; font-weight: 700; }
.speed.on i { background: #fff; border-color: #fff; box-shadow: 0 0 0 4px #ffffff33; }
.ep-item .ep-n { width: 22px; color: #8c8c8c; }
.ep-item .ep-t { flex: 1; min-width: 0; display: grid; gap: 4px; }
.mini-prog { display: block; height: 3px; background: #ffffff33; }
.mini-prog b { display: block; height: 100%; background: var(--accent); }
@media (max-width: 760px) {
  .p-title { display: none; }
  .ctrl-row { grid-template-columns: 1fr auto; }
  .ctrl-left, .ctrl-right { gap: 4px; }
  .menu-cols { grid-template-columns: 1fr; }
  .p-icon { width: 38px; }
  .p-icon svg { width: 26px; height: 26px; }
  .player .p-bottom { padding: 40px 12px 12px; }
  .next-up { right: 12px; bottom: 110px; }
}

/* watched indicators, My List buttons */
.card-add { position: absolute; top: -34px; right: 8px; width: 30px; height: 30px; border-radius: 50%; border: 2px solid #fffb; background: #141414cc; display: grid; place-items: center; font-size: 18px; font-weight: 700; line-height: 1; }
.card-hover { overflow: visible; }
.card-add:hover { border-color: #fff; background: #333; }
.card-add.on { background: #fff; color: #000; border-color: #fff; }
.watched-dot { position: absolute; top: 6px; right: 6px; z-index: 1; background: #000c; color: var(--good); border-radius: 3px; padding: 1px 6px; font-size: 11px; font-weight: 700; }
.watched-tag { color: var(--good); font-size: 12px; font-weight: 700; margin-left: 6px; }
.left-tag { color: #bbb; font-size: 12px; font-weight: 400; margin-left: 6px; }
.watched-line { margin-top: 8px; color: #ddd; font-size: 14px; }
.modal-prog { margin-top: 8px; width: 220px; height: 4px; background: #ffffff40; }
.modal-prog i { display: block; height: 100%; background: var(--accent); }

.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: #232323f2; border: 1px solid var(--line); padding: 10px 16px; border-radius: 6px; z-index: 50; max-width: calc(100% - 32px); }

@media (max-width: 900px) {
  .links { display: none; }
  .nav-select { display: block; }
  .nav { gap: 14px; }
  .brand { font-size: 22px; }
}
@media (max-width: 760px) {
  .billboard { height: 70vh; min-height: 380px; }
  .bb-content { bottom: 16%; }
  .rows, .billboard + .rows { margin-top: -40px; }
  .hero-inner { flex-direction: column; align-items: flex-start; padding: 90px 20px 20px; }
  .hero-inner .poster { width: 110px; }
  .details { padding: 4px 20px 28px; }
  .ep { grid-template-columns: 120px 1fr; }
  .ep .num { display: none; }
  .modal { padding: 0; }
  .modal-card { border-radius: 0; }
}
.player:not([hidden]) ~ .toast { top: 84px; bottom: auto; }

/* ---------- accounts, profile, admin ---------- */
.avatar { padding: 0; overflow: hidden; background: none; }
.avatar-img { width: 32px; height: 32px; border-radius: 4px; display: block; object-fit: cover; }
.avatar-sm { width: 30px; height: 30px; border-radius: 4px; object-fit: cover; vertical-align: middle; }
.avatar-big { width: 110px; height: 110px; border-radius: 6px; object-fit: cover; flex: none; }
.account-menu { position: fixed; top: 58px; right: var(--pad); z-index: 40; width: 250px; background: #000000f0; border: 1px solid #ffffff26; border-radius: 4px; padding: 8px 0; box-shadow: 0 10px 30px #000a; }
.account-menu .am-head { display: flex; gap: 10px; align-items: center; padding: 8px 14px 12px; border-bottom: 1px solid #ffffff1f; margin-bottom: 6px; }
.account-menu .am-head div { display: grid; min-width: 0; }
.account-menu .am-head small { color: var(--muted); overflow: hidden; text-overflow: ellipsis; }
.account-menu button { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 9px 14px; font-size: 14px; color: #ddd; }
.account-menu button:hover { background: #ffffff14; color: #fff; text-decoration: underline; }
.profile-top { display: flex; gap: 20px; align-items: center; margin: 10px 0 18px; }
.profile-fields { display: grid; gap: 8px; flex: 1; }
.profile-fields label, .admin-form label { display: grid; gap: 6px; font-size: 13px; color: var(--muted); }
.details h4 { margin: 18px 0 10px; }
.avatar-grid { display: flex; flex-wrap: wrap; gap: 10px; }
.avatar-grid button, .avatar-upload { width: 64px; height: 64px; padding: 0; border: 3px solid transparent; border-radius: 6px; background: none; overflow: hidden; }
.avatar-grid button img { width: 100%; height: 100%; display: block; }
.avatar-grid button.on, .avatar-grid button:hover { border-color: #fff; }
.avatar-upload { display: grid; place-items: center; background: #333; font-size: 30px; color: #bbb; cursor: pointer; }
.avatar-upload:hover { border-color: #fff; color: #fff; }
.pw-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.small { font-size: 12px; }
.check { display: flex !important; align-items: center; gap: 8px; cursor: pointer; }
.admin h1 { margin-bottom: 24px; }
.admin-card { background: var(--panel); border-radius: 8px; padding: 22px 24px; margin-bottom: 22px; max-width: 980px; }
.admin-card h2 { margin: 0 0 8px; font-size: 20px; display: flex; align-items: center; gap: 10px; }
.admin-card h3 { margin: 22px 0 10px; font-size: 16px; }
.admin-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px 16px; margin-top: 14px; }
.admin-form.inline { grid-template-columns: 1fr 1.3fr 1.2fr auto auto; align-items: center; }
.form-actions { display: flex; align-items: center; gap: 14px; grid-column: 1 / -1; }
.pill-status { font-size: 12px; font-weight: 700; padding: 3px 8px; border-radius: 3px; background: #ffffff1f; }
.pill-status.ok, .ok-text { color: var(--good); }
.pill-status.bad { color: #ff7b84; }
table.users { width: 100%; border-collapse: collapse; font-size: 14px; }
table.users th { text-align: left; color: var(--muted); font-weight: 400; font-size: 12px; padding: 6px 8px; border-bottom: 1px solid #333; }
table.users td { padding: 8px; border-bottom: 1px solid #262626; }
table.users tr.disabled td { opacity: .5; }
.row-actions { text-align: right; }
code { background: #333; padding: 1px 5px; border-radius: 3px; font-size: 13px; }
.player-msg .btn { margin-top: 10px; }
.player-msg { pointer-events: auto; }
@media (max-width: 760px) {
  .admin-form.inline, .pw-row { grid-template-columns: 1fr; }
  table.users th:nth-child(5), table.users td:nth-child(5), table.users th:nth-child(3), table.users td:nth-child(3) { display: none; }
}

/* who's watching, subtitle search details, stream info */
.who-watching { padding-top: 28px; max-width: 520px; }
.ww-row { display: flex; gap: 14px; align-items: center; padding: 12px 0; border-bottom: 1px solid #333; }
.avatar-md { width: 48px; height: 48px; border-radius: 6px; object-fit: cover; flex: none; }
.ww-title { font-size: 17px; font-weight: 700; margin: 2px 0; }
.modal-card:has(.who-watching) { width: min(560px, 100%); margin-top: 12vh; }
.video-card { margin: 0 8px 10px; padding: 10px 12px; background: #ffffff0f; border-radius: 4px; }
.vc-label { font-size: 11px; text-transform: uppercase; letter-spacing: .6px; color: #8c8c8c; }
.vc-release { font-size: 13px; color: #fff; word-break: break-all; margin: 3px 0 6px; }
.vc-facts { display: flex; flex-wrap: wrap; gap: 6px; }
.vc-facts span { font-size: 12px; padding: 2px 7px; border-radius: 3px; background: #ffffff1a; }
.vc-tip { font-size: 11px; color: #8c8c8c; margin-top: 6px; }
.menu button.sub-result { display: grid; grid-template-columns: 12px 1fr; align-items: start; }
.menu button.sub-result .sub-name { word-break: break-all; font-size: 13px; }
.menu button.sub-result small { grid-column: 2; margin: 2px 0 0; }
.match { color: var(--good); }
table.stream-info { width: 100%; font-size: 13px; border-collapse: collapse; margin: 0 4px; }
table.stream-info th { text-align: left; color: #8c8c8c; font-weight: 400; padding: 5px 10px 5px 4px; vertical-align: top; white-space: nowrap; }
table.stream-info td { padding: 5px 4px; color: #ddd; word-break: break-word; }

/* ratings badges in details */
.ratings { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 12px; min-height: 28px; }
.rt-badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px 4px 6px; border-radius: 4px; background: #000a; border: 1px solid #ffffff26; font-size: 14px; color: #fff; }
a.rt-badge:hover { border-color: #fff; }
.rt-badge .score { font-weight: 800; font-size: 16px; }
.rt-badge small { color: #bbb; font-size: 12px; }
.imdb-logo { background: #f5c518; color: #000; font-weight: 900; font-size: 12px; padding: 2px 5px; border-radius: 3px; letter-spacing: -.3px; }
.mc { display: inline-grid; place-items: center; min-width: 26px; height: 24px; border-radius: 3px; font-weight: 800; color: #fff; }
.mc.good { background: #00ce7a; } .mc.mixed { background: #ffbd3f; color: #000; } .mc.bad { background: #ff6874; }
.rt-badge.plain { padding: 4px 8px; font-size: 12px; font-weight: 700; }
.awards { flex-basis: 100%; font-size: 13px; color: #ddd; }

/* people search */
.person-result { margin-bottom: 34px; padding-bottom: 10px; border-bottom: 1px solid #333; }
.person-head { display: flex; align-items: center; gap: 16px; margin-bottom: 6px; }
.person-head img, .person-ph { width: 76px; height: 76px; border-radius: 50%; object-fit: cover; background: #333; display: grid; place-items: center; font-size: 32px; flex: none; }
.person-head h2 { margin: 2px 0; font-size: 26px; }
.person-head a, .other-people a { color: #54b9c5; }
.other-people { margin-top: 16px; }

/* ---------- TV mode (tv.js adds .tv on Samsung / LG TVs or with ?tv=1): big, obvious focus for the remote ---------- */
.tv { cursor: none; }
.tv :focus { outline: none; }
.tv .btn:focus, .tv button:focus, .tv a:focus, .tv select:focus, .tv input:focus { outline: none; box-shadow: 0 0 0 3px #141414, 0 0 0 6px #fff; }
.tv .card:focus { box-shadow: none; }
.tv .card:focus .poster { transform: scale(1.1); outline: 4px solid #fff; outline-offset: 0; box-shadow: 0 10px 30px #000; z-index: 2; }
.tv .card:focus .card-hover { opacity: 1; }
.tv .card-add { display: none; }
.tv .row-arrow { display: none; }
.tv .row-track { scroll-behavior: smooth; padding-top: 14px; padding-bottom: 22px; }
.tv .p-icon:focus { box-shadow: none; background: #fff3; border-radius: 50%; transform: scale(1.2); }
.tv .player .p-icon:focus svg { color: #fff; }
.tv .player:not(.idle) .p-icon:focus { outline: 3px solid #fff; outline-offset: 2px; }
.tv .menu button:focus, .tv .menu .item:focus { background: #fff; color: #000; box-shadow: none; }
.tv .ep:focus, .tv .chan:focus, .tv .ep-item:focus { background: #333; box-shadow: inset 0 0 0 3px #fff; }
.tv .links a:focus { color: #fff; font-weight: 700; box-shadow: 0 3px 0 #fff; }
.tv #volume, .tv .vol input { display: none; }
.tv .toast { font-size: 20px; }

/* Older TV browsers (Samsung 2019–2021) have no aspect-ratio. */
@supports not (aspect-ratio: 1) {
  .poster, .ep .thumb { height: 0; padding-top: 150%; }
  .poster.wide, .ep .thumb { padding-top: 56.25%; }
}

/* ---------- sign in with your phone (QR / code) ---------- */
.login-wrap { display: flex; align-items: stretch; justify-content: center; gap: 28px; flex-wrap: wrap; width: 100%; }
.qr-card { width: 340px; background: #000000bf; border-radius: 8px; padding: 36px 32px; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 14px; }
.qr-card h2 { margin: 0; font-size: 22px; }
.qr { width: 220px; height: 220px; background: #fff; border-radius: 8px; overflow: hidden; }
.qr svg { display: block; width: 100%; height: 100%; }
.qr-skel { width: 100%; height: 100%; }
.qr-steps { color: #ccc; font-size: 14px; line-height: 1.5; }
.dcode { font: 700 34px/1 ui-monospace, Menlo, Consolas, monospace; letter-spacing: 4px; color: #fff; }
.dcode-input { font: 700 28px ui-monospace, Menlo, Consolas, monospace; letter-spacing: 4px; text-align: center; text-transform: uppercase; width: 100%; max-width: 320px; margin: 8px 0; }
.link-device { max-width: 480px; }
.link-who { min-height: 22px; color: #ddd; }
@media (max-width: 760px) { .qr-card { display: none; } }
.tv .qr-card { width: 420px; }
.tv .qr { width: 280px; height: 280px; }
.tv .dcode { font-size: 44px; }

/* ---------- phones and tablets (touch), iPhone first ---------- */
.p-center, .tabbar { display: none; }
.touch, .touch button, .touch a { -webkit-tap-highlight-color: transparent; }
.touch button, .touch a, .touch .card { touch-action: manipulation; }
/* iOS zooms into any text field under 16px */
.touch input, .touch select, .touch textarea { font-size: 16px; }
.touch .nav { padding-top: calc(14px + env(safe-area-inset-top)); padding-left: max(var(--pad), env(safe-area-inset-left)); padding-right: max(var(--pad), env(safe-area-inset-right)); }
/* no sticky hover effects after a tap */
.touch .card:hover .poster { transform: none; box-shadow: none; }
.touch .card:hover .card-hover { opacity: 0; }
.touch .card-add, .touch .row-arrow, .touch #seek-hover:empty { display: none; }
.touch .close-x { width: 44px; height: 44px; font-size: 18px; top: calc(10px + env(safe-area-inset-top)); }

/* bottom tab bar (phones) */
@media (max-width: 760px) {
  .touch .tabbar, .tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 12; display: flex; justify-content: space-around; background: #141414f2; border-top: 1px solid #ffffff14; padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }
  .tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; color: #8c8c8c; font-size: 10.5px; font-weight: 600; padding: 4px 0; }
  .tabbar a.on { color: #fff; }
  .tabbar svg { width: 24px; height: 24px; }
  .in-app #view { padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
  .in-app .nav-select { display: none; }
  .in-app .toast { bottom: calc(76px + env(safe-area-inset-bottom)); }
  .player:not([hidden]) ~ .tabbar { display: none; }
}

/* player */
.touch .player { touch-action: manipulation; -webkit-user-select: none; user-select: none; }
.touch .player::after { content: ""; position: absolute; top: 0; left: 0; right: 0; bottom: 0; background: #0000008c; opacity: 1; transition: opacity .3s; pointer-events: none; z-index: 1; }
.touch .player.idle::after { opacity: 0; }
.touch .player .p-top, .touch .player .p-bottom, .touch .p-center, .touch .next-up, .touch .player-msg, .touch .menu, .touch .spinner, .touch .flash { z-index: 3; }
.touch .p-center { display: flex; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); align-items: center; gap: min(14vw, 72px); transition: opacity .3s; }
.touch .player.idle .p-center { opacity: 0; pointer-events: none; }
.touch .p-center .p-icon { width: 56px; height: 56px; }
.touch .p-center .p-icon svg { width: 40px; height: 40px; }
.touch .p-center .p-icon.big { width: 76px; height: 76px; }
.touch .p-center .p-icon.big svg { width: 62px; height: 62px; }
.touch .ctrl-left [data-act="play"], .touch .ctrl-left [data-act="back10"], .touch .ctrl-left [data-act="fwd10"], .touch .vol { display: none; }
.touch .player .p-top { padding: max(12px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) 12px max(14px, env(safe-area-inset-left)); }
.touch .player .p-bottom { padding: 40px max(16px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); }
.touch .p-icon { width: 44px; height: 44px; }
.touch .seek-row { margin-bottom: 6px; gap: 12px; }
.touch .seek { height: 34px; touch-action: none; }
.touch .seek::before, .touch .seek-buf, .touch .seek-fill { top: 15px; height: 4px; }
.touch .seek .knob { transform: scale(1); }
.touch .seek.scrubbing::before, .touch .seek.scrubbing .seek-buf, .touch .seek.scrubbing .seek-fill { top: 14px; height: 6px; }
.touch .seek.scrubbing .knob { transform: scale(1.5); }
.touch .seek-hover { bottom: 38px; font-size: 15px; padding: 4px 10px; }
.touch .player:not(.idle) .subs-layer { bottom: 130px; }
.touch .subs-layer { z-index: 2; bottom: max(7%, env(safe-area-inset-bottom)); }
.touch .menu button.item { padding: 11px 10px; font-size: 16px; }
.touch .menu .pill { padding: 8px 14px; }
.tap-play { width: 88px; height: 88px; border-radius: 50%; border: 0; background: #e50914; color: #fff; display: grid; place-items: center; box-shadow: 0 6px 30px #000a; }
.tap-play svg { width: 44px; height: 44px; margin-left: 6px; }
.player-msg:has(.tap-play) { background: none; transform: translate(-50%, -50%); }
/* menus become sheets: from the bottom in portrait, from the side in landscape */
@media (max-width: 760px) {
  .touch .menu { left: 0; right: 0; bottom: 0; width: auto; max-height: 72vh; border-radius: 14px 14px 0 0; padding: 16px 16px max(16px, env(safe-area-inset-bottom)); }
}
@media (max-height: 500px) and (orientation: landscape) {
  .touch .menu { top: 0; bottom: 0; right: 0; left: auto; width: min(430px, 62vw); max-height: none; border-radius: 0; padding: max(14px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 14px 16px; }
  .touch .menu-cols { grid-template-columns: 1fr; }
  .touch .player:not(.idle) .subs-layer { bottom: 105px; }
  .touch .player .p-bottom { padding-top: 24px; }
  .touch .p-title { display: flex; }
}

/* No browser focus box on player buttons after Esc / Space (TV mode draws its own highlight). */
html:not(.tv) .player .p-icon:focus { outline: none; box-shadow: none; }
.p-icon[data-menu="settings"] svg { width: 30px; height: 30px; }
