:root {
  font-family: Inter, Geist, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  color: #19191b;
  background: #fafafa;
  font-synthesis: none;
  --line: #e4e4e6;
  --muted: #69696f;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace
}

* {
  box-sizing: border-box
}

body {
  margin: 0;
  min-height: 100vh
}

button,
a,
input,
textarea,
select,
summary {
  font: inherit
}

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

button {
  cursor: pointer
}

a {
  color: inherit;
  text-decoration: none
}

button {
  background: none;
  border: 0;
  color: inherit
}

button:disabled,
fieldset:disabled label {
  cursor: wait
}

a:focus-visible,
button:focus-visible,
summary:focus-visible,
textarea:focus-visible,
select:focus-visible,
label:has(input:focus-visible) {
  outline: 2px solid #607ed4;
  outline-offset: 3px
}

button:disabled {
  opacity: .6
}

button:disabled:focus-visible {
  outline: 0
}

[hidden] {
  display: none !important
}

.top {
  background: #fff;
  border-bottom: 1px solid var(--line)
}

.top-inner {
  height: 64px;
  max-width: 1440px;
  margin: auto;
  padding: 0 clamp(20px, 4.4vw, 76px);
  display: flex;
  align-items: center;
  gap: 48px
}

.brand,
.top-actions,
nav,
.account,
.destination,
h2,
.panel-head,
.section-heading,
.primary,
.secondary,
.icon-button,
.model-choice,
.ratio-options label,
.preview-foot,
.dialog-head,
.dialog-actions,
.prompt-row,
.ref,
.stage-label,
#work-actions {
  display: flex;
  align-items: center
}

.brand {
  gap: 9px;
  white-space: nowrap;
  line-height: 1
}

.brand strong {
  font-size: 20px;
  letter-spacing: -1.1px;
  font-weight: 650
}

.slash {
  color: #c8c8cb;
  font-size: 23px;
  font-weight: 250;
  margin: 0 3px
}

.brand-studio {
  font-size: 14px;
  color: #68686d;
  letter-spacing: -.25px
}

nav {
  height: 100%;
  gap: 28px
}

nav a {
  height: 100%;
  display: grid;
  place-items: center;
  position: relative;
  font-size: 13px;
  color: #68686d
}

nav a[aria-current] {
  color: #171719;
  font-weight: 650
}

nav a[aria-current]::after {
  content: "";
  height: 2px;
  background: #19191b;
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0
}

.top-actions {
  margin-left: auto;
  gap: 12px
}

.icon,
.icon-button svg {
  width: 17px;
  height: 17px;
  display: block;
  flex-shrink: 0
}

.icon-button {
  width: 32px;
  height: 32px;
  justify-content: center;
  border-radius: 6px;
  color: #5d5d62
}

.icon-button:hover {
  background: #f1f1f2;
  color: #101011
}

.account,
.destination,
.secondary {
  gap: 8px;
  border: 1px solid #dcdcdf;
  border-radius: 7px;
  background: #fff;
  min-height: 34px;
  padding: 0 12px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap
}

.account:hover,
.destination:hover,
.secondary:hover {
  border-color: #aaaab0;
  background: #f8f8f8
}

main {
  max-width: 1392px;
  margin: 0 auto;
  padding: 42px clamp(20px, 4.4vw, 76px) 52px
}

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

h1,
h2,
p,
fieldset,
legend {
  margin: 0
}

h1 {
  font-size: clamp(29px, 3vw, 40px);
  line-height: 1.26;
  letter-spacing: -1.8px;
  font-weight: 680
}

.page-heading p {
  font-size: 13px;
  color: var(--muted);
  margin-top: 9px;
  line-height: 1.65
}

.destination {
  color: #64646a;
  height: 35px;
  font-size: 12px;
  font-family: var(--mono)
}

.destination .icon {
  width: 14px;
  height: 14px
}

.destination b {
  font-weight: 500;
  color: #2b2b2d
}

.crumb {
  opacity: .45
}

.workspace {
  display: grid;
  grid-template-columns: minmax(290px, .84fr) minmax(0, 1.62fr);
  gap: 18px
}

.panel {
  background: white;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  min-width: 0;
  box-shadow: 0 1px 2px #11111104
}

.panel-head {
  justify-content: space-between;
  padding: 0 20px;
  height: 49px;
  flex-shrink: 0;
  border-bottom: 1px solid var(--line)
}

h2 {
  font-size: 14px;
  font-weight: 620;
  gap: 9px;
  letter-spacing: -.2px
}

.panel-head h2 .icon {
  width: 16px;
  height: 16px;
  color: #57575c
}

.controls {
  padding: 20px;
  display: flex;
  flex: 1;
  flex-direction: column
}

