:root {
  --bg: #f7f7f8;
  --surface: #ffffff;
  --text: #1b1c1f;
  --muted: #6b6f78;
  --border: #dcdee3;
  --accent: #5b5bd6;
  --accent-text: #ffffff;
  --ok: #1f8a4c;
  --err: #c2372f;
  --warn: #b85c00;
  --code-bg: #f1f2f5;
  --highlight: #e9e9fd;
  --link: #3f3fc4;
  --link-visited: #6b3fb8;
}
/* Dark colours: from the system setting while the theme is Auto, or chosen with the theme toggle
   (data-theme on <html>, set by the script in index.html and ui/theme.js). */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme=light]) {
    --bg: #131417;
    --surface: #1c1d21;
    --text: #e8e9ec;
    --muted: #9a9ea8;
    --border: #33353b;
    --accent: #8b8bf0;
    --accent-text: #111;
    --ok: #4fc283;
    --err: #ff7a70;
    --warn: #ff9a3c;
    --code-bg: #24262b;
    --highlight: #2c2c4a;
    --link: #a8b0ff;
    --link-visited: #d0b0ff;
  }
}
:root[data-theme=dark] {
  --bg: #131417;
  --surface: #1c1d21;
  --text: #e8e9ec;
  --muted: #9a9ea8;
  --border: #33353b;
  --accent: #8b8bf0;
  --accent-text: #111;
  --ok: #4fc283;
  --err: #ff7a70;
  --warn: #ff9a3c;
  --code-bg: #24262b;
  --highlight: #2c2c4a;
  --link: #a8b0ff;
  --link-visited: #d0b0ff;
}

* { box-sizing: border-box; }
/* Thin scrollbars in the theme's own colours (page, settings panel, text boxes), instead of the
   browser's light grey ones; color-scheme lets the browser draw the rest of its controls dark too. */
:root { color-scheme: light dark; }
:root[data-theme=light] { color-scheme: light; }
:root[data-theme=dark] { color-scheme: dark; }
* { scrollbar-width: thin; scrollbar-color: var(--muted) transparent; }
body {
  margin: 0;
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}
/* Links: the browser defaults are too dark on the dark theme, so both themes set their own. */
a { color: var(--link); text-underline-offset: 2px; }
a:visited { color: var(--link-visited); }
a:hover { text-decoration-thickness: 2px; }
code, .mono, pre, textarea.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* Masthead: the top bar and the API tester tabs, kept at the top while the page scrolls.
   ui/top-bar.js writes its height into --masthead-h, so jumps and sticky panels stop below it.
   When even the shortest bar wraps (.wrapped), it scrolls away with the page instead. */
.masthead { position: sticky; top: 0; z-index: 30; }
.masthead.wrapped { position: static; }
html { scroll-padding-top: calc(var(--masthead-h, 0px) + 12px); }
/* Top bar: title, section tabs, the API tester toggle, and the connection chip with its panel.
   It stays on one line as long as it can; ui/top-bar.js adds .short, .menu and .tight in turn. */
.topbar {
  position: relative; display: flex; flex-wrap: wrap; align-items: center; gap: 0 clamp(2px, .6vw, 8px);
  padding: 0 clamp(10px, 1.6vw, 20px); background: var(--surface); border-bottom: 1px solid var(--border);
}
.topbar h1 { font-size: 17px; margin: 0 clamp(4px, 1vw, 12px) 0 0; padding: 12px 0; white-space: nowrap; }
.topbar .tabs { padding: 0; border: none; background: none; }
.tabs button.unsupported { opacity: .45; }

.tabs {
  display: flex; gap: 2px; padding: 0 16px; overflow-x: auto;
  background: var(--surface); border-bottom: 1px solid var(--border);
}
.tabs[hidden] { display: none; }
.tabs button, .tester-toggle {
  background: none; border: none; border-bottom: 2px solid transparent; border-radius: 0;
  padding: 14px clamp(7px, 1vw, 14px) 12px; color: var(--muted); cursor: pointer; white-space: nowrap;
}
.tabs button.active, .tester-toggle.active { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }
.tester-toggle .caret { color: var(--muted); font-weight: 400; margin-left: 2px; }
/* The endpoint tabs: a row of pills under the top bar while one of them is open. */
.tester-tabs { gap: 4px; padding: 7px 20px; background: var(--bg); align-items: center; }
.tester-tabs button { border: 1px solid transparent; border-radius: 999px; padding: 4px 12px; font-size: 13px; }
.tester-tabs button.active { border-color: var(--accent); font-weight: 500; }
.tester-tabs .tab-sep { align-self: stretch; margin: 4px 6px; }

.conn { position: relative; margin-left: auto; padding: 8px 0; min-width: 0; flex: 0 1 auto; }
.conn-chip {
  display: flex; align-items: center; gap: 8px; max-width: 100%;
  border-radius: 999px; padding: 6px 14px; background: var(--bg); white-space: nowrap;
}
.conn-chip[aria-expanded=true] { border-color: var(--accent); }
.conn-chip .dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.conn-chip[data-state=ok] .dot { background: var(--ok); }
.conn-chip[data-state=err] .dot { background: var(--err); }
.conn-chip[data-state=loading] .dot { background: var(--accent); }
.conn-label { min-width: 0; max-width: 300px; overflow: hidden; text-overflow: ellipsis; }
.conn-state { font-size: 12px; color: var(--muted); }
.conn-chip[data-state=err] .conn-state { color: var(--err); }
.conn-chip .caret { color: var(--muted); }
.conn-panel {
  position: absolute; right: 0; top: calc(100% - 2px); z-index: 20;
  width: min(460px, calc(100vw - 32px)); box-sizing: border-box; padding: 16px;
  display: flex; flex-direction: column; gap: 12px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, .25);
}
.conn-panel[hidden] { display: none; }
.conn-panel p { margin: 0; }
.conn-field { display: flex; flex-direction: column; gap: 4px; }
.conn-row { display: flex; gap: 8px; align-items: center; }
.conn-row input { flex: 1; min-width: 0; }
.conn-row button[type=submit] { margin-left: auto; }
.key-form { display: flex; flex-direction: column; gap: 10px; }
.models-status { color: var(--muted); overflow-wrap: anywhere; }
.models-status.err { color: var(--err); }
.conn-signup { padding-top: 10px; border-top: 1px solid var(--border); }
/* Icon buttons at the end of the bar: the theme toggle and the GitHub link (one SVG in the text
   colour, so it suits both themes). */
