:root {
  color-scheme: dark;
  --bg: #0a0a0a;
  --panel: #171717;
  --panel-soft: #1f1f1f;
  --line: rgba(255, 255, 255, 0.1);
  --line-strong: rgba(255, 255, 255, 0.18);
  --text: #fafaf9;
  --muted: #a8a29e;
  --muted-2: #78716c;
  --button: #f5f5f4;
  --button-text: #0c0a09;
  --danger: #ef4444;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
}

:root.light {
  color-scheme: light;
  --bg: #fafaf9;
  --panel: #ffffff;
  --panel-soft: #f5f5f4;
  --line: rgba(12, 10, 9, 0.1);
  --line-strong: rgba(12, 10, 9, 0.18);
  --text: #0c0a09;
  --muted: #57534e;
  --muted-2: #79716b;
  --button: #0c0a09;
  --button-text: #ffffff;
  --shadow: 0 24px 80px rgba(28, 25, 23, 0.13);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--text);
  font-family:
    "SF Pro Display", "SF Pro Text", Inter, ui-sans-serif, system-ui,
    -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", sans-serif;
  background:
    radial-gradient(circle at 50% 0, rgba(245, 245, 244, 0.08), transparent 28rem),
    radial-gradient(rgba(245, 245, 244, 0.16) 1px, transparent 1px),
    var(--bg);
  background-size: auto, 16px 16px, auto;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  content: "";
  background: linear-gradient(180deg, transparent 0, var(--bg) 78%);
}

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

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

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

button {
  cursor: pointer;
}

.site-shell {
  min-height: 100vh;
}

.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 24px;
  align-items: center;
  width: min(1200px, calc(100% - 32px));
  height: 68px;
  margin: 0 auto;
  backdrop-filter: blur(18px);
}

.brand,
.nav-actions,
.nav-links,
.hero-actions,
.panel-title,
.canvas-toolbar,
.cost-row,
.count-row,
.node-meta,
.credit-chip,
.primary-button,
.secondary-button,
.text-button,
.submit-button,
.icon-button {
  display: inline-flex;
  align-items: center;
}

.brand {
  gap: 10px;
  font-size: 15px;
  font-weight: 650;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  color: var(--button-text);
  background: var(--button);
  border-radius: 8px;
}

.nav-links {
  justify-content: center;
  gap: 6px;
}

.nav-links a,
.text-button {
  min-height: 36px;
  padding: 0 12px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 8px;
  font-size: 14px;
}

.nav-links a {
  display: inline-flex;
  align-items: center;
}

.nav-links a:hover,
.text-button:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
}

.nav-actions {
  gap: 8px;
  justify-content: flex-end;
}

.icon-button {
  justify-content: center;
  width: 36px;
  height: 36px;
  color: var(--muted);
  background: color-mix(in srgb, var(--panel) 84%, transparent);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.icon-button:hover {
  color: var(--text);
  border-color: var(--line-strong);
}

.primary-button,
.secondary-button,
.submit-button {
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 18px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 650;
}

.primary-button,
.submit-button {
  color: var(--button-text);
  background: var(--button);
  border: 1px solid var(--button);
}

.secondary-button {
  color: var(--text);
  background: color-mix(in srgb, var(--panel) 82%, transparent);
  border: 1px solid var(--line);
}

.compact {
  min-height: 36px;
  padding: 0 13px;
}

.page {
  width: min(1200px, calc(100% - 32px));
  margin: 0 auto;
}

.hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 520px);
  gap: 44px;
  align-items: center;
  min-height: 620px;
  padding: 58px 0 68px;
}

.hero-copy {
  max-width: 760px;
}

