:root {
  color-scheme: dark;
  --bg: #070b16;
  --panel: rgba(13, 19, 34, 0.82);
  --panel-border: rgba(153, 180, 255, 0.18);
  --text: #eef3ff;
  --muted: #aab6d8;
  --accent: #7cf0c5;
  --accent-2: #8cb4ff;
  --danger: #ff7f9d;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.35);
  --sidebar: 260px;
  font-family: "Segoe UI", "Trebuchet MS", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(124, 240, 197, 0.14), transparent 28%),
    radial-gradient(circle at 80% 10%, rgba(140, 180, 255, 0.14), transparent 24%),
    linear-gradient(180deg, #060913, #090f1d 40%, #050811);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background: transparent;
}

a {
  color: var(--accent-2);
  text-decoration: none;
}

a:hover {
  color: var(--accent);
  text-decoration: underline;
}

code,
.mono,
pre {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

.layout {
  display: grid;
  grid-template-columns: var(--sidebar) minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 22px 18px;
  border-right: 1px solid var(--panel-border);
  background: rgba(7, 11, 22, 0.72);
  backdrop-filter: blur(16px);
  overflow: auto;
}

.brand {
  margin-bottom: 18px;
}

.brand strong {
  display: block;
  margin-top: 8px;
  font-size: 1.15rem;
  letter-spacing: -0.03em;
}

.toc {
  display: grid;
  gap: 4px;
  margin-bottom: 18px;
}

.toc a {
  padding: 8px 10px;
  border-radius: 10px;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.95rem;
}

.toc a:hover {
  color: var(--text);
  background: rgba(140, 180, 255, 0.08);
  text-decoration: none;
}

.sidebar-status {
  margin-top: 8px;
}

.sidebar-status h3 {
  margin: 0 0 10px;
  font-size: 0.95rem;
}

.sidebar-status p {
  margin: 0 0 8px;
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.45;
}

.sidebar-status .label {
  display: inline-block;
  min-width: 4.5rem;
  color: var(--accent-2);
}

.sidebar-status code {
  font-size: 0.78rem;
  word-break: break-all;
}

.sidebar-token {
  margin-top: 12px;
}

.sidebar-token h3 {
  margin: 0 0 12px;
  font-size: 0.82rem;
}

.sidebar-token input {
  min-width: 0;
  width: 100%;
  padding: 9px 10px;
  font-size: 0.78rem;
}

.token-actions {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  margin-top: 9px;
}

.token-actions button {
  padding: 8px 10px;
  font-size: 0.76rem;
}

.token-status,
.token-note {
  margin: 9px 0 0;
  font-size: 0.72rem;
  color: var(--muted);
}

.token-status.ok {
  color: var(--accent);
}

.token-note {
  margin-top: 4px;
}

.docs {
  width: min(920px, calc(100vw - var(--sidebar) - 48px));
  margin: 0 auto;
  padding: 28px 24px 72px;
}

.hero {
  position: relative;
  padding: 28px;
  border: 1px solid var(--panel-border);
  border-radius: 28px;
  background:
    linear-gradient(135deg, rgba(140, 180, 255, 0.14), transparent 40%),
    linear-gradient(180deg, rgba(10, 15, 29, 0.9), rgba(8, 11, 20, 0.94));
  box-shadow: var(--shadow);
  overflow: hidden;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.button-link {
  display: inline-flex;
  align-items: center;
  padding: 10px 16px;
  border-radius: 12px;
  text-decoration: none;
  font-weight: 600;
  border: 1px solid transparent;
}

.button-link.primary {
  color: #051019;
  background: linear-gradient(135deg, var(--accent), #c7ffe6);
}

.button-link.ghost {
  color: var(--text);
  background: rgba(140, 180, 255, 0.08);
  border-color: rgba(140, 180, 255, 0.2);
}

.button-link:hover {
  text-decoration: none;
  filter: brightness(1.05);
}

.playground {
  border-color: rgba(124, 240, 197, 0.22);
}

.stack {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

.field {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.9rem;
}

.field em {
  font-style: normal;
  opacity: 0.75;
}

.field input,
.field textarea,
.field select {
  width: 100%;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(140, 180, 255, 0.18);
  background: rgba(6, 10, 19, 0.9);
  color: var(--text);
  font: inherit;
  outline: none;
}

.field textarea {
  resize: vertical;
  min-height: 88px;
}

.field input:focus,
.field textarea:focus,
.field select:focus {
  border-color: rgba(124, 240, 197, 0.45);
  box-shadow: 0 0 0 4px rgba(124, 240, 197, 0.08);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.mode-toggle {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border-radius: 14px;
  border: 1px solid rgba(140, 180, 255, 0.18);
  background: rgba(6, 10, 19, 0.75);
  width: fit-content;
}

.mode-option {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}

.mode-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.mode-option span {
  display: inline-block;
  padding: 8px 14px;
  border-radius: 10px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 600;
  transition: background 0.15s ease, color 0.15s ease;
}

.mode-option input:checked + span {
  color: #051019;
  background: linear-gradient(135deg, var(--accent), #c7ffe6);
}

.mode-option input:focus-visible + span {
  box-shadow: 0 0 0 3px rgba(124, 240, 197, 0.25);
}

.image-edit-fields {
  padding: 12px;
  border-radius: 16px;
  border: 1px dashed rgba(140, 180, 255, 0.22);
  background: rgba(140, 180, 255, 0.04);
}

.image-edit-fields .ghost {
  width: 100%;
  min-height: 44px;
  margin-top: 0;
}

button.ghost {
  color: var(--text);
  background: rgba(140, 180, 255, 0.08);
  border: 1px solid rgba(140, 180, 255, 0.2);
  border-radius: 12px;
  padding: 10px 14px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

button.ghost:hover:not(:disabled) {
  filter: brightness(1.08);
}

button.ghost:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.media-item {
  position: relative;
}

.media-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.media-actions .ghost {
  font-size: 0.85rem;
  padding: 6px 10px;
}

.row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.inline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.92rem;
}

.status-line {
  margin: 0;
  min-height: 1.2em;
  color: var(--muted);
  font-size: 0.9rem;
  flex: 1;
}

.status-line.error {
  color: var(--danger);
}

.status-line.ok {
  color: var(--accent);
}

.primary {
  color: #051019;
  background: linear-gradient(135deg, var(--accent), #c7ffe6);
  font-weight: 700;
  border: none;
}

.media-grid {
  display: grid;
  gap: 14px;
  margin-top: 14px;
}

.media-grid img,
.media-grid video {
  width: 100%;
  max-height: 420px;
  object-fit: contain;
  border-radius: 16px;
  border: 1px solid rgba(140, 180, 255, 0.16);
  background: rgba(5, 9, 18, 0.7);
}

.media-meta {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
  word-break: break-all;
}

.video-job-card {
  margin-top: 16px;
}

@media (max-width: 700px) {
  .form-grid {
    grid-template-columns: 1fr;
  }
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border: 1px solid rgba(124, 240, 197, 0.28);
  border-radius: 999px;
  color: var(--accent);
  background: rgba(124, 240, 197, 0.08);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  margin: 0;
  letter-spacing: -0.03em;
}

h1 {
  margin-top: 16px;
  font-size: clamp(2.2rem, 5vw, 3.4rem);
  line-height: 1.02;
}

h2 {
  font-size: 1.45rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.lede {
  max-width: 70ch;
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.65;
}

.doc-section {
  margin-top: 28px;
  padding: 22px;
  border: 1px solid var(--panel-border);
  border-radius: 22px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.doc-section > p,
.doc-section > ol {
  color: var(--muted);
  line-height: 1.65;
}

.doc-section > h2 {
  margin-bottom: 12px;
}

.steps {
  padding-left: 1.2rem;
}

.steps li {
  margin: 0.4rem 0;
}

.hint {
  color: var(--muted);
  line-height: 1.55;
}

.card {
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  background: rgba(8, 12, 24, 0.72);
  padding: 14px;
}

.models-card {
  margin-top: 14px;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(140, 180, 255, 0.25);
  color: var(--accent-2);
  background: rgba(140, 180, 255, 0.08);
  font-size: 12px;
  white-space: nowrap;
  font-family: "SFMono-Regular", Consolas, monospace;
}

.pill.get {
  color: var(--accent);
  border-color: rgba(124, 240, 197, 0.3);
  background: rgba(124, 240, 197, 0.08);
}

.pill.post {
  color: #ffd28c;
  border-color: rgba(255, 210, 140, 0.3);
  background: rgba(255, 210, 140, 0.08);
}

.code,
.output {
  margin: 12px 0 0;
  padding: 14px 16px;
  border-radius: 14px;
  background: rgba(5, 9, 18, 0.92);
  border: 1px solid rgba(140, 180, 255, 0.16);
  overflow: auto;
  color: #dce7ff;
  font-size: 0.88rem;
  line-height: 1.5;
  white-space: pre;
}

.output {
  min-height: 120px;
  max-height: 320px;
  white-space: pre-wrap;
  color: var(--muted);
}

.table-wrap {
  overflow: auto;
  margin-top: 12px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

th,
td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(140, 180, 255, 0.12);
  vertical-align: top;
}

th {
  color: var(--accent-2);
  font-weight: 600;
}

td {
  color: var(--muted);
}

button {
  cursor: pointer;
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 8px 12px;
  font: inherit;
  color: var(--text);
  background: rgba(140, 180, 255, 0.08);
  border-color: rgba(140, 180, 255, 0.2);
}

button:hover {
  border-color: rgba(124, 240, 197, 0.35);
}

.ghost {
  color: var(--text);
  background: rgba(140, 180, 255, 0.08);
  border-color: rgba(140, 180, 255, 0.2);
}

.footnote {
  margin-top: 28px;
}

.footnote .hint {
  margin: 0;
}

@media (max-width: 900px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: relative;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--panel-border);
  }

  .docs {
    width: min(100vw - 24px, 920px);
    padding: 16px 12px 48px;
  }

  .toc {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
