* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  height: 100%;
  background: #bfe6ff;
  color: #1a2b4a;
  font-family: "Segoe UI", system-ui, sans-serif;
  overflow: hidden;
}

#sky {
  position: fixed;
  inset: 0;
  z-index: 0;
  background: linear-gradient(180deg, #7fc7ff 0%, #bfe6ff 60%, #e8f7ff 100%);
}

.game {
  position: relative;
  z-index: 1;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

.hud {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 28px;
  background: rgba(255, 255, 255, 0.5);
  backdrop-filter: blur(4px);
  border-bottom: 1px solid rgba(26, 43, 74, 0.15);
  flex-wrap: wrap;
}

.hud h1 {
  font-size: 1.25rem;
  margin: 0;
  letter-spacing: 0.5px;
  color: #1a2b4a;
  white-space: nowrap;
}

.stats {
  display: flex;
  gap: 24px;
}

.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 50px;
}

.stat .label {
  font-size: 0.7rem;
  text-transform: uppercase;
  color: #4a6088;
  letter-spacing: 1px;
}

.stat span:last-child {
  font-size: 1.3rem;
  font-weight: 600;
  color: #1a2b4a;
}

.mic-status {
  font-size: 0.85rem;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.7);
  border: 2px solid rgba(26, 43, 74, 0.15);
  color: #4a6088;
  white-space: nowrap;
}

.mic-status.listening {
  border-color: #7fd858;
  color: #2f7a1f;
  animation: pulse 1.6s ease-in-out infinite;
}

.mic-status.error {
  border-color: #ff5b6e;
  color: #c8283b;
  animation: none;
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(127, 216, 88, 0.4); }
  50% { box-shadow: 0 0 0 6px rgba(127, 216, 88, 0); }
}

@media (max-width: 480px) {
  .hud {
    padding: 10px 14px;
  }

  .hud h1 {
    font-size: 0.95rem;
  }

  .stats {
    gap: 12px;
  }

  .stat {
    min-width: 38px;
  }

  .stat .label {
    font-size: 0.6rem;
  }

  .stat span:last-child {
    font-size: 1.05rem;
  }

  .mic-status {
    font-size: 0.7rem;
    padding: 4px 10px;
  }
}

.playfield {
  position: relative;
  flex: 1;
  overflow: hidden;
}

.playfield::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 50px;
  background: linear-gradient(180deg, #6fbf5f, #4a9e3d);
  border-top: 3px solid #3d8531;
}

.balloon {
  position: absolute;
  width: 84px;
  height: 100px;
  border-radius: 50% 50% 50% 50% / 62% 62% 38% 38%;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 6px;
  color: #fff;
  font-weight: 800;
  font-size: 2.1rem;
  line-height: 1;
  background: var(--balloon-color);
  box-shadow:
    inset -10px -10px 18px rgba(0, 0, 0, 0.15),
    inset 10px 10px 18px rgba(255, 255, 255, 0.3);
}

.balloon::before {
  content: "";
  position: absolute;
  bottom: -28px;
  left: 50%;
  width: 2px;
  height: 28px;
  background: rgba(60, 50, 40, 0.4);
  transform: translateX(-50%);
}

.balloon::after {
  content: "";
  position: absolute;
  bottom: -6px;
  left: 50%;
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 7px solid var(--balloon-color);
  transform: translateX(-50%);
}

.balloon.color-1 { --balloon-color: #ff5b6e; }
.balloon.color-2 { --balloon-color: #4d8dff; }
.balloon.color-3 { --balloon-color: #ffb23f; }
.balloon.color-4 { --balloon-color: #7fd858; }
.balloon.color-5 { --balloon-color: #b06fff; }
.balloon.color-6 { --balloon-color: #ff7fd0; }

.balloon.pop {
  animation: pop 0.22s ease forwards;
  pointer-events: none;
}

.balloon.crashed {
  animation: crash 0.2s ease forwards;
  pointer-events: none;
}

@keyframes pop {
  to { transform: scale(1.5); opacity: 0; }
}

@keyframes crash {
  to { transform: scale(0.75) translateY(8px); opacity: 0; }
}

.heard-readout {
  position: absolute;
  bottom: 62px;
  left: 50%;
  transform: translateX(-50%);
  min-width: 70px;
  padding: 8px 18px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.85);
  border: 2px solid rgba(26, 43, 74, 0.25);
  font-size: 1.3rem;
  font-weight: 700;
  text-align: center;
  text-transform: capitalize;
  color: #1a2b4a;
  min-height: 1.6em;
  transition: transform 0.1s ease;
}

.heard-readout.miss {
  border-color: #ff5b6e;
  color: #ff5b6e;
}

.heard-readout.shake {
  animation: shake 0.3s ease;
}

@keyframes shake {
  0%, 100% { transform: translateX(-50%); }
  25% { transform: translateX(calc(-50% - 8px)); }
  75% { transform: translateX(calc(-50% + 8px)); }
}

.overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  text-align: center;
  background: rgba(191, 230, 255, 0.9);
  padding: 20px;
}

.overlay.hidden {
  display: none;
}

.overlay h2 {
  font-size: 1.8rem;
  color: #1a2b4a;
  margin: 0;
}

.overlay p {
  color: #33456b;
  max-width: 360px;
}

.overlay button {
  padding: 10px 28px;
  font-size: 1rem;
  border-radius: 999px;
  border: none;
  background: linear-gradient(135deg, #4d8dff, #7fd858);
  color: white;
  cursor: pointer;
  font-weight: 600;
  transition: transform 0.15s ease;
}

.overlay button:hover {
  transform: scale(1.05);
}

.difficulty-select {
  display: flex;
  gap: 10px;
}

.difficulty-select .difficulty-btn {
  padding: 8px 18px;
  font-size: 0.9rem;
  border-radius: 12px;
  border: 2px solid rgba(26, 43, 74, 0.2);
  background: rgba(255, 255, 255, 0.6);
  color: #1a2b4a;
  cursor: pointer;
  font-weight: 600;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.difficulty-select .difficulty-btn:hover {
  transform: scale(1.05);
}

.difficulty-select .difficulty-btn.selected {
  border-color: #4d8dff;
  background: #fff;
  box-shadow: 0 0 0 2px rgba(77, 141, 255, 0.25);
}

.difficulty-desc {
  font-size: 0.7rem;
  font-weight: 400;
  color: #4a6088;
}

.support-note {
  font-size: 0.8rem;
  color: #c8283b;
  max-width: 320px;
}

.support-note.hidden {
  display: none;
}
