/* KWONMO — 악보 추출기 작업대 */
.mch-page:root[data-font-size="small"] { font-size: 95%; }
.mch-page:root[data-font-size="large"] { font-size: 115%; }
.mch-page:root { height: 100%; overflow: hidden; }
.mch-page body { height: 100%; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.mch-page .masthead { flex: 0 0 var(--header-total); }
.mch-app { flex: 1; min-height: 0; min-width: 0; width: 100%; max-width: none; padding: 0 1.375rem calc(1.125rem + var(--safe-b)); display: grid; grid-template-rows: 4.875rem minmax(0, 1fr); gap: .875rem; overflow: hidden; color: var(--text); font-size: .875rem; }
.mch-app * { box-sizing: border-box; }
.mch-app [hidden] { display: none !important; }
.mch-app h1, .mch-app h2, .mch-app p { margin: 0; }
.mch-app h1 { font-size: 1.1875rem; font-weight: 650; }
.mch-app h2 { font-size: 1rem; }
.mch-app button { font: inherit; min-height: 2.375rem; padding: var(--sp-sm) .9375rem; border: var(--hairline) solid var(--line); border-radius: .4375rem; color: var(--text); background: var(--surface); cursor: pointer; }
.mch-app button:hover:not(:disabled) { background: var(--surface-2); border-color: var(--accent); }
.mch-app button:disabled { opacity: .7; cursor: default; }
.mch-app :is(button, input):focus-visible { outline: var(--focus-ring) solid var(--accent); outline-offset: var(--focus-ring); }
.mch-heading { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 1.25rem; }
.mch-heading p { justify-self: end; color: var(--danger); white-space: pre-wrap; overflow-wrap: anywhere; max-height: 5em; overflow: auto; }
.mch-body { position: relative; display: grid; grid-template-rows: minmax(0, 1fr) auto; gap: .875rem; min-height: 0; min-width: 0; overflow: auto; }
.mch-workspace { position: relative; display: grid; grid-template-columns: 16rem minmax(0, 1fr) 20rem; gap: .875rem; min-height: 0; overflow: auto; }
.mch-panel { min-width: 0; min-height: 0; display: flex; flex-direction: column; background: var(--surface); border: var(--hairline) solid var(--line); border-radius: var(--radius-md); overflow: hidden; }
.mch-panel-head { flex: 0 0 3.875rem; display: flex; justify-content: space-between; align-items: center; gap: .75rem; padding: 0 1.25rem; border-bottom: var(--hairline) solid var(--line); }
.mch-panel-body { flex: 1; display: flex; flex-direction: column; padding: .9375rem 1.25rem; gap: .75rem; overflow: auto; min-height: 0; }
.mch-song { flex-shrink: 0; width: 100%; display: block; text-align: left; overflow-wrap: anywhere; }
.mch-song strong, .mch-song small { display: block; }
.mch-song small { margin-top: var(--sp-sm); color: var(--text-mid); }
.mch-song[aria-pressed="true"] { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 16%, var(--surface)); }
.mch-song-footer { display: flex; gap: var(--sp-sm); padding: .9375rem 1.25rem; border-top: var(--hairline) solid var(--line); }
.mch-song-footer button { flex: 1; }
.mch-app dialog:modal { margin: auto; }
.mch-song-dialog { width: min(82rem, calc(100vw - 2rem)); height: min(54rem, 80vh); max-height: calc(100vh - 2rem); padding: 0; color: var(--text); background: var(--surface); border: var(--hairline) solid var(--line); border-radius: var(--radius-md); }
.mch-song-dialog[open] { display: flex; flex-direction: column; }
.mch-song-dialog::backdrop { background: color-mix(in srgb, var(--rule-soft) 70%, transparent); }
.mch-song-dialog .mch-panel-head button { min-height: 1.75rem; padding: var(--sp-xs) var(--sp-sm); }
.mch-library-tools { display:flex; align-items:center; justify-content:space-between; gap:1rem; padding:.75rem 1.25rem; }
.mch-library-tools input { width:min(26rem,70%); padding:.5rem .7rem; font:inherit; border:1px solid var(--line); border-radius:.3rem; background:var(--surface-2); color:var(--text); }
.mch-song-list { flex:1; min-height:0; overflow:auto; padding:0 1.25rem; }
.mch-song-list table { width:100%; min-width:45rem; border-spacing:0; font-variant-numeric:tabular-nums; }
.mch-song-list th,.mch-song-list td { text-align:left; padding:.6rem .7rem; border-bottom:1px solid var(--line); white-space:nowrap; }
.mch-song-list th { position:sticky; top:0; background:var(--surface-2); z-index:1; }
.mch-song-list .mch-list-name { width:35%; min-width:12rem; white-space:normal; overflow-wrap:anywhere; }
.mch-song-list td button { min-height:1.75rem; border:0; padding:0; background:transparent; color:inherit; text-align:left; overflow-wrap:anywhere; }
.mch-song-list td { height:3rem; }
.mch-song-list td button[data-open-song] { padding:.3rem .65rem; border:1px solid var(--line); border-radius:.35rem; white-space:nowrap; }
.mch-song-list input[type=checkbox] { width:1.15rem; height:1.15rem; cursor:pointer; }
.mch-song-list tr[data-song] { cursor:pointer; }
.mch-song-list tr:hover td { background:var(--surface-2); }
.mch-song-list tr.is-selected td { background:color-mix(in srgb,var(--accent) 15%,var(--surface)); }
.mch-song-list tr.is-selected td:first-child { box-shadow:inset 3px 0 var(--accent); }

