:root {
  color-scheme: light;
  --bg: #f3f5f8;
  --surface: #ffffff;
  --surface-muted: #f7f8fb;
  --text: #17202e;
  --muted: #697386;
  --line: #dbe1ea;
  --line-strong: #c5cfdd;
  --accent: #0f8b8d;
  --accent-strong: #0a6567;
  --accent-soft: #e5f6f6;
  --danger: #b42318;
  --warning: #a15c00;
  --success: #0a7a47;
  --shadow: 0 18px 48px rgba(27, 39, 61, 0.09);
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --sidebar: 284px;
  --font: Inter, "Segoe UI", "Microsoft YaHei", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    linear-gradient(90deg, rgba(15, 139, 141, 0.04) 1px, transparent 1px),
    linear-gradient(180deg, rgba(15, 139, 141, 0.04) 1px, transparent 1px),
    var(--bg);
  background-size: 40px 40px;
  font-family: var(--font);
}

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

button {
  cursor: pointer;
}

button:disabled,
input:disabled,
textarea:disabled,
select:disabled {
  cursor: not-allowed;
  opacity: 0.65;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--sidebar) minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 24px;
  background: #101820;
  color: #f6fbff;
}

.brand-block {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
}

.brand-mark {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 14px;
  background: #16343a;
  color: #8ff0e9;
  font-weight: 800;
  letter-spacing: 0;
}

.brand-block h1,
.brand-block p,
.topbar h2,
.panel-head h3 {
  margin: 0;
}

.brand-block h1 {
  font-size: 18px;
  line-height: 1.25;
}

.brand-block p {
  margin-top: 4px;
  color: #aebbc8;
  font-size: 13px;
}

.nav-list {
  display: grid;
  gap: 8px;
}

.nav-item {
  height: 44px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: #c5d1df;
  text-align: left;
}

.nav-item:hover,
.nav-item:focus-visible {
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.06);
  outline: none;
}

.nav-item.is-active {
  background: #e6f7f4;
  color: #0d3b3f;
}

.sidebar-note {
  margin-top: auto;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
}

.sidebar-note span {
  display: block;
  margin-bottom: 8px;
  color: #8ff0e9;
  font-size: 12px;
  font-weight: 700;
}

.sidebar-note p {
  margin: 0;
  color: #b7c3cf;
  font-size: 13px;
  line-height: 1.5;
}

.workspace {
  min-width: 0;
  padding: 28px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
}

.section-label {
  margin: 0 0 6px;
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 800;
}

.topbar h2 {
  font-size: clamp(24px, 3vw, 34px);
  line-height: 1.12;
}

.status-row,
.button-row,
.gallery-tools {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.status-row span {
  color: var(--muted);
  font-size: 14px;
}

.view {
  display: none;
}

.view.is-active {
  display: block;
}

body.home-active .workspace {
  padding: 0;
  background: #020406;
}

body.home-active .app-shell {
  display: block;
}

body.home-active .sidebar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 8;
  height: auto;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 22px;
  padding: 20px clamp(22px, 4vw, 56px);
  background: transparent;
  color: #fff;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-16px);
  transition: opacity 320ms ease, transform 320ms ease;
}

body.home-active:has(.home-stage.is-revealed) .sidebar {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

body.home-active .brand-block {
  grid-template-columns: 44px auto;
  width: max-content;
}

body.home-active .brand-mark {
  width: 44px;
  height: 44px;
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.08);
  color: var(--home-accent);
  backdrop-filter: blur(16px);
}

body.home-active .brand-block p {
  color: rgba(255, 255, 255, 0.68);
}

body.home-active .nav-list {
  justify-self: end;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

body.home-active .nav-item {
  width: auto;
  min-width: 76px;
  height: 40px;
  border-color: rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  padding: 0 16px;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.84);
  text-align: center;
  backdrop-filter: blur(16px);
}

body.home-active .nav-item:hover,
body.home-active .nav-item:focus-visible,
body.home-active .nav-item.is-active {
  border-color: rgba(255, 255, 255, 0.36);
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
}

body.home-active .sidebar-note {
  display: none;
}

body.home-active .topbar {
  display: none;
}

.home-stage {
  --home-accent: #ffd37a;
  position: relative;
  min-height: 100vh;
  overflow: hidden;
  isolation: isolate;
  background: #020406;
  color: #f9fbff;
  cursor: pointer;
}

