:root {
  --game-bg: linear-gradient(180deg, #ede7f6 0%, #d1c4e9 45%, #b39ddb 100%);
}

.drum-field {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-evenly;
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 8px 16px 12px;
  background: var(--game-bg);
  box-sizing: border-box;
}

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

.instruments-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: clamp(10px, 2.5vw, 18px);
  width: 100%;
  max-width: 520px;
  z-index: 10;
}

.inst-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: clamp(96px, 26vw, 140px);
  height: clamp(118px, 30vw, 148px);
  border-radius: 28px;
  border: 3.5px solid #ffffff;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 8px 22px rgba(74, 20, 140, 0.12);
  cursor: pointer;
  touch-action: none;
  transition: transform 0.1s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.1s ease, border-color 0.1s ease, background 0.1s ease;
  user-select: none;
  -webkit-user-select: none;
  padding: 6px;
  position: relative;
}

.inst-btn:hover {
  transform: scale(1.04);
}

.inst-btn:focus-visible {
  outline: 4px solid #f59e0b;
  outline-offset: 3px;
}

.inst-musician {
  display: block;
  font-size: clamp(26px, 6.5vw, 36px);
  line-height: 1;
  margin-bottom: 3px;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.12));
  transition: transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: none;
}

.inst-icon {
  display: block;
  font-size: clamp(38px, 9.5vw, 50px);
  line-height: 1;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.1));
  transition: transform 0.12s ease;
  pointer-events: none;
}

.inst-name {
  display: block;
  font-size: clamp(13px, 3.2vw, 16px);
  font-weight: 800;
  color: #4a148c;
  margin-top: 5px;
  white-space: nowrap;
  pointer-events: none;
}

.inst-hit {
  transform: scale(0.91) !important;
  background: #fdf4ff !important;
  border-color: #d946ef !important;
  box-shadow: 0 2px 8px rgba(217, 70, 239, 0.3) !important;
}

.inst-hit .inst-musician {
  transform: translateY(-8px) scale(1.22);
}

.inst-hit .inst-icon {
  transform: scale(1.18);
}

/* Celebration band bounce when milestone round is reached */
.inst-celebrate {
  animation: band-bounce 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) infinite alternate;
  border-color: #f59e0b !important;
}

.inst-celebrate .inst-musician {
  transform: translateY(-10px) scale(1.25);
}

@keyframes band-bounce {
  0% { transform: translateY(0) scale(1); }
  100% { transform: translateY(-8px) scale(1.06); }
}

/* Floating musical notes */
.note-particle {
  position: absolute;
  pointer-events: none;
  font-size: 26px;
  line-height: 1;
  z-index: 50;
  animation: note-rise 0.75s ease-out forwards;
}

@keyframes note-rise {
  0% { transform: translate(-50%, -50%) scale(0.6); opacity: 1; }
  100% { transform: translate(calc(-50% + var(--ndx, 0px)), calc(-50% + var(--ndy, -50px))) scale(1.2); opacity: 0; }
}

/* Floating sound word bubble */
.sound-bubble {
  position: absolute;
  pointer-events: none;
  font-size: 14px;
  font-weight: 800;
  color: #4a148c;
  background: rgba(255, 255, 255, 0.95);
  padding: 3px 10px;
  border-radius: 12px;
  box-shadow: 0 4px 10px rgba(74, 20, 140, 0.16);
  border: 1.5px solid #d946ef;
  z-index: 55;
  animation: sound-bubble-rise 0.7s cubic-bezier(0.25, 1, 0.5, 1) forwards;
  white-space: nowrap;
}

@keyframes sound-bubble-rise {
  0% { transform: translate(-50%, 0) scale(0.6); opacity: 0; }
  25% { transform: translate(-50%, -12px) scale(1.05); opacity: 1; }
  100% { transform: translate(-50%, -36px) scale(1); opacity: 0; }
}

/* Confetti shower on round victory */
.confetti-piece {
  position: absolute;
  width: 10px;
  height: 14px;
  border-radius: 3px;
  pointer-events: none;
  animation: confetti-drop linear forwards;
  z-index: 45;
}

@keyframes confetti-drop {
  0% { transform: translate(0, 0) rotate(0deg); opacity: 1; }
  100% { transform: translate(var(--cx, 0), var(--cy, 480px)) rotate(var(--crot, 720deg)); opacity: 0; }
}

/* Controls */
.drum-controls {
  position: relative;
  display: flex;
  justify-content: center;
  width: 100%;
  margin-top: 6px;
  z-index: 20;
  flex-shrink: 0;
}

.rhythm-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, #a855f7 0%, #7e22ce 100%);
  color: #ffffff;
  font-size: 17px;
  font-weight: 700;
  padding: 10px 26px;
  border-radius: 30px;
  border: none;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(126, 34, 206, 0.35);
  transition: transform 0.12s ease, background 0.2s ease, box-shadow 0.2s ease;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

.rhythm-active {
  background: linear-gradient(135deg, #ec4899 0%, #be185d 100%);
  box-shadow: 0 0 20px rgba(236, 72, 153, 0.55);
  animation: rhythm-pulse 1.2s ease-in-out infinite alternate;
}

@keyframes rhythm-pulse {
  0% { transform: scale(1); }
  100% { transform: scale(1.05); }
}

.rhythm-btn:hover {
  transform: translateY(-2px) scale(1.03);
}

.rhythm-btn:focus-visible {
  outline: 3px solid #f59e0b;
  outline-offset: 3px;
}

.rhythm-icon {
  font-size: 20px;
  line-height: 1;
}

/* Landscape & compact screen adaptation */
@media (max-height: 520px) {
  .drum-field {
    padding: 4px 12px 6px;
    justify-content: center;
    gap: 4px;
  }
  .instruments-grid {
    max-width: 720px;
    gap: 8px;
  }
  .inst-btn {
    width: clamp(74px, 14vw, 112px);
    height: clamp(82px, 24vh, 108px);
    border-radius: 18px;
    padding: 4px;
  }
  .inst-musician {
    font-size: clamp(18px, 5vh, 26px);
    margin-bottom: 2px;
  }
  .inst-icon {
    font-size: clamp(24px, 6vh, 34px);
  }
  .inst-name {
    font-size: 11px;
    margin-top: 2px;
  }
  .drum-controls {
    margin-top: 4px;
  }
  .rhythm-btn {
    padding: 6px 18px;
    font-size: 14px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .inst-hit,
  .inst-hit .inst-musician,
  .inst-hit .inst-icon,
  .inst-celebrate,
  .inst-celebrate .inst-musician {
    transform: none !important;
    animation: none !important;
  }
  .rhythm-active {
    animation: none;
  }
  .note-particle,
  .sound-bubble,
  .confetti-piece {
    animation: none !important;
    display: none !important;
  }
}
