@font-face {
  font-family: 'Fraunces';
  src: url('./fonts/fraunces-soft.woff') format('woff');
  font-style: normal;
  font-weight: 300 600;
  font-display: swap;
}
@font-face {
  font-family: 'DM Sans';
  src: url('./fonts/dm-sans.woff') format('woff');
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
}
:root {
  --font-ui: 'DM Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-display: 'Fraunces', Georgia, 'Times New Roman', serif;
  --ink: #49312d;
  --muted: #806c69;
  --line: #b8a29d;
  --paper: #fffdfc;
  --blush: #ecd9d7;
  --sky-top: #f6eeee;
  --sky-bottom: #eaded5;
  font-family: var(--font-ui);
}
:is(html, body)[data-mood='cozy'] {
  --sky-top: #fff3df;
  --sky-bottom: #efcfb4;
}
:is(html, body)[data-mood='playful'] {
  --sky-top: #ffe8ee;
  --sky-bottom: #fcd3b9;
}
:is(html, body)[data-mood='dreamy'] {
  --sky-top: #ebe5fb;
  --sky-bottom: #cfe0f5;
}
:is(html, body)[data-mood='tender'] {
  --sky-top: #fff1f1;
  --sky-bottom: #f2c9d5;
}
:is(html, body)[data-mood='bright'] {
  --sky-top: #fff3c4;
  --sky-bottom: #cdebea;
}
:is(html, body)[data-mood='reflective'] {
  --sky-top: #e8e6f1;
  --sky-bottom: #c3d2e4;
}
:is(html, body)[data-mood='lullaby'] {
  --sky-top: #fdf0f7;
  --sky-bottom: #e1d4f2;
}
:is(html, body)[data-mood='folk'] {
  --sky-top: #f7efd6;
  --sky-bottom: #c8dcb4;
}
:is(html, body)[data-mood='lofi'] {
  --sky-top: #f4e1da;
  --sky-bottom: #b8bfd8;
}
:is(html, body)[data-mood='breezy'] {
  --sky-top: #e3f5f1;
  --sky-bottom: #bfe3ea;
}
:is(html, body)[data-mood='moonlit'] {
  --sky-top: #dfe4f6;
  --sky-bottom: #a9b7de;
}
:is(html, body)[data-mood='merry'] {
  --sky-top: #eef7de;
  --sky-bottom: #f6ccb8;
}
body {
  background: var(--sky-bottom);
  color: var(--ink);
}
#game {
  background: linear-gradient(165deg, var(--sky-top), var(--sky-bottom));
}
.wordmark,
.hero h1,
.prompt h1,
.prompt #instruction,
.result h2,
.score,
.sheet h2 {
  font-family: var(--font-display);
  font-weight: 400;
  letter-spacing: -0.02em;
  font-optical-sizing: auto;
}
.wordmark {
  font-size: 30px;
}
.wordmark i,
.hero h1 em {
  color: #a77578;
}
.hero h1 {
  font-size: clamp(58px, 9vw, 108px);
  letter-spacing: -1px;
}
.prompt #instruction {
  font-size: 36px;
}
.eyebrow {
  font-weight: 400;
  font-size: 15px;
  letter-spacing: 0.12em;
}
.prompt #subtitle {
  font-weight: 400;
  font-size: 20px;
}
.prompt p,
.result p,
.hero p {
  font-weight: 400;
  color: var(--muted);
}
.icon,
.secondary,
.primary,
.bird-controls .animal-part {
  background: var(--paper);
  color: var(--ink);
  border: 1.5px solid var(--line);
  box-shadow: 0 3px 0 #d9c6c480;
  backdrop-filter: none;
  font-family: var(--font-ui);
  font-weight: 400;
}
.icon {
  border-radius: 48% 52% 51% 49%;
}
.primary,
.secondary {
  font-size: 21px;
  border-radius: 24px 27px 23px 26px;
}
.primary {
  background: #f1dede;
}
.primary:not(:disabled):hover {
  background: #ebd0d2;
}
.secondary:hover,
.bird-controls .animal-part:not(:disabled):hover {
  background: #f9eeee;
}
.bird-controls .animal-part {
  border-radius: 18px 20px 17px 21px;
  font-size: 20px;
  transition:
    background 0.25s,
    color 0.25s,
    box-shadow 0.2s;
}
.bird-controls .animal-part[aria-pressed='true'] {
  outline: none;
  border-color: #765a54;
  box-shadow:
    0 0 0 2px #b48f8729,
    0 3px 0 #d9c6c480;
}
.bird-controls .animal-part.learned,
.bird-controls .animal-part.learned:hover {
  background: #668274;
  border-color: #506d60;
  color: #fffdfc;
  box-shadow: 0 3px 0 #4f6b5e33;
}
.part-stage.notes .part-notes {
  font-family: var(--font-ui);
  font-size: 20px;
  font-weight: 400;
  line-height: 1.15;
}
.keyboard {
  background: #e8d9d7;
  border: 1.5px solid #b39b96;
  padding: 8px;
  gap: 4px;
  border-radius: 24px 27px 22px 26px;
  box-shadow: 0 4px 0 #c8b0ac66;
}
.key {
  background: #fffefd;
  color: #715752;
  border: 1px solid #cbb5b0;
  box-shadow: inset 0 -5px #ecdedc;
  border-radius: 8px 9px 13px 11px;
  padding-bottom: 12px;
}
.key b {
  font-family: var(--font-ui);
  font-size: 22px;
  font-weight: 400;
}
.key small {
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 400;
  color: #8d7570;
  opacity: 1;
}
.key.black:after {
  background: #62534f;
  border: 1px solid #493b37;
  box-shadow: inset 0 -5px #4b3c38;
  border-radius: 0 0 9px 8px;
}
.key.held {
  background: #efd3d6;
  box-shadow: inset 0 -2px #d5aeb3;
}
.sheet,
.sheet header {
  background: #fff9f8;
}
.sheet h3 {
  font-weight: 400;
  font-size: 26px;
}
.sheet article {
  font-size: 20px;
}
.sheet p,
.sheet a {
  color: var(--ink);
}
.result {
  background: transparent;
}
.result p {
  font-size: 20px;
}
.reward-controls button {
  font-size: 21px;
}
@media (max-width: 600px) {
  .wordmark {
    font-size: 25px;
  }
  .prompt #instruction {
    font-size: 32px;
  }
  .prompt #subtitle {
    font-size: 18px;
  }
  .eyebrow {
    font-size: 13px;
  }
  .bird-controls .animal-part {
    font-size: 18px;
  }
  .keyboard {
    padding: 6px;
    gap: 3px;
    border-radius: 18px 21px 17px 20px;
  }
  .key b {
    font-size: 20px;
  }
  .part-stage.notes .part-notes {
    font-size: 18px;
  }
}
@media (max-height: 600px) {
  .prompt #instruction {
    font-size: 28px;
  }
  .key b {
    font-size: 18px;
  }
  .key small {
    display: none;
  }
}

.bird-controls .animal-part {
  height: 58px;
  min-height: 58px;
}
.prompt #subtitle:empty {
  display: none;
  min-height: 0;
}
.prompt .eyebrow {
  letter-spacing: 0.05em;
}

@property --sky-top {
  syntax: '<color>';
  inherits: true;
  initial-value: #f8f5f4;
}
@property --sky-bottom {
  syntax: '<color>';
  inherits: true;
  initial-value: #eee9e8;
}
:is(html, body)[data-mood='neutral'] {
  --sky-top: #f8f5f4;
  --sky-bottom: #eee9e8;
}
#game {
  transition:
    --sky-top 1.8s ease,
    --sky-bottom 1.8s ease;
}

#game {
  transition:
    opacity 0.75s ease,
    --sky-top 1.8s ease,
    --sky-bottom 1.8s ease;
}
.hud .icon {
  width: 44px;
  height: 44px;
  background: none;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}