.home-bg,
.home-canvas,
.home-shade {
  position: absolute;
  inset: 0;
}

.home-bg {
  z-index: -4;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.07);
  opacity: 0.72;
  filter: saturate(1.08) contrast(1.08);
  animation: home-pan 24s ease-in-out infinite alternate;
}

.home-bg-next {
  z-index: -3;
  opacity: 0;
  transition: opacity 820ms ease;
}

.home-stage.is-swapping .home-bg-next {
  opacity: 0.72;
}

.home-canvas {
  z-index: -2;
  width: 100%;
  height: 100%;
  opacity: 0.75;
}

.home-shade {
  z-index: -1;
  background:
    radial-gradient(circle at 58% 48%, rgba(255, 255, 255, 0.04), transparent 34%),
    linear-gradient(90deg, rgba(2, 4, 6, 0.76) 0%, rgba(2, 4, 6, 0.38) 42%, rgba(2, 4, 6, 0.72) 100%),
    linear-gradient(180deg, rgba(2, 4, 6, 0.18) 0%, rgba(2, 4, 6, 0.86) 100%);
}

.home-content {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(320px, 0.82fr) minmax(360px, 1.18fr);
  align-items: center;
  gap: clamp(20px, 5vw, 72px);
  padding: clamp(48px, 7vw, 96px) clamp(84px, 10vw, 148px) clamp(48px, 7vw, 96px) clamp(36px, 6vw, 92px);
}

.home-copy {
  max-width: 530px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(18px);
  transition: opacity 360ms ease, transform 360ms ease;
}

