:root {
  color-scheme: dark;
  --page: #101713;
  --sidebar: #141d18;
  --surface: #19231d;
  --surface-raised: #202c24;
  --surface-code: #101713;
  --line: #2b3b31;
  --line-bright: #405445;
  --text: #eef2e8;
  --muted: #9eac9f;
  --subtle: #718174;
  --accent: #c6f36b;
  --accent-ink: #17200f;
  --blue: #9bc9ff;
  --green: #94dfa6;
  --red: #ff9a8f;
  --radius: 16px;
  --shadow: 0 18px 55px rgba(0, 0, 0, 0.22);
}

* { box-sizing: border-box; }

html { min-width: 320px; scroll-behavior: smooth; }

body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(ellipse at 75% -15%, rgba(116, 161, 88, 0.12), transparent 38rem),
    var(--page);
  color: var(--text);
  font: 15px/1.65 "Open Sans", Inter, system-ui, sans-serif;
}

button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

code, .path, .try-bar input, .try-bar .verb, .try-status, .try-result pre,
.nav-endpoint, table.params td.name, table.params td.type {
  font-family: "JetBrains Mono", "Cascadia Code", Consolas, monospace;
}

#sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 20;
  display: flex;
  width: 264px;
  flex-direction: column;
  overflow: auto;
  padding: 27px 18px 18px;
  background: rgba(20, 29, 24, 0.96);
  border-right: 1px solid var(--line);
  backdrop-filter: blur(18px);
}

.sidebar-brand-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0 2px 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid rgba(198, 243, 107, 0.35);
  border-radius: 13px;
  background: rgba(198, 243, 107, 0.1);
  color: var(--accent);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.07em;
}

.brand-title { color: var(--text); font-size: 15px; font-weight: 700; }
.brand-tag { color: var(--muted); font-size: 11px; }
.login-button {
  min-height: 36px;
  padding: 0 11px;
  border: 1px solid var(--line-bright);
  border-radius: 8px;
  background: var(--surface-raised);
  color: var(--accent);
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
}
.login-button:hover { border-color: var(--accent); background: rgba(198, 243, 107, .08); }
#nav { display: flex; flex: 1; flex-direction: column; gap: 6px; }
.nav-group { margin: 0; }

.nav-resource {
  display: flex;
  align-items: center;
  min-height: 42px;
  padding: 9px 11px;
  border: 1px solid transparent;
  border-radius: 10px;
  color: #c2cec2;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: background 140ms ease, color 140ms ease, border-color 140ms ease;
}

.nav-resource:hover { background: rgba(255, 255, 255, 0.04); color: var(--text); }
.nav-resource.active {
  border-color: rgba(198, 243, 107, 0.14);
  background: rgba(198, 243, 107, 0.09);
  color: var(--accent);
}

.nav-endpoints {
  display: flex;
  flex-direction: column;
  margin: 3px 0 8px 18px;
  padding-left: 12px;
  border-left: 1px solid var(--line);
}

.nav-endpoint {
  padding: 5px 0;
  color: var(--subtle);
  cursor: pointer;
  font-size: 11px;
  text-decoration: none;
  transition: color 140ms ease;
}

.nav-endpoint:hover { color: var(--accent); }
.sidebar-foot { display: flex; gap: 16px; padding: 16px 8px 4px; border-top: 1px solid var(--line); }
.sidebar-foot a { color: var(--muted); font-size: 12px; text-decoration: none; }
.sidebar-foot a:hover { color: var(--accent); }

