* {
  box-sizing: border-box;
}

:root {
  --bg: #090b16;
  --text: #f7f3f4;
  --muted: #b9b1b8;
  --line: rgba(255,255,255,.13);
  --glass: rgba(18,20,34,.72);
  --accent: #e8c6d4;
}

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, system-ui, sans-serif;
}

body {
  min-height: 100vh;
  overflow: hidden;
  position: relative;
}

main {
  min-height: 100vh;
  position: relative;
  z-index: 2;
}

.screen {
  min-height: 100vh;
  width: 100%;
  display: none;
  place-items: center;
  padding: 28px 22px;
  text-align: center;
}

.screen.active {
  display: grid;
  animation: fadeIn .75s ease both;
}

#home, #ending {
  align-content: center;
}

.heart {
  font-family: Georgia, serif;
  font-size: 46px;
  color: var(--accent);
  margin-bottom: 12px;
  animation: float 3.5s ease-in-out infinite;
}

.heart.big {
  font-size: 64px;
}

.eyebrow {
  text-transform: lowercase;
  letter-spacing: .12em;
  font-size: 11px;
  color: var(--muted);
  margin: 0 0 16px;
}

h1, h2 {
  font-family: Caveat, cursive;
  font-weight: 500;
  line-height: .95;
  margin: 0;
}

h1 {
  font-size: clamp(48px, 13vw, 82px);
}

h2 {
  font-size: clamp(48px, 13vw, 78px);
}

.sub {
  color: var(--muted);
  font-size: 14px;
  margin: 24px 0 30px;
}

.main-btn, .ghost-btn {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 13px 22px;
  font: inherit;
  cursor: pointer;
  transition: transform .2s ease, background .2s ease, border-color .2s ease;
}

.main-btn {
  color: #17131a;
  background: var(--accent);
  border-color: transparent;
}

.main-btn:hover, .ghost-btn:hover {
  transform: translateY(-2px);
}

.main-btn:active, .ghost-btn:active {
  transform: scale(.97);
}

.ghost-btn {
  color: var(--text);
  background: rgba(255,255,255,.04);
}

.hint, .swipe-hint {
  color: #777581;
  font-size: 10px;
  margin-top: 24px;
}

#letter {
  display: none;
  grid-template-rows: auto auto 1fr auto auto;
  align-content: center;
  justify-items: center;
  gap: 12px;
}

#letter.active {
  display: grid;
}

.progress {
  width: min(360px, 78vw);
  height: 2px;
  background: rgba(255,255,255,.1);
  border-radius: 99px;
  overflow: hidden;
}

.progress span {
  display: block;
  height: 100%;
  width: 14.28%;
  background: var(--accent);
  transition: width .45s ease;
}

.page-number {
  color: #777581;
  font-size: 10px;
  margin: 0;
}

.letter-card {
  width: min(680px, 90vw);
  min-height: 330px;
  display: grid;
  place-items: center;
  align-content: center;
  padding: 34px 28px;
  background: linear-gradient(145deg, rgba(255,255,255,.055), rgba(255,255,255,.018));
  border: 1px solid var(--line);
  border-radius: 24px;
  backdrop-filter: blur(12px);
  box-shadow: 0 25px 70px rgba(0,0,0,.35);
}

.mini-heart {
  color: var(--accent);
  font-size: 22px;
  margin-bottom: 18px;
}

.letter-text {
  max-width: 590px;
  margin: 0;
  font-family: Caveat, cursive;
  font-size: clamp(29px, 6vw, 43px);
  line-height: 1.08;
}

.letter-text.typing {
  animation: textIn .45s ease both;
}

.controls {
  display: flex;
  gap: 10px;
  align-items: center;
}

.controls .ghost-btn {
  width: 46px;
  height: 46px;
  padding: 0;
}

.ending-text {
  max-width: 500px;
  color: var(--muted);
  line-height: 1.65;
  font-size: 14px;
  margin: 22px auto;
}

.signature {
  font-family: Caveat, cursive;
  font-size: 31px;
  color: var(--accent);
  margin: 0 0 25px;
}

.restart {
  font-size: 12px;
}

.stars, .stars::before, .stars::after {
  position: fixed;
  inset: 0;
  content: "";
  pointer-events: none;
}

.stars {
  opacity: .55;
  background-image:
    radial-gradient(circle at 15% 20%, rgba(255,255,255,.8) 0 1px, transparent 1.5px),
    radial-gradient(circle at 75% 30%, rgba(255,255,255,.55) 0 1px, transparent 1.5px),
    radial-gradient(circle at 35% 78%, rgba(255,255,255,.6) 0 1px, transparent 1.5px),
    radial-gradient(circle at 90% 82%, rgba(255,255,255,.5) 0 1px, transparent 1.5px);
  background-size: 180px 180px, 230px 230px, 260px 260px, 210px 210px;
  animation: drift 22s linear infinite;
}

.glow {
  position: fixed;
  width: 38vw;
  height: 38vw;
  max-width: 420px;
  max-height: 420px;
  border-radius: 50%;
  filter: blur(80px);
  opacity: .12;
  pointer-events: none;
}

.glow-one {
  background: #9d6c87;
  top: -15%;
  left: -10%;
}

.glow-two {
  background: #596f9e;
  right: -15%;
  bottom: -15%;
}

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

@keyframes textIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

@keyframes drift {
  from { transform: translateY(0); }
  to { transform: translateY(-35px); }
}

@media (max-height: 650px) {
  .letter-card { min-height: 250px; }
  .letter-text { font-size: clamp(25px, 5vw, 35px); }
}
