/* ====== NEONHUB · Roblox Script Hosting ====== */
:root {
  --bg-0: #07080d;
  --bg-1: #0b0d15;
  --bg-2: #10131f;
  --bg-3: #161a2a;
  --line: #1e2338;
  --line-2: #262c46;
  --text: #e6e9f4;
  --text-dim: #9aa3c0;
  --text-mute: #5b6486;
  --neon-g: #39ff9c;
  --neon-g-dim: rgba(57, 255, 156, 0.16);
  --neon-p: #a26bff;
  --neon-p-dim: rgba(162, 107, 255, 0.18);
  --danger: #ff5470;
  --warn: #ffb84c;
  --radius: 12px;
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: "Space Grotesk", ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--sans);
  color: var(--text);
  background: var(--bg-0);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; }
input, select, textarea { font-family: inherit; color: inherit; }

/* Background */
.bg-grid {
  position: fixed; inset: 0; z-index: -2;
  background:
    linear-gradient(var(--bg-0), var(--bg-0)),
    linear-gradient(to right, rgba(162,107,255,.06) 1px, transparent 1px) 0 0 / 42px 42px,
    linear-gradient(to bottom, rgba(57,255,156,.05) 1px, transparent 1px) 0 0 / 42px 42px;
  background-blend-mode: normal, screen, screen;
  mask-image: radial-gradient(ellipse at 50% 0%, #000 40%, transparent 85%);
}
.bg-glow {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(600px 400px at 15% -5%, rgba(162,107,255,.22), transparent 60%),
    radial-gradient(700px 500px at 90% 0%, rgba(57,255,156,.14), transparent 60%),
    radial-gradient(500px 400px at 50% 110%, rgba(162,107,255,.18), transparent 60%);
}

/* Topbar */
.topbar {
  position: sticky; top: 0; z-index: 40;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 14px 22px;
  background: linear-gradient(to bottom, rgba(11,13,21,.85), rgba(11,13,21,.6));
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 12px; }
.logo {
  width: 40px; height: 40px; border-radius: 10px;
  display: grid; place-items: center;
  color: var(--neon-g);
  background: linear-gradient(135deg, var(--neon-g-dim), var(--neon-p-dim));
  border: 1px solid var(--line-2);
  box-shadow: 0 0 24px rgba(57,255,156,.12) inset;
}
.brand-text { display: flex; flex-direction: column; line-height: 1; }
.brand-title { font-weight: 700; font-size: 18px; letter-spacing: .3px; }
.brand-sub { font-size: 11px; color: var(--text-mute); margin-top: 3px; letter-spacing: 1px; text-transform: uppercase; }
.accent { color: var(--neon-g); text-shadow: 0 0 12px rgba(57,255,156,.4); }

.nav {
  display: flex; gap: 4px;
  padding: 5px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  justify-self: center;
}
.nav-btn {
  padding: 8px 16px;
  border: 0; background: transparent; color: var(--text-dim);
  cursor: pointer; border-radius: 999px;
  font-size: 13px; font-weight: 500;
  transition: color .2s, background .2s;
}
.nav-btn:hover { color: var(--text); }
.nav-btn.active {
  background: linear-gradient(135deg, var(--neon-g-dim), var(--neon-p-dim));
  color: #fff;
  box-shadow: inset 0 0 0 1px var(--line-2);
}

.topbar-actions { justify-self: end; display: flex; gap: 10px; align-items: center; }
.status-pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 12px; border-radius: 999px;
  background: var(--bg-2); border: 1px solid var(--line);
  font-size: 12px; color: var(--text-dim);
}
.status-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--neon-g); box-shadow: 0 0 10px var(--neon-g);
}
.status-pill.api .status-dot { background: var(--neon-p); box-shadow: 0 0 10px var(--neon-p); }
.status-pill.off .status-dot { background: var(--danger); box-shadow: 0 0 10px var(--danger); }

/* Layout */
.main {
  max-width: 1200px; margin: 0 auto;
  padding: 32px 22px 80px;
}
.tab { display: none; }
.tab.active { display: block; animation: fadeUp .35s ease; }
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Hero */
.hero { text-align: center; margin: 22px 0 34px; }
.hero h1 {
  margin: 0 0 10px; font-size: clamp(28px, 4vw, 44px);
  font-weight: 700; letter-spacing: -0.02em; line-height: 1.1;
}
.hero p { margin: 0; color: var(--text-dim); font-size: 15px; }
.hero code {
  background: var(--bg-2); border: 1px solid var(--line);
  padding: 2px 8px; border-radius: 6px; font-family: var(--mono); font-size: 13px;
  color: var(--neon-g);
}

