/* Sociaro look (tokens from sociaro.com shared/tokens.css); re-points the variables the shared ui/ files read. */
@font-face { font-family: Fraunces; src: url(/static/fonts/fraunces.woff2) format('woff2'); font-weight: 100 900; font-display: swap; }
@font-face { font-family: 'Inter Tight'; src: url(/static/fonts/inter-tight.woff2) format('woff2'); font-weight: 100 900; font-display: swap; }
@font-face { font-family: 'JetBrains Mono'; src: url(/static/fonts/jetbrains-mono.woff2) format('woff2'); font-weight: 100 800; font-display: swap; }

:root, :root[data-theme="light"] {
  --paper: #f5efe2; --paper-2: #ede6d4; --paper-3: #e4dcc6;
  --ink: #1a1510; --ink-2: #3a2f22; --ink-3: #7a6e5e; --rule: #c9bfa9;
  --accent: #9a7a2e; --accent-2: #7a5e1e; --accent-ink: #fff8e8;
  --err: #a44a3a; --ok: #6a8a5c;
  --font-display: Fraunces, Georgia, serif;
  --font-body: 'Inter Tight', ui-sans-serif, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}
:root[data-theme="light"] {
  --bg: var(--paper); --panel: var(--paper-2); --panel-2: var(--paper-3); --field: #fffdf7; --popup: var(--paper);
  --line: var(--rule); --text: var(--ink); --muted: var(--ink-3);
  --highlight: var(--ink); --on-highlight: var(--paper);
  --accent-dark: var(--paper-3); --on-accent: var(--accent-ink); --accent-text: var(--accent-2);
  --inset-background: var(--paper-2); --red: var(--err); --success: var(--ok);
  font-family: var(--font-body);
}

body { background: var(--bg); }
h1, h2, h3 { font-family: var(--font-display); font-weight: 500; letter-spacing: -.01em; }
h2 { margin: 0; font-size: 20px; }
pre, code { font-family: var(--font-mono); }
a { color: var(--text); }

