:root {
  color-scheme: light;
  --bg: #fbf8f2;
  --surface: #f4efe6;
  --surface-strong: #ece3d6;
  --panel-border: rgba(17, 14, 10, 0.14);
  --panel-border-strong: rgba(17, 14, 10, 0.24);
  --accent: #cab9a3;
  --accent-soft: rgba(202, 185, 163, 0.18);
  --text: #11100d;
  --muted: rgba(17, 16, 13, 0.58);
  --shadow: 0 24px 60px rgba(17, 14, 10, 0.08);
  --piano-height: 222px;
  --content-width: 1240px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

body {
  min-height: 100vh;
}

button {
  font: inherit;
}

.app-shell {
  width: min(calc(100% - 48px), var(--content-width));
  margin: 0 auto;
  padding: 34px 0 34px;
}

.portrait-message {
  display: none;
}

.main-stage {
  display: block;
}

.visualizer-panel {
  position: relative;
  border: 1px solid var(--panel-border);
  border-radius: 32px;
  background:
    linear-gradient(
      180deg,
      rgba(255, 255, 255, 0.8),
      rgba(244, 239, 230, 0.92)
    ),
    var(--bg);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.visualizer-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.65), transparent 38%),
    radial-gradient(
      circle at top right,
      rgba(202, 185, 163, 0.18),
      transparent 26%
    );
  pointer-events: none;
}

.visualizer-meta {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 26px 0;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 12px;
  border: 1px solid rgba(202, 185, 163, 0.48);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.56);
  color: var(--text);
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.progress-text {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  font-size: 0.88rem;
  letter-spacing: 0.08em;
}

.visualizer-canvas-shell {
  position: relative;
  min-height: 64vh;
  padding: 18px 26px 0;
}

#note-canvas {
  display: block;
  width: 100%;
  height: calc(64vh - 18px);
  min-height: calc(64vh - 18px);
  border: 1px solid rgba(17, 14, 10, 0.08);
  border-bottom: 0;
  border-radius: 24px 24px 0 0;
  background: #ffffff;
}

.hit-line {
  position: absolute;
  left: 26px;
  right: 26px;
  bottom: 0;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(17, 16, 13, 0.9),
    transparent
  );
}

.visualizer-placeholder {
  position: absolute;
  inset: 18px 26px 0;
  display: grid;
  place-items: center;
  border-radius: 24px 24px 0 0;
  background: rgba(251, 248, 242, 0.72);
  cursor: pointer;
}

.visualizer-placeholder[hidden] {
  display: none;
}

.visualizer-placeholder:focus-visible {
  outline: 1px solid rgba(17, 14, 10, 0.32);
  outline-offset: -8px;
}

.visualizer-placeholder-copy {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 24px 32px;
  border: 1px solid rgba(17, 14, 10, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
}

.overlay-signal {
  display: none;
  width: 22px;
  height: 24px;
  position: relative;
}

.overlay-signal::before,
.overlay-signal::after {
  content: "";
  position: absolute;
  top: 0;
  width: 6px;
  height: 24px;
  border-radius: 999px;
  background: rgba(17, 16, 13, 0.78);
}

.overlay-signal::before {
  left: 3px;
}

.overlay-signal::after {
  right: 3px;
}

.visualizer-placeholder[data-state="paused"] .overlay-signal {
  display: block;
}

.visualizer-placeholder-copy strong {
  display: block;
  font-size: 0.76rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(17, 16, 13, 0.78);
}

.piano-dock {
  position: relative;
  height: var(--piano-height);
  padding: 0 26px 26px;
  background: transparent;
  border-top: 0;
}

.piano-shell {
  width: 100%;
  margin: 0;
  position: relative;
  height: calc(var(--piano-height) - 58px);
  border: 1px solid var(--panel-border);
  border-top: 0;
  border-radius: 0 0 26px 26px;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.92),
    rgba(236, 227, 214, 0.9)
  );
  box-shadow: 0 18px 34px rgba(17, 14, 10, 0.06);
  overflow: hidden;
}

.playback-scrubber {
  padding-top: 14px;
  padding-bottom: 10px;
}

#seek-bar {
  width: 100%;
  margin: 0;
  appearance: none;
  height: 4px;
  border-radius: 999px;
  background: linear-gradient(90deg, #cbb79d 0%, #ff8f2c 100%);
  outline: none;
}

#seek-bar::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 999px;
  background: linear-gradient(90deg, #cbb79d 0%, #ff8f2c 100%);
}

#seek-bar::-webkit-slider-thumb {
  appearance: none;
  width: 14px;
  height: 14px;
  margin-top: -5px;
  border: 1px solid rgba(17, 14, 10, 0.14);
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 2px 8px rgba(17, 14, 10, 0.12);
}

#seek-bar::-moz-range-track {
  height: 4px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, #cbb79d 0%, #ff8f2c 100%);
}

#seek-bar::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border: 1px solid rgba(17, 14, 10, 0.14);
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 2px 8px rgba(17, 14, 10, 0.12);
}

