:root {
  --pink: #ff5d8f;
  --purple: #9b7bff;
  --blue: #3fa9f5;
  --green: #5fd35f;
  --yellow: #ffd23d;
  --orange: #ff9f43;
  --ink: #3a2c5a;
  --panel: #fffdf7;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  height: 100%;
  font-family: "Baloo 2", "Comic Sans MS", "Segoe UI", system-ui, sans-serif;
  color: var(--ink);
  background: linear-gradient(160deg, #e6f3ff 0%, #fde9ff 50%, #e9fff2 100%);
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

body {
  display: flex;
  flex-direction: column;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
}

.topbar {
  position: relative;
  z-index: 10;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(6px);
  box-shadow: 0 2px 10px rgba(120, 80, 160, 0.15);
  flex-wrap: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
}

.topbar::-webkit-scrollbar {
  display: none;
}

.topbar > * {
  flex: 0 0 auto;
}

.site-logo {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  font-size: 0.95rem;
  font-weight: 900;
  text-decoration: none;
}

.site-logo-mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 2px solid var(--ink);
  border-radius: 9px;
  background: var(--green);
  color: #fff;
  box-shadow: 3px 3px 0 rgba(58, 44, 90, 0.28);
  font-size: 0.72rem;
  letter-spacing: 0;
}

.logo {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: 0.3px;
  max-width: min(38vw, 340px);
  overflow: hidden;
  background: linear-gradient(90deg, var(--pink), var(--purple), var(--blue));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  white-space: nowrap;
  pointer-events: none;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #fff;
  border-radius: 999px;
  padding: 4px 11px;
  font-weight: 700;
  font-size: 0.85rem;
  box-shadow: 0 2px 6px rgba(120, 80, 160, 0.18);
}

.chip b {
  color: var(--purple);
}

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  font-size: 1.15rem;
  background: #fff;
  box-shadow: 0 3px 8px rgba(120, 80, 160, 0.22);
  display: grid;
  place-items: center;
  transition: transform 0.1s;
}

.icon-btn:active {
  transform: scale(0.9);
}

.btn {
  border-radius: 999px;
  padding: 8px 16px;
  font-weight: 800;
  font-size: 0.95rem;
  color: #fff;
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.12);
  transition: transform 0.08s, box-shadow 0.08s;
}

.btn:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.12);
}

.btn.green {
  background: var(--green);
}

.btn.blue {
  background: var(--blue);
}

.btn.pink {
  background: var(--pink);
}

.btn.orange {
  background: var(--orange);
}

.topbar-spacer {
  flex: 1 1 auto;
  min-width: clamp(80px, 20vw, 200px);
}

.progress-wrap {
  position: relative;
  z-index: 3;
  flex: 0 0 auto;
  height: 10px;
  background: rgba(255, 255, 255, 0.6);
}

.progress-bar {
  height: 100%;
  width: 0%;
  border-radius: 0 999px 999px 0;
  background: linear-gradient(90deg, var(--green), var(--yellow));
  transition: width 0.35s ease;
}

.game-area {
  position: relative;
  z-index: 1;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.prompt {
  font-size: 2.5rem;
  font-weight: 800;
  margin: 0 0 8px;
  color: var(--ink);
  text-align: center;
  line-height: 1.2;
}

.prompt-target {
  font-size: 4rem;
  font-weight: 800;
  color: var(--pink);
  display: inline-block;
  animation: letterbounce 1s ease infinite alternate;
}

@keyframes letterbounce {
  to {
    transform: scale(1.15) translateY(-8px);
  }
}

.bubbles-container {
  position: relative;
  width: 100%;
  flex: 1 1 auto;
  min-height: 0;
}

.bubble {
  position: absolute;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 2.2rem;
  font-weight: 800;
  color: #fff;
  cursor: pointer;
  animation: floatUp linear forwards;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15), inset 0 -6px 12px rgba(0, 0, 0, 0.1);
  transition: transform 0.1s;
  touch-action: manipulation;
}

.bubble:active {
  transform: scale(0.92);
}

.bubble.popping {
  animation: popBubble 0.35s ease forwards;
}

.bubble.shaking {
  animation: shakeBubble 0.5s ease;
}

@keyframes floatUp {
  0% {
    transform: translateY(0);
    opacity: 0;
  }
  15% {
    opacity: 1;
  }
  85% {
    opacity: 1;
  }
  100% {
    transform: translateY(-120vh);
    opacity: 0;
  }
}

@keyframes popBubble {
  0% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.5);
    opacity: 0.6;
  }
  100% {
    transform: scale(0);
    opacity: 0;
  }
}

@keyframes shakeBubble {
  0%,
  100% {
    transform: translateX(0);
  }
  20% {
    transform: translateX(-12px);
  }
  40% {
    transform: translateX(12px);
  }
  60% {
    transform: translateX(-8px);
  }
  80% {
    transform: translateX(8px);
  }
}

.score-area {
  position: relative;
  z-index: 2;
  padding: 10px 0;
  text-align: center;
}

.score-area .btn {
  margin-top: 6px;
}

.wrong-flash {
  position: fixed;
  inset: 0;
  z-index: 9998;
  display: grid;
  place-items: center;
  pointer-events: none;
  opacity: 0;
}

.wrong-flash.show {
  animation: wrongflash 0.5s ease;
}

.wrong-flash span {
  font-size: 22vmin;
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.3));
}

@keyframes wrongflash {
  0% {
    opacity: 0;
    transform: scale(0.4);
  }
  30% {
    opacity: 1;
    transform: scale(1.1);
  }
  100% {
    opacity: 0;
    transform: scale(1.1);
  }
}

.overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(60, 44, 90, 0.55);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 12px;
}

.overlay.open {
  display: flex;
}

.modal {
  background: var(--panel);
  border-radius: 24px;
  padding: 24px;
  width: min(90vw, 480px);
  text-align: center;
  box-shadow: 0 20px 60px rgba(60, 44, 90, 0.4);
  animation: popin 0.25s ease;
}

@keyframes popin {
  from {
    transform: scale(0.85);
    opacity: 0;
  }
}

.modal .trophy {
  font-size: 4.6rem;
  animation: bounce 0.8s ease infinite alternate;
}

@keyframes bounce {
  to {
    transform: translateY(-14px);
  }
}

.modal h2 {
  margin: 0 0 4px;
  font-size: 1.8rem;
}

.modal-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 16px;
  flex-wrap: wrap;
}

#confetti {
  position: fixed;
  inset: 0;
  z-index: 95;
  pointer-events: none;
}

@media (max-width: 600px) {
  .prompt {
    font-size: 1.6rem;
  }
  .prompt-target {
    font-size: 2.8rem;
  }
  .bubble {
    font-size: 1.6rem;
  }
  .site-logo {
    font-size: 0.78rem;
  }
  .site-logo-mark {
    width: 28px;
    height: 28px;
    font-size: 0.6rem;
  }
}
