:root {
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", sans-serif;
  background: var(--multi-view-page-bg, #f5f5f7);
  color: #1d1d1f;
  --multi-view-page-bg: #f5f5f7;
  --multi-view-page-gradient-start: #ffffff;
  --multi-view-accent-focus: rgba(0, 102, 204, 0.24);
  --surface: rgba(255, 255, 255, 0.92);
  --surface-strong: #ffffff;
  --border: #d2d2d7;
  --border-soft: #e5e5ea;
  --text: #1d1d1f;
  --muted: #6e6e73;
  --accent: #0066cc;
  --danger: #b42318;
  --composer-height: 190px;
  --composer-bottom: 28px;
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background:
    linear-gradient(180deg, var(--multi-view-page-gradient-start) 0, var(--multi-view-page-bg) 210px),
    var(--multi-view-page-bg);
}

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

button,
select,
textarea,
label {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
input:focus-visible,
a:focus-visible {
  outline: 3px solid var(--multi-view-accent-focus);
  outline-offset: 3px;
}

select:focus,
textarea:focus {
  outline: 0;
  box-shadow: none;
}

.app-shell {
  min-height: 100vh;
  padding: 64px clamp(20px, 5vw, 80px) 0;
}

.return-workflow-link {
  position: fixed;
  top: 20px;
  left: clamp(20px, 5vw, 80px);
  z-index: 60;
  display: inline-flex;
  align-items: center;
  max-width: calc(100vw - 40px);
  min-height: 38px;
  gap: 6px;
  padding: 0 12px 0 10px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.08);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  transition: background 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.return-workflow-link svg {
  display: block;
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.return-workflow-link path {
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.return-workflow-link span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.return-workflow-link:hover {
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.1);
  transform: translateY(-1px);
}

.return-workflow-link:active {
  transform: translateY(0);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.08);
}

.empty-hero-stage {
  display: grid;
  min-height: var(
    --empty-stage-height,
    calc(100vh - var(--composer-height) - var(--composer-bottom))
  );
  align-content: center;
  justify-items: center;
  gap: 8px;
}

.app-shell.is-initializing .empty-hero-stage {
  visibility: hidden;
}

.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 20px;
  margin-top: 0;
  margin-bottom: 8px;
  text-align: center;
  transition: justify-content 180ms ease, margin-top 180ms ease, text-align 180ms ease, opacity 180ms ease;
}

.app-shell.has-results .topbar {
  min-height: 38px;
  align-items: center;
  justify-content: center;
  margin-top: 0;
  margin-bottom: 28px;
  text-align: center;
}

.app-shell.has-results {
  padding: 28px clamp(20px, 5vw, 80px) 260px;
}

body.has-multi-view-results .return-workflow-link {
  top: 28px;
}

.app-shell.has-results .empty-hero-stage {
  display: block;
  min-height: 0;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  max-width: 760px;
  font-size: clamp(30px, 3.1vw, 42px);
  line-height: 1.04;
  letter-spacing: 0;
}

.hero-subtitle {
  max-width: 560px;
  margin: 8px auto 0;
  color: #6e6e73;
  font-size: 16px;
  line-height: 1.55;
}

.app-shell.has-results h1 {
  max-width: 280px;
  font-size: 19px;
  line-height: 1.12;
  font-weight: 700;
}

.app-shell.has-results .eyebrow {
  margin-bottom: 5px;
  font-size: 10px;
  opacity: 0.72;
}

.app-shell.has-results .hero-subtitle {
  display: none;
}

h2 {
  font-size: 17px;
  line-height: 1.25;
}

p {
  color: var(--muted);
  line-height: 1.55;
}

.primary-button,
.secondary-button,
.text-button,
.icon-button {
  cursor: pointer;
}

.primary-button {
  min-height: 44px;
  padding: 0 18px;
  border: 0;
  border-radius: 999px;
  background: var(--text);
  color: #ffffff;
  font-weight: 400;
  transition: background 180ms ease, color 180ms ease, transform 180ms ease;
}

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

.primary-button:disabled {
  background: #ececf0;
  color: #86868b;
  cursor: not-allowed;
}

.secondary-button {
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-strong);
  color: var(--text);
  transition: border-color 180ms ease, box-shadow 180ms ease;
}

.secondary-button:hover {
  border-color: #a1a1a6;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.06);
}

