:root {
  --bg-main: #070b14;
  --bg-surface: #0f172a;
  --bg-elevated: #162038;
  --bg-code: #090e1a;
  --border-subtle: rgba(148, 163, 184, 0.14);
  --border-accent: rgba(56, 189, 248, 0.4);
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --accent-blue: #38bdf8;
  --accent-blue-dark: #0284c7;
  --accent-green: #10b981;
  --accent-amber: #f59e0b;
  --accent-red: #ef4444;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, Helvetica, Arial, sans-serif;
  --font-mono: "JetBrains Mono", "Fira Code", Consolas, Monaco, monospace;
}

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

html {
  scroll-behavior: smooth;
}

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

.bg-grid {
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(to right, rgba(148, 163, 184, 0.04) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(148, 163, 184, 0.04) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
  z-index: 0;
}

.ambient-glow {
  position: fixed;
  border-radius: 50%;
  filter: blur(130px);
  pointer-events: none;
  z-index: 0;
  opacity: 0.15;
}

.glow-primary {
  width: 560px;
  height: 560px;
  background: radial-gradient(circle, #0ea5e9 0%, transparent 70%);
  top: -180px;
  left: -120px;
}

.glow-secondary {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, #10b981 0%, transparent 70%);
  bottom: -180px;
  right: -100px;
}

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

.mono {
  font-family: var(--font-mono);
}

code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: rgba(56, 189, 248, 0.1);
  color: var(--accent-blue);
  padding: 2px 6px;
  border-radius: 4px;
}

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

.header-inner {
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--text-primary);
}

.brand-logo {
  display: flex;
  align-items: center;
}

.brand-titles {
  display: flex;
  flex-direction: column;
}

.brand-name {
  font-weight: 800;
  font-size: 17px;
  letter-spacing: 0.04em;
}

.brand-domain {
  color: var(--accent-blue);
}

.brand-sub {
  font-size: 11px;
  color: var(--text-muted);
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 22px;
}

.main-nav a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: color 0.15s ease;
}

.main-nav a:hover {
  color: var(--accent-blue);
}

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

.gateway-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.3);
  font-size: 12px;
  color: #34d399;
}

.dot-live {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-green);
  box-shadow: 0 0 8px var(--accent-green);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 14px;
  padding: 10px 18px;
  cursor: pointer;
  transition: all 0.15s ease;
  border: 1px solid transparent;
}

.btn-sm {
  padding: 7px 13px;
  font-size: 13px;
}

.btn-xs {
  padding: 5px 10px;
  font-size: 12px;
}

.btn-primary {
  background: linear-gradient(135deg, #0284c7, #0369a1);
  color: #fff;
  border-color: rgba(56, 189, 248, 0.35);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #0ea5e9, #0284c7);
}

.btn-outline {
  background: rgba(15, 23, 42, 0.8);
  color: var(--text-primary);
  border-color: var(--border-subtle);
}

.btn-outline:hover {
  border-color: var(--accent-blue);
  color: var(--accent-blue);
}

.btn-copy {
  background: rgba(56, 189, 248, 0.12);
  color: var(--accent-blue);
  border-color: rgba(56, 189, 248, 0.3);
}

.btn-copy:hover {
  background: rgba(56, 189, 248, 0.22);
}

/* Main Content */
.main-content {
  padding-top: 28px;
  padding-bottom: 64px;
}

.notice-banner {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 18px;
  border-radius: 10px;
  background: rgba(56, 189, 248, 0.07);
  border: 1px solid rgba(56, 189, 248, 0.25);
  margin-bottom: 32px;
  font-size: 14px;
  color: var(--text-secondary);
}

.notice-badge {
  flex-shrink: 0;
  padding: 3px 8px;
  border-radius: 5px;
  background: rgba(56, 189, 248, 0.18);
  color: var(--accent-blue);
  font-size: 11px;
  font-weight: 700;
  margin-top: 2px;
}

/* Hero */
.hero-section {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 28px;
  align-items: stretch;
  margin-bottom: 48px;
}

.version-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.tag {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 6px;
  font-weight: 600;
}

.tag-blue {
  background: rgba(56, 189, 248, 0.12);
  color: var(--accent-blue);
  border: 1px solid rgba(56, 189, 248, 0.3);
}

.tag-green {
  background: rgba(16, 185, 129, 0.12);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.tag-slate {
  background: rgba(148, 163, 184, 0.12);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
}

.hero-left h1 {
  font-size: 32px;
  line-height: 1.22;
  font-weight: 800;
  margin-bottom: 16px;
  letter-spacing: -0.02em;
}

.hero-lead {
  color: var(--text-secondary);
  font-size: 16px;
  margin-bottom: 24px;
}

.endpoint-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.endpoint-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.endpoint-label {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.endpoint-value {
  font-size: 14px;
  color: #fff;
  background: var(--bg-code);
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid var(--border-subtle);
}

.endpoint-note {
  font-size: 12px;
  color: var(--text-secondary);
}

/* Arch Card */
.arch-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 100%;
}

.arch-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 14px;
}

.arch-title {
  font-weight: 700;
  font-size: 14px;
}

.arch-rev {
  font-size: 11px;
  color: var(--accent-blue);
}

.spec-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 18px;
}

