* {
  box-sizing: border-box;
}

body {
  margin: 0;
  direction: rtl;
  text-align: right;
  font-family: sans-serif;
  background: #1a1a1f;
  color: #fff;
}

main {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

video {
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  object-fit: contain;
  background: #1a1a1f;
}

/* ---- controls ---- */
#controls {
  position: fixed;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 15;
  display: flex;
  align-items: center;
  gap: 8px;
  direction: ltr;
  width: min(94vw, 520px);
  padding: 8px 12px;
  border-radius: 40px;
  background: rgba(38, 20, 60, 0.82);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.45), 0 0 24px rgba(255, 110, 180, 0.25);
  backdrop-filter: blur(6px);
  transition: opacity 0.35s ease;
}
#controls.hidden-bar {
  opacity: 0;
  pointer-events: none;
}
#controls button {
  flex: 0 0 auto;
  width: 48px;
  height: 48px;
  border: none;
  border-radius: 50%;
  font-size: 22px;
  line-height: 1;
  color: #fff;
  background: linear-gradient(160deg, #ff8fc2, #e0347e);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
#controls button:active {
  transform: scale(0.92);
}
#seek {
  flex: 1 1 auto;
  accent-color: #ff5fa8;
  height: 6px;
}
#timeLabel {
  flex: 0 0 auto;
  font-size: 13px;
  color: #ffd9ec;
  min-width: 38px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

/* ---- splash ---- */
#splash {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background:
    radial-gradient(circle at 30% 20%, rgba(137, 110, 192, 0.35), transparent 55%),
    radial-gradient(circle at 75% 75%, rgba(255, 110, 180, 0.28), transparent 50%),
    linear-gradient(180deg, #2b1445 0%, #1c0f33 55%, #2b1040 100%);
  transition: opacity 0.5s ease;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
#splash.hidden {
  opacity: 0;
  pointer-events: none;
}

#splashTitle {
  font-size: clamp(26px, 7vw, 44px);
  font-weight: bold;
  color: #ffd9ec;
  text-shadow: 0 3px 14px rgba(0, 0, 0, 0.6);
  margin-top: 8px;
}

#balloonWrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  animation: floaty 3s ease-in-out infinite;
}

@keyframes floaty {
  0%, 100% { transform: translateY(0) rotate(-1.5deg); }
  50% { transform: translateY(-18px) rotate(1.5deg); }
}

#balloon {
  position: relative;
  width: min(64vw, 320px);
  aspect-ratio: 0.88;
  border-radius: 50% 50% 48% 48% / 56% 56% 42% 42%;
  background:
    radial-gradient(circle at 32% 26%, rgba(255, 255, 255, 0.85), rgba(255, 255, 255, 0) 28%),
    linear-gradient(160deg, #ff9ac6 0%, #ff5fa8 55%, #e03a8c 100%);
  box-shadow:
    inset -14px -18px 34px rgba(160, 20, 90, 0.45),
    0 24px 60px rgba(0, 0, 0, 0.45),
    0 0 70px rgba(255, 110, 180, 0.35);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
}
#balloon::after {
  /* knot */
  content: '';
  position: absolute;
  bottom: -14px;
  left: 50%;
  transform: translateX(-50%);
  border-inline: 12px solid transparent;
  border-top: 16px solid #e03a8c;
}

#bear {
  font-size: clamp(64px, 18vw, 110px);
  line-height: 1;
  filter: drop-shadow(0 4px 8px rgba(120, 10, 60, 0.5));
}
#heart {
  position: absolute;
  top: 12%;
  inset-inline-end: 14%;
  font-size: clamp(28px, 8vw, 46px);
  animation: beat 1.2s ease-in-out infinite;
}
@keyframes beat {
  0%, 100% { transform: scale(1); }
  30% { transform: scale(1.25); }
}

#tapText {
  font-size: clamp(22px, 6vw, 34px);
  font-weight: bold;
  color: #fff;
  text-shadow: 0 2px 0 rgba(160, 20, 90, 0.9), 0 6px 16px rgba(0, 0, 0, 0.45);
}

#string {
  width: 40px;
  height: min(20vh, 160px);
  margin-top: 12px;
}

#splash.popping #balloonWrap {
  animation: none;
}
#splash.popping #balloon {
  animation: pop 0.38s ease-out forwards;
}
@keyframes pop {
  0% { transform: scale(1); opacity: 1; }
  55% { transform: scale(1.45); opacity: 1; }
  100% { transform: scale(1.9); opacity: 0; }
}
#splash.popping #string,
#splash.popping #splashTitle {
  transition: opacity 0.3s ease;
  opacity: 0;
}

#popfx {
  position: fixed;
  inset: 0;
  z-index: 30;
  pointer-events: none;
}