.text-button {
  border: 0;
  background: transparent;
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
}

.icon-button {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: #f1f1f3;
  color: #515154;
  transition: background 180ms ease, box-shadow 180ms ease, color 180ms ease, transform 180ms ease;
}

.icon-button:hover {
  background: #e0e0e5;
  color: #1d1d1f;
  box-shadow: none;
  transform: scale(1.06);
}

.icon-button:active {
  transform: scale(1);
  box-shadow: none;
}

.modal-close-icon {
  display: block;
  width: 18px;
  height: 18px;
  pointer-events: none;
}

.modal-close-icon path {
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
}

.result-gallery {
  display: grid;
  width: 100%;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  align-items: start;
  margin: 0 auto;
}

.app-shell.has-results .result-gallery {
  margin-left: 0;
  margin-right: 0;
}

.gallery-empty {
  grid-column: 1 / -1;
  display: grid;
  width: 100%;
  min-height: 0;
  align-content: center;
  justify-items: center;
  gap: 8px;
  padding: 16px clamp(16px, 3vw, 30px) 0;
  background: transparent;
}

.gallery-empty[hidden] {
  display: none;
}

.gallery-empty strong {
  color: var(--text);
  font-size: 21px;
  line-height: 1.35;
}

.gallery-empty span:last-child {
  color: var(--muted);
  line-height: 1.6;
}

.empty-preview {
  display: grid;
  width: min(500px, 100%);
  justify-items: center;
  cursor: default;
}

.preview-angle-row {
  display: grid;
  grid-template-columns: repeat(5, minmax(72px, 86px));
  justify-content: center;
  gap: clamp(2px, 0.4vw, 5px);
  align-items: end;
}

.angle-thumb {
  display: grid;
  width: 86px;
  justify-self: center;
  place-items: center;
  gap: 5px;
  padding: 4px;
  color: #6e6e73;
  font-size: 13px;
  line-height: 1;
  text-align: center;
  transition: opacity 220ms ease, transform 220ms ease;
}

.angle-thumb svg {
  display: block;
  width: 86px;
  height: 81px;
  overflow: visible;
  filter: drop-shadow(0 16px 18px rgba(0, 0, 0, 0.08));
  transition: filter 220ms ease, opacity 220ms ease, transform 220ms ease;
}

.angle-thumb rect {
  fill: #ffffff;
  stroke: #86868b;
  stroke-width: 1.8;
}

.angle-thumb .shape-fill {
  fill: #ffffff;
  stroke: #86868b;
  stroke-width: 1.8;
}

.angle-thumb path {
  fill: none;
  stroke: #86868b;
  stroke-linecap: round;
  stroke-width: 1.8;
}

.angle-thumb ellipse {
  fill: #1d1d1f;
  opacity: 0.08;
}

.angle-thumb:hover {
  color: #1d1d1f;
  transform: translateY(-6px);
}

.angle-thumb:hover rect,
.angle-thumb:hover .shape-fill {
  stroke: #1d1d1f;
}

.angle-thumb:hover svg {
  filter: drop-shadow(0 20px 24px rgba(0, 0, 0, 0.1));
}

.result-card {
  position: relative;
  display: grid;
  gap: 10px;
  padding: 10px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.06);
}

.result-card-actions {
  position: absolute;
  top: 18px;
  right: 18px;
  z-index: 2;
  display: flex;
  gap: 6px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-4px);
  transition: opacity 160ms ease, transform 160ms ease;
}

