/* Score Studio (/sheet-music-editor). It wears Video Studio's frame and
   panels (video-studio.css): menus and Export along the top, the note bar,
   then the palettes, the pages and the settings in a row, with the piano
   keyboard under the pages when it is open. On a phone the palettes and the
   settings become sheets opened from tabs. */

/* ---- Start screen ---- */
.ss-new .st-new-row + .st-new-row { margin-top: 12px; }
.ss-new .st-new-row > .st-field { flex: 0 0 auto; }
.ss-new .st-new-row > .ss-grow { flex: 1 1 220px; min-width: 0; }
.ss-new .ss-grow .input { width: 100%; }
.ss-new .ss-num { width: 84px; }
.ss-chips { display: flex; flex-wrap: wrap; gap: 6px; min-height: 30px; margin-bottom: 8px; }
.ss-chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 4px 3px 10px; color: var(--text); background: var(--surface-2); border: 1px solid var(--border); font-size: 0.82rem; }
.ss-chip-x { display: grid; place-items: center; width: 22px; height: 22px; padding: 0; color: var(--muted); background: none; border: 0; font: inherit; font-size: 1rem; line-height: 1; cursor: pointer; }
.ss-chip-x:hover { color: var(--text); }
.ss-chip-x:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.ss-new-adds { display: flex; flex-wrap: wrap; gap: 8px; }
.ss-new-adds .st-select { width: auto; min-width: 200px; }

/* ---- The frame ---- */
.ss-work { grid-template-rows: auto auto minmax(0, 1fr); }
.ss-body { grid-template-columns: 264px minmax(0, 1fr) 292px; }
.ss-main { position: relative; display: grid; grid-template-rows: minmax(0, 1fr) auto; min-width: 0; min-height: 0; }
.ss-menu { max-height: 74vh; overflow-y: auto; scrollbar-width: thin; }
.ss-menu-head { margin: 6px 10px 2px; color: var(--accent-strong); font-family: var(--mono); font-size: 0.62rem; letter-spacing: 0.08em; text-transform: uppercase; }

