/* The sequencer (src/sequencer.js): channel rack, piano roll and playlist in one panel above the bottom bar. */
#seq { position: fixed; left: 14px; right: 388px; bottom: calc(var(--views-h, 47px) + 14px); height: 0; display: flex; flex-direction: column; z-index: 3; overflow: hidden;
  transition: right 0.25s, height 0.25s; container-type: inline-size; background: linear-gradient(180deg, rgba(20, 23, 32, 0.96), rgba(12, 14, 20, 0.97)); }
#seq.resizing { transition: none; }
body.noside #seq { right: 14px; }
#seq[hidden] { display: none; }
body.seq #seq { height: var(--seq-h, 380px); }
body.seq.seqmax #seq { height: calc(100vh - 86px - var(--views-h, 47px) - 14px); }
body.seq #tester { bottom: calc(var(--views-h, 47px) + var(--seq-h, 380px) + 28px); }
body.seq.seqmax #tester { display: none; }

.sq-grip { position: absolute; top: 0; left: 0; right: 0; height: 6px; cursor: ns-resize; z-index: 8; }
.sq-grip::after { content: ''; position: absolute; left: 50%; top: 2px; width: 38px; height: 3px; margin-left: -19px; border-radius: 2px; background: rgba(255, 255, 255, 0.14); }
.sq-grip:hover::after { background: var(--accent); }

