:root {
  --bg: #09090b;
  --bg-deep: #060607;
  --panel: rgba(20, 20, 23, 0.82);
  --panel-solid: #141416;
  --panel-soft: rgba(255, 255, 255, 0.035);
  --line: rgba(255, 255, 255, 0.09);
  --line-strong: rgba(255, 255, 255, 0.15);
  --text: #f5f2ec;
  --text-soft: #aaa7a0;
  --text-muted: #6f6e6a;
  --accent: #ff6a3d;
  --accent-hot: #ff8b55;
  --accent-soft: rgba(255, 106, 61, 0.14);
  --amber: #ffc45e;
  --green: #6fe5a5;
  --red: #ff6d77;
  --blue: #82b8ff;
  --radius-xl: 26px;
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.34);
  --font-ui: "Avenir Next", "SF Pro Display", "SF Pro Text", "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-mono: "SFMono-Regular", "Cascadia Code", "Roboto Mono", monospace;
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: dark;
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 75% -10%, rgba(255, 106, 61, 0.12), transparent 30rem),
    radial-gradient(circle at -5% 55%, rgba(255, 187, 97, 0.05), transparent 26rem),
    linear-gradient(180deg, #0c0c0f 0%, var(--bg) 44%, #080809 100%);
  color: var(--text);
  font-family: var(--font-ui);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button,
input,
textarea,
select {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  color: inherit;
}

svg {
  display: block;
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

::selection {
  color: #0b0b0d;
  background: var(--accent-hot);
}

:focus-visible {
  outline: 2px solid var(--accent-hot);
  outline-offset: 3px;
}

[hidden] {
  display: none !important;
}

.ambient {
  position: fixed;
  z-index: -2;
  width: 38rem;
  height: 38rem;
  border-radius: 999px;
  filter: blur(110px);
  opacity: 0.13;
  pointer-events: none;
}

.ambient--one {
  top: 4rem;
  right: -16rem;
  background: #ff572f;
}

.ambient--two {
  bottom: -18rem;
  left: 18%;
  background: #ffb13c;
}

.grain {
  position: fixed;
  inset: 0;
  z-index: 20;
  opacity: 0.028;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.92' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.75'/%3E%3C/svg%3E");
}

.app {
  width: min(1560px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: 0 34px;
}

.topbar {
  position: relative;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 98px;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  gap: 13px;
  align-items: center;
  color: var(--text);
  text-decoration: none;
}

.brand__mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 12px;
  background: var(--accent);
  color: #0a0a0c;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.1), 0 12px 28px rgba(255, 106, 61, 0.18);
  transform: rotate(-3deg);
}

.brand__mark svg {
  width: 27px;
  height: 27px;
  fill: currentColor;
  stroke: none;
}

.brand__type {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.brand__type strong {
  font-size: 18px;
  font-weight: 750;
  letter-spacing: 0.21em;
}

.brand__type small {
  color: var(--text-muted);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.26em;
}

.topbar__right {
  display: flex;
  gap: 10px;
  align-items: center;
}

.local-chip,
.connection-chip {
  display: inline-flex;
  gap: 9px;
  align-items: center;
  min-height: 34px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text-soft);
  background: rgba(255, 255, 255, 0.02);
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 650;
  letter-spacing: 0.1em;
  white-space: nowrap;
}

.local-chip__dot,
.connection-chip__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.035);
}

.local-chip__dot {
  background: var(--amber);
}

.connection-chip[data-state="connected"] {
  color: #c9f8dc;
  border-color: rgba(111, 229, 165, 0.22);
  background: rgba(111, 229, 165, 0.06);
}

.connection-chip[data-state="connected"] .connection-chip__dot {
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(111, 229, 165, 0.08), 0 0 12px rgba(111, 229, 165, 0.5);
}

.connection-chip[data-state="loading"] .connection-chip__dot {
  background: var(--amber);
  animation: pulseDot 1.1s ease-in-out infinite;
}

.connection-chip[data-state="error"] {
  color: #ffc7cb;
  border-color: rgba(255, 109, 119, 0.25);
  background: rgba(255, 109, 119, 0.06);
}

.connection-chip[data-state="error"] .connection-chip__dot {
  background: var(--red);
}

.layout {
  display: grid;
  grid-template-columns: 326px minmax(0, 1fr);
  gap: 26px;
  padding: 28px 0 0;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.workspace {
  min-width: 0;
}

.panel {
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(150deg, rgba(255, 255, 255, 0.026), transparent 46%),
    var(--panel);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.02) inset;
  backdrop-filter: blur(22px);
}

.connection-panel,
.models-panel {
  padding: 20px;
}

.panel__heading,
.card-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.panel__heading h2,
.card-heading h2,
.activity-panel__heading h2 {
  margin: 3px 0 0;
  font-size: 18px;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.eyebrow {
  display: flex;
  gap: 8px;
  align-items: center;
  margin: 0;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.17em;
}

.eyebrow span {
  color: var(--accent);
}

.lock-badge {
  display: grid;
  width: 31px;
  height: 31px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.025);
}

