:root {
  color-scheme: light;
  --ink: #263044;
  --muted: #66708b;
  --rose: #ff629a;
  --tangerine: #ffad42;
  --lemon: #ffe66d;
  --leaf: #4fd38f;
  --aqua: #5bd7ff;
  --blue: #5376ff;
  --violet: #9b67ff;
  --paper: rgba(255, 255, 255, 0.88);
  --shadow: 0 18px 38px rgba(48, 61, 92, 0.2);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
}

body {
  display: grid;
  min-width: 320px;
  min-height: 100svh;
  overflow: hidden;
  color: var(--ink);
  font-family: ui-rounded, "SF Pro Rounded", "Comic Sans MS", system-ui, sans-serif;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.28) 0 18px, transparent 18px 36px),
    linear-gradient(135deg, #ffe78f 0%, #ff9dc2 28%, #8ee9ff 64%, #b9f7c8 100%);
}

button,
a {
  color: inherit;
  font: inherit;
  -webkit-tap-highlight-color: transparent;
}

button {
  border: 0;
  cursor: pointer;
  touch-action: manipulation;
}

a {
  text-decoration: none;
}

.game-shell {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: clamp(10px, 2vw, 16px);
  width: min(1220px, 100vw);
  height: 100svh;
  margin: 0 auto;
  padding: clamp(10px, 2vw, 18px);
}

.topbar {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) minmax(104px, auto);
  align-items: center;
  gap: 12px;
}

.home-link {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border: 4px solid rgba(255, 255, 255, 0.78);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.76);
  box-shadow: 0 8px 0 rgba(38, 48, 68, 0.14), var(--shadow);
  font-size: 1.45rem;
  font-weight: 1000;
}

.eyebrow,
h1 {
  margin: 0;
}

.eyebrow {
  color: #6840a8;
  font-size: clamp(0.74rem, 1.8vw, 0.9rem);
  font-weight: 950;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  font-size: clamp(2rem, 7vw, 4.9rem);
  line-height: 0.94;
  letter-spacing: 0;
  text-shadow: 0 4px 0 rgba(255, 255, 255, 0.58);
}

.now-playing {
  min-width: 104px;
  max-width: 210px;
  padding: 11px 12px;
  border: 4px solid rgba(255, 255, 255, 0.78);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.74);
  box-shadow: var(--shadow);
  color: #35415f;
  font-size: clamp(0.9rem, 2vw, 1.08rem);
  font-weight: 950;
  line-height: 1.08;
  text-align: center;
}

.song-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(116px, 1fr)) minmax(78px, 0.55fr);
  gap: 10px;
}

.song-button,
.stop-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-width: 0;
  min-height: 56px;
  padding: 0 10px;
  border: 4px solid rgba(255, 255, 255, 0.74);
  border-radius: 8px;
  color: #fff;
  box-shadow: inset 0 -5px 0 rgba(0, 0, 0, 0.15), 0 7px 0 rgba(38, 48, 68, 0.14);
  font-size: clamp(0.9rem, 2.1vw, 1.08rem);
  font-weight: 1000;
  white-space: nowrap;
}