.playground, .legal { width: min(1280px, calc(100% - 40px)); margin-inline: auto; }
/* The console's masthead (customer-portal/ui.py), so the playground reads as one of its tabs. */
header.bar { border-bottom: 1px solid #d8cfb7; background: rgba(245,239,226,.92); position: sticky; top: 0; z-index: 10; backdrop-filter: blur(6px); }
.bar .wrap { max-width: 72rem; margin: 0 auto; padding: 0 clamp(16px,4vw,40px); display: flex; align-items: center; gap: clamp(12px,3vw,32px); min-height: 60px; flex-wrap: wrap; }
.mark { margin-right: auto; text-decoration: none; display: inline-flex; align-items: center; }
.mark img { height: 20px; width: auto; display: block; }
.bar nav { display: flex; gap: 4px; flex-wrap: wrap; }
.bar nav a { font: 500 13px/1 var(--font-body); padding: 9px 12px; border-radius: 3px; text-decoration: none; color: var(--ink-2); white-space: nowrap; }
.bar nav a:hover { background: var(--paper-2); }
.bar nav a[aria-current=page] { color: var(--accent); background: var(--paper-2); font-weight: 600; }
.who { font: 400 12px/1 var(--font-mono); color: var(--ink-3); min-width: 0; overflow-wrap: anywhere; }
.bar form { display: inline; margin: 0; }
/* The console's switch (customer-portal/ui.py) for a boolean field: what it shows is what is sent. */
.switch { display: inline-flex; align-items: center; gap: 10px; margin: 0; cursor: pointer; font-weight: 500; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch .track { position: relative; flex: none; width: 40px; height: 22px; border: 1px solid var(--rule); border-radius: 11px; background: var(--paper-2); transition: background .18s ease, border-color .18s ease; }
.switch .track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border: 1px solid var(--rule); border-radius: 50%; background: var(--field); transition: transform .18s ease; }
.switch input:checked + .track { background: var(--accent); border-color: var(--accent); }
.switch input:checked + .track::after { transform: translateX(18px); border-color: var(--accent); }
.switch input:focus-visible + .track { outline: 2px solid var(--accent); outline-offset: 2px; }
.switch .what { font-size: 13px; color: var(--ink-2); }
/* Link fields: one compact row per link (URL box, Upload, ×), and «+ Add» for a list. */
.url-field { display: grid; gap: 6px; }
fieldset.url-field { min-width: 0; margin: 0; padding: 0; border: 0; }
.url-label { font-size: 12px; font-weight: 600; color: var(--ink-2); }
.url-rows { display: grid; gap: 6px; }
.url-row { display: flex; align-items: center; gap: 6px; }
.url-row input:not([type=file]) { min-width: 0; height: 38px; padding: 0 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--field); color: var(--text); font: 13px var(--font-body); }
.url-row .url-input, .url-row > input[type=text] { flex: 1; }
.url-row .url-extra { flex: 0 0 84px; }
.url-row select { flex: none; width: auto; height: 38px; padding: 0 8px; border: 1px solid var(--line); border-radius: 10px; background: var(--field); color: var(--text); font: 13px var(--font-body); }
.url-row .secondary, .url-add { width: auto; flex: none; height: 38px; padding: 0 12px; font-size: 12px; }
.url-remove { flex: none; width: 30px; height: 30px; border: 0; border-radius: 8px; background: none; color: var(--muted); font-size: 18px; line-height: 1; }
.url-remove:hover { background: var(--paper-2); color: var(--text); }
.url-add { justify-self: start; }
.url-note { margin: 0; }
.url-note:empty { display: none; }
.url-note.error { color: var(--danger, #a44a3a); }
.bar button { min-height: 36px; padding: 0 12px; border: 1px solid var(--rule); border-radius: 2px; background: transparent; color: var(--ink-2); font: 500 13px var(--font-body); cursor: pointer; }
.bar button:hover { background: var(--paper-2); border-color: var(--ink-3); }
#signIn { width: auto; justify-content: center; padding: 9px 16px; font-size: 13px; text-decoration: none; }
.playground { padding: 24px 0 40px; }
.legal { padding-bottom: 32px; color: var(--muted); font-size: 11px; }
.legal a { color: var(--muted); }

.tabs { display: inline-flex; gap: 4px; padding: 4px; border: 1px solid var(--line); border-radius: 11px; background: var(--inset-background); }
.tabs button { padding: 6px 12px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); font-size: 12px; font-weight: 700; }
.tabs button:hover { color: var(--highlight); }
.tabs button[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); }
.pane-toggle { display: none; margin-bottom: 16px; width: 100%; }
.pane-toggle button { flex: 1; padding: 9px 12px; }

.panes { display: grid; grid-template-columns: minmax(360px, 440px) minmax(0, 1fr); gap: 24px; align-items: start; }
.pane { min-width: 0; }
.pane-card { border: 1px solid var(--line); border-radius: 14px; background: var(--panel); margin: 0; }
.pane-body { display: grid; gap: 16px; padding: 20px; }
.fields { display: grid; gap: 16px; }
.helper { margin: 0; font-size: 12px; color: var(--muted); line-height: 1.6; }
.field-help { margin: -8px 0 0; font-size: 12px; color: var(--muted); line-height: 1.6; }
.json-control { font-family: var(--font-mono); }
.lora-mix { min-width: 0; margin: 0; padding: 0; border: 0; }
.lora-mix legend { padding: 0; font-size: 13px; font-weight: 700; }
.lora-mix .helper { margin-top: 4px; }
.lora-part { display: grid; grid-template-columns: 1fr auto; align-items: center; margin-top: 12px; }
.lora-part label { margin: 0; font-weight: 500; }
.lora-part output { font: 12px var(--font-mono); font-variant-numeric: tabular-nums; }
.lora-part input[type=range] { grid-column: 1 / -1; width: 100%; height: 24px; margin: 0; padding: 0; border: 0; background: transparent; accent-color: var(--accent); }
.lora-part small { grid-column: 1 / -1; margin-top: 2px; font-size: 11px; }
.lora-part .helper { font-weight: 400; }
.lora-part:has(input:disabled) { color: var(--muted); }
.feedback { margin: 0; font-size: 13px; line-height: 1.6; overflow-wrap: anywhere; }
.feedback:empty { display: none; }
.feedback.error { color: var(--red); }
.advanced-settings { margin: 0; }
.advanced-settings summary { padding: 12px 0 4px; font-size: 13px; }
.advanced-settings .fields { margin-top: 12px; }