.lock-badge svg {
  width: 15px;
  height: 15px;
}

#connectionForm {
  display: flex;
  flex-direction: column;
  gap: 15px;
  margin-top: 21px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.field__label {
  color: #c3c0b9;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.field__label--split {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.field__hint {
  color: var(--text-muted);
  font-size: 9px;
  line-height: 1.5;
}

.input-shell,
.select-shell {
  position: relative;
  display: flex;
  align-items: center;
  min-width: 0;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.22);
  transition: border-color 180ms ease, background 180ms ease, box-shadow 180ms ease;
}

.input-shell:focus-within,
.select-shell:focus-within {
  border-color: rgba(255, 106, 61, 0.48);
  background: rgba(255, 106, 61, 0.035);
  box-shadow: 0 0 0 3px rgba(255, 106, 61, 0.07);
}

.input-shell > svg {
  flex: 0 0 18px;
  width: 18px;
  height: 18px;
  margin-left: 13px;
  color: #777670;
}

.input-shell input {
  width: 100%;
  min-width: 0;
  height: 100%;
  padding: 0 12px;
  border: 0;
  outline: 0;
  color: var(--text);
  background: transparent;
  font-family: var(--font-mono);
  font-size: 11px;
}

.input-shell input::placeholder,
textarea::placeholder {
  color: #5d5c58;
}

.input-action {
  display: grid;
  flex: 0 0 38px;
  width: 38px;
  height: 38px;
  padding: 0;
  place-items: center;
  border: 0;
  color: var(--text-muted);
  background: transparent;
  cursor: pointer;
  transition: color 150ms ease;
}

.input-action:hover {
  color: var(--text);
}

.input-action svg {
  width: 16px;
  height: 16px;
}

.form-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.check-field {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  color: var(--text-soft);
  font-size: 10px;
  cursor: pointer;
  user-select: none;
}

.check-field input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.check-field__box {
  position: relative;
  width: 15px;
  height: 15px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.02);
  transition: border-color 160ms ease, background 160ms ease;
}

.check-field input:checked + .check-field__box {
  border-color: var(--accent);
  background: var(--accent);
}

.check-field input:checked + .check-field__box::after {
  position: absolute;
  top: 2px;
  left: 4px;
  width: 4px;
  height: 7px;
  border: solid #111;
  border-width: 0 1.5px 1.5px 0;
  content: "";
  transform: rotate(45deg);
}

.text-button {
  padding: 0;
  border: 0;
  color: var(--accent-hot);
  background: transparent;
  font-size: 10px;
  font-weight: 650;
  cursor: pointer;
}

.text-button:hover {
  color: #ffb190;
}

.text-button--muted {
  color: var(--text-muted);
}

.text-button--muted:hover {
  color: var(--text-soft);
}

.button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 18px;
  overflow: hidden;
  border: 1px solid transparent;
  border-radius: 12px;
  font-weight: 650;
  cursor: pointer;
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease, opacity 180ms ease;
}

.button:not(:disabled):hover {
  transform: translateY(-1px);
}

.button:not(:disabled):active {
  transform: translateY(0);
}

.button:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.button--wide {
  width: 100%;
}

.button--primary {
  color: #fff8f4;
  border-color: rgba(255, 255, 255, 0.08);
  background: linear-gradient(135deg, #ff7147, #ef4f22);
  box-shadow: 0 12px 26px rgba(255, 83, 37, 0.17);
}

.button--primary::after,
.button--generate::after {
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, transparent 25%, rgba(255, 255, 255, 0.16) 45%, transparent 63%);
  content: "";
  transform: translateX(-110%);
  transition: transform 650ms ease;
}

.button--primary:not(:disabled):hover::after,
.button--generate:not(:disabled):hover::after {
  transform: translateX(110%);
}

.button__content {
  position: relative;
  z-index: 1;
  display: flex;
  gap: 9px;
  align-items: center;
  justify-content: center;
  font-size: 11px;
}

.button__content > svg {
  width: 17px;
  height: 17px;
}

.button__loader {
  display: none;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.28);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}

.button.is-loading .button__content {
  display: none;
}

.button.is-loading .button__loader {
  display: block;
}

.inline-notice {
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text-soft);
  background: rgba(255, 255, 255, 0.025);
  font-size: 10px;
  line-height: 1.55;
}

.inline-notice[data-type="success"] {
  color: #c8f6da;
  border-color: rgba(111, 229, 165, 0.2);
  background: rgba(111, 229, 165, 0.055);
}

.inline-notice[data-type="error"] {
  color: #ffc6ca;
  border-color: rgba(255, 109, 119, 0.22);
  background: rgba(255, 109, 119, 0.06);
}

.inline-notice[data-type="info"] {
  color: #c9defe;
  border-color: rgba(130, 184, 255, 0.21);
  background: rgba(130, 184, 255, 0.06);
}

.panel__heading--models {
  align-items: center;
}

