/* The songbook (SPEC section 15, "Songbook"): sheet music of the picture house the plate lives in. Black, white and
   greys on paper, engraved rules and the start card's corner pieces; the bell's orange once, on LEARN IT. */
:root {
  color-scheme: light;
  --house: #161615;
  --paper: #f4f3ef;
  --ink: #141414;
  --ink-2: #4a4a48;
  --ink-3: #8a8a86;
  --rule: #c9c8c2;
  --bell: #ff5b1a;
  --type: ui-rounded, "SF Pro Rounded", "Arial Rounded MT Bold", system-ui, sans-serif;
  --display: "Didot", "Bodoni 72", "Bodoni MT", "Big Caslon", Georgia, serif;
  --mono: ui-monospace, "SF Mono", Menlo, monospace;
  --cell: 15px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--house); color: var(--ink); font-family: var(--type); -webkit-font-smoothing: antialiased; }
a { color: inherit; }
kbd {
  display: inline-block;
  min-width: 1.6em;
  padding: 0 0.35em;
  border: 1px solid var(--ink);
  border-bottom-width: 2px;
  border-radius: 3px;
  font: 600 0.82em/1.45 var(--type);
  text-align: center;
  text-transform: uppercase;
  white-space: nowrap;
}

.sb-book { max-width: 1180px; margin: 0 auto; padding: 18px 18px 40px; }
.sb-note { color: #b9b8b2; font-size: 13px; text-align: center; letter-spacing: 0.04em; }
.sb-error { margin: 16px auto; max-width: 640px; padding: 10px 14px; border: 1px solid #ff453a; border-radius: 4px; color: #ffb4ae; font-size: 13px; }

/* Ornaments: the start card's corner pieces inside a double rule, and the diamond flourish between two lines. */
.sb-rule { position: absolute; inset: 10px; border: 4px double currentColor; border-radius: 5px; opacity: 0.75; pointer-events: none; }
.sb-corner {
  position: absolute;
  width: 20px;
  height: 20px;
  background: currentColor;
  -webkit-mask: url(stage-art/ui/corner.svg) center / contain no-repeat;
  mask: url(stage-art/ui/corner.svg) center / contain no-repeat;
}
.sb-corner.tl { top: 3px; left: 3px; }
.sb-corner.tr { top: 3px; right: 3px; transform: scaleX(-1); }
.sb-corner.bl { bottom: 3px; left: 3px; transform: scaleY(-1); }
.sb-corner.br { bottom: 3px; right: 3px; transform: scale(-1); }
.sb-flourish { position: relative; display: block; width: 150px; height: 8px; margin: 10px auto; }
.sb-flourish::before, .sb-flourish::after { content: ""; position: absolute; top: 50%; width: 44%; border-top: 1px solid currentColor; opacity: 0.7; }
.sb-flourish::before { left: 0; }
.sb-flourish::after { right: 0; }
.sb-flourish { background: linear-gradient(currentColor, currentColor) center / 6px 6px no-repeat; clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%); }
/* A sunburst of grey rays behind a cover, the way song sheets of the day were printed. */
.sb-burst {
  position: absolute;
  inset: 0;
  z-index: 0;
  background: repeating-conic-gradient(from 0deg at 50% 118%, rgba(0, 0, 0, 0.06) 0deg 4deg, transparent 4deg 8deg);
  pointer-events: none;
}

/* The shelf: a masthead in the house's own lettering over a row of covers. */
.sb-mast { position: relative; padding: 18px 0 8px; text-align: center; color: #ecebe6; }
.sb-back { position: absolute; left: 0; top: 0; font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; color: #b9b8b2; text-decoration: none; }
.sb-back::before { content: "‹ "; }
.sb-back:hover, .sb-back:focus-visible { color: #fff; text-decoration: underline; }
.sb-bill { margin: 0; font-size: 10px; letter-spacing: 0.34em; text-transform: uppercase; opacity: 0.8; }
.sb-booktitle { margin: 6px 0 0; font: 400 clamp(30px, 6vw, 54px)/1.05 var(--display); letter-spacing: 0.06em; }
.sb-sub { margin: 0; font-size: 12px; letter-spacing: 0.08em; color: #b9b8b2; }
.sb-head { margin: 26px 0 10px; font-size: 11px; font-weight: 700; letter-spacing: 0.28em; text-transform: uppercase; color: #ecebe6; display: flex; align-items: center; gap: 12px; }
.sb-head::before, .sb-head::after { content: ""; flex: 1; border-top: 1px solid currentColor; opacity: 0.5; }
.sb-shelf { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 22px; margin-top: 18px; }
.sb-cover-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  aspect-ratio: 9 / 12;
  padding: 34px 22px 26px;
  overflow: hidden;
  border-radius: 3px;
  background: var(--paper);
  color: var(--ink);
  text-align: center;
  text-decoration: none;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.5);
  transition: transform 120ms ease-out;
}
.sb-cover-card:hover, .sb-cover-card:focus-visible { transform: translateY(-3px); outline: none; }
.sb-cover-card:focus-visible .sb-rule { opacity: 1; border-color: var(--ink); }
.sb-cover-card > * { position: relative; z-index: 1; }
.sb-cover-card > .sb-rule, .sb-cover-card > .sb-burst { position: absolute; }
.sb-no { font-size: 9px; letter-spacing: 0.3em; text-transform: uppercase; color: var(--ink-2); }
.sb-card-art { width: 70%; max-height: 42%; margin: 10px 0 4px; object-fit: contain; filter: grayscale(1); }
.sb-card-title { margin-top: auto; font: 400 26px/1.08 var(--display); letter-spacing: 0.02em; text-wrap: balance; }
.sb-card-title.long { font-size: 20px; }
.sb-cover-card .sb-flourish { width: 110px; margin: 8px auto; }
.sb-card-by { font-size: 11px; letter-spacing: 0.08em; color: var(--ink-2); }
.sb-card-meta { margin-top: 8px; font-size: 9px; letter-spacing: 0.22em; text-transform: uppercase; color: var(--ink-2); }
.sb-card-rights { margin-top: 3px; font-size: 9px; letter-spacing: 0.06em; color: var(--ink-3); }
.sb-more { margin: 0; text-align: center; font-size: 13px; color: #b9b8b2; letter-spacing: 0.04em; }
.sb-more a { color: #ecebe6; }
.sb-foot { margin-top: 30px; text-align: center; color: #8f8e89; font-size: 11px; letter-spacing: 0.04em; }
.sb-foot p { margin: 0; }

/* One sheet: the controls over a page of paper. */
.sb-controls { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.sb-controls .sb-back { position: static; }
.sb-gap { flex: 1; }
.sb-btn {
  padding: 7px 16px;
  border: 1px solid #ecebe6;
  border-radius: 4px;
  color: #ecebe6;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  text-decoration: none;
}
.sb-btn:hover, .sb-btn:focus-visible { background: #ecebe6; color: var(--house); outline: none; }
.sb-btn.sb-learn { border-color: var(--bell); background: var(--bell); color: #fff; }
.sb-btn.sb-learn:hover, .sb-btn.sb-learn:focus-visible { background: #ff7a42; border-color: #ff7a42; color: #fff; }
.sb-sheet { padding: 28px clamp(14px, 3vw, 40px) 30px; border-radius: 3px; background: var(--paper); color: var(--ink); box-shadow: 0 16px 50px rgba(0, 0, 0, 0.55); }
.sb-sheet .sb-head { color: var(--ink); }
.sb-sheet .sb-foot { color: var(--ink-2); }

.sb-cover { position: relative; display: flex; align-items: center; justify-content: center; gap: 28px; min-height: 300px; padding: 46px 40px 40px; overflow: hidden; }
.sb-cover > .sb-rule { inset: 6px; }
.sb-cover-art { position: relative; z-index: 1; width: min(300px, 34%); max-height: 300px; object-fit: contain; filter: grayscale(1); }
.sb-cover-text { position: relative; z-index: 1; max-width: 560px; text-align: center; }
.sb-cover .sb-bill { color: var(--ink-2); }
.sb-title { margin: 8px 0 0; font: 400 clamp(38px, 7vw, 68px)/1 var(--display); letter-spacing: 0.02em; text-wrap: balance; }
.sb-by { margin: 0; font: italic 400 18px/1.3 var(--display); }
.sb-blurb { margin: 12px auto 0; max-width: 440px; font-size: 13px; line-height: 1.5; color: var(--ink-2); text-wrap: pretty; }
.sb-cast, .sb-meta { margin: 12px 0 0; font-size: 10px; letter-spacing: 0.24em; text-transform: uppercase; }
.sb-meta { margin-top: 4px; color: var(--ink-2); }
.sb-rights { margin: 10px 0 0; font-size: 10px; letter-spacing: 0.08em; color: var(--ink-3); }

/* How to play: the keyboard diagram beside the numbered steps. */
.sb-how-body { display: flex; gap: 26px; align-items: flex-start; }
.sb-kb { --k: 21px; flex: none; margin: 0; }
.kb-block { display: flex; flex-direction: column; gap: 3px; }
.kb-row { position: relative; display: flex; gap: 3px; padding-left: calc(var(--off) * (var(--k) + 3px)); }
.kb-key {
  display: grid;
  place-items: center;
  width: var(--k);
  height: var(--k);
  border: 1px solid var(--ink-3);
  border-radius: 3px;
  font-size: 9px;
  font-weight: 700;
  color: var(--ink-2);
}
.kb-pad { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.kb-step { background: #fff; border: 1.5px solid var(--ink); color: var(--ink); }
.kb-part { background: #b5b4ae; border-color: #8a8a86; color: var(--ink); }
.kb-hold { border-style: dotted; color: var(--ink-3); }
.kb-shift { position: absolute; left: 0; width: calc(2.25 * var(--k) + 2px); font-size: 8px; letter-spacing: 0.08em; text-transform: uppercase; }
.kb-space { width: calc(5 * var(--k)); font-size: 8px; letter-spacing: 0.1em; text-transform: uppercase; }
.sb-kb figcaption { display: flex; flex-direction: column; gap: 3px; margin-top: 10px; font-size: 11px; color: var(--ink-2); }
.kb-tag { display: flex; align-items: center; gap: 6px; }
.kb-swatch { display: inline-block; width: 11px; height: 11px; border-radius: 2px; }
.sb-steps { margin: 0; padding-left: 20px; font-size: 13px; line-height: 1.55; }
.sb-steps li { margin-bottom: 3px; }
.sb-try { font-weight: 600; }
/* The touch plate's diagram (web/js/songbook.js `touchPlate`): the part keys over the pads and the steps. */
.sb-tp { --k: 34px; }
.tp-block { display: flex; flex-direction: column; gap: 6px; width: max-content; }
.tp-parts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 3px; }
.tp-decks { display: flex; gap: 10px; }
.tp-deck { display: grid; grid-template-columns: repeat(4, var(--k)); gap: 3px; }
.sb-tp .kb-key { width: auto; height: 22px; overflow: hidden; font-size: 7px; letter-spacing: 0.02em; text-transform: uppercase; white-space: nowrap; }
.sb-tp .tp-parts .kb-key { font-size: 8px; letter-spacing: 0.08em; }
.kb-swatch.kb-deck { border: 1.5px dashed var(--ink); }
.tb-cap.tb-named { min-width: 0; margin-right: 0; padding: 0 0.45em; font-size: 9px; letter-spacing: 0.04em; }

.sb-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 18px; margin: 18px 0 4px; padding: 7px 10px; border-top: 1px solid var(--ink); border-bottom: 1px solid var(--ink); font-size: 11px; color: var(--ink-2); }
.lg-title { font-weight: 700; letter-spacing: 0.24em; text-transform: uppercase; color: var(--ink); }
.lg-item { display: inline-flex; align-items: center; gap: 6px; }
.lg-cell { position: relative; display: inline-block; width: var(--cell); height: 18px; }
.lg-held { display: inline-flex; }

/* A part: the player's billing, then the tablature: the step keys over each bar, one line per pad. */
.sb-part { margin-top: 22px; break-inside: avoid; }
.sb-part-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; margin: 0 0 6px; padding-bottom: 4px; border-bottom: 3px double var(--ink); font-size: 13px; font-weight: 400; letter-spacing: 0.04em; }
.sb-who { font: 400 22px/1 var(--display); letter-spacing: 0.04em; }
.sb-part-meta { margin-left: auto; font-size: 11px; letter-spacing: 0.08em; color: var(--ink-2); }
.tb-way { overflow-x: auto; }
.tb-way.per2, .tb-way.per1 { display: none; }
.tb { border-collapse: collapse; margin: 6px 0 10px; table-layout: fixed; }
.tb th, .tb td { padding: 0; }
.tb-corner { width: 108px; padding-right: 8px !important; font-size: 8px; font-weight: 400; letter-spacing: 0.14em; text-transform: uppercase; text-align: right; color: var(--ink-3); }
.tb-barno { padding: 0 0 2px 3px !important; border-left: 2px solid var(--ink); font: italic 400 14px/1 var(--display); text-align: left; }
.tb-key { width: var(--cell); height: 15px; font: 600 9px/15px var(--type); text-align: center; color: var(--ink-2); border-bottom: 1px solid var(--ink); }
.tb-key.beat { color: var(--ink); }
.tb-key.barline { border-left: 2px solid var(--ink); }
.tb-pad { height: 20px; padding-right: 8px !important; text-align: right; white-space: nowrap; }
.tb-cap {
  min-width: 18px;
  margin-right: 5px;
  border: 0;
  border-radius: 3px;
  background: var(--ink);
  color: var(--paper);
  font-size: 10px;
  line-height: 16px;
}
.tb-sound { display: inline-block; min-width: 40px; font-size: 11px; text-align: left; color: var(--ink-2); }
tbody tr:nth-child(even) td { background: rgba(0, 0, 0, 0.035); }

/* Cells. The mark is the `i` in the middle: a dot for a hit, a big diamond for an accent, a ring for a soft hit,
   a line from a held note through its ties, and a faint dot for a rest so the steps can be counted. */
.st { position: relative; width: var(--cell); height: 20px; border-left: 1px solid transparent; }
.st.beat { border-left-color: var(--rule); }
.st.barline { border-left: 2px solid var(--ink); }
/* Marks are drawn with borders, not backgrounds, so they print with background graphics off. */
.st i { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); }
.st.rest i { width: 2px; height: 2px; border: 1px solid var(--ink-3); border-radius: 50%; }
.st.hit i { width: 8px; height: 8px; border: 4px solid var(--ink); border-radius: 50%; }
.st.accent i { width: 10px; height: 10px; border: 5px solid var(--ink); transform: translate(-50%, -50%) rotate(45deg); }
.st.soft i { width: 8px; height: 8px; border: 1.5px solid var(--ink); border-radius: 50%; }
.st.held::after, .st.tie::after { content: ""; position: absolute; top: 50%; height: 0; margin-top: -1.5px; border-top: 3px solid var(--ink); }
.st.held::after { left: 50%; right: -1px; }
.st.tie::after { left: -1px; right: -1px; }
.st.tie.end::after { right: 30%; }
.st.tie i { display: none; }
.st.tie.end i { display: block; left: 70%; width: 0; height: 9px; border-left: 2px solid var(--ink); }
.st small { position: absolute; left: 50%; top: -1px; transform: translateX(-50%); font: 700 7px/1 var(--type); white-space: nowrap; color: var(--ink); z-index: 1; }
.st:has(small) i { top: 62%; }
/* A hit that only sometimes plays: its mark half-toned with a small question mark over it. */
.st.maybe i { opacity: 0.45; }
.st.maybe.tie::after, .st.maybe.held::after { opacity: 0.45; }
/* A held note crossing a system break: a tie arc leaves the last step and enters the first step of the next line. */
.st.on::before, .st.from::before { content: ""; position: absolute; top: 50%; width: 9px; height: 7px; margin-top: -9px; border-top: 1.5px solid var(--ink); border-radius: 50% 50% 0 0; }
.st.on::before { right: -6px; }
.st.from::before { left: -6px; }

/* The tune: each bar a strip of sixteen steps with the note names set where they fall, held ones underlined. */
.sb-tune { margin-top: 18px; break-inside: avoid; }
.tn-bars { --u: 9px; display: flex; flex-wrap: wrap; border-left: 2px solid var(--ink); }
.tn-bar { position: relative; flex: 1 0 22%; padding: 14px 6px 6px; border-right: 2px solid var(--ink); border-top: 1px solid var(--ink); border-bottom: 1px solid var(--ink); margin-bottom: -1px; }
.tn-no { position: absolute; left: 4px; top: 1px; font: italic 400 11px/1 var(--display); color: var(--ink-2); }
.tn-line { display: flex; align-items: flex-start; min-height: 22px; }
.tn-gap { flex: 0 0 calc(var(--w) * var(--u)); }
.tn-note { display: flex; flex: 0 0 auto; flex-direction: column; gap: 1px; min-width: calc(var(--w) * var(--u)); padding-right: 4px; font-size: 12px; line-height: 1.05; white-space: nowrap; }
.tn-note b { font-weight: 700; }
.tn-note.long { border-bottom: 2px solid var(--ink); padding-bottom: 2px; }
.tn-note.tied b { font-weight: 400; font-style: italic; color: var(--ink-2); }
.tn-note.tied b::before { content: "‿"; margin-right: 1px; }
.tn-note.maybe b { color: var(--ink-2); }
.tn-note small { font: 700 8px/1 var(--type); color: var(--ink-2); }

/* Narrower windows show two bars to a system, then one; the tune's bars stack the same way. */
@media screen and (max-width: 1120px) {
  .tb-way.per4 { display: none; }
  .tb-way.per2 { display: block; }
  .tn-bar { flex-basis: 45%; }
}
@media screen and (max-width: 720px) {
  .sb-book { padding: 12px 10px 30px; }
  :root { --cell: 17px; }
  .tb-way.per2 { display: none; }
  .tb-way.per1 { display: block; }
  .tb-corner { width: 84px; }
  .sb-how-body { flex-direction: column; }
  .sb-cover { flex-direction: column; padding: 40px 22px 30px; gap: 12px; }
  .sb-cover-art { width: 60%; }
  .sb-part-meta { margin-left: 0; }
  .tn-bar { flex-basis: 100%; }
  .sb-controls { flex-wrap: wrap; }
  .sb-btn { padding: 7px 12px; }
}
/* The plate's touch layout (web/js/touch.js, TOUCH_QUERY): every control at least 44 px high. */
@media screen and (max-width: 899px), screen and (pointer: coarse) and (max-height: 599px) {
  .sb-mast { padding-top: 48px; }
  .sb-back { display: inline-flex; align-items: center; min-height: 44px; padding-right: 14px; }
  .sb-btn { display: inline-flex; align-items: center; min-height: 44px; }
  .sb-more a { display: inline-block; padding: 15px 4px; }
}
@media (prefers-reduced-motion: reduce) {
  .sb-cover-card { transition: none; }
  .sb-cover-card:hover, .sb-cover-card:focus-visible { transform: none; }
}

/* Paper: black on white, no backgrounds or shadows, the art small, the controls gone; four bars to a system. */
@media print {
  @page { margin: 11mm 10mm; }
  html, body, .sb-book, .sb-sheet { background: #fff !important; color: #000; }
  :root { --cell: 10px; --ink: #000; --ink-2: #222; --ink-3: #666; --rule: #bbb; }
  .sb-book { max-width: none; padding: 0; }
  .sb-controls, .sb-back, .sb-try { display: none !important; }
  .sb-sheet { padding: 0; box-shadow: none; border-radius: 0; }
  .sb-burst { display: none; }
  .sb-cover { min-height: 0; padding: 16px 24px 14px; gap: 18px; }
  .sb-cover-art { width: auto; max-width: 34mm; max-height: 34mm; }
  .sb-title { font-size: 38px; }
  .sb-by { font-size: 14px; }
  .sb-blurb { font-size: 10px; margin-top: 6px; }
  .sb-cast, .sb-meta { margin-top: 6px; font-size: 8px; }
  .sb-rights { margin-top: 4px; font-size: 8px; }
  .sb-head { margin: 10px 0 6px; font-size: 9px; }
  .sb-sheet .sb-head { color: #000; }
  .sb-how-body { gap: 16px; }
  .sb-kb { --k: 14px; }
  .kb-key { font-size: 7px; }
  .kb-block, .kb-row { gap: 2px; }
  .kb-row { padding-left: calc(var(--off) * (var(--k) + 2px)); }
  .kb-pad { background: none; border: 2.5px solid #000; color: #000; }
  .kb-part { background: none; border: 1px dashed #000; }
  .kb-kb figcaption { font-size: 8px; }
  .sb-kb figcaption { font-size: 8.5px; margin-top: 5px; }
  .kb-swatch.kb-pad, .kb-swatch.kb-step, .kb-swatch.kb-part { width: 9px; height: 9px; }
  .sb-steps { font-size: 9.5px; line-height: 1.35; }
  .sb-steps li { margin-bottom: 1px; }
  .sb-legend { margin: 8px 0 0; padding: 4px 6px; font-size: 8.5px; }
  .lg-cell { height: 13px; }
  .sb-part { margin-top: 6px; break-inside: auto; }
  .sb-part-head, .tb { break-inside: avoid; }
  .sb-part-head { break-after: avoid-page; }
  .sb-part-head { margin-bottom: 2px; font-size: 10px; }
  .sb-who { font-size: 15px; }
  .sb-part-meta { font-size: 8.5px; }
  .tb-way.per4 { display: block !important; overflow: visible; }
  .tb-way.per2, .tb-way.per1 { display: none !important; }
  .tb { margin: 2px 0; font-size: 7px; line-height: 1; }
  .tb-bars { display: none; }
  .tb-corner { width: 66px; font-size: 6px; }
  .tb-key { position: relative; height: 18px; padding-top: 9px !important; font-size: 6px; line-height: 9px; vertical-align: bottom; }
  .tb-keys .tb-corner { vertical-align: bottom; line-height: 9px; }
  .tb-key[data-bar]::before { content: attr(data-bar); position: absolute; left: 2px; top: 0; font: italic 400 9px/1 var(--display); color: #000; }
  .tb-pad { height: 9.5px; padding-right: 5px !important; }
  .tb-cap { min-width: 11px; margin-right: 3px; padding: 0 2px; background: none; color: #000; border: 1px solid #000; border-radius: 2px; font-size: 6.5px; line-height: 7.5px; }
  .tb-sound { min-width: 28px; font-size: 7px; }
  tbody tr:nth-child(even) td { background: none; }
  .st { height: 9.5px; }
  .st.rest i { width: 1.5px; height: 1.5px; border-width: 0.75px; }
  .st.hit i, .st.soft i { width: 6px; height: 6px; }
  .st.hit i { border-width: 3px; }
  .st.soft i { border-width: 1px; }
  .st.accent i { width: 7px; height: 7px; border-width: 3.5px; }
  .st.held::after, .st.tie::after { margin-top: -1px; border-top-width: 2px; }
  .st.tie.end i { height: 6px; }
  .st small { font-size: 5px; top: -1px; }
  .sb-tune { margin-top: 8px; }
  .tn-bars { --u: 6px; }
  .tn-bar { flex-basis: 22% !important; }
  .tn-bar { padding: 10px 3px 3px; }
  .tn-no { font-size: 8px; }
  .tn-note { font-size: 8px; }
  .tn-note small { font-size: 6px; }
  .sb-foot { margin-top: 10px; font-size: 8px; }
  .sb-flourish { margin: 5px auto; }
  a { text-decoration: none; }
}
