:root {
  --bg: #0A0E17;
  --panel: #131A2B;
  --panel-2: #1A2338;
  --border: #232C42;
  --text: #ECEFF6;
  --muted: #8993AB;
  --brand: #2F6FED;
  --brand-dim: #1C3F8F;
  --live: #E63950;
  --live-dim: #7A1E2A;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, sans-serif;
  min-height: 100vh;
}

.hidden { display: none !important; }

/* ---- Topbar ---- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 10;
}

.logo {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 26px;
  letter-spacing: 0.04em;
  margin: 0;
  color: var(--text);
}
.logo span { color: var(--brand); }

.pill {
  font-size: 11px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.pill.on { border-color: var(--brand); color: var(--brand); }

/* ---- Auth ---- */
.auth-view {
  display: flex;
  justify-content: center;
  padding: 60px 24px;
}
.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 28px;
}
.auth-card h2 {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 22px;
  letter-spacing: 0.03em;
  margin: 0 0 20px;
  color: var(--muted);
}
form { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }
input {
  background: #0E1424;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  color: var(--text);
  font-size: 14px;
  font-family: 'Inter', sans-serif;
}
button {
  background: var(--brand);
  border: none;
  border-radius: 8px;
  padding: 12px 16px;
  color: white;
  font-weight: 600;
  cursor: pointer;
  font-size: 14px;
  font-family: 'Inter', sans-serif;
}
button:hover { background: var(--brand-dim); }
button.secondary { background: transparent; border: 1px solid var(--border); color: var(--text); }
.msg { font-size: 13px; color: var(--muted); min-height: 16px; }

/* ---- App layout ---- */
.app-view { max-width: 1100px; margin: 0 auto; padding: 24px; }
.section { margin-bottom: 40px; }
.section-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 16px; }
.section-head h2 {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 28px;
  letter-spacing: 0.03em;
  margin: 0;
}
.live-section .section-head h2 { color: var(--live); }
.ondemand-section .section-head h2 { color: var(--brand); }
.section-sub { font-size: 12px; color: var(--muted); }

/* ---- Live TV: numbered DStv-style grid ---- */
.live-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
}
.live-tile {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.15s;
  position: relative;
}
.live-tile:hover { border-color: var(--live); transform: translateY(-2px); }
.live-number {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 34px;
  color: var(--muted);
  line-height: 1;
}
.live-tile:hover .live-number { color: var(--live); }
.live-name { font-size: 13px; margin-top: 8px; font-weight: 600; }
.live-cat { font-size: 11px; color: var(--muted); margin-top: 2px; }
.live-dot {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--live);
  box-shadow: 0 0 0 0 rgba(230,57,80,0.6);
  animation: pulse 1.8s infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(230,57,80,0.5); }
  70% { box-shadow: 0 0 0 8px rgba(230,57,80,0); }
  100% { box-shadow: 0 0 0 0 rgba(230,57,80,0); }
}

/* ---- On Demand: Netflix-style rows ---- */
.ondemand-row { margin-bottom: 24px; }
.ondemand-row-title {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 10px;
}
.ondemand-scroll {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 8px;
  scrollbar-width: thin;
}
.ondemand-card {
  flex: 0 0 150px;
  height: 210px;
  border-radius: 10px;
  background: linear-gradient(160deg, var(--panel-2), var(--panel));
  border: 1px solid var(--border);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 12px;
  transition: transform 0.15s, border-color 0.15s;
}
.ondemand-card:hover { transform: scale(1.04); border-color: var(--brand); }
.ondemand-card .name { font-size: 13px; font-weight: 600; }
.ondemand-card .cat { font-size: 11px; color: var(--muted); margin-top: 4px; }

/* ---- Player overlay ---- */
.player-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.9);
  display: flex; align-items: center; justify-content: center;
  z-index: 100; padding: 20px;
}
.player-box { width: 100%; max-width: 800px; }
.player-topbar {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 10px; color: var(--text); font-size: 14px; font-weight: 600;
}
.close-btn {
  background: transparent; border: none; color: var(--muted);
  font-size: 18px; cursor: pointer; padding: 4px 8px;
}
.video-wrap { position: relative; }
video { width: 100%; border-radius: 8px; background: black; display: block; }

.play-overlay-btn {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.35); border-radius: 8px; cursor: pointer;
}
.play-triangle {
  width: 0; height: 0;
  border-top: 18px solid transparent; border-bottom: 18px solid transparent;
  border-left: 28px solid white;
  margin-left: 6px;
}
.play-overlay-btn:hover { background: rgba(0,0,0,0.5); }

.loading-spinner {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
}
.loading-spinner::after {
  content: ''; width: 36px; height: 36px; border-radius: 50%;
  border: 3px solid rgba(255,255,255,0.2); border-top-color: var(--brand);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Topbar / logout ---- */
.topbar-right { display: flex; align-items: center; gap: 10px; }
.logout-btn {
  background: transparent; border: 1px solid var(--border); color: var(--muted);
  font-size: 11px; padding: 6px 12px; border-radius: 999px; cursor: pointer;
  font-family: 'Inter', sans-serif; text-transform: uppercase; letter-spacing: 0.04em;
}
.logout-btn:hover { border-color: var(--live); color: var(--live); }

@media (max-width: 600px) {
  .live-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
  .live-number { font-size: 28px; }
}