.hud .icon svg {
  width: 25px;
  height: 25px;
}
.sound-off {
  opacity: 1;
}
.sound-off-shape {
  display: none;
}
.sound-off .sound-off-shape {
  display: block;
}
.sound-off .sound-on-shape {
  display: none;
}

/* Soft ink outlines, with slightly uneven corners like the bird illustration. */
.primary,
.secondary,
.bird-controls .animal-part {
  border: 1.5px solid #927771;
  border-radius: 12px 18px 13px 16px / 16px 12px 18px 13px;
  box-shadow: none;
  background: #fffdfc;
}
.primary:not(:disabled):hover,
.secondary:not(:disabled):hover,
.bird-controls .animal-part:not(:disabled):hover {
  background: #f5e9e7;
}
.primary:active,
.secondary:active,
.bird-controls .animal-part:active {
  transform: translateY(1px);
}
.bird-controls .animal-part:nth-child(even) {
  border-radius: 17px 11px 16px 12px / 12px 17px 11px 16px;
}
.bird-controls .animal-part[aria-pressed='true'] {
  border-color: var(--ink);
  box-shadow: none;
  background: #f2e6e4;
}
.bird-controls .animal-part.learned,
.bird-controls .animal-part.learned:hover {
  background: #668274;
  color: #fffdfc;
  box-shadow: none;
}
.home-bottom #start {
  min-width: 168px;
  padding: 10px 30px;
  background: #fffdfc;
  font-size: 24px;
}
.keyboard {
  background: #f0e7e5;
  border-color: #927771;
  border-radius: 15px 21px 16px 19px / 20px 16px 21px 14px;
  box-shadow: none;
}
.key {
  border-color: #ae928c;
  border-radius: 5px 8px 11px 7px / 7px 5px 9px 12px;
  box-shadow: none;
}
.key:nth-child(even) {
  border-radius: 8px 5px 8px 11px / 5px 8px 12px 7px;
}
.key.black:after {
  background: #62504b;
  border-color: #49312d;
  border-radius: 1px 2px 8px 6px / 2px 1px 6px 9px;
  box-shadow: none;
}
.key.held {
  background: #efd3d6;
  box-shadow: none;
}

/* Independent transparent artwork; background color remains CSS-controlled. */
#game:before {
  content: '';
  position: absolute;
  inset: 0;
  background: url('./art/paper-grain.png') repeat;
  background-size: 420px;
  pointer-events: none;
  z-index: 0;
}
#game:after {
  content: '';
  position: absolute;
  inset: 110px 0 220px;
  background: url('./art/foliage.png') center/100% 100% no-repeat;
  pointer-events: none;
  opacity: 0.55;
  z-index: 0;
}
.illustrated-branches {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}
body[data-state='home'] #game:before,
body[data-state='home'] #game:after,
body[data-state='home'] .illustrated-branches {
  visibility: hidden;
}
@media (max-height: 500px) {
  #game:after {
    display: none;
  }
}

/* Separate edge strips keep the foliage's natural aspect ratio at every size. */
#game:after {
  display: none;
}
.edge-foliage {
  position: absolute;
  inset: 110px 0 220px;
  pointer-events: none;
  z-index: 0;
  opacity: 0.5;
}
.edge-foliage:before,
.edge-foliage:after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  width: clamp(30px, 8vw, 100px);
  background-image: url('./art/foliage.png');
  background-repeat: no-repeat;
  background-size: auto 100%;
}
.edge-foliage:before {
  left: 0;
  background-position: left center;
}
.edge-foliage:after {
  right: 0;
  background-position: right center;
}
body[data-state='home'] .edge-foliage {
  visibility: hidden;
}
@media (max-height: 500px) {
  .edge-foliage {
    display: none;
  }
}

/* Wide or landscape screens: the piano spans the screen with the part buttons in a row on top. */
@media (min-width: 700px), (max-height: 900px) and (orientation: landscape) {
  .dock {
    padding: 10px max(16px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom))
      max(16px, env(safe-area-inset-left));
  }
  .dock-inner {
    max-width: 1200px;
  } /* the piano spans the screen, but stops growing on very wide displays */
  .dock .keyboard {
    height: clamp(76px, 11vh, 112px);
  }
  .prompt {
    top: 52px;
  }
  .prompt .eyebrow {
    margin-bottom: 2px;
  }
}
/* Short ones (phones on their side) also move the prompt to the top edge. */
@media (max-height: 500px) and (orientation: landscape) {
  .prompt {
    top: 8px;
  }
  .prompt h1,
  .prompt #instruction {
    font-size: 24px;
    margin: 0;
  }
  .prompt .eyebrow {
    margin: 0 0 2px;
    font-size: 12px;
  }
  .key b {
    font-size: 18px;
  }
  .dock .keyboard {
    height: 64px;
  }
}

/* Perches: one image per bird (art/perch-1..4.png: log, sprigs and pole), faded out by a mask in placePosts. */
.perch-post {
  position: absolute;
  pointer-events: none;
}
.perch-post img {
  display: block;
  width: 100%;
  height: 100%;
}

/* The round label and instruction are kept for screen readers but no longer take screen space. */
.prompt {
  position: absolute;
  top: 0;
  left: 0;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  transform: none;
}

/* Home: one bird on its post (the scene shows it); starting the game zooms out and slides the others in. */
body[data-state='home'] .bird-grove,
body[data-transition='true'] .bird-grove {
  visibility: visible;
}
body[data-state='home'] .illustrated-branches {
  visibility: visible;
}
body[data-transition] .bird-perch {
  transition: none;
}
body[data-transition] #animal-scene {
  z-index: 1;
}
body[data-transition='true'] #home {
  opacity: 0;
  transition: opacity 0.45s ease;
  pointer-events: none;
}

/* Bigger logo on the game screen. */
.hud .wordmark {
  font-size: clamp(34px, 5.5vw, 50px);
  line-height: 1;
}
@media (max-height: 500px) and (orientation: landscape) {
  .hud .wordmark {
    font-size: 28px;
  }
}

/* Background leaves and sprigs are switched off for now; delete this rule to bring them back. */
.edge-foliage,
#game:after {
  display: none !important;
}

/* Home hint: plain text, since a tap anywhere (except the bird) starts the game. */
.home-bottom #start.primary {
  min-width: 0;
  padding: 10px 16px;
  border: 0;
  border-radius: 0;
  background: none;
  box-shadow: none;
  font-size: 22px;
  color: var(--muted);
  animation: start-hint 2s ease-in-out infinite;
}
.home-bottom #start.primary:disabled {
  animation: none;
  opacity: 0.5;
}
@keyframes start-hint {
  0%,
  100% {
    opacity: 0.35;
  }
  50% {
    opacity: 1;
  }
}
@media (prefers-reduced-motion: reduce) {
  .home-bottom #start.primary {
    animation: none;
  }
}

/* The game is not selectable text: no blue highlight on posts or birds, no image dragging. */
#game,
#game * {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
#game img {
  -webkit-user-drag: none;
}

/* Type: Fraunces (soft serif) for the logo and headings, DM Sans for everything else. */
.primary,
.secondary,
.bird-controls .animal-part,
.key b,
.home-bottom #start.primary {
  font-weight: 500;
}
.hero h1 {
  letter-spacing: -0.035em;
  font-weight: 400;
}
.hud .wordmark {
  font-size: clamp(26px, 4.6vw, 40px);
}
@media (max-height: 500px) and (orientation: landscape) {
  .hud .wordmark {
    font-size: 24px;
  }
}
.hero h1 {
  white-space: nowrap;
  font-size: clamp(38px, 13.4vw, 108px);
}