.result-card:hover .result-card-actions,
.result-card:focus-within .result-card-actions {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.result-card-actions.is-attaching .result-action-button:not(.result-attach-button) {
  opacity: 0;
  pointer-events: none;
}

.result-action-button {
  min-height: 30px;
  padding: 0 10px;
  border: 0;
  border-radius: 999px;
  background: rgba(29, 29, 31, 0.82);
  color: #ffffff;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  backdrop-filter: blur(12px);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.18);
}

.result-action-button:hover,
.result-action-button:focus-visible {
  outline: 0;
  background: #1d1d1f;
}

.result-card.is-pending,
.result-card.is-queued,
.result-card.is-running,
.result-card.is-failed {
  align-items: center;
}

.result-card.is-failed {
  min-height: 0;
  align-items: stretch;
}

.result-state-card {
  display: grid;
  min-height: 0;
  place-items: center;
  align-content: center;
  gap: 10px;
  padding: 26px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 16px;
  background: #ffffff;
  color: var(--muted);
  text-align: center;
}

.result-card.is-pending .result-state-card,
.result-card.is-queued .result-state-card,
.result-card.is-running .result-state-card {
  aspect-ratio: 16 / 10;
  border: 0;
}

.result-card.is-failed .result-state-card {
  min-height: auto;
  aspect-ratio: 16 / 10;
  border: 0;
}

.result-state-card strong {
  color: var(--text);
  font-size: 17px;
}

.result-state-card span:last-child {
  max-width: 260px;
  font-size: 13px;
  line-height: 1.5;
}

.result-queue-detail {
  color: var(--muted);
}

.result-queue-detail::after {
  display: inline-block;
  min-width: 1.1em;
  content: "";
  text-align: left;
  animation: result-queue-dots 1.2s steps(4, end) infinite;
}

.result-spinner {
  width: 30px;
  height: 30px;
  border: 3px solid #e5e5ea;
  border-top-color: #1d1d1f;
  border-radius: 50%;
  animation: result-spin 0.9s linear infinite;
}

.history-load-more {
  grid-column: 1 / -1;
  display: flex;
  min-height: 1px;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 0;
  color: var(--muted);
}

.history-load-more[hidden] {
  display: none;
}

.history-load-more.is-loading {
  min-height: 58px;
  margin-top: 2px;
  padding: 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.04);
}

.history-load-spinner {
  display: none;
  width: 22px;
  height: 22px;
  border: 2px solid #e5e5ea;
  border-top-color: #1d1d1f;
  border-radius: 50%;
  animation: result-spin 0.9s linear infinite;
}

.history-load-more.is-loading .history-load-spinner {
  display: block;
}

.history-load-text {
  font-size: 14px;
  line-height: 1.4;
}

.result-failed-mark {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 50%;
  background: #fff1f0;
  color: #c62828;
  font-weight: 700;
}

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

@keyframes result-queue-dots {
  0% {
    content: "";
  }
  25% {
    content: ".";
  }
  50% {
    content: "..";
  }
  75%,
  100% {
    content: "...";
  }
}

.result-image-button {
  display: block;
  width: 100%;
  overflow: hidden;
  padding: 0;
  border: 0;
  border-radius: 16px;
  background: #ffffff;
  cursor: zoom-in;
}

.result-image-button img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: contain;
  background: #ffffff;
}

.result-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
}

.result-meta strong {
  color: var(--text);
}

.result-meta-placeholder {
  visibility: hidden;
  pointer-events: none;
}

.creation-module {
  position: fixed;
  left: 50%;
  bottom: var(--composer-bottom);
  z-index: 20;
  display: grid;
  height: var(--composer-height);
  width: min(900px, calc(100% - 56px));
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 8px;
  padding: 12px;
  border: 0;
  border-radius: 20px;
  background: var(--surface);
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.14);
  backdrop-filter: blur(22px);
  transform: translateX(-50%);
}

.composer-topline {
  display: grid;
  min-height: 0;
  grid-template-columns: var(--upload-column-width, 60px) minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  transition: grid-template-columns 180ms ease;
}

.upload-stack {
  position: relative;
  display: block;
  width: 60px;
  max-width: 100%;
  aspect-ratio: 9 / 16;
  min-height: 0;
  place-items: center;
  gap: 6px;
  padding: 12px;
  border-radius: 16px;
  background: #f7f7f9;
  color: var(--muted);
  cursor: pointer;
  transition: background 180ms ease, transform 180ms ease;
}

.upload-stack:focus-within {
  outline: 0;
}

.upload-stack.is-dragover {
  background: #eef6ff;
  transform: translateY(-1px);
}

.upload-stack:not(.has-images):hover {
  background: #f3f3f6;
  transform: translateY(-1px) scale(1.025);
}

.upload-stack.has-images {
  width: var(--upload-column-width, 60px);
  height: 106px;
  aspect-ratio: auto;
  padding: 0;
  background: transparent;
  overflow: visible;
  z-index: 2;
}

.upload-stack input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.upload-add {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 1;
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 50%;
  background: transparent;
  color: #515154;
  font-size: 23px;
  line-height: 1;
  transform: translate(-50%, -50%);
}

