:root {
  --bg-deep: #0e0410;
  --bg-warm: #2a0e1c;
  --fg: #fff5fa;
  --gold-light: #ffe7a3;
  --gold: #f4c542;
  --gold-deep: #b8860b;
  --rose: #ffb6c1;
  --rose-deep: #e88aa3;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  width: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
  background: #0a0309;
  color: var(--fg);
  font-family: "Cormorant Garamond", "Georgia", serif;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

* { touch-action: none; }

/* ── Aurora background ─────────────────────────────────────────────────── */
#aurora {
  position: fixed;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(ellipse 60% 50% at 20% 30%, rgba(244, 197, 66, 0.18), transparent 60%),
    radial-gradient(ellipse 70% 60% at 80% 20%, rgba(232, 138, 163, 0.22), transparent 60%),
    radial-gradient(ellipse 80% 70% at 50% 90%, rgba(184, 134, 11, 0.15), transparent 65%),
    radial-gradient(ellipse 60% 60% at 90% 80%, rgba(255, 182, 193, 0.18), transparent 60%),
    linear-gradient(160deg, var(--bg-deep) 0%, var(--bg-warm) 60%, #1c0918 100%);
  animation: aurora-shift 28s ease-in-out infinite alternate;
  filter: blur(0.5px);
}

@keyframes aurora-shift {
  0%   { background-position: 0% 0%, 100% 0%, 50% 100%, 100% 100%, 0 0; transform: scale(1) rotate(0deg); }
  50%  { transform: scale(1.05) rotate(0.6deg); }
  100% { background-position: 20% 10%, 80% 20%, 60% 80%, 90% 70%, 0 0; transform: scale(1.03) rotate(-0.6deg); }
}

#bg-canvas, #sparkle-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

#sparkle-canvas { z-index: 3; }
#bg-canvas { z-index: 1; }

/* ── Main content ──────────────────────────────────────────────────────── */
main {
  position: relative;
  z-index: 2;
  height: 100%;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: env(safe-area-inset-top, 0) 1.25rem env(safe-area-inset-bottom, 0);
  user-select: none;
}

main * { pointer-events: none; }
main #title { pointer-events: auto; }
main #counters { pointer-events: auto; }
main #since-date { pointer-events: auto; }

.title {
  margin: 0 0 1rem;
  font-family: "Cormorant Garamond", "Georgia", serif;
  font-size: clamp(2.4rem, 8.5vw, 4.6rem);
  font-weight: 600;
  letter-spacing: 0;
  line-height: 1.05;
  text-align: center;
  max-width: 18ch;
  color: var(--fg);
  text-shadow:
    0 2px 28px rgba(0, 0, 0, 0.7),
    0 0 60px rgba(244, 197, 66, 0.10);
  cursor: default;
}

.title em {
  font-style: italic;
  font-weight: 600;
  color: var(--gold-light);
  background: linear-gradient(180deg, #fff3c4 0%, var(--gold) 60%, var(--gold-deep) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 18px rgba(244, 197, 66, 0.35));
}

/* #4 — Title breathes */
.title {
  animation: title-breathe 5.4s ease-in-out infinite;
}
@keyframes title-breathe {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.012); }
}

.since-date {
  margin: 0 0 2.2rem;
  font-family: "Caveat", cursive;
  font-weight: 500;
  font-size: clamp(1.1rem, 3vw, 1.6rem);
  letter-spacing: 0.01em;
  opacity: 0.85;
  color: var(--gold-light);
  text-shadow: 0 0 18px rgba(244, 197, 66, 0.25);
  cursor: pointer;
  transition: opacity 0.4s ease;
}

.since-date.flip {
  font-family: "Outfit", sans-serif;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-size: clamp(0.85rem, 2.4vw, 1.05rem);
  color: var(--gold-light);
}

.counters {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem 1.2rem;
  width: 100%;
  max-width: 30rem;
}

.cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(255, 245, 250, 0.05);
  border: 1px solid rgba(255, 220, 230, 0.10);
  border-radius: 14px;
  padding: 0.85rem 0.4rem;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
}

.num {
  font-family: "Outfit", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: clamp(1.7rem, 6vw, 2.6rem);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  color: var(--gold);
  background: linear-gradient(180deg, var(--gold-light) 0%, var(--gold) 50%, var(--gold-deep) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 14px rgba(244, 197, 66, 0.35));
  animation: number-glow 3.2s ease-in-out infinite alternate;
}

@keyframes number-glow {
  0%   { filter: drop-shadow(0 0 8px rgba(244, 197, 66, 0.25)); }
  100% { filter: drop-shadow(0 0 22px rgba(244, 197, 66, 0.55)); }
}

/* #5 — Counter weight (drop-in animation on tick) */
.num.tick {
  animation: num-tick 0.45s cubic-bezier(0.2, 0.7, 0.3, 1);
}
.num.tick-big {
  animation: num-tick-big 0.7s cubic-bezier(0.2, 0.7, 0.3, 1);
}
@keyframes num-tick {
  0%   { transform: translateY(-6px); opacity: 0.6; }
  100% { transform: translateY(0); opacity: 1; }
}
@keyframes num-tick-big {
  0%   { transform: translateY(-14px) scale(1.18); opacity: 0; }
  60%  { opacity: 1; }
  100% { transform: translateY(0) scale(1); opacity: 1; }
}

/* Reveal odometer roll */
.num.odometer {
  display: inline-block;
  transform: translateY(-100%);
  opacity: 0;
}
.num.odometer-roll {
  animation: odometer-roll 1.6s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
@keyframes odometer-roll {
  0%   { transform: translateY(-200%); opacity: 0; }
  40%  { opacity: 1; }
  100% { transform: translateY(0); opacity: 1; }
}

.unit {
  margin-top: 0.4rem;
  font-family: "Outfit", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  font-weight: 500;
  opacity: 0.65;
}

@media (min-width: 640px) {
  .counters { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}

/* ── Hidden message (long-press counter) ───────────────────────────────── */
.hidden-message {
  margin-top: 1.6rem;
  max-width: 32ch;
  text-align: center;
  font-family: "Caveat", cursive;
  font-size: clamp(1.05rem, 2.6vw, 1.4rem);
  color: var(--rose);
  opacity: 0;
  transition: opacity 1.2s ease;
  pointer-events: none;
}

.hidden-message.show { opacity: 0.9; }

/* ── Proposal overlay ──────────────────────────────────────────────────── */
#proposal-overlay {
  position: fixed;
  inset: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  background: radial-gradient(ellipse at center, rgba(28, 8, 22, 0.55), rgba(10, 3, 9, 0.85));
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  transition: opacity 1.4s ease;
  pointer-events: none;
}

#proposal-overlay:not(.hidden) {
  opacity: 1;
  pointer-events: auto;
}

#proposal-overlay.hidden { display: none; }

.ring {
  width: clamp(140px, 38vw, 240px);
  height: auto;
  filter: drop-shadow(0 0 24px rgba(244, 197, 66, 0.65)) drop-shadow(0 0 60px rgba(255, 255, 255, 0.25));
  animation: ring-spin 14s linear infinite, ring-bob 4s ease-in-out infinite alternate;
  transform-origin: center;
}

.ring .glint {
  animation: glint-pulse 2.4s ease-in-out infinite;
  transform-origin: center;
}

