@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Playfair+Display:wght@500;600;700&display=swap');

:root {
  --cream: #f6f1e6;
  --paper: #fffdf8;
  --ink: #1c2b26;
  --green: #123f36;
  --green-deep: #0d322b;
  --copper: #b08a55;
  --line: #e4d9c8;
  --gold: #c4a15a;
  --shadow: 0 18px 40px #32281b16;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100dvh;
  background:
    radial-gradient(circle at 18% 0, #fffdf9 0 18%, transparent 52%),
    var(--cream);
  color: var(--ink);
  font: 500 16px/1.45 'DM Sans', sans-serif;
}

.booth-shell {
  width: min(100%, 1100px);
  min-height: 100dvh;
  margin: auto;
  padding: 10px;
  position: relative;
}

.booth-header {
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  background: #fffdfaeb;
  border: 1px solid var(--line);
  border-radius: 16px 16px 0 0;
}

.couple { text-align: center; }
.couple strong, h1, h2 { font-family: 'Playfair Display', Georgia, serif; }
.couple strong { font-size: 26px; letter-spacing: -0.04em; font-weight: 600; }
.couple small { display: block; margin-top: 2px; font-size: 10px; letter-spacing: 0.22em; color: #6d675c; }
.heart { color: var(--copper); margin-left: 6px; font: 28px/0 'Playfair Display', serif; vertical-align: -2px; }

.count-badge {
  position: absolute;
  right: 12px;
  top: 10px;
  min-height: 52px;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 0;
  border-radius: 14px;
  padding: 7px 12px;
  background: #f4efe4;
  color: #1b1f1e;
  font: 500 10px/1.2 'DM Sans', sans-serif;
  cursor: pointer;
}
.count-badge b { font-size: 13px; }
.icon { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; stroke-linecap: round; }

.screen {
  display: none;
  min-height: calc(100dvh - 92px);
  padding: 18px 12px 24px;
  position: relative;
  animation: appear 220ms ease both;
}
.screen.is-active { display: flex; flex-direction: column; }

.camera-stage, .countdown-stage {
  position: relative;
  flex: 1;
  min-height: 420px;
  max-height: calc(100dvh - 230px);
  overflow: hidden;
  border-radius: 8px;
  background: #4e3b30;
  box-shadow: var(--shadow);
}

video, .countdown-stage img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
}
#countdown-photo { transform: none; }

.camera-fallback {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 18% 22%, #ffe0a8 0 8px, transparent 9px),
    radial-gradient(circle at 78% 18%, #ffd48a 0 7px, transparent 8px),
    radial-gradient(circle at 62% 30%, #f3c27a 0 5px, transparent 6px),
    linear-gradient(128deg, #4a342b, #a07b5c 46%, #2a211d);
}
.camera-fallback::after {
  content: '';
  position: absolute;
  left: 28%;
  right: 28%;
  top: 22%;
  bottom: 18%;
  border-radius: 46% 46% 18% 18%;
  background: linear-gradient(145deg, #e7b48d, #8a5640);
  box-shadow: 70px 40px 0 -18px #ead0b4, -54px 18px 0 -24px #3a281f;
}
.camera-stage.has-camera .camera-fallback,
.camera-stage.has-photo .camera-fallback,
.countdown-stage.has-live .countdown-fallback,
.countdown-stage.has-still .countdown-fallback { display: none; }

.finder { position: absolute; inset: 22px; pointer-events: none; }
.finder i { position: absolute; width: 34px; height: 34px; border: 0 solid #fff; }
.finder i:nth-child(1) { top: 0; left: 0; border-width: 3px 0 0 3px; border-radius: 8px 0 0 0; }
.finder i:nth-child(2) { top: 0; right: 0; border-width: 3px 3px 0 0; border-radius: 0 8px 0 0; }
.finder i:nth-child(3) { bottom: 0; left: 0; border-width: 0 0 3px 3px; border-radius: 0 0 0 8px; }
.finder i:nth-child(4) { right: 0; bottom: 0; border-width: 0 3px 3px 0; border-radius: 0 0 8px 0; }

.camera-help {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 14px;
  margin: 0;
  text-align: center;
  color: #fff;
  font-size: 13px;
  text-shadow: 0 2px 10px #000;
}

.camera-actions, .split-actions {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  padding-top: 16px;
}
.camera-actions { margin-top: -34px; position: relative; z-index: 2; }

.primary, .secondary {
  min-height: 64px;
  border-radius: 999px;
  padding: 0 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  border: 1.5px solid var(--green);
  font: 700 16px/1 'DM Sans', sans-serif;
  letter-spacing: 0.04em;
  cursor: pointer;
}
.primary { background: var(--green); color: #fff; box-shadow: 0 10px 22px #0d322b33; }
.secondary { background: var(--paper); color: var(--green); }
.primary:hover, .primary:focus-visible { background: var(--green-deep); }
.secondary:hover, .secondary:focus-visible { background: #fff8ee; }
button:focus-visible, .upload-button:focus-within { outline: 3px solid #d7a24a; outline-offset: 3px; }
.capture-button { min-width: min(100%, 280px); }
.capture-button .icon, .split-actions .icon { width: 22px; height: 22px; }

.upload-button { position: relative; cursor: pointer; }
.upload-button input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.countdown-stage { max-height: calc(100dvh - 160px); }
.shade {
  position: absolute;
  inset: 0;
  background: #10211ccc;
  backdrop-filter: blur(2px);
}
.countdown-value {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #fff;
  font: 600 clamp(120px, 22vw, 220px)/1 'Playfair Display', serif;
}
.countdown-value::before {
  content: '';
  position: absolute;
  width: min(280px, 46vw);
  height: min(280px, 46vw);
  border: 2px solid #ffffffb8;
  border-radius: 50%;
}
.countdown-stage p {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 11%;
  margin: 0;
  text-align: center;
  color: #fff;
  font: 600 clamp(28px, 4vw, 40px)/1.2 'Playfair Display', serif;
}
.small-note { margin: 16px 0 0; text-align: center; color: #6a655c; }

.screen h1 {
  margin: 8px 0 28px;
  text-align: center;
  font-size: clamp(36px, 5vw, 52px);
  font-weight: 600;
}
.screen[data-screen='frames'] { align-items: center; }

.frames {
  width: min(100%, 920px);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
  align-items: start;
}
.frame {
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink);
  font: 600 14px 'DM Sans', sans-serif;
  cursor: pointer;
}
.frame b { display: block; margin-top: 10px; font-weight: 500; }

.photo-card, .review-card {
  position: relative;
  display: block;
  overflow: hidden;
  background: #fffdf8;
}
.photo-card { height: 210px; padding: 8px; }
.photo-card img, .review-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  background: linear-gradient(140deg, #4d3a30, #c49570 52%, #2f211d);
}
.photo-card i {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 10px;
  padding: 6px 4px 5px;
  background: #fffdf8ee;
  color: var(--ink);
  font: 600 11px/1.15 'Playfair Display', serif;
  font-style: normal;
  text-align: center;
}
.photo-card i small { display: block; margin-top: 2px; font: 500 8px 'DM Sans', sans-serif; letter-spacing: 0.12em; }

.frame[data-frame='plain'] .photo-card { padding: 0; background: transparent; }
.frame[data-frame='classic'] .photo-card { padding: 10px 10px 36px; border: 1px solid #e7d7bc; }
.frame[data-frame='floral'] .photo-card,
.frame[data-frame='leaves'] .photo-card { padding: 12px; border: 1px solid #e6d3b4; }
.frame[data-frame='floral'] .photo-card::before,
.frame[data-frame='floral'] .photo-card::after,
.frame[data-frame='leaves'] .photo-card::before,
.frame[data-frame='leaves'] .photo-card::after {
  content: '';
  position: absolute;
  width: 28px;
  height: 28px;
  z-index: 2;
  background:
    radial-gradient(circle at 30% 70%, transparent 9px, var(--gold) 10px 11px, transparent 12px),
    linear-gradient(var(--gold), var(--gold)) 4px 22px / 16px 1.5px no-repeat,
    linear-gradient(var(--gold), var(--gold)) 14px 8px / 1.5px 14px no-repeat;
}
.frame[data-frame='floral'] .photo-card::before,
.frame[data-frame='leaves'] .photo-card::before { top: 4px; left: 4px; }
.frame[data-frame='floral'] .photo-card::after,
.frame[data-frame='leaves'] .photo-card::after { top: 4px; right: 4px; transform: scaleX(-1); }
.frame[data-frame='minimal'] .photo-card { padding: 6px; border: 1px solid #eadfce; background: #fbf8f2; }
.frame.is-selected .photo-card { outline: 3px solid #1f6b5a; outline-offset: 4px; }

.action-wide { margin: 28px auto 0; min-width: 180px; min-height: 52px; }

.screen[data-screen='review'] { align-items: center; justify-content: center; }
.review-card {
  width: min(390px, 86vw);
  padding: 16px 16px 12px;
  background: var(--paper);
  box-shadow: var(--shadow);
}
.review-card img { aspect-ratio: 1.15 / 1; height: auto; }
.review-caption {
  margin: 12px 0 2px;
  text-align: center;
  font: 600 26px/1.15 'Playfair Display', serif;
}
.review-caption span { color: var(--copper); }
.review-caption small {
  display: block;
  margin-top: 4px;
  font: 500 11px 'DM Sans', sans-serif;
  letter-spacing: 0.16em;
  color: #6e685d;
}
.review-card.frame-plain { padding: 0; background: transparent; box-shadow: none; }
.review-card.frame-plain .review-caption { display: none; }
.review-card.frame-classic { border: 1px solid #e4d3b4; padding: 18px 18px 10px; }
.review-card.frame-floral,
.review-card.frame-leaves { border: 1px solid #e6d3b4; }
.review-card.frame-floral::before,
.review-card.frame-floral::after,
.review-card.frame-leaves::before,
.review-card.frame-leaves::after {
  content: '';
  position: absolute;
  width: 42px;
  height: 42px;
  z-index: 2;
  pointer-events: none;
  background:
    radial-gradient(circle at 28% 72%, transparent 10px, var(--gold) 11px 12.5px, transparent 13.5px),
    linear-gradient(var(--gold), var(--gold)) 6px 30px / 22px 1.5px no-repeat,
    linear-gradient(var(--gold), var(--gold)) 20px 10px / 1.5px 20px no-repeat;
}
.review-card.frame-floral::before,
.review-card.frame-leaves::before { top: 6px; left: 6px; }
.review-card.frame-floral::after,
.review-card.frame-leaves::after { top: 6px; right: 6px; transform: scaleX(-1); }
.review-card.frame-minimal {
  padding: 10px 10px 8px;
  border: 1px solid #eadfce;
  background: #fbf8f2;
  box-shadow: none;
}
.review-card.frame-minimal .review-caption { font-size: 18px; }

.split-actions { width: min(560px, 100%); margin-top: 22px; }
.split-actions button { flex: 1; max-width: 240px; }

.centered {
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: calc(100dvh - 92px);
}
.centered h1 { margin: 18px 0 4px; }
.centered p { margin: 0; font-size: 22px; }
.printer { width: 120px; height: 120px; fill: none; stroke: #6d8a7c; stroke-width: 3; stroke-linejoin: round; }
.heart-print { fill: #d7a07a; stroke: none; }
.spark {
  position: absolute;
  width: 10px;
  height: 10px;
  background: var(--gold);
  clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%);
}
.spark.s1 { transform: translate(78px, -78px); }
.spark.s2 { transform: translate(108px, -28px) scale(0.7); }
.spark.s3 { transform: translate(-96px, -64px) scale(0.55); }
.progress {
  width: min(360px, 78%);
  height: 8px;
  margin: 28px auto 14px;
  border-radius: 999px;
  background: #e3ddd2;
  overflow: hidden;
}
.progress i {
  display: block;
  width: 0;
  height: 100%;
  background: var(--green);
  transition: width 3.6s linear;
}
.screen.is-active .progress i { width: 100%; }
.centered small, .small-note { color: #6d685f; }
.done-mark {
  width: 112px;
  height: 112px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #7f9a8c;
  color: #fff;
  font: 64px/1 'DM Sans', sans-serif;
}
.big-heart { margin: 18px 0 8px; color: #c9a27a; font: 64px/1 'Playfair Display', serif; }
.return-line { width: min(280px, 70%); height: 1px; margin: 8px auto 16px; background: #d9d2c6; }

.sprig {
  position: absolute;
  width: 72px;
  height: 180px;
  fill: none;
  stroke: #c6a36a;
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
  opacity: 0.9;
}
.sprig-left { left: 8px; bottom: 18px; }
.sprig-right { right: 8px; bottom: 28px; }

dialog {
  width: min(440px, 92vw);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 28px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: var(--shadow);
}
dialog::backdrop { background: #17302c80; }
dialog h2 { margin: 8px 0; font-size: 32px; }
.eyebrow { margin: 0; letter-spacing: 0.16em; font-size: 12px; color: #7a7368; }
.dialog-close {
  position: absolute;
  top: 8px;
  right: 12px;
  border: 0;
  background: none;
  color: var(--ink);
  font-size: 28px;
  cursor: pointer;
}

@keyframes appear {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

@media (max-width: 720px) {
  .booth-shell { padding: 0; }
  .booth-header { border-radius: 0; height: 64px; }
  .couple strong { font-size: 20px; }
  .count-badge { right: 6px; padding: 6px 8px; }
  .frames { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px 10px; }
  .photo-card { height: 150px; }
  .camera-actions, .split-actions { flex-direction: column; }
  .primary, .secondary, .upload-button { width: min(100%, 360px); }
  .sprig { display: none; }
  .camera-actions { margin-top: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; transition-duration: 1ms !important; }
  .screen.is-active .progress i { width: 72%; }
}
