:root{
  --bg:#090911;--panel:#12121c;--panel2:#191927;--text:#f5f4fb;--muted:#aaa8b8;
  --accent:#8b5cf6;--accent2:#5b21b6;--line:#29283a;--danger:#ef4444;
}
*{box-sizing:border-box}
html,body{margin:0;min-height:100%;background:var(--bg);color:var(--text);font-family:Inter,Segoe UI,Arial,sans-serif}
button,input,select{font:inherit}
button{cursor:pointer}
#app{display:grid;grid-template-columns:240px 1fr;min-height:100vh}
.sidebar{position:sticky;top:0;height:100vh;border-right:1px solid var(--line);background:rgba(13,13,21,.96);padding:24px 16px;display:flex;flex-direction:column}
.brand{display:flex;align-items:center;gap:12px;padding:0 8px 25px}
.brand-mark{width:40px;height:40px;border-radius:12px;display:grid;place-items:center;font-weight:900;background:linear-gradient(135deg,var(--accent),var(--accent2));box-shadow:0 10px 30px #6d28d944}
.brand strong,.brand small{display:block}
.brand small{color:var(--muted);margin-top:3px}
nav{display:grid;gap:7px}
.nav{border:0;background:transparent;color:var(--muted);padding:12px 14px;border-radius:12px;text-align:left;display:flex;gap:12px}
.nav:hover,.nav.active{background:#8b5cf61c;color:white}
.nav.active{outline:1px solid #8b5cf644}
.server-card{margin-top:auto;border:1px solid var(--line);border-radius:14px;padding:12px;display:flex;gap:10px;align-items:center;background:var(--panel)}
.server-card strong,.server-card small{display:block}
.server-card small{font-size:11px;color:var(--muted);margin-top:3px;max-width:145px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.dot{width:9px;height:9px;border-radius:50%;background:#f59e0b;box-shadow:0 0 12px currentColor}
.dot.online{background:#22c55e}.dot.offline{background:#ef4444}
main{min-width:0;padding:32px}
header{display:flex;justify-content:space-between;align-items:end;gap:20px;margin-bottom:24px}
h1{font-size:32px;margin:3px 0 0}.eyebrow{font-size:11px;letter-spacing:.18em;color:#a78bfa;font-weight:800;margin:0}
.search-wrap{width:min(420px,50vw)}
.search-wrap input{width:100%;background:var(--panel);border:1px solid var(--line);border-radius:13px;color:white;padding:13px 16px;outline:none}
.search-wrap input:focus{border-color:#7c3aed}
.hero{min-height:280px;border:1px solid #ffffff12;border-radius:24px;padding:42px;display:flex;align-items:end;background:
linear-gradient(90deg,rgba(8,8,16,.96),rgba(8,8,16,.40)),
radial-gradient(circle at 80% 20%,#7c3aed99,transparent 32%),
linear-gradient(135deg,#1c1630,#0c0c14);overflow:hidden;margin-bottom:34px}
.hero h2{font-size:43px;max-width:650px;margin:9px 0 10px}.hero p:not(.eyebrow){color:#ccc9d8;max-width:600px}
.hero button,.primary{border:0;border-radius:11px;padding:12px 18px;background:var(--accent);color:white;font-weight:800}
.toolbar{display:flex;align-items:center;justify-content:space-between;margin:0 0 18px;gap:12px}
.toolbar select{background:var(--panel);color:white;border:1px solid var(--line);padding:10px 12px;border-radius:10px;min-width:220px}
#resultCount{color:var(--muted);font-size:13px}
.hidden{display:none!important}
.grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(165px,1fr));gap:18px}
.card{position:relative;background:var(--panel);border:1px solid var(--line);border-radius:15px;overflow:hidden;transition:.18s transform,.18s border-color;min-width:0}
.card:hover{transform:translateY(-3px);border-color:#7c3aed88}
.poster{width:100%;aspect-ratio:2/3;background:#181824;object-fit:cover;display:block}
.live .poster{aspect-ratio:16/9;object-fit:contain;padding:14px}
.card-info{padding:12px}.card-title{font-size:14px;font-weight:800;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.card-meta{font-size:12px;color:var(--muted);margin-top:5px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.fav{position:absolute;right:8px;top:8px;border:0;background:#090911cc;color:white;width:34px;height:34px;border-radius:10px;z-index:2}
.fav.on{color:#facc15}
.section-title{font-size:20px;margin:30px 0 14px}
.empty{border:1px dashed var(--line);border-radius:16px;padding:35px;text-align:center;color:var(--muted)}
.skeleton-grid{display:grid;grid-template-columns:repeat(5,1fr);gap:18px}
.skeleton-grid div{height:260px;border-radius:15px;background:linear-gradient(100deg,#13131d,#222233,#13131d);background-size:200%;animation:shimmer 1.3s infinite}
@keyframes shimmer{to{background-position:-200%}}
.modal{position:fixed;inset:0;background:#000b;z-index:20;display:grid;place-items:center;padding:30px}
.modal-card{position:relative;width:min(1000px,95vw);max-height:92vh;overflow:auto;background:#11111a;border:1px solid var(--line);border-radius:18px;padding:20px;box-shadow:0 30px 100px #000}
.close{position:absolute;right:10px;top:10px;z-index:5;width:38px;height:38px;border-radius:50%;border:0;background:#000b;color:white;font-size:25px}
.player{width:100%;aspect-ratio:16/9;background:black;border-radius:12px}
.detail{display:grid;grid-template-columns:180px 1fr;gap:22px;padding:8px}
.detail img{width:100%;border-radius:12px;background:#1b1b28}
.detail h2{margin:0 0 8px}.detail p{color:#c4c2cf;line-height:1.55}
.episodes{display:grid;gap:9px;margin-top:18px}
.episode{display:flex;justify-content:space-between;align-items:center;gap:12px;background:#191925;border:1px solid var(--line);border-radius:11px;padding:11px 13px}
.episode button{border:0;background:#7c3aed;color:white;border-radius:9px;padding:8px 12px}
@media(max-width:800px){
  #app{grid-template-columns:74px 1fr}.sidebar{padding:20px 10px}.brand>div:not(.brand-mark),.nav span,.server-card div{display:none}.brand{padding-left:6px}.server-card{justify-content:center}.nav{justify-content:center}
  main{padding:20px}.hero{padding:26px;min-height:230px}.hero h2{font-size:34px}
}
@media(max-width:560px){
  main{padding:14px}header{align-items:stretch;flex-direction:column}.search-wrap{width:100%}.grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:11px}.detail{grid-template-columns:1fr}.detail>img{max-width:170px}.hero h2{font-size:29px}
}
.logout-btn {
  padding: 10px 16px;
  border: 1px solid #343346;
  border-radius: 10px;
  background: #181822;
  color: #f5f4fb;
  font-weight: 700;
  cursor: pointer;
}

.logout-btn:hover {
  background: #242433;
}


/* =========================================================
   BOXFLIX TV LAYOUT REFRESH
   ========================================================= */

:root{
  --tv-bg:#070a14;
  --tv-panel:#0f1424;
  --tv-panel-2:#151c31;
  --tv-panel-3:#1a2440;
  --tv-line:rgba(255,255,255,.075);
  --tv-text:#f6f7fb;
  --tv-muted:#9da6bb;
  --tv-purple:#8b5cf6;
  --tv-purple-2:#6d28d9;
  --tv-blue:#465f9d;
}

html,
body{
  background:
    radial-gradient(circle at 80% 8%,rgba(87,72,178,.16),transparent 30%),
    radial-gradient(circle at 8% 40%,rgba(42,71,137,.13),transparent 35%),
    var(--tv-bg);
}

#app{
  grid-template-columns:190px 1fr;
}

.sidebar{
  padding:28px 14px;
  background:
    linear-gradient(180deg,rgba(12,16,31,.98),rgba(7,10,20,.98));
  border-right:1px solid var(--tv-line);
}

.brand{
  padding:0 8px 30px;
}

.brand-mark{
  width:44px;
  height:44px;
  border-radius:13px;
  background:
    linear-gradient(135deg,#a78bfa,#6d28d9);
}

.nav{
  min-height:48px;
  border-radius:10px;
}

.nav:hover,
.nav.active{
  background:
    linear-gradient(90deg,rgba(139,92,246,.20),rgba(139,92,246,.05));
}

main{
  padding:24px 32px 50px;
}

.boxflix-topbar{
  min-height:88px;
  align-items:center;
  margin-bottom:18px;
  border-bottom:1px solid var(--tv-line);
  padding-bottom:18px;
}

.topbar-title{
  min-width:190px;
}

.topbar-clock{
  margin-left:auto;
  display:flex;
  gap:18px;
  align-items:center;
  color:#dce1ef;
  font-size:14px;
}

.topbar-clock strong{
  font-size:18px;
}

.topbar-clock span{
  color:var(--tv-muted);
}

.search-wrap{
  width:min(360px,34vw);
  margin-left:26px;
}

.search-wrap input{
  min-height:50px;
  border-radius:16px;
  background:#151b2d;
  border:1px solid rgba(139,92,246,.32);
  padding:0 18px;
}

.boxflix-home-hero{
  min-height:190px;
  margin-bottom:22px;
  border-radius:20px;
  background:
    radial-gradient(circle at 80% 20%,rgba(139,92,246,.30),transparent 33%),
    linear-gradient(120deg,#11172a,#1b2340);
}

.boxflix-home-hero h2{
  font-size:34px;
}

.launcher-grid{
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:28px;
  max-width:1100px;
  margin:24px auto 18px;
}

.home-launcher{
  appearance:none;
  border:1px solid rgba(255,255,255,.055);
  min-height:245px;
  border-radius:22px;
  background:
    linear-gradient(150deg,#18213a,#101628);
  color:white;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:12px;
  box-shadow:0 18px 50px rgba(0,0,0,.22);
  transition:
    transform .18s ease,
    border-color .18s ease,
    box-shadow .18s ease;
}

.home-launcher:hover,
.home-launcher:focus-visible{
  transform:translateY(-5px) scale(1.015);
  border-color:rgba(139,92,246,.50);
  box-shadow:0 24px 65px rgba(46,29,93,.28);
  outline:none;
}

.launcher-orbit{
  width:112px;
  height:112px;
  border-radius:50%;
  display:grid;
  place-items:center;
  background:
    conic-gradient(
      #587de3 0 28%,
      rgba(73,107,199,.14) 28% 50%,
      #587de3 50% 78%,
      rgba(73,107,199,.14) 78% 100%
    );
  position:relative;
}

.launcher-orbit::after{
  content:"";
  position:absolute;
  inset:10px;
  border-radius:50%;
  background:#202b4d;
}

.launcher-icon{
  position:relative;
  z-index:2;
  width:58px;
  height:58px;
  display:grid;
  place-items:center;
  border-radius:16px;
  background:#f5f7fb;
  color:#1b2440;
  font-size:28px;
  font-weight:900;
}

.home-launcher strong{
  font-size:20px;
  letter-spacing:.04em;
}

.home-launcher small{
  color:var(--tv-muted);
}

.home-shortcuts{
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:14px;
  max-width:1100px;
  margin:0 auto 34px;
}

.home-shortcuts button{
  min-height:58px;
  border:1px solid var(--tv-line);
  border-radius:16px;
  background:#141d38;
  color:#bcc5da;
  font-weight:800;
}

.home-shortcuts button:hover{
  color:white;
  background:#1a2750;
}

#toolbar{
  height:0;
  min-height:0;
  padding:0;
  margin:0;
  overflow:hidden;
  border:0;
}

#categorySelect,
#resultCount{
  position:absolute;
  width:1px;
  height:1px;
  opacity:0;
  pointer-events:none;
}

.catalog-shell{
  display:grid;
  grid-template-columns:260px minmax(0,1fr);
  min-height:calc(100vh - 150px);
  margin:-2px -32px -50px;
}

.catalog-rail,
.live-category-panel{
  background:rgba(6,9,18,.96);
  border-right:1px solid var(--tv-line);
  padding:18px 0 30px;
  overflow:auto;
  max-height:calc(100vh - 118px);
  position:sticky;
  top:118px;
}

.rail-search-label{
  color:var(--tv-muted);
  font-size:13px;
  padding:12px 20px 18px;
  border-bottom:1px solid var(--tv-line);
  margin-bottom:4px;
}

.rail-category{
  width:100%;
  min-height:52px;
  border:0;
  border-bottom:1px solid rgba(255,255,255,.045);
  background:transparent;
  color:#e8ebf3;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  text-align:left;
  padding:0 20px;
  font-weight:650;
  transition:background .14s ease;
}

.rail-category:hover,
.rail-category.active{
  background:#394d7e;
  color:white;
}

.rail-category span{
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}

.rail-category b{
  color:#d6dbea;
  font-size:12px;
}

.catalog-main{
  min-width:0;
  padding:20px 26px 50px;
  background:
    linear-gradient(180deg,rgba(30,42,76,.78),rgba(12,17,32,.18) 260px);
}

.catalog-heading{
  display:flex;
  justify-content:space-between;
  align-items:end;
  gap:20px;
  margin-bottom:20px;
}

.catalog-heading h2{
  font-size:24px;
  margin:3px 0 0;
}

.catalog-kicker{
  font-size:10px;
  letter-spacing:.18em;
  color:#a99afa;
  font-weight:900;
}

.catalog-count{
  color:var(--tv-muted);
  font-size:13px;
}

.poster-grid{
  grid-template-columns:repeat(5,minmax(130px,1fr));
  gap:12px;
}

.poster-grid .card{
  background:#101625;
  border-radius:8px;
  overflow:hidden;
  border:1px solid rgba(255,255,255,.055);
}

.poster-grid .poster{
  aspect-ratio:2/3;
}

.poster-grid .card-info{
  padding:9px 10px 11px;
}

.poster-grid .card:hover{
  transform:translateY(-3px) scale(1.012);
  border-color:rgba(139,92,246,.36);
}

.load-more-trigger{
  min-height:80px;
  display:grid;
  place-items:center;
  color:var(--tv-muted);
}

.live-guide-shell{
  display:grid;
  grid-template-columns:280px 420px minmax(360px,1fr);
  min-height:calc(100vh - 150px);
  margin:-2px -32px -50px;
  background:
    linear-gradient(110deg,#111a30,#26355f);
}

.live-channel-panel{
  background:rgba(8,12,24,.92);
  border-right:1px solid var(--tv-line);
  min-width:0;
}

.live-panel-title{
  height:54px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:0 16px;
  border-bottom:1px solid var(--tv-line);
  color:#dce1ef;
}

.live-channel-list{
  height:calc(100vh - 204px);
  overflow:auto;
}

.live-guide-row{
  width:100%;
  min-height:68px;
  border:0;
  border-bottom:1px solid rgba(255,255,255,.055);
  background:transparent;
  color:white;
  display:grid;
  grid-template-columns:52px 1fr;
  gap:12px;
  align-items:center;
  padding:8px 12px;
  text-align:left;
}

.live-guide-row:hover,
.live-guide-row.active{
  background:#263a67;
}

.live-guide-row img{
  width:48px;
  height:48px;
  object-fit:contain;
  border-radius:8px;
  background:#0e1424;
}

.live-guide-copy{
  min-width:0;
}

.live-guide-copy strong,
.live-guide-copy small{
  display:block;
  overflow:hidden;
  white-space:nowrap;
  text-overflow:ellipsis;
}

.live-guide-copy strong{
  font-size:14px;
}

.live-guide-copy small{
  color:#c0c7d7;
  font-size:12px;
  margin-top:3px;
}

.live-progress{
  display:block;
  height:2px;
  margin-top:8px;
  background:rgba(255,255,255,.11);
  overflow:hidden;
}

.live-progress i{
  display:block;
  width:58%;
  height:100%;
  background:#f0b729;
}

.live-preview-panel{
  padding:22px;
  min-width:0;
}

.live-preview-box{
  width:100%;
  aspect-ratio:16/9;
  background:#020306;
  border:1px solid rgba(255,255,255,.08);
  display:grid;
  place-items:center;
  box-shadow:0 20px 55px rgba(0,0,0,.25);
}

.preview-placeholder{
  color:#b9c0d1;
  display:grid;
  place-items:center;
  gap:9px;
}

.preview-placeholder small{
  color:#778199;
}

.preview-play{
  font-size:34px;
}

.preview-channel-art{
  width:100%;
  height:100%;
  display:grid;
  place-items:center;
  align-content:center;
  gap:24px;
  background:
    radial-gradient(circle,rgba(70,95,157,.32),transparent 42%);
}

.preview-channel-art img{
  max-width:180px;
  max-height:120px;
  object-fit:contain;
}

.preview-channel-art button{
  border:0;
  border-radius:12px;
  background:linear-gradient(135deg,#8b5cf6,#6d28d9);
  color:white;
  font-weight:900;
  padding:13px 20px;
}

.live-preview-meta{
  padding:18px 3px;
}

.live-preview-meta span{
  color:#a99afa;
  font-size:10px;
  letter-spacing:.18em;
  font-weight:900;
}

.live-preview-meta h2{
  margin:6px 0;
}

.live-preview-meta p{
  color:var(--tv-muted);
}

.home-recent-grid{
  grid-template-columns:repeat(5,minmax(140px,1fr));
}

@media(max-width:1250px){
  .live-guide-shell{
    grid-template-columns:230px 360px minmax(320px,1fr);
  }

  .poster-grid{
    grid-template-columns:repeat(4,minmax(130px,1fr));
  }
}

@media(max-width:980px){
  #app{
    grid-template-columns:76px 1fr;
  }

  .sidebar{
    padding-left:8px;
    padding-right:8px;
  }

  .brand>div:not(.brand-mark),
  .nav span,
  .server-card div{
    display:none;
  }

  .catalog-shell{
    grid-template-columns:220px minmax(0,1fr);
  }

  .live-guide-shell{
    grid-template-columns:220px 1fr;
  }

  .live-preview-panel{
    display:none;
  }

  .poster-grid{
    grid-template-columns:repeat(3,minmax(130px,1fr));
  }
}

@media(max-width:720px){
  main{
    padding:16px;
  }

  .boxflix-topbar{
    flex-wrap:wrap;
  }

  .topbar-clock{
    display:none;
  }

  .search-wrap{
    width:100%;
    margin-left:0;
  }

  .launcher-grid,
  .home-shortcuts{
    grid-template-columns:1fr;
  }

  .catalog-shell,
  .live-guide-shell{
    display:block;
    margin:0;
  }

  .catalog-rail,
  .live-category-panel{
    position:static;
    max-height:220px;
  }

  .live-channel-list{
    height:auto;
    max-height:650px;
  }

  .poster-grid{
    grid-template-columns:repeat(2,minmax(120px,1fr));
  }
}