/* ---- Bottom UI: numbered badges on the posts, a quiet dock, a softer piano ---- */
.part-badges {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  overflow: hidden;
}
.part-badges .part-badge {
  position: absolute;
  display: grid;
  place-items: center;
  padding: 0;
  margin: 0;
  min-height: 0;
  border: 1.5px solid #7a5c4c;
  border-radius: 50%;
  background: #fffdfc;
  color: #5b4338;
  font-family: var(--font-ui);
  font-weight: 600;
  line-height: 1;
  box-shadow: none;
  pointer-events: auto;
  cursor: pointer;
  transform: none;
  transition:
    background 0.25s,
    color 0.25s,
    border-color 0.25s,
    transform 0.12s;
}
.part-badges .part-badge:hover {
  background: #f6ece6;
}
.part-badges .part-badge:active {
  transform: scale(0.93);
}
.part-badges .part-badge[aria-pressed='true'] {
  border-color: #49312d;
  background: #f2e3d8;
}
.part-badges .part-badge.learned,
.part-badges .part-badge.learned:hover {
  background: #668274;
  border-color: #506d60;
  color: #fffdfc;
  animation: badge-pop 0.4s ease;
}
@keyframes badge-pop {
  0% {
    transform: scale(0.6);
  }
  60% {
    transform: scale(1.15);
  }
  100% {
    transform: scale(1);
  }
}
.part-badges .part-badge:disabled {
  filter: none;
}
.part-badges .part-badge:focus-visible {
  outline: 3px solid #c66743;
  outline-offset: 3px;
}

.dock {
  padding: 10px max(20px, env(safe-area-inset-right)) max(14px, env(safe-area-inset-bottom))
    max(20px, env(safe-area-inset-left));
}
.dock-inner {
  position: relative;
  display: flex;
  flex-direction: column;
  margin-left: auto;
  margin-right: auto;
}
.dock-note {
  display: block;
  order: -1;
  margin: 0 0 8px;
  text-align: center;
  font-family: var(--font-ui);
  font-size: 14px;
  color: var(--muted);
}
.dock-note:empty {
  display: none;
}
.dock .bird-controls {
  position: absolute;
  right: 0;
  bottom: calc(100% + 6px);
  width: auto;
  margin: 0;
  min-height: 0;
  display: block;
}
.keyboard {
  height: 120px;
}
@media (min-width: 700px), (max-height: 900px) and (orientation: landscape) {
  .dock .keyboard {
    height: clamp(76px, 11vh, 112px);
  }
}
@media (max-height: 500px) and (orientation: landscape) {
  .dock .keyboard {
    height: 64px;
  }
  .dock-note {
    margin-bottom: 4px;
    font-size: 13px;
  }
}

