:root {
  color-scheme: light;
  --ink: #3f3437;
  --muted: #7f6d6f;
  --cream: #fff8ef;
  --cream-2: #ffeadd;
  --rose: #ef8ea2;
  --mint: #8be5cf;
  --gold: #ffd983;
  --panel: rgba(255, 251, 245, 0.78);
  --line: rgba(255, 255, 255, 0.78);
  --shadow: 0 28px 80px rgba(125, 81, 78, 0.18);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: #fff5ed;
}

body {
  min-height: 100%;
  margin: 0;
  color: var(--ink);
  font-family: "Avenir Next", "SF Pro Display", "PingFang TC", "Noto Sans TC", sans-serif;
  background:
    radial-gradient(circle at 14% 8%, rgba(255, 255, 255, 0.95), transparent 28%),
    radial-gradient(circle at 88% 18%, rgba(255, 205, 187, 0.64), transparent 28%),
    radial-gradient(circle at 12% 88%, rgba(176, 245, 226, 0.58), transparent 30%),
    linear-gradient(135deg, #fffaf4 0%, #ffece2 54%, #ffe3dc 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.42;
  background-image:
    linear-gradient(rgba(122, 84, 82, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(122, 84, 82, 0.05) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(circle at center, black, transparent 76%);
}

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

button,
input,
select {
  font: inherit;
}

.app-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: max(22px, env(safe-area-inset-top)) 0 70px;
  position: relative;
}

.topbar,
.hero-panel,
.stage-card,
.idea-card {
  position: relative;
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border-radius: 999px;
  padding: 10px;
  margin-bottom: 18px;
}

.brand-pill {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.68);
}

.brand-pill span,
.eyebrow {
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-size: 0.74rem;
  font-weight: 800;
  color: #a46a72;
}

.brand-pill strong {
  font-size: 0.98rem;
}

.top-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.top-actions a {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  border-radius: 999px;
  padding: 0 16px;
  background: rgba(255, 255, 255, 0.55);
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.hero-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 390px);
  gap: 22px;
  border-radius: 34px;
  padding: clamp(22px, 4vw, 42px);
  overflow: hidden;
}

.hero-panel::after,
.stage-card::after,
.idea-card::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 86% 14%, rgba(255, 255, 255, 0.72), transparent 18%),
    linear-gradient(120deg, transparent 0 46%, rgba(255, 255, 255, 0.2) 46% 50%, transparent 50% 100%);
}

.hero-copy,
.control-card,
.stage-toolbar,
.dock,
.idea-card > * {
  position: relative;
  z-index: 1;
}

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

h1 {
  margin-bottom: 18px;
  max-width: 720px;
  font-size: clamp(2.35rem, 7vw, 5.35rem);
  line-height: 0.96;
  letter-spacing: -0.07em;
}

h2 {
  margin-bottom: 8px;
  font-size: clamp(1.38rem, 3vw, 2rem);
  letter-spacing: -0.04em;
}

.hero-copy p:not(.eyebrow),
.idea-card p {
  max-width: 650px;
  color: var(--muted);
  line-height: 1.78;
  font-size: 1.03rem;
}

.control-card {
  display: grid;
  gap: 12px;
  align-self: stretch;
}

.field,
.upload-field,
.color-field {
  display: grid;
  gap: 8px;
  border-radius: 24px;
  padding: 15px;
  background: rgba(255, 255, 255, 0.66);
  border: 1px solid rgba(255, 255, 255, 0.85);
}

.field span,
.upload-field span,
.color-field span,
.slider span {
  color: #6d5a5d;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.field input,
.field select {
  width: 100%;
  border: 0;
  border-radius: 16px;
  padding: 13px 14px;
  color: var(--ink);
  background: #fffaf7;
  outline: 1px solid rgba(137, 99, 98, 0.08);
}

.field select {
  min-height: 46px;
  appearance: none;
  cursor: pointer;
}

.field input:focus,
.field select:focus {
  outline-color: rgba(239, 142, 162, 0.5);
}

.control-grid,
.color-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.color-grid {
  grid-template-columns: repeat(3, 1fr);
}

.color-field {
  min-height: 84px;
  align-content: center;
}

.color-field input {
  width: 100%;
  height: 42px;
  padding: 3px;
  border: 0;
  border-radius: 16px;
  background: #fffaf7;
  cursor: pointer;
  outline: 1px solid rgba(137, 99, 98, 0.08);
}

.upload-field {
  cursor: pointer;
}

.upload-field input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
  pointer-events: none;
}

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

