:root {
  --bg: #0a0a0a;
  --bg-elevated: #111111;
  --card: #141414;
  --card-hover: #1a1a1a;
  --input: #1c1c1c;
  --border: #262626;
  --text: #f5f5f5;
  --text-muted: #737373;
  --text-secondary: #a3a3a3;
  --blue: #3b82f6;
  --blue-hover: #2563eb;
  --blue-muted: #1d4ed8;
  --purple: #8b5cf6;
  --green: #22c55e;
  --green-bg: rgba(34, 197, 94, 0.12);
  --red: #ef4444;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
  --font: "Noto Sans Mono", "Noto Sans Thai", monospace, sans-serif;
  --layout-max: 900px;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: "Noto Sans Mono", "Noto Sans Thai", monospace, sans-serif !important;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font) !important;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--blue);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* Header */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(10, 10, 10, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  max-width: var(--layout-max);
  margin: 0 auto;
  padding: 16px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--purple), #6366f1);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.brand-icon svg {
  width: 20px;
  height: 20px;
  color: white;
}

.brand-text h1 {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.brand-text p {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.lang-toggle {
  display: flex;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.lang-btn {
  padding: 6px 14px;
  font-size: 0.78rem;
  font-weight: 600;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
}

.lang-btn.active {
  background: var(--blue);
  color: white;
}

.api-status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: var(--green-bg);
  border: 1px solid rgba(34, 197, 94, 0.25);
  border-radius: 999px;
  font-size: 0.72rem;
  color: var(--green);
  max-width: 280px;
}

.api-status .dot {
  width: 7px;
  height: 7px;
  background: var(--green);
  border-radius: 50%;
  flex-shrink: 0;
  animation: pulse 2s infinite;
}

.api-status span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* Main */
.main {
  max-width: var(--layout-max);
  margin: 0 auto;
  padding: 32px 32px 64px;
}

/* Doc hero */
.doc-hero {
  text-align: center;
  margin-bottom: 40px;
}

.doc-hero-title {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 10px;
  letter-spacing: -0.02em;
}

.doc-hero-desc {
  color: var(--text-muted);
  font-size: 0.88rem;
  margin-bottom: 28px;
  line-height: 1.7;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.stat-value.blue { color: var(--blue); }
.stat-value.green { color: var(--green); }
.stat-value.purple { color: var(--purple); }
.stat-value.orange { color: #f59e0b; }

.stat-label {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.rate-limit-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px 20px;
  background: rgba(88, 101, 242, 0.08);
  border: 1px solid rgba(88, 101, 242, 0.28);
  border-radius: var(--radius);
}

.rate-limit-content {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text);
  text-align: center;
}

.rate-limit-content .discord-icon {
  color: #5865f2;
  flex-shrink: 0;
}

.rate-limit-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: rgba(88, 101, 242, 0.15);
  border: 1px solid rgba(88, 101, 242, 0.35);
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  color: #5865f2;
  white-space: nowrap;
}

.rate-limit-badge .discord-icon {
  color: #5865f2;
  flex-shrink: 0;
  display: block;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.35rem;
  font-weight: 700;
  margin-bottom: 8px;
  letter-spacing: -0.02em;
}

.section-title svg {
  color: var(--blue);
}

.section-desc {
  color: var(--text-muted);
  font-size: 0.88rem;
  margin-bottom: 28px;
}

/* Token panel */
.token-panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 24px;
}

.token-panel-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.92rem;
  font-weight: 600;
  margin-bottom: 6px;
}

.token-panel-header svg {
  color: var(--blue);
}

.token-required {
  color: var(--red);
}

.token-desc {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 14px;
}

.token-input-row {
  display: flex;
  gap: 10px;
  align-items: stretch;
}

.token-input-wrapper {
  flex: 1;
}

