/* ---- 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); color: var(--text); background: var(--bg); }
.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; }
.cmp-spacer { flex: 1; }
.cmp [hidden] { display: none !important; }

/* top bar: steps · output · primary action */
.cmp-top { display: flex; align-items: center; gap: 14px; padding: 12px 16px; border-bottom: 1px solid var(--border); background: var(--panel); flex-wrap: wrap; }
.cmp-steps { display: flex; gap: 2px; padding: 4px; border-radius: 12px; border: 1px solid var(--border); background: var(--bg); }
.cmp-step { height: 32px; padding: 0 14px; border: none; border-radius: 8px; background: transparent; color: var(--text-dim); font: inherit; font-size: 14px; font-weight: 500; cursor: pointer; }
.cmp-step:hover { color: var(--text); }
.cmp-step.active { background: var(--text); color: var(--panel); font-weight: 600; }
.cmp-top-note { font-size: 13px; color: var(--text-muted); }
.cmp-output { display: flex; align-items: center; gap: 10px; }
.cmp-select-btn { height: 38px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--bg); color: var(--text); font: inherit; font-size: 13.5px; display: inline-flex; align-items: center; gap: 8px; cursor: pointer; white-space: nowrap; }
.cmp-select-btn:hover { border-color: color-mix(in srgb, var(--text) 30%, var(--border)); }
.cmp-select-btn.sm { height: 28px; padding: 0 10px; font-size: 12px; border-radius: 8px; }
.cmp-select-btn.on { color: var(--pw-accent); }
.cmp-codec { display: flex; gap: 2px; padding: 4px; border-radius: 12px; border: 1px solid var(--border); background: var(--bg); }
.cmp-codec-btn { height: 30px; padding: 0 12px; border: none; border-radius: 8px; background: transparent; color: var(--text-dim); font: inherit; font-size: 13.5px; font-weight: 700; cursor: pointer; }
.cmp-codec-btn.on { background: var(--text); color: var(--panel); }
.cmp-codec-btn:disabled { opacity: 0.35; cursor: default; }
.cmp-cta { height: 44px; padding: 0 18px; border: none; border-radius: 12px; background: var(--text); color: var(--panel); font: inherit; font-size: 15px; font-weight: 700; display: inline-flex; align-items: center; gap: 8px; cursor: pointer; white-space: nowrap; box-shadow: 0 2px 10px rgba(0, 0, 0, 0.18); }
.cmp-cta:hover:not(:disabled) { filter: brightness(0.92); }
.cmp-cta:disabled { opacity: 0.45; cursor: default; }

