/* The Score view (score.js): engraved sheet music on paper. */

@font-face {
  font-family: "Bravura";
  src: url("../../fonts/Bravura.woff2") format("woff2");
  font-display: block;
}

/* The paper and its ink: shared with the hybrid view (hybrid.css), which draws on the same page. */
.score,
.hybrid {
  --paper: #fbf7ec;
  /* The paper's textures (--tooth, --mottle, --grain) are set by the view, from ink.js. */
  --gloss: rgba(255, 252, 242, 0.9);
  --ink: #1b1712;
  --staff: rgba(27, 23, 18, 0.82);
  --ink-soft: #6b5f4d;
  --sel: #b0283f;
  --range: rgba(176, 40, 63, 0.1);
  --range-line: rgba(176, 40, 63, 0.55);
  --hot-glow: rgba(176, 40, 63, 0.45);
  /* The note Write would put down: on the scale in effect, or off it. */
  --on-scale: #1f8a46;
  --off-scale: #d1261c;
  --desk: radial-gradient(120% 90% at 50% 0%, #2a2430 0%, #17141b 55%, #0e0c11 100%);
}
.score {
  display: flex;
  height: 100%;
  min-height: 0;
  background: var(--desk);
}
.score.night,
.hybrid.night {
  --paper: #15121a;
  --gloss: rgba(255, 246, 220, 0.75);
  --ink: #ecdcb4;
  --staff: rgba(212, 175, 55, 0.55);
  --ink-soft: #a39271;
  --sel: #ff9fae;
  --range: rgba(212, 175, 55, 0.1);
  --range-line: rgba(212, 175, 55, 0.6);
  --hot-glow: rgba(255, 159, 174, 0.5);
  --on-scale: #6fe08f;
  --off-scale: #ff6a5c;
  --desk: radial-gradient(120% 90% at 50% 0%, #120f16 0%, #08070a 100%);
}

.score-main {
  position: relative;
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.score-view {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
/* The lamp over the desk: a warm light from the upper left, falling off toward the
   corners. It stays put while the paper scrolls beneath it. */
.score-lamp {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(90% 70% at 22% 0%, rgba(255, 246, 222, 0.12), transparent 70%),
    radial-gradient(160% 120% at 40% 25%, transparent 50%, rgba(28, 18, 6, 0.18) 100%);
}
/* The lamp turned off (the ribbon's lamp button). */
.no-lamp .score-lamp {
  display: none;
}
.score-scroll {
  position: relative;
  flex: 1;
  overflow: auto;
  overscroll-behavior: contain;
  cursor: default;
}
.score-scroll.writing {
  cursor: crosshair;
}
.score-scroll.hand {
  cursor: grab;
}
.score-scroll.grabbing {
  cursor: grabbing;
}
/* What a click would do, under the pointer: open a part's menu, grab a note, move the page. */
.score-scroll.over-name {
  cursor: pointer;
}
.score-scroll.over-note {
  cursor: grab;
}
.score-scroll.over-desk {
  cursor: grab;
}
.score-scroll.grabbing.over-note,
.score-scroll.grabbing.over-desk {
  cursor: grabbing;
}
.score-content {
  position: relative;
  min-height: 100%;
}

/* ---------------------------------------------------------------- paper */

.score-paper {
  position: absolute;
  border-radius: 3px;
  /* One color all the way down (a score can be very tall), with its tooth, formation and
     grain in tiles of different sizes, so no repeat lines up. */
  background-color: var(--paper);
  background-image: var(--tooth), var(--mottle), var(--grain);
  background-size:
    256px 256px,
    600px 600px,
    180px 180px;
  box-shadow:
    /* Edges warmed a little, as paper tones with age. */
    inset 0 0 calc(var(--sp) * 6) rgba(150, 106, 38, 0.14),
    0 1px 0 rgba(255, 255, 255, 0.6) inset,
    0 0 0 1px rgba(120, 96, 52, 0.18),
    0 18px 50px rgba(0, 0, 0, 0.55),
    0 2px 6px rgba(0, 0, 0, 0.35);
}
.score-paper::after {
  /* A deckled gold rule framing the page. */
  content: "";
  position: absolute;
  inset: calc(var(--sp) * 1.2);
  border: 1px solid rgba(160, 124, 52, 0.22);
  border-radius: 2px;
  pointer-events: none;
}
.score.night .score-paper {
  box-shadow:
    inset 0 0 calc(var(--sp) * 6) rgba(0, 0, 0, 0.3),
    0 0 0 1px rgba(212, 175, 55, 0.22),
    0 18px 50px rgba(0, 0, 0, 0.7);
}
.score.night .score-paper::after {
  border-color: rgba(212, 175, 55, 0.18);
}

.score-head {
  position: relative;
  text-align: center;
  color: var(--ink);
  box-sizing: border-box;
}
.score-title {
  font: 600 calc(var(--sp) * 2.6) / 1.1 var(--serif);
  letter-spacing: 0.04em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.score-head.song .score-title {
  font-size: calc(var(--sp) * 3.6);
  padding-top: calc(var(--sp) * 0.6);
}
.score-sub {
  margin-top: calc(var(--sp) * 0.5);
  font: italic 500 calc(var(--sp) * 1.5) / 1.2 var(--serif);
  color: var(--ink-soft);
  letter-spacing: 0.03em;
}
.score-row {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(var(--sp) * 0.6);
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
.score-tempo {
  font: 600 calc(var(--sp) * 1.6) / 1 var(--serif);
  color: var(--ink);
}
.score-tempo .smufl {
  font-family: "Bravura";
  font-size: calc(var(--sp) * 3);
  line-height: 0;
  vertical-align: calc(var(--sp) * -0.15);
}
.score-author {
  font: italic 500 calc(var(--sp) * 1.6) / 1 var(--serif);
  color: var(--ink-soft);
}
.score-empty {
  position: absolute;
  inset: 40% 0 auto;
  text-align: center;
  color: var(--ink-soft);
  font: italic 500 18px/1.4 var(--serif);
}
.score-empty div + div {
  font-size: 14px;
  opacity: 0.8;
}

/* ---------------------------------------------------------------- engraving */

.score-sys {
  position: absolute;
  overflow: visible;
  pointer-events: none;
  /* Each system on its own layer: the ink filter is drawn once, not on every scroll. */
  will-change: transform;
}
.score-defs {
  position: absolute;
  width: 0;
  height: 0;
}

/* While the view is being resized, the ink without its filters (wet ink's lighting, the glow, the
   gloss): drawing them again at every step is what makes resizing slow, the most where the web view
   draws filters without the GPU. They come back once the resizing settles. */
.score-view.resizing .score-sys,
.score-view.resizing .score-sys * {
  filter: none !important;
}
.score-sys .ink {
  fill: var(--ink);
}
.score-sys .staff {
  fill: var(--staff);
}
/* Night paper: the music gives the light. */
.score.night:not(.no-glow) .score-sys .glow {
  /* The notes as the light: a bright core and a warm halo held close around
     them (in staff spaces, the system's units). */
  --ink: #fff4d8;
  filter: drop-shadow(0 0 0.1px rgba(255, 242, 205, 0.9)) drop-shadow(0 0 0.3px rgba(255, 214, 140, 0.55)) drop-shadow(0 0 0.7px rgba(255, 190, 100, 0.22));
}
.score-sys .glyphs {
  font-family: "Bravura";
  font-size: 4px;
}
.score-sys {
  /* Outlines placed exactly (no hinting to the pixel grid): smooth curves at any size. */
  text-rendering: geometricPrecision;
  shape-rendering: geometricPrecision;
}
.score-sys .sname {
  font: italic 500 1.55px var(--serif);
  fill: var(--ink);
  letter-spacing: 0.02px;
}
.score-sys .sname.short {
  font-size: 1.3px;
  fill: var(--ink-soft);
}
.score-sys .volta {
  font: 700 1.45px var(--serif);
  fill: var(--ink);
}
.score-sys .reptimes {
  font: italic 700 1.55px var(--serif);
  fill: var(--ink);
}
.score-sys .mnum {
  font: italic 600 1.25px var(--serif);
  fill: var(--ink-soft);
}
.score-sys .score-tag {
  font: italic 700 1.35px var(--serif);
  letter-spacing: 0.04px;
}
.score-sys .score-band {
  stroke-width: 0.08;
}
.score-sys .score-range {
  fill: var(--range);
  stroke: var(--range-line);
  stroke-width: 0.1;
  stroke-dasharray: 0.5 0.3;
}
.score-sys .sheen {
  /* The light over a still-wet drop of ink: broad and faint… */
  fill: var(--gloss);
  opacity: 0.16;
  /* (in the system's units, staff spaces, like everything in it) */
  filter: blur(0.09px);
}
.score-sys .gloss {
  /* …with a small, soft highlight at its heart. */
  fill: var(--gloss);
  opacity: 0.62;
  filter: blur(0.025px);
}
.score-sys .sel {
  fill: var(--sel);
  filter: drop-shadow(0 0 0.35px var(--sel));
}
/* Under the pointer: a staff's name lit and underlined (a click opens its part's menu)… */
.score-sys .name-hot {
  fill: var(--sel);
  filter: drop-shadow(0 0 0.25px var(--sel)) drop-shadow(0 0 0.6px var(--hot-glow));
}
.score-sys .name-line {
  fill: var(--sel);
  opacity: 0.8;
}
/* …a note lit, to be grabbed… */
.score-sys .hov {
  fill: var(--sel);
  opacity: 0.8;
  filter: drop-shadow(0 0 0.3px var(--sel)) drop-shadow(0 0 0.7px var(--hot-glow));
}
/* …or the line the playhead would move to. */
.score-sys .seek-line {
  fill: var(--sel);
  opacity: 0.3;
}
.score-sys .ghost {
  fill: var(--sel);
  opacity: 0.55;
}
.score-sys .ghost-ledger {
  fill: var(--sel);
  opacity: 0.45;
}
.score-sys .ghost.on-scale,
.score-sys .ghost-ledger.on-scale {
  fill: var(--on-scale);
  opacity: 0.75;
}
.score-sys .ghost.off-scale,
.score-sys .ghost-ledger.off-scale {
  fill: var(--off-scale);
  opacity: 0.8;
}
/* Chord and scale markers (score.harmony), above each system as on a lead sheet. */
.score-sys .chord-text {
  font: 700 1.75px var(--serif);
  fill: var(--ink);
  cursor: pointer;
}
.score-sys .chord-text.scale {
  font: italic 600 1.4px var(--serif);
  fill: var(--ink-soft);
}
.score-sys .chord-text.on {
  fill: var(--sel);
  filter: drop-shadow(0 0 0.25px var(--sel)) drop-shadow(0 0 0.6px var(--hot-glow));
}
.score-scroll.chording {
  cursor: copy;
}
/* A marker's scale, while the pointer is on it: its notes as ghost notes, the chord's own darker. */
.score-sys .scale-note {
  fill: var(--ink);
  opacity: 0.22;
}
.score-sys .scale-tone {
  fill: var(--sel);
  opacity: 0.42;
}

.score-ph {
  position: absolute;
  width: 2px;
  margin-left: -1px;
  border-radius: 2px;
  background: linear-gradient(180deg, transparent, rgba(176, 40, 63, 0.75) 12%, rgba(176, 40, 63, 0.75) 88%, transparent);
  pointer-events: none;
}
.score-ph.on {
  box-shadow: 0 0 10px rgba(176, 40, 63, 0.45);
}
.score.night .score-ph {
  background: linear-gradient(180deg, transparent, rgba(245, 226, 166, 0.85) 12%, rgba(245, 226, 166, 0.85) 88%, transparent);
}
.score.night .score-ph.on {
  box-shadow: var(--glow);
}

/* ---------------------------------------------------------------- the passage bar */

.score-rangebar {
  position: absolute;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 8px 7px 14px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(36, 31, 42, 0.96), rgba(18, 16, 22, 0.96));
  border: 1px solid var(--line-3);
  box-shadow:
    0 14px 36px rgba(0, 0, 0, 0.6),
    var(--glow);
  backdrop-filter: blur(8px);
  animation: score-rise 0.18s ease-out;
  white-space: nowrap;
  z-index: 3;
}
@keyframes score-rise {
  from {
    opacity: 0;
    transform: translate(-50%, 8px);
  }
}
.score-range-what {
  font: 600 13px/1 var(--serif);
  letter-spacing: 0.06em;
  color: var(--champagne);
  margin-right: 4px;
}
.score-swatch {
  width: 14px;
  height: 14px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid rgba(255, 240, 200, 0.35);
  background: radial-gradient(circle at 35% 30%, rgba(255, 255, 255, 0.55), transparent 45%), var(--c);
  cursor: pointer;
  flex: none;
  transition: transform 0.12s;
}
.score-swatch.big {
  width: 20px;
  height: 20px;
}
.score-swatch:hover {
  transform: scale(1.18);
  box-shadow: 0 0 0 2px rgba(245, 226, 166, 0.35);
}

/* ---------------------------------------------------------------- the toolbar */

.score-values {
  display: inline-flex;
  gap: 2px;
  padding: 2px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.25);
}
.score-value {
  width: 24px;
  height: 22px;
  padding: 0;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font: 15px/1 "Bravura";
  cursor: pointer;
}
.score-value:hover {
  color: var(--gold-hi);
  background: rgba(212, 175, 55, 0.08);
}
.score-value.on {
  background: var(--metal);
  color: #251a06;
}
.score-value.dot {
  font-size: 18px;
}
/* The music's size: a small A and a large one. */
.btn.score-size {
  min-width: 24px;
  padding: 0 5px;
  font: 600 11px/1 var(--serif);
}
.btn.score-size.up {
  font-size: 16px;
}
.score-zoom {
  min-width: 36px;
  text-align: center;
  font: 500 10.5px/1 var(--mono);
  color: var(--muted);
}
/* The choice of PDF, under the export button. */
.score-pdfmenu {
  position: absolute;
  top: 40px;
  right: 10px;
  z-index: 5;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 250px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(36, 31, 42, 0.98), rgba(22, 19, 26, 0.98));
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.55);
}
.score-pdfitem {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 8px 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  text-align: left;
  cursor: pointer;
}
.score-pdfitem:hover {
  background: rgba(212, 175, 55, 0.1);
}
.score-pdfitem-t {
  font: 600 13px/1.2 var(--serif);
  color: var(--gold-hi);
}
.score-pdfitem-n {
  font-size: 11px;
  color: var(--muted);
}
/* The wet ink's knobs: gloss and shine. */
.score-ink-knob {
  display: flex;
  align-items: center;
  gap: 4px;
}
.score-ribbon .score-ink-knob .label {
  margin-left: 2px;
}
.score-slider {
  width: 56px;
  margin: 0;
  accent-color: var(--gold);
  cursor: pointer;
}
.select.score-scope {
  max-width: 190px;
}

/* ---------------------------------------------------------------- the sidebar */

.score-side {
  width: 236px;
  flex: none;
  overflow: auto;
  padding: 10px 10px 16px;
  background: linear-gradient(180deg, #16131a, #0f0d12);
  border-right: 1px solid var(--line);
}
.score-side.off {
  display: none;
}
/* Holders of what comes and goes over the music (the passage's bar, the menus), and of the ribbon: no box of their own. */
.score-over,
.score-ribbon-dock {
  display: contents;
}
.score-side-h {
  margin: 12px 4px 6px;
  font: 600 11px/1 var(--sans);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--gold-mid);
}
.score-side-h:first-child {
  margin-top: 2px;
}
.score-side-h.with-eye {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
  margin-bottom: 2px;
}
.score-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.score-part,
.score-mark {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 28px;
  padding: 2px 4px 2px 2px;
  border-radius: 7px;
}
.score-part:hover,
.score-mark:hover {
  background: rgba(212, 175, 55, 0.05);
}
.score-part.off .score-part-name {
  color: var(--dim);
  text-decoration: line-through;
  text-decoration-color: rgba(163, 151, 128, 0.4);
}
.score-part.off .score-dot {
  opacity: 0.35;
}
.score-eye {
  width: 24px;
  height: 22px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--dim);
  cursor: pointer;
  flex: none;
}
.score-eye .glyph {
  width: 15px;
  height: 15px;
}
.score-eye.on {
  color: var(--gold);
}
.score-eye:hover {
  color: var(--gold-hi);
  background: rgba(212, 175, 55, 0.08);
}
.score-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--c);
  box-shadow: 0 0 6px var(--c);
  flex: none;
}
.score-part-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font: 500 15px/1.1 var(--serif);
  color: var(--text);
}
/* The sidebar's part names open the part's menu, like the names on the page. */
.score-part-name.hot {
  padding: 0;
  border: 0;
  background: none;
  text-align: left;
  cursor: pointer;
  text-decoration: underline transparent;
  text-underline-offset: 3px;
  transition:
    color 0.12s,
    text-decoration-color 0.12s,
    text-shadow 0.12s;
}
.score-part-name.hot:hover,
.score-part-name.hot:focus-visible {
  color: var(--gold-hi);
  text-decoration-color: var(--gold);
  text-shadow: 0 0 10px rgba(212, 175, 55, 0.45);
}
.select.score-clef {
  width: 74px;
  height: 22px;
  font-size: 10.5px;
  padding: 0 4px;
}
.btn.score-only {
  font-size: 10px;
}
.score-bulk {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  margin-top: 4px;
}
.btn.on-text {
  color: var(--gold);
}
.score-mark .text-input.score-mark-label {
  flex: 1;
  min-width: 0;
  height: 24px;
  font: italic 500 14px/1 var(--serif);
}
.score-mark-where {
  border: none;
  background: transparent;
  color: var(--muted);
  font: 500 10px/1 var(--mono);
  white-space: nowrap;
  cursor: pointer;
  padding: 0 2px;
}
.score-mark-where:hover {
  color: var(--gold-hi);
}
.score-none {
  padding: 4px 6px;
  font: italic 13px/1.35 var(--serif);
  color: var(--dim);
}