.kicker {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.aurora-title {
  max-width: 820px;
  margin: 0;
  color: transparent;
  background: linear-gradient(90deg, var(--text) 0 36%, var(--muted) 54%, var(--text) 72% 100%) 0 0 / 220% 100%;
  background-clip: text;
  -webkit-background-clip: text;
  font-size: clamp(46px, 7vw, 94px);
  font-weight: 680;
  line-height: 0.98;
  letter-spacing: 0;
  animation: title-aurora 7s ease-in-out infinite;
}

@keyframes title-aurora {
  0%,
  100% {
    background-position: 0%;
  }

  50% {
    background-position: 100%;
  }
}

.hero-text {
  max-width: 620px;
  margin: 24px 0 0;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.8;
}

.hero-actions {
  gap: 12px;
  margin-top: 34px;
}

.hero-preview {
  position: relative;
  min-height: 460px;
}

.preview-card {
  position: absolute;
  overflow: hidden;
  width: 260px;
  padding: 10px;
  background: rgba(23, 23, 23, 0.82);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

:root.light .preview-card {
  background: rgba(255, 255, 255, 0.9);
}

.preview-card span {
  display: block;
  padding: 10px 2px 2px;
  color: var(--muted);
  font-size: 13px;
}

.card-a {
  top: 18px;
  left: 34px;
  transform: rotate(-5deg);
}

.card-b {
  top: 132px;
  right: 6px;
  transform: rotate(4deg);
}

.card-c {
  bottom: 18px;
  left: 92px;
  transform: rotate(-1deg);
}

.preview-art {
  aspect-ratio: 4 / 3;
  border-radius: 7px;
}

.art-a {
  background:
    linear-gradient(135deg, rgba(12, 10, 9, 0.08), rgba(12, 10, 9, 0.44)),
    radial-gradient(circle at 30% 24%, #fef3c7, transparent 28%),
    linear-gradient(135deg, #14532d, #0f766e 46%, #f97316);
}

.art-b {
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.05), rgba(0, 0, 0, 0.48)),
    repeating-linear-gradient(90deg, transparent 0 18px, rgba(255, 255, 255, 0.09) 18px 19px),
    linear-gradient(135deg, #111827, #7f1d1d 52%, #f59e0b);
}

.art-c {
  background:
    radial-gradient(circle at 70% 24%, rgba(255, 255, 255, 0.8), transparent 14%),
    linear-gradient(135deg, #1e3a8a, #0f172a 44%, #7c2d12);
}

.canvas-section,
.prompt-section {
  padding: 56px 0 72px;
  border-top: 1px solid var(--line);
}

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}

.section-head h2 {
  margin: 0;
  font-size: clamp(30px, 4vw, 44px);
  font-weight: 650;
  letter-spacing: 0;
}

.section-head p {
  max-width: 680px;
  margin: 12px auto 0;
  color: var(--muted);
  line-height: 1.8;
}

.centered {
  justify-content: center;
  text-align: center;
}

.credit-chip {
  gap: 10px;
  padding: 9px 13px;
  background: color-mix(in srgb, var(--panel) 86%, transparent);
  border: 1px solid var(--line);
  border-radius: 999px;
}

.credit-chip span {
  color: var(--muted);
  font-size: 13px;
}

.canvas-board {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  min-height: 660px;
  overflow: hidden;
  background: color-mix(in srgb, var(--panel) 86%, transparent);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.composer-panel {
  padding: 18px;
  border-right: 1px solid var(--line);
}

.panel-title {
  gap: 9px;
  margin-bottom: 18px;
}

.composer-form {
  display: grid;
  gap: 15px;
}

.field {
  display: grid;
  gap: 8px;
}

.field span,
.count-row label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

textarea,
input,
select {
  width: 100%;
  min-height: 40px;
  color: var(--text);
  outline: none;
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  border: 1px solid var(--line);
  border-radius: 8px;
}

textarea {
  padding: 12px;
  resize: none;
  line-height: 1.7;
}

input,
select {
  padding: 0 11px;
}

textarea:focus,
input:focus,
select:focus {
  border-color: var(--line-strong);
  box-shadow: 0 0 0 3px rgba(168, 162, 158, 0.16);
}

.segmented {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  padding: 4px;
  background: color-mix(in srgb, var(--bg) 74%, transparent);
  border: 1px solid var(--line);
  border-radius: 999px;
}

.segment {
  min-height: 32px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 999px;
  font-size: 13px;
}

.segment.active {
  color: var(--button-text);
  background: var(--button);
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.count-row,
.cost-row {
  justify-content: space-between;
  gap: 12px;
}

.count-row input {
  padding: 0;
  accent-color: var(--button);
}

.cost-row {
  padding: 12px;
  color: var(--muted);
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.cost-row strong {
  color: var(--text);
}

.submit-button {
  width: 100%;
  min-height: 46px;
}

.submit-button:disabled {
  cursor: wait;
  opacity: 0.68;
}

.infinite-canvas {
  position: relative;
  display: grid;
  grid-template-rows: auto 1fr;
  min-width: 0;
  background:
    radial-gradient(rgba(245, 245, 244, 0.12) 1px, transparent 1px),
    color-mix(in srgb, var(--bg) 86%, transparent);
  background-size: 18px 18px;
}

.canvas-toolbar {
  justify-content: space-between;
  min-height: 58px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
}

.canvas-toolbar strong,
.canvas-toolbar span {
  display: block;
}

.canvas-toolbar span {
  color: var(--muted);
  font-size: 13px;
}

.canvas-grid {
  position: relative;
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 18px;
  align-content: start;
  min-height: 600px;
  padding: 26px;
}

.empty-node {
  position: absolute;
  top: 50%;
  left: 50%;
  display: grid;
  justify-items: center;
  width: min(320px, calc(100% - 40px));
  padding: 30px;
  text-align: center;
  background: color-mix(in srgb, var(--panel) 86%, transparent);
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  transform: translate(-50%, -50%);
}

.empty-node .icon {
  width: 38px;
  height: 38px;
  margin-bottom: 12px;
  color: var(--muted);
}

.empty-node strong {
  font-size: 18px;
}

.empty-node span:last-child {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
}

.image-node {
  overflow: hidden;
  background: color-mix(in srgb, var(--panel) 88%, transparent);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.24);
}

.image-node:nth-child(odd) {
  transform: rotate(-0.6deg);
}

.image-node:nth-child(even) {
  transform: rotate(0.7deg);
}

.generated-canvas,
.generated-image {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  background: #1c1917;
}

.node-meta {
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
}

.image-title,
.image-subtitle {
  display: block;
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.image-subtitle {
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
}

.prompt-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-top: 30px;
}

.prompt-card {
  min-height: 188px;
  padding: 16px;
  background: color-mix(in srgb, var(--panel) 88%, transparent);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.prompt-card strong,
.prompt-card span {
  display: block;
}

.prompt-card strong {
  line-height: 1.55;
}

.prompt-card span {
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
}

.prompt-badge {
  display: inline-flex;
  width: fit-content;
  margin-bottom: 14px;
  padding: 5px 8px;
  color: var(--button-text);
  background: var(--button);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.icon {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
}

.icon svg {
  width: 100%;
  height: 100%;
  stroke: currentColor;
}

@media (max-width: 980px) {
  .nav {
    grid-template-columns: auto auto;
  }

  .nav-links {
    display: none;
  }

  .hero,
  .canvas-board {
    grid-template-columns: 1fr;
  }

  .hero {
    min-height: auto;
  }

  .hero-preview {
    min-height: 390px;
  }

  .composer-panel {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

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

@media (max-width: 640px) {
  .nav {
    width: min(100% - 24px, 1200px);
  }

  .nav-actions .text-button,
  .nav-actions .compact {
    display: none;
  }

  .page {
    width: min(100% - 24px, 1200px);
  }

  .hero {
    padding-top: 40px;
  }

  .aurora-title {
    font-size: 46px;
  }

  .hero-text {
    font-size: 16px;
  }

  .hero-actions,
  .section-head {
    align-items: stretch;
    flex-direction: column;
  }

  .hero-preview {
    display: none;
  }

  .field-grid,
  .canvas-grid,
  .prompt-grid {
    grid-template-columns: 1fr;
  }

  .canvas-grid {
    padding: 16px;
  }
}
