:root {
  color: #451d16;
  background: #f7f0df;
  font-family: Georgia, "Times New Roman", serif;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; margin: 0; }
body { overflow-x: hidden; }
button { font: inherit; }

.card {
  min-height: 100dvh;
  position: relative;
  background-color: #fffdfa;
  background-image:
    radial-gradient(ellipse 52% 38% at -8% -10%, rgba(226, 151, 142, 0.78) 0%, rgba(242, 189, 181, 0.50) 42%, transparent 72%),
    radial-gradient(ellipse 47% 34% at 108% -8%, rgba(215, 166, 57, 0.76) 0%, rgba(239, 204, 128, 0.48) 43%, transparent 73%),
    radial-gradient(ellipse 43% 33% at -8% 108%, rgba(169, 151, 204, 0.68) 0%, rgba(211, 199, 232, 0.42) 43%, transparent 73%),
    radial-gradient(ellipse 50% 38% at 108% 108%, rgba(205, 139, 33, 0.78) 0%, rgba(232, 185, 90, 0.50) 43%, transparent 73%);
}

.screen {
  display: none;
  min-height: 100dvh;
  opacity: 0;
}
.screen.active { display: flex; animation: fade-in 360ms ease forwards; }
@keyframes fade-in { to { opacity: 1; } }

.sound-toggle {
  position: fixed;
  z-index: 10;
  top: max(0.85rem, env(safe-area-inset-top));
  right: 0.85rem;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 2.6rem;
  padding: 0.45rem 0.7rem;
  border: 1px solid #c99a35;
  border-radius: 999px;
  color: #fff9e9;
  background: rgba(103, 15, 24, 0.92);
  box-shadow: 0 2px 8px rgba(73, 33, 17, 0.25);
  cursor: pointer;
  font-size: 0.875rem;
}
.sound-toggle:focus-visible, .card-button:focus-visible, .image-start-button:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }

.top-screen { align-items: center; justify-content: center; background: #f7ead4; }
.opening-stage { position: relative; width: min(100vw, calc(100dvh * 0.80143)); height: 100dvh; }
.opening-image { display: block; width: 100%; height: 100%; object-fit: contain; }
.image-start-button { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: transparent; cursor: pointer; }

.video-screen { align-items: center; justify-content: center; padding: 5.25rem 1.25rem 2.5rem; }
.video-layout { width: min(86vw, 41rem); display: flex; flex-direction: column; align-items: center; gap: 1.5rem; }
.video-frame { width: 100%; aspect-ratio: 1; padding: 0.3rem; overflow: hidden; line-height: 0; border: 1px solid #c99a35; background: #fcf5e8; box-shadow: 0 8px 26px rgba(99, 67, 22, 0.16); }
video { display: block; width: 100%; height: 100%; object-fit: contain; background: #fcf5e8; }

.card-button { min-height: 3.1rem; padding: 0.7rem 1.35rem; border: 2px solid #e2b54c; border-radius: 999px; color: #fff8e9; background: linear-gradient(#a6192c, #6d0713); box-shadow: inset 0 0 0 2px rgba(255,255,255,.16), 0 3px 8px rgba(79, 18, 20, .22); cursor: pointer; font-size: 1rem; font-weight: bold; letter-spacing: .02em; }
.card-button:hover { filter: brightness(1.08); }
.card-button:active { transform: translateY(1px); }
.is-hidden { display: none; }
.letter-prompt { display: grid; justify-items: center; gap: 0.4rem; text-align: center; }
.letter-prompt[hidden] { display: none; }
.letter-prompt p { margin: 0; font-size: clamp(1.15rem, 4.8vw, 1.55rem); }

.letter-screen { flex-direction: column; align-items: center; justify-content: center; gap: 1.25rem; padding: 4.5rem 0.75rem 2rem; }
.letter-frame { position: relative; width: min(94vw, 35rem); aspect-ratio: 1122 / 1400; }
.letter-image { display: block; width: 100%; height: 100%; object-fit: contain; }
.letter-copy { --letter-size: clamp(0.9rem, 3.3vw, 1.35rem); position: absolute; top: 25%; right: 24%; bottom: 28%; left: 24%; overflow: hidden; color: #4a271e; font-size: var(--letter-size); line-height: 1.45; text-align: left; }
.letter-copy p { margin: 0; }
.letter-copy .salutation { margin-bottom: 1em; }
.letter-copy .message { white-space: pre-wrap; overflow-wrap: anywhere; }
.letter-copy .signature { margin-top: 1.2em; text-align: right; }
.replay-button { flex: 0 0 auto; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
@media (min-width: 700px) {
  .video-screen { padding-top: 4rem; }
  .letter-screen { padding-top: 2.5rem; }
}
@media (max-height: 650px) and (orientation: landscape) {
  .opening-stage { width: min(100vw, calc(100dvh * 0.80143)); height: 100dvh; }
  .video-screen { padding: 3.6rem 1rem 1rem; }
  .video-layout { width: min(68vh, 75vw); gap: .7rem; }
  .letter-screen { padding: 3.5rem 1rem 1rem; flex-direction: row; }
  .letter-frame { width: min(45vh, 48vw); }
}
