:root {
  --ab-bg-1: #f7f4ff;
  --ab-bg-2: #eaf8ff;
  --ab-card: rgba(255, 255, 255, 0.95);
  --ab-border: rgba(126, 109, 188, 0.14);
  --ab-text: #342d4e;
  --ab-soft-text: #6c648a;
  --ab-accent: #8d7cff;
  --ab-accent-2: #ff9fc7;
  --ab-good: #43c285;
  --ab-bad: #ff7084;
  --ab-gold: #ffcd58;
  --ab-shadow: 0 18px 40px rgba(79, 60, 130, 0.14);
  --ab-radius-xl: 28px;
  --ab-radius-lg: 20px;
  --ab-radius-md: 14px;
}

.game-board .game-board-inner {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  gap: 10px;
  align-items: stretch;
  justify-content: stretch;
  padding: 10px;
  overflow: hidden;
}

.ab-progress-wrap {
  width: 100%;
  padding: 0 2px;
  flex: 0 0 auto;
}

.ab-progress-bar {
  width: 100%;
  height: 14px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(141, 124, 255, 0.14);
}

.ab-progress-fill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--ab-accent), var(--ab-accent-2));
  transition: width 0.25s ease;
}

.ab-game-card {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  border-radius: var(--ab-radius-xl);
  background: var(--ab-card);
  border: 1px solid var(--ab-border);
  box-shadow: var(--ab-shadow);
  overflow: hidden;
}

.ab-prompt-wrap {
  text-align: center;
  display: grid;
  gap: 2px;
  padding-top: 4px;
  flex: 0 0 auto;
}

.ab-prompt-type {
  margin: 0;
  color: var(--ab-soft-text);
  font-size: 0.74rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  display: none;
}

.ab-prompt-text {
  margin: 0;
  font-size: clamp(1.15rem, 2.2vw, 1.6rem);
  line-height: 1.1;
  color: var(--ab-text);
}

.ab-playfield-wrap {
  min-width: 0;
  min-height: 0;
  display: flex;
  justify-content: center;
  align-items: stretch;
  overflow: hidden;
  flex: 1 1 auto;
}

.ab-playfield {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 320px;
  border-radius: 28px;
  overflow: hidden;
  background:
    radial-gradient(circle at 20% 20%, rgba(255, 255, 255, 0.85), transparent 16%),
    radial-gradient(circle at 80% 22%, rgba(255, 255, 255, 0.7), transparent 14%),
    radial-gradient(circle at 60% 75%, rgba(255, 255, 255, 0.65), transparent 16%),
    linear-gradient(180deg, #f7f1ff, #eef8ff);
  border: 2px solid rgba(141, 124, 255, 0.14);
}

.ab-bubble {
  position: absolute;
  border: 0;
  border-radius: 999px;
  min-width: 70px;
  min-height: 70px;
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font: inherit;
  font-size: clamp(1.35rem, 3vw, 2rem);
  font-weight: 900;
  color: var(--ab-text);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 10px 24px rgba(85, 66, 136, 0.14);
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.08s ease, box-shadow 0.16s ease, opacity 0.16s ease;
}

.ab-bubble:hover {
  transform: scale(1.04);
}

.ab-bubble.is-correct-hit {
  background: rgba(67, 194, 133, 0.18);
}

.ab-bubble.is-wrong-hit {
  background: rgba(255, 112, 132, 0.18);
}

.ab-bubble.is-popping {
  pointer-events: none;
  animation: abPop 220ms ease forwards;
}

.ab-action-btn,
.ab-mode-btn {
  border: 0;
  border-radius: 999px;
  padding: 12px 18px;
  font: inherit;
  font-weight: 900;
  cursor: pointer;
  transition: transform 0.16s ease, box-shadow 0.16s ease, opacity 0.16s ease;
}

.ab-action-btn {
  min-width: 150px;
  background: linear-gradient(135deg, var(--ab-accent), var(--ab-accent-2));
  color: white;
  box-shadow: 0 10px 20px rgba(141, 124, 255, 0.2);
}

.ab-mode-btn {
  background: #f3efff;
  color: var(--ab-text);
  box-shadow: 0 8px 16px rgba(91, 73, 147, 0.12);
}

.ab-mode-btn:hover,
.ab-action-btn:hover:not(:disabled) {
  transform: translateY(-2px);
}

.ab-action-btn:disabled,
.ab-mode-btn:disabled {
  opacity: 0.45;
  cursor: default;
  transform: none;
}

.ab-summary-card {
  width: 100%;
  padding: 24px;
  border-radius: var(--ab-radius-xl);
  text-align: center;
  background: var(--ab-card);
  border: 1px solid var(--ab-border);
  box-shadow: var(--ab-shadow);
  flex: 0 0 auto;
}

.ab-summary-card h3 {
  margin: 0 0 10px;
  font-size: 1.8rem;
  color: var(--ab-text);
}

.ab-summary-card p {
  margin: 0;
  color: var(--ab-soft-text);
  font-weight: 700;
}

.ab-summary-actions {
  display: flex;
  justify-content: center;
  margin-top: 14px;
}

.ab-fx-layer {
  pointer-events: none;
  position: fixed;
  inset: 0;
  overflow: hidden;
  z-index: 999;
}

.ab-float {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  font-size: clamp(1.4rem, 3vw, 2.2rem);
  font-weight: 1000;
  color: #8b2fd1;
  text-shadow:
    0 2px 12px rgba(255, 255, 255, 0.95),
    0 0 22px rgba(255, 255, 255, 0.8);
  animation: abFloatCenter 900ms ease forwards;
  z-index: 1001;
}

.ab-float.is-reward {
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  color: #ff9a00;
  text-shadow:
    0 2px 14px rgba(255,255,255,0.95),
    0 0 24px rgba(255,205,88,0.7);
}

.ab-burst {
  position: fixed;
  left: 50%;
  top: 50%;
  width: 14px;
  height: 14px;
  border-radius: 999px;
  background: var(--ab-gold);
  animation: abBurst 700ms ease forwards;
  opacity: 0.95;
}

.ab-shake {
  animation: abShake 250ms ease;
}

@keyframes abFloatCenter {
  0% {
    opacity: 0;
    transform: translate(-50%, -40%) scale(0.72);
  }
  12% {
    opacity: 1;
  }
  70% {
    opacity: 1;
    transform: translate(-50%, -54%) scale(1.12);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -68%) scale(1.2);
  }
}

@keyframes abBurst {
  0% {
    opacity: 0.95;
    transform: translate(0, 0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(var(--dx, 0), var(--dy, 0)) scale(0.3);
  }
}

@keyframes abPop {
  0% {
    opacity: 1;
    transform: scale(1);
  }
  100% {
    opacity: 0;
    transform: scale(1.18);
  }
}

@keyframes abShake {
  0% { transform: translateX(0); }
  20% { transform: translateX(-4px); }
  40% { transform: translateX(4px); }
  60% { transform: translateX(-3px); }
  80% { transform: translateX(3px); }
  100% { transform: translateX(0); }
}

@media (max-width: 980px) {
  .ab-game-card {
    padding: 10px;
    gap: 10px;
  }

  .ab-prompt-text {
    font-size: clamp(1.05rem, 3.4vw, 1.45rem);
  }

  .ab-playfield {
    min-height: 280px;
  }
}

@media (max-width: 640px) {
  .ab-playfield {
    min-height: 240px;
  }

  .ab-bubble {
    min-width: 58px;
    min-height: 58px;
    font-size: 1.2rem;
  }
}