:root {
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-muted: #f7f7f7;
  --ink: #111111;
  --ink-soft: #4a4a4a;
  --line: #e8e8e8;
  --line-strong: #d9d9d9;
  --accent-green: #8de58f;
}

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

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Space Grotesk", system-ui, sans-serif;
  overflow-x: hidden;
  overflow-y: auto;
}

.site-nav {
  position: sticky;
  top: 0;
  z-index: 40;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
}

.site-nav-inner {
  width: min(1200px, calc(100% - 2rem));
  margin-inline: auto;
  min-height: 3.5rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.45rem 0;
}

.site-brand {
  color: #111111;
  text-decoration: none;
  font-family: "Syne", "Space Grotesk", system-ui, sans-serif;
  font-size: 0.95rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  font-weight: 600;
}

.site-links {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.site-links a {
  color: #333333;
  text-decoration: none;
  font-size: 0.77rem;
  border: 1px solid transparent;
  border-radius: 0.35rem;
  padding: 0.38rem 0.62rem;
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease;
}

.site-links a:hover {
  background: #f2f2f2;
  border-color: #e3e3e3;
  color: #111111;
}

.site-links a.site-link-open-network {
  background: var(--accent-green);
  color: #ffffff;
  border-color: rgba(17, 17, 17, 0.2);
  font-weight: 600;
}

.site-links a.site-link-open-network:hover {
  background: color-mix(in srgb, var(--accent-green) 88%, #ffffff 12%);
  color: #ffffff;
}

.site-nav-toggle {
  display: none;
  margin-left: auto;
  width: 2rem;
  height: 2rem;
  border: 1px solid var(--line-strong);
  border-radius: 0.35rem;
  background: #ffffff;
  color: #222222;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
}

.site-nav-toggle-open,
.site-nav-toggle-close {
  display: inline-block;
}

.site-nav-toggle-close {
  display: none;
}

.site-nav.is-open .site-nav-toggle-open {
  display: none;
}

.site-nav.is-open .site-nav-toggle-close {
  display: inline-block;
}

.api-shell {
  width: min(1200px, calc(100% - 1.4rem));
  min-height: calc(100vh - 3.7rem);
  height: auto;
  margin: 0.8rem auto 1rem;
}

.api-panel {
  min-height: calc(100vh - 5.1rem);
  height: auto;
  border: 1px solid var(--line);
  border-radius: 0.9rem;
  background: var(--surface);
  display: grid;
  grid-template-rows: auto auto 1fr;
  box-shadow: 0 8px 24px rgba(17, 17, 17, 0.05);
  overflow: hidden;
}

.api-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  padding: 0.9rem 1rem 0.75rem;
  border-bottom: 1px solid var(--line);
}

.api-title-wrap {
  min-width: 0;
}

h1,
h2,
h3 {
  font-family: "Syne", "Space Grotesk", system-ui, sans-serif;
  color: #111111;
  letter-spacing: 0.01em;
}

.api-title-wrap h1 {
  margin: 0;
  font-size: clamp(1.35rem, 2.8vw, 1.9rem);
}

.api-title-wrap h2 {
  margin: 0.2rem 0 0;
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #2f2f2f;
}

.version-info {
  color: #666666;
  font-size: 0.8rem;
  margin-top: 0.25rem;
}

.group-tabs {
  display: flex;
  gap: 0.45rem;
  padding: 0.62rem 1rem;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
  background: linear-gradient(180deg, #ffffff 0%, #fafafa 100%);
}

.group-tab {
  margin: 0;
  border: 1px solid var(--line-strong);
  background: #ffffff;
  color: #333333;
  border-radius: 999px;
  padding: 0.42rem 0.78rem;
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
}

.group-tab:hover {
  background: #f7f7f7;
  border-color: #cfcfcf;
}

.group-tab.is-active {
  background: #111111;
  color: #ffffff;
  border-color: #111111;
}

.panel-columns {
  display: grid;
  grid-template-columns: minmax(0, 1.75fr) minmax(280px, 1fr);
  align-items: start;
}

.section-column {
  min-width: 0;
}

.response-column {
  min-width: 0;
  border-left: 1px solid var(--line);
  background: #fcfcfc;
}

.card-group {
  padding: 0.85rem 1rem 0.95rem;
}

.card-group.is-hidden {
  display: none;
}

.group-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.8rem;
  margin-bottom: 0.75rem;
  padding: 0.62rem 0.72rem;
  border: 1px solid var(--line);
  border-left: 3px solid #111111;
  border-radius: 0.55rem;
  background: linear-gradient(180deg, #ffffff 0%, #fafafa 100%);
}

.group-head h2 {
  margin: 0;
  font-size: 0.84rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
}

.group-head p {
  margin: 0;
  color: #666666;
  font-size: 0.76rem;
  line-height: 1.35;
}

.group-grid {
  display: grid;
  gap: 0.9rem;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  align-items: stretch;
}

.response-grid {
  grid-template-columns: 1fr;
}

.card {
  border: 1px solid var(--line);
  border-radius: 0.75rem;
  padding: 0.8rem;
  background: #fcfcfc;
  display: flex;
  flex-direction: column;
  min-height: 100%;
}

.card.response {
  background: var(--surface);
}

.card h3 {
  margin: 0 0 0.75rem;
  font-family: "Syne", "Space Grotesk", system-ui, sans-serif;
  color: #111111;
  letter-spacing: 0.01em;
  font-size: 0.98rem;
}

.card > :not(button) {
  order: 1;
}

.card > button {
  order: 2;
  margin-top: auto;
}

label {
  display: block;
  width: 100%;
  margin: 0 0 0.36rem;
  font-size: 0.78rem;
  color: #555555;
}

input,
textarea {
  display: block;
  width: 100%;
  margin: 0 0 0.74rem;
  border: 1px solid var(--line-strong);
  border-radius: 0.45rem;
  background: #ffffff;
  color: #111111;
  padding: 0.5rem 0.58rem;
  font-family: "Space Grotesk", system-ui, sans-serif;
  font-size: 0.88rem;
}

textarea {
  min-height: 120px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
    "Liberation Mono", "Courier New", monospace;
}

input:focus,
textarea:focus {
  outline: none;
  border-color: #111111;
}

button {
  border: 1px solid #111111;
  border-radius: 0.45rem;
  background: #111111;
  color: #ffffff;
  padding: 0.5rem 0.8rem;
  font-weight: 600;
  font-family: "Space Grotesk", system-ui, sans-serif;
  font-size: 0.82rem;
  cursor: pointer;
  transition: background 160ms ease, transform 120ms ease, border-color 160ms ease;
}

button:hover {
  background: #2a2a2a;
  border-color: #2a2a2a;
}

button:active {
  transform: translateY(1px);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

button.secondary {
  background: var(--accent-green);
  border-color: rgba(17, 17, 17, 0.2);
  color: #ffffff;
}

button.secondary:hover {
  background: color-mix(in srgb, var(--accent-green) 88%, #ffffff 12%);
  border-color: rgba(17, 17, 17, 0.22);
}

pre {
  margin: 0;
  background: var(--surface-muted);
  color: #111111;
  border: 1px solid var(--line);
  border-radius: 0.55rem;
  padding: 0.58rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
    "Liberation Mono", "Courier New", monospace;
  font-size: 0.79rem;
  line-height: 1.42;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: break-word;
  max-width: 100%;
  max-height: 260px;
  overflow: auto;
}

.card.response pre {
  min-height: 180px;
  max-height: calc(100vh - 14rem);
}

@media (max-width: 900px) {
  .site-nav-inner {
    width: calc(100% - 1.5rem);
    align-items: center;
    flex-wrap: wrap;
  }

  .site-brand {
    max-width: calc(100% - 2.8rem);
    font-size: 0.78rem;
  }

  .site-nav-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .site-links {
    display: none;
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 0.3rem;
    padding-top: 0.25rem;
  }

  .site-nav.is-open .site-links {
    display: flex;
  }

  .site-links a {
    width: 100%;
    text-align: left;
    background: #ffffff;
    border: 1px solid var(--line);
  }

  .site-links a.site-link-open-network {
    color: #ffffff;
    border-color: rgba(17, 17, 17, 0.22);
  }

  .panel-columns {
    grid-template-columns: 1fr;
  }

  .response-column {
    border-left: 0;
    border-top: 1px solid var(--line);
  }
}

@media (max-width: 720px) {
  .api-shell {
    width: calc(100% - 1rem);
    margin: 0.45rem auto;
  }

  .api-title-wrap h1 {
    font-size: clamp(1.2rem, 7vw, 1.55rem);
    line-height: 1.15;
  }

  .api-title-wrap h2 {
    font-size: 0.84rem;
  }

  .group-tabs {
    padding: 0.56rem 0.75rem;
  }

  .group-tab {
    font-size: 0.76rem;
    padding: 0.4rem 0.7rem;
  }

  .card-group {
    padding: 0.75rem;
  }

  .group-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
  }

  .group-grid {
    grid-template-columns: 1fr;
  }
}
