/* Tonic — arrangement timeline */

.tl { flex: none; display: flex; flex-direction: column; background: var(--panel); border-bottom: 1px solid var(--line); position: relative; z-index: 3; }
.tl-head { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-bottom: 1px solid var(--line); background: var(--panel); }
.ci-wrap { position: relative; display: flex; align-items: center; gap: 9px; width: min(440px, 52%); height: 32px; padding: 0 10px; border-radius: 9px; background: var(--panel-3); color: var(--muted); border: 1px solid transparent; transition: background .16s, border-color .16s, box-shadow .16s, color .16s; }
.ci-wrap:hover { background: var(--panel-2); border-color: var(--line); }
.ci-wrap:focus-within { background: var(--panel); border-color: var(--accent); box-shadow: var(--ring); color: var(--accent); }
.ci-wrap.ok { border-color: color-mix(in srgb, var(--ok) 55%, transparent); }
.ci-wrap.bad { border-color: var(--bad); }
.ci { flex: 1; min-width: 0; height: 30px !important; padding: 0 !important; background: none !important; border: 0 !important; box-shadow: none !important; font-weight: 600; color: var(--ink); }
.ci-count { font: 700 11px/1 var(--mono); color: var(--ok); min-width: 0; }
.ci-wrap.bad .ci-count { color: var(--bad); }
.tl-head .snap { width: 112px; height: 30px; font-size: 12px; font-weight: 700; }
.tl-zoom { display: flex; }

.tl-scroll { overflow-x: auto; overflow-y: hidden; position: relative; scrollbar-gutter: stable; }
.tl-inner { position: relative; min-width: 100%; }
.tl-row { display: flex; position: relative; }
.tl-gutter { position: sticky; left: 0; z-index: 6; flex: none; width: var(--gutter); background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; justify-content: center; padding: 0 10px; gap: 1px; }
.tl-gutter b { font: 800 9px/1 var(--sans); letter-spacing: .07em; text-transform: uppercase; color: var(--ink-2); white-space: nowrap; }
.tl-gutter small { font-size: 10px; color: var(--muted); font-weight: 600; }
.tl-track { position: relative; flex: none; }

/* ruler */
.rl-row .tl-gutter { background: var(--panel-2); }
.rl-track {
  height: 30px; cursor: pointer; background-color: var(--panel-2);
  background-image: linear-gradient(to right, var(--roll-bar) 1px, transparent 1px), linear-gradient(to right, var(--roll-beat) 1px, transparent 1px);
  background-size: var(--bar) 100%, var(--beat) 9px; background-position: 0 0, 0 100%; background-repeat: repeat-x, repeat-x;
}
.rl-track:hover { background-color: color-mix(in srgb, var(--accent) 4%, var(--panel-2)); }
.rl-num { position: absolute; top: 7px; padding-left: 6px; font: 500 11px/1 var(--mono); color: var(--muted); pointer-events: none; user-select: none; }
.rl-num.major { color: var(--ink-2); font-weight: 500; }
.rl-loop { position: absolute; top: 0; bottom: 0; pointer-events: none; background: color-mix(in srgb, var(--accent) 7%, transparent); border-top: 3px solid color-mix(in srgb, var(--accent) 30%, transparent); transition: left .25s var(--ease-out), width .25s var(--ease-out); }
.rl-loop.brace { pointer-events: auto; cursor: grab; background: color-mix(in srgb, var(--accent) 17%, transparent); border-top-color: var(--accent); }
.rl-loop.tmp { background: color-mix(in srgb, var(--accent) 22%, transparent); border-top-color: var(--accent); transition: none; }
.rl-loop .lh { position: absolute; top: 0; bottom: 0; width: 9px; cursor: ew-resize; }
.rl-loop .lh.l { left: 0; } .rl-loop .lh.r { right: 0; }
.rl-loop .lh::after { content: ""; position: absolute; top: 5px; bottom: 5px; width: 3px; border-radius: 2px; background: var(--accent); left: 2px; opacity: 0; transition: opacity .15s; }
.rl-loop .lh.r::after { left: auto; right: 2px; } .rl-loop.brace:hover .lh::after { opacity: .9; }

