@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@300;400;500;600;700&family=Inter:wght@300;400;500;600&display=swap');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:         #07070f;
  --bg-2:       #0c0c18;
  --bg-3:       #11111e;
  --surface:    rgba(255,255,255,0.025);
  --border:     rgba(0,212,255,0.1);
  --border-md:  rgba(0,212,255,0.2);
  --border-hi:  rgba(0,212,255,0.4);
  --cyan:       #00d4ff;
  --cyan-dim:   rgba(0,212,255,0.12);
  --purple:     #7c3aed;
  --purple-dim: rgba(124,58,237,0.12);
  --green:      #22d3a0;
  --red:        #f87171;
  --text:       #e2e8f0;
  --text-dim:   #94a3b8;
  --text-muted: #4a5568;
  --mono:       'JetBrains Mono', 'Fira Code', monospace;
  --sans:       'Inter', system-ui, sans-serif;
  --radius:     4px;
  --glow-cyan:  0 0 20px rgba(0,212,255,0.15), 0 0 40px rgba(0,212,255,0.05);
  --glow-purple:0 0 20px rgba(124,58,237,0.2);
}

html { scroll-behavior: smooth; }

body {
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── Grid background ──────────────────────────────────────── */

.grid-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  background-image:
    linear-gradient(rgba(0,212,255,0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,212,255,0.025) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
}

.grid-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 80% 60% at 50% 0%, rgba(0,212,255,0.04) 0%, transparent 70%),
              radial-gradient(ellipse 60% 40% at 80% 80%, rgba(124,58,237,0.05) 0%, transparent 60%);
}

/* ── Layout ────────────────────────────────────────────────── */

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
  position: relative;
  z-index: 1;
}

/* ── Nav ───────────────────────────────────────────────────── */

nav {
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid var(--border);
  background: rgba(7,7,15,0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.nav-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-logo {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 14px;
  color: var(--cyan);
  letter-spacing: 0.05em;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-logo .bracket { color: var(--text-muted); }

.nav-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.nav-link {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-dim);
  text-decoration: none;
  letter-spacing: 0.05em;
  transition: color 0.2s;
}
.nav-link:hover { color: var(--cyan); }

.nav-user {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-dim);
}

.nav-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--border-md);
}

/* ── Buttons ───────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-decoration: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  border: none;
  outline: none;
}

.btn-lg { padding: 12px 24px; font-size: 13px; }
.btn-sm { padding: 6px 14px; font-size: 11px; }

.btn-primary {
  background: var(--cyan);
  color: #000;
  box-shadow: 0 0 24px rgba(0,212,255,0.25);
}
.btn-primary:hover {
  background: #1ae0ff;
  box-shadow: 0 0 32px rgba(0,212,255,0.4);
  transform: translateY(-1px);
}

.btn-outline {
  background: transparent;
  color: var(--cyan);
  border: 1px solid var(--border-md);
}
.btn-outline:hover {
  border-color: var(--border-hi);
  background: var(--cyan-dim);
  box-shadow: var(--glow-cyan);
}

.btn-ghost {
  background: transparent;
  color: var(--text-dim);
  border: 1px solid var(--border);
}
.btn-ghost:hover {
  border-color: var(--border-md);
  color: var(--text);
}

.btn-danger {
  background: transparent;
  color: var(--red);
  border: 1px solid rgba(248,113,113,0.2);
}
.btn-danger:hover {
  background: rgba(248,113,113,0.08);
  border-color: rgba(248,113,113,0.4);
}

/* ── Tags / badges ─────────────────────────────────────────── */

.badge {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  padding: 2px 8px;
  border-radius: 2px;
  border: 1px solid;
  text-transform: uppercase;
}

.badge-js    { color: #f0db4f; border-color: rgba(240,219,79,0.3); background: rgba(240,219,79,0.06); }
.badge-py    { color: #4b8bbe; border-color: rgba(75,139,190,0.3); background: rgba(75,139,190,0.06); }
.badge-ts    { color: #007acc; border-color: rgba(0,122,204,0.3);  background: rgba(0,122,204,0.06); }
.badge-default { color: var(--text-dim); border-color: var(--border); background: var(--surface); }

.tag {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 2px;
  padding: 2px 6px;
  letter-spacing: 0.04em;
}

/* ── Cards ─────────────────────────────────────────────────── */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.card:hover {
  border-color: var(--border-md);
  box-shadow: var(--glow-cyan);
}

/* ── Input / select ────────────────────────────────────────── */

input, select, textarea {
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--mono);
  font-size: 13px;
  padding: 8px 12px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--border-md);
  box-shadow: 0 0 0 3px rgba(0,212,255,0.06);
}
input::placeholder, textarea::placeholder { color: var(--text-muted); }

/* ── Scrollbar ─────────────────────────────────────────────── */

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--bg-3); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ── Utility ───────────────────────────────────────────────── */

.mono { font-family: var(--mono); }
.muted { color: var(--text-muted); }
.dim   { color: var(--text-dim); }
.cyan  { color: var(--cyan); }
.green { color: var(--green); }
.red   { color: var(--red); }
.flex  { display: flex; }
.items-center { align-items: center; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }

/* ── Divider ───────────────────────────────────────────────── */
.divider {
  height: 1px;
  background: var(--border);
  margin: 32px 0;
}

/* ── Loading spinner ───────────────────────────────────────── */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--cyan);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Empty state ───────────────────────────────────────────── */
.empty {
  text-align: center;
  padding: 64px 24px;
  color: var(--text-muted);
  font-family: var(--mono);
  font-size: 13px;
}
.empty-icon { font-size: 32px; margin-bottom: 12px; opacity: 0.4; }

/* ── Modal ─────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.8);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.modal-overlay.open {
  opacity: 1;
  pointer-events: all;
}
.modal {
  background: var(--bg-2);
  border: 1px solid var(--border-md);
  border-radius: var(--radius);
  width: 100%;
  max-width: 760px;
  max-height: 85vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transform: translateY(8px);
  transition: transform 0.2s;
}
.modal-overlay.open .modal { transform: translateY(0); }
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.modal-title {
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  padding: 4px;
  transition: color 0.2s;
}
.modal-close:hover { color: var(--text); }
.modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}
.modal-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

/* ── Code block ────────────────────────────────────────────── */
.code-wrap {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
}
.code-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  background: var(--bg-3);
  border-bottom: 1px solid var(--border);
}
.code-lang {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.06em;
}
pre {
  margin: 0;
  padding: 20px;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.7;
  background: var(--bg-3);
  color: var(--text);
}
pre code { background: none; padding: 0; }

/* ── Toast ─────────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 2000;
}
.toast {
  font-family: var(--mono);
  font-size: 12px;
  padding: 10px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border-md);
  background: var(--bg-2);
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
  animation: toastIn 0.2s ease;
  max-width: 300px;
}
.toast.success { border-color: rgba(34,211,160,0.4); color: var(--green); }
.toast.error   { border-color: rgba(248,113,113,0.4); color: var(--red); }
@keyframes toastIn {
  from { opacity: 0; transform: translateX(8px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 640px) {
  .container { padding: 0 16px; }
  .btn-lg { padding: 10px 18px; }
}
