.piano-character {
  width: 120px;
  height: auto;
  filter: drop-shadow(0 10px 25px rgba(0, 0, 0, 0.2));
}

.piano-info {
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.05);
  border-radius: 12px;
  padding: 1rem 1.25rem;
  color: #1f2430;
}

.piano-panel {
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 18px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
}

.piano-panel .card-body {
  padding: 1rem 1rem 1.25rem;
}

.interval-cta {
  max-width: 640px;
  white-space: normal;
}

.btn-interval-cta {
  background-color: rgba(240, 77, 55, 0.1);
  border: 2px solid rgba(240, 77, 55, 0.45);
  color: var(--theme-darker, #2b2f3a);
  font-weight: 600;
  padding: 0.75rem 2rem;
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.btn-interval-cta:hover {
  background-color: var(--theme-special, #f04d37);
  border-color: var(--theme-special, #f04d37);
  color: var(--theme-lightest, #fff);
  box-shadow: 0 12px 28px rgba(240, 77, 55, 0.22);
}

.piano-keyboard {
  position: relative;
  padding: 0.35rem 0.25rem 0.9rem;
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.85), rgba(255, 255, 255, 0.9));
  color: #1f2430;
  overflow-x: hidden;
}

.piano-keyboard {
  max-width: 960px;
  margin-inline: auto;
}

.piano-octave {
  position: relative;
  margin: 0.85rem 0;
  padding: 0.9rem 0.9rem 1.4rem;
  border-radius: 16px;
  border: 1px solid rgba(0, 0, 0, 0.05);
  background: linear-gradient(180deg, #fdfefe 0%, #f3f7fb 100%);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.06);
  --white-key-count: 1;
  --white-gap: 3px;
}

.octave-header {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #2c3444;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.octave-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: radial-gradient(circle, #ffd29f 30%, #ff9b7b 80%);
  box-shadow: 0 0 18px rgba(255, 155, 123, 0.7);
}

.piano-key {
  position: relative;
  border: none;
  border-radius: 0 0 9px 9px;
  cursor: pointer;
  font-weight: 700;
  transition: transform 0.08s ease, box-shadow 0.12s ease, filter 0.12s ease;
  user-select: none;
}

.piano-key:focus-visible {
  outline: 2px solid #8bd5ff;
  outline-offset: 2px;
}

.piano-key.white {
  width: 100%;
  height: 210px;
  background: linear-gradient(180deg, #f7f9fb 0%, #e4e9f1 90%);
  box-shadow: inset 0 -6px 0 rgba(0, 0, 0, 0.08), 0 12px 30px rgba(0, 0, 0, 0.2);
  color: #55607a;
  display: inline-flex;
  justify-content: center;
  align-items: flex-end;
  padding-bottom: 12px;
  flex: 1 1 0;
}

.piano-key.black {
  position: absolute;
  width: calc((100% / var(--white-key-count)) * 0.7);
  height: 150px;
  left: calc(((var(--white-step) + 0.68) / var(--white-key-count)) * 100%);
  background: linear-gradient(180deg, #11182a 0%, #0c1224 50%, #030712 100%);
  color: #e8eeff;
  box-shadow: inset 0 -4px 0 rgba(255, 255, 255, 0.05), 0 12px 24px rgba(0, 0, 0, 0.35);
  z-index: 2;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  padding-bottom: 10px;
  border-radius: 0 0 8px 8px;
}

.piano-key.playing {
  transform: translateY(2px) scale(0.995);
  box-shadow: 0 12px 30px rgba(255, 198, 109, 0.3), inset 0 -6px 0 rgba(255, 255, 255, 0.08);
  filter: drop-shadow(0 0 18px rgba(255, 186, 129, 0.35));
}

.piano-key.playing::after {
  content: '';
  position: absolute;
  inset: 10px 10px 16px 10px;
  border-radius: inherit;
  background: radial-gradient(circle at 50% 24%, rgba(255, 219, 186, 0.8), rgba(255, 140, 102, 0.55) 45%, rgba(240, 77, 55, 0.12) 70%);
  opacity: 0.95;
  pointer-events: none;
  mix-blend-mode: screen;
  animation: piano-glow 260ms ease-out forwards;
}

.piano-key.black.playing::after {
  inset: 8px 6px 14px 6px;
  background: radial-gradient(circle at 50% 18%, rgba(255, 236, 211, 0.82), rgba(255, 163, 123, 0.55) 42%, rgba(240, 77, 55, 0.16) 68%);
}

@keyframes piano-glow {
  to {
    opacity: 0;
    transform: scale(1.06);
  }
}

.piano-key .key-label {
  font-size: 0.95rem;
  display: block;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.4);
  line-height: 1.1;
}

.piano-key.black .key-label {
  font-size: 0.85rem;
  letter-spacing: 0.01em;
}

.piano-key .keyboard-hint {
  font-size: 0.75rem;
  opacity: 0.6;
}

.piano-key.white .keyboard-hint {
  color: #7a8599;
}

.piano-key.black .keyboard-hint {
  color: #b8c7ff;
}

.glow-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: radial-gradient(circle, #ffd29f 30%, #ff9b7b 80%);
  box-shadow: 0 0 18px rgba(255, 155, 123, 0.7);
}

.sparkle-trail {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: radial-gradient(circle, #fff, rgba(255, 255, 255, 0));
  pointer-events: none;
  mix-blend-mode: screen;
  animation: drift 900ms ease-out forwards;
  filter: blur(0.5px);
}

@keyframes drift {
  to {
    transform: translateY(-24px) translateX(6px) scale(0.4);
    opacity: 0;
  }
}

.piano-white-keys {
  display: grid;
  grid-template-columns: repeat(var(--white-key-count), minmax(48px, 1fr));
  position: relative;
  z-index: 1;
  gap: var(--white-gap);
}

.piano-black-keys {
  position: absolute;
  inset: 0;
  top: 0.35rem;
  height: calc(100% - 0.35rem);
  pointer-events: none;
}

.btn.btn-song {
  --bs-btn-color: var(--theme-lightest, #fff);
  --bs-btn-bg: var(--theme-special, #f04d37);
  --bs-btn-border-color: var(--theme-special, #f04d37);
  --bs-btn-hover-color: var(--theme-lightest, #fff);
  --bs-btn-hover-bg: #ff6e4b;
  --bs-btn-hover-border-color: #ff6e4b;
  --bs-btn-focus-shadow-rgb: 240, 77, 55;
  --bs-btn-active-color: var(--theme-lightest, #fff);
  --bs-btn-active-bg: #e8442f;
  --bs-btn-active-border-color: #e8442f;
  --bs-btn-disabled-color: var(--theme-lightest, #fff);
  --bs-btn-disabled-bg: var(--theme-special, #f04d37);
  --bs-btn-disabled-border-color: var(--theme-special, #f04d37);
  min-width: 240px;
  font-weight: 700;
  letter-spacing: 0.01em;
  background: linear-gradient(135deg, var(--theme-special, #f04d37), #ff7c57);
  border: 2px solid var(--theme-special, #f04d37);
  color: var(--theme-lightest, #fff);
  box-shadow: 0 14px 30px rgba(240, 77, 55, 0.25);
  transition: transform 0.08s ease, box-shadow 0.14s ease, background 0.14s ease;
}

.btn.btn-song:hover {
  background: linear-gradient(135deg, #ff7c57, var(--theme-special, #f04d37));
  border-color: var(--theme-special, #f04d37);
  color: var(--theme-lightest, #fff);
  box-shadow: 0 16px 34px rgba(240, 77, 55, 0.28);
  transform: translateY(-1px);
}

.btn.btn-song:focus-visible {
  box-shadow: 0 0 0 0.2rem rgba(240, 77, 55, 0.35), 0 14px 30px rgba(240, 77, 55, 0.25);
  outline: none;
}

.btn.btn-song:active,
.btn.btn-song.is-playing {
  transform: translateY(0);
  box-shadow: 0 8px 18px rgba(240, 77, 55, 0.22);
  background: linear-gradient(135deg, #f44d35, #ff704c);
  border-color: #e8442f;
}

.piano-note-link {
  font-weight: 700;
}

.piano-black-keys .piano-key.black {
  pointer-events: auto;
}

.piano-keys-wrapper {
  position: relative;
  margin-top: 0.25rem;
  padding-top: 0.25rem;
}

@media (max-width: 768px) {
  .piano-info {
    padding: 0.75rem 0.9rem;
  }

  .piano-octave {
    margin: 0.5rem 0;
    padding: 0.75rem 0.75rem 1.15rem;
    --white-gap: 3px;
  }

  .piano-keyboard {
    padding: 0.3rem 0.2rem 0.6rem;
  }

  .piano-white-keys {
    grid-template-columns: repeat(var(--white-key-count), minmax(44px, 1fr));
  }

  .piano-key.white {
    height: 170px;
    padding-bottom: 10px;
  }

  .piano-key.black {
    height: 120px;
    width: calc((100% / var(--white-key-count)) * 0.76);
    left: calc(((var(--white-step) + 0.64) / var(--white-key-count)) * 100%);
    padding-bottom: 8px;
  }

  .piano-key .key-label {
    font-size: 0.9rem;
  }
}

@media (max-width: 520px) {
  .piano-panel .card-body {
    padding: 0.85rem 0.75rem 1rem;
  }

  .piano-octave {
    margin: 0.4rem 0;
    padding: 0.65rem 0.6rem 0.95rem;
    --white-gap: 2px;
  }

  .piano-white-keys {
    grid-template-columns: repeat(var(--white-key-count), minmax(38px, 1fr));
  }

  .piano-key.white {
    height: 145px;
    padding-bottom: 8px;
  }

  .piano-key.black {
    height: 105px;
    width: calc((100% / var(--white-key-count)) * 0.7);
    left: calc(((var(--white-step) + 0.6) / var(--white-key-count)) * 100%);
    padding-bottom: 7px;
  }

  .piano-key .key-label {
    font-size: 0.82rem;
  }

  .piano-key .keyboard-hint {
    font-size: 0.68rem;
  }
}

@media (max-width: 400px) {
  .piano-panel .card-body {
    padding: 0.75rem 0.5rem 0.9rem;
  }

  .piano-octave {
    margin: 0.35rem 0;
    padding: 0.55rem 0.45rem 0.85rem;
    --white-gap: 1px;
  }

  .piano-white-keys {
    grid-template-columns: repeat(var(--white-key-count), minmax(32px, 1fr));
  }

  .piano-keyboard {
    padding: 0.25rem 0.1rem 0.55rem;
  }

  .piano-key.white {
    height: 128px;
    padding-bottom: 7px;
  }

  .piano-key.black {
    height: 94px;
    width: calc((100% / var(--white-key-count)) * 0.66);
    left: calc(((var(--white-step) + 0.58) / var(--white-key-count)) * 100%);
    padding-bottom: 6px;
  }

    .piano-key .key-label {
      font-size: 0.78rem;
    }

    .piano-key .keyboard-hint {
      font-size: 0.63rem;
    }
  }

body.piano-touch .keyboard-hint,
body.piano-touch .keyboard-shortcut-banner {
  display: none !important;
}
