:root {
  --night: #0a0d16;
  --night-2: #121726;
  --ink: #f6efe6;
  --ink-2: rgba(246, 239, 230, 0.68);
  --ink-3: rgba(246, 239, 230, 0.42);
  --gold: #f4b860;
  --gold-2: #ffd79a;
  --gold-deep: #c9852f;
  --rose: #e9a3a9;
  --blue: #7fb2d6;
  --glass: rgba(255, 255, 255, 0.055);
  --glass-2: rgba(255, 255, 255, 0.09);
  --line: rgba(255, 255, 255, 0.11);
  --serif: "Cormorant Garamond", Georgia, serif;
  --sans: "Manrope", system-ui, -apple-system, sans-serif;
  --ease: cubic-bezier(.22, 1, .36, 1);
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--night);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }
[hidden] { display: none !important; }

/* ---------- night sky ---------- */
.sky {
  position: fixed; inset: 0; z-index: 0; overflow: hidden;
  background:
    radial-gradient(120% 70% at 50% -10%, #23263a 0%, transparent 60%),
    linear-gradient(180deg, #10131f 0%, var(--night) 55%, #07090f 100%);
}
.lamp {
  position: absolute; top: -90px; left: 50%; width: 420px; height: 420px; margin-left: -210px;
  background: radial-gradient(circle, rgba(255, 214, 150, .55) 0%, rgba(255, 190, 110, .14) 30%, transparent 65%);
  filter: blur(10px);
  animation: breathe 7s ease-in-out infinite;
}
.bokeh {
  position: absolute; border-radius: 50%;
  filter: blur(2px);
  opacity: .55;
  animation: drift 18s ease-in-out infinite alternate;
}
.b1 { width: 70px; height: 70px; left: 8%;  top: 18%; background: radial-gradient(circle, rgba(244,184,96,.75), rgba(244,184,96,.08) 70%); }
.b2 { width: 34px; height: 34px; left: 78%; top: 12%; background: radial-gradient(circle, rgba(127,178,214,.8), rgba(127,178,214,.05) 70%); animation-duration: 22s; }
.b3 { width: 52px; height: 52px; left: 64%; top: 38%; background: radial-gradient(circle, rgba(255,215,154,.6), rgba(255,215,154,.05) 70%); animation-duration: 26s; }
.b4 { width: 26px; height: 26px; left: 22%; top: 55%; background: radial-gradient(circle, rgba(233,163,169,.8), rgba(233,163,169,.05) 70%); animation-duration: 15s; }
.b5 { width: 90px; height: 90px; left: 82%; top: 70%; background: radial-gradient(circle, rgba(244,184,96,.45), rgba(244,184,96,.04) 70%); filter: blur(6px); animation-duration: 30s; }
.b6 { width: 40px; height: 40px; left: 4%;  top: 82%; background: radial-gradient(circle, rgba(127,178,214,.55), rgba(127,178,214,.04) 70%); animation-duration: 20s; }
.b7 { width: 18px; height: 18px; left: 46%; top: 26%; background: radial-gradient(circle, rgba(255,230,190,.9), rgba(255,230,190,.05) 70%); animation-duration: 12s; }
@keyframes drift { 0% { transform: translate(0,0) scale(1); } 100% { transform: translate(18px,-26px) scale(1.12); } }
@keyframes breathe { 0%,100% { opacity: .85; transform: scale(1); } 50% { opacity: 1; transform: scale(1.06); } }
.grain {
  position: fixed; inset: 0; z-index: 1; pointer-events: none; opacity: .07; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- layout ---------- */
.app {
  position: relative; z-index: 2;
  max-width: 480px; margin: 0 auto;
  min-height: 100vh; min-height: 100dvh;
  padding: 28px 18px calc(120px + var(--safe-b));
  display: flex; flex-direction: column;
}
.screen { animation: rise .7s var(--ease) both; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

.eyebrow {
  font-size: 12px; letter-spacing: .18em; text-transform: uppercase;
  color: var(--gold); font-weight: 600; margin: 0 0 10px;
  display: flex; align-items: center; gap: 8px;
}
.eyebrow::before { content: ""; width: 18px; height: 1px; background: currentColor; opacity: .7; }
.title {
  font-family: var(--serif); font-weight: 500; font-style: italic;
  font-size: 44px; line-height: 1.02; margin: 0 0 12px; letter-spacing: -.01em;
}
.title em { font-style: italic; color: var(--gold-2); }
.lead { color: var(--ink-2); margin: 0 0 24px; font-size: 15px; }

.card {
  background: var(--glass);
  border: 1px solid var(--line);
  border-radius: 26px;
  padding: 18px;
  backdrop-filter: blur(22px) saturate(140%);
  -webkit-backdrop-filter: blur(22px) saturate(140%);
  box-shadow: 0 20px 60px -30px rgba(0,0,0,.8), inset 0 1px 0 rgba(255,255,255,.06);
}

/* ---------- calendar ---------- */
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.cal-month { font-family: var(--serif); font-size: 26px; font-weight: 600; text-transform: capitalize; }
.cal-month small { font-family: var(--sans); font-size: 13px; color: var(--ink-3); font-weight: 500; margin-left: 6px; }
.nav-btn {
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--glass-2); border: 1px solid var(--line);
  display: grid; place-items: center; transition: transform .2s, opacity .2s;
}
.nav-btn:active { transform: scale(.92); }
.nav-btn:disabled { opacity: .25; }
.nav-btn svg { width: 16px; height: 16px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-dow { text-align: center; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); padding-bottom: 4px; font-weight: 600; }
.cal-dow.we { color: rgba(233,163,169,.7); }
.day {
  position: relative; aspect-ratio: 1; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 15px; font-weight: 500; font-variant-numeric: tabular-nums;
  transition: background .25s var(--ease), color .25s, transform .2s var(--ease), box-shadow .3s;
}
.day:active:not(:disabled) { transform: scale(.88); }
.day.blank { pointer-events: none; }
.day:disabled { color: rgba(246,239,230,.18); }
.day.today::after {
  content: ""; position: absolute; bottom: 5px; width: 4px; height: 4px; border-radius: 50%; background: var(--gold);
}
.day.on {
  background: radial-gradient(circle at 35% 30%, var(--gold-2), var(--gold) 55%, var(--gold-deep));
  color: #2a1a07; font-weight: 700;
  box-shadow: 0 0 0 1px rgba(255,215,154,.5), 0 8px 26px -6px rgba(244,184,96,.75);
  animation: pop .35s var(--ease);
}
.day.on.today::after { background: #2a1a07; }
.day.avail { color: var(--gold-2); box-shadow: inset 0 0 0 1px rgba(244,184,96,.55); background: rgba(244,184,96,.08); }
.day.pick {
  background: radial-gradient(circle at 35% 30%, #fff1dc, var(--gold-2) 50%, var(--gold));
  color: #2a1a07; font-weight: 700; box-shadow: 0 0 0 3px rgba(255,215,154,.25), 0 10px 30px -6px rgba(244,184,96,.9);
}
@keyframes pop { 0% { transform: scale(.7); } 60% { transform: scale(1.08); } 100% { transform: scale(1); } }

.quick { display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
.chip {
  padding: 8px 14px; border-radius: 999px; font-size: 13px; font-weight: 600;
  background: var(--glass-2); border: 1px solid var(--line); color: var(--ink-2);
  transition: all .2s var(--ease);
}
.chip:active { transform: scale(.95); }
.chip.on { background: rgba(244,184,96,.16); border-color: rgba(244,184,96,.55); color: var(--gold-2); }

.summary { margin-top: 18px; color: var(--ink-2); font-size: 14px; min-height: 21px; }
.summary b { color: var(--gold-2); font-weight: 600; }

/* ---------- time picker ---------- */
.section-label { font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3); font-weight: 600; margin: 22px 4px 10px; }
.times {
  display: flex; gap: 8px; overflow-x: auto; padding: 4px 4px 10px; margin: 0 -4px;
  scroll-snap-type: x mandatory; scrollbar-width: none;
}
.times::-webkit-scrollbar { display: none; }
.time {
  flex: 0 0 auto; scroll-snap-align: center;
  padding: 12px 16px; border-radius: 16px; font-weight: 600; font-variant-numeric: tabular-nums;
  background: var(--glass); border: 1px solid var(--line); color: var(--ink-2);
  transition: all .25s var(--ease);
}
.time.on { background: linear-gradient(160deg, var(--gold-2), var(--gold)); color: #2a1a07; border-color: transparent; box-shadow: 0 10px 24px -10px rgba(244,184,96,.9); }
.field {
  width: 100%; padding: 15px 16px; border-radius: 18px; font: inherit; font-size: 15px;
  background: var(--glass); color: var(--ink); border: 1px solid var(--line); outline: none;
  transition: border-color .2s;
}
.field::placeholder { color: var(--ink-3); }
.field:focus { border-color: rgba(244,184,96,.6); }

/* ---------- CTA ---------- */
.dock {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5;
  padding: 18px 18px calc(18px + var(--safe-b));
  background: linear-gradient(180deg, transparent, rgba(10,13,22,.92) 40%);
}
.dock-inner { max-width: 444px; margin: 0 auto; }
.cta {
  width: 100%; height: 58px; border-radius: 20px;
  font-weight: 700; font-size: 16px; letter-spacing: .01em;
  color: #2a1a07;
  background: linear-gradient(160deg, #ffe2b4 0%, var(--gold) 55%, var(--gold-deep) 100%);
  box-shadow: 0 16px 40px -14px rgba(244,184,96,.85), inset 0 1px 0 rgba(255,255,255,.6);
  display: flex; align-items: center; justify-content: center; gap: 10px;
  transition: transform .2s var(--ease), opacity .3s, filter .3s;
  position: relative; overflow: hidden;
}
.cta::after {
  content: ""; position: absolute; top: 0; left: -60%; width: 40%; height: 100%;
  background: linear-gradient(100deg, transparent, rgba(255,255,255,.55), transparent);
  transform: skewX(-20deg); animation: shine 3.6s ease-in-out infinite;
}
@keyframes shine { 0%, 60% { left: -60%; } 100% { left: 130%; } }
.cta:active { transform: scale(.97); }
.cta.off { filter: grayscale(.8) brightness(.55); pointer-events: none; }
.cta.off::after { display: none; }
.ghost-btn { display: block; margin: 14px auto 0; color: var(--ink-3); font-size: 14px; font-weight: 500; padding: 8px; }

/* ---------- waiting ---------- */
.wait { text-align: center; padding-top: 8vh; }
.moon {
  width: 120px; height: 120px; margin: 0 auto 30px; border-radius: 50%; position: relative;
  background: radial-gradient(circle at 38% 34%, #fff4e0, var(--gold-2) 40%, var(--gold) 70%, var(--gold-deep));
  box-shadow: 0 0 60px rgba(244,184,96,.5), 0 0 140px rgba(244,184,96,.25);
  animation: float 5s ease-in-out infinite;
}
.moon::before, .moon::after {
  content: ""; position: absolute; inset: -18px; border-radius: 50%;
  border: 1px solid rgba(255,215,154,.25); animation: ripple 3.2s ease-out infinite;
}
.moon::after { animation-delay: 1.6s; }
@keyframes float { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
@keyframes ripple { 0% { transform: scale(.85); opacity: .9; } 100% { transform: scale(1.6); opacity: 0; } }
.recap { margin-top: 26px; text-align: left; }
.recap-row { display: flex; justify-content: space-between; align-items: baseline; padding: 10px 2px; border-bottom: 1px solid var(--line); }
.recap-row:last-child { border-bottom: 0; }
.recap-row span { color: var(--ink-3); font-size: 13px; }
.recap-row b { font-weight: 600; text-align: right; }

/* ---------- proposal + coin ---------- */
.invite { text-align: center; padding: 26px 20px 22px; }
.invite .when { font-family: var(--serif); font-size: 38px; line-height: 1.05; font-weight: 600; margin: 6px 0 2px; }
.invite .at { font-size: 30px; font-weight: 700; color: var(--gold-2); letter-spacing: .02em; font-variant-numeric: tabular-nums; }
.invite .note { margin-top: 12px; color: var(--ink-2); font-size: 15px; font-style: italic; font-family: var(--serif); font-size: 20px; }
.from { font-size: 13px; color: var(--ink-3); }

.coin-stage { perspective: 1000px; display: flex; flex-direction: column; align-items: center; margin-top: 34px; }
.coin-wrap { position: relative; width: 168px; height: 168px; }
.coin {
  position: absolute; inset: 0; transform-style: preserve-3d;
  transition: transform .1s;
}
.coin.idle { animation: wobble 3.2s ease-in-out infinite; }
@keyframes wobble { 0%,100% { transform: rotateY(-14deg) rotateX(6deg); } 50% { transform: rotateY(14deg) rotateX(-4deg); } }
.face {
  position: absolute; inset: 0; border-radius: 50%; backface-visibility: hidden; -webkit-backface-visibility: hidden;
  display: grid; place-items: center;
  background:
    radial-gradient(circle at 30% 25%, rgba(255,255,255,.75), transparent 28%),
    radial-gradient(circle at 50% 50%, #ffe0a6 0%, #f4b860 48%, #b8731f 100%);
  box-shadow: inset 0 0 0 6px rgba(140,82,18,.55), inset 0 0 0 9px rgba(255,226,170,.7), inset 0 -10px 22px rgba(110,60,10,.5);
}
.face::before {
  content: ""; position: absolute; inset: 18px; border-radius: 50%;
  border: 1.5px dashed rgba(110,62,12,.45);
}
.face span {
  font-family: var(--serif); font-weight: 600; font-style: italic; font-size: 54px; color: #6b3f0c;
  text-shadow: 0 1px 0 rgba(255,236,200,.8), 0 -1px 0 rgba(90,50,8,.4);
}
.face.front { transform: translateZ(2px); }
.face.back { transform: rotateY(180deg) translateZ(2px); }
.edge { position: absolute; inset: 1px; border-radius: 50%; background: #8a5214; }
.coin-shadow {
  width: 120px; height: 18px; margin-top: 18px; border-radius: 50%;
  background: radial-gradient(ellipse, rgba(0,0,0,.6), transparent 70%);
  transition: transform .3s, opacity .3s;
}
.coin-cap { margin-top: 18px; text-align: center; }
.coin-cap b { display: block; font-family: var(--serif); font-size: 30px; font-weight: 600; letter-spacing: .02em; }
.coin-cap span { color: var(--ink-3); font-size: 14px; }
.verdict {
  margin-top: 20px; font-family: var(--serif); font-style: italic; font-size: 34px; color: var(--gold-2);
  text-shadow: 0 0 30px rgba(244,184,96,.6); opacity: 0; transform: scale(.8);
  transition: all .6s var(--ease);
}
.verdict.show { opacity: 1; transform: none; }

/* ---------- confirmed ---------- */
.reveal { position: fixed; inset: 0; z-index: 1; overflow: hidden; }
.reveal img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 30%;
  filter: blur(28px) brightness(.55) saturate(1.2); transform: scale(1.18);
  transition: filter 3.2s var(--ease), transform 6s var(--ease);
}
.reveal.in img { filter: blur(0) brightness(.92) saturate(1.05); transform: scale(1.02); }
.reveal::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(10,13,22,.25) 0%, rgba(10,13,22,0) 30%, rgba(10,13,22,.55) 58%, rgba(10,13,22,.97) 82%);
}
.done { position: relative; z-index: 4; margin-top: auto; padding-top: 38vh; text-align: center; }
.done .title { font-size: 48px; margin-bottom: 4px; }
.ticket { margin-top: 18px; padding: 20px; text-align: center; }
.ticket .when { font-family: var(--serif); font-size: 30px; font-weight: 600; }
.ticket .at { font-size: 22px; color: var(--gold-2); font-weight: 700; margin-top: 2px; }
.ticket .note { margin-top: 8px; color: var(--ink-2); font-family: var(--serif); font-style: italic; font-size: 19px; }
.countdown { display: flex; justify-content: center; gap: 10px; margin-top: 16px; }
.cd { min-width: 64px; padding: 10px 6px; border-radius: 16px; background: rgba(255,255,255,.06); border: 1px solid var(--line); }
.cd b { display: block; font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; }
.cd span { font-size: 11px; color: var(--ink-3); letter-spacing: .08em; text-transform: uppercase; }
.fade-up { opacity: 0; transform: translateY(16px); animation: rise .9s var(--ease) forwards; }

/* ---------- misc ---------- */
.toast {
  position: fixed; left: 50%; top: 64px; z-index: 50; white-space: nowrap; transform: translate(-50%, -30px);
  padding: 12px 18px; border-radius: 16px; background: rgba(20,24,38,.92); border: 1px solid var(--line);
  font-size: 14px; opacity: 0; pointer-events: none; transition: all .4s var(--ease);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.devbar {
  position: relative; z-index: 6; display: flex; gap: 6px; justify-content: center; align-items: center;
  padding: 10px; font-size: 12px; color: var(--ink-3); flex-wrap: wrap;
}
.devbar .chip { padding: 6px 12px; font-size: 12px; }
.denied { text-align: center; padding-top: 22vh; }
.spinner { width: 34px; height: 34px; margin: 30vh auto 0; border-radius: 50%; border: 2px solid var(--line); border-top-color: var(--gold); animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

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

.pills { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 22px; }
.pill { padding: 8px 12px; border-radius: 14px; background: rgba(244,184,96,.1); border: 1px solid rgba(244,184,96,.35); color: var(--gold-2); font-size: 13px; font-weight: 600; }
