@font-face {
  font-family: "Cormorant Garamond";
  src: url("cormorant-600.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Cormorant Garamond";
  src: url("cormorant-500.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Cormorant Garamond";
  src: url("cormorant-500i.woff2") format("woff2");
  font-weight: 500;
  font-style: italic;
  font-display: swap;
}

:root {
  --night: #070b14;
  --ink: #f3eee6;
  --flame: #ffb35c;
  --marigold: #f2a33a;
  color-scheme: dark;
}

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

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--night);
  color: var(--ink);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

#yard {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  height: 100dvh;
  display: block;
  touch-action: manipulation;
}

.hud {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}

.music {
  pointer-events: auto;
  position: absolute;
  top: max(10px, env(safe-area-inset-top));
  right: max(10px, env(safe-area-inset-right));
  min-width: 44px;
  min-height: 44px;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid rgba(255, 213, 154, 0.35);
  background: rgba(14, 22, 38, 0.82);
  color: #ffd59a;
  font: 600 0.78rem/1.1 system-ui, sans-serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  backdrop-filter: blur(8px);
}

.music[aria-pressed="true"] {
  border-color: rgba(255, 181, 92, 0.75);
  box-shadow: 0 0 20px rgba(255, 150, 60, 0.35);
}

.tap-cta {
  pointer-events: auto;
  position: absolute;
  left: 50%;
  bottom: max(18px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 72px;
  transition: opacity 420ms ease, transform 420ms ease;
}

body.hud-off .tap-cta,
body.finished .tap-cta {
  opacity: 0;
  transform: translateX(-50%) translateY(12px);
  pointer-events: none;
}

.tap-rings {
  position: absolute;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 213, 154, 0.85);
  animation: ring 2.4s cubic-bezier(0.2, 0.6, 0.3, 1) infinite;
}

.tap-rings::after {
  content: "";
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  border: 1px solid rgba(255, 213, 154, 0.5);
  animation: ring 2.4s cubic-bezier(0.2, 0.6, 0.3, 1) 1.2s infinite;
}

.tap-pill {
  position: relative;
  z-index: 1;
  border: 0;
  border-radius: 999px;
  padding: 10px 18px 10px 14px;
  background: #b9772f;
  color: #2a1600;
  font: 600 0.95rem/1.2 system-ui, sans-serif;
  letter-spacing: 0.01em;
  box-shadow:
    0 0 28px -2px rgba(255, 170, 70, 0.65),
    0 10px 24px -10px rgba(0, 0, 0, 0.9),
    inset 0 1px 0 rgba(255, 255, 255, 0.5);
  animation: bob 2.4s ease-in-out infinite;
}

.tap-note {
  pointer-events: none;
  position: absolute;
  left: 50%;
  bottom: calc(max(92px, env(safe-area-inset-bottom) + 74px));
  transform: translateX(-50%);
  margin: 0;
  font: 500 0.88rem/1.3 system-ui, sans-serif;
  color: rgba(243, 238, 230, 0.72);
  transition: opacity 320ms ease;
}

body.hud-off .tap-note,
body.finished .tap-note { opacity: 0; }

.finale {
  position: fixed;
  inset: 0;
  z-index: 3;
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
}

.finale.is-on {
  visibility: visible;
  pointer-events: auto;
  animation: finale-in 1.8s ease forwards;
}

.finale picture,
.finale img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 22%;
}

.veil {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    rgba(7, 11, 20, 0.55) 0%,
    rgba(7, 11, 20, 0.25) 38%,
    rgba(7, 11, 20, 0.72) 100%
  );
  opacity: 0;
}

.finale.is-on .veil { animation: veil 2.2s ease forwards; }

.words {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  text-align: center;
  padding:
    0 max(18px, env(safe-area-inset-right))
    max(28px, env(safe-area-inset-bottom))
    max(18px, env(safe-area-inset-left));
  opacity: 0;
}

.finale.is-on .words { animation: words 2.6s ease 0.35s forwards; }

.words h1 {
  margin: 0;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-weight: 600;
  font-size: clamp(2.6rem, 11vw, 3.6rem);
  line-height: 0.95;
  text-shadow: 0 2px 14px rgba(0, 0, 0, 0.75);
}

.words .saal {
  margin: 8px 0 0;
  color: #ffd59a;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-weight: 500;
  font-size: clamp(1.15rem, 4.5vw, 1.45rem);
  letter-spacing: 0.14em;
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.8);
}

.words .from {
  margin: 14px 0 0;
  max-width: 22ch;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-style: italic;
  font-weight: 500;
  font-size: clamp(1.2rem, 4.8vw, 1.55rem);
  line-height: 1.25;
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.85);
}

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@keyframes ring {
  0% { opacity: 0; transform: scale(0.55); }
  25% { opacity: 0.9; }
  100% { opacity: 0; transform: scale(1.45); }
}

@keyframes bob {
  0%, 60%, 100% { transform: translateY(0); }
  70% { transform: translateY(2px) scale(0.98); }
}

@keyframes finale-in {
  0% { opacity: 0; }
  100% { opacity: 1; }
}

@keyframes veil {
  0% { opacity: 0; }
  100% { opacity: 1; }
}

@keyframes words {
  0% { opacity: 0; transform: translateY(10px); filter: blur(6px); }
  100% { opacity: 1; transform: none; filter: none; }
}

@media (prefers-reduced-motion: reduce) {
  .tap-rings, .tap-rings::after, .tap-pill { animation: none; }
  .finale.is-on, .finale.is-on .veil, .finale.is-on .words {
    animation: none;
    opacity: 1;
  }
  .tap-cta, .tap-note { transition: none; }
}
