:root {
  --ink: #08110f;
  --muted: #66756f;
  --paper: #f4f0e7;
  --card: rgba(255, 252, 243, 0.82);
  --line: rgba(8, 17, 15, 0.12);
  --green: #0f8f72;
  --green-dark: #07634f;
  --amber: #f3a51d;
  --blue: #123c69;
  --shadow: 0 28px 80px rgba(8, 17, 15, 0.16);
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  font-family: "Aptos Display", "Microsoft YaHei UI", "Trebuchet MS", sans-serif;
  background:
    radial-gradient(circle at 15% 10%, rgba(243, 165, 29, 0.34), transparent 28rem),
    radial-gradient(circle at 85% 18%, rgba(15, 143, 114, 0.25), transparent 30rem),
    linear-gradient(135deg, #f8f0df 0%, #e9f4ee 45%, #dde9f2 100%);
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  content: "";
  background-image:
    linear-gradient(rgba(8, 17, 15, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(8, 17, 15, 0.05) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.82), transparent);
}

button,
textarea,
select {
  font: inherit;
}

button,
select {
  cursor: pointer;
}

.shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 52px 0;
}

.hero {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 24px;
  align-items: center;
  min-height: 290px;
  margin-bottom: 28px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 36px;
  padding: 42px;
  background:
    linear-gradient(135deg, rgba(255, 252, 243, 0.86), rgba(255, 252, 243, 0.42)),
    linear-gradient(100deg, rgba(18, 60, 105, 0.11), transparent);
  box-shadow: var(--shadow);
  animation: rise 680ms ease both;
}

.hero h1 {
  max-width: 780px;
  margin: 0;
  font-size: clamp(42px, 8vw, 92px);
  line-height: 0.92;
  letter-spacing: -0.07em;
}

.lead {
  max-width: 680px;
  margin: 24px 0 0;
  color: #40514b;
  font-size: clamp(17px, 2vw, 21px);
  line-height: 1.65;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--green-dark);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.status {
  display: inline-flex;
  align-items: center;
  margin-top: 26px;
  border: 1px solid rgba(15, 143, 114, 0.24);
  border-radius: 999px;
  padding: 10px 14px;
  color: var(--green-dark);
  background: rgba(235, 255, 247, 0.72);
  font-size: 14px;
}

.status.is-error {
  border-color: rgba(180, 61, 32, 0.32);
  color: #9a3412;
  background: rgba(255, 237, 213, 0.78);
}

.orb {
  width: 220px;
  height: 220px;
  justify-self: center;
  border-radius: 44% 56% 62% 38%;
  background:
    radial-gradient(circle at 35% 30%, #fff7d7 0 12%, transparent 13%),
    linear-gradient(145deg, var(--amber), var(--green) 52%, var(--blue));
  box-shadow:
    inset 22px 24px 70px rgba(255, 255, 255, 0.28),
    0 32px 70px rgba(15, 99, 79, 0.28);
  animation: float 7s ease-in-out infinite;
}

.auth-card {
  align-self: stretch;
  border: 1px solid rgba(8, 17, 15, 0.12);
  border-radius: 28px;
  padding: 20px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.68), rgba(255, 255, 255, 0.28)),
    rgba(15, 143, 114, 0.08);
}

.auth-card h2,
.account-box h2 {
  margin: 0 0 14px;
  font-size: 28px;
  letter-spacing: -0.04em;
}

.auth-form {
  display: grid;
  gap: 12px;
}

.auth-form input {
  width: 100%;
  min-height: 46px;
  border: 1px solid rgba(8, 17, 15, 0.15);
  border-radius: 16px;
  padding: 0 14px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.68);
  outline: none;
}

.auth-form input:focus {
  border-color: rgba(15, 143, 114, 0.62);
  box-shadow: 0 0 0 5px rgba(15, 143, 114, 0.12);
}

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

.auth-actions button {
  border: 0;
  border-radius: 16px;
  padding: 12px;
  color: #fffdf6;
  background: linear-gradient(135deg, var(--green-dark), var(--green));
  font-weight: 900;
}

.auth-actions button[value="register"] {
  color: var(--green-dark);
  background: rgba(15, 143, 114, 0.13);
}

.auth-message,
.account-box p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.workspace {
  display: grid;
  grid-template-columns: 0.82fr 1.18fr;
  gap: 28px;
  align-items: start;
}

.creator-card,
.result-card {
  border: 1px solid var(--line);
  border-radius: 30px;
  background: var(--card);
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px);
}

.creator-card {
  position: sticky;
  top: 24px;
  display: grid;
  gap: 20px;
  padding: 24px;
  animation: rise 760ms 80ms ease both;
}

.field span,
.controls span {
  display: block;
  margin-bottom: 9px;
  color: #2d3b37;
  font-size: 14px;
  font-weight: 800;
}

textarea,
select {
  width: 100%;
  border: 1px solid rgba(8, 17, 15, 0.15);
  border-radius: 20px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.66);
  outline: none;
}

textarea:focus,
select:focus {
  border-color: rgba(15, 143, 114, 0.62);
  box-shadow: 0 0 0 5px rgba(15, 143, 114, 0.12);
}

textarea {
  min-height: 230px;
  resize: vertical;
  padding: 18px;
  line-height: 1.65;
}

select {
  min-height: 48px;
  padding: 0 14px;
}

