:root{
  --bg:#090b10;
  --surface:#10131a;
  --surface-2:#141821;
  --surface-3:#0d1016;
  --line:#242a35;
  --line-soft:#1b2029;
  --text:#f4f6f9;
  --muted:#929cab;
  --muted-2:#667181;
  --accent:#8b7cf6;
  --accent-strong:#9b8cff;
  --accent-soft:rgba(139,124,246,.12);
  --green:#66d29a;
  --green-soft:rgba(102,210,154,.10);
  --amber:#e9b968;
  --amber-soft:rgba(233,185,104,.10);
  --danger:#ef7185;
  --danger-soft:rgba(239,113,133,.10);
  --shadow:0 18px 60px rgba(0,0,0,.28);
  --radius:14px;
}

*{box-sizing:border-box}
html{scroll-behavior:smooth;background:var(--bg)}
body{
  margin:0;
  min-height:100vh;
  color:var(--text);
  font-family:Inter,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Arial,sans-serif;
  background:
    radial-gradient(900px 480px at 50% -170px,rgba(139,124,246,.10),transparent 68%),
    var(--bg);
  -webkit-font-smoothing:antialiased;
}

a{color:inherit;text-decoration:none}
button,input,select,textarea{font:inherit}
button{appearance:none}
::selection{background:rgba(139,124,246,.35)}

.container{width:min(1180px,calc(100% - 40px));margin:0 auto}

