.piano-player {
  position: sticky;
  bottom: 0;
  z-index: 100;
  background: #1a1a2e;
  border-radius: 12px 12px 0 0;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
  overflow: hidden;
  margin-top: 20px;
}

/* ---- Toolbar ---- */

.piano-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  background: #16213e;
  flex-wrap: nowrap;
  min-height: 44px;
}

.piano-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: #e94560;
  color: #fff;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s;
  flex-shrink: 0;
}
.piano-btn:hover {
  background: #ff6b81;
}
.piano-btn:active {
  transform: scale(0.9);
}
.piano-btn-play--active {
  background: #e94560;
  font-size: 11px;
  letter-spacing: 2px;
}
.piano-btn-keyboard {
  background: rgba(255, 255, 255, 0.1);
  font-size: 12px;
  color: #fff;
}
.piano-btn-keyboard:hover {
  background: rgba(255, 255, 255, 0.2);
}

.piano-time {
  font-family: "Metropolis-Bold", monospace;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.7);
  white-space: nowrap;
  flex-shrink: 0;
  min-width: 80px;
}
.piano-time-current {
  color: #fff;
  font-weight: 700;
}

.piano-progress-wrap {
  flex: 1;
  height: 6px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 3px;
  cursor: pointer;
  min-width: 60px;
  position: relative;
}
.piano-progress-bar {
  height: 100%;
  background: #e94560;
  border-radius: 3px;
  width: 0;
  transition: width 0.1s linear;
}
.piano-progress-wrap:hover .piano-progress-bar {
  background: #ff6b81;
}

.piano-btn-sound {
  background: rgba(255, 255, 255, 0.1);
  font-size: 16px;
}
.piano-btn-sound:hover {
  background: rgba(255, 255, 255, 0.2);
}
.piano-btn-sound--muted {
  opacity: 0.5;
}

.piano-volume-slider {
  width: 60px;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
  flex-shrink: 0;
}
.piano-volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #e94560;
  cursor: pointer;
}
.piano-volume-slider::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #e94560;
  cursor: pointer;
  border: none;
}

.piano-bpm-group {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
.piano-bpm-input {
  width: 52px;
  padding: 4px 6px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  text-align: center;
  -moz-appearance: textfield;
}
.piano-bpm-input::-webkit-outer-spin-button,
.piano-bpm-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.piano-bpm-input:focus {
  outline: none;
  border-color: #e94560;
}
.piano-bpm-label {
  font-size: 11px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.5);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ---- Keyboard ---- */

.piano-keyboard-container {
  position: relative;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
}

.piano-keys {
  position: relative;
  display: flex;
  height: 130px;
  min-width: 100%;
  user-select: none;
}
@media (max-width: 768px) {
  .piano-keys {
    height: 100px;
  }
}

.piano-key {
  position: relative;
  box-sizing: border-box;
  transition: background 0.08s ease;
}

.piano-key--white {
  flex: 1;
  background: linear-gradient(to bottom, #f8f8f8 0%, #fff 10%, #fff 90%, #e8e8e8 100%);
  border-right: 1px solid #c0c0c0;
  border-bottom: 3px solid #999;
  z-index: 1;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 6px;
}
.piano-key--white:first-child {
  border-radius: 0 0 0 4px;
}
.piano-key--white:last-child {
  border-right: none;
  border-radius: 0 0 4px 0;
}

.piano-key--black {
  position: absolute;
  top: 0;
  height: 60%;
  background: linear-gradient(to bottom, #2a2a2a 0%, #1a1a1a 80%, #111 100%);
  border-radius: 0 0 4px 4px;
  border-bottom: 3px solid #000;
  z-index: 2;
}

.piano-key-label {
  font-size: 9px;
  color: #999;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
}
.piano-key--white:hover .piano-key-label {
  opacity: 1;
}

/* Active (playing) state */
.piano-key--white.piano-key--active {
  background: linear-gradient(to bottom, #ff9f43 0%, #e94560 100%);
  border-bottom-color: #c0392b;
}
.piano-key--white.piano-key--active .piano-key-label {
  opacity: 1;
  color: #fff;
}

.piano-key--black.piano-key--active {
  background: linear-gradient(to bottom, #e94560 0%, #c0392b 100%);
  border-bottom-color: #922b21;
}

/* ---- OSMD Cursor overlay ---- */

.music-xml-render img[id^="cursorImg"] {
  display: none !important;
}

.piano-cursor-overlay {
  position: absolute;
  width: 6px;
  height: 80px;
  background: rgba(233, 69, 96, 0.6);
  border-radius: 3px;
  z-index: 10;
  pointer-events: none;
  display: none;
  transition: left 0.08s linear, top 0.08s linear;
  box-shadow: 0 0 8px rgba(233, 69, 96, 0.4);
}

@media print {
  .piano-player {
    display: none !important;
  }
}