.composer {
  display: flex;
  flex-direction: column
}

.controls fieldset {
  border: 0;
  padding: 0;
  min-width: 0
}

.controls legend,
.prompt-row label {
  font-size: 13px;
  font-weight: 610;
  padding: 0
}

.model-options,
.ratio-options {
  display: grid;
  gap: 8px
}

.model-options {
  grid-template-columns: 1fr 1fr;
  margin-top: 9px
}

.model-choice,
.ratio-options label {
  user-select: none;
  cursor: pointer;
  position: relative;
  justify-content: center;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: white;
  transition: background .14s, border-color .14s
}

.model-choice {
  height: 42px;
  gap: 7px;
  font-weight: 570;
  font-size: 13px
}

.model-choice input,
.ratio-options input {
  position: absolute;
  opacity: 0;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  cursor: inherit
}

.model-choice:has(:checked),
.ratio-options label:has(:checked) {
  border-color: #242426;
  background: #f6f6f7;
  box-shadow: inset 0 0 0 .5px #242426
}

.model-choice:hover,
.ratio-options label:hover {
  background: #f6f6f7
}

.prompt-row {
  justify-content: space-between;
  margin: 22px 0 8px
}

#count,
.stage-meta,
kbd {
  font-family: var(--mono)
}

#count {
  font-size: 10px;
  color: #75757a
}

.controls textarea {
  flex: 1;
  min-height: 113px;
  resize: vertical;
  width: 100%;
  border: 1px solid #dcdcdf;
  border-radius: 8px;
  padding: 12px;
  color: #262629;
  font-size: 13px;
  line-height: 1.8;
  background: #fff
}

.controls textarea::placeholder {
  color: #87878e
}

.prompt-tools,
.upload-zone,
.upload-button,
.clarity-row {
  display: flex;
  align-items: center
}

.prompt-tools {
  gap: 9px;
  margin-top: 8px
}

.prompt-tools .secondary {
  font-size: 11px;
  min-height: 29px
}

.quiet-button {
  font-size: 12px;
  color: var(--muted);
  padding: 5px 2px
}

.quiet-button:hover {
  color: #19191b;
  text-decoration: underline
}

.controls .input-group {
  margin-top: 19px
}

.upload-zone {
  flex-wrap: wrap;
  gap: 3px 10px;
  margin-top: 8px;
  border: 1px dashed #ceced2;
  border-radius: 7px;
  padding: 6px 10px
}

.upload-zone.drag-over {
  border-color: #222;
  background: #f2f2f3
}

.upload-button {
  gap: 6px;
  padding: 4px 0;
  font-size: 12px;
  font-weight: 550
}

.upload-button .icon {
  width: 15px;
  height: 15px
}

#reference-help {
  font-size: 10px;
  color: var(--muted)
}

.custom-references {
  display: flex;
  gap: 8px;
  flex-wrap: wrap
}

.custom-reference {
  position: relative;
  margin-top: 8px;
  border-radius: 5px;
  border: 1px solid var(--line);
  width: 62px;
  height: 54px;
  background: #f6f6f7
}

.custom-reference img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: inherit
}

.remove-reference {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 22px;
  height: 22px;
  padding: 3px;
  display: grid;
  place-items: center;
  border: 1px solid #0002;
  border-radius: 50%;
  background: #fffffff2
}

.remove-reference .icon {
  width: 12px;
  height: 12px
}

.clarity-row {
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px
}

.clarity-row label {
  font-size: 13px;
  font-weight: 610
}

.clarity-row select {
  max-width: 70%;
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 3px 8px;
  background: white;
  color: #252528;
  font-size: 12px
}

.ratio-group {
  margin-top: 21px !important
}

.ratio-options {
  grid-template-columns: repeat(3, 1fr);
  margin-top: 9px
}

.ratio-options label {
  height: 36px;
  gap: 9px;
  font: 12px var(--mono)
}

.ratio-shape {
  display: block;
  border: 1.3px solid currentColor;
  border-radius: 1.5px;
  opacity: .9
}

.square {
  width: 12px;
  height: 12px
}

.wide {
  width: 16px;
  height: 10px
}

.tall {
  height: 14px;
  width: 9px
}

.generate-block {
  margin-top: 22px
}

.primary {
  justify-content: center;
  gap: 9px;
  border-radius: 7px;
  background: #1b1b1d;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  min-height: 39px;
  padding: 0 15px
}

.primary:hover {
  background: #333336
}

.generate {
  width: 100%;
  position: relative;
  min-height: 41px;
  box-shadow: 0 1px 2px #0002
}

.generate .icon {
  width: 16px;
  height: 16px
}

