*,
*::before,
*::after { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: #10112b;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: "Inter", system-ui, sans-serif;
  color: #f3ead8;
}

#scene {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  display: block;
  cursor: pointer;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  cursor: pointer;
}

/* ---- captions ---- */
#caption {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: max(9vh, 64px);
  margin: 0 auto;
  max-width: 34ch;
  text-align: center;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-style: italic;
  font-weight: 500;
  font-size: clamp(1.35rem, 3.2vw, 2.4rem);
  line-height: 1.2;
  letter-spacing: 0.01em;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.55), 0 0 24px rgba(0, 0, 0, 0.6);
  opacity: 0;
  pointer-events: none;
}

/* ---- end title ---- */
#title {
  position: fixed;
  left: 16px;
  right: 16px;
  top: 28%;
  transform: translateY(-50%);
  text-align: center;
  pointer-events: none;
}

#title h1 {
  margin: 0;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-weight: 500;
  font-size: clamp(3rem, 11vw, 8rem);
  letter-spacing: 0.06em;
  line-height: 1;
  color: #fbeedd;
  opacity: 0;
  filter: blur(8px);
  transition: opacity 2.4s ease, filter 2.4s ease;
}

#title p {
  margin: 1.1rem 0 0;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-style: italic;
  font-size: clamp(1.1rem, 2.4vw, 1.6rem);
  color: #d9c9e6;
  opacity: 0;
  transition: opacity 2s ease 1.6s;
}

#replay {
  margin-top: 2.4rem;
  padding: 0.6rem 1.3rem;
  border: 1px solid rgba(251, 238, 221, 0.35);
  border-radius: 999px;
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #fbeedd;
  opacity: 0;
  transition: opacity 1.6s ease 3.2s, background 0.3s, border-color 0.3s;
}

#replay:hover,
#replay:focus-visible {
  background: rgba(251, 238, 221, 0.1);
  border-color: rgba(251, 238, 221, 0.7);
  outline: none;
}

#title.show { pointer-events: auto; }
#title.show h1 { opacity: 1; filter: blur(0); }
#title.show p,
#title.show #replay { opacity: 1; }

/* ---- intro ---- */
#intro {
  position: fixed;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 1.2rem;
  padding: 16px;
  background: radial-gradient(ellipse at center, rgba(16, 17, 43, 0.35), rgba(10, 11, 24, 0.8));
  transition: opacity 1.2s ease;
}

#intro.gone {
  opacity: 0;
  pointer-events: none;
}

#begin {
  display: grid;
  justify-items: center;
  gap: 0.9rem;
}

#begin .ring {
  display: grid;
  place-items: center;
  width: 84px;
  height: 84px;
  border-radius: 50%;
  border: 1px solid rgba(243, 234, 216, 0.5);
  transition: transform 0.4s ease, background 0.4s ease;
}

#begin svg {
  width: 30px;
  height: 30px;
  fill: #f3ead8;
  margin-left: 4px;
}

#begin .label {
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 1.6rem;
  letter-spacing: 0.12em;
  text-transform: lowercase;
}

#begin:hover .ring,
#begin:focus-visible .ring {
  transform: scale(1.06);
  background: rgba(243, 234, 216, 0.08);
}

#begin:focus-visible { outline: none; }

#intro .hint {
  margin: 0;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  color: rgba(243, 234, 216, 0.55);
  text-align: center;
}

/* ---- controls ---- */
#controls {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px max(14px, env(safe-area-inset-bottom));
  opacity: 0;
  transition: opacity 0.6s ease;
  pointer-events: none;
}

body.playing:not(.idle) #controls,
body.paused #controls {
  opacity: 1;
  pointer-events: auto;
}

#pause {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(10, 11, 24, 0.35);
}

#pause svg {
  width: 18px;
  height: 18px;
  fill: #f3ead8;
}

#pause .i-play { display: none; }
body.paused #pause .i-play { display: block; }
body.paused #pause .i-pause { display: none; }

#progress {
  flex: 1;
  height: 2px;
  border-radius: 2px;
  background: rgba(243, 234, 216, 0.18);
  overflow: hidden;
}

#progress span {
  display: block;
  height: 100%;
  width: 0;
  background: rgba(243, 234, 216, 0.7);
}

.noscript {
  position: fixed;
  inset: 0;
  display: grid;
  place-content: center;
  margin: 0;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 1.5rem;
}
