:root {
  --night: #120d0b;
  --night-2: #1c1411;
  --gold: #d7b56a;
  --gold-dim: rgba(215, 181, 106, 0.45);
  --paper: #f6f0e6;
  --paper-2: #fbf7f1;
  --ink: #241c17;
  --muted: #7a6a5e;
  --line: rgba(215, 181, 106, 0.28);
  --serif: "Noto Serif SC", "Songti SC", "STSong", serif;
  --latin: "Cormorant Garamond", "Noto Serif SC", serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  min-height: 100%;
  min-height: 100dvh;
}

body {
  color: var(--ink);
  font-family: var(--serif);
  line-height: 1.85;
  background: #ffe4f1;
}

.scene {
  position: fixed;
  left: 0;
  width: 100%;
  height: auto;
  z-index: -1;
  pointer-events: none;
  user-select: none;
}

.scene-top {
  top: 0;
  clip-path: inset(0 0 calc(100% - 18vw) 0);
}

.scene-bottom {
  bottom: 0;
  clip-path: inset(calc(100% - 24vw) 0 0 0);
}

button { font: inherit; color: inherit; }

.gate {
  position: fixed;
  inset: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
  width: 100%;
  height: 100%;
  padding: 18vw 24px calc(24vw + env(safe-area-inset-bottom));
  border: 0;
  background: transparent;
  cursor: pointer;
  transition: opacity 0.6s ease, visibility 0.6s ease;
}

body.entered .gate {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.halo {
  position: absolute;
  width: min(520px, 86vw);
  height: min(520px, 86vw);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(215, 181, 106, 0.16), transparent 68%);
  filter: blur(8px);
  pointer-events: none;
}

.frame {
  position: relative;
  padding: 14px;
  background:
    linear-gradient(160deg, rgba(255, 236, 196, 0.55), rgba(215, 181, 106, 0.12) 40%, rgba(120, 78, 36, 0.35));
  box-shadow:
    0 30px 80px rgba(0, 0, 0, 0.45),
    inset 0 0 0 1px rgba(255, 232, 190, 0.35);
}

.frame::before,
.frame::after {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  border-color: var(--gold);
  border-style: solid;
}

.frame::before { top: 8px; left: 8px; border-width: 1px 0 0 1px; }
.frame::after { right: 8px; bottom: 8px; border-width: 0 1px 1px 0; }

.sticker {
  display: block;
  width: min(210px, 58vw);
  height: auto;
  border-radius: 28px;
  box-shadow: 0 16px 40px rgba(196, 91, 134, 0.28);
}

.hello {
  position: relative;
  font-family: var(--serif);
  font-weight: 700;
  font-size: clamp(2.4rem, 12vw, 3.6rem);
  line-height: 1;
  letter-spacing: 0.18em;
  color: #ff5d93;
  text-indent: 0.18em;
  text-shadow: 0 2px 0 #fff, 0 8px 18px rgba(255, 255, 255, 0.8);
}

.hello::before,
.hello::after {
  content: "";
  display: block;
  width: 72px;
  height: 1px;
  margin: 18px auto 0;
  background: linear-gradient(90deg, transparent, #ff8aaf, transparent);
}

.hello::before { margin: 0 auto 18px; }

.stage {
  width: min(430px, 100%);
  margin: 0 auto;
  padding: 12px 16px calc(128px + env(safe-area-inset-bottom));
}

.tabs {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 12px 0 16px;
  background: linear-gradient(rgba(255, 228, 241, 0.94) 70%, transparent);
}

.tab {
  flex: 1;
  min-width: 0;
  border: 0;
  background: rgba(255, 255, 255, 0.78);
  color: #d45b86;
  border-radius: 999px;
  padding: 10px 8px;
  letter-spacing: 0.04em;
  text-transform: lowercase;
  font-family: var(--latin);
  font-size: 1rem;
  cursor: pointer;
}

.tab.is-on {
  background: linear-gradient(180deg, #e6cb8a, #b8893e);
  border-color: transparent;
  color: #2a1c10;
}

.panel[hidden] { display: none; }

.letter, .close {
  background: rgba(255, 255, 255, 0.86);
  border: 0;
  border-radius: 22px;
  box-shadow: 0 16px 40px rgba(214, 120, 156, 0.18);
  padding: 28px 20px 32px;
}

.letter > p:first-of-type::first-letter {
  float: left;
  margin: 0.08em 0.12em 0 0;
  font-family: var(--latin);
  font-size: 4.4rem;
  line-height: 0.75;
  color: #9a7040;
}

.letter p, .close p { margin-bottom: 1.15em; }
.letter p:last-child, .close p:last-child { margin-bottom: 0; }

.verse {
  margin: 1.8em 0 2em;
  padding: 8px 0 8px 1.2em;
  border-left: 1px solid rgba(154, 112, 64, 0.45);
  color: #6d4c32;
}

.verse p { margin-bottom: 1em; }
.verse--center {
  border-left: 0;
  padding-left: 0;
  text-align: center;
}

.kicker {
  text-align: center;
  letter-spacing: 0.42em;
  text-transform: uppercase;
  text-indent: 0.42em;
  color: #9a7040;
  font-family: var(--latin);
  font-size: 1.05rem;
}

.sign {
  margin-top: 2em;
  text-align: right;
  font-family: var(--latin);
  font-style: italic;
  font-size: 2rem;
  line-height: 1.25;
  color: #6d4c32;
}

.journal { display: flex; flex-direction: column; gap: 42px; }

.journal figure {
  margin: 0;
  background: rgba(255, 255, 255, 0.86);
  border: 0;
  border-radius: 22px;
  box-shadow: 0 16px 40px rgba(214, 120, 156, 0.18);
  padding: 12px 12px 0;
  overflow: hidden;
}

.journal img {
  display: block;
  width: 100%;
  height: auto;
  background: #efe6dc;
}

.journal figcaption {
  padding: 16px 10px 18px;
  color: var(--muted);
  font-size: 0.98rem;
  text-align: center;
}

.player {
  position: fixed;
  left: 50%;
  bottom: 18px;
  z-index: 6;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 12px;
  width: min(360px, calc(100% - 28px));
  padding: 8px 16px 8px 8px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: #d45b86;
  backdrop-filter: blur(12px);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
}

.player[hidden],
body:not(.entered) .player { display: none; }

.player button {
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 50%;
  background: linear-gradient(180deg, #e6cb8a, #b8893e);
  color: #2a1c10;
  cursor: pointer;
  display: grid;
  place-items: center;
}

.player svg { width: 15px; height: 15px; fill: currentColor; }
.player span {
  font-family: var(--latin);
  font-size: 1.15rem;
  letter-spacing: 0.04em;
}

@media (max-width: 640px) {
  .letter, .close { padding: 28px 18px 32px; }
  .hello { letter-spacing: 0.12em; text-indent: 0.12em; }
}

@media (prefers-reduced-motion: reduce) {
  .gate { transition: none; }
}
