:root {
  --bg: #f6efe5;
  --bg-soft: #fff8f0;
  --surface: rgba(255, 250, 243, 0.88);
  --surface-strong: #fffdf8;
  --line: rgba(99, 66, 36, 0.12);
  --text: #2e1f16;
  --muted: #7e6454;
  --accent: #c45d2d;
  --accent-strong: #8b3513;
  --accent-soft: #f1c7a2;
  --success: #2d7a54;
  --warning: #a16400;
  --danger: #9c2e2e;
  --shadow: 0 20px 60px rgba(90, 56, 24, 0.14);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(255, 196, 130, 0.6), transparent 28%),
    radial-gradient(circle at top right, rgba(235, 148, 102, 0.32), transparent 24%),
    linear-gradient(180deg, #f9f4eb 0%, var(--bg) 42%, #efe1d0 100%);
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

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

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(280px, 0.8fr);
  gap: 24px;
  align-items: stretch;
  margin-bottom: 24px;
}

.hero-copy,
.hero-card,
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.hero-copy {
  padding: 34px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent-strong);
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 12px;
}

.hero h1 {
  margin: 0;
  font-size: clamp(30px, 4vw, 54px);
  line-height: 1.04;
}

.hero-text {
  margin: 18px 0 0;
  color: var(--muted);
  max-width: 720px;
  font-size: 16px;
  line-height: 1.7;
}

.hero-card {
  padding: 24px;
  display: grid;
  gap: 16px;
  align-content: center;
}

.mini-stat {
  padding: 16px;
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.7), rgba(249, 232, 216, 0.88));
  border: 1px solid rgba(99, 66, 36, 0.08);
}

.mini-stat span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 6px;
}

.mini-stat strong {
  font-size: 18px;
}

.grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(340px, 0.95fr);
  gap: 24px;
}

.panel {
  padding: 24px;
}

.panel-head h2 {
  margin: 0 0 4px;
  font-size: 24px;
}

.panel-head p {
  margin: 0 0 20px;
  color: var(--muted);
}

.generator-form,
.field-group {
  display: grid;
  gap: 16px;
}

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

.mode-option {
  position: relative;
  overflow: hidden;
  cursor: pointer;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.76);
  border: 1px solid var(--line);
  text-align: center;
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
}

.mode-option.active {
  background: linear-gradient(135deg, #d86d3e, #b84a1e);
  color: white;
  border-color: transparent;
  transform: translateY(-1px);
}

.mode-option input {
  position: absolute;
  inset: 0;
  opacity: 0;
}

.mode-option span {
  display: block;
  padding: 14px 16px;
  font-weight: 700;
}

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

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

.field span {
  font-weight: 600;
}

input,
select,
textarea,
.upload-drop {
  width: 100%;
  border: 1px solid rgba(99, 66, 36, 0.14);
  border-radius: 18px;
  background: var(--surface-strong);
  color: var(--text);
  font: inherit;
}

input,
select,
textarea {
  padding: 14px 16px;
}

textarea {
  resize: vertical;
  min-height: 132px;
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid rgba(196, 93, 45, 0.18);
  border-color: rgba(196, 93, 45, 0.45);
}

.upload-drop {
  position: relative;
  min-height: 172px;
  padding: 18px;
  display: grid;
  place-items: center;
  gap: 8px;
  text-align: center;
  border-style: dashed;
  background:
    linear-gradient(180deg, rgba(255, 246, 235, 0.96), rgba(255, 238, 221, 0.96));
}

.upload-drop input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.upload-drop strong {
  font-size: 18px;
}

.upload-drop small {
  color: var(--muted);
}

.image-preview img {
  width: 100%;
  max-height: 260px;
  object-fit: cover;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
}

.primary-btn {
  border: 0;
  border-radius: 18px;
  padding: 16px 18px;
  font: inherit;
  font-weight: 700;
  color: white;
  cursor: pointer;
  background: linear-gradient(135deg, #d96e3f 0%, #b44717 100%);
  box-shadow: 0 18px 40px rgba(180, 71, 23, 0.25);
  transition: transform 180ms ease, box-shadow 180ms ease, opacity 180ms ease;
}

.primary-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 22px 44px rgba(180, 71, 23, 0.33);
}

.primary-btn:disabled {
  opacity: 0.6;
  cursor: wait;
}

.status-card {
  padding: 18px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255, 252, 247, 0.95), rgba(244, 232, 217, 0.9));
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.status-card.success {
  border-color: rgba(45, 122, 84, 0.25);
}

.status-card.error {
  border-color: rgba(156, 46, 46, 0.24);
}

.status-label {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.progress-bar {
  margin-top: 16px;
  width: 100%;
  height: 14px;
  border-radius: 999px;
  background: rgba(99, 66, 36, 0.08);
  overflow: hidden;
}

.progress-fill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #d86d3e, #7e3214);
  transition: width 300ms ease;
}

.task-meta,
.download-links {
  margin-top: 16px;
  display: grid;
  gap: 10px;
}

.task-pill,
.download-links a {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  max-width: 100%;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
  text-decoration: none;
  color: var(--text);
  word-break: break-all;
}

.preview-wrap {
  margin-top: 18px;
}

.viewer-wrap,
.render-wrap {
  overflow: hidden;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255, 253, 249, 0.94), rgba(247, 239, 227, 0.94));
}

#model-viewer {
  width: 100%;
  height: 380px;
  --poster-color: transparent;
}

.render-wrap img {
  display: block;
  width: 100%;
  max-height: 380px;
  object-fit: contain;
}

.result-json {
  margin-top: 16px;
  padding: 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: #2a1d16;
  color: #ffe8d2;
  overflow: auto;
  max-height: 320px;
  font-size: 12px;
  line-height: 1.6;
}

.hidden {
  display: none !important;
}

@media (max-width: 960px) {
  .hero,
  .grid,
  .field-row {
    grid-template-columns: 1fr;
  }

  .page-shell {
    width: min(100% - 20px, 1200px);
    padding-top: 18px;
  }

  .hero-copy,
  .hero-card,
  .panel {
    border-radius: 22px;
  }
}
