/* Online Piano (newellabs.com/play/piano). Self-contained; system fonts only. */
:root {
  color-scheme: light dark;
  --bg: #f5f0e6; --well: #ece4d4; --card: #fffcf7;
  --ink: #1b2130; --ink-2: #3a4254; --muted: #596070; --faint: #a39d92; --done: #756f66;
  --line: #e1d7c5; --line-strong: #cdbfa6;
  --accent: #875810; --accent-bright: #dfa140; --glow: rgba(236, 170, 64, .75);
  --focus: #2459d6; --rec: #c2362b; --rec-on: #c2362b;
  /* the instrument */
  --case-hi: #2b2622; --case-lo: #120f0d; --felt: #9e2b25;
  --ivory-hi: #fffefb; --ivory-lo: #ece6da; --ivory-edge: #c9bfae; --ivory-down: #ddd5c6;
  --ebony-hi: #3b3836; --ebony-lo: #0c0b0b; --ebony-down: #4a4643;
  --lab-white: #4b4338; --lab-black: #e9e2d5;
  --next-hi: #ffd88a; --next-lo: #f0b64e; --next-black: #e0a23f;
  --kc-bg: rgba(255, 250, 240, .7); --kc-line: rgba(80, 60, 30, .3);
  --veil: rgba(245, 240, 230, .55);
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12151c; --well: #1a1f29; --card: #1c212b;
    --ink: #ece7de; --ink-2: #d0cac0; --muted: #a4aab5; --faint: #5d6470; --done: #858c98;
    --line: #2a3140; --line-strong: #3b4354;
    --accent: #e9bb6c; --accent-bright: #e2a646; --glow: rgba(240, 180, 80, .6);
    --focus: #93b4ff; --rec: #ee5b4d; --rec-on: #c0392f;
    --case-hi: #2a2d33; --case-lo: #0b0c0f;
    --ivory-hi: #ebe6dc; --ivory-lo: #d3ccbf; --ivory-edge: #9d9384; --ivory-down: #c2b9aa;
    --ebony-hi: #34363b; --ebony-lo: #07080a; --ebony-down: #4a4d53;
    --kc-bg: rgba(255, 250, 240, .55);
    --veil: rgba(18, 21, 28, .55);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 16px/1.6 var(--sans); overflow-x: hidden; }
