/* Piano Louvor — the sales page. The app's identity (KEYFLOW ADR-0025): ebony, ivory keys,
   brass, the red felt above the keys, hymnal type (Caslon), the hymnal's cloth cover; Kids
   in its own sky. The page is built around the piano itself: playable, fixed beside the
   reading column on wide screens, its world turning Kids with the Kids chapter. */

:root {
  color-scheme: dark;
  --bg: #120e0c;
  --surface: #1c1714;
  --surface-2: #28211c;
  --ink: #f3ede2;
  --muted: #a99c8b;
  --accent: #c9a35a;
  --accent-strong: #e3c47f;
  --accent-ink: #1a130d;
  --felt: #a3302f;
  --cloth: #3b141b;
  --sky: #e3f2ff;
  --sky-ink: #1f2a5a;
  --sky-ink-soft: #4a5687;
  --sun: #ffd23f;

  --serif: 'Libre Caslon Text', Georgia, serif;
  --sans: 'Inter', system-ui, sans-serif;
  --kids: 'Fredoka', system-ui, sans-serif;

  /* Five sizes: small, body, lead, heading, display. */
  --step-small: 0.9375rem;
  --step-body: clamp(1.0625rem, 1rem + 0.2vw, 1.125rem);
  --step-lead: clamp(1.25rem, 1rem + 0.8vw, 1.75rem);
  --step-head: clamp(2rem, 1.4rem + 2.2vw, 3.25rem);
  --step-display: clamp(3.5rem, 0.9rem + 9vw, 9.5rem);

  --margin: clamp(1rem, 2.2vw, 2rem);
  --radius: 12px;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in-out: cubic-bezier(0.76, 0, 0.24, 1);
  --t-press: 140ms;
  --t-hover: 180ms;
  --t-reveal: 800ms;

  /* Kids: one colour per note (the app's tokens.kids.notes). */
  --kc-0: #ff5a5f;
  --kc-2: #ff9f1c;
  --kc-4: #ffd23f;
  --kc-5: #3bceac;
  --kc-7: #2eb5f0;
  --kc-9: #5b6cf0;
  --kc-11: #b15cf0;
  --kc-sharp: #8a93c7;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: var(--step-body);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

h1,
h2,
p,
ol,
ul,
dl,
dd {
  margin: 0;
}

h1,
h2 {
  font-family: var(--serif);
  font-weight: 400;
  text-wrap: balance;
}

h2 {
  font-size: var(--step-head);
  line-height: 1.04;
  letter-spacing: -0.02em;
}

p {
  text-wrap: pretty;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

a {
  color: inherit;
  text-underline-offset: 0.2em;
  text-decoration-thickness: 0.07em;
}

button {
  font: inherit;
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

::selection {
  background: var(--accent);
  color: var(--accent-ink);
}

[hidden] {
  display: none !important;
}

.sr {
  position: absolute;
  width: 1px;
  height: 1px; /* taste-skill-ignore: visually hidden text, not a rule */
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* --- Buttons: the app's brass button ------------------------------------------------------ */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 56px;
  padding: 0 28px;
  border: 0;
  border-radius: var(--radius);
  background: var(--accent);
  color: var(--accent-ink);
  font-family: var(--sans);
  font-size: var(--step-body);
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  touch-action: manipulation;
  transition:
    transform var(--t-press) var(--ease-out),
    background-color var(--t-hover) ease;
}

.button:active {
  transform: scale(0.97);
}

.button.small {
  min-height: 44px;
  padding: 0 18px;
  font-size: var(--step-small);
  white-space: nowrap;
}

.button.ghost {
  background: var(--surface-2);
  color: var(--ink);
}

.text-link {
  font-weight: 500;
  color: var(--accent-strong);
}

@media (hover: hover) and (pointer: fine) {
  .button:hover {
    background: var(--accent-strong);
  }

  .button.ghost:hover {
    background: #342b25;
  }
}

/* --- The page: the piano beside the reading column ----------------------------------------- */

.stage-wrap {
  padding: 12px 12px 0;
}

.read {
  padding: 0 var(--margin);
}

/* --- The piano (the app's own interface: its borders, glows and radii) ----------------------- */

[data-ui].stage {
  --bar: 52px;
  --keys-h: clamp(118px, 26%, 210px);
  --lanes-bg: var(--surface);
  --line: var(--felt);
  --note: #d6a84e;
  --note-sharp: #c47a5a;
  --note-ink: rgba(26, 19, 13, 0.72);
  --grid: rgba(243, 237, 226, 0.09);
  --lane-line: rgba(243, 237, 226, 0.035);
  --card: var(--surface-2);
  --card-ink: var(--ink);
  --card-soft: var(--muted);
  --hit: #86be7c;
  --timing: #e8913a;
  --error: #e2574c;
  position: relative;
  display: grid;
  grid-template-rows: var(--bar) minmax(0, 1fr) var(--keys-h);
  height: clamp(450px, 66svh, 600px);
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--lanes-bg);
  color: var(--ink);
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 500ms ease;
}

[data-ui] .stage-bar {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 14px;
}

[data-ui] .tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  border-radius: 10px;
  background: rgba(243, 237, 226, 0.06);
}

[data-ui] .tab {
  min-height: 34px;
  padding: 0 14px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-size: 0.9375rem;
  font-weight: 500;
  cursor: pointer;
  touch-action: manipulation;
  transition:
    background-color var(--t-hover) ease,
    color var(--t-hover) ease;
}

[data-ui] .tab[aria-pressed='true'] {
  background: var(--accent);
  color: var(--accent-ink);
}

[data-ui] .kids-tab {
  font-family: var(--kids);
  font-weight: 600;
  letter-spacing: 0.01em;
}

[data-ui] .stage-song {
  overflow: hidden;
  font-family: var(--serif);
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--card-soft);
  white-space: nowrap;
  text-overflow: ellipsis;
}

