/* J&D Streaming — Gaming Netflix-style */
:root{
  --bg:#0b0b0f;
  --panel:#121218;
  --text:#e6e6ea;
  --muted:#a3a3ad;
  --brand:#1138ff;
  --accent: var(--brand);
  --radius:16px;
  --space:clamp(12px,2vw,20px);
  --maxw:1200px;
}
*{box-sizing:border-box}
html{scroll-behavior:smooth}
body{margin:0;background:var(--bg);color:var(--text);font-family:Inter,system-ui,Segoe UI,Roboto,Arial,sans-serif;line-height:1.5}
img{max-width:100%;height:auto}
a{color:inherit;text-decoration:none}
.sr-only{position:absolute!important;height:1px;width:1px;overflow:hidden;clip:rect(1px,1px,1px,1px);white-space:nowrap}
.container{max-width:var(--maxw);margin:auto;padding:0 var(--space)}

/* Header */
.site-header{position:sticky;top:0;background:linear-gradient(180deg,#0b0b0f 0%,rgba(11,11,15,.65) 100%);backdrop-filter:blur(6px);z-index:1000}
.header-inner{display:flex;align-items:center;justify-content:space-between;padding:12px 0}
.brand{display:flex;align-items:center;gap:10px;font-weight:800}
.brand-mark{display:inline-grid;place-items:center;width:36px;height:36px;border-radius:10px;background:var(--brand);color:#fff}
.nav{display:flex;gap:16px;align-items:center}
.nav a{opacity:.9}
.nav a:hover{opacity:1}
.btn{background:var(--brand);border:0;color:#fff;border-radius:999px;padding:.6rem 1rem;cursor:pointer;font-weight:600}
.btn:hover{filter:brightness(1.1)}
.btn-ghost{background:transparent;border:2px solid #fff}

/* Hero */
.hero{background: radial-gradient(1000px 500px at 50% -20%, #20202a, var(--bg));}
.hero-inner{padding:clamp(40px,6vw,96px) 0}
.hero-copy{max-width:760px}
.hero h1{font-size:clamp(28px,6vw,56px);margin:0 0 10px}
.hero p{color:var(--muted);margin:0 0 16px}
.hero-search{display:flex;gap:10px;margin-bottom:10px}
.hero-search input{flex:1;padding:.8rem 1rem;border-radius:12px;border:1px solid #2c2c36;background:#0f0f15;color:#fff}
.filters{display:flex;gap:8px;flex-wrap:wrap}
.chip{background:#1e1e28;border:1px solid #2a2a34;border-radius:999px;padding:.4rem .75rem;color:#d1d1db;cursor:pointer}
.chip[aria-pressed="true"]{background:#2a2a34;outline:2px solid #555}

/* Catalog rows */
.catalog .row-scroller{display:grid;grid-auto-flow:column;grid-auto-columns:clamp(160px,22vw,260px);gap:12px;overflow-x:auto;padding-bottom:10px;scroll-snap-type:x mandatory}
.card{scroll-snap-align:start;background:var(--panel);border-radius:14px;overflow:hidden;display:flex;flex-direction:column}
.card .thumb{aspect-ratio:16/9;background:#1b1b24;display:grid;place-items:center;font-weight:700}
.card h3{font-size:1rem;margin:10px}
.card p{color:var(--muted);margin:0 10px 12px;font-size:.9rem}
.card .card-actions{display:flex;gap:8px;align-items:center;margin:0 10px 12px}
.tag{font-size:.75rem;background:#1e1e28;border-radius:999px;padding:.25rem .5rem;color:#d1d1db}

/* CTA Go live */
.cta{padding:50px 0}
.grid-2{display:grid;gap:var(--space)}
@media(min-width: 768px){ .grid-2{grid-template-columns:1.1fr .9fr}}
.form-row{display:grid;gap:6px}
input, select, textarea{padding:.8rem;border-radius:12px;border:1px solid #2d2d37;background:#0f0f15;color:#fff}
.form-status{min-height:1.25rem}

/* Footer */
.site-footer{border-top:1px solid #1f1f29;padding:18px 0;color:#a1a1ab}

/* Modals & player */
.modal{position:fixed;inset:0;background:rgba(0,0,0,.6);display:none;align-items:center;justify-content:center;padding:var(--space);z-index:2000}
.modal[aria-hidden="false"]{display:flex}
.modal__dialog{background:#0f0f15;border:1px solid #1f1f29;border-radius:16px;max-width:720px;width:100%;padding:18px;color:#fff}
.modal__header{display:flex;align-items:center;justify-content:space-between;margin-bottom:10px}
.modal__close{background:transparent;border:0;color:#fff;font-size:1.5rem;cursor:pointer}
.player{display:grid;gap:16px}
@media(min-width: 820px){ .player{grid-template-columns:1.4fr .6fr}}
.player-video{aspect-ratio:16/9;display:grid;place-items:center;background:#1b1b24;border-radius:12px;font-size:3rem}
.pillbar{display:flex;gap:8px;flex-wrap:wrap;margin:6px 0}
.pill{background:#1e1e28;border:1px solid #2a2a34;border-radius:999px;padding:.25rem .6rem;font-size:.8rem}
.player-actions{display:flex;gap:10px;margin-top:10px}


/* Category blocks with modern layered backgrounds */
.cat{position:relative;margin:18px 0;padding:18px;border-radius:20px;overflow:hidden;border:1px solid #1f1f29}
.cat::before, .cat::after{
  content:""; position:absolute; inset:-40%; pointer-events:none; filter:blur(40px); opacity:.45;
  background: radial-gradient(600px 300px at 20% 20%, transparent 40%, rgba(255,255,255,.06) 60%, transparent 80%);
  transform:rotate(5deg);
}
.cat::after{background: radial-gradient(500px 260px at 80% 60%, transparent 40%, rgba(255,255,255,.05) 60%, transparent 80%); transform:rotate(-8deg)}

/* Accent color halos per category */
.cat--live{background:
  linear-gradient(180deg, rgba(229,9,20,.10), rgba(229,9,20,.04)),
  repeating-linear-gradient(45deg, #15151c, #15151c 8px, #111118 8px, #111118 16px);
}
.cat--esports{background:
  linear-gradient(180deg, rgba(36,99,235,.10), rgba(36,99,235,.04)),
  repeating-linear-gradient(45deg, #15151c, #15151c 8px, #111118 8px, #111118 16px);
}
.cat--retro{background:
  linear-gradient(180deg, rgba(244,63,94,.10), rgba(244,63,94,.04)),
  repeating-linear-gradient(45deg, #15151c, #15151c 8px, #111118 8px, #111118 16px);
}
.cat--walkthroughs{background:
  linear-gradient(180deg, rgba(234,179,8,.12), rgba(234,179,8,.04)),
  repeating-linear-gradient(45deg, #15151c, #15151c 8px, #111118 8px, #111118 16px);
}
.cat--speedruns{background:
  linear-gradient(180deg, rgba(16,185,129,.12), rgba(16,185,129,.04)),
  repeating-linear-gradient(45deg, #15151c, #15151c 8px, #111118 8px, #111118 16px);
}

/* Section title glow stripe */
.section-title{position:relative;margin:14px 0 12px;font-size:1.25rem}
.section-title::after{
  content:""; position:absolute; left:0; bottom:-6px; width:120px; height:3px; border-radius:3px;
  background: linear-gradient(90deg, rgba(255,255,255,.7), rgba(255,255,255,0));
}

/* Cards: add subtle hover lift */
.card{transition:transform .18s ease, box-shadow .18s ease}
.card:hover{transform:translateY(-3px); box-shadow:0 10px 24px rgba(0,0,0,.25)}
.card .thumb{position:relative}
.card .thumb::after{
  content:""; position:absolute; inset:0; background:linear-gradient(180deg, transparent, rgba(0,0,0,.25));
}


/* Override brand color to logo blue */
:root{ --brand:#1138ff; }

.logo{height:40px;width:auto;vertical-align:middle}
.btn{background:var(--brand);}
.btn-ghost{border:2px solid var(--brand);color:var(--brand);background:transparent}
.btn-ghost:hover{background:rgba(10,45,143,.15)}

/* Members page */
.member-area{padding:30px 0;display:grid;gap:30px}
.profile-card{display:grid;gap:20px;grid-template-columns:160px 1fr;align-items:center;background:var(--panel);padding:20px;border-radius:20px}
.profile-avatar img{width:140px;height:140px;border-radius:50%;object-fit:cover;background:#1f1f29}
.profile-info textarea{width:100%;margin:10px 0;background:#0f0f15;color:#fff;border-radius:10px;padding:.6rem}
.profile-stats .stats-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(120px,1fr));gap:14px}
.stat{background:#1a1a22;border-radius:14px;padding:14px;text-align:center}
.stat h3{margin:0;font-size:1.6rem}
.profile-faves input{padding:.6rem;border-radius:10px;margin-right:8px;background:#0f0f15;color:#fff}


/* Brand image */
.brand-img{display:inline-block;width:40px;height:40px;object-fit:contain;border-radius:8px;background:transparent}
.brand span{font-weight:800}


/* Keep auth buttons pinned to the far right */
.nav{display:flex;gap:16px;align-items:center}
.auth-actions{margin-left:auto;display:flex;gap:12px}


/* Welcome chip */
.welcome-chip{background:#1e1e28;border:1px solid #2a2a34;border-radius:999px;padding:.35rem .65rem}


/* === Enhanced Footer === */
.enhanced-footer{
  margin-top: 32px;
  background:
    radial-gradient(800px 380px at 20% -10%, rgba(17,56,255,.20), transparent),
    linear-gradient(180deg, rgba(17,56,255,.08), rgba(17,56,255,.02));
  border-top: 1px solid #1f1f29;
  padding-top: 28px;
}
.footer-grid{
  display: grid;
  gap: 18px;
  grid-template-columns: 1.1fr 1fr 1fr 1fr;
}
@media (max-width: 980px){
  .footer-grid{ grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px){
  .footer-grid{ grid-template-columns: 1fr; }
}
.footer-brand .brand{ display:flex; align-items:center; gap:10px; font-weight:700; }
.footer-logo{ height:40px; width:auto; border-radius:8px; }
.footer-col h4{ margin: 4px 0 8px; font-size: 1rem; }
.footer-col ul{ list-style:none; padding:0; margin:0; display:grid; gap:6px; }
.footer-col a{ color: var(--muted); }
.footer-col a:hover{ color: #fff; }
.social{ display:flex; gap:10px; margin-top:10px; }
.sbtn{ display:grid; place-items:center; height:36px; width:36px; border-radius:10px; border:1px solid #2a2a34; background:#1b1b24; }
.sbtn:hover{ transform: translateY(-1px); }
.footer-bottom{ border-top: 1px solid #1f1f29; margin-top: 20px; }
.footer-bottom .container{ display:flex; justify-content:center; padding: 14px 0; }


/* Footer social icons white */
.sbtn svg, .sbtn svg path { fill: #fff; }



/* Match header/nav background to footer gradient */
.site-header{
  background:
    radial-gradient(800px 380px at 20% -10%, rgba(17,56,255,.20), transparent),
    linear-gradient(180deg, rgba(17,56,255,.08), rgba(17,56,255,.02));
  border-bottom: 1px solid #1f1f29;
}

/* Ensure nav links remain readable on the new background */
.site-header .nav a{ color:#fff; }
.site-header .nav a:hover{ opacity:.9; }

/* Buttons on header keep contrast */
.site-header .btn{ border-color:#2a2a34; }
.site-header .btn.btn-ghost{ background:transparent; }



/* === Mobile navigation & responsive tweaks === */
.nav-toggle{
  display:none;
  background:#1b1b24;
  border:1px solid #2a2a34;
  border-radius:12px;
  padding:8px;
  margin-left:12px;
}
.nav-toggle svg path{ fill:#fff; }

@media (max-width: 900px){
  .site-header .header-inner{ gap:10px; }
  .nav-toggle{ display:flex; align-items:center; justify-content:center; }
  .site-header .nav{
    position: absolute;
    top: 64px;
    right: 12px;
    left: 12px;
    background: var(--panel, #11131a);
    border: 1px solid #1f1f29;
    border-radius: 16px;
    padding: 14px;
    display: none;
    box-shadow: 0 10px 30px rgba(0,0,0,.35);
    z-index: 50;
  }
  .site-header .nav.open{ display: grid; gap: 10px; }
  .site-header .nav a,
  .site-header .nav .btn,
  .site-header .nav .btn-ghost{ width: 100%; text-align: left; }
  .site-header .nav .auth-actions{ margin-left: 0; display: grid; gap: 10px; }
  .brand-img{ height: 28px; }
  h1{ font-size: clamp(1.3rem, 4vw, 1.8rem); }
  h2{ font-size: clamp(1.1rem, 3.5vw, 1.4rem); }
  .container{ padding-left: 12px; padding-right: 12px; }
  .games-grid{ grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
  .card-panel{ padding: 12px; border-radius: 12px; }
  .statbar{ grid-template-columns: repeat(2,1fr); }
}

/* Slightly wider tablets */
@media (max-width: 680px){
  .statbar{ grid-template-columns: 1fr; }
  .grid-2{ display:block; }
}


/* === Auth Modals === */
.modal-backdrop{
  position: fixed; inset: 0;
  display: none;
  align-items: center; justify-content: center;
  background: rgba(8,10,18,.55);
  backdrop-filter: blur(6px);
  z-index: 100;
}
.modal-backdrop.open{ display:flex; }
.modal-card{
  width: min(640px, 92vw);
  background: var(--panel, #11131a);
  border: 1px solid #1f1f29;
  border-radius: 16px;
  padding: 18px;
  box-shadow: 0 20px 60px rgba(0,0,0,.45);
}
.modal-actions{ display:flex; gap:10px; justify-content:flex-end; margin-top:10px; }
.modal-close{
  position:absolute; top:10px; right:10px;
  background: transparent; border: 1px solid rgba(255,255,255,.25);
  color: #fff; font-size: 20px; line-height: 1; height: 36px; width: 36px; border-radius: 10px;
}
.modal-close:hover{ background: rgba(255,255,255,.1); }

.modal-card{ position: relative; }


/* Ensure white X close button is obvious */
.modal-close{
  color:#fff;
  border:1px solid rgba(255,255,255,.25);
  background:transparent;
  width:40px; height:40px;
  display:grid; place-items:center;
  font-weight:700; font-size:22px; line-height:1;
  cursor:pointer;
}
.modal-close:focus{ outline:2px solid rgba(255,255,255,.4); outline-offset:2px; }


/* Match section underline with primary button color */
.section-title::after,
.section h2::after,
.title-underline,
.section-underline,
.underline,
hr.section-rule {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent);
}


/* Generic small bar under headings */
h2 + .underline, h2 + .rule, h2 + .bar, .section h2 + div[class*="underline"] {
  background: var(--accent) !important;
  border-color: var(--accent) !important;
}


/* === Fading underline (brand blue → transparent) === */
:root{
  --brand-r: 17;
  --brand-g: 56;
  --brand-b: 255;
}
/* Pseudo-element under section titles */
.section-title::after,
.section h2::after{
  content: "";
  display: block;
  height: 2px;
  margin-top: 6px;
  background: linear-gradient(90deg, var(--brand), rgba(var(--brand-r), var(--brand-g), var(--brand-b), 0));
  border: 0;
}
/* Common small bar elements directly under headings */
h2 + .underline,
h2 + .rule,
h2 + .bar,
.section h2 + div[class*="underline"],
hr.section-rule{
  height: 2px;
  background: linear-gradient(90deg, var(--brand), rgba(var(--brand-r), var(--brand-g), var(--brand-b), 0)) !important;
  border: 0 !important;
}

/* === Hero background video === */
.hero{
  position: relative;
  min-height: clamp(360px, 60vh, 560px);
  display: grid;
  align-items: center;
  overflow: hidden;
  border-bottom: 1px solid #1f1f29;
  background:
    radial-gradient(800px 380px at 20% -10%, rgba(17,56,255,.15), transparent),
    linear-gradient(180deg, rgba(17,56,255,.06), rgba(17,56,255,.02));
}
.hero::after{
  /* subtle dark scrim for text contrast */
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,.35), rgba(0,0,0,.55));
  pointer-events: none;
  z-index: 0;
}
.hero-video{
  position: absolute; inset: 0;
  z-index: 0;
  pointer-events: none;
}
.hero-video video{
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  filter: saturate(1.1) brightness(.7);
}
.hero-content{
  position: relative;
  z-index: 1;
  padding: clamp(18px, 4vw, 28px) 0;
}
.hero h1{
  font-size: clamp(1.6rem, 5vw, 2.4rem);
  line-height: 1.15;
  margin: 0 0 8px 0;
}
.hero p.lead{
  color: var(--muted);
  margin: 0 0 14px 0;
}
.hero .search-row{
  display: grid; grid-template-columns: 1fr auto; gap: 10px;
  max-width: 640px;
}
@media (max-width: 680px){
  .hero .search-row{ grid-template-columns: 1fr; }
}


/* === Category Tiles Background (lazy) === */
.cat{ position: relative; overflow: hidden; }
.cat.has-cat-bg{ /* ensure stacking context for header art */ }
.cat.has-cat-bg::before{
  content:"";
  position:absolute; left:12px; right:12px; top:6px;
  height: 160px;
  border-radius: 16px;
  background-image: var(--bg-url);
  background-size: cover; background-position: center;
  filter: saturate(1.05) brightness(.75);
  z-index: 0;
}
.cat.has-cat-bg::after{
  /* readable text overlay */
  content:""; position:absolute; left:12px; right:12px; top:6px; height:160px; border-radius:16px;
  background: linear-gradient(180deg, rgba(0,0,0,.15), rgba(0,0,0,.55));
  z-index: 0;
}
.cat.has-cat-bg > .section-title{ position: relative; z-index: 1; padding: 16px 16px 10px 16px; margin: 0 12px; }
.cat.has-cat-bg > .row-scroller{ position: relative; z-index: 1; margin-top: 8px; }
@media (max-width: 900px){
  .cat.has-cat-bg::before, .cat.has-cat-bg::after{ left:8px; right:8px; height: 140px; }
  .cat.has-cat-bg > .section-title{ margin: 0 8px; padding: 14px 14px 8px; }
}
@media (max-width: 600px){
  .cat.has-cat-bg::before, .cat.has-cat-bg::after{ left:6px; right:6px; height: 120px; }
}
/* Respect reduced data */
@media (prefers-reduced-data: reduce){
  .cat.has-cat-bg::before{ background-image: none !important; }
}


/* === Category BG (reliable child layer) === */
.cat{ position: relative; }
.cat .cat-bg{
  position:absolute; left:12px; right:12px; top:6px; height:160px;
  background:#0f111a; background-size:cover; background-position:center;
  border-radius:16px; filter:saturate(1.05) brightness(.75);
  z-index:0;
}
.cat .cat-bg::after{
  content:""; position:absolute; inset:0; border-radius:inherit;
  background: linear-gradient(180deg, rgba(0,0,0,.15), rgba(0,0,0,.55));
}
.cat > .section-title{ position:relative; z-index:1; margin:0 12px; padding:16px 16px 10px; }
.cat > .row-scroller{ position:relative; z-index:1; margin-top:8px; }
@media (max-width: 900px){
  .cat .cat-bg{ left:8px; right:8px; height:140px; }
  .cat > .section-title{ margin:0 8px; padding:14px 14px 8px; }
}
@media (max-width: 600px){
  .cat .cat-bg{ left:6px; right:6px; height:120px; }
}
@media (prefers-reduced-data: reduce){
  .cat .cat-bg{ background-image:none !important; }
}


/* === Stream Card Thumbnails === */
.card .thumb,
.item .thumb,
.stream .thumb{
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  display: block;
}
/* Ensure text doesn't sit under the thumb if injected */
.card .thumb + *,
.item .thumb + *,
.stream .thumb + *{ position: relative; }


/* === Simple stream card thumbnail === */
.thumb{
  height: 140px; /* adjust if your cards need taller hero */
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  border-radius: 14px;
  margin-bottom: 10px;
}
@media (max-width: 700px){
  .thumb{ height: 120px; }
}