.count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 24px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text-soft);
  background: rgba(255, 255, 255, 0.025);
  font-family: var(--font-mono);
  font-size: 9px;
}

.search-box {
  display: flex;
  align-items: center;
  height: 39px;
  margin-top: 17px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.19);
  transition: border-color 160ms ease;
}

.search-box:focus-within {
  border-color: rgba(255, 106, 61, 0.42);
}

.search-box svg {
  flex: 0 0 15px;
  width: 15px;
  height: 15px;
  color: var(--text-muted);
}

.search-box input {
  width: 100%;
  height: 100%;
  padding: 0 9px;
  border: 0;
  outline: 0;
  color: var(--text);
  background: transparent;
  font-size: 10px;
}

.search-box kbd {
  padding: 2px 5px;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.025);
  font-family: var(--font-mono);
  font-size: 8px;
}

.filter-row {
  display: flex;
  gap: 6px;
  margin-top: 10px;
}

.filter-chip {
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: 999px;
  color: var(--text-muted);
  background: transparent;
  font-size: 9px;
  cursor: pointer;
  transition: color 150ms ease, background 150ms ease, border-color 150ms ease;
}

.filter-chip:hover {
  color: var(--text-soft);
  background: rgba(255, 255, 255, 0.03);
}

.filter-chip.is-active {
  color: #ffd1bf;
  border-color: rgba(255, 106, 61, 0.19);
  background: rgba(255, 106, 61, 0.09);
}

.model-list {
  position: relative;
  min-height: 142px;
  max-height: 286px;
  margin-top: 10px;
  overflow-y: auto;
  scrollbar-color: rgba(255, 255, 255, 0.14) transparent;
  scrollbar-width: thin;
}

.model-list::-webkit-scrollbar {
  width: 5px;
}

.model-list::-webkit-scrollbar-thumb {
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.13);
}

.empty-models {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 142px;
  padding: 24px 10px;
  text-align: center;
}

.empty-models__icon {
  display: grid;
  width: 40px;
  height: 40px;
  margin-bottom: 9px;
  place-items: center;
  border: 1px dashed var(--line-strong);
  border-radius: 12px;
  color: var(--text-muted);
  transform: rotate(3deg);
}

.empty-models__icon svg {
  width: 20px;
  height: 20px;
}

.empty-models p {
  margin: 0;
  color: var(--text-soft);
  font-size: 11px;
}

.empty-models small {
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 9px;
}

.model-item {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) auto 15px;
  gap: 9px;
  align-items: center;
  width: 100%;
  min-height: 51px;
  padding: 7px 8px;
  border: 1px solid transparent;
  border-radius: 10px;
  color: var(--text-soft);
  background: transparent;
  text-align: left;
  cursor: pointer;
  transition: background 140ms ease, border-color 140ms ease, color 140ms ease;
}

.model-item + .model-item {
  margin-top: 2px;
}

.model-item:hover {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.025);
}

.model-item.is-selected {
  color: var(--text);
  border-color: rgba(255, 106, 61, 0.2);
  background: linear-gradient(90deg, rgba(255, 106, 61, 0.11), rgba(255, 106, 61, 0.025));
}

.model-item__icon {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--text-muted);
  background: rgba(0, 0, 0, 0.18);
}

.model-item__icon svg {
  width: 15px;
  height: 15px;
}

.model-item.is-selected .model-item__icon {
  color: var(--accent-hot);
  border-color: rgba(255, 106, 61, 0.22);
  background: rgba(255, 106, 61, 0.08);
}

.model-item__body {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 3px;
}

.model-item__body strong {
  overflow: hidden;
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 560;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.model-item__body small {
  overflow: hidden;
  color: var(--text-muted);
  font-size: 8px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.model-item__type {
  padding: 3px 5px;
  border-radius: 4px;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.035);
  font-family: var(--font-mono);
  font-size: 6.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.model-item.is-selected .model-item__type {
  color: #ffc0aa;
  background: rgba(255, 106, 61, 0.11);
}

.model-item__check {
  width: 13px;
  height: 13px;
  color: transparent;
}

.model-item.is-selected .model-item__check {
  color: var(--accent-hot);
}

.refresh-button {
  display: flex;
  gap: 7px;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 37px;
  margin-top: 9px;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.018);
  font-size: 9px;
  cursor: pointer;
  transition: color 150ms ease, background 150ms ease;
}

.refresh-button:not(:disabled):hover {
  color: var(--text-soft);
  background: rgba(255, 255, 255, 0.035);
}

.refresh-button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.refresh-button svg {
  width: 14px;
  height: 14px;
}

.privacy-note {
  display: flex;
  gap: 10px;
  padding: 2px 5px;
  color: var(--text-muted);
}

.privacy-note svg {
  flex: 0 0 15px;
  width: 15px;
  height: 15px;
  margin-top: 2px;
  color: #77766f;
}

.privacy-note p {
  margin: 0;
  font-size: 9px;
  line-height: 1.65;
}

.workspace__intro {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 22px;
  min-height: 91px;
  padding: 1px 2px 20px;
}

.workspace__intro h1 {
  margin: 7px 0 5px;
  font-size: clamp(29px, 3.3vw, 47px);
  font-weight: 560;
  letter-spacing: -0.045em;
  line-height: 1.06;
}

.workspace__intro h1 em {
  color: var(--accent-hot);
  font-family: "Iowan Old Style", "Baskerville", "Songti SC", serif;
  font-weight: 400;
}

.workspace__intro > div > p:last-child {
  margin: 0;
  color: var(--text-muted);
  font-size: 11px;
}

.selected-model {
  display: flex;
  flex: 0 0 auto;
  gap: 10px;
  align-items: center;
  max-width: 290px;
  min-height: 50px;
  padding: 8px 12px 8px 9px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.022);
}

