:root {
  color-scheme: dark;
  --bg: #050816;
  --panel: rgba(7, 10, 29, .22);
  --panel-strong: rgba(7, 10, 29, .42);
  --line: rgba(255, 255, 255, .1);
  --line-soft: rgba(255, 255, 255, .065);
  --text: #f7f7ff;
  --muted: rgba(220, 225, 248, .55);
  --muted-2: rgba(220, 225, 248, .36);
  --violet: #8e82ff;
  --violet-2: #6f6ef7;
  --cyan: #49d5e5;
  --green: #65ddb5;
  --danger: #ff6f91;
  --radius-lg: 28px;
  --radius-md: 18px;
  --shadow: 0 26px 90px rgba(0, 0, 0, .32);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--text);
  background: var(--bg);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button,
textarea {
  font: inherit;
}

button {
  color: inherit;
}

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

button:focus-visible,
textarea:focus-visible,
a:focus-visible {
  outline: 2px solid rgba(142, 130, 255, .8);
  outline-offset: 3px;
}

#starfield {
  position: fixed;
  z-index: 0;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

body::before {
  position: fixed;
  z-index: 0;
  inset: 0;
  background:
    radial-gradient(circle at 15% 4%, rgba(84, 75, 210, .24), transparent 29%),
    radial-gradient(circle at 91% 20%, rgba(16, 126, 168, .16), transparent 28%),
    linear-gradient(180deg, rgba(2, 4, 14, .06), rgba(2, 4, 14, .56));
  content: "";
  pointer-events: none;
}

.site-layer {
  position: relative;
  z-index: 2;
  min-height: 100vh;
}

.svg-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

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

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.site-header {
  position: relative;
  display: grid;
  width: min(1480px, calc(100% - 48px));
  height: 64px;
  margin: 0 auto;
  align-items: center;
  grid-template-columns: minmax(210px, 1fr) auto minmax(320px, 1fr);
  gap: 18px;
  border-bottom: 1px solid rgba(255, 255, 255, .07);
}

.header-spacer {
  width: 1px;
  height: 1px;
}

.mode-nav {
  justify-self: center;
  display: flex;
  min-height: 38px;
  padding: 3px;
  gap: 3px;
  border: 1px solid rgba(255, 255, 255, .09);
  border-radius: 12px;
  background: rgba(7, 10, 29, .2);
}

.mode-nav button {
  min-width: 82px;
  padding: 0 15px;
  border: 0;
  border-radius: 9px;
  color: rgba(222, 226, 247, .48);
  background: transparent;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .02em;
  transition: color .18s, background .18s, box-shadow .18s;
}

.mode-nav button:hover {
  color: rgba(245, 246, 255, .82);
}

.mode-nav button.active {
  color: #f6f5ff;
  background: linear-gradient(110deg, rgba(126, 104, 241, .28), rgba(50, 174, 207, .14));
  box-shadow: inset 0 0 0 1px rgba(154, 141, 255, .14);
}

.brand {
  display: inline-flex;
  gap: 12px;
  align-items: center;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  position: relative;
  display: grid;
  width: 40px;
  height: 40px;
  border: 1px solid rgba(151, 139, 255, .35);
  border-radius: 13px;
  place-items: center;
  background:
    linear-gradient(145deg, rgba(144, 130, 255, .18), rgba(67, 207, 222, .06));
  box-shadow: inset 0 0 20px rgba(116, 102, 255, .08), 0 0 28px rgba(109, 96, 255, .12);
}

.brand-mark::after {
  position: absolute;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 12px #fff;
  content: "";
  transform: translate(10px, -9px);
}

.brand-mark svg {
  width: 21px;
  height: 21px;
  color: #a69bff;
  fill: rgba(166, 155, 255, .08);
}

.brand > span:last-child {
  display: flex;
  flex-direction: column;
}

.brand strong {
  font-size: 16px;
  letter-spacing: .08em;
}

.brand small {
  margin-top: 2px;
  color: var(--muted-2);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .18em;
}

.header-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: flex-end;
  min-width: 0;
}

.theme-control {
  display: inline-flex;
  min-height: 38px;
  padding: 0 8px 0 11px;
  gap: 7px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--muted);
  background: rgba(255, 255, 255, .025);
  font-size: 12px;
  font-weight: 650;
  backdrop-filter: blur(12px);
}

.theme-control select {
  max-width: 94px;
  height: 30px;
  padding: 0 22px 0 7px;
  border: 0;
  border-radius: 8px;
  outline: 0;
  color: var(--text);
  background:
    linear-gradient(45deg, transparent 50%, currentColor 50%) right 7px center / 5px 5px no-repeat,
    transparent;
  font: inherit;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}

.theme-control select option {
  color: #151a2f;
  background: #fff;
}

.theme-control:focus-within {
  border-color: rgba(142, 130, 255, .52);
  box-shadow: 0 0 0 3px rgba(142, 130, 255, .09);
}

.theme-setting-row {
  display: flex;
  min-height: 70px;
  margin: 22px 0 14px;
  padding: 14px 15px;
  gap: 18px;
  align-items: center;
  justify-content: space-between;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, .025);
}

.theme-setting-row > span {
  display: grid;
  gap: 5px;
}

.theme-setting-row strong {
  font-size: 14px;
}

.theme-setting-row small {
  color: var(--muted);
  font-size: 12px;
}

.theme-setting-row select {
  min-width: 118px;
  height: 38px;
  padding: 0 32px 0 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: 0;
  color: var(--text);
  background:
    linear-gradient(45deg, transparent 50%, currentColor 50%) right 12px center / 6px 6px no-repeat,
    rgba(255, 255, 255, .035);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}

.theme-setting-row select option {
  color: #151a2f;
  background: #fff;
}

.theme-setting-row select:focus {
  border-color: rgba(142, 130, 255, .52);
  box-shadow: 0 0 0 3px rgba(142, 130, 255, .09);
}

.ghost-button,
.icon-button,
.new-chat-button,
.upload-button {
  display: inline-flex;
  border: 1px solid var(--line);
  align-items: center;
  justify-content: center;
  color: rgba(238, 240, 255, .72);
  background: rgba(255, 255, 255, .025);
  cursor: pointer;
  transition: border-color .18s, color .18s, background .18s, transform .18s;
  backdrop-filter: blur(12px);
}

.ghost-button:hover,
.icon-button:hover,
.new-chat-button:hover,
.upload-button:hover {
  border-color: rgba(154, 144, 255, .34);
  color: #fff;
  background: rgba(135, 119, 255, .08);
  transform: translateY(-1px);
}

.ghost-button {
  min-height: 38px;
  padding: 0 14px;
  gap: 7px;
  border-radius: 12px;
  font-size: 13px;
  text-decoration: none;
}

.ghost-button svg {
  width: 15px;
  height: 15px;
}

.icon-button {
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: 12px;
}

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

main {
  width: min(1480px, calc(100% - 48px));
  margin: 0 auto;
}

.hero {
  display: flex;
  min-height: 92px;
  padding: 20px 4px 15px;
  align-items: flex-end;
  justify-content: space-between;
  animation: reveal .6s ease both;
}

.hero-kicker {
  display: flex;
  margin-bottom: 7px;
  gap: 10px;
  align-items: center;
  color: rgba(186, 178, 255, .68);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: .25em;
}

.hero-kicker b {
  font: inherit;
}

.hero-kicker span {
  width: 32px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(151, 139, 255, .6));
}

.hero h1 {
  margin: 0;
  color: #f8f8ff;
  font-size: clamp(28px, 3.2vw, 38px);
  font-weight: 660;
  line-height: 1.1;
  letter-spacing: -.02em;
  text-wrap: balance;
}