.keyboard {
  gap: 0;
  padding: 6px;
  border: 2px solid #6b4a3a;
  border-radius: 14px;
  background: #c9a27a url('./art/wood-tile.png') repeat;
  background-size: auto 48px;
  box-shadow: none;
}
.key,
.key:nth-child(even),
.key:first-child,
.key:last-child {
  border: 2px solid #6b4a3a;
  border-radius: 3px 3px 12px 12px;
  background: #fff8ee;
  box-shadow: none;
  color: #6b4a3a;
  padding-bottom: 14px;
}
.key + .key {
  margin-left: -2px;
}
.key b {
  font-weight: 500;
}
.key small {
  font-size: 12px;
  color: #8a6d5e;
}
.key.black:after {
  width: 46%;
  right: -23%;
  height: 60%;
  background: linear-gradient(#7a5a47, #553b2d);
  border: 2px solid #6b4a3a;
  border-radius: 0 0 6px 6px;
  box-shadow: none;
}
.key.held {
  background: #f6e0c8;
  box-shadow: none;
}
@media (hover: none) {
  .key small {
    display: none;
  }
}
.primary,
.secondary {
  border: 1.5px solid #8a6d5e;
  border-radius: 16px;
}

/* Hand-drawn piano: only the shapes wobble (tray, key outlines, black keys); the letters stay crisp on top. */
.keyboard {
  position: relative;
  isolation: isolate;
  border: 0;
  background: none;
  padding: 7px;
}
.keyboard::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  border: 2px solid #6b4a3a;
  border-radius: 14px;
  background: #c9a27a url('./art/wood-tile.png') repeat;
  background-size: auto 48px;
  filter: url(#hand-lines);
}
.key,
.key:nth-child(even),
.key:first-child,
.key:last-child {
  position: relative;
  border: 0;
  border-radius: 0;
  background: none;
  margin-left: 0;
}
.key::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  border: 2px solid #6b4a3a;
  border-radius: 3px 3px 12px 12px;
  background: #fff8ee;
  filter: url(#hand-lines);
  transition: background 0.06s;
}
.key + .key::before {
  left: -2px;
}
.key.held {
  background: none;
}
.key.held::before {
  background: #f6e0c8;
}
.key.black:after {
  filter: url(#hand-lines);
}

/* The dock is always laid out (just invisible before the game starts) and its hint line keeps its height,
   so the birds' layout is computed from the real dock size from the very first frame: no snap later. */
#dock[hidden] {
  display: block !important;
  visibility: hidden;
  pointer-events: none;
}
.dock-note {
  min-height: 20px;
}
.dock-note:empty {
  display: block;
  visibility: hidden;
}
@media (max-height: 500px) and (orientation: landscape) {
  .dock-note {
    min-height: 17px;
  }
}

/* The numbers are carved into the perch art now: the badges are invisible tap targets over them,
   and only show a green check once a part is learned. */
.part-badges .part-badge {
  background: transparent;
  border-color: transparent;
  color: transparent;
}
.part-badges .part-badge:hover {
  background: rgba(255, 255, 255, 0.18);
}
.part-badges .part-badge[aria-pressed='true'] {
  background: rgba(255, 255, 255, 0.22);
  border-color: rgba(107, 74, 58, 0.5);
  box-shadow: 0 0 0 2px rgba(255, 248, 238, 0.7);
}
.part-badges .part-badge.learned,
.part-badges .part-badge.learned:hover {
  background: #668274;
  border-color: #506d60;
  color: #fffdfc;
  animation: badge-pop 0.4s ease;
}

/* The whole melody, shown above the piano once every part is learned. It overlays the dock, so the birds never shift. */
.final-notes {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(100% - 22px);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px;
  pointer-events: none;
  animation: final-in 0.5s ease;
}
.final-notes[hidden] {
  display: none;
}
.final-note {
  min-width: clamp(22px, 6.2vw, 30px);
  height: clamp(26px, 7vw, 34px);
  padding: 0 4px;
  display: grid;
  place-items: center;
  border: 1.5px solid #6b4a3a;
  border-radius: 8px;
  background: #fff8ee;
  color: #6b4a3a;
  font: 600 clamp(13px, 3.6vw, 16px)/1 var(--font-ui);
  transition:
    background 0.15s,
    color 0.15s,
    transform 0.15s;
}
.final-note.done {
  background: #668274;
  border-color: #506d60;
  color: #fffdfc;
}
.final-note.next {
  box-shadow: 0 0 0 2px rgba(102, 130, 116, 0.55);
  transform: translateY(-2px);
}
@keyframes final-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* The tap targets over the carved numbers are invisible in every state (no ring, tint or outline). */
.part-badges .part-badge:not(.learned),
.part-badges .part-badge:not(.learned):hover,
.part-badges .part-badge:not(.learned)[aria-pressed='true'],
.part-badges .part-badge:not(.learned):active {
  background: transparent !important;
  border-color: transparent !important;
  box-shadow: none !important;
  outline: none !important;
  transform: none;
}
.part-badges .part-badge:not(.learned):focus-visible {
  outline: 2px solid rgba(102, 130, 116, 0.8) !important;
  outline-offset: 2px;
}
.part-badges .part-badge.learned[aria-pressed='true'] {
  outline: none !important;
  box-shadow: none !important;
}

/* Piano: shapes come from one svg (piano-art.mjs); the keys themselves are transparent buttons with crisp labels. */
.keyboard {
  position: relative;
  isolation: isolate;
  border: 0 !important;
  background: none !important;
  box-shadow: none !important;
  padding: 7px;
}
.keyboard::before {
  content: none !important;
}
.piano-art {
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  overflow: visible;
}
.piano-art .wk {
  fill: url(#piano-white);
}
.piano-art .wk.held {
  fill: url(#piano-white-down);
}
.piano-art .bk {
  fill: url(#piano-black);
}
.key,
.key:nth-child(even),
.key:first-child,
.key:last-child {
  background: none !important;
  border: 0 !important;
  box-shadow: none !important;
  border-radius: 0 !important;
  margin-left: 0 !important;
}
.key::before {
  content: none !important;
}
.key.black:after {
  display: none !important;
}

/* Hearts: a bird lets one out beside it when it has finished its part. Pop, float, sway and fade run as
   separate animations so each gets its own easing and the motion reads as one soft spring. */
.part-heart {
  position: absolute;
  pointer-events: none;
  transform: translate(-50%, -50%);
}
.part-heart svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
  will-change: translate, scale, rotate, opacity;
  animation:
    heart-pop 0.55s cubic-bezier(0.34, 1.56, 0.64, 1) both,
    heart-float 1.9s cubic-bezier(0.22, 0.61, 0.36, 1) both,
    heart-sway 1.9s ease-in-out both,
    heart-fade 1.9s ease-in-out both;
  animation-delay: inherit;
}
.part-heart .heart-body {
  fill: url(#heart-fill);
  stroke: #6b4a3a;
  stroke-width: 1.9;
  stroke-linejoin: round;
}
.part-heart .heart-shine {
  fill: none;
  stroke: #fff;
  stroke-opacity: 0.8;
  stroke-width: 1.7;
  stroke-linecap: round;
}
@keyframes heart-pop {
  from {
    scale: 0.15;
  }
  to {
    scale: 1;
  }
}
@keyframes heart-float {
  from {
    translate: 0 4px;
  }
  to {
    translate: var(--drift) -58px;
  }
}
@keyframes heart-sway {
  0% {
    rotate: -10deg;
  }
  45% {
    rotate: 7deg;
  }
  100% {
    rotate: -3deg;
  }
}
@keyframes heart-fade {
  0% {
    opacity: 0;
  }
  10% {
    opacity: 1;
  }
  62% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}
@media (prefers-reduced-motion: reduce) {
  .part-heart svg {
    animation: heart-fade-only 1.6s ease-in-out both;
  }
  @keyframes heart-fade-only {
    0%,
    100% {
      opacity: 0;
    }
    15%,
    70% {
      opacity: 1;
    }
  }
}

/* No check mark on learned posts: the hearts and the melody row carry the feedback. */
.part-badges .part-badge.learned,
.part-badges .part-badge.learned:hover {
  background: transparent !important;
  border-color: transparent !important;
  color: transparent !important;
  animation: none;
}

/* The hint fades out once the first bird is solved; the progress row (solved notes and ???) fades in over it. */
.dock-note {
  transition: opacity 0.45s ease;
}
.dock-note.gone {
  opacity: 0;
}
.final-notes {
  gap: 4px 14px;
}
.final-group {
  display: inline-flex;
  gap: 4px;
  pointer-events: auto; /* the row ignores taps, but each group plays its bird */
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.final-group:focus-visible {
  outline: 2px solid #b9741a;
  outline-offset: 3px;
  border-radius: 10px;
}
.final-note.unknown {
  border-style: dashed;
  background: rgba(255, 248, 238, 0.55);
  color: #8a6d5e;
}

/* The next key to play glows once every part is learned. */
.piano-art .wg {
  fill: #fbd878;
  stroke: #e0a93c;
  stroke-width: 2;
  stroke-linejoin: round;
  opacity: 0;
  pointer-events: none;
} /* warm gold with an outline, so it stands apart from the cream keys */
.piano-art .wg.on {
  animation: key-glow 1.5s ease-in-out infinite;
}
@keyframes key-glow {
  0%,
  100% {
    opacity: 0.6;
  }
  50% {
    opacity: 1;
  }
}
@media (prefers-reduced-motion: reduce) {
  .piano-art .wg.on {
    animation: none;
    opacity: 1;
  }
}

/* Win screen: a round play/stop button for the jingle, then a pulsing tap-anywhere line. */
.reward-controls {
  flex-direction: column;
  align-items: center;
  gap: 14px;
  bottom: max(34px, env(safe-area-inset-bottom));
}
.jingle-toggle {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1.5px solid #6b4a3a;
  border-radius: 50%;
  background: #fffdfc;
  cursor: pointer;
  transition:
    background 0.2s,
    transform 0.12s;
}
.jingle-toggle:hover {
  background: #f6ece6;
}
.jingle-toggle:active {
  transform: scale(0.94);
}
.jingle-toggle svg {
  width: 24px;
  height: 24px;
  fill: #6b4a3a;
  stroke: #6b4a3a;
  stroke-width: 2;
  stroke-linejoin: round;
  grid-area: 1/1;
}
.jingle-toggle .i-pause {
  display: none;
  stroke-width: 0;
}
.jingle-toggle.playing .i-play {
  display: none;
}
.jingle-toggle.playing .i-pause {
  display: block;
}
.reward-controls #next.primary {
  min-width: 0;
  padding: 8px 16px;
  border: 0;
  border-radius: 0;
  background: none;
  box-shadow: none;
  font-size: 20px;
  color: var(--muted);
  animation: start-hint 2s ease-in-out infinite;
}
.reward-controls #next.primary:hover {
  background: none;
}
@media (prefers-reduced-motion: reduce) {
  .reward-controls #next.primary {
    animation: none;
  }
}

/* Restart: a smaller round button beside play/pause; play/pause stays centred over the tap-anywhere line. */
.jingle-row {
  position: relative;
  display: flex;
  justify-content: center;
}
.jingle-reset {
  position: absolute;
  left: calc(100% + 14px);
  top: 50%;
  transform: translateY(-50%);
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1.5px solid #6b4a3a;
  border-radius: 50%;
  background: #fffdfc;
  cursor: pointer;
  transition:
    background 0.2s,
    transform 0.12s;
}
.jingle-reset:hover {
  background: #f6ece6;
}
.jingle-reset:active {
  transform: translateY(-50%) scale(0.93);
}
.jingle-reset svg {
  width: 20px;
  height: 20px;
  fill: #6b4a3a;
}

/* ---- How to play: a compact illustrated card ---- */
.guide {
  border: 0;
  padding: 0;
  background: none;
  color: var(--ink);
  max-width: none;
  max-height: none;
  margin: auto;
  overflow: visible;
}
.guide::backdrop {
  background: rgba(74, 50, 40, 0.38);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}
.guide[open] {
  animation: scrim-in 0.25s ease;
}
.guide[open] .guide-card {
  animation: guide-in 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}
@keyframes scrim-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
@keyframes guide-in {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
.guide-card {
  position: relative;
  width: min(460px, calc(100vw - 28px));
  max-height: min(88dvh, 760px);
  overflow: auto;
  padding: 28px 26px 22px;
  border: 1.5px solid #6b4a3a;
  border-radius: 24px;
  background: linear-gradient(#fffaf4, #fbf1e6);
  box-shadow: 0 18px 50px rgba(74, 50, 40, 0.28);
}
.guide-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1.5px solid #6b4a3a;
  border-radius: 50%;
  background: #fffdfc;
  cursor: pointer;
  transition:
    background 0.2s,
    transform 0.12s;
}
.guide-close:hover {
  background: #f6ece6;
}
.guide-close:active {
  transform: scale(0.94);
}
.guide-close svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: #6b4a3a;
  stroke-width: 2;
  stroke-linecap: round;
}
.guide h2 {
  margin: 0 52px 6px 0;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(28px, 7vw, 34px);
  letter-spacing: -0.02em;
  line-height: 1.1;
}
.guide-lede {
  margin: 0 0 20px;
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.5;
  color: var(--muted);
}
.guide-steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 16px;
}
.guide-steps li {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 14px;
  align-items: center;
}
.step-art {
  width: 64px;
  height: 64px;
  display: block;
  border: 1.5px solid #6b4a3a;
  border-radius: 18px;
  background: #fff8ee;
  overflow: hidden;
}
.step-art svg {
  display: block;
  width: 100%;
  height: 100%;
}
.guide h3 {
  margin: 0 0 2px;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 20px;
  letter-spacing: -0.01em;
}
.guide-steps p {
  margin: 0;
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.45;
  color: var(--muted);
}
.guide-tip {
  margin: 20px 0 0;
  padding: 10px 14px;
  border-radius: 14px;
  background: rgba(201, 162, 122, 0.2);
  font-family: var(--font-ui);
  font-size: 14.5px;
  color: #5b4338;
  text-align: center;
}
.guide-foot {
  margin: 14px 0 0;
  font-family: var(--font-ui);
  font-size: 13px;
  color: #8a6d5e;
  text-align: center;
}
.guide-foot a {
  color: inherit;
}
@media (max-width: 380px) {
  .guide-card {
    padding: 24px 18px 18px;
  }
  .guide-steps li {
    grid-template-columns: 56px 1fr;
    gap: 12px;
  }
  .step-art {
    width: 56px;
    height: 56px;
    border-radius: 15px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .guide[open],
  .guide[open] .guide-card {
    animation: none;
  }
}

.guide-card:focus {
  outline: none;
}

.guide .keys {
  white-space: nowrap;
  font-weight: 600;
  color: #5b4338;
  letter-spacing: 0.04em;
}

.jingle-reset {
  position: static !important;
  transform: none !important;
  width: 54px !important;
  height: 54px !important;
}
.jingle-reset:active {
  transform: scale(0.94) !important;
}
.jingle-reset svg {
  width: 24px !important;
  height: 24px !important;
}

/* Home -> game: the logo flies to the header while the rest of the home screen fades. */
body[data-transition='true'] #home {
  opacity: 1;
  transition: none;
}
body[data-transition='true'] .home-bottom {
  opacity: 0;
  transition: opacity 0.35s ease;
}
.hero h1 {
  will-change: transform;
}
body[data-transition='true'] .hero h1 {
  transition: transform 1.2s cubic-bezier(0.6, 0, 0.2, 1);
}

/* One logo style on the home and game screens (so the flight between them is seamless). */
.wordmark,
.hero h1 {
  letter-spacing: -0.035em;
  font-weight: 400;
}
.wordmark em,
.hero h1 em {
  font-style: normal;
  color: #a77578;
}
.wordmark .logo-note,
.hero h1 .logo-note {
  font-style: normal;
  color: #a77578;
  font-size: 0.92em;
  letter-spacing: inherit;
}
/* Pin the optical size so the big home logo and the small header logo are the very same letterforms. */
.wordmark,
.hero h1 {
  font-optical-sizing: none;
  font-variation-settings: 'opsz' 48;
  font-kerning: normal;
  text-rendering: geometricPrecision;
}

/* The dock (piano and the finished melody above it) fades in and out instead of popping. */
/* (no opacity here: the finish sequence in birds.css drives the dock's opacity and slide) */
#dock {
  transition:
    opacity 1s ease,
    transform 1s cubic-bezier(0.22, 0.61, 0.36, 1),
    visibility 0s linear 0s;
}
#dock[hidden] {
  opacity: 0;
  transform: translateY(55px);
  transition:
    opacity 0.7s ease,
    transform 1s cubic-bezier(0.22, 0.61, 0.36, 1),
    visibility 0s linear 1s;
}

