/* ZERO TWO Scripts page, premium cleanup (v1). Loaded last. Scoped to the Scripts page only. */

/* 1. One header, not two: hide the generic page banner, the repeated "new arrivals" strip and the ticker */
body[data-px-route="scripts"] .fx-banner,
body[data-px-route="scripts"] .fx-ticker,
body[data-px-route="scripts"] #pxTickHost{display:none!important}

/* 2. Hero: calm, static, same language as the home page */
html body #view-scripts .sx-hero{margin:clamp(12px,2vw,22px) auto 20px;border-radius:clamp(22px,3vw,30px);
  background:radial-gradient(700px 380px at 90% 0%,rgba(122,82,240,.5),transparent 65%),linear-gradient(155deg,#1d0f45 0%,#12082b 60%,#0b0618 100%);
  box-shadow:0 30px 60px -36px rgba(40,10,100,.75),inset 0 0 0 1px rgba(255,255,255,.08)}
html body #view-scripts .sx-art{width:48%;opacity:.55;animation:none;filter:saturate(1) contrast(1)}
html body #view-scripts .sx-orb,html body #view-scripts .sx-scan,html body #view-scripts .sx-grid{display:none}
html body #view-scripts .sx-in{padding:clamp(24px,4vw,48px);gap:clamp(20px,3vw,40px);align-items:center}
html body #view-scripts .sx-kick{border-color:rgba(233,201,130,.4);background:rgba(233,201,130,.1);color:#e9c982;font-family:'Inter',sans-serif;letter-spacing:.14em}
html body #view-scripts .sx-kick em{display:none}
html body #view-scripts .sx-live{background:#e9c982}
html body #view-scripts .sx-live::after{display:none}
html body #view-scripts .sx-hero h1{font:700 clamp(2.2rem,4.6vw,3.4rem)/1.05 'Space Grotesk','Inter',sans-serif!important;letter-spacing:-.025em!important;
  background:none;-webkit-text-fill-color:#fff;color:#fff!important}
html body #view-scripts .sx-hero p{color:rgba(255,255,255,.78)!important;font-size:1.02rem;max-width:40ch}
html body #view-scripts .sx-search{height:56px;border-radius:999px;background:#fff;border:1px solid rgba(255,255,255,.4);box-shadow:0 16px 34px -18px rgba(0,0,0,.6)}
html body #view-scripts .sx-search svg{stroke:#5b2fd0}
html body #view-scripts .sx-search input{color:#14102a!important}
html body #view-scripts .sx-search input::placeholder{color:#7a7394}
html body #view-scripts .sx-search kbd{border-color:#d8d0ee;background:#f5f1fa;color:#5b2fd0}
html body #view-scripts .sx-search:focus-within{border-color:#7a52f0;box-shadow:0 0 0 4px rgba(122,82,240,.3),0 16px 34px -18px rgba(0,0,0,.6)}
html body #view-scripts .sx-stats{gap:10px}
html body #view-scripts .sx-stat{padding:16px 18px;border-radius:16px;background:rgba(255,255,255,.07);border:1px solid rgba(255,255,255,.14);backdrop-filter:none;-webkit-backdrop-filter:none;animation:none}
html body #view-scripts .sx-stat::before{display:none}
html body #view-scripts .sx-stat b{font-family:'Space Grotesk','Inter',sans-serif;font-weight:700;color:#fff}
html body #view-scripts .sx-stat span{font-family:'Inter',sans-serif;font-weight:600;letter-spacing:.1em;color:rgba(255,255,255,.62)}
html body #view-scripts .sx-stat-new.has b{color:#e9c982;text-shadow:none}

/* 3. Toolbar + filters */
html body #view-scripts .sc-tools{border-radius:16px;background:#fff!important;border:1px solid rgba(64,20,112,.12)!important;box-shadow:0 10px 24px -20px rgba(67,20,120,.5)}
html body #view-scripts .sc-count{font-family:'Inter',sans-serif;font-weight:700;letter-spacing:.06em;color:#5b2fd0!important}
html body #view-scripts .chip{font-family:'Inter',sans-serif;border-radius:999px!important}
html body #view-scripts .chip.on{background:#1d0f45!important;box-shadow:none}