[data-ui] .stage-points {
  flex: none;
  font-size: 0.8125rem;
  color: var(--card-soft);
  white-space: nowrap;
}

[data-ui] .stage-points strong {
  font-family: var(--serif);
  font-size: 1.375rem;
  font-weight: 700;
  color: var(--card-ink);
}

[data-ui][data-phase='playing'] .tabs,
[data-ui][data-phase='loading'] .tabs {
  display: none;
}

/* The lanes: one per white key, a line at every bar, the notes falling onto the felt. */
[data-ui] .lanes {
  position: relative;
  overflow: hidden;
}

[data-ui] .lane-lines {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: repeat(var(--whites, 8), minmax(0, 1fr));
}

[data-ui] .lane-lines i {
  border-right: 1px solid var(--lane-line);
}

[data-ui] .lane-lines i:last-child {
  border-right: 0;
}

[data-ui] .falling {
  position: absolute;
  inset: 0;
}

/* Behind the card the song falls quietly, silent; its cifra waits for the game. */
[data-ui][data-phase='idle'] .falling {
  opacity: 0.55;
}

[data-ui][data-phase='idle'] .chip {
  display: none;
}

[data-ui] .bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--grid);
}

[data-ui] .note {
  position: absolute;
  top: 0;
  left: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding-bottom: 5px;
  border-radius: 7px;
  background: var(--note);
  color: var(--note-ink);
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1;
  will-change: transform;
  transition: opacity 160ms ease;
}

[data-ui] .note.sharp {
  background: var(--note-sharp);
}

[data-ui] .note svg {
  display: none;
}

[data-ui] .note.hit {
  opacity: 0;
}

[data-ui] .note.missed {
  opacity: 0.32;
}

/* The cifra: the chord falls with its bar and docks at the line while it is played. */
[data-ui] .chip {
  position: absolute;
  top: 0;
  left: 8px;
  z-index: 1;
  min-width: 34px;
  height: 26px;
  padding: 0 7px;
  border-radius: 7px;
  background: rgba(18, 14, 12, 0.88);
  font-family: var(--serif);
  font-size: 0.9375rem;
  font-weight: 700;
  line-height: 26px;
  text-align: center;
  color: var(--ink);
}

[data-ui] .chip.docked {
  box-shadow: inset 0 0 0 1.5px var(--accent-strong);
  color: var(--accent-strong);
}

/* A hit: a beam of brass rising up the lane from the key. */
[data-ui] .beam {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 72%;
  opacity: 0;
  pointer-events: none;
  transform-origin: bottom;
  background: linear-gradient(to top, rgba(227, 196, 127, 0.5), rgba(227, 196, 127, 0)); /* taste-skill-ignore: the app's hit beam, only during a game */
}

[data-ui] .beam.on {
  animation: beam 460ms var(--ease-out);
}

@keyframes beam {
  from {
    opacity: 1;
    scale: 1 0.55;
  }
  to {
    opacity: 0;
    scale: 1 1;
  }
}

/* The word and the combo, as the app says them. */
[data-ui] .feedback {
  position: absolute;
  top: 26%;
  left: 0;
  right: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  pointer-events: none;
  opacity: 0;
  text-align: center;
}

[data-ui] .feedback.on {
  animation: say 1000ms var(--ease-out) forwards;
}

[data-ui] .feedback .word {
  font-family: var(--serif);
  font-size: clamp(1.625rem, 4vw, 2.25rem);
  font-weight: 700;
  line-height: 1.1;
  color: var(--hit);
}

[data-ui] .feedback[data-kind='early'] .word,
[data-ui] .feedback[data-kind='late'] .word {
  color: var(--timing);
}

[data-ui] .feedback[data-kind='miss'] .word,
[data-ui] .feedback[data-kind='wrong'] .word {
  color: var(--error);
}

[data-ui] .feedback[data-kind='ready'] .word {
  color: var(--card-ink);
}

[data-ui] .feedback .combo {
  font-family: var(--serif);
  font-size: 2.25rem;
  font-weight: 700;
  line-height: 1;
  color: var(--card-ink);
}

