/* cf-tracks.css: the phone editor's track timeline (task 434, owner's spec 2026-11-11). Loaded last on beat-editor.html,
 * everything scoped to .app.cft (set by cf-tracks.js), so ?oldtl=1 shows the previous layout untouched.
 * Rows (px): ruler 24 · cuts, captions, transitions, song 40 each · clips 52, 4 px apart. The left column and the
 * row bands use the same numbers. */
.app.cft {
  --cft-bg: #0b0b0e;
  --cft-row: #15151a;
  --cft-ink: #f4f5f8;
  --cft-ink2: rgba(244, 245, 248, .62);
  --cft-cut: #e04bd6;
  --cft-cap: #6b3df5;
  --cft-tx: #ef3b3b;
  --cft-song: #d9264f;
  --cft-handle: #f6c21c;
  background: var(--cft-bg) !important;
}
html.cft-on body { background: #0b0b0e; }

/* ---------- top bar ---------- */
.app.cft .hdr { display: flex !important; align-items: center; gap: 6px !important; background: var(--cft-bg) !important; padding: calc(env(safe-area-inset-top, 0px) + 6px) 10px 6px 6px !important; }
.app.cft .hdr > * { flex-shrink: 0; }
.app.cft .hdr-close { width: 44px !important; height: 44px !important; background: transparent !important; box-shadow: none !important; color: var(--cft-ink) !important; }
.app.cft .hdr-close svg { width: 22px; height: 22px; }
.app.cft .cft-name { flex: 1 1 auto !important; min-width: 0; height: 44px; display: inline-flex; align-items: center; gap: 4px; padding: 0 6px; border: 0; background: transparent; color: var(--cft-ink); font: 600 17px/1.2 -apple-system, BlinkMacSystemFont, "SF Pro Text", Inter, system-ui, sans-serif; letter-spacing: -.01em; cursor: pointer; text-align: left; border-radius: 10px; }
.app.cft .cft-name-t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.app.cft .cft-name svg { flex: 0 0 auto; opacity: .8; }
.app.cft .cft-name:active { background: rgba(255, 255, 255, .06); }
.app.cft .cft-aspect { height: 36px; min-width: 44px; display: inline-flex; align-items: center; gap: 7px; padding: 0 12px; border: 0; border-radius: 10px; background: rgba(255, 255, 255, .08); color: var(--cft-ink); font: 600 14px/1 -apple-system, BlinkMacSystemFont, Inter, system-ui, sans-serif; cursor: pointer; box-shadow: inset 0 0 0 .5px rgba(255, 255, 255, .12), inset 0 1px 0 rgba(255, 255, 255, .08); -webkit-backdrop-filter: blur(16px) saturate(160%); backdrop-filter: blur(16px) saturate(160%); }
.app.cft .cft-aspect::after { content: ""; position: absolute; inset: -4px 0; }
.app.cft .cft-aspect { position: relative; }
.app.cft .cft-aspect-i { width: 11px; height: 17px; border: 1.8px solid currentColor; border-radius: 3px; box-sizing: border-box; }
.app.cft .cft-aspect-i.is-h { width: 17px; height: 11px; }
html body #app.cft #btnExport, .app.cft .hdr-export { height: 36px !important; padding: 0 14px !important; border-radius: 12px !important; background: #fff !important; background-image: none !important; color: #0b0b0e !important; font: 700 15px/1 -apple-system, BlinkMacSystemFont, Inter, system-ui, sans-serif !important; gap: 7px !important; box-shadow: 0 1px 0 rgba(255, 255, 255, .25), 0 6px 16px rgba(0, 0, 0, .35) !important; border: 0 !important; position: relative; }
.app.cft .hdr-export::after { content: ""; position: absolute; inset: -4px -2px; }
html body #app.cft #btnExport svg { color: #0b0b0e; }
html body #app.cft #btnExport[disabled] { opacity: .38 !important; background: #fff !important; color: #0b0b0e !important; }
html body #app.cft #btnExport:not([disabled]):hover { background: #e9eaee !important; }

/* ---------- preview ---------- */
.app.cft .stage-wrap { position: relative; padding: 6px 12px 22px !important; }
.app.cft .stage { border-radius: 14px !important; }
.app.cft .cft-collapse { position: absolute; left: 50%; bottom: 0; transform: translateX(-50%); width: 56px; height: 24px; border: 0; background: transparent; color: rgba(255, 255, 255, .78); display: grid; place-items: center; cursor: pointer; padding: 0; }
.app.cft .cft-collapse::after { content: ""; position: absolute; inset: -10px -4px; }
.app.cft .cft-collapse svg { width: 26px; height: 26px; transition: transform .25s ease; }
.app.cft.cft-mini .cft-collapse svg { transform: rotate(180deg); }
.app.cft.cft-mini .stage-wrap { flex: 0 0 26vh !important; max-height: 26vh; }
.app.cft .cft-fs { position: absolute; top: 8px; right: 8px; z-index: 6; width: 36px !important; height: 36px !important; border-radius: 12px !important; background: rgba(12, 12, 16, .45) !important; color: #fff !important; -webkit-backdrop-filter: blur(14px) saturate(160%); backdrop-filter: blur(14px) saturate(160%); box-shadow: inset 0 0 0 .5px rgba(255, 255, 255, .18); }
.app.cft .cft-fs::after { content: ""; position: absolute; inset: -4px; }

/* ---------- transport: play · time over total · undo redo ---------- */
.app.cft .transport { display: grid !important; grid-template-columns: 1fr auto 1fr !important; align-items: center; padding: 2px 8px 4px !important; gap: 0 !important; }
.app.cft .transport .t-time { display: none !important; }
.app.cft .transport #btnPrimary { grid-column: 1; justify-self: start; width: 48px !important; height: 44px !important; border-radius: 12px !important; background: transparent !important; background-image: none !important; box-shadow: none !important; color: #fff !important; }
.app.cft .transport #btnPrimary svg { width: 26px; height: 26px; }
.app.cft .transport #btnPrimary[data-state="analyze"] { width: auto !important; padding: 0 14px !important; background: #fff !important; color: #0b0b0e !important; }
.app.cft .transport #btnPrimary[data-state="disabled"] { color: rgba(255, 255, 255, .3) !important; }
.app.cft .transport .t-right { display: none !important; }
.app.cft .cft-time { grid-column: 2; display: flex; flex-direction: column; align-items: center; gap: 2px; font: 500 14px/1.15 "SF Mono", "JetBrains Mono", ui-monospace, Menlo, monospace; font-variant-numeric: tabular-nums; color: var(--cft-ink); letter-spacing: .02em; }
.app.cft .cft-time .cft-tot { color: var(--cft-ink2); }
.app.cft .cft-ur { grid-column: 3; justify-self: end; display: flex; gap: 4px; }
.app.cft .cft-ur button { width: 44px; height: 44px; border: 0; border-radius: 12px; background: transparent; color: var(--cft-ink); display: grid; place-items: center; cursor: pointer; padding: 0; }
.app.cft .cft-ur button:disabled { color: rgba(255, 255, 255, .28); cursor: default; }
.app.cft .cft-ur button:not(:disabled):active { background: rgba(255, 255, 255, .08); }

/* ---------- the tracks ---------- */
.app.cft .tl-wrap { padding: 0 0 6px !important; background: var(--cft-bg); }
.app.cft .tl-rail { position: relative; cursor: grab; }
.app.cft .tl-rail.is-scrubbing { cursor: grabbing; }
.app.cft .tl-rail-scroll { position: relative; z-index: 1; }
.app.cft .tl-rail-track { min-height: 0 !important; gap: 8px !important; align-items: flex-start !important; padding-top: 0 !important; padding-bottom: 0 !important; }
.app.cft .tl-timed { display: flex; flex-direction: column; }
/* ruler */
.app.cft .tl-ticks { height: 24px !important; border-bottom: 0 !important; order: 0; }
.app.cft .tl-ticks .tick { height: 7px; width: 2px; border-radius: 1px; background: rgba(255, 255, 255, .32); bottom: 4px; }
.app.cft .tl-ticks .tick.sec { height: 3px; width: 3px; border-radius: 50%; background: rgba(255, 255, 255, .55); bottom: 2px; }
.app.cft .tl-ticks .tick.sec b { bottom: 8px !important; font: 500 12px/1 "SF Mono", "JetBrains Mono", ui-monospace, monospace !important; color: rgba(255, 255, 255, .62) !important; }
/* rows */
.app.cft .cft-row { position: relative; margin-top: 4px; flex: 0 0 auto; }
.app.cft .cft-beats { height: 40px; order: 1; }
.app.cft .cft-caps { height: 40px; order: 2; }
.app.cft .cft-fx { height: 40px; order: 3; }
.app.cft .tl-audio.cft-music { order: 4; }
.app.cft .tl-strip { order: 5; }
.app.cft .cft-beat { position: absolute; top: 13px; bottom: 13px; width: 2px; margin-left: -1px; border-radius: 1px; background: rgba(224, 75, 214, .28); }
.app.cft .cft-cut { position: absolute; top: 6px; bottom: 6px; width: 4px; margin-left: -2px; border-radius: 2px; background: var(--cft-cut); box-shadow: 0 0 10px rgba(224, 75, 214, .45); }
.app.cft .cft-cap { position: absolute; top: 3px; height: 34px; min-width: 6px; padding: 0 8px; border: 0; border-radius: 6px; background: var(--cft-cap); color: #fff; font: 600 13px/34px -apple-system, BlinkMacSystemFont, Inter, system-ui, sans-serif; text-align: left; overflow: hidden; white-space: nowrap; cursor: pointer; box-sizing: border-box; box-shadow: inset -1px 0 0 rgba(0, 0, 0, .35); }
.app.cft .cft-cap span { display: block; overflow: hidden; text-overflow: ellipsis; }
.app.cft .cft-cap.off { background: rgba(107, 61, 245, .32); color: rgba(255, 255, 255, .55); }
.app.cft .cft-capadd { position: absolute; left: 0; top: 3px; height: 34px; padding: 0 12px; border: 1px dashed rgba(255, 255, 255, .25); border-radius: 8px; background: rgba(255, 255, 255, .03); color: rgba(255, 255, 255, .7); font: 600 13px/1 -apple-system, BlinkMacSystemFont, Inter, system-ui, sans-serif; cursor: pointer; white-space: nowrap; }
.app.cft .cft-tx { position: absolute; top: 6px; bottom: 6px; width: 7px; margin-left: -3.5px; padding: 0; border: 0; border-radius: 3px; background: var(--cft-tx); cursor: pointer; }
.app.cft .cft-tx::after { content: ""; position: absolute; inset: -6px -10px; }
.app.cft .cft-fxband { position: absolute; left: 0; right: 0; top: 15px; height: 10px; border-radius: 5px; background: rgba(239, 59, 59, .22); }
.app.cft .cft-fxband span { position: absolute; left: 6px; top: -2px; font: 600 11px/14px -apple-system, BlinkMacSystemFont, Inter, system-ui, sans-serif; color: rgba(255, 190, 190, .9); text-transform: capitalize; white-space: nowrap; }
/* the song */
.app.cft .tl-audio.cft-music { position: relative; height: 40px !important; margin-top: 4px !important; padding: 0 10px 0 14px !important; border: 0 !important; border-radius: 8px !important; background: var(--cft-song) !important; color: #fff !important; overflow: visible !important; box-shadow: inset 0 2px 0 var(--cft-handle), inset 0 -2px 0 var(--cft-handle); transition: transform .12s ease; }
.app.cft .tl-audio.cft-music > svg, .app.cft .tl-audio.cft-music > span:not(.cft-mname):not(.cft-handle) { display: none !important; }
.app.cft .cft-mname { display: flex !important; align-items: center; gap: 6px; min-width: 0; overflow: hidden; white-space: nowrap; font: 600 14px/1 -apple-system, BlinkMacSystemFont, Inter, system-ui, sans-serif; }
.app.cft .cft-mname b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.app.cft .cft-mname em { font-style: normal; font-weight: 500; opacity: .75; font-size: 12px; }
.app.cft .cft-handle { position: absolute; left: -16px; top: 0; bottom: 0; width: 18px; border-radius: 8px 0 0 8px; background: var(--cft-handle); display: grid; place-items: center; cursor: ew-resize; touch-action: none; z-index: 2; }
.app.cft .cft-handle::after { content: ""; position: absolute; inset: -6px -14px -6px -12px; }
.app.cft .cft-handle i { width: 7px; height: 7px; border-left: 2.4px solid #121214; border-bottom: 2.4px solid #121214; transform: translateX(1.5px) rotate(45deg); }
.app.cft .cft-handle:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.app.cft .tl-audio.cft-dragging { transform: translateX(var(--cft-shift, 0px)); transition: none; }
.app.cft .tl-audio.cft-dragging::before { content: attr(data-start); position: absolute; left: 0; top: -26px; padding: 3px 8px; border-radius: 8px; background: var(--cft-handle); color: #121214; font: 700 12px/1.2 -apple-system, BlinkMacSystemFont, Inter, system-ui, sans-serif; white-space: nowrap; }
/* the clips */
.app.cft .tl-strip { height: 52px !important; margin-top: 4px !important; }
.app.cft .tl-clip { height: 52px !important; border-right: 1.5px solid #0b0b0e !important; }
.app.cft .tl-clip:first-of-type { border-radius: 8px 0 0 8px; }
.app.cft .tl-clip:last-of-type { border-radius: 0 8px 8px 0; }
.app.cft .tl-tx-gap { height: 52px !important; }
/* a clean filmstrip like the spec: transitions live on row 3 now, so the per-cut buttons only show in the Transitions
   tool; the length and swap badges only on the clip you picked */
.app.cft .tl-wrap:not(.tx-mode) .tl-strip .tl-tx-gap { visibility: hidden; pointer-events: none; }
.app.cft .tl-clip:not(.selected) .dur, .app.cft .tl-clip:not(.selected) .tl-swap { display: none !important; }
/* trim handles (cf-trim.js): 14 px to see, 30 px to grab (wider would steal drags meant for scrolling the tracks) */
.app.cft .cf-trim-h::after { content: ""; position: absolute; inset: -6px -8px; }
.app.cft .cft-fx { cursor: pointer; }
.app.cft .cft-fxhint { position: absolute; left: 0; top: 3px; height: 34px; display: flex; align-items: center; padding: 0 12px; border: 1px dashed rgba(239, 59, 59, .4); border-radius: 8px; color: rgba(255, 190, 190, .8); font: 600 13px/1 -apple-system, BlinkMacSystemFont, Inter, system-ui, sans-serif; white-space: nowrap; pointer-events: none; }
.app.cft .tl-add { align-self: flex-end !important; width: 40px !important; height: 40px !important; margin-bottom: 6px !important; border: 0 !important; border-radius: 10px !important; background: #fff !important; color: #0b0b0e !important; box-shadow: 0 4px 14px rgba(0, 0, 0, .45); position: relative; }
.app.cft .tl-add::after { content: ""; position: absolute; inset: -4px; }
/* the playhead: fixed in the middle */
.app.cft .tl-playhead { left: calc(50% - 1px) !important; transform: none !important; width: 2px !important; background: #fff !important; box-shadow: 0 0 6px rgba(255, 255, 255, .55) !important; z-index: 9 !important; }
.app.cft .tl-playhead-cap { display: none; }
/* the row bands behind the tracks and the icon column over their left edge */
.app.cft .cft-bands { position: absolute; left: 0; right: 0; top: 0; z-index: 0; pointer-events: none; }
.app.cft .cft-bands i { display: block; background: var(--cft-row); }
.app.cft .cft-bands i { margin-top: 4px; height: 40px; }
.app.cft .cft-bands i:nth-child(1) { margin-top: 28px; }
.app.cft .cft-bands i:nth-child(5) { height: 52px; }
.app.cft .cft-col { position: absolute; left: 0; top: 0; z-index: 7; width: 52px; display: flex; flex-direction: column; background: linear-gradient(90deg, var(--cft-bg) 70%, rgba(11, 11, 14, 0)); pointer-events: none; }
.app.cft .cft-col > * { pointer-events: auto; }
.app.cft .cft-col .cft-ruler-sp { height: 24px; pointer-events: none; }
.app.cft .cft-col button, .app.cft .cft-col .cft-film { margin-top: 4px; width: 44px; border: 0; background: transparent; color: rgba(255, 255, 255, .78); display: grid; place-items: center; padding: 0; cursor: pointer; position: relative; }
.app.cft .cft-col button::after { content: ""; position: absolute; inset: -4px 0; }
.app.cft .cft-col button.off { color: rgba(255, 255, 255, .32); }
.app.cft .cft-col [data-eye] { height: 40px; }
.app.cft .cft-col .cft-film { height: 52px; cursor: default; color: rgba(255, 255, 255, .6); }

/* ---------- project sheet (glass) ---------- */
.cft-sheet-wrap { position: fixed; inset: 0; z-index: 2147482000; background: rgba(0, 0, 0, 0); transition: background .25s ease; display: flex; align-items: flex-end; }
.cft-sheet-wrap.on { background: rgba(0, 0, 0, .45); }
.cft-sheet { width: 100%; max-height: 78vh; overflow: auto; box-sizing: border-box; padding: 8px 18px calc(env(safe-area-inset-bottom, 0px) + 18px); border-radius: 22px 22px 0 0; background: rgba(22, 22, 28, .82); -webkit-backdrop-filter: blur(28px) saturate(170%); backdrop-filter: blur(28px) saturate(170%); box-shadow: inset 0 .5px 0 rgba(255, 255, 255, .22), 0 -10px 40px rgba(0, 0, 0, .5); color: #f4f5f8; font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", Inter, system-ui, sans-serif; transform: translateY(100%); transition: transform .3s cubic-bezier(.2, .9, .25, 1); }
.cft-sheet-wrap.on .cft-sheet { transform: none; }
.cft-grab { width: 38px; height: 5px; border-radius: 3px; background: rgba(255, 255, 255, .28); margin: 0 auto 12px; }
.cft-lbl { display: block; margin: 12px 2px 8px; font: 600 13px/1.2 inherit; color: rgba(255, 255, 255, .6); }
.cft-rename { display: flex; gap: 8px; }
.cft-rename input { flex: 1 1 auto; min-width: 0; height: 46px; padding: 0 14px; border: 0; border-radius: 12px; background: rgba(255, 255, 255, .08); color: #fff; font: 500 16px/1 inherit; box-shadow: inset 0 0 0 .5px rgba(255, 255, 255, .14); }
.cft-rename input:focus { outline: 2px solid #3b82f6; outline-offset: 0; }
.cft-save { height: 46px; padding: 0 18px; border: 0; border-radius: 12px; background: #fff; color: #0b0b0e; font: 700 15px/1 inherit; cursor: pointer; }
.cft-list { display: flex; flex-direction: column; gap: 2px; }
.cft-item { display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 6px 8px; border-radius: 12px; color: inherit; text-decoration: none; }
.cft-item:active { background: rgba(255, 255, 255, .06); }
.cft-item.is-cur { background: rgba(255, 255, 255, .05); }
.cft-item-i { flex: 0 0 auto; width: 30px; height: 44px; border-radius: 7px; overflow: hidden; background: #0e0e12 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'%3E%3Cpath fill='%233B82F6' d='M36 8h-16l-8 28h12l-8 28 28-36h-14l6-20z'/%3E%3C/svg%3E") center / 16px no-repeat; }
.cft-item-i img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cft-item-n { flex: 1 1 auto; min-width: 0; font: 600 15px/1.25 inherit; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cft-item-a { flex: 0 0 auto; font: 500 12px/1 inherit; color: rgba(255, 255, 255, .55); }
.cft-empty { margin: 4px 2px; font: 500 14px/1.4 inherit; color: rgba(255, 255, 255, .6); }

/* light theme: the editor stays dark (like the spec), only the sheet follows the page */
@media (prefers-reduced-motion: reduce) {
  .cft-sheet, .cft-sheet-wrap, .app.cft .cft-collapse svg, .app.cft .tl-audio.cft-music { transition: none !important; }
}
.app.cft .cft-mname svg { color: #fff !important; stroke: #fff !important; flex: 0 0 auto; }
