/* SpaceGate Nova v3 - fixes for sports filtering layout, responsive cards and download UX */
html{scrollbar-gutter:stable;}
.rail,.grid,.episodes-grid-shahid,.sg-starz-grid,.sg-match-grid{min-width:0;}
.rail{scroll-behavior:smooth;}
.card,.pro-card{min-width:0;contain:layout paint;}
.card-meta-bottom{min-width:0;overflow:hidden;}
.card b,.card small,.card-meta-bottom b,.card-meta-bottom small{max-width:100%;overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-box-orient:vertical;word-break:break-word;overflow-wrap:anywhere;}
.card b,.card-meta-bottom b{-webkit-line-clamp:2;line-height:1.32;min-height:2.55em;}
.card small,.card-meta-bottom small{-webkit-line-clamp:1;}
.pro-card .poster,.top-card .poster{isolation:isolate;}
.sg-preview-video,.sg-preview-img{pointer-events:none;}

/* Starz/Shahid episode cards: keep text inside the card on all desktop sizes */
.sg-starz-grid{grid-template-columns:repeat(auto-fit,minmax(min(100%,520px),1fr));align-items:stretch;}
.sg-starz-episode{width:100%;min-width:0;grid-template-columns:minmax(170px,32%) minmax(0,1fr);}
.sg-starz-episode .episode-info{min-width:0;overflow:hidden;align-items:flex-start;}
.sg-starz-episode .episode-title-btn{max-width:100%;min-width:0;overflow:hidden;text-overflow:ellipsis;display:block;}
.sg-starz-episode .episode-title-btn b{max-width:100%;overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;line-height:1.35;}
.sg-starz-episode .episode-info p{max-width:100%;overflow-wrap:anywhere;}
.sg-episode-actions{width:100%;min-width:0;}
.episode-watch-mini,.episode-download{max-width:100%;white-space:nowrap;}

/* Sports/live cards */
.sg-sports-page,.sg-live-page{overflow:hidden;}
.sg-match-grid{grid-template-columns:repeat(auto-fit,minmax(min(100%,300px),1fr));}
.sg-match-card{min-width:0;grid-template-columns:minmax(96px,34%) minmax(0,1fr);}
.sg-match-card>div:last-child{min-width:0;overflow:hidden;}
.sg-match-card b,.sg-match-card small,.sg-match-card em{max-width:100%;overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-box-orient:vertical;}
.sg-match-card b{-webkit-line-clamp:2;}
.sg-match-card small,.sg-match-card em{-webkit-line-clamp:1;}

/* In-site download launcher */
.sg-download-toast{position:fixed;z-index:9998;inset-inline-start:18px;bottom:92px;width:min(390px,calc(100vw - 36px));background:rgba(15,19,28,.96);border:1px solid rgba(255,255,255,.12);box-shadow:0 22px 55px rgba(0,0,0,.45);border-radius:22px;padding:14px 16px;display:grid;gap:8px;color:#fff;backdrop-filter:blur(16px);}
.sg-download-toast b{font-size:.98rem;font-weight:1000;}
.sg-download-toast small{color:var(--muted);line-height:1.6;font-weight:700;}
.sg-download-toast a{justify-self:start;color:#061018;background:var(--cyan);border-radius:999px;padding:8px 14px;font-weight:1000;text-decoration:none;}
.sg-download-toast button{position:absolute;top:8px;inset-inline-end:8px;width:26px;height:26px;border:0;border-radius:50%;background:rgba(255,255,255,.1);color:#fff;cursor:pointer;}
#sgDownloadFrame{position:absolute!important;width:1px!important;height:1px!important;border:0!important;clip:rect(0 0 0 0)!important;clip-path:inset(50%)!important;overflow:hidden!important;}

@media (min-width:1400px){
  .rail .card{width:clamp(160px,9.5vw,205px);}
}
@media (max-width:1280px){
  .sg-starz-episode{grid-template-columns:minmax(150px,36%) minmax(0,1fr);}
  .sg-starz-episode .episode-info{padding:16px;}
}
@media (max-width:980px){
  .sg-starz-grid{grid-template-columns:1fr;}
  .sg-starz-episode{grid-template-columns:minmax(160px,34%) minmax(0,1fr);}
}
@media (max-width:720px){
  .sg-starz-episode{grid-template-columns:1fr;}
  .sg-starz-episode .episode-thumb{height:190px;min-height:190px;}
  .sg-starz-episode .episode-info{padding:14px;}
  .sg-match-card{grid-template-columns:104px minmax(0,1fr);border-radius:16px;}
  .rail .card{width:145px;}
  .card b,.card-meta-bottom b{font-size:.88rem;}
}
@media (max-width:420px){
  .rail .card{width:132px;}
  .sg-match-card{grid-template-columns:92px minmax(0,1fr);}
  .sg-match-card>div:last-child{padding:12px;}
  .episode-watch-mini,.episode-download{height:32px;padding:0 10px;font-size:.8rem;}
}