.home-stage.is-revealed .home-copy {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.home-kicker {
  margin: 0 0 16px;
  color: var(--home-accent);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

.home-copy h2 {
  margin: 0;
  max-width: 620px;
  color: #ffffff;
  font-size: clamp(42px, 5.8vw, 76px);
  line-height: 1.02;
  letter-spacing: 0;
}

.home-copy > p:not(.home-kicker) {
  max-width: 520px;
  margin: 22px 0 0;
  color: rgba(238, 246, 255, 0.78);
  font-size: clamp(15px, 1.4vw, 18px);
  line-height: 1.75;
}

.home-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 32px;
}

.home-primary,
.home-secondary {
  min-height: 46px;
  border-radius: 999px;
  padding: 0 22px;
  font-weight: 800;
}

.home-primary {
  border: 1px solid color-mix(in srgb, var(--home-accent) 74%, #ffffff 26%);
  background: var(--home-accent);
  color: #071014;
  box-shadow: 0 12px 34px color-mix(in srgb, var(--home-accent) 34%, transparent);
}

.home-secondary {
  border: 1px solid rgba(255, 255, 255, 0.24);
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  backdrop-filter: blur(16px);
}

.home-orb-wrap {
  position: relative;
  width: min(46vw, 620px);
  aspect-ratio: 1;
  justify-self: center;
  display: grid;
  place-items: center;
}

.home-orb {
  position: absolute;
  inset: 0;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 50%;
  background-position: center;
  background-size: cover;
  box-shadow:
    inset 0 0 80px rgba(255, 255, 255, 0.08),
    0 0 0 1px rgba(255, 255, 255, 0.08),
    0 40px 120px rgba(0, 0, 0, 0.38);
  transform: translateZ(0);
  animation: home-orb-float 10s ease-in-out infinite alternate;
}

.home-orb::before,
.home-orb::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
}

.home-orb::before {
  background:
    linear-gradient(115deg, rgba(255, 255, 255, 0.36), transparent 32%),
    radial-gradient(circle at 64% 24%, rgba(255, 255, 255, 0.18), transparent 22%),
    radial-gradient(circle at 36% 72%, rgba(0, 0, 0, 0.42), transparent 40%);
  mix-blend-mode: screen;
}

.home-orb::after {
  box-shadow:
    inset -28px -34px 80px rgba(0, 0, 0, 0.52);
}

.home-clock {
  position: relative;
  z-index: 3;
  width: min(42%, 230px);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 50%;
  background: rgba(4, 8, 12, 0.42);
  color: #ffffff;
  opacity: 1;
  transform: scale(1);
  backdrop-filter: blur(18px);
  transition: opacity 260ms ease, transform 260ms ease;
}

.home-clock strong {
  font-size: clamp(28px, 3.2vw, 46px);
  line-height: 1;
}

.home-clock span {
  color: rgba(255, 255, 255, 0.72);
  font-size: 13px;
}

.home-orb-wrap {
  width: min(52vw, 680px);
}

.home-stage .home-bg {
  opacity: 0.88;
  filter: saturate(1.16) contrast(1.12);
}

.home-stage .home-shade {
  background:
    radial-gradient(circle at 50% 48%, rgba(0, 0, 0, 0.04), transparent 26%),
    linear-gradient(90deg, rgba(2, 4, 6, 0.52), rgba(2, 4, 6, 0.16), rgba(2, 4, 6, 0.52)),
    linear-gradient(180deg, rgba(2, 4, 6, 0.08), rgba(2, 4, 6, 0.56));
}

.home-scene-rail {
  position: absolute;
  top: 50%;
  right: 22px;
  z-index: 4;
  display: grid;
  gap: 14px;
  transform: translateY(-50%);
}

.home-scene-dot {
  width: 44px;
  height: 44px;
  overflow: hidden;
  border: 2px solid rgba(255, 255, 255, 0.22);
  border-radius: 50%;
  padding: 2px;
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.2);
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.home-scene-dot img {
  width: 100%;
  height: 100%;
  display: block;
  border-radius: inherit;
  object-fit: cover;
}

.home-scene-dot:hover,
.home-scene-dot:focus-visible,
.home-scene-dot.is-active {
  border-color: #ffffff;
  transform: scale(1.08);
  box-shadow: 0 0 0 5px color-mix(in srgb, var(--home-accent) 22%, transparent), 0 16px 36px rgba(0, 0, 0, 0.28);
}

@keyframes home-pan {
  from {
    transform: scale(1.07) translate3d(-1.2%, -0.8%, 0);
  }

  to {
    transform: scale(1.13) translate3d(1.4%, 0.9%, 0);
  }
}

@keyframes home-orb-float {
  from {
    transform: translate3d(0, -10px, 0) scale(0.985);
  }

  to {
    transform: translate3d(0, 14px, 0) scale(1.015);
  }
}

.surface {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
}

.generate-layout,
.providers-layout {
  display: grid;
  grid-template-columns: minmax(420px, 0.95fr) minmax(360px, 1.05fr);
  gap: 20px;
  align-items: start;
}

.generator-panel,
.results-panel,
.providers-layout .surface,
.gallery-shell {
  padding: 20px;
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.panel-head h3 {
  font-size: 20px;
  line-height: 1.2;
}

.counter {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 10px;
  background: var(--surface-muted);
  color: var(--muted);
  font-size: 13px;
}

.segmented {
  display: inline-grid;
  grid-template-columns: repeat(2, minmax(72px, 1fr));
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-muted);
}

.segment {
  height: 34px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
}

.segment.is-active {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 5px rgba(22, 32, 46, 0.12);
}

.field {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}

.field.compact {
  min-width: 220px;
  flex: 1 1 240px;
  margin-bottom: 0;
}

.field > span {
  color: #394557;
  font-size: 13px;
  font-weight: 700;
}

input,
textarea,
select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  background: #fff;
  color: var(--text);
}

textarea {
  resize: vertical;
  line-height: 1.55;
}

input:focus,
textarea:focus,
select:focus,
button:focus-visible {
  border-color: var(--accent);
  outline: 3px solid rgba(15, 139, 141, 0.18);
}

.field-grid {
  display: grid;
  gap: 14px;
}

