*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #fff;
}

/* ── Stage ── */
#stage {
  position: relative;
  width: 100vw;
  height: 100vh;
  background: #000;
  cursor: pointer;
  transition: background 0.6s ease;
}

#frame {
  display: block;
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.6s ease;
}

/* Image visible only once playback is running */
#stage.is-playing #frame {
  opacity: 1;
}

/* Stopped state: fade image out, background goes white */
#stage.is-stopped #frame {
  opacity: 0;
}

#stage.is-stopped {
  background: #dddddd;
}

/* ── Loader overlay ── */
#loader-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
  z-index: 10;
}

#loader-squares {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
  max-width: 320px;
}

.sq {
  width: 20px;
  height: 20px;
  background: #333;
  transition: background 0.15s ease;
}

.sq.loaded {
  background: #fff;
}

/* ── Countdown overlay ── */
#countdown-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  z-index: 20;
  pointer-events: none;
}

#countdown-num {
  font-family: system-ui, -apple-system, sans-serif;
  font-size: clamp(80px, 20vw, 200px);
  font-weight: 900;
  color: #fff;
  text-shadow: 0 2px 20px rgba(0, 0, 0, 0.5);
  opacity: 0;
  transform: scale(1.4);
  transition: opacity 0.15s ease, transform 0.15s ease;
  user-select: none;
}

#countdown-num.show {
  opacity: 1;
  transform: scale(1);
}

/* Hidden utility */
.hidden {
  display: none !important;
}
