:root {
  color-scheme: light;
  --bg: #f6f5fa;
  --surface: #fff;
  --ink: #251d3b;
  --muted: #635c73;
  --line: #e4dfec;
  --accent: #542bab;
  --accent-hover: #45218d;
  --tint: #efe8fb;
  --success: #186044;
  --error: #962a40;
  --radius: 16px;
  --mono: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-family: system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
h1, h2, h3, p { margin: 0; }
p { color: var(--muted); line-height: 1.5; }
h2 { font-size: 1.27rem; letter-spacing: -.025em; }
h3 { font-size: 1.1rem; letter-spacing: -.015em; }
.shell { width: min(1080px, calc(100% - 48px)); margin-inline: auto; }
main { padding-block: 34px 56px; }
.topbar { background: var(--surface); border-bottom: 1px solid var(--line); }
.topbar-inner, .brand, .health, .actions, .check, .format { display: flex; align-items: center; gap: 10px; }
.topbar-inner { min-height: 64px; justify-content: space-between; }
.brand { font-weight: 750; letter-spacing: -.025em; }
.brand-mark { display: flex; align-items: center; justify-content: center; gap: 3px; width: 30px; height: 30px; border-radius: 9px; background: var(--accent); }
.brand-mark i, .wave i { display: block; border-radius: 999px; }
.brand-mark i { width: 3px; height: 10px; background: #fff; }
.brand-mark i:nth-child(2) { height: 16px; }
.health { font-size: .875rem; font-weight: 650; color: var(--muted); }
.health::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
[data-state="success"] { color: var(--success); }
[data-state="error"] { color: var(--error); }

.intro {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 36px 40px;
  margin-bottom: 20px;
  border-radius: var(--radius);
  background: #271744;
  color: #fff;
  overflow: hidden;
}
.intro h1 { font-size: clamp(2.4rem, 5vw, 4.1rem); line-height: 1.02; letter-spacing: -.065em; }
.intro p { margin-top: 12px; color: #e2d6f7; }
.wave { display: flex; align-items: center; gap: 8px; margin-right: 4px; }
.wave i { width: clamp(4px, .55vw, 8px); height: 26px; background: #9b72e9; }
.wave i:nth-child(3n) { height: 53px; }
.wave i:nth-child(4n) { height: 39px; }
.wave i:nth-child(5n) { height: 70px; background: #bd9bff; }
.wave i:nth-child(7n) { height: 84px; background: #d6bdff; }
.wave i:nth-child(-n+2), .wave i:nth-last-child(-n+2) { height: 14px; opacity: .45; }

.workspace { display: grid; grid-template-columns: minmax(240px, 310px) minmax(0, 1fr); gap: 20px; align-items: start; }
.card { padding: 24px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); min-width: 0; }
.connection-state { margin: 5px 0 18px; font-size: .875rem; font-weight: 650; }
.account {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  padding: 9px 10px;
  border-radius: 10px;
  background: var(--tint);
}
.account .avatar { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; flex: none; background: #fff; }
.account-meta { display: grid; gap: 2px; min-width: 0; }
.account-meta strong { font-size: .85rem; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-meta a { font-size: .74rem; color: var(--muted); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-meta a:hover { color: var(--accent); }
form { display: grid; gap: 10px; justify-items: start; }
.generation-fields { display: grid; gap: 10px; width: 100%; min-width: 0; margin: 0; padding: 0; border: 0; }
form + .result, .connection-actions + .result { margin-top: 16px; }
label, summary { font-weight: 650; }
label { font-size: .9rem; }
input, textarea, select, button, .button { font: inherit; }
input:not([type="checkbox"]), textarea, select {
  max-width: 100%;
  padding: 10px 12px;
  border: 1px solid #cfc7de;
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
}
input:not([type="checkbox"]), textarea { width: 100%; }
textarea { resize: vertical; min-height: 105px; }
::placeholder { color: #706981; }
.check { font-weight: 500; margin-block: 2px; }
.check input { accent-color: var(--accent); width: 17px; height: 17px; flex: none; margin: 0; }
.connection-actions { display: grid; gap: 8px; border-top: 1px solid var(--line); margin-top: 18px; padding-top: 16px; }
.connection form > button { width: 100%; }
.actions { flex-wrap: wrap; }
.format { color: var(--muted); }
button, .button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  min-height: 42px;
  padding: 9px 14px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: #fff;
  background: var(--accent);
  font-size: .875rem;
  font-weight: 680;
  text-decoration: none;
  cursor: pointer;
}
button:hover, .button:hover { background: var(--accent-hover); }
.secondary { background: var(--surface); color: var(--accent); border-color: #d7cbe7; }
.secondary:hover, .quiet:hover { background: var(--tint); }
.quiet { color: var(--accent); background: transparent; }
button:disabled { opacity: .58; cursor: wait; }
:focus-visible { outline: 3px solid #8560cb; outline-offset: 3px; }
.views { display: flex; flex-wrap: wrap; gap: 6px; margin: 16px 0 20px; border-bottom: 1px solid var(--line); padding-bottom: 10px; }
.views button { color: var(--muted); background: transparent; padding-inline: 10px; }
.views button:hover, .views button[aria-pressed="true"] { color: var(--accent); background: var(--tint); }
.panel > p { margin-top: 6px; }
.panel > form, .upload > form { margin-top: 14px; }
.upload { border-top: 1px solid var(--line); margin-top: 20px; padding-top: 16px; }
summary { cursor: pointer; }
.result {
  display: grid;
  gap: 10px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  font-size: .9rem;
  overflow-wrap: anywhere;
}
.result p { color: inherit; }
.result details { color: var(--muted); }
.result pre { max-height: 240px; margin: 8px 0 0; white-space: pre-wrap; overflow: auto; }
pre, code { font-family: var(--mono); font-size: .85em; }
.result .actions { gap: 8px; }
.result .button, .result button { min-height: 36px; padding: 6px 10px; }
.endpoints { margin-top: 20px; }
.endpoints > summary { display: flex; align-items: center; gap: 10px; list-style: none; }
.endpoints > summary::-webkit-details-marker { display: none; }
.endpoints > summary::before { content: ''; width: 7px; height: 7px; border-right: 2px solid; border-bottom: 2px solid; transform: rotate(-45deg); }
.endpoints[open] > summary::before { transform: rotate(45deg); }
.endpoints > summary span { margin-left: auto; color: var(--muted); font-size: .875rem; }
.endpoints p { margin: 16px 0 10px; }
.docs-links { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; }
.docs-links a { color: var(--accent); font-weight: 600; text-decoration: none; }
.docs-links a:hover { text-decoration: underline; }
table { width: 100%; border-collapse: collapse; text-align: left; font-size: .9rem; }
td, th { padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
tbody th { font-weight: 500; overflow-wrap: anywhere; }
tbody td:first-child { color: var(--accent); font-weight: 700; font-size: .8rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

@media (max-width: 720px) {
  .workspace { grid-template-columns: 1fr; }
  .intro { padding: 28px; }
  .wave { gap: 5px; }
  .wave i:nth-child(n+12) { display: none; }
}
@media (max-width: 440px) {
  .shell { width: calc(100% - 28px); }
  main { padding-top: 20px; }
  .card, .intro { padding: 18px; }
  .wave { display: none; }
  .views button { padding-inline: 7px; }
  td, th { padding-inline: 4px; }
}
