* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { width: 100%; height: 100%; background: #000; overflow: hidden; }
body { font-family: "Outfit", "Helvetica Neue", Arial, sans-serif; color: #fff; }

:root {
  --accent: #FF2D55;     /* brand pink */
  --accent-2: #FF8A00;   /* brand orange */
  --accent-3: #8E2DE2;   /* brand purple */
  --panel: rgba(16, 16, 22, 0.9);
  --muted: #b0b3bd;
}

#stage {
  position: absolute; left: 0; top: 0;
  width: 1920px; height: 1080px;
  transform-origin: 0 0;
  background: #000;
  overflow: hidden;
}

#player { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #000; }

.hidden { display: none !important; }

kbd {
  display: inline-block; padding: 2px 10px; border-radius: 6px;
  background: rgba(255,255,255,0.15); font-family: inherit; font-size: 0.9em;
}

/* ---------- Tap to start ---------- */
#tap-to-start { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,0.6); }
.tap-box { font-size: 48px; padding: 40px 70px; border-radius: 20px; background: var(--panel); border: 3px solid var(--accent); }

/* ---------- Live banner (bottom third) ---------- */
#banner {
  position: absolute; left: 96px; right: 96px; bottom: 64px;
  display: flex; align-items: center; gap: 48px;
  padding: 36px 48px; border-radius: 24px;
  background: var(--panel);
}
.banner-left { min-width: 300px; }
.live-pill { display: inline-block; background: #E50914; padding: 6px 18px; border-radius: 8px; font-weight: 700; font-size: 26px; }
.banner-channel { margin-top: 16px; font-size: 40px; font-weight: 700; }
.banner-channel .num { color: var(--accent); margin-right: 14px; }
.banner-main { flex: 1; min-width: 0; }
.now-artist { font-size: 34px; color: var(--accent-2); font-weight: 600; }
.now-title { font-size: 52px; font-weight: 800; margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.progress { height: 8px; background: rgba(255,255,255,0.2); border-radius: 4px; margin-top: 20px; overflow: hidden; }
.progress-fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--accent-2), var(--accent)); }
.next-up { margin-top: 16px; font-size: 28px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.banner-hints { font-size: 26px; color: var(--muted); line-height: 1.8; }

/* ---------- Overlays ---------- */
.overlay {
  position: absolute; inset: 0; padding: 72px 96px;
  background: linear-gradient(90deg, rgba(11,11,15,0.97) 0%, rgba(11,11,15,0.9) 60%, rgba(11,11,15,0.7) 100%);
}
.overlay-title { font-size: 56px; margin-bottom: 40px; }

/* Guide */
.guide-list { display: flex; flex-direction: column; gap: 18px; }
.guide-row { display: flex; align-items: stretch; gap: 18px; border-radius: 16px; padding: 10px; border: 4px solid transparent; }
.guide-row.focused { border-color: #fff; background: rgba(255,255,255,0.08); }
.guide-ch { width: 320px; padding: 20px 24px; background: rgba(255,255,255,0.08); border-radius: 12px; }
.guide-ch .num { color: var(--accent); font-size: 30px; font-weight: 700; }
.guide-ch .name { font-size: 34px; font-weight: 700; margin-top: 4px; }
.guide-slots { flex: 1; display: flex; gap: 12px; overflow: hidden; }
.guide-slot { flex: 0 0 340px; padding: 18px 22px; background: rgba(255,255,255,0.05); border-radius: 12px; overflow: hidden; }
.guide-slot.now { background: rgba(255,255,255,0.16); }
.guide-slot .time { font-size: 24px; color: var(--muted); }
.guide-slot.now .time { color: var(--accent); font-weight: 700; }
.guide-slot .t { font-size: 28px; font-weight: 700; margin-top: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.guide-slot .a { font-size: 24px; color: var(--accent-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Browse */
.browse-rows { display: flex; flex-direction: column; gap: 36px; }
.row-title { font-size: 34px; font-weight: 700; margin-bottom: 16px; }
.row-items { display: flex; gap: 28px; transition: transform 0.2s ease; }
.card { flex: 0 0 384px; border-radius: 14px; overflow: hidden; background: #1c1d22; border: 5px solid transparent; }
.card.focused { border-color: #fff; transform: scale(1.05); }
.card-thumb { width: 100%; height: 216px; background-size: cover; background-position: center; display: flex; align-items: center; justify-content: center; font-size: 64px; font-weight: 800; }
.card-meta { padding: 14px 18px; }
.card-t { font-size: 26px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-a { font-size: 22px; color: var(--accent-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .live-pill { font-size: 20px; padding: 4px 12px; }
.row-viewport { overflow: hidden; padding: 12px 0; }

/* VOD bar */
#vod-bar { position: absolute; left: 96px; right: 96px; bottom: 64px; padding: 36px 48px; border-radius: 24px; background: var(--panel); }
.vod-times { display: flex; justify-content: space-between; margin-top: 14px; font-size: 26px; color: var(--muted); }

/* Toast + debug */
#toast { position: absolute; top: 64px; left: 50%; transform: translateX(-50%); padding: 20px 40px; border-radius: 14px; background: var(--panel); font-size: 32px; }
#debug { position: absolute; top: 20px; right: 20px; padding: 12px 20px; background: rgba(200,0,0,0.85); font: 24px monospace; border-radius: 8px; }

/* ---------- Brand ---------- */
.bug { position: absolute; top: 44px; right: 56px; width: 312px; height: 84px; opacity: 0.85; pointer-events: none; }
.banner-emblem { width: 168px; height: 168px; flex: 0 0 168px; margin: -16px -12px -16px -16px; }
.overlay-logo { position: absolute; top: 64px; right: 96px; height: 76px; }
.tap-logo { display: block; height: 110px; margin: 0 auto 28px; }
.tap-box { text-align: center; }
.guide-emblem { width: 92px; height: 92px; float: left; margin: -6px 14px 0 -6px; }
.card-emblem { height: 190px; }
.card-thumb.live { background: #15151c; }
.guide-row.focused, .card.focused { box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6); }
.tap-box { border-color: var(--accent); }

/* Neon look (?brand=neon): round badge in the corner, taller logo */
.theme-neon .bug { width: 160px; height: 160px; top: 40px; right: 56px; opacity: 0.9; }
.theme-neon .overlay-logo { height: 104px; top: 48px; }
.theme-neon .tap-logo { height: 150px; }

/* ---------- Mouse / touch controls (computers & phones) ---------- */
button { font: inherit; }
.topbar { position: absolute; left: 0; right: 0; top: 0; height: 132px; padding: 0 64px; display: none;
  align-items: center; gap: 48px; background: linear-gradient(180deg, rgba(11,11,15,0.92) 0%, rgba(11,11,15,0.55) 65%, rgba(11,11,15,0) 100%); z-index: 20; }
.mouse.ui-active .topbar, .mouse.overlay-open .topbar { display: flex; }
.topbar-logo { height: 58px; cursor: pointer; }
.theme-neon .topbar-logo { height: 78px; }
.topbar-nav { display: flex; gap: 8px; }
.nav-btn { background: none; border: 0; color: #c9c9d1; font-size: 32px; font-weight: 600; padding: 12px 22px; cursor: pointer; border-radius: 10px; }
.nav-btn:hover { color: #fff; background: rgba(255,255,255,0.08); }
.nav-btn.active { color: #fff; font-weight: 800; box-shadow: inset 0 -4px 0 var(--accent); border-radius: 0; }
.topbar-right { margin-left: auto; display: flex; gap: 14px; }
.ui-btn { background: rgba(255,255,255,0.14); border: 0; color: #fff; font-size: 28px; font-weight: 600; padding: 14px 26px; border-radius: 12px; cursor: pointer; }
.ui-btn:hover { background: rgba(255,255,255,0.28); }
.ui-btn.big { font-size: 30px; padding: 14px 34px; background: #fff; color: #0b0b0f; }
.ui-btn.big:hover { background: #e6e6ea; }
.live-btn .dot { color: #E50914; }

/* Banner hint buttons: plain labels on TV, clickable buttons with a mouse */
.hint-row { display: flex; align-items: center; gap: 8px; }
.hint-btn { background: rgba(255,255,255,0.15); border: 0; color: #fff; border-radius: 6px; padding: 0 10px; font-size: 22px; line-height: 36px; cursor: pointer; }
.mouse .hint-btn { padding: 4px 16px; font-size: 26px; }
.mouse .hint-btn:hover { background: var(--accent); }

/* Player controls only with a mouse; keyboard hints only without */
.vod-controls { display: none; align-items: center; gap: 16px; margin-top: 22px; }
.vod-controls .spacer { flex: 1; }
.mouse .vod-controls { display: flex; }
.mouse .vod-hint { display: none; }
.progress.seekable { cursor: pointer; }
.mouse .progress.seekable { height: 14px; border-radius: 7px; }

/* Overlays: room for the top menu, scrolling instead of remote-style paging */
.mouse .overlay { padding-top: 150px; }
.mouse .overlay-logo { display: none; }
.mouse .browse-rows { max-height: 860px; overflow-y: auto; padding-right: 12px; }
.mouse .row-viewport { overflow-x: auto; }
.mouse .row-items { transform: none !important; }
.mouse .card, .mouse .guide-row { cursor: pointer; }
.mouse .card:hover { border-color: rgba(255,255,255,0.7); transform: scale(1.03); }
.mouse .guide-row:hover { border-color: rgba(255,255,255,0.5); }
.mouse.ui-active .bug { opacity: 0; transition: opacity 0.2s; }
.mouse:not(.ui-active):not(.overlay-open) #stage { cursor: none; }
.browse-rows::-webkit-scrollbar, .row-viewport::-webkit-scrollbar { height: 10px; width: 10px; }
.browse-rows::-webkit-scrollbar-thumb, .row-viewport::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.25); border-radius: 5px; }

/* ---------- Timed shows ---------- */
.guide-slot.show { background: linear-gradient(135deg, rgba(255,138,0,0.28), rgba(255,45,85,0.28)); }
.guide-slot.show.now { background: linear-gradient(135deg, rgba(255,138,0,0.5), rgba(255,45,85,0.5)); }
.guide-slot.later { flex-basis: 300px; opacity: 0.85; border: 2px dashed rgba(255,255,255,0.3); background: transparent; }
#banner.in-show .now-artist { color: var(--accent); font-weight: 700; }

/* Corner badge: base + "● LIVE" layer on top, pulsing like a heartbeat (lub-dub, rest). */
.bug img { position: absolute; inset: 0; width: 100%; height: 100%; }
.bug-live { animation: heartbeat 2s ease-in-out infinite; }
.bug-live:not([src]) { display: none; }
@keyframes heartbeat {
  0%   { opacity: 1; }
  10%  { opacity: 0.15; }
  20%  { opacity: 1; }
  32%  { opacity: 0.15; }
  44%  { opacity: 1; }
  100% { opacity: 1; }
}

/* Off air: channel data couldn't be loaded */
#off-air { position: absolute; inset: 0; background: var(--bg, #0b0b0f); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 24px; z-index: 50; }
#off-air.hidden { display: none; }
.off-air-logo { width: 420px; height: auto; }
.off-air-title { font-size: 64px; font-weight: 800; }
.off-air-text { font-size: 32px; color: var(--muted); }

/* ===================== Phone layout (js/phone.js) ===================== */
body.phone { overflow: visible; height: auto; min-height: 100%; background: #0b0b0f; -webkit-text-size-adjust: 100%; }
html:has(body.phone) { overflow: auto; height: auto; background: #0b0b0f; }
.phone #phone { max-width: 720px; margin: 0 auto; padding-bottom: calc(24px + env(safe-area-inset-bottom)); }
.phone .ph-top { position: sticky; top: 0; z-index: 10; background: #0b0b0f; padding-top: env(safe-area-inset-top); }
.phone .ph-head { display: flex; align-items: center; height: 48px; padding: 0 16px; }
.phone .ph-logo { height: 26px; }
.phone .ph-player { position: relative; width: 100%; aspect-ratio: 16 / 9; background: #000; overflow: hidden; }
.phone #stage { position: absolute; inset: 0; width: 100%; height: 100%; transform: none !important; }
/* TV-only parts */
.phone #banner, .phone #guide, .phone #browse, .phone #vod-bar, .phone #topbar, .phone #debug { display: none !important; }
/* Corner badge, scaled down */
.phone .bug { top: 8px; right: 8px; width: 104px; height: 28px; opacity: 0.9; }
.phone.theme-neon .bug { width: 52px; height: 52px; }
.phone #toast { top: 12px; font-size: 14px; padding: 8px 14px; border-radius: 10px; white-space: nowrap; }
.phone .tap-box { font-size: 16px; padding: 14px 20px; border-width: 2px; border-radius: 12px; }
.phone .tap-logo { height: 30px !important; }
.phone #off-air { gap: 8px; padding: 16px; text-align: center; }
.phone .off-air-logo { width: 160px; }
.phone .off-air-title { font-size: 22px; }
.phone .off-air-text { font-size: 13px; }

/* Player controls: appear on tap, hide after a few seconds */
.ph-controls { position: absolute; left: 0; right: 0; bottom: 0; display: flex; gap: 8px; padding: 28px 10px 10px;
  background: linear-gradient(0deg, rgba(0,0,0,0.75), rgba(0,0,0,0)); opacity: 0; pointer-events: none; transition: opacity 0.2s; z-index: 5; }
#phone.ctl .ph-controls { opacity: 1; pointer-events: auto; }
.ph-spacer { flex: 1; }
.ph-btn { background: rgba(255,255,255,0.18); color: #fff; border: 0; border-radius: 10px; font-size: 15px; font-weight: 700; min-width: 44px; height: 38px; padding: 0 12px; }
.ph-unmute { position: absolute; left: 10px; top: 10px; z-index: 6; background: #fff; color: #0b0b0f; border: 0; border-radius: 999px; font-size: 14px; font-weight: 700; padding: 8px 14px; box-shadow: 0 4px 16px rgba(0,0,0,0.5); }
/* With the system's own controls (on demand), leave room for them */
.phone video[controls] ~ .bug { display: none; }

/* Now playing */
.ph-now { padding: 14px 16px 6px; }
.ph-row { display: flex; align-items: center; gap: 10px; }
.ph-emblem { width: 44px; height: 44px; border-radius: 10px; flex: none; }
.ph-ch { font-size: 14px; font-weight: 700; color: #d9d9e0; }
.ph-live { color: #ff3b47; font-size: 12px; font-weight: 800; letter-spacing: 0.04em; }
.ph-chip { display: inline-block; font-size: 11px; font-weight: 800; letter-spacing: 0.04em; padding: 2px 8px; border-radius: 6px; background: rgba(255,255,255,0.14); }
.ph-chip.show { background: linear-gradient(90deg, var(--accent-2), var(--accent)); }
.ph-title { font-size: 21px; font-weight: 800; margin-top: 10px; line-height: 1.2; }
.ph-artist { font-size: 15px; color: var(--accent-2); font-weight: 600; }
.ph-progress { height: 4px; background: rgba(255,255,255,0.15); border-radius: 2px; margin-top: 10px; overflow: hidden; }
.ph-progress i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent-2), var(--accent)); }
.ph-next { font-size: 13px; color: var(--muted); margin-top: 8px; }
.ph-live-btn { margin-top: 12px; width: 100%; height: 44px; border: 0; border-radius: 12px; background: #fff; color: #0b0b0f; font-size: 16px; font-weight: 800; }
.ph-live-btn .dot { color: #E50914; }

/* Tabs */
.ph-tabs { display: flex; gap: 6px; padding: 10px 16px; position: sticky; top: calc(48px + 56.25vw + env(safe-area-inset-top)); z-index: 9; background: #0b0b0f; }
@media (min-width: 720px) { .ph-tabs { top: calc(48px + 405px + env(safe-area-inset-top)); } }
.ph-tabs button { flex: 1; height: 40px; border-radius: 10px; border: 0; background: rgba(255,255,255,0.08); color: #c9c9d1; font-size: 15px; font-weight: 700; }
.ph-tabs button.active { background: #fff; color: #0b0b0f; }

/* Lists */
.ph-list { padding: 4px 16px; display: flex; flex-direction: column; gap: 8px; }
.ph-chan, .ph-vid { display: flex; gap: 12px; align-items: center; width: 100%; text-align: left; color: #fff; background: rgba(255,255,255,0.05);
  border: 2px solid transparent; border-radius: 14px; padding: 10px; font: inherit; }
.ph-chan.on, .ph-vid.on { border-color: var(--accent); background: rgba(255,45,85,0.1); }
.ph-chan-text, .ph-vid-text { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 2px; }
.ph-chan-now { font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ph-chan-next { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ph-chips { display: flex; gap: 6px; overflow-x: auto; padding: 2px 0 6px; scrollbar-width: none; }
.ph-chips::-webkit-scrollbar { display: none; }
.ph-gchip { flex: none; border: 0; border-radius: 999px; padding: 7px 14px; background: rgba(255,255,255,0.1); color: #fff; font-size: 14px; font-weight: 600; }
.ph-gchip.on { background: linear-gradient(90deg, var(--accent-2), var(--accent)); }
.ph-thumb { position: relative; flex: none; width: 128px; aspect-ratio: 16 / 9; border-radius: 10px; background: linear-gradient(135deg,#FF8A00,#FF2D55,#8E2DE2) center / cover; }
.ph-dur { position: absolute; right: 4px; bottom: 4px; font-size: 11px; font-weight: 700; background: rgba(0,0,0,0.75); border-radius: 4px; padding: 1px 5px; }
.ph-vid-title { font-size: 15px; font-weight: 700; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ph-empty { color: var(--muted); padding: 20px 0; text-align: center; }
.phone button { -webkit-tap-highlight-color: transparent; cursor: pointer; }

/* Turned sideways: full-screen TV */
@media (orientation: landscape) and (max-height: 600px) {
  .phone .ph-head, .phone .ph-now, .phone .ph-tabs, .phone .ph-list { display: none; }
  .phone #phone { max-width: none; padding: 0; }
  .phone .ph-top { position: fixed; inset: 0; padding: 0; background: #000; }
  .phone .ph-player { height: 100vh; height: 100dvh; aspect-ratio: auto; }
  .phone .bug { top: 14px; right: calc(14px + env(safe-area-inset-right)); width: 150px; height: 40px; }
}
/* Full screen (Android) */
.ph-player:fullscreen { aspect-ratio: auto; width: 100vw; height: 100vh; }

/* Computers: muted start because the browser blocked sound */
.unmute-btn { position: absolute; left: 64px; top: 64px; z-index: 30; background: #fff; color: #0b0b0f; border: 0; border-radius: 999px;
  font-size: 34px; font-weight: 800; padding: 18px 34px; cursor: pointer; box-shadow: 0 8px 30px rgba(0,0,0,0.5); }
.mouse.ui-active .unmute-btn { top: 160px; }
.phone .unmute-btn { display: none; }
/* Phone: "● LIVE" pulses like the TV badge's heartbeat */
.ph-now .ph-live { display: inline-block; animation: heartbeat 2s ease-in-out infinite; }