.upload-stack.has-images .upload-add {
  display: none;
}

.thumbnail-stack {
  position: relative;
  display: flex;
  min-height: 64px;
  align-items: center;
  justify-content: center;
  overflow: visible;
  width: 100%;
}

.thumbnail-stack.has-images {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 0;
  justify-content: flex-start;
  overflow: visible;
  padding: 0;
  scrollbar-width: none;
}

.thumbnail-stack.has-images::before {
  position: absolute;
  inset: -10px auto -10px -10px;
  width: calc(100% + 20px);
  content: "";
}

.thumbnail-stack.has-images:hover::before {
  width: var(--expanded-hover-width, calc(100% + 20px));
}

.thumbnail-stack.has-images::-webkit-scrollbar {
  display: none;
}

.thumbnail-item {
  position: absolute;
  top: 0;
  left: 0;
  display: block;
  width: 60px;
  height: 106px;
  overflow: hidden;
  border-radius: 16px;
  background: #ffffff;
  box-shadow: 0 9px 24px rgba(0, 0, 0, 0.14);
  transform: translateX(calc(var(--stack-index) * 10px)) rotate(calc((var(--stack-index) - 1) * 2deg));
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.thumbnail-stack:hover .thumbnail-item,
.upload-stack:focus-within .thumbnail-item {
  transform: translateX(calc(var(--stack-index) * (60px + 10px))) rotate(0deg) scale(1.035);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.16);
}

.thumbnail-item.single-thumbnail {
  transform: none;
}

.thumbnail-stack:hover .thumbnail-item.single-thumbnail,
.upload-stack:focus-within .thumbnail-item.single-thumbnail {
  transform: none;
}

.thumbnail-stack:hover .thumbnail-item:hover {
  z-index: 8;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.19);
}

.thumbnail-stack:hover,
.upload-stack:focus-within .thumbnail-stack {
  z-index: 4;
}

.thumbnail-item img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #ffffff;
  transition: transform 180ms ease;
}

.thumbnail-stack:hover .thumbnail-item:hover img,
.thumbnail-item.single-thumbnail:hover img {
  transform: scale(1.045);
}

.thumbnail-remove {
  position: absolute;
  top: 5px;
  right: 5px;
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: transparent;
  cursor: pointer;
  padding: 0;
}

.thumbnail-remove svg {
  display: block;
  width: 22px;
  height: 22px;
  overflow: visible;
}

.thumbnail-remove circle {
  fill: rgba(0, 0, 0, 0.78);
}

.thumbnail-remove path {
  fill: none;
  stroke: #ffffff;
  stroke-linecap: round;
  stroke-width: 1.7;
}

.prompt-wrap {
  display: grid;
  position: relative;
  min-height: 0;
  min-width: 0;
}

.prompt-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 28px;
}

#resultStatus {
  min-width: 0;
  color: var(--muted);
  font-size: 14px;
}

#resultStatus.error {
  color: var(--danger);
}

.toast-message {
  position: fixed;
  top: 18px;
  left: 50%;
  z-index: 80;
  max-width: min(420px, calc(100% - 40px));
  padding: 10px 14px;
  border: 0;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.78);
  color: #ffffff;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.18);
  font-size: 14px;
  line-height: 1.35;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -18px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast-message.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.toast-message[hidden] {
  display: none;
}

.account-dock {
  position: fixed;
  left: 8px;
  bottom: 40px;
  z-index: 60;
  display: grid;
  justify-items: center;
  width: 78px;
  padding: 0 10px;
}

.account-dock::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 100%;
  height: 16px;
}

.account-menu-trigger {
  position: relative;
  display: grid;
  width: 58px;
  height: 34px;
  place-items: center;
  border: 0;
  border-radius: 16px;
  background: transparent;
  color: var(--muted);
  box-shadow: none;
  cursor: pointer;
  transition: color 160ms ease;
}

.account-menu-trigger:hover,
.account-dock:focus-within .account-menu-trigger {
  color: var(--accent);
  outline: none;
}

.account-menu-trigger svg {
  display: block;
  width: 24px;
  height: 16px;
}

.account-menu-trigger path,
.account-icon-button path {
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
}

