:root {
  color-scheme: light;
  --background: #fdfdfa;
  --ink: #263640;
  --muted: #63777c;
  --mint: #087e71;
  font: 15px/1.4 system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--background);
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; }
button { font: inherit; color: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
button:focus-visible { outline: 2px solid var(--mint); outline-offset: 3px; z-index: 5; }
[hidden] { display: none !important; }
.sr-only, .icon-defs { position: absolute; width: 1px; height: 1px; margin: -1px; clip-path: inset(50%); overflow: hidden; white-space: nowrap; pointer-events: none; }
.icon { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }

.game {
  width: min(100%, 1440px);
  min-height: 100svh;
  margin-inline: auto;
  display: grid;
  grid-template-rows: auto clamp(278px, 59svh, 475px) auto;
  align-content: center;
  padding: 14px clamp(8px, 3.2vw, 45px) clamp(22px, 6svh, 60px);
}
.controls { position: relative; z-index: 4; display: flex; justify-content: space-between; padding-inline: clamp(6px, 3.2vw, 44px); pointer-events: none; }
.control-anchor { position: relative; pointer-events: auto; }
.control { position: relative; top: auto; right: auto; z-index: auto; padding: 0; }
.control:disabled { cursor: wait; opacity: .65; }
.controls :is(.control, .controlPill) {
  color: #33465c;
  background: linear-gradient(160deg, #ffffffed, #edf3facf);
  border-color: #cbd8e6;
  box-shadow: inset 0 1px 0 #fff, 0 2px 6px #38537b14;
}
.controls .controlPill { transition-property: transform, filter, border-color, box-shadow; }
.controls :is(.control[aria-expanded="true"], .control.is-connected, .controlPill[aria-pressed="true"]) {
  color: #fff;
  background: linear-gradient(160deg, #286bd2, #1f5fbf);
  border-color: #205bb5;
  box-shadow: inset 0 1px 0 #ffffff38, 0 2px 6px #205bb531;
}
.controls :is(.control, .controlPill):focus-visible { outline-color: #286bd2; }
.connection-light { position: absolute; right: 7px; bottom: 7px; width: 9px; height: 9px; border: 1.5px solid #fff; border-radius: 50%; background: #a9dbff; }
.options, .midi-message { position: absolute; top: calc(100% + 12px); z-index: 5; border: 1px solid #deebe8; background: #fffffc; border-radius: 19px; box-shadow: 0 8px 30px #2f4b4022; }
.options { width: min(calc(100vw - 44px), 282px); padding: 14px; touch-action: pan-y pinch-zoom; }
.setting + .setting { margin-top: 12px; }
.setting > span { display: block; margin: 0 0 5px 5px; font-size: 12px; font-weight: 650; color: #536b69; }
.segment { display: flex; flex-wrap: wrap; gap: 8px; }
.midi-message { min-width: min(270px, 79vw); max-width: min(330px, 84vw); width: max-content; right: 0; margin: 0; padding: 13px 15px; font-size: 13px; }
.midi-message a { color: #176c62; font-weight: 650; text-underline-offset: .15em; }
.midi-links { display: flex; flex-wrap: wrap; gap: 8px 14px; margin-top: 8px; }
.midi-message .midi-pair { margin-top: 9px; }

.score { position: relative; min-width: 0; isolation: isolate; overflow: hidden; }
.score-svg { position: absolute; z-index: 1; pointer-events: none; inset: 0; width: 100%; height: 100%; }
.staff-rules, .measure-line { fill: none; stroke: #afbec0; stroke-width: 1.7; vector-effect: non-scaling-stroke; }
.measure-line { stroke: #c4cecf; stroke-width: 1.35; }
.clef { position: absolute; z-index: 2; left: clamp(5px, 3.5vw, 50px); top: 27%; height: 53%; width: auto; pointer-events: none; }
.playhead { position: absolute; top: 7%; bottom: 2.5%; left: 0; width: 0; color: var(--mint); pointer-events: none; will-change: transform; }
.playhead-line { position: absolute; inset: 36px auto 0 -3px; width: 6px; border-radius: 4px; background: linear-gradient(#84cbbd, #c1e7dd); }
.playhead-cap { position: absolute; left: 0; top: 0; display: grid; place-items: center; width: 50px; height: 50px; transform: translateX(-50%); border-radius: 18px; border: 2px solid #78c5b4; box-shadow: inset 0 1px 0 #fff, 0 0 0 5px var(--background), 0 5px 13px #27796b2d; background: linear-gradient(140deg, #f1fbf7, #d4efe6); }
.score.is-wrong .playhead { color: #a5554c; }
.score.is-wrong .playhead-line { background: linear-gradient(#d7a297, #f0dbd1); }
.score.is-wrong .playhead-cap { border-color: #d9a69a; background: #fff0eb; animation: retry .28s ease-out; }
@keyframes retry {
  30% { transform: translateX(calc(-50% - 4px)) rotate(-6deg); }
  70% { transform: translateX(calc(-50% + 3px)) rotate(4deg); }
}
.note { color: #31464b; }
.note.is-past { opacity: .29; }
.notation { display: none; }
.no-hints .notation { display: inline; }
.no-hints .note-tile { display: none; }
.notation line { stroke: currentColor; stroke-width: 1.75; vector-effect: non-scaling-stroke; }
.note-head { fill: currentColor; stroke: currentColor; stroke-width: 1.4; }
.note-head.open { fill: var(--background); }
.note-flag, .note-dot, .note-accidental { fill: currentColor; }
.note-accidental { font: 24px Georgia, serif; }
.note-halo { fill: #d6eee4; opacity: 0; }
.note.is-active .note-halo { opacity: 1; }
.note.is-wrong .note-halo { fill: #f5e1d9; }
.note-duration { fill: none; stroke: #268f7b; stroke-width: 2.5; opacity: 0; }
.note.is-burning .note-duration { opacity: 1; }
.tile-bed { fill: #edf1f0; }
.tile-fill { fill: var(--note-fill); }
.tile-shine { fill: url(#tile-sheen); }
.tile-outline { fill: none; stroke: var(--note-edge); stroke-width: 1; }
.tile-label { fill: #23403e; font-size: 15px; font-weight: 720; }
.note.is-active .tile-outline { stroke: #227866; stroke-width: 1.5; }
.note.is-burning .tile-outline { stroke: var(--note-edge); }
.note.is-past .tile-color { display: none; }
.note.is-wrong .tile-fill { fill: #f2d8cf; }
.note.is-wrong .tile-outline { stroke: #bb7668; }

.instrument {
  width: min(100%, 1060px);
  margin: 0 auto;
  padding: 3px clamp(0px, .6vw, 8px) 13px;
  perspective: 880px;
}
.piano-keys {
  position: relative;
  display: grid;
  grid-template-columns: repeat(var(--white-key-count, 8), minmax(0, 1fr));
  gap: 3px;
  height: clamp(91px, 21svh, 178px);
  transform-origin: 50% 100%;
  transform: rotateX(24deg);
}
.key {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: end;
  min-width: 0;
  padding: 0 0 10px;
  gap: 2px;
  border: 1px solid #cbd6d8;
  border-bottom: clamp(6px, 1.1vw, 13px) solid #d6dfe0;
  border-radius: 8px 8px 12px 12px;
  background: linear-gradient(#edf3f3, #fff 48%);
  box-shadow: inset 0 1px 1px #fff, 0 4px 0 #b8c8ca, 0 10px 12px #52676e1e;
  outline-offset: -4px;
  touch-action: pan-y;
  user-select: none;
  transition: background-color .14s, border-color .14s, transform .13s, box-shadow .13s;
}
.key .note-name { color: #3b5057; font-size: 12px; font-weight: 650; }
.key .sharp-mark { display: none; color: #f1f6f8; font-size: 11px; }
.key kbd { color: #63777c; font: 600 10px/1 system-ui, sans-serif; }
.key.is-hint { background: linear-gradient(#d4ede5, #ebf8f2 70%); border-color: #87beaf; border-bottom-color: #a6d0c1; }
.key.is-down { background: #c4e8da; transform: translateY(4px); box-shadow: inset 0 1px 1px #fff, 0 1px 0 #92b5aa; }
.key.is-wrong { background: #f5e5df; border-bottom-color: #d7b2a7; }
.key.black {
  position: absolute;
  z-index: 2;
  top: -7px;
  width: calc(62% / var(--white-key-count, 8));
  height: 61%;
  transform: translateX(-50%);
  padding-bottom: 5px;
  border-color: #354852;
  border-bottom: clamp(5px, .85vw, 10px) solid #263c46;
  border-radius: 6px 6px 8px 8px;
  box-shadow: inset 0 1px 0 #84969f, 0 4px 3px #283e4a38;
  background: linear-gradient(#536974, #3e5662 78%);
}
.key.black .note-name, .key.black kbd { color: #f1f6f8; }
.key.black.is-hint { background: #4c8377; border-color: #3b7565; border-bottom-color: #35665f; }
.key.black.is-down { background: #598e80; transform: translate(-50%, 4px); }
.key.black.is-wrong { background: #996c60; }
.key.black:focus-visible { outline-color: #b7e5d9; }
.piano-keys.no-hints :is(.note-name, .sharp-mark) { visibility: hidden; }

@media (max-width: 560px) {
  .game { grid-template-rows: auto clamp(228px, 46svh, 345px) auto; padding-bottom: 21px; }
  .tile-label { font-size: 13px; }
  .playhead-cap { width: 41px; height: 41px; border-radius: 14px; }
  .playhead-line { width: 5px; left: -2.5px; }
  .piano-keys { gap: 2px; height: clamp(102px, 18svh, 135px); transform: rotateX(16deg); }
  .key { padding-bottom: 8px; border-radius: 5px 5px 8px 8px; }
  .key.black { border-radius: 5px; }
  .key .note-name { font-size: clamp(7px, 2.4vw, 10px); }
  .key.black .note-name { display: none; }
  .key.black .sharp-mark { display: block; }
}
@media (max-height: 540px) and (min-width: 561px) {
  .game { grid-template-rows: auto minmax(199px, 59svh) auto; padding-top: 5px; padding-bottom: 13px; }
  .piano-keys { height: clamp(71px, 20svh, 120px); }
}
@media (pointer: coarse) { .key kbd { display: none; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
