/* Stafflight — warm paper, ink, one vermilion accent. Three level hues share a family. */
:root {
  --bg: #f7f6fc;
  --surface: #ffffff;
  --surface-2: #eeecf8;
  --ink: #1b1535;
  --muted: #645e80;
  --line: #e0ddef;
  --accent: #6a45f0;
  --accent-ink: #ffffff;
  --l1: #4f8a63;
  --l2: #c4861f;
  --l3: #3d5fa0;
  --paper: #ffffff;
  --paper-ink: #1b1535;
  --shadow: 0 1px 0 rgba(29, 27, 24, .04), 0 12px 32px -14px rgba(40, 20, 110, .22);
  --radius: 16px;
  --dock-h: 136px;
  --side-w: 296px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e0a1d;
    --surface: #171230;
    --surface-2: #211a40;
    --ink: #f1eefc;
    --muted: #a39cc4;
    --line: #2d2650;
    --accent: #a99bff;
    --accent-ink: #120a33;
    --l1: #7cc194;
    --l2: #e2aa4d;
    --l3: #86a4e0;
    --shadow: 0 1px 0 rgba(0, 0, 0, .3), 0 18px 40px -16px rgba(0, 0, 0, .7);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e0a1d;
  --surface: #171230;
  --surface-2: #211a40;
  --ink: #f1eefc;
  --muted: #a39cc4;
  --line: #2d2650;
  --accent: #a99bff;
  --accent-ink: #120a33;
  --l1: #7cc194;
  --l2: #e2aa4d;
  --l3: #86a4e0;
  --shadow: 0 1px 0 rgba(0, 0, 0, .3), 0 18px 40px -16px rgba(0, 0, 0, .7);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.55 "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; cursor: pointer; }
h1, h2, p { margin: 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
kbd {
  font: 500 12px/1 "Inter", sans-serif; padding: 2px 6px; border-radius: 5px;
  background: var(--surface-2); border: 1px solid var(--line); border-bottom-width: 2px;
}

.app { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: 100vh; }

/* ---------- sidebar ---------- */
.sidebar {
  position: sticky; top: 0; align-self: start; height: 100vh; overflow: auto;
  padding: 28px 20px 28px 24px; border-right: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); }
.brand-mark { width: 34px; height: 34px; }
.brand-name { font: 500 26px/1 "Fraunces", Georgia, serif; letter-spacing: -.01em; }
.tagline { margin: 10px 0 30px; color: var(--muted); font-size: 14px; max-width: 22ch; }
.eyebrow { font-size: 11.5px; font-weight: 600; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); margin-bottom: 10px; }
.library { display: flex; flex-direction: column; gap: 6px; }
.song-card {
  display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; text-align: left;
  padding: 12px 14px; border-radius: 12px; border: 1px solid transparent; background: transparent;
  transition: background .15s, border-color .15s;
}
.song-card:hover { background: var(--surface-2); }
.song-card[aria-current="true"] { background: var(--surface); border-color: var(--line); box-shadow: var(--shadow); }
.song-card .t { font: 500 16px/1.25 "Fraunces", Georgia, serif; }
.song-card .c { grid-column: 1; font-size: 12.5px; color: var(--muted); }
.song-card .n { grid-row: 1 / span 2; grid-column: 2; align-self: center; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.side-foot { margin-top: 28px; font-size: 12.5px; color: var(--muted); max-width: 28ch; }

.side-link {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: -12px 0 24px; padding: 11px 14px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink); text-decoration: none; transition: background .15s, transform .12s;
}
.side-link:hover { background: var(--surface-2); transform: translateY(-1px); }
.side-link b { display: block; font-size: 14px; }
.side-link small { display: block; font-size: 12px; color: var(--muted); font-weight: 500; }
.lib-count { font-weight: 500; letter-spacing: 0; text-transform: none; opacity: .8; margin-left: 4px; }
.search { position: relative; display: block; margin-bottom: 10px; }
.search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search input {
  width: 100%; padding: 9px 12px 9px 34px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface);
  color: var(--ink); font: inherit; font-size: 14px;
}
.search input::placeholder { color: var(--muted); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.lib-empty { color: var(--muted); font-size: 14px; padding: 8px 4px; }

/* ---------- main ---------- */
.main { padding: 22px clamp(16px, 4vw, 52px) calc(var(--dock-h) + 40px); min-width: 0; max-width: 1180px; }
.topbar { display: flex; justify-content: flex-end; gap: 8px; margin-bottom: 8px; }
.chip-btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line); font-size: 13.5px; font-weight: 500;
  transition: background .15s, border-color .15s, transform .1s;
}
.chip-btn:hover { background: var(--surface-2); }
.chip-btn:active { transform: translateY(1px); }
.chip-btn.icon-only { padding: 8px 10px; }
.chip-btn.on { border-color: var(--l1); }
.chip-btn.on svg { color: var(--l1); }