[data-ui] .feedback .combo:not(:empty)::after {
  content: 'combo';
  display: block;
  margin-top: 4px;
  font-family: var(--sans);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--accent-strong);
}

@keyframes say {
  0% {
    opacity: 0;
    scale: 0.9;
  }
  12% {
    opacity: 1;
    scale: 1;
  }
  70% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

/* The card over the lanes: the song, its facts, the speed, Jogar. */
[data-ui] .card {
  position: absolute;
  inset: var(--bar) 0 var(--keys-h);
  z-index: 4;
  display: grid;
  grid-template-columns: 44px minmax(0, 340px) 44px;
  justify-content: center;
  align-items: center;
  gap: 4px;
  padding: 10px 6px;
  pointer-events: none;
}

[data-ui] .card-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 18px 16px 14px;
  border-radius: 16px;
  background: var(--card);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
  color: var(--card-ink);
  text-align: center;
  pointer-events: auto;
}

[data-ui] .result {
  grid-template-columns: minmax(0, 340px);
}

[data-ui] .card-step {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(18, 14, 12, 0.72);
  color: var(--ink);
  cursor: pointer;
  pointer-events: auto;
  touch-action: manipulation;
  transition:
    transform var(--t-press) var(--ease-out),
    background-color var(--t-hover) ease;
}

[data-ui] .card-step:active {
  transform: scale(0.92);
}

[data-ui] .card-step svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

[data-ui] .card-number {
  font-family: var(--serif);
  font-size: 1rem;
  font-style: italic;
  color: var(--accent-strong);
}

[data-ui] .card-title {
  font-family: var(--serif);
  font-size: clamp(1.375rem, 2.4vw, 1.75rem);
  font-weight: 700;
  line-height: 1.12;
  text-wrap: balance;
}

[data-ui] .card-origin {
  margin-top: -4px;
  font-size: 0.875rem;
  color: var(--card-soft);
}

[data-ui] .card-facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  width: 100%;
  margin-top: 2px;
  border: 1px solid rgba(243, 237, 226, 0.1);
  border-radius: 10px;
}

[data-ui] .card-facts div {
  padding: 7px 4px;
}

[data-ui] .card-facts div + div {
  border-left: 1px solid rgba(243, 237, 226, 0.1);
}

[data-ui] .card-facts dt {
  font-size: 0.75rem;
  color: var(--card-soft);
}

[data-ui] .card-facts dd {
  font-family: var(--serif);
  font-size: 1.0625rem;
  font-weight: 700;
}

[data-ui] .card-shapes {
  display: flex;
  justify-content: center;
  gap: 6px;
}

[data-ui] .card-shapes span {
  width: 22px;
  height: 22px;
}

[data-ui] .card-shapes svg {
  width: 100%;
  height: 100%;
  fill: var(--c);
}

[data-ui] .speeds {
  display: flex;
  width: 100%;
  padding: 3px;
  border-radius: 10px;
  background: rgba(243, 237, 226, 0.06);
}

[data-ui] .speeds button {
  flex: 1;
  min-height: 34px;
  padding: 0 4px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--card-soft);
  font-size: 0.8125rem;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  touch-action: manipulation;
}

[data-ui] .speeds button[aria-pressed='true'] {
  background: var(--accent);
  color: var(--accent-ink);
}

[data-ui] .play {
  width: 100%;
  min-height: 48px;
  margin-top: 2px;
  border: 0;
  border-radius: 10px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 1.0625rem;
  font-weight: 600;
  cursor: pointer;
  touch-action: manipulation;
  transition:
    transform var(--t-press) var(--ease-out),
    background-color var(--t-hover) ease;
}

[data-ui] .play:active {
  transform: scale(0.97);
}

[data-ui] .quiet {
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid rgba(243, 237, 226, 0.18);
  border-radius: 10px;
  background: transparent;
  color: var(--card-ink);
  font-size: 0.9375rem;
  cursor: pointer;
  touch-action: manipulation;
}

[data-ui] .card-hint,
[data-ui] .result-note,
[data-ui] .result-more {
  font-size: 0.8125rem;
  line-height: 1.4;
  color: var(--card-soft);
}

[data-ui] .result-more a {
  color: var(--accent-strong);
  font-weight: 500;
}

[data-ui] .result-note:empty {
  display: none;
}

/* With a mouse, the computer's keys play too (A is the lowest white key). */
[data-ui] .keyboard-hint {
  display: none;
  margin-top: -6px;
}

@media (hover: hover) and (pointer: fine) and (min-height: 701px) {
  [data-ui] .keyboard-hint {
    display: block;
  }
}

[data-ui] .verdict {
  font-family: var(--serif);
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.1;
}

[data-ui] .stars {
  display: flex;
  gap: 8px;
}

[data-ui] .stars svg {
  width: 34px;
  height: 34px;
  fill: rgba(243, 237, 226, 0.12);
}

