:root {
  color-scheme: light;
  --ink: #1d1d1b;
  --muted: #6f706b;
  --line: #dedfd8;
  --surface: #ffffff;
  --soft: #f2f2ec;
  --accent: #ff5f37;
  --accent-dark: #d93e18;
  --green: #177253;
  --shadow: 0 24px 70px rgba(34, 35, 31, 0.1);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 82% 8%, rgba(255, 95, 55, 0.1), transparent 26rem),
    #f7f7f2;
}

a { color: inherit; }
button, select, textarea { font: inherit; }

.site-header,
footer {
  width: min(1120px, calc(100% - 40px));
  margin-inline: auto;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 84px;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 1.02rem;
  font-weight: 750;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  color: white;
  background: var(--ink);
  border-radius: 10px 10px 10px 3px;
  font-size: 0.9rem;
}

nav { display: flex; gap: 8px; }

nav a {
  padding: 9px 14px;
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 650;
  text-decoration: none;
}

nav a:hover,
nav a[aria-current="page"] {
  color: var(--ink);
  background: var(--surface);
}

.chat-page {
  width: min(760px, calc(100% - 40px));
  margin: 0 auto;
  padding: 88px 0 110px;
}

.intro { max-width: 650px; margin-bottom: 34px; }

.eyebrow {
  margin: 0 0 12px;
  color: var(--accent-dark);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

h1, h2, h3, p { margin-top: 0; }

h1 {
  margin-bottom: 18px;
  font-size: clamp(2.6rem, 7vw, 4.7rem);
  line-height: 0.98;
  letter-spacing: -0.065em;
}

.intro > p:last-child,
.docs-intro > p:last-child {
  max-width: 620px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.7;
}

.composer,
.result {
  border: 1px solid rgba(29, 29, 27, 0.09);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.composer {
  padding: 28px;
  border-radius: 24px 24px 24px 8px;
}

.field-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line);
}

label { font-size: 0.9rem; font-weight: 720; }

select {
  width: min(250px, 58%);
  padding: 11px 38px 11px 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  background: var(--soft);
}

.speed-row > div:first-child p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.76rem;
}

.speed-control {
  display: grid;
  width: min(330px, 65%);
  grid-template-columns: minmax(130px, 1fr) 52px;
  align-items: center;
  gap: 14px;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--accent-dark);
  cursor: pointer;
}

.speed-control output {
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  font-size: 0.88rem;
  font-weight: 750;
  text-align: right;
}

.text-field { position: relative; padding-top: 24px; }
.text-field label { display: block; margin-bottom: 12px; }

textarea {
  display: block;
  width: 100%;
  min-height: 190px;
  resize: vertical;
  padding: 2px 0 28px;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
  font-size: 1.08rem;
  line-height: 1.65;
}

textarea::placeholder { color: #a2a39e; }

.character-count {
  position: absolute;
  right: 0;
  bottom: 4px;
  color: var(--muted);
  font-size: 0.76rem;
}

.form-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.status {
  min-height: 1.3em;
  margin: 0;
  color: var(--green);
  font-size: 0.86rem;
}

.status.error { color: #b42318; }

button {
  display: inline-flex;
  min-width: 168px;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 13px 18px;
  border: 0;
  border-radius: 11px;
  color: white;
  background: var(--ink);
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 750;
  transition: transform 160ms ease, background 160ms ease;
}

button:hover:not(:disabled) {
  background: var(--accent-dark);
  transform: translateY(-1px);
}

button:disabled { cursor: wait; opacity: 0.7; }

.button-spinner {
  display: none;
  width: 15px;
  height: 15px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}

button.loading .button-spinner { display: block; }
@keyframes spin { to { transform: rotate(360deg); } }

.result {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 24px;
  margin-top: 22px;
  padding: 22px 24px;
  border-radius: 8px 22px 22px 22px;
}

.result[hidden] { display: none; }

.result-label {
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.result h2 { margin: 0; font-size: 1rem; }
audio { width: 100%; min-width: 220px; height: 40px; }

.download-link {
  color: var(--accent-dark);
  font-size: 0.86rem;
  font-weight: 720;
  white-space: nowrap;
  text-underline-offset: 3px;
}

footer {
  display: flex;
  justify-content: space-between;
  padding: 24px 0 38px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.84rem;
}

footer a { color: var(--ink); font-weight: 700; text-decoration: none; }

.docs-page {
  display: grid;
  width: min(1120px, calc(100% - 40px));
  grid-template-columns: 190px minmax(0, 740px);
  gap: 76px;
  margin: 0 auto;
  padding: 76px 0 110px;
}

.docs-nav {
  position: sticky;
  top: 24px;
  align-self: start;
  display: grid;
  gap: 7px;
}

.docs-nav p {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.docs-nav a {
  padding: 6px 0;
  color: var(--muted);
  font-size: 0.88rem;
  text-decoration: none;
}

.docs-nav a:hover { color: var(--accent-dark); }
.docs-intro { padding-bottom: 60px; }
.docs-intro h1 { font-size: clamp(2.5rem, 6vw, 4.25rem); }

.endpoint {
  padding: 50px 0;
  border-top: 1px solid var(--line);
  scroll-margin-top: 24px;
}

.endpoint-heading {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.endpoint-heading h2 {
  margin: 0;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 1.35rem;
  letter-spacing: -0.03em;
}

.method {
  padding: 5px 8px;
  border-radius: 6px;
  color: white;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 0.7rem;
  font-weight: 800;
}

.method.post { background: var(--accent-dark); }
.method.get { background: var(--green); }
.endpoint > p { color: var(--muted); line-height: 1.65; }

.endpoint h3 {
  margin: 30px 0 12px;
  font-size: 0.8rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.parameter {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 6px 18px;
  padding: 15px 0;
  border-bottom: 1px solid var(--line);
}

.parameter > code { color: var(--accent-dark); font-weight: 750; }
.parameter > span { color: var(--muted); font-size: 0.8rem; }

.parameter p {
  grid-column: 2;
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

code, pre { font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace; }

p code {
  padding: 2px 5px;
  border-radius: 4px;
  background: #e9e9e2;
  font-size: 0.86em;
}

pre {
  overflow-x: auto;
  margin: 0;
  padding: 20px;
  border: 1px solid #34342f;
  border-radius: 12px;
  color: #f3f3ed;
  background: #20201e;
  font-size: 0.82rem;
  line-height: 1.65;
}

@media (max-width: 760px) {
  .site-header, footer, .chat-page, .docs-page {
    width: min(100% - 28px, 760px);
  }

  .chat-page { padding: 60px 0 80px; }
  .composer { padding: 20px; }
  .speed-control { width: min(220px, 65%); }
  .form-footer, .result { align-items: stretch; flex-direction: column; }
  .form-footer { display: flex; }
  button { width: 100%; }
  .result { display: flex; }
  audio { min-width: 0; }
  .docs-page { display: block; padding: 58px 0 80px; }

  .docs-nav {
    position: static;
    display: flex;
    flex-wrap: wrap;
    gap: 4px 16px;
    margin-bottom: 52px;
  }

  .docs-nav p { width: 100%; }
  .parameter { grid-template-columns: 1fr; }
  .parameter p { grid-column: 1; }
}
