.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.pianohero-page {
  max-width: 1100px;
  margin: 24px auto 48px;
  padding: 0 16px;
  color: #1f2937;
}

.pianohero-header {
  margin: 0 0 16px;
  text-align: center;
}

.pianohero-header h1 {
  margin: 0 0 8px;
  font-size: clamp(1.9rem, 2.4vw + 1.2rem, 2.8rem);
}

.pianohero-header p {
  margin: 0 auto;
  max-width: 720px;
  color: #475569;
}

.pianohero-layout {
  max-width: 1200px;
  margin: 0 auto;
}

.pianohero-stage {
  background: linear-gradient(180deg, #f8fafc 0%, #eef2ff 100%);
  border-radius: 20px;
  padding: 18px 18px 24px;
  box-shadow: 0 20px 40px rgba(15, 23, 42, 0.08);
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.pianohero-extra {
  margin: 32px auto 0;
  display: grid;
  gap: 24px;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  align-items: start;
}

.pianohero-hud {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 24px;
  justify-content: center;
  font-weight: 600;
}

.pianohero-hud span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.15);
  color: #1e3a8a;
}

.pianohero-level-badge {
  background: rgba(16, 185, 129, 0.15) !important;
  color: #065f46 !important;
}

.pianohero-board {
  position: relative;
  height: clamp(320px, 48vw, 480px);
  border-radius: 16px;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.04) 0%, rgba(15, 23, 42, 0.12) 100%);
  display: grid;
  grid-template-columns: repeat(var(--lane-count, 4), 1fr);
  gap: 10px;
  padding: 12px;
}

.pianohero-lane {
  position: relative;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.35);
  overflow: hidden;
  isolation: isolate;
}

.pianohero-lane::after {
  content: '';
  position: absolute;
  inset: auto 0 80px;
  height: 1px;
  background: rgba(148, 163, 184, 0.5);
  pointer-events: none;
}

.pianohero-lane__badge {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 23, 42, 0.08);
  color: rgba(15, 23, 42, 0.85);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.95rem;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  z-index: 2;
}

.pianohero-lane__badge kbd {
  font: inherit;
  padding: 2px 6px;
  border-radius: 6px;
  background: rgba(37, 99, 235, 0.12);
  color: #1e3a8a;
}

.pianohero-target {
  position: absolute;
  inset-inline: 12px;
  bottom: 22px;
  height: 64px;
  border-radius: 12px;
  border: 2px dashed rgba(30, 64, 175, 0.35);
  background: rgba(96, 165, 250, 0.08);
  pointer-events: none;
  z-index: 1;
}

.pianohero-note {
  position: absolute;
  left: 12%;
  right: 12%;
  top: 16px;
  height: 52px;
  border-radius: 10px;
  background: var(--lane-color, #2563eb);
  box-shadow: 0 12px 24px rgba(37, 99, 235, 0.3);
  transform: translateY(0);
  transition: transform 0.18s ease, opacity 0.18s ease;
  z-index: 1;
}

.pianohero-note::after {
  content: attr(data-label);
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.92);
  text-shadow: 0 1px 2px rgba(15, 23, 42, 0.25);
  letter-spacing: 0.04em;
}

.pianohero-note.is-hit {
  opacity: 0.35;
  box-shadow: none;
}

.pianohero-note.is-missed {
  opacity: 0.2;
  box-shadow: none;
  background: linear-gradient(180deg, rgba(239, 68, 68, 0.8), rgba(185, 28, 28, 0.9));
}

.pianohero-lane[data-lane="0"] {
  --lane-color: #2563eb;
}

.pianohero-lane[data-lane="1"] {
  --lane-color: #0ea5e9;
}

.pianohero-lane[data-lane="2"] {
  --lane-color: #f97316;
}

.pianohero-lane[data-lane="3"] {
  --lane-color: #a855f7;
}

.pianohero-lane[data-lane="4"] {
  --lane-color: #ec4899;
}

.pianohero-lane[data-lane="5"] {
  --lane-color: #f43f5e;
}

.pianohero-lane[data-lane="6"] {
  --lane-color: #facc15;
}

.pianohero-lane[data-lane="7"] {
  --lane-color: #22d3ee;
}

.pianohero-lane[data-lane="8"] {
  --lane-color: #34d399;
}

.pianohero-lane[data-lane="9"] {
  --lane-color: #fb7185;
}

.pianohero-lane.is-locked::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  z-index: 3;
  backdrop-filter: blur(1px);
}