[data-ui] .stars svg.on {
  fill: var(--accent);
}

[data-ui] .result-line {
  font-size: 0.9375rem;
}

@media (hover: hover) and (pointer: fine) {
  [data-ui] .play:hover {
    background: var(--accent-strong);
  }

  [data-ui] .card-step:hover {
    background: rgba(40, 33, 28, 0.95);
  }

  [data-ui] .tab:hover:not([aria-pressed='true']) {
    color: var(--ink);
  }
}

/* The keys: ivory and ebony, the felt line above them. */
[data-ui] .keys {
  position: relative;
  z-index: 3;
  display: grid;
  grid-template-columns: repeat(var(--whites, 8), minmax(0, 1fr));
  border-top: 3px solid var(--line);
  box-shadow: 0 -10px 24px -8px rgba(163, 48, 47, 0.55);
  background: #d8cfc1;
  touch-action: none;
  transition: box-shadow 500ms ease;
}

[data-ui] .key {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  min-width: 0;
  padding: 0 0 10px;
  border: 0;
  border-right: 1px solid rgba(26, 19, 13, 0.16);
  border-radius: 0 0 6px 6px;
  background: #f3ede2;
  box-shadow: inset 0 -5px 0 rgba(26, 19, 13, 0.13);
  color: rgba(26, 19, 13, 0.6);
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 90ms ease;
}

[data-ui] .key:last-child {
  border-right: 0;
}

[data-ui] .key svg {
  display: none;
}

[data-ui] .key.down {
  background: var(--accent-strong);
}

[data-ui] .key.wrong {
  background: #e9b7ae;
}

[data-ui] .key.black {
  position: absolute;
  top: 0;
  left: calc(var(--at) / var(--whites, 8) * 100%);
  width: calc(100% / var(--whites, 8) * 0.58);
  height: 60%;
  padding: 0;
  border: 0;
  border-radius: 0 0 5px 5px;
  background: #2b2420;
  box-shadow: inset 0 -6px 0 #120e0c;
  translate: -50% 0;
}

[data-ui] .key.black.down {
  background: #c47a5a;
}

/* --- Kids: the same game in its own sky -------------------------------------------------- */

[data-ui].stage[data-mode='kids'] {
  --lanes-bg: var(--sky);
  --line: #3d7bff;
  --grid: rgba(31, 42, 90, 0.08);
  --lane-line: rgba(31, 42, 90, 0.07);
  --card: #ffffff;
  --card-ink: var(--sky-ink);
  --card-soft: var(--sky-ink-soft);
  --hit: #16b364;
  --timing: #f08a00;
  --error: #f0444a;
  color: var(--sky-ink);
}

[data-ui][data-mode='kids'] .tabs,
[data-ui][data-mode='kids'] .speeds {
  background: rgba(31, 42, 90, 0.07);
}

[data-ui][data-mode='kids'] .tab {
  color: var(--sky-ink-soft);
}

[data-ui][data-mode='kids'] .tab[aria-pressed='true'],
[data-ui][data-mode='kids'] .speeds button[aria-pressed='true'] {
  background: var(--sun);
  color: var(--sky-ink);
}

[data-ui][data-mode='kids'] .card-body {
  border-radius: 22px;
  box-shadow: 0 14px 34px rgba(31, 42, 90, 0.22);
  font-family: var(--kids);
}

[data-ui][data-mode='kids'] .card-title,
[data-ui][data-mode='kids'] .verdict {
  font-family: var(--kids);
  font-weight: 600;
}

[data-ui][data-mode='kids'] .play {
  border-radius: 999px;
  background: var(--sun);
  box-shadow: 0 4px 0 #d9a91c;
  color: var(--sky-ink);
  font-family: var(--kids);
  font-size: 1.1875rem;
  font-weight: 600;
}

[data-ui][data-mode='kids'] .quiet {
  border-color: rgba(31, 42, 90, 0.2);
  border-radius: 999px;
  font-family: var(--kids);
}

[data-ui][data-mode='kids'] .card-step {
  background: rgba(255, 255, 255, 0.85);
  color: var(--sky-ink);
}

[data-ui][data-mode='kids'] .chip,
[data-ui][data-mode='kids'] .result-more {
  display: none;
}

[data-ui][data-mode='kids'] .stage-song,
[data-ui][data-mode='kids'] .feedback .word,
[data-ui][data-mode='kids'] .feedback .combo {
  font-family: var(--kids);
  font-weight: 600;
}

[data-ui][data-mode='kids'] .feedback .combo:not(:empty)::after {
  color: var(--sky-ink-soft);
}

[data-ui][data-mode='kids'] .stars svg {
  fill: rgba(31, 42, 90, 0.12);
}

[data-ui][data-mode='kids'] .stars svg.on {
  fill: var(--sun);
}

[data-ui][data-mode='kids'] .note {
  border-radius: 9px;
  background: var(--c);
}

[data-ui][data-mode='kids'] .note span {
  display: none;
}