.icon-link {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 34px; height: 34px; padding: 0; border: none; border-radius: 8px; background: none;
  color: var(--muted); cursor: pointer;
}
.icon-link:hover, .icon-link:visited:hover { color: var(--text); background: var(--bg); }
.icon-link:visited { color: var(--muted); }
.icon-link svg { width: 20px; height: 20px; }
/* The fitting steps. The tabs sit in .nav-wrap, which lays out as if it weren't there until .menu
   folds it into a drop-down under #nav-menu. */
.nav-wrap { display: contents; }
.nav-menu { display: none; }
.topbar.short .opt { display: none; }
.topbar.menu .nav-menu {
  display: flex; align-items: center; gap: 6px; white-space: nowrap; margin: 8px 0;
  padding: 6px 12px; border-radius: 8px; background: var(--bg); font-weight: 600;
}
.nav-menu .burger, .nav-menu .caret { color: var(--muted); font-weight: 400; }
/* All tab names stacked in one cell, only the open one visible: the button keeps one width. */
.nav-current { display: inline-grid; text-align: left; }
.nav-current > span { grid-area: 1 / 1; visibility: hidden; }
.nav-current > span.on { visibility: visible; }
.nav-menu[aria-expanded=true] { border-color: var(--accent); }
.topbar.menu .nav-wrap { display: none; }
.topbar.menu .nav-wrap.open {
  display: flex; flex-direction: column; position: absolute; top: calc(100% - 4px); z-index: 25;
  min-width: 200px; padding: 6px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; box-shadow: 0 12px 32px rgba(0, 0, 0, .25);
}
.topbar.menu .nav-wrap .tabs { flex-direction: column; gap: 0; overflow: visible; }
.topbar.menu .nav-wrap .tabs button, .topbar.menu .nav-wrap .tester-toggle {
  text-align: left; padding: 9px 12px; border-bottom: none; border-left: 3px solid transparent; border-radius: 6px;
}
.topbar.menu .nav-wrap .tabs button.active, .topbar.menu .nav-wrap .tester-toggle.active { border-left-color: var(--accent); background: var(--highlight); }
/* The endpoint tabs inside the drop-down: folded away until "API tester" is clicked, then a list
   to its right (or indented under it when there is no room to the right). */
.topbar.menu .nav-wrap #tester-tabs { display: none; }
.topbar.menu .nav-wrap.sub-open #tester-tabs {
  display: flex; flex-direction: column; align-items: stretch; gap: 0; position: absolute; left: calc(100% + 4px);
  min-width: 170px; padding: 6px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; box-shadow: 0 12px 32px rgba(0, 0, 0, .25);
}
.topbar.menu .nav-wrap.sub-open.sub-below #tester-tabs { position: static; min-width: 0; padding: 0 0 4px 14px; border: none; box-shadow: none; background: none; }
.topbar.menu .nav-wrap #tester-tabs button { border: none; border-left: 3px solid transparent; border-radius: 6px; padding: 7px 12px; text-align: left; font-size: 14px; }
.topbar.menu .nav-wrap #tester-tabs button.active { border-left-color: var(--accent); background: var(--highlight); }
.topbar.menu .nav-wrap #tester-tabs .tab-sep { display: none; }
.topbar.menu h1 { font-size: 15px; }
.topbar.tight .conn-state, .topbar.tight .gh-link, .topbar.tight #theme-toggle { display: none; }
/* The theme entry in the drop-down: only there once the icon has left the bar. */
.theme-item { display: none; }
.topbar.tight .nav-wrap.open .theme-item {
  display: block; text-align: left; padding: 9px 12px; margin-top: 4px; border: none;
  border-top: 1px solid var(--border); border-radius: 0 0 6px 6px; background: none; color: var(--muted); cursor: pointer;
}
.topbar.tight .nav-wrap.open .theme-item:hover { color: var(--text); }
.topbar.tight .conn-chip { padding: 6px 10px; gap: 6px; }
.topbar.tiny h1 { font-size: 13.5px; margin-right: 2px; }
.topbar.tiny .nav-menu { padding: 6px 8px; }
.topbar.tiny .nav-menu .burger { display: none; }
/* When even that wraps: the chip gets its own line, its label shortens, and the panel spans the width. */
.topbar.wrapped h1 { flex-basis: 100%; padding-bottom: 0; }
/* The chip takes what is left beside the menu button and shortens its label, so a long provider
   name ("Custom (OpenAI-compatible)") doesn't push it onto a third row. */
.topbar.tiny .conn, .topbar.wrapped .conn { margin-left: auto; min-width: 0; display: flex; justify-content: flex-end; flex: 1 1 0; }
.topbar.wrapped .conn { position: static; }
.topbar.wrapped .conn-chip { min-width: 0; }
.topbar.wrapped .conn-panel { left: 16px; right: 16px; width: auto; top: calc(100% + 4px); }
@media (max-width: 700px) { .conn-panel { left: 16px; right: 16px; width: auto; top: calc(100% + 4px); } .conn { position: static; } }

main { max-width: 1400px; margin: 0 auto; padding: 20px; }
.panel { display: none; }
.panel.active { display: grid; grid-template-columns: minmax(320px, 1fr) minmax(320px, 1.2fr); gap: 20px; align-items: start; }
.panel[data-panel=models].active { display: block; }
@media (max-width: 900px) { .panel.active { grid-template-columns: 1fr; } }

