:root {
  --bg: #faf6f0;
  --card: #ffffff;
  --ink: #2e2a26;
  --muted: #8a8278;
  --line: rgba(46, 42, 38, 0.1);
  --coral: #ff7f6e;
  --peach: #ffb45c;
  --sage: #9cbe7f;
  --blush: #f9c6cf;
  --butter: #ffe79a;
  --shadow: 0 14px 34px rgba(46, 42, 38, 0.08), 0 2px 8px rgba(46, 42, 38, 0.05);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  font-size: 16px;
  overflow-x: hidden;
  width: 100%;
}

body {
  font-family: "Nunito", system-ui, -apple-system, sans-serif;
  background:
    radial-gradient(600px 500px at 90% -10%, var(--butter), transparent),
    radial-gradient(500px 400px at -10% 20%, var(--blush), transparent),
    var(--bg);
  color: var(--ink);
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  overflow-y: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

/* ---------- Progress bar ---------- */
.progress-track {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: rgba(46, 42, 38, 0.08);
  z-index: 50;
}
.progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--coral), var(--peach));
  transition: width 0.4s ease;
}

/* ---------- Deck & slides ---------- */
.deck {
  width: min(430px, 95vw);
  position: relative;
  margin-bottom: 120px;
}

.slide {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 60vh;
  min-height: 60dvh;
  padding: 24px 16px;
}

.slide.active { display: flex; animation: slideIn 0.45s ease; }