.hero h1 em {
  margin-left: 8px;
  color: transparent;
  background: linear-gradient(105deg, #aa9fff 8%, #8b86ff 48%, #63dbe6 96%);
  background-clip: text;
  font-style: normal;
  -webkit-background-clip: text;
}

.hero p {
  margin: 0 0 5px;
  color: var(--muted);
  font-size: 13px;
}

.studio-shell {
  position: relative;
  display: grid;
  overflow: hidden;
  height: 510px;
  min-height: 510px;
  border: 1px solid rgba(255, 255, 255, .105);
  border-radius: var(--radius-lg);
  grid-template-columns: minmax(720px, .95fr) minmax(560px, 1.05fr);
  background: transparent;
  box-shadow: none;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  animation: reveal .65s .08s ease both;
}

.studio-shell::before {
  position: absolute;
  z-index: 1;
  top: -1px;
  left: 16%;
  width: 27%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(163, 151, 255, .65), transparent);
  content: "";
}

.conversation-panel,
.output-panel {
  position: relative;
  display: flex;
  min-width: 0;
  flex-direction: column;
  background: transparent;
}

.conversation-panel {
  border-right: 1px solid var(--line-soft);
  container-type: inline-size;
  overflow: hidden;
}

.output-panel {
  background: transparent;
}

.panel-header {
  display: flex;
  min-height: 54px;
  padding: 0 16px;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line-soft);
}

.panel-title {
  display: flex;
  gap: 11px;
  align-items: center;
}

.panel-icon {
  display: grid;
  width: 28px;
  height: 28px;
  border: 1px solid rgba(151, 138, 255, .2);
  border-radius: 11px;
  place-items: center;
  color: #9b91ff;
  background: rgba(130, 111, 255, .075);
}

.panel-icon.cool {
  border-color: rgba(68, 205, 223, .18);
  color: #66d9e7;
  background: rgba(48, 186, 207, .065);
}

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

.panel-title > div:last-child {
  display: flex;
  flex-direction: column;
}

.panel-title strong {
  color: rgba(250, 250, 255, .9);
  font-size: 15px;
  letter-spacing: .02em;
}

.panel-title small {
  margin-top: 3px;
  color: var(--muted-2);
  font-size: 11px;
}

.new-chat-button {
  min-height: 32px;
  padding: 0 11px;
  gap: 6px;
  border-radius: 10px;
  font-size: 12px;
}

.new-chat-button svg {
  width: 13px;
  height: 13px;
}

.chat-messages {
  position: relative;
  display: flex;
  min-height: 0;
  padding: 13px 15px;
  flex: 1 1 0;
  flex-direction: column;
  gap: 15px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-color: rgba(150, 140, 255, .22) transparent;
}

.output-empty {
  display: flex;
  margin: auto;
  align-items: center;
  flex-direction: column;
  text-align: center;
}

.chat-empty {
  display: flex;
  width: 100%;
  flex-direction: column;
  gap: 12px;
}

.chat-empty-heading {
  display: flex;
  gap: 10px;
  align-items: center;
}

.chat-empty-heading > span:last-child {
  display: flex;
  flex-direction: column;
}

.empty-orbit {
  position: relative;
  display: grid;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  border: 1px solid rgba(151, 138, 255, .16);
  border-radius: 50%;
  place-items: center;
  background: transparent;
}

.empty-orbit::before,
.empty-orbit::after {
  position: absolute;
  border: 1px solid rgba(151, 138, 255, .07);
  border-radius: 50%;
  content: "";
  inset: -4px;
}

.empty-orbit::after {
  display: none;
}

.empty-orbit i {
  position: absolute;
  top: 1px;
  left: 10px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #b6adff;
  box-shadow: 0 0 13px rgba(182, 173, 255, .9);
  transform-origin: 11px 18px;
  animation: orbit 7s linear infinite;
}

.empty-orbit svg {
  width: 16px;
  height: 16px;
  color: #9c91ff;
}

.chat-empty strong,
.output-empty strong {
  color: rgba(246, 247, 255, .75);
  font-size: 15px;
}

.chat-empty small,
.output-empty small {
  max-width: 320px;
  margin-top: 7px;
  color: var(--muted-2);
  font-size: 12px;
  line-height: 1.65;
}

