/* ---- Compilations tab (public/compile.js) ---- */
.main.main-compile { padding: 0; overflow: hidden; display: flex; }
.cmp { flex: 1; min-width: 0; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr) auto; color: var(--text); }
.cmp-boot { grid-row: 1 / -1; margin: auto; display: flex; flex-direction: column; align-items: center; gap: 10px; color: var(--text-dim); font-size: 13.5px; text-align: center; }

/* header: title + channel pills */
.cmp-top { display: flex; align-items: center; gap: 16px; padding: 14px 18px 12px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.cmp-heading { flex: 1; min-width: 220px; }
.cmp-heading h1 { margin: 0; font-size: 18px; letter-spacing: -0.01em; }
.cmp-sub { font-size: 12.5px; color: var(--text-muted); }
.cmp-channels { display: flex; gap: 4px; padding: 4px; border-radius: 12px; background: var(--bg); border: 1px solid var(--border); }
.cmp-channel { height: 34px; padding: 0 12px 0 6px; border: none; border-radius: 9px; background: transparent; color: var(--text-dim); font: inherit; font-size: 13px; font-weight: 600; display: inline-flex; align-items: center; gap: 8px; cursor: pointer; white-space: nowrap; }
.cmp-channel img { width: 24px; height: 24px; border-radius: 7px; object-fit: cover; }
.cmp-channel-dot { width: 24px; height: 24px; border-radius: 7px; background: var(--ch); color: #fff; font-size: 12px; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18); }
.cmp-channel:hover { color: var(--text); }
.cmp-channel.active { background: var(--panel); color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12), inset 0 0 0 1px color-mix(in srgb, var(--ch) 55%, var(--border)); }

/* work area: library | preview | export + renders */
.cmp-work { display: grid; grid-template-columns: 340px minmax(0, 1fr) 270px; min-height: 0; }
.cmp-lib { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--border); }
.cmp-lib-head { padding: 12px 12px 8px; display: flex; flex-direction: column; gap: 8px; }
.cmp-search { display: flex; align-items: center; gap: 8px; height: 34px; padding: 0 10px; border-radius: 9px; background: var(--bg); border: 1px solid var(--border); color: var(--text-muted); }
.cmp-search:focus-within { border-color: var(--pw-accent); }
.cmp-search input { flex: 1; min-width: 0; border: none; background: transparent; color: var(--text); font: inherit; font-size: 13px; outline: none; padding: 0; }
.cmp-filters { display: flex; gap: 4px; }
.cmp-filter { height: 26px; padding: 0 10px; border-radius: 13px; border: 1px solid var(--border); background: transparent; color: var(--text-dim); font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; }
.cmp-filter:hover { color: var(--text); }
.cmp-filter.active { background: var(--text); color: var(--panel); border-color: var(--text); }
.cmp-grid { flex: 1; min-height: 0; overflow-y: auto; padding: 4px 12px 16px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 10px; align-content: start; }
.cmp-note { grid-column: 1 / -1; display: flex; gap: 8px; align-items: flex-start; padding: 8px 10px; border-radius: 9px; font-size: 12px; line-height: 1.45; color: var(--pw-yellow-ink); background: color-mix(in srgb, var(--pw-yellow) 10%, var(--panel)); }
.cmp-lib-empty { grid-column: 1 / -1; display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 40px 12px; color: var(--text-dim); font-size: 13px; text-align: center; }
.cmp-card { display: flex; flex-direction: column; gap: 4px; padding: 0; border: none; background: none; color: inherit; text-align: left; cursor: pointer; font-family: inherit; min-width: 0; }
.cmp-card.is-off { opacity: 0.45; cursor: default; }
.cmp-card-thumb { position: relative; aspect-ratio: 16 / 9; border-radius: 9px; overflow: hidden; background: var(--bg); display: flex; align-items: center; justify-content: center; color: var(--text-muted); box-shadow: inset 0 0 0 1px var(--border); }
.cmp-card-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.15s ease; }
.cmp-card:hover:not(:disabled) .cmp-card-thumb img { transform: scale(1.04); }
.cmp-dur { position: absolute; right: 5px; bottom: 5px; padding: 1px 5px; border-radius: 4px; background: rgba(0, 0, 0, 0.78); color: #fff; font-size: 10.5px; font-weight: 600; font-variant-numeric: tabular-nums; }
.cmp-badge { position: absolute; left: 5px; top: 5px; display: inline-flex; align-items: center; gap: 3px; padding: 1px 5px; border-radius: 4px; background: rgba(0, 0, 0, 0.6); color: #fff; font-size: 10px; font-weight: 600; }
.cmp-card-add { position: absolute; right: 6px; top: 6px; width: 28px; height: 28px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--pw-accent); color: #fff; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3); opacity: 0; transform: scale(0.85); transition: opacity 0.12s ease, transform 0.12s ease; }
.cmp-card:hover:not(:disabled) .cmp-card-add, .cmp-card.is-added .cmp-card-add { opacity: 1; transform: none; }
.cmp-card.is-added .cmp-card-add { background: #2ecc71; }
.cmp-card.is-added .cmp-card-thumb { box-shadow: inset 0 0 0 2px #2ecc71; }
.cmp-card-title { font-size: 12.5px; font-weight: 600; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cmp-card-meta { font-size: 11.5px; color: var(--text-muted); }

/* preview */
.cmp-stage { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--pw-stage); }
.cmp-player { position: relative; flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 16px; overflow: hidden; }
.cmp-player video { width: 100%; height: 100%; object-fit: contain; border-radius: 6px; background: #000; cursor: pointer; }
.cmp-player video:not([src]) { display: none; }
.cmp-now { position: absolute; left: 26px; top: 24px; max-width: calc(100% - 52px); padding: 3px 9px; border-radius: 7px; background: rgba(0, 0, 0, 0.6); color: #fff; font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; pointer-events: none; }
.cmp-now[hidden], .cmp-player-empty[hidden], .cmp-cut[hidden] { display: none; }
.cmp-player-empty { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 24px; text-align: center; color: var(--text-dim); font-size: 13px; }
.cmp-player-empty strong { color: var(--text); font-size: 15px; }
.cmp-player-empty span { max-width: 340px; line-height: 1.5; }
.cmp-scrub { position: relative; height: 24px; margin: 0 16px; border-radius: 6px; background: color-mix(in srgb, var(--text) 10%, transparent); cursor: pointer; touch-action: none; }
.cmp-cut { position: absolute; top: 0; bottom: 0; border-radius: 6px; background: color-mix(in srgb, var(--pw-accent) 32%, transparent); box-shadow: inset 0 0 0 2px var(--pw-accent); pointer-events: none; }
.cmp-head { position: absolute; top: -3px; bottom: -3px; width: 2px; margin-left: -1px; background: #fff; border-radius: 1px; pointer-events: none; }
.cmp-transport { display: flex; align-items: center; gap: 6px; padding: 8px 12px 12px; flex-wrap: wrap; }
.cmp-transport button:disabled { opacity: 0.4; cursor: default; }
.cmp-spacer { flex: 1; }
#cmp-playall.on { background: var(--pw-accent); border-color: var(--pw-accent); color: #fff; }

/* export + renders */
.cmp-side { border-left: 1px solid var(--border); display: flex; flex-direction: column; min-height: 0; padding: 14px 14px 0; gap: 8px; }
.cmp-side-title { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; color: var(--text-muted); }
.cmp-export { display: flex; flex-direction: column; gap: 10px; padding-bottom: 14px; margin-bottom: 4px; border-bottom: 1px solid var(--border); }
.cmp-total { display: flex; flex-direction: column; gap: 2px; }
.cmp-total b { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.cmp-total span { font-size: 12.5px; color: var(--text-muted); }
.cmp-format { margin: 0; }
.cmp-format .pwx-seg-btn { color: var(--text-dim); }
.cmp-format .pwx-seg-btn.on { color: var(--text); }
.cmp-render-btn { width: 100%; display: flex; flex-direction: row; align-items: center; justify-content: center; gap: 6px; height: 38px; font-size: 13.5px; white-space: nowrap; }
.cmp-render-btn:disabled { opacity: 0.5; }
.cmp-renders { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding-bottom: 14px; }
.cmp-renders-empty { font-size: 12.5px; color: var(--text-muted); line-height: 1.5; }
.cmp-render { padding: 10px; border-radius: 10px; background: var(--bg); border: 1px solid var(--border); display: flex; flex-direction: column; gap: 8px; }
.cmp-render-head { display: flex; align-items: flex-start; gap: 6px; }
.cmp-render-name { flex: 1; min-width: 0; font-size: 12.5px; font-weight: 600; line-height: 1.35; overflow-wrap: anywhere; }
.cmp-render-body { display: flex; flex-direction: column; gap: 6px; }
.cmp-render.is-done .cmp-render-body { flex-direction: row; align-items: center; gap: 8px; }
.cmp-render-phase { display: flex; justify-content: space-between; gap: 8px; font-size: 11.5px; color: var(--text-dim); }
.cmp-render-meta { font-size: 11.5px; color: var(--text-muted); }
.cmp-render-error { font-size: 12px; color: var(--danger, #e5484d); line-height: 1.4; }

/* timeline */
.cmp-timeline { border-top: 1px solid var(--border); background: var(--panel); }
.cmp-tl-bar { display: flex; align-items: center; gap: 8px; padding: 8px 14px 0; }
.cmp-tl-title { font-size: 12.5px; font-weight: 700; }
.cmp-tl-hint { font-size: 12px; color: var(--text-muted); }
#cmp-zoom { width: 110px; accent-color: var(--pw-accent); }
#cmp-fit.on { color: var(--pw-accent); border-color: color-mix(in srgb, var(--pw-accent) 50%, var(--border)); }
.cmp-track { display: flex; align-items: center; padding: 10px 14px 14px; overflow-x: auto; min-height: 132px; }
.cmp-track-empty { flex: 1; height: 96px; display: flex; align-items: center; justify-content: center; gap: 8px; border: 1.5px dashed var(--border); border-radius: 12px; color: var(--text-muted); font-size: 13px; }
.cmp-block { position: relative; flex-shrink: 0; height: 96px; border-radius: 10px; overflow: hidden; background: var(--bg); border: 2px solid transparent; cursor: grab; display: flex; flex-direction: column; justify-content: space-between; box-shadow: 0 0 0 1px var(--border); }
.cmp-block.is-selected { border-color: var(--pw-accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--pw-accent) 25%, transparent); }
.cmp-block.is-dragging { opacity: 0.35; }
.cmp-block.drop-before { box-shadow: -5px 0 0 -1px var(--pw-accent); }
.cmp-block.drop-after { box-shadow: 5px 0 0 -1px var(--pw-accent); }
/* the clip's thumbnail repeated along its length, like a filmstrip */
.cmp-block-strip { position: absolute; inset: 0; background-size: auto 100%; background-repeat: repeat-x; background-position: left center; opacity: 0.85; }
.cmp-block-strip::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0, 0, 0, 0.55) 0%, rgba(0, 0, 0, 0) 40%, rgba(0, 0, 0, 0) 60%, rgba(0, 0, 0, 0.6) 100%); }
.cmp-block-info, .cmp-block-foot { position: relative; display: flex; align-items: center; gap: 6px; padding: 6px 8px; color: #fff; font-size: 11.5px; font-weight: 600; min-width: 0; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6); }
.cmp-block-foot { justify-content: space-between; font-variant-numeric: tabular-nums; }
.cmp-block-foot span { display: inline-flex; align-items: center; gap: 3px; }
.cmp-block-num { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 5px; background: rgba(0, 0, 0, 0.6); display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; text-shadow: none; }
.cmp-block-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-right: 18px; }
.cmp-block-x { position: absolute; right: 5px; top: 5px; width: 20px; height: 20px; border-radius: 50%; border: none; background: rgba(0, 0, 0, 0.6); color: #fff; display: none; align-items: center; justify-content: center; cursor: pointer; }
.cmp-block:hover .cmp-block-x { display: inline-flex; }
@media (hover: none) { .cmp-block-x { display: inline-flex; } }

/* the join between two clips: + to add a transition, or the transition's name */
.cmp-join { flex-shrink: 0; z-index: 1; height: 28px; min-width: 28px; margin: 0 -6px; padding: 0 8px; border-radius: 14px; border: 1.5px solid color-mix(in srgb, var(--text) 25%, var(--border)); background: var(--panel); color: var(--text-dim); display: inline-flex; align-items: center; justify-content: center; font: inherit; font-size: 11px; font-weight: 700; cursor: pointer; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35); transition: transform 0.1s ease; }
.cmp-join:hover { border-color: var(--pw-accent); color: var(--text); transform: scale(1.1); }
.cmp-join.is-set { border-style: solid; border-color: color-mix(in srgb, var(--pw-accent) 60%, transparent); background: color-mix(in srgb, var(--pw-accent) 16%, var(--panel)); color: var(--pw-accent); }
.cmp-join-menu { position: fixed; z-index: 900; transform: translate(-50%, calc(-100% - 8px)); min-width: 230px; padding: 6px; border-radius: 12px; background: var(--pw-menu-bg); border: 1px solid var(--pw-menu-border); box-shadow: 0 16px 40px rgba(0, 0, 0, 0.3); color: var(--pw-menu-text); animation: pop-in 0.1s ease both; }
.cmp-join-title { font-size: 11.5px; font-weight: 600; color: var(--pw-menu-dim); padding: 4px 8px 6px; }
.cmp-join-menu .pw-menu-item { height: auto; min-height: 38px; padding: 5px 8px; text-align: left; }
.cmp-join-menu .pw-menu-item > span { display: flex; flex-direction: column; }
.cmp-join-hint { font-size: 11.5px; color: var(--pw-menu-dim); font-weight: 400; }

/* narrower screens */
@media (max-width: 1200px) {
  .cmp-work { grid-template-columns: 290px minmax(0, 1fr) 240px; }
}
@media (max-width: 980px) {
  .cmp-work { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto auto; overflow-y: auto; }
  .main.main-compile { overflow-y: auto; }
  .cmp { grid-template-rows: auto auto auto; }
  .cmp-stage { order: 1; }
  .cmp-player { height: 52vw; max-height: 50vh; flex: none; }
  .cmp-lib { order: 2; border-right: none; border-top: 1px solid var(--border); max-height: 60vh; }
  .cmp-side { order: 3; border-left: none; border-top: 1px solid var(--border); padding-bottom: 14px; }
  .cmp-timeline { position: sticky; bottom: 0; z-index: 2; }
  .cmp-tl-hint { display: none; }
}
@media (max-width: 760px) {
  .main.main-compile { height: auto; }
  .cmp-top { padding: 12px; }
  .cmp-channels { width: 100%; overflow-x: auto; }
  .cmp-channel { flex: 1; min-width: 0; justify-content: center; padding: 0 8px 0 4px; gap: 6px; font-size: 12.5px; }
  .cmp-channel span:last-child { overflow: hidden; text-overflow: ellipsis; }
  .cmp-channel img, .cmp-channel-dot { width: 22px; height: 22px; flex-shrink: 0; }
  .cmp-search input { font-size: 16px; }
}