.scrubber-times {
  display: flex;
  justify-content: space-between;
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  font-variant-numeric: tabular-nums;
}

.keyboard {
  position: relative;
  height: 100%;
  padding: 12px 12px 14px;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.6),
    rgba(236, 227, 214, 0.2)
  );
}

.keyboard-white,
.keyboard-black {
  position: absolute;
  inset: 12px;
}

.keyboard-white {
  display: flex;
  gap: 0;
  align-items: stretch;
}

.key {
  position: relative;
  border: 0;
  padding: 0;
  border-radius: 0 0 10px 10px;
  transition:
    background-color 120ms ease,
    transform 120ms ease,
    box-shadow 120ms ease,
    opacity 120ms ease;
}

.key:focus-visible {
  outline: 1px solid rgba(17, 14, 10, 0.8);
  outline-offset: -2px;
}

.key-white {
  flex: 1 1 0;
  min-width: 10px;
  border-right: 1px solid rgba(17, 14, 10, 0.12);
  background: linear-gradient(180deg, #fffdfa 0%, #efe7da 100%);
  box-shadow:
    inset 0 -4px 10px rgba(17, 14, 10, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.key-white:first-child {
  border-bottom-left-radius: 14px;
}

.key-white:last-child {
  border-right: 0;
  border-bottom-right-radius: 14px;
}

.key-black {
  position: absolute;
  top: 0;
  width: calc((100% / var(--white-key-count, 52)) * 0.64);
  height: 62%;
  margin-left: calc((100% / var(--white-key-count, 52)) * -0.32);
  border-radius: 0 0 8px 8px;
  background: linear-gradient(180deg, #292723 0%, #0e0d0b 100%);
  box-shadow:
    inset 0 -8px 12px rgba(0, 0, 0, 0.3),
    0 8px 14px rgba(17, 14, 10, 0.18);
  z-index: 2;
}

.key-white.active-left,
.key-black.active-left {
  background: #cbb79d;
}

.key-white.active-right,
.key-black.active-right {
  background: #ff8f2c;
}

.key-white.active-left,
.key-white.active-right {
  box-shadow:
    inset 0 -8px 14px rgba(92, 71, 48, 0.18),
    0 0 0 1px rgba(17, 14, 10, 0.12);
}

.key-black.active-left,
.key-black.active-right {
  box-shadow:
    inset 0 -8px 14px rgba(0, 0, 0, 0.26),
    0 8px 14px rgba(17, 14, 10, 0.18);
}

@media (max-width: 720px) {
  :root {
    --piano-height: 198px;
  }

  .app-shell {
    width: min(calc(100% - 24px), var(--content-width));
    padding-top: 20px;
    padding-bottom: 20px;
  }

  .visualizer-meta {
    padding: 16px 16px 0;
  }

  .visualizer-canvas-shell {
    min-height: 54vh;
    padding: 14px 16px 0;
  }

  #note-canvas {
    height: calc(54vh - 14px);
    min-height: calc(54vh - 14px);
  }

  .hit-line {
    left: 16px;
    right: 16px;
    bottom: 0;
  }

  .visualizer-placeholder {
    inset: 14px 16px 0;
  }

  .piano-dock {
    padding: 0 16px 16px;
    background: #ffffff;
  }

  .piano-shell {
    height: calc(var(--piano-height) - 50px);
  }

  .playback-scrubber {
    padding-bottom: 8px;
  }

  .keyboard {
    padding: 8px 8px 10px;
  }

  .keyboard-white,
  .keyboard-black {
    inset: 8px;
  }

  .key-black {
    height: 58%;
  }
}

@media (max-width: 720px) and (orientation: portrait) {
  .app-shell {
    padding-top: 14px;
  }

  .portrait-message {
    display: block;
    margin-bottom: 12px;
    padding: 12px 14px;
    border: 1px solid rgba(17, 14, 10, 0.12);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.88);
    color: rgba(17, 16, 13, 0.78);
    font-size: 0.72rem;
    line-height: 1.4;
    letter-spacing: 0.04em;
  }

  .visualizer-canvas-shell {
    min-height: 34vh;
  }

  #note-canvas {
    height: 34vh;
    min-height: 34vh;
  }

  .piano-dock {
    height: 184px;
  }

  .piano-shell {
    height: 132px;
  }

  .playback-scrubber {
    padding-top: 12px;
  }
}

@media (max-width: 932px) and (orientation: landscape) {
  :root {
    --piano-height: 164px;
  }

  .visualizer-canvas-shell {
    min-height: 46vh;
  }

  #note-canvas {
    height: calc(46vh - 18px);
    min-height: calc(46vh - 18px);
  }

  .piano-shell {
    height: calc(var(--piano-height) - 46px);
  }

  .keyboard {
    padding: 8px 10px 10px;
  }

  .keyboard-white,
  .keyboard-black {
    inset: 8px 10px 10px;
  }

  .key-white {
    min-width: 12px;
  }

  .key-black {
    height: 60%;
  }
}
