:root {
  --moonlight: #F0ECDD;
  --frost-blue: #8BA3C5;
  --steel: #495B7D;
  --storm: #23354D;
  --oxford: #02122F;
  --glass: rgba(240, 236, 221, 0.14);
  --glass-strong: rgba(240, 236, 221, 0.22);
  --border: rgba(240, 236, 221, 0.28);
  --shadow: 0 28px 90px rgba(2, 18, 47, 0.46);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  color: var(--moonlight);
  background:
    radial-gradient(circle at 18% 8%, rgba(139, 163, 197, 0.32), transparent 34rem),
    radial-gradient(circle at 82% 22%, rgba(240, 236, 221, 0.13), transparent 28rem),
    linear-gradient(145deg, var(--oxford) 0%, #071b3d 45%, var(--storm) 100%);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  overflow: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(240, 236, 221, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(240, 236, 221, 0.035) 1px, transparent 1px);
  background-size: 72px 72px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.92), transparent);
  z-index: -3;
}

button {
  font: inherit;
}

.app-shell {
  position: relative;
  min-height: 100svh;
  isolation: isolate;
}

.site-locked .app-shell,
.site-locked .music-toggle {
  visibility: hidden;
  pointer-events: none;
}

.password-gate {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: clamp(1.1rem, 4vw, 2rem);
  background:
    radial-gradient(circle at 72% 18%, rgba(240,236,221,0.18), transparent 18rem),
    radial-gradient(circle at 20% 82%, rgba(139,163,197,0.2), transparent 24rem),
    rgba(2,18,47,0.78);
  backdrop-filter: blur(12px);
}

.site-unlocked .password-gate {
  display: none;
}

.password-card {
  width: min(520px, 100%);
  padding: clamp(1.7rem, 6vw, 3rem);
  text-align: center;
  border: 1px solid rgba(240,236,221,0.28);
  border-radius: 18px;
  color: var(--moonlight);
  background: rgba(8,28,58,0.62);
  box-shadow: 0 28px 80px rgba(2,18,47,0.5), inset 0 0 34px rgba(240,236,221,0.08);
}

.password-card h1 {
  margin: 0 0 0.65rem;
  font-size: clamp(3rem, 12vw, 5.7rem);
}

.password-card form {
  display: grid;
  gap: 0.8rem;
  margin-top: 1.3rem;
}

.password-card input {
  width: 100%;
  padding: 0.95rem 1rem;
  border: 1px solid rgba(240,236,221,0.34);
  border-radius: 999px;
  color: var(--moonlight);
  background: rgba(2,18,47,0.45);
  box-shadow: inset 0 0 18px rgba(139,163,197,0.12);
  font: inherit;
  text-align: center;
  outline: none;
}

.password-card input:focus {
  border-color: rgba(240,236,221,0.75);
  box-shadow: 0 0 22px rgba(139,163,197,0.28), inset 0 0 18px rgba(139,163,197,0.12);
}

.password-message {
  min-height: 1.4rem;
  margin: 0.85rem 0 0;
  color: #f3d9bd;
  font-family: 'Caveat', cursive;
  font-size: 1.35rem;
}

.view {
  position: fixed;
  inset: 0;
  display: none;
  min-height: 100svh;
  padding: clamp(1.15rem, 3vw, 2rem);
  overflow-y: auto;
  opacity: 0;
}

.view.active {
  display: grid;
  place-items: center;
  opacity: 1;
  animation: pageIn 620ms ease both;
}

.entrance-view,
.menu-view,
.room-view {
  background:
    radial-gradient(circle at 78% 16%, rgba(240, 236, 221, 0.13), transparent 21rem),
    radial-gradient(circle at 18% 84%, rgba(139, 163, 197, 0.18), transparent 28rem);
}

.entrance-view {
  background:
    linear-gradient(90deg, rgba(2, 18, 47, 0.72), rgba(2, 18, 47, 0.22) 52%, rgba(2, 18, 47, 0.18)),
    linear-gradient(to top, rgba(2, 18, 47, 0.55), transparent 38%),
    url("assets/hero-moonlit-lake.png") center / cover no-repeat;
}

.entrance-view .moon {
  display: none;
}

.center-content,
.menu-content,
.room-content {
  position: relative;
  z-index: 1;
  width: min(1120px, 100%);
}

.center-content,
.room-content.narrow {
  width: min(880px, 100%);
  text-align: center;
}

.center-content {
  padding: 7rem 0 4rem;
}

.menu-content,
.room-content {
  padding: 5.4rem 0 2.2rem;
}

.eyebrow {
  margin: 0 0 0.8rem;
  color: var(--frost-blue);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  margin-top: 0;
  font-family: Georgia, "Times New Roman", serif;
  letter-spacing: 0;
}

h1 {
  max-width: 980px;
  margin-inline: auto;
  margin-bottom: 1.35rem;
  font-size: clamp(4.2rem, 12vw, 9.2rem);
  line-height: 0.88;
  font-weight: 700;
  text-wrap: balance;
}

h2 {
  margin-bottom: 2rem;
  color: var(--moonlight);
  font-size: clamp(2.65rem, 7vw, 5.7rem);
  line-height: 0.95;
  font-weight: 600;
  text-wrap: balance;
}

h3 {
  margin-bottom: 0.4rem;
  font-size: 1.45rem;
  line-height: 1.05;
}

p {
  line-height: 1.75;
}

