:root {
  --bg: #0c0a0f;
  --panel: rgba(22, 18, 28, 0.9);
  --line: rgba(255, 255, 255, 0.1);
  --amber: #e8a54b;
  --rose: #d4786a;
  --fog: rgba(248, 242, 236, 0.94);
  --muted: rgba(210, 198, 186, 0.62);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(ellipse 65% 40% at 15% -8%, rgba(232, 165, 75, 0.14), transparent 55%),
    radial-gradient(ellipse 45% 35% at 95% 8%, rgba(212, 120, 106, 0.12), transparent 50%),
    linear-gradient(165deg, #100d14, #0c0a0f 48%, #09080c);
  color: var(--fog);
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

.back-btn {
  position: fixed;
  z-index: 20;
  top: max(12px, var(--safe-top));
  left: max(12px, var(--safe-left));
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(12, 10, 16, 0.78);
  color: #fff;
  text-decoration: none;
  font-size: 0.85rem;
  backdrop-filter: blur(8px);
}

.hero {
  max-width: 920px;
  margin: 0 auto;
  padding: calc(72px + var(--safe-top)) 20px 12px;
}

.eyebrow {
  margin: 0 0 8px;
  letter-spacing: 0.18em;
  font-size: 0.72rem;
  color: var(--amber);
}

.hero h1 {
  margin: 0;
  font-size: clamp(1.9rem, 4.2vw, 2.7rem);
  font-weight: 750;
  letter-spacing: 0.06em;
}

.lead {
  margin: 12px 0 0;
  max-width: 40rem;
  color: var(--muted);
  line-height: 1.65;
  font-size: 0.98rem;
}

.layout {
  max-width: 920px;
  margin: 0 auto;
  padding: 8px 20px 64px;
  display: grid;
  gap: 16px;
}

.panel {
  padding: 18px 18px 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel);
  backdrop-filter: blur(10px);
}

.panel h2 {
  margin: 0 0 10px;
  font-size: 1.05rem;
  font-weight: 650;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.panel-head h2 {
  margin: 0;
}

.badge {
  font-size: 0.78rem;
  color: var(--amber);
  border: 1px solid rgba(232, 165, 75, 0.35);
  border-radius: 999px;
  padding: 4px 10px;
}

.hint {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.5;
}

.hint.is-error {
  color: #ff8f7a;
}

.hint.is-ok {
  color: #8fd4a8;
}

.upload {
  display: grid;
  place-items: center;
  min-height: 180px;
  border: 1px dashed rgba(255, 255, 255, 0.22);
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.22);
  cursor: pointer;
  overflow: hidden;
  position: relative;
  transition: border-color 0.2s, background 0.2s;
}

.upload:hover,
.upload.is-drag {
  border-color: rgba(232, 165, 75, 0.55);
  background: rgba(232, 165, 75, 0.06);
}

.upload.has-file {
  min-height: 220px;
}

#uploadText {
  color: var(--muted);
  font-size: 0.92rem;
  padding: 16px;
  text-align: center;
}

#preview {
  max-width: 100%;
  max-height: 320px;
  object-fit: contain;
  display: block;
}

.style-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}

.style-card {
  appearance: none;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--fog);
  padding: 14px 12px;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.18s, transform 0.18s, background 0.18s;
}

.style-card:hover {
  border-color: rgba(232, 165, 75, 0.4);
  transform: translateY(-1px);
}

.style-card.is-active {
  border-color: rgba(232, 165, 75, 0.75);
  background: linear-gradient(160deg, rgba(232, 165, 75, 0.16), rgba(212, 120, 106, 0.08));
  box-shadow: 0 0 0 1px rgba(232, 165, 75, 0.2);
}

.style-card__label {
  display: block;
  font-weight: 650;
  font-size: 0.95rem;
}

.style-card__blurb {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.4;
}

.options-root {
  display: grid;
  gap: 14px;
}

.opt-group h3 {
  margin: 0 0 8px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--muted);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  appearance: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--fog);
  padding: 7px 12px;
  font-size: 0.84rem;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.chip:hover {
  border-color: rgba(255, 255, 255, 0.28);
}

.chip.is-active {
  border-color: rgba(232, 165, 75, 0.7);
  background: rgba(232, 165, 75, 0.18);
  color: #fff;
}

.meta-row {
  margin-top: 14px;
  display: grid;
  gap: 10px;
}

.meta-row label {
  display: grid;
  gap: 6px;
  font-size: 0.86rem;
  color: var(--muted);
}

select {
  appearance: none;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.28);
  color: var(--fog);
  padding: 10px 12px;
  font: inherit;
}

.actions {
  margin-top: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 10px 18px;
  font-size: 0.92rem;
  text-decoration: none;
  border: 1px solid var(--line);
  cursor: pointer;
  color: var(--fog);
  background: transparent;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-primary {
  border-color: transparent;
  background: linear-gradient(120deg, #e8a54b, #d4786a);
  color: #1a120c;
  font-weight: 700;
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.04);
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}

.result-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.25);
}

.result-card img {
  width: 100%;
  display: block;
  aspect-ratio: 1;
  object-fit: cover;
  background: #111;
}

.result-card__bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
}

.result-card__bar a {
  color: var(--amber);
  text-decoration: none;
  font-size: 0.86rem;
}

@media (max-width: 560px) {
  .style-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
