:root {
  color-scheme: light;
  --paper: #f4f3ee;
  --panel: #fffefa;
  --input: #fff;
  --stage: #f7f8f2;
  --ink: #202b29;
  --muted: #65716c;
  --line: #dce1d8;
  --strong-line: #bacbbd;
  --accent: #15644d;
  --accent-hover: #104c3b;
  --on-accent: #fff;
  --soft: #e8f0e6;
  --danger: #a52d2a;
  --error-bg: #fff0ed;
  --shadow: 0 24px 80px #221a171e;
  font:
    14px/1.55 "Segoe UI",
    -apple-system,
    BlinkMacSystemFont,
    Arial,
    sans-serif;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #141414;
  --panel: #1b1b1b;
  --input: #151515;
  --stage: #171717;
  --ink: #f2f0eb;
  --muted: #aaa9a2;
  --line: #333332;
  --strong-line: #555550;
  --accent: #80b49a;
  --accent-hover: #a0ccb3;
  --on-accent: #102018;
  --soft: #20332a;
  --danger: #ffa8a4;
  --error-bg: #392222;
  --shadow: 0 24px 80px #0005;
}

* {
  box-sizing: border-box;
}
[hidden] {
  display: none !important;
}
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
}
button,
input,
select,
textarea {
  font: inherit;
}
button,
select,
summary {
  cursor: pointer;
}
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 8px 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  font-weight: 600;
}
button:hover {
  background: var(--soft);
  border-color: var(--strong-line);
}
button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
input,
select,
textarea {
  width: 100%;
  min-width: 0;
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: var(--input);
}
input::placeholder,
textarea::placeholder {
  color: var(--muted);
  opacity: 0.85;
}
textarea {
  resize: vertical;
}
label {
  display: block;
  margin-bottom: 7px;
  font-size: 12px;
  font-weight: 600;
}
input[type="checkbox"] {
  width: 18px;
  height: 18px;
  flex: none;
  accent-color: var(--accent);
}
input[type="range"] {
  padding: 0;
  accent-color: var(--accent);
}
a {
  color: inherit;
  text-decoration: none;
}
a:hover {
  color: var(--accent);
}
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}
h1,
h2,
h3,
p {
  margin: 0;
}
h1 {
  font-size: clamp(30px, 3vw, 42px);
  line-height: 1.14;
  font-weight: 650;
  letter-spacing: -1.5px;
  text-wrap: balance;
}
h2 {
  font-size: 18px;
  font-weight: 600;
  line-height: 1.4;
}
h3 {
  font-size: 15px;
  font-weight: 600;
}
svg {
  width: 21px;
  height: 21px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
svg[viewBox="0 0 180 144"] {
  stroke: none;
}
.icon-library {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 100;
  padding: 12px;
  background: var(--accent);
  color: var(--on-accent);
  transform: translateY(-200%);
}
.skip-link:focus {
  transform: none;
}
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.icon-button {
  min-width: 38px;
  min-height: 38px;
  padding: 8px;
}
.eyebrow,
.field-caption {
  font-size: 10px;
  letter-spacing: 1.65px;
  font-weight: 600;
  color: var(--muted);
}
.eyebrow {
  margin-bottom: 12px;
}
.lead {
  margin-top: 12px;
  font-size: 14px;
  color: var(--muted);
  max-width: 680px;
}
.text-link {
  font-size: 12px;
  color: var(--muted);
}
.subtle {
  font-size: 11px;
  color: var(--muted);
  font-weight: 400;
}
.row {
  display: flex;
  align-items: center;
  gap: 9px;
}
.row > input {
  flex: 1;
}
summary {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 49px;
  list-style: none;
  padding: 14px 18px;
  font-size: 13px;
  font-weight: 600;
}
summary::-webkit-details-marker {
  display: none;
}
summary::after {
  content: "+";
  font-size: 17px;
  font-weight: 400;
  margin-left: auto;
  color: var(--muted);
}
details[open] > summary::after {
  content: "−";
}
.summary-title {
  display: flex;
  align-items: center;
  gap: 9px;
}
.connection-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--muted);
}
.connection:has(#key:not(:placeholder-shown)) .connection-dot {
  background: var(--accent);
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0;
  margin: 0;
  width: fit-content;
  flex: none;
}
.brand-lockup img {
  display: block;
}
.brand-lockup > span {
  display: grid;
}
.brand-lockup strong {
  font-size: 26px;
  line-height: 1;
  font-weight: 650;
  letter-spacing: -1.7px;
}
.brand-dot {
  color: var(--accent);
}
.brand-lockup small {
  color: var(--muted);
  font-size: 8px;
  letter-spacing: 2.9px;
  margin-top: 6px;
}
.site-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 0;
  margin-inline: auto;
}
.nav-label-short {
  display: none;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 13px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 13px;
  min-height: 42px;
  white-space: nowrap;
}
.nav-item:hover {
  background: var(--paper);
  color: var(--ink);
}
.nav-item.active {
  background: var(--soft);
  color: var(--accent);
}
.nav-item svg {
  width: 18px;
  height: 18px;
}
.nav-item svg[aria-hidden="true"] {
  pointer-events: none;
}
.site-content {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}
.site-header {
  min-height: 72px;
  padding: 0 32px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  border-bottom: 1px solid var(--line);
}
.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.header-actions .icon-button {
  background: transparent;
  border-color: transparent;
}
.header-actions .icon-button:hover {
  border-color: var(--line);
}
#theme-toggle {
  display: grid;
  place-items: center;
  position: relative;
  width: 40px;
  height: 40px;
}
.theme-icon {
  grid-area: 1 / 1;
  width: 20px;
  height: 20px;
  stroke-width: 1.75;
  transition:
    opacity 0.2s ease,
    transform 0.32s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.theme-icon-sun {
  opacity: 1;
  transform: rotate(0deg) scale(1);
}
.theme-icon-moon {
  opacity: 0;
  transform: rotate(-70deg) scale(0.45);
}
:root[data-theme="dark"] .theme-icon-sun {
  opacity: 0;
  transform: rotate(70deg) scale(0.45);
}
:root[data-theme="dark"] .theme-icon-moon {
  opacity: 1;
  transform: rotate(0deg) scale(1);
}
@keyframes themeReveal {
  from {
    clip-path: circle(0 at var(--theme-transition-x) var(--theme-transition-y));
  }
  to {
    clip-path: circle(
      var(--theme-transition-radius) at var(--theme-transition-x)
        var(--theme-transition-y)
    );
  }
}
html.theme-transitioning::view-transition-old(root) {
  z-index: 1;
  animation: none;
}
html.theme-transitioning::view-transition-new(root) {
  z-index: 2;
  animation: themeReveal 0.56s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.theme-transition-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  pointer-events: none;
  background: var(--theme-transition-surface);
  clip-path: circle(0 at var(--theme-transition-x) var(--theme-transition-y));
}
.theme-transition-overlay.covering {
  animation: themeCover 0.42s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
.theme-transition-overlay.revealing {
  animation: themeOverlayFade 0.2s ease-out forwards;
}
@keyframes themeCover {
  to {
    clip-path: circle(
      var(--theme-transition-radius) at var(--theme-transition-x)
        var(--theme-transition-y)
    );
  }
}
@keyframes themeOverlayFade {
  to {
    opacity: 0;
  }
}
html.theme-transitioning
  :is(
    body,
    button,
    input,
    select,
    textarea,
    .panel,
    .site-header,
    .site-footer,
    .nav-item,
    summary
  ) {
  transition: none !important;
}
#app-main {
  flex: 1;
  display: flex;
  flex-direction: column;
}
.view {
  width: 100%;
  max-width: 1580px;
  margin: 0 auto;
  padding: 35px 32px 0;
}
.page-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  margin-bottom: 28px;
}
.page-heading > .text-link {
  white-space: nowrap;
}
.page-heading > button {
  flex: none;
}
.site-footer {
  margin: 32px 32px 0;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  padding: 20px 0;
  color: var(--muted);
  font-size: 10px;
}
.site-footer small {
  font-size: inherit;
}
.site-footer nav {
  display: flex;
  align-items: center;
  gap: 18px;
}
.site-footer button {
  border: 0;
  padding: 0;
  min-height: 30px;
  font-size: 10px;
  background: transparent;
  color: var(--muted);
  font-weight: 400;
}
.site-footer button:hover {
  color: var(--accent);
}
body,
button,
input,
select,
textarea,
.panel,
.site-header,
.site-footer,
.nav-item,
summary {
  transition:
    background-color 0.24s ease,
    border-color 0.24s ease,
    box-shadow 0.24s ease,
    color 0.24s ease;
}
@media (min-width: 1700px) {
  .view {
    padding-top: 44px;
  }
}
@media (max-width: 1150px) {
  .site-header {
    padding-inline: 24px;
  }
  .view {
    padding: 27px 24px 0;
  }
  .site-footer {
    margin-inline: 24px;
  }
}
@media (max-width: 1100px) {
  .site-header {
    min-height: 0;
    padding: 12px 18px 0;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px 14px;
  }
  .site-nav {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-content: stretch;
    gap: 8px;
    margin: 0 -18px;
    padding: 8px 18px;
    border-top: 1px solid var(--line);
  }
  .nav-item {
    flex: 1;
    justify-content: center;
    min-width: 0;
    min-height: 44px;
    padding: 8px 12px;
  }
}
@media (max-width: 540px) {
  .site-header {
    padding-inline: 16px;
  }
  .brand-lockup img {
    width: 28px;
    height: 28px;
  }
  .brand-lockup strong {
    font-size: 22px;
  }
  .brand-lockup small {
    font-size: 7px;
  }
  .site-nav {
    gap: 6px;
    margin-inline: -16px;
    padding: 8px 12px;
  }
  .site-nav .nav-label-long {
    display: none;
  }
  .site-nav .nav-label-short {
    display: inline;
  }
  .nav-item {
    flex-direction: column;
    gap: 3px;
    padding: 5px 2px;
    font-size: 10px;
    line-height: 1.2;
  }
  .nav-item svg {
    width: 17px;
    height: 17px;
  }
  .view {
    padding: 24px 16px 0;
  }
  .page-heading {
    display: block;
    margin-bottom: 22px;
  }
  .page-heading > button,
  .page-heading > .text-link {
    margin-top: 16px;
    display: inline-flex;
  }
  .page-heading h1 {
    font-size: 31px;
  }
  .lead {
    font-size: 13px;
  }
  .site-footer {
    margin-inline: 16px;
    align-items: start;
    flex-direction: column;
    gap: 8px;
  }
  .site-footer small {
    display: none;
  }
}
.account-button {
  font-size: 11px;
  max-width: 210px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#view-studio {
  position: relative;
}
.account-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  justify-items: center;
  align-content: center;
  align-items: center;
  gap: 16px;
  width: min(100%, 480px);
  padding: 30px;
  margin: auto;
  text-align: center;
}
.account-copy {
  min-width: 0;
}
.account-copy h2 {
  font-size: 21px;
  font-weight: 550;
  margin: 0 0 5px;
  letter-spacing: -0.5px;
  overflow-wrap: anywhere;
}
.account-copy p {
  font-size: 12px;
  color: var(--muted);
}
.account-methods,
.api-key-form {
  display: grid;
  width: min(100%, 340px);
  gap: 10px;
}
.api-key-form {
  text-align: left;
}
.api-key-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.api-key-actions .primary {
  flex: 1;
}
.api-key-form .hint {
  font-size: 10px;
  line-height: 1.5;
}
.account-actions {
  width: min(100%, 340px);
}
.account-actions button {
  width: 100%;
}
.account-copy code {
  display: inline-block;
  font-size: 11px;
  margin-top: 8px;
  color: var(--muted);
}
.account-feedback {
  grid-column: 1 / -1;
  display: grid;
  justify-items: center;
  align-items: center;
  gap: 4px;
  width: 100%;
}
.account-feedback:has([hidden]) {
  row-gap: 0;
}
.account-feedback #account-status {
  max-width: 340px;
  margin: 0;
  overflow-wrap: anywhere;
}
.account-feedback #account-status[data-error="true"] {
  color: var(--danger);
}
.account-feedback .text-button {
  font-size: 11px;
}
#view-studio[data-access="required"] {
  flex: 1;
  min-height: 0;
  display: grid;
  align-content: center;
  justify-items: center;
  padding-block: 24px;
}
#view-studio[data-access="required"] > .account-panel {
  width: min(100%, 480px);
  margin: 0;
}
#view-studio[data-access="required"] .account-copy h2 {
  margin-bottom: 10px;
  font-size: 25px;
}
#view-studio[data-access="required"] .account-copy p {
  font-size: 14px;
}
#view-studio[data-access="required"] .account-feedback {
  justify-content: center;
}
#view-studio[data-access="ready"] > .account-panel {
  position: absolute;
  z-index: 20;
  top: 6px;
  right: 32px;
  width: min(280px, calc(100vw - 32px));
  padding: 18px;
  gap: 12px;
  box-shadow: var(--shadow);
  text-align: left;
  justify-items: stretch;
}
#view-studio[data-access="ready"] .account-copy h2 {
  font-size: 14px;
  letter-spacing: 0;
}
#view-studio[data-access="ready"] .account-copy p,
#view-studio[data-access="ready"] .account-methods,
#view-studio[data-access="ready"] .api-key-form {
  display: none !important;
}
#view-studio[data-access="ready"] .account-actions {
  width: 100%;
}
#view-studio[data-access="ready"] .account-feedback {
  justify-items: start;
}
.inline-model {
  display: flex;
  gap: 6px;
}
.inline-model select {
  min-width: 0;
  flex: 1;
}
.inline-model button {
  padding-inline: 12px;
}
#inline-catalog-status {
  font-size: 10px;
  line-height: 1.4;
}
@media (max-width: 640px) {
  #view-studio[data-access="required"] {
    padding-block: 20px;
  }
  #view-studio[data-access="required"] > .account-panel {
    padding: 24px 20px;
  }
  .account-panel {
    grid-template-columns: 1fr;
    padding: 24px 18px;
    gap: 14px;
  }
  .account-copy h2 {
    font-size: 20px;
  }
  #view-studio[data-access="ready"] > .account-panel {
    right: 16px;
    padding: 16px;
  }
  .account-button {
    max-width: 158px;
    font-size: 10px;
    padding-inline: 9px;
  }
  .header-actions {
    gap: 2px;
  }
}

