.score-view,
.score-tools-port,
.score-legend-port {
  --score-ink: #423e35;
  --score-muted: #938777;
  --score-paper: #fffdf6;
  --score-perfect: #3293c0;
  --score-great: #487e60;
  --score-ok: #bf8d32;
  --score-miss: #b85c52;
  --score-wrong: #c52f32;
  color: var(--score-ink);
}

.score-view {
  width: 100%;
  min-width: 0;
}

.score-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 3px 14px;
}

.score-toolbar-label,
.score-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.score-eyebrow {
  color: #927f67;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .15em;
}

.score-position,
.score-tempo,
.score-page-count {
  font-size: 11px;
  line-height: 1.5;
  color: #928777;
  font-variant-numeric: tabular-nums;
}

.score-tempo {
  color: #786d5f;
}

.score-page-count {
  border-left: 1px solid #dcd2c1;
  padding-left: 12px;
}

.score-spread {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(12px, 2vw, 26px);
  align-items: start;
  min-width: 0;
}

.score-spread-single {
  grid-template-columns: minmax(0, 1fr);
  max-width: 600px;
  margin-inline: auto;
}

.score-paper {
  box-sizing: border-box;
  position: relative;
  min-width: 0;
  overflow: hidden;
  background: linear-gradient(100deg, #fdfaf0 0%, var(--score-paper) 8%, var(--score-paper) 94%, #fbf7ec 100%);
  border: 1px solid #e7dfcf;
  border-radius: 3px;
  box-shadow: 0 3px 5px #77664a08, 0 14px 30px #77664a0b;
  animation: score-page-arrive .3s ease-out both;
}

.score-paper:nth-child(2) {
  animation-delay: .025s;
}

.score-svg {
  display: block;
  width: 100%;
  height: auto;
  color: var(--score-ink);
  shape-rendering: geometricPrecision;
  overflow: visible;
}

.score-svg text {
  fill: currentColor;
  font-family: "Segoe UI", Arial, sans-serif;
}

.score-page-kicker {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 2.6px;
  color: #aa9677;
}

.score-page-number {
  font-size: 10px;
  color: #ad9d86;
  font-variant-numeric: tabular-nums;
}

.score-svg .score-piece-title {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 21px;
  font-weight: 400;
  fill: #665944;
}

.score-page-tempo {
  font-size: 12px;
  fill: #9b8c75 !important;
}

.score-staff-line {
  stroke: #c0b7a6;
  stroke-width: .65;
}

.score-barline {
  stroke: #9e9482;
  stroke-width: .85;
}

.score-final-barline {
  stroke: #817664;
  stroke-width: 2.7;
}

.score-brace {
  fill: none;
  stroke: #807664;
  stroke-width: 1.8;
}

.score-clef {
  color: #655c4d;
  fill: currentColor;
}

.score-svg .score-meter {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 21px;
  font-weight: 700;
}

.score-measure-number {
  font-size: 8px;
  color: #a99a82;
  font-variant-numeric: tabular-nums;
}

.score-change-tempo {
  font-size: 10px;
  color: #94846b;
}

.score-note, .score-note-decoration {
  color: var(--score-ink);
  transition: color .15s ease;
}

/* Opacity is driven directly by beat, with no wall-clock CSS delay. */
.score-view-hidden .score-beam {
  transition: none;
}

.score-note-perfect { color: var(--score-perfect); }
.score-note-great { color: var(--score-great); }
.score-note-ok { color: var(--score-ok); }
.score-note-miss { color: var(--score-miss); }
.score-note-wrong { color: var(--score-wrong); }

.score-notehead {
  fill: currentColor;
  stroke: none;
}

.score-notehead-round, .score-notehead-diamond { display: none; }
/* Fill-box follows the engraved path even when its skin or scale changes. */
.score-notehead[data-attack]:not([data-uniform]) > [data-half="attack"] {
  clip-path: inset(-1% 50% -1% -1%) fill-box;
}
.score-notehead[data-release] > [data-half="release"] {
  clip-path: inset(-1% -1% -1% 50%) fill-box;
  fill: var(--head-release, var(--score-ink));
}
.score-notehead:is(:not([data-release]), [data-uniform]) > [data-half="release"] { display: none !important; }
.score-notehead[data-release="perfect"] { --head-release: var(--score-perfect); }
.score-notehead[data-release="great"] { --head-release: var(--score-great); }
.score-notehead[data-release="ok"] { --head-release: var(--score-ok); }
.score-notehead[data-release="miss"] { --head-release: var(--score-miss); }
.score-notehead[data-release="wrong"] { --head-release: var(--score-wrong); }
.score-note-named { --note-letter: var(--skin-label-ink, #fff); }
.score-note-named.score-note-perfect { --note-letter: var(--skin-label-perfect, #fff); }
.score-note-named.score-note-great { --note-letter: var(--skin-label-great, #fff); }
.score-note-named.score-note-ok { --note-letter: var(--skin-label-ok, #171410); }
.score-note-named.score-note-miss { --note-letter: var(--skin-label-miss, #fff); }
.score-note-named.score-note-wrong { --note-letter: var(--skin-label-wrong, #fff); }
.score-svg .score-note-name {
  font: 600 7px/1 "Segoe UI", Arial, sans-serif;
  fill: var(--note-letter);
  stroke: currentColor;
  stroke-width: .7;
  stroke-linejoin: round;
  paint-order: stroke fill;
  pointer-events: none;
  user-select: none;
}
.score-svg .score-note-name-open {
  fill: var(--skin-label-paper, #171410);
  stroke: var(--score-paper);
  stroke-width: .7;
}
.score-svg .score-note-name-sharp { font-style:italic; }
.score-notehead[data-release] + .score-note-name:not(.score-note-name-open) { stroke-width: 1.2; }

.score-note-dot { fill: currentColor; }
.score-ledger { stroke: currentColor; stroke-width: .9; }
.score-tuplet { text-anchor:middle; font:italic 600 10px Georgia,serif; fill:currentColor; }

.score-svg .score-accidental {
  font-family: "Segoe UI Symbol", "Arial Unicode MS", serif;
  font-size: 21px;
  fill: currentColor;
}

.score-finger {
  font-size: 9px;
  font-weight: 600;
  fill: #9b896d !important;
}

.score-hold-guides { pointer-events:none; }
.score-hold-guide {
  fill:none;
  stroke:var(--skin-cursor-color, #5194d2);
  stroke-width:1.7;
  stroke-opacity:.72;
  stroke-linecap:round;
}
.score-dropped .score-hold-guides { visibility:hidden; }

.score-tie {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.1;
}

.score-stem { stroke: currentColor; stroke-width: 1.15; }
.score-beam { stroke: var(--score-ink); stroke-width: 4; stroke-linecap: butt; }
.score-flag { fill: currentColor; }
.score-rest { fill: #716858; color: #716858; }
.score-view-by-heart .score-rest { visibility: hidden; }
.score-rest-stem { stroke: currentColor; stroke-width: 1.5; }
.score-rest-curve { fill: none; stroke: currentColor; stroke-width: 1.5; }

.score-playhead-glow { fill: #5b9fdd; opacity: .09; }
.score-playhead-line { stroke: #5194d2; stroke-width: 2.2; stroke-linecap: round; opacity: .9; }
.score-entry-mark { fill: var(--skin-cursor-color, #5194d2); pointer-events:none; }
.score-playhead { pointer-events: none; }
.score-view-pickable .score-svg { cursor: crosshair; }
.score-view-pickable .score-note { cursor: pointer; }
.score-note-accompaniment { opacity: .55; }
.score-practice-range { pointer-events: none; }
.score-range-fill { fill: #d5b45b; opacity: .11; }
.score-range-edge { stroke: #ba9a48; stroke-width: 1.3; opacity: .58; stroke-dasharray: 3 3; }

.score-popup { color: var(--score-great); animation: score-timing-feedback .8s ease-out both; font-variant-numeric: tabular-nums; }
.score-popup-perfect { color: color-mix(in srgb,var(--score-perfect) 82%,var(--skin-label-paper,#000)); }
.score-popup-great { color: var(--score-great); }
.score-popup-ok { color: var(--score-ok); }
.score-popup-miss { color: var(--score-miss); }
.score-popup-wrong { color: var(--score-wrong); }
.score-popup-extra { color: var(--skin-judgments-extra-score, var(--score-wrong)); }
.score-svg .score-popup-label { font-size: 10px; font-weight: 600; fill: currentColor; stroke: none; text-shadow: 0 1px 1.5px #1119; }
.score-svg .score-popup-sign { font: 800 14px var(--mono,monospace); }
@keyframes score-timing-feedback {
  0%, 65% { opacity: 1; }
  100% { opacity: 0; }
}
[data-direction="early"] { --timing-sign: var(--skin-timing-early,#a275d1); }
[data-direction="late"] { --timing-sign: var(--skin-timing-late,#e94d5a); }
[data-error-symbol="X"] { --symbol-color: var(--skin-symbols-wrong,#f24342); --symbol-weight: 82%; }
[data-error-symbol="M"] { --symbol-color: var(--skin-symbols-miss,#f4d529); --symbol-weight: 54%; }
[data-error-symbol="E"] { --symbol-color: var(--skin-symbols-extra,#ff8819); --symbol-weight: 69%; }
.score-popup[data-error-symbol] {
  color: color-mix(in srgb,var(--symbol-color,var(--timing-sign)) var(--symbol-weight,82%),var(--skin-label-paper,#000));
}
.score-legend-item [data-error-symbol] {
  color: color-mix(in srgb,var(--symbol-color,var(--timing-sign)) 85%,white);
}
.score-popup:is([data-direction="early"],[data-direction="late"]) {
  color: color-mix(in srgb,var(--timing-sign) 82%,var(--skin-label-paper,#000));
}

.score-footer-rule { stroke: #e8dfce; stroke-width: .8; }
.score-page-footer { font-size: 8px; letter-spacing: .4px; color: #b2a48e; }

.score-caption {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 20px;
  padding: 13px 3px 0;
  color: #9a8d78;
  font-size: 10px;
  line-height: 1.5;
}

.score-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 13px;
}

.score-legend-item { display: inline-flex; align-items: center; gap: 5px; }
.score-legend-dot { width: 5px; height: 5px; border-radius: 50%; display: inline-block; background: currentColor; }
.score-legend-perfect { color: var(--score-perfect); }
.score-legend-great { color: var(--score-great); }
.score-legend-ok { color: var(--score-ok); }
.score-legend-miss { color: var(--score-miss); }
.score-legend-wrong { color: var(--score-wrong); }

@keyframes score-page-arrive {
  from { opacity: .55; transform: translateX(8px); }
  to { opacity: 1; transform: translateX(0); }
}

@media (max-width: 700px) {
  .score-spread { grid-template-columns: minmax(0, 1fr); }
  .score-paper:nth-child(2) { display: none; }
  .score-toolbar { align-items: flex-start; gap: 10px; }
  .score-toolbar-label, .score-meta { gap: 4px 10px; }
  .score-toolbar-label { flex-direction: column; align-items: flex-start; }
  .score-meta { justify-content: flex-end; }
  .score-page-count { border: 0; padding: 0; }
  .score-caption { font-size: 10px; }
  .score-legend { gap: 9px; }
}

/* The stage supplies a definite available rectangle. Pages are fitted to it
   in score.js, so neither CSS viewport breakpoints nor scroll can cut a staff. */
.score-view.score-fit {
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.score-view.score-fit > .score-toolbar,
.score-view.score-fit > .score-caption {
  flex: 0 0 auto;
}

.score-view.score-fit .score-spread {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: none;
  min-height: 0;
  margin: 0;
  overflow: hidden;
}

.score-view.score-fit .score-paper {
  display: block;
  flex: 0 0 auto;
  max-width: none;
  animation: none;
}

.score-view.score-fit .score-spread-turn .score-paper {
  animation: score-page-reveal .16s ease-out both;
}

@keyframes score-page-reveal {
  from { opacity: .6; }
  to { opacity: 1; }
}

.score-view.score-fit .score-svg {
  height: 100%;
}

.score-tools-port {
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  padding: 0;
}

.score-tools-port .score-toolbar-label,
.score-tools-port .score-meta {
  align-items: flex-start;
  justify-content: flex-start;
  gap: 4px 10px;
}

.score-tools-port .score-toolbar-label {
  flex-direction: column;
}

.score-tools-port .score-eyebrow {
  display: none;
}

.score-tools-port .score-page-count {
  border: 0;
  padding: 0;
}

.score-legend-port {
  padding: 0;
  gap: 10px;
}

.score-legend-port .score-legend {
  gap: 8px 12px;
}

@media (prefers-reduced-motion: reduce) {
  .score-paper, .score-note, .score-note-decoration, .score-popup,
  .score-view.score-fit .score-spread-turn .score-paper { animation: none; transition: none; }
  .score-playhead { opacity: 1 !important; }
}

/* First lesson: the same notation, with a visible count underneath. */
.first-pulse-guide {
  margin-block: 22px;
  padding: clamp(16px, 2vw, 24px);
  border: 1px solid #e5ddce;
  border-radius: 14px;
  background: #faf7f0;
  text-align: left;
}

.first-pulse-guide h3 {
  margin: 0 0 10px;
  color: #514837;
  font: 500 22px/1.25 Georgia, "Times New Roman", serif;
}

.first-pulse-intro,
.first-pulse-preparation {
  margin: 0;
  max-width: 80ch;
  color: #665e50;
  font-size: 13px;
  line-height: 1.65;
}

.first-pulse-figure { margin: 16px 0 0; }
.first-pulse-paper {
  overflow-x: auto;
  border: 1px solid #e8deca;
  border-radius: 8px;
  background: var(--score-paper);
  scrollbar-width: thin;
}

.first-pulse-paper:focus-visible,
.first-pulse-symbol summary:focus-visible,
.first-pulse-source a:focus-visible {
  outline: 3px solid #438fc0;
  outline-offset: 3px;
}

.first-pulse-paper .first-pulse-score {
  width: 100%;
  min-width: 520px;
  max-width: 100%;
  height: auto;
}

.first-pulse-figure figcaption {
  margin-top: 10px;
  color: #6d6659;
  font-size: 12px;
  line-height: 1.6;
}

.first-pulse-play { color: #356e92; }
.first-pulse-rest { color: #77674c; }
.first-pulse-align { stroke: currentColor; stroke-width: .8; stroke-dasharray: 2 3; opacity: .45; }
.first-pulse-count-circle { fill: #e7eef1; }
.first-pulse-rest .first-pulse-count-circle { fill: #eee8da; }
.first-pulse-score .first-pulse-count { font-size: 15px; font-weight: 700; }
.first-pulse-score .first-pulse-count-label { font-size: 10px; fill: #8a7e6a; }
.first-pulse-score .first-pulse-action { font-size: 12px; font-weight: 700; letter-spacing: .8px; }
.first-pulse-score .first-pulse-action-detail { font-size: 10px; }
.first-pulse-score .first-pulse-duration { font-size: 10px; fill: #8c8170; }
.first-pulse-help { margin: 16px 0 10px; color: #756b5c; font-size: 12px; line-height: 1.6; }
.first-pulse-symbols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.first-pulse-symbol { min-width: 0; padding: 0 13px; border: 1px solid #e7dfd0; border-radius: 8px; background: #fffdf8; }
.first-pulse-symbol:last-child { grid-column: 1 / -1; }
.first-pulse-symbol summary { padding: 12px 0; color: #5c5140; cursor: pointer; font-size: 12px; font-weight: 600; line-height: 1.5; }
.first-pulse-symbol summary::marker { color: #998260; }
.first-pulse-symbol p { margin: 0 0 13px; color: #716756; font-size: 12px; line-height: 1.7; }
.first-pulse-keyboard { display: block; width: 308px; max-width: 100%; height: auto; margin: 0 0 14px; }
.first-pulse-key-white { fill: #fffdf7; stroke: #b8ad98; stroke-width: 1; }
.first-pulse-key-c { fill: #dcecf4; stroke: #438fc0; stroke-width: 1.5; }
.first-pulse-key-black { fill: #47433c; }
.first-pulse-keyboard text { font: 600 12px "Segoe UI", Arial, sans-serif; fill: #356e92; }
.first-pulse-keyboard .first-pulse-key-caption { font-size: 10px; font-weight: 400; fill: #776d5c; }
.first-pulse-preparation { margin-top: 16px; font-size: 12px; }
.first-pulse-source { margin: 9px 0 0; color: #897d69; font-size: 10px; line-height: 1.6; }
.first-pulse-source a { color: #6d7b83; text-decoration: underline; text-underline-offset: 2px; }

.lesson-excerpt .first-pulse-paper { margin-block: 12px; }
.lesson-excerpt .first-pulse-score { min-width: 360px; }
.lesson-excerpt label { display: block; margin-block: 10px 4px; font-size: 13px; color: #554936; }
.lesson-excerpt select {
  max-width: 100%; min-height: 38px; padding: 5px 10px; color-scheme: light;
  background: #fffdf8; border: 1px solid #9d8c73; border-radius: 5px; color: #493f32; font: inherit;
}
.lesson-excerpt select:focus-visible { outline: 3px solid #438fc0; outline-offset: 2px; }
.lesson-symbol-description { margin: 9px 0 0; font-size: 13px; line-height: 1.55; color: #514837; }
.first-pulse-score .lesson-symbol-target { cursor: pointer; pointer-events: bounding-box; }
.first-pulse-score .lesson-symbol-active {
  color: #075582; outline: 1.5px solid #227398; outline-offset: 1.5px;
  filter: drop-shadow(0 0 2px #fbc257);
}
.first-pulse-score :is(text, g).lesson-symbol-active { fill: currentColor !important; }
.first-pulse-score :is(line, .score-tie, .score-beam).lesson-symbol-active { stroke: currentColor; }

@media (max-width: 600px) {
  .first-pulse-symbols { grid-template-columns: minmax(0, 1fr); }
  .first-pulse-guide { padding: 14px; }
}
