:root {
  color: #203047;
  background: #f7fbff;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    linear-gradient(180deg, #f7fbff 0%, #eef8fb 100%);
}

button,
select {
  font: inherit;
}

.app-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 40px;
}

.app-shell::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(circle at 14% 18%, rgba(255, 207, 90, 0.22), transparent 20rem),
    radial-gradient(circle at 86% 24%, rgba(24, 169, 189, 0.16), transparent 22rem);
}

body.game-active {
  background:
    linear-gradient(180deg, rgba(247, 251, 255, 0.05), rgba(238, 248, 251, 0.22)),
    url("../assets/song-bg-mary-lamb.png") center top / cover fixed;
}

body.game-active.song-bg-mary-lamb {
  background:
    linear-gradient(180deg, rgba(247, 251, 255, 0.05), rgba(238, 248, 251, 0.22)),
    url("../assets/song-bg-mary-lamb.png") center top / cover fixed;
}

body.game-active.song-bg-hot-cross-buns {
  background:
    linear-gradient(180deg, rgba(247, 251, 255, 0.05), rgba(238, 248, 251, 0.22)),
    url("../assets/song-bg-hot-cross-buns.png") center top / cover fixed;
}

body.game-active.song-bg-twinkle-start {
  background:
    linear-gradient(180deg, rgba(247, 251, 255, 0.05), rgba(238, 248, 251, 0.22)),
    url("../assets/song-bg-twinkle-start.png") center top / cover fixed;
}

body.game-active.song-bg-ode-to-joy {
  background:
    linear-gradient(180deg, rgba(247, 251, 255, 0.05), rgba(238, 248, 251, 0.22)),
    url("../assets/song-bg-ode-to-joy.png") center top / cover fixed;
}

body.game-active.song-bg-jingle-bells {
  background:
    linear-gradient(180deg, rgba(247, 251, 255, 0.05), rgba(238, 248, 251, 0.22)),
    url("../assets/song-bg-jingle-bells.png") center top / cover fixed;
}

body.game-active.song-bg-bach-doorway {
  background:
    radial-gradient(circle at 24% 20%, rgba(255, 207, 90, 0.24), transparent 17rem),
    linear-gradient(180deg, rgba(255, 250, 232, 0.08), rgba(226, 246, 255, 0.24)),
    url("../assets/bach-study-room-bg.png") center top / cover fixed;
}

body.game-active.song-bg-bach-lantern {
  background:
    radial-gradient(circle at 72% 18%, rgba(129, 222, 232, 0.24), transparent 17rem),
    linear-gradient(180deg, rgba(244, 252, 255, 0.08), rgba(255, 244, 211, 0.24)),
    url("../assets/bach-study-room-bg.png") center top / cover fixed;
}

body.game-active.song-bg-bach-cadence {
  background:
    radial-gradient(circle at 54% 20%, rgba(185, 155, 255, 0.22), transparent 17rem),
    linear-gradient(180deg, rgba(249, 245, 255, 0.08), rgba(230, 249, 255, 0.24)),
    url("../assets/bach-study-room-bg.png") center top / cover fixed;
}

body.game-active.song-bg-firefly-violin {
  background:
    radial-gradient(circle at 72% 18%, rgba(255, 207, 90, 0.3), transparent 18rem),
    linear-gradient(180deg, rgba(255, 246, 218, 0.08), rgba(222, 244, 255, 0.24)),
    url("../assets/kid-music-room-bg.png") center top / cover fixed;
}

body.game-active.song-bg-pirate-fiddle {
  background:
    radial-gradient(circle at 20% 26%, rgba(129, 216, 200, 0.26), transparent 18rem),
    linear-gradient(180deg, rgba(241, 252, 255, 0.06), rgba(255, 232, 184, 0.24)),
    url("../assets/kid-music-room-bg.png") center top / cover fixed;
}

body.game-active.song-bg-moonbeam-concerto {
  background:
    radial-gradient(circle at 62% 20%, rgba(185, 155, 255, 0.28), transparent 18rem),
    linear-gradient(180deg, rgba(246, 242, 255, 0.08), rgba(229, 249, 255, 0.22)),
    url("../assets/kid-music-room-bg.png") center top / cover fixed;
}

body.game-active.song-bg-dragonfly-strings {
  background:
    radial-gradient(circle at 78% 24%, rgba(129, 216, 200, 0.28), transparent 18rem),
    linear-gradient(180deg, rgba(239, 255, 247, 0.08), rgba(255, 244, 211, 0.24)),
    url("../assets/kid-music-room-bg.png") center top / cover fixed;
}

body.game-active.song-bg-shooting-star-serenade {
  background:
    radial-gradient(circle at 64% 16%, rgba(255, 207, 90, 0.34), transparent 18rem),
    linear-gradient(180deg, rgba(247, 243, 255, 0.08), rgba(221, 246, 255, 0.24)),
    url("../assets/kid-music-room-bg.png") center top / cover fixed;
}

body.game-active.song-bg-wild-horse-tarantella {
  background:
    radial-gradient(circle at 22% 22%, rgba(255, 173, 105, 0.28), transparent 18rem),
    linear-gradient(180deg, rgba(255, 246, 232, 0.08), rgba(235, 246, 255, 0.24)),
    url("../assets/kid-music-room-bg.png") center top / cover fixed;
}

body.game-active .app-shell::before {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.16)),
    radial-gradient(circle at 50% 58%, rgba(255, 255, 255, 0.08), transparent 24rem);
}

.hero {
  position: relative;
  min-height: 300px;
  overflow: hidden;
  border-radius: 8px;
  background: #21405f;
  color: #fff;
  box-shadow: 0 22px 52px rgba(25, 39, 58, 0.2);
}

.hero img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(22, 42, 64, 0.88), rgba(22, 42, 64, 0.38) 58%, rgba(22, 42, 64, 0.06));
}

.hero-copy {
  position: relative;
  z-index: 1;
  width: min(560px, 100%);
  padding: 48px;
}

.eyebrow {
  margin: 0 0 8px;
  color: #0b7f91;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.hero .eyebrow {
  color: #ffd15c;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 14px;
  max-width: 11ch;
  font-size: clamp(2.3rem, 6vw, 4.9rem);
  line-height: 0.96;
  letter-spacing: 0;
}

.hero-copy p:last-child {
  max-width: 36rem;
  margin-bottom: 0;
  font-size: 1.1rem;
  line-height: 1.55;
}

.lesson-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 18px 0;
}

.mode-launcher {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 0 0 18px;
}

.mode-launcher button {
  min-height: 112px;
  padding: 18px;
  border: 2px solid rgba(255, 255, 255, 0.82);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(255, 246, 218, 0.94));
  color: #203047;
  text-align: left;
  box-shadow: 0 14px 30px rgba(36, 58, 86, 0.12);
  cursor: pointer;
}

.mode-launcher button:nth-child(2) {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(238, 234, 255, 0.96));
}

.mode-launcher button:nth-child(3) {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(222, 248, 232, 0.96));
}