/* 4. Cards: three across on desktop, readable code preview, tighter rhythm */
html body #view-scripts #cards{display:grid;grid-template-columns:repeat(auto-fill,minmax(320px,1fr));gap:20px}
html body #view-scripts #cards>.ig-post{border-radius:20px;border:1px solid rgba(64,20,112,.12);box-shadow:0 1px 2px rgba(33,10,60,.04),0 18px 40px -30px rgba(67,20,120,.4);transition:transform .25s,box-shadow .25s}
html body #view-scripts #cards>.ig-post:hover{transform:translateY(-3px);box-shadow:0 26px 48px -28px rgba(67,20,120,.5)}
html body #view-scripts #cards>.ig-post .ig-media{aspect-ratio:auto;height:128px;background:#15102b}
html body #view-scripts #cards>.ig-post .ig-media pre{color:#d7ccf7;font-size:12px;padding:16px 18px}
html body #view-scripts #cards>.ig-post .ig-media .ig-lang{background:rgba(255,255,255,.12);color:#fff}
html body #view-scripts #cards>.ig-post .ig-dlbtn{border-radius:12px;background:linear-gradient(180deg,#f3dba0,#c9a24f);color:#1a1030;box-shadow:none}
html body #view-scripts #cards>.ig-post .ig-dlbtn svg{color:#1a1030}
html body #view-scripts #cards>.ig-post .ig-dlbtn small{color:rgba(26,16,48,.65)}

@media (max-width:900px){
  html body #view-scripts .sx-in{grid-template-columns:1fr}
  html body #view-scripts .sx-art{width:100%;opacity:.28}
  html body #view-scripts .sx-stats{grid-template-columns:repeat(4,1fr)}
  html body #view-scripts .sx-stat{padding:12px}
}
@media (max-width:640px){
  html body #view-scripts #cards{grid-template-columns:1fr!important}
  html body #view-scripts .sx-stats{grid-template-columns:1fr 1fr}
}

/* ---- v2: compact banner: no anime art, no hero search, no extra text ---- */
html body #view-scripts .sx-art,
html body #view-scripts .sx-kick,
html body #view-scripts .sx-copy p,
html body #view-scripts .sx-search{display:none!important}
html body #view-scripts .sx-hero{margin:clamp(10px,1.6vw,16px) auto 14px;border-radius:20px}
html body #view-scripts .sx-in{grid-template-columns:auto 1fr;padding:18px clamp(18px,3vw,28px);gap:20px;align-items:center}
html body #view-scripts .sx-hero h1{font-size:clamp(1.6rem,3vw,2.1rem)!important}
html body #view-scripts .sx-stats{grid-template-columns:repeat(4,auto);justify-content:end;gap:8px}
html body #view-scripts .sx-stat{display:flex;align-items:baseline;gap:8px;padding:9px 14px;border-radius:12px}
html body #view-scripts .sx-stat b{font-size:1.15rem}
html body #view-scripts .sx-stat span{font-size:10px}
@media (max-width:900px){
  html body #view-scripts .sx-in{grid-template-columns:1fr;gap:12px;padding:16px}
  html body #view-scripts .sx-stats{grid-template-columns:repeat(2,1fr);justify-content:stretch}
}
/* phones have no search in the top bar, so keep one slim search there */
@media (max-width:640px){
  html body #view-scripts .sx-search{display:flex!important;width:100%;height:46px;margin:0}
}