.prompt-suggestions {
  display: grid;
  gap: 7px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.prompt-suggestions button {
  display: flex;
  min-width: 0;
  min-height: 50px;
  padding: 8px;
  gap: 7px;
  border: 1px solid rgba(255, 255, 255, .07);
  border-radius: 11px;
  align-items: flex-start;
  color: inherit;
  background: transparent;
  cursor: pointer;
  text-align: left;
  transition: border-color .18s, background .18s, transform .18s;
}

.prompt-suggestions button:hover {
  border-color: rgba(148, 135, 255, .3);
  background: rgba(126, 108, 255, .04);
  transform: translateY(-1px);
}

.prompt-suggestions button > b {
  color: rgba(153, 141, 255, .55);
  font-size: 10px;
  font-weight: 650;
}

.prompt-suggestions button > span {
  display: flex;
  min-width: 0;
  flex-direction: column;
}

.prompt-suggestions button strong {
  overflow: hidden;
  color: rgba(241, 243, 255, .68);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.prompt-suggestions button small {
  overflow: hidden;
  margin-top: 4px;
  color: rgba(219, 224, 247, .3);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-turn {
  display: flex;
  gap: 9px;
  align-items: flex-end;
  animation: messageIn .24s ease both;
}

.chat-turn.user {
  justify-content: flex-end;
}

.turn-avatar {
  display: grid;
  width: 25px;
  height: 25px;
  flex: 0 0 25px;
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 8px;
  place-items: center;
  color: rgba(245, 246, 255, .58);
  background: rgba(255, 255, 255, .035);
  font-size: 10px;
  font-weight: 700;
}

.chat-turn.assistant .turn-avatar {
  color: #a99fff;
  background: rgba(123, 107, 255, .08);
}

.chat-bubble {
  max-width: 78%;
  padding: 12px 14px;
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 15px 15px 15px 4px;
  background: rgba(255, 255, 255, .03);
}

.user .chat-bubble {
  border-color: rgba(143, 126, 255, .18);
  border-radius: 15px 15px 4px;
  background: linear-gradient(135deg, rgba(123, 106, 255, .11), rgba(68, 184, 211, .04));
}

.chat-bubble p {
  margin: 0;
  color: rgba(242, 244, 255, .77);
  font-size: 14px;
  line-height: 1.65;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.chat-bubble small {
  display: block;
  margin-top: 7px;
  color: rgba(218, 223, 245, .3);
  font-size: 11px;
}

.turn-images {
  display: grid;
  margin-bottom: 8px;
  gap: 5px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.turn-images img {
  width: 100%;
  height: 72px;
  border-radius: 8px;
  object-fit: cover;
}

.composer {
  position: relative;
  display: flex;
  min-height: 0;
  flex: 1 1 auto;
  margin: 14px;
  border: 1px solid rgba(255, 255, 255, .115);
  border-radius: 18px;
  flex-direction: column;
  background: transparent;
  box-shadow: inset 0 1px rgba(255, 255, 255, .018);
  transition: border-color .18s, box-shadow .18s, background .18s;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

.composer:focus-within,
.composer.dragover {
  border-color: rgba(143, 128, 255, .42);
  background: rgba(16, 16, 44, .12);
  box-shadow: 0 0 0 3px rgba(126, 108, 255, .055), 0 16px 40px rgba(0, 0, 0, .14);
}

.composer textarea {
  display: block;
  width: 100%;
  min-height: 120px;
  max-height: none;
  flex: 1 1 auto;
  padding: 11px 14px 4px;
  resize: none;
  border: 0;
  outline: 0;
  color: rgba(247, 248, 255, .88);
  background: transparent;
  font-size: 14px;
  line-height: 1.7;
}

.composer textarea::placeholder {
  color: rgba(219, 224, 248, .28);
}

.composer-footer {
  display: flex;
  padding: 8px 9px 9px 11px;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
}

.composer-left,
.composer-right {
  display: flex;
  gap: 8px;
  align-items: center;
}

.upload-button {
  min-height: 32px;
  padding: 0 10px;
  gap: 6px;
  border-radius: 10px;
  font-size: 12px;
}

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

body[data-mode="word"] .upload-button {
  display: none;
}

.prompt-count {
  color: var(--muted-2);
  font-size: 8px;
  font-variant-numeric: tabular-nums;
}

.prompt-count b {
  color: rgba(226, 229, 248, .55);
  font-weight: 500;
}

.ratio-picker,
.size-picker {
  display: flex;
  min-height: 32px;
  padding: 3px;
  gap: 2px;
  align-items: center;
  border: 1px solid rgba(255, 255, 255, .075);
  border-radius: 10px;
  background: transparent;
}

.model-picker {
  display: flex;
  min-height: 32px;
  padding: 0 3px 0 0;
  gap: 2px;
  align-items: center;
  border: 1px solid rgba(255, 255, 255, .075);
  border-radius: 10px;
  background: transparent;
}

.model-picker > span {
  padding: 0 5px 0 6px;
  color: rgba(218, 223, 246, .34);
  font-size: 8px;
}

.model-picker > select,
.size-picker > select,
.ratio-picker > select {
  max-width: 150px;
  min-width: 70px;
  height: 26px;
  padding: 0 4px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: rgba(255, 255, 255, .8);
  font-size: 8px;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}

.model-picker > select option,
.size-picker > select option,
.ratio-picker > select option {
  color: #050816;
  background: #ffffff;
}

.ratio-picker > span,
.size-picker > span {
  padding: 0 5px 0 4px;
  color: rgba(218, 223, 246, .34);
  font-size: 8px;
}

.ratio-picker button {
  min-width: 29px;
  height: 24px;
  padding: 0 5px;
  border: 0;
  border-radius: 7px;
  color: rgba(225, 229, 248, .42);
  background: transparent;
  cursor: pointer;
  font-size: 8px;
}

.ratio-picker button:hover {
  color: rgba(255, 255, 255, .8);
}

.ratio-picker button.active {
  color: #fff;
  background: rgba(131, 115, 255, .2);
  box-shadow: inset 0 0 0 1px rgba(156, 143, 255, .18);
}

.generate-button,
.dialog-action {
  position: relative;
  display: inline-flex;
  overflow: hidden;
  min-height: 38px;
  padding: 0 15px;
  gap: 9px;
  border: 1px solid rgba(168, 159, 255, .3);
  border-radius: 11px;
  align-items: center;
  justify-content: center;
  color: #fff;
  background: linear-gradient(105deg, rgba(117, 94, 245, .92), rgba(89, 103, 235, .92) 52%, rgba(42, 174, 196, .88));
  box-shadow: 0 9px 28px rgba(86, 83, 218, .22), inset 0 1px rgba(255, 255, 255, .18);
  cursor: pointer;
  font-size: 10px;
  font-weight: 650;
  transition: transform .18s, box-shadow .18s, filter .18s;
}

.generate-button::before,
.dialog-action::before {
  position: absolute;
  top: -40%;
  left: -45%;
  width: 35%;
  height: 180%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .28), transparent);
  content: "";
  transform: rotate(18deg);
  transition: left .5s;
}

.generate-button:hover,
.dialog-action:hover {
  filter: brightness(1.08);
  box-shadow: 0 12px 34px rgba(86, 83, 218, .32), inset 0 1px rgba(255, 255, 255, .22);
  transform: translateY(-1px);
}

.generate-button:hover::before,
.dialog-action:hover::before {
  left: 120%;
}

.generate-button:disabled {
  opacity: .62;
  cursor: wait;
  filter: saturate(.7);
  transform: none;
}

.generate-button svg {
  width: 15px;
  height: 15px;
}

.generate-button.loading svg {
  animation: sendPulse 1s ease-in-out infinite;
}

.attachment-tray {
  display: none;
  padding: 10px 10px 0;
  gap: 7px;
  overflow-x: auto;
}

.attachment-tray.show {
  display: flex;
}

.attachment-item {
  position: relative;
  width: 52px;
  height: 42px;
  flex: 0 0 52px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 10px;
  background: transparent;
}

.attachment-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.attachment-item button {
  position: absolute;
  top: 3px;
  right: 3px;
  display: grid;
  width: 17px;
  height: 17px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, .2);
  border-radius: 50%;
  place-items: center;
  color: #fff;
  background: rgba(3, 5, 16, .72);
  cursor: pointer;
  font-size: 12px;
  line-height: 1;
}

.output-body {
  position: relative;
  display: grid;
  min-height: 0;
  padding: 14px;
  flex: 1 1 auto;
}

.output-empty,
.generation-loading,
.output-error,
.result-stage {
  grid-area: 1 / 1;
}

.empty-frame {
  position: relative;
  display: grid;
  width: 58px;
  height: 58px;
  margin-bottom: 12px;
  border: 1px solid rgba(103, 206, 225, .11);
  border-radius: 20px;
  place-items: center;
  color: rgba(107, 212, 229, .46);
  background: transparent;
  transform: rotate(-3deg);
}

.empty-frame::before,
.empty-frame::after {
  position: absolute;
  border: 1px solid rgba(146, 132, 255, .06);
  border-radius: 22px;
  content: "";
  inset: -6px;
}

.empty-frame::after {
  inset: -12px;
  border-color: rgba(103, 206, 225, .03);
}

.empty-frame svg {
  width: 24px;
  height: 24px;
}

.empty-frame span {
  position: absolute;
  z-index: 2;
  width: 13px;
  height: 13px;
  border-style: solid;
  border-color: rgba(145, 132, 255, .52);
}

.empty-frame span:nth-child(1) {
  top: -1px;
  left: -1px;
  border-width: 1px 0 0 1px;
  border-radius: 3px 0 0;
}

.empty-frame span:nth-child(2) {
  top: -1px;
  right: -1px;
  border-width: 1px 1px 0 0;
  border-radius: 0 3px 0 0;
}

.empty-frame span:nth-child(3) {
  right: -1px;
  bottom: -1px;
  border-width: 0 1px 1px 0;
  border-radius: 0 0 3px;
}

.empty-frame span:nth-child(4) {
  bottom: -1px;
  left: -1px;
  border-width: 0 0 1px 1px;
  border-radius: 0 0 0 3px;
}

.feature-pills {
  display: flex;
  margin-top: 20px;
  gap: 7px;
  flex-wrap: wrap;
  justify-content: center;
}

.feature-pills span {
  padding: 5px 8px;
  border: 1px solid rgba(255, 255, 255, .065);
  border-radius: 999px;
  color: rgba(218, 223, 246, .35);
  background: rgba(255, 255, 255, .015);
  font-size: 8px;
}

.output-meta {
  padding: 6px 9px;
  border: 1px solid rgba(255, 255, 255, .075);
  border-radius: 999px;
  color: rgba(225, 229, 247, .42);
  background: rgba(255, 255, 255, .02);
  font-size: 8px;
}

.generation-loading {
  display: none;
  place-self: center;
  justify-items: center;
  text-align: center;
}

.generation-loading.show {
  display: grid;
}

.loading-visual {
  position: relative;
  display: grid;
  width: 126px;
  height: 126px;
  margin-bottom: 26px;
  place-items: center;
}

.loading-visual > i {
  position: absolute;
  border: 1px solid rgba(151, 139, 255, .13);
  border-radius: 50%;
  inset: 0;
  animation: orbit 8s linear infinite;
}

.loading-visual > i::after {
  position: absolute;
  top: 17px;
  right: 6px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #9b91ff;
  box-shadow: 0 0 16px rgba(155, 145, 255, .85);
  content: "";
}

.loading-visual > i:nth-of-type(2) {
  inset: 13px;
  border-color: rgba(75, 208, 224, .12);
  animation-direction: reverse;
  animation-duration: 5.5s;
}

.loading-visual > i:nth-of-type(2)::after {
  top: auto;
  right: auto;
  bottom: 9px;
  left: 12px;
  width: 4px;
  height: 4px;
  background: #4dd1e2;
  box-shadow: 0 0 14px rgba(77, 209, 226, .85);
}

.loading-visual > i:nth-of-type(3) {
  inset: 28px;
  border-style: dashed;
  animation-duration: 11s;
}

.loading-visual > i:nth-of-type(3)::after {
  display: none;
}

.loading-core {
  display: grid;
  width: 50px;
  height: 50px;
  border: 1px solid rgba(159, 146, 255, .27);
  border-radius: 17px;
  place-items: center;
  color: #afa6ff;
  background: radial-gradient(circle, rgba(128, 108, 255, .22), rgba(91, 77, 190, .06));
  box-shadow: 0 0 38px rgba(107, 90, 233, .17), inset 0 0 20px rgba(141, 128, 255, .1);
  animation: coreFloat 2.2s ease-in-out infinite;
}

.loading-core svg {
  width: 22px;
  height: 22px;
}

.generation-loading strong {
  color: rgba(247, 248, 255, .82);
  font-size: 13px;
}

.generation-loading small {
  margin-top: 8px;
  color: var(--muted-2);
  font-size: 9px;
}

.progress-track {
  overflow: hidden;
  width: 190px;
  height: 3px;
  margin-top: 22px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .055);
}

.progress-track span {
  display: block;
  width: 5%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #806cf1, #55cede);
  box-shadow: 0 0 12px rgba(99, 202, 222, .42);
  transition: width .35s ease;
}

.generation-loading > b {
  margin-top: 7px;
  color: rgba(215, 219, 243, .32);
  font-size: 8px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.output-error {
  display: none;
  width: min(390px, 90%);
  padding: 25px;
  place-self: center;
  border: 1px solid rgba(255, 111, 145, .18);
  border-radius: 18px;
  justify-items: center;
  background: rgba(57, 10, 26, .1);
  text-align: center;
}

.output-error.show {
  display: grid;
}

.output-error > span {
  display: grid;
  width: 38px;
  height: 38px;
  margin-bottom: 12px;
  border: 1px solid rgba(255, 111, 145, .26);
  border-radius: 12px;
  place-items: center;
  color: #ff8da8;
  background: rgba(255, 111, 145, .08);
  font-size: 16px;
  font-weight: 700;
}

.output-error strong {
  color: rgba(255, 231, 237, .85);
  font-size: 12px;
}

.output-error small {
  margin-top: 7px;
  color: rgba(255, 205, 217, .5);
  font-size: 9px;
  line-height: 1.65;
}

.output-error button {
  min-height: 32px;
  margin-top: 16px;
  padding: 0 13px;
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 9px;
  color: rgba(255, 255, 255, .7);
  background: rgba(255, 255, 255, .035);
  cursor: pointer;
  font-size: 9px;
}

.result-stage {
  display: none;
  min-width: 0;
}

.result-stage.show {
  display: flex;
  min-height: 100%;
  align-items: center;
  justify-content: center;
}

.result-card {
  position: relative;
  overflow: hidden;
  width: min(100%, 560px);
  border: 1px solid rgba(255, 255, 255, .13);
  border-radius: 19px;
  background: transparent;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .3);
  animation: resultIn .55s cubic-bezier(.22, .9, .25, 1) both;
}

.result-image-button {
  display: flex;
  width: 100%;
  padding: 0;
  border: 0;
  align-items: center;
  justify-content: center;
  background:
    linear-gradient(45deg, rgba(255, 255, 255, .02) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(255, 255, 255, .02) 25%, transparent 25%);
  background-size: 18px 18px;
  cursor: zoom-in;
}

.result-image-button img {
  display: block;
  max-width: 100%;
  max-height: 350px;
  object-fit: contain;
}

.result-actions {
  display: flex;
  min-height: 48px;
  padding: 0 13px 0 16px;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid rgba(255, 255, 255, .08);
  background: rgba(5, 7, 21, .22);
  backdrop-filter: blur(16px);
}

.result-actions > span {
  display: flex;
  min-width: 0;
  flex-direction: column;
}

.result-actions strong {
  overflow: hidden;
  color: rgba(246, 247, 255, .76);
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.result-actions small {
  margin-top: 3px;
  color: var(--muted-2);
  font-size: 8px;
}

.result-actions > div {
  display: flex;
  gap: 6px;
}

.result-actions button,
.history-actions button {
  display: inline-flex;
  min-height: 31px;
  padding: 0 9px;
  gap: 5px;
  border: 1px solid rgba(255, 255, 255, .09);
  border-radius: 9px;
  align-items: center;
  color: rgba(237, 239, 255, .58);
  background: rgba(255, 255, 255, .025);
  cursor: pointer;
  font-size: 8px;
}

.result-actions button:hover,
.history-actions button:hover {
  border-color: rgba(149, 136, 255, .28);
  color: #fff;
  background: rgba(129, 111, 255, .075);
}

.result-actions svg,
.history-actions svg {
  width: 13px;
  height: 13px;
}

.workspace-notes {
  display: flex;
  padding: 16px 7px 0;
  gap: 18px;
  align-items: center;
  justify-content: center;
  color: rgba(220, 225, 247, .29);
  font-size: 8px;
}

.workspace-notes span {
  display: inline-flex;
  gap: 6px;
  align-items: center;
}

.workspace-notes i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 10px rgba(101, 221, 181, .65);
}

footer {
  display: flex;
  width: min(1380px, calc(100% - 48px));
  min-height: 92px;
  margin: 34px auto 0;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid rgba(255, 255, 255, .055);
  color: rgba(220, 225, 247, .24);
}

footer span {
  font-size: 8px;
  font-weight: 700;
  letter-spacing: .2em;
}

footer small {
  font-size: 8px;
}

.drawer-backdrop,
.modal-backdrop,
.lightbox {
  position: fixed;
  z-index: 50;
  inset: 0;
  visibility: hidden;
  background: rgba(1, 3, 12, .64);
  opacity: 0;
  backdrop-filter: blur(10px);
  transition: opacity .22s, visibility .22s;
}

.drawer-backdrop.show,
.modal-backdrop.show,
.lightbox.show {
  visibility: visible;
  opacity: 1;
}

.history-drawer {
  position: fixed;
  z-index: 51;
  top: 0;
  right: 0;
  display: flex;
  width: min(430px, 92vw);
  height: 100vh;
  border-left: 1px solid rgba(255, 255, 255, .1);
  flex-direction: column;
  background:
    radial-gradient(circle at 80% 0, rgba(113, 94, 240, .11), transparent 34%),
    rgba(5, 8, 24, .77);
  box-shadow: -24px 0 80px rgba(0, 0, 0, .35);
  backdrop-filter: blur(28px) saturate(120%);
  transform: translateX(102%);
  transition: transform .3s cubic-bezier(.22, .85, .28, 1);
}

.history-drawer.show {
  transform: translateX(0);
}

.drawer-header {
  display: flex;
  min-height: 96px;
  padding: 0 22px 0 26px;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line-soft);
}

.drawer-header span,
.dialog-kicker {
  color: rgba(168, 156, 255, .5);
  font-size: 7px;
  font-weight: 750;
  letter-spacing: .22em;
}

.drawer-header h2 {
  margin: 6px 0 0;
  font-size: 20px;
  font-weight: 620;
  letter-spacing: -.035em;
}

.drawer-header-actions {
  display: flex;
  gap: 9px;
  align-items: center;
}

.history-clear-button {
  min-height: 34px;
  padding: 0 11px;
  border: 1px solid rgba(255, 111, 145, .22);
  border-radius: 10px;
  color: rgba(255, 174, 193, .82);
  background: rgba(255, 111, 145, .055);
  cursor: pointer;
  font-size: 9px;
  transition: border-color .18s, color .18s, background .18s;
}

.history-clear-button:hover:not(:disabled) {
  border-color: rgba(255, 111, 145, .42);
  color: #ffc0ce;
  background: rgba(255, 111, 145, .1);
}

.history-clear-button:disabled {
  opacity: .46;
  cursor: not-allowed;
}

.history-content {
  display: flex;
  min-height: 0;
  padding: 18px;
  flex: 1;
  flex-direction: column;
  gap: 11px;
  overflow-y: auto;
}

.history-empty {
  margin: auto;
  color: var(--muted-2);
  font-size: 10px;
}

.history-item {
  flex: 0 0 auto;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 15px;
  background: transparent;
}

.history-item-main {
  display: grid;
  padding: 9px;
  gap: 11px;
  grid-template-columns: 96px minmax(0, 1fr);
}

.history-thumb {
  display: grid;
  overflow: hidden;
  width: 96px;
  min-width: 96px;
  height: 72px;
  min-height: 72px;
  padding: 0;
  border: 0;
  border-radius: 10px;
  align-self: start;
  place-items: center;
  color: var(--muted-2);
  background: rgba(255, 255, 255, .025);
  cursor: pointer;
}

.history-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: cover;
  object-position: center;
}