.mode-launcher span {
  display: block;
  margin-bottom: 8px;
  color: #0b7f91;
  font-size: 0.82rem;
  font-weight: 950;
  text-transform: uppercase;
}

.mode-launcher strong {
  display: block;
  font-size: 1.25rem;
  line-height: 1.15;
}

.mode-launcher small {
  display: inline-block;
  margin-top: 12px;
  padding: 5px 8px;
  border-radius: 999px;
  background: rgba(24, 169, 189, 0.1);
  color: #0b6170;
  font-weight: 900;
}

.lesson-strip article,
.song-panel,
.staff-card {
  border: 1px solid #d6e4ee;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(12px);
  box-shadow: 0 10px 28px rgba(36, 58, 86, 0.08);
}

.lesson-strip article {
  padding: 18px;
}

.lesson-strip span {
  display: inline-grid;
  width: 32px;
  height: 32px;
  margin-bottom: 10px;
  place-items: center;
  border-radius: 50%;
  background: #ffcf5a;
  color: #17283c;
  font-weight: 900;
}

.lesson-strip h2,
.staff-card h2,
.panel-heading h2 {
  margin-bottom: 8px;
  font-size: 1.18rem;
}

.lesson-strip p,
.song-facts p,
.coach,
.staff-card p {
  color: #53657a;
  line-height: 1.45;
}

.home-lesson-lab {
  display: grid;
  grid-template-columns: minmax(230px, 0.78fr) minmax(320px, 1.05fr);
  gap: 12px;
  align-items: stretch;
  margin: 0 0 18px;
}

.home-lab-copy,
.home-note-board,
.home-micro-lessons button {
  border: 1px solid #d6e4ee;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 10px 28px rgba(36, 58, 86, 0.08);
  backdrop-filter: blur(10px);
}

.home-lab-copy {
  display: grid;
  align-content: center;
  min-height: 180px;
  padding: 22px;
  background:
    linear-gradient(135deg, rgba(255, 244, 201, 0.98), rgba(238, 248, 251, 0.96));
}

.home-lab-copy h2 {
  max-width: 12ch;
  margin-bottom: 10px;
  color: #203047;
  font-size: clamp(1.75rem, 3vw, 2.55rem);
  line-height: 1;
}

.home-lab-copy p:last-child {
  margin-bottom: 0;
  color: #53657a;
  font-weight: 800;
  line-height: 1.42;
}

.home-note-board {
  display: grid;
  gap: 14px;
  padding: 18px;
}

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

.home-note-header span {
  display: inline-grid;
  min-height: 36px;
  place-items: center;
  padding: 0 12px;
  border-radius: 999px;
  background: #dff7fa;
  color: #0a7280;
  font-weight: 950;
}

.home-note-header strong {
  color: #203047;
  line-height: 1.3;
}

.home-note-row {
  display: grid;
  grid-template-columns: repeat(8, minmax(54px, 1fr));
  gap: 8px;
}

.home-note-row button {
  min-height: 78px;
  border: 2px solid #d6e4ee;
  border-radius: 8px 8px 14px 14px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(255, 247, 226, 0.96));
  color: #203047;
  font-size: 1.4rem;
  font-weight: 950;
  cursor: pointer;
  box-shadow: inset 0 -8px 0 rgba(255, 207, 90, 0.22);
  transition: transform 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
}

.home-note-row button:hover,
.home-note-row button.active,
.home-note-row button.demo {
  border-color: #18a9bd;
  transform: translateY(-3px);
  box-shadow:
    inset 0 -8px 0 rgba(24, 169, 189, 0.18),
    0 12px 22px rgba(24, 169, 189, 0.16);
}

.home-note-row button.demo {
  border-color: #ffcf5a;
  background: linear-gradient(180deg, #fff8dc, #ffe7a3);
}

.home-note-row small {
  display: block;
  margin-top: 4px;
  color: #607286;
  font-size: 0.68rem;
  font-weight: 950;
  text-transform: uppercase;
}

.home-micro-lessons {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.home-micro-lessons button {
  min-height: 118px;
  padding: 16px;
  color: #203047;
  text-align: left;
  cursor: pointer;
  transition: transform 140ms ease, border-color 140ms ease, background 140ms ease;
}

.home-micro-lessons button:nth-child(1) {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(223, 247, 250, 0.94));
}

.home-micro-lessons button:nth-child(2) {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(255, 246, 218, 0.94));
}

.home-micro-lessons button:nth-child(3) {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(238, 234, 255, 0.94));
}

.home-micro-lessons button:nth-child(4) {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(222, 248, 232, 0.94));
}

.home-micro-lessons button:hover,
.home-micro-lessons button.playing {
  border-color: #18a9bd;
  transform: translateY(-3px);
}

.home-micro-lessons span {
  display: block;
  margin-bottom: 8px;
  color: #0b7f91;
  font-size: 0.76rem;
  font-weight: 950;
  text-transform: uppercase;
}

.home-micro-lessons strong {
  display: block;
  font-size: 1.05rem;
  line-height: 1.15;
}

.home-micro-lessons small {
  display: inline-block;
  margin-top: 12px;
  padding: 5px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.68);
  color: #53657a;
  font-weight: 950;
}

.game-layout {
  display: grid;
  grid-template-columns: 330px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
  padding: 14px;
  border: 1px solid rgba(214, 228, 238, 0.85);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 24px 70px rgba(25, 39, 58, 0.14);
  backdrop-filter: blur(10px);
}

body:not(.game-active) .game-layout {
  display: none;
}

body.game-active .hero,
body.game-active .lesson-strip,
body.game-active .mode-launcher {
  display: none;
}

body.game-active .app-shell {
  width: min(1280px, calc(100% - 24px));
  height: 100vh;
  min-height: 100vh;
  overflow: hidden;
  padding-top: 18px;
}

body.game-active .game-layout {
  position: relative;
  height: calc(100vh - 36px);
  min-height: 0;
  grid-template-columns: minmax(235px, 255px) minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0 8px 80px 0;
  border-color: transparent;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
  scrollbar-color: rgba(24, 169, 189, 0.72) rgba(255, 255, 255, 0.36);
  scrollbar-width: auto;
}

body.game-active .game-layout::-webkit-scrollbar {
  width: 14px;
}

body.game-active .game-layout::-webkit-scrollbar-track {
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.36);
}

body.game-active .game-layout::-webkit-scrollbar-thumb {
  border: 3px solid rgba(255, 255, 255, 0.72);
  border-radius: 999px;
  background: rgba(24, 169, 189, 0.72);
}

body.game-active .piano-stage {
  display: grid;
  grid-template-areas:
    "staff"
    "piano"
    "track"
    "helpers";
  gap: clamp(7px, 1vh, 10px);
  align-content: start;
  justify-items: center;
  min-height: auto;
  padding: clamp(10px, 1.6vh, 18px) 20px max(72px, 8vh);
}

