:root {
  --cream: #FFF7F3;
  --pearl: #FFFDFB;
  --blush: #F9DDE3;
  --rose: #EFB4C3;
  --cherry: #9C2A4B;
  --wine: #4F1B2B;
  --muted: #7A4A5A;
  --gold: #C8A15A;
  --gold-soft: #F1E1BC;
  --serif: 'Cormorant Garamond', 'Playfair Display', Georgia, serif;
  --script: 'Marck Script', 'Segoe Script', cursive;
  --sans: 'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--cream);
  background-image:
    radial-gradient(circle at 15% 0%, #FFE9EE 0, transparent 45%),
    radial-gradient(circle at 95% 35%, #FFF0D9 0, transparent 40%);
  background-attachment: fixed;
  color: var(--wine);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.55;
}

#snow {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}

.wrap {
  position: relative;
  z-index: 1;
  max-width: 960px;
  margin: 0 auto;
  padding: 28px 16px 56px;
}
.wrap.day { max-width: 560px; }

:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }

h1 {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 600;
  font-size: clamp(36px, 9vw, 58px);
  line-height: 1.05;
  margin: 4px 0 8px;
  color: var(--wine);
}

/* ---------- hero ---------- */
.hero { text-align: center; padding: 6px 0 18px; }
.bow { display: inline-block; color: var(--cherry); }
.hero .bow { width: 96px; height: 58px; }
.script {
  font-family: var(--script);
  color: var(--cherry);
  font-size: 26px;
  margin: 2px 0 0;
}
.pearls {
  height: 14px;
  width: min(260px, 70%);
  margin: 12px auto 10px;
  background: radial-gradient(circle at 7px 7px, #fff 0 3px, #E7C9D1 4px 5.5px, transparent 6px) 0 0 / 14px 14px repeat-x;
}
.ny {
  display: inline-block;
  margin: 4px 0 0;
  padding: 6px 18px;
  border: 1.5px solid var(--gold);
  border-radius: 999px;
  background: var(--gold-soft);
  font-weight: 700;
  font-size: 15px;
}

/* ---------- doors ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px 14px;
  padding-top: 14px;
}
@media (min-width: 760px) {
  .grid { grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 28px 16px; }
}

.door {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  text-decoration: none;
  color: var(--cherry);
  background: var(--pearl);
  border: 2px solid var(--rose);
  border-radius: 60px 60px 16px 16px;
  box-shadow: 0 6px 16px rgba(156, 42, 75, .10);
  transition: transform .2s ease, box-shadow .2s ease;
}
.door:hover, .door:focus-visible {
  transform: translateY(-3px);
  box-shadow: 0 10px 22px rgba(156, 42, 75, .16);
}
.door .num {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 600;
  font-size: clamp(34px, 10vw, 46px);
  line-height: 1;
}
.door .date, .door .tag { font-size: 12px; font-weight: 600; color: var(--muted); }
.door .tag {
  background: var(--gold-soft);
  color: var(--wine);
  border-radius: 999px;
  padding: 1px 9px;
}
.door .bow {
  position: absolute;
  top: -14px;
  left: 50%;
  transform: translateX(-50%);
  width: 42px;
  height: 25px;
}
.door.open::before {
  content: "";
  position: absolute;
  inset: 7px;
  border: 1.5px dashed var(--rose);
  border-radius: 52px 52px 10px 10px;
  pointer-events: none;
}
.door.locked {
  background: linear-gradient(180deg, #FBE6EB, #F6D3DC);
  border-color: #EBC0CC;
  color: #7A3F52;
  box-shadow: none;
}
.door.locked .date { color: #7A3F52; }
.door .lock { width: 16px; height: 16px; opacity: .8; }
.door.today {
  border-color: var(--gold);
  box-shadow: 0 0 0 4px var(--gold-soft), 0 8px 20px rgba(200, 161, 90, .35);
  animation: glow 2.6s ease-in-out infinite;
}
@keyframes glow {
  50% { box-shadow: 0 0 0 7px rgba(241, 225, 188, .7), 0 8px 24px rgba(200, 161, 90, .45); }
}

/* door slot, opening animation */
.slot { position: relative; aspect-ratio: 4 / 5; }
.glow {
  position: absolute;
  inset: 0;
  border-radius: 60px 60px 16px 16px;
  background: radial-gradient(circle at 50% 55%, #FFF8DC 0, var(--gold-soft) 45%, var(--rose) 100%);
  opacity: 0;
  transition: opacity .3s ease;
}
.slot.lit .glow { opacity: 1; }
.door.fresh { border-color: var(--cherry); }
.door.fresh::before { border-style: solid; border-color: var(--cherry); opacity: .35; }
.door.fresh .tag { background: var(--cherry); color: #fff; }
.door.opening {
  transform-origin: left center;
  animation: swing .75s ease-in forwards;
}
@keyframes swing {
  to { transform: perspective(700px) rotateY(-100deg); opacity: .15; }
}
.foot { text-align: center; margin-top: 30px; }

/* first-time reveal on day page */
.veil { text-align: center; }
.veil .bow { display: block; width: 96px; height: 58px; margin: 6px auto 14px; }
.fade { animation: fadeIn .6s ease both; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } }

/* game */
#game {
  display: block;
  width: 100%;
  max-width: 360px;
  aspect-ratio: 360 / 560;
  margin: 14px auto;
  border-radius: 24px;
  border: 3px solid var(--pearl);
  box-shadow: 0 10px 30px rgba(156, 42, 75, .18);
  touch-action: none;
  background: var(--blush);
}
.game-hint { text-align: center; color: var(--muted); font-size: 15px; margin: 0; }

/* ---------- day page ---------- */
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.back {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--cherry);
  font-weight: 700;
  text-decoration: none;
}
.back:hover { text-decoration: underline; }
.topbar .bow { width: 44px; height: 27px; }

.pill {
  display: inline-block;
  background: var(--blush);
  color: #7A2B45;
  font-weight: 700;
  font-size: 14px;
  padding: 5px 14px;
  border-radius: 999px;
}
.day-head { margin: 4px 0 18px; }
.lead { margin: 0; color: var(--muted); font-size: 18px; }

.card {
  position: relative;
  background: var(--pearl);
  border: 2px solid var(--blush);
  border-radius: 26px;
  padding: 34px 22px 24px;
  margin-bottom: 18px;
  box-shadow: 0 10px 30px rgba(156, 42, 75, .10);
  overflow: hidden;
}
.card .lace {
  position: absolute;
  left: 0; right: 0; top: 0;
  height: 12px;
  background: radial-gradient(circle at 10px 0, var(--blush) 0 9px, transparent 9.5px) 0 0 / 20px 12px repeat-x;
}

.letter p {
  font-family: var(--serif);
  font-size: 22px;
  line-height: 1.5;
  margin: 0 0 14px;
}
.letter p:last-child { margin-bottom: 0; }
.sign {
  font-family: var(--script);
  color: var(--cherry);
  font-size: 26px;
  text-align: right;
  margin: 10px 0 0;
}

/* locked view */
.locked-card { text-align: center; }
.seal {
  position: relative;
  width: 116px; height: 116px;
  margin: 6px auto 16px;
  border-radius: 50%;
  background: var(--blush);
  display: flex; align-items: center; justify-content: center;
  color: var(--cherry);
}
.seal .lock { width: 40px; height: 40px; }
.seal .bow { position: absolute; top: -14px; left: 50%; transform: translateX(-50%); width: 64px; height: 38px; }

.count { display: flex; gap: 10px; margin: 18px 0 4px; }
.tile {
  flex: 1;
  background: var(--cream);
  border: 2px solid var(--blush);
  border-radius: 16px;
  padding: 10px 4px;
  text-align: center;
}
.tv { font-family: var(--serif); font-weight: 600; font-size: 34px; line-height: 1.1; color: var(--cherry); }
.tl { font-size: 12px; color: var(--muted); }

/* media */
.media { margin: 0 0 20px; }
.media video {
  display: block;
  width: 100%;
  max-height: 70vh;
  background: #2b1019;
  border-radius: 20px;
  border: 3px solid var(--pearl);
  box-shadow: 0 8px 22px rgba(156, 42, 75, .18);
}
.media-audio {
  background: var(--blush);
  border-radius: 20px;
  padding: 14px 14px 12px;
}
.media-audio audio { display: block; width: 100%; }
.audio-title { font-family: var(--serif); font-style: italic; font-weight: 600; font-size: 22px; margin-bottom: 8px; color: var(--wine); }
.media-photo {
  background: var(--pearl);
  padding: 12px 12px 8px;
  border-radius: 6px;
  box-shadow: 0 8px 22px rgba(156, 42, 75, .18);
  transform: rotate(-1.5deg);
}
.media-photo:nth-of-type(even) { transform: rotate(1.5deg); }
.media-photo img { display: block; width: 100%; height: auto; border-radius: 2px; }
.media-photo figcaption { font-family: var(--script); font-size: 20px; color: var(--cherry); text-align: center; padding-top: 10px; }
.frame { position: relative; aspect-ratio: 16 / 9; border-radius: 20px; overflow: hidden; border: 3px solid var(--pearl); box-shadow: 0 8px 22px rgba(156, 42, 75, .18); background: #2b1019; }
.frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.media > figcaption { font-size: 14px; color: var(--muted); margin-top: 8px; text-align: center; }

.links { display: flex; flex-wrap: wrap; gap: 10px; margin: 0 0 18px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 22px;
  border-radius: 999px;
  border: 2px solid var(--cherry);
  background: transparent;
  color: var(--cherry);
  font: 700 16px var(--sans);
  text-decoration: none;
}
.btn:hover { background: var(--blush); }
.btn.primary { background: var(--cherry); color: #fff; }
.btn.primary:hover { background: #7E2039; }

.pager { display: flex; justify-content: space-between; gap: 10px; margin-top: 8px; }

/* finale */
.card.finale { background: var(--wine); border-color: #7A2B45; color: #FFF4F1; }
.card.finale .lace { background: radial-gradient(circle at 10px 0, #7A2B45 0 9px, transparent 9.5px) 0 0 / 20px 12px repeat-x; }
.card.finale .tile { background: #6A2640; border-color: #8B3A56; }
.card.finale .tv { color: var(--gold-soft); }
.card.finale .tl { color: #F3D5DD; }
.card.finale .sign { color: var(--gold-soft); }
.finale-title { font-family: var(--script); color: var(--gold-soft); font-size: 28px; text-align: center; margin: 0 0 4px; }
.finale-big { font-family: var(--serif); font-style: italic; font-weight: 600; font-size: 36px; text-align: center; margin: 0; }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