/* Smooth appear/disappear for the end-of-melody UI (they are absolutely placed, so keeping them laid out while hidden is safe). */
#reward-controls {
  transition:
    opacity 0.6s ease,
    visibility 0s linear 0s;
}
#reward-controls[hidden] {
  display: flex !important;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition:
    opacity 0.4s ease,
    visibility 0s linear 0.4s;
}
#result {
  transition:
    opacity 0.6s ease,
    visibility 0s linear 0s;
}
#result[hidden] {
  display: block !important;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition:
    opacity 0.4s ease,
    visibility 0s linear 0.4s;
}
/* The how-to-play card eases out as well as in. */
.guide {
  transition:
    opacity 0.22s ease,
    transform 0.22s ease,
    overlay 0.22s allow-discrete,
    display 0.22s allow-discrete;
}
.guide::backdrop {
  transition:
    background 0.22s ease,
    backdrop-filter 0.22s ease;
}
.guide:not([open]) {
  opacity: 0;
}
.guide:not([open])::backdrop {
  background: rgba(74, 50, 40, 0);
  backdrop-filter: blur(0);
}
@media (prefers-reduced-motion: reduce) {
  #dock,
  #reward-controls,
  #result,
  .guide {
    transition: none !important;
  }
}

/* Newly learned parts ease into the melody row instead of popping. */
.final-group.fresh {
  animation: chip-in 0.5s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
@keyframes chip-in {
  from {
    opacity: 0;
    transform: translateY(6px) scale(0.92);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@media (prefers-reduced-motion: reduce) {
  .final-group.fresh {
    animation: none;
  }
}

/* Sign in with Google, inside the how-to-play card. */
.account {
  display: grid;
  justify-items: center;
  gap: 10px;
  margin: 18px 0 6px;
  padding: 16px 14px 14px;
  border-radius: 18px;
  background: #fbefe3;
  border: 1.5px solid rgba(107, 74, 58, 0.25);
  text-align: center;
  font-family: var(--font-ui);
}
.account[hidden] {
  display: none;
}
.account-note {
  margin: 0;
  font-size: 15px;
  line-height: 1.4;
  color: var(--ink);
  font-weight: 500;
}
.account-google {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 0 18px;
  height: 44px;
  border-radius: 22px;
  background: #fff;
  border: 1.5px solid #6b4a3a;
  color: #3b2a24;
  font: 600 15px/1 var(--font-ui);
  text-decoration: none;
  transition:
    background 0.2s,
    transform 0.12s;
}
.account-google:hover {
  background: #f6ece6;
}
.account-google:active {
  transform: scale(0.97);
}
.account-line {
  margin: 0;
  display: grid;
  gap: 2px;
  font-size: 14px;
  color: var(--muted);
}
.account-line b {
  color: #668274;
  font-weight: 700;
  font-size: 15px;
}
.account-line span {
  overflow-wrap: anywhere;
}
.account-out {
  border: 0;
  background: none;
  color: #6b4a3a;
  font: 500 14px var(--font-ui);
  text-decoration: underline;
  cursor: pointer;
  padding: 4px 8px;
}

/* Live contact shadow on each perch: clipped to the perch art so it only ever lands on the wood. */
.perch-shadow {
  position: absolute;
  inset: 0;
  pointer-events: none;
  mix-blend-mode: multiply;
  -webkit-mask-size: 100% 100%;
  mask-size: 100% 100%;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
}

/* Keyboard focus ring: round and soft on the header icons instead of a square box. */
.hud .icon {
  border-radius: 50%;
}
.hud .icon:focus-visible {
  outline: 2px solid #a77578;
  outline-offset: 2px;
}

/* End screen: sits at the bottom like the piano did, drawn straight on the background in the game's own style (no card). */
.result {
  top: auto !important;
  bottom: max(22px, env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  width: min(560px, calc(100% - 24px));
  padding: 0 8px;
  border: 0;
  border-radius: 0;
  background: none;
  box-shadow: none;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}
.result #match {
  display: none;
}
.result .eyebrow {
  font-size: 12px;
  letter-spacing: 0.14em;
  margin: 0 0 4px;
  color: var(--muted);
}
.result h2 {
  font-size: 34px;
  margin: 0 0 10px;
  line-height: 1.05;
  color: var(--ink);
}
.result .stats {
  display: flex;
  justify-content: center;
  gap: 22px;
  margin: 0 0 14px;
}
.result .stats div {
  display: grid;
  gap: 1px;
  justify-items: center;
}
.result .stats b {
  font: 600 17px/1.1 var(--font-ui);
  color: var(--ink);
}
.result .stats span {
  font: 400 12px/1.2 var(--font-ui);
  color: var(--muted);
}
.result .jingles {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin: 0 0 14px;
}
.result .jingles button {
  min-width: 0;
  width: 56px;
  height: 46px;
  padding: 0;
  display: grid;
  place-items: center;
  border: 1.5px solid #6b4a3a;
  border-radius: 23px;
  background: #fffdfc;
  color: #6b4a3a;
  font: 600 16px/1 var(--font-ui);
  cursor: pointer;
  transition:
    background 0.2s,
    transform 0.12s;
}
.result .jingles button:hover {
  background: #f6ece6;
}
.result .jingles button:active {
  transform: scale(0.94);
}
/* End screen: the same screen space as the piano. Date, title, stats, then the songs with day arrows either side. */
.result {
  display: flex !important;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  text-align: center;
  bottom: max(12px, env(safe-area-inset-bottom));
  width: min(1200px, calc(100% - 40px));
  min-height: 0;
}
.result > * {
  margin: 0 !important;
}
.result #result-copy,
.result #match {
  display: none;
}
.result #totals[hidden],
.result #jingles[hidden] {
  display: none;
}
.result .eyebrow {
  font-size: 11px;
  letter-spacing: 0.16em;
  color: var(--muted);
  line-height: 1;
}
.result h2 {
  font-size: 26px;
  line-height: 1;
  margin-bottom: 1px !important;
}
.result .stats {
  display: flex;
  gap: 18px;
  margin-bottom: 2px !important;
}
.result .stats div {
  display: flex;
  align-items: baseline;
  gap: 5px;
}
.result .stats b {
  font: 600 15px/1 var(--font-ui);
}
.result .stats span {
  font: 400 11.5px/1 var(--font-ui);
  color: var(--muted);
}
.result .jingles {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.result .jingles button:not(.day-arrow) {
  height: 40px;
  width: 54px;
  border-radius: 20px;
  font-size: 15px;
}

.day-arrow {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  color: #6b4a3a;
  font: 500 30px/1 var(--font-ui);
  cursor: pointer;
  transition:
    background 0.2s,
    transform 0.12s,
    opacity 0.2s;
}
.result .jingles .day-arrow {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  background: none;
  font-size: 30px;
}
.day-arrow:hover:not(:disabled) {
  background: rgba(107, 74, 58, 0.1);
}
.day-arrow:active:not(:disabled) {
  transform: scale(0.92);
}
.day-arrow:disabled {
  opacity: 0.22;
  cursor: default;
}

/* End screen: nudge to sign in (only when signed out and sign-in is available). */
.save-progress {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 30px;
  padding: 0 12px;
  border-radius: 15px;
  margin-top: 2px;
  background: #fff;
  border: 1.5px solid rgba(107, 74, 58, 0.55);
  color: #3b2a24;
  font: 600 13px/1 var(--font-ui);
  text-decoration: none;
  transition:
    background 0.2s,
    transform 0.12s;
}
.save-progress[hidden] {
  display: none;
}
.save-progress:hover {
  background: #f6ece6;
}
.save-progress:active {
  transform: scale(0.97);
}

.result h2 {
  transition: opacity 0.2s ease;
}
.result .jingles button.now {
  background: #efd8bf;
}

/* Locked songs (not beaten yet): pressing one starts that level. */
.result .jingles button.locked {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  color: #9a8076;
  border-style: dashed;
  background: rgba(255, 253, 252, 0.55);
}
.result .jingles button.locked svg {
  display: block;
}
.result .jingles button.locked.now {
  background: #efd8bf;
  color: #6b4a3a;
  border-style: solid;
}

.result .jingles button.locked.missed {
  cursor: default;
  opacity: 0.55;
  border-style: dotted;
}
.result .jingles button.locked.missed:hover {
  background: rgba(255, 253, 252, 0.55);
}
.result .jingles button.locked.missed:active {
  transform: none;
}

/* Signed in: the account block shrinks to a small muted line, with Sign out tucked beside it. */
.account.signed {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: center;
  gap: 2px 10px;
  margin: 12px 0 0;
  padding: 0;
  background: none;
  border: 0;
  border-radius: 0;
  font-size: 12.5px;
  color: var(--muted);
}
.account.signed .account-line {
  display: inline;
  font-size: 12.5px;
  color: var(--muted);
}
.account.signed .account-out {
  padding: 0;
  font: 500 12.5px var(--font-ui);
  color: var(--muted);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.account.signed .account-out:hover {
  color: #6b4a3a;
}
.account-google {
  white-space: nowrap;
  flex-wrap: nowrap;
  justify-content: center;
  line-height: 1;
}
.account-google svg {
  display: block;
  flex: none;
  width: 18px;
  height: 18px;
}
.account-google span {
  display: block;
  line-height: 1;
  padding-top: 1px;
}

/* How to play: made to fit on one page without a scrollbar. Wide screens use two columns of steps; short screens tighten up. */
.guide-card {
  max-height: calc(100dvh - 20px);
}
@media (min-width: 640px) {
  .guide-card {
    width: min(700px, calc(100vw - 28px));
  }
  .guide-steps {
    grid-template-columns: 1fr 1fr;
    gap: 16px 28px;
    align-items: start;
  }
  .guide-steps li {
    grid-template-columns: 56px 1fr;
    align-items: start;
  }
  .step-art {
    width: 56px;
    height: 56px;
    border-radius: 16px;
  }
  .account:not(.signed) {
    grid-auto-flow: column;
    justify-content: space-between;
    align-items: center;
    text-align: left;
    gap: 14px;
    padding: 12px 16px;
  }
  .account:not(.signed) .account-note {
    font-size: 14.5px;
  }
}
@media (max-height: 820px), (max-width: 639px) and (max-height: 960px) {
  .guide-card {
    padding: 22px 22px 14px;
  }
  .guide h2 {
    font-size: 28px;
    margin-bottom: 4px;
  }
  .guide-lede {
    margin-bottom: 12px;
    font-size: 15px;
    line-height: 1.4;
  }
  .guide-steps {
    gap: 10px 24px;
  }
  .guide-steps p {
    font-size: 14px;
    line-height: 1.38;
  }
  .guide h3 {
    font-size: 18px;
  }
  .guide-tip {
    margin-top: 12px;
    padding: 8px 12px;
    font-size: 14px;
  }
  .account {
    margin: 10px 0 2px;
    padding: 10px 12px;
    gap: 8px;
  }
  .account-note {
    font-size: 14px;
  }
  .account-google {
    height: 40px;
  }
  .guide-foot {
    margin-top: 8px;
  }
}
@media (max-height: 700px) {
  .step-art {
    display: none;
  }
  .guide-steps li {
    grid-template-columns: 1fr;
  }
  .guide-tip {
    display: none;
  }
}

.guide-foot .foot-signout {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  text-decoration: underline;
  cursor: pointer;
}
.guide-foot .foot-signout:disabled {
  opacity: 0.6;
}

/* The page behind the game takes the same mood colour, so no edge of the window ever shows a different background. */
html {
  background: var(--sky-bottom);
  min-height: 100%;
}
html {
  transition:
    --sky-top 1.8s ease,
    --sky-bottom 1.8s ease;
}
body {
  min-height: 100dvh;
}
@media (prefers-reduced-motion: reduce) {
  html {
    transition: none;
  }
}

/* How to play: the dialog itself is the full-window dim + blur, so nothing at any edge is left uncovered (the card sits centred inside it). */
.guide[open] {
  position: fixed;
  inset: 0;
  width: 100vw;
  max-width: 100vw;
  height: 100vh;
  max-height: 100vh;
  margin: 0;
  display: grid;
  place-items: center;
  background: rgba(74, 50, 40, 0.38);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
}
@supports (height: 100dvh) {
  .guide[open] {
    height: 100dvh;
    max-height: 100dvh;
  }
}
.guide::backdrop {
  background: transparent;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

/* Win screen: plain "Tap here" text with a generous tap area around it (not a button, and not the whole screen). */
.reward-controls #next.primary {
  position: relative;
  pointer-events: auto;
  cursor: pointer;
}
.reward-controls #next.primary::after {
  content: '';
  position: absolute;
  inset: -30px -64px;
  border-radius: 40px;
}

/* End screen: tight rows. */
.result {
  gap: 3px;
}
.result h2 {
  margin: 0 0 1px !important;
  font-size: 25px;
}
.result .stats {
  margin: 0 !important;
  gap: 20px;
}
.result .jingles {
  margin-top: 3px !important;
  gap: 9px;
}
.result .jingles button:not(.day-arrow) {
  height: 38px;
  width: 52px;
  border-radius: 19px;
}
.result .jingles .day-arrow {
  margin: 0 2px;
  width: 30px;
  height: 30px;
  font-size: 26px;
}
.save-progress {
  margin-top: 4px;
  height: 28px;
}

/* Start screen: plain "Tap here to start" text; the tappable area is a generous patch around it (not the whole screen). */
.home-bottom #start.primary {
  position: relative;
  pointer-events: auto;
  cursor: pointer;
}
.home-bottom #start.primary::after {
  content: '';
  position: absolute;
  inset: -34px -70px;
  border-radius: 40px;
}
.home-bottom #start.primary:disabled {
  cursor: default;
}

