/* ==========================================================================
   Website live-TV player — dark, video first.
   Phone: player sticks to the top, the channel guide scrolls under it.
   Desktop (≥ 1024px): player + now-playing on the left (sticky), guide on the right.
   ========================================================================== */
:root {
    --bg: #06080f;
    --bg-2: #0b0f1a;
    --card: #111827;
    --card-2: #161f33;
    --line: rgba(148, 163, 184, 0.14);
    --line-2: rgba(148, 163, 184, 0.24);
    --text: #f1f5f9;
    --muted: #94a3b8;
    --accent: #3b82f6;
    --accent-2: #8b5cf6;
    --grad: linear-gradient(135deg, #2563eb, #7c3aed);
    --live: #ef4444;
    --gold: #fbbf24;
    --radius: 16px;
    --top-h: 64px;
    --font: 'Inter', 'Hind Siliguri', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --safe-b: env(safe-area-inset-bottom, 0px);
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0; min-height: 100vh; min-height: 100dvh; background: var(--bg); color: var(--text);
    font-family: var(--font); font-size: 14px; line-height: 1.45; -webkit-font-smoothing: antialiased;
    background-image: radial-gradient(1200px 600px at 10% -10%, rgba(37, 99, 235, 0.16), transparent 60%),
                      radial-gradient(900px 500px at 100% 0%, rgba(124, 58, 237, 0.12), transparent 60%);
    background-attachment: fixed;
}
html[data-locale="bn"] body { font-family: 'Hind Siliguri', 'Inter', system-ui, sans-serif; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
img { display: block; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Top bar ---------- */
.topbar {
    height: var(--top-h); display: flex; align-items: center; gap: 14px; padding: 0 clamp(12px, 2.4vw, 28px);
    position: relative; z-index: 30;
}
.brand { flex-shrink: 0; }
.brand img { height: 34px; width: auto; }
.search {
    flex: 1; min-width: 0; max-width: 520px; margin: 0 auto; display: flex; align-items: center; gap: 10px; height: 42px; padding: 0 12px 0 14px;
    border-radius: 12px; background: rgba(255, 255, 255, 0.05); border: 1px solid var(--line); color: var(--muted);
    transition: border-color .2s, background .2s;
}
.search:focus-within { border-color: var(--accent); background: rgba(59, 130, 246, 0.08); }
.search input { flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: transparent; font-size: 14px; color: var(--text); }
.search input::placeholder { color: var(--muted); }
.search input::-webkit-search-cancel-button { filter: invert(0.7); }
.kbd { font: 600 11px/1 var(--font); padding: 3px 6px; border-radius: 6px; border: 1px solid var(--line-2); color: var(--muted); }
.top-actions { display: flex; gap: 8px; flex-shrink: 0; }
.pill-btn {
    display: inline-flex; align-items: center; gap: 7px; height: 38px; padding: 0 14px; border-radius: 999px; white-space: nowrap;
    border: 1px solid var(--line-2); background: rgba(255, 255, 255, 0.04); color: var(--text); text-decoration: none; font-weight: 600; font-size: 13px;
    transition: background .2s, border-color .2s, transform .2s;
}
.pill-btn:hover { background: rgba(255, 255, 255, 0.09); }
.pill-btn.accent { background: var(--grad); border-color: transparent; box-shadow: 0 8px 24px rgba(37, 99, 235, 0.35); }
.pill-btn.accent:hover { transform: translateY(-1px); }

/* ---------- Notice ticker ---------- */
.ticker {
    display: flex; align-items: center; gap: 10px; margin: 0 clamp(12px, 2.4vw, 28px) 12px; padding: 0 14px; height: 36px;
    border-radius: 10px; background: rgba(251, 191, 36, 0.08); border: 1px solid rgba(251, 191, 36, 0.2); color: #fde68a; overflow: hidden;
}
.ticker > i { flex-shrink: 0; color: var(--gold); }
.ticker-track { overflow: hidden; flex: 1; mask-image: linear-gradient(90deg, transparent, #000 4%, #000 96%, transparent); }
.ticker-move { display: inline-flex; gap: 64px; white-space: nowrap; padding-left: 100%; animation: ticker 38s linear infinite; font-size: 13px; }
.ticker:hover .ticker-move { animation-play-state: paused; }
@keyframes ticker { to { transform: translateX(-100%); } }

/* ---------- Layout ---------- */
.layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0; }
.stage { position: sticky; top: 0; z-index: 20; background: var(--bg); }
.footer { padding: 18px clamp(12px, 2.4vw, 28px) calc(18px + var(--safe-b)); color: var(--muted); font-size: 12px; text-align: center; }

/* ---------- Player ---------- */
.player {
    position: relative; width: 100%; aspect-ratio: 16 / 9; background: #000; overflow: hidden; outline: none;
    user-select: none; -webkit-user-select: none; touch-action: pan-y;
}
.player video#video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #000; }
.player:fullscreen, .player:-webkit-full-screen { aspect-ratio: auto; width: 100vw; height: 100vh; border-radius: 0 !important; }
.layer { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
.poster { flex-direction: column; gap: 14px; background: radial-gradient(circle at 50% 40%, #172036, #05070c 70%); color: var(--muted); text-align: center; padding: 20px; }
.poster-logo { width: clamp(84px, 16vw, 140px); aspect-ratio: 1; border-radius: 22px; background: rgba(255, 255, 255, 0.95); display: flex; align-items: center; justify-content: center; padding: 12px; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6); }
.poster-logo img { max-width: 100%; max-height: 100%; object-fit: contain; }
.poster-logo:has(img:not([src])), .poster-logo:has(img[src=""]) { display: none; }
.poster p { margin: 0; font-weight: 600; font-size: clamp(13px, 1.4vw, 16px); }
.spinner { pointer-events: none; }
.ring { width: 54px; height: 54px; border-radius: 50%; border: 4px solid rgba(255, 255, 255, 0.15); border-top-color: #fff; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.nosignal { background: #000; }
.nosignal video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: .55; }
.nosignal-box { position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 18px 26px; border-radius: 16px; background: rgba(0, 0, 0, 0.6); backdrop-filter: blur(6px); text-align: center; max-width: 86%; }
.nosignal-box i { font-size: 24px; color: var(--live); }
.nosignal-box.info i { color: var(--gold); }
.nosignal-box strong { font-size: clamp(15px, 2vw, 20px); letter-spacing: .02em; }
.nosignal-box span { color: #cbd5e1; font-size: 13px; }
.ghost-btn { margin-top: 6px; display: inline-flex; gap: 7px; align-items: center; padding: 7px 14px; border-radius: 999px; border: 1px solid rgba(255, 255, 255, 0.3); background: rgba(255, 255, 255, 0.08); font-weight: 600; font-size: 13px; }
.ghost-btn:hover { background: rgba(255, 255, 255, 0.16); }

.unmute { position: absolute; bottom: 72px; left: 50%; translate: -50% 0; z-index: 6; display: inline-flex; align-items: center; gap: 8px; padding: 9px 14px; border-radius: 999px; border: 0; background: rgba(255, 255, 255, 0.95); color: #0f172a; font-weight: 700; font-size: 13px; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4); animation: pop .3s ease-out; }
@keyframes pop { from { transform: scale(.9); opacity: 0; } }
@media (max-width: 640px) { .unmute { bottom: 58px; padding: 7px 12px; font-size: 12px; } }
.osd { position: absolute; top: 14px; right: 14px; z-index: 6; padding: 8px 14px; border-radius: 12px; background: rgba(0, 0, 0, 0.7); backdrop-filter: blur(6px); font-weight: 700; font-size: clamp(14px, 2vw, 22px); opacity: 0; transform: translateY(-6px); transition: opacity .2s, transform .2s; pointer-events: none; max-width: 70%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.osd.show { opacity: 1; transform: none; }
.osd b { color: var(--accent); margin-right: 8px; font-variant-numeric: tabular-nums; }
.big-play { position: absolute; z-index: 5; left: 50%; top: 50%; width: 72px; height: 72px; margin: -36px 0 0 -36px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, 0.92); color: #0f172a; font-size: 26px; box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5); }
.big-play i { margin-left: 4px; }

/* Controls */
.controls {
    position: absolute; inset: 0; z-index: 4; display: flex; flex-direction: column; justify-content: space-between; pointer-events: none;
    opacity: 1; transition: opacity .25s;
}
.player.idle .controls { opacity: 0; }
.player.idle { cursor: none; }
.ctrl-top, .ctrl-bar { pointer-events: auto; display: flex; align-items: center; gap: 6px; padding: 12px 14px; }
.ctrl-top { background: linear-gradient(rgba(0, 0, 0, 0.65), transparent); gap: 10px; }
.ctrl-bar { background: linear-gradient(transparent, rgba(0, 0, 0, 0.8)); padding-top: 28px; }
.ctrl-title { font-weight: 700; font-size: 14px; text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.live-badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 9px; border-radius: 6px; background: var(--live); font-size: 11px; font-weight: 800; letter-spacing: .06em; cursor: pointer; flex-shrink: 0; }
.live-badge.behind { background: rgba(255, 255, 255, 0.2); }
.live-badge .dot { width: 7px; height: 7px; border-radius: 50%; background: #fff; animation: blink 1.4s infinite; }
@keyframes blink { 50% { opacity: .3; } }
.cbtn { width: 40px; height: 40px; border-radius: 10px; border: 0; background: transparent; color: #fff; font-size: 16px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; transition: background .15s; flex-shrink: 0; }
.cbtn:hover { background: rgba(255, 255, 255, 0.14); }
.cbtn.text { width: auto; padding: 0 12px; font-size: 13px; font-weight: 600; }
.spacer { flex: 1; }
.vol { display: flex; align-items: center; }
.vol input { width: 0; opacity: 0; transition: width .2s, opacity .2s; accent-color: #fff; }
.vol:hover input, .vol:focus-within input { width: 90px; opacity: 1; margin: 0 6px; }
.quality { position: relative; }
.menu { position: absolute; right: 0; bottom: 46px; min-width: 150px; padding: 6px; border-radius: 12px; background: rgba(15, 23, 42, 0.96); border: 1px solid var(--line-2); box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5); }
.menu button { display: flex; width: 100%; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 10px; border: 0; border-radius: 8px; background: transparent; font-size: 13px; font-weight: 600; text-align: left; }
.menu button:hover { background: rgba(255, 255, 255, 0.08); }
.menu button.on { color: var(--accent); }
.menu button.on::after { content: "\f00c"; font: 900 12px "Font Awesome 6 Free"; }

/* ---------- Now playing ---------- */
.now { display: flex; align-items: center; gap: 12px; padding: 12px clamp(12px, 2.4vw, 0px); border-bottom: 1px solid var(--line); background: var(--bg); }
.now-logo { width: 52px; height: 52px; flex-shrink: 0; border-radius: 12px; background: #fff; padding: 5px; display: flex; align-items: center; justify-content: center; }
.now-logo img { max-width: 100%; max-height: 100%; object-fit: contain; }
.now-logo:has(img:not([src])) { background: var(--card-2); }
.now-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.now-label { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 700; color: var(--live); text-transform: uppercase; letter-spacing: .06em; }
.now h1 { margin: 1px 0 0; font-size: clamp(16px, 2.2vw, 22px); font-weight: 800; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.now-cat { color: var(--muted); font-size: 12.5px; font-weight: 500; }
.now-cat:empty { display: none; }
.now-actions { display: flex; gap: 6px; }
.round-btn { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line-2); background: rgba(255, 255, 255, 0.04); display: inline-flex; align-items: center; justify-content: center; transition: background .15s, color .15s, border-color .15s; }
.round-btn:hover { background: rgba(255, 255, 255, 0.1); }
.round-btn.fav[aria-pressed="true"] { color: var(--gold); border-color: rgba(251, 191, 36, 0.5); background: rgba(251, 191, 36, 0.1); }
.eq { display: inline-flex; align-items: flex-end; gap: 2px; height: 10px; }
.eq i { width: 2px; background: currentColor; border-radius: 1px; animation: eq 0.9s ease-in-out infinite; }
.eq i:nth-child(2) { animation-delay: -.3s; } .eq i:nth-child(3) { animation-delay: -.6s; }
@keyframes eq { 0%, 100% { height: 3px; } 50% { height: 10px; } }
.paused .eq i { animation: none; height: 4px; }
.hint { display: none; margin: 10px 0 0; color: var(--muted); font-size: 12px; }

/* ---------- Guide ---------- */
.guide { padding: 0 clamp(12px, 2.4vw, 28px) 10px; min-width: 0; }
.guide-head { position: sticky; z-index: 10; background: var(--bg); padding: 12px 0 10px; }
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; scroll-snap-type: x proximity; padding-bottom: 2px; }
.chips::-webkit-scrollbar { display: none; }
.chip {
    flex-shrink: 0; scroll-snap-align: start; display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 14px; border-radius: 999px;
    border: 1px solid var(--line-2); background: rgba(255, 255, 255, 0.03); color: #cbd5e1; font-weight: 600; font-size: 13px; transition: all .15s;
}
.chip:hover { border-color: rgba(255, 255, 255, 0.4); color: #fff; }
.chip.active { background: #fff; border-color: #fff; color: #0b1220; }
.chip .fa-star { color: var(--gold); }
.chip.active .fa-star { color: #d97706; }
.guide-count { margin-top: 10px; color: var(--muted); font-size: 12px; font-weight: 600; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; }
.card {
    position: relative; display: flex; flex-direction: column; gap: 7px; padding: 8px; border-radius: 14px; border: 1px solid var(--line);
    background: var(--card); text-align: left; transition: transform .15s, border-color .15s, background .15s; min-width: 0;
    content-visibility: auto; contain-intrinsic-size: 120px 130px;
}
.card:hover { transform: translateY(-2px); border-color: var(--line-2); background: var(--card-2); }
.card .logo { aspect-ratio: 16 / 11; border-radius: 10px; background: #fff; display: flex; align-items: center; justify-content: center; padding: 8px; overflow: hidden; }
.card .logo img { max-width: 100%; max-height: 100%; object-fit: contain; }
.card .logo.none { background: var(--card-2); color: var(--muted); font-size: 22px; }
.card .name { font-size: 12.5px; font-weight: 600; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.5em; }
.card .no { position: absolute; top: 12px; left: 12px; padding: 1px 6px; border-radius: 6px; background: rgba(15, 23, 42, 0.78); color: #fff; font-size: 10.5px; font-weight: 700; font-variant-numeric: tabular-nums; }
.card .pro { position: absolute; top: 12px; right: 12px; padding: 1px 6px; border-radius: 6px; background: var(--gold); color: #3b2500; font-size: 10px; font-weight: 800; }
.card .star { position: absolute; top: 12px; right: 12px; color: var(--gold); font-size: 12px; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.6)); }
.card .pro + .star { right: 46px; }
.card.playing { border-color: var(--accent); background: linear-gradient(180deg, rgba(59, 130, 246, 0.18), rgba(59, 130, 246, 0.04)); box-shadow: 0 0 0 1px var(--accent) inset; }
.card.playing .name { color: #bfdbfe; }
.card.playing::after { content: ""; position: absolute; left: 50%; bottom: -1px; width: 34%; height: 3px; transform: translateX(-50%); border-radius: 3px 3px 0 0; background: var(--grad); }
.empty { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 48px 16px; color: var(--muted); text-align: center; }
.empty i { font-size: 28px; opacity: .6; }

/* ---------- Phones ---------- */
@media (max-width: 1023px) {
    .stage { margin: 0; }
    .now { padding: 10px 12px; }
    .now-actions .round-btn:not(.fav) { display: none; }
    .guide-head { top: var(--stage-h, 0px); }
}
@media (max-width: 640px) {
    :root { --top-h: 56px; }
    .topbar { gap: 8px; }
    .top-actions { gap: 6px; }
    .brand img { height: 28px; }
    .search { height: 38px; }
    .kbd, .pill-btn span { display: none; }
    .pill-btn { width: 38px; padding: 0; justify-content: center; }
    .ticker { margin-bottom: 10px; height: 32px; }
    .grid { grid-template-columns: repeat(auto-fill, minmax(82px, 1fr)); gap: 8px; }
    .card { padding: 6px; border-radius: 12px; gap: 5px; }
    .card .name { font-size: 11.5px; }
    .card .no, .card .pro, .card .star { top: 9px; }
    .card .no { left: 9px; } .card .pro, .card .star { right: 9px; }
    .cbtn { width: 36px; height: 36px; font-size: 15px; }
    .vol input, #btnPrev, #btnNext { display: none; }
    .ctrl-top, .ctrl-bar { padding: 8px 10px; }
    .ctrl-bar { padding-top: 22px; }
    .now-logo { width: 44px; height: 44px; }
}
/* Landscape phone: full-height video */
@media (max-width: 1023px) and (orientation: landscape) and (max-height: 500px) {
    .topbar, .ticker { display: none; }
    .player { aspect-ratio: auto; height: 100vh; height: 100dvh; }
    .stage { position: relative; }
}

/* ---------- Desktop ---------- */
@media (min-width: 1024px) {
    .layout { grid-template-columns: minmax(0, 1fr) 380px; gap: 22px; padding: 0 clamp(16px, 2.4vw, 28px); align-items: start; }
    .stage { top: 12px; background: transparent; }
    .player { border-radius: var(--radius); box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55); }
    .now { padding: 16px 4px 14px; background: transparent; }
    .hint { display: block; }
    .guide {
        position: sticky; top: 12px; height: calc(100vh - 24px); display: flex; flex-direction: column; padding: 0;
        border-radius: var(--radius); border: 1px solid var(--line); background: rgba(11, 15, 26, 0.75); backdrop-filter: blur(10px); overflow: hidden;
    }
    .has-ticker .guide { height: calc(100vh - 24px); }
    .guide-head { position: static; padding: 14px 14px 10px; background: transparent; border-bottom: 1px solid var(--line); }
    .chips { flex-wrap: wrap; overflow: visible; }
    .grid { flex: 1; overflow-y: auto; padding: 12px 14px 16px; align-content: start; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); scrollbar-width: thin; scrollbar-color: #334155 transparent; }
    .empty { flex: 1; }
}
@media (min-width: 1500px) {
    .layout { grid-template-columns: minmax(0, 1fr) 460px; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition: none !important; }
}