.auth-dialog {
  width: min(460px, calc(100vw - 32px));
  max-width: none;
  max-height: calc(100vh - 32px);
  padding: 0;
  overflow: auto;
  border: 1px solid var(--line-bright);
  border-radius: 18px;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
}
.auth-dialog::backdrop { background: rgba(4, 8, 5, .76); backdrop-filter: blur(5px); }
.auth-card { position: relative; padding: 30px; }
.auth-card h2 { margin: 7px 0; font-size: 24px; font-weight: 600; letter-spacing: -.04em; }
.auth-card p { margin: 0 0 20px; color: var(--muted); font-size: 13px; }
.auth-card label { display: block; margin: 14px 0 6px; color: #c4cec4; font-size: 12px; font-weight: 600; }
.auth-card input {
  width: 100%;
  min-height: 43px;
  padding: 0 12px;
  border: 1px solid var(--line-bright);
  border-radius: 8px;
  background: var(--surface-code);
  color: var(--text);
}
.auth-close {
  position: absolute;
  top: 14px;
  right: 16px;
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 21px;
}
.auth-close:hover { color: var(--text); border-color: var(--line-bright); }
.auth-submit { width: 100%; margin-top: 20px; }
.auth-message { margin-top: 12px; color: var(--red); font-size: 12px; }
.auth-token {
  display: block;
  max-height: 120px;
  padding: 12px;
  overflow-wrap: anywhere;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-code);
  color: var(--accent);
  user-select: all;
}
.auth-result-actions { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 16px; }
.auth-result-actions .primary-button, .auth-result-actions .secondary-button { min-height: 38px; }
.auth-stats-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 16px 0; }
.auth-stats-card { display: flex; min-width: 0; flex-direction: column; gap: 5px; padding: 11px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-code); }
.auth-stats-card span { color: var(--muted); font-size: 10px; }
.auth-stats-card strong { color: var(--accent); font-size: 19px; font-variant-numeric: tabular-nums; }
.auth-stats-title { margin: 18px 0 8px; font-size: 13px; font-weight: 600; }
.auth-stats-list { max-height: 210px; overflow: auto; margin: 0; padding: 0; list-style: none; }
.auth-stats-list li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-top: 1px solid var(--line); font: 11px "JetBrains Mono", monospace; }
.auth-stats-list li span { overflow-wrap: anywhere; color: var(--muted); }
.auth-stats-list li strong { flex: 0 0 auto; color: var(--accent); }

#content {
  width: min(100% - 264px, 1200px);
  margin-left: 264px;
  padding: 52px clamp(28px, 5vw, 78px) 90px;
}

.resource-section { min-width: 0; animation: enter 240ms ease both; }
.resource-section[hidden] { display: none; }
@keyframes enter { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }

.hero {
  position: relative;
  overflow: hidden;
  margin-bottom: 30px;
  padding: clamp(26px, 4vw, 48px);
  border: 1px solid var(--line);
  border-radius: 22px;
  background:
    radial-gradient(ellipse at 90% 15%, rgba(198, 243, 107, 0.13), transparent 25rem),
    linear-gradient(135deg, #1d2b22, #17211b 75%);
  box-shadow: var(--shadow);
}

.overview-hero {
  margin-bottom: 22px;
  padding: 30px 36px;
}

.overview-hero h1 {
  margin: 8px 0 6px;
  font-size: clamp(30px, 3vw, 40px);
}

.overview-hero > p { max-width: 620px; font-size: 14px; }
.overview-hero .hero-actions { margin-top: 16px; }
.overview-hero .primary-button, .overview-hero .secondary-button { min-height: 38px; }

.hero::after {
  position: absolute;
  right: 7%;
  bottom: -96px;
  width: 230px;
  height: 230px;
  border: 1px solid rgba(198, 243, 107, 0.09);
  border-radius: 50%;
  box-shadow: 0 0 0 30px rgba(198, 243, 107, 0.025), 0 0 0 60px rgba(198, 243, 107, 0.02);
  content: "";
  pointer-events: none;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--accent);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.eyebrow-mark, .status-pip {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 13px rgba(198, 243, 107, 0.55);
}

.hero h1 {
  max-width: 780px;
  margin: 12px 0 10px;
  color: var(--text);
  font-size: clamp(30px, 4.4vw, 52px);
  font-weight: 600;
  letter-spacing: -0.055em;
  line-height: 1.13;
}

.hero > p {
  max-width: 680px;
  margin: 0;
  color: #b7c5b8;
  font-size: clamp(14px, 1.35vw, 17px);
}

.hero .base {
  display: inline-block;
  margin-top: 22px;
  padding: 7px 10px;
  border: 1px solid var(--line-bright);
  border-radius: 7px;
  background: rgba(9, 15, 11, 0.35);
  color: var(--muted);
  font: 11px "JetBrains Mono", monospace;
}

.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 24px; }
.primary-button, .secondary-button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 9px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  transition: transform 140ms ease, background 140ms ease, border-color 140ms ease;
}