/* ---------- shell ---------- */
.topbar{
  position:sticky;top:0;z-index:30;
  background:rgba(9,11,16,.88);
  border-bottom:1px solid rgba(255,255,255,.06);
  backdrop-filter:blur(18px);
}
.nav{height:64px;display:flex;align-items:center;justify-content:space-between;gap:24px}
.brand{display:flex;align-items:center;gap:11px;font-weight:760;letter-spacing:-.015em;font-size:14px}
.logo{
  width:30px;height:30px;border-radius:9px;display:grid;place-items:center;
  background:#f2f0ff;color:#171328;font-size:13px;font-weight:900;
  box-shadow:0 0 0 1px rgba(255,255,255,.08);
}
.brand-copy{display:flex;align-items:baseline;gap:6px;white-space:nowrap}
.brand-copy b{color:#b5aaff;font-weight:760}
.navlinks{display:flex;align-items:center;gap:6px;font-size:13px;color:var(--muted)}
.navlinks a{padding:8px 10px;border-radius:8px;transition:.15s}
.navlinks a:hover,.navlinks a.active{background:rgba(255,255,255,.045);color:#fff}

.kicker{
  display:inline-flex;align-items:center;gap:8px;
  font-size:11px;font-weight:780;letter-spacing:.13em;text-transform:uppercase;color:#a69afd;
}
.kicker:before{content:"";width:18px;height:1px;background:currentColor;opacity:.7}
.muted{color:var(--muted)}

h1,h2,h3,p{overflow-wrap:anywhere}
h1{margin:0;letter-spacing:-.052em}
h2,h3{letter-spacing:-.03em}

/* ---------- public homepage ---------- */
.hero{
  padding:88px 0 66px;
  display:grid;grid-template-columns:minmax(0,1.05fr) minmax(360px,.72fr);gap:72px;align-items:center;
  border-bottom:1px solid var(--line-soft);
}
.hero h1{font-size:clamp(44px,6.2vw,72px);line-height:1.01;margin:17px 0 20px;max-width:820px}
.gradient{color:#fff}
.hero p{max-width:690px;margin:0;color:#a5afbd;font-size:16px;line-height:1.75}
.hero-actions{display:flex;gap:10px;flex-wrap:wrap;margin-top:28px}
.hero-note{display:flex;gap:18px;flex-wrap:wrap;margin-top:34px;color:var(--muted-2);font-size:12px}
.hero-note span{display:inline-flex;align-items:center;gap:7px}
.hero-note i{width:5px;height:5px;background:#6459ae;border-radius:50%;display:inline-block}

.button{
  min-height:40px;display:inline-flex;align-items:center;justify-content:center;gap:8px;
  padding:10px 14px;border:1px solid var(--accent);border-radius:9px;
  background:var(--accent);color:#fff;font-weight:720;font-size:13px;cursor:pointer;
  transition:transform .14s,background .14s,border-color .14s,opacity .14s;
}
.button:hover{transform:translateY(-1px);background:var(--accent-strong);border-color:var(--accent-strong)}
.button:active{transform:none}
.button:disabled{opacity:.45;cursor:not-allowed;transform:none}
.button.ghost{background:transparent;border-color:var(--line);color:#d9dee7}
.button.ghost:hover{background:rgba(255,255,255,.04);border-color:#343b48}
.button.secondary{background:#23344e;border-color:#2a3e5d}
.button.small{min-height:32px;padding:7px 10px;font-size:12px;border-radius:8px}
.button.danger{background:var(--danger-soft);border-color:rgba(239,113,133,.28);color:#ff9aac}
.button.danger:hover{background:rgba(239,113,133,.16);border-color:rgba(239,113,133,.42)}

.terminal{
  position:relative;border:1px solid var(--line);border-radius:16px;overflow:hidden;
  background:#0b0e13;box-shadow:var(--shadow)
}
.terminal:after{content:"";position:absolute;inset:0;pointer-events:none;box-shadow:inset 0 1px rgba(255,255,255,.025)}
.terminal-head{height:42px;border-bottom:1px solid var(--line-soft);display:flex;align-items:center;gap:7px;padding:0 14px}
.terminal-head:after{content:"terminal / python";margin-left:auto;color:#4f5968;font:10px ui-monospace,SFMono-Regular,Consolas,monospace}
.dot{width:8px;height:8px;border-radius:50%;background:#303743}
.terminal pre{margin:0;padding:26px;min-height:292px;color:#8e9aaa;line-height:1.78;overflow:auto;font-size:13px}
.terminal .hi{color:#84d8aa}.terminal .cmd{color:#a99eff}

.library-section{padding-top:46px}
.searchbar{
  display:grid;grid-template-columns:minmax(0,1fr) 220px auto;gap:9px;
  padding:10px;background:var(--surface);border:1px solid var(--line);border-radius:12px;
}
.input{
  width:100%;min-height:42px;background:var(--surface-3);color:#eef1f6;border:1px solid var(--line);
  border-radius:9px;padding:10px 12px;outline:0;transition:border-color .14s,box-shadow .14s,background .14s;
}
.input::placeholder{color:#596473}
.input:focus{border-color:#5d557f;box-shadow:0 0 0 3px rgba(139,124,246,.08);background:#10141b}
select.input{cursor:pointer}

.section-head{display:flex;justify-content:space-between;align-items:end;margin:35px 0 16px;gap:20px}
.section-head h2{font-size:28px;margin:7px 0 0}
.count{font-size:12px;color:var(--muted);padding:7px 10px;border:1px solid var(--line);border-radius:999px;background:var(--surface)}

.grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px}
.card{
  min-width:0;position:relative;display:flex;flex-direction:column;
  background:var(--surface);border:1px solid var(--line);border-radius:var(--radius);padding:18px;
  transition:transform .16s,border-color .16s,background .16s;
}
.card:hover{transform:translateY(-2px);border-color:#353b48;background:#12161e}
.card-topline{display:flex;align-items:center;justify-content:space-between;gap:12px}
.badges,.tags,.card-actions,.meta{display:flex;gap:7px;align-items:center;flex-wrap:wrap}
.badge{
  padding:4px 7px;border:1px solid var(--line);border-radius:6px;background:#121720;
  color:#8995a5;font-size:9px;font-weight:820;letter-spacing:.08em;text-transform:uppercase
}
.badge.free{background:var(--green-soft);border-color:rgba(102,210,154,.18);color:#84d8aa}
.badge.featured{background:var(--accent-soft);border-color:rgba(139,124,246,.20);color:#b3a9ff}
.card-index{font:11px ui-monospace,SFMono-Regular,Consolas,monospace;color:#4e5968}
.card h3{font-size:18px;line-height:1.25;margin:17px 0 8px}
.card p{margin:0;color:#909baa;font-size:13px;line-height:1.65;min-height:64px}
.tags{margin-top:14px;min-height:21px}
.tags span{font-size:11px;color:#6f7a89}
.meta{justify-content:space-between;margin-top:auto;padding-top:16px;border-top:1px solid var(--line-soft);font-size:11px;color:#6f7a89}
.card-actions{margin-top:12px}
.card-actions .button{width:100%}
.empty{grid-column:1/-1;text-align:center;padding:54px 24px;border:1px dashed #2a303b;border-radius:12px;color:var(--muted);background:rgba(255,255,255,.012)}
.empty small{display:inline-block;margin-top:8px;color:#697484}
.footer{margin-top:70px;border-top:1px solid var(--line-soft);padding:26px 0 42px;color:#667181;font-size:12px}

/* ---------- tool detail ---------- */
.back{display:inline-flex;align-items:center;gap:7px;color:#8995a5;margin:32px 0 32px;font-size:13px}
.back:hover{color:#fff}
.detail-hero{display:grid;grid-template-columns:minmax(0,1fr) 250px;gap:54px;align-items:end;padding-bottom:36px;border-bottom:1px solid var(--line-soft)}
.detail-hero h1{font-size:clamp(38px,5vw,58px);line-height:1.04;margin:14px 0 16px}
.detail-hero p{max-width:740px;margin:0;color:#9ba6b5;line-height:1.75;font-size:15px}
.detail-hero .tags{margin-top:18px}
.download-box{background:var(--surface);border:1px solid var(--line);border-radius:14px;padding:18px;display:flex;flex-direction:column;gap:7px}
.download-box strong{font-size:30px;letter-spacing:-.04em}.download-box small{color:var(--muted);font-size:10px;letter-spacing:.08em;text-transform:uppercase}
.detail-grid{display:grid;grid-template-columns:minmax(0,1.45fr) minmax(260px,.55fr);gap:12px;margin-top:20px}
.panel{min-width:0;background:var(--surface);border:1px solid var(--line);border-radius:14px;padding:16px}
.panel-title{text-transform:uppercase;letter-spacing:.1em;font-size:10px;color:#8b95a3;font-weight:820;margin-bottom:12px}
.code-panel-head{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:12px}.code-panel-head .panel-title{margin:0}
.code{margin:0;background:#090c10;border:1px solid var(--line-soft);border-radius:10px;padding:18px;overflow:auto;color:#a8d6b8;line-height:1.68;font-size:12.5px}
.code-full{max-height:72vh;white-space:pre;tab-size:4}
.change-list{margin:0;padding-left:18px;color:#929dac;line-height:1.8;font-size:13px}
.copy-button.copied{border-color:rgba(102,210,154,.32)!important;color:#8ce0b2!important;background:rgba(102,210,154,.08)!important}

/* ---------- admin ---------- */
.admin-shell .topbar{background:rgba(9,11,16,.94)}
.admin-badge{display:inline-flex;align-items:center;gap:7px;padding:6px 9px;border:1px solid var(--line);border-radius:7px;color:#8d98a7;font-size:10px;font-weight:780;letter-spacing:.09em;text-transform:uppercase}
.admin-badge i{width:6px;height:6px;border-radius:50%;background:var(--green);box-shadow:0 0 0 3px rgba(102,210,154,.08)}
.admin-head{display:flex;justify-content:space-between;align-items:flex-end;margin:38px 0 18px;gap:20px}
.admin-head h1{font-size:34px;margin:8px 0 6px;letter-spacing:-.045em}
.admin-head .muted{font-size:13px;line-height:1.6}
.notice{padding:11px 13px;border:1px solid var(--line);background:var(--surface);border-radius:10px;color:#8d98a6;line-height:1.55;margin-bottom:14px;font-size:12px}
.local-notice{display:flex;align-items:center;gap:9px}
.local-notice:before{content:"";width:7px;height:7px;flex:0 0 auto;border-radius:50%;background:var(--green)}
.local-notice code{color:#b7adff;background:#0b0e14;border:1px solid var(--line-soft);border-radius:5px;padding:2px 5px}

.admin-layout{display:grid;grid-template-columns:360px minmax(0,1fr);gap:14px;align-items:start}
.admin-sidebar{position:sticky;top:78px;min-width:0}
.admin-list-head{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:8px}
.admin-list-head strong{font-size:12px;letter-spacing:.08em;text-transform:uppercase;color:#8994a4}
.admin-list-head span{font-size:11px;color:#5e6978}
.admin-search{position:relative;margin-bottom:8px}
.admin-search .input{padding-left:34px;min-height:39px;font-size:12px}
.admin-search:before{content:"⌕";position:absolute;left:12px;top:8px;color:#697484;font-size:17px;z-index:1}
.tool-list{border:1px solid var(--line);border-radius:12px;overflow:hidden;background:var(--surface);max-height:calc(100vh - 255px);overflow-y:auto}
.tool-row{position:relative;display:block;padding:13px 13px 12px;background:var(--surface);border-top:1px solid var(--line-soft);cursor:pointer;transition:background .13s}
.tool-row:first-child{border-top:0}.tool-row:hover{background:#131820}.tool-row.selected{background:#151923;box-shadow:inset 2px 0 0 var(--accent)}
.tool-row-main{display:flex;align-items:flex-start;justify-content:space-between;gap:10px}
.tool-row h3{margin:5px 0 5px;font-size:14px;line-height:1.3;letter-spacing:-.015em}
.tool-row .sub{font-size:10.5px;color:#697484;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.row-actions{display:flex;gap:5px;margin-top:10px}.row-actions .button{flex:1}
.status{display:inline-flex;align-items:center;gap:5px;font-size:9px;font-weight:820;letter-spacing:.09em;text-transform:uppercase}
.status:before{content:"";width:5px;height:5px;border-radius:50%;background:currentColor}
.status.on{color:#76d6a2}.status.off{color:#d7ad6b}

.editor-panel{background:var(--surface);border:1px solid var(--line);border-radius:12px;overflow:hidden}
.editor-header{position:sticky;top:64px;z-index:8;display:flex;justify-content:space-between;align-items:flex-start;gap:20px;padding:17px 18px;background:rgba(16,19,26,.96);border-bottom:1px solid var(--line);backdrop-filter:blur(14px)}
.editor-header h2{margin:5px 0 2px;font-size:21px;letter-spacing:-.035em}.editor-header .muted{font-size:11px}
.editor-body{padding:18px}
.editor-section{padding:0 0 18px;margin-bottom:18px;border-bottom:1px solid var(--line-soft)}
.editor-section:last-of-type{margin-bottom:0}
.editor-section-title{font-size:10px;letter-spacing:.1em;text-transform:uppercase;color:#6e7988;font-weight:820;margin-bottom:13px}
label{display:block;color:#9ba6b5;font-size:11px;font-weight:720;margin:12px 0 6px}
textarea.input{min-height:88px;resize:vertical;line-height:1.55}
.two{display:grid;grid-template-columns:1fr 1fr;gap:10px}
.checkbox{display:flex;align-items:center;gap:8px;margin-top:12px;color:#99a4b3;font-size:12px;cursor:pointer}.checkbox input{width:auto;accent-color:var(--accent)}
.publish-check{padding:11px 12px;border:1px solid var(--line);border-radius:9px;background:#0d1117}
.code-editor{min-height:460px!important;font-family:ui-monospace,SFMono-Regular,Consolas,"Liberation Mono",monospace;line-height:1.6;tab-size:4;font-size:12.5px}
.advanced-fields{margin-top:4px;border:1px solid var(--line);border-radius:10px;background:#0e1117;overflow:hidden}
.advanced-fields summary{cursor:pointer;color:#9da8b7;font-size:11px;font-weight:760;user-select:none;padding:11px 12px;list-style:none}
.advanced-fields summary::-webkit-details-marker{display:none}.advanced-fields summary:after{content:"+";float:right;color:#697484}.advanced-fields[open] summary:after{content:"−"}
.advanced-fields[open] summary{border-bottom:1px solid var(--line-soft)}
.advanced-fields-inner{padding:0 12px 13px}
.editor-actions{display:flex;gap:7px;flex-wrap:wrap}.editor-actions .button:first-child{min-width:112px}
.admin-footer-actions{display:flex;justify-content:space-between;align-items:center;gap:10px;flex-wrap:wrap;margin-top:8px;padding:10px 11px;background:var(--surface);border:1px solid var(--line);border-radius:10px;font-size:11px}
.toast{position:fixed;right:20px;bottom:20px;z-index:80;padding:11px 13px;background:#161b24;border:1px solid #343c49;border-radius:9px;box-shadow:var(--shadow);opacity:0;transform:translateY(8px);pointer-events:none;transition:.18s;font-size:12px;color:#e9edf3}.toast.show{opacity:1;transform:none}

/* ---------- responsive ---------- */
@media(max-width:980px){
  .hero{grid-template-columns:1fr;gap:34px}.terminal{max-width:640px}
  .grid{grid-template-columns:1fr 1fr}
  .admin-layout{grid-template-columns:1fr}.admin-sidebar{position:static}.tool-list{max-height:360px}
  .editor-header{top:64px}.detail-hero,.detail-grid{grid-template-columns:1fr}
}
@media(max-width:640px){
  .container{width:min(100% - 24px,1180px)}
  .nav{height:58px}.brand-copy span{display:none}.navlinks a:not(.active){display:none}
  .hero{padding:58px 0 42px}.hero h1{font-size:42px}.hero p{font-size:14px}.terminal pre{min-height:250px;padding:19px}
  .searchbar,.grid,.two{grid-template-columns:1fr}.section-head,.admin-head{align-items:flex-start;flex-direction:column}.admin-head{margin-top:26px}
  .admin-head .button{width:100%}.editor-header{top:58px;flex-direction:column}.editor-actions{width:100%}.editor-actions .button{flex:1}
  .local-notice{align-items:flex-start}.detail-hero{gap:24px}.download-box{max-width:none}.back{margin:24px 0}
}
