:root {
  --ink: #20211f;
  --ink-soft: #3b3c38;
  --muted: #656662;
  --muted-2: #85857f;
  --line: #deded7;
  --line-soft: #ecebe5;
  --paper: #ffffff;
  --bg: #faf9f6;
  --accent: #7061ac;
  --accent-soft: #f0edf8;
  --green: #2f6b4f;
  --green-soft: #e8f2ec;
  --red: #953032;
  --red-soft: #f8eaea;
  --amber: #8a5a17;
  --amber-soft: #fbf1df;
  --code-bg: #17181a;
  --code-head: #212226;
  --code-ink: #f2f1ec;
  --code-muted: #a6a49b;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  color: var(--ink);
  background: var(--bg);
  font-family: var(--sans);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body, h1, h2, h3, h4, p, blockquote, pre, ul, ol { margin: 0; }
body { min-height: 100vh; background: var(--bg); }
[hidden] { display: none !important; }
img, svg { display: block; }
button, input, textarea, select { font: inherit; color: inherit; }
button, select { cursor: pointer; }
button:disabled { cursor: default; opacity: .55; }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
::selection { background: #dcd4f1; color: var(--ink); }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: 16px; top: -80px; z-index: 100;
  background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 8px;
  text-decoration: none; font-weight: 600;
}
.skip-link:focus { top: 12px; }

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 40;
  background: rgba(250, 249, 246, .92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}
.header-inner {
  width: min(100% - 48px, 1440px); margin-inline: auto; min-height: 66px;
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
}
.brand { display: inline-flex; align-items: center; gap: 9px; text-decoration: none; min-width: 0; }
.brand-mark {
  display: grid; place-items: center; width: 32px; height: 32px; flex: none;
  border-radius: 50%; background: var(--ink); color: #fff;
}
.brand-text { font-size: 25px; font-weight: 760; letter-spacing: -.075em; color: #1c1d1a; }
.brand-dot { color: #775265; margin-left: -4px; }
.brand-product {
  margin-left: 5px; padding-left: 11px; border-left: 1px solid var(--line);
  color: var(--muted); font-size: .78rem; font-weight: 650; letter-spacing: .08em;
  text-transform: uppercase;
}
.header-nav { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.header-nav a {
  border-radius: 100px; padding: 9px 13px; color: var(--muted);
  font-size: .89rem; font-weight: 560; text-decoration: none;
}
.header-nav a:hover { background: var(--line-soft); color: var(--ink); }
.header-nav .header-studio { border: 1px solid var(--line); background: var(--paper); color: var(--ink); }
.header-nav .header-studio:hover { background: var(--ink); color: #fff; border-color: var(--ink); }
.menu-button {
  display: none; width: 42px; height: 42px; border: 1px solid var(--line);
  border-radius: 10px; background: var(--paper); place-items: center;
}
.menu-lines { display: grid; gap: 4px; width: 17px; }
.menu-lines span { height: 1.7px; border-radius: 2px; background: var(--ink); transition: transform .18s ease, opacity .18s ease; }
body.nav-open .menu-lines span:nth-child(1) { transform: translateY(5.7px) rotate(45deg); }
body.nav-open .menu-lines span:nth-child(2) { opacity: 0; }
body.nav-open .menu-lines span:nth-child(3) { transform: translateY(-5.7px) rotate(-45deg); }

/* Layout */
.shell {
  width: min(100% - 48px, 1440px); margin-inline: auto;
  display: grid; grid-template-columns: 268px minmax(0, 1fr);
  gap: clamp(28px, 4vw, 64px); padding: 38px 0 84px;
}
.sidebar { align-self: start; position: sticky; top: 90px; max-height: calc(100vh - 110px); overflow: auto; overscroll-behavior: contain; }
.sidebar-inner { display: grid; gap: 26px; padding-right: 4px; }
.version-card {
  border: 1px solid var(--line); border-radius: 16px; background: var(--paper);
  padding: 16px; display: grid; gap: 9px;
}
.version-line { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.version-badge {
  display: inline-flex; align-items: center; border-radius: 100px;
  background: var(--ink); color: #fff; font-size: .72rem; font-weight: 700;
  letter-spacing: .06em; padding: 4px 9px;
}
.version-state { color: var(--green); font-size: .76rem; font-weight: 650; }
.version-card p { color: var(--muted); font-size: .82rem; line-height: 1.45; }
.version-card a { color: var(--ink); font-size: .8rem; font-weight: 620; text-decoration: underline; text-underline-offset: 2px; }

.side-nav { display: grid; gap: 2px; }
.nav-group {
  margin: 18px 0 6px; padding-left: 12px; color: var(--muted-2);
  font-size: .7rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
}
.nav-group:first-child { margin-top: 0; }
.side-nav a {
  display: block; padding: 9px 12px; border-radius: 9px; color: var(--muted);
  font-size: .91rem; font-weight: 520; text-decoration: none; line-height: 1.3;
}
.side-nav a:hover { background: var(--line-soft); color: var(--ink); }
.side-nav a[aria-current="page"] { background: #e9e6df; color: var(--ink); font-weight: 640; }
.sidebar-key {
  border-top: 1px solid var(--line); padding: 16px 12px 0; display: grid; gap: 4px;
}
.sidebar-key-label { color: var(--muted-2); font-size: .7rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.sidebar-key strong { font-family: var(--mono); font-size: .78rem; overflow-wrap: anywhere; }
.sidebar-key span:last-child { color: var(--muted); font-size: .78rem; }
.sidebar-backdrop { display: none; }

/* Main and typography */
.main { min-width: 0; }
.main:focus { outline: none; }
.page { max-width: 900px; animation: page-in .24s ease both; }
@keyframes page-in { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }
.eyebrow {
  color: var(--accent); font-size: .72rem; font-weight: 750;
  letter-spacing: .12em; text-transform: uppercase; margin-bottom: 14px;
}
h1 { font-size: clamp(2.35rem, 4.2vw, 3.35rem); line-height: 1.04; letter-spacing: -.055em; font-weight: 570; }
h1 .h1-muted { color: var(--muted); }
.lede { margin-top: 20px; max-width: 760px; color: var(--muted); font-size: 1.12rem; line-height: 1.6; text-wrap: pretty; }
.page h2 { margin-top: 42px; margin-bottom: 14px; font-size: 1.52rem; letter-spacing: -.035em; font-weight: 620; line-height: 1.2; }
.page h3 { margin-top: 28px; margin-bottom: 10px; font-size: 1.06rem; letter-spacing: -.015em; font-weight: 650; }
.page p { margin-top: 12px; line-height: 1.68; color: var(--ink-soft); }
.page p.note { color: var(--muted); font-size: .9rem; }
.page a { text-decoration: underline; text-underline-offset: 2px; text-decoration-thickness: 1px; }
.page a:hover { color: var(--accent); }
.page ul, .page ol { margin-top: 12px; padding-left: 22px; display: grid; gap: 8px; line-height: 1.6; }
.page li::marker { color: var(--muted-2); }
code {
  font-family: var(--mono); font-size: .86em; background: #eceae3;
  border-radius: 5px; padding: 2px 5px; overflow-wrap: anywhere;
}
pre code { background: none; padding: 0; border-radius: 0; font-size: inherit; }
strong { font-weight: 650; }

.badges { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 22px; }
.badge {
  border: 1px solid var(--line); background: var(--paper); border-radius: 100px;
  padding: 6px 11px; font-size: .78rem; font-weight: 600; color: var(--muted);
}

/* Endpoint */
.endpoint-block {
  margin-top: 22px; border: 1px solid var(--line); border-radius: 15px;
  background: var(--paper); padding: 17px 18px;
}
.endpoint-line { display: flex; align-items: center; gap: 11px; flex-wrap: wrap; }
.endpoint-line code { background: transparent; padding: 0; font-size: .9rem; font-weight: 560; overflow-wrap: anywhere; }
.endpoint-block p { margin-top: 9px; color: var(--muted); font-size: .9rem; line-height: 1.55; }
.method {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 58px; padding: 4px 8px; border-radius: 6px;
  font-family: var(--mono); font-size: .7rem; font-weight: 750; letter-spacing: .04em;
}
.method.get { background: var(--green-soft); color: var(--green); }
.method.post { background: var(--accent-soft); color: var(--accent); }
.method.delete { background: var(--red-soft); color: var(--red); }
.method.put, .method.patch { background: var(--amber-soft); color: var(--amber); }

/* Cards */
.cards { margin-top: 28px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.card { border: 1px solid var(--line); border-radius: 15px; background: var(--paper); padding: 18px; }
.card h3 { margin: 0 0 7px; font-size: .98rem; }
.card p { margin: 0; color: var(--muted); font-size: .88rem; line-height: 1.55; }

/* Code */
.code-tabs { margin-top: 18px; }
.tab-list { display: flex; gap: 2px; margin-bottom: -1px; padding-left: 10px; position: relative; z-index: 1; }
.tab-list button {
  border: 1px solid transparent; border-bottom: 0; border-radius: 8px 8px 0 0;
  background: transparent; color: var(--muted); padding: 8px 13px; font-size: .8rem; font-weight: 600;
}
.tab-list button[aria-selected="true"] { background: var(--code-bg); color: var(--code-ink); border-color: var(--code-bg); }
.code-block {
  margin-top: 18px; background: var(--code-bg); border-radius: 13px;
  overflow: hidden; color: var(--code-ink); border: 1px solid #2a2b2e;
}
.code-tabs .code-block { margin-top: 0; border-radius: 0 13px 13px 13px; }
.code-head {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 9px 13px 9px 17px; background: var(--code-head); border-bottom: 1px solid #2e2f33;
}
.code-title { color: var(--code-muted); font-size: .76rem; font-weight: 600; letter-spacing: .01em; }
.copy-button {
  border: 1px solid #3a3b40; border-radius: 7px; background: transparent;
  color: #c9c7bf; padding: 5px 9px; font-size: .72rem; font-weight: 600;
}
.copy-button:hover { background: #303136; color: #fff; }
.copy-button.copied { border-color: #4c7a5d; color: #9ed7b2; }
.code-block pre { margin: 0; padding: 17px 19px; overflow-x: auto; tab-size: 2; }
.code-block code { color: var(--code-ink); font-family: var(--mono); font-size: 13px; line-height: 1.65; background: none; padding: 0; }
.code-block pre::-webkit-scrollbar { height: 9px; }
.code-block pre::-webkit-scrollbar-thumb { background: #3d3e43; border-radius: 10px; }

/* Callouts, steps, tables */
.callout { margin-top: 22px; border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: 0 12px 12px 0; background: var(--paper); padding: 15px 17px; }
.callout strong { display: block; margin-bottom: 4px; font-size: .94rem; }
.callout p { margin: 0; color: var(--muted); font-size: .89rem; line-height: 1.6; }
.callout.info { border-left-color: var(--accent); background: #fbfaff; }
.callout.warn { border-left-color: #c58a2e; background: #fffaf0; }
.callout.success { border-left-color: var(--green); background: #f7fcf9; }

.steps { list-style: none; padding-left: 0 !important; counter-reset: step; }
.steps > li { position: relative; padding-left: 40px; }
.steps > li::before {
  counter-increment: step; content: counter(step);
  position: absolute; left: 0; top: -2px; width: 24px; height: 24px;
  display: grid; place-items: center; border-radius: 50%; background: var(--ink); color: #fff;
  font-size: .74rem; font-weight: 700;
}
.steps-numbered > li { padding-left: 44px; padding-bottom: 8px; }
.steps-numbered > li::before { width: 28px; height: 28px; top: 0; }
.steps > li h2 { margin-top: 0 !important; font-size: 1.2rem !important; }
.steps > li p { margin-top: 8px; }

.check-list { padding-left: 0 !important; list-style: none; }
.check-list li { position: relative; padding-left: 25px; }
.check-list li::before {
  content: ""; position: absolute; left: 2px; top: .52em; width: 9px; height: 5px;
  border-left: 2px solid var(--green); border-bottom: 2px solid var(--green);
  transform: rotate(-45deg);
}
.page ul:not(.check-list):not(.badges):not(.mini-tabs) { padding-left: 22px; }

.table-wrap { margin-top: 16px; overflow-x: auto; border: 1px solid var(--line); border-radius: 13px; background: var(--paper); }
table { width: 100%; border-collapse: collapse; font-size: .87rem; line-height: 1.5; }
th, td { text-align: left; vertical-align: top; padding: 11px 14px; border-bottom: 1px solid var(--line-soft); }
th { color: var(--muted-2); font-size: .71rem; font-weight: 750; letter-spacing: .07em; text-transform: uppercase; background: #fbfaf7; }
tr:last-child td { border-bottom: 0; }
td code, th code { font-size: .82em; }
td { color: var(--ink-soft); }
td:first-child { white-space: nowrap; }

/* Status */
.status-grid { margin-top: 16px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.status-card { border: 1px solid var(--line); border-radius: 13px; background: var(--paper); padding: 14px 15px; }
.status-card p { margin: 8px 0 0; color: var(--muted); font-size: .86rem; line-height: 1.5; }
.status-pill {
  display: inline-flex; align-items: center; gap: 6px; border-radius: 100px;
  padding: 4px 10px; font-size: .72rem; font-weight: 700; letter-spacing: .02em;
}
.status-pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status-pill.idle { background: #eeede8; color: var(--muted); }
.status-pill.queued { background: var(--amber-soft); color: var(--amber); }
.status-pill.processing { background: var(--accent-soft); color: var(--accent); }
.status-pill.ready { background: var(--green-soft); color: var(--green); }
.status-pill.failed { background: var(--red-soft); color: var(--red); }

/* Next links / changelog */
.next-links { margin-top: 42px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.next-link { border: 1px solid var(--line); border-radius: 14px; background: var(--paper); padding: 15px 17px; text-decoration: none !important; display: grid; gap: 4px; }
.next-link:hover { border-color: #bdb9ce; background: #fdfcff; }
.next-link span { color: var(--muted-2); font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.next-link strong { font-size: .98rem; font-weight: 620; }
.changelog { margin-top: 16px; display: grid; gap: 12px; }
.changelog article { border: 1px solid var(--line); border-radius: 14px; background: var(--paper); padding: 17px 19px; }
.changelog-head { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.changelog-head time { color: var(--muted); font-size: .8rem; }
.changelog ul { margin-top: 4px; }

/* Playground */
.playground { margin-top: 26px; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr); gap: 16px; align-items: start; }
.pg-column { display: grid; gap: 16px; min-width: 0; }
.panel { border: 1px solid var(--line); border-radius: 17px; background: var(--paper); padding: 20px; min-width: 0; }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 15px; }
.panel h2 { margin: 0 !important; font-size: 1.02rem !important; letter-spacing: -.01em; }
.panel-hint { color: var(--muted-2); font-size: .72rem; font-weight: 560; text-align: right; }
.field { display: grid; gap: 6px; min-width: 0; }
.field > label { color: var(--ink-soft); font-size: .82rem; font-weight: 620; }
.field-meta { display: flex; justify-content: space-between; gap: 10px; color: var(--muted); font-size: .75rem; min-height: 1.1em; }
input[type="text"], input[type="password"], input[type="number"], select, textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 10px; background: #fff;
  color: var(--ink); padding: 10px 11px; font-size: .9rem; min-height: 42px;
}
textarea { resize: vertical; min-height: 126px; line-height: 1.55; }
input:focus, select:focus, textarea:focus { border-color: #a99bd6; outline: 3px solid #e3dcf5; outline-offset: 0; }
input[readonly] { background: #f7f6f1; color: var(--muted); font-family: var(--mono); font-size: .76rem; }
.row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px; margin-top: 11px; }
.row.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.key-input { display: flex; gap: 8px; }
.key-input input { font-family: var(--mono); }
.checkbox { display: flex; align-items: center; gap: 8px; margin-top: 11px; color: var(--muted); font-size: .82rem; }
.checkbox input { width: 16px; height: 16px; margin: 0; accent-color: var(--ink); }
.button-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.primary, .secondary, .ghost {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 40px; padding: 8px 15px; border-radius: 100px;
  font-size: .86rem; font-weight: 620; text-decoration: none !important; border: 1px solid transparent;
}
.primary { background: var(--ink); color: #fff; }
.primary:hover:not(:disabled) { background: #3b3a3d; }
.secondary { background: var(--paper); border-color: var(--line); color: var(--ink); }
.secondary:hover:not(:disabled) { background: #f2f1ec; }
.ghost { background: transparent; color: var(--muted); border-color: transparent; }
.ghost:hover:not(:disabled) { background: var(--line-soft); color: var(--ink); }
.ghost.small { min-height: 42px; padding: 8px 11px; border-color: var(--line); background: var(--paper); }
.hint { margin-top: 10px; color: var(--muted); font-size: .8rem; line-height: 1.5; }
.error-text { margin-top: 10px; color: var(--red); font-size: .84rem; line-height: 1.5; font-weight: 560; }
.result-panel .hint { min-height: 2.4em; }
.audio-box { margin-top: 14px; border: 1px solid var(--line-soft); border-radius: 12px; background: #fbfaf7; padding: 12px; display: grid; gap: 10px; }
.audio-box audio { width: 100%; }
.audio-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.meta { color: var(--muted); font-size: .78rem; }
.mini-tabs { display: flex; gap: 2px; margin-top: 16px; border-bottom: 1px solid var(--line); }
.mini-tab { border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--muted); padding: 7px 11px; font-size: .8rem; font-weight: 600; }
.mini-tab.active { color: var(--ink); border-bottom-color: var(--ink); }
.json-output {
  margin: 0; margin-top: 10px; min-height: 180px; max-height: 360px; overflow: auto;
  background: #1b1c1f; color: #dcdad3; border-radius: 10px; padding: 13px 14px;
  font-family: var(--mono); font-size: .74rem; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere;
}
.json-output code { background: none; padding: 0; color: inherit; font-size: inherit; white-space: inherit; }
.timeline { list-style: none; padding: 0 !important; margin-top: 4px !important; display: grid; gap: 0; }
.timeline li { position: relative; padding: 0 0 12px 20px; color: var(--ink-soft); font-size: .82rem; line-height: 1.45; }
.timeline li::before { content: ""; position: absolute; left: 2px; top: .45em; width: 6px; height: 6px; border-radius: 50%; background: #b9b5c9; }
.timeline li:not(:last-child)::after { content: ""; position: absolute; left: 4.5px; top: 1.2em; bottom: 0; width: 1px; background: var(--line); }
.timeline li.done::before { background: var(--green); }
.timeline li.active::before { background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.timeline li.failed::before { background: var(--red); }
.timeline li.muted { color: var(--muted-2); }

/* Footer */
.site-footer { border-top: 1px solid var(--line); background: var(--bg); }
.footer-inner {
  width: min(100% - 48px, 1440px); margin-inline: auto; min-height: 64px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  color: var(--muted); font-size: .82rem;
}
.footer-inner nav { display: flex; flex-wrap: wrap; gap: 16px; }
.footer-inner a { color: var(--muted); text-decoration: none; }
.footer-inner a:hover { color: var(--ink); text-decoration: underline; }

@media (max-width: 1180px) {
  .shell { grid-template-columns: 232px minmax(0, 1fr); gap: 32px; }
}

@media (max-width: 980px) {
  .shell { grid-template-columns: minmax(0, 1fr); padding-top: 26px; }
  .sidebar {
    position: fixed; z-index: 50; inset: 0 auto 0 0; width: min(320px, 88vw);
    max-height: none; background: var(--bg); border-right: 1px solid var(--line);
    padding: 22px 18px 32px; transform: translateX(-104%); transition: transform .22s ease;
    overflow: auto; box-shadow: 0 20px 60px rgba(32, 33, 31, .18);
  }
  body.nav-open .sidebar { transform: none; }
  .sidebar-inner { padding-right: 0; }
  .sidebar-backdrop {
    display: block; position: fixed; inset: 0; z-index: 45;
    background: rgba(32, 33, 31, .32); border: 0; padding: 0;
  }
  .menu-button { display: grid; }
  .header-nav a:not(.header-studio) { display: none; }
  .header-nav { gap: 0; }
  .playground { grid-template-columns: minmax(0, 1fr); }
  .page { max-width: none; }
}

@media (max-width: 720px) {
  .header-inner, .shell, .footer-inner { width: calc(100% - 32px); }
  .brand-product { display: none; }
  .header-nav .header-studio { padding: 8px 12px; font-size: .82rem; }
  h1 { font-size: clamp(2.15rem, 8.2vw, 2.7rem); }
  .lede { font-size: 1.02rem; }
  .page h2 { margin-top: 34px; font-size: 1.34rem; }
  .cards, .status-grid, .next-links, .row, .row.three { grid-template-columns: minmax(0, 1fr); }
  .code-block code { font-size: 12px; }
  .code-block pre { padding: 14px 15px; }
  .panel { padding: 16px; }
  .footer-inner { flex-direction: column; align-items: flex-start; padding: 16px 0; }
  .table-wrap { border-radius: 11px; }
  th, td { padding: 9px 11px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

@media print {
  .site-header, .sidebar, .site-footer, .playground, .next-links { display: none !important; }
  .shell { display: block; padding: 0; width: 100%; }
  .page[hidden] { display: block !important; }
  .code-block { break-inside: avoid; }
}