kbd {
  position: absolute;
  right: 10px;
  font-size: 10px;
  font-weight: 400;
  color: #cdcdcf;
  border: 1px solid #555558;
  padding: 1px 4px;
  border-radius: 4px
}

.form-note {
  font-size: 12px;
  line-height: 1.6;
  color: #8e5523;
  margin-top: 8px
}

.form-note:empty {
  display: none
}

.preview {
  display: flex;
  flex-direction: column
}

.stage,
.lightbox-stage {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  background: #161719
}

.stage {
  flex: 1;
  min-height: 302px;
  margin: 12px 12px 0;
  border-radius: 6px
}

.stage canvas,
.stage > img,
.lightbox-stage canvas,
.lightbox-stage img {
  display: block;
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain
}

.stage-label,
.stage-meta {
  position: absolute;
  pointer-events: none;
  color: #e8e8e8
}

.stage-label {
  top: 15px;
  left: 15px;
  gap: 6px;
  line-height: 1;
  padding: 5px 8px;
  border: 1px solid #ffffff38;
  border-radius: 4px;
  background: #131416bb;
  font-size: 10px
}

.stage-label b {
  font-weight: 450;
  letter-spacing: .5px
}

.stage-label > span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #c8c8c9
}

.stage-meta {
  right: 14px;
  bottom: 14px;
  font-size: 9px;
  letter-spacing: .85px;
  text-shadow: 0 0 3px #000
}

.preview-foot {
  min-height: 69px;
  padding: 11px 20px;
  justify-content: space-between;
  gap: 12px
}

.caption {
  display: grid;
  gap: 4px;
  min-width: 0
}

.caption strong {
  font-size: 14px;
  font-weight: 620;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis
}

.caption span {
  color: var(--muted);
  font-size: 11px
}

.compact {
  min-height: 31px;
  font-size: 12px;
  gap: 6px;
  padding: 0 9px
}

.compact .icon {
  width: 14px;
  height: 14px
}

#work-actions {
  gap: 5px
}

.references {
  margin-top: 29px
}

.section-heading {
  justify-content: space-between;
  margin-bottom: 12px
}

.section-heading span {
  font-size: 12px;
  color: var(--muted)
}

.reference-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 13px
}

.ref {
  gap: 13px;
  min-width: 0;
  text-align: left;
  padding: 9px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 9px
}

.ref[aria-pressed=true] {
  border-color: #96969c
}

.ref:hover {
  border-color: #656569
}

.thumb {
  position: relative;
  display: block;
  overflow: hidden;
  width: 76px;
  height: 57px;
  flex-shrink: 0;
  border-radius: 4px;
  background: #1b1c1e
}

.thumb canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%
}

.ref-copy {
  min-width: 0;
  display: grid;
  gap: 5px
}

.ref-copy strong {
  font-size: 13px;
  font-weight: 600
}

.ref-copy small {
  color: var(--muted);
  font-size: 11px
}

.ref > .icon {
  margin: 0 4px 0 auto;
  color: #828288;
  width: 14px;
  height: 14px
}

dialog {
  width: min(460px, calc(100vw - 32px));
  max-height: 86dvh;
  overflow: auto;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 13px;
  box-shadow: 0 20px 85px #0003;
  color: #19191b
}

dialog::backdrop {
  background: #11131860;
  backdrop-filter: blur(3px)
}

.dialog-head {
  justify-content: space-between;
  padding: 14px 19px;
  border-bottom: 1px solid var(--line)
}

.dialog-body {
  padding: 19px
}

.dialog-body > p,
.dialog-body details p,
.lightbox > p {
  font-size: 13px;
  line-height: 1.7;
  color: var(--muted)
}

.connections {
  list-style: none;
  padding: 0;
  margin: 15px 0
}

.connections li {
  padding: 10px 0;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border-bottom: 1px solid var(--line)
}

.connections li span {
  font-size: 11px;
  color: var(--muted)
}

.connections li span.yes {
  color: #167840
}

.dialog-actions {
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px
}

.dialog-body details {
  border: 1px solid var(--line);
  border-radius: 7px;
  font-size: 13px;
  padding: 10px 12px
}

.dialog-body summary {
  cursor: pointer
}

.dialog-body details p {
  margin-top: 10px
}

.dialog-body details a {
  text-decoration: underline;
  display: inline-block;
  margin-top: 8px
}

.dialog-body dt {
  font-size: 12px;
  font-weight: 620;
  margin: 9px 0 3px
}

.dialog-body dd {
  font: 11px/1.6 var(--mono);
  margin: 0;
  overflow-wrap: anywhere
}

.lightbox {
  width: min(1000px, calc(100vw - 32px))
}

.lightbox-stage {
  height: min(65dvh, 680px)
}

