:root {
  color-scheme: dark;
  --canvas: #101211;
  --surface: #181b19;
  --ink: #f2f0e9;
  --muted: #a3a49a;
  --subtle: #7c8076;
  --line: #30352f;
  --accent: #d6a77e;
  --accent-bright: #edc8a3;
  --accent-dim: rgba(214, 167, 126, 0.13);
  --paper: #efeadd;
  --paper-ink: #20251f;
  --window: #161917;
  --onaccent: #1a1d19;
  --control-size: 44px;
  --surface-hover: #1d211d;
  --line-hover: #4a5048;
  --control: #989b90;
  --control-muted: #8c9085;
  --control-bg: rgba(24, 27, 25, 0.7);
  --control-bg-hover: rgba(32, 36, 31, 0.8);
  --overlay: rgba(8, 10, 9, 0.78);
  --shadow-result: 0 18px 40px rgba(0, 0, 0, 0.35);
  --shadow-popover: 0 26px 70px rgba(0, 0, 0, 0.55);
  --shadow-dialog: 0 40px 120px rgba(0, 0, 0, 0.55);
  --font-body: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: SFMono-Regular, Consolas, monospace;
  font-family: var(--font-body);
  background: var(--canvas);
  color: var(--ink);
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
}

* { box-sizing: border-box; }
html { background: var(--canvas); scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; background: var(--canvas); }
[hidden] { display: none !important; }
button, a, select, textarea, summary { touch-action: manipulation; }
button, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; border: 0; cursor: pointer; background: none; min-height: var(--control-size); }
a { color: inherit; text-underline-offset: 4px; }
button:focus-visible, a:focus-visible, select:focus-visible, textarea:focus-visible, [tabindex]:focus-visible, summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}
button:disabled { cursor: default; opacity: 0.55; }
::selection { background: var(--accent); color: var(--onaccent); }

.wrap {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  max-width: 1264px;
  margin: auto;
  padding: 0 clamp(20px, 4.4vw, 56px);
}