body.game-active .piano-wrap {
  grid-area: piano;
  width: min(620px, 72vw);
  margin: 0 auto;
}

body.game-active .piano-top {
  margin-bottom: 8px;
}

body.game-active .keyboard-map {
  justify-content: center;
}

body.game-active .note-track {
  grid-area: track;
  width: min(640px, 72vw);
  margin-inline: auto;
}

body.game-active .rhythm-card {
  grid-area: rhythm;
  width: min(640px, 72vw);
}

body.game-active .melody-lens {
  grid-area: melody;
  width: min(640px, 72vw);
}

body.game-active .brain-link-card {
  width: min(640px, 72vw);
}

body.game-active .staff-card {
  grid-area: staff;
  width: min(640px, 72vw);
}

body.game-active .key-bed {
  height: clamp(160px, 17vw, 220px);
}

body.game-active .staff-card,
body.game-active .rhythm-card,
body.game-active .melody-lens,
body.game-active .brain-link-card,
body.game-active .note-track {
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(4px);
}

body.game-active .staff-card {
  grid-template-columns: minmax(0, 1fr) minmax(160px, 220px);
  min-height: 66px;
  padding: 12px 16px;
}

body.game-active .staff-card p:last-child {
  margin-top: 4px;
  font-size: 0.9rem;
  line-height: 1.3;
}

body.game-active .mini-staff {
  height: 58px;
}

body.game-active .rhythm-card,
body.game-active .melody-lens,
body.game-active .brain-link-card {
  min-height: 74px;
  margin-top: 0;
  padding: 12px 14px;
}

body.game-active .note-track {
  min-height: 50px;
  margin-top: 0;
  padding: 8px;
}

body.game-active .helper-menu {
  grid-area: helpers;
  width: min(640px, 72vw);
  border: 1px solid rgba(214, 228, 238, 0.92);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.76);
  box-shadow: 0 10px 28px rgba(36, 58, 86, 0.08);
  backdrop-filter: blur(4px);
}

body.game-active .helper-menu summary {
  min-height: 44px;
  padding: 11px 14px;
  color: #203047;
  font-weight: 950;
  cursor: pointer;
}

body.game-active .helper-menu summary:hover {
  color: #0b7f91;
}

body.game-active .helper-menu summary::marker {
  color: #18a9bd;
}

body.game-active .helper-menu-grid {
  display: block;
  width: 100%;
  padding: 0 10px 10px;
}

body.game-active .helper-menu .brain-link-card,
body.game-active .helper-menu .rhythm-card,
body.game-active .helper-menu .melody-lens {
  width: 100% !important;
  max-width: none;
  box-sizing: border-box;
  margin-top: 10px;
  box-shadow: none;
}

body.game-active .helper-menu-end {
  margin: 10px 2px 0;
  color: #607286;
  font-size: 0.86rem;
  font-weight: 850;
  text-align: center;
}

@media (min-width: 821px) {
  body.game-active .piano-stage {
    padding-left: 0;
  }

  body.game-active .piano-wrap {
    width: min(680px, 64vw);
  }

  body.game-active .staff-card,
  body.game-active .rhythm-card,
  body.game-active .melody-lens,
  body.game-active .brain-link-card,
  body.game-active .note-track,
  body.game-active .helper-menu {
    width: min(680px, 64vw);
  }
}

@media (min-width: 821px) and (max-height: 780px) {
  body.game-active .song-panel {
    width: 240px;
    padding: 12px;
  }

  body.game-active .piano-stage {
    padding-top: 8px;
  }

  body.game-active .staff-card {
    min-height: 60px;
    padding-block: 10px;
  }

  body.game-active .mini-staff {
    height: 52px;
  }

  body.game-active .song-facts .song-tip,
  body.game-active .buddy-card p {
    display: none;
  }

  body.game-active .song-facts .note-line {
    max-height: 46px;
  }
}

body.game-active .song-panel {
  position: relative;
  top: auto;
  left: auto;
  z-index: 4;
  width: 100%;
  max-height: none;
  overflow: visible;
  padding: 14px;
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(6px);
  transition: transform 180ms ease;
}

@media (min-width: 821px) and (max-height: 780px) {
  body.game-active .song-panel {
    width: 240px;
    padding: 12px;
  }
}

body.game-active.focus-mode .song-panel {
  display: none;
}

body.game-active.focus-mode .game-layout {
  grid-template-columns: minmax(0, 1fr);
}

body.game-active.focus-mode .piano-stage {
  padding-left: 20px;
}

body.game-active.focus-mode .piano-wrap,
body.game-active.focus-mode .staff-card,
body.game-active.focus-mode .rhythm-card,
body.game-active.focus-mode .melody-lens,
body.game-active.focus-mode .brain-link-card,
body.game-active.focus-mode .note-track,
body.game-active.focus-mode .helper-menu {
  width: min(720px, 78vw);
}

body.game-active .song-facts {
  min-height: 0;
  margin-top: 10px;
}

body.game-active .song-facts .goal-row,
body.game-active .voice-plan,
body.game-active .keyboard-map {
  display: none;
}

body.game-active .song-facts p {
  margin-block: 6px;
  line-height: 1.32;
}

body.game-active .practice-path {
  gap: 5px;
}

body.game-active .practice-path li {
  min-height: 28px;
  padding-block: 5px;
}

body.game-active .song-facts .song-tip {
  display: none;
  font-size: 0.9rem;
}

body.game-active .song-facts .note-line {
  max-height: 68px;
  padding: 9px;
  overflow: auto;
  font-size: 0.82rem;
  line-height: 1.45;
}

body.game-active .next-note-card {
  margin: 10px 0;
  padding: 11px;
}

body.game-active .stat-row div {
  min-height: 44px;
}

body.game-active .stat-row strong {
  font-size: 1.08rem;
}

body.game-active .back-button {
  min-height: 34px;
  margin-bottom: 10px;
}

body.game-active .song-panel h2 {
  font-size: 1.12rem;
  line-height: 1.15;
}

body.game-active .select-label {
  margin-bottom: 5px;
}

body.game-active select {
  min-height: 38px;
}

body.game-active .buddy-card {
  grid-template-columns: 68px 1fr;
  gap: 9px;
  margin-top: 10px;
  padding: 8px;
}

body.game-active .buddy-card img {
  width: 68px;
  height: 68px;
}

body.game-active .buddy-card strong {
  font-size: 1.08rem;
}

body.game-active .buddy-card p {
  font-size: 0.92rem;
  line-height: 1.25;
}

body.game-active .note-pill {
  min-width: 38px;
  min-height: 34px;
}

body.game-active .brain-link-card h2,
body.game-active .rhythm-card h2,
body.game-active .melody-lens h2 {
  margin-bottom: 8px;
  font-size: 1rem;
}

body.game-active .brain-link-grid {
  gap: 7px;
}

body.game-active .brain-link-grid div {
  min-height: 58px;
  padding: 8px;
}

body.game-active .brain-link-grid strong {
  font-size: 0.8rem;
  line-height: 1.18;
}