.lightbox > p {
  padding: 12px 18px;
  max-height: 100px;
  overflow: auto
}

.empty {
  border: 1px solid var(--line);
  border-radius: 12px;
  min-height: 320px;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 13px;
  text-align: center;
  padding: 24px
}

.empty > svg {
  width: 30px;
  height: 30px;
  color: #777
}

.empty h2 {
  font-size: 19px
}

.empty p {
  font-size: 13px;
  color: var(--muted)
}

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px
}

.work-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: white;
  padding: 0;
  text-align: left
}

.work-card:hover {
  border-color: #888
}

.work-card img {
  display: block;
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: contain;
  background: #ececee
}

.work-card div {
  padding: 12px
}

.work-card strong,
.work-card small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap
}

.work-card strong {
  font-size: 13px
}

.work-card small {
  color: var(--muted);
  font-size: 11px;
  margin-top: 5px
}

.more {
  margin: 20px auto
}

.toast {
  position: fixed;
  z-index: 5;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  max-width: calc(100vw - 32px);
  padding: 10px 14px;
  background: #202023;
  color: white;
  box-shadow: 0 4px 24px #0002;
  border-radius: 7px;
  font-size: 13px;
  text-align: center
}

.spinner {
  width: 22px;
  height: 22px;
  border: 2px solid #bbb;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin .9s linear infinite
}

.spinner.light {
  border-color: #ffffff85;
  border-right-color: transparent
}

#busy-cover {
  position: absolute;
  inset: 0;
  background: #151518cf;
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 13px;
  backdrop-filter: blur(3px)
}

#busy-cover b {
  font-size: 14px
}

#elapsed {
  color: #ccc;
  font: 12px var(--mono)
}

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

@media(min-width:1550px) {
  main {
    padding-top: 54px
  }

  .stage {
    min-height: 375px
  }
}

@media(max-width:900px) {
  .workspace {
    grid-template-columns: minmax(265px, .9fr) minmax(0, 1.28fr);
    gap: 12px
  }

  .controls {
    padding: 16px
  }

  .panel-head {
    padding: 0 16px
  }

  .ref {
    gap: 8px
  }

  .thumb {
    width: 55px;
    height: 47px
  }

  .ref > .icon {
    display: none
  }

  .preview-foot {
    padding: 13px
  }

  .top-inner {
    gap: 30px
  }
}

@media(max-width:680px) {
  .top-inner {
    height: 55px;
    padding: 0 15px;
    gap: 23px
  }

  .brand strong {
    font-size: 17px
  }

  .brand img {
    width: 26px;
    height: 26px
  }

  .brand {
    gap: 6px
  }

  .slash,
  .brand-studio {
    display: none
  }

  nav {
    gap: 15px
  }

  nav a {
    font-size: 12px
  }

  .top-actions {
    gap: 4px
  }

  .account {
    min-height: 30px;
    padding: 0 8px
  }

  .account .icon {
    display: none
  }

  .top-actions > .icon-button {
    width: 27px
  }

  main {
    padding: 25px 15px 38px
  }

  .page-heading {
    margin-bottom: 17px
  }

  .page-heading h1 {
    font-size: 29px
  }

  .page-heading p {
    font-size: 12px;
    margin-top: 5px
  }

  .destination {
    display: none
  }

  .workspace {
    grid-template-columns: minmax(0, 1fr);
    gap: 14px
  }

  .panel-head {
    height: 43px
  }

  .controls textarea {
    min-height: 96px
  }

  .prompt-row,
  .ratio-group {
    margin-top: 16px !important
  }

  .generate-block {
    margin-top: 16px
  }

  .stage {
    min-height: 200px;
    aspect-ratio: 1.6;
    margin: 9px 9px 0
  }

  .reference-list {
    grid-template-columns: 1fr;
    gap: 8px
  }

  .ref {
    padding: 7px;
    gap: 12px
  }

  .ref > .icon {
    display: block
  }

  .thumb {
    width: 60px;
    height: 40px
  }

  .ref-copy {
    grid-auto-flow: column;
    align-items: center;
    gap: 10px
  }

  .references {
    margin-top: 23px
  }

  .section-heading span {
    font-size: 11px
  }

  kbd {
    display: none
  }
}

@media(max-width:360px) {
  .top-inner {
    gap: 12px
  }

  nav {
    gap: 9px
  }

  .brand strong {
    font-size: 15px
  }
}

@media(prefers-reduced-motion:reduce) {

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 2s !important;
    transition: none !important
  }
}

.setup-steps {
  padding-left: 20px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.8
}

.setup-steps li + li {
  margin-top: 7px
}

.dialog-body details p > a,
.setup-steps li > a {
  display: inline;
  margin: 0;
  color: #353539
}
