/* scripts.nitaimaarek.com — dark, dense, fast. */

:root {
  --bg: #0c0d11;
  --panel: #14161d;
  --panel-2: #1a1d26;
  --line: #262a36;
  --text: #e6e8ef;
  --dim: #8b91a4;
  --accent: #7c5cff;
  --accent-2: #a78bfa;
  --good: #35d07f;
  --warn: #ffb454;
  --radius: 12px;
  --mono: ui-monospace, SFMono-Regular, "JetBrains Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

/* several containers below set display:flex, which would otherwise beat the
   UA's [hidden] rule and leave them visible */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background:
    radial-gradient(1100px 480px at 50% -220px, #2a1f5c33, transparent 70%),
    var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh;
}

.wrap { width: min(980px, 100% - 32px); margin-inline: auto; }

/* ---------------------------------------------------------------- header */

.top {
  border-bottom: 1px solid var(--line);
  background: #0c0d11cc;
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 20;
}
.top .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
  font-size: 17px;
}
.logo {
  font-family: var(--mono);
  font-weight: 700;
  color: var(--accent-2);
  background: #7c5cff1f;
  border: 1px solid #7c5cff45;
  border-radius: 10px;
  padding: 4px 9px;
  line-height: 1;
}
.brand b { letter-spacing: -0.3px; }
.brand em { display: block; font-style: normal; font-size: 12px; color: var(--dim); }
.dim { color: var(--dim); }
.counts { color: var(--dim); font-size: 13px; white-space: nowrap; }
.counts span { color: var(--text); font-weight: 600; }

main { padding-bottom: 60px; }

/* ---------------------------------------------------------------- cards */

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  margin-top: 18px;
}

.row { display: flex; gap: 10px; flex-wrap: wrap; }
.row.bottom { margin-top: 10px; align-items: center; }

.in {
  flex: 1 1 240px;
  min-width: 0;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--text);
  padding: 10px 12px;
  font: inherit;
  outline: none;
}
.in.slim { flex: 0 1 220px; }
.in::placeholder { color: #666d80; }
.in:focus { border-color: var(--accent); box-shadow: 0 0 0 3px #7c5cff26; }

.code-in {
  width: 100%;
  margin-top: 10px;
  min-height: 190px;
  resize: vertical;
  background: #0e1017;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: #d8dcf0;
  padding: 12px;
  font: 13px/1.55 var(--mono);
  outline: none;
  tab-size: 4;
}
.code-in:focus { border-color: var(--accent); box-shadow: 0 0 0 3px #7c5cff26; }

.hint { color: var(--dim); font-size: 12px; margin-left: auto; }

/* ---------------------------------------------------------------- buttons */

.btn {
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  border-radius: 9px;
  padding: 9px 15px;
  font: 600 14px/1 system-ui, sans-serif;
  cursor: pointer;
  transition: background .12s, border-color .12s, transform .08s;
}
.btn:hover { background: #222634; border-color: #38405a; }
.btn:active { transform: translateY(1px); }
.btn.primary {
  background: linear-gradient(180deg, var(--accent), #6847e8);
  border-color: #8a6dff;
  color: #fff;
}
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; }
.btn.tiny { padding: 6px 10px; font-size: 12.5px; }
.btn.copied { background: #35d07f22; border-color: #35d07f77; color: var(--good); }

/* ---------------------------------------------------------------- publish result */

.done { border-color: #35d07f55; background: linear-gradient(180deg, #35d07f0d, transparent), var(--panel); }
.done-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.field { margin-top: 10px; }
.field label { display: block; font-size: 12px; color: var(--dim); margin-bottom: 5px; }
.warn { color: var(--warn); }
.copyline {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #0e1017;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 8px 8px 8px 12px;
}
.copyline code {
  flex: 1;
  min-width: 0;
  font: 12.5px/1.4 var(--mono);
  color: #b9c0dd;
  overflow-x: auto;
  white-space: nowrap;
  scrollbar-width: thin;
}

/* ---------------------------------------------------------------- toolbar */

.toolbar { display: flex; gap: 10px; margin-top: 26px; flex-wrap: wrap; }
.seg {
  display: flex;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 3px;
  gap: 3px;
}
.seg-btn {
  border: 0;
  background: transparent;
  color: var(--dim);
  padding: 7px 13px;
  border-radius: 7px;
  font: 600 13px/1 system-ui, sans-serif;
  cursor: pointer;
}
.seg-btn.on { background: #7c5cff26; color: var(--accent-2); }

/* ---------------------------------------------------------------- list */

.list { margin-top: 14px; display: flex; flex-direction: column; gap: 10px; }

.item {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.item.open { border-color: #7c5cff66; }
.item-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  cursor: pointer;
  flex-wrap: wrap;
}
.item-head:hover { background: #ffffff05; }
.item-main { flex: 1 1 260px; min-width: 0; }
.item-title {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.item-meta {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 4px;
  font-size: 12px;
  color: var(--dim);
}
.chip {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 9px;
  font-size: 11.5px;
  color: #aab1c8;
}
.chip.game { background: #7c5cff1a; border-color: #7c5cff3d; color: var(--accent-2); }
.id { font-family: var(--mono); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }

.item-body { border-top: 1px solid var(--line); }
.item-body pre {
  margin: 0;
  padding: 14px;
  max-height: 460px;
  overflow: auto;
  font: 12.5px/1.6 var(--mono);
  color: #cfd5ee;
  background: #0e1017;
  white-space: pre;
  tab-size: 4;
}
.item-foot {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  padding: 10px 14px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--dim);
}
.item-foot a { color: var(--accent-2); }
.item-foot .spacer { flex: 1; }

.more-wrap { display: flex; justify-content: center; margin-top: 16px; }
.empty { text-align: center; color: var(--dim); margin: 40px 0; }

/* ---------------------------------------------------------------- footer */

.foot { margin-top: 44px; padding-top: 18px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--dim); }
.foot code {
  font-family: var(--mono);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 2px 6px;
  color: #b9c0dd;
  display: inline-block;
  overflow-x: auto;
  max-width: 100%;
  vertical-align: bottom;
}

/* ---------------------------------------------------------------- toast */

.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translate(-50%, 24px);
  background: #1d2130;
  border: 1px solid #38405a;
  color: var(--text);
  padding: 11px 18px;
  border-radius: 10px;
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .16s, transform .16s;
  z-index: 60;
  max-width: calc(100% - 32px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.bad { border-color: #ff6b6b77; }

@media (max-width: 620px) {
  .in.slim { flex: 1 1 100%; }
  .hint { display: none; }
  .row.bottom .btn { flex: 1; }
}