body.game-active .rhythm-card {
  grid-template-columns: minmax(165px, 0.7fr) minmax(0, 1fr);
  gap: 10px;
}

body.game-active .helper-menu .rhythm-card {
  grid-template-areas:
    "title beat beat"
    "text text tap";
  grid-template-columns: minmax(150px, 0.45fr) minmax(0, 1fr) auto;
  align-items: center;
}

body.game-active .helper-menu .rhythm-card > div:first-child {
  grid-area: title;
}

body.game-active .helper-menu .rhythm-card .beat-row {
  grid-area: beat;
}

body.game-active .helper-menu #rhythmText {
  grid-area: text;
}

body.game-active .helper-menu .tap-beat {
  grid-area: tap;
}

body.game-active .beat-row {
  gap: 6px;
}

body.game-active .beat-row span {
  min-width: 34px;
  min-height: 30px;
}

body.game-active .melody-lens {
  grid-template-columns: minmax(165px, 0.65fr) minmax(0, 1fr);
  gap: 10px;
}

body.game-active .helper-menu .melody-lens {
  grid-template-areas: "title sky";
  grid-template-columns: minmax(150px, 0.36fr) minmax(0, 1fr);
  align-items: center;
}

body.game-active .helper-menu .melody-lens > div:first-child {
  grid-area: title;
}

body.game-active .helper-menu .melody-sky {
  grid-area: sky;
}

body.game-active .melody-sky {
  height: 58px;
}

.back-button {
  width: 100%;
  min-height: 40px;
  margin-bottom: 14px;
  border: 1px solid #d6e4ee;
  border-radius: 8px;
  background: #fff;
  color: #33465d;
  font-weight: 950;
  cursor: pointer;
}

.voice-plan {
  margin-top: 12px;
  border: 1px solid #d6e4ee;
  border-radius: 8px;
  background: #fbfdff;
}

.voice-plan summary {
  min-height: 42px;
  padding: 10px 12px;
  color: #203047;
  font-weight: 950;
  cursor: pointer;
}

.voice-plan p {
  margin: 0;
  padding: 0 12px 10px;
  color: #53657a;
  font-weight: 800;
}

.voice-plan ul {
  display: grid;
  gap: 8px;
  max-height: 230px;
  margin: 0;
  padding: 0 12px 12px;
  overflow: auto;
  list-style: none;
}

.voice-plan li {
  display: grid;
  gap: 3px;
  padding: 8px;
  border-radius: 8px;
  background: #eef8fb;
}

.voice-plan li strong {
  color: #0b7f91;
  font-size: 0.8rem;
}

.voice-plan li span {
  color: #33465d;
  line-height: 1.3;
}

.song-panel {
  padding: 20px;
}

.select-label {
  display: block;
  margin-bottom: 8px;
  color: #384a5e;
  font-weight: 800;
}

select {
  width: 100%;
  min-height: 44px;
  border: 1px solid #bfd1df;
  border-radius: 8px;
  background: #fff;
  color: #203047;
  padding: 0 12px;
}

.buddy-card {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 12px;
  align-items: center;
  margin-top: 14px;
  padding: 10px;
  border: 1px solid #d6e4ee;
  border-radius: 8px;
  background: #fbfdff;
}

.buddy-card img {
  width: 92px;
  height: 92px;
  object-fit: cover;
  border: 3px solid #fff;
  border-radius: 8px;
  box-shadow: 0 8px 18px rgba(32, 48, 71, 0.14);
}

.buddy-card span {
  color: #0b7f91;
  font-size: 0.74rem;
  font-weight: 950;
  text-transform: uppercase;
}

.buddy-card strong {
  display: block;
  margin: 2px 0 4px;
  color: #203047;
  font-size: 1.25rem;
}

.buddy-card p {
  margin-bottom: 0;
  color: #53657a;
  font-weight: 800;
  line-height: 1.35;
}

.buddy-picker {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 8px;
}

.buddy-choice {
  min-height: 38px;
  border: 1px solid #bfd1df;
  border-radius: 8px;
  background: #fff;
  color: #33465d;
  font-weight: 950;
  cursor: pointer;
}

.buddy-choice.active {
  border-color: #ffcf5a;
  background: #fff4c9;
  color: #5b4600;
}

.song-facts {
  min-height: 150px;
  margin-top: 16px;
}

.note-line {
  padding: 12px;
  overflow-wrap: anywhere;
  border-radius: 8px;
  background: #eef8fb;
  color: #0d6574;
  font-weight: 900;
  line-height: 1.8;
}

.practice-path-row {
  display: grid;
  gap: 7px;
  margin: 10px 0;
}

.practice-path {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: practice-step;
}

.practice-path li {
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 7px;
  align-items: center;
  min-height: 30px;
  padding: 6px 8px;
  border: 1px solid #d8e9ef;
  border-radius: 8px;
  background: rgba(238, 248, 251, 0.78);
  color: #33465d;
  font-size: 0.82rem;
  font-weight: 900;
  line-height: 1.2;
}

.practice-path li::before {
  counter-increment: practice-step;
  content: counter(practice-step);
  display: grid;
  width: 20px;
  height: 20px;
  place-items: center;
  border-radius: 50%;
  background: #ffcf5a;
  color: #17283c;
  font-size: 0.72rem;
  font-weight: 950;
}

.mini-label {
  display: inline-block;
  margin-right: 4px;
  color: #0b7f91;
  font-size: 0.72rem;
  font-weight: 950;
  text-transform: uppercase;
}

.next-note-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 12px;
  align-items: center;
  margin: 18px 0;
  padding: 16px;
  border-radius: 8px;
  background: #203047;
  color: #fff;
}

.next-note-card span {
  color: #aee9f1;
  font-weight: 800;
}

.next-note-card strong {
  grid-row: span 2;
  font-size: 3rem;
  line-height: 1;
  color: #ffcf5a;
}

body.game-active.needs-help .next-note-card {
  outline: 3px solid rgba(255, 207, 90, 0.82);
  box-shadow: 0 0 0 6px rgba(255, 207, 90, 0.2), 0 16px 28px rgba(32, 48, 71, 0.18);
}

body.game-active.needs-help .next-note-card strong {
  animation: helper-bounce 760ms ease-in-out infinite alternate;
}

.next-note-card small {
  font-weight: 800;
}

.next-note-card em {
  grid-column: 1 / -1;
  display: block;
  margin-top: 4px;
  padding: 7px 9px;
  border-radius: 7px;
  background: rgba(255, 207, 90, 0.14);
  color: #ffeeb2;
  font-size: 0.82rem;
  font-style: normal;
  font-weight: 900;
  line-height: 1.25;
}

body[data-assist="hint"] .next-note-card em,
body[data-assist="guided"] .next-note-card em {
  background: rgba(255, 207, 90, 0.24);
  color: #fff5cb;
}

body[data-assist="guided"] .next-note-card {
  border: 2px solid rgba(255, 207, 90, 0.88);
}

