:root {
  --ink: #ffffff;
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.55);
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
}

body {
  /* Fallback shown before the video paints or if it fails to load */
  background-color: #1a1014;
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

/* Full-bleed background video. Sized to the LARGE viewport (100lvh) so it bleeds
   behind the iOS Safari toolbars for an immersive look; object-fit:cover fills the
   screen while preserving aspect ratio (no stretch). */
.bg-video {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;   /* fallback: on iOS this is the large viewport (behind bars) */
  height: 100lvh;  /* explicit large viewport for modern browsers */
  object-fit: cover;
  object-position: center;
  z-index: -2;
}

/* Subtle darkening for legibility of the text on top. Matches the video's
   large-viewport sizing so the tint also covers the area behind the bars. */
.scrim {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  height: 100lvh;
  z-index: -1;
  background: linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0.35) 0%,
    rgba(0, 0, 0, 0.15) 35%,
    rgba(0, 0, 0, 0.45) 100%
  );
}

.overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;   /* fallback */
  height: 100dvh;  /* dynamic viewport: tracks the visible area so the text stays
                      clear of the iOS toolbars while the video bleeds behind them */
  display: flex;
  flex-direction: column;
  align-items: center;
  /* Push the names toward the top and the countdown toward the bottom,
     leaving the middle of the video clear. */
  justify-content: space-between;
  text-align: center;
  /* Vertical padding keeps each group off the extreme edges (and away from the
     dead-center). Horizontal padding respects notched-phone safe areas. */
  padding: max(12vh, env(safe-area-inset-top))
           max(1.25rem, env(safe-area-inset-right))
           max(14vh, env(safe-area-inset-bottom))
           max(1.25rem, env(safe-area-inset-left));
}

.top,
.bottom {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(0.5rem, 2.5vw, 1.25rem);
}

.names {
  margin: 0;
  font-weight: 700;
  letter-spacing: 0.01em;
  font-size: clamp(2rem, 9vw, 5rem);
  line-height: 1.05;
  text-shadow: var(--shadow);
}

.tagline {
  margin: 0;
  font-size: clamp(1rem, 4vw, 1.6rem);
  font-weight: 400;
  opacity: 0.95;
  text-shadow: var(--shadow);
}

.countdown {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: clamp(0.5rem, 3vw, 1.5rem);
  margin-top: clamp(0.25rem, 2vw, 1rem);
}

.unit {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: clamp(3.25rem, 16vw, 5.5rem);
  padding: clamp(0.5rem, 2vw, 0.9rem) clamp(0.4rem, 2vw, 0.8rem);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.value {
  font-size: clamp(1.5rem, 7vw, 3rem);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  text-shadow: var(--shadow);
}

.label {
  margin-top: 0.35em;
  font-size: clamp(0.6rem, 2.4vw, 0.85rem);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  opacity: 0.85;
}

.celebrate {
  margin: 0;
  font-size: clamp(1.4rem, 6vw, 2.4rem);
  font-weight: 700;
  text-shadow: var(--shadow);
}

/* Floating music on/off toggle */
.sound-toggle {
  position: fixed;
  z-index: 2;
  bottom: max(1rem, env(safe-area-inset-bottom));
  right: max(1rem, env(safe-area-inset-right));
  display: flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 3rem;
  padding: 0;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  color: var(--ink);
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
  transition: transform 0.15s ease, background 0.15s ease;
}

.sound-toggle:hover { background: rgba(0, 0, 0, 0.55); }
.sound-toggle:active { transform: scale(0.92); }

.sound-icon { font-size: 1.4rem; line-height: 1; }

/* Pulsing ring to draw the eye to the button while music is paused */
.sound-toggle.attention {
  animation: sound-pulse 1.8s ease-out infinite;
}

@keyframes sound-pulse {
  0%   { box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4), 0 0 0 0 rgba(255, 255, 255, 0.55); }
  70%  { box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4), 0 0 0 14px rgba(255, 255, 255, 0); }
  100% { box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4), 0 0 0 0 rgba(255, 255, 255, 0); }
}

/* Nudge bubble above the speaker button */
.sound-hint {
  position: fixed;
  z-index: 3;
  right: max(1rem, env(safe-area-inset-right));
  bottom: calc(max(1rem, env(safe-area-inset-bottom)) + 3.75rem);
  max-width: 11rem;
  padding: 0.55rem 0.85rem;
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  color: var(--ink);
  font-size: 0.85rem;
  line-height: 1.25;
  text-align: center;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.45);
  animation: hint-pop 0.35s ease both, hint-bob 1.8s ease-in-out 0.35s infinite;
}

/* Little tail pointing down toward the button */
.sound-hint::after {
  content: "";
  position: absolute;
  right: 1.1rem;
  bottom: -5px;
  width: 11px;
  height: 11px;
  background: rgba(0, 0, 0, 0.62);
  transform: rotate(45deg);
}

@keyframes hint-pop {
  from { opacity: 0; transform: translateY(8px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes hint-bob {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-4px); }
}

/* Users who prefer reduced motion still see the poster/video; we just avoid any
   added motion effects. (No transitions are defined that need disabling here.) */
@media (prefers-reduced-motion: reduce) {
  .bg-video { /* leave looping video as-is; nothing extra to disable */ }
  .sound-toggle { transition: none; }
  .sound-toggle.attention { animation: none; }
  .sound-hint { animation: hint-pop 0.35s ease both; } /* fade in, but no bobbing */
}