/* Header */
.header {
  flex: none;
  height: 84px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.wordmark {
  display: inline-flex;
  align-items: center;
  color: var(--ink);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.9px;
  text-decoration: none;
}
.header-actions { display: flex; align-items: center; gap: 20px; }
.header-link, .set-up {
  display: inline-flex;
  align-items: center;
  padding: 8px 0;
  color: var(--muted);
  font-size: 13px;
  transition: color 0.2s ease;
}
.header-link:hover, .set-up:hover { color: var(--ink); }
.header-link.is-connected::before {
  content: "";
  width: 5px;
  height: 5px;
  margin-right: 7px;
  border-radius: 50%;
  background: var(--accent);
}

/* Prompt lab */
main {
  flex: 1;
  padding: clamp(8px, 2vh, 28px) 0 36px;
}
.lab {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
}
.lab-intro { margin-bottom: 16px; }
.lab-kicker {
  margin: 0 0 10px;
  color: var(--accent);
  font-size: 11px;
  line-height: 1.4;
  letter-spacing: 1.2px;
  text-transform: uppercase;
}
.prompt {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}
.prompt > label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.9px;
  text-transform: uppercase;
}
.prompt-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: stretch;
}
textarea {
  width: 100%;
  min-height: 92px;
  max-height: 190px;
  padding: 12px 14px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--canvas);
  color: var(--ink);
  font-size: 13px;
  line-height: 1.55;
}
textarea::placeholder { color: var(--subtle); }
.run {
  align-self: stretch;
  min-width: 156px;
  padding: 0 18px;
  border-radius: 7px;
  background: var(--accent);
  color: var(--onaccent);
  font-size: 13px;
  font-weight: 600;
  transition: filter 0.2s ease;
}
.run:hover { filter: brightness(1.06); }
.prompt-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 18px;
  margin-top: 10px;
}
.presets { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 11px;
}
.chip:hover { border-color: var(--line-hover); color: var(--ink); }
.chip[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-dim); color: var(--ink); }
.live-model { margin: 0; color: var(--subtle); font-size: 12px; line-height: 1.5; }
.live-model strong { color: var(--muted); font-weight: 500; }
.connect-link {
  min-height: 0;
  padding: 0;
  color: var(--accent);
  font-size: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.connect-link:hover { color: var(--accent-bright); }
.run-status {
  min-height: 20px;
  margin: 9px 2px 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}
.run-status:empty { min-height: 0; margin-top: 0; }
.fixture-note { margin: 8px 0 0; color: var(--subtle); font-size: 10.5px; line-height: 1.5; }

/* Comparison stage */
/* Four model cards */
.models-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-top: 12px;
}
.compare-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px 24px;
  margin-top: 20px;
}
.recorded-note {
  margin: 0;
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.5;
  letter-spacing: 0.2px;
}
.all-switch {
  display: flex;
  flex: none;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 7px;
}
.all-switch button {
  min-height: 36px;
  padding: 0 16px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  transition: background 0.15s ease, color 0.15s ease;
}
.all-switch button + button { border-left: 1px solid var(--line); }
.all-switch button:hover { color: var(--ink); }
.all-switch button[aria-pressed="true"] { background: var(--ink); color: var(--canvas); }
.all-switch button[aria-pressed="true"]:hover { color: var(--canvas); }
.model-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}
.card-title { margin: 0; color: var(--ink); font-size: 14px; font-weight: 500; letter-spacing: -0.2px; }
.card-meta { margin: 2px 0 0; color: var(--muted); font-size: 10px; line-height: 1.4; }
.card-state {
  flex: none;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.8px;
  text-transform: uppercase;
}
.model-card[data-side="after"] .card-state { color: var(--accent); }
.card-view {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 8 / 5;
  overflow: hidden;
  padding: 6px;
  border: 0;
  background: var(--window);
  text-align: left;
}
button.card-view { cursor: zoom-in; }
.card-view:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.card-shot {
  position: absolute;
  inset: 6px;
  width: calc(100% - 12px);
  height: calc(100% - 12px);
  border-radius: 3px;
  object-fit: cover;
  object-position: top left;
  visibility: hidden;
  opacity: 0;
}
.model-card[data-side="before"] .card-shot.before,
.model-card[data-side="after"] .card-shot.after { visibility: visible; opacity: 1; }
.card-live {
  position: absolute;
  top: 6px;
  left: 6px;
  width: 1280px;
  height: 800px;
  border: 0;
  border-radius: 3px;
  background: var(--paper);
  transform-origin: top left;
}
.card-status {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  margin: 0;
  padding: 20px;
  background: var(--overlay);
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}
.model-card.is-ready .card-status { display: none; }

