:root {
  --page: #f6f5ef;
  --surface: rgba(255, 255, 255, 0.78);
  --surface-solid: #ffffff;
  --ink: #101814;
  --muted: #727a75;
  --line: #dadcd6;
  --accent: #109b7e;
  --accent-dark: #087a64;
  --accent-soft: #e1f4ee;
  --danger: #b84c43;
  --shadow: 0 28px 80px rgba(24, 35, 30, 0.08);
  color-scheme: light;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  min-height: 100%;
  background: var(--page);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  min-height: 100dvh;
  margin: 0;
  background:
    radial-gradient(circle at 9% 8%, rgba(16, 155, 126, 0.1), transparent 27rem),
    linear-gradient(rgba(16, 24, 20, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(16, 24, 20, 0.035) 1px, transparent 1px),
    var(--page);
  background-size: auto, 72px 72px, 72px 72px, auto;
  color: var(--ink);
}

button,
select,
textarea {
  font: inherit;
}

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

button:focus-visible,
a:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(16, 155, 126, 0.22);
  outline-offset: 2px;
}

.page-shell {
  width: min(1540px, 100%);
  min-height: 100dvh;
  margin: 0 auto;
  padding: 0 34px 34px;
}

.topbar {
  display: flex;
  min-height: 96px;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  color: var(--ink);
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border-radius: 14px;
  background: var(--ink);
  color: white;
  font-family: Georgia, serif;
  font-size: 17px;
  letter-spacing: 0;
}

.topbar-links {
  display: flex;
  align-items: center;
  gap: 30px;
}

.topbar-links a {
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
}

.topbar-links a:hover {
  color: var(--accent-dark);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(360px, 0.78fr) minmax(520px, 1.22fr);
  gap: 24px;
  min-height: calc(100dvh - 130px);
  padding-top: 24px;
}

.creator-panel,
.result-panel {
  min-width: 0;
  border: 1px solid rgba(199, 203, 196, 0.78);
  border-radius: 28px;
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.creator-panel {
  align-self: start;
  padding: clamp(28px, 4vw, 54px);
}

.result-panel {
  display: flex;
  min-height: calc(100dvh - 154px);
  flex-direction: column;
  padding: 30px;
}

.eyebrow {
  color: var(--accent-dark);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.22em;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 18px;
  font-size: clamp(42px, 5vw, 70px);
  line-height: 0.98;
  letter-spacing: -0.055em;
}

.intro {
  max-width: 560px;
  margin-bottom: 24px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.8;
}

.account-line {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 28px;
  color: var(--muted);
  font-size: 13px;
}

.status-dot {
  width: 9px;
  height: 9px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #9ca39f;
  box-shadow: 0 0 0 6px rgba(156, 163, 159, 0.12);
}

.status-dot.ready {
  background: var(--accent);
  box-shadow: 0 0 0 6px rgba(16, 155, 126, 0.12);
}

.status-dot.error {
  background: var(--danger);
  box-shadow: 0 0 0 6px rgba(184, 76, 67, 0.1);
}

.field-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(150px, 0.85fr);
  gap: 14px;
}

.field,
.prompt-field {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 9px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 750;
}

select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.86);
  color: var(--ink);
  font-size: 16px;
}

select {
  min-height: 52px;
  padding: 0 42px 0 15px;
}

select:disabled,
textarea:disabled {
  cursor: not-allowed;
  opacity: 0.62;
}

.prompt-field {
  margin-top: 22px;
}

textarea {
  min-height: 208px;
  resize: vertical;
  padding: 17px;
  line-height: 1.72;
}

textarea::placeholder {
  color: #9ba29d;
}

.prompt-meta {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  margin-top: 9px;
  color: #909792;
  font-size: 12px;
  line-height: 1.55;
}

.prompt-meta b {
  color: var(--muted);
  font-weight: 700;
}

.example-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 20px;
}

.example-list button,
.clear-button {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
  cursor: pointer;
}

.example-list button {
  min-height: 36px;
  padding: 0 13px;
  border-radius: 999px;
  font-size: 12px;
}

.example-list button:hover,
.clear-button:hover {
  border-color: rgba(16, 155, 126, 0.45);
  color: var(--accent-dark);
}

.generate-button {
  display: flex;
  width: 100%;
  min-height: 62px;
  align-items: center;
  justify-content: space-between;
  margin-top: 24px;
  padding: 0 23px;
  border: 0;
  border-radius: 17px;
  background: var(--ink);
  color: white;
  cursor: pointer;
  font-size: 16px;
  font-weight: 800;
  transition: transform 160ms ease, background 160ms ease;
}

.generate-button:hover:not(:disabled) {
  transform: translateY(-1px);
  background: #24302b;
}

.generate-button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.privacy-note {
  margin: 18px 0 0;
  color: #8b928e;
  font-size: 12px;
  line-height: 1.65;
}