.mch-song-now { display: flex; flex-direction: column; gap: .625rem; padding: .875rem; border: var(--hairline) solid var(--accent); border-radius: .5rem; background: color-mix(in srgb, var(--accent) 10%, var(--surface)); }
.mch-song-now > strong { font-size: 1rem; overflow-wrap: anywhere; }
.mch-song-now dl { display: grid; grid-template-columns: max-content 1fr; gap: .25rem .75rem; margin: 0; font-size: .8125rem; }
.mch-song-now dt { color: var(--text-mid); }
.mch-song-now dd { margin: 0; }
.mch-step-dots { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: .25rem; }
.mch-step-dots li { display: flex; flex-direction: column; gap: .2rem; font-size: .6875rem; color: var(--text-mid); text-align: center; }
.mch-step-dots li::before { content: ''; height: .3125rem; border-radius: .2rem; background: var(--line); }
.mch-step-dots li:is(.is-done, .is-skip)::before { background: var(--gain); }
.mch-step-dots li.is-run::before { background: var(--accent); }
.mch-step-dots li.is-fail::before { background: var(--danger); }
.mch-app .mch-song-remove { flex: 0 0 auto; min-height: 1.75rem; padding: var(--sp-xs) var(--sp-sm); font-size: .8125rem; white-space: nowrap; }
.mch-center { display: flex; flex-direction: column; gap: .875rem; min-height: 0; min-width: 0; }
.mch-songbar { display: flex; align-items: center; gap: .9375rem; }
.mch-songbar h2 { font-size: 1.1875rem; font-weight: 650; overflow-wrap: anywhere; }
.mch-songbar span:not(:empty), .mch-badge { flex: 0 0 auto; padding: var(--sp-xs) .5625rem; border-radius: .3125rem; background: var(--surface-2); font-size: .8125rem; white-space: nowrap; }
.mch-song small { width: fit-content; }
.mch-songbar span, .mch-instruction, .mch-panel small, .mch-right, .mch-footer { color: var(--text-mid); }
.mch-work { flex: 1; }
.mch-drop { width: 100%; min-height: 16rem; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .75rem; border-style: dashed !important; }
.mch-drop.is-over { background: var(--surface-2); outline: var(--stroke-2) solid var(--accent); }
.mch-app progress { width: 100%; accent-color: var(--accent); margin-top: var(--sp-md); }
.mch-process { list-style: none; padding: 0; margin: 0; }
.mch-process li { display: flex; justify-content: space-between; column-gap: 1rem; row-gap: .875rem; padding: .75rem 0; border-bottom: var(--hairline) solid var(--line); }
.mch-process .is-running { background: var(--surface-2); color: var(--accent); }
.mch-app .mch-error { color: var(--danger); white-space: pre-wrap; overflow-wrap: anywhere; margin-block: var(--sp-md); }
.mch-edit { position: relative; flex: 1; min-height: 0; display: grid; grid-template-rows: minmax(4rem, 1fr) minmax(12rem, 3fr); gap: .875rem; overflow: auto; }
.mch-grid { display: block; min-width: 0; }
.mch-system + .mch-system { margin-top: 1.125rem; }
.mch-grid-row, .mch-key-row { display: grid; grid-template-columns: 5.5rem repeat(var(--mch-row-bars, 4), minmax(0, 1fr)); }
.mch-system-heading, .mch-key-heading { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.mch-system-heading { margin-bottom: .375rem; color: var(--text-mid); font-size: .8125rem; }
.mch-system-title { display: inline-flex; align-items: center; gap: .25rem; }
.mch-score-head { flex: 0 0 auto; min-height: 3.875rem; flex-wrap: wrap; padding-block: .5rem; gap: .375rem; }
.mch-score-head .mch-overline { flex: 1; }
.mch-view-tools { flex: 1 1 100%; order: 1; display: flex; flex-wrap: wrap; align-items: center; gap: .375rem .75rem; }
.mch-view-tools button, .mch-speed button { min-height: 1.625rem; padding: .125rem .5rem; font-size: .75rem; }
.mch-app :is(.mch-view-tools, .mch-speed) button[aria-pressed="true"] { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 18%, var(--surface)); }
.mch-follow { display: inline-flex; align-items: center; gap: .25rem; font-size: .8125rem; color: var(--text-mid); white-space: nowrap; }
.mch-speed { display: inline-flex; align-items: center; gap: .375rem; }
.mch-guitar { display: block; width: 100%; max-width: 6.5rem; height: auto; }
.mch-guitar-string, .mch-guitar-fret { stroke: var(--text-mid); stroke-width: 1; }
.mch-guitar-nut { stroke: var(--text); stroke-width: 3; }
.mch-guitar-dot { fill: var(--accent); }
.mch-guitar-open { fill: none; stroke: var(--text-mid); stroke-width: 1.2; }
.mch-guitar-mute { fill: var(--danger); font-size: 9px; }
.mch-guitar-base { fill: var(--text-mid); font-size: 9px; }
.mch-bass-note { font-size: 1.375rem; font-weight: 700; color: var(--accent); }
.mch-layer-none { color: var(--text-mid); font-size: .8125rem; }
.mch-drum { display: block; width: 100%; height: auto; }
.mch-drum-name { fill: var(--text-mid); font-size: 6px; }
.mch-drum-line { stroke: var(--line); stroke-width: .5; }
.mch-drum-hit { fill: var(--accent); }
.mch-row-label { display: flex; align-items: center; color: var(--text-mid); font-size: .8125rem; }
.mch-code-cell { min-width: 0; display: flex; flex-direction: column; border: var(--hairline) solid var(--line); }
.mch-measure-number { color: var(--text-mid); font-weight: normal; }
.mch-slots { display: flex; min-width: 0; flex: 1; }
.mch-grid :is(.mch-bar, .mch-key-slot) { container-type: inline-size; flex: 1; min-width: 0; min-height: 0; padding: .375rem .125rem; border: 0; border-right: var(--hairline) solid var(--line); border-radius: 0; background: transparent; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .25rem; }
.mch-grid :is(.mch-bar, .mch-key-slot):last-child { border-right: 0; }
.mch-grid .mch-bar { flex-flow: row wrap; align-content: center; align-items: baseline; padding: .125rem .25rem; gap: 0 .25rem; }
.mch-bar strong { flex: 1 0 auto; text-align: center; font-size: clamp(.75rem, 18cqi, 1.25rem); white-space: nowrap; }
.mch-key-cell { border: var(--hairline) solid var(--line); border-top: 0; }
.mch-key-slot small { font-size: clamp(.5rem, 11cqi, .8125rem); }
.mch-chord-tones { overflow-wrap: anywhere; }
.mch-keyboard { display: block; width: 100%; height: auto; max-height: 6rem; }
.mch-white-key { fill: var(--surface); stroke: var(--text-mid); stroke-width: 1; }
.mch-black-key { fill: var(--text); stroke: var(--text); stroke-width: 1; }
.mch-hand-left { fill: var(--accent); background: var(--accent); }
.mch-hand-right { fill: var(--gain); background: var(--gain); }
.mch-key-name { fill: var(--surface); font-size: 1.0625rem; font-weight: 700; text-anchor: middle; }
.mch-key-register { fill: var(--text-mid); font-size: 1.0625rem; }
.mch-hand-legend { display: inline-flex; align-items: center; gap: .5rem; font-size: .75rem; color: var(--text-mid); white-space: nowrap; }
.mch-hand-legend i { display: inline-block; width: .625rem; height: .625rem; margin-right: .25rem; border-radius: .125rem; }
.mch-detail-key { border-bottom: var(--hairline) solid var(--line); padding-bottom: .375rem; }
.mch-detail-key .mch-keyboard { max-height: 8rem; margin-block: .375rem; }
.mch-detail-instrument { display:grid; justify-items:center; gap:.25rem; margin-block:.375rem; }
.mch-detail-instrument .mch-drum { max-width:12rem; }
.mch-detail-key p { font-size: .75rem; }
.mch-footer { min-height: 0; overflow: auto; padding: 0 1.25rem; font-size: .875rem; border: var(--hairline) solid var(--line); border-radius: var(--radius-md); background: var(--surface); }
.mch-transport { display: flex; flex-direction: column; white-space: nowrap; }
.mch-transport-row { display: flex; flex-wrap: nowrap; align-items: center; height: 3.25rem; gap: .625rem; overflow-x: auto; border-bottom: var(--hairline) solid var(--line); }
.mch-transport-row > * { flex-shrink: 0; }
.mch-mixer { display: flex; align-items: stretch; gap: .625rem; padding-block: .625rem; overflow-x: auto; }
.mch-mix-group { flex-shrink: 0; display: flex; flex-direction: column; justify-content: center; gap: .375rem; padding-inline-end: .625rem; border-right: var(--hairline) solid var(--line); }
.mch-mix-group:last-child { border-right: 0; }
.mch-mix-cards { flex-shrink: 0; display: flex; gap: .375rem; padding-inline-end: .625rem; border-right: var(--hairline) solid var(--line); }
.mch-mix-cards:last-child { border-right: 0; }
.mch-mixer button { min-height: 1.625rem; padding: .125rem .4375rem; font-size: .75rem; }
.mch-mixer strong { color: var(--text); font-size: .8125rem; }
.mch-mixer input[type="range"]:disabled { opacity: .4; }
.mch-seg { display: inline-flex; }
.mch-app .mch-seg button { border-radius: 0; margin-inline-start: calc(-1 * var(--hairline)); }
.mch-app .mch-seg button:first-child { border-radius: .375rem 0 0 .375rem; margin-inline-start: 0; }
.mch-app .mch-seg button:last-child { border-radius: 0 .375rem .375rem 0; }
.mch-mixer button[aria-pressed="true"] { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 18%, var(--surface)); color: var(--text); }
.mch-inst-card { display: flex; flex-direction: column; justify-content: center; gap: .375rem; padding: .5rem .625rem; border: var(--hairline) solid var(--line); border-radius: .5rem; }
.mch-inst-card.is-current { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, var(--surface)); }
.mch-inst-card.is-silent :is(label, .mch-seg) { opacity: .5; }
.mch-inst-head { display: flex; align-items: center; justify-content: space-between; gap: .375rem; }
.mch-app .mch-inst-name { border-color: transparent; background: transparent; padding-inline: .25rem; font-weight: 700; color: var(--text); }
.mch-app .mch-mixer .mch-inst-mute[aria-pressed="true"] { border-color: var(--warn); background: color-mix(in srgb, var(--warn) 18%, var(--surface)); }
.mch-mixer input[type="range"] { width: 5rem; }
.mch-inst-card input[type="range"] { width: 4.25rem; }
.mch-footer .mch-error:empty { display: none; }
.mch-transport label { display: flex; align-items: center; gap: var(--sp-sm); }
.mch-transport input[type="range"] { width: 7rem; accent-color: var(--accent); }
.mch-transport select { font: inherit; min-height: 2rem; padding: var(--sp-xs) var(--sp-sm); border: var(--hairline) solid var(--line); border-radius: .4375rem; color: var(--text); background: var(--surface); }
.mch-transport .mch-seek { flex: 1; min-width: 12rem; }
.mch-transport .mch-seek input { flex: 1; min-width: 0; }
.mch-transport output { font-variant-numeric: tabular-nums; letter-spacing: .03em; white-space: nowrap; }
.mch-transport label output { min-width: 4ch; text-align: right; }
.mch-grid [data-bar].is-selected { background: color-mix(in srgb, var(--accent) 16%, var(--surface)); border-color: var(--accent); outline: var(--stroke-2) solid var(--accent); outline-offset: calc(-1 * var(--stroke-2)); }
.mch-key-cell { position: relative; }
/* 지금 재생 중인 마디: 칸 아래 변에 바짝 붙인 두꺼운 띠 — 가운데로 내려가면 아래 줄 마디로 읽힌다(11-17 대표님). */
.mch-grid .mch-key-cell.is-current::after { content: ''; position: absolute; inset-inline: .375rem; bottom: .1875rem; height: .3125rem; border-radius: .1875rem; background: var(--gain); pointer-events: none; }
.mch-grid .mch-bar.is-current .mch-measure-number { color: var(--accent); font-weight: 700; }
.mch-overline { color: var(--text-mid); font-size: .8125rem; font-weight: 400; }
.mch-songbar { flex-wrap: wrap; }
.mch-edit-dot { display: inline-block; width: .4375rem; height: .4375rem; margin-inline-start: .375rem; border-radius: 50%; background: var(--accent); vertical-align: middle; }
.mch-bar-heading { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; color: var(--text); }
.mch-right .mch-panel-body { gap: .375rem; scrollbar-width: none; }
.mch-right .mch-panel-body::-webkit-scrollbar { display: none; }
.mch-right .mch-panel-head #mchApply { min-height: 1.875rem; border-color: var(--accent); }
.mch-right .mch-panel-body > * { flex-shrink: 0; }
.mch-right button { min-height: 1.75rem; padding: var(--sp-xs) var(--sp-sm); font-size: .8125rem; }
.mch-right .mch-error { margin-block: .25rem; }
.mch-right .mch-error:empty { display: none; }
.mch-editor-options, .mch-editor-slots { display: flex; flex-wrap: wrap; gap: .375rem; }
.mch-editor-options button, .mch-editor-slots button { flex: 1; }
.mch-editor-slots button { display: flex; flex-direction: column; gap: .125rem; text-align: left; }
.mch-editor-slots strong { font-size: 1.125rem; }
.mch-right button[aria-pressed="true"] { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 16%, var(--surface)); color: var(--text); }
.mch-chord-picker { margin: 0; padding: .25rem 0; border: 0; border-top: var(--hairline) solid var(--line); min-width: 0; }
.mch-chord-picker legend { padding-inline-end: .5rem; }
.mch-root-options, .mch-quality-options { display: grid; gap: .25rem; margin-block-end: .25rem; }
.mch-root-options { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.mch-quality-options { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .375rem .75rem; }
.mch-quality-pair { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .2rem; }
.mch-quality-pair button[data-quality] { overflow-wrap: anywhere; }
.mch-quality-pair button[data-preview] { padding-inline: .45rem; }
.mch-bar-heading strong { flex: 1; text-align: center; }
.mch-engine-list { display: flex; flex-direction: column; gap: .25rem; }
.mch-engine-row { display: grid; grid-template-columns: 3.5rem minmax(0, 1fr) auto auto auto; align-items: center; gap: .375rem; font-size: .8125rem; }
.mch-engine-row strong { color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mch-app .mch-engine-meter { width: 100%; height: .375rem; margin: 0; accent-color: var(--accent); }
.mch-engine-row small { white-space: nowrap; }
.mch-chord-picker button { padding-inline: .375rem; }
.mch-right :is(button:disabled, fieldset:disabled button) { opacity: .45; cursor: default; }
.mch-empty-preview { flex: 1; display: flex; align-items: center; justify-content: center; gap: .75rem; padding: var(--sp-md); text-align: center; color: var(--text-mid); }
.mch-divider { position: absolute; z-index: 3; touch-action: none; }
.mch-divider-columns { cursor: col-resize; }
.mch-divider-rows { cursor: row-resize; }
.mch-divider::after { content: ''; position: absolute; background: var(--line); opacity: .25; }
.mch-divider-columns::after { inset-block: 0; left: 50%; width: var(--stroke-2); transform: translateX(-50%); }
.mch-divider-rows::after { inset-inline: 0; top: 50%; height: var(--stroke-2); transform: translateY(-50%); }
.mch-divider:is(:hover, .is-active)::after { background: var(--accent); opacity: 1; }
.mch-body.is-splitting, .mch-body.is-splitting * { user-select: none; }
@media (max-width: 48rem), (max-height: 30rem) and (orientation: landscape) {
  .mch-divider { display: none; }
  .mch-app { padding-inline: var(--sp-xs); gap: var(--sp-xs); }
  .mch-workspace { grid-template-columns: minmax(0, 1fr); grid-auto-rows: minmax(12rem, auto); }
  .mch-center { min-height: 30rem; }
  .mch-heading { grid-template-columns: auto minmax(0, 1fr); gap: var(--sp-xs); }
  .mch-heading p { grid-column: 1 / -1; }
  #mchGridScroll { padding-inline: var(--sp-xs); }
  .mch-panel-head { padding-inline: var(--sp-sm); }
  .mch-transport-row { height: 2.75rem; }
}
.mch-footer audio { display: none; }
.mch-app.is-local-only { display: flex; align-items: center; justify-content: center; }
.mch-app.is-local-only .mch-heading { display: flex; flex-direction: column; text-align: center; }
.mch-app.is-local-only .mch-heading p { font-size: 1.5rem; }
#mchExportPanel { border-top:var(--hairline) solid var(--line); padding-top:.875rem; }
#mchExportTitle { margin-bottom:.75rem; }
.mch-export { display: grid; grid-template-columns: max-content 1fr; gap: .5rem 1.5rem; margin: 0 0 var(--sp-md, 1rem); }
.mch-export-actions button { flex:1 1 auto; }
.mch-export dt { color: var(--text-mid); }
.mch-export dd { margin: 0; font-weight: 700; }
.mch-export-actions { display: flex; flex-wrap:wrap; gap: .375rem; align-items: center; margin-top: var(--sp-md, 1rem); }
.mch-button { display: inline-block; padding: .5rem .9rem; border: var(--hairline) solid var(--accent); border-radius: var(--radius-sm, .4rem); background: var(--accent); color: var(--surface); text-decoration: none; }
.mch-button.is-disabled { opacity: .45; cursor: default; }
.mch-lyrics { flex: 1; min-height: 0; overflow: hidden; padding: .25rem 1rem; display: flex; flex-direction: column; justify-content: center; text-align: center; }
.mch-lyrics p { margin: .15rem 0; color: var(--text-dim); font-size: 1rem; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mch-song-info { display: block; margin-top: .375rem; color: var(--text-mid); }
.mch-lyrics p.is-current { color: var(--text); font-size: 1.25rem; font-weight: 700; }
.mch-lyrics p.is-current span.is-sung { color: var(--accent); }
.mch-lyrics .mch-empty-preview { height: 100%; }
.mch-panel:has(> .mch-chord-shade) { position: relative; }
.mch-chord-shade { position:absolute; inset:0; z-index:4; background:rgba(0,0,0,.28); }
.mch-chord-popover { position: fixed; z-index: 50; width: min(19rem, calc(100vw - 1rem)); max-height: min(26rem, calc(100vh - 1rem)); display: flex; flex-direction: column; padding: .5rem; border: var(--hairline) solid var(--accent); border-radius: var(--radius-md, .5rem); background: var(--surface); box-shadow: 0 .5rem 1.5rem rgba(0, 0, 0, .35); font-size: .875rem; }
.mch-pop-head { display: flex; justify-content: space-between; align-items: center; padding: 0 .25rem .375rem; }
.mch-pop-head button { padding: .1rem .45rem; }
.mch-pop-list { list-style: none; margin: 0; padding: 0; overflow: auto; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .375rem 1rem; }
.mch-pop-list li { display: flex; gap: .3rem; }
.mch-pop-play { min-height: 2rem; flex: 0 0 auto; padding: .2rem .4rem; font-size: .75rem; }
.mch-pop-pick { flex: 1; min-width: 0; padding: .2rem .3rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mch-pop-pick[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); }
.mch-pop-note { margin: .375rem .25rem 0; color: var(--text-mid); font-size: .75rem; }
.mch-pop-mode { margin-top: .375rem; width: 100%; padding: .25rem .4rem; font-size: .8125rem; }

.mch-code-cell.is-draft { border: var(--stroke-2) dashed var(--warn); }
.mch-draft-label { margin-inline-start: .375rem; color: var(--warn); font-weight: 700; }
.mch-leave-dialog { max-width: 26rem; padding: var(--sp-lg); color: var(--text); background: var(--surface); border: var(--hairline) solid var(--line); border-radius: var(--radius-md); }
.mch-leave-dialog::backdrop { background: var(--rule-soft); }
.mch-leave-dialog p { margin-block: var(--sp-md); }
.mch-leave-dialog > div { display: flex; gap: var(--sp-sm); justify-content: flex-end; }

.mch-page[data-theme="dark"] { color-scheme: dark; --bg:#1a2023; --surface:#262d31; --surface-2:#323b40; --text:#f7f4ec; --text-mid:#c4ceca; --text-dim:#9aa8a7; --accent:#f08b5e; --gain:#89bfaf; --line:#485458; }
.mch-page[data-theme="light"] { color-scheme:light; --bg:#ecece6; --surface:#faf9f4; --surface-2:#e6e8e2; --text:#21292b; --text-mid:#485355; --text-dim:#596765; --line:#bdc6c1; --accent:#a7411a; --gain:#286752; }
.mch-page body { font-family:"Segoe UI","Malgun Gothic",sans-serif; background:var(--bg); }
.mch-heading { grid-template-columns:auto auto minmax(0,1fr); justify-content:start; border-bottom:1px solid var(--line); }
.mch-heading h1 { display:flex; gap:.8rem; align-items:center; font:600 1rem "Segoe UI","Malgun Gothic",sans-serif; }
.mch-menubar { display:flex; align-items:center; gap:.15rem; }
.mch-menubar details { position:relative; }
.mch-menubar summary { list-style:none; cursor:pointer; padding:.45rem .75rem; border-radius:.25rem; }
.mch-menubar summary:hover,.mch-menubar details[open] summary { color:var(--accent); background:var(--surface-2); }
.mch-menubar details>div { position:absolute; z-index:60; top:100%; left:0; min-width:12rem; padding:.3rem; border:1px solid var(--line); border-radius:.3rem; background:var(--surface); box-shadow:0 .5rem 1rem #0003; }
.mch-menubar button { display:block; width:100%; text-align:left; border:0; }
.mch-menubar hr { border:0; border-top:1px solid var(--line); }
.mch-lyric-panel>.mch-panel-head { flex-basis:2.5rem; }
#mchLyricsEdit { border:0; background:transparent; }
#mchLyricsEdit:hover { text-decoration:underline; }
.mch-preferences { width:min(25rem,90%); padding:1.5rem; color:var(--text); background:var(--surface); border:1px solid var(--line); border-radius:.5rem; }
.mch-preferences::backdrop { background:#12181780; }
.mch-preferences form { display:grid; gap:1rem; }
.mch-preferences label { display:flex; justify-content:space-between; align-items:center; }
.mch-preferences select { padding:.4rem; color:var(--text); background:var(--surface-2); border:1px solid var(--line); border-radius:.25rem; }
.mch-lyric-dialog { width:min(36rem,92vw); margin:auto; }
.mch-lyric-dialog label { display:grid; gap:.35rem; justify-content:stretch; }
.mch-lyric-dialog select, .mch-lyric-dialog input { width:100%; min-width:0; box-sizing:border-box; }
.mch-lyric-dialog input { padding:.5rem; color:var(--text); background:var(--surface-2); border:1px solid var(--line); }
.mch-lyric-dialog footer { text-align:right; }
#mchLyricError:empty { display:none; }
.mch-preferences button { justify-self:end; }
#mchSettingsError:empty { display:none; }
@media(max-width:48rem){ .mch-heading { grid-template-columns:1fr;gap:0; }.mch-heading h1 svg { width:5rem;height:1.4rem; }.mch-heading p:empty {display:none}.mch-menubar details:last-child>div {left:auto;right:0} }

#mchPresetDialog { margin:auto; width:min(65rem,95vw); max-height:90vh; overflow:auto; padding:0; color:var(--text); background:var(--surface); border:1px solid var(--line); border-radius:.6rem; }
#mchPresetDialog::backdrop { background:#101618a6; }
#mchPresetDialog header { cursor:grab; touch-action:none; user-select:none; display:flex; align-items:center; gap:1rem; padding:.8rem 1rem; border-bottom:1px solid var(--line); }
#mchPresetDialog header:active { cursor:grabbing; }
#mchPresetDialog h2 { font-size:1.1rem; margin:0; }
#mchClosePreset { margin-left:auto; }
.mch-preset-layout { display:grid; grid-template-columns:2fr 1fr; gap:1rem; padding:1rem; }
#mchPresetParts { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:.75rem; }
#mchPresetParts .mch-inst-card { gap:.8rem; padding:1rem; }
#mchPresetParts label { display:flex; gap:.4rem; align-items:center; }
#mchPresetParts input { min-width:0; flex:1; accent-color:var(--accent); }
.mch-preset-list { display:grid; gap:.35rem; align-content:start; border-left:1px solid var(--line); padding-left:1rem; }
.mch-preset-list hr { border:0; border-top:1px solid var(--line); width:100%; margin:.25rem 0; }
#mchPresetDialog button { padding:.35rem .55rem; }
#mchPresetDialog button[aria-pressed="true"] { border-color:var(--accent); background:color-mix(in srgb,var(--accent) 15%,var(--surface)); color:var(--text); }
#mchPresetDialog button[aria-pressed="true"]:disabled { opacity:1; }
#mchPresetStatus { color:var(--text-mid); font-size:.82rem; }
@media(max-width:50rem) { .mch-preset-layout { grid-template-columns:1fr; } .mch-preset-list { border:0; padding:0; } }

.mch-menubar > button { width:auto; min-height:0; border:0; border-radius:.25rem; padding:.45rem .75rem; background:transparent; }
.mch-menubar > button:hover:not(:disabled) { color:var(--accent); background:var(--surface-2); }
#mchPreferencesDialog button[type="button"] { justify-self:stretch; text-align:start; }

#mchShortcutList > div { display: flex; justify-content: space-between; gap: 1em; }

.mch-slot-row { display:grid; grid-template-columns:1fr auto; gap:.35rem; }