@keyframes ring-spin {
  0%   { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes ring-bob {
  0%   { translate: 0 -6px; }
  100% { translate: 0 6px; }
}

@keyframes glint-pulse {
  0%, 100% { opacity: 0; transform: scale(0.6); }
  50%      { opacity: 1; transform: scale(1.4); }
}

.ask {
  margin: 0;
  font-family: "Cormorant Garamond", serif;
  font-style: italic;
  font-weight: 600;
  font-size: clamp(1.6rem, 5.5vw, 2.8rem);
  color: var(--fg);
  text-shadow: 0 0 30px rgba(244, 197, 66, 0.55), 0 2px 18px rgba(0, 0, 0, 0.5);
  text-align: center;
  letter-spacing: 0.01em;
  min-height: 1.4em;
  white-space: pre-wrap;
}

.ask::after {
  content: "▎";
  display: inline-block;
  margin-left: 4px;
  opacity: 0.6;
  animation: caret 0.9s steps(2) infinite;
}
.ask.done::after { display: none; }

@keyframes caret {
  0%, 50%  { opacity: 0.7; }
  51%, 100%{ opacity: 0; }
}

.yes-btn {
  margin-top: 1.6rem;
  padding: 0.85rem 2.4rem;
  border: none;
  border-radius: 999px;
  font-family: "Cormorant Garamond", serif;
  font-weight: 600;
  font-size: clamp(1.2rem, 3.5vw, 1.6rem);
  letter-spacing: 0.04em;
  background: linear-gradient(180deg, #fff3c4 0%, var(--gold) 55%, var(--gold-deep) 100%);
  color: #2a0e1c;
  cursor: pointer;
  box-shadow: 0 0 24px rgba(244, 197, 66, 0.45), 0 6px 20px rgba(0, 0, 0, 0.45);
  -webkit-appearance: none;
  appearance: none;
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity 0.6s ease, transform 0.6s ease, box-shadow 0.3s ease;
}
.yes-btn.show {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
  animation: yes-pulse 2.4s ease-in-out infinite;
}
.yes-btn.hidden { display: none; }
.yes-btn:active { transform: scale(0.96); box-shadow: 0 0 16px rgba(244, 197, 66, 0.7); }

@keyframes yes-pulse {
  0%, 100% { box-shadow: 0 0 24px rgba(244, 197, 66, 0.45), 0 6px 20px rgba(0, 0, 0, 0.45); }
  50%      { box-shadow: 0 0 38px rgba(244, 197, 66, 0.7), 0 6px 22px rgba(0, 0, 0, 0.5); }
}

.engaged-line {
  margin-top: 1.6rem;
  font-family: "Caveat", cursive;
  font-size: clamp(1.1rem, 3vw, 1.5rem);
  color: var(--gold-light);
  opacity: 0;
  text-shadow: 0 0 18px rgba(244, 197, 66, 0.35);
  transition: opacity 1s ease;
}
.engaged-line.show { opacity: 0.9; }

/* Reveal staging: ring & ask hidden initially in proposal mode */
#proposal-overlay .ring {
  opacity: 0;
  transform: scale(0.6) translateY(40px);
  transition: opacity 1.2s ease, transform 1.2s cubic-bezier(0.22, 1, 0.36, 1);
}
#proposal-overlay.stage-ring .ring {
  opacity: 1;
  transform: scale(1) translateY(0);
}

/* ── Modes ─────────────────────────────────────────────────────────────── */
body.proposal-mode #aurora { animation-duration: 14s; }
body.proposal-mode .num { animation-duration: 1.6s; }

/* Peek phase: dust gets visually brighter via aurora intensity */
body.peek #aurora {
  filter: brightness(1.15) saturate(1.1);
  transition: filter 1.2s ease;
}

/* Engaged mode: title rewords + persistent gold tint */
body.engaged .title em { animation: engaged-shimmer 6s ease-in-out infinite; }
@keyframes engaged-shimmer {
  0%, 100% { filter: drop-shadow(0 0 18px rgba(244, 197, 66, 0.35)); }
  50%      { filter: drop-shadow(0 0 32px rgba(244, 197, 66, 0.7)); }
}

/* ── Reduced motion ────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  #aurora, .num, .ring, .ring .glint, .ask { animation: none !important; }
}