.stage {
  display: grid;
  grid-template-columns: 136px minmax(0, 1fr);
  gap: clamp(24px, 3.6vw, 42px);
  align-items: center;
}
.models { display: grid; gap: 9px; align-content: center; min-width: 0; }
.model {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  width: 100%;
  min-width: 0;
  min-height: 0;
  padding: 0;
  border: 0;
  background: none;
  color: var(--subtle);
  text-align: left;
}
.model .thumb {
  display: block;
  width: 100%;
  aspect-ratio: 8 / 5;
  object-fit: cover;
  object-position: top left;
  border: 1px solid transparent;
  border-radius: 4px;
  opacity: 0.45;
  transition: opacity 0.2s ease, border-color 0.2s ease;
}
.model .label { display: block; font-size: 12px; line-height: 1.25; letter-spacing: -0.1px; }
.model .meta { display: block; color: var(--subtle); font-size: 9.5px; line-height: 1.3; opacity: 0.8; }
.model[aria-pressed="true"] { color: var(--ink); }
.model[aria-pressed="true"] .thumb, .model[aria-pressed="true"] .thumb-wrap { opacity: 1; border-color: var(--line-hover); }
.model:hover .thumb, .model:hover .thumb-wrap { opacity: 0.78; }
.model:disabled { cursor: progress; }
.model .meta[data-status="error"] { color: var(--accent); }
.thumb-wrap {
  position: relative;
  width: 100%;
  min-width: 0;
  aspect-ratio: 8 / 5;
  overflow: hidden;
  border: 1px solid transparent;
  border-radius: 4px;
  background: var(--window);
  opacity: 0.45;
  transition: opacity 0.2s ease, border-color 0.2s ease;
}
.thumb-frame {
  position: absolute;
  top: 0;
  left: 0;
  width: 1280px;
  height: 800px;
  border: 0;
  transform: scale(0.10625);
  transform-origin: top left;
  pointer-events: none;
  background: var(--paper);
}
.thumb-placeholder {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  background: var(--surface);
  color: var(--subtle);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.6px;
}
.rail-empty { margin: 0; color: var(--subtle); font-size: 11px; line-height: 1.5; }
.rail-link { display: inline-flex; min-height: 32px; align-items: center; color: var(--accent); font-size: 11px; line-height: 1.4; text-decoration: underline; text-underline-offset: 3px; }
.rail-link:hover { color: var(--accent-bright); }
.frame {
  position: relative;
  min-width: 0;
  aspect-ratio: 8 / 5;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--window);
  box-shadow: var(--shadow-result);
  cursor: ew-resize;
  touch-action: pan-y;
}
.frame:focus-visible { outline-offset: 3px; }
.shot {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top left;
  opacity: 0;
}
.live {
  position: absolute;
  top: 0;
  left: 0;
  width: 1280px;
  height: 800px;
  border: 0;
  transform-origin: top left;
  background: var(--paper);
  opacity: 0;
  pointer-events: none;
}
.frame[data-source="recorded"][data-view="before"] .shot.before,
.frame[data-source="recorded"][data-view="after"] .shot.after,
.frame[data-source="live"][data-view="before"] .live.before,
.frame[data-source="live"][data-view="after"] .live.after { opacity: 1; }
.frame[data-source="live"] .live { pointer-events: auto; }
.frame-empty, .frame-loading {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 12px;
  padding: 26px;
  background: var(--overlay);
  text-align: center;
}
.frame-empty p, .frame-loading p {
  max-width: 380px;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}
.frame-loading { backdrop-filter: blur(4px); }
.spinner {
  width: 22px;
  height: 22px;
  border: 2px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: lab-spin 0.9s linear infinite;
}
@keyframes lab-spin { to { transform: rotate(360deg); } }
.cancel { min-height: 36px; color: var(--muted); font-size: 12px; }
.cancel:hover { color: var(--ink); }
.noscript { max-width: 380px; margin: 0 auto; padding: 40px 20px; color: var(--muted); font-size: 13px; line-height: 1.6; text-align: center; }

.lab-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 12px;
}
.compare { display: flex; }
.state {
  min-height: var(--control-size);
  padding: 0 18px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--subtle);
  font-size: 11px;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  cursor: pointer;
}
.state:first-child { border-radius: 7px 0 0 7px; }
.state:last-child { border-left: 0; border-radius: 0 7px 7px 0; }
.state[aria-pressed="true"] { background: var(--ink); color: var(--canvas); }
.source { margin: 0; color: var(--subtle); font-size: 11px; line-height: 1.5; text-align: right; }

/* Run details */
.run-meta, .prompt-lab {
  margin-top: 14px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.run-meta summary, .prompt-lab summary {
  display: flex;
  align-items: center;
  min-height: var(--control-size);
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.9px;
  text-transform: uppercase;
  cursor: pointer;
}
.meta-body { padding: 2px 0 16px; }
.meta-body dl {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  gap: 6px 18px;
  margin: 0 0 12px;
  font-size: 12px;
  line-height: 1.55;
}
.meta-body dt { color: var(--subtle); }
.meta-body dd { margin: 0; color: var(--muted); overflow-wrap: anywhere; }
.limits { margin: 0 0 12px; color: var(--subtle); font-size: 11px; line-height: 1.6; }
.meta-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.prompt-lab-body { padding: 2px 0 16px; }

/* Measures */
.measures { margin-top: 24px; }
.measures-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.measures h3 {
  margin: 0;
  color: var(--muted);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.9px;
  text-transform: uppercase;
}
.measure-view { display: flex; overflow: hidden; border: 1px solid var(--line); border-radius: 6px; }
.measure-view button {
  min-height: 30px;
  padding: 0 10px;
  color: var(--subtle);
  font-size: 10px;
}
.measure-view button:first-child { border-right: 1px solid var(--line); }
.measure-view button[aria-pressed="true"] { background: var(--ink); color: var(--canvas); }
.measure-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.measure-table th, .measure-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}
.measure-table thead th {
  color: var(--subtle);
  font-size: 9.5px;
  font-weight: 500;
  letter-spacing: 0.6px;
  text-transform: uppercase;
}
.measure-table tbody th { color: var(--muted); font-weight: 400; }
.measure-table td { color: var(--ink); font-variant-numeric: tabular-nums; }
.measure-table td.change { color: var(--subtle); font-variant-numeric: tabular-nums; }
.measure-note { margin: 10px 0 0; color: var(--subtle); font-size: 11px; line-height: 1.6; }
.measure-empty { color: var(--subtle); font-size: 12px; }
.fact-detail { margin-top: 8px; color: var(--muted); font-size: 11px; }
.fact-detail summary { min-height: 32px; cursor: pointer; }
.fact-detail ul { margin: 4px 0 0; padding-left: 18px; line-height: 1.6; }