/* Too narrow for one row: two groups per line, never three and one. */
.final-notes.two {
  display: grid;
  grid-template-columns: repeat(2, max-content);
  justify-content: center;
  gap: 6px 14px;
}
.final-notes.two .final-group {
  justify-content: center;
}
.jingle-reset svg {
  transform: translateY(1px);
}
.reward-controls .jingle-reset {
  padding: 0;
}

/* End screen sign-in: a quiet link, not a button. */
.save-progress {
  height: auto;
  padding: 6px 4px;
  margin-top: 6px;
  border: 0;
  border-radius: 0;
  background: none;
  color: var(--muted);
  font: 500 13px/1.2 var(--font-ui);
  gap: 8px;
  text-decoration: underline;
  text-decoration-color: rgba(107, 74, 58, 0.3);
  text-underline-offset: 3px;
  opacity: 0.9;
}
.save-progress:hover {
  background: none;
  color: var(--ink);
  text-decoration-color: currentColor;
  opacity: 1;
}
.save-progress:active {
  transform: none;
  opacity: 0.7;
}
.save-progress svg {
  width: 14px;
  height: 14px;
  flex: none;
}
.save-progress span {
  text-decoration: inherit;
}

/* How you compare popup */
.compare .guide-card {
  width: min(420px, calc(100vw - 28px));
}
.cmp {
  margin: 14px 0 0;
  padding: 0;
}
.cmp figcaption {
  display: flex;
  flex-direction: column;
  gap: 1px;
  margin-bottom: 6px;
}
.cmp figcaption b {
  font: 600 15px/1.2 var(--font-ui);
  color: var(--ink);
}
.cmp figcaption span {
  font: 400 13px/1.3 var(--font-ui);
  color: var(--muted);
}
.cmp svg {
  display: block;
  width: 100%;
  height: auto;
}
.cmp-axis {
  display: flex;
  justify-content: space-between;
  margin-top: 3px;
  font: 400 11.5px/1 var(--font-ui);
  color: var(--muted);
}
.compare-save {
  margin: 6px 0 0;
  text-align: left;
}
.compare-save .save-progress {
  padding-left: 0;
  white-space: nowrap;
}
.compare-save[hidden] {
  display: none;
}
.compare .guide-lede {
  margin-bottom: 0;
}
.compare .compare-save {
  margin-top: 10px;
}
.compare .compare-save .save-progress {
  margin-top: 0;
  padding-top: 2px;
  padding-bottom: 2px;
}