.request-form, .result {
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 16px;
  display: flex; flex-direction: column; gap: 12px; min-width: 0;
}
.result:empty::before { content: "Response will appear here."; color: var(--muted); }

label { display: flex; flex-direction: column; gap: 4px; font-weight: 500; font-size: 13px; }
label.inline { flex-direction: row; align-items: center; gap: 6px; font-weight: 400; }
input, select, textarea, button {
  font: inherit; color: inherit; background: var(--bg);
  border: 1px solid var(--border); border-radius: 6px; padding: 7px 9px;
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
button { cursor: pointer; }
button.primary, .key-form button {
  background: var(--accent); color: var(--accent-text); border-color: var(--accent); font-weight: 600;
}
button.primary { align-self: flex-start; padding: 8px 20px; }
button.secondary { background: var(--surface); }
button.icon { padding: 4px 8px; background: none; }
button:disabled { opacity: .6; cursor: progress; }

.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row[hidden] { display: none; }
.grid3 { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; align-items: end; }

.model-picker, .voice-picker { display: flex; flex-direction: column; gap: 6px; }
.model-picker .row select { flex: 1; min-width: 0; }
.model-picker .model-info { font-size: 12px; color: var(--muted); }

.messages { display: flex; flex-direction: column; gap: 8px; }
.message { display: grid; grid-template-columns: 110px 1fr auto; gap: 6px; align-items: start; }

.status-line { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; font-size: 12.5px; }
.badge { padding: 2px 8px; border-radius: 999px; font-weight: 600; font-size: 12px; border: 1px solid currentColor; }
.badge.ok { color: var(--ok); }
.badge.err { color: var(--err); }
.output { white-space: pre-wrap; word-break: break-word; background: var(--bg); border-radius: 8px; padding: 12px; }
.output.error { color: var(--err); }
.output img { max-width: 100%; border-radius: 6px; display: block; margin: 0 auto 8px; }
/* Pictures and clips with their bar (ui/media.js): Request details on the left, Retry and Download
   on the right. A picture opens larger in the pop-out (.lightbox) when clicked. */
figure.media { margin: 0 0 12px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
figure.media .media-pic { cursor: zoom-in; margin-bottom: 0; }
figure.media .media-pic:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
figure.media figcaption { margin: 0; }
.media-bar { display: flex; align-items: flex-start; gap: 8px; min-width: 0; }
.media-left { flex: 1 1 0; min-width: 0; }
.media-actions { display: flex; gap: 4px; flex: none; margin-left: auto; }
.media-btn { display: inline-grid; place-items: center; width: 34px; height: 34px; padding: 0; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface); color: var(--muted); cursor: pointer; }
a.media-btn, a.media-btn:visited { color: var(--muted); }
.media-btn:hover, a.media-btn:hover { color: var(--text); border-color: var(--accent); }
.media-btn svg { width: 18px; height: 18px; }
.media-details > summary { line-height: 34px; white-space: nowrap; }
/* Opened, the details take the bar's full width under the buttons rather than squeezing beside them. */
.media-bar { flex-wrap: wrap; }
.media-left:has(details[open]) { flex-basis: 100%; order: 2; }
.lightbox { position: fixed; inset: 0; z-index: 100; background: rgba(0, 0, 0, .86);
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; grid-template-rows: auto minmax(0, 1fr); align-items: center; gap: 8px; padding: 12px; }
.lightbox-bar { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; color: #ddd; }
.lightbox-actions { margin-left: auto; display: flex; gap: 6px; }
.lightbox-img { grid-column: 2; grid-row: 2; max-width: 100%; max-height: 100%; margin: auto; border-radius: 6px; object-fit: contain; }
.lightbox-prev { grid-column: 1; grid-row: 2; }
.lightbox-next { grid-column: 3; grid-row: 2; }
.lightbox .media-btn { background: rgba(30, 30, 34, .85); border-color: #555; color: #ddd; }
.lightbox a.media-btn, .lightbox a.media-btn:visited { color: #ddd; }
.result h3 { margin: 4px 0 0; font-size: 13px; }

pre { background: var(--code-bg); padding: 10px; border-radius: 6px; overflow: auto; max-height: 420px; margin: 6px 0 0; white-space: pre-wrap; word-break: break-all; }
details summary { cursor: pointer; font-weight: 500; font-size: 13px; }

.decision-options { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 8px; }
.decision-options span { padding: 4px 10px; border: 1px solid var(--border); border-radius: 999px; }
.decision-options span.chosen { background: var(--accent); color: var(--accent-text); border-color: var(--accent); font-weight: 600; }
.meter { height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; width: 160px; display: inline-block; vertical-align: middle; }
.meter > div { height: 100%; background: var(--accent); }

table { border-collapse: collapse; width: 100%; font-size: 12.5px; }
th, td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--border); white-space: nowrap; }
td.sim { text-align: center; font-variant-numeric: tabular-nums; }
.table-wrap { overflow: auto; max-height: 70vh; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; margin: 12px 0; }
#models-table thead th { position: sticky; top: 0; background: var(--surface); }
#model-filter { flex: 1; max-width: 420px; }
.cat { font-size: 11px; padding: 1px 6px; border-radius: 4px; background: var(--highlight); }

.questions { display: flex; flex-direction: column; gap: 10px; }
.question { border: 1px solid var(--border); border-radius: 8px; padding: 10px; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.question .row select { flex: 1; }
.answer { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; white-space: normal; }
.answer .cat { margin-left: 8px; }
.score-dist { display: grid; gap: 2px; }
.score-dist > div { display: grid; grid-template-columns: 120px 160px auto; align-items: center; gap: 6px; }

.ref-images { display: grid; grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); gap: 8px; }
.ref-images:empty { display: none; }
.ref-images figure { position: relative; margin: 0; }
.ref-images img { width: 100%; aspect-ratio: 1; object-fit: cover; border: 1px solid var(--border); border-radius: 6px; display: block; }
.ref-images figcaption { font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ref-images button { position: absolute; top: 2px; right: 2px; padding: 0 6px; line-height: 18px; font-size: 12px; }

/* Games and Tools: icon launcher, and the open app filling the page */
.tab-sep { flex: 0 0 1px; background: var(--border); margin: 8px 6px; }
.panel.hub.active { display: block; }
/* Games and Tools pages are narrower than the testers, so forms and pictures don't sit far apart on a
   wide screen. Inputs stay left-aligned; only pictures and video players are centred. */
.panel.hub { max-width: 1040px; margin-inline: auto; }
.hub-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.hub-head h2 { margin: 0; font-size: 18px; }
/* An open app's header, with the title as a drop-down of the hub's apps (hubs.js appSwitcher). It
   scrolls away with the page; the top bar's Tools and Games tabs are the main way to switch. */
.app-head { position: relative; margin: -8px 0 16px; padding: 8px 0; border-bottom: 1px solid var(--border); }
/* The list is placed against the header, so on a phone it starts at the left edge rather than after
   the back button. */
.app-switch-wrap { position: static; }
.app-switch {
  display: inline-flex; align-items: center; gap: 8px; padding: 4px 10px 4px 4px; border-radius: 10px;
  background: none; border: 1px solid transparent; color: var(--text); font: inherit; font-size: 18px; font-weight: 700; cursor: pointer;
}
.app-switch:hover, .app-switch[aria-expanded=true] { border-color: var(--border); background: var(--surface); }
.app-switch .caret { color: var(--muted); font-size: 13px; font-weight: 400; }
.app-switch .app-icon, .app-switch-item .app-icon {
  width: 30px; height: 30px; display: grid; place-items: center; border-radius: 8px; flex: none;
  background: var(--highlight); color: var(--accent);
}
.app-switch .app-icon svg, .app-switch-item .app-icon svg { width: 18px; height: 18px; }
.app-switch-list {
  position: absolute; top: calc(100% + 4px); left: 0; z-index: 25; width: min(380px, calc(100vw - 32px));
  display: flex; flex-direction: column; gap: 2px; padding: 6px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 12px 32px rgba(0, 0, 0, .25);
}
.app-switch-list[hidden] { display: none; }
.app-switch-item {
  display: flex; align-items: center; gap: 10px; text-align: left; padding: 8px; border-radius: 8px;
  background: none; border: none; border-left: 3px solid transparent; color: var(--text); font: inherit; font-size: 14px; font-weight: 400; cursor: pointer;
}
.app-switch-item > span:nth-child(2) { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.app-switch-item:hover, .app-switch-item:focus-visible { background: var(--highlight); }
.app-switch-item[aria-current] { border-left-color: var(--accent); background: var(--highlight); }
.app-switch-item .tag { margin-left: auto; }
/* The menu of the top bar's Tools and Games tabs (hubs.js setupHubMenus): under the tab, or, in the
   folded drop-down, as a list indented under it. */
.hub-menu {
  position: absolute; top: calc(100% - 4px); z-index: 25; min-width: 240px; padding: 6px;
  display: flex; flex-direction: column; gap: 2px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 12px 32px rgba(0, 0, 0, .25);
}
.hub-menu[hidden] { display: none; }
.hub-menu-item {
  display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 8px; border-left: 3px solid transparent;
  color: var(--text); text-decoration: none; font-size: 14px; white-space: nowrap;
}
.hub-menu-item:visited { color: var(--text); }
.hub-menu-item:hover, .hub-menu-item:focus-visible { background: var(--highlight); }
.hub-menu-item[aria-current] { border-left-color: var(--accent); background: var(--highlight); }
.hub-menu-item .app-icon { width: 26px; height: 26px; display: grid; place-items: center; border-radius: 7px; flex: none; background: var(--highlight); color: var(--accent); }
.hub-menu-item .app-icon svg { width: 16px; height: 16px; }
.hub-menu-all { color: var(--muted); border-top: 1px solid var(--border); border-radius: 0 0 8px 8px; margin-top: 2px; }
.hub-menu-all:visited { color: var(--muted); }
.topbar.menu .nav-wrap .hub-menu { position: static; min-width: 0; padding: 0 0 4px 14px; border: none; box-shadow: none; background: none; }
/* One line on a phone: the back button shows only its arrow, the title shortens with an ellipsis. */
.app-head { flex-wrap: nowrap; }
.app-head h2 { min-width: 0; flex: 0 1 auto; }
.app-switch { max-width: 100%; min-width: 0; }
.app-switch > span:nth-child(2) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
@media (max-width: 600px) {
  .app-back-text { display: none; }
  .app-switch { font-size: 16px; }
  .app-head .tag { display: none; }
}
.launcher { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.app-card {
  display: flex; flex-direction: column; align-items: flex-start; gap: 8px; text-align: left;
  padding: 18px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  color: var(--text); cursor: pointer; font: inherit;
}
.app-card:hover, .app-card:focus-visible { border-color: var(--accent); background: var(--highlight); }
.app-card .app-icon {
  width: 44px; height: 44px; display: grid; place-items: center; border-radius: 10px;
  background: var(--highlight); color: var(--accent);
}
.app-card .app-icon svg { width: 26px; height: 26px; }
.app-card strong { font-size: 15px; }
.app-card.soon { border-style: dashed; cursor: default; color: var(--muted); background: none; }
.app-card.soon:hover { border-color: var(--border); }
.tag { display: inline-block; font-size: 11px; padding: 1px 8px; border-radius: 999px; background: var(--highlight); color: var(--accent); font-weight: 600; }
.app-view { display: flex; flex-direction: column; gap: 16px; }
.placeholder-note { background: var(--surface); border: 1px dashed var(--border); border-radius: 10px; padding: 14px 18px; }
.placeholder-note ul { margin: 6px 0 0; padding-left: 20px; }
.mock { opacity: .75; }
.mock [disabled] { cursor: not-allowed; }

/* AI Group Chat */
.groupchat { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 16px; }
@media (max-width: 760px) { .groupchat { grid-template-columns: minmax(0, 1fr); } }
.gc-side, .gc-main { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 14px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.gc-side { align-self: start; }
.gc-side-head { justify-content: space-between; }
.gc-person { display: flex; gap: 8px; align-items: center; }
.gc-person.off { opacity: .5; }
.gc-person-text { flex: 1; min-width: 0; }
.ellip { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gc-edit { display: flex; flex-direction: column; gap: 8px; padding: 10px; border: 1px solid var(--accent); border-radius: 8px; }
.gc-edit input[type=color] { width: 40px; height: 26px; padding: 0 2px; }
button.icon-btn { background: none; border: none; padding: 2px 6px; color: var(--muted); font-size: 14px; line-height: 1; }
button.icon-btn:hover { color: var(--text); }
button.danger { color: var(--err); }
.gc-avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; color: #fff; flex: none; }
.gc-settings summary {
  cursor: pointer; display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap;
  padding: 9px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg);
}
.gc-settings summary::-webkit-details-marker { display: none; }
.gc-settings summary::after { content: '▸'; margin-left: auto; color: var(--muted); }
.gc-settings[open] summary::after { content: '▾'; }
.gc-settings summary:hover { border-color: var(--accent); }
.gc-settings[open] summary { border-color: var(--accent); }
.gc-settings-line { font-size: 13px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1 1 200px; }
.gc-settings[open] { display: flex; flex-direction: column; gap: 10px; padding-bottom: 10px; border-bottom: 1px solid var(--border); }
.gc-log { height: 55vh; min-height: 280px; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding-right: 4px; }
.gc-empty { margin: auto; text-align: center; max-width: 40ch; }
.gc-msg { display: flex; gap: 10px; align-items: flex-start; }
.gc-msg .bubble { background: var(--code-bg); border-radius: 10px; padding: 6px 12px 8px; max-width: min(70ch, 85%); }
.gc-msg.me { flex-direction: row-reverse; }
.gc-msg.me .bubble { background: var(--highlight); }
.gc-msg.failed .bubble { border: 1px solid var(--err); background: none; }
.gc-msg.failed .gc-text { color: var(--err); }
.gc-msg.typing .bubble { opacity: .7; }
/* Delete stays focusable: faded until hover or keyboard focus, always shown on touch screens. */
.gc-msg .icon-btn { opacity: 0; margin-left: 4px; }
.gc-msg:hover .icon-btn, .gc-msg:focus-within .icon-btn { opacity: 1; }
@media (hover: none) { .gc-msg .icon-btn { opacity: .7; } }
.gc-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.gc-msg.system .bubble { border: 1px dashed var(--border); background: none; }
.gc-msg.system .gc-text { color: var(--muted); }
/* A fallback that was handled (the round still ran): amber, a heads-up rather than a failure. */
.gc-msg.system.warn .bubble { border: 1px solid var(--warn); background: color-mix(in srgb, var(--warn) 12%, transparent); }
.gc-msg.system.warn .gc-meta span:first-child, .gc-msg.system.warn .gc-text { color: var(--warn); }
.gc-msg.system.warn .gc-avatar { background: var(--warn) !important; }
/* Group Chat's "typing…" indicator. Its own class, so other .dots (the Providers tab's setup level) stay still. */
.gc-dots { letter-spacing: 2px; animation: gc-blink 1.2s infinite; }
@keyframes gc-blink { 50% { opacity: .3; } }
.gc-queue { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; min-height: 24px; }
/* The Details toggle (off by default): the technical extras (.gc-detail) show only with it on. */
.gc-queue-row { display: flex; align-items: center; gap: 8px; }
.gc-queue-row .gc-queue { flex: 1 1 auto; min-width: 0; }
.gc-details-btn { flex: none; font-size: 12px; padding: 2px 9px; border-radius: 999px; border: 1px solid var(--border); background: none; color: var(--muted); cursor: pointer; }
.gc-details-btn[aria-pressed=true] { border-color: var(--accent); color: var(--text); background: var(--highlight); }

/* (?) help: a small round button after a label; its text shows on hover or focus (ui/help-tip.js). */
.help-tip-wrap { position: relative; display: inline-block; vertical-align: middle; }
.help-tip { width: 1.25em; height: 1.25em; padding: 0; border-radius: 50%; border: 1px solid var(--border); background: none; color: var(--muted); font: inherit; font-size: 0.8em; line-height: 1; cursor: help; }
.help-tip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.help-tip-text { display: none; position: absolute; left: 0; top: calc(100% + 6px); z-index: 20; width: max-content; max-width: 260px; padding: 8px 10px; border-radius: 6px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font-size: 13px; font-weight: normal; line-height: 1.4; box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18); }
.help-tip:hover + .help-tip-text, .help-tip:focus + .help-tip-text { display: block; }
.groupchat:not(.show-details) .gc-detail { display: none; }
.gc-chip { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; padding: 2px 9px; border-radius: 999px; border: 1px solid var(--border); }
.gc-chip .dot { width: 8px; height: 8px; border-radius: 50%; }
.gc-chip.typing { border-color: var(--accent); background: var(--highlight); font-weight: 600; }
.gc-chip.done { color: var(--muted); }
.gc-chip.failed { border-color: var(--err); color: var(--err); }
.gc-chip.skipped, .gc-chip.left { color: var(--muted); text-decoration: line-through; }
.gc-chip .gc-odds { color: var(--muted); font-variant-numeric: tabular-nums; }
.gc-settings label[hidden] { display: none; }
.gc-compose { display: flex; gap: 8px; align-items: stretch; }
.gc-compose textarea { flex: 1; min-width: 0; }
.gc-buttons { display: flex; flex-direction: column; gap: 6px; }
.gc-buttons button.primary { align-self: stretch; }
@media (max-width: 520px) { .gc-compose { flex-direction: column; } .gc-buttons { flex-direction: row; flex-wrap: wrap; } }

/* Video Generator mock */
.vidgen { display: grid; grid-template-columns: minmax(280px, 1fr) minmax(280px, 1.4fr); gap: 16px; }
@media (max-width: 900px) { .vidgen { grid-template-columns: 1fr; } }
.vidgen > div { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
/* Model cards wrap and stretch, so each row is filled at any width (no lone card on a half-empty row). */
/* The video model list (ui/video-settings.js): one compact row per model, its name, marks for start
   and end picture, sound and a face kept in our tests, and the price; "Other video model" last. */
.vg-models { display: flex; flex-direction: column; gap: 2px; }
.vg-model { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; align-items: center; gap: 4px 8px;
  padding: 5px 8px; border: 1px solid transparent; border-radius: 8px; cursor: pointer; font-weight: 400; }
.vg-model:hover { background: var(--highlight); }
.vg-model.chosen { border-color: var(--accent); background: var(--highlight); }
.vg-model input[type=radio] { margin: 0; }
.vg-model-name { font-size: 14px; line-height: 1.25; }
/* On a phone the marks go under the name, so names don't have to be cut or broken. */
@media (max-width: 520px) {
  .vg-model:not(.vg-other) { grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "radio name price" "radio marks price"; row-gap: 2px; }
  .vg-model:not(.vg-other) > input { grid-area: radio; }
  .vg-model:not(.vg-other) > .vg-model-name { grid-area: name; }
  .vg-model:not(.vg-other) > .vg-marks { grid-area: marks; }
  .vg-model:not(.vg-other) > .vg-model-price { grid-area: price; }
}
.tool-layout .vg-model-name { font-size: 15px; }
.vg-model-price { justify-self: end; font-size: 14px; white-space: nowrap; }
.vg-marks { display: inline-flex; gap: 3px; color: var(--muted); }
.vg-mark { display: inline-grid; place-items: center; width: 17px; height: 17px; }
.vg-mark svg { width: 15px; height: 15px; }
.vg-mark.need { color: var(--accent); }
.vg-mark.dim { opacity: .55; }
.vg-mark.full svg circle:first-child { fill: currentColor; fill-opacity: .35; }
.vg-other { grid-template-columns: auto minmax(0, 1fr); margin-top: 4px; border-color: var(--border); }
.vg-other select { grid-column: 1 / -1; }
.vg-legend { display: flex; flex-wrap: wrap; gap: 2px 12px; margin: 4px 2px 0; }
.vg-legend[hidden] { display: none; }
.vg-legend-item { display: inline-flex; align-items: center; gap: 3px; }
.vg-stage { aspect-ratio: 16 / 9; border-radius: 8px; background: var(--code-bg); display: grid; place-items: center; color: var(--muted); }

/* Draw the DreamGen Scene */
.tool-step { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 14px 18px; display: flex; flex-direction: column; gap: 10px; }
.tool-step h3 { margin: 0; font-size: 15px; }
.tool-form { display: flex; flex-direction: column; gap: 10px; }
.tool-step .result { margin: 0; }
/* A tool's step shows its result box only once there is something in it (the request details and stats). */
.tool-step .result:empty { display: none; }
.scene-preview { max-height: 320px; overflow: auto; white-space: pre-wrap; }
.scene-chars { display: flex; flex-direction: column; gap: 8px; }
.scene-chars:empty { display: none; }
.scene-char { display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; border-top: 1px solid var(--border); padding-top: 8px; }
.scene-char > button { flex: none; }
.ref-portraits { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
.ref-portraits:empty { display: none; }
.ref-portraits figure { position: relative; margin: 0; display: flex; flex-direction: column; gap: 4px; }
.ref-portraits img { width: 100%; aspect-ratio: 1; object-fit: cover; border: 1px solid var(--border); border-radius: 6px; display: block; }
.ref-portraits .remove { position: absolute; top: 2px; right: 2px; padding: 0 6px; line-height: 18px; font-size: 12px; }
.ref-portraits input[type=text], .ref-portraits input:not([type]) { font-size: 12px; padding: 4px 6px; }
.ref-portraits figure.off img { opacity: .4; }
.ref-portraits .small-row { display: flex; flex-wrap: wrap; gap: 4px; }
.ref-portraits .small-row button { padding: 2px 6px; font-size: 12px; }
.ref-portraits .send { display: flex; align-items: center; gap: 4px; }
.export-pictures { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; margin-top: 8px; }
.export-pictures figure { margin: 0; display: flex; flex-direction: column; gap: 4px; }
.export-pictures img { width: 100%; aspect-ratio: 1; object-fit: cover; border: 1px solid var(--border); border-radius: 6px; display: block; }
.scene-export { font-size: 12px; min-height: 220px; resize: vertical; }
.notice { background: var(--highlight); border-radius: 8px; padding: 8px 12px; }

/* Tool pages: the steps on the left, the settings panel on the right (ui/tool-layout.js), so the
   work has the focus. On a narrow screen the panel folds into a Settings button above the steps. */
.panel.hub:has(.tool-layout) { max-width: 1320px; }
.tool-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(300px, 360px); gap: 16px; align-items: start; }
.tool-layout > .tool-panel { grid-column: 2; grid-row: 1; }
.tool-layout > .tool-main { grid-column: 1; grid-row: 1; }
.tool-main { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.tool-panel {
  position: sticky; top: calc(var(--masthead-h, 0px) + 12px); max-height: calc(100vh - var(--masthead-h, 0px) - 24px); overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px;
}
.tool-panel-head { display: none; }
.tool-panel-body { display: flex; flex-direction: column; gap: 14px; }
.panel-section { min-width: 0; }
.panel-section + .panel-section { border-top: 1px solid var(--border); padding-top: 14px; }
.panel-section h3 { margin: 0; font-size: 15px; display: inline; }
/* Each section folds by its heading (panelSection in ui/tool-layout.js); all start open. */
.panel-section > details > summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 6px; }
.panel-section > details > summary::-webkit-details-marker { display: none; }
.panel-section > details > summary::before { content: '▾'; color: var(--muted); font-size: 12px; width: 12px; }
.panel-section > details:not([open]) > summary::before { content: '▸'; }
.panel-section-body { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; min-width: 0; }
.panel-section p { margin: 0; }
.tool-panel .model-picker .row { flex-wrap: wrap; }
.tool-panel .model-picker select { min-width: 0; flex: 1 1 100%; }
@media (max-width: 900px) {
  .tool-layout { grid-template-columns: minmax(0, 1fr); }
  .tool-layout > .tool-panel, .tool-layout > .tool-main { grid-column: 1; grid-row: auto; }
  .tool-panel { position: static; max-height: none; }
  .tool-panel-head { display: flex; align-items: center; gap: 10px; min-width: 0; }
  .tool-panel-summary { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
  .tool-panel.open .tool-panel-head { margin-bottom: 14px; }
  .tool-panel:not(.open) .tool-panel-body { display: none; }
}
/* Tool pages read larger than the testers: the testers stay compact, the tools are for reading. */
.tool-layout { font-size: 15px; }
.tool-layout .small, .tool-layout .model-picker .model-info, .tool-layout .vs-price { font-size: 14px; }
.tool-layout label, .tool-layout details summary, .tool-layout .status-line { font-size: 14.5px; }
.tool-layout .tool-step h3, .tool-layout .panel-section h3 { font-size: 17px; }
.tool-layout .scene-export, .tool-layout pre, .tool-layout .mono { font-size: 13.5px; }
.tool-layout input, .tool-layout select, .tool-layout textarea, .tool-layout button { font-size: 15px; }
.tool-layout .tool-about > summary { font-size: 15.5px; }
/* A text box in a folded section (System prompt) fills the width, with its Reset button below it. */
.tool-layout details > textarea { display: block; width: 100%; box-sizing: border-box; margin: 8px 0 6px; resize: vertical; }
/* Video model cards: the name and the price only; the details are in the tooltip and, for the
   chosen model, in the note under the cards. */
.vg-model-note { background: var(--highlight); border-radius: 8px; padding: 8px 12px; }
.vg-model-note:empty { display: none; }
.vg-model-note ul { margin: 4px 0; padding-left: 18px; }
/* A tool's "How it works · Privacy", folded after the first visit (aboutBox). */
.tool-about { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 10px 18px; }
.tool-about > summary { cursor: pointer; font-weight: 600; font-size: 14px; }
.tool-about-body { padding-top: 8px; }
.tool-about-body ol { margin: 0 0 8px; padding-left: 20px; }
.tool-about-body p { margin: 6px 0 0; }
/* The tools fold the status, request, response and cURL into one "Request details". */
.request-details > summary { color: var(--muted); font-size: 13px; }
.request-details[open] { display: flex; flex-direction: column; gap: 6px; }

/* Long file inputs (e.g. "Add portraits") must not push past the card on phones. */
.tool-step input[type=file] { max-width: 100%; min-width: 0; }
.tool-step label.inline { flex-wrap: wrap; max-width: 100%; }
.style-custom[hidden] { display: none; }

.cancel-btn { align-self: flex-start; }
.cancel-btn[hidden] { display: none; }

/* Animate the DreamGen Scene mock: keep the picture and clip boxes a sensible size */
.tool-step .vg-stage { width: 100%; max-width: 560px; margin-inline: auto; }

/* Providers tab */
.panel[data-panel=providers].active { display: block; }
.topbar h1 a { color: inherit; text-decoration: none; }
.topbar h1 { padding: 6px 0; line-height: 0; }
.logo { display: inline-flex; align-items: center; gap: 5px; }
.logo svg { display: block; width: auto; }
.logo .logo-icon { height: 38px; }
.logo .logo-word { height: 32px; }
.lg-paper { fill: var(--surface); }
.topbar.tiny .logo .logo-word { display: none; }
.topbar h1 a:hover { opacity: .8; }
/* The logo is the Welcome link: underlined like an active tab while the Welcome page is open. */
.topbar h1 { align-self: stretch; display: flex; align-items: center; padding: 0; }
.topbar h1 a { align-self: stretch; border-bottom: 2px solid transparent; padding: 6px 0 4px; }
.topbar h1 a[aria-current=page] { border-bottom-color: var(--accent); }
/* The welcome page (Providers tab): intro, tool cards, then one wide box per provider. */
.welcome { max-width: 1100px; margin-inline: auto; display: flex; flex-direction: column; gap: 26px; font-size: 15px; line-height: 1.5; }
.welcome section > h3 { margin: 0 0 10px; font-size: 17px; }
.welcome p { margin: 0 0 6px; }
.welcome-hero h2 { margin: 0 0 8px; font-size: 24px; }
.welcome-hero p { font-size: 17px; max-width: 760px; }
.welcome-start ol { margin: 0 0 8px; padding-left: 22px; }
.welcome-start li { margin: 3px 0; }
/* Getting started follows the connection (providers-guide.js): done steps ticked and dimmed, the
   next one marked, and "You're set" once a key and the model list are in. */
.welcome-start li.done { color: var(--muted); }
.welcome-start li.done .tick { color: var(--ok); font-weight: 700; }
.welcome-start li.current { font-weight: 600; }
.welcome-start li.current::marker { color: var(--accent); }
.welcome-start.ready { border-left: 3px solid var(--ok); padding-left: 14px; }
.welcome-start details { margin-top: 6px; }
.welcome-start summary { cursor: pointer; color: var(--muted); }
.link-btn { background: none; border: none; padding: 0; font: inherit; color: var(--link); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.welcome a.app-card { text-decoration: none; color: inherit; }
.welcome-privacy p { max-width: 760px; }
.providers-intro { max-width: 760px; margin-bottom: 14px; }
.providers-intro h2 { margin: 0 0 6px; font-size: 22px; }
.provider-cards { display: flex; flex-direction: column; gap: 16px; }
.provider-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 18px 20px;
  display: grid; grid-template-columns: minmax(240px, 1fr) minmax(0, 1.3fr) minmax(0, 1.2fr); gap: 22px; align-items: start; }
@media (max-width: 860px) { .provider-card { grid-template-columns: 1fr; gap: 12px; } }
.provider-card.off { opacity: .75; }
.provider-main, .provider-notes { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.provider-steps { min-width: 0; }
.provider-card p, .provider-card ol, .provider-card ul { margin: 0; }
.provider-card ol, .provider-card ul { padding-left: 20px; }
.provider-card li { margin: 3px 0; }
.provider-head { display: flex; flex-direction: column; gap: 4px; }
.provider-head h3 { margin: 0; font-size: 19px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.provider-head .ease { font-size: 13px; color: var(--muted); }
.provider-head .dots { color: var(--accent); letter-spacing: 1px; }
.provider-card .row { margin-top: 4px; flex-wrap: wrap; }
a.button-link { display: inline-block; padding: 6px 12px; border-radius: 8px; background: var(--accent); color: var(--accent-text); text-decoration: none; font-weight: 600; }
a.button-link:visited { color: var(--accent-text); }
a.button-link:hover { filter: brightness(1.08); }
/* A picture's footer: the tokens and cost on the left, the Animate button on the right with its line under it. */
.handoff-row { display: flex; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; gap: 8px 16px; margin-top: 10px; }
.handoff-action { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; text-align: right; margin-left: auto; }

/* Model filter (Filter models tab) */
.model-filter {
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 16px;
  display: flex; flex-direction: column; gap: 12px; margin-bottom: 16px;
}
.model-filter-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 12px; }
.model-filter-head .mf-clear { margin-left: auto; }
.model-filter-head .mf-clear[hidden] { display: none; }
.model-filter-lists { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; }
.mf-list { border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px 12px; margin: 0; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.mf-list legend { font-weight: 600; padding: 0 4px; }
.mf-list p { margin: 0; }
.mf-list .row input { flex: 1; min-width: 0; }
/* A combobox (ui/combo.js: the model filter, AI Group Chat): its list is as tall as about eight
   rows and scrolls for the rest. */
.mf-add { align-items: flex-start; }
.combo { position: relative; flex: 1; min-width: 0; display: flex; }
.combo input { width: 100%; }
.combo-list {
  position: absolute; z-index: 15; top: calc(100% + 4px); left: 0; min-width: 100%; width: max-content; max-width: min(480px, calc(100vw - 48px));
  max-height: 300px; overflow-y: auto;
  list-style: none; margin: 0; padding: 4px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, .25);
}
.combo-list[hidden] { display: none; }
.combo-list li { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 7px 10px; border-radius: 6px; font-size: 14px; cursor: pointer; white-space: nowrap; }
.combo-list li[aria-selected=true], .combo-list li[role=option]:hover { background: var(--highlight); }
.combo-list li.current { font-weight: 600; }
.combo-list .combo-more { cursor: default; display: block; }
.mf-rows { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.mf-rows:empty::before { content: "Empty: matches everything"; color: var(--muted); font-size: 12px; }
.mf-rows li { display: flex; align-items: center; gap: 2px; padding: 2px 4px 2px 10px; border: 1px solid var(--border); border-radius: 999px; background: var(--bg); }
.filter-note { margin: 0; }
.filter-note[hidden] { display: none; }
.model-picker label[hidden] { display: none; }

/* Video tools: model cards, settings and clips */
.video-settings { display: flex; flex-direction: column; gap: 10px; }
.vs-price { font-size: 13px; }
.vs-notice:empty { display: none; }
/* The shared video choice doesn't suit this tool: a pick is needed before the tool can run. */
.vs-notice.vs-blocked { color: var(--text); background: var(--highlight); border-left: 3px solid var(--err); border-radius: 6px; padding: 8px 12px; }
/* Video jobs (ui/video-jobs.js), in the video tools' settings panel. */
.vj-list { display: flex; flex-direction: column; gap: 10px; }
.vj-row { border: 1px solid var(--border); border-radius: 8px; padding: 10px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.vj-row.running { border-color: var(--accent); }
.vj-row.failed { border-color: color-mix(in srgb, var(--err) 60%, transparent); }
.vj-head { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.vj-head .icon-btn { margin-left: auto; }
.vj-status.live { color: var(--accent); font-weight: 600; }
.vj-prompt { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.vj-row .row { flex-wrap: wrap; gap: 8px; align-items: center; }
.output video, .vj-row video { max-width: 100%; border-radius: 6px; display: block; }
/* A finished clip plays centred in its result box, at most 70% of the screen height. */
.output video { margin-inline: auto; max-height: 70vh; }
.output > video + div { text-align: center; margin-top: 6px; }
.tool-form { display: flex; flex-direction: column; gap: 12px; }
/* With a picture in it, the box takes the picture's own shape (portrait, square, wide), up to 480 px
   tall, instead of the empty 16:9 placeholder, so a tall picture can't spill over the buttons. */
.tool-step .vg-stage:has(img) { aspect-ratio: auto; background: none; width: auto; max-width: 100%; align-self: center; }
.vg-stage img { display: block; max-width: 100%; max-height: 480px; width: auto; height: auto; object-fit: contain; border-radius: 8px; }
/* Relative price: $$$$$ with the first n lit (1-5), never an amount. */
.price-tag { font-weight: 700; letter-spacing: 1px; white-space: nowrap; }
.price-tag .on { color: var(--text); }
.price-tag .off { color: var(--muted); opacity: .45; }
.price-tag .price-amount { font-weight: 400; letter-spacing: 0; color: var(--muted); }

/* A model's test results and details, folded under the model picker (ui/model-picker.js). */
.model-picker .model-facts > summary { cursor: pointer; color: var(--muted); font-size: 14px; }
.model-picker .model-facts p { margin: 6px 0 0; }
.tip-row { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; }