.subtitle {
  max-width: 640px;
  margin: 0 auto 2.2rem;
  color: rgba(240, 236, 221, 0.78);
  font-size: clamp(1.08rem, 2.5vw, 1.42rem);
}

.moon {
  position: absolute;
  top: clamp(2rem, 7vw, 4.6rem);
  right: clamp(1.2rem, 10vw, 9rem);
  width: clamp(9rem, 20vw, 17rem);
  aspect-ratio: 1;
  border-radius: 50%;
  background:
    radial-gradient(circle at 38% 33%, #fffaf0 0 6%, transparent 7%),
    radial-gradient(circle at 60% 68%, rgba(139, 163, 197, 0.34) 0 8%, transparent 9%),
    radial-gradient(circle at 42% 62%, rgba(73, 91, 125, 0.18) 0 11%, transparent 12%),
    linear-gradient(135deg, #fffaf0, var(--moonlight) 48%, #b9c5d7);
  box-shadow:
    0 0 60px rgba(240, 236, 221, 0.48),
    0 0 140px rgba(139, 163, 197, 0.38),
    inset -18px -18px 40px rgba(73, 91, 125, 0.26);
  opacity: 0.9;
  animation: moonFloat 9s ease-in-out infinite;
  z-index: 0;
}

.menu-moon {
  opacity: 0.35;
  transform: scale(0.72);
}

.glow-button,
.back-button {
  border: 0;
  cursor: pointer;
}

.glow-button {
  min-height: 3.85rem;
  padding: 0 2.1rem;
  border-radius: 999px;
  color: var(--oxford);
  background: var(--frost-blue);
  box-shadow:
    0 0 30px rgba(139, 163, 197, 0.62),
    0 18px 55px rgba(2, 18, 47, 0.42);
  font-weight: 800;
  transition: transform 220ms ease, box-shadow 220ms ease, background 220ms ease;
}

.glow-button:hover,
.glow-button:focus-visible {
  transform: translateY(-3px);
  background: var(--moonlight);
  box-shadow:
    0 0 44px rgba(240, 236, 221, 0.52),
    0 20px 70px rgba(139, 163, 197, 0.36);
}

.music-toggle {
  position: fixed;
  right: 1.1rem;
  bottom: 1.1rem;
  z-index: 12;
  min-height: 3.05rem;
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0 1rem;
  border: 1px solid rgba(240, 236, 221, 0.34);
  border-radius: 999px;
  color: var(--moonlight);
  background: rgba(240, 236, 221, 0.13);
  box-shadow: 0 16px 44px rgba(2, 18, 47, 0.38);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  cursor: pointer;
  transition: transform 220ms ease, border-color 220ms ease, box-shadow 220ms ease, background 220ms ease;
}

.music-toggle:hover,
.music-toggle:focus-visible {
  transform: translateY(-2px);
  border-color: rgba(240, 236, 221, 0.58);
  background: rgba(240, 236, 221, 0.2);
}

.music-toggle.playing {
  color: var(--oxford);
  background: var(--frost-blue);
  box-shadow:
    0 0 30px rgba(139, 163, 197, 0.5),
    0 18px 54px rgba(2, 18, 47, 0.42);
}

.music-dot {
  width: 0.7rem;
  aspect-ratio: 1;
  border-radius: 50%;
  background: rgba(240, 236, 221, 0.5);
  box-shadow: 0 0 14px rgba(240, 236, 221, 0.28);
}

.music-toggle.playing .music-dot {
  background: var(--oxford);
  box-shadow: 0 0 16px rgba(2, 18, 47, 0.36);
  animation: musicPulse 1.4s ease-in-out infinite;
}

.back-button {
  position: fixed;
  top: 1.1rem;
  left: 1.1rem;
  z-index: 5;
  min-height: 2.85rem;
  padding: 0 1rem;
  border: 1px solid rgba(240, 236, 221, 0.34);
  border-radius: 999px;
  color: var(--moonlight);
  background: rgba(240, 236, 221, 0.12);
  box-shadow: 0 12px 34px rgba(2, 18, 47, 0.32);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.back-button:hover,
.back-button:focus-visible {
  background: rgba(240, 236, 221, 0.22);
}

.glass-card,
.menu-card,
.photo-card,
.admire-card {
  border: 1px solid var(--border);
  background: linear-gradient(145deg, rgba(240, 236, 221, 0.18), rgba(139, 163, 197, 0.08));
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  border-radius: 28px;
}

.menu-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
}

.menu-card {
  min-height: 10.8rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: flex-start;
  padding: 1.2rem;
  color: var(--moonlight);
  text-align: left;
  cursor: pointer;
  transition: transform 260ms ease, border-color 260ms ease, background 260ms ease, box-shadow 260ms ease;
}

.menu-card:hover,
.menu-card:focus-visible,
.photo-card:hover,
.admire-card:hover {
  transform: translateY(-8px);
  border-color: rgba(240, 236, 221, 0.62);
  background: linear-gradient(145deg, rgba(240, 236, 221, 0.24), rgba(139, 163, 197, 0.13));
  box-shadow: 0 30px 95px rgba(139, 163, 197, 0.22);
}

.menu-card span {
  color: var(--frost-blue);
  font-size: 0.84rem;
  font-weight: 800;
}

.menu-card strong {
  max-width: 14rem;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.65rem, 3.2vw, 2.2rem);
  line-height: 1.02;
}

.menu-card-wide {
  grid-column: span 2;
}

.wish-card,
.letter-card {
  max-width: 900px;
  margin: 0 auto;
  padding: clamp(1.45rem, 5vw, 3.25rem);
}

.wish-card p {
  margin: 0.5rem 0;
  color: rgba(240, 236, 221, 0.82);
  font-size: clamp(1.15rem, 2.6vw, 1.42rem);
}

.letter-card p {
  margin: 0 0 1.15rem;
  color: rgba(240, 236, 221, 0.84);
  font-size: clamp(1rem, 2.2vw, 1.18rem);
}

.letter-card p:first-child,
.letter-card p:last-child {
  color: var(--moonlight);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.7rem;
}

.gallery-grid,
.admire-grid,
.countdown-grid {
  display: grid;
  gap: 1rem;
}

.gallery-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.photo-card {
  min-height: 23rem;
  padding: 0.75rem;
  transition: transform 260ms ease, border-color 260ms ease, box-shadow 260ms ease, background 260ms ease;
}

.photo-placeholder {
  display: grid;
  min-height: 17rem;
  place-items: center;
  color: rgba(240, 236, 221, 0.72);
  background:
    linear-gradient(135deg, rgba(139, 163, 197, 0.18), rgba(240, 236, 221, 0.07)),
    repeating-linear-gradient(135deg, transparent 0 16px, rgba(240, 236, 221, 0.05) 16px 17px);
  border: 1px dashed rgba(240, 236, 221, 0.4);
  border-radius: 22px;
}

.photo-card p,
.admire-card p {
  margin: 0.45rem 0 0;
  color: rgba(240, 236, 221, 0.66);
}

.photo-card p {
  margin-top: 0.9rem;
}

.admire-grid {
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.admire-card {
  min-height: 13.5rem;
  padding: 0.8rem;
  transition: transform 260ms ease, border-color 260ms ease, box-shadow 260ms ease, background 260ms ease;
}

.admire-card div {
  min-height: 6.3rem;
  margin-bottom: 1rem;
  border: 1px dashed rgba(240, 236, 221, 0.35);
  border-radius: 20px;
  background:
    radial-gradient(circle at 35% 30%, rgba(240, 236, 221, 0.2), transparent 34%),
    linear-gradient(145deg, rgba(139, 163, 197, 0.2), rgba(2, 18, 47, 0.1));
}

.countdown-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.count-card {
  min-height: 10rem;
  display: grid;
  place-items: center;
  padding: 1.35rem;
  color: var(--oxford);
  background:
    linear-gradient(160deg, rgba(240, 236, 221, 0.72), rgba(139, 163, 197, 0.94)),
    var(--frost-blue);
  border: 1px solid rgba(240, 236, 221, 0.72);
  border-radius: 24px;
  box-shadow: 0 22px 70px rgba(2, 18, 47, 0.32);
}

.count-card strong {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(3.2rem, 8vw, 5.2rem);
  line-height: 0.9;
}

.count-card span {
  font-weight: 800;
}

.date-note {
  margin: 1.25rem 0 0;
  color: rgba(240, 236, 221, 0.68);
  font-size: 0.95rem;
}

.friends-room {
  width: min(900px, 100%);
}

.letter-stage {
  display: grid;
  min-height: clamp(29rem, 60vh, 39rem);
  place-items: center;
  perspective: 1600px;
}

.paper-letter {
  position: relative;
  width: min(640px, 100%);
  min-height: clamp(26rem, 56vh, 34rem);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: clamp(2rem, 5vw, 3.4rem);
  color: var(--oxford);
  background:
    radial-gradient(circle at 18% 14%, rgba(255, 255, 255, 0.42), transparent 8rem),
    radial-gradient(circle at 82% 76%, rgba(73, 91, 125, 0.1), transparent 10rem),
    repeating-linear-gradient(92deg, rgba(73, 91, 125, 0.035) 0 1px, transparent 1px 10px),
    repeating-linear-gradient(0deg, rgba(2, 18, 47, 0.025) 0 1px, transparent 1px 13px),
    var(--moonlight);
  border-radius: 10px 22px 14px 18px;
  box-shadow:
    0 32px 90px rgba(2, 18, 47, 0.42),
    inset 0 0 46px rgba(73, 91, 125, 0.12);
  clip-path: polygon(0.7% 0.9%, 94% 0, 100% 6.2%, 99.1% 98.8%, 2% 100%, 0 94%);
  transform-origin: left center;
  overflow: hidden;
}

.paper-letter::before {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 4.7rem;
  aspect-ratio: 1;
  background:
    linear-gradient(135deg, rgba(73, 91, 125, 0.22), rgba(240, 236, 221, 0.55) 54%, rgba(255, 255, 255, 0.86));
  clip-path: polygon(100% 0, 0 0, 100% 100%);
  box-shadow: -8px 10px 20px rgba(2, 18, 47, 0.16);
}

.paper-letter::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(88deg, transparent, rgba(255, 255, 255, 0.24), transparent),
    radial-gradient(circle at 30% 20%, rgba(2, 18, 47, 0.045) 0 1px, transparent 1.5px),
    radial-gradient(circle at 70% 62%, rgba(2, 18, 47, 0.04) 0 1px, transparent 1.6px);
  background-size: auto, 18px 18px, 23px 23px;
  mix-blend-mode: multiply;
  opacity: 0.68;
}

.paper-letter.turn-next {
  animation: turnNext 760ms cubic-bezier(0.22, 0.9, 0.22, 1) both;
}

.paper-letter.turn-prev {
  animation: turnPrev 760ms cubic-bezier(0.22, 0.9, 0.22, 1) both;
}

.paper-message,
.paper-name {
  position: relative;
  z-index: 1;
}

.paper-message {
  margin: 0;
  color: rgba(2, 18, 47, 0.82);
  font-family: "Bradley Hand", "Segoe Print", "Comic Sans MS", cursive;
  font-size: clamp(1.35rem, 3.2vw, 2rem);
  line-height: 1.65;
  text-align: left;
}

.paper-name {
  align-self: flex-end;
  margin: 2rem 0 0;
  color: var(--steel);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.45rem, 3.6vw, 2.25rem);
  font-style: italic;
  line-height: 1.1;
}