.connection-fields {
  display: grid;
  grid-template-columns: 130px minmax(160px, 1fr) minmax(190px, 1.15fr) auto;
  align-items: end;
  gap: 14px;
  padding: 0 18px;
}
.connection-fields > button {
  min-height: 42px;
}
.key-field {
  position: relative;
}
.key-field input {
  padding-right: 76px;
}
.key-field button {
  position: absolute;
  right: 4px;
  top: 4px;
  min-height: 34px;
  font-size: 10px;
  padding: 5px 9px;
  background: transparent;
  border: 0;
}
.connection-foot {
  display: flex;
  justify-content: space-between;
  gap: 15px;
  align-items: center;
  padding: 8px 18px 10px;
}
.hint {
  font-size: 11px;
  line-height: 1.65;
  color: var(--muted);
  overflow-wrap: anywhere;
}
.text-button {
  font-size: 11px;
  padding: 3px 0;
  min-height: 27px;
  border: 0;
  background: transparent;
  color: var(--muted);
  white-space: nowrap;
}
.text-button:hover {
  color: var(--accent);
  background: transparent;
}
.primary-settings {
  display: grid;
  grid-template-columns:
    minmax(130px, 1.5fr) minmax(160px, 1.3fr) minmax(130px, 1fr)
    minmax(80px, 0.65fr) 75px;
  gap: 12px;
  margin-top: 14px;
  padding: 17px 18px 13px;
}
.custom-size {
  grid-column: 1/-1;
  display: grid;
  grid-template-columns: 140px 36px 140px 1fr;
  align-items: end;
  gap: 12px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}