a { color: inherit; text-decoration-color: var(--accent-bright); text-decoration-thickness: 1.5px; text-underline-offset: 3px; }
a:hover { color: var(--accent); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
button { font: inherit; color: inherit; touch-action: manipulation; }
.seg label { touch-action: manipulation; }
kbd { font: 500 .82em/1 var(--mono); display: inline-block; min-width: 1.6em; padding: .22em .38em; text-align: center; border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 5px; background: var(--card); color: var(--ink); }
.wrap { max-width: 980px; margin: 0 auto; padding: 0 16px; }
.wide { max-width: 1240px; margin: 0 auto; padding: 0 16px; }
/* A phone held sideways: keep clear of the notch or camera island. (Browsers without env() keep the 16 px above.) */
.wrap, .wide { padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
[hidden] { display: none !important; }
.fine-only { display: none; }
.vh { position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

.skip { position: absolute; left: -9999px; top: 8px; z-index: 50; background: var(--ink); color: var(--bg); padding: 10px 14px; border-radius: 10px; }
.skip:focus { left: 16px; }

/* Header, hero, footer */
.top { border-bottom: 1px solid var(--line); }
.top-in { min-height: 54px; display: flex; align-items: center; }
.brand { display: inline-flex; align-items: center; gap: 9px; min-height: 44px; text-decoration: none; font-weight: 650; font-size: 15px; padding: 8px 0; }
.brand svg { width: 22px; height: 22px; color: var(--accent-bright); }
.brand-sub { color: var(--muted); font-weight: 500; margin-left: 2px; }
.brand-sub::before { content: "/"; margin-right: 6px; color: var(--faint); }
.hero { padding-top: 20px; padding-bottom: 2px; }
h1 { font: 700 clamp(2rem, 7vw, 3rem)/1.05 var(--serif); letter-spacing: -.01em; margin: 0 0 8px; }
.lede { margin: 0; color: var(--ink-2); max-width: 640px; font-size: 1rem; line-height: 1.5; }
.foot { border-top: 1px solid var(--line); margin-top: 56px; padding: 22px 0 32px; color: var(--muted); font-size: .9rem; }
.foot p { margin: 0; }
.foot-in { display: flex; flex-wrap: wrap; justify-content: space-between; column-gap: 20px; }
.foot a { color: var(--muted); display: inline-block; padding: 12px 0; }

/* Controls */
.stage { padding-top: 16px; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; margin: 0 0 12px; }
.seg { display: inline-flex; align-items: center; background: var(--well); border: 1px solid var(--line); border-radius: 13px; padding: 3px; max-width: 100%; }
.seg-cap, .songs-cap { font: 650 11px/1 var(--sans); letter-spacing: .09em; text-transform: uppercase; color: var(--muted); padding: 0 6px; white-space: nowrap; }
.seg input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; pointer-events: none; }
.seg label { min-height: 38px; min-width: 40px; padding: 0 8px; display: inline-flex; align-items: center; justify-content: center; border-radius: 10px; font-weight: 600; font-size: 14px; color: var(--ink-2); cursor: pointer; white-space: nowrap; transition: background-color .15s, color .15s; }
.seg input:checked + label { background: var(--card); color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, .12), 0 0 0 1px var(--line-strong), inset 0 -3px 0 var(--accent); }  /* the accent bar marks the choice in both themes */
.seg input:focus-visible + label { outline: 3px solid var(--focus); outline-offset: 1px; }
/* Sustain + song picker. 340 px is the least this row needs with the picker's caption hidden (see the 860 px rule
   below), so it drops under the Notes switch before the picker's text can be cut. */
.row2 { display: flex; align-items: center; gap: 10px; flex: 1 1 340px; min-width: 0; }

.songs { display: flex; align-items: center; gap: 8px; flex: 1 1 200px; min-width: 0; max-width: 400px; }
.songs-cap { flex: none; padding-left: 0; cursor: pointer; }
.pick { position: relative; flex: 1 1 auto; min-width: 0; display: flex; }
.pick::after { content: ""; position: absolute; right: 16px; top: 50%; width: 7px; height: 7px; margin-top: -6px; border: solid var(--ink-2); border-width: 0 2px 2px 0; transform: rotate(45deg); pointer-events: none; }
.pick select { -webkit-appearance: none; appearance: none; width: 100%; min-width: 0; min-height: 44px; padding: 0 40px 0 16px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--card); color: var(--ink); font: 500 15px/1.2 var(--sans); cursor: pointer; text-overflow: ellipsis; }
.pick select:hover { border-color: var(--accent-bright); }
.pick select.has-song { border-color: var(--accent-bright); box-shadow: inset 0 0 0 1px var(--accent-bright); }
.pick select:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 16px; border-radius: 12px; border: 1px solid var(--line-strong); background: var(--card); font-size: 15px; font-weight: 600; cursor: pointer; transition: border-color .15s, background-color .15s, color .15s; -webkit-tap-highlight-color: transparent; }
.btn:hover { border-color: var(--ink-2); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .45; cursor: default; transform: none; border-color: var(--line-strong); }
.btn svg { width: 18px; height: 18px; fill: currentColor; flex: none; }
.btn-sm { min-height: 38px; padding: 0 12px; font-size: 14px; border-radius: 10px; }
.btn-sm svg { width: 16px; height: 16px; }
.btn-icon { padding: 0; width: 44px; }
.btn-sm.btn-icon { width: 38px; }
.link-btn { background: none; border: 0; padding: 4px 2px; min-height: 32px; color: var(--ink-2); text-decoration: underline; text-decoration-color: var(--accent-bright); text-underline-offset: 3px; cursor: pointer; font-size: inherit; }
.rec-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--rec); flex: none; transition: border-radius .15s; }
.btn-rec[aria-pressed="true"] { background: var(--rec-on); border-color: var(--rec-on); color: #fff; }
.btn-rec[aria-pressed="true"] .rec-dot { background: #fff; border-radius: 2px; animation: blink 1.2s ease-in-out infinite; }
@keyframes blink { 50% { opacity: .35; } }
.btn .i-stop { display: none; }
.btn.is-playing .i-stop { display: block; }
.btn.is-playing .i-play { display: none; }
#play.attention:not([disabled]) { border-color: var(--accent-bright); box-shadow: 0 0 0 3px var(--glow); }
/* Sustain pedal toggle */
.pedal { flex: none; }
.pedal .pedal-state { font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); padding: 2px 6px; border-radius: 6px; background: var(--well); }
.pedal[aria-pressed="true"] { border-color: var(--accent-bright); box-shadow: inset 0 0 0 1px var(--accent-bright); }
.pedal[aria-pressed="true"] .pedal-state { background: var(--accent-bright); color: #21170a; }
.pedal.held { border-color: var(--accent-bright); }

/* Play-along panel */
.along { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 10px 12px 8px; margin: 0 0 12px; }
.along-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 10px; }
.along-title { margin: 0; font-size: 15px; line-height: 1.3; }
.along-count { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; margin-left: 4px; white-space: nowrap; }
.along-actions { display: flex; gap: 6px; }
.strip { position: relative; display: flex; gap: 3px; overflow-x: auto; padding: 8px 2px 6px; scrollbar-width: none; -webkit-mask-image: linear-gradient(90deg, transparent, #000 18px, #000 calc(100% - 18px), transparent); mask-image: linear-gradient(90deg, transparent, #000 18px, #000 calc(100% - 18px), transparent); }
.strip::-webkit-scrollbar { display: none; }
.strip::before, .strip::after { content: ""; flex: none; width: 40%; }
.tok { flex: none; min-width: 30px; padding: 1px 5px 3px; display: inline-flex; flex-direction: column; align-items: center; border-radius: 8px; font-weight: 650; font-size: 17px; line-height: 1.05; color: var(--ink-2); transition: background-color .12s, color .12s; }
.tok.bar-end { margin-right: 10px; }
.tok.done { color: var(--done); font-weight: 500; }
.tok.cur { background: var(--accent-bright); color: #21170a; }
.tok sub, .key sub { font-size: .62em; font-weight: 600; vertical-align: baseline; position: relative; top: .1em; margin-left: .5px; }
.tok .dt, .tok .db { display: block; height: 6px; font-size: 8px; line-height: 6px; letter-spacing: 1px; }
.along-hint { margin: 2px 0 2px; font-size: 13px; color: var(--muted); }

/* Range bar: where the visible keys sit on the full 88-key piano */
.navrow { display: flex; align-items: center; gap: 6px; margin: 0 0 8px; }
.navrow .btn { flex: none; }
.map { position: relative; flex: 1 1 auto; min-width: 0; height: 44px; padding: 8px 0; cursor: pointer; touch-action: none; -webkit-user-select: none; user-select: none; border-radius: 10px; }
.map svg { display: block; width: 100%; height: 28px; border-radius: 4px; }
.map .mw { fill: var(--ivory-hi); stroke: var(--ivory-edge); stroke-width: .08; }
.map .mb { fill: var(--ebony-lo); }
.map .mc { fill: var(--accent-bright); }
.win { position: absolute; top: 4px; bottom: 4px; left: 0; border-radius: 7px; border: 2.5px solid var(--accent-bright); background: rgba(236, 170, 64, .14); box-shadow: 0 0 0 9999px rgba(0, 0, 0, .0); transition: left .25s ease, width .25s ease; pointer-events: none; }
.map:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.range-txt { flex: none; min-width: 64px; text-align: center; font-size: 13px; font-weight: 650; color: var(--ink-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.zoom { display: inline-flex; gap: 4px; flex: none; }

/* The instrument */
.piano { --w: 24px; --x: 0; --kh: clamp(170px, 32vh, 240px); position: relative; margin: 0 -8px; padding: 0 6px 8px; border-radius: 14px; background: linear-gradient(180deg, var(--case-hi), var(--case-lo)); box-shadow: 0 2px 3px rgba(0, 0, 0, .18), 0 18px 36px -20px rgba(0, 0, 0, .6); }
.rail { height: 16px; position: relative; }
.rail::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: var(--felt); border-radius: 2px 2px 0 0; opacity: .9; }
.viewport { position: relative; height: var(--kh); overflow: hidden; border-radius: 0 0 6px 6px; }
.keys { position: absolute; top: 0; left: 0; height: 100%; width: calc(52 * var(--w)); transform: translateX(calc(var(--x) * var(--w) * -1)); transition: transform .28s cubic-bezier(.2, .7, .2, 1); touch-action: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.keys.instant, .piano.instant .keys { transition: none; }
.key { position: absolute; top: 0; margin: 0; padding: 0; border: 0; cursor: pointer; -webkit-tap-highlight-color: transparent; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; }
.key:focus-visible { outline: none; }
.key.white { left: calc(var(--p) * var(--w)); width: var(--w); height: 100%; z-index: 1; border-radius: 0 0 5px 5px; background: linear-gradient(180deg, var(--ivory-lo) 0, var(--ivory-hi) 9%, var(--ivory-hi) 88%, var(--ivory-lo) 100%); box-shadow: inset -1px 0 0 var(--ivory-edge), inset 0 -4px 0 rgba(0, 0, 0, .06); padding-bottom: 10px; }
.key.black { left: calc(var(--p) * var(--w) - var(--w) * .29); width: calc(var(--w) * .58); height: 62%; z-index: 2; border-radius: 0 0 4px 4px; background: linear-gradient(180deg, var(--ebony-lo), var(--ebony-hi) 84%, #59544f 90%, var(--ebony-lo) 96%); box-shadow: 0 2px 2px rgba(0, 0, 0, .45), inset 0 -2px 0 rgba(255, 255, 255, .06); padding-bottom: 7px; }
.key.white.down { background: linear-gradient(180deg, var(--ivory-down) 0, var(--ivory-lo) 12%, var(--ivory-lo) 100%); box-shadow: inset -1px 0 0 var(--ivory-edge), inset 0 3px 6px rgba(0, 0, 0, .18); }
.key.black.down { background: linear-gradient(180deg, var(--ebony-lo), var(--ebony-down) 94%, var(--ebony-lo)); box-shadow: 0 1px 1px rgba(0, 0, 0, .4); }
.key.white.next { background: linear-gradient(180deg, var(--next-lo) 0, var(--next-hi) 14%, var(--next-hi) 86%, var(--next-lo) 100%); box-shadow: inset -1px 0 0 var(--ivory-edge), inset 0 0 0 3px var(--accent-bright); }
.key.black.next { background: linear-gradient(180deg, #6b4410, var(--next-black) 70%, #c88a2e); box-shadow: 0 0 0 2px var(--next-hi), 0 0 14px 3px var(--glow); }
.key.next .lab { animation: nudge 1.4s ease-in-out infinite; }
.key.black.next .lab { color: #21170a; }
.key.black.next .kc { color: #21170a; border-color: rgba(33, 23, 10, .35); }
@keyframes nudge { 50% { transform: translateY(-3px); } }
.key.white.next.down { background: linear-gradient(180deg, var(--next-lo), var(--next-lo)); }
.key:focus-visible.white { box-shadow: inset 0 0 0 3px var(--focus); }
.key:focus-visible.black { box-shadow: 0 0 0 3px var(--focus); }
.lab { display: flex; flex-direction: column; align-items: center; pointer-events: none; font-weight: 700; line-height: 1.05; white-space: nowrap; }
.white .lab { color: var(--lab-white); font-size: clamp(9px, calc(var(--w) * .42), 15px); }
.black .lab { color: var(--lab-black); font-size: clamp(8px, calc(var(--w) * .3), 11px); }
.lab .dt, .lab .db { height: 5px; font-size: 7px; line-height: 5px; letter-spacing: .5px; }
.lab .dt:empty, .lab .db:empty { height: 0; }
.piano.narrow .black .lab { display: none; }
.piano.tiny .white:not(.is-c) .lab { visibility: hidden; }
.mc-dot { display: block; width: 6px; height: 6px; margin: 5px auto 0; border-radius: 50%; background: var(--accent-bright); box-shadow: 0 0 0 1px rgba(0, 0, 0, .18); pointer-events: none; }
.kc { display: none; pointer-events: none; margin-top: 5px; min-width: 18px; height: 18px; padding: 0 3px; align-items: center; justify-content: center; border-radius: 5px; font: 600 11px/1 var(--mono); color: #3a3228; background: var(--kc-bg); border: 1px solid var(--kc-line); }
.black .kc { color: #f2ece2; background: rgba(255, 255, 255, .12); border-color: rgba(255, 255, 255, .22); min-width: 16px; height: 16px; font-size: 10px; }
.kc:empty { visibility: hidden; }
@media (hover: hover) { .key.white:hover { background: linear-gradient(180deg, var(--ivory-lo) 0, #fff 9%, #fff 88%, var(--ivory-lo) 100%); } .key.white.next:hover, .key.white.down:hover { background: linear-gradient(180deg, var(--next-lo), var(--next-hi)); } .key.white.down:not(.next):hover { background: linear-gradient(180deg, var(--ivory-down) 0, var(--ivory-lo) 12%); } }

/* Tap-to-start veil */
.start { position: absolute; left: 0; right: 0; top: 0; bottom: 0; z-index: 5; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; border: 0; margin: 0; padding: 16px; border-radius: 14px; background: var(--veil); -webkit-backdrop-filter: blur(1px); backdrop-filter: blur(1px); cursor: pointer; -webkit-tap-highlight-color: transparent; }
.start-pill { display: inline-flex; align-items: center; gap: 10px; min-height: 52px; padding: 0 24px; border-radius: 999px; background: var(--ink); color: var(--bg); font-size: 17px; font-weight: 650; box-shadow: 0 10px 24px -10px rgba(0, 0, 0, .5); transition: transform .15s; }
.start-pill svg { width: 22px; height: 22px; fill: currentColor; }
.start:hover .start-pill { transform: scale(1.03); }
.start-sub { font-size: 13px; font-weight: 500; color: var(--ink); background: var(--card); padding: 4px 10px; border-radius: 999px; text-align: center; }
.start:focus-visible { outline-offset: -3px; }

.under { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 16px; margin: 8px 0 0; font-size: 13px; color: var(--muted); }
.under p { margin: 0; }
#sound-status { font-variant-numeric: tabular-nums; }
#sound-status.warn { color: var(--rec); }
.credit a { color: var(--muted); }
.turn-hint { display: none; align-items: center; gap: 8px; margin: 6px 0 0; font-size: 13px; color: var(--muted); }
.turn-hint svg { width: 20px; height: 20px; flex: none; color: var(--accent); }
@media (pointer: coarse) and (orientation: portrait) and (max-width: 559px) { .turn-hint { display: flex; } }

/* Recorder */
.deck { margin-top: 14px; }
.deck-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.status { margin: 10px 0 0; color: var(--muted); font-size: 14px; line-height: 1.45; min-height: 2.9em; }
#status { font-variant-numeric: tabular-nums; }
.keyhint { margin: 4px 0 0; color: var(--muted); font-size: 13px; line-height: 2; }

/* Help text */
.prose { margin-top: 40px; }
.prose > * { max-width: 700px; }
.prose h2 { font: 700 1.5rem/1.2 var(--serif); margin: 36px 0 12px; }
.prose h3 { font-size: 1.02rem; margin: 22px 0 4px; line-height: 1.35; }
.prose p { margin: 0 0 10px; color: var(--ink-2); }
.prose ul { padding-left: 1.2em; margin: 0; color: var(--ink-2); }
.prose li { margin: 0 0 10px; }
.prose li::marker { color: var(--accent-bright); }
.prose strong { color: var(--ink); }
.song-list { list-style: none; padding: 0 !important; margin: 4px 0 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 0 16px; line-height: 1.35; }
.song-list li { margin: 0; padding: 0; }
.song-list a { display: inline-flex; align-items: center; min-height: 40px; }

/* Toast */
.toast { position: fixed; left: 50%; top: max(12px, env(safe-area-inset-top)); z-index: 40; width: max-content; max-width: calc(100vw - 32px); transform: translate(-50%, -12px); opacity: 0; pointer-events: none; background: var(--ink); color: var(--bg); padding: 12px 16px; border-radius: 12px; font-size: 14px; font-weight: 500; box-shadow: 0 12px 30px -10px rgba(0, 0, 0, .45); transition: opacity .2s, transform .2s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.show.has-link { pointer-events: auto; }  /* a plain message never takes taps; at the top it is never on the keys */
.toast input { display: block; width: min(560px, calc(100vw - 64px)); margin-top: 8px; padding: 8px; border-radius: 8px; border: 0; font: 13px var(--mono); color: var(--ink); background: var(--card); }

/* More toys (links to the other Newel Labs toys) */
.more-toys { margin-top: 48px; }
.more-toys h2 { font: 700 1.4rem/1.2 var(--serif); margin: 0 0 12px; }
.more-toys ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); }
.more-toys a { display: grid; grid-template-columns: 112px minmax(0, 1fr); align-items: center; column-gap: 14px; min-height: 44px; padding: 10px; border: 1px solid var(--line); border-radius: 16px; background: var(--card); color: var(--ink); text-decoration: none; }
.more-toys a:hover { border-color: var(--accent-bright); color: var(--ink); }
.more-toys img { grid-row: 1 / 3; display: block; width: 112px; height: 63px; border-radius: 10px; object-fit: cover; background: var(--well); }
.more-toys b { align-self: end; font-weight: 700; }
.more-toys span { align-self: start; font-size: 0.88rem; line-height: 1.35; color: var(--muted); }
.more-toys + .foot { margin-top: 40px; }

/* Sizes */
@media (min-width: 420px) { .piano { margin: 0; } }
@media (max-width: 380px) { .seg label { padding: 0 6px; font-size: 13px; min-width: 40px; } .seg-cap { display: none; } .navrow { gap: 4px; } .range-txt { min-width: 56px; font-size: 12px; } }
@media (max-width: 520px) {
  .hero { padding-top: 16px; }
  .lede { font-size: 15px; }
  .along { padding: 8px 10px 6px; }
  .along-head { flex-wrap: nowrap; }
  /* The song name gives way first; the "3 of 42" count always stays in view. */
  .along-title { flex: 1 1 auto; min-width: 0; display: flex; align-items: baseline; white-space: nowrap; }
  .along-title strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
  .along-count { flex: none; }
  #restart { width: 38px; padding: 0; }
  #restart .lbl-r { display: none; }
  .strip { padding-top: 6px; }
  .along-hint { margin: 0; }
  .piano { --kh: clamp(160px, 30vh, 240px); }
}
/* Up to 860 px the toolbar has no room for the "Play along" caption beside the picker (it squeezed the picker to
   "Cho…" on tablets), so it is kept for screen readers only and the picker's empty choice says "Play along…". */
@media (max-width: 860px) { .songs-cap { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; } }
/* The narrowest phones: a slimmer Sustain button, so "Play along…" fits in the picker beside it. */
@media (max-width: 360px) { .pedal { padding: 0 10px; gap: 6px; } .pedal svg { display: none; } }
/* Up to 400 px there is room for only a few letters of the song's name here ("Twinkle T…"); the picker right above
   the panel shows it, so the panel keeps just the "3 of 42" count. */
@media (max-width: 400px) { .along-title strong { display: none; } .along-count { margin-left: 0; } }
@media (min-width: 600px) {
  .wrap, .wide { padding-left: 24px; padding-right: 24px; }
  .wrap, .wide { padding-left: max(24px, env(safe-area-inset-left)); padding-right: max(24px, env(safe-area-inset-right)); }
  .piano { padding: 0 10px 10px; border-radius: 18px; }
  .rail { height: 22px; }
  .start { border-radius: 18px; }
  .seg label { min-width: 44px; padding: 0 12px; }
  .stage { padding-top: 22px; }
  .hero { padding-top: 32px; }
}
@media (min-width: 900px) { .piano { --kh: 230px; } }
@media (hover: hover) and (pointer: fine) {
  .kc { display: flex; }
  .fine-only { display: revert; }
}
@media (orientation: landscape) and (max-height: 500px) {
  .top-in { min-height: 40px; }
  .brand { padding: 4px 0; }
  .hero { padding-top: 8px; padding-bottom: 0; }
  h1 { font-size: 1.6rem; margin: 0; }
  .lede { display: none; }
  .stage { padding-top: 8px; }
  .toolbar { margin-bottom: 8px; }
  .rail { height: 10px; }
  .navrow { margin-bottom: 4px; }
  .piano { --kh: clamp(110px, calc(100vh - 221px), 220px); }
  .along-hint { display: none; }
}
@supports (height: 100svh) {
  @media (orientation: landscape) and (max-height: 500px) { .piano { --kh: clamp(110px, calc(100svh - 221px), 220px); } }
}
/* Touch screens: every control is at least 44 px for a finger. (Mouse users keep the slimmer 38 px buttons.) */
@media (pointer: coarse) {
  .seg label, .btn-sm { min-height: 44px; }
  .seg label { min-width: 44px; }
  .btn-sm.btn-icon { width: 44px; }
  .song-list a { min-height: 44px; }
  .link-btn { position: relative; }
  .link-btn::after { content: ""; position: absolute; left: -10px; right: -10px; top: 50%; height: 44px; margin-top: -22px; }
  /* iPhone Safari zooms the whole page into any form field under 16 px when it's tapped. */
  .pick select, .toast input { font-size: 16px; }
}
@media (pointer: coarse) and (max-width: 520px) { #restart { width: 44px; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; }
  .key.next .lab { animation: none; }
  .btn-rec[aria-pressed="true"] .rec-dot { animation: none; }
}
