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

:root {
  --bg: #09090e;
  --sidebar-bg: #0e0e16;
  --surface: #131320;
  --surface2: #1c1c2e;
  --border: rgba(255,255,255,0.07);
  --border-hover: rgba(255,255,255,0.14);
  --accent: #7c6dfa;
  --accent2: #a78bfa;
  --accent-glow: rgba(124,109,250,0.18);
  --green: #22c55e;
  --red: #ef4444;
  --text: #e4e4f0;
  --muted: #5a5a72;
  --muted2: #3d3d55;
  --mono: 'JetBrains Mono', monospace;
  --sans: 'Inter', sans-serif;
  --sidebar-w: 260px;
  --header-h: 56px;
}

html, body { height: 100%; }

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
}

/* ── HEADER ─────────────────────────────── */
header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-h);
  z-index: 200;
  background: rgba(9,9,14,0.92);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  height: 100%;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0 1.25rem;
}

.logo {
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex: 1;
}

.logo-icon { font-size: 1.2rem; }
.accent { color: var(--accent2); }

.badge {
  background: var(--accent-glow);
  border: 1px solid rgba(124,109,250,0.35);
  color: var(--accent2);
  padding: 0.18rem 0.6rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
}

.hamburger {
  display: none;
  flex-direction: column;
  gap: 4px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
}

.hamburger span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: background 0.2s;
}

.hamburger:hover span { background: var(--accent2); }

/* ── LAYOUT ──────────────────────────────── */
.layout {
  display: flex;
  height: 100vh;
  padding-top: var(--header-h);
}

/* ── SIDEBAR ─────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  height: 100%;
}

.sidebar-top {
  padding: 1rem 1rem 0.5rem;
  border-bottom: 1px solid var(--border);
}

.sidebar-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
}

nav#sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem 0 1.5rem;
  scrollbar-width: thin;
  scrollbar-color: var(--muted2) transparent;
}

nav#sidebar-nav::-webkit-scrollbar { width: 4px; }
nav#sidebar-nav::-webkit-scrollbar-track { background: transparent; }
nav#sidebar-nav::-webkit-scrollbar-thumb { background: var(--muted2); border-radius: 2px; }

.sidebar-loading {
  display: flex;
  justify-content: center;
  padding: 2rem;
}

.cat-group { margin-bottom: 0.25rem; }

.cat-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  cursor: pointer;
  user-select: none;
}

.cat-arrow {
  font-size: 0.6rem;
  color: var(--muted);
  transition: transform 0.2s;
  display: inline-block;
}

.cat-arrow.open { transform: rotate(90deg); }

.cat-name {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  flex: 1;
}

.cat-count {
  font-size: 0.68rem;
  background: var(--surface2);
  color: var(--muted);
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  font-family: var(--mono);
}

.cat-items {
  display: none;
  flex-direction: column;
}

.cat-items.open { display: flex; }

.api-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 1rem 0.5rem 1.5rem;
  cursor: pointer;
  border-radius: 0;
  transition: background 0.15s;
  border-left: 2px solid transparent;
}

.api-item:hover {
  background: rgba(124,109,250,0.07);
}

.api-item.active {
  background: rgba(124,109,250,0.12);
  border-left-color: var(--accent2);
}

.api-item-method {
  font-family: var(--mono);
  font-size: 0.6rem;
  font-weight: 700;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  text-transform: uppercase;
  flex-shrink: 0;
}

.api-item-method.post {
  background: rgba(124,109,250,0.18);
  color: var(--accent2);
}

.api-item-method.get {
  background: rgba(34,197,94,0.15);
  color: #4ade80;
}

.api-item-name {
  font-size: 0.83rem;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── OVERLAY (mobile) ─────────────────── */
.overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 150;
}

/* ── MAIN CONTENT ───────────────────────── */
.main-content {
  flex: 1;
  overflow-y: auto;
  padding: 2rem;
  scrollbar-width: thin;
  scrollbar-color: var(--muted2) transparent;
}

.main-content::-webkit-scrollbar { width: 5px; }
.main-content::-webkit-scrollbar-track { background: transparent; }
.main-content::-webkit-scrollbar-thumb { background: var(--muted2); border-radius: 3px; }

