:root {
  --game-bg: linear-gradient(180deg, #b3e5fc 0%, #c8e6c9 48%, #a5d6a7 78%, #66bb6a 100%);
  --game-accent: #1b5e20;
}

.echo-field {
  position: relative;
  width: 100%;
  height: 100%;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px 14px;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  background: linear-gradient(180deg, #81d4fa 0%, #c8e6c9 46%, #81c784 82%, #4caf50 100%);
}

/* --- Top HUD: Choir Roster & Turn Banner -------------------------------- */

.top-hud {
  width: 100%;
  max-width: 720px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 20;
}

.choir-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  width: 100%;
}

.choir-member {
  position: relative;
  background: rgba(255, 255, 255, 0.88);
  border: 3px solid rgba(255, 255, 255, 0.95);
  border-radius: 20px;
  padding: 7px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.2s ease, border-color 0.2s ease;
}

.choir-member:active {
  transform: scale(0.95);
}

.choir-member.active {
  background: #ffffff;
  border-color: #ff8f00;
  box-shadow: 0 6px 16px rgba(255, 143, 0, 0.35);
  transform: translateY(-2px) scale(1.03);
}

.choir-member.concert-dance {
  animation: member-bounce 0.45s ease-in-out infinite alternate;
}

@keyframes member-bounce {
  from { transform: translateY(0) scale(1); }
  to { transform: translateY(-6px) scale(1.06); }
}

.member-emoji {
  font-size: 2rem;
  line-height: 1;
}

.member-name {
  font-size: 0.78rem;
  font-weight: 800;
  color: #1e3a4c;
  text-align: center;
  line-height: 1.15;
}

.member-star {
  position: absolute;
  top: -6px;
  right: -4px;
  font-size: 1.1rem;
  line-height: 1;
  opacity: 0;
  transform: scale(0.4);
  transition: opacity 0.25s ease, transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.choir-member.done .member-star {
  opacity: 1;
  transform: scale(1);
}

.turn-banner {
  background: rgba(255, 255, 255, 0.94);
  border: 2px solid #a5d6a7;
  border-radius: 20px;
  padding: 8px 16px;
  text-align: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  transition: border-color 0.25s ease, background 0.25s ease;
}

.turn-banner.your-turn {
  background: #fff8e1;
  border-color: #ffb300;
}

.turn-banner.concert-mode {
  background: #fce4ec;
  border-color: #ec407a;
}

.turn-status {
  font-size: 1rem;
  font-weight: 800;
  color: #1e3a4c;
}

/* --- Center Forest Choir Stage ------------------------------------------ */

.echo-stage {
  position: relative;
  width: 100%;
  max-width: 720px;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-around;
  padding: 6px 0;
  z-index: 10;
}

.soloist-box {
  display: flex;
  justify-content: center;
  width: 100%;
}

.soloist-btn {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  background: rgba(255, 255, 255, 0.94);
  border: 4px solid #ffffff;
  border-radius: 32px;
  padding: 10px 22px;
  cursor: pointer;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.14);
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s ease;
}

.soloist-btn:active {
  transform: scale(0.95);
}

.soloist-btn.soloist-singing {
  border-color: #ffca28;
  box-shadow: 0 0 24px rgba(255, 193, 7, 0.7);
  animation: soloist-pulse 0.42s ease-in-out infinite alternate;
}

@keyframes soloist-pulse {
  from { transform: scale(1); }
  to { transform: scale(1.06); }
}

.soloist-emoji {
  font-size: 3.6rem;
  line-height: 1;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.16));
}

.soloist-bubble {
  display: flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, #fffde7 0%, #fff59d 100%);
  border: 2px solid #fbc02d;
  border-radius: 22px;
  padding: 8px 16px;
}

.bubble-note {
  font-size: 1.5rem;
  line-height: 1;
}

.soloist-phrase {
  font-size: 1.45rem;
  font-weight: 900;
  color: #d84315;
  letter-spacing: 0.02em;
}

/* --- Pitch-Staggered Note Pads ------------------------------------------ */

.echo-pads-box {
  width: 100%;
  min-height: 132px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 8px 6px;
}

.echo-pad {
  position: relative;
  min-width: 96px;
  min-height: 92px;
  border-radius: 26px;
  border: 4px solid #ffffff;
  padding: 10px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: #ffffff;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.18);
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s ease, filter 0.2s ease;
  touch-action: manipulation;
}