/* Toolbar */
.toolbar {
  display: flex; flex-wrap: wrap; gap: 12px;
  margin-bottom: 18px;
}
.search-wrap {
  position: relative; flex: 1 1 320px;
  display: flex; align-items: center;
}
.search-wrap svg { position: absolute; left: 14px; color: var(--text-mute); }
.search-wrap input {
  width: 100%; padding: 12px 14px 12px 42px;
  background: var(--bg-2); border: 1px solid var(--line);
  border-radius: var(--radius); color: var(--text); font-size: 14px;
  outline: none; transition: border-color .2s, box-shadow .2s;
}
.search-wrap input:focus {
  border-color: var(--neon-g);
  box-shadow: 0 0 0 3px var(--neon-g-dim);
}
.filters { display: flex; gap: 8px; }
.filters select {
  padding: 12px 14px; background: var(--bg-2); border: 1px solid var(--line);
  border-radius: var(--radius); color: var(--text); font-size: 13px;
  outline: none; cursor: pointer;
}
.filters select:focus { border-color: var(--neon-p); }

/* Stats */
.stats-row {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 12px; margin-bottom: 22px;
}
.stat {
  background: var(--bg-1); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px 16px;
  display: flex; flex-direction: column; gap: 4px;
}
.stat-label { font-size: 11px; color: var(--text-mute); text-transform: uppercase; letter-spacing: 1px; }
.stat-value { font-size: 20px; font-weight: 700; color: var(--text); font-family: var(--mono); }

/* Card grid */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 16px;
}
.card {
  position: relative;
  background: linear-gradient(180deg, var(--bg-1), var(--bg-0));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  display: flex; flex-direction: column; gap: 12px;
  transition: transform .2s, border-color .2s, box-shadow .2s;
  cursor: pointer; overflow: hidden;
}
.card::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(400px 200px at var(--mx,50%) 0%, var(--neon-g-dim), transparent 60%);
  opacity: 0; transition: opacity .3s;
}
.card:hover { transform: translateY(-2px); border-color: var(--line-2); box-shadow: var(--shadow); }
.card:hover::before { opacity: 1; }
.card:focus-visible { outline: 2px solid var(--neon-g); outline-offset: 2px; }