.song-head { margin: 10px 0 22px; }
.song-head .eyebrow { margin-bottom: 8px; }
.song-head h1 { font: 500 clamp(32px, 5vw, 52px)/1.05 "Fraunces", Georgia, serif; letter-spacing: -.02em; }
.composer { margin-top: 8px; font-size: 16px; color: var(--muted); }
.pd {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 12px; padding: 4px 12px 4px 9px;
  border-radius: 999px; background: color-mix(in srgb, var(--l1) 14%, transparent); color: var(--l1);
  font-size: 12.5px; font-weight: 600;
}

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.controls { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 18px 28px; padding: 18px 22px; }
.ctl { display: flex; flex-direction: column; gap: 8px; }
.ctl-play { flex-direction: row; align-items: center; gap: 14px; }
.ctl-actions { flex-direction: row; gap: 8px; margin-left: auto; }
.lbl { font-size: 12px; font-weight: 600; color: var(--muted); letter-spacing: .02em; }
.lbl b { color: var(--ink); font-variant-numeric: tabular-nums; }
.lbl .unit { font-weight: 500; }

.play {
  width: 56px; height: 56px; border-radius: 50%; border: 0; background: var(--accent); color: var(--accent-ink);
  display: grid; place-items: center; box-shadow: 0 8px 20px -8px var(--accent); transition: transform .12s;
}
.play:hover { transform: scale(1.04); }
.play:active { transform: scale(.97); }
.play[hidden], [hidden] { display: none !important; }
.ghost { width: 40px; height: 40px; border-radius: 50%; background: transparent; border: 1px solid var(--line); display: grid; place-items: center; }
.ghost:hover { background: var(--surface-2); }
.tempo { display: flex; flex-direction: column; gap: 8px; min-width: 150px; }
input[type="range"] { width: 100%; accent-color: var(--accent); margin: 0; }

.seg { display: inline-flex; padding: 3px; gap: 2px; background: var(--surface-2); border-radius: 12px; border: 1px solid var(--line); }
.seg button {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 13px; border: 0; background: transparent;
  border-radius: 9px; font-weight: 600; font-size: 14px; color: var(--muted); transition: background .15s, color .15s;
}
.seg button small { font-weight: 500; font-size: 12px; opacity: .85; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, .12); }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.dot.l1 { background: var(--l1); } .dot.l2 { background: var(--l2); } .dot.l3 { background: var(--l3); }

/* ---------- ladder ---------- */
.ladder { margin: 28px 0 14px; }
.ladder-head { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; margin-bottom: 12px; }
.ladder-head h2 { font: 500 20px/1.2 "Fraunces", Georgia, serif; }
.ladder-head p { color: var(--muted); font-size: 13.5px; }
.tiles { display: flex; flex-wrap: wrap; gap: 6px; }
.tile {
  position: relative; width: 38px; height: 52px; padding: 0; border-radius: 9px; border: 1px solid var(--line);
  background: var(--surface); overflow: hidden; display: flex; flex-direction: column; justify-content: space-between;
  align-items: center; font-size: 11.5px; font-weight: 600; color: var(--muted); padding-top: 5px;
  transition: transform .12s, border-color .15s;
}
.tile:hover { transform: translateY(-2px); border-color: var(--muted); }
.tile .bar { width: 100%; transition: height .35s cubic-bezier(.3, 1.3, .5, 1), background .2s; }
.tile[data-level="1"] .bar { height: 7px;  background: var(--l1); }
.tile[data-level="2"] .bar { height: 17px; background: var(--l2); }
.tile[data-level="3"] .bar { height: 27px; background: var(--l3); }
.tile.now { border-color: var(--accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 30%, transparent); color: var(--ink); }
.tile.pulse { animation: pulse .9s ease-out; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 60%, transparent); } 100% { box-shadow: 0 0 0 12px transparent; } }