.custom-size .hint {
  align-self: center;
}
.custom-size button {
  margin-bottom: 2px;
}
.workspace-grid {
  display: grid;
  grid-template-columns: minmax(335px, 0.85fr) minmax(0, 1.5fr);
  gap: 20px;
  margin-top: 22px;
  align-items: start;
}
.editor-column {
  display: grid;
  gap: 12px;
  min-width: 0;
}
.composer {
  padding: 20px;
}
.modebar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}
.tabs {
  display: flex;
  gap: 3px;
  padding: 4px;
  background: var(--paper);
  border-radius: 10px;
}
.tabs button {
  min-height: 33px;
  padding: 6px 14px;
  font-size: 12px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font-weight: 500;
}
.tabs button[aria-pressed="true"] {
  background: var(--panel);
  border-color: var(--line);
  color: var(--accent);
  box-shadow: 0 1px 3px #00000006;
}
.shortcut {
  color: var(--muted);
  font-size: 10px;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 1px 5px;
}
.prompt-label {
  font-size: 14px;
  margin-bottom: 11px;
}
#prompt {
  min-height: 156px;
  font-size: 14px;
  line-height: 1.8;
  padding: 13px;
  margin-bottom: 20px;
  background: var(--input);
}
#dropzone {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 17px 13px;
  border: 1px dashed var(--strong-line);
  border-radius: 10px;
  background: var(--stage);
  cursor: pointer;
}
#dropzone strong {
  display: block;
  font-size: 12px;
  font-weight: 600;
}
#dropzone small {
  display: block;
  font-size: 10px;
  color: var(--muted);
  margin-top: 3px;
}
#dropzone > svg {
  color: var(--accent);
  width: 25px;
  height: 25px;
}
.upload-plus {
  margin-left: auto;
  color: var(--accent);
  font-size: 23px;
}
#dropzone:hover,
#dropzone.drag,
#prompt.drag {
  background: var(--soft);
  border-color: var(--accent);
}
.file-note {
  font-size: 9px;
  color: var(--muted);
  text-align: center;
  margin-top: 9px;
}
.mask-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 12px;
}
.mask-row + .hint {
  margin-top: 7px;
}
.small {
  min-height: 32px;
  font-size: 11px;
  padding: 5px 10px;
}
.composer-footer {
  display: flex;
  gap: 10px;
  align-items: center;
  border-top: 1px solid var(--line);
  margin-top: 23px;
  padding-top: 18px;
}
.primary {
  background: var(--accent);
  color: var(--on-accent);
  border-color: var(--accent);
}
.primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}
#run {
  flex: 1;
  min-height: 43px;
  font-size: 13px;
}
.request-note {
  font-size: 9px;
  text-align: center;
  color: var(--muted);
  margin-top: 10px;
}
.advanced-content {
  padding: 0 18px 18px;
}
.field {
  margin-top: 15px;
}
.grid2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.check {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 18px;
  font-size: 12px;
  font-weight: 500;
}
.developer-options {
  margin-top: 18px;
  border-top: 1px solid var(--line);
}
.developer-options summary {
  padding-inline: 0;
  font-size: 12px;
}
.technical {
  display: grid;
  gap: 15px;
}
.technical h3 {
  font-size: 11px;
  margin-bottom: 6px;
}
pre {
  font:
    10px/1.7 ui-monospace,
    Consolas,
    monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  margin: 0;
  color: var(--muted);
}
.stage {
  padding: 20px;
  min-height: 590px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.stage-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 13px;
}
.stage-head h2 {
  display: flex;
  align-items: center;
  gap: 11px;
}
.stage-head .subtle {
  background: var(--paper);
  border-radius: 6px;
  padding: 3px 7px;
  font-size: 10px;
}
#status {
  font-size: 11px;
  line-height: 1.7;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  overflow-wrap: anywhere;
}
#status[data-kind="error"] {
  color: var(--danger);
  background: var(--error-bg);
  border-color: transparent;
}
#status[data-kind="busy"] {
  background: var(--soft);
  color: var(--accent);
}
#status[data-kind="busy"]:before {
  content: "";
  display: inline-block;
  width: 11px;
  height: 11px;
  border: 2px solid var(--strong-line);
  border-top-color: var(--accent);
  border-radius: 50%;
  margin-right: 8px;
  animation: spin 1s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