/* sections */
.sec-row .tl-gutter { background: var(--panel); }
.sec-track { height: 28px; background-image: linear-gradient(to right, var(--roll-grid) 1px, transparent 1px); background-size: var(--bar) 100%; background-repeat: repeat-x; border-bottom: 1px solid var(--line); }
.sec-block {
  position: absolute; top: 4px; bottom: 4px; display: flex; align-items: center; padding: 0 12px; border-radius: 7px; cursor: grab; overflow: hidden; user-select: none;
  background: color-mix(in srgb, var(--c) 15%, var(--panel)); box-shadow: inset 3px 0 0 var(--c); transition: left .25s var(--ease-out), width .25s var(--ease-out), background .15s;
}
.sec-block:hover { background: color-mix(in srgb, var(--c) 24%, var(--panel)); }
.sec-name { font: 800 11px/1 var(--sans); letter-spacing: .02em; color: color-mix(in srgb, var(--c) 78%, var(--ink)); white-space: nowrap; }
.sec-h { position: absolute; top: 0; bottom: 0; width: 8px; cursor: ew-resize; z-index: 2; }
.sec-h.l { left: 0; } .sec-h.r { right: 0; }
.sec-track:active .sec-block { transition: none; }
.swatches { display: flex; gap: 10px; }
.swatch { width: 28px; height: 28px; border-radius: 50%; background: var(--c); box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .35); transition: transform .15s var(--ease-spring); }
.swatch:hover { transform: scale(1.12); } .swatch.on { outline: 2px solid var(--c); outline-offset: 3px; }
.stack { display: grid; gap: 14px; }

/* chord lane */
.lane-row .tl-gutter { background: var(--panel); }
.lane-track {
  height: 108px; outline: none;
  background-image: linear-gradient(to right, var(--roll-bar) 1px, transparent 1px), linear-gradient(to right, var(--roll-grid) 1px, transparent 1px);
  background-size: var(--bar) 100%, var(--beat) 100%; background-repeat: repeat-x;
}
.chord {
  position: absolute; top: 9px; bottom: 9px; padding: 10px 11px 0; border-radius: 11px; cursor: grab; overflow: hidden; container-type: inline-size; user-select: none; touch-action: none;
  background: linear-gradient(180deg, color-mix(in srgb, var(--c) 13%, var(--panel)), var(--panel) 72%); border: 1px solid color-mix(in srgb, var(--c) 28%, var(--line-2));
  box-shadow: var(--shadow-xs); transition: left .28s var(--ease-out), width .28s var(--ease-out), box-shadow .2s, background .2s, opacity .3s, transform .3s var(--ease-out), border-color .2s;
}
.chord:hover { box-shadow: var(--shadow-sm); border-color: color-mix(in srgb, var(--c) 55%, var(--line-2)); }
.chord:active { cursor: grabbing; }
.chord.sel { z-index: 3; border-color: var(--c); box-shadow: 0 0 0 2px var(--c), var(--shadow-md); background: linear-gradient(180deg, color-mix(in srgb, var(--c) 24%, var(--panel)), color-mix(in srgb, var(--c) 8%, var(--panel)) 80%); }
.chord.now::before { content: ""; position: absolute; inset: 0; background: color-mix(in srgb, var(--c) 18%, transparent); pointer-events: none; animation: now-pulse 1.8s ease-in-out infinite; }
.chord.now { box-shadow: 0 0 0 2px var(--c), 0 0 26px -4px var(--c); }
.chord.born { opacity: 0; transform: translateY(8px) scale(.94); }
.chord.gone { opacity: 0; transform: scale(.92); pointer-events: none; }
.lane-track.dragging .chord { transition: box-shadow .2s, background .2s; }
.lane-track.dragging { cursor: grabbing; }
@keyframes now-pulse { 50% { opacity: .45; } }
.ch-stripe { position: absolute; left: 0; right: 0; top: 0; height: 3px; background: var(--c); }
.ch-name { display: flex; align-items: baseline; gap: 1px; line-height: 1; white-space: nowrap; }
.ch-root { font: 800 23px/1 var(--sans); letter-spacing: -.035em; }
.ch-q { font: 700 14px/1 var(--sans); color: var(--ink-2); letter-spacing: -.02em; }
.ch-bass { font: 700 13px/1 var(--sans); color: var(--muted); margin-left: 2px; }
.ch-roman { margin-top: 7px; font: 500 11.5px/1 var(--mono); color: color-mix(in srgb, var(--c) 82%, var(--ink)); white-space: nowrap; }
.ch-notes { margin-top: 5px; font: 600 10.5px/1 var(--sans); color: var(--muted); white-space: nowrap; letter-spacing: .01em; }
.ch-ten { position: absolute; left: 11px; right: 11px; bottom: 8px; height: 3px; border-radius: 2px; background: var(--line); overflow: hidden; pointer-events: none; }
.ch-ten i { display: block; height: 100%; width: 100%; border-radius: 2px; transform-origin: left; transform: scaleX(calc(.1 + var(--t, .3) * .9)); background: color-mix(in srgb, var(--f-D) calc(var(--t, .3) * 100%), var(--f-S)); transition: transform .45s var(--ease-out), background .45s; }
.ch-h { position: absolute; top: 0; bottom: 0; width: 11px; z-index: 2; cursor: ew-resize; }
.ch-h.l { left: 0; } .ch-h.r { right: 0; }
.ch-h::after { content: ""; position: absolute; top: calc(50% - 11px); height: 22px; width: 3px; border-radius: 3px; background: var(--c); opacity: 0; transition: opacity .15s; left: 3px; }
.ch-h.r::after { left: auto; right: 3px; }
.chord:hover .ch-h::after, .chord.sel .ch-h::after { opacity: .55; }
.ch-h:hover::after { opacity: 1 !important; }
@container (max-width: 96px) { .ch-notes { display: none; } }
@container (max-width: 62px) { .ch-roman { display: none; } .ch-root { font-size: 18px; } .ch-q { font-size: 11px; } .ch-bass { display: none; } }