/* ---------- status ---------- */
.status {
  margin: 4px 0 14px; padding: 12px 16px; border-radius: 12px; background: color-mix(in srgb, var(--accent) 9%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--line)); font-size: 14px; display: flex; gap: 14px; align-items: center; flex-wrap: wrap;
}
.status b { font-variant-numeric: tabular-nums; }
.status button { margin-left: auto; }

/* ---------- score ---------- */
.paper-wrap { margin-top: 10px; }
.paper {
  background: var(--paper); color: var(--paper-ink); border-radius: 18px; padding: 26px clamp(14px, 3vw, 34px) 30px;
  box-shadow: var(--shadow); border: 1px solid rgba(0, 0, 0, .06);
}
.paper-inner { position: relative; min-height: 260px; }
#score { width: 100%; }
.badges { position: absolute; inset: 0; pointer-events: none; }
.badge {
  position: absolute; height: 5px; border-radius: 3px; border: 0; padding: 0; pointer-events: auto; cursor: pointer;
  transition: transform .15s, height .15s, opacity .15s; opacity: .9;
}
.badge::after { content: ""; position: absolute; inset: -9px 0; }
.badge:hover { height: 8px; transform: translateY(-1px); opacity: 1; }
.badge[data-level="1"] { background: var(--l1); } .badge[data-level="2"] { background: var(--l2); } .badge[data-level="3"] { background: var(--l3); }
.loading { position: absolute; inset: 0; display: grid; place-items: center; grid-auto-flow: column; gap: 8px; align-content: center; justify-content: center; }
.loading span { width: 9px; height: 9px; border-radius: 50%; background: #b9ae98; animation: blink 1s infinite ease-in-out; }
.loading span:nth-child(2) { animation-delay: .15s; } .loading span:nth-child(3) { animation-delay: .3s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; transform: scale(.8); } 40% { opacity: 1; transform: scale(1); } }
.loading.done { display: none; }
.print-head, .print-foot { display: none; }
.howto { margin-top: 18px; font-size: 13px; color: var(--muted); max-width: 70ch; }