.spec-list li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
  padding-bottom: 8px;
  border-bottom: 1px dashed rgba(148, 163, 184, 0.1);
}

.spec-key {
  color: var(--text-secondary);
}

.spec-val {
  color: var(--text-primary);
  text-align: right;
  font-size: 12px;
}

.arch-footer {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding-top: 12px;
  border-top: 1px solid var(--border-subtle);
}

.metric-box {
  background: var(--bg-code);
  padding: 10px;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
}

.metric-label {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.metric-num {
  font-size: 16px;
  font-weight: 700;
}

.text-green {
  color: #34d399;
}

/* Sections */
.section-block {
  margin-bottom: 48px;
}

.section-head {
  margin-bottom: 20px;
}

.section-head h2 {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 6px;
}

.section-sub {
  color: var(--text-secondary);
  font-size: 14px;
}

/* Spec Explorer */
.spec-explorer {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 18px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 16px;
}

.method-tabs {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.method-tab {
  text-align: left;
  background: var(--bg-code);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 12px 14px;
  color: var(--text-primary);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: all 0.15s ease;
}

.method-tab:hover {
  border-color: rgba(56, 189, 248, 0.4);
}

.method-tab.active {
  background: var(--bg-elevated);
  border-color: var(--accent-blue);
  box-shadow: inset 3px 0 0 var(--accent-blue);
}

.method-badge {
  align-self: flex-start;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(56, 189, 248, 0.15);
  color: var(--accent-blue);
}

.badge-stream {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
}

.badge-get {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
}

.method-name {
  font-size: 14px;
  font-weight: 700;
}

.method-desc {
  font-size: 12px;
  color: var(--text-secondary);
}

.method-viewer {
  display: flex;
  flex-direction: column;
  background: var(--bg-code);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  overflow: hidden;
}

.viewer-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background: rgba(15, 23, 42, 0.9);
  border-bottom: 1px solid var(--border-subtle);
}

.viewer-path {
  font-size: 12px;
  color: var(--accent-blue);
}

.code-block {
  padding: 16px;
  font-size: 12.5px;
  line-height: 1.55;
  color: #e2e8f0;
  overflow-x: auto;
  white-space: pre;
}

/* Inspector */
.inspector-grid {
  display: grid;
  grid-template-columns: 1fr 1.15fr;
  gap: 20px;
}

.inspector-form {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-row label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}

.input-control {
  background: var(--bg-code);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--text-primary);
  font-size: 13px;
}

.input-control:focus {
  outline: none;
  border-color: var(--accent-blue);
}

.inspector-output {
  background: var(--bg-code);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.output-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  font-size: 12px;
  color: var(--text-secondary);
}

.status-code {
  padding: 3px 8px;
  border-radius: 4px;
  font-weight: 700;
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
}

.status-code.is-error {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
}

/* Tables */
.table-wrap {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

.data-table th,
.data-table td {
  padding: 13px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border-subtle);
}

.data-table th {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  background: rgba(9, 14, 26, 0.6);
}

.data-table tr:last-child td {
  border-bottom: none;
}

.badge-ok {
  color: #34d399;
  font-weight: 700;
}

.badge-err {
  color: #f87171;
  font-weight: 700;
}

.badge-warn {
  color: #fbbf24;
  font-weight: 700;
}

.status-pill {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  font-family: var(--font-mono);
}

.pill-online {
  background: rgba(16, 185, 129, 0.14);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--border-subtle);
  background: rgba(7, 11, 20, 0.9);
  padding: 28px 0;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

.footer-text {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 6px;
}

.footer-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  font-size: 12px;
  color: var(--text-muted);
}

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(3, 7, 18, 0.78);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
}

.modal-backdrop.is-open {
  opacity: 1;
  pointer-events: auto;
}

.modal-window {
  width: 100%;
  max-width: 480px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  overflow: hidden;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-subtle);
}

.modal-header h3 {
  font-size: 16px;
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 16px;
}

.modal-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.modal-alert {
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.35);
  color: #fbbf24;
  font-size: 11.5px;
}

.modal-desc {
  font-size: 13.5px;
  color: var(--text-secondary);
}

.modal-error {
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #f87171;
  font-size: 12px;
}

.modal-actions {
  margin-top: 8px;
  display: flex;
  justify-content: flex-end;
}

@media (max-width: 960px) {
  .hero-section,
  .spec-explorer,
  .inspector-grid {
    grid-template-columns: 1fr;
  }

  .main-nav {
    display: none;
  }

  .endpoint-cards {
    grid-template-columns: 1fr;
  }
}