.letter-controls {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 1rem;
  align-items: center;
  margin: 1.3rem auto 0;
  width: min(640px, 100%);
}

.letter-nav {
  min-height: 3.2rem;
  padding: 0 1.1rem;
  border: 1px solid rgba(240, 236, 221, 0.34);
  border-radius: 999px;
  color: var(--moonlight);
  background: rgba(240, 236, 221, 0.13);
  box-shadow: 0 14px 34px rgba(2, 18, 47, 0.26);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  cursor: pointer;
  transition: transform 220ms ease, background 220ms ease, border-color 220ms ease;
}

.letter-nav:hover,
.letter-nav:focus-visible {
  transform: translateY(-2px);
  border-color: rgba(240, 236, 221, 0.6);
  background: rgba(240, 236, 221, 0.22);
}

.letter-indicator {
  min-width: 4.5rem;
  margin: 0;
  color: rgba(240, 236, 221, 0.72);
  font-weight: 800;
}

.secret-crate {
  width: min(36rem, 100%);
  margin: 4.2rem auto 0;
  text-align: center;
}

.secret-crate > p:first-child {
  margin: 0 0 0.7rem;
  color: rgba(240, 236, 221, 0.74);
  font-size: 1rem;
}

.crate-button {
  position: relative;
  width: min(26rem, 100%);
  aspect-ratio: 1.08;
  margin: 0 auto;
  display: grid;
  place-items: end center;
  border: 0;
  background: transparent;
  cursor: pointer;
  filter: drop-shadow(0 28px 52px rgba(2, 18, 47, 0.56));
}