[data-ui][data-mode='kids'] .note svg {
  display: block;
  width: min(62%, 26px);
  fill: rgba(31, 42, 90, 0.85);
}

[data-ui][data-mode='kids'] .beam {
  background: linear-gradient(to top, rgba(61, 123, 255, 0.35), rgba(61, 123, 255, 0)); /* taste-skill-ignore: the app's hit beam, only during a game */
}

[data-ui][data-mode='kids'] .keys {
  box-shadow: 0 -10px 24px -8px rgba(61, 123, 255, 0.45);
  background: #c7d3ea;
}

[data-ui][data-mode='kids'] .key {
  border-right-color: rgba(31, 42, 90, 0.14);
  background: color-mix(in srgb, var(--c) 30%, #ffffff);
  box-shadow: inset 0 -5px 0 rgba(31, 42, 90, 0.1);
  color: var(--sky-ink);
  font-family: var(--kids);
  font-weight: 600;
}

[data-ui][data-mode='kids'] .key svg {
  display: block;
  width: min(58%, 30px);
  fill: var(--c);
  stroke: var(--sky-ink);
  stroke-width: 1.6;
  stroke-linejoin: round;
}

[data-ui][data-mode='kids'] .key.down {
  background: color-mix(in srgb, var(--c) 70%, #ffffff);
}

[data-ui][data-mode='kids'] .key.black {
  background: #33427a;
  box-shadow: inset 0 -6px 0 var(--sky-ink);
}

[data-ui][data-mode='kids'] .key.black.down {
  background: var(--kc-sharp);
}

.pc-0 {
  --c: var(--kc-0);
}
.pc-2 {
  --c: var(--kc-2);
}
.pc-4 {
  --c: var(--kc-4);
}
.pc-5 {
  --c: var(--kc-5);
}
.pc-7 {
  --c: var(--kc-7);
}
.pc-9 {
  --c: var(--kc-9);
}
.pc-11 {
  --c: var(--kc-11);
}
.pc-1,
.pc-3,
.pc-6,
.pc-8,
.pc-10 {
  --c: var(--kc-sharp);
}

/* A phone keeps the card short: the song, the speed, Jogar. */
@media (max-width: 699px), (max-height: 700px) {
  [data-ui] .card-facts {
    display: none;
  }
}

/* Without script the piano is a picture of the game: nothing to press. */
html:not(.js) [data-ui] .play,
html:not(.js) [data-ui] .card-step,
html:not(.js) [data-ui] .speeds,
html:not(.js) [data-ui] .tabs {
  display: none;
}

/* --- The first screen: the name, what it does ---------------------------------------------- */

.nav {
  display: none;
}

.intro {
  display: flex;
  flex-direction: column;
  padding: 24px 0 0;
}

.wordmark {
  margin-left: -0.04em;
  font-size: min(15vw, 5.5rem);
  line-height: 0.9;
  letter-spacing: -0.04em;
  white-space: nowrap;
}

.statement {
  max-width: 26ch;
  margin-top: 18px;
  font-family: var(--serif);
  font-size: var(--step-lead);
  line-height: 1.3;
}

.intro-note {
  max-width: 40ch;
  margin-top: 12px;
  color: var(--muted);
}

/* --- The hymnal -------------------------------------------------------------------------------- */

.hymnal {
  padding: 88px 0 72px;
}

.section-lead {
  max-width: 46ch;
  margin-top: 18px;
}

.free-hymns {
  list-style: none;
  margin-top: 28px;
  padding: 0;
}

.free-hymns button {
  display: grid;
  grid-template-columns: 2.4rem minmax(0, 1fr);
  column-gap: 12px;
  align-items: baseline;
  width: 100%;
  padding: 10px 12px 10px 0;
  border: 0;
  border-radius: 10px;
  background: transparent;
  text-align: left;
  cursor: pointer;
  touch-action: manipulation;
  transition: background-color var(--t-hover) ease;
}

.free-hymns .n {
  grid-row: span 2;
  justify-self: end;
  font-family: var(--serif);
  font-size: 1.625rem;
  line-height: 1;
  color: var(--accent);
}

.free-hymns .t {
  font-family: var(--serif);
  font-size: var(--step-lead);
  line-height: 1.25;
}

.free-hymns .o {
  display: none;
  font-size: var(--step-small);
  color: var(--muted);
}

@media (min-width: 700px) {
  .free-hymns .o {
    display: block;
  }
}

/* A phone sets the ten as the index of the fifty is set: running on, each one a button. */
@media (max-width: 699px) {
  .free-hymns {
    margin-top: 22px;
    font-family: var(--serif);
    font-size: var(--step-lead);
    line-height: 1.6;
  }

  .free-hymns li {
    display: inline;
  }

  .free-hymns button {
    display: inline;
    width: auto;
    margin-right: 0.6em;
    padding: 2px 0;
    border-radius: 6px;
    font-size: inherit;
    line-height: inherit;
  }

  .free-hymns .n {
    margin-right: 0.3em;
    font-size: 0.8em;
  }

  .free-hymns .t {
    font-size: inherit;
    text-decoration: underline;
    text-decoration-color: rgba(201, 163, 90, 0.4);
    text-underline-offset: 0.18em;
    text-decoration-thickness: 0.06em;
  }

  .free-hymns button[aria-current='true'] {
    background: none;
  }
}

.free-hymns button[aria-current='true'] {
  background: var(--surface);
}

.free-hymns button[aria-current='true'] .t {
  color: var(--accent-strong);
}

@media (hover: hover) and (pointer: fine) {
  .free-hymns button:hover {
    background: var(--surface);
  }
}

/* The old hymnal itself: a page of 1861, warm paper among the ebony. */
.hymnal-page {
  margin: 44px calc(var(--margin) * -1) 0;
}

.hymnal-page img {
  width: 100%;
  aspect-ratio: 2.3;
  object-fit: cover;
  object-position: 20% 30%;
  background: var(--surface);
}

.hymnal-page figcaption {
  max-width: 46ch;
  margin-top: 12px;
  padding: 0 var(--margin);
  font-size: var(--step-small);
  color: var(--muted);
}

.index {
  margin-top: 44px;
}

.index-title {
  color: var(--muted);
}

/* The fifty, as a hymnal prints its index: the number, then the title, running on. */
.index-list {
  counter-reset: hymn 10;
  margin-top: 12px;
  padding: 0;
  font-family: var(--serif);
  font-size: var(--step-body);
  line-height: 1.75;
}

/* Folded, the index shows its first ten; the button opens the rest. */
.index:not(.open) .index-list li:nth-child(n + 11) {
  display: none;
}

.index:not(.open) .index-list::after {
  content: '…';
  color: var(--muted);
}

.index-list li {
  counter-increment: hymn;
  display: inline;
  margin-right: 0.85em;
}

.index-list li::before {
  content: counter(hymn);
  margin-right: 0.35em;
  font-size: 0.8em;
  color: var(--accent);
}

.index-more {
  margin-top: 14px;
  padding: 10px 0;
  border: 0;
  background: none;
  color: var(--accent-strong);
  font-weight: 500;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: transparent;
  text-underline-offset: 0.2em;
  transition: text-decoration-color var(--t-hover) ease;
}

@media (hover: hover) and (pointer: fine) {
  .index-more:hover {
    text-decoration-color: currentColor;
  }
}

/* --- The teacher (when config.js names him) ------------------------------------------------ */

.teacher {
  display: grid;
  gap: 20px;
  align-items: center;
  padding: 0 0 72px;
}

.teacher h2 {
  font-size: var(--step-lead);
  font-family: var(--serif);
}

.teacher-photo {
  width: 120px;
  height: 120px;
  object-fit: cover;
  border-radius: 50%;
}

.teacher-name {
  margin: 6px 0;
  font-family: var(--serif);
  font-style: italic;
  color: var(--accent-strong);
}

/* --- Kids: the sky --------------------------------------------------------------------------- */

.kids {
  margin: 0 calc(var(--margin) * -1);
  padding: 72px var(--margin) 80px;
  background: var(--sky);
  color: var(--sky-ink);
}

.kids h2 {
  font-family: var(--kids);
  font-weight: 600;
  letter-spacing: -0.01em;
}

.kids .section-lead {
  color: var(--sky-ink);
}

.kids p:not(.section-lead) {
  max-width: 46ch;
  margin-top: 28px;
  color: var(--sky-ink-soft);
}

.shapes {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 18px;
  margin-top: 28px;
  padding: 0;
  list-style: none;
}

.shapes li {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  font-family: var(--kids);
  font-weight: 600;
  font-size: var(--step-small);
}

.shapes svg {
  width: 34px;
  height: 34px;
  fill: var(--c);
  stroke: var(--sky-ink);
  stroke-width: 1.4;
  stroke-linejoin: round;
}

.kids-songs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
  padding: 0;
  list-style: none;
}

.kids-songs button {
  min-height: 44px;
  padding: 0 16px;
  border: 0;
  border-radius: 999px;
  background: #ffffff;
  color: var(--sky-ink);
  font-family: var(--kids);
  font-size: var(--step-small);
  font-weight: 500;
  cursor: pointer;
  touch-action: manipulation;
  transition:
    transform var(--t-press) var(--ease-out),
    background-color var(--t-hover) ease;
}

.kids-songs button:active {
  transform: scale(0.96);
}

/* The Kids home in the app (a real screenshot): on wide screens, beside the Kids piano. */
.kids-shot {
  display: none;
  margin: 40px 0 0;
}

.kids-shot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top;
  border-radius: var(--radius);
}