.field-grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.field-grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.field-grid.four {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.model-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.prompt-actions {
  display: flex;
  gap: 12px;
  align-items: end;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.prompt-actions.compact-actions {
  align-items: center;
  justify-content: space-between;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-muted);
}

.prompt-model-note {
  min-width: 220px;
  flex: 1 1 280px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.button {
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 0 14px;
  font-weight: 700;
}

.button.primary {
  background: var(--accent);
  color: #fff;
}

.button.primary:hover {
  background: var(--accent-strong);
}

.button.secondary {
  border-color: var(--line-strong);
  background: #fff;
  color: var(--text);
}

.button.secondary:hover,
.button.ghost:hover {
  border-color: var(--accent);
  color: var(--accent-strong);
}

.button.ghost {
  border-color: var(--line);
  background: var(--surface-muted);
  color: var(--muted);
}

.image-source-row {
  margin-bottom: 14px;
}

.upload-box {
  min-height: 118px;
  display: grid;
  gap: 6px;
  place-items: center;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.upload-box input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
}

.upload-box span {
  font-weight: 800;
}

.upload-box strong {
  max-width: 100%;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.form-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.form-footer p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.footer-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.computed-size {
  margin-top: -4px;
  color: var(--muted);
  font-size: 13px;
}

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

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

.image-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.image-frame {
  position: relative;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: #e8edf3;
}

.image-frame img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.image-meta {
  display: grid;
  gap: 8px;
  padding: 12px;
}

.image-meta strong {
  font-size: 13px;
  line-height: 1.35;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.image-meta span,
.image-meta small {
  color: var(--muted);
  font-size: 12px;
}

.card-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.card-actions .button {
  min-height: 34px;
  padding: 0 10px;
  font-size: 12px;
}

.empty-state {
  grid-column: 1 / -1;
  min-height: 180px;
  display: grid;
  place-items: center;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface-muted);
  color: var(--muted);
  text-align: center;
}

.batch-log {
  display: grid;
  gap: 10px;
}

.batch-panel {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.compact-head {
  margin-bottom: 12px;
}

.compact-empty {
  min-height: 96px;
}

.log-item {
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
}

.log-item strong {
  font-size: 14px;
}

.log-item p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.log-item[data-status="failed"] {
  border-color: rgba(180, 35, 24, 0.35);
}

.log-item[data-status="succeeded"] {
  border-color: rgba(10, 122, 71, 0.35);
}

.gallery-tools input {
  width: min(360px, 52vw);
}

.providers-list {
  display: grid;
  gap: 12px;
}

.provider-card {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.provider-card header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.provider-card h4 {
  margin: 0;
  font-size: 15px;
}

.provider-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.provider-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 0 8px;
  background: var(--surface-muted);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.model-preview {
  min-height: 44px;
  max-height: 120px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px;
  background: var(--surface-muted);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 20;
  max-width: min(420px, calc(100vw - 48px));
  transform: translateY(16px);
  opacity: 0;
  pointer-events: none;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  background: #101820;
  color: #fff;
  box-shadow: var(--shadow);
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.is-visible {
  transform: translateY(0);
  opacity: 1;
}

.auth-control {
  position: fixed;
  top: 18px;
  right: 24px;
  z-index: 16;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: rgba(7, 12, 17, 0.26);
  box-shadow: 0 14px 38px rgba(0, 0, 0, 0.18);
  backdrop-filter: blur(20px) saturate(1.12);
}

.auth-control span {
  max-width: 120px;
  color: rgba(255, 255, 255, 0.74);
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.auth-control .button {
  min-height: 36px;
}

.auth-dialog {
  width: min(440px, calc(100vw - 28px));
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  padding: 0;
  background: rgba(8, 14, 20, 0.72);
  color: var(--text);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.38);
  backdrop-filter: blur(24px) saturate(1.16);
}

.auth-dialog::backdrop {
  background: rgba(2, 4, 6, 0.58);
  backdrop-filter: blur(5px);
}

.auth-card {
  display: grid;
  gap: 14px;
  padding: 16px;
}

.auth-card .dialog-head {
  margin: -16px -16px 2px;
}

.auth-card .button.primary {
  width: 100%;
}

.auth-hint {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.image-dialog {
  width: min(960px, calc(100vw - 32px));
  border: 0;
  border-radius: 18px;
  padding: 0;
  background: #fff;
  box-shadow: 0 24px 80px rgba(16, 24, 32, 0.28);
}

.image-dialog::backdrop {
  background: rgba(16, 24, 32, 0.55);
}

.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.image-dialog img {
  width: 100%;
  max-height: 72vh;
  display: block;
  object-fit: contain;
  background: #101820;
}

.image-dialog pre {
  max-height: 180px;
  margin: 0;
  overflow: auto;
  padding: 14px 16px;
  color: var(--muted);
  white-space: pre-wrap;
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  body:not(.home-active) .sidebar {
    position: static;
    height: auto;
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
  }

  body:not(.home-active) .nav-list {
    grid-template-columns: repeat(4, minmax(82px, 1fr));
    flex: 1 1 520px;
  }

  body:not(.home-active) .sidebar-note {
    display: none;
  }

  .generate-layout,
  .providers-layout {
    grid-template-columns: 1fr;
  }

  body.home-active .workspace {
    min-height: 100vh;
  }

  .home-stage,
  .home-content {
    min-height: 100vh;
  }

  .home-content {
    grid-template-columns: minmax(0, 1fr);
    display: grid;
    place-items: center;
    padding: 84px 78px 64px 36px;
  }

  .home-copy {
    max-width: 620px;
    justify-self: start;
  }

  .home-copy h2 {
    max-width: 620px;
  }

  .home-orb-wrap {
    width: min(46vw, 410px);
    opacity: 0.9;
  }

  .home-stage.is-revealed .home-content {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-content: center;
  }

  .home-stage.is-revealed .home-orb-wrap {
    position: absolute;
    right: 74px;
    bottom: 52px;
  }
}

@media (max-width: 760px) {
  .workspace {
    padding: 18px;
  }

  body:not(.home-active) .sidebar {
    padding: 18px;
  }

  .topbar,
  .form-footer,
  .panel-head {
    align-items: stretch;
    flex-direction: column;
  }

  .field-grid.two,
  .field-grid.three,
  .field-grid.four {
    grid-template-columns: 1fr;
  }

  .model-line {
    grid-template-columns: 1fr;
  }

  body:not(.home-active) .nav-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  body.home-active .sidebar {
    grid-template-columns: 1fr;
    align-items: start;
    gap: 12px;
    padding: 16px;
  }

  body.home-active .brand-block {
    display: none;
  }

  body.home-active .nav-list {
    justify-self: stretch;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
  }

  body.home-active .nav-item {
    min-width: 76px;
    height: 38px;
    padding: 0 12px;
    font-size: 14px;
  }

  body.home-active .workspace {
    min-height: 100vh;
  }

  .home-stage,
  .home-content {
    min-height: 100vh;
  }

  .home-content {
    display: grid;
    place-items: center;
    padding: 44px 58px 34px 18px;
  }

  .home-stage.is-revealed .home-content {
    display: block;
    padding: 92px 58px 34px 18px;
  }

  .home-stage.is-revealed .home-copy {
    position: relative;
    z-index: 2;
  }

  .home-copy h2 {
    font-size: clamp(38px, 12vw, 54px);
  }

  .home-copy > p:not(.home-kicker) {
    font-size: 14px;
    line-height: 1.65;
  }

  .home-actions {
    align-items: stretch;
    flex-direction: column;
    margin-top: 24px;
  }

  .home-primary,
  .home-secondary {
    width: 100%;
  }

  .home-orb-wrap {
    position: relative;
    right: auto;
    bottom: auto;
    width: min(70vw, 300px);
    margin: 0 auto;
  }

  .home-stage.is-revealed .home-orb-wrap {
    position: absolute;
    right: -54px;
    bottom: 26px;
    z-index: 1;
    width: min(62vw, 250px);
    margin: 0;
    opacity: 0.58;
  }

  .home-scene-rail {
    right: 12px;
    gap: 10px;
  }

  .home-scene-dot {
    width: 38px;
    height: 38px;
  }

  .gallery-tools,
  .gallery-tools input,
  .button.primary,
  .footer-actions,
  .footer-actions .button,
  .form-footer .button {
    width: 100%;
  }
}

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

  .home-canvas {
    display: none;
  }
}

/* Final ambient glass shell */
:root {
  color-scheme: dark;
  --bg: #030609;
  --surface: rgba(9, 15, 20, 0.46);
  --surface-muted: rgba(255, 255, 255, 0.08);
  --text: rgba(248, 252, 255, 0.94);
  --muted: rgba(225, 236, 245, 0.66);
  --line: rgba(255, 255, 255, 0.15);
  --line-strong: rgba(255, 255, 255, 0.24);
  --accent: var(--home-accent, #ffd37a);
  --accent-strong: color-mix(in srgb, var(--home-accent, #ffd37a) 82%, #ffffff 18%);
  --accent-soft: color-mix(in srgb, var(--home-accent, #ffd37a) 18%, transparent);
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.28);
  --radius-sm: 8px;
  --radius: 8px;
  --radius-lg: 8px;
}

html {
  background: #030609;
}

body {
  min-height: 100vh;
  overflow-x: hidden;
  background: #030609;
  color: var(--text);
}

.app-shell {
  position: relative;
  min-height: 100vh;
  display: block;
  isolation: isolate;
}

.ambient-stage {
  --home-accent: #ffd37a;
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  background: #020406;
  pointer-events: none;
}

.ambient-stage .home-bg,
.ambient-stage .home-canvas,
.ambient-stage .home-shade {
  position: absolute;
  inset: 0;
}

.ambient-stage .home-bg {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.88;
  filter: saturate(1.18) contrast(1.12);
  transform: scale(1.08);
  animation: home-pan 24s ease-in-out infinite alternate;
}

.ambient-stage .home-bg-next {
  opacity: 0;
  transition: opacity 820ms ease;
}

.ambient-stage.is-swapping .home-bg-next {
  opacity: 0.88;
}

.ambient-stage .home-canvas {
  width: 100%;
  height: 100%;
  opacity: 0.74;
}

.ambient-stage .home-shade {
  background:
    radial-gradient(circle at 52% 44%, rgba(255, 255, 255, 0.05), transparent 25%),
    linear-gradient(90deg, rgba(2, 4, 6, 0.60), rgba(2, 4, 6, 0.18) 48%, rgba(2, 4, 6, 0.64)),
    linear-gradient(180deg, rgba(2, 4, 6, 0.05), rgba(2, 4, 6, 0.68));
}

.sidebar {
  position: fixed;
  top: 18px;
  left: 50%;
  right: auto;
  z-index: 10;
  width: min(1040px, calc(100vw - 32px));
  height: 62px;
  display: grid;
  grid-template-columns: minmax(190px, auto) minmax(0, 1fr);
  align-items: center;
  gap: 18px;
  padding: 9px 12px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: rgba(7, 12, 17, 0.32);
  color: #fff;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.22);
  backdrop-filter: blur(24px) saturate(1.18);
  transform: translateX(-50%);
  transition: opacity 360ms ease, transform 360ms ease, background 240ms ease;
}

body.home-active:not(.home-revealed) .sidebar {
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -14px);
}

.sidebar-note {
  display: none;
}

.brand-block {
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 10px;
  min-width: 0;
}

.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  border-color: rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.08);
  color: var(--home-accent);
  backdrop-filter: blur(14px);
}

.brand-block h1 {
  color: #fff;
  font-size: 15px;
  white-space: nowrap;
}

.brand-block p {
  margin-top: 2px;
  color: rgba(255, 255, 255, 0.62);
  font-size: 12px;
  white-space: nowrap;
}

.nav-list {
  justify-self: end;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

.nav-item {
  min-width: 76px;
  height: 40px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0 14px;
  background: transparent;
  color: rgba(255, 255, 255, 0.72);
  text-align: center;
  transition: color 180ms ease, border-color 180ms ease, background 180ms ease, transform 180ms ease;
}

.nav-item:hover,
.nav-item:focus-visible {
  border-color: rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  outline: none;
}

.nav-item.is-active {
  border-color: color-mix(in srgb, var(--home-accent) 54%, rgba(255, 255, 255, 0.22));
  background: color-mix(in srgb, var(--home-accent) 20%, rgba(255, 255, 255, 0.08));
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

.workspace {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  padding: 108px clamp(18px, 3vw, 42px) 38px;
  background: transparent;
}

body.home-active .workspace {
  padding: 0;
  background: transparent;
}

.topbar {
  max-width: 1240px;
  margin: 0 auto 16px;
  padding: 14px 16px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: rgba(7, 12, 17, 0.28);
  color: var(--text);
  backdrop-filter: blur(20px) saturate(1.12);
}

body.home-active .topbar {
  display: none;
}

.topbar h2,
.panel-head h3,
.provider-card h4 {
  color: var(--text);
}

.section-label {
  color: var(--accent-strong);
}

.generate-layout,
.providers-layout,
.gallery-shell {
  max-width: 1240px;
  margin-inline: auto;
}

.generate-layout,
.providers-layout {
  grid-template-columns: minmax(420px, 0.92fr) minmax(360px, 1.08fr);
  gap: 18px;
}

.surface,
.image-card,
.provider-card,
.log-item,
.prompt-actions.compact-actions,
.model-preview,
.empty-state,
.counter,
.segmented,
.upload-box,
.image-dialog {
  border-color: rgba(255, 255, 255, 0.15);
  background: rgba(8, 14, 20, 0.44);
  color: var(--text);
  box-shadow: 0 18px 56px rgba(0, 0, 0, 0.22);
  backdrop-filter: blur(22px) saturate(1.12);
}

.surface {
  border-radius: 8px;
}

.image-card,
.provider-card,
.log-item {
  background: rgba(9, 15, 20, 0.38);
}

.empty-state,
.model-preview,
.prompt-actions.compact-actions,
.counter,
.segmented {
  background: rgba(255, 255, 255, 0.07);
  box-shadow: none;
}

.panel-head {
  color: var(--text);
}

.field > span {
  color: rgba(246, 250, 255, 0.78);
}

input,
textarea,
select {
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(3, 7, 11, 0.42);
  color: var(--text);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

input::placeholder,
textarea::placeholder {
  color: rgba(225, 236, 245, 0.38);
}

select option {
  background: #101820;
  color: #fff;
}

input:focus,
textarea:focus,
select:focus,
button:focus-visible {
  border-color: color-mix(in srgb, var(--home-accent) 70%, #ffffff 30%);
  outline: 3px solid color-mix(in srgb, var(--home-accent) 22%, transparent);
}

.button {
  border-radius: 8px;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease, color 160ms ease;
}

.button:hover {
  transform: translateY(-1px);
}

.button.primary {
  border-color: color-mix(in srgb, var(--home-accent) 70%, #ffffff 30%);
  background: var(--home-accent);
  color: #071014;
}

.button.primary:hover {
  background: color-mix(in srgb, var(--home-accent) 82%, #ffffff 18%);
  color: #071014;
}

.button.secondary,
.button.ghost {
  border-color: rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.86);
}

.button.secondary:hover,
.button.ghost:hover {
  border-color: color-mix(in srgb, var(--home-accent) 58%, rgba(255, 255, 255, 0.24));
  background: color-mix(in srgb, var(--home-accent) 15%, rgba(255, 255, 255, 0.09));
  color: #fff;
}

.segment {
  color: rgba(255, 255, 255, 0.62);
}

.segment.is-active {
  background: color-mix(in srgb, var(--home-accent) 20%, rgba(255, 255, 255, 0.12));
  color: #fff;
  box-shadow: none;
}

.prompt-model-note,
.status-row span,
.form-footer p,
.computed-size,
.image-meta span,
.image-meta small,
.provider-card p,
.log-item p,
.upload-box strong,
.image-dialog pre,
.counter,
.tag {
  color: var(--muted);
}

.tag {
  background: rgba(255, 255, 255, 0.08);
}

.image-frame {
  border: 0;
  background: rgba(255, 255, 255, 0.08);
}

.form-footer,
.batch-panel {
  border-top-color: rgba(255, 255, 255, 0.12);
}

.home-stage {
  min-height: 100vh;
  overflow: hidden;
  background: transparent;
  color: #f9fbff;
  cursor: pointer;
}

.home-content {
  position: relative;
  z-index: 2;
}

.home-copy {
  transition: opacity 420ms ease 80ms, transform 420ms ease 80ms;
}

.home-stage.is-revealed .home-copy {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.home-primary,
.home-secondary {
  border-radius: 8px;
}

.home-clock {
  background: rgba(4, 8, 12, 0.34);
}

.home-scene-rail {
  position: fixed;
  top: 50%;
  right: 22px;
  z-index: 12;
  display: grid;
  gap: 14px;
  transform: translateY(-50%);
}

.home-scene-dot {
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(14px);
}

.view {
  opacity: 0;
  transform: translateY(8px);
}

.view.is-active {
  display: block;
  opacity: 1;
  transform: translateY(0);
  animation: view-in 260ms ease both;
}

@keyframes view-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.toast {
  border-color: rgba(255, 255, 255, 0.16);
  background: rgba(8, 14, 20, 0.72);
  backdrop-filter: blur(18px);
}

.image-dialog::backdrop {
  background: rgba(2, 4, 6, 0.64);
  backdrop-filter: blur(6px);
}

.dialog-head {
  border-bottom-color: rgba(255, 255, 255, 0.12);
}

@media (max-width: 1180px) {
  .sidebar,
  body:not(.home-active) .sidebar,
  body.home-active .sidebar {
    position: fixed;
    top: 14px;
    left: 50%;
    right: auto;
    width: min(940px, calc(100vw - 28px));
    height: auto;
    display: grid;
    grid-template-columns: minmax(160px, auto) minmax(0, 1fr);
    padding: 9px 10px;
    transform: translateX(-50%);
  }

  body.home-active:not(.home-revealed) .sidebar {
    transform: translate(-50%, -14px);
  }

  .generate-layout,
  .providers-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .sidebar,
  body:not(.home-active) .sidebar,
  body.home-active .sidebar {
    top: 10px;
    width: calc(100vw - 20px);
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 10px;
  }

  .brand-block {
    display: none;
  }

  .nav-list,
  body:not(.home-active) .nav-list,
  body.home-active .nav-list {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
  }

  .nav-item,
  body.home-active .nav-item {
    min-width: 0;
    height: 38px;
    padding: 0 8px;
    font-size: 13px;
  }

  .workspace {
    padding: 78px 12px 28px;
  }

  body.home-active .workspace {
    padding: 0;
  }

  .topbar {
    padding: 12px;
  }

  .generator-panel,
  .results-panel,
  .providers-layout .surface,
  .gallery-shell {
    padding: 14px;
  }

  .home-content {
    padding: 44px 58px 34px 18px;
  }

  .home-stage.is-revealed .home-content {
    padding-top: 88px;
  }

  .home-scene-rail {
    top: auto;
    right: auto;
    bottom: 12px;
    left: 50%;
    grid-auto-flow: column;
    gap: 10px;
    padding: 6px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 999px;
    background: rgba(7, 12, 17, 0.28);
    backdrop-filter: blur(18px);
    transform: translateX(-50%);
  }

  .home-scene-dot {
    width: 36px;
    height: 36px;
  }

  .gallery-tools input {
    width: 100%;
  }
}

/* Header split: brand stays top-left, tabs stay centered */
.sidebar,
body:not(.home-active) .sidebar,
body.home-active .sidebar {
  position: fixed;
  inset: 0 auto auto 0;
  z-index: 14;
  width: 100%;
  height: 0;
  display: block;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
  transform: none;
  pointer-events: none;
}

body.home-active:not(.home-revealed) .sidebar {
  opacity: 1;
  transform: none;
}

.brand-block,
body.home-active .brand-block {
  position: fixed;
  top: 18px;
  left: 24px;
  z-index: 15;
  width: max-content;
  display: grid;
  grid-template-columns: 38px minmax(0, auto);
  align-items: center;
  gap: 10px;
  padding: 8px 12px 8px 8px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: rgba(7, 12, 17, 0.24);
  color: #fff;
  box-shadow: 0 14px 38px rgba(0, 0, 0, 0.18);
  backdrop-filter: blur(20px) saturate(1.12);
  pointer-events: auto;
}

.nav-list,
body:not(.home-active) .nav-list,
body.home-active .nav-list {
  position: fixed;
  top: 18px;
  left: 50%;
  z-index: 15;
  width: max-content;
  min-width: min(430px, calc(100vw - 48px));
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: rgba(7, 12, 17, 0.28);
  box-shadow: 0 14px 38px rgba(0, 0, 0, 0.18);
  backdrop-filter: blur(22px) saturate(1.14);
  transform: translateX(-50%);
  pointer-events: auto;
  transition: opacity 360ms ease, transform 360ms ease;
}

body.home-active:not(.home-revealed) .nav-list {
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -12px);
}

@media (max-width: 760px) {
  .brand-block,
  body.home-active .brand-block {
    top: 10px;
    left: 10px;
    display: grid;
    grid-template-columns: 34px auto;
    max-width: calc(100vw - 20px);
    padding: 6px 10px 6px 6px;
  }

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

  .brand-block h1 {
    font-size: 13px;
  }

  .brand-block p {
    display: none;
  }

  .nav-list,
  body:not(.home-active) .nav-list,
  body.home-active .nav-list {
    top: 64px;
    width: calc(100vw - 20px);
    min-width: 0;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .workspace {
    padding-top: 132px;
  }

  body.home-active .workspace {
    padding-top: 0;
  }

  .home-stage.is-revealed .home-content {
    padding-top: 124px;
  }

  .auth-control {
    top: 10px;
    right: 10px;
    max-width: calc(100vw - 200px);
    padding: 6px;
  }

  .auth-control span {
    display: none;
  }

  .auth-control .button {
    min-height: 34px;
    padding-inline: 10px;
    font-size: 13px;
  }
}
