:root {
  color-scheme: dark;
  --paper: #141414;
  --panel: #1b1b1b;
  --input: #151515;
  --stage: #171717;
  --ink: #f2f0eb;
  --muted: #aaa9a2;
  --line: #333332;
  --strong-line: #555550;
  --accent: #efb36b;
  --accent-hover: #f8c88f;
  --on-accent: #23190d;
  --soft: #30281f;
  --danger: #ffa8a4;
  --error-bg: #392222;
  --shadow: 0 24px 80px #0005;
  font:
    14px/1.55 "Segoe UI",
    -apple-system,
    BlinkMacSystemFont,
    Arial,
    sans-serif;
}
:root[data-theme="light"] {
  color-scheme: light;
  --paper: #f5f4f0;
  --panel: #fff;
  --input: #faf9f6;
  --stage: #f5f4f0;
  --ink: #232320;
  --muted: #66665f;
  --line: #ddddd5;
  --strong-line: #a5a59b;
  --accent: #925018;
  --accent-hover: #753d10;
  --on-accent: #fff;
  --soft: #f7ead9;
  --danger: #a52d2a;
  --error-bg: #fff0ed;
  --shadow: 0 24px 80px #221a171e;
}

* {
  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;
  }
}

.site-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 214px;
  padding: 28px 16px 14px;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border-right: 1px solid var(--line);
  z-index: 20;
}
.brand-lockup {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 8px;
  margin-bottom: 48px;
  width: fit-content;
}
.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;
}
.sidebar-label {
  color: var(--muted);
  font-size: 10px;
  margin: 0 12px 14px;
}
.site-nav {
  display: grid;
  gap: 5px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 12px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 13px;
  min-height: 45px;
}
.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-indicator {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  margin-left: auto;
  background: currentColor;
  display: none;
}
.nav-item.active .nav-indicator {
  display: block;
}
.sidebar-bottom {
  margin-top: auto;
  padding-top: 34px;
}
.sidebar-foot {
  border-top: 1px solid var(--line);
  padding: 16px 10px 0;
  margin-top: 14px;
  color: var(--muted);
  font-size: 9px;
}
.site-content {
  margin-left: 214px;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}
.site-header {
  min-height: 70px;
  padding: 0 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
}
.breadcrumbs {
  display: flex;
  gap: 12px;
  color: var(--muted);
  font-size: 11px;
}
.breadcrumbs strong {
  font-weight: 500;
  color: var(--ink);
}
.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);
}
.mobile-brand,
.mobile-tabs {
  display: none;
}
#app-main {
  flex: 1;
}
.view {
  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);
}
@media (min-width: 1700px) {
  .view {
    padding-top: 44px;
  }
}
@media (max-width: 1150px) {
  .site-sidebar {
    width: 184px;
    padding-inline: 12px;
  }
  .site-content {
    margin-left: 184px;
  }
  .site-header {
    padding-inline: 24px;
  }
  .view {
    padding: 27px 24px 0;
  }
  .site-footer {
    margin-inline: 24px;
  }
}
@media (max-width: 850px) {
  .site-sidebar {
    display: none;
  }
  .site-content {
    margin-left: 0;
  }
  .site-header {
    min-height: 60px;
    padding: 0 18px;
  }
  .mobile-brand {
    display: flex;
    align-items: center;
    gap: 7px;
  }
  .mobile-brand strong {
    font-size: 21px;
    letter-spacing: -1px;
  }
  .breadcrumbs {
    display: none;
  }
  .mobile-tabs {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    padding: 0 12px;
    border-bottom: 1px solid var(--line);
    background: var(--paper);
  }
  .mobile-tabs a {
    min-height: 45px;
    display: grid;
    place-items: center;
    font-size: 12px;
    color: var(--muted);
    border-bottom: 2px solid transparent;
  }
  .mobile-tabs a.active {
    border-color: var(--accent);
    color: var(--accent);
  }
}
@media (max-width: 540px) {
  .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;
}
.account-panel {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 8px 24px;
  padding: 23px 24px;
  margin-bottom: 16px;
}
.account-copy {
  min-width: 0;
}
.account-copy h2 {
  font-size: 21px;
  font-weight: 550;
  margin: 10px 0 8px;
  letter-spacing: -0.5px;
  overflow-wrap: anywhere;
}
.account-copy p {
  font-size: 12px;
  color: var(--muted);
}
.account-copy code {
  display: inline-block;
  font-size: 11px;
  margin-top: 8px;
  color: var(--muted);
}
.account-feedback {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.account-feedback:has([hidden]) {
  row-gap: 0;
}
.account-feedback .text-button {
  font-size: 11px;
}
.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: 850px) {
  .mobile-tabs {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 640px) {
  .account-panel {
    grid-template-columns: 1fr;
    padding: 20px;
    gap: 15px;
  }
  .account-copy h2 {
    font-size: 20px;
  }
  .account-actions button {
    width: 100%;
  }
  .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;
}
.settings-note {
  grid-column: 1/-1;
  font-size: 10px;
  margin-top: -3px;
}
.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;
  background: var(--input);
}
#mode-description {
  margin: 6px 0 20px;
}
#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);
}
#storage-dialog {
  width: min(560px, calc(100vw - 24px));
}
.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;
}
#storage-status {
  margin-top: 14px;
}

@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;
  }
}
