:root {
  --ink: #142018;
  --muted: #66716a;
  --line: #dce2dd;
  --paper: #f6f7f3;
  --surface: #ffffff;
  --green: #166534;
  --lime: #b8f238;
  --blue: #2563eb;
  --amber: #a16207;
  --red: #b91c1c;
  --sidebar: 260px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 24px; }
body { margin: 0; color: var(--ink); background: var(--paper); font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif; }
a { color: inherit; }
code, pre { font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace; }

.sidebar { position: fixed; inset: 0 auto 0 0; width: var(--sidebar); padding: 28px 22px; display: flex; flex-direction: column; background: #102017; color: #eef6f0; z-index: 2; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.brand__mark { width: 40px; height: 40px; display: grid; place-items: center; color: #102017; background: var(--lime); border-radius: 11px; font-size: 24px; font-weight: 900; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 16px; letter-spacing: .04em; }
.brand small { margin-top: 3px; color: #9fb0a5; font-size: 12px; }
.side-nav { margin-top: 52px; display: grid; gap: 5px; }
.side-nav a { padding: 11px 13px; border-radius: 8px; color: #b9c6bd; text-decoration: none; font-size: 14px; }
.side-nav a:hover { color: #fff; background: rgba(255,255,255,.07); }
.sidebar__footer { margin-top: auto; display: flex; gap: 10px; align-items: center; padding-top: 18px; border-top: 1px solid rgba(255,255,255,.11); }
.sidebar__footer strong, .sidebar__footer small { display: block; }
.sidebar__footer strong { font-size: 13px; }
.sidebar__footer small { margin-top: 3px; color: #8fa096; font-size: 11px; }
.online-dot { width: 9px; height: 9px; flex: 0 0 auto; border-radius: 50%; background: var(--lime); box-shadow: 0 0 0 5px rgba(184,242,56,.1); }

main { margin-left: var(--sidebar); }
.hero, .section { max-width: 1160px; margin: 0 auto; padding-left: 56px; padding-right: 56px; }
.hero { padding-top: 56px; padding-bottom: 64px; }
.hero__topline { display: flex; justify-content: space-between; align-items: center; margin-bottom: 48px; }
.hero__topline a { color: var(--muted); font-size: 13px; text-decoration: none; }
.hero__topline a:hover { color: var(--ink); }
.version { padding: 6px 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--green); font: 700 11px/1 system-ui; letter-spacing: .08em; }
.kicker { margin: 0 0 10px; color: var(--green); font-size: 11px; font-weight: 800; letter-spacing: .16em; }
h1 { max-width: 900px; margin: 0; font-size: clamp(42px, 5.4vw, 68px); line-height: .98; letter-spacing: -.055em; }
.hero__copy { max-width: 680px; margin: 24px 0 38px; color: var(--muted); font-size: 17px; line-height: 1.8; }
.flow { display: grid; grid-template-columns: 1fr auto 1fr auto 1fr; align-items: center; border: 1px solid var(--line); background: var(--surface); }
.flow > div { min-height: 116px; padding: 22px; }
.flow span, .flow strong, .flow small { display: block; }
.flow span { margin-bottom: 17px; color: var(--green); font-size: 11px; font-weight: 800; letter-spacing: .12em; }
.flow strong { font-size: 15px; }
.flow small { margin-top: 5px; color: var(--muted); font-size: 12px; }
.flow i { color: #97a29b; font-style: normal; }

.section { padding-top: 72px; padding-bottom: 72px; border-top: 1px solid var(--line); }
.section-heading { display: grid; grid-template-columns: 1fr minmax(280px, 390px); gap: 48px; align-items: end; margin-bottom: 30px; }
h2 { margin: 0; font-size: clamp(28px, 4vw, 42px); line-height: 1.12; letter-spacing: -.035em; }
.section-heading > p { margin: 0 0 3px; color: var(--muted); line-height: 1.75; }
.key-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.key-card { padding: 28px; border: 1px solid var(--line); border-top-width: 4px; background: var(--surface); }
.key-card--source { border-top-color: var(--blue); }
.key-card--ingest { border-top-color: var(--green); }
.key-card__tag { display: inline-flex; padding: 5px 8px; border-radius: 4px; background: #edf2ef; color: var(--muted); font-size: 11px; font-weight: 700; }
.key-card h3 { margin: 22px 0 12px; font-size: 24px; }
.key-card h3 code { padding: 0; background: none; }
.key-card > p { min-height: 54px; margin: 0 0 22px; color: var(--muted); line-height: 1.7; }
.key-card dl { margin: 0; border-top: 1px solid var(--line); }
.key-card dl div { display: grid; grid-template-columns: 92px 1fr; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.key-card dt { color: var(--muted); }
.key-card dd { margin: 0; }
.callout { margin-top: 16px; padding: 18px 20px; border-left: 4px solid var(--lime); background: #edf6dc; color: #405044; font-size: 14px; line-height: 1.7; }

.steps { margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--line); }
.steps li { display: grid; grid-template-columns: 56px 1fr; gap: 24px; padding: 28px 0; border-bottom: 1px solid var(--line); }
.steps > li > span { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 50%; color: #102017; background: var(--lime); font-weight: 800; }
.steps strong { font-size: 17px; }
.steps p { margin: 8px 0; color: var(--muted); line-height: 1.65; }
.steps a { color: var(--green); font-size: 13px; font-weight: 700; text-underline-offset: 3px; }
pre { max-width: 100%; margin: 14px 0 0; padding: 16px 18px; overflow: auto; border: 1px solid #2f3d34; border-radius: 7px; color: #e8f0e9; background: #17231b; font-size: 12px; line-height: 1.75; }
.limit-card { display: grid; grid-template-columns: 110px 1fr; gap: 24px; margin-top: 30px; padding: 24px; border: 1px dashed #aeb8b0; background: rgba(255,255,255,.48); }
.limit-card span { color: var(--amber); font-size: 12px; font-weight: 800; letter-spacing: .08em; }
.limit-card p { margin: 0; color: var(--muted); line-height: 1.75; }

.api-heading { display: flex; justify-content: space-between; gap: 32px; align-items: end; }
.api-heading p:last-child { margin: 10px 0 0; color: var(--muted); }
.search { width: min(360px, 100%); display: flex; align-items: center; gap: 9px; padding: 0 14px; border: 1px solid var(--line); background: var(--surface); }
.search:focus-within { border-color: var(--green); box-shadow: 0 0 0 3px rgba(22,101,52,.08); }
.search span { color: var(--muted); font-size: 22px; }
.search input { width: 100%; height: 44px; border: 0; outline: 0; background: transparent; color: var(--ink); font: inherit; font-size: 13px; }
.legend { display: flex; flex-wrap: wrap; gap: 18px; margin: 28px 0 22px; color: var(--muted); font-size: 12px; }
.legend span { display: inline-flex; align-items: center; gap: 7px; }
.legend i { width: 8px; height: 8px; border-radius: 50%; }
.legend__public { background: #8a958d; }
.legend__session { background: var(--blue); }
.legend__key { background: var(--green); }
.endpoint-groups { display: grid; gap: 32px; }
.endpoint-group h3 { display: flex; align-items: center; gap: 10px; margin: 0 0 10px; font-size: 15px; }
.endpoint-group h3 span { padding: 4px 7px; border-radius: 4px; background: #e8ece9; color: var(--muted); font-size: 10px; }
.endpoint-list { display: grid; gap: 8px; }
.endpoint-card { border: 1px solid var(--line); background: var(--surface); }
.endpoint-card[open] { border-color: #aeb9b1; box-shadow: 0 10px 30px rgba(20,32,24,.06); }
.endpoint-card summary { min-height: 62px; display: grid; grid-template-columns: 74px minmax(210px, 1fr) minmax(220px, 1.15fr) auto; gap: 14px; align-items: center; padding: 0 18px; cursor: pointer; list-style: none; }
.endpoint-card summary::-webkit-details-marker { display: none; }
.method { width: 62px; padding: 7px 0; border-radius: 4px; text-align: center; font-size: 10px; font-weight: 900; letter-spacing: .05em; }
.method--get { color: #165bc4; background: #e9f1ff; }
.method--post { color: #166534; background: #e8f6ec; }
.method--put, .method--patch { color: #9a5700; background: #fff3db; }
.method--delete { color: var(--red); background: #ffebeb; }
.path { overflow: hidden; color: #26332b; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.endpoint-summary { color: var(--muted); font-size: 13px; }
.auth-dot { width: 9px; height: 9px; border-radius: 50%; }
.auth-dot--public { background: #8a958d; }
.auth-dot--session { background: var(--blue); }
.auth-dot--key { background: var(--green); }
.endpoint-content { padding: 22px; border-top: 1px solid var(--line); }
.endpoint-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.chip { padding: 5px 8px; border-radius: 4px; background: #edf1ee; color: #4d5c52; font-size: 11px; font-weight: 700; }
.endpoint-description { margin: 0 0 22px; color: var(--muted); line-height: 1.7; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.detail-block { min-width: 0; }
.detail-block--wide { grid-column: 1 / -1; }
.detail-block h4 { margin: 0 0 9px; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; }
.param-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.param-table th, .param-table td { padding: 9px; border: 1px solid var(--line); text-align: left; vertical-align: top; }
.param-table th { color: var(--muted); background: #f4f6f4; font-weight: 600; }
.response-list { display: flex; flex-wrap: wrap; gap: 7px; }
.response-code { padding: 6px 9px; border: 1px solid var(--line); border-radius: 4px; color: var(--muted); font-size: 11px; }
.loading { min-height: 220px; display: grid; place-items: center; align-content: center; color: var(--muted); }
.loading span { width: 28px; height: 28px; border: 3px solid var(--line); border-top-color: var(--green); border-radius: 50%; animation: spin .7s linear infinite; }
.loading p { margin-top: 12px; font-size: 13px; }
.empty-state { padding: 42px; border: 1px dashed var(--line); color: var(--muted); text-align: center; }
.error-box { padding: 28px; border: 1px solid #efc7c7; color: #8b2929; background: #fff4f4; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 900px) {
  :root { --sidebar: 0px; }
  .sidebar { position: static; width: auto; height: auto; padding: 18px 22px; flex-direction: row; align-items: center; }
  .side-nav, .sidebar__footer { display: none; }
  main { margin-left: 0; }
  .hero, .section { padding-left: 24px; padding-right: 24px; }
  .hero { padding-top: 28px; }
  .section-heading { grid-template-columns: 1fr; gap: 16px; }
  .key-grid { grid-template-columns: 1fr; }
  .endpoint-card summary { grid-template-columns: 64px minmax(0,1fr) auto; }
  .endpoint-summary { display: none; }
  .detail-grid { grid-template-columns: 1fr; }
  .detail-block--wide { grid-column: auto; }
}

@media (max-width: 620px) {
  .hero__topline { margin-bottom: 38px; }
  h1 { font-size: 46px; }
  .flow { grid-template-columns: 1fr; }
  .flow i { display: none; }
  .flow > div { min-height: 0; border-bottom: 1px solid var(--line); }
  .flow > div:last-child { border-bottom: 0; }
  .api-heading { align-items: stretch; flex-direction: column; }
  .search { width: 100%; }
  .steps li { grid-template-columns: 42px 1fr; gap: 14px; }
  .limit-card { grid-template-columns: 1fr; gap: 10px; }
  .endpoint-card summary { min-height: 72px; padding: 0 12px; gap: 8px; }
  .path { font-size: 11px; }
  .endpoint-content { padding: 16px; }
}