.benchmark-note {
  margin-top: 24px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}
.benchmark-note h3 {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.9px;
  text-transform: uppercase;
}
.benchmark-note p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.65; }
.benchmark-note strong { color: var(--ink); font-weight: 500; }
.benchmark-note a { color: var(--accent); }

.benchmark { margin-top: 28px; scroll-margin-top: 24px; }
.benchmark-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}
.benchmark-head h3 {
  margin: 0;
  color: var(--muted);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.9px;
  text-transform: uppercase;
}
.benchmark-head p { max-width: 470px; margin: 0; color: var(--subtle); font-size: 12px; line-height: 1.6; text-align: right; }
.benchmark-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.benchmark-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  text-align: left;
  transition: border-color 0.2s ease, background 0.2s ease;
}
.benchmark-card:hover { border-color: var(--line-hover); background: var(--surface-hover); }
.benchmark-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.pair-item { display: block; min-width: 0; }
.benchmark-pair img {
  display: block;
  width: 100%;
  aspect-ratio: 8 / 5;
  object-fit: cover;
  object-position: top left;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--window);
}
.pair-label {
  display: block;
  margin-top: 3px;
  color: var(--subtle);
  font-size: 9px;
  letter-spacing: 0.6px;
  text-transform: uppercase;
}
.benchmark-card .name { color: var(--ink); font-size: 12px; font-weight: 500; }
.benchmark-card .meta { color: var(--subtle); font-size: 10px; line-height: 1.4; }
.benchmark-card .scores {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  padding-top: 6px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}
.benchmark-card .score { color: var(--ink); }
.benchmark-foot { margin: 10px 0 0; color: var(--subtle); font-size: 11px; line-height: 1.6; }
.benchmark-foot a { color: var(--accent); }

/* Footer */
.foot {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0 20px;
  color: var(--subtle);
}
.demo-info { position: relative; display: inline-flex; align-items: center; }
.info-button, .github {
  display: grid;
  place-items: center;
  width: var(--control-size);
  height: var(--control-size);
  min-height: var(--control-size);
  padding: 0;
  border-radius: 50%;
  color: var(--control-muted);
  transition: color 0.25s ease, background 0.25s ease;
}
.info-button:hover, .github:hover { color: var(--ink); background: var(--control-bg-hover); }
.info-button svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.2; }
.info-button .info-dot { fill: currentColor; stroke: none; }
.github svg { width: 18px; height: 18px; fill: currentColor; }
.demo-details {
  position: absolute;
  z-index: 5;
  bottom: 46px;
  left: 0;
  width: min(360px, calc(100vw - 40px));
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.65;
  box-shadow: var(--shadow-popover);
}
.demo-details p { margin: 0 0 10px; }
.demo-details a { color: var(--ink); }
.panel-link {
  min-height: var(--control-size);
  padding: 8px 0 0;
  color: var(--accent);
  font-size: 11px;
  text-align: left;
}
.panel-link:hover { color: var(--accent-bright); }