#empty {
  flex: 1;
  min-height: 435px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  text-align: center;
  gap: 12px;
  margin: 15px 0 0;
  border: 1px dashed var(--line);
  border-radius: 10px;
  background-color: var(--stage);
  background-image: radial-gradient(var(--line) 0.7px, transparent 0.7px);
  background-size: 16px 16px;
  padding: 25px;
}
.empty-illustration svg {
  width: 166px;
  height: 132px;
}
#empty h3 {
  font-size: 18px;
  letter-spacing: -0.35px;
}
#empty p {
  font-size: 12px;
  max-width: 290px;
  color: var(--muted);
  line-height: 1.7;
}
#empty button {
  margin-top: 5px;
}
.stage-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 14px;
  font-size: 9px;
  color: var(--muted);
}
.stage-foot button {
  font-size: 9px;
}
#sources {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(87px, 1fr));
  gap: 9px;
  margin-top: 12px;
}
#sources:empty {
  display: none;
}
.source {
  position: relative;
  min-width: 0;
}
.source img {
  display: block;
  width: 100%;
  height: 78px;
  object-fit: cover;
  border-radius: 7px;
  border: 1px solid var(--line);
}
.source p {
  font-size: 9px;
  color: var(--muted);
  margin-top: 4px;
  overflow-wrap: anywhere;
}
.source button {
  position: absolute;
  right: 4px;
  top: 4px;
  min-height: 23px;
  width: 23px;
  padding: 0;
  border-radius: 50%;
  background: var(--panel);
}
.source .make-primary {
  position: static;
  width: 100%;
  min-height: 22px;
  border-radius: 4px;
  font-size: 9px;
  margin-top: 4px;
}
.checker {
  background-color: #ebebeb;
  background-image: conic-gradient(
    #d4d4d4 25%,
    transparent 0 50%,
    #d4d4d4 0 75%,
    transparent 0
  );
  background-size: 20px 20px;
}
#gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(250px, 100%), 1fr));
  gap: 14px;
  margin-top: 15px;
}
#gallery:empty {
  display: none;
}
.result {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}
.result-view {
  display: block;
  width: 100%;
  height: 330px;
  border: 0;
  padding: 0;
  border-radius: 0;
}
.result-view img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.result-info {
  padding: 12px;
}
.result-meta {
  font-size: 10px;
  color: var(--muted);
  margin-bottom: 9px;
  overflow-wrap: anywhere;
}
.result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}
.result-actions button {
  font-size: 10px;
}
.result-actions select {
  font-size: 10px;
  max-width: 100%;
}
#partial {
  border: 1px dashed var(--accent);
  border-radius: 8px;
  padding: 12px;
  margin-top: 15px;
}
#partial img {
  display: block;
  max-width: 100%;
  max-height: 300px;
  margin: 8px auto;
}
dialog {
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--panel);
  color: var(--ink);
  width: min(930px, calc(100vw - 24px));
  max-height: calc(100dvh - 30px);
  padding: 24px;
  box-shadow: var(--shadow);
}
dialog::backdrop {
  background: #080808b8;
  backdrop-filter: blur(4px);
}
.dialog-head {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 15px;
  margin-bottom: 18px;
}
.dialog-head h2 {
  font-size: 19px;
}
.dialog-head .hint {
  margin-top: 5px;
}
.dialog-head button {
  flex: none;
}
.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 21px;
}
.danger {
  color: var(--danger);
  border-color: var(--line);
}
.warning {
  color: var(--muted);
  padding: 10px;
  border-left: 2px solid var(--strong-line);
  margin-top: 8px;
}
.mask-tools {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 9px;
}
.mask-tools label {
  margin: 0;
}
.mask-tools input {
  width: 130px;
}
.mask-tools [aria-pressed="true"] {
  background: var(--soft);
  color: var(--accent);
}
#mask-area {
  position: relative;
  margin: 14px auto;
  width: fit-content;
  max-width: 100%;
  line-height: 0;
}
#mask-base {
  display: block;
  max-width: 100%;
  max-height: 54dvh;
}
#mask-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: crosshair;
}
#mask-preview {
  width: 32px;
  height: 32px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 4px;
}
#lightbox img {
  display: block;
  max-height: 78dvh;
  max-width: 100%;
  margin: auto;
}
@media (max-width: 1280px) {
  .connection-fields {
    grid-template-columns: 130px 1fr;
  }
  .primary-settings {
    grid-template-columns: 1fr 1fr 1fr;
  }
  .model-field {
    grid-column: span 2;
  }
  .primary-settings > div:nth-child(2) {
    grid-column: 3;
  }
  .workspace-grid {
    grid-template-columns: minmax(300px, 1fr) minmax(0, 1.15fr);
    gap: 16px;
  }
  .composer,
  .stage {
    padding: 18px;
  }
  .stage-foot {
    flex-wrap: wrap;
    gap: 3px 10px;
  }
  .custom-size {
    grid-template-columns: 1fr 36px 1fr;
  }
  .custom-size .hint {
    grid-column: 1 / -1;
  }
}
@media (max-width: 1060px) and (min-width: 851px), (max-width: 700px) {
  .workspace-grid {
    grid-template-columns: 1fr;
  }
  .stage {
    min-height: 400px;
  }
  #empty {
    min-height: 290px;
  }
}
@media (max-width: 540px) {
  .connection-fields {
    grid-template-columns: 1fr;
  }
  .connection-foot {
    align-items: start;
    gap: 10px;
  }
  #connection-name {
    display: none;
  }
  .primary-settings {
    grid-template-columns: 1fr 1fr;
    padding: 16px;
  }
  .model-field,
  .primary-settings > div:nth-child(2) {
    grid-column: 1 / -1;
  }
  .primary-settings > div:nth-child(5) {
    max-width: 110px;
  }
  .composer,
  .stage {
    padding: 16px;
  }
  .stage-head h2 {
    font-size: 14px;
  }
  .stage-head .subtle {
    font-size: 9px;
  }
  .shortcut {
    display: none;
  }
  .tabs {
    flex: 1;
  }
  .tabs button {
    flex: 1;
  }
  .empty-illustration svg {
    width: 130px;
    height: 105px;
  }
  #empty h3 {
    font-size: 18px;
    max-width: 220px;
  }
  .mask-tools {
    gap: 7px;
  }
  dialog {
    padding: 18px;
  }
  .dialog-head h2 {
    font-size: 17px;
  }
  .result-view {
    height: 280px;
  }
  #elapsed:empty {
    display: none;
  }
}

