/* Learn Piano Keys - design system
   Palette taken from the instrument itself: rosewood case, ivory keys,
   brass pedal lyre, crimson fallboard felt. Hands are colour-coded
   throughout: left = slate, right = felt rose. */

:root {
  --ink:        #14100F;
  --ink-2:      #1B1614;
  --ink-3:      #251E1A;
  --ink-4:      #332A24;
  --ivory:      #F4EDE2;
  --ivory-2:    #A79A8C;
  --ivory-3:    #6F655C;
  --brass:      #D4A343;
  --brass-dim:  #8A6C2C;
  --brass-ink:  #241B08;
  --felt:       #9E3B45;
  --hand-l:     #6FB6DC;
  --hand-r:     #D96E68;
  --good:       #7FA86F;
  --shadow:     0 30px 70px -30px rgba(0,0,0,.9);

  --display: 'Bodoni Moda', Georgia, 'Times New Roman', serif;
  --body: 'Instrument Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  --wrap: 1120px;
  --r: 10px;
  --ease: cubic-bezier(.22,.61,.36,1);
}

[data-theme="light"] {
  --ink:        #F6F1E7;
  --ink-2:      #FFFDF8;
  --ink-3:      #E6DDCC;
  --ink-4:      #D2C5AF;
  --ivory:      #17120F;
  --ivory-2:    #574E45;
  --ivory-3:    #837868;
  --brass:      #8A6612;
  --brass-dim:  #C0A056;
  --brass-ink:  #FFFDF8;
  --felt:       #8E333D;
  --hand-l:     #2C7CA8;
  --hand-r:     #B04A44;
  --good:       #4A7738;
  --shadow:     0 24px 50px -28px rgba(40,30,15,.5);
}

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

html, body {
  margin: 0; padding: 0;
  max-width: 100%;
  background: var(--ink);
  color: var(--ivory);
  font-family: var(--body);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}
@supports not (overflow-x: clip) {
  html, body { overflow-x: hidden; }
}

img, canvas, svg, video, table, pre { max-width: 100%; }
img { display: block; }
a { color: var(--brass); text-decoration: none; }
a:hover { text-decoration: underline; }

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

h1, h2, h3 {
  font-family: var(--display); font-weight: 500;
  letter-spacing: -.015em; line-height: 1.08; margin: 0 0 .5em;
}
h1 { font-size: clamp(2.4rem, 6vw, 4.4rem); }
h2 { font-size: clamp(1.8rem, 3.4vw, 2.7rem); }
h3 { font-size: 1.2rem; font-family: var(--body); font-weight: 600; letter-spacing: 0; }
main h2 + p, main h1 + p { margin-top: 0; }

p { margin: 0 0 1.1em; }
.lede { font-size: 1.14rem; color: var(--ivory-2); max-width: 62ch; }
.muted { color: var(--ivory-2); }
.eyebrow {
  font-family: var(--mono); font-size: .72rem; letter-spacing: .18em;
  text-transform: uppercase; color: var(--brass); margin: 0 0 1.1em;
}

.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 24px; }
section { padding: 82px 0; border-top: 1px solid var(--ink-3); }
section:first-of-type { border-top: 0; }
main.narrow .wrap { max-width: 780px; }
main.narrow h2 { font-size: 1.25rem; font-family: var(--body); font-weight: 600; letter-spacing: 0; margin-top: 1.8em; }

/* ---------- header ---------- */
.site-head {
  position: sticky; top: 0; z-index: 60;
  background: color-mix(in srgb, var(--ink) 88%, transparent);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--ink-3);
}
.site-head .wrap { display: flex; align-items: center; gap: 20px; height: 64px; }
.brand {
  font-family: var(--display); font-size: 1.2rem; font-weight: 600;
  letter-spacing: -.01em; color: var(--ivory); text-decoration: none;
  display: flex; align-items: center; gap: 10px; white-space: nowrap;
}
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 22px; height: 22px; flex: 0 0 22px; border-radius: 3px;
  background: linear-gradient(90deg, var(--ivory) 0 34%, var(--ink) 34% 46%, var(--ivory) 46% 66%, var(--ink) 66% 78%, var(--ivory) 78% 100%);
  box-shadow: inset 0 -3px 0 var(--felt);
}
.nav { margin-left: auto; display: flex; align-items: center; gap: 22px; }
.nav a { color: var(--ivory-2); font-size: .92rem; white-space: nowrap; }
.nav a:hover, .nav a[aria-current] { color: var(--ivory); text-decoration: none; }
.nav a[aria-current] { border-bottom: 1px solid var(--brass); }
/* Buttons keep their own text colour inside the nav. Without these the
   .nav a rule wins on specificity and brass buttons lose their contrast. */
.nav a.btn-primary, .nav a.btn-primary:hover { color: var(--brass-ink); border-bottom: 0; }
.nav a.btn-ghost, .nav a.btn-ghost:hover { color: var(--ivory); border-bottom: 0; }
.nav a.pill, .nav a.pill:hover { border-bottom: 0; }
.nav-toggle {
  display: none; margin-left: auto; background: none;
  border: 1px solid var(--ink-4); color: var(--ivory);
  border-radius: var(--r); padding: 8px 12px; font: inherit; font-size: .85rem; cursor: pointer;
}
.theme-toggle {
  background: none; border: 1px solid var(--ink-4); color: var(--ivory-2);
  border-radius: 999px; padding: 5px 12px; font: inherit; font-size: .78rem; cursor: pointer;
}
.theme-toggle:hover { color: var(--ivory); border-color: var(--ivory-3); }

.crumbs { border-bottom: 1px solid var(--ink-3); font-size: .82rem; }
.crumbs .wrap { padding-top: 12px; padding-bottom: 12px; color: var(--ivory-3); }
.crumbs a { color: var(--ivory-2); }
.crumbs .sep { margin: 0 8px; opacity: .5; }
.crumbs span[aria-current] { color: var(--ivory); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 13px 22px; border-radius: var(--r); border: 1px solid transparent;
  font: inherit; font-size: .95rem; font-weight: 600; cursor: pointer; text-decoration: none;
  transition: transform .16s var(--ease), background .16s var(--ease), border-color .16s var(--ease);
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn[disabled] { opacity: .38; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--brass); color: var(--brass-ink); }
.btn-ghost { background: transparent; color: var(--ivory); border-color: var(--ink-4); }
.btn-ghost:hover { border-color: var(--ivory-3); }
.btn-sm { padding: 9px 14px; font-size: .87rem; }

