/* ChordPath. Own look: dark keys area, warm wood accent, bright blue for "your note". */
:root {
  --bg: #101318; --panel: #181c23; --line: #2a303a; --ink: #eef1f5; --muted: #9aa4b2;
  --wood: #c8915a; --blue: #2f9bff; --right: #2fbf71; --wrong: #e5484d;
  --ivory: #f5f0e6; --ebony: #1c1d22;
  --kb-h: clamp(150px, 40dvh, 360px);
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
/* iPhone: tapping fast near the words was starting a text selection (Select / Copy). Nothing in the app is typed or copied. */
html, body { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; }
button, a { touch-action: manipulation; }
body {
  background: var(--bg); color: var(--ink);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  display: grid; grid-template-rows: auto auto 1fr auto var(--kb-h); grid-template-columns: minmax(0, 1fr);
  height: 100vh; height: 100dvh; overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}
a { color: var(--blue); }
.muted { color: var(--muted); }
.small { font-size: 14px; }

.top { display: flex; align-items: center; gap: 16px; padding: 8px 16px; border-bottom: 1px solid var(--line); }
.brand { font-weight: 800; font-size: 22px; color: var(--ink); text-decoration: none; letter-spacing: .3px; }
.brand span { color: var(--wood); }
.brand.big { font-size: 40px; }
.top nav { display: flex; gap: 4px; margin-left: auto; }
.top nav a { color: var(--ink); text-decoration: none; padding: 10px 14px; border-radius: 10px; }
body[data-screen="home"] .top nav a[href="#/"], body[data-screen="play"] .top nav a[href="#/play"],
body[data-screen="coachhome"] .top nav a[href="#/coach"], body[data-screen="songs"] .top nav a[href="#/songs"] { background: var(--panel); color: var(--wood); }

main { overflow: auto; padding: 12px 16px; }
.btn {
  font: inherit; color: var(--ink); background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; min-height: 44px; padding: 8px 16px; cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center;
}
.btn.small { min-height: 40px; padding: 6px 12px; font-size: 15px; }
.btn.go { background: var(--blue); border-color: var(--blue); color: #fff; font-weight: 700; }
.btn.go:disabled { background: var(--panel); border-color: var(--line); color: var(--muted); }
.btn.big { font-size: 20px; min-height: 60px; padding: 12px 28px; }
.btn[aria-pressed="true"] { border-color: var(--wood); color: var(--wood); }
.btn:disabled { opacity: .55; cursor: default; }

/* home */
.home { max-width: 760px; margin: 0 auto; }
.lead { font-size: 18px; margin: 4px 0 12px; }
.lessons { list-style: none; padding: 0; margin: 0 0 10px; display: grid; gap: 10px; }
.lcard { display: flex; gap: 14px; align-items: center; padding: 12px 16px; background: var(--panel);
  border: 1px solid var(--line); border-radius: 14px; color: var(--ink); text-decoration: none; }
.lcard .num { flex: 0 0 44px; height: 44px; border-radius: 50%; display: grid; place-items: center;
  background: var(--bg); color: var(--wood); font-weight: 800; font-size: 20px; border: 2px solid var(--wood); }
.lcard.free { margin-bottom: 10px; }

/* free play */
.play { max-width: 760px; margin: 0 auto; text-align: center; }
.bignamer { padding: 12px 0; }
.nm-big { font-size: clamp(44px, 9vw, 88px); font-weight: 800; line-height: 1.05; color: var(--blue); }
.nm-big.muted { color: var(--muted); font-size: clamp(28px, 6vw, 44px); }
.nm-sub { font-size: 20px; color: var(--muted); margin-top: 4px; }

/* lesson */
.lesson { max-width: 1200px; margin: 0 auto; min-height: 100%; display: flex; flex-direction: column; }
.lbody { display: flex; gap: 8px 20px; flex-wrap: wrap; align-items: flex-start; align-content: flex-start; flex: 1; }
.ltext { flex: 1 1 320px; min-width: 0; }
/* feedback and buttons stay in view at the bottom of the lesson area */
.actions { position: sticky; bottom: -12px; background: var(--bg); padding: 4px 0 8px; margin-top: 6px;
  border-top: 1px solid var(--line); }
.lhead { display: flex; gap: 12px; align-items: baseline; flex-wrap: wrap; }
.lhead .where { color: var(--muted); font-size: 14px; }
.back { text-decoration: none; }
.back::before { content: "\25C0  "; font-size: 12px; }
.steps { display: flex; gap: 5px; margin: 8px 0 4px; flex-wrap: wrap; }
.steps i { width: 22px; height: 6px; border-radius: 3px; background: var(--line); }
.steps i.done { background: var(--right); }
.steps i.now { background: var(--wood); }
.lesson h2 { margin: 6px 0 2px; font-size: 26px; color: var(--wood); }
.say { font-size: 18px; margin: 4px 0 10px; max-width: 70ch; }
.fb { min-height: 30px; font-size: 20px; font-weight: 700; margin: 2px 0 6px; }
.fb.right { color: var(--right); }
.fb.wrong { color: var(--wrong); }
.fb.info { color: var(--muted); }
.run { display: flex; gap: 8px; align-items: center; margin-right: 6px; }
.run i { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--right); }
.run i.on { background: var(--right); }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.lesson.done h2 { color: var(--right); }

/* chord card: piano, guitar, bari side by side */
.card { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; background: var(--panel);
  border: 1px solid var(--line); border-radius: 14px; padding: 10px 14px; margin: 4px 0 6px; width: fit-content; max-width: 100%; }
.card figure { margin: 0; text-align: center; }
.card figcaption { font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.dia.piano { width: 230px; height: auto; }
.dia.fret { height: 130px; width: auto; }
.pw { fill: var(--ivory); stroke: #888; stroke-width: .8; }
.pb { fill: var(--ebony); }
.pd { fill: var(--blue); }
.pn { fill: var(--ink); font-size: 11px; font-weight: 700; }
.fs, .ff { stroke: #8a94a3; stroke-width: 1.2; }
.nut { stroke: var(--ink); stroke-width: 4; }
.fd, .fbar { fill: var(--wood); }
.fo { fill: none; stroke: var(--ink); stroke-width: 1.5; }
.fx, .fn { fill: var(--muted); font-size: 13px; }
.fx { fill: var(--ink); }

/* key bar + keys */
.keybar { display: flex; align-items: center; gap: 8px; padding: 6px 12px; background: var(--panel);
  border-top: 1px solid var(--line); }
.namer { flex: 1; min-width: 0; text-align: center; font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.namer b { color: var(--blue); font-size: 20px; }
.kb { position: relative; background: #0a0b0e; touch-action: none; user-select: none; -webkit-user-select: none;
  -webkit-touch-callout: none; overflow: hidden; padding-bottom: env(safe-area-inset-bottom); }
.key { position: absolute; top: 0; display: flex; align-items: flex-end; justify-content: center; }
.key.white { height: 100%; background: var(--ivory); border: 1px solid #9c9486; border-top: 0;
  border-radius: 0 0 8px 8px; z-index: 1; }
.key.black { height: 62%; background: linear-gradient(#2a2b31, var(--ebony)); border: 1px solid #000;
  border-radius: 0 0 6px 6px; z-index: 2; box-shadow: 0 3px 4px rgba(0,0,0,.5); }
.lab { pointer-events: none; font-weight: 700; margin-bottom: 10px; font-size: 15px; color: #6b6458; }
.black .lab { color: #9aa0aa; font-size: 12px; margin-bottom: 8px; }
.nolabels .lab { visibility: hidden; }
/* "play now": the whole key is shaded (Aaron, 27 Nov: an outline alone is hard to see on white keys).
   White: mid blue #1f6fd1 at 45% over ivory = #95b6dd (1.85:1 against an unshaded key, labels 6.5:1).
   Black: light blue #7cc0ff (8.7:1 against an unshaded black key). Held, right and wrong colours win. */
.key.hint { box-shadow: inset 0 0 0 4px var(--blue); }
.key.white.hint:not(.held):not(.right):not(.wrong):not(.found) { background: #95b6dd; }
.key.black.hint:not(.held):not(.right):not(.wrong) { background: #7cc0ff; }
.key.hint:not(.right):not(.wrong) .lab { color: #0b2f55; }
.key.held { background: #bfe0ff; }
.key.black.held { background: #2f6fb8; }
.key.found { background: #b9ecd0; }
.key.right { background: var(--right); }
.key.wrong { background: var(--wrong); }
.key.right .lab, .key.wrong .lab { color: #fff; }
.key.right .lab::after { content: " \2713"; }
.key.wrong .lab::after { content: " \2717"; }


/* songs */
.tag { display: inline-block; font-size: 12px; font-weight: 700; padding: 1px 8px; border-radius: 999px;
  border: 1px solid var(--line); color: var(--muted); vertical-align: middle; }
.tag.warn { border-color: var(--wood); color: var(--wood); }
.songs-h, .songpage h2 { margin: 6px 0 4px; color: var(--wood); font-size: 26px; }
.songpage { max-width: 980px; margin: 0 auto; }
.songpage h3 { margin: 14px 0 6px; font-size: 18px; }
.opts { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 8px 0 4px; }
.seg { display: inline-flex; gap: 0; }
.seg .btn { border-radius: 0; }
.seg .btn:first-child { border-radius: 12px 0 0 12px; }
.seg .btn:last-child { border-radius: 0 12px 12px 0; }
.tempo { display: inline-flex; gap: 8px; align-items: center; }
.parts { display: flex; flex-wrap: wrap; gap: 8px; }
.parts .btn { gap: 6px; }
.anypair { margin-top: 8px; }
.anypair select { font: inherit; background: var(--panel); color: var(--ink); border: 1px solid var(--line); border-radius: 10px; min-height: 40px; padding: 4px 8px; }
.tips { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; margin: 8px 0; }
.tips summary { cursor: pointer; font-weight: 700; color: var(--wood); }
.tips ul { margin: 6px 0 0; padding-left: 20px; }
.warnbox { border: 1px solid var(--wood); color: var(--wood); border-radius: 12px; padding: 8px 12px; }

.songplay { max-width: 1200px; margin: 0 auto; min-height: 100%; display: flex; flex-direction: column; }
.sp-top { display: grid; grid-template-columns: auto auto minmax(0, 1fr); gap: 4px 20px; align-items: end; margin: 6px 0 2px; }
.sp-now, .sp-next { display: flex; flex-direction: column; align-items: flex-start; }
.sp-top .lbl { font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
#sp-now, #ch-now { font-size: clamp(48px, 6vw, 80px); line-height: 1; color: var(--blue); }
#sp-next, #ch-next { font-size: clamp(30px, 4.5vw, 48px); line-height: 1; color: var(--muted); }
.sp-notes { color: var(--muted); font-size: 15px; margin-top: 2px; }
.sp-ly { align-self: end; min-width: 0; }
.ly { font-size: 22px; line-height: 1.2; padding-top: 1.3em; }
.ly.spoken { padding-top: 0; font-style: italic; }
.lw { position: relative; }
.lc { position: absolute; left: 0; bottom: 1.15em; font-size: 17px; color: var(--wood); white-space: nowrap; }
.lc.on { color: var(--blue); font-size: 20px; }
.sp-bars { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 4px; }
.bx { min-width: 64px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel);
  display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.bx.now { border-color: var(--blue); box-shadow: 0 0 0 2px var(--blue) inset; }
.bx small { flex-basis: 100%; color: var(--muted); font-size: 11px; line-height: 1.2; }
.bc { font-weight: 700; font-size: 17px; }
.bc.on { color: var(--blue); }
.bc .mk { font-style: normal; font-size: 12px; margin-left: 3px; }
.bc.m-right { color: var(--right); } .bc.m-late, .bc.m-early { color: var(--wood); } .bc.m-wrong { color: var(--wrong); }
.songcard { align-items: flex-start; padding: 6px 10px; gap: 10px; margin: 4px 0; }
.songplay .songcard .dia.piano { width: 170px; }
.songplay.has-card .sp-bars { display: none; }
.songplay .songcard .dia.fret { height: 92px; }
.songplay .songcard figcaption { font-size: 12px; margin-bottom: 2px; }
.songplay .sc-say { font-size: 15px; line-height: 1.35; }
.songplay #sp-card { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; }
.songplay .actions { position: static; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: auto; }
.songplay .actions .fb { flex: 1 1 220px; margin: 0; min-height: 0; }
.sc-name { font-size: 30px; font-weight: 800; color: var(--wood); align-self: center; padding-right: 4px; }
.sc-say { flex: 1 1 260px; margin: 0; font-size: 16px; max-width: 46ch; }
.ch-count { display: flex; flex-direction: column; align-items: flex-start; }
#ch-count { font-size: clamp(52px, 8vw, 92px); line-height: 1; color: var(--right); }
.key.keep::before { content: ""; position: absolute; top: 8px; left: 50%; width: 14px; height: 14px; margin-left: -7px;
  border-radius: 50%; background: var(--blue); pointer-events: none; }
/* Listen: the notes the piano is sounding light up amber; the change flashes; key change notice */
.key.white.sound:not(.held) { background: #f3c98b; }
.key.black.sound:not(.held) { background: #c8915a; }
.key.sound:not(.held) .lab { color: #3a2410; }
.legend .lg-sound { background: #f3c98b; }
@keyframes cpflash { from { color: #fff; transform: scale(1.08); } to { color: var(--blue); transform: none; } }
#sp-now.flash { animation: cpflash .35s ease-out; display: inline-block; transform-origin: left bottom; }
@media (prefers-reduced-motion: reduce) { #sp-now.flash { animation: none; } }
.keynote { display: inline-block; margin: 4px 0; padding: 6px 14px; border-radius: 999px; font-weight: 800;
  background: var(--wood); color: #1b1208; font-size: 18px; }
.keynote[hidden] { display: none; }
.legend { font-size: 13px; color: var(--muted); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin: 2px 0; }
.legend i { display: inline-block; width: 14px; height: 14px; border-radius: 3px; margin-left: 6px; }
.legend .lg-now { box-shadow: inset 0 0 0 2px var(--blue); background: #95b6dd; }
.legend .lg-next { border-radius: 50%; border: 2px solid var(--blue); }
.legend .lg-keep { border-radius: 50%; background: var(--blue); }
.key.next::before { content: ""; position: absolute; top: 8px; left: 50%; width: 12px; height: 12px; margin-left: -6px;
  border-radius: 50%; border: 2px solid var(--blue); opacity: .75; pointer-events: none; }

/* free play chord strip */
.fstrip { text-align: left; }
.fs-bar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.fs-ok { font-weight: 700; color: var(--right); }
.fs-groups { display: flex; gap: 6px; overflow-x: auto; padding: 6px 0 2px; scrollbar-width: none; touch-action: pan-x; }
.chip { font: inherit; font-size: 14px; white-space: nowrap; color: var(--ink); background: var(--bg); border: 1px solid var(--line);
  border-radius: 999px; padding: 6px 12px; min-height: 36px; cursor: pointer; }
.chip[aria-selected="true"] { border-color: var(--wood); color: var(--wood); }
.fs-cards { display: flex; gap: 8px; overflow-x: auto; padding: 6px 0; touch-action: pan-x; scroll-snap-type: x proximity;
  overscroll-behavior-x: contain; -webkit-overflow-scrolling: touch; }
.fs-card { flex: 0 0 auto; scroll-snap-align: start; font: inherit; color: var(--ink); background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; padding: 4px 8px 2px; display: flex; flex-direction: column; align-items: center; cursor: pointer; }
.fs-card b { font-size: 20px; }
.fs-card.on { border-color: var(--blue); box-shadow: 0 0 0 2px var(--blue) inset; }
.fs-card .dia.piano { width: 120px; }
.play .bignamer { padding: 6px 0; }

/* Coach: scale numbers on the keys, and the number buttons */
.deg { position: absolute; left: 50%; bottom: 40px; transform: translateX(-50%); min-width: 26px; height: 26px; padding: 0 4px;
  border-radius: 13px; background: var(--wood); color: #1b1208; font-weight: 800; font-size: 15px; line-height: 26px;
  text-align: center; pointer-events: none; }
.key.black .deg { bottom: 34px; }
.numpad { display: flex; gap: 8px; flex-wrap: wrap; margin: 4px 0 8px; }
.numpad .btn { min-width: 52px; font-size: 20px; font-weight: 800; }


/* ---- Rustwood frame (added by tools/vendor_tools.py) ---- */
.rw-bar{position:relative;z-index:60;flex:0 0 auto;display:flex;align-items:center;gap:10px;
  padding:calc(env(safe-area-inset-top) + 8px) 14px 8px;background:#06080d;color:#dfe6f5;
  border-bottom:1px solid rgba(223,230,245,.12);font-family:system-ui,-apple-system,"Segoe UI",Roboto,sans-serif}
.rw-bar a{color:inherit;text-decoration:none}
.rw-brand{display:flex;align-items:baseline;gap:8px;white-space:nowrap}
.rw-brand b{font:800 17px/1 Impact,"Arial Narrow Bold",sans-serif;letter-spacing:.06em;color:#fff}
.rw-brand span{font:600 10px/1 ui-monospace,Menlo,Consolas,monospace;letter-spacing:.28em;color:#e0303c}
.rw-name{font:600 11px/1 ui-monospace,Menlo,Consolas,monospace;letter-spacing:.14em;text-transform:uppercase;color:#9aa8c6;white-space:nowrap}
.rw-sp{flex:1}
.rw-help{position:relative}
.rw-help summary,.rw-back,.rw-swap{font:600 11px/1 ui-monospace,Menlo,Consolas,monospace;letter-spacing:.12em;text-transform:uppercase;
  cursor:pointer;list-style:none;padding:8px 10px;border:1px solid rgba(223,230,245,.25);border-radius:6px;white-space:nowrap}
.rw-swap{border-color:#e0303c;color:#fff}
.rw-help summary::-webkit-details-marker{display:none}
.rw-help[open] summary{background:#dfe6f5;color:#06080d}
.rw-pop{position:absolute;z-index:100;right:0;top:calc(100% + 8px);max-height:calc(100dvh - 120px);overflow-y:auto;touch-action:pan-y;width:min(340px,calc(100vw - 28px));padding:16px 18px;
  background:#0b1530;border:1px solid rgba(223,230,245,.2);border-radius:10px;box-shadow:0 10px 30px rgba(0,0,0,.45);
  font:400 14px/1.5 system-ui,-apple-system,"Segoe UI",Roboto,sans-serif;color:#dfe6f5}
.rw-pop ol{margin:0 0 10px;padding-left:20px}
.rw-pop li{margin:0 0 6px}
.rw-pop p{margin:0;color:#9aa8c6;font-size:13px}
.rw-pop .rw-priv{color:#fff;margin-top:8px}
@media (max-width:720px){.rw-name{display:none}.rw-back{display:none}}
@media (max-width:560px){.rw-brand span{display:none}}
@media (max-width:420px){.rw-swap{display:none}}
.rw-bar{padding:calc(env(safe-area-inset-top) + 4px) 14px 4px}
.rw-help summary,.rw-back,.rw-swap{padding:6px 10px}
@media (max-width:720px){.rw-back{display:none}}
@media (max-width:420px){.rw-swap{display:none}}

/* start screen */
.start { position: fixed; inset: 0; background: rgba(10,11,14,.94); display: grid; place-items: center; z-index: 10; padding: 16px; }
.start[hidden] { display: none; }
.startbox { text-align: center; max-width: 420px; }
.fatal { position: fixed; top: 60px; left: 16px; right: 16px; background: var(--wrong); color: #fff; padding: 12px; border-radius: 10px; }

/* tall tablets upright (e.g. 924 x 1380): use the height for taller keys and a bigger chord card */
@media (orientation: portrait) and (min-width: 700px) {
  :root { --kb-h: clamp(150px, 44dvh, 640px); }
  .say { font-size: 20px; }
  .dia.piano { width: 380px; }
  .dia.fret { height: 200px; }
}

/* any short screen: smaller top bar */
@media (max-height: 520px) {
  :root { --kb-h: clamp(140px, 42dvh, 260px); }
  .top { padding: 4px 12px; }
  .brand { font-size: 18px; }
  .top nav a { padding: 6px 10px; }
  .keybar { padding: 2px 10px; }
  .btn.small { min-height: 36px; }
}

/* phones: in a lesson the "Lessons" link replaces the top bar, and everything is compact */
@media (max-height: 520px) and (orientation: landscape), (max-width: 480px) and (orientation: portrait) {
  body[data-screen="lesson"] .top, body[data-screen="lesson"] .rw-bar { display: none; }
  body[data-screen="lesson"] { grid-template-rows: 1fr auto var(--kb-h); }
  main { padding: 6px 12px; }
  .lhead .where { font-size: 12px; }
  .lesson h2 { font-size: 19px; margin: 2px 0; }
  .say { font-size: 15px; line-height: 1.35; margin: 2px 0 6px; }
  .card { padding: 6px 8px; gap: 8px; flex-wrap: nowrap; margin: 2px 0; }
  .card figcaption { font-size: 11px; margin-bottom: 2px; }
  .dia.piano { width: 132px; }
  .dia.fret { height: 80px; }
  .fb { font-size: 16px; min-height: 22px; margin: 0 0 4px; }
  .actions { padding: 4px 0 6px; margin-top: 2px; }
  .actions .row { gap: 6px; flex-wrap: nowrap; }
  .actions .btn { min-height: 40px; padding: 4px 10px; font-size: 15px; }
  .run { gap: 4px; margin-right: 2px; }
  .run i { width: 13px; height: 13px; }
}

/* phone upright: a bit less keyboard height so the lesson words, card and Next fit */
@media (max-width: 480px) and (orientation: portrait) {
  :root { --kb-h: clamp(150px, 34dvh, 260px); }
  .top nav a { padding: 8px 8px; font-size: 15px; }
  .btn.small { padding: 6px 8px; font-size: 14px; }
  .namer { font-size: 15px; }
  .steps { margin: 4px 0 2px; }
}

/* phone on its side: words and buttons on the left, chord card on the right */
@media (max-height: 520px) and (orientation: landscape) {
  .lesson { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 12px;
    grid-template-areas: "head card" "body card" "act card"; align-content: start; min-height: 0; }
  :root { --kb-h: clamp(140px, 40dvh, 260px); }
  main { padding-top: 2px; }
  .lhead { grid-area: head; font-size: 12px; }
  .steps { display: none; }
  .lbody { display: contents; }
  .ltext { grid-area: body; }
  .card { grid-area: card; align-self: start; }
  .say { font-size: 14px; margin: 0 0 4px; }
  .actions { grid-area: act; position: static; border-top: 0; padding: 0 0 2px; }
  .lesson h2 { font-size: 18px; margin: 0; }
}

/* songs and the chord strip on phones */
@media (max-height: 520px) and (orientation: landscape), (max-width: 480px) and (orientation: portrait) {
  body[data-screen="songs"] .top { display: none; }
  body[data-screen="songs"] { grid-template-rows: 1fr auto var(--kb-h); }
  .sp-top { gap: 2px 12px; margin: 2px 0; }
  #sp-now, #ch-now, #ch-count { font-size: 40px; }
  #sp-next, #ch-next { font-size: 24px; }
  .sp-notes { font-size: 12px; }
  .ly { font-size: 16px; }
  .lc { font-size: 13px; } .lc.on { font-size: 15px; }
  .sp-bars { gap: 4px; margin: 4px 0 2px; }
  .bx { min-width: 44px; padding: 2px 6px; }
  .bc { font-size: 14px; }
  .bx small { display: none; }
  .legend { display: none; }
  /* phones: the song's chord card keeps the piano and the words; guitar and bari are on the song page cards */
  .songplay .songcard { flex-wrap: nowrap; padding: 4px 8px; gap: 8px; }
  .songplay .songcard figure:not(:first-of-type), .songplay .sc-name, .songplay .songcard figcaption { display: none; }
  .songplay .songcard .dia.piano { width: 110px; }
  .songplay .sc-say { font-size: 13px; line-height: 1.3; }
  .songplay .sc-more { display: none; }
  .songplay #sp-card .btn { min-height: 36px; }
  .fs-card .dia.piano { width: 76px; }
  .fs-card b { font-size: 16px; }
  .fs-card { padding: 2px 6px 0; }
  .chip { min-height: 32px; padding: 4px 10px; font-size: 13px; }
  .play .nm-big { font-size: 40px; } .play .nm-sub { font-size: 15px; }
  .play .tip { display: none; }
}
@media (max-width: 480px) and (orientation: portrait) {
  .sp-top { grid-template-columns: auto auto; }
  .sp-ly { grid-column: 1 / -1; }
}
@media (max-height: 520px) and (orientation: landscape) {
  .sp-top { grid-template-columns: auto auto minmax(0, 1fr); }
  .play .nm-big { font-size: 30px; }
  .fs-groups { padding: 2px 0 0; }
  .fs-cards { padding: 2px 0; }
  .fs-card .dia.piano { width: 64px; }
}

/* Coach on short screens: smaller number buttons and badges */
@media (max-height: 520px) {
  .numpad { gap: 4px; margin: 2px 0 4px; }
  .numpad .btn { min-width: 40px; min-height: 36px; font-size: 16px; padding: 2px 8px; }
  .deg { bottom: 30px; min-width: 22px; height: 22px; line-height: 22px; font-size: 13px; }
}

/* narrow phones: four tabs (Lessons, Coach, Songs, Free play) must fit beside the name */
@media (max-width: 480px) {
  .top { gap: 6px; padding: 6px 8px; }
  .top .brand { font-size: 17px; }
  .top nav { gap: 0; }
  .top nav a { padding: 8px 6px; font-size: 14px; }
}
@media (max-width: 359px) {
  .top .brand { font-size: 15px; }
  .top nav a { padding: 8px 4px; font-size: 13px; }
}
.top nav a { white-space: nowrap; }
@media (max-width: 339px) {
  .top { gap: 4px; padding: 6px 6px; }
  .top .brand { font-size: 14px; }
  .top nav a { padding: 8px 3px; font-size: 12.5px; }
}
@media (min-width: 340px) and (max-width: 400px) {
  .top .brand { font-size: 16px; }
  .top nav a { padding: 8px 4px; font-size: 13.5px; }
}