/* Visual pitch height offset */
.echo-pad.pitch-high {
  transform: translateY(-16px);
  background: linear-gradient(135deg, #29b6f6 0%, #0288d1 100%);
}

.echo-pad.pitch-mid {
  transform: translateY(0);
  background: linear-gradient(135deg, #66bb6a 0%, #2e7d32 100%);
}

.echo-pad.pitch-low {
  transform: translateY(16px);
  background: linear-gradient(135deg, #ffa726 0%, #ef6c00 100%);
}

.echo-pad.pad-target {
  border-color: #ffee58;
  box-shadow: 0 0 24px rgba(255, 238, 88, 0.95), 0 8px 18px rgba(0, 0, 0, 0.2);
}

.echo-pad.pad-lit {
  filter: brightness(1.18);
  border-color: #ffffff;
  box-shadow: 0 0 28px rgba(255, 255, 255, 0.95);
}

.echo-pad.pitch-high.pad-lit {
  transform: translateY(-22px) scale(1.12);
}

.echo-pad.pitch-mid.pad-lit {
  transform: translateY(-6px) scale(1.12);
}

.echo-pad.pitch-low.pad-lit {
  transform: translateY(10px) scale(1.12);
}

.echo-pad.pad-sung {
  border-color: #a5d6a7;
}

.pad-note-icon {
  font-size: 1.5rem;
  line-height: 1;
}

.pad-syllable {
  font-size: 1.35rem;
  font-weight: 900;
  line-height: 1.1;
}

.pad-check {
  position: absolute;
  top: -8px;
  right: -8px;
  font-size: 1.15rem;
  line-height: 1;
  opacity: 0;
  transform: scale(0.4);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.echo-pad.pad-sung .pad-check {
  opacity: 1;
  transform: scale(1);
}

/* --- Particles Layer ---------------------------------------------------- */

.particles-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 25;
}

.echo-particle {
  position: absolute;
  font-size: 1.65rem;
  line-height: 1;
  pointer-events: none;
  animation: echo-spark 0.85s ease-out forwards;
}

@keyframes echo-spark {
  0% {
    transform: translate(-50%, -50%) scale(0.5);
    opacity: 1;
  }
  100% {
    transform: translate(calc(-50% + var(--tx, 0px)), calc(-50% + var(--ty, -44px))) scale(1.25);
    opacity: 0;
  }
}

/* --- Bottom Controls ---------------------------------------------------- */

.echo-controls {
  width: 100%;
  max-width: 720px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  z-index: 20;
}

.echo-ctrl-btn {
  border: none;
  border-radius: 30px;
  padding: 12px 20px;
  font-size: 1.05rem;
  font-weight: 800;
  color: #ffffff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.18);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  touch-action: manipulation;
}

.echo-ctrl-btn:active {
  transform: scale(0.95);
}

.mic-btn {
  background: linear-gradient(135deg, #546e7a 0%, #37474f 100%);
  border: 2px solid #b0bec5;
}

.mic-btn[aria-pressed="true"] {
  background: linear-gradient(135deg, #00897b 0%, #00695c 100%);
  border-color: #80cbc4;
}

.listen-btn {
  background: linear-gradient(135deg, #0288d1 0%, #01579b 100%);
  border: 2px solid #81d4fa;
}

.echo-sing-btn {
  flex: 1 1 190px;
  max-width: 280px;
  min-height: 54px;
  font-size: 1.18rem;
  background: linear-gradient(135deg, #ec407a 0%, #c2185b 100%);
  border: 3px solid #f8bbd0;
  box-shadow: 0 8px 20px rgba(194, 24, 91, 0.35);
}

/* --- Responsive Adjustments --------------------------------------------- */

@media (max-width: 520px) {
  .echo-field {
    padding: 6px 8px 10px;
  }

  .choir-row {
    gap: 5px;
  }

  .choir-member {
    padding: 5px 4px;
    border-radius: 16px;
  }

  .member-emoji {
    font-size: 1.65rem;
  }

  .member-name {
    font-size: 0.68rem;
  }

  .turn-banner {
    padding: 6px 10px;
  }

  .turn-status {
    font-size: 0.88rem;
  }

  .soloist-btn {
    padding: 8px 14px;
    gap: 10px;
  }

  .soloist-emoji {
    font-size: 2.8rem;
  }

  .soloist-phrase {
    font-size: 1.2rem;
  }

  .echo-pads-box {
    gap: 10px;
    min-height: 112px;
  }

  .echo-pad {
    min-width: 80px;
    min-height: 78px;
    padding: 8px 12px;
    border-radius: 20px;
  }

  .pad-syllable {
    font-size: 1.15rem;
  }

  .echo-ctrl-btn {
    padding: 10px 14px;
    font-size: 0.94rem;
  }

  .echo-sing-btn {
    min-height: 48px;
    font-size: 1.05rem;
  }
}

@media (max-height: 620px) {
  .soloist-emoji {
    font-size: 2.5rem;
  }

  .echo-pads-box {
    min-height: 98px;
  }

  .echo-pad {
    min-height: 70px;
  }
}