.selected-model[data-state="selected"] {
  border-color: rgba(255, 106, 61, 0.2);
  background: rgba(255, 106, 61, 0.045);
}

.selected-model__icon {
  display: grid;
  flex: 0 0 32px;
  width: 32px;
  height: 32px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--text-muted);
  background: rgba(0, 0, 0, 0.16);
}

.selected-model[data-state="selected"] .selected-model__icon {
  color: var(--accent-hot);
  border-color: rgba(255, 106, 61, 0.2);
}

.selected-model__icon svg {
  width: 16px;
  height: 16px;
}

.selected-model > span:last-child {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 3px;
}

.selected-model small {
  color: var(--text-muted);
  font-size: 8px;
}

.selected-model strong {
  max-width: 225px;
  overflow: hidden;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 550;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.studio-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.22fr) minmax(360px, 0.78fr);
  gap: 16px;
  align-items: start;
}

.preview-card {
  overflow: hidden;
}

.preview-frame {
  position: relative;
  display: grid;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  place-items: center;
  border-bottom: 1px solid var(--line);
  background:
    radial-gradient(circle at 50% 48%, rgba(255, 255, 255, 0.045), transparent 30%),
    linear-gradient(145deg, #18181c 0%, #0d0d10 54%, #151311 100%);
  isolation: isolate;
}

.preview-frame::before {
  position: absolute;
  inset: 0;
  z-index: -1;
  opacity: 0.38;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.024) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.024) 1px, transparent 1px);
  background-size: 46px 46px;
  content: "";
  mask-image: radial-gradient(circle at center, #000, transparent 82%);
}

.preview-frame::after {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.055) 1px, transparent 1px),
    linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px);
  background-size: 33.333% 50%;
  content: "";
  opacity: 0.13;
  mask-image: linear-gradient(to bottom, #000, transparent 22%, transparent 78%, #000);
}

.preview-frame__vignette {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  box-shadow: inset 0 0 90px rgba(0, 0, 0, 0.56);
}

#resultVideo {
  display: none;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #030304;
}

.preview-frame[data-state="success"] #resultVideo {
  display: block;
}

.preview-frame[data-state="success"] .preview-placeholder,
.preview-frame[data-state="success"] .stage-status {
  display: none;
}

.preview-placeholder {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 30px;
  text-align: center;
}

.focus-mark {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 180px;
  height: 130px;
  opacity: 0.34;
  transform: translate(-50%, -50%);
}

.focus-mark span {
  position: absolute;
  width: 16px;
  height: 16px;
  border-color: rgba(255, 255, 255, 0.35);
  border-style: solid;
}

.focus-mark span:nth-child(1) {
  top: 0;
  left: 0;
  border-width: 1px 0 0 1px;
}

.focus-mark span:nth-child(2) {
  top: 0;
  right: 0;
  border-width: 1px 1px 0 0;
}

.focus-mark span:nth-child(3) {
  bottom: 0;
  left: 0;
  border-width: 0 0 1px 1px;
}

.focus-mark span:nth-child(4) {
  right: 0;
  bottom: 0;
  border-width: 0 1px 1px 0;
}

.preview-placeholder__icon {
  display: grid;
  width: 60px;
  height: 60px;
  margin-bottom: 15px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 50%;
  color: rgba(255, 255, 255, 0.74);
  background: rgba(255, 255, 255, 0.035);
  box-shadow: 0 0 0 9px rgba(255, 255, 255, 0.018);
}

.preview-placeholder__icon svg {
  width: 24px;
  height: 24px;
  translate: 1px 0;
}

.preview-placeholder p {
  margin: 0;
  color: rgba(255, 255, 255, 0.78);
  font-size: 12px;
  font-weight: 550;
}

.preview-placeholder small {
  margin-top: 5px;
  color: rgba(255, 255, 255, 0.36);
  font-size: 9px;
}

.preview-topline {
  position: absolute;
  top: 15px;
  right: 16px;
  left: 16px;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: rgba(255, 255, 255, 0.48);
  font-family: var(--font-mono);
  font-size: 7.5px;
  letter-spacing: 0.12em;
  pointer-events: none;
}

.record-indicator {
  display: flex;
  gap: 7px;
  align-items: center;
}