/* Stats row: the whole row opens the comparison; a small bar-chart glyph hints at it. */
.result .stats {
  align-items: center;
}
.result .stats.tappable {
  pointer-events: auto;
  cursor: pointer;
  padding: 6px 10px;
  margin: -6px -10px;
  border-radius: 14px;
  transition:
    background 0.2s,
    transform 0.12s;
  -webkit-tap-highlight-color: transparent;
}
.result .stats.tappable:hover {
  background: rgba(107, 74, 58, 0.07);
}
.result .stats.tappable:active {
  transform: scale(0.97);
  background: rgba(107, 74, 58, 0.1);
}
.result .stats.tappable,
.result .stats.tappable:focus,
.result .stats.tappable:focus-visible {
  outline: none;
}
.result .stats.tappable:focus-visible {
  background: rgba(107, 74, 58, 0.07);
}
.stats-ico {
  width: 18px;
  height: 18px;
  fill: #6b4a3a;
  opacity: 0.75;
  flex: none;
}
.result .stats span {
  white-space: nowrap;
}
.result .stats {
  gap: 14px;
}

/* Difficulty toggle (How to play) and hard mode, which hides the discovered notes. */
.difficulty {
  margin: 16px 0 0;
  display: grid;
  gap: 6px;
  justify-items: center;
  text-align: center;
}
.diff-label {
  font: 600 13px/1 var(--font-ui);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #8a6d5e;
}
.diff-seg {
  display: inline-flex;
  padding: 3px;
  border: 1.5px solid #6b4a3a;
  border-radius: 999px;
  background: #fffdfc;
}
.diff-seg button {
  font: 600 14px/1 var(--font-ui);
  padding: 8px 20px;
  border: 0;
  border-radius: 999px;
  background: none;
  color: #6b4a3a;
  cursor: pointer;
  transition:
    background 0.2s,
    color 0.2s;
}
.diff-seg button[aria-pressed='true'] {
  background: #6b4a3a;
  color: #fffdfc;
}
.diff-note {
  margin: 0;
  font: 400 13.5px/1.3 var(--font-ui);
  color: var(--muted);
}
body[data-difficulty='hard'] .final-note:not(.unknown) {
  color: transparent;
  font-size: 0;
  min-width: clamp(18px, 5vw, 24px);
}

/* Song view: replaces the end-screen controls while one song is open. */
body[data-songview] #result,
body[data-songview] #reward-controls {
  display: none !important;
}
.songview {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: max(14px, env(safe-area-inset-bottom));
  width: min(560px, calc(100% - 24px));
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-align: center;
  pointer-events: auto;
  z-index: 5;
  transition: bottom 1s cubic-bezier(0.22, 0.61, 0.36, 1);
}
.songview[hidden] {
  display: none;
}
.songview .eyebrow {
  font-size: 11px;
  letter-spacing: 0.16em;
  color: var(--muted);
  line-height: 1;
  margin: 0;
}
.songview h2 {
  font: 400 26px/1.1 var(--font-display);
  letter-spacing: -0.02em;
  margin: 0;
  color: var(--ink);
}
.sv-heart {
  color: #d9798f;
  font-size: 0.8em;
}
.sv-stats {
  display: flex;
  justify-content: center;
  gap: 18px;
  min-height: 20px;
  margin: 2px 0 6px;
}
.sv-stats div {
  display: flex;
  align-items: baseline;
  gap: 5px;
}
.sv-stats b {
  font: 600 15px/1 var(--font-ui);
  color: var(--ink);
}
.sv-stats span {
  font: 400 11.5px/1 var(--font-ui);
  color: var(--muted);
}
.sv-stats p {
  margin: 0;
  font: 400 13.5px/1.3 var(--font-ui);
  color: var(--muted);
}
.sv-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 8px;
}
.sv-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 42px;
  padding: 0 16px;
  border: 1.5px solid #6b4a3a;
  border-radius: 21px;
  background: #fffdfc;
  color: #6b4a3a;
  font: 600 14px/1 var(--font-ui);
  cursor: pointer;
  transition:
    background 0.2s,
    transform 0.12s;
}
.sv-btn:hover {
  background: #f6ece6;
}
.sv-btn:active {
  transform: scale(0.95);
}
.sv-btn svg {
  width: 20px;
  height: 20px;
  fill: #6b4a3a;
}
.sv-btn[aria-pressed='true'] {
  background: #6b4a3a;
  color: #fffdfc;
}
.sv-round {
  width: 42px;
  padding: 0;
  justify-content: center;
}
.sv-primary {
  background: #6b4a3a;
  color: #fffdfc;
}
.sv-primary:hover {
  background: #5a3d30;
}
body[data-piano='open'] .songview {
  bottom: var(--kb-gap, 180px);
}
body[data-piano='open'] .songview .sv-stats {
  display: none;
}

