.score-entry { margin: 24px 0; }
.score-entry-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: 16px; }
a.grid-card.score-entry-card { display: flex; flex-direction: row; align-items: center; gap: 16px; min-width: 0; min-height: 112px; padding: 22px; box-sizing: border-box; }
.score-entry-symbol { display: flex; align-items: center; justify-content: center; flex: 0 0 48px; height: 48px; border-radius: 12px; background: var(--accent-pale, #ebf2fc); color: var(--accent, #0d4ea6); }
.score-entry-symbol .svg-icon { width: 26px; height: 26px; margin: 0; fill: currentColor; }
.score-entry-title { min-width: 0; font-size: 20px; font-weight: 700; line-height: 1.45; overflow-wrap: anywhere; color: var(--gray-900, #111827); }
.score-entry-card:focus-visible { outline: 3px solid var(--accent, #0d4ea6); outline-offset: 4px; }
html.dark-mode .score-entry-symbol { background: var(--dk-accent-bg, #123264); color: var(--dk-accent, #5b9fdf); }
html.dark-mode .score-entry-title { color: var(--dk-text-bright, #c8d4e8); }
.chapter-contributions { margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--color-border, #ddd); }
.chapter-contributions h2 { margin-top: 0; }
.pdf-workspace .library { display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
/* This sheet loads after the viewer styles; keep the docked library out of fullscreen. */
.pdf-workspace.focus-mode .workspace > .library { display: none; }
.pdf-workspace .library > .section-label, .pdf-workspace .library > .intro { display: none; }
.pdf-workspace .library > h1 { font-size: 19px; margin: 0 0 18px; }
.pdf-workspace .workspace > .library { padding: 20px 16px; }
.pdf-workspace .workspace > .library > h1 { font-size: 17px; margin-bottom: 12px; }
.pdf-workspace .workspace > .library > .library-note { display: none; }
.pdf-workspace .workspace > .library .score-type-label { display: none; }
.pdf-workspace .workspace > .library #score-type { margin-top: 8px; }
.pdf-workspace .workspace > .library .library-heading { margin-top: 8px; }
.pdf-workspace .library-heading h2 { margin: 0; }
.pdf-workspace .score-library-search { flex-shrink: 0; }
.pdf-workspace .score-library-scopes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; margin-bottom: 14px; }
.pdf-workspace .score-library-scopes button { min-width: 0; min-height: 40px; padding: 8px 4px; border-radius: 9px; font-size: 12px; line-height: 1.4; word-break: keep-all; }
.pdf-workspace .score-library-scopes [aria-pressed="true"] { background: var(--soft); border-color: var(--accent); color: var(--accent); font-weight: 650; }
.pdf-workspace .score-scope-context { margin: 0 0 12px; font-size: 12px; line-height: 1.5; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pdf-workspace .score-scope-context[hidden] { display: none; }
.pdf-workspace .score-choice-row { display: flex; align-items: stretch; gap: 6px; min-width: 0; }
.pdf-workspace .score-choice-row .document-card { flex: 1; }
.pdf-workspace .score-favorite { flex: 0 0 44px; width: 44px; min-height: 46px; border-radius: 8px; padding: 4px; font-size: 23px; line-height: 1; }
.pdf-workspace .score-favorite.active { color: var(--accent); background: var(--soft); border-color: var(--accent); }
.pdf-workspace .score-library-empty { padding: 24px 12px; margin: 0; text-align: center; color: var(--muted); font-size: 13px; line-height: 1.7; }
.pdf-workspace #score-search, .pdf-workspace #score-type { width: 100%; max-width: 100%; min-height: 44px; font-size: 13px; box-sizing: border-box; }
.pdf-workspace .score-search-field { position: relative; min-width: 0; }
.pdf-workspace #score-search { padding-right: 42px; }
.pdf-workspace #score-search::-webkit-search-cancel-button { display: none; }
.pdf-workspace #clear-score-search { position: absolute; right: 1px; top: 1px; width: 40px; height: 42px; border: 0; background: transparent; font-size: 22px; }
.pdf-workspace .score-search-help { margin: 6px 0 0; font-size: 11px; color: var(--muted); }
.pdf-workspace .score-type-label { display: block; margin-top: 12px; }
.pdf-workspace .library-heading { margin-top: 16px; }
.pdf-workspace #score-results { margin: 0 0 12px; padding: 0; font-size: 12px; }
.pdf-workspace .score-library-list { flex: 1; min-height: 0; overflow: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; scrollbar-width: thin; padding: 2px 3px 12px 0; }
.pdf-workspace .score-library-list .documents { display: block; overflow: visible; max-height: none; }
.pdf-workspace .score-work-card { padding: 14px; margin-bottom: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--ca-surface, #fff); }
.pdf-workspace .score-work-card.active { border-color: var(--ca-accent, #0d4ea6); }
.pdf-workspace .score-work-heading { margin: 0 0 6px; font-size: 15px; font-weight: 650; line-height: 1.5; overflow-wrap: anywhere; }
.pdf-workspace .score-work-composer { margin: 0 0 12px; font-size: 11px; color: var(--muted); line-height: 1.5; }
.pdf-workspace .score-work-scores { display: grid; gap: 7px; }
.pdf-workspace .score-work-scores .document-card { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; min-width: 0; min-height: 46px; padding: 10px 12px; margin: 0; border: 1px solid var(--line); border-radius: 8px; background: var(--ca-surface-2, #f8f9fb); }
.pdf-workspace .score-work-scores .document-card.active { border-color: var(--ca-accent, #0d4ea6); background: var(--soft); }
.pdf-workspace .score-work-scores .file-name { font-size: 13px; font-weight: 600; line-height: 1.45; max-height: none; overflow: visible; }
.pdf-workspace .score-work-scores small { flex-shrink: 0; font-size: 10px; margin: 0; }
/* Score variants are usually one or two rows; reserve the full row for their name. */
.pdf-workspace .score-work-scores .document-card { flex-direction: column; align-items: flex-start; justify-content: center; gap: 3px; text-align: left; }
.pdf-workspace .score-work-scores .file-name { width: 100%; min-width: 0; word-break: keep-all; overflow-wrap: anywhere; }
.pdf-workspace .score-work-scores small { line-height: 1.4; color: var(--muted); }
.pdf-workspace .workspace > .library .score-work-card { padding: 10px; margin-bottom: 9px; }
.pdf-workspace .workspace > .library .score-work-composer { margin-bottom: 8px; }
.pdf-workspace .workspace > .library .score-work-scores .document-card { padding: 8px; }
.pdf-workspace .library-note { flex-shrink: 0; margin: 12px 0 0; padding-top: 10px; }
.pdf-workspace .score-library-error { font-size: 12px; line-height: 1.6; color: #b13939; margin: 0 0 12px; }
html.dark-mode .pdf-workspace .score-library-error { color: #ffb3b3; }
.pdf-workspace .score-picker-launcher { display: none; }
.pdf-workspace .score-picker-dialog { inset: auto 0 0; width: 100%; max-width: 560px; height: 92dvh; max-height: 92dvh; margin: auto auto 0; padding: 0; border-radius: 20px 20px 0 0; overflow: hidden; }
.pdf-workspace .score-picker-dialog[open] { display: flex; flex-direction: column; }
.pdf-workspace .score-picker-dialog::backdrop { background: #0f111766; }
.pdf-workspace .score-picker-bar { display: flex; align-items: center; justify-content: space-between; flex-shrink: 0; gap: 16px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.pdf-workspace .score-picker-bar h2 { margin: 0; font-size: 19px; font-weight: 650; }
.pdf-workspace .score-picker-bar button { min-width: 52px; min-height: 40px; font-size: 13px; }
.pdf-workspace .score-picker-content { display: flex; flex: 1; min-height: 0; overflow: hidden; }
.pdf-workspace .score-picker-content .library { width: 100%; height: 100%; max-height: none; padding: 16px 18px max(16px, env(safe-area-inset-bottom)); border: 0; }
.pdf-workspace .score-picker-content .library > .section-label,
.pdf-workspace .score-picker-content .library > h1,
.pdf-workspace .score-picker-content .library > .intro,
.pdf-workspace .score-picker-content .library > .library-note { display: none; }
.pdf-workspace .score-navigation { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 20px 14px; align-items: center; }
.pdf-workspace .score-navigation[hidden] { display: none; }
.pdf-workspace.focus-mode .score-navigation { display: none; }
.pdf-workspace .score-document-actions { display: flex; gap: 8px; }
.pdf-workspace .score-document-actions > * { display: flex; align-items: center; justify-content: center; gap: 7px; min-height: 44px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 9px; background: var(--ca-surface, #fff); font-size: 13px; line-height: 1.5; }
.pdf-workspace .score-document-actions .score-current-favorite { flex: none; width: auto; }
.pdf-workspace .score-current-favorite span { font-size: 13px; }
.pdf-workspace .score-document-actions a:hover { background: var(--soft); }
.pdf-workspace .score-related-actions { display: flex; gap: 8px; }
.pdf-workspace .score-related-actions button { min-height: 44px; border-radius: 9px; font-size: 13px; padding: 10px 14px; }
.pdf-workspace .score-related-actions [aria-expanded="true"] { background: var(--soft); border-color: var(--accent); color: var(--accent); }
.pdf-workspace .score-related { margin: 0 20px 14px; padding: 10px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.pdf-workspace .score-related-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.pdf-workspace .score-related-heading > div { min-width: 0; }
.pdf-workspace .score-related-heading h3 { margin: 0; font-size: 13px; }
.pdf-workspace .score-related-heading button { flex-shrink: 0; min-height: 40px; }
.pdf-workspace #related-score-results { margin: 3px 0 0; padding: 0; font-size: 11px; }
.pdf-workspace .score-related .documents { display: block; max-height: 250px; overflow: auto; overscroll-behavior: contain; scrollbar-width: thin; padding: 0 3px 0 0; }
.pdf-workspace .score-related-row + .score-related-row { padding-top: 8px; margin-top: 8px; border-top: 1px solid var(--line); }
.pdf-workspace .score-related-row h4 { margin: 0 0 5px; font-size: 13px; line-height: 1.5; overflow-wrap: anywhere; }
.pdf-workspace .score-related-choices { display: flex; flex-wrap: wrap; gap: 6px; }
.pdf-workspace .score-related-choice { min-height: 44px; padding: 8px 12px; font-size: 12px; border-radius: 7px; }
.pdf-workspace #related-score-more { width: 100%; min-height: 44px; margin-top: 8px; }
.pdf-workspace.focus-mode .score-related { display: none; }
/* Top-layer navigation never moves the score or its toolbars. */
body.pdf-workspace .score-related[popover] { position: fixed; inset: auto; box-sizing: border-box; margin: 0; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--ca-surface, #fff); color: var(--ink, inherit); box-shadow: 0 12px 36px #10182826; overflow: auto; overscroll-behavior: contain; }
body.pdf-workspace .score-related[popover]:not(:popover-open) { display: none; }
body.pdf-workspace .score-related[popover]:popover-open { display: flex; flex-direction: column; gap: 10px; }
body.pdf-workspace .score-related[popover]::backdrop { background: transparent; pointer-events: auto; }
body.pdf-workspace .score-related[popover] .score-related-heading { flex: 0 0 auto; margin: 0; }
body.pdf-workspace .score-related[popover] .documents { max-height: none; min-height: 0; flex: 1 1 auto; overflow: auto; }
body.pdf-workspace .score-related[popover] .score-related-choice { text-align: left; word-break: keep-all; }
body.pdf-workspace .score-related[data-scope="work"] .score-related-choices { display: grid; grid-template-columns: minmax(0, 1fr); }
.pdf-workspace .mobile-tool-picker { display: none; }
.pdf-workspace .tool-picker-dialog { padding: 0; width: calc(100% - 24px); max-width: 440px; border-radius: 16px; }
.pdf-workspace .tool-picker-content { padding: 16px; }
.pdf-workspace .tool-picker-content .tool-group { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.pdf-workspace .tool-picker-content .tool-group button { min-width: 0; min-height: 64px; padding: 14px; border: 1px solid var(--line); border-radius: 10px; text-align: left; font-size: 20px; }
.pdf-workspace .tool-picker-content .tool-group button span { display: inline; margin-left: 6px; font-size: 14px; }
.pdf-workspace .tool-picker-content #start-measure { grid-column: 1 / -1; }
.pdf-workspace #score-more { width: 100%; min-height: 44px; margin-top: 4px; font-size: 13px; }
.pdf-workspace .library-heading small { font-size: 11px; opacity: .7; }
.pdf-workspace .document-header h2 { overflow-wrap: anywhere; }
@media (max-width: 700px) {
    .score-entry-grid { grid-template-columns: minmax(0, 1fr); gap: 12px; }
    a.grid-card.score-entry-card { min-height: 96px; padding: 18px; }
    .pdf-workspace .workspace > .library { display: none; }
    .pdf-workspace .score-picker-launcher { display: block; padding: 12px; background: var(--ca-surface, #fff); border-bottom: 1px solid var(--line); }
    .pdf-workspace.focus-mode .score-picker-launcher { display: none; }
    .pdf-workspace #open-score-picker { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 72px; padding: 12px 14px; text-align: left; border-radius: 12px; }
    .pdf-workspace .score-picker-launcher-icon { display: grid; place-items: center; flex: 0 0 40px; height: 40px; border-radius: 9px; background: var(--soft); color: var(--accent); }
    .pdf-workspace .score-picker-launcher-icon .svg-icon { width: 23px; height: 23px; margin: 0; fill: currentColor; }
    .pdf-workspace .score-picker-launcher-copy { flex: 1; min-width: 0; }
    .pdf-workspace .score-picker-launcher-copy strong { display: block; font-size: 15px; font-weight: 650; }
    .pdf-workspace .score-picker-launcher-copy small { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; margin-top: 4px; font-size: 11px; line-height: 1.5; color: var(--muted); }
    .pdf-workspace .score-work-heading { font-size: 16px; }
    .pdf-workspace .score-work-composer { font-size: 12px; }
    .pdf-workspace .score-work-scores small { font-size: 11px; }
    .pdf-workspace .score-navigation { display: grid; gap: 8px; margin: 0 12px 14px; }
    .pdf-workspace .score-document-actions, .pdf-workspace .score-related-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; width: 100%; }
    .pdf-workspace .score-document-actions > *, .pdf-workspace .score-related-actions button { min-width: 0; padding: 10px 8px; }
    .pdf-workspace .score-related { margin: 0 12px 14px; }
    .pdf-workspace .toolbar > #workspace-tool-group { display: none; }
    .pdf-workspace .mobile-tool-picker { display: flex; align-items: center; justify-content: space-between; gap: 20px; min-width: 126px; min-height: 44px; padding: 10px 14px; border-color: var(--accent); border-radius: 9px; font-size: 14px; font-weight: 650; background: var(--soft); color: var(--accent); }
    .pdf-workspace .toolbar .history-controls button { min-width: 40px; min-height: 44px; }
}
@media (max-height: 600px) {
    .pdf-workspace .score-picker-bar { padding: 8px 14px; }
    .pdf-workspace .score-picker-dialog .score-library-search { display: grid; grid-template-columns: minmax(0, 1fr) 110px; gap: 8px; margin-bottom: 12px; }
    .pdf-workspace .score-picker-dialog .score-library-scopes { grid-column: 1 / -1; grid-template-columns: repeat(2, minmax(0, 1fr)); margin-bottom: 0; }
    .pdf-workspace .score-picker-dialog .score-library-scopes button { grid-column: auto; min-height: 44px; }
    .pdf-workspace .score-picker-dialog .score-library-search > label { display: none; }
    .pdf-workspace .score-picker-dialog .score-search-field { grid-column: 1; grid-row: 2; }
    .pdf-workspace .score-picker-dialog #score-type { grid-column: 2; grid-row: 2; }
    .pdf-workspace .score-picker-dialog .score-search-help { grid-column: 1 / -1; margin: 0; }
    .pdf-workspace .score-picker-dialog #score-results,
    .pdf-workspace .score-picker-dialog .score-scope-context,
    .pdf-workspace .score-picker-dialog .score-library-error { grid-column: 1 / -1; margin: 0; }
}