.song-button:nth-child(1) {
  background: linear-gradient(180deg, #ff75aa, #f14184);
}

.song-button:nth-child(2) {
  background: linear-gradient(180deg, #ffb84d, #f47828);
}

.song-button:nth-child(3) {
  background: linear-gradient(180deg, #6de39c, #20a96d);
}

.song-button:nth-child(4) {
  background: linear-gradient(180deg, #6fd7ff, #3c70ff);
}

.stop-button {
  background: linear-gradient(180deg, #9b67ff, #6447d8);
}

.song-button:active,
.song-button.is-playing,
.stop-button:active {
  transform: translateY(4px);
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.15), 0 3px 0 rgba(38, 48, 68, 0.14);
}

.play-icon {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.25);
  font-size: 0.76rem;
}

.stage {
  position: relative;
  display: grid;
  align-items: end;
  min-height: 0;
  overflow: hidden;
  border: 5px solid rgba(255, 255, 255, 0.78);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.78) 0%, rgba(255, 255, 255, 0.44) 54%, rgba(255, 255, 255, 0.22) 100%),
    linear-gradient(135deg, #fff3a4 0%, #ffd0e2 36%, #baf3ff 67%, #ddffd8 100%);
  box-shadow: var(--shadow);
}

.music-sky {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.staff-line {
  position: absolute;
  left: 5%;
  right: 5%;
  height: 5px;
  border-radius: 999px;
  background: rgba(38, 48, 68, 0.12);
}

.staff-line.one {
  top: 20%;
}

.staff-line.two {
  top: 30%;
}

.staff-line.three {
  top: 40%;
}

.floating-note {
  position: absolute;
  color: rgba(75, 69, 150, 0.33);
  font-weight: 1000;
  line-height: 1;
  animation: floatNote 4s ease-in-out infinite;
}

.note-one {
  top: 14%;
  left: 15%;
  font-size: clamp(3rem, 8vw, 6rem);
}

.note-two {
  top: 22%;
  right: 16%;
  font-size: clamp(2.8rem, 7vw, 5.6rem);
  animation-delay: -1.5s;
}

.note-three {
  top: 48%;
  left: 47%;
  font-size: clamp(2.3rem, 5vw, 4.4rem);
  animation-delay: -2.7s;
}

@keyframes floatNote {
  0%,
  100% {
    transform: translateY(0) rotate(-5deg);
  }

  50% {
    transform: translateY(-14px) rotate(6deg);
  }
}

.sparkle-layer {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.sparkle {
  position: absolute;
  width: 16px;
  height: 16px;
  border-radius: 4px;
  background: var(--sparkle-color, #ffe66d);
  opacity: 0;
  transform: translate(-50%, -50%) rotate(45deg) scale(0.35);
  animation: sparklePop 780ms ease-out forwards;
}

@keyframes sparklePop {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) rotate(45deg) scale(0.2);
  }

  20% {
    opacity: 1;
  }

  100% {
    opacity: 0;
    transform: translate(calc(-50% + var(--sparkle-x, 0px)), calc(-50% + var(--sparkle-y, -90px))) rotate(160deg) scale(1);
  }
}

.piano {
  position: relative;
  z-index: 2;
  width: min(1060px, calc(100% - 28px));
  height: clamp(330px, 58vh, 560px);
  margin: 0 auto clamp(14px, 3vh, 28px);
  padding: clamp(12px, 2vw, 18px);
  border: 6px solid rgba(255, 255, 255, 0.86);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(255, 255, 255, 0.18)),
    linear-gradient(90deg, var(--rose), var(--tangerine), var(--lemon), var(--leaf), var(--aqua), var(--blue), var(--violet));
  box-shadow: 0 18px 0 rgba(38, 48, 68, 0.12), 0 24px 42px rgba(38, 48, 68, 0.24);
}

.white-keys {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  height: 100%;
  gap: 5px;
}

.piano-key {
  position: relative;
  display: grid;
  align-content: end;
  justify-items: center;
  min-width: 0;
  overflow: hidden;
  user-select: none;
}

.piano-key span {
  font-weight: 1000;
  letter-spacing: 0;
}

.piano-key small {
  margin: 4px 0 clamp(12px, 3vh, 25px);
  font-size: clamp(0.74rem, 1.8vw, 1.04rem);
  font-weight: 950;
}

.white {
  height: 100%;
  border: 3px solid rgba(38, 48, 68, 0.18);
  border-radius: 8px;
  background:
    linear-gradient(180deg, #ffffff 0%, #fffdf7 60%, var(--key-color, #ffdce9) 100%);
  box-shadow: inset 0 -11px 0 rgba(38, 48, 68, 0.08), 0 8px 0 rgba(38, 48, 68, 0.13);
  color: #253044;
}

.white span {
  font-size: clamp(1.75rem, 5vw, 3.8rem);
  line-height: 1;
}

.c {
  --key-color: #ffd7e6;
}

.d {
  --key-color: #ffe1b7;
}

.e {
  --key-color: #fff3a6;
}

.f {
  --key-color: #d7fad5;
}

.g {
  --key-color: #c9f5ff;
}

.a {
  --key-color: #d7e0ff;
}

.b {
  --key-color: #e9dcff;
}

.c-high {
  --key-color: #ffd7e6;
}

.black-keys {
  position: absolute;
  inset: clamp(12px, 2vw, 18px);
  pointer-events: none;
}

.black {
  position: absolute;
  top: 0;
  width: 8.8%;
  height: 58%;
  border: 4px solid rgba(255, 255, 255, 0.18);
  border-radius: 0 0 8px 8px;
  background: linear-gradient(180deg, #30354d 0%, #111827 72%, #080a13 100%);
  box-shadow: inset 0 -10px 0 rgba(255, 255, 255, 0.08), 0 9px 0 rgba(38, 48, 68, 0.22), 0 12px 24px rgba(38, 48, 68, 0.24);
  color: #ffffff;
  pointer-events: auto;
}

.black span {
  margin-bottom: 16px;
  font-size: clamp(0.86rem, 2vw, 1.3rem);
}

.cs {
  left: 8.3%;
}

.ds {
  left: 21%;
}

.fs {
  left: 46.2%;
}

.gs {
  left: 58.8%;
}

.as {
  left: 71.4%;
}

.piano-key.is-active,
.piano-key.is-song {
  filter: saturate(1.2);
}

.white.is-active,
.white.is-song {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(255, 255, 255, 0.3)),
    var(--active-color, #ff629a);
  box-shadow: inset 0 -5px 0 rgba(38, 48, 68, 0.08), 0 3px 0 rgba(38, 48, 68, 0.13);
  transform: translateY(5px);
}

.black.is-active,
.black.is-song {
  background: linear-gradient(180deg, var(--active-color, #5bd7ff), #263044);
  box-shadow: inset 0 -4px 0 rgba(255, 255, 255, 0.08), 0 3px 0 rgba(38, 48, 68, 0.22), 0 8px 16px rgba(38, 48, 68, 0.2);
  transform: translateY(5px);
}

@media (max-width: 760px) {
  body {
    overflow: auto;
  }

  .game-shell {
    min-height: 100svh;
    height: auto;
  }

  .topbar {
    grid-template-columns: 46px minmax(0, 1fr);
  }

  .home-link {
    width: 46px;
    height: 46px;
  }

  .now-playing {
    grid-column: 1 / -1;
    justify-self: stretch;
    max-width: none;
  }

  .song-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .stop-button {
    grid-column: 1 / -1;
  }

  .stage {
    min-height: 520px;
  }

  .piano {
    width: calc(100% - 16px);
    height: 390px;
    padding: 8px;
  }

  .white-keys {
    gap: 3px;
  }

  .black-keys {
    inset: 8px;
  }

  .black {
    width: 9.5%;
  }
}

@media (max-width: 430px) {
  .song-button,
  .stop-button {
    min-height: 52px;
  }

  .black span {
    font-size: 0.76rem;
  }
}