/* Dialogs */
dialog {
  width: min(620px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  padding: 32px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-dialog);
  overflow: auto;
  overscroll-behavior: contain;
}
dialog.viewer {
  width: min(1100px, calc(100vw - 24px), calc((100dvh - 150px) * 1.6));
  max-height: calc(100dvh - 24px);
  padding: 0;
  overflow: hidden;
}
.viewer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}
.viewer-head h2 { margin: 0; color: var(--ink); font-size: 16px; font-weight: 500; letter-spacing: -0.2px; }
.viewer-meta { margin: 3px 0 0; color: var(--muted); font-size: 10.5px; line-height: 1.4; }
.viewer-controls { display: flex; flex: none; align-items: center; gap: 12px; }
.viewer-switch button { min-height: 34px; padding: 0 12px; }
.viewer-stage { position: relative; aspect-ratio: 8 / 5; overflow: hidden; padding: 6px; background: var(--window); }
.viewer-stage iframe {
  position: absolute;
  top: 6px;
  left: 6px;
  width: 1280px;
  height: 800px;
  border: 0;
  background: var(--paper);
  transform-origin: top left;
}
.viewer-note {
  margin: 0;
  padding: 10px 18px 12px;
  border-top: 1px solid var(--line);
  color: var(--subtle);
  font-size: 10.5px;
  line-height: 1.5;
}
dialog::backdrop { background: var(--overlay); backdrop-filter: blur(8px); }
.dialog-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}
.dialog-head h2 {
  margin: 4px 0 0;
  font-size: 29px;
  font-weight: 500;
  letter-spacing: -1.2px;
  line-height: 1.08;
}
.dialog-head .icon {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: var(--control-size);
  height: var(--control-size);
  min-height: var(--control-size);
  border-radius: 50%;
  color: var(--muted);
  font-size: 22px;
}
.dialog-head .icon:hover { color: var(--ink); background: var(--canvas); }
dialog p { color: var(--muted); font-size: 14px; line-height: 1.7; }
.reasons { display: grid; gap: 20px; }
.reasons h3 { margin: 0 0 5px; color: var(--accent); font-size: 12px; font-weight: 500; }
.reasons p { margin: 0; }
dialog a { color: var(--ink); }
.dialog-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 22px;
}
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--control-size);
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: transparent;
  color: var(--ink);
  font-size: 12px;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}