.kids-songs button[aria-current='true'] {
  background: var(--sun);
}

@media (hover: hover) and (pointer: fine) {
  .kids-songs button:hover:not([aria-current='true']) {
    background: #fff6d6;
  }
}

/* --- The two ways in --------------------------------------------------------------------------- */

.plans {
  display: grid;
}

.plan {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 56px var(--margin) 48px;
}

.plan p {
  max-width: 44ch;
}

.plan-lead {
  font-family: var(--serif);
  font-style: italic;
  font-size: var(--step-lead);
  line-height: 1.3;
}

/* The full access: the hymnal's cloth cover with its gilt frame. */
.plan.full {
  background: var(--cloth);
}

.plan.full::before {
  content: '';
  position: absolute;
  inset: 10px;
  border: 1px solid rgba(201, 163, 90, 0.55); /* taste-skill-ignore: the cover's stamped gilt frame (ADR-0025) */
  border-radius: 4px;
  pointer-events: none;
}

.plan.full .plan-lead {
  color: var(--accent-strong);
}

.plan.free {
  background: var(--surface);
}

.plan.free .plan-lead {
  color: var(--muted);
}

.plan-buy {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 14px;
  margin-top: 10px;
}

.price {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 6px 14px;
  font-family: var(--serif);
  font-size: var(--step-display);
  line-height: 0.9;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

.price small {
  font-family: var(--sans);
  font-size: var(--step-small);
  letter-spacing: 0;
  color: var(--muted);
}

.soon {
  font-family: var(--serif);
  font-size: var(--step-lead);
}

.plan .button {
  align-self: stretch;
}

.seal {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 8px;
  font-size: var(--step-small);
}

.seal p {
  max-width: 46ch;
}

.seal-mark {
  flex: none;
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-ink);
  font-family: var(--serif);
  font-size: 1.75rem;
  line-height: 1;
}

