/* Kingdom Flix — gold on deep purple. Mobile-first, Netflix-style. */
:root {
  --purple-950: #1a0633;
  --purple-900: #2a0a4a;
  --purple-800: #3b1163;
  --purple-700: #4d1a7d;
  --gold-400: #f0c420;
  --gold-500: #d4a017;
  --gold-600: #a97b0c;
  --ink: #f5eefb;
  --ink-dim: #c9b3e3;
  --ink-faint: #9a7fc0;
  --card: #241040;
  --card-2: #2f1554;
  --danger: #e5484d;
  --radius: 10px;
  --nav-h: 60px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--purple-950);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  min-height: 100vh;
}
button { font: inherit; color: inherit; }
a { color: inherit; }
.hidden { display: none !important; }

/* ---------- top nav ---------- */
.topnav {
  position: sticky; top: 0; z-index: 50;
  height: var(--nav-h);
  display: flex; align-items: center; gap: 14px;
  padding: 0 16px;
  background: linear-gradient(180deg, rgba(26,6,51,.97), rgba(26,6,51,.85));
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(240,196,32,.18);
}
.brand { display: flex; align-items: center; gap: 9px; cursor: pointer; user-select: none; }
.brand-crown {
  width: 34px; height: 34px; border-radius: 9px;
  display: grid; place-items: center; font-size: 20px;
  background: linear-gradient(135deg, var(--gold-400), var(--gold-600));
  box-shadow: 0 0 14px rgba(240,196,32,.45);
}
.brand-name { font-weight: 800; letter-spacing: .5px; font-size: 17px; }
.brand-name em { font-style: normal; color: var(--gold-400); }
.nav-links { display: none; gap: 4px; margin-left: 8px; }
.nav-links button {
  background: none; border: 0; padding: 8px 10px; border-radius: 8px;
  color: var(--ink-dim); cursor: pointer; font-size: 14.5px;
}
.nav-links button.active, .nav-links button:hover { color: var(--gold-400); background: rgba(240,196,32,.08); }
.nav-spacer { flex: 1; }
.search-wrap { position: relative; }
.search-wrap input {
  width: 150px; padding: 8px 12px 8px 32px; border-radius: 20px;
  border: 1px solid rgba(240,196,32,.3); background: rgba(255,255,255,.06);
  color: var(--ink); font-size: 14px; outline: none;
  transition: width .2s, border-color .2s;
}
.search-wrap input:focus { width: 210px; border-color: var(--gold-400); }
.search-wrap .mag { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--ink-faint); font-size: 14px; }
.avatar-btn {
  width: 36px; height: 36px; border-radius: 50%; border: 2px solid var(--gold-400);
  font-weight: 800; cursor: pointer; color: #1a0633; font-size: 15px;
}
.menu {
  position: absolute; top: calc(var(--nav-h) - 6px); right: 10px; z-index: 60;
  background: var(--card-2); border: 1px solid rgba(240,196,32,.25);
  border-radius: var(--radius); min-width: 210px; overflow: hidden;
  box-shadow: 0 12px 40px rgba(0,0,0,.5);
}
.menu button {
  display: block; width: 100%; text-align: left; background: none; border: 0;
  padding: 12px 16px; cursor: pointer; font-size: 14.5px; color: var(--ink);
}
.menu button:hover { background: rgba(240,196,32,.1); color: var(--gold-400); }
.menu .menu-head { padding: 12px 16px; border-bottom: 1px solid rgba(240,196,32,.15); color: var(--ink-dim); font-size: 13px; }

/* ---------- mobile bottom nav ---------- */
.mobilenav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 50;
  display: flex; background: rgba(26,6,51,.97); backdrop-filter: blur(8px);
  border-top: 1px solid rgba(240,196,32,.18);
  padding-bottom: env(safe-area-inset-bottom);
}
.mobilenav button {
  flex: 1; background: none; border: 0; padding: 10px 4px 8px;
  color: var(--ink-faint); font-size: 11px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
}
.mobilenav button .ico { font-size: 19px; }
.mobilenav button.active { color: var(--gold-400); }
main { padding-bottom: 76px; }
@media (min-width: 760px) {
  .mobilenav { display: none; }
  main { padding-bottom: 24px; }
  .nav-links { display: flex; }
  .search-wrap input { width: 180px; }
}