.progress {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #d9e7ef;
}

.progress div {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #18a9bd, #ffcf5a);
  transition: width 180ms ease;
}

.stat-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 12px;
}

.stat-row div {
  min-height: 66px;
  padding: 10px;
  border: 1px solid #d6e4ee;
  border-radius: 8px;
  background: #fbfdff;
}

.stat-row span {
  display: block;
  color: #607286;
  font-size: 0.75rem;
  font-weight: 900;
  text-transform: uppercase;
}

.stat-row strong {
  color: #203047;
  font-size: 1.35rem;
}

.star-bank {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 4px;
  margin-top: 10px;
  padding: 8px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.64);
}

.star-bank span {
  display: grid;
  min-height: 22px;
  place-items: center;
  border-radius: 6px;
  background: #eef3f7;
  color: #9aabb8;
  font-size: 0.78rem;
  font-weight: 950;
}

.star-bank span.filled {
  background: #fff4c9;
  color: #8a6500;
  box-shadow: inset 0 0 0 2px #ffcf5a;
}

.level-message {
  margin: 8px 0 0;
  color: #53657a;
  font-size: 0.86rem;
  font-weight: 800;
  line-height: 1.35;
}

.level-path {
  display: grid;
  gap: 7px;
  margin-top: 12px;
}

.level-step {
  display: grid;
  gap: 2px;
  padding: 8px 10px;
  border: 1px solid #d6e4ee;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.76);
  color: #203047;
  text-align: left;
  cursor: pointer;
}

.level-step span {
  color: #607286;
  font-size: 0.68rem;
  font-weight: 950;
  text-transform: uppercase;
}

.level-step strong {
  font-size: 0.84rem;
}

.level-step.current {
  border-color: #18a9bd;
  box-shadow: 0 0 0 2px rgba(24, 169, 189, 0.12);
}

.level-step.complete {
  border-color: #74d99f;
  background: #effaf3;
}

.level-step.next-up {
  border-color: #ffcf5a;
  background: #fff7d8;
}

.level-step.challenge-step {
  border-color: #cdbdff;
  background:
    linear-gradient(90deg, rgba(185, 155, 255, 0.2), rgba(255, 255, 255, 0.82));
}

.level-step.challenge-step span {
  color: #6250b5;
}

.level-step.challenge-step.next-up {
  border-color: #9d85ff;
  box-shadow: 0 0 0 2px rgba(157, 133, 255, 0.16);
}

.level-step.locked {
  opacity: 0.62;
}

.quest-card {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid #d6e4ee;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.74);
}

.quest-card ul {
  display: grid;
  gap: 7px;
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
}

.quest-card li {
  display: grid;
  grid-template-columns: 24px 1fr;
  gap: 8px;
  align-items: center;
  color: #53657a;
  font-size: 0.88rem;
  font-weight: 850;
}

.quest-card li span {
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border: 2px solid #cfe0ea;
  border-radius: 50%;
  background: #fff;
  color: #607286;
  font-size: 0.78rem;
}

.quest-card li.done {
  color: #176238;
}

.quest-card li.done span {
  border-color: #74d99f;
  background: #ddf8e8;
  color: #176238;
}

.quest-card li.next-quest span {
  border-color: #ffcf5a;
  background: #fff4c9;
  color: #5b4600;
}

.quest-card li[data-kind="recorder"]:not(.done) {
  color: #4938a6;
}

.quest-card li[data-kind="recorder"]:not(.done) span {
  border-color: #b9a8ff;
  background: #eeeaff;
  color: #4938a6;
}

.control-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 16px;
}

.control-row button {
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  background: #18a9bd;
  color: #fff;
  font-weight: 900;
  cursor: pointer;
}

.control-row button:nth-child(2) {
  background: #eef3f7;
  color: #203047;
}

.control-row button:last-child {
  background: #fff4c9;
  color: #5b4600;
}

.practice-tools {
  margin-top: 12px;
  border: 1px solid #d6e4ee;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.68);
}

.practice-tools summary {
  min-height: 42px;
  padding: 10px 12px;
  color: #203047;
  font-weight: 950;
  cursor: pointer;
}

.practice-tools > button,
.practice-tools .speed-control {
  width: calc(100% - 20px);
  margin-inline: 10px;
}

.practice-tools > button:last-child {
  margin-bottom: 10px;
}

.wide-toggle {
  width: 100%;
  min-height: 46px;
  margin-top: 10px;
  border: 2px solid #18a9bd;
  border-radius: 8px;
  background: #fff;
  color: #0a7280;
  font-weight: 950;
  cursor: pointer;
}

.wide-toggle[aria-pressed="true"] {
  border-color: #ffcf5a;
  background: #fff4c9;
  color: #5b4600;
}

.memory-toggle {
  margin-top: 12px;
  border-color: #7b61ff;
  color: #4938a6;
}

.memory-toggle[aria-pressed="true"] {
  border-color: #7b61ff;
  background: #eeeaff;
  color: #352586;
}

.speed-control {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 10px;
  padding: 10px;
  border: 1px solid #d6e4ee;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.64);
}

.speed-control span {
  grid-column: 1 / -1;
  color: #607286;
  font-size: 0.75rem;
  font-weight: 900;
  text-transform: uppercase;
}

.speed-control button {
  min-height: 36px;
  border: 1px solid #bfd3df;
  border-radius: 8px;
  background: #fff;
  color: #33465d;
  font-weight: 950;
  cursor: pointer;
}

.speed-control button.active {
  border-color: #ffcf5a;
  background: #fff4c9;
  color: #5b4600;
}

.recorder-tools {
  display: grid;
  gap: 9px;
  width: calc(100% - 20px);
  margin: 10px 10px 0;
  padding: 10px;
  border: 1px solid #d6e4ee;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
}

.recorder-tools label {
  color: #607286;
  font-size: 0.75rem;
  font-weight: 900;
  text-transform: uppercase;
}

.recorder-tools select {
  min-height: 38px;
}

.recorder-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
}

.recorder-row button,
.record-review button {
  min-height: 36px;
  border: 1px solid #bfd3df;
  border-radius: 8px;
  background: #fff;
  color: #33465d;
  font-weight: 950;
  cursor: pointer;
}

.recorder-row button:first-child[aria-pressed="true"] {
  border-color: #e45c44;
  background: #ffe6df;
  color: #8c2b1b;
}

.recorder-row button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.record-status {
  margin: 0;
  padding: 7px 9px;
  border-radius: 8px;
  background: #eef8fb;
  color: #53657a;
  font-size: 0.82rem;
  font-weight: 850;
  line-height: 1.3;
}

.record-status[data-state="recording"] {
  background: #ffe6df;
  color: #8c2b1b;
}

.record-status[data-state="clean"] {
  background: #ddf8e8;
  color: #176238;
}

.record-status[data-state="one-fix"],
.record-status[data-state="practice"],
.record-status[data-state="review"] {
  background: #fff4c9;
  color: #5b4600;
}

