:root {
  --bg: #efe2c8;
  --bg-deep: #dcc6a2;
  --court: #8faea5;
  --court-dark: #6f8f85;
  --line: rgba(248, 250, 247, 0.82);
  --shadow: rgba(32, 49, 45, 0.12);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
}

.shell {
  min-height: 100vh;
  display: grid;
  justify-items: center;
  align-content: start;
  padding: max(10px, env(safe-area-inset-top)) 16px max(18px, env(safe-area-inset-bottom));
}

.phone {
  width: min(
    calc(100vw - 32px),
    398px,
    calc((100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 118px) * 0.5)
  );
  margin-top: 4px;
}

.stage {
  position: relative;
  border: 1px solid rgba(255, 255, 255, 0.65);
  box-shadow: 0 28px 80px rgba(32, 49, 45, 0.14);
}

.stage {
  overflow: hidden;
  border-radius: 32px;
}

canvas {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 9 / 16;
  background: linear-gradient(180deg, var(--court) 0%, var(--court-dark) 100%);
  cursor: none;
  touch-action: none;
}

@media (max-width: 480px) and (orientation: portrait) {
  .shell {
    padding: max(6px, env(safe-area-inset-top)) 12px max(18px, env(safe-area-inset-bottom));
  }

  .phone {
    width: min(
      calc(100vw - 24px),
      calc((100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 108px) * 0.485)
    );
    margin-top: 2px;
  }

  .stage {
    border-radius: 28px;
  }
}

.intro-splash {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 50% 38%, rgba(255, 255, 255, 0.28), transparent 34%),
    linear-gradient(180deg, rgba(143, 174, 165, 0.52), rgba(111, 143, 133, 0.62));
  opacity: 1;
  transition: opacity 1800ms ease;
  pointer-events: auto;
}

.intro-splash.hidden {
  opacity: 0;
  pointer-events: none;
}

.intro-logo {
  width: min(82vw, 360px);
  max-width: calc(100% - 40px);
  height: auto;
  filter: drop-shadow(0 28px 64px rgba(32, 49, 45, 0.2));
  opacity: 0.98;
  transform: scale(1);
  transition: transform 1800ms ease, opacity 1800ms ease;
}

.intro-splash.hidden .intro-logo {
  opacity: 0;
  transform: scale(1.06);
}

.ceremony-splash {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: grid;
  place-items: center;
  background: rgba(68, 90, 83, 0.14);
  opacity: 1;
  transition: opacity 1000ms ease;
  pointer-events: auto;
}

.ceremony-splash.hidden,
.ceremony-splash.fade-out {
  opacity: 0;
  pointer-events: none;
}

.ceremony-image {
  width: min(82%, 360px);
  max-width: calc(100% - 40px);
  height: auto;
  filter: drop-shadow(0 28px 64px rgba(32, 49, 45, 0.16));
}

.overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(68, 90, 83, 0.08);
  transition: opacity 900ms ease;
}

.overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.about-card {
  width: min(330px, calc(100% - 44px));
  padding: 30px 24px 28px;
  border-radius: 28px;
  text-align: center;
  color: rgba(248, 250, 247, 0.92);
  background: rgba(120, 146, 139, 0.2);
  backdrop-filter: blur(18px);
  border: 1px solid rgba(248, 250, 247, 0.24);
  box-shadow: 0 24px 60px rgba(32, 49, 45, 0.12);
  font-family: Futura, "Avenir Next", "Century Gothic", sans-serif;
}

.about-mark {
  margin-bottom: 14px;
  font-size: 11px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  opacity: 0.72;
}

.about-card p {
  margin: 0 0 10px;
  font-size: 13px;
  letter-spacing: 0.075em;
  line-height: 1.55;
}

.about-card strong {
  font-weight: 600;
  letter-spacing: 0.12em;
}

.control-zone {
  position: relative;
  height: 98px;
  margin-top: 10px;
  border-radius: 24px;
  background: var(--bg);
  touch-action: none;
}

.serve-mark,
.music-toggle {
  position: absolute;
  text-align: center;
  letter-spacing: 0.16em;
  color: rgba(49, 71, 64, 0.56);
}

.serve-mark {
  left: 50%;
  right: auto;
  bottom: 12px;
  width: 92px;
  height: 38px;
  z-index: 2;
  display: grid;
  place-items: center;
  font-family: Futura, "Avenir Next", "Century Gothic", sans-serif;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-indent: 0.18em;
  transition: opacity 160ms ease, transform 160ms ease, background 160ms ease, border-color 160ms ease;
  border: 1px solid rgba(248, 250, 247, 0.34);
  border-radius: 999px;
  background: rgba(248, 250, 247, 0.12);
  box-shadow:
    0 10px 24px rgba(32, 49, 45, 0.14),
    inset 0 0 0 1px rgba(255, 255, 255, 0.08);
  cursor: pointer;
  pointer-events: auto;
  color: rgba(248, 250, 247, 0.92);
  backdrop-filter: blur(10px);
  transform: translateX(-50%);
}

.music-toggle {
  top: 12px;
  right: 10px;
  left: auto;
  z-index: 2;
  width: 56px;
  height: 28px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  background: transparent;
  font-family: Futura, "Avenir Next", "Century Gothic", sans-serif;
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.22em;
  text-indent: 0.22em;
  color: rgba(49, 71, 64, 0.52);
  cursor: pointer;
  pointer-events: auto;
  transition: opacity 160ms ease, color 160ms ease, transform 160ms ease;
}

.music-toggle:active {
  transform: scale(0.96);
}

.music-toggle.is-off {
  color: rgba(49, 71, 64, 0.28);
}

.serve-mark.hidden {
  opacity: 0;
  transform: translateX(-50%) translateY(6px);
}

.serve-mark:active {
  transform: translateX(-50%) scale(0.97);
  background: rgba(248, 250, 247, 0.18);
  border-color: rgba(248, 250, 247, 0.5);
}

@keyframes breathe {
  0%,
  100% {
    transform: scale(0.96);
    opacity: 0.68;
  }

  50% {
    transform: scale(1.06);
    opacity: 1;
  }
}
