.piano-container {
  padding: var(--spacing-md);
  background: #000000;
  border-top: 1px solid var(--color-cyber-green);
  min-height: 240px;
  overflow-x: auto; /* Remove overflow: visible, add overflow-x: auto for mobile scrolling */
}

.piano-container.hidden {
  display: none;
}

.piano-keyboard {
  /* Changed from flex to relative positioning with explicit width */
  position: relative;
  max-width: 1200px;
  margin: 0 auto;
  height: 200px;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  width: 750px;
  min-width: 750px;
}

.piano-key {
  position: absolute;
  cursor: pointer;
  transition: all 0.05s ease;
  border: 1px solid rgba(0, 0, 0, 0.2);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

/* White Keys */
.piano-key.white {
  width: 50px;
  height: 180px;
  background: linear-gradient(180deg, #ffffff 0%, #f0f0f0 100%);
  border-radius: 0 0 8px 8px;
  z-index: 1;
}

.piano-key.white:hover {
  background: linear-gradient(180deg, #f0f0f0 0%, #e0e0e0 100%);
}

.piano-key.white.active {
  background: linear-gradient(180deg, var(--color-cyber-green) 0%, #00cc33 100%);
  box-shadow: 0 0 30px rgba(0, 255, 65, 0.8), 0 4px 6px rgba(0, 0, 0, 0.3);
  transform: translateY(2px);
}

/* Black Keys */
.piano-key.black {
  width: 32px;
  height: 120px;
  background: linear-gradient(180deg, #1a1a1a 0%, #0a0a0a 100%);
  border-radius: 0 0 6px 6px;
  position: absolute;
  z-index: 2;
  margin-left: -16px;
}

.piano-key.black:hover {
  background: linear-gradient(180deg, #2a2a2a 0%, #1a1a1a 100%);
}

.piano-key.black.active {
  background: linear-gradient(180deg, var(--color-cyber-purple) 0%, #9900cc 100%);
  box-shadow: 0 0 30px rgba(191, 0, 255, 0.8), 0 4px 6px rgba(0, 0, 0, 0.3);
  transform: translateY(2px);
}

/* Key Labels */
.piano-key-label {
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.75rem;
  font-weight: 600;
  opacity: 0.6;
  pointer-events: none;
  user-select: none;
}

.piano-key.white .piano-key-label {
  color: #333;
}

.piano-key.black .piano-key-label {
  color: #fff;
  bottom: 8px;
}

.piano-key.active .piano-key-label {
  opacity: 1;
}

/* Mobile Optimizations */
@media (max-width: 768px) {
  .piano-keyboard {
    height: 150px;
    overflow-x: auto;
    justify-content: flex-start;
    padding: 0 var(--spacing-sm);
  }

  .piano-key.white {
    width: 40px;
    height: 140px;
    min-width: 40px;
  }

  .piano-key.black {
    width: 26px;
    height: 90px;
    margin-left: -13px;
  }

  .piano-key-label {
    font-size: 0.625rem;
    bottom: 8px;
  }

  .piano-key.black .piano-key-label {
    bottom: 6px;
  }
}

@media (max-width: 480px) {
  .piano-keyboard {
    height: 120px;
  }

  .piano-key.white {
    width: 32px;
    height: 110px;
    min-width: 32px;
  }

  .piano-key.black {
    width: 22px;
    height: 70px;
    margin-left: -11px;
  }

  .piano-key-label {
    font-size: 0.5rem;
    bottom: 6px;
  }
}

/* Touch feedback for mobile */
@media (hover: none) and (pointer: coarse) {
  .piano-key:active {
    transform: translateY(2px);
  }
}
