.lesson-visual-keyboard {
  min-width: 0;
  margin-top: 14px;
  border: 1px solid #dbe4f0;
  border-radius: 16px;
  background: #f8fafc;
  padding: 18px;
}

.piano-guide-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  cursor: pointer;
  list-style: none;
}

.piano-guide-summary::-webkit-details-marker {
  display: none;
}

.piano-guide-summary > span:first-child {
  display: grid;
  gap: 3px;
}

.piano-guide-summary small {
  color: #2368d7;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.piano-guide-summary-action {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #2368d7;
  font-size: 0.78rem;
  font-weight: 800;
}

.piano-guide-summary-action b {
  transition: transform 160ms ease;
}

.lesson-visual-keyboard[open]
  .piano-guide-summary-action b {
  transform: rotate(180deg);
}

.lesson-visual-keyboard[open]
  .piano-guide-summary-action {
  font-size: 0;
}

.lesson-visual-keyboard[open]
  .piano-guide-summary-action::before {
  content: "Close guide";
  font-size: 0.78rem;
}

.piano-guide-content {
  padding-top: 16px;
}

.piano-guide-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 20px;
  padding: 11px 13px;
  border: 1px solid #dbe4f0;
  border-radius: 12px;
  background: #ffffff;
}

.piano-guide-controls label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #344054;
  font-size: 0.82rem;
  font-weight: 700;
}

.piano-guide-controls input {
  width: 17px;
  height: 17px;
  accent-color: #2368d7;
}

.lesson-keyboard-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.lesson-keyboard-heading h3 {
  margin: 3px 0 0;
  color: #101828;
  font-size: 1.05rem;
}

.lesson-keyboard-details {
  margin: 7px 0 0;
  color: #667085;
  font-size: 0.88rem;
}

.visual-keyboard-viewport {
  position: relative;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  margin-top: 20px;
  overflow-x: auto;
  border: 10px solid #172033;
  border-radius: 16px;
  background: #172033;
  box-shadow: inset 0 2px 7px rgb(0 0 0 / 35%);
  scrollbar-color: #98a2b3 #1d2939;
  scrollbar-width: thin;
}

.visual-keyboard {
  --white-key-width: 34px;
  --black-key-width: 22px;
  --white-key-height: 174px;
  --black-key-height: 112px;
  --keyboard-height: 190px;

  display: flex;
  align-items: flex-start;
  width: max-content;
  min-width: 100%;
  height: var(--keyboard-height);
  padding: 0 8px 8px;
  background: linear-gradient(180deg, #111827, #27364f);
}

.visual-key {
  position: relative;
  flex: 0 0 auto;
  transition:
    background-color 120ms ease,
    box-shadow 120ms ease,
    transform 120ms ease;
}

.visual-key-white {
  z-index: 1;
  width: var(--white-key-width);
  height: var(--white-key-height);
  border: 1px solid #98a2b3;
  border-radius: 0 0 6px 6px;
  background:
    linear-gradient(
      90deg,
      #e4e7ec,
      #ffffff 18%,
      #ffffff 82%,
      #d0d5dd
    );
  box-shadow:
    inset 0 -8px 8px rgb(0 0 0 / 8%),
    0 3px 2px rgb(0 0 0 / 20%);
}

.visual-key-black {
  z-index: 2;
  width: var(--black-key-width);
  height: var(--black-key-height);
  margin-right: calc(var(--black-key-width) / -2);
  margin-left: calc(var(--black-key-width) / -2);
  border: 1px solid #000000;
  border-radius: 0 0 5px 5px;
  background:
    linear-gradient(
      90deg,
      #050608,
      #344054 45%,
      #050608
    );
  box-shadow:
    inset 0 -7px 5px rgb(255 255 255 / 6%),
    0 5px 5px rgb(0 0 0 / 38%);
}

.visual-key.active {
  background: #fbbf24;
  box-shadow:
    0 0 0 3px #fef3c7,
    0 0 22px #f59e0b;
  transform: translateY(4px);
}

.visual-key-label {
  position: absolute;
  right: 0;
  bottom: 9px;
  left: 0;
  opacity: 0;
  color: #475467;
  font-size: 0.58rem;
  font-weight: 800;
  text-align: center;
  transition: opacity 120ms ease;
}

.visual-key-black .visual-key-label {
  bottom: 8px;
  color: #ffffff;
  font-size: 0.5rem;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
}

.show-all-key-names .visual-key-label,
.label-guided-notes
  .visual-key.guided
  .visual-key-label {
  opacity: 1;
}

.visual-keyboard-empty {
  margin: 0;
  color: #667085;
  padding: 28px;
  text-align: center;
}

.visual-key.guided:not(.active) {
  background: #60a5fa;
  box-shadow:
    0 0 0 3px #dbeafe,
    0 0 24px #3b82f6;
  animation: guided-key-pulse 1.2s ease-in-out infinite;
}

@keyframes guided-key-pulse {
  0%,
  100% {
    filter: brightness(1);
  }

  50% {
    filter: brightness(1.28);
  }
}

@media (prefers-reduced-motion: reduce) {
  .visual-key.guided:not(.active) {
    animation: none;
  }
}