.button:hover { background: var(--surface-hover); border-color: var(--line-hover); }
.button.primary { border-color: var(--accent); background: var(--accent); color: var(--onaccent); font-weight: 600; }
.button.primary:hover { background: var(--accent); filter: brightness(1.06); }
.text {
  min-height: var(--control-size);
  padding: 0 4px;
  color: var(--muted);
  font-size: 12px;
}
.text:hover { color: var(--ink); }
.dialog-status { min-height: 20px; margin-top: 8px; color: var(--accent); font-size: 12px; line-height: 1.5; }
.setup-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 23px 0; }
.setup-fields label, .connect-fields label:not(.check-row), .connected label { display: grid; gap: 8px; color: var(--muted); font-size: 12px; }
select {
  width: 100%;
  min-height: var(--control-size);
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--canvas);
  color: var(--ink);
}
.command {
  padding: 18px;
  border-radius: 8px;
  background: var(--canvas);
  overflow: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 12px;
  line-height: 1.7;
}
.setup-steps { padding-left: 18px; color: var(--muted); font-size: 13px; line-height: 1.7; }
.setup-steps li { margin: 8px 0; }
.subtle { margin: 8px 0 0; color: var(--subtle); font-size: 12px; line-height: 1.6; }
.connect-fields { display: grid; gap: 14px; margin: 18px 0 8px; }
.connect-fields input[type="password"] {
  width: 100%;
  min-height: var(--control-size);
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--canvas);
  color: var(--ink);
  font: inherit;
  font-size: 13px;
}
.check-row { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; }
.check-row input { width: 16px; height: 16px; accent-color: var(--accent); }
.connect-help { margin: 4px 0 0; font-size: 12px; }
.connector-note { margin: 12px 0 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--canvas); color: var(--accent-bright); font-size: 12px; line-height: 1.5; }
.connected { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
dialog.workshop {
  width: min(1260px, calc(100vw - 24px));
  height: calc(100dvh - 24px);
  padding: 0;
  overflow: hidden;
}
.workshop .dialog-head {
  align-items: center;
  margin: 0;
  padding: 12px 20px;
  border-bottom: 1px solid var(--line);
}
.workshop .dialog-head h2 { margin: 0; font-size: 17px; font-weight: 500; letter-spacing: -0.3px; }
.workshop iframe { width: 100%; height: calc(100% - 69px); border: 0; background: var(--canvas); }

.sr-only, .skip:not(:focus) {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.skip:focus {
  position: fixed;
  z-index: 9;
  top: 0;
  left: 0;
  padding: 15px;
  background: var(--paper);
  color: var(--paper-ink);
}

@media (min-width: 1500px) {
  .wrap { max-width: 1340px; padding: 0 64px; }
}

@media (max-width: 1000px) and (min-width: 761px) {
  .stage { grid-template-columns: 112px minmax(0, 1fr); gap: 20px; }
  .benchmark-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .model .label { font-size: 10.5px; }
  .model .meta { font-size: 9px; }
}

@media (max-width: 760px) {
  .models-grid { grid-template-columns: 1fr; }
  .stage { grid-template-columns: 1fr; gap: 16px; }
  .benchmark-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .benchmark-head { align-items: flex-start; flex-direction: column; gap: 6px; }
  .benchmark-head p { text-align: left; }
  .models { grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; max-width: 360px; margin: 0 auto; gap: 8px; }
  .model .label { font-size: 10.5px; }
  .model .meta { font-size: 9px; }
  .frame { width: 100%; max-width: 900px; margin: 0 auto; }
  .lab-controls { flex-wrap: wrap; }
  .source { text-align: left; }
}

@media (max-width: 640px) {
  .wrap { padding: 0 20px; }
  .header { height: 72px; }
  .header-actions { gap: 12px; }
  .wordmark { font-size: 18px; letter-spacing: -0.7px; }
  .header-link, .set-up { font-size: 11px; }
  main { padding: 12px 0 24px; }
  .prompt { padding: 12px; }
  .prompt-row { grid-template-columns: 1fr; }
  .run { min-height: var(--control-size); padding: 0 16px; }
  .prompt-foot { justify-content: flex-start; }
  textarea { min-height: 150px; }
  .compare-bar { flex-direction: column; align-items: stretch; gap: 10px; }
  .all-switch { width: 100%; }
  .all-switch button { flex: 1; min-height: 40px; font-size: 11px; }
  .models { max-width: 360px; gap: 6px; }
  .model .label { font-size: 9.5px; }
  .model .meta { display: none; }
  .lab-controls { padding-top: 10px; }
  .state { padding: 0 14px; font-size: 10px; }
  .source { width: 100%; font-size: 10px; }
  .meta-body dl { grid-template-columns: 1fr; gap: 2px; }
  .meta-body dt { margin-top: 6px; }
  .measures-head { align-items: flex-start; }
  .measure-table th, .measure-table td { padding: 7px 6px; }
  .benchmark-grid { grid-template-columns: 1fr; }
  .measure-table { font-size: 11px; }
  .measure-table thead th { font-size: 9px; }
  .foot { padding-bottom: 14px; }
  dialog { padding: 22px; border-radius: 14px; }
  .dialog-head h2 { font-size: 26px; }
  .reasons { gap: 16px; }
  .setup-fields { grid-template-columns: 1fr; }
  .viewer-head { flex-wrap: wrap; padding: 12px 14px; }
  .viewer-controls { width: 100%; justify-content: space-between; }
  .viewer-switch { flex: 1; }
  .viewer-switch button { flex: 1; }
  .viewer-note { padding: 8px 14px 10px; }
  .dialog-footer { gap: 8px; }
  .dialog-footer .button { flex: 1 1 auto; }
  .workshop .dialog-head { padding: 10px 14px; }
  .workshop iframe { height: calc(100% - 65px); }
}

@media (min-width: 901px) and (max-height: 820px) {
  .header { height: 72px; }
  main { padding: 6px 0 20px; }
  .foot { padding-bottom: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

@media (max-width: 380px) {
  .header { gap: 10px; }
  .wordmark { font-size: 16px; letter-spacing: -0.5px; }
  .header-actions { gap: 10px; }
  .header-link, .set-up { font-size: 10px; white-space: nowrap; }
  textarea { min-height: 190px; }
}