/* A narrow pane: the sidebar would crowd the music. */
@media (max-width: 1100px) {
  .score-side {
    width: 200px;
  }
}
.compact .score-side {
  display: none;
}

/* ---------------------------------------------------------------- the ribbon */

.score-ribbon {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 4px 10px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(30, 26, 35, 0.92), rgba(17, 15, 20, 0.92));
  overflow-x: auto;
  scrollbar-width: none;
  flex: none;
}
.score-ribbon::-webkit-scrollbar {
  display: none;
}
.score-group {
  display: flex;
  align-items: center;
  gap: 5px;
  flex: none;
}
.score-spacer {
  flex: 1;
  min-width: 8px;
}
.score-ribbon .label {
  margin-left: 6px;
}

/* Repeats in the sidebar: the bars, how many times, and each ending's passes. */
.score-rep-sign {
  width: 16px;
  height: 18px;
  text-align: center;
  font: 18px/1 "Bravura";
  transform: translateY(0.2em);
  color: var(--gold-mid);
}
.score-rep-where {
  flex: 1;
  text-align: left;
}
.score-rep-times {
  display: inline-flex;
  align-items: center;
  gap: 1px;
}
.score-rep-n {
  min-width: 26px;
  text-align: center;
  font: italic 700 14px/1 var(--serif);
  color: var(--champagne);
}
.score-ending {
  margin-left: 18px;
  border-left: 1px solid rgba(212, 175, 55, 0.25);
  border-top-left-radius: 0;
}
.score-ending-text {
  min-width: 34px;
  font: 700 13px/1 var(--serif);
  color: var(--champagne);
}
.score-passes {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 2px;
}
.score-pass {
  width: 20px;
  height: 20px;
  border: 1px solid rgba(212, 175, 55, 0.25);
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  font: 600 11px/1 var(--mono);
  cursor: pointer;
}
.score-pass:hover {
  color: var(--gold-hi);
}
.score-pass.on {
  background: rgba(212, 175, 55, 0.18);
  border-color: var(--gold-mid);
  color: var(--champagne);
}