.record-review {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 9px;
  border-radius: 8px;
  background: #fff4c9;
}

.record-review[hidden] {
  display: none;
}

.record-review p {
  grid-column: 1 / -1;
  margin: 0;
  color: #5b4600;
  font-size: 0.84rem;
  font-weight: 900;
  line-height: 1.3;
}

.record-review button:last-child {
  border-color: #ffd0c2;
  color: #8c3b24;
}

.quiet-button {
  width: 100%;
  min-height: 42px;
  margin-top: 10px;
  border: 1px solid #d6e4ee;
  border-radius: 8px;
  background: #f8fbfd;
  color: #33465d;
  font-weight: 900;
  cursor: pointer;
}

.danger-button {
  border-color: #ffd0c2;
  color: #8c3b24;
}

.focus-button[aria-pressed="true"] {
  border-color: #18a9bd;
  background: #dff7fa;
  color: #0a7280;
}

.coach {
  min-height: 48px;
  margin: 16px 0 0;
  font-weight: 800;
}

.recent-action {
  margin: 12px 0 0;
  padding: 7px 9px;
  border-radius: 8px;
  background: #eef8fb;
  color: #0b7f91;
  font-size: 0.78rem;
  font-weight: 950;
}

.piano-stage {
  min-width: 0;
}

.staff-card {
  display: grid;
  grid-template-columns: minmax(150px, 0.6fr) minmax(130px, 0.4fr);
  gap: 16px;
  justify-content: space-between;
  align-items: center;
  min-height: 96px;
  padding: 18px;
}

.staff-card p:last-child {
  grid-column: 1 / -1;
  max-width: 460px;
  margin-bottom: 0;
}

.mini-staff {
  position: relative;
  height: 78px;
  min-width: 150px;
  overflow: hidden;
  border: 1px solid rgba(24, 169, 189, 0.18);
  border-radius: 8px;
  background:
    repeating-linear-gradient(0deg, rgba(32, 48, 71, 0.18) 0 2px, transparent 2px 15px),
    linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(241, 251, 253, 0.88));
}

.mini-staff span {
  position: absolute;
  left: 8px;
  color: rgba(32, 48, 71, 0.48);
  font-size: 0.62rem;
  font-weight: 950;
}

.mini-staff span:nth-child(1) { bottom: 8%; }
.mini-staff span:nth-child(2) { bottom: 20%; }
.mini-staff span:nth-child(3) { bottom: 32%; }
.mini-staff span:nth-child(4) { bottom: 44%; }
.mini-staff span:nth-child(5) { bottom: 56%; }

.mini-staff strong {
  position: absolute;
  right: 18px;
  display: grid;
  width: 34px;
  height: 26px;
  place-items: center;
  border: 2px solid rgba(255, 255, 255, 0.86);
  border-radius: 999px;
  background: var(--note-color, #ffd868);
  color: #203047;
  font-size: 0.86rem;
  font-weight: 950;
  transform: translateY(50%) rotate(-8deg);
  box-shadow: 0 8px 18px rgba(36, 58, 86, 0.16);
}

.rhythm-card {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  min-height: 92px;
  margin-top: 14px;
  padding: 16px;
  border: 1px solid #d6e4ee;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 10px 28px rgba(36, 58, 86, 0.08);
}

.rhythm-card h2 {
  margin-bottom: 0;
  font-size: 1.05rem;
}

#rhythmText {
  margin-bottom: 0;
}

.beat-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.beat-row span {
  display: grid;
  min-width: 38px;
  min-height: 34px;
  place-items: center;
  border: 2px solid #ffd868;
  border-radius: 999px;
  background: #fff6d8;
  color: #5b4600;
  font-size: 0.78rem;
  font-weight: 950;
}

.beat-row span.long-beat {
  min-width: 58px;
  border-color: #b99bff;
  background: #f1edff;
  color: #4938a6;
}

.beat-row span.active-beat {
  border-color: #18a9bd;
  background: #dff7fa;
  color: #0a7280;
  transform: translateY(-2px) scale(1.04);
}

.tap-beat {
  justify-self: start;
  min-height: 38px;
  padding: 8px 14px;
  border: 0;
  border-radius: 8px;
  background: #18a9bd;
  color: #fff;
  font-weight: 950;
  cursor: pointer;
}

.melody-lens {
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  min-height: 104px;
  margin-top: 14px;
  padding: 16px;
  border: 1px solid #d6e4ee;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 10px 28px rgba(36, 58, 86, 0.08);
}

.melody-lens h2 {
  margin-bottom: 0;
  font-size: 1.1rem;
}

.melody-sky {
  position: relative;
  height: 78px;
  overflow: hidden;
  border: 1px solid rgba(24, 169, 189, 0.18);
  border-radius: 8px;
  background:
    repeating-linear-gradient(0deg, rgba(24, 169, 189, 0.13) 0 2px, transparent 2px 18px),
    linear-gradient(180deg, rgba(255, 255, 255, 0.75), rgba(238, 248, 251, 0.72));
}

.brain-link-card {
  border: 1px solid #d6e4ee;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 10px 28px rgba(36, 58, 86, 0.08);
}

.brain-link-card h2 {
  margin-bottom: 10px;
  font-size: 1.08rem;
}

