/* Patlat (balon): tap-to-pop bubble game. Only styles for this game. */

.balon-stage {
  display: flex; flex-direction: column; gap: 10px;
  padding: 4px 10px 14px;
}

/* ---------- candy-striped timer bar ---------- */
.balon-timer {
  position: relative; flex: none;
  height: clamp(30px, 4.6vh, 40px);
  margin: 2px 16px 0;
}
.balon-timer-track {
  position: absolute; inset: 0;
  background: var(--sky-pale);
  border: var(--outline); border-radius: 999px;
  box-shadow: 0 4px 0 var(--navy);
  overflow: hidden;
}
.balon-timer-fill {
  position: absolute; inset: 0;
  background: linear-gradient(-45deg, var(--red) 25%, var(--white) 25% 50%, var(--red) 50% 75%, var(--white) 75%) 0 0 / 34px 34px;
  animation: balon-stripes .9s linear infinite;
  clip-path: inset(0 0 0 0 round 999px);
}
.balon-timer-fill::after {
  /* glossy shine strip */
  content: ""; position: absolute; left: 6px; right: 6px; top: 3px; height: 28%;
  border-radius: 999px; background: rgba(255, 255, 255, .55);
}
@keyframes balon-stripes { to { background-position: 34px 0; } }
.balon-timer-candy {
  position: absolute; left: 0; top: 50%;
  width: 46px; height: 46px; margin: -23px 0 0 -23px;
  pointer-events: none;
  filter: drop-shadow(0 3px 0 rgba(42, 36, 102, .35));
  will-change: transform;
}
.balon-timer.low .balon-timer-track { animation: balon-low .5s ease-in-out infinite; }
@keyframes balon-low { 50% { transform: scale(1.04, 1.12); } }

/* ---------- play field ---------- */
.balon-field {
  position: relative; flex: 1; min-height: 0;
  border: var(--outline); border-radius: var(--r-lg);
  box-shadow: var(--sticker);
  overflow: hidden;
  background: linear-gradient(180deg, #B4E7FB 0%, var(--sky-pale) 62%, #F4FCFF 100%);
}
.balon-canvas {
  position: absolute; inset: 0; width: 100%; height: 100%;
  display: block; touch-action: none; cursor: pointer;
}
.balon-field::after {
  /* golden flash for the star bubble */
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(circle at 50% 50%, rgba(252, 230, 0, .55), rgba(252, 230, 0, 0) 70%);
  opacity: 0;
}
.balon-field.flash::after { animation: balon-flash .7s ease-out; }
@keyframes balon-flash { 0% { opacity: 0; } 15% { opacity: 1; } 100% { opacity: 0; } }

/* ---------- target banner (7+) ---------- */
.balon-target {
  position: absolute; top: 10px; left: 50%; z-index: 3;
  display: flex; align-items: center; gap: 8px;
  padding: 4px 8px 8px 16px;
  background: var(--yellow); color: var(--navy);
  border: var(--outline); border-radius: 999px;
  box-shadow: 0 5px 0 var(--navy);
  font-size: clamp(17px, 4.6vw, 22px); font-weight: 900; white-space: nowrap;
  pointer-events: none;
  transform: translate(-50%, -160%) scale(.6); opacity: 0;
  transition: transform .45s cubic-bezier(.2, 1.6, .4, 1), opacity .25s ease;
}
.balon-target.show { transform: translate(-50%, 0) scale(1); opacity: 1; }
.balon-target img { width: 46px; height: 46px; animation: balon-wiggle .8s ease-in-out infinite; }
.balon-target b {
  display: grid; place-items: center;
  min-width: 40px; height: 34px; padding: 0 6px;
  background: var(--red); color: var(--white);
  border: 3px solid var(--navy); border-radius: 999px;
  font-size: 18px; font-weight: 900;
  animation: balon-throb .6s ease-in-out infinite;
}
.balon-target i {
  position: absolute; left: 18px; right: 18px; bottom: 3px; height: 4px;
  border-radius: 4px; background: var(--navy);
  transform-origin: left center;
}
@keyframes balon-wiggle { 0%, 100% { transform: rotate(-12deg) scale(1); } 50% { transform: rotate(12deg) scale(1.12); } }
@keyframes balon-throb { 50% { transform: scale(1.15); } }

/* ---------- combo text ---------- */
.balon-combo {
  position: absolute; left: 50%; bottom: 12px; z-index: 3;
  pointer-events: none; white-space: nowrap;
  font-size: clamp(24px, 6.5vw, 40px); font-weight: 900; color: var(--white);
  text-shadow: 0 3px 0 var(--navy), 3px 0 0 var(--navy), -3px 0 0 var(--navy), 0 -3px 0 var(--navy), 2px 2px 0 var(--navy), -2px 2px 0 var(--navy);
  transform: translateX(-50%) scale(.4); opacity: 0;
  transition: opacity .25s ease, transform .25s ease;
}
.balon-combo.show { opacity: 1; transform: translateX(-50%) scale(1); }
.balon-combo.bump { animation: balon-combo-bump .35s cubic-bezier(.2, 1.8, .4, 1); }
.balon-combo.big { animation: balon-combo-big .6s cubic-bezier(.2, 1.8, .4, 1); }
.balon-combo em { font-style: normal; color: var(--yellow); }
@keyframes balon-combo-bump { 0% { transform: translateX(-50%) scale(1.35) rotate(-4deg); } 100% { transform: translateX(-50%) scale(1); } }
@keyframes balon-combo-big { 0% { transform: translateX(-50%) scale(1.9) rotate(6deg); } 60% { transform: translateX(-50%) scale(.9) rotate(-3deg); } 100% { transform: translateX(-50%) scale(1); } }

/* ---------- one-line instruction (7+) ---------- */
.balon-intro {
  position: absolute; left: 50%; top: 42%; z-index: 4;
  width: max-content; max-width: calc(100% - 32px);
  padding: 12px 20px;
  background: var(--white); border: var(--outline); border-radius: var(--r-md);
  box-shadow: var(--sticker);
  font-size: clamp(19px, 5vw, 26px); font-weight: 900; text-align: center; line-height: 1.2;
  pointer-events: none;
  transform: translate(-50%, -50%);
  animation: balon-intro-in .5s cubic-bezier(.2, 1.6, .4, 1) both;
  transition: opacity .35s ease, transform .35s ease;
}
.balon-intro.hide { opacity: 0; transform: translate(-50%, -80%) scale(.8); }
@keyframes balon-intro-in { from { transform: translate(-50%, -50%) scale(.4) rotate(-6deg); opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  .balon-timer-fill, .balon-target img, .balon-target b, .balon-timer.low .balon-timer-track { animation: none; }
  .balon-combo.bump, .balon-combo.big { animation-duration: .01s; }
}