.crate-button:hover .crate-image,
.crate-button:focus-visible .crate-image {
  transform: translateY(-0.35rem) scale(1.02);
}

.crate-button.shake .crate-image {
  animation: crateShake 520ms ease-in-out both;
}

.crate-image,
.gift-item {
  position: absolute;
  display: block;
  max-width: 100%;
  object-fit: contain;
  user-select: none;
  pointer-events: none;
}

.crate-image {
  bottom: 0;
  z-index: 2;
  width: 100%;
  max-height: 82%;
  transition: transform 260ms ease, filter 360ms ease;
}

.gift-item {
  bottom: 16%;
  z-index: 3;
  width: min(18rem, 62%);
  opacity: 0;
  transform: translateY(5.2rem) scale(0.78);
  filter:
    drop-shadow(0 0 28px rgba(139, 163, 197, 0.55))
    drop-shadow(0 18px 24px rgba(2, 18, 47, 0.35));
}

.secret-crate.unlocked .crate-image {
  filter:
    drop-shadow(0 0 26px rgba(240, 236, 221, 0.34))
    drop-shadow(0 0 42px rgba(139, 163, 197, 0.32));
}

.secret-crate.unlocked .gift-item {
  animation: giftRise 1.05s cubic-bezier(0.16, 0.9, 0.28, 1.08) 260ms both;
}

.sparkles {
  position: absolute;
  inset: 5% 10% 24%;
  z-index: 4;
  pointer-events: none;
}

.sparkles i {
  position: absolute;
  width: 0.58rem;
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--moonlight);
  box-shadow:
    0 0 12px rgba(240, 236, 221, 0.92),
    0 0 24px rgba(139, 163, 197, 0.62);
  opacity: 0;
}

.sparkles i:nth-child(1) { left: 15%; top: 50%; }
.sparkles i:nth-child(2) { left: 30%; top: 18%; }
.sparkles i:nth-child(3) { left: 50%; top: 8%; }
.sparkles i:nth-child(4) { right: 28%; top: 22%; }
.sparkles i:nth-child(5) { right: 14%; top: 48%; }
.sparkles i:nth-child(6) { left: 50%; bottom: 12%; }

.secret-crate.unlocked .sparkles i {
  animation: sparklePop 1.6s ease-out infinite;
}

.secret-crate.unlocked .sparkles i:nth-child(2) { animation-delay: 120ms; }
.secret-crate.unlocked .sparkles i:nth-child(3) { animation-delay: 260ms; }
.secret-crate.unlocked .sparkles i:nth-child(4) { animation-delay: 380ms; }
.secret-crate.unlocked .sparkles i:nth-child(5) { animation-delay: 520ms; }
.secret-crate.unlocked .sparkles i:nth-child(6) { animation-delay: 660ms; }

.crate-status {
  min-height: 1.8rem;
  margin: 0.85rem 0 0;
  color: var(--frost-blue);
  font-weight: 800;
}

