/* Band-IT M3.3.3 */
.app-message-dialog{color:#ece9e2;background:#1d2125;border:1px solid #4c5054;border-radius:20px;padding:26px;width:min(520px,calc(100vw - 32px));max-height:85dvh;box-sizing:border-box;overflow:auto;box-shadow:0 24px 80px #0009;font:inherit}
.app-message-dialog::backdrop{background:#0009}.app-message-dialog small{color:#d8aa4a;letter-spacing:.13em}.app-message-dialog h2{font-size:23px;margin:12px 0}.app-message-dialog p{white-space:pre-wrap;line-height:1.5;overflow-wrap:anywhere}.app-message-dialog input{width:100%;box-sizing:border-box;padding:12px;color:inherit;background:#15191d;border:1px solid #555;border-radius:9px;font:inherit}.app-message-actions{display:flex;justify-content:flex-end;gap:10px;margin-top:24px}.app-message-actions button{border:1px solid #62605a;border-radius:10px;min-height:44px;padding:10px 20px;background:#292d31;color:inherit;font:inherit}.app-message-actions [data-accept]{background:#d5a745;color:#191919;font-weight:700}.app-message-actions [data-accept].danger{background:#9d3535;color:white}.app-message-dialog :focus-visible{outline:2px solid #e0b654;outline-offset:3px}
.annotation-chord[data-white-background=true],.live-annotation-chord[data-white-background=true]{background:#fff!important;box-shadow:0 0 0 .15em #fff;text-shadow:none!important;border-radius:0}
.annotation-white-background{display:flex;align-items:center;gap:8px;font-size:12px;margin-top:10px;padding:8px 0}.annotation-white-background input{width:18px;height:18px;accent-color:#d3a342}
.score-header-tools .treble-clef-icon{width:18px;height:26px}#scoreTransportToggle svg{width:20px;height:20px;fill:none;stroke:currentColor;stroke-width:1.6;stroke-linecap:round;stroke-linejoin:round}#scoreTransportToggle[aria-expanded=true]{color:#e9bb59;background:#463415;border-color:#9b732b}
.visual-count-in{position:fixed;inset:50% auto auto 50%;transform:translate(-50%,-50%);z-index:9000;width:160px;height:160px;display:grid;place-items:center;border-radius:24px;background:#15181beb;color:#f3c468;font-size:100px;font-weight:800;font-variant-numeric:tabular-nums;box-shadow:0 6px 35px #0006;pointer-events:none}.visual-count-in.paused{opacity:.6}.visual-count-in[hidden]{display:none!important}
#settingsModal{padding:0;background:#121519;align-items:stretch;justify-content:stretch}#settingsModal .settings-dialog{width:100%;max-width:none;height:100dvh;max-height:none;border:0;border-radius:0;display:flex;flex-direction:column;padding-top:env(safe-area-inset-top);box-sizing:border-box}#settingsModal .settings-dialog>header{flex:none;padding:18px max(20px,env(safe-area-inset-right)) 18px max(20px,env(safe-area-inset-left))}#settingsModal .settings-content{flex:1;min-height:0;overflow:auto;display:block;padding:24px max(20px,env(safe-area-inset-right)) calc(28px + env(safe-area-inset-bottom)) max(20px,env(safe-area-inset-left));max-width:1300px;width:100%;box-sizing:border-box;align-self:center;scroll-padding-top:24px}
.settings-nav{display:flex;gap:8px;flex:none;padding:10px 20px;overflow-x:auto;border-bottom:1px solid #373c42}.settings-nav button{flex:none;padding:10px 16px;min-height:42px;background:#24292e;border:1px solid #41474e;border-radius:9px;color:#e7d3a1;font:inherit;cursor:pointer}.settings-group{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px;margin-bottom:32px;scroll-margin-top:10px}.settings-group>h3{grid-column:1/-1;color:#d5aa4d;font-size:18px;margin:0}.settings-group>*{min-width:0;margin:0}#settings-connection,#settings-data{grid-template-columns:minmax(0,1fr)}#settingsModal .setting-row{padding:18px;border:1px solid #353a40;border-radius:14px}#settingsModal .setting-row-embedded{padding:0;border:0}.settings-group .music-settings-card{display:block}.settings-group .music-setting-block{padding:18px!important;border:0;border-bottom:1px solid #353a40}.settings-group .playback-audio>div{align-items:flex-start;flex-direction:column}.settings-group .playback-audio label{min-height:36px}.bulk-delete summary{font-weight:700;color:#dfb058;cursor:pointer}.bulk-delete p{color:#bdc3c9;line-height:1.5}.bulk-delete input[type=search]{display:block;width:100%;box-sizing:border-box;margin:8px 0;padding:12px;color:#eee;background:#171b20;border:1px solid #53595f;border-radius:8px;font:inherit}.bulk-delete-actions{display:flex;gap:10px;flex-wrap:wrap}.bulk-delete button{min-height:42px;padding:10px 16px;color:#eee;background:#252a30;border:1px solid #555;border-radius:8px;font:inherit}.bulk-delete button.danger{color:#ffc1b9;border-color:#a95850}.delete-score-list{max-height:360px;overflow:auto;margin:16px 0;border:1px solid #343b43;border-radius:10px}.delete-score-list label{display:flex;align-items:center;gap:12px;padding:12px;border-bottom:1px solid #343b43;min-height:26px}.delete-score-list input{width:20px;height:20px;flex:none;accent-color:#d3a342}
#quickSettingsButton svg,#settingsButton svg{width:21px;height:21px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}#openChordEditor{margin:10px 0;min-height:44px;width:100%}
.stage:not(.annotation-editing):not(.editing){grid-template-rows:var(--bandit-header-height,64px) minmax(0,1fr)}.stage.header-two-rows{--bandit-header-height:106px}
.stage-header{position:relative;display:flex;align-items:center;justify-content:center;gap:0;padding:8px 16px;box-sizing:border-box}.stage-header .header-actions{display:flex;align-items:center;justify-content:space-between;width:100%;gap:12px;min-width:0}.stage-header .current-meta{position:absolute;left:50%;transform:translateX(-50%);text-align:center;justify-content:center;pointer-events:none}.stage-header .portrait-right-actions{display:flex;align-items:center;flex:none;gap:6px}.stage-header .musical-meta{flex:none}.stage-header .portrait-left-actions{display:none}.stage-header.header-stacked{flex-direction:column;gap:8px}.stage-header.header-stacked .current-meta{position:static;transform:none;flex:none;height:24px;width:100%}.stage-header.header-stacked .header-actions{overflow-x:auto;overflow-y:hidden;flex:none;min-height:44px;scrollbar-width:none}.stage-header.header-stacked .header-actions::-webkit-scrollbar{display:none}.stage-header.header-stacked .portrait-right-actions{margin-left:auto}
/* Keep long list painting local; avoid rebuilding identical list rows. */
.song-list,.quick-song-list{overscroll-behavior:contain;background:var(--panel,#171b20)}.song-row{contain:layout style}.bounded-pdf-slot{background:#fff!important}.bounded-pdf-preview{position:absolute;inset:0;width:100%;height:100%;pointer-events:none;z-index:0}.bounded-pdf-canvas{position:relative;z-index:1}.live-annotation-layer{z-index:2}
@media(orientation:portrait){.stage:not(.annotation-editing):not(.editing){--bandit-header-height:calc(60px + env(safe-area-inset-top));grid-template-rows:var(--bandit-header-height) minmax(0,1fr)}.stage.header-two-rows:not(.annotation-editing):not(.editing){--bandit-header-height:calc(104px + env(safe-area-inset-top))}.stage-header{padding-top:calc(8px + env(safe-area-inset-top));grid-template-rows:none;grid-template-columns:none}.stage-header .portrait-left-actions{display:flex;flex:none;gap:4px}.stage-header .musical-meta{display:none}.stage-header .portrait-right-actions{gap:4px}.stage-header .score-header-tools{gap:4px}.score-header-tools .treble-clef-icon{height:24px}.stage-header .score-header-tools .header-button,.stage-header .score-header-tools .view-mode-button{width:38px;height:40px}.stage-header .header-actions{gap:8px}.stage-header .portrait-right-actions{grid-column:auto;grid-row:auto}}
@media(max-width:720px){.settings-group{grid-template-columns:minmax(0,1fr)}.settings-nav{padding:8px 12px}#settingsModal .settings-content{padding:16px 12px 32px}.settings-group .music-settings-card{grid-template-columns:minmax(0,1fr)}}

.app-message-dialog.dialog-fallback{position:fixed;top:50%;left:50%;margin:0;transform:translate(-50%,-50%);z-index:2147483647;box-shadow:0 0 0 100vmax #0009}#settingsModal .display-settings-card>.setting-row-embedded{padding:18px}.footer-button svg{vertical-align:middle}.song-row{transition:background-color .15s,border-color .15s}.stage-header{backdrop-filter:none;background:#121417}
.annotation-white-background{grid-column:1/-1}.annotation-chord.selected[data-white-background=true]{outline:2px solid #c49126;outline-offset:3px}
#settingsButton svg{width:17px;height:17px}#quickSettingsButton svg{width:18px;height:18px}

/* M3.3.4: author button display must not override the hidden state. */
#scoreTransportToggle[hidden]{display:none!important}

/* M3.3.5: alignment and backdrop in one collapsible formatting card. */
.source-controls > summary { cursor: pointer; color: #edc46e; font: 700 12px/1.5 system-ui; }
.source-controls > summary:focus-visible { outline: 2px solid #edc46e; outline-offset: 4px; border-radius: 3px; }
.source-controls-body { padding-top: 12px; }
.source-toggle-row { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1.35fr); gap: 10px; }
.source-toggle-row > label { display: grid; grid-template-columns: 18px minmax(0,1fr); align-items: start; gap: 7px; min-width: 0; margin: 0; padding: 0; grid-column: auto; font-size: 12px; line-height: 1.4; }
.source-toggle-row input[type=checkbox] { margin: 0; }
.source-controls-body > .timing-hint { margin-bottom: 0; }
.chord-current-card > .annotation-control-row-top { grid-column: 1 / -1; grid-template-columns: minmax(90px,1fr) 60px 82px; margin: 0; }
.chord-current-card .annotation-placement-actions { grid-template-columns: 32px 46px; }

/* M3.3.7: keep the favorite control beside the metadata save status. */
.metadata-section-heading { flex-direction: row; flex-wrap: wrap; align-items: center; }
.metadata-section-heading > div:first-child { flex: 1 1 190px; min-width: 0; }
.metadata-section-heading h3 { overflow-wrap: anywhere; }
.metadata-heading-actions { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; margin-left: auto; max-width: 100%; }
.metadata-heading-actions .edit-status { min-width: 0; white-space: normal; }
.metadata-favorite-toggle { position: relative; display: grid; place-items: center; flex: 0 0 44px; width: 44px; height: 44px; border-radius: 10px; color: #d7a44a; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.metadata-favorite-toggle input { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); clip-path: inset(50%); white-space: nowrap; border: 0; }
.metadata-favorite-toggle svg { width: 27px; height: 27px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.metadata-favorite-toggle input:checked + svg { fill: currentColor; }
.metadata-favorite-toggle:focus-within { outline: 2px solid #edc46e; outline-offset: 2px; }
@media (hover: hover) { .metadata-favorite-toggle:hover { background: #d7a44a14; } }
.metadata-options { grid-template-columns: minmax(0, 1fr); }
@media (max-width: 700px) { .metadata-section-heading > div:first-child { flex: 0 1 auto; width: 100%; } }

/* M3.3.8: local data management and a recoverable first-start reset. */
#bulkDeleteCard,#factoryResetCard { padding: 20px; border: 1px solid #42474e; border-radius: 14px; background: #1b2025; }
.bulk-delete summary small { display: block; margin: 7px 0 0 20px; color: #b7bfc7; font-size: 13px; font-weight: 400; }
.delete-score-empty { padding: 16px; }.bulk-delete button:disabled { opacity: .45; cursor: default; }
.factory-reset-card h4 { margin: 0; color: #edbf70; font-size: 18px; }
.factory-reset-card p { color: #bdc3c9; line-height: 1.5; }
.factory-reset-card button { min-height: 44px; padding: 11px 16px; border: 1px solid #a95850; border-radius: 9px; background: #352322; color: #ffc1b9; font: inherit; cursor: pointer; }
#factoryResetStatus:empty { display: none; }
#factoryResetGate { position: fixed; inset: 0; z-index: 2147483647; display: grid; place-items: center; padding: 24px; background: #121519; color: #ece9e1; font: 16px/1.5 system-ui; }
#factoryResetGate>div { width: min(620px,100%); box-sizing: border-box; padding: 28px; border: 1px solid #454950; border-radius: 18px; background: #1d2126; }
#factoryResetGate small { color: #d7a44a; letter-spacing: 2px; text-transform: uppercase; font-weight: 800; }
#factoryResetGate h1 { font-size: clamp(22px,4vw,30px); line-height: 1.2; }
#factoryResetGate button { padding: 12px 18px; border: 1px solid #cf9e45; border-radius: 10px; background: #d7a44a; color: #171a20; font: 700 16px system-ui; }

/* M3.3.45: matching action heights and restrained gold header controls. */
.score-editor {--metadata-action-height:40px;}
.score-editor-header {flex-wrap:nowrap;min-width:0;}
.score-editor-heading {flex:1 1 auto;min-width:0;}
.score-editor-header-actions {width:max-content;max-width:none;min-width:0;flex:0 0 auto;flex-wrap:nowrap;justify-content:flex-end;gap:6px;}
.score-editor-header-actions > button {
 width:auto;height:var(--metadata-action-height);min-height:var(--metadata-action-height);
 padding:0 12px;display:inline-flex;align-items:center;justify-content:center;gap:7px;
 border:1px solid #544830;border-radius:9px;background:#25231e;color:#e2bb73;
 font-size:12px;white-space:nowrap;cursor:pointer;
 transition:background-color .14s ease,border-color .14s ease,color .14s ease;
}
.score-editor-header-actions > button svg {flex:none;}
.score-editor-header-actions > button b {display:block;}
.score-editor-header-actions > button:disabled {opacity:.5;cursor:progress;}
.score-editor-header-actions > button:focus-visible {outline:2px solid #d7a44a;outline-offset:3px;}
@media(hover:hover) and (pointer:fine){
 .score-editor-header-actions > button:not(:disabled):hover {background:#d7a44a;border-color:#d7a44a;color:#1c160c;}
}
.score-editor-header-actions > button:not(:disabled):active {background:#d7a44a;border-color:#d7a44a;color:#1c160c;}
.metadata-actions > button {height:var(--metadata-action-height);}
.score-editor-shell {grid-template-columns:minmax(0,1fr);}
@media(orientation:landscape) and (max-width:760px){.score-editor{--metadata-action-height:34px;}}
@media(prefers-reduced-motion:reduce){.score-editor-header-actions > button{transition:none;}}

/* M3.3.45: icon-only metadata actions on every screen; wrap the title only when needed. */
.stage.editing {grid-template-columns:minmax(0,1fr);}
.score-editor-header.is-measuring .score-editor-heading {flex:none;width:max-content;}
.score-editor-header.is-compact .score-editor-header-actions > button {
 width:var(--metadata-action-height);min-width:var(--metadata-action-height);padding:0;gap:0;
}
.score-editor-header.is-compact .score-editor-header-actions > button > :is(b,span) {display:none;}
.score-editor-header.is-stacked {flex-wrap:wrap;row-gap:10px;}
.score-editor-header.is-stacked .score-editor-heading {flex:1 0 100%;}
.score-editor-header.is-stacked .score-editor-header-actions {margin-left:auto;}
.metadata-action-tooltip {
 position:fixed;z-index:10000;max-width:calc(100vw - 16px);padding:7px 10px;
 border:1px solid #80612e;border-radius:7px;background:#25231e;color:#f1cb7f;
 box-shadow:0 4px 14px #0006;font:600 12px/1.4 system-ui,sans-serif;
 pointer-events:none;overflow-wrap:anywhere;
}
.metadata-action-tooltip[hidden] {display:none;}

/* M3.3.45: downloadable operational trace, matching the existing settings cards. */
#runtimeDiagnosticsCard{padding:18px}
#runtimeDiagnosticsCard h4{margin:0;color:#edbf70;font-size:18px}
#runtimeDiagnosticsCard p{color:#bdc3c9;line-height:1.5;margin:12px 0}
#runtimeDiagnosticsCard small{font-size:13px}
#runtimeDiagnosticDownload{min-height:44px;padding:11px 16px;border:1px solid #9c7837;border-radius:9px;background:#30291e;color:#edc977;font:inherit;cursor:pointer}
#runtimeDiagnosticDownload:hover,#runtimeDiagnosticDownload:focus-visible{background:#d4a33e;color:#191712}
#runtimeDiagnosticDownload:disabled{opacity:.45;cursor:default}

/* Uniform portrait buttons, including nested score controls and quick actions. */
@media(orientation:portrait){
 .stage-header .portrait-left-actions,.stage-header .portrait-right-actions,.stage-header .score-header-tools,.stage-header .view-mode-switch {align-items:center;gap:4px}
 .stage-header .portrait-right-actions :is(.header-button,.view-mode-button),.stage-header .portrait-left-actions button {height:34px;min-height:34px;max-height:34px;flex-shrink:0;box-sizing:border-box;margin-block:0;align-self:center}
 .stage-header .portrait-right-actions :is(.header-button,.view-mode-button) {width:34px;min-width:34px;padding:0}
 .stage-header .view-mode-switch {height:34px}
}
