/* Note Ninjas — bright, bouncy, kid-friendly */

* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --ink: #2d2a4a;
  --card: #ffffff;
  --green: #5dd39e;
  --green-dark: #3cb27f;
  --blue: #54a0ff;
  --blue-dark: #2e86de;
  --pink: #f368e0;
  --pink-dark: #d24bc0;
  --yellow: #feca57;
  --yellow-dark: #e0a93c;
  --red: #ff6b6b;
  --purple: #9b8cff;
}

body {
  font-family: "Baloo 2", "Comic Sans MS", "Chalkboard SE", "Segoe UI", system-ui, sans-serif;
  color: var(--ink);
  min-height: 100vh;
  background: linear-gradient(160deg, #aee7ff 0%, #d8f7e6 55%, #fff3c9 100%);
  display: flex;
  justify-content: center;
}

#app { width: 100%; max-width: 560px; padding: 20px 16px 40px; }

.screen { display: none; animation: pop-in 0.35s ease; }
.screen.active { display: block; }

@keyframes pop-in {
  0% { opacity: 0; transform: scale(0.94) translateY(10px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}

.title {
  font-size: 2.6rem;
  text-align: center;
  margin: 12px 0 4px;
  color: var(--ink);
  text-shadow: 3px 3px 0 rgba(255, 255, 255, 0.7);
}

.wiggle { display: inline-block; animation: wiggle 2.2s ease-in-out infinite; }
@keyframes wiggle {
  0%, 100% { transform: rotate(-8deg); }
  50% { transform: rotate(8deg); }
}

.subtitle { text-align: center; margin-bottom: 18px; font-size: 1.05rem; opacity: 0.8; }
.heading { text-align: center; font-size: 1.8rem; margin: 10px 0 14px; }

.card {
  background: var(--card);
  border-radius: 24px;
  padding: 20px;
  box-shadow: 0 8px 0 rgba(45, 42, 74, 0.12);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.menu { align-items: stretch; }

/* Buttons */
.btn {
  font-family: inherit;
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
  background: var(--purple);
  border: none;
  border-radius: 18px;
  padding: 12px 20px;
  cursor: pointer;
  box-shadow: 0 5px 0 rgba(0, 0, 0, 0.18);
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}
.btn:active { transform: translateY(4px); box-shadow: 0 1px 0 rgba(0, 0, 0, 0.18); }
.btn-big { font-size: 1.35rem; padding: 16px 24px; }
.btn-small { font-size: 0.95rem; padding: 8px 14px; box-shadow: 0 3px 0 rgba(0,0,0,0.15); }
.btn-green { background: var(--green); box-shadow: 0 5px 0 var(--green-dark); }
.btn-blue { background: var(--blue); box-shadow: 0 5px 0 var(--blue-dark); }
.btn-pink { background: var(--pink); box-shadow: 0 5px 0 var(--pink-dark); }
.btn-yellow { background: var(--yellow); box-shadow: 0 5px 0 var(--yellow-dark); color: var(--ink); }
.btn-back { background: #cfd6e4; box-shadow: 0 3px 0 #aab3c5; color: var(--ink); align-self: center; }
.btn:disabled { opacity: 0.5; cursor: default; }

.mini-btn {
  font-family: inherit;
  font-size: 1rem;
  background: #eef1ff;
  border: 2px solid var(--purple);
  color: var(--purple);
  border-radius: 12px;
  width: 40px; height: 36px;
  cursor: pointer;
}
.mini-btn:active { background: var(--purple); color: #fff; }

/* Avatar builder */
.avatar-builder { display: flex; gap: 18px; align-items: center; justify-content: center; flex-wrap: wrap; }
.avatar-preview { width: 130px; height: 130px; }
.avatar-preview.center { margin: 0 auto; }
.avatar-preview svg { width: 100%; height: 100%; }
.avatar-controls { display: flex; flex-direction: column; gap: 8px; }
.avatar-row { display: flex; align-items: center; gap: 10px; justify-content: space-between; min-width: 170px; font-weight: 700; }

.name-input, .code-input {
  font-family: inherit;
  font-size: 1.2rem;
  font-weight: 700;
  text-align: center;
  color: var(--ink);
  border: 3px solid var(--purple);
  border-radius: 16px;
  padding: 12px;
  outline: none;
  width: 100%;
}
.name-input:focus, .code-input:focus { border-color: var(--pink); }
.code-input { text-transform: uppercase; letter-spacing: 6px; max-width: 160px; }
.join-row { display: flex; gap: 10px; justify-content: center; align-items: center; }

/* Me bar */
.me-bar { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; justify-content: center; }
.me-avatar { width: 64px; height: 64px; }
.me-avatar svg { width: 100%; height: 100%; }
.me-name { font-size: 1.3rem; font-weight: 800; }

/* Option pickers */
.option-group { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.option-btn {
  font-family: inherit;
  font-size: 1rem;
  font-weight: 700;
  color: var(--ink);
  background: #eef1ff;
  border: 3px solid #cfd6e4;
  border-radius: 16px;
  padding: 10px 14px;
  cursor: pointer;
}
.option-btn.selected { border-color: var(--green-dark); background: #dcf7eb; }
.hint { text-align: center; opacity: 0.75; font-size: 0.95rem; }

/* Room */
.room-code {
  background: var(--yellow);
  border-radius: 12px;
  padding: 2px 14px;
  letter-spacing: 6px;
  box-shadow: 0 3px 0 var(--yellow-dark);
}
.room-players { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }
.room-player { text-align: center; width: 84px; }
.room-player svg { width: 64px; height: 64px; }
.room-player .p-name { font-size: 0.85rem; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.room-player .p-crown { font-size: 0.9rem; }

/* Game */
.game-header { display: flex; justify-content: center; gap: 10px; margin-bottom: 8px; flex-wrap: wrap; }
.badge {
  background: #fff;
  border-radius: 999px;
  padding: 6px 14px;
  font-weight: 800;
  box-shadow: 0 3px 0 rgba(45, 42, 74, 0.12);
}
.badge-string { background: var(--purple); color: #fff; }
.badge-score { background: var(--yellow); }

.timer-track {
  height: 12px;
  background: rgba(255, 255, 255, 0.7);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 10px;
}
.timer-bar {
  height: 100%;
  width: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--green), var(--blue));
  transition: width 0.25s linear;
}
.timer-bar.low { background: linear-gradient(90deg, var(--red), var(--yellow)); }

.prompt { text-align: center; font-size: 1.15rem; font-weight: 700; margin-bottom: 10px; min-height: 1.5em; }

.staff-card { padding: 12px; }
#staff svg { width: 100%; height: auto; display: block; }

.note-head { transition: transform 0.15s ease; }
.note-clickable { cursor: pointer; }

/* Answers */
.answers { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 14px; }
.answer-btn {
  font-family: inherit;
  font-size: 1.5rem;
  font-weight: 800;
  color: #fff;
  border: none;
  border-radius: 20px;
  min-width: 64px;
  padding: 14px 18px;
  cursor: pointer;
  box-shadow: 0 5px 0 rgba(0, 0, 0, 0.2);
  transition: transform 0.08s ease;
}
.answer-btn:active { transform: translateY(4px); box-shadow: 0 1px 0 rgba(0,0,0,0.2); }
.answer-btn.shake { animation: shake 0.35s ease; }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-7px); }
  50% { transform: translateX(7px); }
  75% { transform: translateX(-4px); }
}
.answer-sub { display: block; font-size: 0.7rem; font-weight: 700; opacity: 0.9; }

.waiting-panel { text-align: center; margin-top: 16px; font-weight: 700; }
#waiting-players { display: flex; gap: 8px; justify-content: center; margin-top: 8px; flex-wrap: wrap; }
#waiting-players .wp { width: 44px; height: 44px; border-radius: 50%; opacity: 0.35; }
#waiting-players .wp.done { opacity: 1; }
#waiting-players svg { width: 100%; height: 100%; }

/* Results */
.results-list { display: flex; flex-direction: column; gap: 10px; }
.result-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #f4f6ff;
  border-radius: 16px;
  padding: 8px 14px;
  font-weight: 700;
}
.result-row .r-rank { font-size: 1.3rem; width: 36px; text-align: center; }
.result-row .r-avatar { width: 44px; height: 44px; }
.result-row .r-avatar svg { width: 100%; height: 100%; }
.result-row .r-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.result-row .r-points { color: var(--blue-dark); }
.result-row.me { background: #dcf7eb; border: 2px solid var(--green); }

.big-score { text-align: center; font-size: 2.2rem; font-weight: 800; color: var(--green-dark); }

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: #fff;
  font-weight: 700;
  padding: 12px 20px;
  border-radius: 16px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
  z-index: 50;
  animation: pop-in 0.25s ease;
  max-width: 90vw;
  text-align: center;
}

/* Confetti */
#confetti { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 40; }
.confetti-bit {
  position: absolute;
  top: -20px;
  width: 12px; height: 12px;
  border-radius: 3px;
  animation: fall linear forwards;
}
@keyframes fall {
  to { transform: translateY(110vh) rotate(720deg); opacity: 0.6; }
}

@media (max-width: 420px) {
  .title { font-size: 2rem; }
  .answer-btn { font-size: 1.25rem; min-width: 56px; padding: 12px 14px; }
}

/* ============ Learn: level map + drills ============ */
.btn-purple { background: var(--purple); box-shadow: 0 5px 0 #7a6ae0; }
.btn-red { background: var(--red); box-shadow: 0 5px 0 #d94f4f; }
.hint.strong { font-weight: 800; opacity: 1; font-size: 1.05rem; }

.level-list { display: flex; flex-direction: column; gap: 10px; }
.level-row {
  font-family: inherit;
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  background: #eef1ff;
  border: 3px solid #cfd6e4;
  border-radius: 18px;
  padding: 12px 14px;
  cursor: pointer;
  color: var(--ink);
  transition: transform 0.08s ease;
}
.level-row:active { transform: translateY(3px); }
.level-row.locked { opacity: 0.55; cursor: default; background: #f1f2f6; }
.lv-emoji { font-size: 1.9rem; flex: 0 0 auto; }
.lv-text { display: flex; flex-direction: column; flex: 1 1 auto; min-width: 0; }
.lv-name { font-weight: 800; font-size: 1.1rem; }
.lv-blurb { font-size: 0.85rem; opacity: 0.75; }
.lv-stars { flex: 0 0 auto; font-size: 0.95rem; letter-spacing: 1px; }

.streak { font-size: 1.1rem; }
.star-row { text-align: center; font-size: 2.2rem; letter-spacing: 4px; }

/* ============ Focus Spots ============ */
.level-row.focus-point.focus-mastered { background: #e8fff1; border-color: #93e6b8; }
.focus-reps { text-align: center; margin: 10px 0; }
.focus-dots { font-size: 1.4rem; letter-spacing: 2px; margin-top: 6px; }
#focus-practice-focus { color: var(--ink); }

/* ============ Avatar Shop ============ */
.shop-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
  gap: 10px;
  margin: 6px 0 14px;
}
.shop-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  background: #f4f6ff;
  border: 3px solid #dfe4f2;
  border-radius: 14px;
  padding: 6px 4px;
}
.shop-item.owned { background: #eef9ff; border-color: #b9e0f0; }
.shop-item.worn { border-color: var(--green-dark); background: #e8fff1; }
.shop-art { width: 72px; height: 72px; }
.shop-art svg { width: 100%; height: 100%; }
.shop-buy { width: 100%; padding: 6px 4px; font-size: 0.8rem; }
.shop-buy.cant-afford { opacity: 0.55; }
.answer-btn.reveal {
  outline: 4px solid var(--green-dark);
  outline-offset: 3px;
  animation: reveal-pop 0.35s ease;
}
@keyframes reveal-pop {
  0% { transform: scale(1); }
  50% { transform: scale(1.12); }
  100% { transform: scale(1); }
}

/* ============ Tuner ============ */
.tuner-note { text-align: center; font-size: 2.6rem; font-weight: 800; }
.tuner-status {
  text-align: center;
  font-size: 1.5rem;
  font-weight: 800;
  padding: 10px;
  border-radius: 16px;
  background: #eef1ff;
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.tuner-status.good { background: #dcf7eb; color: var(--green-dark); }
.tuner-status.low { background: #e6efff; color: var(--blue-dark); }
.tuner-status.high { background: #ffe8e8; color: #d94f4f; }

.tuner-meter {
  position: relative;
  height: 42px;
  border-radius: 999px;
  background: linear-gradient(90deg, #ffd7d7 0%, #fff3c9 30%, #dcf7eb 50%, #fff3c9 70%, #ffd7d7 100%);
  overflow: hidden;
}
.tuner-zone {
  position: absolute;
  left: 40%; width: 20%; top: 0; bottom: 0;
  border-left: 2px dashed var(--green-dark);
  border-right: 2px dashed var(--green-dark);
}
.tuner-needle {
  position: absolute;
  top: 2px; bottom: 2px;
  left: 50%;
  width: 8px;
  margin-left: -4px;
  border-radius: 999px;
  background: var(--ink);
  transition: left 0.12s ease-out;
}
.tuner-scale { display: flex; justify-content: space-between; font-size: 0.8rem; opacity: 0.7; padding: 0 4px; }
.tuner-hz { text-align: center; font-size: 0.9rem; opacity: 0.6; min-height: 20px; }

.string-row { display: flex; gap: 10px; justify-content: center; }
.string-btn {
  font-family: inherit;
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--ink);
  background: #fff3c9;
  border: 3px solid var(--yellow-dark);
  border-radius: 16px;
  width: 58px; height: 54px;
  cursor: pointer;
}
.string-btn.playing { background: var(--yellow); box-shadow: 0 0 0 4px rgba(254, 202, 87, 0.45); }

/* ============ Metronome ============ */
.metro-pulse {
  width: 130px; height: 130px;
  margin: 0 auto;
  border-radius: 50%;
  background: #eef1ff;
  border: 5px solid #cfd6e4;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  font-weight: 800;
}
.metro-pulse.hit { animation: beat 0.18s ease; background: #dcf7eb; border-color: var(--green-dark); }
.metro-pulse.hit-one { animation: beat 0.18s ease; background: var(--yellow); border-color: var(--yellow-dark); }
@keyframes beat {
  0% { transform: scale(1); }
  40% { transform: scale(1.14); }
  100% { transform: scale(1); }
}

.beat-dots { display: flex; gap: 10px; justify-content: center; }
.beat-dot {
  width: 18px; height: 18px;
  border-radius: 50%;
  background: #cfd6e4;
  transition: transform 0.1s ease, background 0.1s ease;
}
.beat-dot.accent { border: 3px solid var(--yellow-dark); }
.beat-dot.on { background: var(--green); transform: scale(1.35); }

.metro-bpm-row { display: flex; align-items: center; justify-content: center; gap: 18px; }
.metro-bpm { display: flex; flex-direction: column; align-items: center; line-height: 1; }
.metro-bpm > span:first-child { font-size: 2.8rem; font-weight: 800; }
.bpm-label { font-size: 0.85rem; opacity: 0.7; font-weight: 700; }
.mini-btn.big { width: 54px; height: 48px; font-size: 1.6rem; font-weight: 800; }
.metro-slider { width: 100%; accent-color: var(--green-dark); height: 32px; }

/* ============ Fingerboard (staff-to-fingerboard mapping) ============ */
.fingerboard {
  background: var(--card);
  border-radius: 24px;
  padding: 12px;
  box-shadow: 0 8px 0 rgba(45, 42, 74, 0.12);
  margin-bottom: 14px;
}
.fb-svg { display: block; max-width: 300px; margin: 0 auto; width: 100%; }
.fb-clickable { cursor: pointer; }
.fb-clickable:active circle { stroke-width: 5; }

/* ============ Rhythm games ============ */
.btn-orange { background: #ff9f43; box-shadow: 0 5px 0 #e0862a; }
.rhythm-svg { display: block; width: 100%; max-width: 420px; margin: 0 auto; }

.tap-pad {
  font-family: inherit;
  display: block;
  width: 100%;
  margin: 14px 0;
  padding: 34px 20px;
  font-size: 1.9rem;
  font-weight: 800;
  color: #fff;
  background: var(--red);
  border: none;
  border-radius: 28px;
  box-shadow: 0 8px 0 #d94f4f;
  cursor: pointer;
  user-select: none;
  touch-action: manipulation;
}
.tap-pad:active { transform: translateY(5px); box-shadow: 0 3px 0 #d94f4f; }
.tap-pad.tapped { animation: pad-pop 0.16s ease; }
@keyframes pad-pop {
  0% { transform: scale(1); }
  40% { transform: scale(0.96); }
  100% { transform: scale(1); }
}
#screen-rhythm-tap .beat-dots { margin: 6px 0 2px; }

/* ============ Music Words ============ */
.sym-card { align-items: center; }
.sym-prompt { min-height: 110px; display: flex; align-items: center; justify-content: center; }
.sym-svg { width: 150px; height: 100px; }
.sym-word { font-size: 2.6rem; font-weight: 800; }
.sym-word.italic { font-style: italic; font-family: Georgia, "Times New Roman", serif; }
.sym-grid { flex-direction: column; align-items: stretch; }
.sym-answer { font-size: 1.02rem; min-width: 0; text-align: center; padding: 12px 16px; }

/* leaderboard category tabs */
.lb-tabs { margin-bottom: 12px; }
.lb-tabs .option-btn { font-size: 0.88rem; padding: 7px 10px; border-radius: 12px; }

/* ============ Practice streaks + badges ============ */
.btn-teal { background: #1dd3b0; box-shadow: 0 5px 0 #14ab8e; }
.heading.small { font-size: 1.3rem; margin: 16px 0 8px; }

.practice-stats, .sum-stats { display: flex; justify-content: space-around; gap: 10px; }
.pstat { display: flex; flex-direction: column; align-items: center; }
.pstat-big { font-size: 2rem; font-weight: 800; }
.pstat-label { font-size: 0.85rem; opacity: 0.7; font-weight: 700; }

.practice-calendar {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  justify-items: center;
}
.cal-head { font-size: 0.75rem; font-weight: 800; opacity: 0.6; }
.cal-day {
  width: 38px; height: 38px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 12px;
  background: #eef1ff;
  font-size: 0.85rem;
  font-weight: 700;
  color: #8a90ad;
}
.cal-day.counted { background: #ffe8d1; }
.cal-day.today { outline: 3px solid var(--green-dark); }

.badge-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.badge-tile {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  background: #f1f2f6; border-radius: 16px; padding: 10px 6px; opacity: 0.55;
}
.badge-tile.earned { background: #fff3c9; opacity: 1; box-shadow: 0 3px 0 var(--yellow-dark); }
.badge-emoji { font-size: 1.8rem; }
.badge-name { font-weight: 800; font-size: 0.85rem; }
.badge-blurb { font-size: 0.72rem; opacity: 0.7; }

/* weekly summary */
.sum-title { text-align: center; font-size: 1.5rem; }
.sum-sub { text-align: center; margin-bottom: 6px; }
.sum-label { font-weight: 800; margin-top: 8px; }
.sum-row { display: flex; align-items: center; gap: 8px; }
.sum-day { flex: 0 0 44px; font-weight: 800; font-size: 0.9rem; }
.sum-bar-track { flex: 1; height: 16px; background: #eef1ff; border-radius: 999px; overflow: hidden; }
.sum-bar { display: block; height: 100%; background: linear-gradient(90deg, var(--green), var(--blue)); border-radius: 999px; }
.sum-min { flex: 0 0 64px; text-align: right; font-size: 0.85rem; font-weight: 700; }
.summary-bars { display: flex; flex-direction: column; gap: 7px; }
.sum-sign { margin-top: 18px; font-size: 0.95rem; }

@media print {
  body { background: #fff !important; display: block; }
  .no-print, #toast, #confetti { display: none !important; }
  .print-card { box-shadow: none; border: 2px solid #ccc; }
  #app { max-width: none; }
}

/* ============ Music Stage ============ */
.btn-ink { background: var(--ink); box-shadow: 0 5px 0 #191731; }
.file-btn { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.num-input {
  font-family: inherit; font-weight: 700; font-size: 1rem; color: var(--ink);
  width: 64px; border: 2px solid #cfd6e4; border-radius: 10px; padding: 6px 8px; text-align: center;
}
.song-row { width: 100%; }
.song-del { flex: 0 0 auto; }

.stage-top { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.stage-title { flex: 1; font-weight: 800; font-size: 1.1rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stage-panel { margin-bottom: 10px; }
.stage-set-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-weight: 700; font-size: 0.9rem; }
.stage-set-row .metro-slider { flex: 1; min-width: 120px; }

.stage-viewport { position: relative; }
.stage-scroll {
  height: 56vh;
  overflow-y: auto;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 8px 0 rgba(45, 42, 74, 0.12);
}
.stage-score { display: flex; flex-direction: column; }
.stage-page { width: 100%; display: block; }
.stage-playhead {
  position: absolute;
  left: 0; right: 0; top: 33%;
  height: 3px;
  background: var(--red);
  opacity: 0.65;
  border-radius: 2px;
  pointer-events: none;
}

.stage-controls { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.stage-play { font-size: 1.3rem; padding: 10px 22px; }
#stage-record.recording { animation: rec-blink 1s ease-in-out infinite; }
@keyframes rec-blink { 0%,100% { filter: brightness(1); } 50% { filter: brightness(1.35); } }
.take-row { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px dashed #e3e7f2; }
.take-name { flex: 1; font-weight: 800; }
.take-len { font-size: 0.85rem; opacity: 0.7; }
.keys-hint { font-size: 0.78rem; }

/* performance mode: nothing but the music */
body.stage-perform #app { max-width: none; padding: 6px; }
body.stage-perform .stage-scroll { height: calc(100vh - 130px); }
body.stage-perform .heading, body.stage-perform .stage-panel { display: none; }
/* dark mode: invert the pages (sheet music inverts beautifully), dim the chrome */
body.stage-dark { background: #14121f; }
body.stage-dark .stage-scroll { background: #1c1930; }
body.stage-dark .stage-page { filter: invert(0.92) hue-rotate(180deg); }
body.stage-dark .hint, body.stage-dark .stage-title { color: #cfd0e8; }

/* the hidden attribute must always win, even over display:flex rules */
[hidden] { display: none !important; }

/* Play It For Real: live pitch meter */
.play-note-name { text-align: center; font-size: 1.3rem; font-weight: 800; color: var(--blue-dark); }
.pitch-meter { display: flex; align-items: center; gap: 8px; margin: 6px 4px; }
.pitch-label { font-size: 0.8rem; font-weight: 700; opacity: 0.7; white-space: nowrap; }
.pitch-track {
  position: relative;
  flex: 1;
  height: 18px;
  background: #eef1ff;
  border-radius: 999px;
  overflow: hidden;
}
.pitch-zone {
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 26%;
  transform: translateX(-50%);
  background: #dcf7eb;
  border-left: 2px dashed var(--green-dark);
  border-right: 2px dashed var(--green-dark);
}
.pitch-marker {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--red);
  transform: translate(-50%, -50%);
  transition: left 0.12s linear, background 0.12s linear;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}
.pitch-marker.good { background: var(--green-dark); }
.pitch-marker.idle { background: #b9c0d8; }

/* Concert Practice */
.concert-tempo { margin-bottom: 4px; }
.concert-tempo-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 4px; }
.tempo-slider {
  width: 100%;
  height: 28px;
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  cursor: pointer;
}
.tempo-slider::-webkit-slider-runnable-track {
  height: 10px; border-radius: 999px;
  background: linear-gradient(90deg, var(--green), var(--blue));
}
.tempo-slider::-moz-range-track {
  height: 10px; border-radius: 999px;
  background: linear-gradient(90deg, var(--green), var(--blue));
}
.tempo-slider::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 26px; height: 26px; border-radius: 50%;
  background: #fff; border: 4px solid var(--blue-dark);
  margin-top: -8px; box-shadow: 0 2px 4px rgba(0,0,0,0.25);
}
.tempo-slider::-moz-range-thumb {
  width: 22px; height: 22px; border-radius: 50%;
  background: #fff; border: 4px solid var(--blue-dark); box-shadow: 0 2px 4px rgba(0,0,0,0.25);
}
.concert-controls { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 4px; }
.crec-seek { display: flex; align-items: center; gap: 8px; margin: 10px 0; }
.crec-seek .tempo-slider { flex: 1 1 auto; }
.crec-seek .hint { flex: 0 0 auto; min-width: 2.6em; text-align: center; }

/* Class layer */
.assignment-box {
  background: #fff8e1; border: 2px solid var(--yellow-dark); border-radius: 14px;
  padding: 12px 14px; font-weight: 700; color: var(--ink); white-space: pre-wrap;
}
.assignment-box.empty { opacity: 0.7; font-weight: 400; }
.assignment-input {
  font-family: inherit; font-size: 1rem; width: 100%; border: 3px solid var(--purple);
  border-radius: 14px; padding: 10px; resize: vertical; outline: none; color: var(--ink);
}
.assignment-input:focus { border-color: var(--pink); }
.roster-head { display: flex; justify-content: space-between; align-items: baseline; }
.roster-list { display: flex; flex-direction: column; gap: 8px; }
.roster-row { display: flex; align-items: center; gap: 10px; background: #f4f6ff; border-radius: 14px; padding: 8px 12px; }
.roster-avatar { width: 40px; height: 40px; flex: none; }
.roster-avatar svg { width: 100%; height: 100%; }
.roster-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.roster-name { font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.roster-sub { font-size: 0.78rem; opacity: 0.75; }
.roster-points { text-align: right; font-weight: 800; color: var(--blue-dark); display: flex; flex-direction: column; }
.roster-seen { font-size: 0.7rem; font-weight: 400; opacity: 0.6; }

/* Sight-Reading Gym */
.sr-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.sr-scroll #sr-staff { min-width: 100%; }
.sr-scroll svg { height: 164px; width: auto; max-width: none; display: block; }

/* Home menu section headings */
.menu-group {
  font-weight: 800; font-size: 0.9rem; color: var(--ink); opacity: 0.55;
  text-align: left; margin: 10px 4px 2px; letter-spacing: 0.5px;
}
.menu-group:first-child { margin-top: 0; }

/* How to Play panels */
.howto { margin-bottom: 6px; }
.howto-btn {
  font-family: inherit; font-weight: 700; font-size: 0.95rem;
  background: #eef1ff; color: var(--blue-dark); border: 2px solid var(--blue);
  border-radius: 14px; padding: 8px 14px; cursor: pointer; width: 100%;
}
.howto-btn.open { background: var(--blue); color: #fff; }
.howto-panel {
  background: #f4f6ff; border-radius: 14px; padding: 12px 14px; margin-top: 8px;
  animation: pop-in 0.2s ease;
}
.howto-title { font-weight: 800; margin-bottom: 6px; }
.howto-steps { margin: 0 0 8px 1.1em; padding: 0; }
.howto-steps li { margin: 4px 0; font-size: 0.95rem; line-height: 1.35; }
.howto-ex-art { text-align: center; background: #fff; border-radius: 12px; padding: 10px; }
.howto-ex-art svg { max-width: 100%; height: auto; }
.howto-cap { font-size: 0.85rem; opacity: 0.8; margin-top: 6px; }

/* Improv Studio */
.improv-transport { display: flex; gap: 8px; justify-content: center; margin: 6px 0; flex-wrap: wrap; }
.improv-pad { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin: 8px 0; }
.improv-key {
  font-family: inherit; font-size: 1.4rem; font-weight: 800; color: #fff;
  border: none; border-radius: 16px; min-width: 56px; min-height: 68px; cursor: pointer;
  box-shadow: 0 5px 0 rgba(0,0,0,0.2); transition: transform 0.06s ease, filter 0.1s ease;
  touch-action: manipulation; user-select: none;
}
.improv-key.lit { transform: translateY(4px) scale(1.05); filter: brightness(1.25); box-shadow: 0 1px 0 rgba(0,0,0,0.2); }

/* Theory games (circle of fifths + key sig) */
.theory-circle { text-align: center; }
.theory-circle svg { max-width: 260px; height: auto; }
.tune-btn { font-size: 1rem; min-width: 130px; }
