/* ═══════════════════════════════════════════════════════════════
   Piano Keyboard — Visual piano with white and black keys
   Positions are calculated in JS and set via inline style.
   ═══════════════════════════════════════════════════════════════ */

.piano-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.piano-section__label {
  font-size: 0.75rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* Keyboard container */
.piano-keyboard {
  position: relative;
  height: 140px;
  background: #181820;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border-medium);
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

.piano-keyboard-disabled .piano-keyboard {
  opacity: 0.45;
  pointer-events: none;
}

/* ── White Keys ────────────────────────────────────────────── */
.piano-key--white {
  position: absolute;
  top: 0;
  height: 100%;
  background: linear-gradient(180deg, #f8f6f0 0%, #e8e4dc 80%, #d4d0c8 100%);
  border: none;
  border-right: 1px solid rgba(0, 0, 0, 0.1);
  border-bottom: 3px solid #bbb8b0;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding-bottom: 8px;
  z-index: 1;
  transition: background 80ms ease, border-bottom-width 60ms ease;
}

.piano-key--white:hover {
  background: linear-gradient(180deg, #fff 0%, #f4f0e8 80%, #e8e4dc 100%);
}

.piano-key--white:active,
.piano-key--white.piano-key--active {
  background: linear-gradient(180deg, #eae6de 0%, #ddd8d0 80%, #ccc8c0 100%);
  border-bottom-width: 1px;
  padding-bottom: 10px;
}

/* ── Black Keys ────────────────────────────────────────────── */
.piano-key--black {
  position: absolute;
  top: 0;
  height: 58%;
  background: linear-gradient(180deg, #333 0%, #1a1a1a 60%, #0d0d0d 100%);
  border: none;
  border-bottom: 3px solid #000;
  border-radius: 0 0 4px 4px;
  cursor: pointer;
  z-index: 2;
  box-shadow: -1px 0 2px rgba(0, 0, 0, 0.35),
              1px 0 2px rgba(0, 0, 0, 0.35),
              0 3px 6px rgba(0, 0, 0, 0.5);
  transition: background 80ms ease, box-shadow 60ms ease;
}

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

.piano-key--black:active,
.piano-key--black.piano-key--active {
  background: linear-gradient(180deg, #222 0%, #111 60%, #0a0a0a 100%);
  border-bottom-width: 1px;
  height: calc(58% - 2px);
  box-shadow: -1px 0 1px rgba(0, 0, 0, 0.2),
              1px 0 1px rgba(0, 0, 0, 0.2),
              0 1px 2px rgba(0, 0, 0, 0.3);
}

/* ── Key Labels ────────────────────────────────────────────── */
.piano-key__label {
  font-size: 0.55rem;
  font-family: var(--font-mono);
  color: rgba(0, 0, 0, 0.3);
  font-weight: 500;
  pointer-events: none;
  line-height: 1;
  white-space: nowrap;
}

.piano-key--white:hover .piano-key__label {
  color: rgba(0, 0, 0, 0.55);
}

/* ── Highlight: Correct (green) ────────────────────────────── */
.piano-key--correct.piano-key--white {
  background: linear-gradient(180deg, #86efac 0%, #4ade80 80%, #22c55e 100%) !important;
  border-bottom-color: #16a34a !important;
}
.piano-key--correct.piano-key--white .piano-key__label {
  color: rgba(255, 255, 255, 0.9) !important;
}
.piano-key--correct.piano-key--black {
  background: linear-gradient(180deg, #22c55e 0%, #16a34a 60%, #15803d 100%) !important;
  box-shadow: 0 0 14px rgba(34, 197, 94, 0.5),
              -1px 0 2px rgba(0, 0, 0, 0.2),
              1px 0 2px rgba(0, 0, 0, 0.2) !important;
}

/* ── Highlight: Wrong (red) ────────────────────────────────── */
.piano-key--wrong.piano-key--white {
  background: linear-gradient(180deg, #fca5a5 0%, #f87171 80%, #ef4444 100%) !important;
  border-bottom-color: #dc2626 !important;
}
.piano-key--wrong.piano-key--white .piano-key__label {
  color: rgba(255, 255, 255, 0.9) !important;
}
.piano-key--wrong.piano-key--black {
  background: linear-gradient(180deg, #ef4444 0%, #dc2626 60%, #b91c1c 100%) !important;
  box-shadow: 0 0 14px rgba(239, 68, 68, 0.5),
              -1px 0 2px rgba(0, 0, 0, 0.2),
              1px 0 2px rgba(0, 0, 0, 0.2) !important;
}

/* ── Highlight: Hint (blue — show correct after wrong) ─────── */
.piano-key--hint.piano-key--white {
  background: linear-gradient(180deg, #93c5fd 0%, #60a5fa 80%, #3b82f6 100%) !important;
  border-bottom-color: #2563eb !important;
}
.piano-key--hint.piano-key--white .piano-key__label {
  color: rgba(255, 255, 255, 0.9) !important;
}
.piano-key--hint.piano-key--black {
  background: linear-gradient(180deg, #3b82f6 0%, #2563eb 60%, #1d4ed8 100%) !important;
  box-shadow: 0 0 14px rgba(59, 130, 246, 0.5),
              -1px 0 2px rgba(0, 0, 0, 0.2),
              1px 0 2px rgba(0, 0, 0, 0.2) !important;
}

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 600px) {
  .piano-keyboard { height: 110px; }
  .piano-key__label { font-size: 0.45rem; }
  .piano-key--white { padding-bottom: 5px; }
}

@media (max-width: 400px) {
  .piano-keyboard { height: 90px; }
  .piano-key__label { display: none; }
}