.crate-reset {
  display: none;
  min-height: 2.7rem;
  padding: 0 1rem;
  border: 1px solid rgba(240, 236, 221, 0.32);
  border-radius: 999px;
  color: var(--moonlight);
  background: rgba(240, 236, 221, 0.12);
  cursor: pointer;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.secret-crate.unlocked .crate-reset {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.pin-modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: none;
  place-items: center;
  padding: 1rem;
  background: rgba(2, 18, 47, 0.62);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.pin-modal.open {
  display: grid;
  animation: modalFade 260ms ease both;
}

.pin-dialog {
  position: relative;
  width: min(34rem, 100%);
  padding: clamp(1.35rem, 5vw, 2.4rem);
  border: 1px solid rgba(240, 236, 221, 0.3);
  border-radius: 28px;
  background: linear-gradient(145deg, rgba(240, 236, 221, 0.2), rgba(139, 163, 197, 0.12));
  box-shadow: 0 32px 90px rgba(2, 18, 47, 0.62);
  text-align: center;
}

.pin-dialog h2 {
  margin-bottom: 1.3rem;
  font-size: clamp(2rem, 6vw, 3.6rem);
}

.modal-close {
  position: absolute;
  top: 0.9rem;
  right: 0.9rem;
  min-height: 2.35rem;
  padding: 0 0.8rem;
  border: 1px solid rgba(240, 236, 221, 0.3);
  border-radius: 999px;
  color: var(--moonlight);
  background: rgba(240, 236, 221, 0.12);
  cursor: pointer;
}

.pin-dialog form {
  display: grid;
  gap: 1rem;
  justify-items: center;
}

.pin-dialog input {
  width: min(14rem, 100%);
  min-height: 3.6rem;
  border: 1px solid rgba(240, 236, 221, 0.38);
  border-radius: 18px;
  color: var(--moonlight);
  background: rgba(2, 18, 47, 0.36);
  box-shadow: inset 0 0 26px rgba(139, 163, 197, 0.12);
  font-size: 1.7rem;
  font-weight: 800;
  letter-spacing: 0.28em;
  text-align: center;
}

.pin-dialog input::placeholder {
  color: rgba(240, 236, 221, 0.42);
}

.pin-message {
  min-height: 1.6rem;
  margin: 1rem 0 0;
  color: var(--moonlight);
  font-weight: 800;
}

.snow-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 8;
}

.snowflake {
  position: absolute;
  top: -1rem;
  width: var(--size);
  height: var(--size);
  border-radius: 50%;
  background: rgba(240, 236, 221, 0.82);
  box-shadow: 0 0 12px rgba(240, 236, 221, 0.5);
  animation: snowfall var(--duration) linear infinite;
  animation-delay: var(--delay);
  opacity: var(--opacity);
}

.aurora {
  position: fixed;
  inset: auto -12vw 0;
  height: 45vh;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 20% 100%, rgba(139, 163, 197, 0.18), transparent 44%),
    radial-gradient(ellipse at 80% 100%, rgba(240, 236, 221, 0.11), transparent 42%);
  filter: blur(12px);
  z-index: -2;
}