.history-thumb svg {
  width: 22px;
  height: 22px;
}

.history-info {
  display: flex;
  min-width: 0;
  padding: 4px 2px 2px 0;
  flex-direction: column;
}

.history-info strong {
  display: -webkit-box;
  overflow: hidden;
  color: rgba(245, 246, 255, .72);
  font-size: 10px;
  font-weight: 540;
  line-height: 1.5;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.history-info small {
  margin-top: 6px;
  color: var(--muted-2);
  font-size: 8px;
}

.history-actions {
  display: flex;
  margin-top: auto;
  gap: 5px;
  flex-wrap: wrap;
}

.history-actions .delete-button:hover {
  border-color: rgba(255, 111, 145, .24);
  color: #ff9ab2;
  background: rgba(255, 111, 145, .055);
}

.history-state {
  display: flex;
  padding: 8px 11px;
  gap: 7px;
  align-items: center;
  border-top: 1px solid rgba(255, 255, 255, .055);
  color: rgba(222, 226, 247, .38);
  font-size: 8px;
}

.history-state i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #e4b464;
  animation: softPulse 1.3s ease-in-out infinite;
}

.modal-backdrop {
  display: grid;
  padding: 22px;
  place-items: center;
}

.config-dialog {
  position: relative;
  width: min(510px, 100%);
  min-width: 0;
  max-width: 100%;
  padding: 34px;
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 24px;
  background:
    radial-gradient(circle at 85% 4%, rgba(110, 91, 232, .13), transparent 31%),
    rgba(6, 9, 27, .78);
  box-shadow: 0 30px 100px rgba(0, 0, 0, .48);
  backdrop-filter: blur(28px);
  transform: translateY(12px) scale(.98);
  transition: transform .23s;
}