/* ---- v3: New arrivals back on (compact row) + anime on the phone banner ---- */
html body #view-scripts #arrivals[hidden]{display:none!important}
html body #view-scripts .arrivals{width:100%;margin:0 0 16px;padding:14px 16px 4px;border-radius:18px;background:#fff;border:1px solid rgba(64,20,112,.12);box-shadow:0 10px 24px -22px rgba(67,20,120,.5)}
html body #view-scripts .arr-head h2{font-family:'Space Grotesk','Inter',sans-serif;font-size:1.05rem}
html body #view-scripts .arr-card{border-radius:14px;background:#faf8ff;border-color:rgba(64,20,112,.1)}
@media (max-width:640px){
  html body #view-scripts .sx-art{display:block!important;width:70%;opacity:.5;right:0;
    -webkit-mask:linear-gradient(270deg,#000 20%,transparent 95%);mask:linear-gradient(270deg,#000 20%,transparent 95%)}
  html body #view-scripts .sx-art::after{display:none}
  html body #view-scripts .sx-hero h1{text-shadow:0 2px 14px rgba(10,5,30,.6)}
  html body #view-scripts .sx-in{padding:14px 14px 14px}
  html body #view-scripts .arrivals{padding:12px 12px 2px}
}
@media (max-width:640px){
  html body #view-scripts .sx-stats{grid-template-columns:repeat(4,1fr);gap:6px}
  html body #view-scripts .sx-stat{display:grid;gap:2px;padding:8px 6px;text-align:center;border-radius:10px}
  html body #view-scripts .sx-stat b{font-size:1rem}
  html body #view-scripts .sx-stat span{font-size:8.5px;letter-spacing:.06em}
}

/* ================= v4: no-overflow guarantee + polish ================= */
html body #view-scripts{overflow-x:clip;max-width:100%}
html body #view-scripts .wrap,html body #view-scripts #cards,html body #view-scripts #cards>*{min-width:0;max-width:100%}
html body #view-scripts #cards .ig-post{overflow:hidden}
html body #view-scripts #cards .ig-post h3,html body #view-scripts #cards .ig-post .ig-desc,html body #view-scripts #cards .ig-tags{overflow-wrap:anywhere;word-break:break-word}
html body #view-scripts #cards .ig-post .ig-media pre{white-space:pre-wrap;word-break:break-all;overflow:hidden}
html body #view-scripts .chips{max-width:100%;overflow-x:auto;scrollbar-width:none}
html body #view-scripts .chips::-webkit-scrollbar{display:none}
html body #view-scripts .sc-tools{display:grid;grid-template-columns:1fr auto auto;align-items:center;gap:10px}
html body #view-scripts .sc-tools .spacer{display:none}
html body #view-scripts .sc-tools>*{min-width:0}
html body #view-scripts .sc-sort select{max-width:100%}
html body #view-scripts .sc-tools #zipAllTop{grid-column:1/-1}
html body #view-scripts .arr-row{max-width:100%}
html body #view-scripts .arr-card{flex:0 0 min(270px,78%)}
@media (max-width:640px){
  html body #view-scripts .sc-tools{grid-template-columns:1fr 1fr;padding:10px 12px!important}
  html body #view-scripts .sc-tools .sc-count{grid-column:1/-1}
  html body #view-scripts .sc-sort,html body #view-scripts .sc-sort select{width:100%}
  html body #view-scripts .newtog{width:100%;justify-content:center}
  html body #view-scripts #cards>.ig-post{border-radius:18px}
}

/* ================= Developer controls (only rendered for Developer accounts) ================= */
.dv{margin:0 0 14px;border-radius:18px;background:linear-gradient(155deg,#1d0f45,#12082b);color:#fff;box-shadow:0 18px 40px -28px rgba(40,10,100,.8),inset 0 0 0 1px rgba(255,255,255,.08);overflow:hidden;max-width:100%}
.dv *{box-sizing:border-box;min-width:0}
.dv svg{width:16px;height:16px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
.dv-head{display:flex;align-items:center;gap:10px;padding:12px 14px 12px 16px}
.dv-head b{font:700 1rem/1 'Space Grotesk','Inter',sans-serif;letter-spacing:-.01em}
.dv-tag{display:inline-flex;align-items:center;gap:6px;padding:5px 10px 5px 8px;border-radius:999px;background:rgba(233,201,130,.14);border:1px solid rgba(233,201,130,.4);color:#e9c982;font:700 10.5px/1 'Inter',sans-serif;letter-spacing:.1em;text-transform:uppercase}
.dv-tag svg{width:13px;height:13px}
.dv-fold{margin-left:auto;display:grid;place-items:center;width:36px;height:36px;border-radius:50%;border:1px solid rgba(255,255,255,.18);background:rgba(255,255,255,.06);color:#fff;cursor:pointer;transition:transform .2s}
.dv-fold[aria-expanded="false"]{transform:rotate(-90deg)}
.dv-body{padding:0 16px 16px;display:grid;gap:12px}
.dv-body[hidden]{display:none}
.dv-stats{margin:0;display:grid;grid-template-columns:repeat(4,1fr);gap:8px}
.dv-stats>div{padding:10px 12px;border-radius:12px;background:rgba(255,255,255,.07);border:1px solid rgba(255,255,255,.1)}
.dv-stats dt{font:600 10px/1.2 'Inter',sans-serif;letter-spacing:.1em;text-transform:uppercase;color:rgba(255,255,255,.6)}
.dv-stats dd{margin:4px 0 0;font:700 1.25rem/1 'Space Grotesk','Inter',sans-serif;font-variant-numeric:tabular-nums}
.dv-top{margin:0;font-size:12.5px;color:rgba(255,255,255,.7);overflow-wrap:anywhere}
.dv-top b{color:#fff}
.dv-row{display:flex;flex-wrap:wrap;gap:10px;align-items:center;justify-content:space-between}
.dv-chips,.dv-tools{display:flex;flex-wrap:wrap;gap:8px}
.dv-chip,.dv-btn{height:36px;padding:0 14px;border-radius:999px;border:1px solid rgba(255,255,255,.2);background:rgba(255,255,255,.06);color:#fff;font:600 13px/1 'Inter',sans-serif;cursor:pointer;transition:background .2s,border-color .2s}
.dv-chip:hover,.dv-btn:hover{background:rgba(255,255,255,.14)}
.dv-chip.on,.dv-btn.on{background:linear-gradient(180deg,#f3dba0,#c9a24f);border-color:transparent;color:#1a1030}
.dv-note{margin:0;font-size:12.5px;color:#e9c982}
.dv-note:empty{display:none}
.dv button:focus-visible,.dv-bar button:focus-visible{outline:3px solid #a78bfa;outline-offset:2px}

/* selection on cards */
#cards .ig-post.dv-hide{display:none!important}
#cards.dv-selmode .ig-post{cursor:pointer;-webkit-tap-highlight-color:transparent}
#cards.dv-selmode .ig-post.dv-on{box-shadow:0 0 0 3px #7a52f0,0 24px 48px -26px rgba(67,20,120,.6)!important}
.dv-chk{position:absolute;top:12px;right:12px;z-index:5;display:grid;place-items:center;width:28px;height:28px;border-radius:50%;background:#fff;border:2px solid #b9a7ee;pointer-events:none}
.dv-chk svg{width:16px;height:16px;fill:none;stroke:#fff;stroke-width:3;stroke-linecap:round;stroke-linejoin:round;opacity:0}
.ig-post.dv-on .dv-chk{background:#5b2fd0;border-color:#5b2fd0}
.ig-post.dv-on .dv-chk svg{opacity:1}

/* bulk bar */
.dv-bar{position:fixed;left:50%;transform:translateX(-50%);bottom:calc(20px + env(safe-area-inset-bottom,0px));z-index:900;width:min(720px,calc(100% - 24px));display:flex;align-items:center;gap:12px;padding:10px 12px;border-radius:18px;background:#14102a;color:#fff;box-shadow:0 24px 50px -16px rgba(0,0,0,.6),inset 0 0 0 1px rgba(255,255,255,.12)}
.dv-bar[hidden]{display:none}
.dv-bar.busy{opacity:.7;pointer-events:none}
.dv-count{font-size:13px;white-space:nowrap}.dv-count b{font-size:1.1rem}
.dv-acts{display:flex;flex-wrap:wrap;gap:8px;flex:1;min-width:0}
.dv-bar button{height:36px;padding:0 12px;border-radius:10px;border:1px solid rgba(255,255,255,.2);background:rgba(255,255,255,.08);color:#fff;font:600 12.5px/1 'Inter',sans-serif;cursor:pointer}
.dv-bar .dv-acts button:hover{background:rgba(255,255,255,.18)}
.dv-bar .dv-clear{background:transparent}
@media (max-width:640px){
  .dv-stats{grid-template-columns:repeat(2,1fr)}
  .dv-row{flex-direction:column;align-items:stretch}
  .dv-tools{display:grid;grid-template-columns:1fr 1fr}
  .dv-chips{display:grid;grid-template-columns:repeat(4,1fr)}
  .dv-chip{padding:0 4px;font-size:12px}
  .dv-bar{bottom:calc(92px + env(safe-area-inset-bottom,0px));flex-wrap:wrap;gap:8px}
  .dv-count{order:1}.dv-clear{order:2;margin-left:auto}
  .dv-acts{order:3;flex:0 0 100%;display:grid;grid-template-columns:1fr 1fr}
}

/* compact view (Developer toggle) */
#cards.dv-compact{grid-template-columns:1fr!important;gap:10px!important}
#cards.dv-compact .ig-post{display:grid!important;grid-template-columns:1fr auto;grid-template-areas:"head dl" "title dl";gap:0 14px;align-items:center;padding:12px 16px!important}
#cards.dv-compact .ig-post .ig-head{grid-area:head;padding:0!important}
#cards.dv-compact .ig-post .ig-title{grid-area:title;padding:0!important}
#cards.dv-compact .ig-post .ig-dlbtn{grid-area:dl;width:auto!important;margin:0!important;white-space:nowrap}
#cards.dv-compact .ig-post .ig-media,#cards.dv-compact .ig-post .post-acts,#cards.dv-compact .ig-post .ig-tags,#cards.dv-compact .ig-post .ig-desc,#cards.dv-compact .ig-post .ig-more,#cards.dv-compact .ig-post [class*="stats"]{display:none!important}
@media (max-width:640px){#cards.dv-compact .ig-post{grid-template-columns:1fr;grid-template-areas:"head" "title" "dl"}#cards.dv-compact .ig-post .ig-dlbtn{width:100%!important}}
html body #view-scripts .newtog{white-space:nowrap;font-size:13px;padding:0 12px}
html body #view-scripts .sc-sort select{min-width:0;width:100%}