.record-indicator i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px rgba(255, 106, 61, 0.8);
}

.preview-frame[data-state="generating"] .record-indicator i {
  animation: pulseDot 1.1s ease-in-out infinite;
}

.preview-bottomline {
  position: absolute;
  right: 16px;
  bottom: 15px;
  left: 16px;
  z-index: 4;
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  align-items: center;
  pointer-events: none;
}

.preview-bottomline span {
  padding: 4px 7px;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 5px;
  color: rgba(255, 255, 255, 0.7);
  background: rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(8px);
  font-family: var(--font-mono);
  font-size: 7px;
  letter-spacing: 0.06em;
}

.stage-status {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 5;
  display: flex;
  gap: 13px;
  align-items: center;
  min-width: 245px;
  padding: 14px 16px;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 14px;
  background: rgba(9, 9, 11, 0.74);
  box-shadow: 0 16px 50px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(18px);
  transform: translate(-50%, -50%);
}

.stage-status__spinner {
  flex: 0 0 27px;
  width: 27px;
  height: 27px;
  border: 2px solid rgba(255, 255, 255, 0.12);
  border-top-color: var(--accent-hot);
  border-radius: 50%;
  animation: spin 850ms linear infinite;
}

.stage-status > span:last-child {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.stage-status strong {
  font-size: 10px;
  font-weight: 600;
}

.stage-status small {
  color: var(--text-muted);
  font-size: 8px;
}

.preview-frame[data-state="generating"] .preview-placeholder {
  opacity: 0.18;
  filter: blur(3px);
}

.preview-frame[data-state="error"] .preview-placeholder__icon {
  color: var(--red);
  border-color: rgba(255, 109, 119, 0.2);
}

.preview-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 13px 15px;
  background: rgba(0, 0, 0, 0.09);
}

.task-summary {
  display: flex;
  min-width: 0;
  gap: 10px;
  align-items: center;
}

.task-summary__dot {
  flex: 0 0 7px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #5d5c58;
}

.task-summary__dot[data-state="running"] {
  background: var(--amber);
  box-shadow: 0 0 0 4px rgba(255, 196, 94, 0.07);
  animation: pulseDot 1.2s ease-in-out infinite;
}

.task-summary__dot[data-state="success"] {
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(111, 229, 165, 0.07);
}

.task-summary__dot[data-state="error"] {
  background: var(--red);
  box-shadow: 0 0 0 4px rgba(255, 109, 119, 0.07);
}

.task-summary > div {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 2px;
}

.task-summary strong {
  overflow: hidden;
  font-size: 9px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-summary small {
  overflow: hidden;
  color: var(--text-muted);
  font-size: 8px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.toolbar-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 5px;
}

.icon-button {
  display: grid;
  width: 31px;
  height: 31px;
  padding: 0;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.02);
  cursor: pointer;
  text-decoration: none;
  transition: color 150ms ease, background 150ms ease, border-color 150ms ease;
}

.icon-button svg {
  width: 14px;
  height: 14px;
}

.icon-button:not(:disabled):hover {
  color: var(--text-soft);
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.04);
}

.icon-button:disabled,
.icon-button[aria-disabled="true"] {
  opacity: 0.35;
  pointer-events: none;
}

.prompt-card {
  padding: 20px;
}

.card-heading {
  align-items: center;
}

.prompt-field {
  position: relative;
  display: block;
  margin-top: 17px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(0, 0, 0, 0.2);
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.prompt-field:focus-within {
  border-color: rgba(255, 106, 61, 0.38);
  box-shadow: 0 0 0 3px rgba(255, 106, 61, 0.06);
}

.prompt-field textarea {
  display: block;
  width: 100%;
  min-height: 132px;
  padding: 14px 14px 7px;
  resize: vertical;
  border: 0;
  outline: 0;
  color: #e8e5df;
  background: transparent;
  font-size: 11px;
  line-height: 1.72;
}

.prompt-field__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 12px 10px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 7.5px;
}

.prompt-field__footer b {
  color: var(--text-soft);
  font-weight: 500;
}

.template-row {
  display: flex;
  gap: 5px;
  margin-top: 8px;
  overflow-x: auto;
  scrollbar-width: none;
}

.template-row::-webkit-scrollbar {
  display: none;
}

.template-chip {
  flex: 0 0 auto;
  min-height: 27px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text-muted);
  background: transparent;
  font-size: 8px;
  cursor: pointer;
  transition: color 150ms ease, border-color 150ms ease, background 150ms ease;
}

.template-chip:hover {
  color: #ffccb9;
  border-color: rgba(255, 106, 61, 0.24);
  background: rgba(255, 106, 61, 0.055);
}

.reference-panel {
  margin-top: 13px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.014);
  transition: border-color 160ms ease, background 160ms ease;
}

.reference-panel[data-state="ready"] {
  border-color: rgba(255, 106, 61, 0.15);
  background: linear-gradient(145deg, rgba(255, 106, 61, 0.035), rgba(255, 255, 255, 0.012));
}