.modal-backdrop.show .config-dialog {
  transform: none;
}

.modal-close {
  position: absolute;
  top: 18px;
  right: 18px;
}

.redeem-dialog {
  width: min(440px, calc(100vw - 32px));
}

.redeem-form {
  display: grid;
  gap: 14px;
  margin-top: 24px;
}

.redeem-form label {
  display: grid;
  gap: 8px;
  color: rgba(235, 238, 255, .72);
  font-size: 13px;
  font-weight: 700;
}

.redeem-form input {
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid rgba(151, 139, 255, .24);
  border-radius: 12px;
  outline: 0;
  color: #fff;
  background: rgba(5, 9, 27, .72);
  font: inherit;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.redeem-form input:focus {
  border-color: rgba(116, 221, 238, .55);
  box-shadow: 0 0 0 3px rgba(64, 190, 220, .1);
}

.config-dialog h2 {
  margin: 10px 0 9px;
  font-size: 25px;
  font-weight: 620;
  letter-spacing: -.045em;
}

.config-dialog > p {
  margin: 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.75;
}

code {
  color: rgba(211, 205, 255, .78);
  font-family: "Cascadia Code", "SFMono-Regular", Consolas, monospace;
}

.config-dialog pre {
  overflow-x: auto;
  max-width: 100%;
  margin: 20px 0 13px;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, .075);
  border-radius: 13px;
  background: rgba(0, 2, 12, .38);
  color: rgba(219, 215, 255, .72);
  font-size: 9px;
  line-height: 1.8;
}

.config-note {
  display: flex;
  padding: 13px 14px;
  border: 1px solid rgba(101, 221, 181, .1);
  border-radius: 12px;
  flex-direction: column;
  background: rgba(30, 105, 88, .04);
}

.config-note strong {
  color: rgba(205, 244, 232, .64);
  font-size: 9px;
}

.config-note small {
  margin-top: 4px;
  color: rgba(205, 232, 225, .34);
  font-size: 8px;
  line-height: 1.6;
}

.dialog-action {
  width: 100%;
  min-height: 42px;
  margin-top: 18px;
}

.lightbox {
  display: grid;
  padding: 28px;
  place-items: center;
}

.lightbox-dialog {
  overflow: hidden;
  width: min(1120px, 92vw);
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 19px;
  background: rgba(3, 5, 16, .75);
  box-shadow: 0 30px 100px rgba(0, 0, 0, .6);
  transform: translateY(10px) scale(.985);
  transition: transform .22s;
}

.lightbox.show .lightbox-dialog {
  transform: none;
}

.lightbox-dialog img {
  display: block;
  width: 100%;
  max-height: 78vh;
  object-fit: contain;
  background: rgba(0, 0, 0, .38);
}

.lightbox-dialog > div {
  display: flex;
  min-height: 58px;
  padding: 0 18px;
  align-items: center;
  justify-content: space-between;
}

.lightbox-dialog strong {
  color: rgba(246, 247, 255, .74);
  font-size: 10px;
}

.lightbox-dialog small {
  color: var(--muted-2);
  font-size: 9px;
}

.lightbox-close {
  position: absolute;
  z-index: 2;
  top: 18px;
  right: 18px;
  display: grid;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 50%;
  place-items: center;
  color: #fff;
  background: rgba(3, 5, 16, .48);
  cursor: pointer;
  backdrop-filter: blur(14px);
}

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

.toast {
  display: flex;
  min-height: 45px;
  padding: 11px 14px;
  gap: 10px;
  border: 1px solid rgba(255, 255, 255, .11);
  border-radius: 13px;
  align-items: center;
  color: rgba(245, 246, 255, .72);
  background: rgba(7, 10, 29, .78);
  box-shadow: 0 14px 42px rgba(0, 0, 0, .3);
  font-size: 10px;
  line-height: 1.5;
  backdrop-filter: blur(22px);
  animation: toastIn .25s ease both;
}

.toast i {
  display: grid;
  width: 21px;
  height: 21px;
  flex: 0 0 21px;
  border-radius: 7px;
  place-items: center;
  color: #a89eff;
  background: rgba(132, 115, 255, .1);
  font-size: 10px;
  font-style: normal;
  font-weight: 700;
}

.toast.success i {
  color: #7ce8c3;
  background: rgba(101, 221, 181, .09);
}

.toast.error i {
  color: #ff91aa;
  background: rgba(255, 111, 145, .09);
}

.toast.out {
  animation: toastOut .24s ease forwards;
}

body.overlay-open {
  overflow: hidden;
}

/* Readability tuning for the AI image workspace */
body {
  font-size: 15px;
  text-rendering: geometricPrecision;
}

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

.mode-nav button,
.ghost-button,
.new-chat-button,
.upload-button {
  font-size: 13px;
}

.hero-kicker {
  font-size: 12px;
  letter-spacing: .18em;
}

.hero p,
.panel-title strong,
.chat-empty strong,
.output-empty strong {
  font-size: 15px;
}