.quick-prompts {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.quick-prompts button,
.ghost {
  border: 1px solid rgba(8, 17, 15, 0.13);
  border-radius: 999px;
  padding: 10px 14px;
  color: #21302b;
  background: rgba(255, 255, 255, 0.56);
}

.quick-prompts button:hover,
.ghost:hover {
  transform: translateY(-1px);
  border-color: rgba(15, 143, 114, 0.45);
}

.upload-panel {
  display: grid;
  gap: 12px;
  border: 1px solid rgba(8, 17, 15, 0.11);
  border-radius: 24px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.38);
}

.upload-copy span {
  display: block;
  margin-bottom: 4px;
  color: #2d3b37;
  font-size: 14px;
  font-weight: 800;
}

.upload-copy small,
.upload-drop em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.upload-drop {
  display: grid;
  gap: 4px;
  place-items: center;
  min-height: 96px;
  border: 1px dashed rgba(15, 143, 114, 0.36);
  border-radius: 20px;
  padding: 18px;
  color: var(--green-dark);
  background:
    linear-gradient(135deg, rgba(15, 143, 114, 0.1), rgba(243, 165, 29, 0.1)),
    rgba(255, 255, 255, 0.42);
  text-align: center;
  cursor: pointer;
}

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

.reference-preview {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 12px;
  align-items: center;
}

.reference-preview[hidden] {
  display: none;
}

.reference-preview img {
  width: 72px;
  height: 72px;
  border-radius: 18px;
  object-fit: cover;
  background: #dfe8e2;
}

.reference-preview strong {
  display: block;
  margin-bottom: 8px;
  overflow: hidden;
  color: #2d3b37;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.compact {
  padding: 7px 10px;
  font-size: 12px;
}

.controls {
  display: grid;
  grid-template-columns: 1fr 1fr 0.72fr;
  gap: 12px;
}

.submit {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 0;
  border-radius: 22px;
  padding: 17px 18px;
  color: #fffdf6;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.18), transparent),
    linear-gradient(135deg, var(--green-dark), var(--green) 56%, #0b6f90);
  box-shadow: 0 18px 42px rgba(15, 143, 114, 0.28);
}

.submit:disabled {
  cursor: wait;
  opacity: 0.7;
}

.submit span {
  font-size: 18px;
  font-weight: 900;
}

.submit small {
  opacity: 0.78;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.hint {
  margin: -8px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.result-card {
  min-height: 610px;
  padding: 24px;
  animation: rise 820ms 150ms ease both;
}

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

.result-head h2 {
  margin: 0;
  font-size: 30px;
  letter-spacing: -0.04em;
}

.empty {
  display: grid;
  min-height: 430px;
  place-items: center;
  border: 1px dashed rgba(8, 17, 15, 0.18);
  border-radius: 26px;
  color: var(--muted);
  text-align: center;
  background: rgba(255, 255, 255, 0.32);
}

.empty.is-hidden {
  display: none;
}

.empty-mark {
  width: 128px;
  height: 128px;
  margin: 0 auto 18px;
  border-radius: 32px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.42), transparent),
    conic-gradient(from 120deg, var(--green), var(--amber), var(--blue), var(--green));
  filter: saturate(0.9);
}

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

.image-card {
  overflow: hidden;
  border: 1px solid rgba(8, 17, 15, 0.12);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.56);
  animation: pop 340ms ease both;
}

.image-card img {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  background: #dfe8e2;
}

.image-actions {
  display: flex;
  justify-content: flex-end;
  padding: 12px;
}

.download {
  border-radius: 999px;
  padding: 9px 12px;
  color: var(--green-dark);
  background: rgba(15, 143, 114, 0.12);
  font-size: 14px;
  font-weight: 800;
  text-decoration: none;
}

.message {
  margin: 16px 0 0;
  color: #9a3412;
  line-height: 1.6;
}

.history-panel {
  margin-top: 26px;
  border-top: 1px solid rgba(8, 17, 15, 0.1);
  padding-top: 20px;
}

.history-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.history-head h3 {
  margin: 0;
  font-size: 24px;
  letter-spacing: -0.04em;
}

.history-list {
  display: grid;
  gap: 14px;
}

.history-empty,
.job-card {
  border: 1px solid rgba(8, 17, 15, 0.11);
  border-radius: 22px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.48);
}

.history-empty {
  color: var(--muted);
  text-align: center;
}

.job-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
}

.job-status {
  border-radius: 999px;
  padding: 5px 9px;
  color: var(--green-dark);
  background: rgba(15, 143, 114, 0.12);
  font-size: 12px;
  font-weight: 900;
}

.job-status.failed {
  color: #9a3412;
  background: rgba(255, 237, 213, 0.82);
}

.job-prompt {
  margin: 0 0 12px;
  color: #2d3b37;
  font-size: 13px;
  line-height: 1.55;
}

.job-images {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.job-images a {
  display: block;
  overflow: hidden;
  border-radius: 16px;
  background: #dfe8e2;
}

.job-images img {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pop {
  from {
    opacity: 0;
    transform: scale(0.96);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes float {
  0%,
  100% {
    transform: translateY(0) rotate(0deg);
  }
  50% {
    transform: translateY(-18px) rotate(8deg);
  }
}

@media (max-width: 920px) {
  .shell {
    width: min(100% - 22px, 720px);
    padding: 24px 0;
  }

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

  .hero {
    padding: 28px;
  }

  .orb {
    width: 150px;
    height: 150px;
    justify-self: start;
  }

  .creator-card {
    position: static;
  }
}

@media (max-width: 620px) {
  .hero h1 {
    font-size: 45px;
  }

  .controls,
  .gallery {
    grid-template-columns: 1fr;
  }

  .creator-card,
  .result-card {
    padding: 18px;
    border-radius: 24px;
  }
}