.reference-panel__heading,
.reference-role-row,
.reference-panel__title,
.reference-panel__actions {
  display: flex;
  align-items: center;
}

.reference-panel__heading,
.reference-role-row {
  justify-content: space-between;
  gap: 10px;
}

.reference-panel__title {
  min-width: 0;
  gap: 8px;
}

.reference-panel__icon {
  display: grid;
  flex: 0 0 28px;
  width: 28px;
  height: 28px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text-muted);
  background: rgba(0, 0, 0, 0.14);
}

.reference-panel[data-state="ready"] .reference-panel__icon {
  color: var(--accent-hot);
  border-color: rgba(255, 106, 61, 0.2);
  background: rgba(255, 106, 61, 0.07);
}

.reference-panel__icon svg {
  width: 14px;
  height: 14px;
}

.reference-panel__title > span:last-child {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 2px;
}

.reference-panel__title strong {
  color: var(--text-soft);
  font-size: 9px;
  font-weight: 600;
}

.reference-panel__title small {
  overflow: hidden;
  color: var(--text-muted);
  font-size: 7.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reference-panel__actions {
  flex: 0 0 auto;
  gap: 9px;
}

.reference-panel__actions .text-button:disabled {
  opacity: 0.38;
  cursor: not-allowed;
}

.reference-role-row {
  margin-top: 11px;
}

.role-toggle {
  display: inline-flex;
  gap: 2px;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.16);
}

.role-option {
  position: relative;
  cursor: pointer;
}

.role-option input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.role-option span {
  display: block;
  padding: 5px 9px;
  border-radius: 6px;
  color: var(--text-muted);
  font-size: 7.5px;
  line-height: 1;
  transition: color 150ms ease, background 150ms ease;
}

.role-option input:checked + span {
  color: #ffd3c2;
  background: rgba(255, 106, 61, 0.13);
}

.role-option input:disabled + span {
  opacity: 0.42;
  cursor: not-allowed;
}

.role-option:has(input:not(:disabled)):hover span {
  color: var(--text-soft);
}

.reference-count {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 7px;
}

.reference-input-group {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px;
  margin-top: 9px;
}

.reference-url-shell {
  height: 38px;
}

.reference-url-shell input {
  font-size: 9px;
}

.reference-add {
  min-width: 51px;
  padding: 0 10px;
  border: 1px solid rgba(255, 106, 61, 0.2);
  border-radius: 9px;
  color: #ffd1bf;
  background: rgba(255, 106, 61, 0.09);
  font-size: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: background 150ms ease, border-color 150ms ease, opacity 150ms ease;
}

.reference-add:not(:disabled):hover {
  border-color: rgba(255, 106, 61, 0.35);
  background: rgba(255, 106, 61, 0.15);
}

.reference-add:disabled {
  opacity: 0.38;
  cursor: not-allowed;
}

.reference-help {
  margin: 7px 0 0;
  color: var(--text-muted);
  font-size: 7.5px;
  line-height: 1.55;
}

.reference-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  margin-top: 9px;
}

.reference-list:empty {
  display: none;
}

.reference-item {
  position: relative;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #0d0d10;
}

.reference-item.is-loading::before {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(110deg, #111114 25%, rgba(255, 255, 255, 0.055) 43%, #111114 62%);
  background-size: 220% 100%;
  content: "";
  animation: referenceShimmer 1.25s ease-in-out infinite;
}

.reference-item__image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.8;
  transition: opacity 160ms ease, transform 350ms ease;
}

.reference-item:hover .reference-item__image {
  opacity: 1;
  transform: scale(1.025);
}

.reference-item__fallback {
  position: absolute;
  inset: 0;
  display: none;
  place-items: center;
  color: var(--text-muted);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.025), transparent),
    #111114;
}

.reference-item__fallback svg {
  width: 22px;
  height: 22px;
}

.reference-item.is-broken .reference-item__image {
  display: none;
}

.reference-item.is-broken .reference-item__fallback {
  display: grid;
}

.reference-item__scrim {
  position: absolute;
  inset: 38% 0 0;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.88));
  pointer-events: none;
}

.reference-item__footer {
  position: absolute;
  right: 7px;
  bottom: 6px;
  left: 7px;
  display: flex;
  gap: 5px;
  align-items: center;
  justify-content: space-between;
  pointer-events: none;
}

.reference-item__role,
.reference-item__index {
  font-family: var(--font-mono);
  font-size: 6.5px;
  letter-spacing: 0.05em;
}

.reference-item__role {
  color: #ffd1bf;
}

.reference-item__index {
  color: rgba(255, 255, 255, 0.52);
}

.reference-remove {
  position: absolute;
  top: 5px;
  right: 5px;
  display: grid;
  width: 22px;
  height: 22px;
  padding: 0;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 6px;
  color: rgba(255, 255, 255, 0.72);
  background: rgba(8, 8, 10, 0.67);
  backdrop-filter: blur(8px);
  cursor: pointer;
  opacity: 0;
  transition: opacity 150ms ease, color 150ms ease, background 150ms ease;
}