.panel-title small,
.chat-empty small,
.output-empty small,
.chat-bubble small,
.prompt-count,
.output-meta,
.generation-loading small,
.generation-loading > b {
  font-size: 12px;
}

.prompt-suggestions button > b,
.prompt-suggestions button small,
.workspace-notes,
footer span,
footer small,
.history-empty,
.history-state,
.drawer-header span,
.dialog-kicker,
.config-dialog > p,
.config-dialog pre,
.config-note strong,
.config-note small,
.lightbox-dialog strong,
.lightbox-dialog small,
.toast {
  font-size: 12px;
}

.prompt-suggestions button strong,
.chat-bubble p,
.generation-loading strong,
.output-error strong,
.result-actions strong,
.history-info strong {
  font-size: 14px;
}

.output-error small,
.output-error button,
.result-actions small,
.result-actions button,
.history-actions button,
.history-info small {
  font-size: 12px;
}

.composer textarea {
  min-height: 120px;
  max-height: none;
  flex: 1 1 auto;
  padding: 14px 16px 7px;
  font-size: 15px;
}

.composer-footer {
  padding: 10px 11px 11px 13px;
  align-items: stretch;
  flex-direction: column;
}

.composer-left,
.composer-right {
  min-width: 0;
}

.composer-left {
  justify-content: space-between;
}

.composer-right {
  display: grid;
  grid-template-columns: minmax(190px, 1fr) minmax(112px, .5fr) minmax(230px, .95fr) auto;
  width: 100%;
  gap: 8px;
  align-items: center;
}

.composer-right > * {
  min-width: 0;
}

.model-picker,
.ratio-picker,
.size-picker {
  min-height: 38px;
  flex: 1 1 0;
  border-color: rgba(255, 255, 255, .14);
  background: rgba(255, 255, 255, .045);
  box-shadow: inset 0 1px rgba(255, 255, 255, .05), 0 10px 30px rgba(0, 0, 0, .12);
  -webkit-backdrop-filter: blur(18px) saturate(120%);
  backdrop-filter: blur(18px) saturate(120%);
}

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

.ratio-picker,
.size-picker {
  width: 100%;
  max-width: none;
}

.size-picker {
  min-width: 228px;
}

.model-picker:hover,
.ratio-picker:hover,
.size-picker:hover {
  border-color: rgba(154, 144, 255, .34);
  background: rgba(126, 108, 255, .075);
}

.model-picker > span,
.ratio-picker > span,
.size-picker > span {
  padding: 0 8px;
  color: rgba(232, 235, 255, .66);
  font-size: 12px;
  font-weight: 650;
  white-space: nowrap;
}

.model-picker > select,
.ratio-picker > select,
.size-picker > select {
  width: 100%;
  max-width: none;
  min-width: 0;
  height: 31px;
  padding: 0 24px 0 9px;
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 9px;
  color: rgba(255, 255, 255, .92);
  background:
    linear-gradient(45deg, transparent 50%, rgba(245, 246, 255, .78) 50%) right 10px center / 6px 6px no-repeat,
    linear-gradient(135deg, rgba(255, 255, 255, .08), rgba(255, 255, 255, .02));
  font-size: 13px;
  line-height: 31px;
}

.model-picker > select option,
.ratio-picker > select option,
.size-picker > select option {
  color: #f7f7ff;
  background: #11152d;
}

.ratio-picker > select,
.size-picker > select {
  flex: 1 1 auto;
}

.generate-button,
.dialog-action {
  min-height: 42px;
  padding: 0 18px;
  font-size: 14px;
}

.composer .generate-button {
  flex: 0 0 auto;
  min-width: 142px;
  padding: 6px 14px;
  white-space: nowrap;
}

@container (max-width: 960px) {
  .composer-right {
    grid-template-columns: minmax(0, 1fr) minmax(108px, .52fr) minmax(0, 1.15fr);
  }

  .size-picker {
    min-width: 0;
  }

  .composer .generate-button {
    width: 100%;
    grid-column: 1 / -1;
  }
}

.generate-button-copy {
  display: grid;
  gap: 2px;
  text-align: left;
}

.generate-button-copy b {
  font-size: 13px;
  font-weight: 700;
}

.generate-button-copy small {
  color: rgba(245, 246, 255, .7);
  font-size: 9px;
  font-weight: 500;
}

.generate-button-copy i {
  color: #fff1ae;
  font-style: normal;
  font-weight: 800;
}

.generate-button.insufficient-credits {
  border-color: rgba(255, 174, 104, .42);
  background: linear-gradient(105deg, rgba(122, 79, 164, .92), rgba(173, 93, 104, .9));
}

.result-actions {
  min-height: 56px;
}

.result-actions strong,
.history-info strong,
.chat-empty strong,
.output-empty strong,
.panel-title strong {
  font-weight: 650;
  letter-spacing: 0;
}

@keyframes reveal {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}

@keyframes messageIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

@keyframes resultIn {
  from { opacity: 0; transform: scale(.975) translateY(8px); }
  to { opacity: 1; transform: none; }
}

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

@keyframes softPulse {
  50% { opacity: .45; transform: scale(.82); }
}

@keyframes coreFloat {
  50% { transform: translateY(-4px) scale(1.03); }
}

@keyframes sendPulse {
  50% { opacity: .45; transform: translateX(3px); }
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(8px) scale(.98); }
}

@keyframes toastOut {
  to { opacity: 0; transform: translateX(12px); }
}

.prompt-studio {
  position: relative;
  display: grid;
  width: min(1380px, calc(100% - 48px));
  height: 510px;
  margin: 0 auto 34px;
  overflow: hidden;
  grid-template-columns: minmax(0, .92fr) minmax(0, 1.08fr);
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: var(--radius-lg);
  background: transparent;
  box-shadow: none;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

.prompt-studio[hidden],
.studio-shell[hidden],
.prompt-result-loading[hidden],
.prompt-result-error[hidden],
.prompt-result-content[hidden] {
  display: none !important;
}

.prompt-builder-panel,
.prompt-result-panel {
  min-width: 0;
  min-height: 0;
}

.prompt-builder-panel {
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--line-soft);
}

.prompt-builder-body {
  display: flex;
  min-height: 0;
  padding: 24px 28px 28px;
  flex: 1;
  flex-direction: column;
  gap: 18px;
}

.prompt-idea-field {
  position: relative;
  display: flex;
  min-height: 0;
  flex: 1;
  flex-direction: column;
}

.prompt-idea-field > span,
.prompt-options label > span {
  margin-bottom: 8px;
  color: rgba(233, 235, 252, .7);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .04em;
}

.prompt-idea-field textarea,
.prompt-result-content textarea {
  width: 100%;
  min-height: 0;
  resize: none;
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 18px;
  outline: 0;
  color: rgba(249, 249, 255, .94);
  background: rgba(4, 7, 22, .42);
  box-shadow: inset 0 1px 18px rgba(0, 0, 0, .12);
  line-height: 1.75;
  transition: border-color .18s, box-shadow .18s, background .18s;
}

.prompt-idea-field textarea {
  height: 100%;
  padding: 16px 18px 34px;
}

.prompt-idea-field textarea:focus,
.prompt-result-content textarea:focus {
  border-color: rgba(142, 130, 255, .48);
  background: rgba(7, 10, 29, .56);
  box-shadow: 0 0 0 3px rgba(123, 105, 242, .08);
}

.prompt-idea-field > small {
  position: absolute;
  right: 14px;
  bottom: 10px;
  color: var(--muted-2);
  font-size: 11px;
}

.prompt-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.prompt-options label {
  display: flex;
  min-width: 0;
  flex-direction: column;
}

.prompt-options select {
  width: 100%;
  height: 42px;
  padding: 0 34px 0 12px;
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 12px;
  outline: 0;
  color: rgba(245, 246, 255, .86);
  background: rgba(7, 10, 29, .48);
}

.prompt-options select option {
  color: #f7f7ff;
  background: #0d112c;
}