.run-bar { position: sticky; bottom: 0; z-index: 2; display: grid; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--line); border-radius: 0 0 14px 14px; background: var(--panel); }
.run-key { display: grid; gap: 6px; }
.balance { margin: 0; font-size: 12px; color: var(--muted); }
.balance strong { color: var(--text); font-weight: 600; }
.run-bar .primary { justify-content: center; font-size: 14px; }

.result-bar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--line); }
.result-meta { display: flex; align-items: center; gap: 12px; font-size: 12px; color: var(--muted); }
.elapsed { font-family: var(--font-mono); }
.pill { padding: 3px 10px; border: 1px solid var(--line); border-radius: 999px; font-size: 11px; font-weight: 600; color: var(--muted); }
.pill:empty { display: none; }
.pill[data-status="succeeded"] { color: var(--success); border-color: var(--success); }
.pill[data-status="failed"], .pill[data-status="attention"] { color: var(--red); border-color: var(--red); }
.tab-panel { margin: 0; padding: 20px; min-height: 320px; }
.tab-panel .empty-state { padding: 80px 20px; }
pre.tab-panel { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 12px; line-height: 1.6; }
.run-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 16px; }
.run-model { font-weight: 600; overflow-wrap: anywhere; }
.run-id { font-family: var(--font-mono); font-size: 11px; color: var(--muted); overflow-wrap: anywhere; }
.run-error { margin: 12px 0 0; font-size: 13px; color: var(--red); overflow-wrap: anywhere; }
.run-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 12px; }
.run-actions .primary { width: auto; padding: 9px 14px; font-size: 12px; text-decoration: none; }
progress { width: 100%; height: 5px; accent-color: var(--accent); margin: 8px 0; }
.outputs { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: 16px; }
.outputs figure { margin: 0; min-width: 0; }
.outputs img, .outputs video { display: block; width: 100%; max-height: 520px; object-fit: contain; border-radius: 10px; background: var(--panel-2); }
.outputs audio { width: 100%; }
.outputs .unavailable { margin: 0; padding: 24px; border: 1px dashed var(--line); border-radius: 10px; color: var(--muted); font-size: 13px; text-align: center; }
.output-actions { display: flex; align-items: center; gap: 12px; margin-top: 10px; font-size: 13px; }
.output-actions .copy-icon { position: static; transform: none; }

.code-wrap { position: relative; margin-top: 16px; }
.code-wrap pre { margin: 0; padding: 16px 52px 16px 16px; max-height: 480px; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 12px; line-height: 1.6; background: var(--field); border: 1px solid var(--line); border-radius: 12px; }
.code-wrap .copy-icon { top: 10px; transform: none; }


dialog { width: min(440px, calc(100% - 32px)); padding: 24px; border: 1px solid var(--line); border-radius: 16px; background: var(--popup); color: var(--text); box-shadow: var(--popup-shadow); }
dialog::backdrop { background: rgb(26 21 16 / 45%); }
dialog form { margin: 0; }
dialog p { line-height: 1.6; }
.dialog-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 12px; margin-top: 20px; }
.dialog-actions .primary { width: auto; justify-content: center; text-decoration: none; }

@media (max-width: 768px) {
  .url-row { flex-wrap: wrap; }
  .url-row .url-input { flex-basis: 100%; order: -1; }
  .pane-toggle { display: flex; }
  .panes { grid-template-columns: minmax(0, 1fr); }
  .panes[data-pane="input"] #resultPane, .panes[data-pane="result"] #inputPane { display: none; }
  .pane-body, .tab-panel, .result-bar { padding: 16px; }
  .run-bar { padding: 12px 16px; }
}