.account-unread-badge {
  position: absolute;
  top: -3px;
  right: -3px;
  display: grid;
  min-width: 18px;
  height: 18px;
  place-items: center;
  padding: 0 5px;
  border: 2px solid #ffffff;
  border-radius: 999px;
  background: #ff3b30;
  color: #ffffff;
  font-size: 11px;
  line-height: 1;
}

.account-unread-badge[hidden] {
  display: none;
}

.account-popover {
  position: absolute;
  left: 10px;
  bottom: calc(100% + 10px);
  display: grid;
  width: 236px;
  gap: 6px;
  padding: 8px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.18);
  backdrop-filter: blur(22px);
  opacity: 0;
  pointer-events: none;
  transform: translateY(4px);
  transition: opacity 140ms ease, transform 140ms ease;
}

.account-dock:hover .account-popover,
.account-dock:focus-within .account-popover {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.account-popover[hidden],
.account-panel[hidden],
.announcement-panel[hidden],
.account-menu-item[hidden],
.account-balance-row[hidden] {
  display: none;
}

.account-summary {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
}

.account-summary strong {
  color: var(--text);
  font-size: 15px;
}

.account-summary span,
.account-item-meta {
  color: var(--muted);
  font-size: 12px;
}

.account-menu-item,
.account-balance-row {
  display: flex;
  min-height: 38px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 12px;
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  text-align: left;
  text-decoration: none;
}

.account-menu-item {
  cursor: pointer;
}

.account-menu-item:hover,
.account-menu-item:focus-visible {
  outline: 0;
  background: #f5f5f7;
}

.account-balance-row {
  background: #f5f5f7;
  color: var(--muted);
}

.account-balance-row strong {
  color: var(--text);
  font-size: 14px;
}

.account-panel,
.announcement-panel {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  padding: 20px;
}

.account-panel {
  pointer-events: none;
}

.account-auth-card,
.announcement-card {
  position: relative;
  z-index: 1;
  display: grid;
  width: min(420px, 100%);
  gap: 14px;
  padding: 18px;
  border-radius: 22px;
  background: #ffffff;
  box-shadow: 0 30px 100px rgba(0, 0, 0, 0.22);
  pointer-events: auto;
}

.account-auth-card label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
}

.account-auth-card input {
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #ffffff;
  color: var(--text);
}

.account-panel-head,
.announcement-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.account-panel-head h2,
.announcement-head h2 {
  margin: 0 0 4px;
  color: var(--text);
  font-size: 18px;
}

.account-panel-head p,
.announcement-head p {
  font-size: 13px;
}

.account-icon-button {
  display: grid;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: #f1f1f3;
  color: #515154;
  cursor: pointer;
}

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

.account-panel-actions {
  display: flex;
  justify-content: flex-end;
}

.account-message {
  min-height: 18px;
  color: var(--muted);
  font-size: 13px;
}

.account-message.warn {
  color: var(--danger);
}

.announcement-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(0, 0, 0, 0.32);
}

.announcement-body {
  max-height: min(360px, 56vh);
  overflow: auto;
  color: var(--text);
  font-size: 14px;
  line-height: 1.65;
  white-space: pre-wrap;
}

textarea {
  width: 100%;
  min-height: 106px;
  max-height: 106px;
  resize: none;
  padding: 14px 14px 14px calc(14px + var(--prompt-image-offset, 0px));
  border: 0;
  border-radius: 16px;
  color: var(--text);
  background: transparent;
  line-height: 1.65;
  transition: padding-left 180ms ease;
}

.prompt-hint {
  position: absolute;
  top: 14px;
  left: calc(14px + var(--prompt-image-offset, 0px));
  right: 14px;
  color: var(--muted);
  line-height: 1.65;
  pointer-events: none;
  transition: left 180ms ease;
}

.prompt-hint[hidden] {
  display: none;
}

.composer-footer {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  font-size: 15px;
  margin-bottom: 0;
}

.model-control {
  display: block;
  flex: 0 0 auto;
  width: auto;
}

.select-shell {
  position: relative;
  display: inline-block;
  min-height: 40px;
}