/* ---------- hero ---------- */
.hero {
  position: relative; min-height: 46vh;
  display: flex; align-items: flex-end;
  padding: 34px 18px;
  background:
    radial-gradient(1200px 500px at 70% -10%, rgba(240,196,32,.16), transparent 60%),
    linear-gradient(180deg, var(--purple-800), var(--purple-950));
  overflow: hidden;
}
.hero::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(180deg, transparent 40%, var(--purple-950) 98%);
}
.hero-inner { position: relative; z-index: 1; max-width: 640px; }
.hero-kicker {
  color: var(--gold-400); font-weight: 700; letter-spacing: 2.5px;
  font-size: 12px; text-transform: uppercase; margin-bottom: 10px;
}
.hero h1 { font-size: clamp(30px, 6vw, 52px); line-height: 1.05; margin-bottom: 10px; }
.hero h1 em { font-style: normal; color: var(--gold-400); }
.hero p { color: var(--ink-dim); font-size: 15px; line-height: 1.55; margin-bottom: 18px; max-width: 520px; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.btn {
  border: 0; border-radius: 8px; padding: 12px 22px; font-weight: 700;
  cursor: pointer; font-size: 15px; display: inline-flex; align-items: center; gap: 8px;
}
.btn-gold { background: linear-gradient(135deg, var(--gold-400), var(--gold-500)); color: #241040; }
.btn-gold:hover { filter: brightness(1.08); }
.btn-ghost { background: rgba(255,255,255,.12); color: var(--ink); border: 1px solid rgba(255,255,255,.18); }
.btn-ghost:hover { background: rgba(255,255,255,.2); }

/* ---------- rows ---------- */
.row { margin: 26px 0; }
.row-head { display: flex; align-items: baseline; justify-content: space-between; padding: 0 18px; margin-bottom: 10px; }
.row-head h2 { font-size: 19px; }
.row-head h2 .k { color: var(--gold-400); }
.row-head .more { background: none; border: 0; color: var(--ink-faint); font-size: 13px; cursor: pointer; }
.rail { display: flex; gap: 12px; overflow-x: auto; padding: 4px 18px 10px; scrollbar-width: thin; }
.card {
  flex: 0 0 auto; width: 168px; cursor: pointer; border-radius: var(--radius);
  background: var(--card); overflow: hidden; border: 1px solid rgba(255,255,255,.06);
  transition: transform .15s;
}
.card:hover { transform: translateY(-3px); border-color: rgba(240,196,32,.4); }
.card.wide { width: 250px; }
.poster {
  height: 96px; display: grid; place-items: center; font-size: 40px;
  background: linear-gradient(135deg, hsl(var(--h,270) 60% 30%), hsl(var(--h,270) 70% 16%));
}
.card.wide .poster { height: 140px; }
.card-body { padding: 10px 12px 12px; }
.card-body h3 { font-size: 14px; margin-bottom: 4px; line-height: 1.3; }
.card-body p { font-size: 12px; color: var(--ink-faint); }
.progress-track { height: 4px; background: rgba(255,255,255,.14); border-radius: 2px; margin-top: 8px; }
.progress-fill { height: 100%; background: var(--gold-400); border-radius: 2px; }
.empty { padding: 30px 18px; color: var(--ink-faint); font-size: 14.5px; line-height: 1.6; }

/* ---------- detail ---------- */
.detail { padding: 20px 18px; max-width: 900px; margin: 0 auto; }
.detail-hero {
  border-radius: 14px; padding: 30px 24px; margin-bottom: 20px;
  background: linear-gradient(135deg, hsl(var(--h,270) 55% 28%), hsl(var(--h,270) 70% 14%));
  border: 1px solid rgba(240,196,32,.2);
}
.detail-hero .kind { color: var(--gold-400); font-size: 12px; letter-spacing: 2px; text-transform: uppercase; font-weight: 700; }
.detail-hero h1 { font-size: clamp(24px, 5vw, 38px); margin: 8px 0; }
.detail-hero p { color: var(--ink-dim); line-height: 1.6; font-size: 14.5px; max-width: 640px; }
.detail-hero .meta { margin-top: 12px; color: var(--ink-faint); font-size: 13px; display: flex; gap: 14px; flex-wrap: wrap; }
.detail-actions { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.ep-list { display: grid; gap: 10px; }
.ep {
  display: flex; gap: 14px; align-items: center; background: var(--card);
  border: 1px solid rgba(255,255,255,.06); border-radius: var(--radius);
  padding: 12px; cursor: pointer; text-align: left; width: 100%;
}
.ep:hover { border-color: rgba(240,196,32,.4); }
.ep-num {
  flex: 0 0 44px; height: 44px; border-radius: 8px; display: grid; place-items: center;
  background: rgba(240,196,32,.12); color: var(--gold-400); font-weight: 800; font-size: 17px;
}
.ep-info { flex: 1; min-width: 0; }
.ep-info h3 { font-size: 15px; margin-bottom: 3px; }
.ep-info p { font-size: 13px; color: var(--ink-faint); }
.ep-dur { color: var(--ink-faint); font-size: 13px; white-space: nowrap; }
.back-link { background: none; border: 0; color: var(--ink-dim); cursor: pointer; font-size: 14px; margin-bottom: 14px; }
.back-link:hover { color: var(--gold-400); }

/* ---------- live tv ---------- */
.live-now {
  margin: 18px; border-radius: 14px; padding: 22px;
  background: linear-gradient(135deg, #5c1010, #2a0a0a);
  border: 1px solid rgba(229,72,77,.4);
}
.live-badge {
  display: inline-block; background: var(--danger); color: #fff; font-weight: 800;
  font-size: 12px; letter-spacing: 1.5px; padding: 4px 10px; border-radius: 6px; margin-bottom: 10px;
  animation: pulse 2s infinite;
}
@keyframes pulse { 50% { opacity: .65; } }
.live-now h2 { font-size: 22px; margin-bottom: 6px; }
.live-now p { color: #f0c9c9; font-size: 14px; }
.schedule { margin: 6px 18px 0; }
.slot {
  display: flex; gap: 14px; padding: 12px 4px; border-bottom: 1px solid rgba(255,255,255,.07);
  align-items: baseline;
}
.slot .t { flex: 0 0 118px; color: var(--gold-400); font-size: 13.5px; font-weight: 700; }
.slot .b h3 { font-size: 15px; }
.slot .b p { font-size: 13px; color: var(--ink-faint); margin-top: 2px; }
.slot.onair .b h3 { color: var(--gold-400); }
.slot .now-tag { font-size: 11px; background: var(--danger); color: #fff; border-radius: 4px; padding: 2px 7px; margin-left: 8px; font-weight: 700; }

/* ---------- auth / profiles ---------- */
.center-wrap { min-height: 80vh; display: grid; place-items: center; padding: 24px 18px; }
.auth-card {
  width: 100%; max-width: 400px; background: var(--card);
  border: 1px solid rgba(240,196,32,.2); border-radius: 16px; padding: 30px 26px;
}
.auth-card .brand { justify-content: center; margin-bottom: 18px; }
.auth-card h1 { text-align: center; font-size: 22px; margin-bottom: 6px; }
.auth-card .sub { text-align: center; color: var(--ink-faint); font-size: 13.5px; margin-bottom: 20px; line-height: 1.5; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: var(--ink-dim); margin-bottom: 6px; }
.field input {
  width: 100%; padding: 12px; border-radius: 8px; font-size: 15px;
  border: 1px solid rgba(255,255,255,.15); background: rgba(255,255,255,.05); color: var(--ink);
  outline: none;
}
.field input:focus { border-color: var(--gold-400); }
.form-err { color: var(--danger); font-size: 13.5px; margin-bottom: 12px; min-height: 18px; }
.auth-switch { text-align: center; margin-top: 16px; font-size: 14px; color: var(--ink-faint); }
.auth-switch button { background: none; border: 0; color: var(--gold-400); cursor: pointer; font-weight: 700; }
.profiles-grid { display: flex; gap: 18px; flex-wrap: wrap; justify-content: center; margin: 24px 0; }
.profile-tile { background: none; border: 0; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.profile-face {
  width: 96px; height: 96px; border-radius: 18px; display: grid; place-items: center;
  font-size: 38px; font-weight: 800; color: #1a0633;
  background: linear-gradient(135deg, hsl(var(--h,270) 80% 62%), hsl(var(--h,270) 80% 42%));
  border: 3px solid transparent;
}
.profile-tile:hover .profile-face { border-color: var(--gold-400); }
.profile-tile span { font-size: 14px; color: var(--ink-dim); }
.profile-tile .kids-tag { font-size: 11px; color: var(--gold-400); }

/* ---------- player ---------- */
.player {
  position: fixed; inset: 0; z-index: 100; background: #000;
  display: flex; flex-direction: column;
}
.player-top {
  display: flex; align-items: center; gap: 12px; padding: 14px 16px;
  background: linear-gradient(180deg, rgba(0,0,0,.7), transparent);
  position: absolute; top: 0; left: 0; right: 0; z-index: 2;
}
.icon-btn {
  background: rgba(255,255,255,.14); border: 0; border-radius: 50%;
  width: 40px; height: 40px; font-size: 20px; cursor: pointer; color: #fff;
}
.player-title { color: #fff; font-size: 15px; }
.player-title #player-show { font-weight: 700; margin-right: 8px; }
.player-title #player-ep { color: #ccc; }
#player-video { flex: 1; width: 100%; background: #000; }
.player-note {
  position: absolute; bottom: 70px; left: 50%; transform: translateX(-50%);
  background: rgba(26,6,51,.92); border: 1px solid rgba(240,196,32,.4);
  color: var(--ink); padding: 12px 18px; border-radius: 10px; font-size: 13.5px;
  max-width: 90%; text-align: center; line-height: 1.5;
}

/* ---------- misc ---------- */
.section-head { padding: 22px 18px 4px; max-width: 1100px; margin: 0 auto; }
.section-head h1 { font-size: 24px; }
.section-head p { color: var(--ink-faint); font-size: 14px; margin-top: 6px; line-height: 1.55; }
.search-empty { text-align: center; padding: 60px 20px; color: var(--ink-faint); }
.toast {
  position: fixed; bottom: 90px; left: 50%; transform: translateX(-50%);
  background: var(--card-2); border: 1px solid rgba(240,196,32,.4); color: var(--ink);
  padding: 12px 20px; border-radius: 10px; font-size: 14px; z-index: 200;
  box-shadow: 0 8px 30px rgba(0,0,0,.5);
}
.panel {
  background: var(--card); border: 1px solid rgba(240,196,32,.2);
  border-radius: 12px; padding: 20px; margin: 14px 18px; max-width: 700px;
}
.panel h3 { margin-bottom: 10px; }
.panel p, .panel li { font-size: 14px; color: var(--ink-dim); line-height: 1.65; }
.panel ul { padding-left: 18px; }

/* PWA install banner */
.install-banner {
  position: fixed; left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom));
  z-index: 90; display: flex; align-items: center; gap: 12px;
  background: #2f1554; border: 1px solid rgba(240,196,32,.45); border-radius: 14px;
  padding: 12px 14px; box-shadow: 0 8px 30px rgba(0,0,0,.5);
  animation: ib-in .3s ease;
}
@keyframes ib-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; } }
.ib-crown { font-size: 26px; }
.ib-text { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.ib-text b { font-size: 14px; }
.ib-text span { font-size: 12px; color: var(--ink-dim); }
.install-banner .btn-sm { padding: 8px 16px; font-size: 13px; white-space: nowrap; }
#install-x { background: none; border: none; color: var(--ink-faint); font-size: 16px; cursor: pointer; padding: 6px; }

/* Intro cinematic overlay */
.intro {
  position: fixed; inset: 0; z-index: 200; background: #000;
  display: flex; align-items: center; justify-content: center;
}
.intro.hidden { display: none; }
.intro video { width: 100%; height: 100%; object-fit: cover; }
.intro-skip {
  position: absolute; right: 18px; bottom: calc(24px + env(safe-area-inset-bottom));
  background: rgba(0,0,0,.55); color: #F5C542; border: 1px solid rgba(245,197,66,.6);
  border-radius: 999px; padding: 10px 22px; font-size: 16px; font-weight: 800;
  cursor: pointer; backdrop-filter: blur(4px);
}
.intro-unmute {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%);
  background: rgba(0,0,0,.65); color: #fff; border: 1px solid rgba(255,255,255,.4);
  border-radius: 999px; padding: 14px 28px; font-size: 17px; font-weight: 800;
  cursor: pointer; backdrop-filter: blur(4px);
}
.intro-unmute.hidden { display: none; }
