:root {
  --bg: #f5efe4;
  --paper: #fffdf8;
  --ink: #1f2430;
  --ink-soft: #5d6270;
  --line: #e4dccd;
  --primary: #1f6f6b;
  --primary-soft: #dcefec;
  --primary-ink: #ffffff;
  --good: #2f8a4f;
  --retry: #d99a1e;
  --bad: #cf3f3f;
  --gold: #f2b33d;
  --flame: #e8622c;
  --flame-soft: #fde9dc;
  --beak: #f29f1c;
  --beak-soft: #fff3df;
  --beak-text: #b86e00;
  --shadow: 0 10px 30px rgba(60, 45, 20, 0.08), 0 2px 6px rgba(60, 45, 20, 0.06);
  --radius: 22px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #14161b;
    --paper: #1e2229;
    --ink: #ece7dc;
    --ink-soft: #a3a7b1;
    --line: #333944;
    --primary: #4fb3ab;
    --primary-soft: #1d3533;
    --primary-ink: #0d1716;
    --good: #5fc27f;
    --retry: #e9b450;
    --bad: #f07070;
    --gold: #f5c45a;
    --flame: #ff8a4c;
    --flame-soft: #3a2419;
    --beak: #f29f1c;
    --beak-soft: #33260f;
    --beak-text: #f5b04a;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 17px/1.5 Nunito, system-ui, sans-serif;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  -webkit-tap-highlight-color: transparent;
}

[hidden] { display: none !important; }

h1, h2, .brand { font-family: Fraunces, Georgia, serif; font-weight: 600; letter-spacing: -0.01em; }

main { flex: 1; display: flex; flex-direction: column; }

/* Top bar */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: max(14px, env(safe-area-inset-top)) 20px 10px;
}
.brand { font-size: 22px; border: 0; background: none; color: var(--ink); padding: 0; cursor: pointer; }
.round-stats { display: flex; align-items: center; gap: 18px; }
.stat { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.15; }
.stat__label { font-size: 12px; color: var(--ink-soft); text-transform: uppercase; letter-spacing: 0.06em; font-weight: 700; }
.stat__value { font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; }
.stat--streak.is-hot .stat__value { color: var(--retry); animation: pop 0.4s ease-out; }

.icon-btn {
  border: 0;
  background: var(--paper);
  color: var(--ink);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  box-shadow: var(--shadow);
  cursor: pointer;
  flex: none;
}

.screen { flex: 1; display: flex; flex-direction: column; align-items: center; padding: 8px 16px 28px; }

.home__privacy { width: min(720px, 100%); color: var(--ink-soft); margin: 18px 0 0; }

/* Round */
.round { justify-content: center; gap: 14px; }
.dots { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; max-width: 100%; }
.dot { width: 14px; height: 14px; border-radius: 50%; background: var(--line); transition: background 0.2s; }
.dot--current { box-shadow: 0 0 0 2px var(--primary); background: var(--paper); }
.dot--good { background: var(--good); }
.dot--retry { background: var(--retry); }
.dot--skip { background: var(--bad); }
/* Put right at the end of the round: still its first-time colour, with a green ring */
.dot--fixed { box-shadow: 0 0 0 2px var(--paper), 0 0 0 4px var(--good); }
.dot--fixed.dot--current { box-shadow: 0 0 0 2px var(--primary); }

.staff-card {
  position: relative;
  width: min(780px, 100%);
  background: var(--paper);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 12px 16px;
}
.staff svg { display: block; width: 100%; height: auto; }
.staff svg .is-correct { animation: pop 0.45s ease-out; transform-box: fill-box; transform-origin: center; }
.staff svg .played { animation: shake 0.35s ease-out; transform-box: fill-box; transform-origin: center; }