.native-model-select {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

.model-select-button {
  display: grid;
  width: max-content;
  min-height: 40px;
  grid-template-columns: auto auto 14px;
  align-items: center;
  gap: 7px;
  padding: 0 16px;
  border: 0;
  border-radius: 999px;
  background: #f1f1f3;
  color: var(--text);
  cursor: pointer;
  font: inherit;
  text-align: left;
}

.model-selected-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.select-caret {
  width: 8px;
  height: 8px;
  justify-self: end;
  border-right: 1.5px solid var(--text);
  border-bottom: 1.5px solid var(--text);
  pointer-events: none;
  transform: rotate(45deg) translateY(-2px);
}

.model-options {
  position: absolute;
  left: 0;
  bottom: calc(100% + 8px);
  z-index: 30;
  display: grid;
  width: max-content;
  min-width: 100%;
  gap: 4px;
  padding: 6px;
  border-radius: 18px;
  background: #ffffff;
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.16);
}

.model-options[hidden] {
  display: none;
}

.model-options button {
  display: grid;
  min-width: 100%;
  min-height: 36px;
  grid-template-columns: minmax(0, 1fr) 16px;
  align-items: center;
  gap: 14px;
  border: 0;
  border-radius: 13px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font: inherit;
  text-align: left;
  padding: 0 12px;
}

.model-options-title {
  padding: 5px 12px 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
  line-height: 1.2;
  white-space: nowrap;
}

.model-options button:hover,
.model-options button:focus-visible {
  outline: 0;
  background: #f5f5f7;
}

.model-options button.is-selected {
  background: #f5f5f7;
}

.model-options button::after {
  width: 14px;
  height: 14px;
  content: "";
}

.model-options button.is-selected::after {
  background: currentColor;
  mask: url("data:image/svg+xml,%3Csvg viewBox='0 0 14 14' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M5.45 10.2 2.2 6.95l1.05-1.05 2.2 2.2 5.3-5.3 1.05 1.05-6.35 6.35Z'/%3E%3C/svg%3E") center / contain no-repeat;
}

.field-label {
  display: block;
  margin: 0;
  color: var(--text);
  font-size: inherit;
  font-weight: 400;
  white-space: nowrap;
}

.composer-status {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  color: var(--muted);
  font-size: 13px;
}

.composer-status:not(:empty) {
  display: block;
}

.composer-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 148px;
  margin-left: auto;
}

.credit-cost {
  display: inline-block;
  min-width: 66px;
  color: var(--muted);
  font-size: 13px;
  text-align: right;
  white-space: nowrap;
}

.credit-cost.is-warning {
  color: #c6372f;
}

.credit-cost[hidden] {
  display: inline-block;
  visibility: hidden;
}

.segmented-control {
  display: grid;
  width: 210px;
  min-width: 210px;
  grid-template-columns: repeat(3, 1fr);
  gap: 3px;
  padding: 4px;
  border-radius: 999px;
  background: #f1f1f3;
  contain: layout paint;
}

