:root {
  --ink: #24140f;
  --cream: #fff4e4;
  --butter: #ffcf70;
  --berry: #c5364e;
  --plum: #4c2142;
  --line: rgba(36, 20, 15, 0.14);
  color: var(--ink);
  background:
    radial-gradient(circle at top left, #ffe7bf 0, transparent 34%),
    linear-gradient(160deg, #fff8ee 0%, #f7d7c4 48%, #e7b8c8 100%);
  font-family: Outfit, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
}

main {
  display: grid;
  grid-template-columns: minmax(280px, 440px) 1fr;
  gap: 28px;
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 36px 0 56px;
}

.booth,
.verdict {
  min-width: 0;
  background: rgba(255, 248, 238, 0.78);
  border: 1px solid var(--line);
  border-radius: 28px;
  box-shadow: 0 20px 50px rgba(76, 33, 66, 0.08);
}

.booth {
  container-type: inline-size;
  padding: 28px 24px;
}

.eyebrow {
  margin: 0 0 8px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--berry);
}

h1,
h2,
.score {
  font-family: Fraunces, serif;
  font-weight: 760;
  letter-spacing: -0.04em;
}

h1 {
  margin: 0;
  max-width: 100%;
  font-size: clamp(2rem, 10cqi, 3rem);
  line-height: 0.95;
  letter-spacing: -0.04em;
}

.lede {
  font-size: 1rem;
  line-height: 1.4;
}

label {
  display: block;
  font-weight: 700;
  margin-bottom: 8px;
}

textarea,
#case input[type="text"] {
  width: 100%;
  border: 1.5px solid var(--ink);
  border-radius: 18px;
  padding: 14px 16px;
  font: inherit;
  background: white;
}

textarea {
  resize: vertical;
}

#case input[type="text"] {
  margin: 0 0 16px;
}

.starters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0 18px;
}

.starters button,
.submit {
  font: inherit;
  cursor: pointer;
}

.starters button {
  border: 1px solid var(--line);
  background: white;
  border-radius: 999px;
  padding: 8px 12px;
  text-align: left;
}

.submit {
  width: 100%;
  border: 0;
  border-radius: 999px;
  padding: 14px 18px;
  background: var(--ink);
  color: var(--cream);
  font-weight: 700;
}

.submit:disabled {
  opacity: 0.55;
  cursor: wait;
}

.status {
  min-height: 1.4em;
  color: var(--plum);
  font-weight: 560;
}

.verdict {
  padding: 28px;
}

.meter {
  margin-bottom: 18px;
}

.meter-label,
.gesture > p:first-child,
.edit > p:first-child,
.mail > p:first-child {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.72rem;
  font-weight: 700;
}

.score {
  margin: 4px 0;
  font-size: 5rem;
  line-height: 0.9;
}

.score-note {
  margin-top: 0;
}

.track {
  height: 14px;
  border-radius: 999px;
  background: rgba(36, 20, 15, 0.08);
  overflow: hidden;
}

.track span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--butter), var(--berry));
  transition: width 0.4s ease;
}

.gesture,
.serious {
  border-radius: 20px;
  padding: 16px 18px;
}

h2 {
  margin: 4px 0 8px;
  font-size: 1.6rem;
}

.gesture {
  margin-top: 12px;
  background: var(--butter);
}

.postcard {
  position: relative;
  display: block;
  width: 100%;
  margin-top: 10px;
  aspect-ratio: 3 / 2;
  border: 0;
  padding: 0;
  background: none;
  color: inherit;
  text-align: left;
  cursor: pointer;
  perspective: 1000px;
}

.postcard-inner {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  transition: transform 0.75s cubic-bezier(0.45, 0.05, 0.2, 1);
}

.postcard.is-flipped .postcard-inner {
  transform: rotateY(180deg);
}

