:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --bg: #07080b;
  --panel: #11131a;
  --panel-2: #171a22;
  --text: #f7f7f8;
  --muted: #9aa0aa;
  --line: rgba(255,255,255,.08);
  --accent: #ff355e;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); }
body { min-height: 100vh; overflow-x: hidden; }
button, input { font: inherit; }
button { color: inherit; }

.app { min-height: 100vh; }
.home-view {
  min-height: 100vh;
  padding: 28px clamp(22px, 4vw, 68px) 52px;
  background:
    radial-gradient(circle at 84% 3%, rgba(255,53,94,.16), transparent 28%),
    radial-gradient(circle at 8% 0%, rgba(83,94,255,.13), transparent 30%),
    var(--bg);
}

.topbar { display: flex; justify-content: space-between; align-items: center; gap: 20px; }
.brand { display: inline-flex; align-items: center; gap: 11px; }
.brand-mark {
  width: 42px; height: 42px; display: grid; place-items: center;
  border-radius: 12px; font-weight: 900; font-size: 20px;
  background: linear-gradient(135deg, #ff355e, #ff8a3d);
  box-shadow: 0 9px 28px rgba(255,53,94,.26);
}
.brand-name { font-size: 22px; font-weight: 850; letter-spacing: -.4px; }
.live-pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 13px; border: 1px solid var(--line); border-radius: 999px;
  background: rgba(255,255,255,.035); color: #d7d9df; font-size: 13px; font-weight: 700;
}
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 5px rgba(255,53,94,.11); }

.hero { margin: clamp(55px, 8vh, 98px) 0 34px; }
.eyebrow { margin: 0 0 10px; color: var(--accent); font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: 1.8px; }
.hero h1 { margin: 0; font-size: clamp(38px, 6vw, 76px); line-height: .98; letter-spacing: -3px; }
.hero-sub { margin: 18px 0 0; color: var(--muted); font-size: clamp(15px, 2vw, 18px); }

.channel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr));
  gap: 18px;
}
.channel-card {
  position: relative;
  min-height: 178px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: linear-gradient(160deg, rgba(255,255,255,.055), rgba(255,255,255,.018));
  overflow: hidden;
  cursor: pointer;
  text-align: left;
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
  outline: none;
}
.channel-card::after {
  content: ""; position: absolute; inset: auto -20% -70% 25%; height: 150px;
  background: radial-gradient(circle, var(--card-glow, rgba(255,255,255,.12)), transparent 65%);
  pointer-events: none;
}
.channel-card:hover, .channel-card:focus-visible {
  transform: translateY(-4px) scale(1.01);
  border-color: rgba(255,255,255,.24);
  box-shadow: 0 22px 60px rgba(0,0,0,.32);
}
.channel-inner { min-height: 178px; display: flex; flex-direction: column; justify-content: space-between; padding: 24px; }
.logo-box { height: 72px; display: flex; align-items: center; }
.channel-logo { max-width: 150px; max-height: 64px; object-fit: contain; filter: drop-shadow(0 4px 12px rgba(0,0,0,.18)); }
.logo-fallback { display: none; font-size: 30px; font-weight: 900; letter-spacing: -1px; }
.channel-meta { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.channel-name { font-size: 16px; font-weight: 780; }
.watch-label { color: #aeb3bd; font-size: 12px; font-weight: 750; }

.player-view { position: fixed; inset: 0; background: #000; display: none; overflow: hidden; }
.player-view.active { display: block; }
.video { width: 100%; height: 100%; object-fit: contain; background: #000; }
.loading { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 15px; background: rgba(0,0,0,.72); color: #d8dbe0; font-size: 14px; transition: opacity .2s ease; }
.loading.hidden { opacity: 0; pointer-events: none; }
.spinner { width: 35px; height: 35px; border: 3px solid rgba(255,255,255,.16); border-top-color: #fff; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.controls { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: space-between; padding: max(24px, env(safe-area-inset-top)) max(24px, env(safe-area-inset-right)) max(26px, env(safe-area-inset-bottom)) max(24px, env(safe-area-inset-left)); background: linear-gradient(to bottom, rgba(0,0,0,.68), transparent 25%, transparent 69%, rgba(0,0,0,.72)); opacity: 0; pointer-events: none; transition: opacity .23s ease; }
.controls.is-visible { opacity: 1; pointer-events: auto; }
.controls-top { display: flex; align-items: center; gap: 14px; }
.now-playing { display: flex; flex-direction: column; gap: 2px; }
.now-label { font-size: 10px; color: rgba(255,255,255,.62); letter-spacing: 1.3px; font-weight: 850; }
.now-playing strong { font-size: 17px; }
.icon-btn { width: 48px; height: 48px; display: grid; place-items: center; border: 1px solid rgba(255,255,255,.15); border-radius: 50%; background: rgba(12,12,14,.56); backdrop-filter: blur(12px); cursor: pointer; transition: transform .15s ease, background .15s ease; }
.icon-btn:hover, .icon-btn:focus-visible { transform: scale(1.06); background: rgba(32,32,36,.8); outline: none; }
.icon-btn.small { width: 42px; height: 42px; }
.icon-btn svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn.small svg path:first-child { fill: currentColor; stroke: none; }
.controls-bottom { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; }
.volume-wrap { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid rgba(255,255,255,.13); border-radius: 999px; background: rgba(12,12,14,.56); backdrop-filter: blur(12px); }
.volume { width: min(30vw, 210px); accent-color: #fff; cursor: pointer; }
.volume-value { min-width: 44px; color: rgba(255,255,255,.72); font-size: 12px; font-variant-numeric: tabular-nums; }

.fullscreen-btn { flex: 0 0 auto; }
.fullscreen-exit-icon { display: none; }
.fullscreen-btn.is-fullscreen .fullscreen-enter-icon { display: none; }
.fullscreen-btn.is-fullscreen .fullscreen-exit-icon { display: block; }
.player-view:fullscreen, .player-view:-webkit-full-screen { width: 100vw; height: 100vh; background: #000; }

.error-panel { position: absolute; inset: 0; display: grid; place-items: center; padding: 24px; background: rgba(0,0,0,.86); }
.error-panel[hidden] { display: none !important; }
.error-card { width: min(100%, 420px); padding: 26px; border-radius: 22px; border: 1px solid rgba(255,255,255,.11); background: #111318; text-align: center; box-shadow: 0 20px 70px rgba(0,0,0,.45); }
.error-card strong { display: block; font-size: 20px; margin-bottom: 9px; }
.error-card p { margin: 0; color: #aeb3bd; line-height: 1.5; }
.retry-btn { margin-top: 20px; border: 0; border-radius: 12px; padding: 12px 16px; background: #fff; color: #0b0c0f; font-weight: 800; cursor: pointer; }

@media (max-width: 640px) {
  .home-view { padding: 20px 16px 34px; }
  .live-pill { font-size: 11px; padding: 8px 10px; }
  .hero { margin-top: 56px; }
  .hero h1 { letter-spacing: -2px; }
  .channel-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .channel-card, .channel-inner { min-height: 145px; }
  .channel-inner { padding: 17px; }
  .logo-box { height: 58px; }
  .channel-logo { max-width: 115px; max-height: 52px; }
  .channel-name { font-size: 14px; }
  .watch-label { display: none; }
  .volume { width: 120px; }
}