/* ---- The note bar ---- */
.ss-bar { display: flex; align-items: center; gap: 8px; min-width: 0; padding: 4px 8px; background: var(--surface); border-bottom: 1px solid var(--border); }
.ss-tools { display: flex; align-items: center; gap: 1px; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.ss-tools::-webkit-scrollbar { display: none; }
.ss-tb { flex: none; display: grid; place-items: center; width: 32px; height: 32px; padding: 0; }
.ss-tb svg { display: block; }
.ss-tb-gap { flex: none; width: 1px; height: 22px; margin: 0 6px; background: var(--border); }
.ss-bar-right { display: flex; align-items: center; gap: 2px; flex: none; margin-left: auto; }
.ss-play { color: var(--tint-text); }
.ss-play.is-on { color: var(--bg); background: var(--accent-strong); }
.ss-zoom-box { display: inline-flex; align-items: center; gap: 0; margin-left: 6px; }
.ss-zoom { min-width: 56px; padding-inline: 4px; font-variant-numeric: tabular-nums; }
.ss-app.is-input #ss-input-btn { color: var(--bg); background: var(--accent-strong); }

/* ---- The pages ---- */
.ss-view { position: relative; min-width: 0; min-height: 0; overflow: auto; background: #4a4752; outline: none; scrollbar-width: thin; scrollbar-color: #6c6876 transparent; }
.ss-pages { display: flex; flex-direction: column; align-items: center; gap: 22px; width: max-content; min-width: 100%; padding: 22px 20px 60px; box-sizing: border-box; }
.ss-page { position: relative; flex: none; width: var(--pw, 794px); aspect-ratio: 1200 / 1697; background: #fff; box-shadow: 0 6px 22px rgba(0, 0, 0, 0.45); }
.ss-sheet, .ss-over, .ss-poplayer { position: absolute; inset: 0; }
.ss-sheet svg { display: block; width: 100%; height: auto; }
.ss-over { pointer-events: none; }
.ss-app.is-input .ss-page { cursor: crosshair; }
.ss-sheet .is-sel, .ss-sheet .is-sel * { fill: #2a6bdf; stroke: #2a6bdf; }
.ss-range { position: absolute; background: rgba(42, 107, 223, 0.12); outline: 1.5px solid rgba(42, 107, 223, 0.75); }
.ss-caret { position: absolute; background: rgba(42, 107, 223, 0.16); border-left: 2px solid #2a6bdf; }
.ss-ghost { position: absolute; border-radius: 50%; background: rgba(42, 107, 223, 0.55); transform: rotate(-20deg); }
.ss-ghost.is-ledger { box-shadow: 0 0 0 0 transparent, -4px 0 0 -3px rgba(42, 107, 223, 0.7), 4px 0 0 -3px rgba(42, 107, 223, 0.7); }
.ss-playhead { position: absolute; background: rgba(46, 196, 182, 0.18); border-left: 2px solid #1fa596; }
.ss-pop { position: absolute; z-index: 5; min-width: 70px; max-width: 220px; padding: 1px 4px; color: #111; background: #fffbe6; border: 1.5px solid #2a6bdf; border-radius: 0; font: 15px "Times New Roman", Times, serif; pointer-events: auto; }
.ss-pop.is-ch { font-weight: 700; }
.ss-pop.is-text { font-style: italic; }
.ss-pop:focus { outline: none; box-shadow: 0 0 0 3px rgba(42, 107, 223, 0.25); }

.ss-msg { position: absolute; left: 12px; right: 12px; bottom: 10px; z-index: 6; margin: 0; pointer-events: none; }
.ss-msg:not(:empty) { justify-self: start; width: fit-content; max-width: calc(100% - 24px); padding: 6px 10px; color: var(--text); white-space: normal; background: rgba(20, 17, 31, 0.9); border: 1px solid var(--border); }
.ss-work.has-keys .ss-msg { bottom: 106px; }
.ss-msg[data-kind="warn"] { border-color: #e8b44f; }
.ss-msg[data-kind="ok"] { border-color: #2ec4b6; }

/* ---- The piano keyboard ---- */
.ss-keys { display: none; height: 96px; overflow-x: auto; overflow-y: hidden; background: var(--surface); border-top: 1px solid var(--border); scrollbar-width: thin; }
.ss-work.has-keys .ss-keys { display: block; }
.ss-keys-row { position: relative; display: flex; height: 100%; padding: 0 0 4px; }
.ss-key { position: relative; flex: none; width: 26px; height: 100%; padding: 0; background: #f4f2f7; border: 1px solid #8b8796; border-left-width: 0; border-radius: 0 0 3px 3px; cursor: pointer; touch-action: manipulation; }
.ss-key.is-black { z-index: 1; width: 16px; height: 58%; margin: 0 -8px; background: #1b1922; border: 1px solid #000; }
.ss-key:active { background: var(--accent-strong); }
.ss-key-name { position: absolute; left: 0; right: 0; bottom: 4px; color: #6b6776; font: 600 9px/1 var(--mono); text-align: center; pointer-events: none; }

/* ---- Palettes and instruments ---- */
.ss-lib { display: flex; flex-direction: column; min-height: 0; padding: 8px 10px 20px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
.ss-lib-tabs { display: flex; margin-bottom: 4px; }
.ss-lib-tabs .seg-btn { flex: 1 1 0; }
.ss-pal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(46px, 1fr)); gap: 4px; padding-bottom: 10px; }
.ss-pal-btn { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; min-height: 46px; padding: 3px 2px; color: var(--text); background: var(--surface-2); border: 1px solid var(--border); border-radius: 0; font: inherit; cursor: pointer; transition: border-color 140ms ease, background 140ms ease; }
.ss-pal-btn:hover { border-color: var(--accent); }
.ss-pal-btn:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.ss-pal-btn:active { color: var(--bg); background: var(--gold); border-color: var(--gold); }
.ss-pal-btn small { color: var(--muted); font-size: 0.6rem; line-height: 1.1; }
.ss-pal-btn svg { display: block; }
.ss-pal-word { font: 600 0.86rem/1.1 "Times New Roman", Times, serif; white-space: nowrap; }
.ss-pal-word.is-it { font-style: italic; }
.ss-pal-word.is-small { font-size: 0.66rem; white-space: normal; text-align: center; }
.ss-pal-word.is-big { font-size: 1.2rem; }
.ss-pal-word.is-box { padding: 0 5px; border: 1.5px solid currentColor; }
.ss-pal-word.is-dim { color: var(--muted); font-family: inherit; font-weight: 400; font-size: 0.72rem; }
.ss-pal-word.is-key { font-size: 0.9rem; }
.ss-parts { margin: 6px 0 10px; padding: 0; list-style: none; }
.ss-part { display: flex; align-items: center; gap: 6px; padding: 6px 4px; border-bottom: 1px solid var(--border-soft, var(--border)); }
.ss-part-name { display: flex; flex-direction: column; flex: 1 1 auto; min-width: 0; }
.ss-part-name b { overflow: hidden; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.ss-part-name small { color: var(--muted); font-size: 0.72rem; }
.ss-part-btns { display: flex; flex: none; }
.ss-parts-box .st-select { width: 100%; }

/* ---- Settings ---- */
.ss-insp-what { margin: 0; color: var(--text); font-weight: 600; }
.ss-insp-arts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 8px; }
.ss-insp-btns { display: flex; flex-wrap: wrap; gap: 6px; }
.ss-insp-pair { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; }
.ss-insp-pair .vs-field-label { flex-basis: auto; }
.ss-insp-pair .st-num, .ss-insp-pair .st-select { min-width: 0; width: 100%; }
.ss-insp-text { flex: 1 1 auto; min-width: 0; padding: 4px 8px; font-size: 0.82rem; }
.ss-mix-row { display: flex; gap: 16px; margin: -2px 0 6px 86px; }

/* ---- Dialogs ---- */
.ss-dlg-form { display: flex; flex-direction: column; gap: 12px; min-width: min(420px, 80vw); }
.ss-dlg-form .vs-field-label { flex-basis: 90px; }
.ss-dlg-form .input { flex: 1 1 auto; min-width: 0; }
.ss-dlg-row { display: flex; align-items: center; gap: 8px; }
.ss-dlg-row .st-select { width: auto; }
.ss-export { display: flex; flex-direction: column; gap: 10px; }
.ss-export-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 6px; }
.ss-export-head { grid-column: 1 / -1; margin: 8px 0 0; color: var(--accent-strong); font-family: var(--mono); font-size: 0.64rem; letter-spacing: 0.08em; text-transform: uppercase; }
.ss-export-item { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 8px 10px; color: var(--text); background: var(--surface-2); border: 1px solid var(--border); border-radius: 0; font: inherit; text-align: left; cursor: pointer; }
.ss-export-item small { color: var(--muted); font-size: 0.74rem; line-height: 1.3; }
.ss-export-item.is-on { border-color: var(--accent-strong); box-shadow: inset 0 0 0 1px var(--accent-strong); }
.ss-export-item:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.ss-export-opts:empty { display: none; }
.ss-export-status:empty { display: none; }

/* ---- Phones ---- */
@media (max-width: 760px) {
  .ss-new .st-new-row > .st-field { flex: 1 1 40%; }
  .ss-new .ss-num, .ss-new .st-select, .ss-new-adds .st-select { width: 100%; min-width: 0; }
  .ss-work { grid-template-rows: auto auto minmax(0, 1fr) auto; }
  .ss-body { display: block; position: static; }
  .ss-main { height: 100%; }
  .ss-bar { gap: 4px; padding: 3px 6px; }
  .ss-tb { width: 36px; height: 36px; }
  .ss-zoom-box, #ss-rewind { display: none; }
  .ss-lib { display: none; }
  .vs-work[data-sheet="lib"] .ss-lib { display: flex; }
  .ss-pages { padding: 10px 8px 60px; gap: 12px; }
  .ss-msg { bottom: 8px; }
  .ss-keys { height: 84px; }
  .ss-work.has-keys .ss-msg { bottom: 92px; }
  .ss-mix-row { margin-left: 0; }
  #ss-help, #ss-max { display: none; }
}
@media (max-width: 760px) {
  /* Add matters more here than View: View's zoom has the pinch and its keyboard a button. */
  .ss-work .vs-menubtn:nth-child(3) { display: none; }
  .ss-work .vs-menubtn:nth-child(4) { display: inline-block; }
}