.postcard-face {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border-radius: 6px;
  background: #fffdf8;
  box-shadow: 0 12px 28px rgba(36, 20, 15, 0.16);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.postcard-front {
  display: flex;
  flex-direction: column;
  padding: 10px 10px 0;
}

.photo {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  background: #f4e4cc;
}

.photo img,
.photo-empty {
  width: 100%;
  height: 100%;
}

.photo img {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.photo img[hidden],
.photo-empty[hidden] {
  display: none;
}

.photo.is-editing img {
  opacity: 0.4;
}

.photo-wait {
  position: absolute;
  right: 12px;
  bottom: 12px;
  left: 12px;
  z-index: 1;
  margin: 0;
  padding: 8px 10px;
  border-radius: 999px;
  background: rgba(36, 20, 15, 0.82);
  color: var(--cream);
  text-align: center;
  font-weight: 700;
}

.photo-wait[hidden] {
  display: none;
}

.photo-empty {
  display: grid;
  place-items: center;
  padding: 16px;
  text-align: center;
}

.caption {
  display: -webkit-box;
  padding: 6px 4px 8px;
  overflow: hidden;
  font-family: Caveat, cursive;
  font-size: 1.35rem;
  line-height: 1.05;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.turn-tab {
  position: absolute;
  z-index: 3;
  top: 12px;
  right: 12px;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--berry);
  color: white;
  font-family: Outfit, sans-serif;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  pointer-events: none;
  box-shadow: 0 8px 16px rgba(197, 54, 78, 0.4);
}

.postcard-back {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  grid-template-rows: minmax(0, 1fr);
  transform: rotateY(180deg);
  background: #fffaf3;
}

.back-message,
.back-address,
.inside-page {
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.back-message {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px 14px 16px;
}

.back-to {
  flex: none;
  font-family: Caveat, cursive;
  font-size: 1.35rem;
  line-height: 1;
}

.back-to[hidden] {
  display: none;
}

.back-kicker,
.alt-label {
  flex: none;
  font-family: Outfit, sans-serif;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--berry);
}

.back-note,
.folded-lead,
.alt-copy {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  overflow-wrap: anywhere;
  font-family: Caveat, cursive;
  line-height: 1.22;
}

.back-note {
  font-size: 1.35rem;
}

.back-address {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 14px 12px 14px 14px;
  border-left: 1px solid #e4d0b0;
}

.stamp {
  align-self: end;
  display: grid;
  width: 52px;
  height: 62px;
  place-items: center;
  border: 2px dashed var(--berry);
  color: var(--berry);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  transform: rotate(8deg);
}

.lines {
  display: grid;
  align-content: center;
  flex: 1;
  gap: 16px;
}

.lines span {
  display: block;
  height: 1px;
  background: rgba(36, 20, 15, 0.28);
}

.address-block {
  display: flex;
  flex: 1;
  flex-direction: column;
  justify-content: center;
  min-height: 0;
  margin-top: 10px;
}

.address-block span {
  display: block;
  overflow: hidden;
  overflow-wrap: anywhere;
  font-family: Caveat, cursive;
  font-size: 1.2rem;
  line-height: 1.2;
}

.postcard.is-turning .postcard-face {
  box-shadow: 0 24px 40px rgba(36, 20, 15, 0.28);
}

.postcard.is-peeking .postcard-inner {
  animation: card-show 2.6s cubic-bezier(0.45, 0.05, 0.2, 1) 1;
}

@keyframes card-show {
  0%,
  100% {
    transform: rotateY(0deg);
  }
  34%,
  66% {
    transform: rotateY(180deg);
  }
}

.postcard.is-new:not(.is-flipped) .turn-tab {
  animation: tab-bob 0.7s ease-in-out 8;
}

@keyframes tab-bob {
  50% {
    transform: translateY(-5px) rotate(-8deg);
  }
}

.format {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.format button {
  flex: 1;
  border: 1.5px solid var(--ink);
  border-radius: 999px;
  padding: 8px 12px;
  background: transparent;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.format button[aria-pressed="true"] {
  background: var(--ink);
  color: var(--cream);
}

.format button.is-suggested:not([aria-pressed="true"]) {
  box-shadow: inset 0 0 0 2px var(--berry);
}

.format-note {
  margin: 8px 0 0;
  font-size: 0.92rem;
  line-height: 1.35;
}

.flip-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  margin-top: 12px;
  border: 0;
  border-radius: 999px;
  padding: 13px 18px;
  background: var(--berry);
  color: white;
  font: inherit;
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 10px 22px rgba(197, 54, 78, 0.32);
}

.flip-btn.is-fresh {
  animation: nudge 0.7s ease 6;
}

.flip-glyph {
  width: 22px;
  height: 16px;
  border: 2px solid white;
  border-radius: 2px;
  background: linear-gradient(135deg, white 48%, transparent 48%);
  transform-style: preserve-3d;
}

.flip-btn.is-fresh .flip-glyph {
  animation: spin-card 0.8s ease-in-out infinite;
}

@keyframes spin-card {
  50% {
    transform: rotateY(180deg);
  }
}

@keyframes nudge {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-6px);
  }
}

.book {
  position: relative;
  display: block;
  width: 50%;
  max-width: 250px;
  margin: 12px auto 0;
  padding: 0;
  overflow: hidden;
  border: 0;
  background: none;
  color: inherit;
  text-align: left;
  cursor: pointer;
  perspective: 1800px;
  transition: width 0.8s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.book.is-open {
  width: 100%;
  max-width: 520px;
  overflow: visible;
}

.book-spread {
  position: relative;
  width: 200%;
  margin-left: -100%;
  aspect-ratio: 10 / 7;
  transform-style: preserve-3d;
  transition:
    margin-left 0.8s cubic-bezier(0.2, 0.7, 0.2, 1),
    width 0.8s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.book.is-open .book-spread {
  width: 100%;
  margin-left: 0;
}

.inside {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  overflow: hidden;
  border-radius: 6px;
  background: #fffaf3;
  box-shadow: 0 12px 28px rgba(36, 20, 15, 0.16);
}

.inside::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 14px;
  transform: translateX(-50%);
  background: linear-gradient(
    90deg,
    transparent,
    rgba(36, 20, 15, 0.1),
    transparent
  );
  pointer-events: none;
}

.inside-page {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px 14px;
}

.inside-page-right {
  border-left: 1px solid #e4d0b0;
}

.folded-lead {
  font-size: 1.7rem;
}

.folded-alts {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
}

.alt-line {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 4px;
  min-height: 0;
  overflow: hidden;
}

.alt-copy {
  font-size: 1.2rem;
}

.cover {
  position: absolute;
  top: 0;
  right: 0;
  display: flex;
  flex-direction: column;
  width: 50%;
  height: 100%;
  padding: 10px 10px 0;
  overflow: hidden;
  border-radius: 0 6px 6px 0;
  background: #fffdf8;
  box-shadow: -10px 12px 24px rgba(36, 20, 15, 0.16);
  transform-origin: left center;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  transition: transform 0.8s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.book.is-open .cover {
  transform: rotateY(-180deg);
}

.book:not(.is-open) .turn-tab {
  animation: tab-bob 0.7s ease-in-out 8;
}

.envelope {
  position: relative;
  width: min(100%, 440px);
  margin: 16px auto 0;
  padding: 42px 20px 18px;
  overflow: hidden;
  border-radius: 4px;
  background: #fffdf8;
  box-shadow: 0 10px 24px rgba(36, 20, 15, 0.12);
}

.envelope::before {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 28px;
  background: linear-gradient(#f6ead6, #e7d3b4);
  clip-path: polygon(0 0, 100% 0, 50% 100%);
}

.envelope .stamp {
  position: absolute;
  top: 36px;
  right: 14px;
}

.env-address {
  display: block;
  max-width: 72%;
  font-family: Caveat, cursive;
  font-size: 1.45rem;
  line-height: 1.15;
  white-space: pre-line;
}

.address-option {
  margin-top: 14px;
}

.address-toggle {
  display: flex;
  justify-content: center;
  width: 100%;
  border: 1.5px solid var(--ink);
  border-radius: 999px;
  padding: 12px 16px;
  background: white;
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.address-toggle[aria-expanded="true"] {
  background: var(--ink);
  color: var(--cream);
}

.address-note {
  margin: 8px 0;
  font-size: 0.9rem;
}

.address-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 10px;
}

.address-grid .wide {
  grid-column: 1 / -1;
}

.address-grid input,
.address-grid select {
  width: 100%;
  margin-top: 4px;
  border: 1.5px solid var(--ink);
  border-radius: 12px;
  padding: 8px 10px;
  background: white;
  font: inherit;
  font-weight: 400;
}

.postcard[hidden],
.book[hidden],
.lines[hidden],
.address-block[hidden],
.envelope[hidden],
.alt-line[hidden] {
  display: none;
}

@media (prefers-reduced-motion: reduce) {
  .postcard-inner,
  .book,
  .book-spread,
  .cover {
    transition: none;
  }

  .postcard.is-peeking .postcard-inner,
  .postcard.is-new .turn-tab,
  .book:not(.is-open) .turn-tab,
  .flip-btn.is-fresh,
  .flip-btn.is-fresh .flip-glyph {
    animation: none;
  }
}
.credit {
  margin: 10px 0 0;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 700;
}

.edit {
  margin-top: 14px;
}

.swatches {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 10px 0;
}

.swatches button,
.color-pick {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid transparent;
  box-shadow: inset 0 0 0 1px rgba(36, 20, 15, 0.28);
  padding: 0;
}

.swatches button {
  cursor: pointer;
}

.swatches button[aria-pressed="true"],
.color-pick.is-chosen {
  border-color: var(--ink);
}

.color-pick {
  display: block;
  overflow: hidden;
  margin: 0;
}

.color-pick input {
  width: 40px;
  height: 40px;
  margin: -6px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
}

.edit-status {
  min-height: 1.3em;
  margin: 0 0 8px;
  font-weight: 560;
}

.edit-label {
  margin-top: 4px;
}

.edit input[type="text"] {
  width: 100%;
  border: 1.5px solid var(--ink);
  border-radius: 999px;
  padding: 10px 14px;
  font: inherit;
  background: white;
}

.edit .submit {
  margin-top: 10px;
}

.restore {
  margin-top: 8px;
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  text-decoration: underline;
  cursor: pointer;
}

.restore[hidden] {
  display: none;
}
.mail {
  margin-top: 16px;
  padding: 16px;
  border-radius: 18px;
  background: var(--ink);
  color: var(--cream);
}
.mail p {
  margin: 0;
}
.mail h2 {
  margin: 4px 0 8px;
  font-size: 1.7rem;
}
.mail-copy {
  margin-top: 8px;
  line-height: 1.4;
}
.price {
  font-family: Fraunces, serif;
  font-size: 2.2rem;
  letter-spacing: -0.04em;
}
.price span {
  font-family: Outfit, sans-serif;
  font-size: 1rem;
  letter-spacing: 0;
}
.mail .pay-note {
  color: rgba(255, 244, 228, 0.78);
}
.plan {
  margin-top: 18px;
  background: var(--plum);
  color: var(--cream);
}
.pay {
  margin-top: 14px;
  width: 100%;
  border: 0;
  border-radius: 999px;
  padding: 12px 16px;
  background: var(--butter);
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.pay:disabled {
  opacity: 0.55;
  cursor: wait;
}
.pay-note {
  margin: 8px 0 0;
  font-size: 0.9rem;
}
.banner {
  margin: 0 0 16px;
  padding: 12px 14px;
  border-radius: 16px;
  background: #e7f6ea;
  font-weight: 560;
}
.banner.canceled {
  background: #fff1d6;
}

.serious {
  background: var(--ink);
  color: var(--cream);
  line-height: 1.45;
}

@media (max-width: 800px) {
  main {
    grid-template-columns: 1fr;
    padding-top: 16px;
  }
}