/* ---------------------------------------------------------------- a part's menu */

.score-partmenu {
  /* (its top and max-height are set where it opens) */
  width: 280px;
  display: flex;
  flex-direction: column;
}
.score-partmenu-title {
  display: flex;
  align-items: center;
  gap: 8px;
}
.score-partmenu-chs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 2px 6px 6px;
}
.score-partmenu-ch {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
}
.score-partmenu-ch.on {
  border-color: var(--gold);
  color: var(--gold-hi);
}
.score-partmenu-move {
  margin-top: 4px;
  box-shadow: 0 -1px 0 var(--line);
  border-radius: 0 0 7px 7px;
}
.score-partmenu-move .l {
  flex: 1;
  min-width: 0;
}
.score-partmenu-more {
  display: flex;
}
.score-partmenu-more .glyph {
  width: 12px;
  height: 12px;
  color: var(--dim);
}
.score-partmenu-move.on {
  background: linear-gradient(90deg, rgba(212, 175, 55, 0.2), rgba(212, 175, 55, 0.06));
  color: var(--gold-hi);
}
.score-partmenu-move.on .score-partmenu-more .glyph {
  color: var(--gold-hi);
}
.score-partmenu-h {
  margin: 0 8px 4px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line);
  font: 600 10px/1.3 var(--sans);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold-mid);
}
.score-partmenu-to {
  min-height: 0;
  overflow: auto;
}
.score-partmenu-dest .swatch {
  margin: 0 2px;
}
.score-partmenu-ins {
  margin-left: auto;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 10.5px;
  color: var(--dim);
}
.select.score-range-move {
  max-width: 130px;
}