.brain-link-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.brain-link-grid div {
  min-height: 74px;
  padding: 10px;
  border: 1px solid color-mix(in srgb, #18a9bd 30%, #ffffff);
  border-radius: 8px;
  background: rgba(238, 248, 251, 0.86);
}

.brain-link-grid span {
  display: block;
  margin-bottom: 5px;
  color: #0b7f91;
  font-size: 0.72rem;
  font-weight: 950;
  text-transform: uppercase;
}

.brain-link-grid strong {
  display: block;
  color: #203047;
  font-size: 0.86rem;
  font-weight: 900;
  line-height: 1.25;
}

.tone-orb {
  position: absolute;
  left: 12px;
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 2px solid rgba(255, 255, 255, 0.85);
  border-radius: 50%;
  background: hsl(var(--tone-hue), 82%, 72%);
  color: #203047;
  font-weight: 950;
  box-shadow: 0 8px 18px rgba(36, 58, 86, 0.16);
  animation: tone-orb-drift 5s linear forwards;
}

@keyframes tone-orb-drift {
  from {
    transform: translateX(0);
    opacity: 0;
  }

  8% {
    opacity: 1;
  }

  to {
    transform: translateX(min(480px, 58vw));
    opacity: 0.72;
  }
}

.note-track {
  display: flex;
  gap: 8px;
  align-items: center;
  min-height: 58px;
  margin-top: 14px;
  padding: 10px;
  overflow-x: auto;
  border: 1px solid #d6e4ee;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  scrollbar-width: thin;
}

.note-track.free-track {
  flex-wrap: wrap;
  overflow: visible;
}

.note-pill {
  display: inline-grid;
  min-width: 42px;
  min-height: 38px;
  flex: 0 0 auto;
  gap: 1px;
  place-items: center;
  border: 2px solid #d6e4ee;
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(255, 255, 255, 0.92)),
    var(--note-color, #fff);
  color: #203047;
  font-weight: 950;
}

.note-pill strong,
.note-pill small {
  line-height: 1;
}

.note-pill small {
  color: rgba(32, 48, 71, 0.66);
  font-size: 0.66rem;
  font-weight: 900;
}

.note-pill.free-note {
  min-width: 58px;
  flex: 1 1 70px;
  border-color: color-mix(in srgb, var(--note-color, #9ee6ef) 72%, #ffffff);
  color: #18314b;
}

.note-pill.played {
  border-color: #74d99f;
  background: #ddf8e8;
  color: #176238;
}

.note-pill.locked {
  opacity: 0.42;
}

.note-pill.missing-note {
  border-color: #ff9a8f;
  background: #ffe8e5;
  color: #7f231b;
}

.note-pill.missing-note small {
  color: #7f231b;
}

.note-pill.next {
  border-color: #ffcf5a;
  background: #fff0b5;
  color: #5b4600;
  transform: translateY(-3px);
  box-shadow: 0 8px 16px rgba(255, 207, 90, 0.25);
}

.note-pill.watching {
  border-style: dashed;
}

.note-pill.demo-note {
  border-color: #7b61ff;
  background: #eeeaff;
  color: #352586;
  transform: translateY(-3px) scale(1.04);
}

.piano-wrap {
  margin-top: 18px;
  padding: 16px 18px 20px;
  border: 4px solid #fff;
  border-radius: 8px 8px 18px 18px;
  background:
    linear-gradient(180deg, rgba(255, 218, 103, 0.96), rgba(255, 155, 121, 0.98)),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.14) 0 1px, transparent 1px 24px);
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.55),
    inset 0 -10px 0 rgba(165, 79, 61, 0.13),
    0 20px 44px rgba(97, 71, 51, 0.2);
}

body[data-mode="free"] .piano-wrap {
  background:
    linear-gradient(180deg, rgba(129, 222, 232, 0.96), rgba(255, 218, 103, 0.98)),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.18) 0 1px, transparent 1px 24px);
}

body[data-mode="memory"] .piano-wrap {
  background:
    linear-gradient(180deg, rgba(185, 172, 255, 0.96), rgba(255, 207, 90, 0.98)),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.16) 0 1px, transparent 1px 24px);
}

.piano-top {
  display: flex;
  gap: 8px;
  align-items: center;
  min-height: 28px;
  margin-bottom: 10px;
}

.piano-top::before {
  content: "Piano Starters";
  margin-right: auto;
  color: #65411d;
  font-weight: 950;
}

.piano-top span {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(101, 65, 29, 0.22);
  border-radius: 50%;
  background:
    radial-gradient(circle, rgba(101, 65, 29, 0.42) 1px, transparent 2px) 0 0 / 5px 5px,
    rgba(255, 255, 255, 0.3);
}

.key-bed {
  position: relative;
  width: 100%;
  height: clamp(240px, 34vw, 360px);
  overflow: hidden;
  border: 2px solid rgba(101, 65, 29, 0.18);
  border-radius: 8px;
  background: #f5f0e8;
}

.piano-key {
  position: absolute;
  top: 0;
  border: 0;
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 100ms ease, background 100ms ease, box-shadow 100ms ease;
}

.white-key {
  display: flex;
  width: 12.5%;
  height: 100%;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  padding-bottom: 18px;
  border: 1px solid #d8cbb7;
  border-radius: 0 0 12px 12px;
  background:
    linear-gradient(180deg, #ffffff 0%, #fffaf0 78%, #f2ddbd 100%);
  color: #233247;
  box-shadow:
    inset 0 -12px 0 rgba(218, 157, 28, 0.09),
    inset 0 2px 0 rgba(255, 255, 255, 0.8);
}

.black-key {
  z-index: 2;
  display: flex;
  width: 9.8%;
  height: 62%;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  padding-bottom: 14px;
  border: 2px solid rgba(255, 255, 255, 0.14);
  border-radius: 0 0 10px 10px;
  background:
    linear-gradient(180deg, #455f7e 0%, #1a2a40 82%),
    linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.08), transparent);
  color: #fff;
  box-shadow: 0 10px 18px rgba(6, 14, 25, 0.32);
}

.piano-key span {
  font-size: 1.6rem;
  font-weight: 950;
}

.piano-key kbd {
  min-width: 36px;
  margin-top: 8px;
  padding: 5px 8px;
  border: 2px solid color-mix(in srgb, var(--note-color, #9ee6ef) 62%, #ffffff);
  border-radius: 999px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.42), rgba(255, 255, 255, 0.18)),
    var(--note-color, #9ee6ef);
  color: inherit;
  font-family: inherit;
  font-weight: 900;
}

.key-pointer {
  position: absolute;
  top: 12px;
  left: 50%;
  z-index: 4;
  display: none;
  min-width: 48px;
  padding: 6px 9px;
  border: 2px solid #fff;
  border-radius: 999px;
  background: #ffcf5a;
  color: #203047;
  font-size: clamp(0.62rem, 1.4vw, 0.74rem);
  font-style: normal;
  font-weight: 950;
  line-height: 1;
  pointer-events: none;
  text-transform: uppercase;
  transform: translateX(-50%);
  box-shadow: 0 8px 18px rgba(32, 48, 71, 0.18);
}

.piano-key.first-step-key .key-pointer {
  display: block;
  animation: first-step-pop 760ms ease-in-out infinite alternate;
}

.black-key .key-pointer {
  top: 7px;
  min-width: 40px;
  padding: 4px 6px;
  font-size: clamp(0.56rem, 1.1vw, 0.64rem);
}

body.game-active.needs-help .piano-key.target {
  animation: helper-key-glow 820ms ease-in-out infinite alternate;
}

body.game-active.needs-help .piano-key.target::after {
  position: absolute;
  right: 10px;
  bottom: 10px;
  left: 10px;
  z-index: 3;
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 207, 90, 0.9);
  content: "";
  box-shadow: 0 0 18px rgba(255, 207, 90, 0.8);
}

@keyframes helper-bounce {
  from {
    transform: translateY(0) scale(1);
  }

  to {
    transform: translateY(-2px) scale(1.08);
  }
}

@keyframes helper-key-glow {
  from {
    box-shadow: inset 0 0 0 3px rgba(24, 169, 189, 0.28), 0 0 0 rgba(255, 207, 90, 0);
  }

  to {
    box-shadow: inset 0 0 0 3px rgba(24, 169, 189, 0.42), 0 0 26px rgba(255, 207, 90, 0.74);
  }
}

@keyframes first-step-pop {
  from {
    transform: translate(-50%, 0);
  }

  to {
    transform: translate(-50%, -4px);
  }
}

.black-key kbd {
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.18);
}

.piano-key.active,
.piano-key.target {
  transform: translateY(5px);
}

