:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --bg: #fff7ed;
  --card: #ffffff;
  --ink: #182230;
  --muted: #667085;
  --brand: #e11d48;
  --brand-2: #f97316;
  --brand-3: #7c3aed;
  --line: #eadfd5;
  --shadow: 0 24px 60px rgba(88, 28, 28, 0.13);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 8% 8%, rgba(225, 29, 72, 0.16), transparent 32rem),
    radial-gradient(circle at 92% 4%, rgba(249, 115, 22, 0.18), transparent 30rem),
    linear-gradient(180deg, #fff7ed 0%, #fff 52%, #fff7ed 100%);
  color: var(--ink);
}

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

.hero {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-start;
  margin-bottom: 28px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--brand);
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 0.76rem;
}

h1 {
  margin: 0;
  font-size: clamp(2.25rem, 6vw, 4.8rem);
  line-height: 0.96;
  max-width: 820px;
  letter-spacing: -0.055em;
}

.lead {
  max-width: 760px;
  color: var(--muted);
  font-size: 1.07rem;
  line-height: 1.65;
}

.badge {
  flex: 0 0 auto;
  width: 122px;
  height: 122px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  text-align: center;
  font-weight: 950;
  color: white;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  box-shadow: var(--shadow);
  transform: rotate(7deg);
}

.workspace {
  display: grid;
  grid-template-columns: 430px 1fr;
  gap: 22px;
}

.panel {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(234, 223, 213, 0.95);
  box-shadow: var(--shadow);
  border-radius: 28px;
  padding: 24px;
  backdrop-filter: blur(8px);
}

.controls {
  display: grid;
  gap: 16px;
}

h2 {
  margin: 0;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
}

label {
  display: grid;
  gap: 8px;
  color: #344054;
  font-weight: 780;
}

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

input,
select,
button {
  width: 100%;
  border-radius: 14px;
  border: 1px solid var(--line);
  padding: 12px 13px;
  font: inherit;
}

input,
select {
  background: #fffaf5;
  color: var(--ink);
}

button {
  margin-top: 2px;
  border: 0;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: white;
  font-weight: 950;
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease;
  box-shadow: 0 14px 30px rgba(225, 29, 72, 0.24);
}

button:hover { transform: translateY(-1px); }
button:active { transform: translateY(0); }

input[type="file"] {
  padding: 10px 12px;
  color: var(--muted);
  cursor: pointer;
}

.photo-upload-actions {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: center;
  margin-top: -4px;
}

button.secondary-button {
  width: auto;
  margin: 0;
  padding: 9px 12px;
  border: 1px solid #fecdd3;
  background: #fff1f2;
  color: #be123c;
  box-shadow: none;
  font-size: 0.88rem;
}

.photo-status {
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.35;
}

.preview-photo {
  filter: saturate(1.04) contrast(1.02);
}

.photo-window-stroke {
  pointer-events: none;
}

.hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

.preview {
  min-height: 560px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 20px;
}

.preview-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.preview-header p {
  margin: 6px 0 0;
  color: var(--muted);
}

.pill {
  white-space: nowrap;
  border-radius: 999px;
  background: #fff1f2;
  color: #be123c;
  padding: 8px 12px;
  font-weight: 900;
  font-size: 0.86rem;
}

#preview-svg {
  width: 100%;
  min-height: 360px;
  border-radius: 22px;
  background:
    linear-gradient(90deg, rgba(15, 23, 42, 0.045) 1px, transparent 1px),
    linear-gradient(rgba(15, 23, 42, 0.045) 1px, transparent 1px),
    #fffdfb;
  background-size: 24px 24px;
  border: 1px dashed #decfc0;
}

.stats {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr;
  gap: 12px;
  margin: 0;
}

.stats div {
  background: #fff8f1;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px;
}

.stats dt {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.stats dd {
  margin: 6px 0 0;
  font-size: 1.18rem;
  font-weight: 950;
}

.frame-outline { filter: drop-shadow(0 18px 18px rgba(88, 28, 28, 0.16)); }

@media (max-width: 900px) {
  .shell { padding: 28px 0; }
  .hero { flex-direction: column; }
  .workspace { grid-template-columns: 1fr; }
  .badge { width: 96px; height: 96px; }
}

@media (max-width: 520px) {
  .grid-two,
  .stats,
  .photo-upload-actions { grid-template-columns: 1fr; }

  button.secondary-button { width: 100%; }
}

/* Live rotatable 3D viewer */
.viewer-panel {
  margin-top: 22px;
  display: grid;
  gap: 18px;
}

.viewer-header {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
}

.viewer-header p {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.eyebrow.mini {
  margin-bottom: 8px;
  font-size: 0.68rem;
}

button.viewer-reset {
  width: auto;
  flex: 0 0 auto;
  margin: 0;
  padding: 10px 14px;
  border: 1px solid #fecdd3;
  background: #fff1f2;
  color: #be123c;
  box-shadow: none;
}

.viewer-canvas-wrap {
  position: relative;
  overflow: hidden;
  border: 1px solid #eadfd5;
  border-radius: 24px;
  background: linear-gradient(145deg, #fffdfb 0%, #fff7ed 54%, #fff1f2 100%);
}

#viewer-canvas {
  background: transparent;
  display: block;
  width: 100%;
  height: 520px;
  cursor: grab;
  touch-action: none;
}

#viewer-canvas.is-dragging {
  cursor: grabbing;
}

.viewer-hint {
  position: absolute;
  left: 18px;
  bottom: 14px;
  margin: 0;
  padding: 9px 12px;
  border: 1px solid rgba(234, 223, 213, 0.9);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.86);
  color: var(--muted);
  font-weight: 850;
  font-size: 0.86rem;
  box-shadow: 0 12px 32px rgba(88, 28, 28, 0.12);
}

@media (max-width: 720px) {
  .viewer-header {
    flex-direction: column;
  }

  button.viewer-reset {
    width: 100%;
  }

  #viewer-canvas {
    height: 400px;
  }

  .viewer-hint {
    position: static;
    border-radius: 0;
    border-width: 1px 0 0;
    box-shadow: none;
  }
}