/* the toolbar */
.sq-bar { display: flex; flex-wrap: wrap; gap: 8px 10px; align-items: center; padding: 10px 12px 9px; border-bottom: 1px solid var(--line); background: rgba(255, 255, 255, 0.015); }
.sq-bar > * { flex-shrink: 0; }
.sq-bar .grow { flex: 1 1 0; }
.sq-bar button, .pr-bar button, .pl-bar button { height: 28px; padding: 0 10px; display: inline-flex; align-items: center; gap: 6px; font-size: 12px; }
.sq-bar button.ic, .pr-bar button.ic, .pl-bar button.ic { width: 28px; padding: 0; justify-content: center; }
button:disabled { opacity: 0.35; cursor: default; }
.sq-seg { display: inline-flex; background: rgba(0, 0, 0, 0.35); border: 1px solid var(--line); border-radius: 9px; padding: 2px; gap: 2px; }
.sq-seg button { border: 0; background: transparent; color: var(--dim); height: 24px; border-radius: 7px; }
.sq-seg button:hover { color: var(--text); background: rgba(255, 255, 255, 0.06); }
.sq-seg button.on { background: linear-gradient(180deg, #ffb43f, #f39612); color: #1a1205; font-weight: 600; box-shadow: 0 1px 6px rgba(255, 164, 28, 0.35); }
.sq-mode button { font-weight: 700; letter-spacing: 0.06em; font-size: 11px; padding: 0 10px; }
.sq-group { display: inline-flex; gap: 4px; }
.sq-pat { display: inline-flex; align-items: center; gap: 4px; padding: 2px 4px 2px 8px; border: 1px solid var(--line); border-radius: 9px; background: rgba(0, 0, 0, 0.25); }
.sq-pat select, .sq-rename { height: 26px; padding: 0 6px; width: 132px; border: 0; background: transparent; font-weight: 600; }
.sq-pat button { border: 0; background: transparent; color: var(--dim); }
.sq-pat button:hover { color: var(--text); background: rgba(255, 255, 255, 0.08); }
.sq-swatch { width: 10px; height: 10px; border-radius: 3px; box-shadow: 0 0 8px currentColor; }
.sq-field { display: inline-flex; align-items: center; gap: 6px; }
.sq-field > span { color: var(--dim); font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.08em; font-weight: 600; cursor: default; }
.sq-field:first-of-type > span { cursor: ns-resize; }
.sq-tempo { width: 58px; height: 28px; padding: 0 6px; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--accent); background: rgba(0, 0, 0, 0.35); }
.sq-swing { width: 70px; }
.sq-field select { height: 28px; padding: 0 6px; }
.sq-bar .s-add { position: relative; flex: 0 1 200px; min-width: 130px; }
.sq-bar .s-add input { width: 100%; height: 28px; }
.s-pop { position: absolute; top: calc(100% + 4px); left: 0; width: 300px; max-height: 260px; overflow-y: auto; padding: 4px; z-index: 12; background: rgba(13, 15, 22, 0.97); }
@container (max-width: 1150px) { .sq-views button span { display: none; } .sq-views button { padding: 0 8px; } }
@container (max-width: 900px) { .sq-bar [data-a=demo], .sq-bar [data-a=clear] { display: none; } }

.sq-main { flex: 1; min-height: 0; position: relative; }
.sq-main > div { position: absolute; inset: 0; display: flex; flex-direction: column; }
.sq-main > div[hidden] { display: none; }
.sq-foot { display: flex; gap: 16px; justify-content: space-between; padding: 5px 12px 6px; border-top: 1px solid var(--line); color: var(--dim); font-size: 11px; white-space: nowrap; overflow: hidden; }
.sq-foot span:first-child { overflow: hidden; text-overflow: ellipsis; }
.s-empty { color: var(--dim); padding: 30px; text-align: center; }

/* channel rack */
.sq-rack { overflow: auto; }
.rk-grid { min-width: max-content; position: relative; padding-bottom: 10px; }
.rk-ruler { display: flex; position: sticky; top: 0; z-index: 4; background: #10131b; border-bottom: 1px solid var(--line); height: 22px; }
.rk-corner { flex: 0 0 300px; position: sticky; left: 0; background: #10131b; z-index: 2; border-right: 1px solid var(--line); }
.rk-bars { display: flex; position: relative; padding-left: 8px; }
.rk-barno { color: #c8cfdd; font-size: 10.5px; font-weight: 600; padding: 4px 6px; border-left: 1px solid rgba(255, 255, 255, 0.22); box-sizing: border-box; }
.rk-head { position: absolute; left: 8px; top: 0; width: var(--cw); height: 100vh; background: linear-gradient(180deg, rgba(255, 164, 28, 0.55), rgba(255, 164, 28, 0.06) 22px, rgba(255, 164, 28, 0.06)); border-left: 2px solid var(--accent); pointer-events: none; display: none; z-index: 1; }
.rk-row, .rk-words { display: flex; align-items: center; min-height: 36px; border-bottom: 1px solid rgba(255, 255, 255, 0.035); }
.rk-row.cur { background: rgba(255, 255, 255, 0.025); }
.rk-h { flex: 0 0 300px; position: sticky; left: 0; z-index: 3; display: flex; gap: 6px; align-items: center; padding: 0 8px 0 10px; height: 36px; background: #121620; border-right: 1px solid var(--line); }
.rk-row.cur .rk-h { background: #171c28; box-shadow: inset 3px 0 0 var(--c); }
.rk-h .ic { width: 24px; height: 24px; padding: 0; display: inline-flex; align-items: center; justify-content: center; border: 0; background: transparent; color: #6f7890; border-radius: 6px; }
.rk-h .ic:hover { color: var(--text); background: rgba(255, 255, 255, 0.08); }
.rk-del:hover { color: #ff8a70 !important; }
.led { width: 12px; height: 12px; padding: 0; border-radius: 50%; border: 1px solid rgba(0, 0, 0, 0.6); background: #2a2e38; box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.6); }
.led.m.on { background: radial-gradient(circle at 35% 35%, #c6ff9a, #47c82b); box-shadow: 0 0 7px rgba(90, 230, 60, 0.7); }
.led.s.on { background: radial-gradient(circle at 35% 35%, #ffe39a, #ffa41c); box-shadow: 0 0 7px rgba(255, 164, 28, 0.8); }
.led:hover { transform: scale(1.15); }
.knob { width: 22px; height: 22px; cursor: ns-resize; flex: 0 0 22px; touch-action: none; }
.knob svg { display: block; }
.kb-track { stroke: rgba(255, 255, 255, 0.12); stroke-width: 2.6; fill: none; stroke-linecap: round; }
.kb-val { stroke: var(--c, var(--accent)); stroke-width: 2.6; fill: none; stroke-linecap: round; }
.kb-cap { fill: #2a2f3b; stroke: rgba(0, 0, 0, 0.5); }
.kb-ptr { stroke: #e9edf5; stroke-width: 1.6; stroke-linecap: round; }
.rk-name { flex: 1; min-width: 0; height: 26px; display: flex; align-items: center; gap: 8px; padding: 0 10px; border-radius: 7px; text-align: left;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.025)); border: 1px solid rgba(255, 255, 255, 0.08); font-weight: 500; }
.rk-name .dot { background: var(--c); box-shadow: 0 0 6px var(--c); }
.rk-name .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rk-row.cur .rk-name { border-color: var(--c); }
.rk-row.quiet .rk-steps, .rk-row.quiet .rk-name { opacity: 0.38; }
.rk-steps { display: flex; align-items: center; height: 36px; padding-left: 8px; touch-action: none; }
.st { width: calc(var(--cw) - 4px); height: 26px; margin-right: 4px; border-radius: 4px; position: relative; cursor: pointer; overflow: hidden;
  background: linear-gradient(180deg, #2b303c, #232832); box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.05); transition: transform 0.06s, filter 0.08s; }
.st.alt { background: linear-gradient(180deg, #3a2a2d, #2f2226); }
.st.bar { margin-left: 6px; }
.st:hover { filter: brightness(1.35); }
.st.on { background: linear-gradient(180deg, color-mix(in srgb, var(--c) 30%, #1a1d24), #15181e); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--c) 70%, transparent); }
.st.on::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: calc(var(--v, 0.8) * 100%); background: linear-gradient(180deg, color-mix(in srgb, var(--c) 100%, white 25%), var(--c)); box-shadow: 0 0 12px var(--c); }
.st.on::before { content: ''; position: absolute; left: 3px; right: 3px; height: 2px; border-radius: 1px; top: calc(3px + (1 - var(--p, 0.5)) * 18px); background: rgba(0, 0, 0, 0.55); z-index: 1; }
.st.tail { background: linear-gradient(180deg, color-mix(in srgb, var(--c) 30%, #20232b), color-mix(in srgb, var(--c) 18%, #191c22)); }
.st.hit { transform: scale(1.12); filter: brightness(1.7); }
.rk-words .rk-h .lbl { margin-left: auto; }
.rk-words input { margin: 4px 8px 5px 16px; height: 26px; padding: 0 10px; border-radius: 7px; }

/* piano roll and playlist: a canvas that fills the view and scrolls over a spacer the size of the content */
.pr-bar, .pl-bar { display: flex; gap: 8px; align-items: center; padding: 7px 12px; border-bottom: 1px solid var(--line); flex: 0 0 auto; }
.pr-bar .grow, .pl-bar .grow { flex: 1; }
.pr-chan { height: 28px; padding: 0 8px; max-width: 220px; font-weight: 600; }
.pr-info { color: var(--dim); font-size: 11.5px; }
.pr-words { width: min(380px, 40%); height: 28px; padding: 0 10px; }
.pr-wrap, .pl-wrap { flex: 1; min-height: 0; position: relative; }
.pr-vp, .pl-vp { position: absolute; inset: 0; overflow: auto; }
.pr-space, .pl-space { pointer-events: none; }
.pr-cv, .pl-cv { position: absolute; left: 0; top: 0; display: block; touch-action: none; }
.pl-pats { display: flex; gap: 6px; flex-wrap: wrap; }
.pl-pat { height: 26px !important; border-radius: 7px; gap: 7px !important; }
.pl-pat i { width: 9px; height: 9px; border-radius: 3px; background: hsl(var(--h) 70% 58%); }
.pl-pat small { color: var(--dim); }
.pl-pat.on { border-color: hsl(var(--h) 70% 58%); background: hsla(var(--h), 70%, 58%, 0.14); }

/* context menus */
.sq-ctx { position: fixed; z-index: 60; min-width: 220px; padding: 5px; background: rgba(16, 19, 27, 0.98); display: flex; flex-direction: column; animation: pk-in 0.1s ease-out; }
.sq-ctx button { display: flex; justify-content: space-between; gap: 22px; align-items: center; border: 0; background: transparent; text-align: left; padding: 6px 10px; border-radius: 6px; font-size: 12.5px; }
.sq-ctx button:hover:not(:disabled) { background: rgba(255, 164, 28, 0.16); color: #fff; }
.sq-ctx button.danger:hover { background: rgba(255, 90, 78, 0.2); }
.sq-ctx kbd { color: var(--dim); font: 11px "Segoe UI", system-ui, sans-serif; }
.sq-ctx hr { border: 0; border-top: 1px solid var(--line); margin: 4px 6px; }
.pr-menu { margin-right: 2px; }
