:root {
  --bone: #f7f4ee;
  --paper: #fffdf9;
  --ink: #171514;
  --muted: #77716b;
  --line: rgba(23, 21, 20, .16);
  --wine: #741d34;
  --wine-deep: #4b1021;
  --candle: #c69a52;
  --sage: #687166;
  --serif: "Newsreader", Georgia, serif;
  --sans: "DM Sans", Arial, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { background: var(--bone); }
body {
  min-width: 320px;
  margin: 0;
  overflow: hidden;
  background: var(--bone);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button, input, textarea { color: inherit; font: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--wine); outline-offset: 3px; }

.prototype-note {
  height: 25px;
  display: grid;
  place-items: center;
  padding: 0 18px;
  background: var(--wine);
  color: #fff7f8;
  font-size: 8px;
  letter-spacing: .13em;
  text-align: center;
  text-transform: uppercase;
}

.builder-header {
  height: 57px;
  display: grid;
  grid-template-columns: 38px 1fr minmax(110px, 180px) 40px;
  gap: 16px;
  align-items: center;
  padding: 0 clamp(16px, 3vw, 46px);
  border-bottom: 1px solid var(--line);
  background: rgba(247, 244, 238, .96);
}
.header-back,
.header-close {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 10px;
}
.header-back { font-size: 17px; text-align: left; }
.header-close { text-align: right; }
.builder-wordmark {
  width: max-content;
  color: var(--wine);
  font-family: var(--serif);
  font-size: 18px;
  letter-spacing: .09em;
  line-height: 1;
}
.builder-wordmark span { color: var(--candle); }
.header-progress { display: grid; grid-template-columns: 44px 1fr; gap: 9px; align-items: center; }
.header-progress span { color: var(--muted); font-size: 8px; letter-spacing: .08em; }
.header-progress i { height: 1px; display: block; overflow: hidden; background: rgba(23,21,20,.13); }
.header-progress b { width: 14.285%; height: 100%; display: block; background: var(--wine); transition: width .35s ease; }

.builder {
  position: relative;
  height: calc(100svh - 82px);
  display: grid;
  grid-template-rows: minmax(0, 44fr) minmax(0, 56fr);
  padding-bottom: 74px;
}

.builder-preview {
  min-height: 0;
  display: grid;
  grid-template-rows: 24px minmax(0, 1fr) 40px;
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: 10px clamp(16px, 4vw, 56px) 0;
}
.preview-kicker,
.preview-caption {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.preview-kicker { color: var(--muted); font-size: 7px; letter-spacing: .12em; text-transform: uppercase; }
.preview-stage {
  position: relative;
  min-height: 0;
  overflow: hidden;
  background: #f1eee8;
}
.product-preview {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  mix-blend-mode: multiply;
  transition: opacity .2s ease, transform .45s cubic-bezier(.2,.7,.2,1);
}
.preview-stage.is-changing .product-preview { opacity: .15; transform: scale(.985); }
.preview-caption { padding-top: 8px; }
.preview-caption div { min-width: 0; display: flex; align-items: baseline; gap: 12px; }
.preview-caption strong { overflow: hidden; font-family: var(--serif); font-size: 17px; font-weight: 400; text-overflow: ellipsis; white-space: nowrap; }
.preview-caption span,
.preview-caption p { margin: 0; color: var(--muted); font-size: 8px; }

.crop-preview {
  position: absolute;
  inset: 50% auto auto 50%;
  width: min(34vh, 260px);
  aspect-ratio: 1;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.85);
  border-radius: 50%;
  background: #1b1918;
  box-shadow: 0 18px 70px rgba(23,21,20,.26), 0 0 0 200vw rgba(247,244,238,.62);
  transform: translate(-50%, -50%);
}
.crop-photo,
.projection-photo {
  width: 100%;
  height: 100%;
  background-color: #ddd;
  background-repeat: no-repeat;
  background-position: center;
  background-size: cover;
}
.crop-preview > span {
  position: absolute;
  right: 0;
  bottom: 18px;
  left: 0;
  color: white;
  font-size: 7px;
  letter-spacing: .15em;
  text-align: center;
  text-shadow: 0 1px 6px rgba(0,0,0,.65);
  text-transform: uppercase;
}

.projection-preview {
  --projection-opacity: .5;
  --projection-blur: .82px;
  position: absolute;
  inset: 0;
  overflow: hidden;
  background:
    linear-gradient(103deg, rgba(255,255,255,.025), transparent 38%),
    radial-gradient(ellipse at 54% 43%, #3f3c36 0, #2a2925 45%, #171715 100%);
}
.projection-preview::before,
.projection-preview::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.projection-preview::before {
  z-index: 1;
  opacity: .24;
  background:
    repeating-linear-gradient(7deg, rgba(255,255,255,.035) 0 1px, transparent 1px 7px),
    repeating-linear-gradient(91deg, rgba(0,0,0,.035) 0 1px, transparent 1px 11px);
  mix-blend-mode: soft-light;
}
.projection-preview::after {
  z-index: 6;
  background: radial-gradient(ellipse at center, transparent 42%, rgba(8,8,7,.24) 79%, rgba(7,7,6,.5) 100%);
}
.projection-wall-glow {
  position: absolute;
  z-index: 2;
  top: 1%;
  left: 50%;
  width: min(30vh, 240px);
  aspect-ratio: 1.08;
  border-radius: 46%;
  background: radial-gradient(ellipse, rgba(255,239,208,.14), rgba(232,208,169,.055) 43%, transparent 72%);
  filter: blur(15px);
  transform: translateX(-50%) rotate(-1.5deg);
}
.projection-beam {
  position: absolute;
  z-index: 2;
  left: 50%;
  bottom: -12%;
  width: min(28vh, 224px);
  height: 93%;
  opacity: .25;
  background: linear-gradient(0deg, rgba(255,229,183,.025), rgba(255,238,204,.07) 48%, rgba(255,246,225,.11));
  clip-path: polygon(48% 100%, 52% 100%, 76% 9%, 24% 9%);
  filter: blur(15px);
  transform: translateX(-50%) perspective(400px) rotateX(2deg);
  transform-origin: bottom center;
}
.projection-image-field {
  position: absolute;
  z-index: 4;
  top: 11%;
  left: 50%;
  width: clamp(108px, 18vh, 148px);
  aspect-ratio: 1.04;
  overflow: hidden;
  border-radius: 46% 49% 45% 48% / 48% 45% 50% 46%;
  opacity: var(--projection-opacity);
  filter: blur(var(--projection-blur));
  -webkit-mask-image: radial-gradient(ellipse at 50% 48%, #000 0 44%, rgba(0,0,0,.9) 58%, rgba(0,0,0,.34) 75%, transparent 91%);
  mask-image: radial-gradient(ellipse at 50% 48%, #000 0 44%, rgba(0,0,0,.9) 58%, rgba(0,0,0,.34) 75%, transparent 91%);
  box-shadow:
    0 0 9px 2px rgba(255,242,218,.26),
    0 0 30px 9px rgba(212,177,118,.12),
    0 0 58px 22px rgba(183,142,86,.055);
  transform: translateX(-50%) perspective(420px) rotateX(-4deg) rotateZ(-1.2deg) skewX(-1deg);
  animation: projection-handheld 5.8s ease-in-out infinite alternate;
}
.projection-image-field::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 44% 42%, transparent 34%, rgba(248,228,196,.055) 58%, rgba(25,22,19,.44) 100%),
    linear-gradient(118deg, rgba(255,255,255,.045), transparent 42%);
  mix-blend-mode: soft-light;
  pointer-events: none;
}
.projection-photo {
  width: 100%;
  height: 100%;
  background-color: #80796f;
  background-repeat: no-repeat;
  background-position: center;
  background-size: cover;
  filter: saturate(.48) contrast(.78) brightness(.73) sepia(.16);
}
.projection-source {
  position: absolute;
  z-index: 5;
  bottom: -18px;
  left: 50%;
  width: 76px;
  height: 58px;
  transform: translateX(-50%);
}
.projection-phone {
  position: absolute;
  right: 2px;
  bottom: 0;
  width: 58px;
  height: 42px;
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 10px 10px 0 0;
  background: linear-gradient(135deg, #191919, #30302f);
  box-shadow: 0 -2px 18px rgba(0,0,0,.4);
}
.projection-phone::before {
  content: "";
  position: absolute;
  top: 7px;
  left: 9px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #fff4d8;
  box-shadow: 0 0 9px 3px rgba(255,231,184,.72), 0 0 30px 8px rgba(225,178,101,.28);
}
.projection-lens {
  position: absolute;
  z-index: 2;
  bottom: 26px;
  left: 19px;
  width: 17px;
  height: 17px;
  border: 3px solid #9c9b96;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 36%, #eee7d8 0 6%, #242321 31%, #070707 75%);
  box-shadow: 0 3px 8px rgba(0,0,0,.5);
}
.projection-preview p {
  position: absolute;
  z-index: 8;
  top: 12px;
  left: 14px;
  max-width: 220px;
  display: grid;
  gap: 2px;
  margin: 0;
  color: rgba(255,255,255,.56);
  text-align: left;
}
.projection-preview p b { color: rgba(255,255,255,.76); font-size: 7px; letter-spacing: .11em; }
.projection-preview p span { font-size: 6px; line-height: 1.35; }
.preview-mode {
  position: absolute;
  z-index: 4;
  right: 12px;
  top: 12px;
  min-height: 30px;
  padding: 0 11px;
  border: 1px solid rgba(116,29,52,.3);
  border-radius: 999px;
  background: rgba(255,253,249,.88);
  color: var(--wine);
  font-size: 8px;
}

.builder-controls {
  min-height: 0;
  overflow: hidden;
  border-top: 1px solid var(--line);
  background: var(--paper);
}
.step-content {
  width: min(980px, 100%);
  height: 100%;
  margin: 0 auto;
  overflow-y: auto;
  padding: 18px clamp(16px, 4vw, 48px) 30px;
  scrollbar-width: thin;
  animation: step-enter .38s cubic-bezier(.2,.75,.25,1) both;
}
.step-heading { display: grid; grid-template-columns: 42px 1fr; gap: 12px; align-items: start; }
.step-index { padding-top: 5px; color: var(--wine); font-size: 8px; letter-spacing: .1em; }
.step-heading h1 { margin: 0; font-family: var(--serif); font-size: clamp(28px, 3vw, 42px); font-weight: 400; letter-spacing: -.035em; line-height: .98; }
.step-heading p { max-width: 610px; margin: 7px 0 0; color: var(--muted); font-size: 10px; line-height: 1.45; }
.step-body { margin: 18px 0 0 54px; }

.choice-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.choice {
  min-height: 50px;
  display: grid;
  align-content: center;
  gap: 2px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  background: transparent;
  text-align: left;
  transition: border-color .18s ease, background .18s ease;
}
.choice:hover,
.choice.is-selected { border-color: var(--wine); background: #fff; }
.choice.is-selected { box-shadow: inset 0 0 0 1px var(--wine); }
.choice b { font-size: 10px; font-weight: 500; }
.choice small { color: var(--muted); font-size: 7px; }

.meaning-custom { display: grid; grid-template-columns: 1fr auto; gap: 10px; margin-top: 10px; }
.meaning-custom input {
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  font-size: 10px;
  outline: 0;
}
.meaning-custom input:focus { border-color: var(--wine); }
.meaning-custom button { padding: 0 15px; border: 1px solid var(--ink); background: transparent; font-size: 9px; }

.style-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.style-choice { padding: 0; overflow: hidden; border: 1px solid var(--line); background: transparent; text-align: left; }
.style-choice.is-selected { border-color: var(--wine); box-shadow: inset 0 0 0 1px var(--wine); }
.style-choice figure { aspect-ratio: 1.55; margin: 0; overflow: hidden; background: #f1eee8; }
.style-choice img { width: 100%; height: 100%; display: block; object-fit: cover; transition: transform .35s ease; }
.style-choice:hover img { transform: scale(1.018); }
.style-choice div { display: grid; gap: 3px; padding: 9px 10px; }
.style-choice b { font-size: 10px; font-weight: 500; }
.style-choice span { color: var(--muted); font-size: 7px; }

.line-choices { border-top: 1px solid var(--line); }
.line-choice {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 18px;
  align-items: center;
  padding: 12px 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  text-align: left;
}
.line-choice div { display: grid; gap: 3px; }
.line-choice b { font-size: 10px; font-weight: 500; }
.line-choice small { color: var(--muted); font-size: 8px; }
.line-choice span { color: var(--wine); font-size: 9px; }
.line-choice.is-selected b::before { content: "●"; margin-right: 9px; color: var(--wine); font-size: 7px; }

.finish-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; }
.finish-choice { padding: 0; overflow: hidden; border: 1px solid var(--line); background: transparent; text-align: left; }
.finish-choice.is-selected { border-color: var(--wine); box-shadow: inset 0 0 0 1px var(--wine); }
.finish-choice figure { aspect-ratio: 2.1; margin: 0; overflow: hidden; background: #f1eee8; }
.finish-choice img { width: 100%; height: 100%; display: block; object-fit: cover; }
.finish-choice div { display: flex; align-items: center; justify-content: space-between; padding: 9px 10px; }
.finish-choice b { font-size: 9px; font-weight: 500; }
.finish-choice i { width: 13px; height: 13px; border-radius: 50%; }
.finish-choice i.silver { background: linear-gradient(135deg,#f4f4f1,#90928f); }
.finish-choice i.gold { background: linear-gradient(135deg,#efd58e,#9c6d27); }
.finish-choice i.rose { background: linear-gradient(135deg,#e7bbb4,#a2635d); }

.upload-zone {
  min-height: 116px;
  display: grid;
  place-items: center;
  padding: 22px;
  border: 1px dashed rgba(116,29,52,.42);
  background: #fbf8f2;
  text-align: center;
}
.upload-zone div { display: grid; gap: 7px; }
.upload-zone b { font-family: var(--serif); font-size: 21px; font-weight: 400; }
.upload-zone span { color: var(--muted); font-size: 8px; }
.upload-zone label { width: max-content; margin: 4px auto 0; padding: 8px 13px; border: 1px solid var(--wine); border-radius: 999px; color: var(--wine); font-size: 8px; cursor: pointer; }
.upload-zone input { position: absolute; width: 1px; height: 1px; overflow: hidden; opacity: 0; }
.upload-status { display: grid; grid-template-columns: 1fr auto; gap: 16px; margin-top: 9px; color: var(--muted); font-size: 8px; }

.crop-controls { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 18px; }
.range-control { display: grid; gap: 7px; }
.range-control label { display: flex; justify-content: space-between; color: var(--muted); font-size: 8px; }
.range-control input { width: 100%; accent-color: var(--wine); }
.clarity-box {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 14px;
  align-items: center;
  margin-top: 14px;
  padding: 11px 12px;
  border: 1px solid var(--line);
}
.clarity-score { width: 42px; aspect-ratio: 1; display: grid; place-items: center; border: 1px solid var(--sage); border-radius: 50%; color: var(--sage); font: 17px var(--serif); }
.clarity-box b { display: block; font-size: 9px; font-weight: 500; }
.clarity-box p { margin: 3px 0 0; color: var(--muted); font-size: 8px; }
.proof-toggle { margin-top: 10px; padding: 0; border: 0; border-bottom: 1px solid currentColor; background: transparent; color: var(--wine); font-size: 8px; }
.wall-preview-note { max-width: 560px; margin: 9px 0 0; color: var(--muted); font-size: 8px; line-height: 1.45; }

.review-table { border-top: 1px solid var(--line); }
.review-row { display: grid; grid-template-columns: 100px 1fr auto; gap: 14px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 9px; }
.review-row span { color: var(--muted); }
.review-row b { font-weight: 500; }
.review-row em { color: var(--muted); font-style: normal; }
.review-note { margin-top: 12px; padding: 10px 12px; background: #f1ece4; color: var(--muted); font-size: 8px; line-height: 1.5; }

.builder-actions {
  position: fixed;
  z-index: 20;
  right: 0;
  bottom: 0;
  left: 0;
  height: 74px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 28px;
  align-items: center;
  padding: 0 clamp(16px, 4vw, 56px);
  border-top: 1px solid var(--line);
  background: rgba(247,244,238,.97);
  backdrop-filter: blur(14px);
}
.price-summary { display: flex; align-items: baseline; gap: 16px; min-width: 0; }
.price-summary span { overflow: hidden; color: var(--muted); font-size: 8px; text-overflow: ellipsis; white-space: nowrap; }
.price-summary strong { font: 24px var(--serif); font-weight: 400; }
.action-buttons { display: flex; gap: 8px; }
.quiet-button,
.continue-button { min-height: 39px; border-radius: 999px; font-size: 9px; }
.quiet-button { padding: 0 15px; border: 1px solid var(--line); background: transparent; color: var(--muted); }
.continue-button { min-width: 126px; padding: 0 20px; border: 1px solid var(--wine); background: var(--wine); color: white; }
.continue-button:hover { background: var(--wine-deep); }
.continue-button:disabled { cursor: not-allowed; opacity: .38; }

.bag-confirmation {
  position: fixed;
  z-index: 60;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(17,16,15,.62);
  backdrop-filter: blur(10px);
}
.bag-confirmation > div { width: min(500px, 100%); padding: 34px; background: var(--paper); }
.bag-confirmation p { margin: 0 0 36px; color: var(--wine); font-size: 8px; letter-spacing: .13em; }
.bag-confirmation h2 { margin: 0; font: 40px/1 var(--serif); font-weight: 400; letter-spacing: -.04em; }
.bag-confirmation span { display: block; margin-top: 14px; color: var(--muted); font-size: 10px; line-height: 1.55; }
.bag-confirmation-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 28px; }
.bag-confirmation-actions a,
.bag-confirmation-actions button { min-height: 42px; display: grid; place-items: center; border: 1px solid var(--wine); background: var(--wine); color: white; font-size: 9px; }
.bag-confirmation-actions button { background: transparent; color: var(--wine); }
.builder-toast { position: fixed; z-index: 70; left: 50%; bottom: 88px; padding: 9px 13px; border-radius: 999px; background: var(--ink); color: white; font-size: 8px; opacity: 0; pointer-events: none; transform: translate(-50%, 10px); transition: .2s ease; }
.builder-toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

@keyframes step-enter { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes projection-handheld {
  0% { transform: translateX(-50%) perspective(420px) rotateX(-4deg) rotateZ(-1.35deg) skewX(-1deg) translate(0,0); opacity: calc(var(--projection-opacity) - .05); }
  55% { transform: translateX(-50%) perspective(420px) rotateX(-3.7deg) rotateZ(-.85deg) skewX(-.6deg) translate(1px,-1px); }
  100% { transform: translateX(-50%) perspective(420px) rotateX(-4.2deg) rotateZ(-1.1deg) skewX(-1.2deg) translate(-1px,1px); opacity: var(--projection-opacity); }
}

@media (max-width: 760px) {
  .prototype-note { height: 28px; font-size: 7px; }
  .builder-header { height: 54px; grid-template-columns: 30px 1fr 96px 30px; gap: 8px; padding: 0 14px; }
  .builder { height: calc(100svh - 82px); grid-template-rows: minmax(0, 42fr) minmax(0, 58fr); }
  .builder-preview { grid-template-rows: 20px minmax(0, 1fr) 35px; padding: 8px 12px 0; }
  .preview-caption div { display: grid; gap: 0; }
  .preview-caption strong { font-size: 14px; }
  .preview-caption span { display: none; }
  .step-content { padding: 14px 14px 26px; }
  .step-heading { grid-template-columns: 30px 1fr; gap: 7px; }
  .step-heading h1 { font-size: 29px; }
  .step-body { margin: 14px 0 0 37px; }
  .choice-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .style-grid { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; }
  .style-choice { flex: 0 0 74%; scroll-snap-align: start; }
  .finish-grid { grid-template-columns: repeat(3, minmax(0,1fr)); }
  .finish-choice figure { display: none; }
  .crop-controls { grid-template-columns: 1fr; gap: 9px; }
  .builder-actions { height: 72px; grid-template-columns: minmax(0,1fr) auto; gap: 10px; padding: 0 12px; }
  .price-summary { display: grid; gap: 0; }
  .price-summary strong { font-size: 21px; }
  .action-buttons { gap: 6px; }
  .quiet-button { width: 36px; padding: 0; font-size: 0; }
  .quiet-button::before { content: "←"; font-size: 15px; }
  .continue-button { min-width: 112px; padding: 0 15px; }
  .review-row { grid-template-columns: 76px 1fr; }
  .review-row em { display: none; }
}

@media (max-height: 700px) {
  .builder { grid-template-rows: minmax(0, 39fr) minmax(0, 61fr); }
  .step-content { padding-top: 11px; }
  .step-heading h1 { font-size: 27px; }
  .step-body { margin-top: 10px; }
}

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