@keyframes slideIn {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

.slide.center { justify-content: center; }

/* ---------- Typography ---------- */
.kicker {
  text-transform: uppercase;
  letter-spacing: 3px;
  font-size: 12px;
  font-weight: 800;
  color: var(--muted);
  margin-bottom: 12px;
}

.big-year {
  font-family: "DM Serif Display", serif;
  font-size: clamp(48px, 12vw, 64px);
  line-height: 1;
  color: var(--coral);
  margin-bottom: 12px;
}

.sub {
  color: var(--muted);
  font-size: 17px;
  line-height: 1.5;
  max-width: 300px;
  margin: 12px auto 0;
}

/* ---------- Cover ---------- */
.cover {
  position: relative;
  padding: 0;
}

.confetti {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.confetti span {
  position: absolute;
  top: -12%;
  width: 10px;
  height: 14px;
  border-radius: 3px;
  opacity: 0.8;
  animation: fall linear infinite;
}
.confetti span:nth-child(4n + 1) { background: var(--coral); }
.confetti span:nth-child(4n + 2) { background: var(--peach); }
.confetti span:nth-child(4n + 3) { background: var(--sage); }
.confetti span:nth-child(4n)     { background: var(--blush); }
.confetti span:nth-child(1) { left: 8%;  animation-duration: 7s; animation-delay: 0s;  }
.confetti span:nth-child(2) { left: 18%; animation-duration: 8s; animation-delay: 1.2s; }
.confetti span:nth-child(3) { left: 30%; animation-duration: 6.5s; animation-delay: 0.5s; }
.confetti span:nth-child(4) { left: 44%; animation-duration: 7.5s; animation-delay: 2s;  }
.confetti span:nth-child(5) { left: 56%; animation-duration: 6.8s; animation-delay: 0.9s; }
.confetti span:nth-child(6) { left: 68%; animation-duration: 8s;   animation-delay: 1.6s; }
.confetti span:nth-child(7) { left: 78%; animation-duration: 7.2s; animation-delay: 0.2s; }
.confetti span:nth-child(8) { left: 88%; animation-duration: 6.2s; animation-delay: 2.4s; }
.confetti span:nth-child(9) { left: 95%; animation-duration: 7.8s; animation-delay: 1s;  }
.confetti span:nth-child(10){ left: 38%; animation-duration: 6.9s; animation-delay: 2.8s; }

@keyframes fall {
  0%   { transform: translateY(-10vh) rotate(0deg); }
  100% { transform: translateY(110vh) rotate(420deg); }
}

.cover-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 30vh 0 0;
}

.cover-photo {
  width: 150px;
  height: 150px;
  border-radius: 50%;
  overflow: hidden;
  margin-bottom: 26px;
  background: linear-gradient(135deg, var(--butter), var(--blush));
  box-shadow: var(--shadow);
  position: relative;
  border: 5px solid #fff;
}

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

.cover-ph-noimg {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-size: 14px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
  text-align: center;
}

.cover-kicker {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 6px;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 10px;
}

.cover-title {
  font-family: "DM Serif Display", serif;
  font-size: clamp(36px, 10vw, 46px);
  line-height: 1;
  color: var(--ink);
  margin-bottom: 12px;
}

.cover-name {
  font-family: "DM Serif Display", serif;
  font-style: italic;
  font-size: 30px;
  color: var(--coral);
  margin-bottom: 34px;
}

.start-btn {
  font-family: inherit;
  font-size: clamp(16px, 4vw, 17px);
  font-weight: 800;
  color: #fff;
  background: var(--coral);
  border: none;
  border-radius: 999px;
  padding: 18px 36px;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(255, 127, 110, 0.35);
  transition: transform 0.15s ease, background 0.15s ease;
}
.start-btn:active { transform: scale(0.96); }
.start-btn:hover { background: #ff6f5a; }

/* ---------- Memory slides ---------- */
.mem-slide {
  display: none;
  flex-direction: column;
  align-items: center;
  padding: 0;
}

.mem-slide.active { display: flex; animation: slideIn 0.45s ease; }

.photo-slot {
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: 24px;
  overflow: hidden;
  background: linear-gradient(135deg, var(--butter), var(--blush));
  box-shadow: var(--shadow);
  margin-bottom: 26px;
  position: relative;
}

.photo-slot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.photo-slot.photo-stack {
  background: transparent;
  overflow: visible;
}

.photo-slot.photo-stack img {
  position: absolute;
  inset: 0;
  width: 82%;
  height: 82%;
  border-radius: 20px;
  object-fit: cover;
  box-shadow: var(--shadow);
  border: 3px solid #fff;
}

.photo-slot.photo-stack img:nth-child(1) {
  z-index: 3;
  top: 0;
  left: 8%;
  transform: rotate(-3deg);
}

.photo-slot.photo-stack img:nth-child(2) {
  z-index: 2;
  top: 6%;
  left: 42%;
  transform: rotate(4deg) translateY(6%);
}

.photo-slot.photo-stack img:nth-child(3) {
  z-index: 1;
  top: 16%;
  left: 0;
  transform: rotate(2deg);
}

.photo-slot.photo-stack img:nth-child(4) {
  z-index: 0;
  top: 30%;
  left: 22%;
  transform: rotate(-4deg);
}

.photo-slot.photo-stack img:nth-child(5) {
  z-index: -1;
  top: 44%;
  left: 42%;
  transform: rotate(3deg);
}

.photo-slot.photo-stack img:nth-child(6) {
  z-index: -2;
  top: 56%;
  left: 60%;
  transform: rotate(-2deg);
}

.photo-slot.photo-stack img:nth-child(n + 7) {
  z-index: -3;
  top: 66%;
  left: 76%;
  transform: rotate(1deg);
}

.photo-slot.photo-stack img {
  transition: transform 0.25s ease;
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.photo-slot.photo-stack img:active {
  cursor: grabbing;
}

.photo-slot.photo-stack .shuffle-btn {
  position: absolute;
  top: calc(100% - 28px);
  right: 0;
  z-index: 950;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: none;
  background: var(--card);
  color: var(--ink);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform 0.2s ease;
}
.photo-slot.photo-stack .shuffle-btn:active {
  transform: rotate(180deg);
}
.photo-slot.photo-stack .shuffle-btn:hover {
  background: rgba(255, 127, 110, 0.05);
}

.photo-slot.photo-stack img.stack-front {
  transform: rotate(0deg) scale(1.04);
  z-index: 900;
  box-shadow: 0 18px 40px rgba(46, 42, 38, 0.25);
}

.photo-slot .photo-ph {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 2px dashed rgba(46, 42, 38, 0.25);
  border-radius: 24px;
  margin: 10px;
  box-sizing: border-box;
}

.photo-ph .ph-emoji { font-size: 52px; }
.photo-ph .ph-label {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--muted);
}

.mem-date {
  display: inline-block;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--sage);
  background: rgba(156, 190, 127, 0.15);
  padding: 6px 14px;
  border-radius: 999px;
  margin-bottom: 14px;
}

.mem-title {
  font-family: "DM Serif Display", serif;
  font-size: clamp(28px, 8vw, 34px);
  line-height: 1.15;
  margin-bottom: 14px;
}

.mem-caption {
  color: var(--muted);
  font-size: clamp(16px, 4.5vw, 17px);
  line-height: 1.6;
  max-width: 310px;
  padding: 0 8px;
}

.mem-count {
  margin-bottom: 16px;
  font-size: 14px;
  font-weight: 800;
  color: var(--muted);
}

/* ---------- Final ---------- */
.final-emoji {
  font-size: 58px;
  margin-bottom: 16px;
  animation: bob 2.6s ease-in-out infinite;
}

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

.msg-title {
  font-family: "DM Serif Display", serif;
  font-style: italic;
  font-size: clamp(32px, 9vw, 38px);
  margin-bottom: 18px;
  color: var(--coral);
}

.msg-body {
  color: var(--ink);
  font-size: clamp(16px, 4.5vw, 18px);
  line-height: 1.65;
  max-width: 310px;
  margin-bottom: 26px;
  padding: 0 8px;
}

.player {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 10px 24px 10px 10px;
  box-shadow: var(--shadow);
  margin-bottom: 28px;
  max-width: 90vw;
}

.play-btn {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: none;
  background: var(--coral);
  color: #fff;
  font-size: 22px;
  font-family: inherit;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(255, 127, 110, 0.35);
  transition: transform 0.15s ease;
  flex-shrink: 0;
}
.play-btn:active { transform: scale(0.92); }
.play-btn:hover { background: #ff6f5a; }

.player-info {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
}
.player-title {
  font-weight: 800;
  font-size: 16px;
}
.player-hint {
  font-size: 12px;
  color: var(--muted);
  font-weight: 700;
}

.msg-footer {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--muted);
}

/* ---------- Controls ---------- */
.controls {
  position: fixed;
  bottom: calc(12px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  z-index: 50;
  padding: 8px 16px;
  background: rgba(250, 246, 240, 0.95);
  backdrop-filter: blur(10px);
  border-radius: 999px;
  box-shadow: 0 4px 20px rgba(46, 42, 38, 0.1);
}

.nav-btn {
  font-family: inherit;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(46, 42, 38, 0.12);
  transition: transform 0.15s ease, background 0.15s ease;
  flex-shrink: 0;
}
.nav-btn:active { transform: scale(0.92); }
.nav-btn:hover { background: rgba(255, 127, 110, 0.1); }

.dots {
  display: flex;
  gap: 10px;
  max-width: 35vw;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 8px 4px;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}

.dot {
  flex: 0 0 auto;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: rgba(46, 42, 38, 0.2);
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
  min-width: 12px;
}
.dot:hover {
  background: rgba(46, 42, 38, 0.35);
}
.dot.active {
  background: var(--coral);
  transform: scale(1.4);
}

/* Slightly larger feel on bigger screens, still centered card. */
@media (min-width: 640px) {
  .deck { width: 430px; }
}