.piano-page {
  max-width: 1100px;
  margin: 24px auto;
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  justify-content: center;
  align-items: flex-start;
}

.piano-intro {
  max-width: 720px;
  margin: 0 auto 24px;
  color: #475569;
}

.score-panel,
.keyboard-panel {
  flex: 1 1 360px;
  background: rgba(255, 255, 255, 0.85);
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.08);
}

.score-panel {
  flex: 2 1 520px;
  max-width: 760px;
  width: min(100%, 760px);
}

.score-label {
  display: block;
  font-weight: bold;
  margin-bottom: 8px;
}

.score-select {
  width: 100%;
  border-radius: 8px;
  border: 1px solid #cbd5f5;
  padding: 10px 12px;
  font-size: 1rem;
  background: #f8fafc;
  margin-bottom: 16px;
}

.score-preview {
  margin: 0;
  width: 100%;
  background: #0f172a0d;
  border-radius: 10px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: center;
}

.score-preview img {
  width: 100%;
  max-width: 100%;
  border-radius: 8px;
  box-shadow: 0 2px 12px rgba(15, 23, 42, 0.18);
  background: #ffffff;
  min-height: 200px;
  max-height: 70vh;
  object-fit: contain;
}

.score-preview figcaption {
  font-size: 0.9rem;
  color: #64748b;
  text-align: center;
}

.keyboard-panel h2 {
  margin-top: 0;
  margin-bottom: 8px;
}

.keyboard-help {
  margin: 0 0 16px;
  color: #475569;
}

.piano-board {
  position: relative;
  display: flex;
  gap: 0px;
  padding: 12px;
  border-radius: 14px;
  background: linear-gradient(180deg, #f1f5f9 0%, #e2e8f0 100%);
  box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.35);
  overflow: visible;
  touch-action: none;
}

.piano-key-wrapper {
  position: relative;
  flex: 1 1 0;
  display: flex;
}

.piano-key-wrapper .piano-key--white {
  width: 100%;
}

.piano-board[data-layout="full"] .piano-key--white {
  border-left: 0;
  border-right: 0;
}

.piano-board[data-layout="full"] .piano-key-wrapper:first-child .piano-key--white {
  border-left: 1px solid #cbd5f5;
}

.piano-board[data-layout="full"] .piano-key-wrapper:last-child .piano-key--white {
  border-right: 1px solid #cbd5f5;
}

.piano-key {
  position: relative;
  border: none;
  cursor: pointer;
  font: inherit;
  user-select: none;
  touch-action: manipulation;
  outline: none;
  transition: transform 0.08s ease, box-shadow 0.12s ease;
}

.piano-key--white {
  position: relative;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 90%);
  border-radius: 0 0 8px 8px;
  border: 1px solid #cbd5f5;
  height: 210px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 8px;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.1);
}

.piano-key--white:focus-visible {
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.35);
}

.piano-key--black {
  position: absolute;
  top: 0;
  left: 68%;
  width: 60%;
  height: 60%;
  background: linear-gradient(180deg, #1f2937 0%, #0f172a 85%);
  border-radius: 0 0 6px 6px;
  border: 1px solid #0f172a;
  color: #f8fafc;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 6px;
  box-shadow: 0 6px 12px rgba(15, 23, 42, 0.35);
  z-index: 2;
}

.piano-key--black:focus-visible {
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.45);
}

.piano-key.is-active {
  transform: translateY(2px);
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.16);
}

.piano-key--black.is-active {
  transform: translateY(3px);
}

.piano-status {
  margin-top: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
  font-weight: bold;
}

.piano-status output {
  min-width: 48px;
  font-size: 1.1rem;
  color: #2563eb;
}

.piano-board[data-layout="compact"] {
  gap: 1px;
  padding: 10px 8px;
}

.piano-board[data-layout="compact"] .piano-key--white {
  border-radius: 0 0 6px 6px;
}

.piano-board[data-layout="compact"] .piano-key--black {
  left: 76%;
  width: 42%;
  height: 52%;
}

@media (max-width: 768px) {
  .piano-key--white {
    height: 180px;
  }

  .piano-key--black {
    left: 70%;
    width: 52%;
    height: 58%;
  }
}

@media (max-width: 900px) {
  .score-panel {
    flex: 1 1 100%;
    max-width: 100%;
  }
}
