.screen {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: max(32px, env(safe-area-inset-top)) 22px max(40px, env(safe-area-inset-bottom));
  gap: 14px;
  animation: fadeIn 0.9s ease both;
}

@keyframes fadeIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

/* ---------- landing ---------- */
.wordmark {
  font-family: 'Dancing Script', cursive;
  font-weight: 700;
  font-size: clamp(3.2rem, 14vw, 5.5rem);
  margin: 28px 0 0;
  line-height: 1;
  background: linear-gradient(180deg, #fff6dc, var(--gold));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 22px rgba(245, 211, 138, 0.35));
}
.tagline { font-family: 'Cormorant Garamond', serif; font-style: italic; font-size: 1.45rem; margin: 0; color: #e7e3ff; }
.hint { color: var(--muted); font-size: 0.95rem; margin: 18px 0 0; max-width: 32ch; }
.muted-text { color: var(--muted); margin: 0; font-size: 1.05rem; }
.muted-text b { color: var(--gold); font-weight: 600; }

/* ---------- envelope screen ---------- */
.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.28em;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--gold);
  margin: 0;
  opacity: 0.9;
}
.env-title {
  font-family: 'Dancing Script', cursive;
  font-weight: 700;
  font-size: clamp(2.1rem, 9vw, 3.2rem);
  line-height: 1.1;
  margin: 0;
  max-width: 16ch;
  text-shadow: 0 0 30px rgba(245, 211, 138, 0.3);
}

.warning {
  width: min(420px, 100%);
  margin-top: 8px;
  padding: 16px 20px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(244, 169, 196, 0.12), rgba(245, 211, 138, 0.1));
  border: 1px solid rgba(244, 169, 196, 0.35);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: fadeIn 0.9s 0.2s ease both;
}
.warning-head { font-weight: 700; color: var(--rose); letter-spacing: 0.02em; margin-bottom: 6px; }
.warning p {
  margin: 0;
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.25rem;
  line-height: 1.45;
  white-space: pre-wrap;
}

.envelope {
  position: relative;
  width: min(290px, 76vw);
  aspect-ratio: 1.55;
  margin: 34px auto 18px;
  perspective: 1000px;
  animation: envFloat 5s ease-in-out infinite;
  transition: opacity 0.6s ease 1.5s, transform 0.6s ease 1.5s;
}
@keyframes envFloat { 0%, 100% { translate: 0 0; rotate: -1.5deg; } 50% { translate: 0 -8px; rotate: 1.5deg; } }