@keyframes pageIn {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes moonFloat {
  0%,
  100% {
    transform: translate3d(0, 0, 0);
  }
  50% {
    transform: translate3d(-0.55rem, 0.8rem, 0);
  }
}

@keyframes snowfall {
  from {
    transform: translate3d(var(--drift-start), -4vh, 0);
  }
  to {
    transform: translate3d(var(--drift-end), 106vh, 0);
  }
}

@keyframes crateShake {
  0%,
  100% {
    transform: translateX(0) rotate(0);
  }
  18% {
    transform: translateX(-0.45rem) rotate(-2deg);
  }
  36% {
    transform: translateX(0.42rem) rotate(2deg);
  }
  54% {
    transform: translateX(-0.3rem) rotate(-1.4deg);
  }
  72% {
    transform: translateX(0.22rem) rotate(1deg);
  }
}

@keyframes giftRise {
  0% {
    opacity: 0;
    transform: translateY(5.2rem) scale(0.78);
  }
  62% {
    opacity: 1;
  }
  100% {
    opacity: 1;
    transform: translateY(-9.5rem) scale(1);
  }
}

@keyframes sparklePop {
  0%,
  100% {
    opacity: 0;
    transform: translateY(0) scale(0.4);
  }
  40% {
    opacity: 1;
    transform: translateY(-1.4rem) scale(1);
  }
  70% {
    opacity: 0.3;
    transform: translateY(-2.2rem) scale(0.7);
  }
}

@keyframes modalFade {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes musicPulse {
  0%,
  100% {
    transform: scale(0.86);
    opacity: 0.7;
  }
  50% {
    transform: scale(1.2);
    opacity: 1;
  }
}

@keyframes turnNext {
  0% {
    opacity: 0;
    transform: translateX(4.5rem) rotateY(-28deg) rotateZ(1.2deg);
  }
  58% {
    opacity: 1;
  }
  100% {
    opacity: 1;
    transform: translateX(0) rotateY(0) rotateZ(0);
  }
}

@keyframes turnPrev {
  0% {
    opacity: 0;
    transform: translateX(-4.5rem) rotateY(28deg) rotateZ(-1.2deg);
  }
  58% {
    opacity: 1;
  }
  100% {
    opacity: 1;
    transform: translateX(0) rotateY(0) rotateZ(0);
  }
}

@media (max-width: 1050px) {
  .menu-grid,
  .gallery-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .admire-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .view {
    padding: 1rem;
  }

  .center-content {
    padding-top: 6rem;
  }

  .menu-content,
  .room-content {
    padding-top: 4.75rem;
  }

  .moon {
    top: 1.35rem;
    right: -2.75rem;
    opacity: 0.58;
  }

  h1 {
    font-size: clamp(3.7rem, 18vw, 5.6rem);
  }

  h2 {
    margin-bottom: 1.45rem;
  }

  .menu-grid,
  .gallery-grid,
  .countdown-grid,
  .admire-grid {
    grid-template-columns: 1fr 1fr;
  }

  .menu-card,
  .count-card {
    min-height: 8.4rem;
  }

  .menu-card-wide {
    grid-column: 1 / -1;
  }

  .photo-card {
    min-height: 18rem;
  }

  .photo-placeholder {
    min-height: 12rem;
  }

  .letter-stage {
    min-height: 31rem;
  }

  .letter-controls {
    grid-template-columns: 1fr;
  }

  .letter-nav {
    width: 100%;
  }
}

@media (max-width: 460px) {
  .view {
    padding-inline: 0.85rem;
  }

  .back-button {
    top: 0.8rem;
    left: 0.8rem;
    min-height: 2.55rem;
    padding-inline: 0.85rem;
    font-size: 0.88rem;
  }

  .music-toggle {
    right: 0.8rem;
    bottom: 0.8rem;
    min-height: 2.75rem;
    padding: 0 0.85rem;
    font-size: 0.88rem;
  }

  .menu-grid,
  .countdown-grid,
  .admire-grid {
    gap: 0.7rem;
  }

  .menu-card {
    min-height: 7.6rem;
    padding: 0.9rem;
  }

  .menu-card strong {
    font-size: 1.45rem;
  }

  .count-card {
    min-height: 7.4rem;
    padding: 1rem 0.7rem;
    border-radius: 18px;
  }

  .count-card strong {
    font-size: 2.85rem;
  }

  .glass-card,
  .menu-card,
  .photo-card,
  .admire-card,
  .paper-letter {
    border-radius: 22px;
  }

  .admire-card {
    min-height: 12.5rem;
  }

  .admire-card div {
    min-height: 5.6rem;
  }

  .paper-letter {
    min-height: 27rem;
  }
}

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

/* Lilly moon-room redesign */
:root {
  --paper: #F0ECDD;
  --ink: #2b2430;
  --warm-ink: #d9c2a7;
}

body {
  background:
    radial-gradient(circle at 72% 18%, rgba(240,236,221,0.28), transparent 8rem),
    radial-gradient(circle at 18% 24%, rgba(139,163,197,0.22), transparent 20rem),
    linear-gradient(180deg, #03122d 0%, #061a38 44%, #02122F 100%);
}

body::before {
  background-image:
    radial-gradient(circle, rgba(240,236,221,0.95) 0 1px, transparent 1.7px),
    radial-gradient(circle, rgba(240,236,221,0.55) 0 1px, transparent 1.4px),
    linear-gradient(to top, rgba(139,163,197,0.12), transparent 32%);
  background-size: 130px 130px, 78px 78px, 100% 100%;
  background-position: 0 0, 38px 16px, 0 0;
  mask-image: none;
}

body::after {
  content: "";
  position: fixed;
  inset: auto 0 0;
  height: 34vh;
  pointer-events: none;
  background:
    linear-gradient(to top, rgba(2,18,47,0.92), transparent),
    radial-gradient(ellipse at 20% 100%, rgba(139,163,197,0.18), transparent 42%),
    radial-gradient(ellipse at 80% 100%, rgba(240,236,221,0.12), transparent 40%);
  z-index: -2;
}

.view {
  padding: clamp(1rem, 3vw, 2rem);
}

.view.active {
  animation: pageIn 700ms ease both;
}

.moon {
  width: clamp(8rem, 17vw, 14rem);
  top: clamp(3rem, 8vw, 5rem);
  right: clamp(2rem, 12vw, 9rem);
  background:
    radial-gradient(circle at 32% 28%, rgba(73,91,125,0.28) 0 8%, transparent 9%),
    radial-gradient(circle at 62% 56%, rgba(73,91,125,0.22) 0 11%, transparent 12%),
    radial-gradient(circle at 50% 50%, #fff8df, #d9c7a8 64%, #a9b5c8 100%);
  box-shadow: 0 0 42px rgba(240,236,221,0.65), 0 0 130px rgba(240,236,221,0.28);
}

.top-note {
  position: fixed;
  top: 1.4rem;
  left: 1.8rem;
  z-index: 2;
  transform: rotate(-7deg);
  text-align: left;
}

.hand-note,
.tap-note,
.paper-note,
.paper-message {
  font-family: "Bradley Hand", "Segoe Print", "Comic Sans MS", cursive;
  letter-spacing: 0;
}

.hand-note {
  margin: 0 0 0.4rem;
  color: var(--warm-ink);
  font-size: clamp(1.6rem, 5vw, 3rem);
  line-height: 1.1;
}

.center-content {
  max-width: 880px;
  margin-left: clamp(0rem, 4vw, 4rem);
  padding-top: 7rem;
  text-align: center;
}

h1,
h2 {
  color: #ead2b8;
  font-family: Georgia, "Times New Roman", serif;
  font-style: italic;
  font-weight: 400;
  text-shadow: 0 0 24px rgba(240,236,221,0.18);
}

h1 {
  font-size: clamp(4.4rem, 12vw, 8.8rem);
  line-height: 0.9;
}

h2 {
  font-size: clamp(2.3rem, 6vw, 4.6rem);
  margin-bottom: 0.55rem;
}

.subtitle {
  color: rgba(240,236,221,0.86);
}

.subtitle.small {
  margin-top: 0;
  margin-bottom: 2rem;
  font-size: 1rem;
}

.glow-button {
  color: #2b2430;
  background: linear-gradient(180deg, #f7e5d0, #d8bda4);
  border: 1px solid rgba(240,236,221,0.85);
  box-shadow: 0 0 26px rgba(240,236,221,0.45), inset 0 0 20px rgba(255,255,255,0.28);
  font-weight: 500;
}

.menu-content.narrow {
  width: min(720px, 100%);
  text-align: center;
}

.cute-menu {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.85rem;
}

.menu-card {
  min-height: 8.9rem;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  text-align: center;
  color: var(--paper);
  background: rgba(8, 28, 58, 0.52);
  border-color: rgba(240,236,221,0.22);
  border-radius: 14px;
  box-shadow: inset 0 0 28px rgba(139,163,197,0.08), 0 18px 42px rgba(2,18,47,0.38);
}

.menu-card span {
  color: #d6bca4;
  font-size: 1.55rem;
}

.menu-card strong {
  max-width: 9rem;
  font-size: 1.28rem;
  line-height: 1.05;
}

.menu-card p {
  max-width: 9rem;
  margin: 0;
  color: rgba(240,236,221,0.72);
  font-size: 0.72rem;
  line-height: 1.35;
}

.paper-note,
.paper-letter {
  position: relative;
  color: var(--ink);
  background:
    radial-gradient(circle at 18% 16%, rgba(255,255,255,0.35), transparent 8rem),
    repeating-linear-gradient(94deg, rgba(73,91,125,0.025) 0 1px, transparent 1px 10px),
    var(--paper);
  border: 0;
  border-radius: 4px;
  box-shadow: 0 26px 60px rgba(2,18,47,0.4);
}

.paper-note.large-note {
  width: min(650px, 100%);
  margin: 2rem auto 0;
  padding: clamp(2rem, 6vw, 4rem);
  transform: rotate(-1.5deg);
  font-size: clamp(1.15rem, 2.8vw, 1.55rem);
  line-height: 1.7;
}

.paper-note::before {
  content: "";
  position: absolute;
  top: -0.8rem;
  left: 42%;
  width: 7rem;
  height: 1.8rem;
  background: rgba(223,203,178,0.72);
  transform: rotate(2deg);
  box-shadow: 0 6px 18px rgba(2,18,47,0.12);
}

.boby-letter {
  width: min(620px, 100%);
  padding: clamp(1.7rem, 5vw, 3.2rem);
  overflow: hidden;
  border: 1px solid rgba(73,91,125,0.12);
  border-radius: 6px;
  background:
    linear-gradient(135deg, transparent 0 88%, rgba(219,199,173,0.78) 88% 100%),
    radial-gradient(circle at 12% 10%, rgba(255,255,255,0.45), transparent 8rem),
    repeating-linear-gradient(2deg, rgba(73,91,125,0.025) 0 1px, transparent 1px 12px),
    repeating-linear-gradient(94deg, rgba(73,91,125,0.018) 0 1px, transparent 1px 14px),
    var(--paper);
  box-shadow: 0 28px 70px rgba(2,18,47,0.48), 0 0 35px rgba(240,236,221,0.12);
  transform: rotate(-1deg);
}

.boby-letter::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 4.2rem;
  aspect-ratio: 1;
  background: linear-gradient(135deg, rgba(189,169,145,0.36), rgba(240,236,221,0.86));
  clip-path: polygon(100% 0, 0 0, 100% 100%);
  box-shadow: -8px 8px 18px rgba(2,18,47,0.14);
}

.boby-letter p {
  margin: 0 0 1rem;
  font-family: 'Caveat', cursive;
  font-size: clamp(1.25rem, 3.4vw, 1.62rem);
  line-height: 1.35;
}

.boby-letter p:first-child {
  font-size: clamp(1.7rem, 5vw, 2.4rem);
}

.boby-letter .letter-signature {
  margin-top: 1.3rem;
  text-align: right;
  font-size: clamp(1.35rem, 3.8vw, 1.9rem);
}

.gallery-grid,
.song-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.photo-card,
.song-card,
.admire-card {
  background: rgba(8,28,58,0.52);
  border-color: rgba(240,236,221,0.22);
  border-radius: 14px;
}

.admire-card div.admire-photo {
  min-height: 0;
  aspect-ratio: 1 / 1;
  margin-bottom: 1rem;
  overflow: hidden;
  border: 1px solid rgba(240,236,221,0.3);
  border-radius: 14px;
  background:
    linear-gradient(135deg, rgba(240,236,221,0.9), rgba(139,163,197,0.4)),
    rgba(240,236,221,0.72);
  box-shadow: inset 0 0 24px rgba(255,255,255,0.16), 0 16px 28px rgba(2,18,47,0.2);
}

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

.admire-card div.admire-placeholder {
  display: grid;
  place-items: center;
  color: #e7cbb0;
  font-family: 'Caveat', cursive;
  font-size: clamp(2.4rem, 8vw, 4rem);
  text-shadow: 0 0 20px rgba(240,236,221,0.55);
}

.song-card {
  min-height: 12rem;
  padding: 1.1rem;
  text-align: left;
}

.vinyl-mini {
  width: 4.3rem;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  margin-bottom: 1rem;
  border-radius: 50%;
  color: var(--paper);
  background: radial-gradient(circle, #e7cbb0 0 15%, #10131c 16% 100%);
  box-shadow: 0 0 26px rgba(240,236,221,0.18);
}

.count-card {
  border-radius: 14px;
  background: rgba(8,28,58,0.65);
  color: var(--paper);
  border-color: rgba(240,236,221,0.25);
}

.secret-crate > p:first-child,
.tap-note {
  color: #ead2b8;
}

.tap-note {
  margin: 0;
  transform: rotate(-8deg);
  font-size: 1.15rem;
}

.pin-dialog h2 {
  font-size: clamp(2rem, 6vw, 3.6rem);
}

.game-content {
  width: min(1040px, 100%);
}

.runner-shell {
  width: 100%;
  padding: clamp(0.8rem, 2vw, 1.2rem);
  border: 1px solid rgba(240,236,221,0.42);
  border-radius: 18px;
  background: rgba(8,28,58,0.52);
  box-shadow: inset 0 0 34px rgba(139,163,197,0.08), 0 24px 60px rgba(2,18,47,0.42);
  backdrop-filter: blur(16px);
}

.runner-topbar,
.runner-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  color: var(--paper);
  font-family: 'Courier New', monospace;
}

.runner-status {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.55rem;
}

.treat-counters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.treat-counters span,
.runner-score,
.game-music-toggle,
.pixel-button {
  border: 1px solid rgba(240,236,221,0.28);
  border-radius: 10px;
  background: rgba(2,18,47,0.42);
  box-shadow: inset 0 0 18px rgba(139,163,197,0.1);
}

.treat-counters span,
.runner-score {
  padding: 0.55rem 0.7rem;
  font-size: clamp(0.72rem, 1.9vw, 0.9rem);
  white-space: nowrap;
}

.game-music-toggle {
  padding: 0.55rem 0.7rem;
  color: var(--paper);
  font-family: 'Courier New', monospace;
  font-size: clamp(0.7rem, 1.8vw, 0.86rem);
  cursor: pointer;
  white-space: nowrap;
}

.game-music-toggle.playing {
  border-color: rgba(240,236,221,0.62);
  box-shadow: 0 0 20px rgba(139,163,197,0.36), inset 0 0 18px rgba(240,236,221,0.12);
}

.runner-stage {
  position: relative;
  width: 100%;
  margin: 0.9rem 0;
  overflow: hidden;
  border: 8px solid var(--paper);
  border-radius: 18px;
  background:
    radial-gradient(circle at 82% 16%, rgba(240,236,221,0.2), transparent 8rem),
    linear-gradient(180deg, #02122f 0%, #132945 62%, #23354d 100%);
  box-shadow: 0 0 34px rgba(240,236,221,0.22), inset 0 0 36px rgba(2,18,47,0.45);
  touch-action: manipulation;
}

.runner-canvas {
  display: block;
  width: 100%;
  aspect-ratio: 3 / 1;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.runner-overlay {
  position: absolute;
  inset: 0;
  display: none;
  place-items: center;
  gap: 1rem;
  padding: 1rem;
  text-align: center;
  color: var(--paper);
  background: rgba(2,18,47,0.46);
  backdrop-filter: blur(5px);
}

.runner-overlay.active {
  display: grid;
}

.runner-overlay p {
  max-width: 28rem;
  margin: 0;
  color: #f3d9bd;
  font-family: 'Caveat', cursive;
  font-size: clamp(1.6rem, 5vw, 2.7rem);
  line-height: 1;
  text-shadow: 0 0 20px rgba(240,236,221,0.42);
}

.runner-overlay-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
}

.pixel-button {
  min-width: 6.2rem;
  padding: 0.65rem 0.9rem;
  color: var(--paper);
  font-family: 'Courier New', monospace;
  cursor: pointer;
}

.pixel-button:hover,
.pixel-button:focus-visible {
  border-color: rgba(240,236,221,0.65);
  box-shadow: 0 0 20px rgba(139,163,197,0.28);
}

.runner-actions p {
  margin: 0;
  color: rgba(240,236,221,0.72);
  font-size: clamp(0.75rem, 1.8vw, 0.9rem);
  text-align: right;
}

@media (max-width: 760px) {
  .top-note {
    position: absolute;
    font-size: 1.2rem;
  }

  .cute-menu,
  .gallery-grid,
  .song-grid {
    grid-template-columns: 1fr 1fr;
  }

  .menu-card {
    min-height: 8.2rem;
  }

  .runner-topbar,
  .runner-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .runner-score,
  .runner-status,
  .game-music-toggle,
  .pixel-button,
  .runner-actions p {
    width: 100%;
    text-align: center;
  }

  .runner-status {
    justify-content: stretch;
  }
}

@media (max-width: 460px) {
  h1 {
    font-size: clamp(3.7rem, 19vw, 5rem);
  }

  .cute-menu,
  .gallery-grid,
  .song-grid,
  .admire-grid,
  .countdown-grid {
    grid-template-columns: 1fr;
  }

  .menu-card strong,
  .menu-card p {
    max-width: 100%;
  }
}