.plan.free .text-link {
  align-self: flex-start;
}

/* The free part, as it opens: the app's own hymn list (a real screenshot). */
.plan-shot {
  display: none;
  min-height: 0;
  margin: 0;
  overflow: hidden;
}

.plan-shot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: bottom;
  border-radius: var(--radius);
}

/* --- Questions, answered as reading text --------------------------------------------------- */

.faq {
  display: grid;
  gap: 28px;
  padding: 80px var(--margin);
}

.answers p {
  max-width: 62ch;
  margin-bottom: 18px;
  break-inside: avoid;
}

.answers strong {
  font-weight: 600;
}

/* --- The close: three notes fall toward the felt line and stop: the logo -------------------- */

.close {
  padding: 24px var(--margin) max(104px, calc(env(safe-area-inset-bottom) + 92px));
}

.signature {
  display: flex;
  align-items: center;
  gap: clamp(16px, 3vw, 40px);
}

.logo {
  flex: none;
  width: clamp(96px, 16vw, 200px);
  height: auto;
  overflow: visible;
}

.logo rect {
  fill: var(--accent);
}

.logo .b2 {
  fill: var(--accent-strong);
}

.logo .line {
  fill: var(--felt);
}

.signature-name {
  font-family: var(--serif);
  font-size: var(--step-head);
  line-height: 1;
  letter-spacing: -0.02em;
}

.signature-line {
  margin-top: 10px;
  font-family: var(--serif);
  font-style: italic;
  font-size: var(--step-lead);
  color: var(--accent-strong);
}

.fine-print {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 28px;
  margin-top: 36px;
  font-size: var(--step-small);
  color: var(--muted);
}

.fine-print a {
  color: var(--ink);
}

/* --- The buy bar: phones, once the first screen has gone ------------------------------------ */

.buybar {
  position: fixed;
  inset: auto 0 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px var(--margin) max(10px, env(safe-area-inset-bottom));
  background: var(--surface-2);
  box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.35); /* taste-skill-ignore: a fixed bar floats over the page */
  animation: buybar 240ms var(--ease-out);
}

.buybar p {
  font-size: var(--step-small);
  color: var(--muted);
}

.buybar strong {
  margin-right: 6px;
  font-family: var(--serif);
  font-weight: 400;
  font-size: 1.125rem;
  color: var(--ink);
}

@keyframes buybar {
  from {
    transform: translateY(100%);
  }
}

/* --- Motion: the first screen, entrances, the landing notes --------------------------------- */