.help-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.guide-card {
  padding: 28px 25px 32px;
  border-right: 1px solid var(--line);
}
.guide-card:first-child {
  padding-left: 0;
}
.guide-card:last-child {
  padding-right: 0;
  border-right: 0;
}
.step-number {
  font-size: 10px;
  color: var(--accent);
  letter-spacing: 1.5px;
}
.guide-card h2 {
  margin: 30px 0 12px;
  font-size: 21px;
}
.guide-card p {
  color: var(--muted);
  font-size: 13px;
}
.guide-card .hint {
  margin-top: 15px;
  font-size: 11px;
}
.guide-card .text-link,
.guide-card .text-button {
  display: inline-block;
  margin-top: 22px;
  color: var(--accent);
  font-size: 12px;
}
.help-bottom {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 50px;
  padding-top: 38px;
}
.help-bottom h2 {
  max-width: 210px;
  font-size: 25px;
  letter-spacing: -0.7px;
}
.faq-list details {
  border-bottom: 1px solid var(--line);
}
.faq-list summary {
  padding: 16px 0;
}
.faq-list details p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.8;
  padding: 0 24px 18px 0;
}
.privacy-document {
  max-width: 920px;
  padding: 32px;
}
.privacy-document h2 {
  margin-bottom: 10px;
}
.privacy-document p {
  color: var(--muted);
  margin-bottom: 26px;
  line-height: 1.8;
}
.privacy-document .text-link {
  display: inline-block;
  margin: 16px;
}
@media (max-width: 700px) {
  .help-grid,
  .help-bottom {
    grid-template-columns: 1fr;
  }
  .guide-card,
  .guide-card:first-child,
  .guide-card:last-child {
    padding: 24px 0;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .guide-card:last-child {
    border-bottom: 0;
  }
  .guide-card h2 {
    margin-top: 15px;
  }
  .help-bottom {
    gap: 16px;
  }
  .help-bottom h2 {
    max-width: none;
  }
  .privacy-document {
    padding: 22px;
  }
}
