:root {
  --bg-deep: #0a0a0c;
  --bg-surface: #121216;
  --ink: #f0f0f5;
  --ink-dim: #a0a0ab;
  --ink-muted: #555560;
  --border: #2a2a30;
  --border-hover: #e63946;
  --accent: #e63946;
  --accent-dim: rgba(230, 57, 70, 0.15);
  --ok: #2a9d8f;
  --warn: #e9c46a;
  --bad: #e76f51;
}

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

html, body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "Manrope", "Segoe UI", sans-serif;
  background: var(--bg-deep);
}

a { color: inherit; text-decoration: none; }
h1, h2, h3, h4, h5 { margin: 0; font-weight: 600; }
code, pre { font-family: "Space Mono", monospace; }

:focus-visible { outline: 1px solid var(--accent); outline-offset: 2px; }

.backdrop {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 12% 12%, rgba(230, 57, 70, 0.08), transparent 26%),
    radial-gradient(circle at 80% 0%, rgba(255, 255, 255, 0.03), transparent 28%);
}

.app-container {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

.sidebar {
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

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

.header-title {
  color: var(--accent);
  font-size: 1.6rem;
  letter-spacing: -0.02em;
  font-family: "Chakra Petch", "Trebuchet MS", sans-serif;
}

.header-sub {
  color: var(--ink-dim);
  font-size: 0.82rem;
  margin-top: 0.4rem;
  line-height: 1.55;
}

.header-status {
  margin-top: 0.8rem;
  font-size: 0.75rem;
  color: var(--accent);
  font-family: "Space Mono", monospace;
  text-transform: uppercase;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  padding: 1.5rem 0;
  border-bottom: 1px solid var(--border);
}

#sectionNav {
  display: contents;
}

.tab-btn {
  background: transparent;
  border: none;
  border-left: 3px solid transparent;
  color: var(--ink-dim);
  text-align: left;
  width: 100%;
  padding: 0.7rem 1.5rem;
  font-family: "Manrope", sans-serif;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.tab-btn:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink);
}

.tab-btn.is-active {
  background: var(--accent-dim);
  border-left-color: var(--accent);
  color: var(--ink);
  font-weight: 600;
}

.sidebar-stats {
  padding: 1.5rem;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}

.stat { display: flex; flex-direction: column; }

.stat-label {
  color: var(--ink-muted);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.2rem;
}

.stat-value {
  color: var(--ink);
  font-size: 1rem;
  font-family: "Space Mono", monospace;
  word-break: break-word;
}

.content-area {
  padding: 2rem 2.5rem;
}

.tab-panel { display: none; }
.tab-panel.is-active { display: block; }

.panel-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.hero-card { margin-bottom: 1rem; }

.section-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.2rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.section-bar h2 {
  font-size: 1.15rem;
  color: var(--ink);
  font-family: "Chakra Petch", "Trebuchet MS", sans-serif;
}

.tab-count {
  font-family: "Space Mono", monospace;
  color: var(--ink-muted);
  font-size: 0.85rem;
}

.hero-copy {
  margin: 0 0 1rem;
  color: var(--ink-dim);
  line-height: 1.65;
  max-width: 72ch;
}

.base-grid,
.recipe-grid,
.endpoint-grid,
.meta-grid,
.badge-grid {
  display: grid;
  gap: 1rem;
}

.base-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.recipe-grid {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.badge-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.base-card,
.recipe-card,
.endpoint-card,
.meta-box,
.auth-card {
  background: var(--bg-deep);
  border: 1px solid var(--border);
  padding: 1rem;
}

.label {
  display: block;
  color: var(--ink-muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-family: "Space Mono", monospace;
  margin-bottom: 0.35rem;
}

.value {
  display: block;
  word-break: break-word;
  color: var(--ink);
}

.fact-list {
  margin: 0;
  padding-left: 1.2rem;
  color: var(--ink-dim);
  line-height: 1.65;
}

.fact-list li + li { margin-top: 0.45rem; }

.recipe-card h4,
.endpoint-card h4,
.meta-box h5,
.auth-card h4 {
  font-family: "Chakra Petch", "Trebuchet MS", sans-serif;
}

.recipe-card p,
.endpoint-summary,
.auth-card p {
  margin: 0.5rem 0 0;
  color: var(--ink-dim);
  line-height: 1.6;
}

.method {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 62px;
  padding: 0.28rem 0.5rem;
  border: 1px solid rgba(230, 57, 70, 0.35);
  background: var(--accent-dim);
  color: #ffd2d6;
  font-size: 0.74rem;
  font-family: "Space Mono", monospace;
}

.path {
  color: var(--ink);
  word-break: break-word;
  font-family: "Space Mono", monospace;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0.2rem 0.55rem;
  border: 1px solid var(--border);
  color: var(--ink-dim);
  background: rgba(255, 255, 255, 0.03);
  font-size: 0.72rem;
  font-family: "Space Mono", monospace;
}

.badge.is-ok {
  border-color: rgba(42, 157, 143, 0.4);
  color: #9de5dc;
}

.badge.is-warn {
  border-color: rgba(233, 196, 106, 0.4);
  color: #f4dd9c;
}

.badge.is-accent {
  border-color: rgba(230, 57, 70, 0.4);
  color: #ffabb2;
}

.endpoint-top {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}

.meta-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  margin-top: 0.85rem;
}

.param-list {
  margin: 0;
  padding-left: 1rem;
  color: var(--ink-dim);
  line-height: 1.5;
}

.param-list li + li { margin-top: 0.35rem; }

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

pre {
  margin: 0.85rem 0 0;
  padding: 0.8rem 0.9rem;
  border: 1px solid var(--border);
  background: #09090d;
  color: var(--ink);
  overflow-x: auto;
  white-space: pre-wrap;
}

.section-shell { display: none; }
.section-shell.is-active { display: block; }

.foot {
  display: flex;
  justify-content: space-between;
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px dotted var(--border);
  font-size: 0.8rem;
  color: var(--ink-muted);
}

.foot nav { display: flex; gap: 1rem; flex-wrap: wrap; }
.foot a:hover { color: var(--ink); }

@media (max-width: 900px) {
  .app-container { grid-template-columns: 1fr; }
  .sidebar { height: auto; position: relative; border-right: none; border-bottom: 1px solid var(--border); }
  .sidebar-stats { grid-template-columns: repeat(2, 1fr); gap: 0.8rem; }
  .sidebar-nav { flex-direction: row; flex-wrap: wrap; padding: 0.5rem 0; border: none; }
  .tab-btn { border-left: none; border-bottom: 2px solid transparent; padding: 0.75rem 1rem; }
  .tab-btn.is-active { border-bottom-color: var(--accent); }
  .content-area { padding: 1.5rem; }
  .foot { flex-direction: column; gap: 0.7rem; }
}