/* ── WELCOME ─────────────────────────────── */
.welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 300px;
  text-align: center;
  color: var(--muted);
}

.welcome-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  opacity: 0.4;
}

.welcome h2 {
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.5rem;
}

.welcome p {
  font-size: 0.9rem;
}

/* ── PLAYGROUND ─────────────────────────── */
.playground {
  max-width: 720px;
}

.play-header {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px 14px 0 0;
  padding: 1.25rem 1.5rem;
  border-bottom: none;
}

.play-title-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 0.5rem;
}

.method-badge {
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.25rem 0.6rem;
  border-radius: 6px;
  background: rgba(124,109,250,0.2);
  color: var(--accent2);
  border: 1px solid rgba(124,109,250,0.3);
  text-transform: uppercase;
}

.play-title-row code {
  font-family: var(--mono);
  font-size: 0.95rem;
  color: var(--text);
}

.play-desc {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 0.75rem;
}

.play-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.meta-chip {
  font-size: 0.72rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 0.2rem 0.6rem;
  border-radius: 6px;
}

/* ── PLAYGROUND BODY ─────────────────────── */
.play-body {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0 0 14px 14px;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.section-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 0.35rem;
  display: block;
}

textarea {
  width: 100%;
  min-height: 110px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-family: var(--sans);
  font-size: 0.9rem;
  padding: 0.85rem 1rem;
  resize: vertical;
  outline: none;
  transition: border-color 0.2s;
  line-height: 1.6;
}

textarea:focus { border-color: var(--accent); }
textarea::placeholder { color: var(--muted); }

button#send-btn {
  width: 100%;
  padding: 0.8rem;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: opacity 0.2s, transform 0.1s;
  font-family: var(--sans);
}

button#send-btn:hover { opacity: 0.88; }
button#send-btn:active { transform: scale(0.98); }
button#send-btn:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-icon { font-size: 0.75rem; }

.response-area { display: flex; flex-direction: column; }

.response-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.35rem;
}

.status-pill {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  font-family: var(--mono);
}

.status-pill.ok   { background: rgba(34,197,94,0.12); color: #4ade80; border: 1px solid rgba(34,197,94,0.25); }
.status-pill.err  { background: rgba(239,68,68,0.12);  color: #f87171; border: 1px solid rgba(239,68,68,0.25); }
.status-pill.hidden { display: none; }

pre {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.9rem 1rem;
  font-family: var(--mono);
  font-size: 0.82rem;
  line-height: 1.7;
  color: var(--text);
  min-height: 120px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.muted { color: var(--muted); }

/* ── EXTRA PARAMS ────────────────────────── */
.param-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.param-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.choice-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.choice-btn {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 8px;
  padding: 0.3rem 0.75rem;
  font-size: 0.78rem;
  font-family: var(--sans);
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.choice-btn:hover {
  border-color: var(--border-hover);
  color: var(--text);
}

.choice-btn.active {
  background: rgba(124,109,250,0.18);
  border-color: rgba(124,109,250,0.5);
  color: var(--accent2);
}

.num-stepper {
  display: inline-flex;
  align-items: center;
  gap: 0;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  width: fit-content;
}

.step-btn {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 1rem;
  width: 32px;
  height: 32px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s, background 0.15s;
  font-family: var(--sans);
}

.step-btn:hover {
  color: var(--text);
  background: rgba(255,255,255,0.05);
}

.step-val {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
  min-width: 28px;
  text-align: center;
  font-family: var(--mono);
}

/* ── SPINNER ────────────────────────── */
.spinner {
  width: 20px; height: 20px;
  border: 2px solid rgba(255,255,255,0.2);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.65s linear infinite;
  display: inline-block;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── RESPONSIVE ──────────────────────── */
@media (max-width: 700px) {
  .hamburger { display: flex; }

  .sidebar {
    position: fixed;
    left: calc(-1 * var(--sidebar-w));
    top: var(--header-h);
    height: calc(100vh - var(--header-h));
    z-index: 160;
    transition: left 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  }

  .sidebar.open {
    left: 0;
    box-shadow: 4px 0 24px rgba(0,0,0,0.5);
  }

  .overlay.open { display: block; }

  .main-content { padding: 1.25rem; }
}
