/* === Bubble Wrap additions === */

.bubble-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  max-width: 600px;
  margin: 0 auto 0.75rem;
}

.bubble-count {
  margin: 0;
  font-family: "Fredoka", "Nunito", sans-serif;
  font-weight: 500;
  color: var(--muted);
}

#sound-pill {
  gap: 0.4rem;
}

.sound-controls {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.volume-slider {
  width: 96px;
  accent-color: var(--primary);
  cursor: pointer;
}

.volume-slider:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Fixed 10-across grid — bigger, easy-to-pop bubbles within the page width. */
.sheet {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 8px;
  max-width: 600px;
  padding: 1rem;
  margin: 0 auto 1.25rem;
  background: #eef6fe;
  border: 2px solid #cfe3f5;
  border-radius: 22px;
  box-shadow: 0 14px 30px rgba(70, 130, 190, 0.18);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.bubble {
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  padding: 0;
  border: none;
  aspect-ratio: 1;
  border-radius: 50%;
  cursor: pointer;
  background:
    radial-gradient(circle at 32% 28%,
      #ffffff 0%,
      #eef7ff 22%,
      #cfe8fb 58%,
      #a6d2f1 100%);
  box-shadow:
    0 2px 5px rgba(70, 140, 200, 0.28),
    inset 0 3px 5px rgba(255, 255, 255, 0.8),
    inset 0 -4px 7px rgba(56, 120, 180, 0.25);
  transition: transform 0.12s ease;
}

@media (hover: hover) {
  .bubble:not(.popped):hover { transform: scale(1.06); }
}

.bubble:focus-visible {
  outline: none;
  box-shadow:
    0 0 0 3px #7fb8e6,
    inset 0 3px 5px rgba(255, 255, 255, 0.8);
}

.bubble.popped {
  cursor: default;
  background: radial-gradient(circle at 50% 42%,
    #bcd8ee 0%,
    #d8ecfb 78%);
  box-shadow: inset 0 2px 6px rgba(56, 120, 180, 0.4);
  animation: bubblePop 0.22s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}

/* Quick squish-down then a tiny overshoot back up for that springy give. */
@keyframes bubblePop {
  0%   { transform: scale(1); }
  35%  { transform: scale(0.68); }
  70%  { transform: scale(0.96); }
  100% { transform: scale(0.9); }
}

/* Expanding ring on pop — the "burst" of air escaping. */
.bubble.popped::after {
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: 50%;
  border: 2px solid rgba(120, 180, 230, 0.55);
  pointer-events: none;
  animation: popRing 0.4s ease-out forwards;
}

@keyframes popRing {
  0%   { opacity: 0.8; transform: scale(0.6); }
  100% { opacity: 0;   transform: scale(1.9); }
}

@media (prefers-reduced-motion: reduce) {
  .bubble.popped { animation: none; transform: scale(0.9); }
  .bubble.popped::after { display: none; }
  .confetti { display: none; }
}

.bubble.popped:focus-visible {
  outline: none;
  box-shadow:
    0 0 0 3px #7fb8e6,
    inset 0 2px 6px rgba(56, 120, 180, 0.4);
}

.bubble-actions {
  display: flex;
  gap: 0.6rem;
  max-width: 600px;
  margin: 0 auto;
}

#new-sheet {
  flex: 1;
  display: block;
}

#pop-all {
  flex: 1;
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

#pop-all:hover {
  background: #5eb5cd;
  border-color: #5eb5cd;
}

#pop-all:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.celebrate {
  max-width: 600px;
  margin: 0 auto 1rem;
  padding: 0.9rem 1rem;
  text-align: center;
  background: linear-gradient(135deg, #fff 0%, var(--pick-bg) 100%);
  border: 2px solid var(--pick-border);
  border-radius: 18px;
  box-shadow: var(--shadow);
  animation: cardPop 0.35s cubic-bezier(0.17, 0.89, 0.32, 1.275);
}

.celebrate-msg {
  margin: 0;
  font-family: "Fredoka", "Nunito", sans-serif;
  font-weight: 600;
  font-size: 1.2rem;
  color: var(--primary-dark);
}

.celebrate-time {
  margin: 0.2rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 600;
}

.confetti {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 50;
}

.confetti i {
  position: absolute;
  top: -14px;
  width: 9px;
  height: 14px;
  border-radius: 2px;
  opacity: 0;
  animation-name: confettiFall;
  animation-timing-function: ease-in;
  animation-fill-mode: forwards;
}

@keyframes confettiFall {
  0%   { opacity: 1; transform: translateY(-10px) translateX(0) rotate(0); }
  100% { opacity: 0; transform: translateY(105vh) translateX(var(--x)) rotate(var(--r)); }
}

/* Keep 20 across on small screens — just tighten spacing so it still fits. */
@media (max-width: 640px) {
  .sheet {
    gap: 4px;
    padding: 0.7rem;
  }
}