.prompt-generate-button {
  display: flex;
  width: 100%;
  min-height: 58px;
  padding: 0 20px;
  align-items: center;
  justify-content: space-between;
  border: 1px solid rgba(174, 162, 255, .32);
  border-radius: 16px;
  color: #fff;
  background: linear-gradient(115deg, #7b62ee, #5b7eea 54%, #35b9ca);
  box-shadow: 0 16px 40px rgba(76, 91, 218, .24);
  cursor: pointer;
  transition: transform .18s, filter .18s, opacity .18s;
}

.prompt-generate-button:hover:not(:disabled) {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

.prompt-generate-button.insufficient-credits {
  border-color: rgba(255, 113, 137, .62);
  box-shadow: 0 16px 40px rgba(176, 48, 91, .24);
}

.prompt-generate-button:disabled {
  cursor: wait;
  opacity: .58;
}

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

.prompt-generate-button b {
  font-size: 14px;
}

.prompt-generate-button small {
  color: rgba(255, 255, 255, .62);
  font-size: 10px;
}

.prompt-result-panel {
  display: flex;
  flex-direction: column;
}

.prompt-result-body {
  display: grid;
  min-height: 0;
  padding: 26px 30px 30px;
  flex: 1;
  place-items: stretch;
}

.prompt-result-empty,
.prompt-result-loading,
.prompt-result-error {
  display: flex;
  min-height: 100%;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  color: var(--muted);
  text-align: center;
}

.prompt-result-empty strong,
.prompt-result-loading strong,
.prompt-result-error strong {
  margin-top: 18px;
  color: rgba(245, 246, 255, .78);
  font-size: 15px;
}

.prompt-result-empty small,
.prompt-result-loading small,
.prompt-result-error small {
  max-width: 360px;
  margin-top: 8px;
  color: var(--muted-2);
  font-size: 12px;
  line-height: 1.65;
}

.prompt-result-orbit {
  position: relative;
  display: grid;
  width: 82px;
  height: 82px;
  border: 1px solid rgba(92, 207, 222, .18);
  border-radius: 50%;
  place-items: center;
  color: #72dbe7;
  background: radial-gradient(circle, rgba(73, 213, 229, .12), transparent 68%);
  box-shadow: 0 0 42px rgba(73, 213, 229, .1);
}

.prompt-result-orbit::before,
.prompt-result-orbit::after {
  position: absolute;
  border: 1px solid rgba(145, 132, 255, .12);
  border-radius: 50%;
  content: "";
}

.prompt-result-orbit::before {
  inset: -12px;
}

.prompt-result-orbit::after {
  inset: 12px;
}

.prompt-result-orbit.loading {
  animation: promptOrbit 1.8s linear infinite;
}

.prompt-result-error > b {
  display: grid;
  width: 58px;
  height: 58px;
  border: 1px solid rgba(255, 111, 145, .28);
  border-radius: 50%;
  place-items: center;
  color: #ff8ca8;
  background: rgba(75, 13, 31, .18);
  font-size: 20px;
}

.prompt-result-content {
  display: flex;
  min-width: 0;
  min-height: 0;
  flex-direction: column;
  gap: 16px;
}

.prompt-result-content textarea {
  padding: 20px 22px;
  flex: 1;
  overflow-y: auto;
  color: rgba(248, 249, 255, .88);
  background:
    linear-gradient(145deg, rgba(126, 102, 238, .08), rgba(53, 185, 202, .04)),
    rgba(4, 7, 22, .42);
}

.prompt-result-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.prompt-result-actions button {
  display: inline-flex;
  min-height: 42px;
  padding: 0 16px;
  gap: 8px;
  align-items: center;
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 12px;
  color: rgba(240, 242, 255, .72);
  background: rgba(255, 255, 255, .035);
  cursor: pointer;
}

.prompt-result-actions button.primary {
  border-color: rgba(142, 130, 255, .32);
  color: #fff;
  background: linear-gradient(110deg, rgba(123, 98, 238, .86), rgba(53, 185, 202, .72));
}

.prompt-result-actions svg {
  width: 16px;
  height: 16px;
}

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

@media (max-width: 1320px) {
  .studio-shell {
    height: auto;
    grid-template-columns: 1fr;
  }

  .conversation-panel {
    min-height: 500px;
    border-right: 0;
    border-bottom: 1px solid var(--line-soft);
  }

  .output-panel {
    min-height: 460px;
  }

  .prompt-studio {
    width: min(1380px, calc(100% - 48px));
  }
}

@media (max-width: 1080px) {
  .prompt-studio {
    height: auto;
    grid-template-columns: 1fr;
  }

  .prompt-builder-panel {
    min-height: 520px;
    border-right: 0;
    border-bottom: 1px solid var(--line-soft);
  }

  .prompt-result-panel {
    min-height: 480px;
  }

  .conversation-panel {
    min-height: 500px;
  }

  .output-panel {
    min-height: 460px;
  }
}

@media (max-width: 720px) {
  .site-header,
  main,
  footer {
    width: min(100% - 24px, 1380px);
  }

  .site-header {
    height: 106px;
    padding-top: 12px;
    align-items: flex-start;
    grid-template-columns: 1fr auto;
  }

  .mode-nav {
    grid-column: 1 / -1;
    justify-self: stretch;
    width: 100%;
  }

  .mode-nav button {
    flex: 1;
  }

  .brand-mark {
    width: 36px;
    height: 36px;
  }

  .brand strong {
    font-size: 14px;
  }

  .brand small {
    display: none;
  }

  .ghost-button {
    width: 38px;
    padding: 0;
  }

  .ghost-button span {
    display: none;
  }

  .hero {
    min-height: 0;
    padding: 24px 10px 18px;
    align-items: center;
    flex-direction: column;
    gap: 8px;
    text-align: center;
  }

  .hero-kicker {
    justify-content: center;
    font-size: 7px;
  }

  .hero h1 {
    font-size: clamp(30px, 10vw, 40px);
  }

  .hero h1 em {
    margin-left: 7px;
  }

  .hero p {
    max-width: 390px;
    font-size: 11px;
  }

  .studio-shell {
    border-radius: 21px;
  }

  .prompt-studio {
    width: min(100% - 24px, 1380px);
    border-radius: 21px;
  }

  .prompt-builder-body,
  .prompt-result-body {
    padding: 20px 16px;
  }

  .prompt-options {
    grid-template-columns: 1fr;
  }

  .prompt-builder-panel {
    min-height: 720px;
  }

  .prompt-result-panel {
    min-height: 460px;
  }

  .prompt-result-actions {
    flex-direction: column;
  }

  .prompt-result-actions button {
    justify-content: center;
  }

  .conversation-panel {
    min-height: 520px;
  }

  .panel-header {
    min-height: 58px;
    padding: 0 16px;
  }

  .chat-messages {
    padding: 18px 16px;
  }

  .prompt-suggestions {
    grid-template-columns: 1fr;
  }

  .prompt-suggestions button {
    min-height: 48px;
  }

  .composer {
    margin: 12px;
  }

  .composer-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .composer-right {
    grid-template-columns: 1fr;
    justify-content: stretch;
  }

  .model-picker,
  .ratio-picker,
  .size-picker {
    max-width: none;
  }

  .ratio-picker,
  .size-picker {
    flex: 1;
  }

  .ratio-picker button {
    flex: 1;
  }

  .generate-button {
    min-height: 34px;
  }

  .output-panel {
    min-height: 540px;
  }

  .output-body {
    padding: 14px;
  }

  .result-image-button img {
    max-height: 430px;
  }

  .result-actions {
    padding: 10px;
    align-items: stretch;
    flex-direction: column;
  }

  .result-actions > div {
    align-self: flex-end;
  }

  .workspace-notes {
    padding-top: 13px;
    flex-direction: column;
    gap: 6px;
  }

  footer {
    min-height: 76px;
  }

  footer small {
    display: none;
  }

  .config-dialog {
    padding: 30px 22px 22px;
  }

  .lightbox {
    padding: 10px;
  }

  .lightbox-dialog {
    width: 100%;
  }
}

@media (max-width: 420px) {
  .new-chat-button {
    width: 34px;
    padding: 0;
    font-size: 0;
  }

  .ratio-picker > span {
    display: none;
  }

  .generate-button {
    padding: 0 11px;
  }

  .generate-button .generate-button-copy {
    display: grid;
  }

  .generate-button .generate-button-copy b {
    display: none;
  }

  .turn-images img {
    height: 58px;
  }
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f7f8fc;
  --panel: rgba(255, 255, 255, .38);
  --panel-strong: rgba(255, 255, 255, .68);
  --line: rgba(35, 45, 78, .13);
  --line-soft: rgba(35, 45, 78, .09);
  --text: #171c31;
  --muted: rgba(35, 43, 70, .62);
  --muted-2: rgba(35, 43, 70, .58);
  --shadow: 0 22px 70px rgba(60, 70, 108, .12);
}

html[data-theme="light"] body {
  color: var(--text);
  background: #f7f8fc;
}

html[data-theme="light"] #starfield {
  visibility: hidden;
  opacity: 0;
  animation: none;
}

html[data-theme="light"] body::before {
  background:
    radial-gradient(circle at 15% 5%, rgba(132, 116, 255, .12), transparent 30%),
    radial-gradient(circle at 90% 18%, rgba(59, 196, 216, .1), transparent 27%),
    linear-gradient(180deg, rgba(255, 255, 255, .98), rgba(246, 248, 253, .98));
}

html[data-theme="light"] .site-header,
html[data-theme="light"] .studio-shell,
html[data-theme="light"] .prompt-studio,
html[data-theme="light"] .panel-header,
html[data-theme="light"] footer {
  border-color: var(--line);
}

html[data-theme="light"] .mode-nav,
html[data-theme="light"] .theme-control,
html[data-theme="light"] .theme-setting-row,
html[data-theme="light"] .ghost-button,
html[data-theme="light"] .icon-button,
html[data-theme="light"] .new-chat-button,
html[data-theme="light"] .upload-button,
html[data-theme="light"] .credit-badge,
html[data-theme="light"] .recharge-button,
html[data-theme="light"] .redeem-code-button {
  border-color: rgba(45, 56, 92, .14);
  color: rgba(27, 34, 58, .72);
  background: rgba(255, 255, 255, .42);
  box-shadow: 0 8px 24px rgba(68, 77, 112, .06);
}

html[data-theme="light"] .theme-setting-row select {
  border-color: rgba(45, 56, 92, .14);
  color: #171c31;
  background:
    linear-gradient(45deg, transparent 50%, rgba(35, 43, 70, .72) 50%) right 12px center / 6px 6px no-repeat,
    rgba(255, 255, 255, .58);
}

html[data-theme="light"] .mode-nav button {
  color: rgba(35, 43, 70, .55);
}

html[data-theme="light"] .mode-nav button:hover,
html[data-theme="light"] .ghost-button:hover,
html[data-theme="light"] .icon-button:hover,
html[data-theme="light"] .new-chat-button:hover,
html[data-theme="light"] .upload-button:hover {
  color: #171c31;
  background: rgba(124, 107, 244, .08);
}

html[data-theme="light"] .mode-nav button.active {
  color: #312866;
  background: linear-gradient(110deg, rgba(126, 104, 241, .16), rgba(50, 174, 207, .08));
}

html[data-theme="light"] .brand-mark {
  background: linear-gradient(145deg, rgba(144, 130, 255, .13), rgba(67, 207, 222, .06));
  box-shadow: inset 0 0 20px rgba(116, 102, 255, .05);
}

html[data-theme="light"] .panel-title strong,
html[data-theme="light"] .chat-empty strong,
html[data-theme="light"] .output-empty strong,
html[data-theme="light"] .prompt-result-empty strong,
html[data-theme="light"] .prompt-result-loading strong,
html[data-theme="light"] .prompt-result-error strong,
html[data-theme="light"] .generation-loading strong,
html[data-theme="light"] .result-actions strong,
html[data-theme="light"] .history-info strong,
html[data-theme="light"] .config-dialog h2,
html[data-theme="light"] .lightbox-dialog strong {
  color: rgba(24, 30, 52, .86);
}

html[data-theme="light"] .prompt-suggestions button,
html[data-theme="light"] .chat-bubble,
html[data-theme="light"] .composer,
html[data-theme="light"] .model-picker,
html[data-theme="light"] .ratio-picker,
html[data-theme="light"] .size-picker,
html[data-theme="light"] .history-item {
  border-color: rgba(35, 45, 78, .12);
  background: rgba(255, 255, 255, .26);
  box-shadow: none;
}

html[data-theme="light"] .composer:focus-within,
html[data-theme="light"] .composer.dragover {
  border-color: rgba(115, 96, 225, .38);
  background: rgba(255, 255, 255, .48);
  box-shadow: 0 0 0 3px rgba(126, 108, 255, .06);
}

html[data-theme="light"] .composer textarea,
html[data-theme="light"] .chat-bubble p,
html[data-theme="light"] .prompt-suggestions button strong,
html[data-theme="light"] .prompt-count b,
html[data-theme="light"] .model-picker > span,
html[data-theme="light"] .ratio-picker > span,
html[data-theme="light"] .size-picker > span,
html[data-theme="light"] .prompt-idea-field > span,
html[data-theme="light"] .prompt-options label > span {
  color: rgba(25, 31, 54, .78);
}

html[data-theme="light"] .composer textarea::placeholder,
html[data-theme="light"] .prompt-idea-field textarea::placeholder {
  color: rgba(39, 47, 75, .56);
}

html[data-theme="light"] .model-picker > select,
html[data-theme="light"] .ratio-picker > select,
html[data-theme="light"] .size-picker > select {
  border-color: rgba(35, 45, 78, .1);
  color: rgba(25, 31, 54, .88);
  background:
    linear-gradient(45deg, transparent 50%, rgba(35, 43, 70, .7) 50%) right 10px center / 6px 6px no-repeat,
    rgba(255, 255, 255, .44);
}

html[data-theme="light"] .model-picker > select option,
html[data-theme="light"] .ratio-picker > select option,
html[data-theme="light"] .size-picker > select option,
html[data-theme="light"] .prompt-options select option {
  color: #171c31;
  background: #fff;
}

html[data-theme="light"] .prompt-idea-field textarea,
html[data-theme="light"] .prompt-result-content textarea,
html[data-theme="light"] .prompt-options select,
html[data-theme="light"] .redeem-form input {
  border-color: rgba(35, 45, 78, .13);
  color: #171c31;
  background: rgba(255, 255, 255, .48);
  box-shadow: inset 0 1px 12px rgba(52, 61, 95, .04);
}

html[data-theme="light"] .prompt-idea-field textarea:focus,
html[data-theme="light"] .prompt-result-content textarea:focus {
  background: rgba(255, 255, 255, .72);
}

html[data-theme="light"] .history-drawer,
html[data-theme="light"] .config-dialog,
html[data-theme="light"] .lightbox-dialog {
  border-color: rgba(35, 45, 78, .13);
  color: var(--text);
  background:
    radial-gradient(circle at 85% 4%, rgba(110, 91, 232, .08), transparent 31%),
    rgba(255, 255, 255, .82);
  box-shadow: 0 28px 90px rgba(60, 70, 108, .16);
}

html[data-theme="light"] .drawer-backdrop,
html[data-theme="light"] .modal-backdrop,
html[data-theme="light"] .lightbox {
  background: rgba(229, 233, 244, .62);
}

html[data-theme="light"] .toast {
  border-color: rgba(35, 45, 78, .13);
  color: var(--text);
  background: rgba(255, 255, 255, .92);
  box-shadow: 0 18px 54px rgba(60, 70, 108, .16);
}

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