/* Web24 web player — mobile first (iPhone Safari / home-screen app), 3 columns on wide screens */
:root {
    --bg: #101010;
    --panel: #181818;
    --panel-2: #202020;
    --line: #2a2a2a;
    --text: #f2f2f2;
    --muted: #9a9a9a;
    --red: #d7262e;
    --red-dark: #a91d24;
    --purple: #9a82db;
    --ok: #3ecf8e;
    --radius: 12px;
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --safe-left: env(safe-area-inset-left, 0px);
    --safe-right: env(safe-area-inset-right, 0px);
    color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); }
body { font: 15px/1.4 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif; overflow: hidden; }
button, input { font: inherit; color: inherit; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
svg { width: 22px; height: 22px; fill: currentColor; }

.btn { border: 0; border-radius: 10px; padding: 11px 16px; background: var(--panel-2); cursor: pointer; font-weight: 600; }
.btn.primary { background: var(--red); color: #fff; }
.btn.primary:active { background: var(--red-dark); }
.btn.ghost { background: transparent; border: 1px solid var(--line); width: 100%; margin-top: 10px; }
.btn:disabled { opacity: .5; }
.icon-btn { border: 0; background: transparent; width: 40px; height: 40px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; color: var(--text); }
.icon-btn:active { background: var(--panel-2); }
.icon-btn.on { color: #ffc93c; }

.screen { position: fixed; inset: 0; display: flex; flex-direction: column; }

/* ---------------------------------------------------------------- login */
#login { align-items: center; justify-content: center; padding: calc(24px + var(--safe-top)) 20px calc(24px + var(--safe-bottom)); overflow-y: auto; }
.login-box { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 12px; }
.login-logo { width: 84px; height: 84px; border-radius: 20px; align-self: center; }
.login-box h1 { margin: 4px 0 0; text-align: center; font-size: 26px; }
.login-box p { margin: 0 0 6px; text-align: center; }
.login-box label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
.login-box input:not([type=checkbox]) { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; font-size: 16px; color: var(--text); }
.login-box input:focus { outline: 2px solid var(--red); outline-offset: 0; }
.login-box .check { flex-direction: row; align-items: center; gap: 8px; }
.login-box .btn { margin-top: 6px; padding: 13px; font-size: 16px; }
.error { color: #ff6b6b; min-height: 1.2em; }

/* ---------------------------------------------------------------- top bar */
.topbar { display: flex; align-items: center; gap: 10px; padding: calc(8px + var(--safe-top)) calc(12px + var(--safe-right)) 8px calc(12px + var(--safe-left)); background: var(--bg); border-bottom: 1px solid var(--line); flex: none; }
.topbar-logo { width: 34px; height: 34px; border-radius: 8px; }
.search { flex: 1; display: flex; align-items: center; gap: 8px; background: var(--panel); border-radius: 10px; padding: 0 10px; }
.search svg { width: 18px; height: 18px; fill: var(--muted); flex: none; }
.search input { flex: 1; border: 0; background: transparent; padding: 9px 0; font-size: 16px; outline: 0; min-width: 0; }

/* ---------------------------------------------------------------- layout (phone: player on top, then categories, then list) */
.layout { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.player-pane { order: 1; flex: none; background: #000; }
.categories { order: 2; flex: none; display: flex; gap: 8px; overflow-x: auto; padding: 10px calc(12px + var(--safe-right)) 10px calc(12px + var(--safe-left)); scrollbar-width: none; border-bottom: 1px solid var(--line); }
.categories::-webkit-scrollbar { display: none; }
.channels-pane { order: 3; flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; padding-bottom: var(--safe-bottom); }
.cat { flex: none; border: 1px solid var(--line); background: var(--panel); border-radius: 999px; padding: 7px 14px; white-space: nowrap; cursor: pointer; font-size: 14px; }
.cat.active { background: var(--red); border-color: var(--red); color: #fff; font-weight: 600; }
.cat .n { color: var(--muted); font-size: 12px; margin-left: 4px; }
.cat.active .n { color: rgba(255, 255, 255, .8); }

/* player collapsed until something plays (phone) */
.layout:not(.playing) .player-pane .now-panel { display: none; }
.layout:not(.playing) .video-wrap { display: none; }

.pane-title { display: flex; justify-content: space-between; align-items: baseline; padding: 12px calc(14px + var(--safe-right)) 6px calc(14px + var(--safe-left)); font-weight: 700; }
.channels { list-style: none; margin: 0; padding: 0 0 12px; }
.ch { display: flex; align-items: center; gap: 12px; padding: 9px calc(14px + var(--safe-right)) 9px calc(14px + var(--safe-left)); cursor: pointer; border-left: 3px solid transparent; }
.ch:active, .ch:hover { background: var(--panel); }
.ch.active { background: var(--panel-2); border-left-color: var(--red); }
.ch-logo { width: 54px; height: 36px; border-radius: 6px; background: #fff; object-fit: contain; flex: none; }
.ch-logo.none { background: var(--panel-2); display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; color: var(--muted); }
.ch-text { flex: 1; min-width: 0; }
.ch-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; font-size: 14.5px; }
.ch-epg { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 12.5px; color: var(--muted); }
.ch-bar { height: 2px; background: var(--line); border-radius: 2px; margin-top: 4px; overflow: hidden; }
.ch-bar > div { height: 100%; background: var(--red); }
.ch-star { color: #ffc93c; flex: none; }
.ch-star svg { width: 16px; height: 16px; }
.empty { padding: 20px; text-align: center; }

/* ---------------------------------------------------------------- player */
.video-wrap { position: relative; width: 100%; aspect-ratio: 16 / 9; background: #000; max-height: 45vh; }
.video-wrap video { position: absolute; inset: 0; width: 100%; height: 100%; background: #000; }
.video-overlay { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 16px; text-align: center; pointer-events: none; }
.video-overlay .btn { pointer-events: auto; }
.video-overlay.hide { display: none; }
.video-overlay p { margin: 0; color: #ddd; text-shadow: 0 1px 3px #000; }
/* on-screen info (what is playing): shown on channel change and when the viewer moves / taps over the video */
.osd { position: absolute; left: 0; right: 0; top: 0; display: flex; align-items: center; gap: 10px; padding: 12px 16px 30px; background: linear-gradient(rgba(0, 0, 0, .8), rgba(0, 0, 0, 0)); opacity: 0; transition: opacity .35s; pointer-events: none; }
.osd.show { opacity: 1; }
.osd img { width: 54px; height: 36px; object-fit: contain; background: #fff; border-radius: 6px; flex: none; }
.osd-text { min-width: 0; }
.osd-channel { font-weight: 700; font-size: 16px; color: #fff; text-shadow: 0 1px 3px #000; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.osd-prog { font-size: 13.5px; color: #e6e6e6; text-shadow: 0 1px 3px #000; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.osd-prog:empty { display: none; }
/* search: programmes from the TV guide */
.prog-sec { list-style: none; padding: 10px 14px 4px; font-size: 11.5px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.prog-hit .ch-epg b.live { color: var(--red); }
.prog-hit .ch-epg b.later { color: var(--purple); }
/* TV guide grid */
.tvg, .mv { position: fixed; inset: 0; z-index: 40; background: var(--bg); display: flex; flex-direction: column; padding: var(--safe-top) var(--safe-right) var(--safe-bottom) var(--safe-left); }
body.tvg-open, body.mv-open { overflow: hidden; }
.tvg-head, .mv-head { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.tvg-head h2, .mv-head h2 { margin: 0; font-size: 18px; margin-right: auto; }
.tvg-head select { background: var(--panel-2); color: inherit; border: 1px solid var(--line); border-radius: 10px; padding: 9px 10px; font-size: 15px; max-width: 55vw; }
.tvg-scroll { flex: 1; overflow: auto; -webkit-overflow-scrolling: touch; position: relative; }
.tvg-grid { position: relative; min-width: 100%; }
.tvg-times { display: flex; position: sticky; top: 0; z-index: 3; background: var(--panel); border-bottom: 1px solid var(--line); height: 34px; }
.tvg-corner { width: var(--cw); flex: none; position: sticky; left: 0; background: var(--panel); z-index: 4; border-right: 1px solid var(--line); }
.tvg-ticks { position: relative; flex: none; }
.tvg-ticks span { position: absolute; top: 8px; padding-left: 6px; font-size: 12.5px; color: var(--muted); border-left: 1px solid var(--line); height: 26px; top: 8px; white-space: nowrap; }
.tvg-row { display: flex; height: 58px; border-bottom: 1px solid var(--line); }
.tvg-ch { width: var(--cw); flex: none; position: sticky; left: 0; z-index: 2; background: var(--panel); border: 0; border-right: 1px solid var(--line); display: flex; align-items: center; gap: 8px; padding: 0 10px; color: inherit; text-align: left; cursor: pointer; font: inherit; font-size: 13.5px; font-weight: 600; }
.tvg-ch img { width: 44px; height: 30px; object-fit: contain; background: #fff; border-radius: 5px; flex: none; }
.tvg-ch span { overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.tvg-track { position: relative; flex: 1; }
.tvg-prog { position: absolute; top: 4px; bottom: 4px; background: var(--panel-2); border: 0; border-radius: 7px; padding: 5px 8px; color: inherit; text-align: left; cursor: pointer; overflow: hidden; display: flex; flex-direction: column; justify-content: center; font: inherit; }
.tvg-prog:hover { filter: brightness(1.25); }
.tvg-prog b { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tvg-prog small { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; }
.tvg-prog.on { background: #3a1d22; box-shadow: inset 3px 0 0 var(--red); }
.tvg-prog.past { opacity: .5; }
.tvg-none, .tvg-loading { position: absolute; left: 10px; top: 20px; font-size: 12.5px; color: var(--muted); position: sticky; }
.tvg-loading::after { content: "Loading…"; }
.tvg-nowline { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--red); z-index: 1; pointer-events: none; }
.tvg-empty { padding: 20px; }
/* multi-view */
.mv-layouts { display: flex; gap: 6px; }
.mv-layouts .btn { padding: 8px 14px; }
.mv-grid { flex: 1; display: grid; gap: 4px; padding: 4px; min-height: 0; background: #000; }
.mv-grid.n2 { grid-template-columns: 1fr 1fr; }
.mv-grid.n3 { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }
.mv-grid.n3 .mv-slot:first-child { grid-row: span 2; }
.mv-grid.n4 { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }
@media (max-width: 700px) and (orientation: portrait) { .mv-grid.n2 { grid-template-columns: 1fr; grid-template-rows: 1fr 1fr; } }
.mv-slot { position: relative; background: #111; border: 2px solid transparent; border-radius: 6px; overflow: hidden; min-height: 0; cursor: pointer; }
.mv-slot.active.has { border-color: var(--red); }
.mv-slot video { width: 100%; height: 100%; object-fit: contain; background: #000; display: block; }
.mv-label { position: absolute; left: 0; right: 0; top: 0; display: flex; align-items: center; gap: 4px; padding: 6px 6px 18px 10px; background: linear-gradient(rgba(0, 0, 0, .75), transparent); opacity: 0; transition: opacity .2s; }
.mv-slot:hover .mv-label, .mv-slot.active .mv-label { opacity: 1; }
.mv-label span { flex: 1; font-weight: 700; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-shadow: 0 1px 3px #000; }
.mv-slot:not(.has) .mv-label { display: none; }
.mv-empty { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
.mv-slot.has .mv-empty { display: none; }
.mv-spin { position: absolute; left: 50%; top: 50%; margin: -19px 0 0 -19px; display: none; pointer-events: none; }
.mv-slot.has.loading .mv-spin { display: block; }
.mv-msg { position: absolute; left: 10px; right: 10px; bottom: 10px; margin: 0; font-size: 13px; color: #ffb4b4; text-shadow: 0 1px 3px #000; }
.mv-pick { position: fixed; inset: 0; background: rgba(0, 0, 0, .6); z-index: 45; display: flex; align-items: center; justify-content: center; }
.mv-pick-box { background: var(--panel); width: min(520px, 94vw); max-height: 80vh; border-radius: 14px; display: flex; flex-direction: column; overflow: hidden; }
.mv-pick-head { display: flex; gap: 8px; padding: 10px; border-bottom: 1px solid var(--line); }
.mv-pick-head input { flex: 1; background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; color: inherit; font-size: 16px; }
.mv-pick .channels { overflow-y: auto; }
.mv-pick-cat { padding: 0 10px 10px; border-bottom: 1px solid var(--line); }
.mv-pick-cat select { width: 100%; background: var(--panel-2); color: inherit; border: 1px solid var(--line); border-radius: 10px; padding: 9px 10px; font-size: 15px; }
.mv-pick-cat select:disabled { opacity: .5; }
/* stream info */
.health { display: flex; align-items: center; gap: 16px; background: var(--panel-2); border-radius: 12px; padding: 14px; }
.health p { margin: 4px 0 0; color: #ddd; }
.health-score { font-size: 38px; font-weight: 800; line-height: 1; min-width: 86px; text-align: center; }
.health-score small { display: block; font-size: 12px; color: var(--muted); font-weight: 600; margin-top: 4px; }
.health-score.ok { color: #4cd07d; } .health-score.warn { color: #ffc93c; } .health-score.bad { color: #ff6b6b; }
/* player extras: More menu, channel-number zapping, expiry banner */
@media (max-width: 1199px) { .now-actions .extra { display: none; } }
.icon-btn { position: relative; }
#more-dot { position: absolute; top: 6px; right: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--red); }
.zap { position: absolute; top: 14px; right: 16px; z-index: 3; background: rgba(0, 0, 0, .8); border-radius: 10px; padding: 8px 14px; display: flex; flex-direction: column; align-items: flex-end; pointer-events: none; }
.zap b { font-size: 34px; line-height: 1; color: #fff; font-variant-numeric: tabular-nums; }
.zap span { font-size: 13px; color: #ddd; max-width: 260px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 4px; }
.ch-num { color: var(--muted); font-weight: 500; font-size: 12px; margin-right: 6px; font-variant-numeric: tabular-nums; }
.banner { display: flex; align-items: center; gap: 10px; padding: 8px calc(12px + var(--safe-right)) 8px calc(14px + var(--safe-left)); background: #3a1d22; border-bottom: 1px solid var(--red); font-size: 14px; }
.banner span { flex: 1; }
.banner .btn { padding: 7px 14px; text-decoration: none; }
/* parental lock */
.cat.locked::after { content: " 🔒"; }
.pin-in { font-size: 22px; letter-spacing: .3em; text-align: center; }
.pin-form .error, #lk-err { color: #ff6b6b; min-height: 1em; margin: 6px 0; }
/* report link under a player error, announcement banner */
.report-link { pointer-events: auto; color: #fff; opacity: .85; text-decoration: underline; margin-top: 2px; }
.banner.announce { background: #1d2a3a; border-bottom-color: #3b6fb0; }
.banner.announce span { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
/* renew / upgrade */
.set-row.plan { cursor: default; }
.set-row.plan:hover { filter: none; }
.price { font-weight: 800; white-space: nowrap; }
/* appearance */
.dot-c { display: inline-block; width: 14px; height: 14px; border-radius: 50%; margin-right: 10px; vertical-align: -2px; }
kbd { display: inline-block; min-width: 22px; padding: 2px 7px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 6px; background: var(--panel-2); font: 600 12.5px/1.4 ui-monospace, Menlo, Consolas, monospace; text-align: center; }
.kv.keys dd { text-align: left; font-weight: 400; }
/* keyboard / TV remote: a clear focus ring once arrow keys are used */
body.kbd .ch:focus, body.kbd .cat:focus, body.kbd button:focus, body.kbd .set-row:focus { outline: 3px solid var(--red); outline-offset: -3px; }
.ch:focus { outline: none; }
/* themes */
:root[data-theme="black"] { --bg: #000; --panel: #0b0b0b; --panel-2: #151515; --line: #232323; }
:root[data-theme="light"] { --bg: #f4f4f6; --panel: #ffffff; --panel-2: #ececf1; --line: #dadae0; --text: #17171a; --muted: #6b6b75; }
:root[data-theme="light"] .prog-desc, :root[data-theme="light"] .health p { color: #3a3a40; }
:root[data-theme="light"] .tvg-prog.on { background: #fbe3e4; }
:root[data-theme="light"] .banner { background: #fde8e9; }
:root[data-theme="light"] .banner.announce { background: #e4eefb; }
:root[data-theme="light"] .switch { background: #c4c4cc; }
:root[data-theme="light"] .spinner.sm, :root[data-theme="light"] .spinner.xs, :root[data-theme="light"] .loader-card .spinner { border-color: rgba(0, 0, 0, .15); border-top-color: var(--red); }
:root[data-text="large"] body { zoom: 1.15; width: calc(100vw / 1.15); height: calc(100vh / 1.15); }
/* home screen, followed teams, scores, connections */
.cat.home { font-weight: 700; }
.home-row-head { display: flex; align-items: baseline; justify-content: space-between; }
.home-row-head .link { text-transform: none; letter-spacing: 0; font-weight: 600; }
.ch-extra { font-size: 12.5px; color: var(--text); opacity: .9; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
b.live-b { color: #fff; background: var(--red); border-radius: 4px; padding: 0 5px; font-size: 11px; }
b.score { color: #ffc93c; font-variant-numeric: tabular-nums; }
:root[data-theme="light"] b.score { color: #9a6a00; }
.teams-row { list-style: none; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 4px 12px 8px; }
.teams-row input { flex: 1; min-width: 90px; width: 90px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; color: inherit; font: inherit; font-size: 13px; }
.chip.team { display: inline-flex; align-items: center; gap: 4px; }
.chip .x { background: none; border: 0; color: inherit; font-size: 15px; line-height: 1; padding: 0 0 0 2px; cursor: pointer; }
.set-row.conn { cursor: default; }
.set-row.conn .btn { flex: none; padding: 8px 14px; }
/* live events */
.cat.events { font-weight: 700; }
.ev-chips { list-style: none; display: flex; gap: 6px; overflow-x: auto; padding: 10px 12px 4px; scrollbar-width: none; }
.ev-chips::-webkit-scrollbar { display: none; }
.chip { flex: none; border: 1px solid var(--line); background: var(--panel); color: inherit; border-radius: 999px; padding: 6px 12px; font: inherit; font-size: 13px; cursor: pointer; white-space: nowrap; }
.chip span { color: var(--muted); font-size: 12px; }
.chip.on { background: var(--red); border-color: var(--red); color: #fff; }
.chip.on span { color: rgba(255, 255, 255, .8); }
.ch.ev .ch-name { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.ch.ev b.live { color: #fff; background: var(--red); border-radius: 4px; padding: 0 5px; font-size: 11px; }
.ch.ev b.later { color: var(--purple); }
.bell { background: none; border: 0; padding: 6px; color: var(--muted); cursor: pointer; flex: none; }
.bell svg { width: 22px; height: 22px; fill: currentColor; display: block; }
.bell.on { color: #ffc93c; }
.tvg-prog.rem { box-shadow: inset 0 -3px 0 #ffc93c; }
.remind { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(18px + var(--safe-bottom)); z-index: 60; display: flex; align-items: center; gap: 10px; background: var(--panel); border: 1px solid #ffc93c; border-radius: 12px; padding: 10px 12px; box-shadow: 0 8px 30px rgba(0, 0, 0, .5); max-width: min(560px, 94vw); font-size: 14px; }
.remind span { flex: 1; }
.remind .btn { padding: 8px 14px; }
.netbar { position: fixed; top: 0; left: 0; right: 0; z-index: 70; background: #7a5b00; color: #fff; text-align: center; padding: calc(6px + var(--safe-top)) 12px 6px; font-size: 13.5px; }
/* settings */
.sheet.wide .sheet-box { max-width: 620px; max-height: 90vh; }
.settings .set-sec { font-size: 11.5px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 20px 2px 6px; }
.set-row { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; background: var(--panel-2); border: 0; border-radius: 10px; padding: 12px 14px; margin-bottom: 6px; color: inherit; font: inherit; cursor: pointer; text-decoration: none; }
.set-row:hover { filter: brightness(1.12); }
.set-row.danger b { color: #ff6b6b; }
.set-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.set-text small { color: var(--muted); font-size: 12.5px; }
.chev { color: var(--muted); font-size: 22px; line-height: 1; }
.switch { appearance: none; -webkit-appearance: none; width: 42px; height: 24px; border-radius: 12px; background: #555; position: relative; flex: none; cursor: pointer; transition: background .2s; margin: 0; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .2s; }
.switch:checked { background: var(--red); }
.switch:checked::after { transform: translateX(18px); }
.set-row input[type=radio] { width: 20px; height: 20px; accent-color: var(--red); flex: none; }
.acc-card { background: var(--panel-2); border-radius: 12px; padding: 14px; }
.acc-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.acc-user { font-weight: 800; font-size: 17px; }
.badge { font-size: 12.5px; font-weight: 700; padding: 4px 10px; border-radius: 999px; background: rgba(255, 255, 255, .08); white-space: nowrap; }
.badge.ok { color: #4cd07d; } .badge.bad { color: #ff6b6b; }
.acc-card .kv { margin-bottom: 12px; }
.acc-btns { display: flex; gap: 8px; }
.acc-btns .btn { flex: 1; text-align: center; text-decoration: none; }
.settings .back { margin-bottom: 8px; font-weight: 700; }
.set-search { width: 100%; box-sizing: border-box; background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font-size: 16px; color: inherit; margin: 6px 0; }
.mc-bulk { text-align: right; margin-bottom: 4px; }
.mc-list { list-style: none; margin: 0; padding: 0; }
.mc-list li { display: flex; align-items: center; gap: 10px; padding: 9px 4px; border-bottom: 1px solid var(--line); }
.mc-list li[hidden] { display: none; }
.mc-name { flex: 1; min-width: 0; display: flex; flex-direction: column; font-weight: 600; font-size: 14.5px; }
.mc-name small { color: var(--muted); font-weight: 400; font-size: 12px; }
.mc-star { background: none; border: 0; padding: 4px; cursor: pointer; color: #666; flex: none; }
.mc-star svg { width: 22px; height: 22px; fill: currentColor; display: block; }
.mc-star.on { color: #ffc93c; }
.sync-note { margin-top: 16px; }
.cat.fav::before { content: "★ "; color: #ffc93c; }
.cat.fav.active::before { color: #fff; }
/* subtitles (closed captions) */
#btn-cc.on { color: #4fc3f7; }
video::cue { background: rgba(0, 0, 0, .8); color: #fff; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; font-size: 1.05em; line-height: 1.35; }
.video-wrap:fullscreen .osd-channel { font-size: 22px; }
.video-wrap:fullscreen .osd-prog { font-size: 17px; }
.spinner { width: 38px; height: 38px; border: 3px solid rgba(255, 255, 255, .25); border-top-color: #fff; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
/* the same loader in other sizes: in lists and panels, inside buttons, and in the middle of the screen */
.spinner.sm { width: 24px; height: 24px; border-width: 3px; flex: none; }
.spinner.xs { display: inline-block; width: 14px; height: 14px; border-width: 2px; vertical-align: -2px; margin-right: 8px; }
.loading-inline { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 18px 12px; color: var(--muted); font-size: 14px; list-style: none; }
.btn.busy, button.busy { opacity: .85; cursor: progress; }
.loader-box { position: fixed; inset: 0; z-index: 80; background: rgba(0, 0, 0, .45); display: flex; align-items: center; justify-content: center; }
.loader-box[hidden] { display: none; }
.loader-card { background: var(--panel); border-radius: 14px; padding: 24px 30px; display: flex; flex-direction: column; align-items: center; gap: 14px; font-weight: 600; box-shadow: 0 10px 40px rgba(0, 0, 0, .5); max-width: 86vw; text-align: center; }
.tvg-loading::before { content: ""; display: inline-block; width: 12px; height: 12px; border: 2px solid rgba(255, 255, 255, .25); border-top-color: #fff; border-radius: 50%; animation: spin .8s linear infinite; margin-right: 6px; vertical-align: -2px; }

.now-panel { background: var(--bg); padding: 10px calc(14px + var(--safe-right)) 12px calc(14px + var(--safe-left)); border-bottom: 1px solid var(--line); max-height: 34vh; overflow-y: auto; }
.now-head { display: flex; align-items: center; gap: 10px; }
.now-head img { width: 48px; height: 32px; object-fit: contain; background: #fff; border-radius: 5px; }
.now-names { flex: 1; min-width: 0; }
.now-channel { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.now-actions { display: flex; flex: none; }
.programme { margin-top: 10px; }
.prog-label { font-size: 11px; font-weight: 800; letter-spacing: .08em; color: var(--red); }
.programme.next .prog-label { color: var(--purple); }
.prog-title { font-weight: 700; margin-top: 2px; }
.progress { height: 4px; background: var(--line); border-radius: 4px; overflow: hidden; margin: 6px 0; }
.progress > div { height: 100%; width: 0; background: var(--red); }
.prog-desc { margin: 6px 0 0; color: #cfcfcf; font-size: 13.5px; white-space: pre-line; }

/* ---------------------------------------------------------------- tablet / desktop: categories | channels | player */
@media (min-width: 900px) {
    .layout { flex-direction: row; }
    .categories { order: 1; flex-direction: column; width: 230px; overflow-y: auto; overflow-x: hidden; border-bottom: 0; border-right: 1px solid var(--line); padding: 12px; gap: 4px; }
    .cat { border-radius: 8px; border: 0; background: transparent; text-align: left; white-space: normal; padding: 9px 12px; }
    .cat:hover { background: var(--panel); }
    .channels-pane { order: 2; width: 380px; flex: none; border-right: 1px solid var(--line); }
    .player-pane { order: 3; flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--bg); overflow-y: auto; }
    .layout:not(.playing) .video-wrap, .layout:not(.playing) .player-pane .now-panel { display: block; }
    /* keep the channel name + NOW programme in view under the video, even on a short laptop screen */
    .video-wrap { flex: none; max-height: calc(100vh - 56px - 190px - var(--safe-top)); min-height: 200px; }
    .video-wrap:fullscreen { max-height: none; }
    .now-panel { max-height: none; border-bottom: 0; padding: 16px 20px; }
    .prog-desc { font-size: 14.5px; }
}
@media (min-width: 900px) and (max-width: 1150px) { .categories { width: 190px; } .channels-pane { width: 320px; } }

/* iPhone landscape: video fills the screen */
@media (max-width: 899px) and (orientation: landscape) and (max-height: 500px) {
    .layout.playing .categories, .layout.playing .channels-pane, .layout.playing .now-panel { display: none; }
    .layout.playing .video-wrap { max-height: none; height: calc(100vh - 56px - var(--safe-top)); aspect-ratio: auto; }
}

/* ---------------------------------------------------------------- sheet (account, guide) + toast */
.sheet { position: fixed; inset: 0; background: rgba(0, 0, 0, .6); display: flex; align-items: flex-end; justify-content: center; z-index: 50; }
.sheet-box { background: var(--panel); width: 100%; max-width: 560px; max-height: 85vh; border-radius: 16px 16px 0 0; display: flex; flex-direction: column; padding-bottom: var(--safe-bottom); }
@media (min-width: 700px) { .sheet { align-items: center; } .sheet-box { border-radius: 16px; } }
.sheet-head { display: flex; align-items: center; padding: 12px 12px 8px 18px; border-bottom: 1px solid var(--line); }
.sheet-head h2 { flex: 1; margin: 0; font-size: 17px; }
.sheet-body { overflow-y: auto; padding: 14px 18px 18px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; margin: 0 0 16px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; text-align: right; font-weight: 600; }
/* ---------------------------------------------------------------- help & support panel */
#btn-support { position: relative; }
#btn-support .dot { position: absolute; top: 8px; right: 8px; width: 8px; height: 8px; border-radius: 50%; background: var(--red); }
.support { position: fixed; inset: 0; z-index: 40; background: rgba(0, 0, 0, .55); display: flex; justify-content: flex-end; }
.support-box { background: var(--bg); width: 100%; height: 100%; display: flex; flex-direction: column; padding: var(--safe-top) var(--safe-right) var(--safe-bottom) var(--safe-left); }
@media (min-width: 700px) { .support-box { width: 440px; border-left: 1px solid var(--line); } }
.support-head { display: flex; align-items: center; gap: 8px; padding: 8px 8px 8px 12px; border-bottom: 1px solid var(--line); flex: none; }
.tabs { flex: 1; display: flex; gap: 6px; background: var(--panel); border-radius: 10px; padding: 3px; }
.tab { flex: 1; border: 0; background: transparent; border-radius: 8px; padding: 8px; font-weight: 600; cursor: pointer; color: var(--muted); }
.tab.active { background: var(--panel-2); color: var(--text); }
.pane { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.pane-bar { display: flex; justify-content: space-between; align-items: center; padding: 8px 14px; font-size: 13px; flex: none; }
.status .on { color: var(--ok); } .status .off { color: #ff6b6b; }
.link { border: 0; background: none; color: var(--purple); cursor: pointer; padding: 0; font-size: inherit; }
.chip { border: 1px solid var(--line); background: var(--panel); border-radius: 999px; padding: 6px 12px; cursor: pointer; font-size: 13px; margin: 3px 4px 3px 0; text-align: left; }
.chip.active { background: var(--red); border-color: var(--red); color: #fff; }
.quick { padding: 0 14px 6px; flex: none; }
.quick:empty { display: none; }
.chips { display: flex; gap: 2px; overflow-x: auto; padding: 8px 12px; flex: none; border-bottom: 1px solid var(--line); scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chips .chip { flex: none; }
.msgs { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 10px 14px; }
.hello { background: var(--panel); border-radius: 12px; padding: 12px; color: #d8d8d8; font-size: 14px; }
.msg { margin-bottom: 12px; max-width: 88%; }
.msg.mine { margin-left: auto; }
.bubble { padding: 9px 12px; border-radius: 14px; background: var(--panel); white-space: pre-wrap; word-break: break-word; font-size: 14.5px; }
.msg.mine .bubble { background: var(--red); color: #fff; border-bottom-right-radius: 4px; }
.msg.bot .bubble { border-bottom-left-radius: 4px; }
.msg .meta { font-size: 11px; color: var(--muted); margin-top: 3px; }
.msg.mine .meta { text-align: right; }
.choices { margin-top: 6px; white-space: normal; }
.watch-list { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; white-space: normal; }
.watch { display: flex; flex-direction: column; align-items: flex-start; text-align: left; border: 1px solid var(--line); background: var(--panel-2); border-radius: 10px; padding: 8px 10px; cursor: pointer; }
.watch span { font-size: 12.5px; color: var(--muted); }
.watch em { font-style: normal; font-size: 12.5px; color: var(--red); font-weight: 700; margin-top: 2px; }
.watch:disabled { opacity: .55; cursor: default; }
.watch:disabled em { color: var(--muted); }
.typing { padding: 0 14px 4px; min-height: 18px; flex: none; }
.composer { display: flex; align-items: flex-end; gap: 8px; padding: 8px 12px 10px; border-top: 1px solid var(--line); flex: none; }
.composer textarea { flex: 1; resize: none; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; font-size: 16px; color: var(--text); max-height: 120px; }
.composer .btn { padding: 10px 14px; }
.attach { cursor: pointer; }
.readonly { padding: 10px 14px; text-align: center; flex: none; }
.replying { display: flex; justify-content: space-between; padding: 6px 14px; background: var(--panel); flex: none; }
.center { text-align: center; }
.older { display: block; margin: 0 auto 12px; }
.post { display: flex; gap: 10px; margin-bottom: 12px; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--panel-2); flex: none; }
.post-body { min-width: 0; flex: 1; }
.post-head { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; font-size: 13.5px; }
.post.mine .post-head b { color: var(--purple); }
.post-text { white-space: pre-wrap; word-break: break-word; font-size: 14px; margin-top: 2px; }
.post-text a, .bubble a, .embed a { color: #8ab4ff; }
.badge { font-size: 9.5px; font-weight: 800; border-radius: 4px; padding: 1px 5px; letter-spacing: .04em; }
.badge.staff { background: var(--ok); color: #062; }
.badge.ai { background: var(--purple); color: #fff; }
.badge.app { background: var(--panel-2); color: var(--muted); }
.quote { font-size: 12.5px; color: var(--muted); border-left: 2px solid var(--line); padding-left: 8px; margin: 3px 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pic { display: block; max-width: 240px; max-height: 240px; border-radius: 8px; margin-top: 6px; }
.file { display: inline-block; margin-top: 4px; }
.embed { border-left: 3px solid var(--purple); background: var(--panel); border-radius: 6px; padding: 8px 10px; margin-top: 6px; font-size: 13px; }

.guide-item { padding: 10px 0; border-bottom: 1px solid var(--line); }
.guide-item.now .g-time { color: var(--red); font-weight: 700; }
.g-time { font-size: 12.5px; color: var(--muted); }
.g-title { font-weight: 700; }
.g-desc { font-size: 13px; color: #cfcfcf; margin-top: 3px; }
.tip { background: var(--panel-2); border-radius: 10px; padding: 12px; font-size: 13.5px; margin-top: 12px; }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(18px + var(--safe-bottom)); background: #333; color: #fff; padding: 10px 16px; border-radius: 10px; z-index: 60; max-width: 90vw; box-shadow: 0 4px 16px rgba(0, 0, 0, .5); }

/* favourites manager, folders, profiles */
.pane-right { display: inline-flex; align-items: baseline; gap: 10px; }
#list-manage { font-weight: 600; }
.cat.sub { font-size: 13px; }
@media (min-width: 900px) { .cat.sub { padding-left: 26px; } }
.fm-new { display: flex; gap: 8px; align-items: center; }
.fm-new .set-search { flex: 1; margin: 0; }
.fm-folders { padding: 8px 0; }
.fm-list { list-style: none; margin: 0; padding: 0; }
.fm-list li { display: flex; align-items: center; gap: 6px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.fm-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fm-name small { display: block; color: var(--muted); font-size: 12px; }
.fm-fold { max-width: 130px; background: var(--panel-2); color: inherit; border: 1px solid var(--line); border-radius: 8px; padding: 5px 6px; font: inherit; font-size: 13px; }
.icon-btn.sm { width: 32px; height: 32px; font-size: 12px; border: 1px solid var(--line); }
.icon-btn.sm:disabled { opacity: .3; cursor: default; }
.btn.sm { padding: 5px 10px; font-size: 13px; width: auto; margin: 0 0 0 6px; }
.prof-btn { width: 32px; height: 32px; margin: 0 4px; background: var(--red); color: #fff; font-weight: 700; font-size: 15px; }
.prof-btn.kids { background: #2bb673; }
.prof-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 12px; padding: 6px 0 4px; }
.prof-tile { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 6px; border: 2px solid transparent; border-radius: 12px; background: var(--panel-2); color: inherit; cursor: pointer; font: inherit; }
.prof-tile.on { border-color: var(--red); }
.prof-tile:hover, .prof-tile:focus { border-color: var(--muted); }
.prof-av { width: 64px; height: 64px; border-radius: 12px; background: var(--red); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 30px; font-weight: 700; }
.prof-tile.kids .prof-av { background: #2bb673; }
.prof-name { font-weight: 600; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prof-kids { display: flex; gap: 8px; align-items: flex-start; margin: 8px 0; font-size: 13px; }