/* ---------- piano dock ---------- */
.dock {
  position: fixed; left: var(--side-w); right: 0; bottom: 0; height: var(--dock-h); padding: 10px clamp(12px, 3vw, 40px) 14px;
  background: linear-gradient(to top, var(--bg) 70%, transparent); z-index: 5;
}
.piano { position: relative; display: flex; height: 100%; max-width: 980px; margin: 0 auto; border-radius: 0 0 12px 12px; box-shadow: 0 10px 28px -12px rgba(0, 0, 0, .45); touch-action: none; user-select: none; }
.key.white {
  flex: 1; position: relative; background: #fffdf8; border: 1px solid #c9bfab; border-top: 0; border-radius: 0 0 7px 7px;
  display: flex; align-items: flex-end; justify-content: center; padding-bottom: 6px; font-size: 10.5px; font-weight: 600; color: #8a8270; transition: background .08s;
}
.key.black {
  position: absolute; top: 0; height: 62%; background: #25221d; border-radius: 0 0 5px 5px; z-index: 2;
  display: flex; align-items: flex-end; justify-content: center; padding-bottom: 5px; font-size: 9.5px; font-weight: 600; color: #8f8776; transition: background .08s;
}
.key.hint { box-shadow: inset 0 -5px 0 var(--accent); }
.key.white.hint { background: color-mix(in srgb, var(--accent) 16%, #fffdf8); }
.key.black.hint { background: color-mix(in srgb, var(--accent) 60%, #25221d); }
.key.down.white, .key.play.white { background: color-mix(in srgb, var(--l3) 28%, #fffdf8); }
.key.down.black, .key.play.black { background: var(--l3); }
.key.wrong.white { background: #f6c9c0; } .key.wrong.black { background: #b8442f; }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--dock-h) + 20px); transform: translate(-50%, 12px); opacity: 0; pointer-events: none;
  padding: 10px 16px; border-radius: 999px; background: var(--ink); color: var(--bg); font-size: 14px; font-weight: 500; z-index: 20;
  transition: opacity .2s, transform .2s; max-width: calc(100vw - 32px); display: flex; align-items: center; gap: 8px; box-shadow: var(--shadow);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast .arrow { font-weight: 700; }
.toast.up .arrow { color: var(--l1); } .toast.down .arrow { color: var(--l2); }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  :root { --dock-h: 108px; }
  .search { max-width: 420px; }
  .song-card { padding: 10px 12px; }
  .song-card .t { font-size: 15px; }
  .tagline { margin-bottom: 12px; }
  .app { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--line); padding: 18px 16px 14px; }
  .tagline { margin-bottom: 14px; }
  .library { flex-direction: row; overflow-x: auto; padding-bottom: 6px; scroll-snap-type: x proximity; }
  .song-card { min-width: 190px; scroll-snap-align: start; border-color: var(--line); background: var(--surface); }
  .side-foot { display: none; }
  .dock { left: 0; }
  .ctl-actions { margin-left: 0; }
  .piano { min-width: 560px; }
  .dock { overflow-x: auto; }
}
@media (max-width: 520px) {
  .tagline { display: none; }
  .brand { margin-bottom: 14px; }
  .controls { padding: 16px; gap: 16px; }
  .seg button small { display: none; }
  .tile { width: 34px; height: 48px; }
}
/* phone held sideways: keep the song list as a slim column and give the score the height, with a low keyboard */
@media (orientation: landscape) and (max-height: 520px) {
  :root { --dock-h: 78px; --side-w: 210px; }
  .app { grid-template-columns: var(--side-w) minmax(0, 1fr); }
  .sidebar { position: sticky; top: 0; height: 100vh; border-right: 1px solid var(--line); border-bottom: 0; padding: 12px 12px 12px max(12px, env(safe-area-inset-left)); }
  .tagline, .side-foot { display: none; }
  .brand { margin-bottom: 10px; }
  .library { flex-direction: column; overflow-x: hidden; overflow-y: auto; scroll-snap-type: none; }
  .song-card { min-width: 0; }
  .main { padding: 10px 14px calc(var(--dock-h) + 16px); }
  .song-head { margin: 4px 0 10px; }
  .song-head h1 { font-size: 26px; }
  .controls { padding: 10px 14px; gap: 10px 18px; }
  .dock { left: var(--side-w); padding: 6px 12px max(6px, env(safe-area-inset-bottom)); overflow: visible; }
  .piano { min-width: 0; }
  .key.white { padding-bottom: 2px; font-size: 9px; }
  .key.black { height: 60%; }
  .toast { bottom: calc(var(--dock-h) + 10px); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ---------- reader (full screen) ---------- */
.paper { position: relative; }
.expand-btn { position: absolute; top: 12px; right: 12px; z-index: 3; background: rgba(255, 253, 248, .92); color: var(--paper-ink); border-color: #e3dccb; }
.expand-btn:hover { background: #f3ecdc; }
.reader-head, .reader-bar { display: none; }

body.reader { overflow: hidden; }
body.reader .sidebar, body.reader .topbar, body.reader .song-head, body.reader .controls,
body.reader .ladder, body.reader .status, body.reader .howto, body.reader .dock, body.reader .toast { display: none !important; }
body.reader .toast.show { display: flex !important; bottom: calc(92px + env(safe-area-inset-bottom)); }
body.reader .app { display: block; }
body.reader .main { padding: 0; max-width: none; }
body.reader .paper-wrap {
  position: fixed; inset: 0; z-index: 40; margin: 0; overflow: auto; background: var(--paper);
  -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
}
body.reader .paper {
  border-radius: 0; box-shadow: none; border: 0; min-height: 100%;
  padding: max(10px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) calc(96px + env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
}
body.reader .expand-btn { display: none; }
body.reader .reader-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 4px 8px 0;
  font: 500 17px/1.2 "Fraunces", Georgia, serif; color: var(--paper-ink);
}
body.reader .reader-head span:last-child { font: 600 12px/1 "Inter", sans-serif; color: #7a7466; white-space: nowrap; }
body.reader .paper-inner { min-height: 0; }
body.reader .reader-bar {
  display: flex; align-items: center; gap: 4px; position: fixed; left: 50%; z-index: 50;
  bottom: calc(14px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  padding: 6px; border-radius: 999px; background: rgba(29, 27, 24, .94); color: #f6f1e6;
  box-shadow: 0 12px 30px -8px rgba(0, 0, 0, .55); backdrop-filter: blur(8px);
  max-width: calc(100vw - 16px);
}
.reader-bar button {
  min-width: 44px; height: 44px; padding: 0 12px; border: 0; border-radius: 999px; background: transparent; color: inherit;
  display: grid; place-items: center; font: 600 15px/1 "Inter", sans-serif; touch-action: manipulation;
}
.reader-bar button:active { background: rgba(255, 255, 255, .14); }
.reader-bar .rd-play { width: 52px; height: 52px; background: var(--accent); color: var(--accent-ink); margin: 0 4px; }
.reader-bar .rd-text small { font-size: 12px; margin-left: 1px; vertical-align: super; }
.reader-bar .rd-text b { font-weight: 700; margin-left: 3px; }
.reader-bar button:focus-visible { outline-color: #fff; }
.reader-bar button[aria-pressed="true"] { background: rgba(255, 255, 255, .18); }
body.reader .reader-bar button { min-width: 40px; padding: 0 9px; }
body.reader .reader-bar .rd-play { min-width: 52px; }

/* page view: one whole page on screen, turn pages instead of scrolling */
#slide { position: relative; transition: transform .28s cubic-bezier(.3, .8, .3, 1); will-change: transform; }
.pg { display: none; }
body.reader.paged .paper-wrap { overflow: hidden; }
body.reader.paged .paper-inner { overflow: hidden; }
body.reader.paged .pg {
  display: flex; align-items: center; position: fixed; top: 54px; bottom: calc(86px + env(safe-area-inset-bottom));
  width: 15%; max-width: 90px; z-index: 45; padding: 0 6px; border: 0; background: transparent; color: #6d665a; touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
body.reader.paged .pg-prev { left: 0; justify-content: flex-start; }
body.reader.paged .pg-next { right: 0; justify-content: flex-end; }
.pg span { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: rgba(29, 27, 24, .1); transition: background .15s, opacity .15s; }
.pg:active span { background: rgba(29, 27, 24, .22); }
.pg:disabled { opacity: 0; pointer-events: none; }

/* ---------- print: just the score, black on white ---------- */
@media print {
  @page { margin: 14mm 12mm; }
  body { background: #fff; color: #000; }
  .sidebar, .topbar, .song-head, .controls, .ladder, .status, .howto, .dock, .toast, .badges, .loading,
  .expand-btn, .reader-bar, .reader-head, .pg { display: none !important; }
  #slide { transform: none !important; }
  .paper-inner { height: auto !important; overflow: visible !important; }
  .app { display: block; }
  .main { padding: 0; max-width: none; }
  .paper { box-shadow: none; border: 0; padding: 0; background: #fff; }
  .print-head { display: block; text-align: center; margin-bottom: 8mm; }
  .ph-title { font: 600 24pt/1.1 "Fraunces", Georgia, serif; }
  .ph-sub { font: 11pt/1.4 "Inter", sans-serif; color: #444; margin-top: 2mm; }
  .print-foot { display: block; margin-top: 8mm; font: 8.5pt/1.4 "Inter", sans-serif; color: #555; text-align: center; }
  #score svg { max-width: 100%; }
}

/* ---------- the reader's own MusicXML (practice page) ---------- */
.side-add { margin: 2px 0 10px; cursor: pointer; }
.side-note { font-size: 12.5px; color: var(--muted); margin: 0 0 12px; max-width: 30ch; }
.xml-row { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 2px; }
.xml-del { width: 30px; height: 30px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font-size: 18px; line-height: 1; }
.xml-del:hover { background: var(--surface-2); color: var(--ink); }
body.custom .ladder { display: none !important; }

.part-pick { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.part-pick select { padding: 8px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; font-size: 14px; max-width: 220px; }
.chk { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.chk input { accent-color: var(--accent); }

/* practice banner */
.song-head { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 8px 24px; align-items: center; padding: 22px 28px; border-radius: 22px; color: #fff; position: relative; overflow: hidden;
  background: linear-gradient(120deg, var(--h1, #35507d), var(--h2, #101c33)); box-shadow: var(--shadow); }
.song-head::after { content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .5;
  background: repeating-linear-gradient(to bottom, rgba(255, 255, 255, .13) 0 1px, transparent 1px 18px); mask-image: linear-gradient(90deg, transparent 30%, #000); -webkit-mask-image: linear-gradient(90deg, transparent 30%, #000); }
.song-head > * { position: relative; z-index: 1; }
.song-head.no-cover { grid-template-columns: 1fr; }
.song-head.no-cover .hero-cover { display: none; }
.song-head .eyebrow, .song-head .composer, .song-head .pd { color: rgba(255, 255, 255, .82); }
.song-head h1 { color: #fff; }
.hero-cover .cover { width: 96px; box-shadow: 0 14px 26px -10px rgba(0, 0, 0, .55); }
@media (max-width: 700px) { .song-head { grid-template-columns: 64px minmax(0, 1fr); padding: 16px 18px; gap: 8px 16px; border-radius: 18px; } .hero-cover .cover { width: 64px; } }
@media (orientation: landscape) and (max-height: 520px) { .song-head { padding: 10px 16px; grid-template-columns: 52px 1fr; } .hero-cover .cover { width: 52px; } }

/* Library | Practice switch, the same control as on the library page */
.mode-tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 3px; margin: 0 0 22px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; }
.mode-tabs a { padding: 8px 10px; border-radius: 9px; text-align: center; font-weight: 600; font-size: 13.5px; color: var(--muted); text-decoration: none; white-space: nowrap; }
.mode-tabs a:hover { color: var(--ink); }
.mode-tabs a[aria-current="page"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, .12); }
@media (max-width: 900px) { .mode-tabs { margin-bottom: 14px; max-width: 360px; } }
@media (orientation: landscape) and (max-height: 520px) { .mode-tabs { margin-bottom: 10px; } .mode-tabs a { padding: 6px 4px; font-size: 12.5px; } }

.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); overflow: hidden; }
.stepper button { width: 38px; height: 38px; border: 0; background: transparent; font-size: 18px; color: var(--ink); }
.stepper button:hover:not(:disabled) { background: var(--surface-2); }
.stepper button:disabled { opacity: .3; cursor: default; }
.stepper output { min-width: 112px; padding: 0 6px; text-align: center; font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
@media (max-width: 900px) { .sidebar { padding-top: max(18px, calc(env(safe-area-inset-top) + 8px)); } .dock { padding-bottom: max(14px, env(safe-area-inset-bottom)); } }

/* keep scrolling content from running under the iPhone status bar */
body::before { content: ""; position: fixed; top: 0; left: 0; right: 0; height: env(safe-area-inset-top); background: var(--bg); z-index: 90; pointer-events: none; }

/* app feel: no accidental text selection or iOS callouts on the interface (inputs and reading pages stay selectable) */
html { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; }
input, textarea, .legal, .legal * { -webkit-user-select: text; user-select: text; }

/* My MusicXML: one slim row instead of a tall block */
.mx-row { display: flex; align-items: center; gap: 10px; margin: 12px 0 4px; flex-wrap: wrap; }
.mx-row .side-add { margin: 0; padding: 7px 12px; font-size: 13px; }
.mx-hint { font-size: 11.5px; color: var(--muted); }
#myXml:empty { display: none; }
@media (max-width: 900px) { .mx-hint { display: none; } }

.eyebrow-row { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.eyebrow-row .eyebrow { margin: 0; }
.view-all { border: 0; background: transparent; color: var(--accent); font-weight: 600; font-size: 13px; padding: 4px 2px; }
@media (min-width: 901px) { .view-all { display: none; } }
@media (max-width: 900px) {
  .library.all { flex-direction: column; overflow: visible; max-height: none; scroll-snap-type: none; }
  .library.all .song-card { min-width: 0; grid-template-columns: 1fr auto; padding: 10px 14px; }
  .library.all .song-card .c { grid-column: 1; }
}

/* wordmark: black lettering with a red barline inside the name */
:root { --bar: #d6293e; }
:root[data-theme="dark"] { --bar: #ff5a6e; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --bar: #ff5a6e; } }
.brand-name { display: inline-flex; align-items: center; color: var(--ink); font-family: "Fraunces", Georgia, serif; font-weight: 500; font-size: 26px; letter-spacing: -.035em; font-variation-settings: "opsz" 72; }
.brand-name .bl { font-weight: 600; color: var(--bar); }
.brand-mark line[stroke="var(--bar)"] { stroke: var(--bar); }
