/* The song page's side panel (owner, 4 Dec 2026: "when we click on, say, bass, it would select it and maybe a sidebar can
   come out on the right"; Change sound, Effects, Notes and Export all open there, never away from the page).
   project.js spOpen / openExport, studio.js fxInto, notegrid.js openIn. One look for #drawer (a track) and #exDrawer (Export).
   1101 px and wider: beside the page (the page makes room, no backdrop); narrower: over the page from the right, ending
   above the page's player (project.js spPlace); phones: the whole width. */
:root { --sp-w: 440px; }

#drawer.drawer, #exDrawer.drawer { width: min(var(--sp-w), 100vw); background: var(--panel); border-left: 1px solid var(--line2);
  box-shadow: -18px 0 40px rgba(0, 0, 0, .45); }
#drawer[hidden], #exDrawer[hidden] { display: none !important; }

/* header: the part's icon, name and what it plays now; ‹ › and x */
.drawer .sp-head { flex: none; display: flex; align-items: center; justify-content: flex-start; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.sp-ic { flex: none; width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; background: var(--panel2); border: 1px solid var(--line2); color: var(--accent); }
.sp-ic svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.sp-ttl { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.drawer .sp-ttl h2 { margin: 0; font-size: 15px; font-weight: 600; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sp-sub { min-width: 0; min-height: 18px; display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; }
.sp-sub:empty { display: none; }
.sp-sub .sdo-sl { padding-left: 0; min-width: 0; }
.sp-sub .sdo-pill, .sp-sub .sdo-mpct { margin-left: 0; }
.sp-sub small { min-width: 0; font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; }
.sp-sub small.mine { color: #6ee9d6; }
.sp-hbtns { flex: none; display: flex; align-items: center; gap: 6px; }
.drawer .sp-nav, .drawer .sp-x { width: 32px; height: 32px; display: grid; place-items: center; padding: 0; border-radius: 8px; border: 1px solid var(--line2);
  background: transparent; color: var(--muted); cursor: pointer; }
.drawer .sp-nav:hover:not(:disabled), .drawer .sp-x:hover { color: var(--text); border-color: #3d4456; background: var(--panel2); }
.drawer .sp-nav:disabled { opacity: .35; cursor: default; }
.sp-nav svg, .sp-x svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* tabs: Change sound · Effects · Notes (only the ones the track has) */
.sp-tabs { flex: none; display: flex; gap: 22px; padding: 0 16px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.sp-tabs::-webkit-scrollbar { display: none; }
.sp-tabs:empty { display: none; }
.sp-tabs button { flex: none; background: none; border: 0; border-bottom: 2px solid transparent; border-radius: 0; margin-bottom: -1px; padding: 11px 0 10px;
  font: inherit; font-size: 13px; font-weight: 500; color: var(--muted); cursor: pointer; }
.sp-tabs button:hover { color: var(--text); }
.sp-tabs button.on { color: var(--text); border-bottom-color: var(--accent); }
.sp-tabs button:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

/* body */
#drawer .drawer-body { padding: 14px 16px 18px; gap: 12px; overscroll-behavior: contain; }
#drawer .drawer-foot:empty { display: none; }
.sp-wait { display: flex; align-items: center; gap: 10px; padding: 18px 2px; color: var(--muted); font-size: 13px; }
.sp-wait .spin { margin: 0; }

/* Change sound: the part's options (Needs better sounds) on top */
.sp-nb:empty { display: none; }
.sp-nb .nb-card { background: var(--bg); padding: 12px 12px 8px; }
.sp-nb .nb-ch b { font-size: 13px; }
.sp-nb .nb-opt { grid-template-columns: 32px minmax(0, 1fr) auto auto 82px; gap: 8px; }
.sp-nb span { color: var(--muted); font-size: 13px; }   /* as the card looked on the page (views.css .pk-notice rules) */
.sp-nb .nb-nm { display: flex; flex-direction: column; justify-content: center; gap: 1px; min-width: 0; color: var(--text); font-size: 13.5px; }
.sp-nb .nb-pct { font-size: 12px; font-variant-numeric: tabular-nums; text-align: right; min-width: 34px; }
.sp-nb .nb-opt .dz-inuse { color: var(--accent); font-size: 12px; text-align: center; }
.sp-nb .nb-opt .nb-now { color: var(--muted); font-size: 12px; text-align: center; }
.sp-nb .nb-busy { display: inline-flex; align-items: center; gap: 8px; color: var(--accent); font-size: 13px; font-weight: 600; }

/* Effects: the track's effects stacked to the panel's width */
#drawer .sp-fxw { display: flex; flex-direction: column; gap: 12px; }
#drawer .sp-fxw .sdo-fx { display: flex; flex-direction: column; gap: 12px; padding: 0; border-top: 0; background: none; }
#drawer .sp-fxw .sdo-fxcol { gap: 12px; }
#drawer .sp-fxw .sdo-fx > section, #drawer .sp-fxw .sdo-fxbox, #drawer .sp-fxw .sdo-fxcol > .btn { width: 100%; box-sizing: border-box; }
#drawer .sp-fxw .sdo-bfx { grid-template-columns: minmax(0, 1fr); gap: 14px; margin: 0; padding: 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel2); }
#drawer .sp-fxw .sdo-bfx > .btn { justify-self: start; }
#drawer .sp-fxw .sdo-param { grid-template-columns: 84px minmax(0, 1fr) 66px; }
#drawer .sp-fxw .sp-mix { gap: 8px; }

/* Notes: the grid fills the panel */
#drawer[data-tab="notes"] .drawer-body { padding: 10px 12px 12px; }

/* Export: the same header, the choices edge to edge */
#exDrawer .sp-ic { color: var(--accent); }

/* the open track's row, lit like the mock-up; rows open the panel */
.sdo-brow[data-row], .sdo-trow[data-row] { cursor: pointer; }
.sdo-brow.sp-sel { background: #112022; border-color: var(--acb, rgba(0, 220, 196, .4)); box-shadow: inset 3px 0 0 var(--accent); }
.sdo-trow.sp-sel { background: #112022; box-shadow: inset 3px 0 0 var(--accent); }
.sdo-trow.sp-sel.off, .sdo-brow.sp-sel.off { opacity: .8; }
.sdo-pen.on, .ng-tog.on { background: var(--accent); border-color: var(--accent); color: #0b0d14; }

/* Needs better sounds on the page: one short line per part, it opens the part's options in the panel */
.pk-notice > .nb-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; padding: 0 16px; }
.nb-item { display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; align-items: center; gap: 10px; min-width: 0; padding: 9px 10px 9px 12px; text-align: left;
  background: var(--bg); border: 1px solid var(--line); border-radius: 10px; color: var(--text); font: inherit; cursor: pointer; }
.nb-item:hover { border-color: #3d4456; }
.nb-item.on { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); background: #0f1718; }
.nb-item .ricon { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 8px; background: var(--panel2); }
.nb-item .ricon svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.nb-it { display: flex; flex-direction: column; min-width: 0; }
.pk-notice .nb-it b { font-size: 13.5px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pk-notice .nb-it small { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pk-notice .nb-go { display: inline-flex; align-items: center; gap: 2px; font-size: 12px; font-weight: 600; color: var(--accent); white-space: nowrap; }
.nb-go svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.pk-notice .nb-item.on .nb-go { color: var(--text); }
@media (max-width: 760px) { .pk-notice > .nb-list { grid-template-columns: minmax(0, 1fr); padding: 0 12px; } }

/* 1101 px and wider: the panel sits beside the page, full height; the page and its fixed footers make room */
@media (min-width: 1101px) {
  #drawer.drawer, #exDrawer.drawer { box-shadow: none; }
  #main:has(> .drawer:not([hidden])) { padding-right: calc(var(--sp-w) + 24px); }
  #main:has(> .drawer:not([hidden])) .sdo-transport, #main:has(> .drawer:not([hidden])) .nbf,
  #main:has(> .drawer:not([hidden])) #transport, #main:has(> .drawer:not([hidden])) #arrFoot { right: var(--sp-w); }
  #main:has(> .drawer:not([hidden])) .nb-applybar { right: calc(var(--sp-w) + 16px); }
  /* Pro: pan and the sends are in the panel's Effects tab while it is open */
  #main:has(> .drawer:not([hidden])) .sdo-row > :nth-child(4), #main:has(> .drawer:not([hidden])) .sdo-row > :nth-child(5),
  #main:has(> .drawer:not([hidden])) .sdo-row > :nth-child(6) { display: none; }
  #main:has(> .drawer:not([hidden])) .sdo-row { grid-template-columns: minmax(150px, 2fr) 64px minmax(110px, 1fr) 130px 44px; }
  #main:has(> .drawer:not([hidden])) .sdo-brow { grid-template-columns: 22px minmax(120px, 1.2fr) 66px minmax(120px, 1.4fr) 116px; gap: 10px; }
}
/* narrow desktops: each row takes two lines (name, mute / solo and the buttons; the fader under them) */
@media (min-width: 1101px) and (max-width: 1399px) {
  #main:has(> .drawer:not([hidden])) .sdo-headrow { display: none; }
  #main:has(> .drawer:not([hidden])) .sdo-row { grid-template-columns: minmax(0, 1fr) auto auto; gap: 6px 10px; }
  #main:has(> .drawer:not([hidden])) .sdo-row > :nth-child(1) { grid-column: 1; grid-row: 1; }
  #main:has(> .drawer:not([hidden])) .sdo-row > :nth-child(2) { grid-column: 2; grid-row: 1; }
  #main:has(> .drawer:not([hidden])) .sdo-row > :nth-child(7) { grid-column: 3; grid-row: 1; }
  #main:has(> .drawer:not([hidden])) .sdo-row > :nth-child(3) { grid-column: 1 / -1; grid-row: 2; }
  #main:has(> .drawer:not([hidden])) .sdo-row > :nth-child(8) { display: none; }
  #main:has(> .drawer:not([hidden])) .sdo-brow { grid-template-columns: 22px minmax(0, 1fr) auto auto; grid-template-areas: "ic name ms acts" "vol vol vol vol"; gap: 6px 10px; }
  #main:has(> .drawer:not([hidden])) .sdo-brow > .ricon { grid-area: ic; }
  #main:has(> .drawer:not([hidden])) .sdo-brow > .sdo-bname { grid-area: name; }
  #main:has(> .drawer:not([hidden])) .sdo-brow > .sdo-ms { grid-area: ms; }
  #main:has(> .drawer:not([hidden])) .sdo-brow > .sdo-vol { grid-area: vol; }
  #main:has(> .drawer:not([hidden])) .sdo-brow > .sdo-bacts { grid-area: acts; }
  #main:has(> .drawer:not([hidden])) .nb-list { grid-template-columns: minmax(0, 1fr); }
  #main:has(> .drawer:not([hidden])) .nbf { padding: 8px 16px 10px; grid-template-columns: auto minmax(0, 1fr) auto auto;
    grid-template-areas: "play what time x" "hear hear dim dim" "wave wave wave wave"; }
  #main:has(> .drawer:not([hidden])) .nbf-hear { justify-self: start; }
}

/* Basic rows between phone and desktop: the buttons' column as wide as Effects + the pen (it was 240 px: 11 px of
   sideways scroll at 1000 px, before the panel) */
@media (min-width: 761px) and (max-width: 1100px) {
  .sdo-brow { grid-template-columns: 26px minmax(130px, 1.2fr) 66px minmax(150px, 1.6fr) 116px; }
}
/* narrower: over the page from the right (no backdrop: the rows on the left stay clickable) */
@media (max-width: 1100px) {
  #drawer.drawer, #exDrawer.drawer { z-index: 41; }
}
/* phones: the whole width, above the player and the tab bar */
@media (max-width: 760px) {
  #drawer.drawer, #exDrawer.drawer { width: 100vw; left: 0; border-left: 0; box-shadow: none; }
  .drawer .sp-head { padding: 12px 12px; gap: 8px; }
  .sp-tabs { padding: 0 12px; gap: 18px; }
  #drawer .drawer-body { padding: 12px 12px 16px; }
  .sp-nb .nb-opt { grid-template-columns: 32px minmax(0, 1fr) auto 76px; }
  .sp-nb .nb-opt .nb-pct { display: none; }
}