.env-back, .env-front, .env-flap { position: absolute; inset: 0; border-radius: 10px; }
.env-back {
  background: linear-gradient(160deg, #efe3c8, #dccaa5);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5), 0 0 60px rgba(245, 211, 138, 0.12);
}
.env-card {
  position: absolute;
  left: 7%; right: 7%; top: 8%; bottom: 8%;
  border-radius: 6px;
  background: var(--paper);
  color: var(--ink);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding-top: 10%;
  font-family: 'Dancing Script', cursive;
  font-size: 1.7rem;
  z-index: 2;
  transition: transform 1s cubic-bezier(0.2, 0.8, 0.2, 1) 0.5s;
}
.env-card small { font-size: 1.1rem; }
.env-front {
  z-index: 3;
  background: linear-gradient(170deg, #f7ecd4, #e6d4ae);
  clip-path: polygon(0 0, 50% 56%, 100% 0, 100% 100%, 0 100%);
}
.env-flap {
  z-index: 4;
  background: linear-gradient(180deg, #f3e6c9, #e2cfa6);
  clip-path: polygon(0 0, 100% 0, 50% 60%);
  transform-origin: top center;
  transition: transform 0.7s cubic-bezier(0.5, 0, 0.3, 1), z-index 0s linear 0.35s;
  filter: drop-shadow(0 3px 4px rgba(0, 0, 0, 0.15));
}
.env-seal {
  position: absolute;
  z-index: 5;
  left: 50%; top: 58%;
  width: 54px; height: 54px;
  translate: -50% -50%;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 1.7rem;
  color: #fff3d0;
  background: radial-gradient(circle at 35% 30%, #c86b8e, #9b3d63 60%, #7a2c4d);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.35), inset 0 -3px 6px rgba(0, 0, 0, 0.25), inset 0 2px 4px rgba(255, 255, 255, 0.25);
  transition: transform 0.4s ease, opacity 0.4s ease;
}

.envelope.opening { animation: none; }
.envelope.opening .env-seal { transform: scale(1.4); opacity: 0; }
.envelope.opening .env-flap { transform: rotateX(180deg); z-index: 1; }
.envelope.opening .env-card { transform: translateY(-58%); }
.envelope.opening.gone { opacity: 0; transform: scale(1.1) translateY(-20px); }

.btn-open { font-size: 1.1rem; padding: 0.9em 2em; animation: pulse 2.6s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { box-shadow: 0 8px 30px rgba(245, 211, 138, 0.3); } 50% { box-shadow: 0 8px 46px rgba(245, 211, 138, 0.6); } }

/* ---------- locked ---------- */
.countdown { display: flex; gap: 10px; margin-top: 12px; }
.countdown div {
  min-width: 68px;
  padding: 12px 8px;
  border-radius: 14px;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  display: flex; flex-direction: column; gap: 2px;
}
.countdown b { font-size: 1.7rem; color: var(--gold); font-variant-numeric: tabular-nums; }
.countdown span { font-size: 0.72rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.1em; }

/* ---------- content ---------- */
.content {
  position: relative;
  z-index: 1;
  width: min(640px, 100%);
  margin: 0 auto;
  padding: max(40px, env(safe-area-inset-top)) 20px max(60px, env(safe-area-inset-bottom));
}
.content-head { display: flex; flex-direction: column; align-items: center; gap: 18px; margin-bottom: 36px; text-align: center; }
.content-title { font-family: 'Dancing Script', cursive; font-size: clamp(2.2rem, 9vw, 3.3rem); margin: 0; line-height: 1.1; text-shadow: 0 0 30px rgba(245, 211, 138, 0.3); }
.content-title:empty { display: none; }
.blocks { display: flex; flex-direction: column; gap: 40px; }
.content-foot { text-align: center; margin-top: 56px; font-family: 'Dancing Script', cursive; font-size: 1.5rem; color: var(--gold); }

.reveal { opacity: 0; transform: translateY(28px); transition: opacity 1s ease, transform 1s cubic-bezier(0.2, 0.8, 0.2, 1); }
.reveal.in { opacity: 1; transform: none; }

.letter {
  position: relative;
  background: linear-gradient(180deg, #fffaf0, #f5ead3);
  color: var(--ink);
  border-radius: 6px;
  padding: 38px 28px 46px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.4) inset;
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 1.32rem;
  line-height: 1.6;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  text-align: left;
}
.letter::first-letter {
  font-family: 'Dancing Script', cursive;
  font-size: 3.4rem;
  float: left;
  line-height: 0.85;
  margin: 6px 3px 0 0;
  color: #8b4f7e;
}
.letter::after {
  content: '🌙';
  position: absolute;
  right: 16px;
  bottom: 12px;
  font-size: 1.1rem;
  opacity: 0.6;
}

.polaroid {
  margin: 0 auto;
  width: min(100%, 460px);
  background: #fffdf8;
  padding: 12px 12px 14px;
  border-radius: 4px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
  rotate: var(--tilt, 0deg);
}
.polaroid img { display: block; width: 100%; height: auto; border-radius: 2px; cursor: zoom-in; background: #eee; }
.polaroid figcaption, .frame figcaption, .audio-card .audio-caption {
  font-family: 'Dancing Script', cursive;
  font-size: 1.45rem;
  line-height: 1.25;
  padding: 12px 6px 2px;
  text-align: center;
  white-space: pre-wrap;
}
.polaroid figcaption { color: var(--ink); }

.frame { margin: 0; }
.frame video {
  display: block;
  width: 100%;
  max-height: 80vh;
  border-radius: var(--radius);
  background: #000;
  border: 1px solid var(--glass-border);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5), 0 0 50px rgba(245, 211, 138, 0.12);
}
.frame figcaption { color: var(--moon); }

.audio-card {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 18px 20px;
  border-radius: 24px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.03));
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
}
.audio-play {
  flex: none;
  width: 68px; height: 68px;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  display: grid;
  place-items: center;
  color: #3a2d57;
  background: radial-gradient(circle at 34% 32%, #fffdf0, #fff0c4 45%, #e6c67e);
  box-shadow: 0 0 28px rgba(255, 230, 170, 0.45);
  transition: transform 0.15s;
}
.audio-play:active { transform: scale(0.94); }
.audio-play svg { width: 26px; height: 26px; }
.audio-card.playing .audio-play { animation: moonGlow 2s ease-in-out infinite; box-shadow: 0 0 44px rgba(255, 230, 170, 0.7); }
.audio-body { flex: 1; min-width: 0; text-align: left; }
.audio-card .audio-caption { padding: 0 0 8px; text-align: left; color: var(--moon); font-size: 1.35rem; }
.audio-track { position: relative; height: 6px; border-radius: 999px; background: rgba(255, 255, 255, 0.15); cursor: pointer; touch-action: none; }
.audio-track::before { content: ''; position: absolute; inset: -10px 0; }
.audio-fill { height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, var(--rose), var(--gold)); }
.audio-time { display: flex; justify-content: space-between; font-size: 0.78rem; color: var(--muted); margin-top: 6px; font-variant-numeric: tabular-nums; }
.audio-bars { display: flex; gap: 3px; align-items: flex-end; height: 18px; margin-bottom: 6px; }
.audio-bars i { width: 3px; height: 30%; border-radius: 2px; background: var(--gold); opacity: 0.6; }
.audio-card.playing .audio-bars i { animation: bar 0.9s ease-in-out infinite; }
.audio-bars i:nth-child(2) { animation-delay: -0.2s !important; }
.audio-bars i:nth-child(3) { animation-delay: -0.5s !important; }
.audio-bars i:nth-child(4) { animation-delay: -0.1s !important; }
.audio-bars i:nth-child(5) { animation-delay: -0.7s !important; }
@keyframes bar { 0%, 100% { height: 25%; } 50% { height: 100%; } }

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(5, 8, 24, 0.94);
  display: grid;
  place-items: center;
  padding: 16px;
  cursor: zoom-out;
  animation: fadeIn 0.3s ease both;
}
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 6px; box-shadow: 0 0 80px rgba(245, 211, 138, 0.15); }