/* Start / Continue day */
.day-start {
  height: 36px;
  padding: 0 18px;
  border: 0;
  border-radius: 18px;
  background: #6b4a3a;
  color: #fffdfc;
  font: 600 14px/1 var(--font-ui);
  cursor: pointer;
  pointer-events: auto;
  transition:
    background 0.2s,
    transform 0.12s;
}
.day-start[hidden] {
  display: none;
}
.day-start:hover {
  background: #5a3d30;
}
.day-start:active {
  transform: scale(0.95);
}
body[data-songview] #dock[hidden] {
  transform: translateY(var(--sv-travel, 55px));
}

/* Back to the end screen while playing a day picked from it. */
.hud-group {
  position: relative;
}
.back-days {
  position: absolute;
  left: 0;
  top: calc(100% + 4px);
  height: 34px;
  padding: 0 12px;
  border: 0;
  border-radius: 17px;
  background: rgba(255, 253, 252, 0.7);
  color: #6b4a3a;
  font: 600 14px/1 var(--font-ui);
  white-space: nowrap;
  cursor: pointer;
  transition:
    background 0.2s,
    transform 0.12s;
}
.back-days[hidden] {
  display: none;
}
.back-days:hover {
  background: #fffdfc;
}
.back-days:active {
  transform: scale(0.95);
}

/* Exit button beside replay after a song: back to the day's end screen. The replay button stays centred. */
.jingle-exit {
  position: static;
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border: 1.5px solid #6b4a3a;
  border-radius: 50%;
  background: #fffdfc;
  cursor: pointer;
  transition:
    background 0.2s,
    transform 0.12s;
}
.reward-controls .jingle-exit {
  padding: 0;
}
.jingle-exit:hover {
  background: #f6ece6;
}
.jingle-exit:active {
  transform: scale(0.94);
}
.jingle-exit svg {
  width: 24px;
  height: 24px;
  fill: #6b4a3a;
}
body[data-state='complete'] #exit-day {
  display: none;
}

/* Hard mode: the only prompt left is the dock's "Tap a bird to hear its part". */
body[data-difficulty='hard'] #instruction,
body[data-difficulty='hard'] #subtitle {
  visibility: hidden;
}

.title-heart {
  display: inline-block;
  width: 0.78em;
  height: 0.78em;
  vertical-align: -0.06em;
  margin-left: 0.08em;
  overflow: visible;
}

/* Three-digit song numbers: slightly smaller so they (and the lock) fit inside the round button. */
.result .jingles button.long {
  font-size: 13px;
}
.result .jingles button.long.locked {
  gap: 3px;
  padding: 0 4px;
}
.result .jingles button.long.locked svg {
  width: 12px;
  height: 12px;
}

/* Replay and exit sit side by side, centred together. */
.jingle-row {
  gap: 14px;
  align-items: center;
}

.result h2:empty {
  display: none;
}

.fading {
  opacity: 0 !important;
  pointer-events: none;
  transition: opacity 0.4s ease;
}
body[data-songview] .dock-note {
  visibility: hidden;
}

/* The final (end) screen has no fades or slides: its controls, title and song screen snap in and out. */
body[data-state='complete'] #result,
body[data-state='complete'] #result *,
body[data-state='complete'] #reward-controls,
body[data-state='complete'] #songview,
body[data-state='complete'] #songview * {
  transition: none !important;
}
body[data-from-end] #result,
body[data-from-end] #reward-controls,
body[data-from-end] #songview,
body[data-from-end] #dock {
  transition: none !important;
}
body[data-songview] #dock,
body[data-songview] #dock[hidden],
body[data-songview] .songview {
  transition: none !important;
}
body[data-songview] #dock[hidden] {
  transform: none;
}

.compare .next-day {
  margin: 16px 0 0;
  font: 400 13px/1.3 var(--font-ui);
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  text-align: center;
}

/* The day arrows never get a highlight colour (hover, press or focus). */
.result .jingles .day-arrow,
.result .jingles .day-arrow:hover,
.result .jingles .day-arrow:active,
.result .jingles .day-arrow:focus,
.result .jingles .day-arrow:focus-visible,
.result .jingles .day-arrow:not(:disabled):hover {
  background: none !important;
  outline: none;
  box-shadow: none;
  -webkit-tap-highlight-color: transparent;
}

/* Arrangement switch on the song screen: piano only, band, or full. */
.sv-versions {
  display: inline-flex;
  padding: 3px;
  border: 1.5px solid #6b4a3a;
  border-radius: 999px;
  background: #fffdfc;
  margin-bottom: 2px;
}
.sv-versions button {
  font: 600 13px/1 var(--font-ui);
  padding: 7px 16px;
  border: 0;
  border-radius: 999px;
  background: none;
  color: #6b4a3a;
  cursor: pointer;
}
.sv-versions button[aria-pressed='true'] {
  background: #6b4a3a;
  color: #fffdfc;
}
body[data-piano='open'] .sv-versions {
  display: none;
}

.dock-inner {
  max-width: 860px;
} /* a narrower piano on wide screens: keys stay a natural shape instead of stretching */

/* Share / copy / notify buttons in the stats popup. */
.cmp-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin: 18px 0 0;
}
.cmp-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 38px;
  padding: 0 14px;
  border: 1.5px solid #6b4a3a;
  border-radius: 19px;
  background: #fffdfc;
  color: #6b4a3a;
  font: 600 13.5px/1 var(--font-ui);
  cursor: pointer;
  transition:
    background 0.2s,
    transform 0.12s;
}
.cmp-btn:hover:not(:disabled) {
  background: #f6ece6;
}
.cmp-btn:active:not(:disabled) {
  transform: scale(0.96);
}
.cmp-btn:disabled {
  opacity: 0.55;
  cursor: default;
}
.cmp-btn svg {
  width: 18px;
  height: 18px;
  flex: none;
}
.cmp-note {
  margin: 10px 0 0;
  text-align: center;
  font: 400 12.5px/1.4 var(--font-ui);
  color: var(--muted);
}
.cmp-note[hidden] {
  display: none;
}

/* A short "make sure your sound is on" reminder shown for two seconds after the loading screen. */
.sound-note {
  position: fixed;
  top: max(22px, env(safe-area-inset-top));
  left: 50%;
  translate: -50% 0;
  z-index: 900;
  width: max-content;
  max-width: calc(100vw - 32px);
  padding: 10px 18px;
  border: 2px solid #6b4a3a;
  border-radius: 999px;
  background: #fff8ee;
  color: #6b4a3a;
  font: 600 15px/1.3 var(--font-ui);
  text-align: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.4s ease;
}
.sound-note.show {
  opacity: 1;
}