.tl-empty { position: absolute; left: 12px; top: 10px; bottom: 10px; width: min(560px, calc(100% - 24px)); display: grid; place-items: center; text-align: center; border: 1.5px dashed var(--line-2); border-radius: 13px; color: var(--muted); pointer-events: none; }
.tl-empty > div { display: grid; gap: 4px; justify-items: center; }
.tl-empty .ico { color: var(--accent); margin-bottom: 4px; }
.tl-empty b { color: var(--ink-2); font-size: 13px; }
.tl-empty span { font-size: 12px; max-width: 290px; }

.tl-playhead { position: absolute; top: 0; bottom: 0; left: 0; width: 0; z-index: 5; pointer-events: none; will-change: transform; }
.tl-playhead i { position: absolute; top: 0; bottom: 0; left: -1px; width: 2px; background: var(--accent); box-shadow: 0 0 12px color-mix(in srgb, var(--accent) 70%, transparent); border-radius: 2px; }
.tl-playhead i::before { content: ""; position: absolute; top: 0; left: -5px; border: 6px solid transparent; border-top: 8px solid var(--accent); border-bottom: 0; }

.drop-line { position: absolute; top: 4px; bottom: 4px; width: 2px; margin-left: -1px; border-radius: 2px; background: var(--accent); box-shadow: 0 0 14px var(--accent); pointer-events: none; z-index: 4; }
.drop-ghost { position: absolute; top: 9px; bottom: 9px; border-radius: 11px; border: 1.5px dashed var(--accent); background: var(--accent-ghost); pointer-events: none; z-index: 1; }
.drop-ghost.insert { border-style: solid; }
.marquee { position: absolute; top: 5px; bottom: 5px; background: var(--accent-ghost); border: 1px solid var(--accent); border-radius: 6px; pointer-events: none; z-index: 4; }

/* quick-add popover */
.qa { width: 340px; padding: 14px 14px 12px; }
.qa-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; }
.qa-head b { font-weight: 800; font-size: 13px; letter-spacing: -.01em; }
.qa-head span { font: 500 11px var(--mono); color: var(--muted); }
.qa-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.qa-tile { display: flex; flex-direction: column; gap: 3px; align-items: center; padding: 8px 4px 9px; border-radius: 10px; background: var(--panel-3); border-top: 3px solid var(--c); transition: background .15s, transform .15s var(--ease-out); }
.qa-tile:hover { background: color-mix(in srgb, var(--c) 16%, var(--panel)); transform: translateY(-2px); }
.qa-tile small { font: 500 10.5px var(--mono); color: var(--muted); }
.qa-tile b { font-weight: 800; font-size: 14px; letter-spacing: -.02em; }
.qa-foot { margin-top: 10px; font-size: 11px; color: var(--muted); font-weight: 600; }