.primary-button { background: var(--accent); color: var(--accent-ink); }
.primary-button:hover { transform: translateY(-1px); background: #d7ff8b; }
.secondary-button { border-color: var(--line-bright); background: rgba(255,255,255,.025); color: var(--text); }
.secondary-button:hover { border-color: var(--accent); }

.health-panel, .overview-card, .endpoint {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.health-panel { margin-bottom: 20px; padding: 23px 24px 18px; }
.health-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.health-copy h2 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 5px 0 0;
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.025em;
}

.health-copy > p { margin: 2px 0 0 19px; color: var(--muted); font-size: 12px; }
.health-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--subtle); }
.health-panel[data-state="ok"] .health-dot { background: var(--green); box-shadow: 0 0 12px rgba(148, 223, 166, .5); }
.health-panel[data-state="error"] .health-dot { background: var(--red); box-shadow: 0 0 12px rgba(255, 154, 143, .35); }
.icon-button {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-raised);
  color: var(--muted);
  cursor: pointer;
  font-size: 21px;
  transition: color 140ms ease, transform 140ms ease;
}
.icon-button:hover { color: var(--accent); transform: rotate(25deg); }
.health-panel[data-state="loading"] .icon-button { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.health-metrics {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 9px;
  margin-top: 22px;
  padding-top: 17px;
  border-top: 1px solid var(--line);
}

.metric { display: flex; min-width: 0; flex-direction: column; gap: 2px; }
.metric-value { color: var(--text); font-size: 20px; font-weight: 600; letter-spacing: -0.04em; font-variant-numeric: tabular-nums; }
.metric-label { overflow: hidden; color: var(--muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.overview-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 13px; margin: 20px 0 38px; }
.overview-card { min-height: 185px; padding: 19px; transition: border-color 150ms ease, transform 150ms ease; }
.overview-card:hover { transform: translateY(-2px); border-color: var(--line-bright); }
.card-icon { color: var(--accent); font: 17px "JetBrains Mono", monospace; }
.overview-card h3 { margin: 11px 0 5px; font-size: 15px; font-weight: 600; }
.overview-card p { margin: 0 0 13px; color: var(--muted); font-size: 12px; line-height: 1.6; }
.text-link { padding: 0; border: 0; background: none; color: var(--accent); cursor: pointer; font-size: 12px; font-weight: 600; }
.text-link:hover { color: #d7ff8b; }

.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin: 0 0 14px; }
.section-heading h2 { margin: 5px 0 0; font-size: clamp(20px, 2.4vw, 26px); font-weight: 600; letter-spacing: -0.04em; }
.section-hint { color: var(--muted); font-size: 12px; }
.overview-footnote { display: flex; align-items: center; gap: 9px; margin-top: 17px; color: var(--muted); font-size: 12px; }
.overview-footnote .status-pip { width: 6px; height: 6px; flex: 0 0 auto; }

.section { margin: 34px 0 5px; color: var(--text); font-size: 21px; font-weight: 600; letter-spacing: -0.035em; }
.section-summary { margin: 0 0 20px; color: var(--muted); font-size: 13px; }
.divider { height: 1px; margin: 30px 0; background: linear-gradient(90deg, transparent, var(--line-bright), transparent); }

.endpoint { overflow: hidden; margin-bottom: 17px; }
.endpoint-head { display: flex; min-height: 58px; align-items: center; gap: 12px; padding: 13px 18px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.018); }
.endpoint-symbol { display: grid; width: 30px; height: 30px; flex: 0 0 auto; place-items: center; border: 1px solid var(--line); border-radius: 8px; color: var(--accent); font: 13px "JetBrains Mono", monospace; }
.method { padding: 4px 7px; border: 1px solid rgba(148, 223, 166, .2); border-radius: 5px; background: rgba(148, 223, 166, .08); color: var(--green); font: 700 10px "JetBrains Mono", monospace; letter-spacing: .05em; }
.path { color: var(--text); font-size: 13px; overflow-wrap: anywhere; }
.path .var { color: var(--accent); }
.endpoint-title { display: block; color: var(--text); font-size: 13px; font-weight: 600; }
.endpoint-caption { display: block; color: var(--muted); font-size: 11px; }
.endpoint-head .path + .endpoint-title { margin-left: auto; color: var(--muted); font-size: 12px; font-weight: 400; }
.endpoint-body { padding: 18px; }
.endpoint-body > p { margin: 0 0 14px; color: #c4cec4; font-size: 13px; }
.endpoint-body code { padding: 2px 5px; border: 1px solid var(--line); border-radius: 4px; background: var(--surface-code); color: var(--accent); font-size: .9em; }
.block-title { margin: 22px 0 9px; color: var(--muted); font-size: 10px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }

.params-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; }
table.params { width: 100%; border-collapse: collapse; font-size: 12px; }
table.params th, table.params td { padding: 9px 11px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
table.params tr:last-child td { border-bottom: 0; }
table.params th { background: rgba(255,255,255,.025); color: var(--muted); font-size: 9px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; }
table.params td.name { color: var(--accent); white-space: nowrap; font-size: 11px; }
table.params td.type { color: var(--blue); white-space: nowrap; font-size: 10px; }
.notes { margin: 9px 0 0; padding-left: 19px; color: var(--muted); font-size: 12px; }
.notes li { margin-bottom: 5px; }

.try { overflow: hidden; margin-top: 18px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface-code); }
.try-row { display: flex; flex-wrap: wrap; gap: 7px; padding: 10px; border-bottom: 1px solid var(--line); }
.example-btn { padding: 6px 10px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface-raised); color: #c7d2c8; cursor: pointer; font-size: 11px; transition: border-color 140ms ease, color 140ms ease, background 140ms ease; }
.example-btn:hover { border-color: var(--line-bright); background: #27362b; color: var(--accent); }
.try-bar { display: flex; min-height: 45px; align-items: stretch; }
.try-bar .verb { display: flex; align-items: center; padding: 0 12px; background: rgba(148, 223, 166, .08); color: var(--green); font-size: 10px; font-weight: 700; }
.try-bar input { width: 0; min-width: 0; flex: 1; padding: 0 12px; border: 0; background: transparent; color: var(--text); font-size: 11px; }
.try-bar button.send { padding: 0 15px; border: 0; background: var(--accent); color: var(--accent-ink); cursor: pointer; font-size: 11px; font-weight: 700; transition: background 140ms ease; }
.try-bar button.send:hover { background: #d7ff8b; }
.try-bar button.send:disabled { cursor: wait; opacity: .7; }
.try-status { padding: 7px 11px; border-top: 1px solid var(--line); color: var(--muted); font: 10px "JetBrains Mono", monospace; }
.try-status.ok { color: var(--green); }
.try-status.err { color: var(--red); }
.try-result { max-height: 360px; overflow: auto; }
.try-result:empty { display: none; }
.try-result pre { margin: 0; padding: 12px; color: #c7d8c8; font-size: 10px; line-height: 1.65; white-space: pre-wrap; overflow-wrap: anywhere; }
.tok-key { color: var(--accent); }
.tok-str { color: #b6d8ff; }
.tok-num { color: #e6bd84; }
.tok-bool { color: #d0a6ed; }
.tok-null { color: var(--subtle); }

#navToggle { display: none; }

@media (max-width: 1050px) {
  #sidebar { width: 224px; }
  #content { width: calc(100% - 224px); margin-left: 224px; padding-right: 28px; padding-left: 28px; }
  .health-metrics { grid-template-columns: repeat(4, minmax(0, 1fr)); row-gap: 13px; }
}

@media (max-width: 760px) {
  #navToggle {
    position: fixed;
    z-index: 30;
    top: 12px;
    left: 12px;
    display: grid;
    width: 42px;
    height: 42px;
    place-items: center;
    border: 1px solid var(--line-bright);
    border-radius: 11px;
    background: var(--sidebar);
    color: var(--accent);
    cursor: pointer;
    font-size: 18px;
  }
  #sidebar { width: min(290px, 86vw); padding-top: 68px; transform: translateX(-105%); transition: transform 180ms ease; box-shadow: var(--shadow); }
  #sidebar.open { transform: translateX(0); }
  #content { width: 100%; margin: 0; padding: 76px 20px 60px; }
  .hero { border-radius: 17px; }
  .overview-grid { grid-template-columns: 1fr; }
  .overview-card { min-height: unset; }
  .section-heading { align-items: start; flex-direction: column; gap: 4px; }
  .endpoint-title { margin-left: 0; }
}

@media (max-width: 480px) {
  body { font-size: 14px; }
  #content { padding-right: 14px; padding-left: 14px; }
  .hero { padding: 24px 20px; }
  .overview-hero { padding: 20px 18px; }
  .hero h1 { font-size: 34px; }
  .health-panel { padding: 17px 15px; }
  .health-copy h2 { font-size: 17px; }
  .health-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 8px; }
  .metric-value { font-size: 18px; }
  .endpoint-head, .endpoint-body { padding-right: 13px; padding-left: 13px; }
  .try-bar .verb { padding: 0 8px; }
  .try-bar input { padding: 0 8px; font-size: 10px; }
  .try-bar button.send { padding: 0 10px; font-size: 10px; }
  .params-wrap { margin-right: -2px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