.pill {
  background: transparent; color: var(--ivory-2);
  border: 1px solid var(--ink-4); border-radius: 999px;
  padding: 8px 14px; font: inherit; font-size: .84rem; cursor: pointer;
  transition: all .16s var(--ease); text-decoration: none;
}
.pill:hover { border-color: var(--ivory-3); color: var(--ivory); text-decoration: none; }
.pill.active { background: var(--brass); border-color: var(--brass); color: var(--brass-ink); font-weight: 600; }
.pill-row { display: flex; gap: 8px; flex-wrap: wrap; }
.pill-row .label {
  font-family: var(--mono); font-size: .68rem; letter-spacing: .1em; text-transform: uppercase;
  color: var(--ivory-3); align-self: center; margin-right: 4px;
}

/* ---------- hero ---------- */
.hero { padding: 72px 0 0; }
.hero h1 { max-width: 15ch; }
.hero h1 em { font-style: italic; color: var(--brass); }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
.hero-note { font-family: var(--mono); font-size: .76rem; color: var(--ivory-3); margin-top: 18px; }
.page-head { padding-bottom: 40px; }
.lesson-hero { padding: 62px 0 28px; }

/* ---------- the keybed ---------- */
.keybed-stage { margin-top: 50px; }
.keybed-hint {
  font-family: var(--mono); font-size: .74rem; letter-spacing: .1em;
  text-transform: uppercase; color: var(--ivory-3); text-align: center; margin-bottom: 14px;
}
.note-read { color: var(--brass); margin-left: 8px; letter-spacing: .05em; }
.keybed {
  position: relative; height: 200px; max-width: 940px; margin: 0 auto;
  border-radius: 8px 8px 4px 4px;
  background: linear-gradient(180deg, #2A211C 0 10px, #1A1412 10px 18px);
  padding: 18px 12px 0;
  box-shadow: var(--shadow), inset 0 1px 0 rgba(244,237,226,.06);
  overflow: hidden; touch-action: manipulation;
}
.keybed::before { content: ''; position: absolute; left: 0; right: 0; top: 10px; height: 5px; background: var(--felt); opacity: .85; }
.keybed.short { height: 168px; max-width: none; }
.keys { position: relative; height: 100%; }
.wkey {
  position: absolute; bottom: 0; top: 0;
  background: linear-gradient(180deg, #FBF6EC 0%, #EFE7DA 72%, #D6CCBC 100%);
  border-radius: 0 0 5px 5px; border: 1px solid #2A211C; border-top: 0;
  box-shadow: inset 0 -6px 8px -6px rgba(0,0,0,.35);
  transition: transform .06s linear, background .12s linear;
  transform-origin: top center; cursor: pointer;
}
.bkey {
  position: absolute; top: 0; height: 62%;
  background: linear-gradient(180deg, #2E2622 0%, #171210 88%);
  border-radius: 0 0 4px 4px; border: 1px solid #0C0908;
  box-shadow: 0 4px 6px -2px rgba(0,0,0,.7); z-index: 3;
  transition: transform .06s linear, background .12s linear;
  transform-origin: top center; cursor: pointer;
}
.wkey.on { background: linear-gradient(180deg,#FFF3D9 0%, #F0DCAE 100%); transform: scaleY(.985); }
.bkey.on { background: linear-gradient(180deg,#6A5326 0%, #3A2C13 100%); transform: scaleY(.985); }
.wkey.lh.on, .bkey.lh.on { background: linear-gradient(180deg,#C6E5F5 0%, #6FB6DC 100%); }
.wkey.rh.on, .bkey.rh.on { background: linear-gradient(180deg,#F2BDB9 0%, #D96E68 100%); }
/* One animation, variable-driven, so screen sizes tune thickness without a
   second @keyframes definition (duplicate names behave differently across
   browser engines and once killed this glow). */
.wkey.target, .bkey.target {
  --tg: var(--brass);
  --tg-ring: 3px; --tg-ring-2: 6px;
  --tg-halo: 10px; --tg-spread: 2px; --tg-halo-2: 22px; --tg-spread-2: 7px;
  animation: target 1.1s ease-in-out infinite;
}
.wkey.target.t-l, .bkey.target.t-l { --tg: var(--hand-l); }
.wkey.target.t-r, .bkey.target.t-r { --tg: var(--hand-r); }
@keyframes target {
  0%, 100% { box-shadow: inset 0 0 0 var(--tg-ring) var(--tg), 0 0 var(--tg-halo) var(--tg-spread) var(--tg); }
  50% { box-shadow: inset 0 0 0 var(--tg-ring-2) var(--tg), 0 0 var(--tg-halo-2) var(--tg-spread-2) var(--tg); }
}
@media (max-width: 700px) {
  .wkey.target, .bkey.target {
    --tg-ring: 4px; --tg-ring-2: 8px;
    --tg-halo: 12px; --tg-spread: 3px; --tg-halo-2: 26px; --tg-spread-2: 9px;
  }
  .wkey.target.t-l { background: linear-gradient(180deg,#E4F2FA 0%, #A9D3E9 100%); }
  .wkey.target.t-r { background: linear-gradient(180deg,#FAE6E4 0%, #EBB1AD 100%); }
  .bkey.target.t-l { background: linear-gradient(180deg,#3E6B84 0%, #24485C 100%); }
  .bkey.target.t-r { background: linear-gradient(180deg,#8C4642 0%, #5F2C29 100%); }
}
.wkey.lit { background: linear-gradient(180deg,#FFF0C8 0%, #EBD79C 100%); }
.bkey.lit { background: linear-gradient(180deg,#7A5F26 0%, #4A3812 100%); }
.wkey.middle-c { box-shadow: inset 0 -6px 8px -6px rgba(0,0,0,.35), inset 0 0 0 2px rgba(212,163,67,.5); }
.wkey .kn {
  position: absolute; bottom: 8px; left: 0; right: 0; text-align: center;
  font-family: var(--mono); font-size: .7rem; font-weight: 700; color: #1E1712; pointer-events: none;
}
.wkey .kf {
  position: absolute; bottom: 26px; left: 0; right: 0; text-align: center;
  font-family: var(--mono); font-size: .72rem; font-weight: 600; color: var(--felt); pointer-events: none;
}
.bkey .kn {
  position: absolute; bottom: 8px; left: 50%; transform: translateX(-50%);
  writing-mode: vertical-rl; text-orientation: upright;
  font-family: var(--mono); font-size: .68rem; font-weight: 700; letter-spacing: 1px;
  color: #C9BCA8; pointer-events: none;
}
.keys.hide-names .kn { display: none; }

/* Finger chip: which finger presses this key, in the hand's colour. */
.fchip {
  position: absolute; left: 50%; transform: translateX(-50%); bottom: 34%;
  min-width: 17px; height: 17px; line-height: 17px; border-radius: 50%;
  font-family: var(--mono); font-size: .62rem; font-weight: 700; text-align: center;
  pointer-events: none; z-index: 5;
}
.fchip.fc-l { background: var(--hand-l); color: #0E2431; }
.fchip.fc-r { background: var(--hand-r); color: #2E0C0A; }
.bkey .fchip { bottom: 42%; }

/* ---------- cards and grids ---------- */
.grid { display: grid; gap: 20px; }
.g2 { grid-template-columns: repeat(2, 1fr); }
.g3 { grid-template-columns: repeat(3, 1fr); }
.card {
  background: var(--ink-2); border: 1px solid var(--ink-3);
  border-radius: var(--r); padding: 24px;
}
.card h3, .card h2 { margin-bottom: 8px; }
.card p:last-child { margin-bottom: 0; }
.card-num {
  font-family: var(--mono); font-size: .72rem; color: var(--brass);
  letter-spacing: .12em; display: block; margin-bottom: 12px;
}
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 36px; align-items: start; }

.path-card {
  display: flex; flex-direction: column;
  background: var(--ink-2); border: 1px solid var(--ink-3);
  border-radius: var(--r); padding: 24px; color: var(--ivory); text-decoration: none;
  transition: border-color .16s var(--ease), transform .16s var(--ease);
}
.path-card:hover { border-color: var(--brass-dim); transform: translateY(-2px); text-decoration: none; }
.path-card p { color: var(--ivory-2); flex: 1 1 auto; }
.path-card.start { border-color: var(--brass-dim); }
.path-go { color: var(--brass); font-size: .88rem; font-weight: 600; margin-top: 6px; }

.piece {
  display: flex; align-items: center; gap: 18px; padding: 18px 20px;
  background: var(--ink-2); border: 1px solid var(--ink-3); border-radius: var(--r);
  text-decoration: none; color: var(--ivory);
  transition: border-color .16s var(--ease), transform .16s var(--ease);
}
.piece:hover { border-color: var(--brass-dim); transform: translateY(-2px); text-decoration: none; }
.piece-lvl {
  flex: 0 0 46px; height: 46px; border-radius: 8px; display: grid; place-items: center;
  font-family: var(--mono); font-size: .95rem; background: var(--ink-3); color: var(--brass);
}
.piece-t { font-weight: 600; }
.piece-c { font-size: .86rem; color: var(--ivory-2); }
.piece-go { margin-left: auto; color: var(--brass); font-size: .88rem; }

.basics-panel { background: var(--ink-2); border: 1px solid var(--ink-3); border-radius: var(--r); padding: 22px; }

/* ---------- comparison table ---------- */
.compare { width: 100%; border-collapse: collapse; font-size: .95rem; }
.compare th, .compare td { padding: 13px 16px; text-align: left; border-bottom: 1px solid var(--ink-3); vertical-align: top; }
.compare thead th { font-family: var(--mono); font-size: .72rem; letter-spacing: .12em; text-transform: uppercase; color: var(--ivory-2); }
.compare thead th:last-child { color: var(--brass); }
.compare td.no { color: var(--ivory-3); }
.compare td.yes { color: var(--good); font-weight: 600; }
.table-scroll { overflow-x: auto; }

/* ---------- FAQ ---------- */
details.faq { border-bottom: 1px solid var(--ink-3); padding: 18px 0; }
details.faq summary { cursor: pointer; font-weight: 600; list-style: none; display: flex; align-items: center; gap: 12px; }
details.faq summary::-webkit-details-marker { display: none; }
details.faq summary::before { content: '+'; color: var(--brass); font-family: var(--mono); }
details.faq[open] summary::before { content: '\2013'; }
details.faq p { margin: 12px 0 0; color: var(--ivory-2); }

/* ---------- beginner lesson ---------- */
.lesson-stage { padding-top: 20px; }
.steps { display: flex; gap: 8px; list-style: none; padding: 0; margin: 0 0 22px; justify-content: center; }
.steps li {
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  background: var(--ink-3); color: var(--ivory-3);
  font-family: var(--mono); font-size: .76rem;
}
.steps li.on { background: var(--brass); color: var(--brass-ink); font-weight: 600; }
.steps li.done { background: var(--good); color: var(--ink); }
.lesson-card {
  max-width: 860px; margin: 0 auto; padding: 30px;
  background: var(--ink-2); border: 1px solid var(--ink-3); border-radius: 14px;
}
.step-kicker { font-family: var(--mono); font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; color: var(--ivory-3); margin: 0 0 6px; }
.lesson-card h2 { font-size: clamp(1.5rem, 3vw, 2.1rem); }
.step-body { color: var(--ivory-2); font-size: 1.06rem; max-width: 60ch; }
.lesson-keys { margin: 22px 0 10px; }
.lesson-read { text-align: center; font-family: var(--mono); font-size: .9rem; color: var(--brass); margin: 10px 0 0; min-height: 1.4em; }
.step-feedback { min-height: 1.5em; font-weight: 600; margin: 6px 0 14px; }
.step-feedback.ok { color: var(--good); }
.step-feedback.no { color: var(--felt); }
.lesson-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.lesson-done { max-width: 860px; margin: 0 auto; text-align: center; }

/* ---------- tools ---------- */
.tool .keybed.short { height: 130px; margin-top: 16px; }
.tool-row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 14px; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field span { font-family: var(--mono); font-size: .68rem; letter-spacing: .1em; text-transform: uppercase; color: var(--ivory-3); }
select, input[type=email] {
  background: var(--ink-3); color: var(--ivory); border: 1px solid var(--ink-4);
  border-radius: var(--r); padding: 9px 12px; font: inherit; font-size: .9rem;
}
.tool-read { display: flex; gap: 14px; align-items: baseline; flex-wrap: wrap; margin: 0; }
.tool-read strong { font-family: var(--display); font-size: 1.5rem; font-weight: 500; }
.tool-read span { font-family: var(--mono); font-size: .92rem; color: var(--brass); letter-spacing: .04em; }
.metro-bpm { margin: 0 0 6px; }
.metro-bpm strong { font-family: var(--display); font-size: 3rem; line-height: 1; }
.metro-bpm span { font-family: var(--mono); font-size: .74rem; color: var(--ivory-3); letter-spacing: .12em; }
.beat-lights { display: flex; gap: 8px; margin-top: 16px; }
.beat-lights i { width: 11px; height: 11px; border-radius: 50%; background: var(--ink-4); display: block; }
.beat-lights i.on { background: var(--ivory-3); }
.beat-lights i.on.accent { background: var(--brass); }
.quiz-ask { font-family: var(--display); font-size: 1.5rem; margin: 0 0 10px; min-height: 1.4em; }
.quiz-score { display: flex; gap: 22px; font-size: .88rem; color: var(--ivory-2); margin-bottom: 6px; }
.quiz-score strong { color: var(--ivory); font-family: var(--mono); }

/* ---------- practice tracker ---------- */
.stat .stat-val { font-family: var(--display); font-size: 2.6rem; line-height: 1; margin: 0 0 6px; }
.stat .stat-val strong { font-weight: 500; }
.timer-card .timer-row { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.timer-clock { font-family: var(--display); font-size: clamp(2.6rem, 7vw, 4rem); line-height: 1; margin: 0; }
.heat { display: flex; gap: 5px; align-items: flex-end; height: 74px; margin: 6px 0 12px; }
.heat i { flex: 1 1 auto; background: var(--ink-3); border-radius: 3px 3px 0 0; display: block; min-height: 4px; }
.heat i.has { background: var(--brass); }
.best-row { display: flex; gap: 12px; align-items: baseline; padding: 9px 0; border-bottom: 1px solid var(--ink-3); font-size: .9rem; }
.best-row:last-child { border-bottom: 0; }
.best-row b { font-weight: 600; min-width: 200px; }
.best-row span { color: var(--ivory-2); font-family: var(--mono); font-size: .82rem; }

/* ---------- practice room ---------- */
body.wide main { max-width: 1180px; margin: 0 auto; }
.stage { padding: 20px 20px 40px; }
.stage-head { display: flex; align-items: flex-end; gap: 20px; flex-wrap: wrap; margin-bottom: 18px; }
.stage-head h1 { font-size: clamp(1.6rem, 3.2vw, 2.3rem); margin: 0 0 4px; }
.stage-meta { font-family: var(--mono); font-size: .74rem; color: var(--ivory-3); }
.stage-head .picker { margin-left: auto; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

.badge {
  font-family: var(--mono); font-size: .7rem; letter-spacing: .08em;
  padding: 6px 10px; border-radius: 999px;
  background: var(--ink-3); color: var(--ivory-2); white-space: nowrap;
}
.badge.ok { color: var(--good); box-shadow: inset 0 0 0 1px rgba(127,168,111,.35); }
.badge.warn { color: var(--brass); box-shadow: inset 0 0 0 1px rgba(212,163,67,.3); }

/* Status badges carry a small light: they report state rather than invite a click. */
.badge.status { position: relative; padding-left: 24px; }
.badge.status::before {
  content: ''; position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
  width: 7px; height: 7px; border-radius: 50%; background: var(--ivory-3);
}
.badge.status.ok::before { background: var(--good); }
.badge.status.warn::before { background: var(--brass); }
.badge.sess { position: relative; }
.badge.sess::before {
  content: ''; position: absolute; left: 11px; top: 50%; transform: translateY(-50%);
  width: 7px; height: 7px; border-radius: 50%; background: var(--brass);
}
.badge.sess.paused::before { background: var(--ivory-3); }
button.badge { border: 0; cursor: pointer; font: inherit; font-family: var(--mono); font-size: .7rem; letter-spacing: .08em; line-height: inherit; }
button.badge:hover { box-shadow: inset 0 0 0 1px rgba(244,237,226,.25); }

/* The quiet session clock, and the way out of a session. */
.badge.sess {
  font-variant-numeric: tabular-nums;
  font-size: .95rem; font-weight: 700; color: var(--brass);
  background: var(--ink); box-shadow: inset 0 0 0 1px var(--brass-dim);
  padding: 7px 14px 7px 26px;
}
.badge.sess.paused { opacity: .55; }
.badge.sess-finish { background: var(--brass); color: var(--brass-ink); }
.badge.sess-finish:hover { box-shadow: none; filter: brightness(1.06); }

/* Rotate tip: phones held upright only. Never shown on desktops or laptops,
   and it removes itself the moment the phone is turned sideways. */
.rotate-tip { display: none; }
@media (max-width: 700px) and (orientation: portrait) and (hover: none) and (pointer: coarse) {
  .rotate-tip {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    margin: 10px 0 0; padding: 9px 12px;
    background: var(--ink-2); border: 1px solid var(--ink-4); border-radius: 10px;
    font-size: .78rem; color: var(--ivory-2);
  }
}
.rotate-tip[hidden] { display: none !important; }
.rotate-tip-close {
  background: none; border: 1px solid var(--ink-4); border-radius: 999px;
  color: var(--ivory-2); font: inherit; font-size: .7rem; padding: 4px 10px;
  cursor: pointer; white-space: nowrap;
}

/* ---------- the lesson course ---------- */
.learn-box { margin-bottom: 30px; }
.learn-list, .recap-list { margin: 8px 0 14px; padding-left: 20px; }
.learn-list li, .recap-list li { margin: 7px 0; color: var(--ivory); font-size: .97rem; }
.recap-list li { font-size: 1rem; }
.read-on { font-size: .88rem; margin-top: 6px; }

.lesson-ex .keybed.lesson-kb { height: 170px; margin: 18px 0 4px; max-width: 100%; }
.ex-prompt { font-size: 1.02rem; color: var(--ivory); margin: 16px 0 6px; }
.ex-feedback { min-height: 1.4em; font-size: .9rem; color: var(--felt-2, #D98089); margin: 10px 0 0; }
.ex-feedback.good { color: var(--good); }
.ex-done { margin-top: 16px; border-top: 1px solid var(--ink-3); padding-top: 14px; }
.beat-dots { display: flex; gap: 10px; margin: 10px 0 4px; }
.bdot {
  width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-family: var(--mono); font-size: .75rem; color: var(--ivory-2);
  box-shadow: inset 0 0 0 1px var(--ink-4);
}
.bdot.expect { box-shadow: inset 0 0 0 2px var(--brass); color: var(--ivory); }
.bdot.now { background: var(--ink-3); }
.bdot.hit { background: var(--good); color: #10230C; box-shadow: none; }
.bdot.missed { box-shadow: inset 0 0 0 2px var(--felt); color: var(--felt); }
.staff-wrap { margin: 14px 0 4px; }
.staff-wrap canvas { max-width: 360px; width: 100%; display: block; }

/* quiz */
.quiz-toggle { display: inline-flex; gap: 8px; align-items: center; font-size: .85rem; color: var(--ivory-2); margin-top: 10px; cursor: pointer; }
.quiz-head { display: flex; justify-content: space-between; align-items: center; font-family: var(--mono); font-size: .72rem; letter-spacing: .08em; color: var(--ivory-2); margin-bottom: 12px; }
.q-timer { font-variant-numeric: tabular-nums; }
.q-timer.warn { color: var(--brass); font-weight: 700; }
.q-text { font-family: var(--display); font-size: 1.25rem; margin: 0 0 14px; }
.q-opts { display: grid; gap: 8px; }
.qopt {
  text-align: left; padding: 11px 14px; border-radius: 10px; cursor: pointer;
  background: var(--ink-2); border: 1px solid var(--ink-4); color: var(--ivory);
  font: inherit; font-size: .93rem; transition: border-color .12s linear;
}
.qopt:hover:not(:disabled) { border-color: var(--brass-dim); }
.qopt:disabled { cursor: default; opacity: .92; }
.qopt.q-right { border-color: var(--good); box-shadow: inset 0 0 0 1px var(--good); }
.qopt.q-right::after { content: ' \2713'; color: var(--good); font-weight: 700; }
.qopt.q-wrong { border-color: var(--felt); box-shadow: inset 0 0 0 1px var(--felt); }
.qopt.q-wrong::after { content: ' \2717'; color: var(--felt); font-weight: 700; }
.q-verdict { font-weight: 600; margin: 12px 0 4px; }
.q-verdict.good { color: var(--good); }
.q-verdict.bad { color: var(--felt); }
.q-explain { display: block; font-size: .88rem; color: var(--ivory-2); margin: 4px 0 12px; }
.q-score { font-family: var(--display); font-size: 2rem; margin: 0 0 6px; }
.q-band { font-size: 1rem; color: var(--ivory); margin: 0 0 16px; }
.q-review { border-top: 1px solid var(--ink-3); padding: 12px 0; }
.q-review b { display: block; margin-bottom: 4px; }
.q-review-a { display: block; font-size: .88rem; color: var(--good); margin-bottom: 2px; }

.course-row { display: flex; justify-content: space-between; gap: 14px; padding: 9px 0; border-bottom: 1px solid var(--ink-3); font-size: .9rem; }
.course-row:last-child { border-bottom: 0; }
.course-stat { font-family: var(--mono); font-size: .64rem; letter-spacing: .06em; color: var(--ivory-3); text-align: right; }
.course-stat.has-progress { color: var(--good); }

/* hub */
.lesson-list { display: grid; gap: 12px; }
.lesson-card {
  display: flex; gap: 16px; align-items: center; text-decoration: none;
  background: var(--ink-2); border: 1px solid var(--ink-4); border-radius: 14px; padding: 16px 18px;
  transition: border-color .12s linear;
}
.lesson-card:hover { border-color: var(--brass-dim); }
.lesson-num {
  flex: 0 0 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-family: var(--display); font-size: 1.2rem; color: var(--brass); box-shadow: inset 0 0 0 1px var(--brass-dim);
}
.lesson-body { flex: 1; display: flex; flex-direction: column; gap: 3px; }
.lesson-body b { color: var(--ivory); font-family: var(--display); font-weight: 500; font-size: 1.1rem; }
.lesson-body .muted { font-size: .86rem; }
.lesson-status { font-family: var(--mono); font-size: .64rem; letter-spacing: .06em; color: var(--ivory-3); margin-top: 3px; }
.lesson-status.has-progress { color: var(--good); }

/* Resume strip and start afresh. */
.resume-strip {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--ink-2); border: 1px solid var(--ink-4); border-radius: 12px;
  padding: 10px 16px; margin: 0 0 16px; flex-wrap: wrap;
  font-size: .9rem; color: var(--ivory-2);
}

/* Piece switcher cards in the practice room. */
.piece-cards { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 18px; }
.piece-card {
  background: var(--ink-2); border: 1px solid var(--ink-4); border-radius: 10px;
  padding: 8px 12px; cursor: pointer; text-align: left; color: var(--ivory-2);
  font-family: var(--body); font-size: .78rem; line-height: 1.3;
  transition: border-color .12s linear, color .12s linear;
}
.piece-card b { display: block; color: var(--ivory); font-weight: 600; }
.piece-card span { font-family: var(--mono); font-size: .62rem; letter-spacing: .06em; }
.piece-card:hover { border-color: var(--brass-dim); }
.piece-card.active { border-color: var(--brass); color: var(--ivory); box-shadow: inset 0 0 0 1px var(--brass); }

/* Progress page: chart, ranges, score bars. */
.range-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 12px 0 16px; }
.range-custom { display: inline-flex; gap: 10px; align-items: center; flex-wrap: wrap; font-size: .78rem; color: var(--ivory-2); }
.range-custom input[type="date"] {
  background: var(--ink-3); border: 1px solid var(--ink-4); border-radius: 8px;
  color: var(--ivory); font-family: var(--mono); font-size: .72rem; padding: 6px 8px;
  color-scheme: dark;
}
.chart-wrap { width: 100%; }
.chart-wrap canvas { display: block; width: 100%; }
.best-block { padding: 14px 0; border-bottom: 1px solid var(--ink-3); }
.best-block:last-child { border-bottom: 0; }
.best-block b { display: block; margin-bottom: 8px; font-family: var(--display); font-weight: 500; font-size: 1.05rem; }
.score-line { display: flex; align-items: center; gap: 10px; margin: 5px 0; }
.score-lab { flex: 0 0 84px; font-family: var(--mono); font-size: .64rem; letter-spacing: .06em; color: var(--ivory-2); }
.score-bar { flex: 1; height: 8px; background: var(--ink-3); border-radius: 999px; overflow: hidden; }
.score-bar i { display: block; height: 100%; border-radius: 999px; }
.score-bar .sb-acc { background: var(--good); }
.score-bar .sb-tim { background: var(--hand-l); }
.score-bar .sb-lit { background: var(--brass); color: var(--brass-ink); }
.score-pct { flex: 0 0 56px; text-align: right; font-family: var(--mono); font-size: .66rem; color: var(--ivory-2); }

/* End of session wrap-up card. */
.sess-done { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; padding: 20px; background: rgba(10,8,7,.72); }
.sess-done[hidden] { display: none; }
.sess-card { background: var(--ink-2); border: 1px solid var(--ink-4); border-radius: 16px; padding: 30px 28px; max-width: 460px; width: 100%; box-shadow: var(--shadow); text-align: center; }
.sess-card h2 { font-family: var(--display); font-size: 1.7rem; margin: 0 0 6px; }
.sess-stats { display: flex; justify-content: center; gap: 26px; margin: 18px 0 6px; }
.sess-stats div { font-family: var(--mono); font-size: .68rem; letter-spacing: .08em; color: var(--ivory-2); }
.sess-stats b { display: block; font-family: var(--display); font-size: 1.6rem; letter-spacing: 0; color: var(--ivory); margin-bottom: 4px; }
.sess-moti { font-size: .95rem; color: var(--ivory); margin: 14px 0 20px; }
.sess-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

.instrument { background: var(--ink-2); border: 1px solid var(--ink-3); border-radius: 14px; overflow: hidden; position: relative; }
.staff-wrap { padding: 14px 0 4px; border-bottom: 1px solid var(--ink-3); background: var(--ink); }
#staff { width: 100%; height: 168px; display: block; }
.roll-wrap { position: relative; background: linear-gradient(180deg, var(--ink) 0%, color-mix(in srgb, var(--ink) 80%, #000) 100%); }
#roll { width: 100%; height: 300px; display: block; }
.keybed.in-app { max-width: none; margin: 0; border-radius: 0; height: 168px; box-shadow: none; }

.judge {
  position: absolute; top: 12px; left: 50%; transform: translateX(-50%);
  font-family: var(--mono); font-size: .72rem; letter-spacing: .12em; text-transform: uppercase;
  padding: 5px 12px; border-radius: 999px; opacity: 0;
  transition: opacity .18s var(--ease); pointer-events: none;
}
.judge.good { opacity: 1; background: rgba(127,168,111,.14); color: var(--good); }
.judge.late { opacity: 1; background: rgba(212,163,67,.14); color: var(--brass); }
.judge.miss { opacity: 1; background: rgba(158,59,69,.18); color: #D98089; }
.wait-badge, .take-badge {
  position: absolute; font-family: var(--mono); font-size: .68rem;
  letter-spacing: .1em; text-transform: uppercase;
  background: color-mix(in srgb, var(--ink) 85%, transparent);
  padding: 5px 12px; border-radius: 999px; opacity: 0;
  transition: opacity .2s var(--ease); pointer-events: none;
}
.wait-badge { bottom: 12px; left: 50%; transform: translateX(-50%); color: var(--brass); }
.take-badge { top: 12px; right: 14px; color: var(--hand-r); }
.pulse { position: absolute; top: 14px; left: 14px; width: 10px; height: 10px; border-radius: 50%; background: var(--ink-4); pointer-events: none; }
.pulse.beat { background: var(--ivory-3); transform: scale(1.35); transition: none; }
.pulse.beat.accent { background: var(--brass); transform: scale(1.7); }

.transport {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 16px 18px; background: var(--ink-2);
  border: 1px solid var(--ink-3); border-top: 0; border-radius: 0 0 14px 14px;
}
.transport .spacer { flex: 1 1 auto; }
.tempo { display: flex; align-items: center; gap: 10px; }
.tempo label { font-family: var(--mono); font-size: .7rem; letter-spacing: .1em; text-transform: uppercase; color: var(--ivory-3); }
.tempo output { font-family: var(--mono); font-size: .85rem; min-width: 34px; }
.transpose { gap: 6px; }
.transpose .step {
  width: 26px; height: 26px; border-radius: 6px; background: var(--ink-3);
  border: 1px solid var(--ink-4); color: var(--ivory); font: inherit; font-size: .9rem; line-height: 1; cursor: pointer;
}
.transpose output { min-width: 58px; text-align: center; }
.trans-key { font-family: var(--mono); font-size: .66rem; color: var(--ivory-3); max-width: 130px; line-height: 1.3; }

input[type=range] {
  -webkit-appearance: none; appearance: none; width: 100%; max-width: 240px;
  height: 3px; background: var(--ink-4); border-radius: 2px; font: inherit;
}
.tempo input[type=range] { width: 150px; }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 15px; height: 15px; border-radius: 50%; background: var(--brass); cursor: pointer; }
input[type=range]::-moz-range-thumb { width: 15px; height: 15px; border: 0; border-radius: 50%; background: var(--brass); cursor: pointer; }

.layout { display: grid; grid-template-columns: 1fr 320px; gap: 20px; align-items: start; }
.panel { display: grid; gap: 16px; position: sticky; top: 84px; }
.pcard { background: var(--ink-2); border: 1px solid var(--ink-3); border-radius: 14px; padding: 18px; }
.pcard h2, .pcard h3 {
  font-size: .82rem; font-family: var(--mono); font-weight: 400;
  letter-spacing: .12em; text-transform: uppercase; color: var(--ivory-3); margin: 0 0 14px;
}
.pcard.lit { border-color: var(--brass-dim); }
.scores { display: grid; gap: 14px; }
.score-row { display: flex; align-items: baseline; gap: 10px; }
.score-val { font-family: var(--display); font-size: 1.9rem; line-height: 1; min-width: 76px; }
.score-lab { font-size: .84rem; color: var(--ivory-2); }
.score-row.tim .score-val { color: var(--hand-l); }
.score-row.lit .score-val { color: var(--brass); }
.score-row.streak .score-val { color: var(--good); }
.score-note { font-size: .78rem; color: var(--ivory-3); margin: 6px 0 0; }
.tip { font-size: .88rem; color: var(--ivory-2); margin: 0; }

.bars { display: flex; flex-wrap: wrap; gap: 5px; }
.bar-chip {
  width: 30px; height: 28px; border-radius: 6px; background: var(--ink-3);
  border: 1px solid transparent; color: var(--ivory-3);
  font-family: var(--mono); font-size: .72rem; cursor: pointer; transition: all .12s var(--ease);
}
.bar-chip:hover { color: var(--ivory); }
.bar-chip.loop { background: rgba(212,163,67,.18); color: var(--brass); border-color: var(--brass-dim); }
.bar-chip.here { box-shadow: inset 0 -2px 0 var(--ivory); color: var(--ivory); }

.trouble-card { border-color: var(--brass-dim); }
.trouble-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--ink-3); }
.trouble-row:last-child { border-bottom: 0; }
.trouble-bar { font-family: var(--mono); font-size: .78rem; color: var(--brass); min-width: 58px; }
.trouble-why { font-size: .8rem; color: var(--ivory-2); flex: 1 1 auto; }
.trouble-row .pill { padding: 4px 10px; font-size: .74rem; }

.keyhelp { font-size: .8rem; color: var(--ivory-3); line-height: 1.7; margin: 0; }
kbd {
  font-family: var(--mono); font-size: .74rem; background: var(--ink-3);
  border: 1px solid var(--ink-4); border-radius: 4px; padding: 1px 5px; color: var(--ivory-2);
}

/* ---------- gate ---------- */
.gate {
  position: fixed; inset: 0; z-index: 120;
  background: color-mix(in srgb, var(--ink) 82%, transparent);
  backdrop-filter: blur(6px);
  display: grid; place-items: center; padding: 24px;
}
.gate[hidden] { display: none; }
.gate-card {
  max-width: 520px; width: 100%; background: var(--ink-2);
  border: 1px solid var(--brass-dim); border-radius: 14px; padding: 30px;
  box-shadow: var(--shadow); max-height: 90vh; overflow-y: auto;
}
.gate-form { display: flex; gap: 10px; margin: 18px 0 10px; flex-wrap: wrap; }
.gate-form input { flex: 1 1 220px; }
.gate-msg { min-height: 1.4em; font-size: .88rem; margin: 0 0 10px; }
.gate-msg.ok { color: var(--good); }
.gate-msg.no { color: var(--felt); }
.gate-alt { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
.hp { position: absolute; left: -9999px; }

/* ---------- footer ---------- */
.site-foot { border-top: 1px solid var(--ink-3); padding: 46px 0 60px; }
.foot-cols { display: flex; flex-wrap: wrap; gap: 40px; }
.foot-cols > div { min-width: 150px; }
.foot-cols h2 {
  font-family: var(--mono); font-size: .7rem; letter-spacing: .14em;
  text-transform: uppercase; color: var(--ivory-3); margin: 0 0 12px;
}
.foot-cols a { display: block; color: var(--ivory-2); font-size: .9rem; padding: 3px 0; }
.foot-legal { margin-top: 34px; font-size: .82rem; color: var(--ivory-3); }

/* ---------- misc ---------- */
.hint {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(8px);
  background: var(--ink-3); color: var(--ivory); border: 1px solid var(--ink-4);
  padding: 9px 16px; border-radius: 999px; font-size: .85rem;
  opacity: 0; pointer-events: none; transition: all .2s var(--ease); z-index: 90; max-width: 90vw; text-align: center;
}
.hint.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: absolute; left: -9999px; top: 0; z-index: 200; background: var(--brass); color: var(--brass-ink); padding: 10px 16px; border-radius: 0 0 var(--r) 0; font-weight: 600; }
.skip:focus { left: 0; text-decoration: none; }

/* ---------- responsive ---------- */
@media (max-width: 980px) {
  .layout { grid-template-columns: 1fr; }
  .panel { position: static; }
  #roll { height: 230px; }
  #staff { height: 150px; }
  .keybed.in-app { height: 130px; }
  .stage-head .picker { margin-left: 0; width: 100%; }
  .transpose { order: 3; }
  .trans-key { display: none; }
}
@media (max-width: 860px) {
  .g3, .g2, .two-col { grid-template-columns: 1fr; }
  section { padding: 58px 0; }
  .nav {
    display: none; position: absolute; top: 64px; left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 0;
    background: var(--ink-2); border-bottom: 1px solid var(--ink-3); padding: 8px 24px 18px;
  }
  .nav.open { display: flex; }
  .nav a { padding: 12px 0; border-bottom: 1px solid var(--ink-3); }
  .nav .btn, .nav .theme-toggle { margin-top: 12px; }
  .nav-toggle { display: block; }
  .keybed { height: 150px; }
  .lesson-card { padding: 22px 18px; }
  .steps li { width: 26px; height: 26px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition-duration: .01ms !important; }
}


/* ---- v4 additions ---- */

/* account control */
.acct { position: relative; }
.acct-btn {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--brass); color: var(--brass-ink);
  border: 0; font: inherit; font-weight: 600; font-size: .9rem;
  cursor: pointer; display: grid; place-items: center; line-height: 1;
}
.acct-menu {
  position: absolute; right: 0; top: 42px; min-width: 230px;
  background: var(--ink-2); border: 1px solid var(--ink-3);
  border-radius: var(--r); padding: 14px; box-shadow: var(--shadow); z-index: 70;
}
.acct-menu[hidden] { display: none; }
.acct-email { font-size: .86rem; margin: 0 0 4px; word-break: break-all; color: var(--ivory); }
.acct-state { font-family: var(--mono); font-size: .68rem; letter-spacing: .1em; text-transform: uppercase; color: var(--good); margin: 0 0 12px; }
.signin[hidden], .acct[hidden] { display: none; }

/* the signup card */
.gate-card { position: relative; }
.gate-close {
  position: absolute; top: 12px; right: 14px;
  background: none; border: 0; color: var(--ivory-3);
  font-size: 1.7rem; line-height: 1; cursor: pointer; padding: 4px 8px;
}
.gate-close:hover { color: var(--ivory); }
.gate-close[hidden] { display: none; }

/* the invitation, which is an offer rather than a countdown */
.invite {
  display: flex; gap: 18px; align-items: center; flex-wrap: wrap;
  background: var(--ink-2); border: 1px solid var(--brass-dim);
  border-radius: var(--r); padding: 16px 20px; margin-bottom: 18px;
}
.invite[hidden] { display: none; }
.invite p { margin: 0; flex: 1 1 320px; font-size: .92rem; color: var(--ivory-2); }
.invite strong { color: var(--ivory); }
.invite-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* resume line and progress tags */
.resume {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
  font-size: .88rem; margin: 22px 0 0; color: var(--ivory-2);
}
.resume[hidden] { display: none; }
.resume-tag {
  font-family: var(--mono); font-size: .66rem; letter-spacing: .14em;
  text-transform: uppercase; color: var(--brass);
  border: 1px solid var(--brass-dim); border-radius: 999px; padding: 3px 9px;
}
.resume .sep { color: var(--ivory-3); opacity: .6; }
.progress-tag {
  font-family: var(--mono); font-size: .62rem; letter-spacing: .1em;
  color: var(--good); border: 1px solid currentColor; border-radius: 999px;
  padding: 1px 7px; margin-left: 8px; text-transform: none;
}
.progress-tag[hidden] { display: none; }

@media (max-width: 860px) {
  .acct-menu { right: auto; left: 0; }
  .invite { padding: 14px 16px; }
}

/* ---- v6: the step by step guide, and no blank panels ---- */

.howto {
  background: var(--ink-2); border: 1px solid var(--brass-dim);
  border-radius: 14px; padding: 20px 22px; margin-bottom: 18px;
}
.howto-head { display: flex; align-items: center; gap: 14px; margin-bottom: 4px; }
.howto-head h2 {
  font-family: var(--body); font-size: 1.05rem; font-weight: 600;
  letter-spacing: 0; margin: 0; flex: 1 1 auto; color: var(--ivory);
}
.howto-head .pill { padding: 5px 12px; font-size: .78rem; }
.howto-lede { font-size: .92rem; color: var(--ivory-2); margin: 10px 0 16px; }
.howto-steps { margin: 0 0 16px; padding: 0; list-style: none; counter-reset: howto; }
.howto-steps li {
  position: relative; padding: 0 0 14px 42px; counter-increment: howto;
  font-size: .93rem; color: var(--ivory-2); line-height: 1.55;
}
.howto-steps li::before {
  content: counter(howto);
  position: absolute; left: 0; top: 0;
  width: 27px; height: 27px; border-radius: 50%;
  background: var(--brass); color: var(--brass-ink);
  font-family: var(--mono); font-size: .8rem; font-weight: 600;
  display: grid; place-items: center;
}
.howto-steps li b { color: var(--ivory); font-weight: 600; }
.howto-foot { font-size: .84rem; color: var(--ivory-3); margin: 0 0 16px; }
#howtoBody[hidden] { display: none; }

@media (max-width: 860px) {
  .howto { padding: 16px; }
  .howto-steps li { padding-left: 36px; font-size: .9rem; }
  .howto-steps li::before { width: 24px; height: 24px; font-size: .74rem; }
  .stage { padding: 14px 14px 32px; }
  #roll { height: 200px; }
  #staff { height: 132px; }
  .keybed.in-app { height: 118px; }
  .transport { gap: 10px; padding: 14px; }
  .transport .tempo { flex: 1 1 100%; }
  .transport input[type=range] { flex: 1 1 auto; width: auto; }
  .stage-head h1 { font-size: 1.45rem; }
  .invite { flex-direction: column; align-items: flex-start; }
}

/* ---- v7: hand colour is information, so it is stated plainly ---- */

.hand-legend {
  display: flex; flex-wrap: wrap; gap: 6px 20px;
  padding: 10px 16px;
  background: var(--ink);
  border-top: 1px solid var(--ink-3);
  font-family: var(--mono); font-size: .68rem;
  letter-spacing: .08em; text-transform: uppercase; color: var(--ivory-3);
}
.legend-item { display: inline-flex; align-items: center; gap: 7px; }
.sw { width: 13px; height: 13px; border-radius: 3px; display: inline-block; flex: 0 0 13px; }
.sw-l { background: #6FB6DC; }
.sw-r { background: #D96E68; }
.sw-hit { background: transparent; box-shadow: inset 0 0 0 2px var(--good); }
.sw-miss { background: transparent; box-shadow: inset 0 0 0 2px var(--felt); }

.ink-l { color: #6FB6DC; font-weight: 600; }
.ink-r { color: #D96E68; font-weight: 600; }

.score-val.empty {
  font-family: var(--mono); font-size: .82rem; color: var(--ivory-3);
  letter-spacing: .04em;
}

@media (max-width: 560px) {
  .hand-legend { gap: 6px 12px; font-size: .62rem; padding: 9px 12px; }
}

/* ---- v8: written for someone who has never done this before ---- */

.coach {
  margin: 0; padding: 12px 18px;
  background: var(--ink);
  border-top: 1px solid var(--ink-3);
  color: var(--ivory);
  font-size: .96rem; line-height: 1.45;
  min-height: 3.1em;
  display: flex; align-items: center; gap: 10px;
}
.coach::before {
  content: ''; flex: 0 0 8px; width: 8px; height: 8px;
  border-radius: 50%; background: var(--brass);
}

.tool-glossary { margin: 16px 0 0; display: grid; gap: 0; }
.tool-glossary > div {
  display: grid; grid-template-columns: 150px 1fr; gap: 14px;
  padding: 9px 0; border-bottom: 1px solid var(--ink-3);
}
.tool-glossary > div:last-child { border-bottom: 0; }
.tool-glossary dt { font-weight: 600; font-size: .88rem; color: var(--ivory); margin: 0; }
.tool-glossary dd { margin: 0; font-size: .88rem; color: var(--ivory-2); }

@media (max-width: 700px) {
  .tool-glossary > div { grid-template-columns: 1fr; gap: 2px; }
  .coach { font-size: .9rem; padding: 11px 14px; }
}

.coach-static {
  display: flex; align-items: flex-start; gap: 10px;
  background: var(--ink-2); border: 1px solid var(--ink-3);
  border-left: 3px solid var(--brass);
  border-radius: var(--r);
  padding: 14px 18px; margin: 22px 0 0;
  font-size: .92rem; color: var(--ivory-2); max-width: 68ch;
}

/* ---- v9: reading the stave ---- */

/* the answer-first paragraph, written to be quotable on its own */
.answer-first {
  font-size: 1.14rem; line-height: 1.6; color: var(--ivory);
  max-width: 70ch; margin: 0 0 1.1em;
  padding-left: 16px; border-left: 3px solid var(--brass);
}

.figure {
  background: var(--ink-2); border: 1px solid var(--ink-3);
  border-radius: var(--r); padding: 18px 20px; margin: 0 0 20px;
}
.figure canvas { width: 100%; height: 150px; display: block; }
.figure-cap {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  margin-top: 10px; padding-top: 12px; border-top: 1px solid var(--ink-3);
}
.figure-cap p { margin: 0; font-size: .9rem; color: var(--ivory-2); flex: 1 1 260px; }
.figure-cap b { color: var(--ivory); }

.reader-card { padding: 22px; }
.reader-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 8px; }
.reader-head .quiz-ask { flex: 1 1 auto; margin: 0; }
#trainerStave { width: 100%; height: 190px; display: block; margin: 6px 0 14px; }
.reader-card .keybed.short { height: 140px; }

/* the banner band, used on the home page and the beginner page */
.banner { background: var(--ink-2); }
.banner-inner { display: grid; grid-template-columns: 1.35fr 1fr; gap: 40px; align-items: center; }
.banner-inner h2 { margin-bottom: .35em; }
.banner-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 9px; }
.banner-list li {
  position: relative; padding-left: 26px; font-size: .93rem; color: var(--ivory-2);
}
.banner-list li::before {
  content: ''; position: absolute; left: 0; top: .55em;
  width: 9px; height: 9px; border-radius: 2px; background: var(--brass);
}

@media (max-width: 860px) {
  .banner-inner { grid-template-columns: 1fr; gap: 26px; }
  .figure canvas { height: 120px; }
  #trainerStave { height: 155px; }
  .answer-first { font-size: 1.05rem; }
}

/* ---- v11: circle of fifths ---- */
.fifths { position: relative; width: 100%; max-width: 340px; margin: 0 auto 18px; aspect-ratio: 1; }
.fifth-key {
  position: absolute; transform: translate(-50%, -50%);
  width: 46px; height: 46px; border-radius: 50%;
  background: var(--ink-3); border: 1px solid var(--ink-4); color: var(--ivory-2);
  font: inherit; font-size: .88rem; font-weight: 600; cursor: pointer;
  transition: all .16s var(--ease);
}
.fifth-key:hover { border-color: var(--ivory-3); color: var(--ivory); }
.fifth-key.on { background: var(--brass); border-color: var(--brass); color: var(--brass-ink); }
#tkStave { width: 100%; height: 150px; display: block; margin: 6px 0 14px; }
@media (max-width: 560px) { .fifths { max-width: 270px; } .fifth-key { width: 38px; height: 38px; font-size: .78rem; } }