/* The letter name of a right answer, floating up the screen */
.float-note {
  position: fixed;
  left: 50%;
  top: 34%;
  z-index: 15;
  font: 600 min(42vw, 220px)/1 Fraunces, Georgia, serif;
  color: var(--good);
  text-shadow: 0 6px 24px rgba(0, 0, 0, 0.18);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -50%);
}
.float-note.is-chord { font-size: min(16vw, 96px); }
.float-note.is-showing { animation: noteUp 1.3s cubic-bezier(0.2, 0.7, 0.3, 1) forwards; }
@keyframes noteUp {
  0% { opacity: 0; transform: translate(-50%, -30%) scale(0.5); }
  18% { opacity: 1; transform: translate(-50%, -50%) scale(1.1); }
  35% { opacity: 1; transform: translate(-50%, -60%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -38vh) scale(0.9); }
}

@keyframes pop { 40% { transform: scale(1.18); } }
@keyframes shake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }

.message { margin: 0; min-height: 1.5em; font-size: 20px; font-weight: 700; text-align: center; max-width: 34em; }
.message.good { color: var(--good); }
.message.bad { color: var(--bad); }
.hint { margin: 0; color: var(--ink-soft); text-align: center; max-width: 34em; min-height: 1.5em; }

/* Listening strip */
.listen {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 12px 20px max(16px, env(safe-area-inset-bottom));
  color: var(--ink-soft);
  font-size: 15px;
}
.listen__dot { width: 10px; height: 10px; border-radius: 50%; background: var(--ink-soft); opacity: 0.5; }
.listen.is-hearing .listen__dot { background: var(--good); opacity: 1; }
.listen__meter { width: 120px; height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.listen__meter span { display: block; height: 100%; background: var(--primary); transform-origin: left; transform: scaleX(0); }
.listen__heard { min-width: 2.5em; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }

/* Buttons */
.btn {
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  font: 700 16px/1 Nunito, system-ui, sans-serif;
  padding: 13px 22px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
}
.btn--primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.btn--danger { color: var(--bad); }
.btn--ghost { background: none; border-color: transparent; color: var(--ink-soft); text-decoration: underline; text-underline-offset: 3px; }
.btn:disabled { opacity: 0.4; cursor: default; }
.btn:hover:not(:disabled) { filter: brightness(1.05); }
.small { font-size: 14px; }
.error { color: var(--bad); font-weight: 700; margin: 10px 0 0; }

/* Dialogs */
.dialog {
  border: 0;
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink);
  box-shadow: var(--shadow);
  padding: 26px 24px 22px;
  width: min(480px, calc(100% - 32px));
}
.dialog::backdrop { background: rgba(20, 16, 10, 0.4); }
.dialog h2 { margin: 0 0 16px; font-size: 26px; }
.setting { display: flex; align-items: center; gap: 16px; padding: 14px 0; border-top: 1px solid var(--line); }
.setting h3 { margin: 0 0 2px; font-size: 17px; }
.setting p { margin: 0; color: var(--ink-soft); font-size: 15px; }
.dialog__done { display: block; margin: 16px 0 0 auto; }
.quit h2 { font-size: 24px; }
.quit__msg { margin: 0 0 18px; color: var(--ink-soft); font-size: 17px; }
.quit__actions { flex-wrap: wrap-reverse; align-items: center; }
.tune-status { font-size: 18px; font-weight: 600; min-height: 3em; }

/* Confetti */
.confetti { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 20; }
.confetti span {
  position: absolute;
  top: -20px;
  width: 9px;
  height: 14px;
  border-radius: 2px;
  animation: fall linear forwards;
}
@keyframes fall {
  to { transform: translate(var(--drift), 110vh) rotate(var(--spin)); }
}

/* Test-mode keyboard */
.test-keys { display: flex; overflow-x: auto; padding: 0 16px 16px; gap: 2px; }
.key {
  flex: 0 0 38px;
  height: 90px;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink-soft);
  border-radius: 0 0 6px 6px;
  font: 600 11px Nunito, sans-serif;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 6px;
  cursor: pointer;
}
.key.black { flex-basis: 26px; height: 60px; background: var(--ink); border-color: var(--ink); }