.stage-card,
.idea-card {
  margin-top: 18px;
  border-radius: 34px;
  padding: clamp(18px, 3vw, 28px);
  overflow: hidden;
}

.stage-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 16px;
}

.stage-toolbar h2 {
  margin-bottom: 0;
}

.status-pills {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.status-pills span {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0 14px;
  color: #6c565a;
  background: rgba(255, 255, 255, 0.66);
  font-size: 0.82rem;
  font-weight: 800;
}

.canvas-wrap {
  position: relative;
  z-index: 1;
  min-height: clamp(360px, 58vw, 620px);
  border-radius: 30px;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 18%, rgba(255, 238, 210, 0.25), transparent 32%),
    linear-gradient(135deg, #191518 0%, #2f2327 50%, #181619 100%);
  border: 1px solid rgba(255, 255, 255, 0.66);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.24), 0 24px 60px rgba(72, 42, 46, 0.28);
}

#clothCanvas {
  display: block;
  width: 100%;
  height: 100%;
  min-height: inherit;
  touch-action: none;
  cursor: grab;
}

#clothCanvas:active {
  cursor: grabbing;
}

.canvas-hint {
  position: absolute;
  left: 18px;
  bottom: 18px;
  border-radius: 999px;
  padding: 12px 16px;
  color: rgba(255, 255, 255, 0.84);
  background: rgba(24, 18, 22, 0.42);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  font-size: 0.92rem;
  font-weight: 700;
  pointer-events: none;
}

.dock {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.slider {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
  min-height: 56px;
  padding: 12px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid rgba(255, 255, 255, 0.78);
}

.slider input {
  width: 100%;
  accent-color: var(--rose);
}

.slider strong {
  color: #9c6870;
  font-size: 0.9rem;
}

.button-row {
  grid-column: 1 / -1;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

button {
  border: 0;
  min-height: 48px;
  border-radius: 999px;
  padding: 0 18px;
  color: #6f565a;
  background: rgba(255, 255, 255, 0.7);
  font-weight: 800;
  cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.8);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

button:hover {
  transform: translateY(-1px);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.94), 0 12px 24px rgba(128, 82, 82, 0.12);
}

button.primary {
  color: #4c3f3f;
  background: linear-gradient(135deg, #ff93a9, #ffd983);
}

.idea-card {
  max-width: 760px;
}

.local-only[hidden] {
  display: none;
}

@media (max-width: 880px) {
  .hero-panel {
    grid-template-columns: 1fr;
  }

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

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

@media (max-width: 620px) {
  .app-shell {
    width: min(100% - 20px, 1180px);
    padding-bottom: 36px;
  }

  .topbar {
    align-items: stretch;
    border-radius: 28px;
  }

  .brand-pill,
  .top-actions {
    width: 100%;
  }

  .top-actions a {
    flex: 1;
    justify-content: center;
  }

  .hero-panel,
  .stage-card,
  .idea-card {
    border-radius: 28px;
  }

  h1 {
    font-size: clamp(2.15rem, 13vw, 3.7rem);
  }

  .stage-toolbar {
    display: grid;
  }

  .status-pills {
    justify-content: flex-start;
  }

  .canvas-wrap {
    min-height: 430px;
    border-radius: 24px;
  }

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

  .control-grid,
  .color-grid {
    grid-template-columns: 1fr;
  }

  .slider {
    grid-template-columns: 78px 1fr 34px;
  }

  .button-row {
    justify-content: stretch;
  }

  .button-row button {
    flex: 1 1 140px;
  }
}

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