@media (prefers-reduced-motion: no-preference) {
  .js .wordmark,
  .js .statement,
  .js .intro-note {
    animation: rise var(--t-reveal) var(--ease-out) both;
    animation-delay: calc(var(--i, 0) * 90ms + 200ms);
  }

  .js .statement {
    --i: 1;
  }

  .js .intro-note {
    --i: 2;
  }

  .js [data-ui] .keys {
    animation: lid 900ms var(--ease-out) both;
  }

  .js [data-reveal] {
    opacity: 0;
    translate: 0 24px;
    transition:
      opacity 700ms var(--ease-out),
      translate 900ms var(--ease-out);
    transition-delay: calc(var(--i, 0) * 80ms);
  }

  .js [data-reveal].is-in {
    opacity: 1;
    translate: 0 0;
  }

  /* The end of the film: the notes fall and stop just above the line. */
  .js .signature .logo rect:not(.line) {
    opacity: 0;
    translate: 0 -26px;
    transition:
      translate 1100ms var(--ease-out),
      opacity 400ms ease;
  }

  .js .signature .b2 {
    transition-delay: 140ms;
  }

  .js .signature .b3 {
    transition-delay: 280ms;
  }

  .js .signature.is-in .logo rect {
    opacity: 1;
    translate: 0 0;
  }

  /* The name grows heavier as the first screen leaves. */
  @supports (animation-timeline: view()) {
    .js .wordmark {
      transform-origin: left bottom;
      animation:
        rise var(--t-reveal) var(--ease-out) both 200ms,
        settle linear both;
      animation-timeline: auto, view();
      animation-range:
        normal,
        exit 0% exit 100%;
    }
  }
}

@keyframes rise {
  from {
    opacity: 0;
    translate: 0 22px;
  }
}

@keyframes lid {
  from {
    translate: 0 40%;
  }
}

@keyframes settle {
  to {
    scale: 0.93;
  }
}

/* --- Wider screens --------------------------------------------------------------------------- */

@media (min-width: 700px) {
  .stage-wrap {
    padding: 16px 16px 0;
  }

  [data-ui].stage {
    height: clamp(520px, 62svh, 680px);
  }

  .answers {
    columns: 2;
    column-gap: 48px;
  }
}

@media (min-width: 900px) {
  .plans {
    grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  }

  .plan {
    padding: clamp(48px, 5vw, 80px) clamp(32px, 4vw, 64px);
  }

  .plan h2 {
    font-size: clamp(2.5rem, 1rem + 3vw, 4.5rem);
  }

  .plan-buy {
    margin-top: auto;
    padding-top: 18px;
  }

  .plan-shot {
    display: block;
    width: min(220px, 64%);
    aspect-ratio: 390 / 500;
    margin-top: 10px;
  }

  .faq {
    grid-template-columns: minmax(0, 3fr) minmax(0, 9fr);
    padding: 120px var(--margin);
  }
}

/* The split: the piano stays while the reading column scrolls. */
@media (min-width: 1024px) {
  :root {
    /* The keys' height on the fixed piano: the first screen's text keeps clear of it. */
    --keys-desk: clamp(150px, 22svh, 210px);
  }

  .split {
    display: grid;
    grid-template-columns: minmax(0, 47fr) minmax(0, 53fr);
  }

  .stage-wrap {
    position: sticky;
    top: 0;
    align-self: start;
    height: 100svh;
    padding: 20px 0 20px 20px;
  }

  [data-ui].stage {
    --bar: 60px;
    --keys-h: var(--keys-desk);
    height: 100%;
  }

  .read {
    position: relative;
    z-index: 2;
    padding: 0 var(--margin) 0 clamp(40px, 5vw, 88px);
  }

  .nav {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 28px;
    padding-top: 28px;
    font-size: var(--step-small);
  }

  .nav a:not(.button) {
    color: var(--muted);
    text-decoration: none;
    transition: color var(--t-hover) ease;
  }

  .nav a:not(.button):hover {
    color: var(--ink);
  }

  .intro {
    min-height: calc(100svh - 72px);
    padding: 0;
  }

  .statement {
    order: 1;
    margin-top: 18svh;
  }

  /* The name runs across the first screen and over the piano's edge, above its keys;
     it steps back while a song is played, so no note falls behind it. */
  .wordmark {
    order: 2;
    margin: auto 0 0 calc(-10vw - clamp(40px, 5vw, 88px));
    font-size: clamp(5rem, 9vw, 9.5rem);
    pointer-events: none;
    transition: opacity 400ms ease;
  }

  .split:has([data-phase='playing']) .wordmark,
  .split:has([data-phase='loading']) .wordmark {
    opacity: 0.1;
  }

  .intro-note {
    order: 3;
    margin: 26px 0 calc(var(--keys-desk) - 24px);
  }

  .hymnal {
    padding: 12svh 0 120px;
  }

  .index:not(.open) .index-list li:nth-child(n + 11) {
    display: inline;
  }

  .index:not(.open) .index-list::after {
    content: none;
  }

  .index-more {
    display: none;
  }

  .hymnal-page {
    margin: 52px 0 0;
  }

  .hymnal-page img {
    aspect-ratio: auto;
    border-radius: var(--radius);
  }

  .hymnal-page figcaption {
    padding: 0;
  }

  .kids-shot {
    display: block;
    width: 240px;
    aspect-ratio: 390 / 600;
  }

  .teacher {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .kids {
    margin: 0 calc(var(--margin) * -1) 0 calc(clamp(40px, 5vw, 88px) * -1);
    padding: 120px var(--margin) 140px clamp(40px, 5vw, 88px);
    min-height: 100svh;
  }

  .buybar {
    display: none !important;
  }

  .close {
    padding-bottom: 48px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}
