.bubble-board {
  display: flex;
  flex-wrap: wrap;
  padding: 5px;
  border: 1px solid #394862;
  border-radius: 18px;
  background: #121e31;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}

.bubble {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 12.5%;
  height: 76px;
  padding: 0;
  border: 0;
  border-radius: 12px;
  background: transparent;
  -webkit-tap-highlight-color: transparent;
}

.bubble:focus { outline-offset: -3px; }
.bubble:nth-child(5n + 1) { color: #fa91b9; }
.bubble:nth-child(5n + 2) { color: #b8a5ff; }
.bubble:nth-child(5n + 3) { color: #7fcfff; }
.bubble:nth-child(5n + 4) { color: #79e2bf; }
.bubble:nth-child(5n) { color: #ffd58b; }

.bubble-face {
  width: 76%;
  max-width: 58px;
  border-radius: 50%;
  background: radial-gradient(circle at 32% 27%, #fff 0%, currentColor 38%, #344b78 145%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.3);
  pointer-events: none;
}
.bubble-face::before { display: block; padding-top: 100%; content: ""; }

.bubble[aria-disabled="true"] { cursor: default; }
.bubble[aria-disabled="true"] .bubble-face {
  background: transparent;
  box-shadow: inset 0 0 0 1px #334562;
}
.bubble[aria-disabled="true"]::after {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 38px;
  height: 38px;
  border: 3px solid currentColor;
  border-radius: 50%;
  content: "";
  opacity: 0;
  animation: bubble-pop 330ms ease-out;
  pointer-events: none;
}

@keyframes bubble-pop {
  from { transform: translate(-50%, -50%) scale(0.65); opacity: 1; }
  to { transform: translate(-50%, -50%) scale(1.65); opacity: 0; }
}

.bubble-smoke {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 76px;
  height: 76px;
  z-index: 1;
  background:
    radial-gradient(ellipse at 28% 58%, currentColor, transparent 36%),
    radial-gradient(ellipse at 52% 34%, currentColor, transparent 39%),
    radial-gradient(ellipse at 72% 61%, currentColor, transparent 38%);
  opacity: 0;
  pointer-events: none;
  animation: bubble-smoke-drift 1.5s ease-out both;
}
@keyframes bubble-smoke-drift {
  0% { transform: translate(-50%, -45%) scale(0.3); opacity: 0.75; }
  32% { opacity: 0.65; }
  68% { opacity: 0.35; }
  100% { transform: translate(-50%, -85%) scale(1.55); opacity: 0; }
}

@media (max-width: 759px), (orientation: portrait) {
  .bubble { width: 16.6666%; height: 56px; }
}

@supports (display: grid) {
  .bubble-board {
    display: grid;
    grid-template-columns: repeat(8, minmax(0, 1fr));
    grid-template-rows: repeat(6, minmax(44px, 1fr));
  }
  .bubble { width: 100%; height: auto; }

  @media (max-width: 759px), (orientation: portrait) {
    .bubble-board {
      grid-template-columns: repeat(6, minmax(0, 1fr));
      grid-template-rows: repeat(8, minmax(44px, 1fr));
    }
  }
}

@supports (width: 1cqi) {
  .bubble { container-type: size; }
  .bubble-face { width: min(76cqi, 80cqb, 112px); max-width: none; }
  .bubble[aria-disabled="true"]::after {
    width: min(68cqi, 72cqb, 100px);
    height: min(68cqi, 72cqb, 100px);
  }
  .bubble-smoke { width: min(76cqi, 80cqb, 112px); height: min(76cqi, 80cqb, 112px); }
}

@media (prefers-reduced-motion: reduce) {
  .bubble[aria-disabled="true"]::after { animation: none; }
  .bubble-smoke { animation: none; transform: translate(-50%, -50%); opacity: 0.45; }
}