.reference-item:hover .reference-remove,
.reference-remove:focus-visible {
  opacity: 1;
}

.reference-remove:hover {
  color: #fff;
  background: rgba(255, 106, 61, 0.8);
}

.reference-remove svg {
  width: 11px;
  height: 11px;
}

.divider {
  height: 1px;
  margin: 17px 0 15px;
  background: var(--line);
}

.parameter-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.parameter-heading h3 {
  margin: 0;
  font-size: 11px;
  font-weight: 600;
}

.parameter-heading span {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 6.5px;
  letter-spacing: 0.12em;
}

.parameter-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 10px;
}

.parameter-grid__wide {
  grid-column: 1 / -1;
}

.select-shell {
  height: 40px;
}

.select-shell select {
  width: 100%;
  height: 100%;
  padding: 0 31px 0 11px;
  appearance: none;
  border: 0;
  outline: 0;
  color: #d5d1ca;
  background: transparent;
  font-size: 9px;
  cursor: pointer;
}

.select-shell > svg {
  position: absolute;
  top: 50%;
  right: 10px;
  width: 13px;
  height: 13px;
  color: var(--text-muted);
  pointer-events: none;
  transform: translateY(-50%);
}

.select-shell option {
  color: var(--text);
  background: #171719;
}

.range-shell {
  position: relative;
  display: flex;
  align-items: center;
  height: 23px;
}

.range-shell input {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 20px;
  margin: 0;
  appearance: none;
  outline: 0;
  background: transparent;
  cursor: pointer;
}

.range-shell input::-webkit-slider-runnable-track {
  height: 3px;
  border-radius: 10px;
  background: linear-gradient(90deg, var(--accent) var(--range-progress, 4%), rgba(255, 255, 255, 0.1) var(--range-progress, 4%));
}

.range-shell input::-moz-range-track {
  height: 3px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.1);
}

.range-shell input::-moz-range-progress {
  height: 3px;
  border-radius: 10px;
  background: var(--accent);
}

.range-shell input::-webkit-slider-thumb {
  width: 13px;
  height: 13px;
  margin-top: -5px;
  appearance: none;
  border: 3px solid #171719;
  border-radius: 50%;
  background: var(--accent-hot);
  box-shadow: 0 0 0 1px var(--accent-hot), 0 0 14px rgba(255, 106, 61, 0.32);
}

.range-shell input::-moz-range-thumb {
  width: 9px;
  height: 9px;
  border: 3px solid #171719;
  border-radius: 50%;
  background: var(--accent-hot);
}

#durationOutput {
  color: var(--accent-hot);
  font-family: var(--font-mono);
  font-size: 9px;
}

.range-scale {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 7px;
}

.request-preview {
  margin-top: 13px;
  border-top: 1px dashed var(--line);
}

.request-preview summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0 0;
  color: var(--text-muted);
  list-style: none;
  font-size: 8px;
  cursor: pointer;
}

.request-preview summary::-webkit-details-marker {
  display: none;
}

.request-preview summary code {
  color: #77736c;
  font-family: var(--font-mono);
  font-size: 6.5px;
}

.request-preview pre {
  max-height: 205px;
  margin: 9px 0 0;
  padding: 11px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: #aaa69e;
  background: #0d0d10;
  font-family: var(--font-mono);
  font-size: 8px;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
}

.button--generate {
  width: 100%;
  min-height: 62px;
  margin-top: 13px;
  border-color: rgba(255, 255, 255, 0.1);
  background:
    radial-gradient(circle at 90% 20%, rgba(255, 206, 120, 0.25), transparent 30%),
    linear-gradient(135deg, #ff7048 0%, #ef4b20 58%, #d53d16 100%);
  box-shadow: 0 16px 32px rgba(219, 63, 20, 0.18);
}

.button--generate .button__content {
  gap: 12px;
}

.button--generate .button__content > svg {
  width: 22px;
  height: 22px;
}

.button--generate .button__content > span {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
}

.button--generate strong {
  font-size: 12px;
}

.button--generate small {
  color: rgba(255, 255, 255, 0.65);
  font-size: 8px;
  font-weight: 450;
}

.activity-panel {
  margin-top: 16px;
  padding: 18px 20px;
}

.activity-panel__heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.activity-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.task-id-button {
  display: inline-flex;
  gap: 7px;
  align-items: center;
  height: 27px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.02);
  font-family: var(--font-mono);
  font-size: 7.5px;
  cursor: pointer;
}

.task-id-button:hover {
  color: var(--text-soft);
  border-color: var(--line-strong);
}

.task-id-button svg {
  width: 12px;
  height: 12px;
}

.activity-log {
  display: flex;
  max-height: 190px;
  margin: 15px 0 0;
  padding: 0;
  overflow-y: auto;
  flex-direction: column;
  list-style: none;
  scrollbar-width: thin;
}

.activity-item {
  position: relative;
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr) auto;
  gap: 9px;
  align-items: start;
  padding: 7px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.045);
}