@media (max-width: 560px) {
  .brand { font-size: 19px; }
  .round-stats { gap: 12px; }
  .stat__label { font-size: 10px; }
  .stat__value { font-size: 17px; }
  .message { font-size: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Players and leaderboard */
.top-actions { display: flex; align-items: center; gap: 10px; }
/* The Quaver avatar sits on a paper circle in both themes, so a black bird still shows */
.avatar {
  flex: none;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #f5efe4;
  overflow: hidden;
}
.avatar .bird { width: 82%; height: 82%; margin-top: 4%; }
.avatar--small { width: 30px; height: 30px; }
.player-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 0;
  background: var(--paper);
  color: var(--ink);
  box-shadow: var(--shadow);
  border-radius: 999px;
  padding: 6px 14px 6px 6px;
  font: 800 16px Nunito, system-ui, sans-serif;
  cursor: pointer;
}
.player-chip__change { font-weight: 600; font-size: 13px; color: var(--ink-soft); }

.player-grid { width: min(720px, 100%); display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.player {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 20px 10px 16px;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  border-radius: 20px;
  font: inherit;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.player:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.player.is-last { border-color: var(--primary); }
.player__name { font-weight: 800; font-size: 20px; }
.player__level { font-size: 14px; color: var(--ink-soft); font-weight: 700; }

.board { width: min(720px, 100%); margin-top: 26px; }
.board h2 { font-size: 24px; margin: 0 0 10px; }
.board__list { list-style: none; margin: 0; padding: 0; background: var(--paper); border-radius: 18px; border: 1px solid var(--line); }
.board__row { display: flex; align-items: center; gap: 12px; padding: 12px 16px; }
.board__row + .board__row { border-top: 1px solid var(--line); }
.board__rank { width: 1.4em; font: 600 20px Fraunces, Georgia, serif; color: var(--ink-soft); text-align: center; }
.board__row:first-child .board__rank { color: var(--gold); }
.board__name { flex: 1; font-weight: 800; }
.board__stat { font-size: 14px; color: var(--ink-soft); white-space: nowrap; }
.board__stat strong { color: var(--ink); font-size: 16px; }
.board__stars { display: flex; align-items: center; gap: 3px; }
.board__stars .star-icon { width: 18px; height: 18px; fill: var(--gold); }

@media (max-width: 560px) {
  .player-grid { grid-template-columns: repeat(2, 1fr); }
  .board__row { flex-wrap: wrap; gap: 8px 12px; }
  .player-chip__change { display: none; }
}

.version { margin: 14px 0 0; font-size: 13px; color: var(--ink-soft); }

.setting--stack { flex-direction: column; align-items: stretch; }
.reset-players { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.btn--small { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 8px 12px; font-size: 15px; }
.sync-status { width: min(720px, 100%); color: var(--ink-soft); margin: 12px 0 0; }

/* Countdown timer (note mode) */
.timer { width: min(780px, 100%); height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; }
.timer span { display: block; height: 100%; background: var(--primary); transform-origin: left; transition: background 0.3s; }
.timer.is-low span { background: var(--retry); }
.timer.is-urgent span { background: var(--bad); }
.dot--late { background: var(--ink-soft); }

/* Count-in and beats (timing mode) */
.beats { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 10px; min-height: 44px; }
.beats__label { flex-basis: 100%; min-height: 1.3em; text-align: center; font-weight: 800; color: var(--ink-soft); }
.beat { width: 18px; height: 18px; border-radius: 50%; background: var(--line); transition: background 0.08s, transform 0.08s; }
.beat.is-on { background: var(--primary); transform: scale(1.3); }
.beats.is-count .beat.is-on { background: var(--retry); }
.beats__label.is-big { font: 600 30px/1.3 Fraunces, Georgia, serif; color: var(--retry); }
body.is-timing #skip-btn { display: none; }

/* Tempo controls (timing mode) */
.tempo { display: none; align-items: center; gap: 12px; }
body.is-timing .tempo { display: flex; }
.tempo__btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  font: 700 22px/1 Nunito, system-ui, sans-serif;
  cursor: pointer;
}
.tempo__btn:disabled { opacity: 0.4; cursor: default; }
.tempo__val { min-width: 5.5em; text-align: center; font-weight: 800; font-variant-numeric: tabular-nums; }
.bar-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.kb-link { width: min(720px, 100%); color: var(--ink-soft); margin: 6px 0 0; }
.kb-link a { color: var(--primary); font-weight: 700; }

/* Sign in */
.signin { justify-content: center; }
.signin__card {
  width: min(480px, 100%);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px 24px 24px;
}
.signin__card h1 { font-size: 32px; margin: 0 0 8px; }
.signin__card p { margin: 0 0 18px; color: var(--ink-soft); }
.signin__card p strong { color: var(--ink); overflow-wrap: anywhere; }
.signin__card .error { color: var(--bad); margin: 14px 0 0; }
.signin__card .error:empty { display: none; }
.signin__tip { margin: 14px 0 6px !important; }
.signin__links { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; }
.signin__links .btn { padding: 10px 12px; font-size: 15px; }
.field { display: flex; flex-direction: column; gap: 6px; margin: 0 0 16px; }
.field__label { font-weight: 800; font-size: 15px; }
.field__input {
  font: 600 18px Nunito, system-ui, sans-serif;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 13px 14px;
  width: 100%;
}
.field__input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.field__input--code { font: 600 30px/1 Fraunces, Georgia, serif; letter-spacing: 0.3em; text-align: center; }
.field__input--code::placeholder { color: var(--line); }
.btn--wide { width: 100%; }
.dev-mail { margin-top: 16px; padding: 12px 14px; border-radius: 12px; background: var(--primary-soft); font-size: 15px; overflow-wrap: anywhere; }
.dev-mail code { font: 700 17px ui-monospace, Menlo, monospace; letter-spacing: 0.1em; }
.dev-mail a { color: var(--primary); font-weight: 700; }

/* Adding and managing players */
.player--add { border-style: dashed; background: none; color: var(--ink-soft); }
.avatar--add { background: var(--line); color: var(--ink-soft); font: 700 34px/1 Nunito, system-ui, sans-serif; }
.manage-players { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.manage-players__row { display: flex; align-items: center; gap: 10px; }
.manage-players__name { flex: 1; min-width: 0; font-weight: 800; overflow: hidden; text-overflow: ellipsis; }
.manage-players__empty { color: var(--ink-soft); }
.manage-players__add { align-self: flex-start; }
.dialog__actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }
.dialog .field { margin-bottom: 4px; }

/* Day streaks and streak badges */
.flame { display: block; fill: currentColor; }
.streak { display: inline-flex; align-items: center; gap: 2px; color: var(--flame); font-weight: 800; font-variant-numeric: tabular-nums; }
.streak .flame { width: 18px; height: 18px; }
.streak strong { color: inherit !important; }
.streak.is-waiting { opacity: 0.6; }
.streak.is-waiting .flame { animation: flicker 1.6s ease-in-out infinite; }
.streak.is-out { color: var(--ink-soft); opacity: 0.45; }
.streak--chip { font-size: 15px; margin-left: -2px; }
.streak--chip .flame { width: 16px; height: 16px; }
.streak--big .flame { width: 46px; height: 46px; }
.streak--big strong { font: 600 32px/1 Fraunces, Georgia, serif; }
@keyframes flicker { 50% { transform: scale(0.88) rotate(-4deg); } }

.medal {
  position: relative;
  flex: none;
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--m);
  color: #fff;
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.18);
}
.medal .flame { display: none; }
.medal--huge .flame { display: block; position: absolute; inset: 16%; width: 68%; height: 68%; opacity: 0.3; }
.medal span { position: relative; font: 600 15px/1 Fraunces, Georgia, serif; }
.medal.is-locked { background: var(--line); color: var(--ink-soft); box-shadow: none; }
.medal--small { width: 22px; height: 22px; box-shadow: none; }
.medal--small span { font-size: 10px; }
.medal--corner { position: absolute; right: -6px; bottom: -4px; width: 28px; height: 28px; border: 2px solid var(--paper); box-shadow: none; }
.medal--corner span { font-size: 11px; }
.medal--huge { width: 120px; height: 120px; box-shadow: inset 0 -8px 0 rgba(0, 0, 0, 0.18), 0 0 0 8px var(--flame-soft); animation: medalIn 0.7s cubic-bezier(0.3, 1.6, 0.5, 1) backwards; }
.medal--huge span { font-size: 46px; }
@keyframes medalIn { from { transform: scale(0.2) rotate(-30deg); opacity: 0; } }
.shelf { display: flex; flex-wrap: wrap; gap: 6px; }

.player__avatar { position: relative; }
.player__streak { display: inline-flex; align-items: center; gap: 4px; font-size: 14px; font-weight: 700; color: var(--ink-soft); }
.board__name { display: flex; align-items: center; gap: 6px; }
.board__streak { display: flex; align-items: center; gap: 4px; }

.streak-card {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-top: 14px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--paper);
}
.streak-card.is-today { border-color: var(--flame); background: linear-gradient(var(--flame-soft), var(--paper) 80%); }
.streak-card__flame { flex: none; width: 64px; display: flex; flex-direction: column; align-items: center; color: var(--flame); }
.streak-card__flame .flame { width: 40px; height: 40px; }
.streak-card__flame strong { font: 600 30px/1 Fraunces, Georgia, serif; color: var(--ink); }
.streak-card__flame span { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-soft); }
.streak-card.is-waiting .streak-card__flame .flame { opacity: 0.6; animation: flicker 1.6s ease-in-out infinite; }
.streak-card:not(.is-today):not(.is-waiting) .streak-card__flame { color: var(--line); }
.streak-card__body { flex: 1; min-width: 0; display: grid; gap: 10px; }
.streak-card__text { margin: 0; color: var(--ink); font-weight: 600; }
.streak-card__goal { display: grid; gap: 4px; font-size: 14px; color: var(--ink-soft); font-weight: 700; }
.progress { display: block; height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; }
.progress span { display: block; height: 100%; border-radius: 4px; background: var(--flame); }
.streak-card .medal { width: 32px; height: 32px; }
.streak-card .medal span { font-size: 13px; }