.segmented-control button {
  min-height: 32px;
  padding: 0 10px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.segmented-control .active {
  background: #ffffff;
  color: var(--text);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.composer-footer .primary-button {
  display: grid;
  width: 40px;
  height: 40px;
  min-height: 40px;
  place-items: center;
  padding: 0;
  border-radius: 50%;
  background: #111113;
  color: #ffffff;
  line-height: 1;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.12);
  transition: background 180ms ease, box-shadow 180ms ease, color 180ms ease, transform 180ms ease;
}

.composer-footer .primary-button:not(:disabled):hover {
  background: #000000;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.16);
  transform: translateY(-1px);
}

.composer-footer .primary-button:focus-visible {
  outline: 2px solid rgba(0, 0, 0, 0.2);
  outline-offset: 3px;
}

.composer-footer .primary-button:disabled {
  background: #e1e1e6;
  color: #ffffff;
  box-shadow: none;
  cursor: not-allowed;
}

.generate-arrow-icon {
  display: block;
  width: 22px;
  height: 22px;
  pointer-events: none;
}

.generate-arrow-icon path {
  fill: none;
  stroke: currentColor;
  stroke-width: 2.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.upload-summary {
  color: var(--muted);
  font-size: 13px;
}

.upload-summary:empty {
  display: none;
}

.image-modal {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: none;
  place-items: center;
  padding: 28px;
}

.image-modal.is-open {
  display: grid;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(0, 0, 0, 0.42);
  cursor: zoom-out;
}

.modal-dialog {
  position: relative;
  z-index: 1;
  display: grid;
  width: min(1180px, 100%);
  max-height: min(860px, calc(100vh - 56px));
  gap: 14px;
  padding: 16px;
  border-radius: 20px;
  background: #ffffff;
  box-shadow: 0 30px 120px rgba(0, 0, 0, 0.28);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.modal-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

#attachReferenceButton,
#downloadButton {
  height: 38px;
  min-height: 38px;
  padding: 0 14px;
  border-radius: 999px;
  font-size: 15px;
  line-height: 1;
}

.modal-dialog img {
  display: block;
  width: 100%;
  max-height: calc(100vh - 180px);
  object-fit: contain;
  border-radius: 16px;
  background: #ffffff;
}

@media (max-width: 920px) {
  :root {
    --composer-bottom: 14px;
  }

  .app-shell {
    padding: 58px 18px 0;
  }

  .return-workflow-link {
    top: 14px;
    left: 18px;
    max-width: calc(100vw - 36px);
    min-height: 36px;
    padding-right: 11px;
  }

  .topbar {
    margin-top: 0;
    margin-bottom: 8px;
  }

  .app-shell.has-results {
    padding: 20px 18px 360px;
  }

  .app-shell.has-results .topbar {
    min-height: 36px;
    margin-bottom: 20px;
  }

  body.has-multi-view-results .return-workflow-link {
    top: 20px;
  }

  .result-gallery {
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  }

  .gallery-empty {
    min-height: 0;
    padding: 14px 16px 0;
  }

  .empty-preview {
    width: min(430px, 100%);
  }

  .preview-angle-row {
    grid-template-columns: repeat(5, minmax(56px, 64px));
    gap: 4px;
  }

  .angle-thumb svg {
    width: 64px;
    height: 60px;
  }

  .angle-thumb {
    width: 64px;
  }

  .creation-module {
    height: auto;
    width: calc(100% - 24px);
  }

  .composer-topline {
    grid-template-columns: 1fr;
  }

  .upload-stack {
    width: 96px;
    aspect-ratio: 1 / 1;
  }

  .thumbnail-stack {
    min-height: 64px;
    overflow-x: auto;
    overflow-y: hidden;
  }

  .thumbnail-item,
  .thumbnail-stack:hover .thumbnail-item,
  .upload-stack:focus-within .thumbnail-item {
    position: relative;
    inset: auto;
    flex: 0 0 64px;
    width: 64px;
    height: 64px;
    margin-right: 8px;
    transform: none;
  }

  .composer-footer {
    align-items: stretch;
    grid-template-columns: 1fr;
  }

  .model-control {
    width: 100%;
  }

  .composer-status {
    min-height: 0;
  }

  .composer-actions {
    justify-content: stretch;
    margin-left: 0;
  }

  .segmented-control {
    width: 100%;
    min-width: 0;
  }
}

@media (max-width: 560px) {
  .app-shell {
    padding: 56px 12px 0;
  }

  .return-workflow-link {
    left: 12px;
    max-width: calc(100vw - 24px);
    font-size: 13px;
  }

  h1 {
    font-size: 31px;
  }

  .topbar {
    margin-top: 0;
    margin-bottom: 8px;
  }

  .app-shell.has-results {
    padding: 16px 12px 430px;
  }

  .app-shell.has-results .topbar {
    margin-bottom: 16px;
  }

  body.has-multi-view-results .return-workflow-link {
    top: 16px;
  }

  .hero-subtitle {
    margin-top: 7px;
    font-size: 14px;
  }

  .gallery-empty {
    min-height: 0;
    gap: 4px;
    padding: 10px 6px 0;
  }

  .empty-preview {
    width: min(340px, 100%);
  }

  .preview-angle-row {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 2px;
  }

  .angle-thumb {
    width: 48px;
    padding: 2px 4px;
    font-size: 11px;
  }

  .angle-thumb svg {
    width: 40px;
    height: 38px;
  }

  .angle-thumb:hover {
    transform: translateY(-2px);
  }

  .creation-module {
    padding: 12px;
  }

  .upload-stack {
    width: 76px;
    aspect-ratio: 1 / 1;
    justify-self: start;
  }

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

  .segmented-control,
  .primary-button {
    width: 100%;
  }

  .composer-footer .primary-button {
    width: 40px;
    min-width: 40px;
    align-self: flex-end;
  }

  .modal-header {
    align-items: stretch;
    flex-direction: column;
  }

  .modal-actions {
    justify-content: space-between;
  }
}

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