/* body: numbered clip list + the step's pane */
.cmp-body { display: grid; grid-template-columns: 300px minmax(0, 1fr); min-height: 0; }
.cmp-clips { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--border); background: var(--panel); }
.cmp-clips-head { display: flex; justify-content: space-between; padding: 14px 16px 10px; font-size: 13px; color: var(--text-muted); border-bottom: 1px solid var(--border); font-variant-numeric: tabular-nums; }
.cmp-clip-list { list-style: none; margin: 0; padding: 8px; flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; }
.cmp-clip-empty { padding: 16px 10px; font-size: 13px; color: var(--text-muted); line-height: 1.5; }
.cmp-clip { position: relative; display: flex; align-items: center; gap: 10px; padding: 8px 10px 8px 6px; border-radius: 10px; cursor: pointer; }
.cmp-clip:hover { background: var(--hover); }
.cmp-clip.is-current { background: color-mix(in srgb, var(--text) 9%, transparent); }
.cmp-clip.is-dragging { opacity: 0.4; }
.cmp-clip.drop-before { box-shadow: 0 -2px 0 var(--pw-accent); }
.cmp-clip.drop-after { box-shadow: 0 2px 0 var(--pw-accent); }
.cmp-clip-num { width: 22px; text-align: center; font-size: 14px; color: var(--text-muted); flex-shrink: 0; font-variant-numeric: tabular-nums; }
.cmp-clip-thumb { width: 84px; aspect-ratio: 16 / 9; border-radius: 6px; overflow: hidden; flex-shrink: 0; background: var(--c); display: flex; align-items: center; justify-content: center; color: rgba(255, 255, 255, 0.7); box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.06); }
.cmp-clip-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cmp-clip-title { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; font-size: 14px; line-height: 1.3; }
.cmp-clip-title > span:first-child { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cmp-clip-cut { display: inline-flex; align-items: center; gap: 3px; font-size: 11.5px; color: var(--pw-accent); font-weight: 600; }
.cmp-clip-x { position: absolute; right: 4px; top: 4px; width: 20px; height: 20px; border-radius: 50%; border: none; background: var(--panel); color: var(--text-dim); box-shadow: 0 0 0 1px var(--border); display: none; align-items: center; justify-content: center; cursor: pointer; }
.cmp-clip:hover .cmp-clip-x { display: inline-flex; }
@media (hover: none) { .cmp-clip-x { display: inline-flex; } }
.cmp-clips-foot { padding: 10px; border-top: 1px solid var(--border); }
.cmp-clips-foot:empty { display: none; }
.cmp-clear { width: 100%; height: 36px; border-radius: 10px; border: 1px dashed var(--border); background: transparent; color: var(--text-dim); font: inherit; font-size: 13px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; cursor: pointer; }
.cmp-clear:hover { color: var(--text); border-style: solid; }

.cmp-main { min-width: 0; min-height: 0; display: flex; }
.cmp-pane { display: none; flex: 1; min-width: 0; min-height: 0; flex-direction: column; }
.cmp-pane.active { display: flex; }

/* Select */
.cmp-select-bar { display: flex; align-items: center; gap: 10px; padding: 16px 20px 0; }
.cmp-channels { display: flex; gap: 8px; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.cmp-channels::-webkit-scrollbar { display: none; }
.cmp-channel { flex-shrink: 0; height: 44px; padding: 0 16px 0 8px; border-radius: 22px; border: 1px solid var(--border); background: transparent; color: var(--text-dim); font: inherit; font-size: 15px; font-weight: 500; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; white-space: nowrap; }
.cmp-channel:hover { color: var(--text); }
.cmp-channel.active { color: var(--text); border-color: color-mix(in srgb, var(--text) 45%, var(--border)); background: color-mix(in srgb, var(--text) 7%, transparent); }
.cmp-channel img, .cmp-channel-dot { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.cmp-channel-dot { background: var(--ch); color: #fff; font-size: 13px; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2); }
.cmp-search { display: flex; align-items: center; gap: 8px; width: 220px; flex-shrink: 1; min-width: 140px; height: 44px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--border); background: transparent; color: var(--text-muted); }
.cmp-search:focus-within { border-color: color-mix(in srgb, var(--text) 40%, var(--border)); }
.cmp-search input { flex: 1; min-width: 0; border: none; background: transparent; color: var(--text); font: inherit; font-size: 14.5px; outline: none; padding: 0; }
.cmp-select-bar .cmp-select-btn { height: 44px; color: var(--text-dim); background: transparent; flex-shrink: 0; }
.cmp-showing { padding: 16px 20px 10px; font-size: 16px; color: var(--text-dim); }
.cmp-showing b { color: var(--text); font-weight: 500; }
.cmp-showing span { margin: 0 4px; color: var(--text-muted); }
.cmp-grid { flex: 1; min-height: 0; overflow-y: auto; padding: 4px 20px 24px; display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; align-content: start; grid-auto-rows: max-content; }
.cmp-note { grid-column: 1 / -1; display: flex; gap: 8px; align-items: flex-start; padding: 10px 12px; border-radius: 10px; font-size: 13px; color: var(--pw-yellow-ink); background: color-mix(in srgb, var(--pw-yellow) 10%, var(--panel)); }
.cmp-grid-empty { grid-column: 1 / -1; display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 60px 16px; color: var(--text-dim); font-size: 14px; }
.cmp-tile { display: flex; flex-direction: column; padding: 0; border-radius: 12px; border: 1px solid var(--border); background: var(--panel); color: inherit; text-align: left; cursor: pointer; font-family: inherit; overflow: hidden; transition: border-color 0.12s ease; }
.cmp-tile:hover:not(:disabled) { border-color: color-mix(in srgb, var(--text) 30%, var(--border)); }
.cmp-tile.is-off { opacity: 0.45; cursor: default; }
.cmp-tile-thumb { flex-shrink: 0; position: relative; aspect-ratio: 16 / 9; background: var(--bg); display: flex; align-items: center; justify-content: center; color: var(--text-muted); overflow: hidden; }
.cmp-tile-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cmp-tile-dur { position: absolute; right: 8px; bottom: 8px; padding: 2px 6px; border-radius: 5px; background: rgba(0, 0, 0, 0.8); color: #fff; font-size: 12.5px; font-weight: 600; font-variant-numeric: tabular-nums; }
.cmp-tile.is-picked .cmp-tile-thumb img { filter: brightness(0.55); }
.cmp-tile-check { position: absolute; left: 50%; top: 50%; width: 56px; height: 56px; margin: -28px 0 0 -28px; border-radius: 50%; background: #fff; color: #111; display: flex; align-items: center; justify-content: center; box-shadow: 0 4px 18px rgba(0, 0, 0, 0.4); }
.cmp-tile-title { flex-shrink: 0; padding: 10px 12px 2px; font-size: 15px; font-weight: 500; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cmp-tile-meta { display: flex; align-items: center; gap: 8px; padding: 4px 12px 12px; font-size: 13px; color: var(--text-muted); }
.cmp-order { min-width: 22px; height: 22px; padding: 0 6px; border-radius: 6px; background: var(--c); color: #fff; font-size: 12.5px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }

/* Trim */
.cmp-stage { position: relative; flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; background: #000; overflow: hidden; }
.cmp-stage video { width: 100%; height: 100%; object-fit: contain; cursor: pointer; }
.cmp-stage-empty { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; color: #aaa; font-size: 13.5px; }
.cmp-stage-empty strong { color: #fff; font-size: 15px; }
.cmp-keys { position: absolute; right: 16px; bottom: 16px; padding: 10px 12px; border-radius: 12px; background: rgba(20, 20, 20, 0.78); backdrop-filter: blur(6px); display: flex; flex-direction: column; gap: 6px; min-width: 190px; color: rgba(255, 255, 255, 0.55); font-size: 12.5px; pointer-events: none; }
.cmp-key-row { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.cmp-key-row > span:last-child { display: inline-flex; gap: 4px; }
.cmp-keys kbd { min-width: 20px; height: 20px; padding: 0 5px; border-radius: 5px; border: 1px solid rgba(255, 255, 255, 0.18); background: rgba(255, 255, 255, 0.06); color: rgba(255, 255, 255, 0.75); font: inherit; font-size: 11.5px; display: inline-flex; align-items: center; justify-content: center; }
.cmp-transport { display: flex; align-items: center; gap: 16px; padding: 12px 20px; border-top: 1px solid var(--border); background: var(--panel); }
.cmp-play { width: 44px; height: 44px; border-radius: 10px; border: none; background: var(--text); color: var(--panel); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.cmp-tc { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 16px; color: var(--text-dim); white-space: nowrap; }
.cmp-tc b { color: var(--text); font-weight: 500; }

.cmp-timeline { flex: none; height: 200px; overflow-x: auto; overflow-y: hidden; border-top: 1px solid var(--border); background: var(--panel); }
.cmp-tl-inner { position: relative; height: 100%; min-width: 100%; }
.cmp-ruler { position: absolute; left: 0; right: 0; top: 0; height: 30px; cursor: ew-resize; }
.cmp-tick { position: absolute; bottom: 0; width: 1px; height: 7px; background: color-mix(in srgb, var(--text) 30%, transparent); }
.cmp-tick.major { height: 14px; background: color-mix(in srgb, var(--text) 55%, transparent); }
.cmp-tick i { position: absolute; left: 4px; bottom: 4px; font-style: normal; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; color: var(--text-dim); white-space: nowrap; }
.cmp-handles { position: absolute; left: 0; right: 0; top: 34px; height: 20px; }
.cmp-handle { position: absolute; top: 0; height: 20px; min-width: 34px; padding: 0 6px; transform: translateX(-50%); border-radius: 4px; border: none; background: color-mix(in srgb, var(--text) 22%, transparent); color: var(--text); font: inherit; font-size: 10.5px; font-weight: 700; cursor: pointer; white-space: nowrap; z-index: 2; }
.cmp-handle:hover { background: color-mix(in srgb, var(--text) 40%, transparent); }
.cmp-handle.is-set { background: var(--pw-accent); color: #fff; }
.cmp-track { position: absolute; left: 0; right: 0; top: 58px; bottom: 10px; cursor: text; }
.cmp-block { position: absolute; top: 0; bottom: 0; border-radius: 4px; overflow: hidden; background: var(--c); display: flex; flex-direction: column; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08); }
.cmp-block-title { padding: 6px 8px 0; color: #fff; font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cmp-block-thumb { flex: 1; min-height: 0; padding: 6px 8px; }
.cmp-block-thumb img { height: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 3px; display: block; }
.cmp-wave { display: block; width: 100%; height: 34px; background: color-mix(in srgb, var(--c) 55%, #fff 12%); }
.cmp-playhead { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: #3b82f6; pointer-events: none; z-index: 3; }
.cmp-playhead::before { content: ''; position: absolute; top: 0; left: -5px; width: 12px; height: 12px; border-radius: 3px 3px 6px 6px; background: #3b82f6; }

/* Export */
.cmp-export { flex: 1; min-height: 0; overflow-y: auto; padding: 28px 32px; display: flex; flex-direction: column; gap: 16px; max-width: 760px; }
.cmp-export-card { padding: 22px 24px; border-radius: 14px; border: 1px solid var(--border); background: var(--panel); }
.cmp-export-total { font-size: 40px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.cmp-export-meta { font-size: 14px; color: var(--text-muted); margin-bottom: 18px; }
.cmp-export-rows { display: flex; flex-direction: column; border-top: 1px solid var(--border); }
.cmp-export-rows > div { display: flex; justify-content: space-between; gap: 16px; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.cmp-export-rows span { color: var(--text-muted); }
.cmp-export-rows b { font-weight: 600; }
.cmp-export-hint { margin-top: 12px; font-size: 13px; color: var(--text-muted); line-height: 1.5; }
.cmp-renders-title { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); margin-top: 8px; }
.cmp-renders { display: flex; flex-direction: column; gap: 10px; }
.cmp-renders-empty { font-size: 13.5px; color: var(--text-muted); }
.cmp-render { padding: 14px; border-radius: 12px; background: var(--panel); border: 1px solid var(--border); display: flex; flex-direction: column; gap: 10px; }
.cmp-render-head { display: flex; align-items: flex-start; gap: 8px; }
.cmp-render-name { flex: 1; min-width: 0; font-size: 14px; font-weight: 600; 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: 12px; flex-wrap: wrap; }
.cmp-render-phase { display: flex; justify-content: space-between; gap: 8px; font-size: 12.5px; color: var(--text-dim); }
.cmp-render-meta { font-size: 12.5px; color: var(--text-muted); }
.cmp-render-error { font-size: 13px; color: var(--danger, #e5484d); line-height: 1.4; }
.cmp-download { height: 34px; padding: 0 14px; border-radius: 9px; background: var(--text); color: var(--panel); font-size: 13.5px; font-weight: 700; display: inline-flex; align-items: center; gap: 6px; text-decoration: none; }

/* menus */
.cmp-menu { position: fixed; z-index: 900; min-width: 240px; 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-menu .pw-menu-item { height: auto; min-height: 34px; padding: 6px 8px; text-align: left; }
.cmp-menu-hint { color: var(--pw-menu-dim); font-weight: 400; font-size: 12px; }

/* narrower screens */
@media (max-width: 1100px) {
  .cmp-body { grid-template-columns: 240px minmax(0, 1fr); }
  .cmp-clip-thumb { width: 64px; }
  .cmp-top-note { display: none; }
}
@media (max-width: 860px) {
  .main.main-compile { overflow-y: auto; height: auto; }
  .cmp { grid-template-rows: auto auto; }
  .cmp-body { grid-template-columns: minmax(0, 1fr); }
  .cmp-clips { order: 2; border-right: none; border-top: 1px solid var(--border); }
  .cmp-clip-list { max-height: 260px; }
  .cmp-main { min-height: 70vh; }
  .cmp-stage { flex: none; height: 52vw; }
  .cmp-keys { display: none; }
  .cmp-search { width: 100%; }
  .cmp-top { gap: 10px; }
  .cmp-cta { flex: 1; justify-content: center; }
  .cmp-search input { font-size: 16px; }
}