/* Home: today's lesson */
.today { width: min(640px, 100%); display: grid; gap: 16px; margin-top: 4px; }
.today__head { display: flex; align-items: center; gap: 16px; }
.today__bird { flex: none; width: 104px; height: 104px; border-radius: 50%; background: #f5efe4; display: grid; place-items: center; box-shadow: var(--shadow); }
.today__bird .bird { width: 84%; height: 84%; margin-top: 4%; }
.today__hello { display: grid; gap: 8px; min-width: 0; }
.today__hello h1 { margin: 0; font-size: 32px; line-height: 1.1; }
.today__stats { display: flex; flex-wrap: wrap; gap: 8px; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px 6px 8px; border-radius: 999px; background: var(--paper); border: 1px solid var(--line); font-weight: 700; color: var(--ink-soft); font-size: 15px; }
.pill strong { color: var(--ink); font-size: 17px; }
.pill .streak { font-size: 17px; }
.pill--points .star-icon { width: 20px; height: 20px; fill: var(--beak); }
.today__length { margin: 0; color: var(--ink-soft); text-align: center; }
.today .home__privacy { width: auto; margin: 0; text-align: center; }
.link-btn { border: 0; background: none; padding: 0; font: inherit; font-weight: 800; color: var(--primary); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }

.lesson-card { display: grid; gap: 12px; padding: 22px 22px 20px; border-radius: var(--radius); background: var(--paper); box-shadow: var(--shadow); border: 2px solid var(--primary); }
.lesson-card h2 { margin: 0; font-size: 28px; }
.lesson-card__kicker { margin: 0; font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em; color: var(--primary); }
.lesson-card__text { margin: 0; font-size: 18px; }
.lesson-card__meta, .lesson-card__reward { margin: 0; color: var(--ink-soft); font-size: 15px; }
.lesson-card__reward { text-align: center; }
.btn--big { font-size: 20px; padding: 18px 26px; width: 100%; }
.lesson-card.is-done { border-color: var(--good); }
.lesson-card__done { display: flex; align-items: center; gap: 14px; }
.lesson-card__done .tick { flex: none; width: 52px; height: 52px; padding: 10px; border-radius: 50%; background: var(--good); color: #fff; }
.lesson-card.is-done .lesson-card__kicker { color: var(--good); }
.lesson-card__bonus { display: grid; gap: 12px; padding-top: 14px; border-top: 1px solid var(--line); }
.lesson-card__bonus p { margin: 0; color: var(--ink-soft); }
.lesson-card__bonus .btn { justify-self: start; }
.player__today { font-size: 13px; font-weight: 700; color: var(--primary); display: inline-flex; align-items: center; gap: 4px; }
.player__today.is-done { color: var(--good); }
.player__today .tick { width: 16px; height: 16px; }

/* Progress through today's lesson: a segment per set */
.lesson-progress { width: min(780px, 100%); display: grid; gap: 6px; }
.lesson-progress:empty { display: none; }
.lesson-progress__segs { display: flex; gap: 4px; }
.lesson-progress__seg { flex: 1; height: 10px; border-radius: 5px; background: var(--line); overflow: hidden; }
.lesson-progress__seg span { display: block; height: 100%; background: var(--primary); border-radius: 5px; transition: width 0.4s ease; }
.lesson-progress__seg--timing span { background: var(--retry); }
.lesson-progress__label { display: flex; justify-content: space-between; font-size: 14px; font-weight: 800; color: var(--ink-soft); }
.lesson-progress--big .lesson-progress__seg { height: 14px; border-radius: 7px; }

/* Between sets */
.set-break { justify-content: center; }
.set-break__card { width: min(520px, 100%); display: grid; gap: 14px; padding: 28px 24px 22px; border-radius: var(--radius); background: var(--paper); box-shadow: var(--shadow); text-align: center; }
.set-break__card h2 { margin: 0; font-size: 28px; }
.set-break__kicker { margin: 0; font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em; color: var(--primary); }
.set-break__msg, .set-break__next { margin: 0; }
.set-break__next { color: var(--ink-soft); }
.set-break__news { margin: 0; padding: 12px 16px; border-radius: 14px; background: var(--primary-soft); font-weight: 700; animation: pop 0.5s ease-out 0.2s backwards; }

/* The keyboard shown after a wrong note in the early lessons */
.round.has-keys .staff-card { width: min(440px, 100%); padding: 4px 12px; }
.keys { width: min(420px, 100%); display: grid; gap: 4px; justify-items: center; color: var(--ink-soft); animation: pop 0.35s ease-out; }
.keys svg { width: 100%; height: auto; display: block; }
.keys__letter { font: 800 13px Nunito, system-ui, sans-serif; fill: #fff; }
.keys__note { font-size: 13px; font-weight: 700; }

/* Adding a player */
.onboard__step { margin: 0 0 6px; font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em; color: var(--primary); }
.onboard__page { display: grid; gap: 12px; }
.onboard__page h2 { margin: 0; }
.onboard__sub { margin: 8px 0 0; font-size: 18px; }
.onboard__help { margin: 0 0 4px; color: var(--ink-soft); }
.onboard__bird { justify-self: center; width: 110px; height: 110px; border-radius: 50%; background: #f5efe4; display: grid; place-items: center; }
.onboard__bird .bird { width: 84%; height: 84%; margin-top: 4%; }
.swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.swatch { width: 40px; height: 40px; padding: 4px; border-radius: 50%; border: 2px solid transparent; background: none; cursor: pointer; }
.swatch span { display: block; width: 100%; height: 100%; border-radius: 50%; }
.swatch[aria-checked="true"] { border-color: var(--ink); }
.choices { display: grid; gap: 8px; }
.choice { display: grid; gap: 2px; text-align: left; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--paper); color: var(--ink); font: inherit; cursor: pointer; }
.choice span { color: var(--ink-soft); font-size: 15px; }
.choice[aria-checked="true"] { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary); background: var(--primary-soft); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { padding: 10px 16px; border-radius: 999px; border: 1px solid var(--line); background: var(--paper); color: var(--ink); font: 800 16px Nunito, system-ui, sans-serif; cursor: pointer; }
.chip[aria-checked="true"] { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }

/* The points screen after a lesson */
.celebrate { text-align: center; overflow: visible; }
.celebrate[open] { animation: celebrateIn 0.45s cubic-bezier(0.3, 1.5, 0.5, 1); }
@keyframes celebrateIn { from { transform: scale(0.85); opacity: 0; } }
.celebrate__bird { width: 104px; height: 104px; margin: 4px auto 10px; border-radius: 50%; background: #f5efe4; display: grid; place-items: center; box-shadow: 0 0 0 6px var(--paper), 0 0 0 12px var(--beak); animation: hop 0.6s ease-out 0.3s 2; }
.celebrate__bird .bird { width: 84%; height: 84%; margin-top: 4%; }
@keyframes hop { 40% { transform: translateY(-14px) rotate(-4deg); } }
.celebrate__kicker { margin: 0; font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em; color: var(--beak-text); }
.celebrate h2 { margin: 4px 0 14px; }
.celebrate__lines { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 6px; text-align: left; }
.celebrate__lines li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 12px; background: var(--bg); opacity: 0; transform: translateX(-16px); }
.celebrate__lines li.is-in { opacity: 1; transform: none; transition: opacity 0.3s, transform 0.4s cubic-bezier(0.3, 1.6, 0.5, 1); }
.celebrate__lines strong { color: var(--beak-text); font-size: 18px; white-space: nowrap; }
.celebrate__balance { display: grid; gap: 2px; padding: 14px; margin: 0 0 14px; border-radius: 18px; border: 2px solid var(--beak); background: var(--beak-soft); transition: box-shadow 0.3s; }
.celebrate__balance-label { font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-soft); }
.celebrate__balance strong { font: 600 52px/1.1 Fraunces, Georgia, serif; color: var(--ink); font-variant-numeric: tabular-nums; }
.celebrate__balance.is-up { box-shadow: 0 0 0 6px var(--beak-soft), 0 0 30px var(--beak); animation: pop 0.5s ease-out; }
.celebrate__badge { display: flex; align-items: center; gap: 14px; margin: 0 0 14px; padding: 12px 14px; border-radius: 16px; background: var(--flame-soft); text-align: left; }
.celebrate__badge p { margin: 0; }
.celebrate__badge .medal--huge { flex: none; width: 76px; height: 76px; box-shadow: inset 0 -6px 0 rgba(0, 0, 0, 0.18); }
.celebrate__badge .medal--huge span { font-size: 30px; }
.celebrate__next { margin: 0 0 16px; color: var(--ink-soft); font-size: 15px; }

@media (max-width: 560px) {
  .today__bird { width: 84px; height: 84px; }
  .today__hello h1 { font-size: 26px; }
  .lesson-card { padding: 18px 16px 16px; }
  .lesson-card h2 { font-size: 24px; }
  .celebrate__balance strong { font-size: 44px; }
}

@media (max-width: 560px) {
  .streak-card { gap: 12px; padding: 12px; }
  .streak-card__flame { width: 48px; }
  .board__name { flex-basis: calc(100% - 110px); }
  .board__streak { margin-left: 42px; }
}
.error:empty { display: none; }