.white-key.target {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(255, 255, 255, 0.12)),
    var(--note-color, #ffe17b);
  box-shadow: inset 0 -10px 0 rgba(218, 157, 28, 0.16), 0 0 0 4px #18a9bd, 0 0 24px rgba(24, 169, 189, 0.34);
}

.black-key.target {
  background: linear-gradient(#3f566f, #162236);
  box-shadow: 0 0 0 4px #ffcf5a, 0 0 24px rgba(255, 207, 90, 0.42), 0 10px 18px rgba(6, 14, 25, 0.35);
}

.white-key.demo,
.black-key.demo {
  background: #c8bfff;
  box-shadow: 0 0 0 4px rgba(123, 97, 255, 0.5), 0 0 28px rgba(123, 97, 255, 0.42);
  transform: translateY(7px);
}

.piano-key.active {
  background: var(--note-color, #9ee6ef);
  box-shadow: 0 0 0 4px rgba(24, 169, 189, 0.22), 0 0 24px rgba(24, 169, 189, 0.28);
}

.float-note {
  position: fixed;
  z-index: 30;
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 2px solid #ffcf5a;
  border-radius: 50%;
  background: #fff8d9;
  color: #203047;
  font-weight: 950;
  pointer-events: none;
  transform: translate(-50%, -50%);
  animation: float-note 760ms ease-out forwards;
}

.music-float {
  position: fixed;
  z-index: 29;
  color: #7b61ff;
  font-size: 2rem;
  font-weight: 950;
  pointer-events: none;
  text-shadow: 0 3px 0 rgba(255, 255, 255, 0.8), 0 8px 20px rgba(123, 97, 255, 0.24);
  transform: translate(-50%, 0);
  animation: music-float 1100ms ease-out var(--delay) forwards;
}

@keyframes music-float {
  from {
    opacity: 0;
    transform: translate(-50%, 0) scale(0.72) rotate(-8deg);
  }

  16% {
    opacity: 1;
  }

  to {
    opacity: 0;
    transform: translate(calc(-50% + var(--drift)), -132px) scale(1.22) rotate(12deg);
  }
}

@keyframes float-note {
  from {
    opacity: 0;
    transform: translate(-50%, 8px) scale(0.86);
  }

  18% {
    opacity: 1;
  }

  to {
    opacity: 0;
    transform: translate(-50%, -58px) scale(1);
  }
}

.reward-pop {
  position: fixed;
  left: 50%;
  top: 22%;
  z-index: 35;
  display: grid;
  min-width: 92px;
  min-height: 44px;
  place-items: center;
  padding: 8px 14px;
  border: 3px solid #ffcf5a;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.94);
  color: #5b4600;
  font-weight: 950;
  pointer-events: none;
  transform: translateX(-50%);
  animation: reward-pop 900ms ease-out forwards;
}

@keyframes reward-pop {
  0% {
    opacity: 0;
    transform: translate(-50%, 16px) scale(0.84);
  }

  20% {
    opacity: 1;
    transform: translate(-50%, 0) scale(1.05);
  }

  100% {
    opacity: 0;
    transform: translate(-50%, -44px) scale(0.96);
  }
}

.white-key.correct,
.black-key.correct {
  background: #74d99f;
}

.white-key.miss,
.black-key.miss {
  background: #ff9a8f;
}

.keyboard-map {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.map-chip {
  padding: 8px 10px;
  border: 1px solid #d6e4ee;
  border-radius: 999px;
  background: #fff;
  color: #33465d;
  font-weight: 800;
}

.celebration {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: none;
  place-items: center;
  padding: 24px;
  background: rgba(19, 32, 48, 0.22);
}

.celebration.show {
  display: grid;
}

.celebration-card {
  width: min(420px, 100%);
  padding: 24px;
  border: 3px solid #ffcf5a;
  border-radius: 8px;
  background: #fff;
  text-align: center;
  box-shadow: 0 24px 60px rgba(20, 32, 48, 0.28);
  animation: pop-in 220ms ease-out;
}

.celebration-card span {
  color: #0b7f91;
  font-weight: 950;
  text-transform: uppercase;
}

.celebration-card strong {
  display: block;
  margin: 8px 0;
  color: #203047;
  font-size: 1.7rem;
}

.celebration-card p {
  margin-bottom: 0;
  color: #53657a;
  font-weight: 800;
}

@keyframes pop-in {
  from {
    opacity: 0;
    transform: scale(0.92);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

@media (max-width: 820px) {
  .app-shell {
    width: min(100% - 20px, 720px);
    padding-top: 10px;
  }

  .hero {
    min-height: 420px;
  }

  .hero::after {
    background: linear-gradient(180deg, rgba(22, 42, 64, 0.92), rgba(22, 42, 64, 0.42));
  }

  .hero-copy {
    padding: 28px;
  }

  h1 {
    font-size: 3rem;
  }

  .lesson-strip,
  .home-lesson-lab,
  .mode-launcher,
  .game-layout {
    grid-template-columns: 1fr;
  }

  .home-micro-lessons {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .home-note-row {
    grid-template-columns: repeat(4, minmax(54px, 1fr));
  }

  .home-note-header {
    grid-template-columns: 1fr;
  }

  body.game-active .game-layout {
    height: auto;
    min-height: 0;
    grid-template-columns: 1fr;
    overflow-y: visible;
    padding-right: 0;
    padding-bottom: 32px;
  }

  body.game-active .piano-stage {
    min-height: auto;
    order: 1;
    padding: 0;
  }

  body.game-active .song-panel {
    position: relative;
    order: 2;
    top: auto;
    left: auto;
    width: 100%;
    max-height: none;
    margin-bottom: 18px;
  }

body.game-active .piano-wrap,
body.game-active .staff-card,
body.game-active .rhythm-card,
body.game-active .melody-lens,
body.game-active .brain-link-card,
body.game-active .note-track {
  width: min(680px, 100%);
}

  .staff-card,
  .rhythm-card {
    display: block;
  }

  .melody-lens,
  .rhythm-card,
  .brain-link-card {
    grid-template-columns: 1fr;
  }

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

  .key-bed {
    height: 260px;
  }

  .piano-key span {
    font-size: 1.05rem;
  }

  .white-key {
    padding-bottom: 12px;
  }
}

@media (max-width: 520px) {
  .hero {
    min-height: 460px;
  }

  .hero-copy {
    padding: 22px;
  }

  h1 {
    max-width: 10ch;
    font-size: 2.45rem;
  }

  .song-panel,
  .staff-card,
  .brain-link-card,
  .piano-wrap {
    padding: 14px;
  }

  .brain-link-grid {
    grid-template-columns: 1fr;
  }

  .brain-link-grid div {
    min-height: auto;
  }

  .key-bed {
    height: 220px;
  }

  .black-key {
    width: 10.8%;
  }

  .piano-key kbd {
    min-width: 24px;
    padding: 3px 5px;
    font-size: 0.78rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    scroll-behavior: auto !important;
    transition-duration: 1ms !important;
  }
}