.token-input-wrapper input {
  width: 100%;
  padding: 12px 14px 12px 42px;
  background: var(--input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.88rem;
  outline: none;
  transition: border-color 0.15s;
}

.token-input-wrapper input:focus {
  border-color: var(--blue);
}

.token-toggle-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  background: var(--input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
  flex-shrink: 0;
}

.token-toggle-btn:hover {
  color: var(--text);
  border-color: #333;
}

.token-hint {
  margin-top: 10px;
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Endpoint cards */
.endpoints {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.endpoint {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 0.15s;
}

.endpoint:hover {
  border-color: #333;
}

.endpoint.open {
  border-color: #333;
  box-shadow: var(--shadow);
}

.endpoint-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  cursor: pointer;
  user-select: none;
}

.endpoint-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.endpoint-icon svg {
  width: 18px;
  height: 18px;
}

.endpoint-icon.blue { background: rgba(59, 130, 246, 0.15); color: var(--blue); }
.endpoint-icon.purple { background: rgba(139, 92, 246, 0.15); color: var(--purple); }
.endpoint-icon.green { background: rgba(34, 197, 94, 0.15); color: var(--green); }
.endpoint-icon.orange { background: rgba(249, 115, 22, 0.15); color: #f97316; }
.endpoint-icon.pink { background: rgba(236, 72, 153, 0.15); color: #ec4899; }
.endpoint-icon.cyan { background: rgba(6, 182, 212, 0.15); color: #06b6d4; }
.endpoint-icon.yellow { background: rgba(234, 179, 8, 0.15); color: #eab308; }
.endpoint-icon.red { background: rgba(239, 68, 68, 0.15); color: var(--red); }

.endpoint-info {
  flex: 1;
  min-width: 0;
}

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

.method-badge {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 5px;
  letter-spacing: 0.04em;
}

.method-badge.get {
  background: rgba(59, 130, 246, 0.15);
  color: var(--blue);
}

.endpoint-name {
  font-size: 0.92rem;
  font-weight: 600;
}

.endpoint-path {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 3px;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.copy-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  transition: color 0.15s;
}

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

.chevron {
  color: var(--text-muted);
  transition: transform 0.2s;
  flex-shrink: 0;
}

.endpoint.open .chevron {
  transform: rotate(180deg);
}

/* Expanded body */
.endpoint-body {
  display: none;
  border-top: 1px solid var(--border);
  padding: 20px 18px 22px;
}

.endpoint.open .endpoint-body {
  display: block;
}

.endpoint-desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 20px;
  line-height: 1.7;
}

.endpoint-desc .note {
  display: block;
  margin-top: 8px;
  padding: 10px 14px;
  background: rgba(234, 179, 8, 0.08);
  border: 1px solid rgba(234, 179, 8, 0.2);
  border-radius: var(--radius-sm);
  color: #fbbf24;
  font-size: 0.8rem;
}

/* Params table */
.params-table-wrap {
  overflow-x: auto;
  margin-bottom: 20px;
}

.params-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.params-table th {
  text-align: left;
  padding: 8px 12px;
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border);
}

.params-table td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(38, 38, 38, 0.6);
  vertical-align: top;
}

.param-name {
  color: var(--blue);
  font-size: 0.8rem;
}

.param-type {
  color: var(--text-muted);
  font-size: 0.78rem;
}

.req-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
}

.req-icon.yes { color: var(--green); }
.req-icon.no { color: var(--red); opacity: 0.7; }

.no-params {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 20px;
  font-style: italic;
}

/* Input fields */
.input-group {
  margin-bottom: 14px;
}

.input-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.input-wrapper {
  position: relative;
}

.input-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.input-wrapper input {
  width: 100%;
  padding: 12px 14px 12px 42px;
  background: var(--input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.88rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
}

.input-wrapper input:focus {
  border-color: var(--blue);
}

.input-wrapper input::placeholder {
  color: var(--text-muted);
}

/* Send button */
.send-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 22px;
  background: var(--blue);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
  margin-top: 4px;
}

.send-btn:hover {
  background: var(--blue-hover);
}

.send-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.send-btn.loading svg.spinner {
  animation: spin 0.8s linear infinite;
}

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

/* Response */
.response-box {
  margin-top: 20px;
  display: none;
}

.response-box.visible {
  display: block;
}

.response-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  gap: 12px;
}

.response-meta {
  display: flex;
  align-items: center;
  gap: 8px;
}

.response-type {
  font-size: 0.68rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(139, 92, 246, 0.12);
  color: var(--purple);
  letter-spacing: 0.02em;
}

.response-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.response-stats {
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
}

.status-badge.ok {
  background: var(--green-bg);
  color: var(--green);
}

.status-badge.err {
  background: rgba(239, 68, 68, 0.12);
  color: var(--red);
}

.latency-badge {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(163, 163, 163, 0.1);
  color: var(--text-muted);
  display: none;
}

.latency-badge.visible {
  display: inline-flex;
}

.response-pre {
  background: #080808;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 18px 20px;
  font-size: 0.82rem;
  overflow-x: auto;
  max-height: 520px;
  overflow-y: auto;
  line-height: 1.75;
  tab-size: 2;
}

.json-view {
  display: block;
  white-space: pre;
  word-break: normal;
  color: var(--text-secondary);
}

.json-key { color: #93c5fd; }
.json-string { color: #86efac; }
.json-number { color: #fcd34d; }
.json-boolean { color: #f472b6; }
.json-null { color: #a78bfa; }
.json-punct { color: #6b7280; }

/* Footer */
.footer {
  text-align: center;
  padding: 24px;
  color: var(--text-muted);
  font-size: 0.78rem;
  border-top: 1px solid var(--border);
}

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  box-shadow: var(--shadow);
  transition: transform 0.25s ease;
  z-index: 200;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
}

@media (min-width: 1024px) {
  :root {
    --layout-max: 1180px;
  }

  .main {
    padding: 40px 40px 72px;
  }

  .response-pre {
    font-size: 0.86rem;
    max-height: 640px;
    padding: 20px 24px;
  }
}

@media (min-width: 1440px) {
  :root {
    --layout-max: 1320px;
  }
}

/* Responsive */
@media (max-width: 640px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .rate-limit-content {
    justify-content: center;
  }

  .header-inner {
    flex-wrap: wrap;
  }

  .api-status {
    max-width: 100%;
    order: 3;
    width: 100%;
    justify-content: center;
  }

  .endpoint-header {
    padding: 14px;
    gap: 10px;
  }

  .endpoint-icon {
    width: 34px;
    height: 34px;
  }
}
