/* The public library pages /scripts and /scripts/<id>, laid out from tradingview.com's script pages (2026-10-06):
   listing: 56px/600 centred title, 48px round chips (#f2f2f2, active #2e2e2e), 3 cards per row (r16, 16:9 picture r8
   with an 11px/600 INDICATOR / STRATEGY badge, 18px/24 title, three 16px/24 lines, 'by author' and date 14px, the
   comments and boosts pills 40px r8 at the right); page: 11px badges, 36px/46 title, Chart | Source code chips 34px
   r17, the picture, 'Use on chart' 40px r8 bordered, 16px/24 description in a 660px column, 313px side column.
   Round 31: on the shared shell (site.css, linked first: header, footer, tokens); black page in dark, pill filters, display-font titles over the glow. */
:root { --bg:var(--sx-bg); --t:var(--sx-text); --d:var(--sx-dim); --l:var(--sx-line); --chip:#1f1f1f; --chipon:#f2f2f2; --blue:#5b8cff; --h:#121212; --box:rgba(41,98,255,.14); --code:#0b0b0b; }
@media (prefers-color-scheme: light) { :root { --chip:#f2f2f2; --chipon:#0f0f0f; --blue:#2962ff; --h:#f5f6f8; --box:#e3effd; --code:#f9f9f9; } }
body { color:var(--t); font-size:14px; line-height:20px; overflow-x:hidden; }
#main { background:var(--sx-glow) no-repeat center top / 100% 560px; min-height:60vh; }
a { color:var(--blue); text-decoration:none; }
.wrap { padding:0 40px 72px; max-width:1440px; margin:0 auto; }
.crumbs { font-size:14px; color:var(--d); padding:22px 0 0; } .crumbs a { color:var(--d); } .crumbs span { color:var(--sx-body); }
h1.big { text-align:center; font:600 clamp(40px, 5.5vw, 64px)/1.08 var(--sx-display); letter-spacing:-.035em; margin:56px 0 36px; }
.chips { display:flex; justify-content:center; gap:16px; flex-wrap:wrap; }
.chips a { display:inline-flex; align-items:center; gap:8px; height:48px; padding:0 24px; border-radius:24px; background:var(--chip); border:1px solid var(--l); color:var(--t); font-size:16px; font-weight:500; transition:background .15s; }
.chips a.on { border-color:var(--chipon); }
.chips a:hover { background:var(--sx-card2); }
.chips a.on { background:var(--chipon); color:var(--bg); }
.tools { display:flex; justify-content:flex-end; align-items:center; margin:46px 0 24px; gap:12px; }
.tools select, .tools input { height:40px; border:1px solid var(--sx-line2); border-radius:40px; background:var(--sx-bg2); color:var(--t); font:14px var(--sx-ui); padding:0 16px; outline:none; }
.tools input { width:260px; max-width:100%; } .tools input:focus, .tools select:focus { border-color:var(--sx-accent); }
.grid { display:grid; grid-template-columns:repeat(3, minmax(0, 1fr)); gap:24px 32px; }
@media (max-width: 1100px) { .grid { grid-template-columns:repeat(2, minmax(0, 1fr)); } h1.big { font-size:40px; line-height:48px; } }
@media (max-width: 700px) { .grid { grid-template-columns:1fr; } .wrap { padding:0 16px 48px; } h1.big { margin:36px 0 24px; } .chips { gap:8px; } .chips a { height:40px; padding:0 18px; font-size:15px; } .tools { margin:28px 0 20px; justify-content:stretch; } .tools input, .tools select { flex:1 1 100%; width:auto; } h1.t { font-size:28px; line-height:36px; } }
.card { border-radius:16px; padding:8px 8px 14px; display:flex; flex-direction:column; border:1px solid transparent; transition:background .15s, border-color .15s; }
.card:hover { background:var(--h); border-color:var(--l); }
.card .pic { position:relative; display:block; aspect-ratio:16 / 9; border-radius:12px; background:#0f0f0f; overflow:hidden; border:1px solid var(--l); }
.card .pic img { width:100%; height:100%; object-fit:cover; display:block; }
.card .pic .ph { position:absolute; inset:0; display:flex; align-items:center; justify-content:center; color:#4a4a4a; font-size:14px; }
.badge { position:absolute; right:8px; top:8px; height:20px; line-height:20px; padding:0 6px; border-radius:4px; font-size:11px; font-weight:600; letter-spacing:.2px; text-transform:uppercase; background:rgba(8,153,80,.15); color:#3fc07a; }
.badge.s { background:rgba(242,54,69,.15); color:#ff6b7a; }
@media (prefers-color-scheme: light) { .badge { color:#004d27; } .badge.s { color:#8a1c25; } }
.card h3 { margin:16px 0 8px; font-size:18px; line-height:24px; font-weight:600; } .card h3 a { color:var(--t); }
.card p { margin:0; font-size:16px; line-height:24px; display:-webkit-box; -webkit-line-clamp:3; -webkit-box-orient:vertical; overflow:hidden; color:var(--t); }
.card .by { margin-top:12px; display:flex; align-items:flex-end; justify-content:space-between; }
.card .by .a { font-size:14px; line-height:18px; } .card .by .a a { color:var(--t); } .card .by time { display:block; font-size:14px; color:var(--d); margin-top:4px; }
.pill { display:inline-flex; align-items:center; gap:4px; height:40px; padding:0 12px; border-radius:8px; color:var(--t); font-size:16px; }
.pill svg { width:28px; height:28px; } .pill:hover { background:var(--h); }
.pill.b { border:1px solid var(--l); } .pill.on { color:var(--blue); border-color:var(--blue); }
.pill.bb { border:1px solid var(--sx-btn); background:var(--sx-btn); color:var(--sx-btn-text); font-size:15px; font-weight:500; padding:0 16px; } .pill.bb:hover { background:var(--sx-btn-hover); }
.empty { text-align:center; color:var(--d); font-size:16px; padding:60px 0; }
/* the script's page */
.tags { display:flex; align-items:center; gap:8px; margin-top:22px; font-size:14px; color:var(--d); }
.tag { height:20px; line-height:20px; padding:0 8px; border-radius:4px; font-size:11px; font-weight:600; text-transform:uppercase; background:rgba(41,98,255,.15); color:#7aa2ff; }
.tag.g { background:var(--chip); color:var(--d); } .tag.p { background:transparent; color:#7aa2ff; padding:0; display:inline-flex; align-items:center; gap:4px; }
@media (prefers-color-scheme: light) { .tag { color:#143eb2; } .tag.p { color:#143eb2; } }
h1.t { font:600 40px/48px var(--sx-display); letter-spacing:-.025em; margin:14px 0 20px; }
.row { display:flex; align-items:center; gap:8px; }
.seg a { display:inline-flex; align-items:center; height:34px; padding:0 16px; border-radius:17px; background:var(--chip); color:var(--t); font-size:16px; } .seg a.on { background:var(--chipon); color:var(--bg); }
.view { margin-top:16px; border:1px solid var(--l); border-radius:16px; overflow:hidden; background:#0f0f0f; min-height:200px; }
.view img { display:block; width:100%; }
.view .none { height:380px; display:flex; align-items:center; justify-content:center; color:#6b6b6b; font-size:16px; }
.code { background:var(--code); border:1px solid var(--l); border-radius:12px; max-height:520px; overflow:auto; font:13px/18px Consolas, Menlo, monospace; }
.code table { border-collapse:collapse; } .code td { padding:0 12px; white-space:pre; vertical-align:top; } .code td.n { color:var(--d); text-align:right; user-select:none; padding-right:4px; width:1%; }
.lines { height:34px; display:flex; align-items:center; justify-content:center; gap:6px; margin:10px 0 0; background:var(--chip); border-radius:8px; font-size:14px; }
.prot { padding:32px; text-align:center; color:var(--d); font-size:16px; line-height:24px; }
.cols { display:flex; gap:48px; margin-top:24px; }
.main { flex:1 1 660px; max-width:760px; min-width:0; }
.side { flex:0 0 313px; }
@media (max-width: 900px) { .cols { flex-direction:column; gap:32px; } .main, .side { flex:none; } }
.desc { font-size:16px; line-height:26px; overflow-wrap:anywhere; color:var(--sx-body); } .desc b { color:var(--t); }
.desc p { margin:0 0 24px; } .desc h3 { font-size:16px; font-weight:600; margin:24px 0 8px; border-left:6px solid var(--t); padding-left:10px; text-transform:uppercase; }
.desc ul, .desc ol { margin:0 0 24px; padding-left:24px; } .desc blockquote { margin:0 0 24px; padding-left:14px; border-left:3px solid var(--l); color:var(--d); }
.desc code { font-family:Consolas, Menlo, monospace; font-size:14px; background:var(--chip); border-radius:4px; padding:1px 4px; } .desc pre { background:var(--code); border:1px solid var(--l); border-radius:8px; padding:12px; overflow:auto; } .desc pre code { background:none; padding:0; }
.desc .snap { display:block; margin:8px 0 16px; } .desc .snap img { display:block; width:100%; height:auto; border-radius:8px; border:1px solid var(--l); }
.ibox { background:var(--box); border:1px solid var(--l); border-radius:16px; padding:18px 18px 20px; color:var(--sx-body); font-size:14px; line-height:20px; } .ibox b { display:block; font-size:16px; margin-bottom:6px; color:var(--t); }
.author { display:flex; align-items:center; gap:12px; margin-top:28px; padding-bottom:16px; border-bottom:1px solid var(--l); font-size:16px; font-weight:600; }
.author .av { width:32px; height:32px; border-radius:50%; background:#5b9cf6; color:#fff; display:flex; align-items:center; justify-content:center; font-size:14px; }
.author a { color:var(--t); }
.tagchips { display:flex; flex-wrap:wrap; gap:8px; margin-top:20px; } .tagchips a { height:28px; line-height:28px; padding:0 10px; border-radius:8px; background:var(--chip); color:var(--t); font-size:14px; }
.disc { color:var(--d); font-size:12px; line-height:16px; margin-top:30px; } .disc b { display:block; color:var(--t); font-size:14px; margin-bottom:4px; }
.rulesband { border-top:1px solid var(--l); }
.rules { max-width:960px; margin:0 auto; padding:56px 40px 16px; color:var(--d); font-size:14px; line-height:22px; }
.rules h2 { font:600 22px/1.3 var(--sx-display); color:var(--t); margin:0 0 12px; } .rules ul { padding-left:20px; }
.rulesband + .sx-foot { margin-top:16px; }
@media (max-width: 700px) { .rules { padding:40px 16px 8px; } }
.btnrow { display:flex; align-items:center; gap:12px; margin-top:20px; }
.btnrow .views { margin-left:auto; display:inline-flex; align-items:center; gap:6px; color:var(--d); }
.mine { margin-left:auto; display:flex; gap:12px; }
button.lnk { border:0; background:none; color:#f23645; font:inherit; cursor:pointer; }
/* the shared top bar is ~18px wider than a 390px phone (brand + both buttons); tighten it here until site.css does */
@media (max-width: 420px) { .sx-top { gap: 8px; } .sx-brand { font-size: 17px; gap: 8px; } .sx-brand svg { width: 26px; height: 26px; } .sx-act { gap: 6px; } .sx-act .sx-btn { padding: 0 12px; font-size: 14px; } }