.pianohero-lane.is-locked::after {
  opacity: 0.4;
}

.pianohero-lane.is-locked .pianohero-lane__badge {
  background: rgba(148, 163, 184, 0.4);
  color: rgba(255, 255, 255, 0.7);
}

.pianohero-lane.is-locked .pianohero-note {
  display: none;
}

.pianohero-keys {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.pianohero-key {
  border: none;
  border-radius: 12px;
  padding: 10px 18px;
  background: rgba(37, 99, 235, 0.12);
  color: #1f2937;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
}

.pianohero-key[data-lane="0"] {
  background: rgba(37, 99, 235, 0.18);
}

.pianohero-key[data-lane="1"] {
  background: rgba(14, 165, 233, 0.18);
}

.pianohero-key[data-lane="2"] {
  background: rgba(249, 115, 22, 0.18);
}

.pianohero-key[data-lane="3"] {
  background: rgba(168, 85, 247, 0.18);
}

.pianohero-key[data-lane="4"] {
  background: rgba(236, 72, 153, 0.18);
}

.pianohero-key[data-lane="5"] {
  background: rgba(244, 63, 94, 0.18);
}

.pianohero-key[data-lane="6"] {
  background: rgba(250, 204, 21, 0.2);
}

.pianohero-key[data-lane="7"] {
  background: rgba(34, 211, 238, 0.2);
}

.pianohero-key[data-lane="8"] {
  background: rgba(52, 211, 153, 0.2);
}

.pianohero-key[data-lane="9"] {
  background: rgba(251, 113, 133, 0.2);
}

.pianohero-key:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 2px;
}

.pianohero-key.is-pressed {
  transform: translateY(2px);
  box-shadow: inset 0 2px 6px rgba(15, 23, 42, 0.2);
}

.pianohero-key[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
}

.pianohero-key[disabled].is-pressed {
  transform: none;
}

.pianohero-status {
  min-height: 28px;
  text-align: center;
  font-weight: 600;
  color: #1e3a8a;
}

.pianohero-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  align-items: center;
}

.pianohero-controls label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  color: #1f2937;
}

.pianohero-controls__hint {
  margin: 0;
  font-size: 0.95rem;
  color: #475569;
  max-width: 320px;
  text-align: center;
}

.pianohero-training {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  color: #1f2937;
}

.pianohero-training input {
  width: 18px;
  height: 18px;
}

.pianohero-start {
  border: none;
  border-radius: 999px;
  padding: 12px 28px;
  font-weight: 700;
  background: linear-gradient(135deg, #2563eb, #10b981);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 12px 28px rgba(37, 99, 235, 0.25);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.pianohero-start:focus-visible {
  outline: 3px solid rgba(59, 130, 246, 0.45);
  outline-offset: 3px;
}

.pianohero-start:active {
  transform: translateY(1px);
  box-shadow: 0 8px 20px rgba(37, 99, 235, 0.2);
}

.pianohero-instructions {
  background: rgba(255, 255, 255, 0.82);
  border-radius: 18px;
  padding: 20px;
  box-shadow: 0 16px 32px rgba(15, 23, 42, 0.08);
  line-height: 1.55;
}

.pianohero-ranking {
  background: rgba(255, 255, 255, 0.88);
  border-radius: 18px;
  padding: 20px;
  box-shadow: 0 14px 28px rgba(15, 23, 42, 0.1);
}

.pianohero-instructions h2 {
  margin-top: 0;
  margin-bottom: 12px;
  font-size: 1.2rem;
}

.pianohero-instructions ul {
  margin: 0 0 12px 1.1em;
  padding: 0;
  color: #475569;
}

.pianohero-instructions li + li {
  margin-top: 6px;
}

.pianohero-legend {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.pianohero-legend__row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.pianohero-legend__swatch {
  width: 18px;
  height: 18px;
  border-radius: 6px;
  background: var(--lane-color, #2563eb);
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.12);
}

.pianohero-legend__row span {
  font-weight: 600;
  color: #334155;
}

.pianohero-ranking {
  background: rgba(255, 255, 255, 0.88);
  border-radius: 18px;
  padding: 20px;
  box-shadow: 0 14px 28px rgba(15, 23, 42, 0.1);
}

.pianohero-message--alert {
  color: #dc2626;
}

@media (max-width: 640px) {
  .pianohero-board {
    height: clamp(280px, 70vw, 360px);
    gap: 8px;
  }

  .pianohero-target {
    inset-inline: 8px;
  }

  .pianohero-stage {
    padding: 16px;
  }
}