.activity-item:first-child {
  border-top: 0;
}

.activity-item__mark {
  position: relative;
  width: 7px;
  height: 7px;
  margin-top: 4px;
  border: 1px solid var(--text-muted);
  border-radius: 50%;
}

.activity-item:not(:last-child) .activity-item__mark::after {
  position: absolute;
  top: 8px;
  left: 2px;
  width: 1px;
  height: 27px;
  background: var(--line);
  content: "";
}

.activity-item[data-type="success"] .activity-item__mark {
  border-color: var(--green);
  background: var(--green);
}

.activity-item[data-type="error"] .activity-item__mark {
  border-color: var(--red);
  background: var(--red);
}

.activity-item[data-type="active"] .activity-item__mark {
  border-color: var(--amber);
  background: var(--amber);
  box-shadow: 0 0 0 4px rgba(255, 196, 94, 0.06);
}

.activity-item > div {
  min-width: 0;
}

.activity-item strong {
  display: block;
  color: #bbb8b1;
  font-size: 8.5px;
  font-weight: 550;
}

.activity-item p {
  margin: 3px 0 0;
  overflow-wrap: anywhere;
  color: var(--text-muted);
  font-size: 8px;
  line-height: 1.5;
}

.activity-item time {
  color: #5f5e5a;
  font-family: var(--font-mono);
  font-size: 7px;
}

.footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 70px;
  color: #55544f;
  font-family: var(--font-mono);
  font-size: 7px;
  letter-spacing: 0.08em;
}

.toast-stack {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 100;
  display: flex;
  gap: 8px;
  width: min(340px, calc(100vw - 32px));
  flex-direction: column;
  pointer-events: none;
}

.toast {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px 13px;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  color: var(--text-soft);
  background: rgba(17, 17, 20, 0.94);
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px);
  font-size: 9px;
  line-height: 1.55;
  pointer-events: auto;
  animation: toastIn 220ms ease both;
}

.toast::before {
  flex: 0 0 5px;
  width: 5px;
  height: 5px;
  margin-top: 5px;
  border-radius: 50%;
  background: var(--text-muted);
  content: "";
}

.toast[data-type="success"]::before {
  background: var(--green);
}

.toast[data-type="error"]::before {
  background: var(--red);
}

.toast[data-type="info"]::before {
  background: var(--blue);
}

.toast.is-leaving {
  animation: toastOut 180ms ease both;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes pulseDot {
  0%, 100% { opacity: 0.45; transform: scale(0.88); }
  50% { opacity: 1; transform: scale(1.08); }
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes toastOut {
  to { opacity: 0; transform: translateY(7px) scale(0.98); }
}

@keyframes referenceShimmer {
  from { background-position: 100% 0; }
  to { background-position: -100% 0; }
}

@media (max-width: 1180px) {
  .layout {
    grid-template-columns: 286px minmax(0, 1fr);
    gap: 18px;
  }

  .studio-grid {
    grid-template-columns: 1fr;
  }

  .preview-frame {
    aspect-ratio: 16 / 8.7;
  }

  .parameter-grid {
    grid-template-columns: 1fr 1fr 1fr;
  }

  .parameter-grid__wide {
    grid-column: auto;
  }
}

@media (max-width: 900px) {
  .app {
    padding: 0 20px;
  }

  .layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: start;
  }

  .privacy-note {
    grid-column: 1 / -1;
  }

  .model-list {
    max-height: 235px;
  }

  .workspace__intro {
    padding-top: 8px;
  }
}

@media (max-width: 650px) {
  .app {
    padding: 0 14px;
  }

  .topbar {
    height: 78px;
  }

  .local-chip {
    display: none;
  }

  .connection-chip {
    padding: 0 10px;
    font-size: 8px;
  }

  .brand__mark {
    width: 38px;
    height: 38px;
  }

  .brand__type strong {
    font-size: 16px;
  }

  .layout {
    padding-top: 18px;
  }

  .sidebar {
    display: flex;
  }

  .workspace__intro {
    align-items: flex-start;
    flex-direction: column;
    gap: 14px;
  }

  .workspace__intro h1 {
    font-size: 34px;
  }

  .selected-model {
    width: 100%;
    max-width: none;
  }

  .selected-model strong {
    max-width: calc(100vw - 130px);
  }

  .preview-frame {
    aspect-ratio: 4 / 3;
  }

  .preview-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .toolbar-actions {
    align-self: flex-end;
    margin-top: -38px;
  }

  .prompt-card,
  .connection-panel,
  .models-panel {
    padding: 16px;
  }

  .parameter-grid {
    grid-template-columns: 1fr 1fr;
  }

  .request-preview summary code {
    display: none;
  }

  .activity-panel {
    padding: 16px;
  }

  .activity-panel__heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .activity-actions {
    width: 100%;
    justify-content: space-between;
  }

  .footer {
    align-items: flex-start;
    flex-direction: column;
    justify-content: center;
    gap: 6px;
    min-height: 80px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