.result-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  padding: 4px 4px 22px;
}

.result-heading h2 {
  margin: 8px 0 0;
  font-size: 26px;
  letter-spacing: -0.03em;
}

.clear-button {
  min-height: 38px;
  padding: 0 15px;
  border-radius: 999px;
  font-size: 13px;
}

.result-stage {
  position: relative;
  display: grid;
  min-height: 560px;
  flex: 1;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 22px;
  background:
    radial-gradient(circle at 50% 42%, rgba(16, 155, 126, 0.08), transparent 24rem),
    #edeee9;
}

.empty-result,
.loading-result,
.error-result {
  display: flex;
  max-width: 380px;
  flex-direction: column;
  align-items: center;
  padding: 34px;
  text-align: center;
}

.empty-result strong,
.loading-result strong,
.error-result strong {
  margin-top: 18px;
  font-size: 20px;
}

.empty-result > span:last-child,
.loading-result > span:last-child,
.error-result > span,
.error-result a {
  margin-top: 9px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}

.error-result a {
  color: var(--accent-dark);
  font-weight: 700;
  text-decoration: none;
}

.empty-symbol,
.error-symbol {
  display: grid;
  width: 58px;
  height: 58px;
  place-items: center;
  border-radius: 18px;
  background: var(--surface-solid);
  color: var(--accent-dark);
  box-shadow: 0 12px 30px rgba(24, 35, 30, 0.07);
  font-size: 23px;
  font-weight: 800;
}

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

.loading-orbit {
  width: 52px;
  height: 52px;
  border: 3px solid rgba(16, 155, 126, 0.18);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 900ms linear infinite;
}

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

.image-result {
  display: grid;
  width: 100%;
  height: 100%;
  min-height: 0;
  grid-template-rows: minmax(0, 1fr) auto;
  margin: 0;
}

.image-frame {
  display: grid;
  min-height: 380px;
  place-items: center;
  overflow: hidden;
  padding: 24px;
}

.image-frame img {
  display: block;
  width: 100%;
  height: 100%;
  max-height: calc(100dvh - 330px);
  object-fit: contain;
  border-radius: 14px;
  box-shadow: 0 20px 54px rgba(16, 24, 20, 0.14);
}

figcaption {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px 20px;
  align-items: center;
  padding: 20px 22px;
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.82);
}

figcaption p {
  margin: 0;
  overflow: hidden;
  font-size: 14px;
  line-height: 1.55;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.result-meta {
  display: flex;
  gap: 14px;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 11px;
}

.download-button {
  display: inline-flex;
  min-height: 46px;
  grid-column: 2;
  grid-row: 1 / span 2;
  align-items: center;
  gap: 16px;
  padding: 0 18px;
  border-radius: 14px;
  background: var(--ink);
  color: white;
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
}

[hidden] {
  display: none !important;
}

@media (max-width: 980px) {
  .page-shell {
    padding: 0 20px 24px;
  }

  .workspace {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .creator-panel {
    padding: 34px;
  }

  .result-panel {
    min-height: 680px;
  }

  .image-frame img {
    max-height: 720px;
  }
}

@media (max-width: 640px) {
  .page-shell {
    padding: 0 12px calc(18px + env(safe-area-inset-bottom));
  }

  .topbar {
    min-height: 76px;
  }

  .brand {
    gap: 9px;
    font-size: 13px;
    letter-spacing: 0.1em;
  }

  .brand-mark {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    font-size: 14px;
  }

  .topbar-links {
    gap: 14px;
  }

  .topbar-links a {
    font-size: 12px;
  }

  .topbar-links a:first-child {
    display: none;
  }

  .workspace {
    gap: 12px;
    padding-top: 12px;
  }

  .creator-panel,
  .result-panel {
    border-radius: 22px;
  }

  .creator-panel {
    padding: 26px 20px 22px;
  }

  h1 {
    margin-bottom: 14px;
    font-size: 43px;
  }

  .intro {
    font-size: 14px;
    line-height: 1.7;
  }

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

  select,
  textarea {
    font-size: 16px;
  }

  textarea {
    min-height: 168px;
  }

  .prompt-meta > span:first-child {
    max-width: 78%;
  }

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

  .result-panel {
    min-height: 520px;
    padding: 16px;
  }

  .result-heading {
    padding: 7px 4px 16px;
  }

  .result-heading h2 {
    font-size: 22px;
  }

  .result-stage {
    min-height: 430px;
  }

  .image-frame {
    min-height: 300px;
    padding: 10px;
  }

  .image-frame img {
    max-height: none;
  }

  figcaption {
    grid-template-columns: minmax(0, 1fr);
    padding: 16px;
  }

  .download-button {
    grid-column: 1;
    grid-row: auto;
    justify-content: space-between;
  }
}

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