.card-title-row {
  display: flex; justify-content: space-between; align-items: baseline; gap: 10px;
}
.card-title {
  margin: 0; font-size: 16px; font-weight: 600;
  color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.card-size {
  font-family: var(--mono); font-size: 11px;
  color: var(--text-mute); flex-shrink: 0;
  padding: 3px 8px; border-radius: 6px;
  background: var(--bg-2); border: 1px solid var(--line);
}
.card-desc {
  margin: 4px 0 0; color: var(--text-dim); font-size: 13px; line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-preview {
  margin: 0; padding: 10px;
  background: var(--bg-0); border: 1px solid var(--line);
  border-radius: 8px; overflow: hidden;
  height: 96px; position: relative;
  font-family: var(--mono); font-size: 12px; line-height: 1.5;
  color: var(--text-dim);
}
.card-preview::after {
  content: ""; position: absolute; inset: auto 0 0 0; height: 40px;
  background: linear-gradient(to bottom, transparent, var(--bg-0));
  pointer-events: none;
}
.card-preview code {
  display: block; white-space: pre; overflow: hidden;
}
.card-bottom {
  display: flex; justify-content: space-between; align-items: center;
  gap: 10px; margin-top: auto;
}
.card-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.chip {
  font-size: 10px; padding: 2px 8px; border-radius: 999px;
  background: var(--neon-p-dim); color: var(--neon-p);
  border: 1px solid rgba(162,107,255,.3);
  text-transform: lowercase;
}
.card-actions { display: flex; gap: 6px; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 14px; border-radius: 8px;
  border: 1px solid var(--line-2); background: var(--bg-2);
  color: var(--text); font-size: 13px; font-weight: 500;
  cursor: pointer; transition: all .2s;
}
.btn:hover { border-color: var(--text-mute); }
.btn.sm { padding: 6px 10px; font-size: 12px; }
.btn.primary {
  background: linear-gradient(135deg, var(--neon-g), #2eddb0);
  color: #061012; border-color: transparent; font-weight: 600;
  box-shadow: 0 4px 20px rgba(57,255,156,.25);
}
.btn.primary:hover { transform: translateY(-1px); box-shadow: 0 6px 24px rgba(57,255,156,.4); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--danger); border-color: rgba(255,84,112,.3); }
.btn.danger:hover { background: rgba(255,84,112,.1); }

.icon-btn {
  width: 32px; height: 32px; display: grid; place-items: center;
  border: 1px solid var(--line); background: var(--bg-2);
  border-radius: 8px; color: var(--text-dim); cursor: pointer;
  transition: all .2s;
}
.icon-btn:hover { color: var(--text); border-color: var(--line-2); }

/* Empty */
.empty {
  padding: 60px 20px; text-align: center;
  border: 1px dashed var(--line); border-radius: var(--radius);
  color: var(--text-dim);
}
.empty-icon { color: var(--text-mute); margin-bottom: 10px; }
.empty h3 { margin: 6px 0; color: var(--text); }
.empty p { margin: 0; font-size: 14px; }

/* Panels & Forms */
.panel {
  background: var(--bg-1); border: 1px solid var(--line);
  border-radius: 16px; padding: 26px; box-shadow: var(--shadow);
}
.panel-head { margin-bottom: 20px; }
.panel-head h2 { margin: 0 0 4px; font-size: 22px; font-weight: 700; }
.panel-head .hint { color: var(--text-dim); font-size: 13px; }
.panel-head code {
  background: var(--bg-2); border: 1px solid var(--line);
  padding: 1px 6px; border-radius: 4px; font-family: var(--mono); font-size: 11px;
  color: var(--neon-g);
}

.form { display: flex; flex-direction: column; gap: 16px; }
.row { display: grid; gap: 12px; }
.row.two { grid-template-columns: 1fr 1fr; }
@media (max-width: 640px) { .row.two { grid-template-columns: 1fr; } }

.field { display: flex; flex-direction: column; gap: 6px; }
.field > span:first-child {
  font-size: 12px; color: var(--text-dim); font-weight: 500;
  text-transform: uppercase; letter-spacing: .5px;
}
.field input, .field select {
  padding: 11px 14px; background: var(--bg-2);
  border: 1px solid var(--line); border-radius: 8px;
  color: var(--text); font-size: 14px; outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.field input:focus, .field select:focus {
  border-color: var(--neon-p);
  box-shadow: 0 0 0 3px var(--neon-p-dim);
}
.field.switch { flex-direction: row; align-items: center; gap: 10px; }
.field.switch input { width: auto; }

/* Dropzone */
.dropzone {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; padding: 26px; border: 1px dashed var(--line-2);
  border-radius: 12px; background: var(--bg-2);
  color: var(--text-dim); font-size: 13px;
  transition: all .2s;
}
.dropzone.drag {
  border-color: var(--neon-g); background: var(--neon-g-dim);
  color: var(--neon-g);
}
.dropzone svg { color: var(--text-mute); }
.dropzone.drag svg { color: var(--neon-g); }
.linklike {
  background: none; border: 0; color: var(--neon-g);
  cursor: pointer; padding: 0; font-size: inherit; text-decoration: underline;
}

/* Editor */
.editor-wrap {
  background: var(--bg-0); border: 1px solid var(--line);
  border-radius: 10px; overflow: hidden;
}
.editor-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 14px; background: var(--bg-2); border-bottom: 1px solid var(--line);
  font-size: 12px;
}
.editor-title { color: var(--text-dim); font-weight: 500; }
.editor-meta { color: var(--text-mute); font-family: var(--mono); font-size: 11px; }
.editor-meta .dot { margin: 0 6px; }
.editor {
  position: relative;
  display: grid; grid-template-columns: 44px 1fr;
  height: 320px;
}
.editor-gutter {
  background: var(--bg-1); border-right: 1px solid var(--line);
  padding: 12px 8px 12px 0;
  font-family: var(--mono); font-size: 12px; line-height: 1.55;
  color: var(--text-mute); text-align: right;
  overflow: hidden; user-select: none;
  white-space: pre;
}
.editor textarea {
  width: 100%; height: 100%;
  padding: 12px 14px;
  background: transparent; border: 0; outline: none; resize: none;
  color: var(--text); font-family: var(--mono);
  font-size: 13px; line-height: 1.55;
  white-space: pre; overflow: auto;
  tab-size: 2;
}

.actions { display: flex; gap: 10px; flex-wrap: wrap; }
.callout {
  background: var(--bg-2); border: 1px solid var(--line);
  border-left: 3px solid var(--neon-p);
  padding: 14px 18px; border-radius: 8px; font-size: 13px;
  color: var(--text-dim);
}
.callout ul { padding-left: 20px; margin: 8px 0; }
.callout li { margin: 4px 0; font-family: var(--mono); font-size: 12px; }
.callout code { color: var(--neon-g); }
.muted { color: var(--text-mute); font-size: 12px; margin-top: 6px; }

/* Modal */
.modal {
  position: fixed; inset: 0; z-index: 100;
  display: grid; place-items: center;
  padding: 20px;
  animation: fadeIn .2s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal[hidden] { display: none; }
.modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(4, 5, 10, 0.75);
  backdrop-filter: blur(6px);
}
.modal-panel {
  position: relative;
  width: min(920px, 100%);
  max-height: 88vh;
  background: var(--bg-1); border: 1px solid var(--line-2);
  border-radius: 14px; box-shadow: var(--shadow);
  display: flex; flex-direction: column;
  overflow: hidden;
}
.modal-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  padding: 20px 24px; border-bottom: 1px solid var(--line);
  gap: 16px;
}
.modal-head h3 { margin: 0 0 6px; font-size: 20px; font-weight: 700; }
.modal-meta { color: var(--text-mute); font-size: 12px; font-family: var(--mono); }
.modal-meta .dot { margin: 0 6px; }
.modal-body {
  overflow-y: auto; padding: 20px 24px;
  display: flex; flex-direction: column; gap: 14px;
}
.mDesc { margin: 0; color: var(--text-dim); font-size: 14px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.raw-row {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; background: var(--bg-0);
  border: 1px solid var(--line); border-radius: 8px;
}
.raw-label {
  font-size: 10px; text-transform: uppercase; letter-spacing: 1px;
  color: var(--neon-g); padding: 2px 8px;
  background: var(--neon-g-dim); border-radius: 4px;
  flex-shrink: 0;
}
.raw-code {
  flex: 1; font-family: var(--mono); font-size: 12px;
  color: var(--text); overflow-x: auto; white-space: nowrap;
}

.viewer-wrap {
  background: var(--bg-0); border: 1px solid var(--line);
  border-radius: 10px; overflow: hidden;
}
.viewer-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 12px; background: var(--bg-2); border-bottom: 1px solid var(--line);
  gap: 10px; flex-wrap: wrap;
}
.viewer-tabs { display: flex; gap: 4px; }
.tab-mini {
  padding: 5px 12px; font-size: 12px;
  background: transparent; border: 1px solid transparent;
  color: var(--text-dim); border-radius: 6px; cursor: pointer;
}
.tab-mini.active { background: var(--bg-1); color: var(--text); border-color: var(--line); }
.viewer-actions { display: flex; gap: 6px; flex-wrap: wrap; }

.viewer {
  position: relative;
  height: 440px;
  overflow: hidden;
  font-family: var(--mono); font-size: 13px; line-height: 1.55;
  background: var(--bg-0);
}
.viewer .vscroll {
  position: absolute; inset: 0;
  overflow: auto;
}
.viewer .vinner {
  position: relative;
}
.viewer .vline {
  position: absolute; left: 0; right: 0;
  padding: 0 14px 0 54px;
  white-space: pre;
  color: var(--text);
}
.viewer .vgutter {
  position: absolute; left: 0; top: 0;
  width: 44px; text-align: right;
  padding-right: 8px;
  color: var(--text-mute);
  user-select: none;
}

/* Syntax highlight */
.tok-kw { color: #ff6bcb; }
.tok-str { color: var(--neon-g); }
.tok-num { color: #ffb84c; }
.tok-com { color: var(--text-mute); font-style: italic; }
.tok-fn  { color: #7dd3fc; }
.tok-op  { color: #e6e9f4; }
.tok-glb { color: var(--neon-p); }

/* Toasts */
.toasts {
  position: fixed; bottom: 20px; right: 20px; z-index: 200;
  display: flex; flex-direction: column; gap: 10px;
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  padding: 12px 16px;
  background: var(--bg-2); border: 1px solid var(--line-2);
  border-radius: 10px; box-shadow: var(--shadow);
  font-size: 13px; color: var(--text);
  min-width: 220px;
  display: flex; align-items: center; gap: 10px;
  animation: slideIn .3s ease;
}
.toast.success { border-left: 3px solid var(--neon-g); }
.toast.error   { border-left: 3px solid var(--danger); }
.toast.info    { border-left: 3px solid var(--neon-p); }
@keyframes slideIn {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* Responsive */
@media (max-width: 720px) {
  .topbar { grid-template-columns: 1fr auto; padding: 12px 16px; gap: 10px; }
  .nav { grid-column: 1/-1; justify-self: stretch; justify-content: center; }
  .stats-row { grid-template-columns: 1fr; }
  .main { padding: 20px 16px 60px; }
  .panel { padding: 20px 16px; }
  .brand-sub { display: none; }
}

/* Scrollbars */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg-0); }
::-webkit-scrollbar-thumb { background: var(--bg-3); border-radius: 10px; border: 2px solid var(--bg-0); }
::-webkit-scrollbar-thumb:hover { background: var(--line-2); }
