/* =========================================================================
   Clips (features/clips): screen recordings shared by link, laid out as Cap's. Linked in the admin shell and in
   Watch.html (/v/:token), which shows the same player.
     clx-            the full-screen layer (ClipsView.js): the back button bar, the library (cards), a clip's page
                     (title, who can watch, the link, the video with its summary and transcript), New clip's choice
     cle-            a clip's editor (clipEditor.js): the preview, its transport, the settings down the right
     clt-            the editor's timeline (clipTimeline.js): the ruler, the clip track (parts, trim), the zoom track
     clp-            the player (clipPlayer.js): the screen in its frame, the camera bubble, the controls over the video
     clr-            the browser recorder (clipRecorder.js): the setup dialog, and the recording bar in its floating
                     window (body.clr-pip) or docked at the bottom of the tab (.clr-dock)
   The video's surroundings are theme-constant (black letterbox, white glyphs on a dark scrim), so they read the same on
   a light or a dark page.
   ========================================================================= */
.clp {
  --clp-black: #000;                                   /* the letterbox behind the video */
  --clp-scrim: linear-gradient(to top, rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0));
  --clp-glyph-hover: rgba(255, 255, 255, 0.16);
  --clp-track: rgba(255, 255, 255, 0.32);
  --clp-glyph-soft: rgba(255, 255, 255, 0.62);       /* a quiet label on the dark controls */
  --clp-cam-ring: 0 0 0 3px rgba(255, 255, 255, 0.92), 0 8px 24px rgba(0, 0, 0, 0.32);
  --clp-on-white: #121212;                            /* the big play button's glyph (its disc is white in both themes) */
  --clp-frame-shadow: 0 1cqw 3cqw rgba(0, 0, 0, 0.28);  /* the framed screen on a wallpaper (clipLayout paints the same) */
  --clp-cap-bg: rgba(0, 0, 0, 0.84);                  /* the captions' pill */
}

/* ---- the full-screen layer: over the whole app, as the website editor is (its dialogs, menus and toasts above it).
   It grows out of the top bar's button (--clx-ox / --clx-oy) and shrinks away; pages slide in from the side they're
   reached from; a card grows into the clip's video (view-transition-name clx-hero) ---- */
body.clx-open { overflow: hidden; }
body.clx-open .modal-scrim, body.clx-open .modal-shell { z-index: var(--z-scrim); }
body.clx-open .status-toast-stack, body.clx-open .app-toast { z-index: calc(var(--z-scrim) + 4); }
body.clx-open .note-menu { z-index: calc(var(--z-scrim) + 4); }
.clx { position: fixed; inset: 0; z-index: var(--z-overlay); background: var(--surface); transform-origin: var(--clx-ox, 50%) var(--clx-oy, 0); }
.clx.is-entering { animation: clx-open 340ms var(--ease-ios) both; }
.clx.is-leaving { animation: clx-close 200ms var(--ease) both; pointer-events: none; }
@keyframes clx-open { from { opacity: 0; transform: scale(0.92); border-radius: var(--radius-2xl); } to { opacity: 1; transform: none; } }
@keyframes clx-close { to { opacity: 0; transform: scale(0.96); } }
.clx-page.is-fwd { animation: clx-fwd 300ms var(--ease-ios) both; }
.clx-page.is-back { animation: clx-back 300ms var(--ease-ios) both; }
@keyframes clx-fwd { from { opacity: 0; transform: translateX(32px); } }
@keyframes clx-back { from { opacity: 0; transform: translateX(-32px); } }
.clx-hero { view-transition-name: clx-hero; }
::view-transition-group(clx-hero) { animation-duration: 380ms; animation-timing-function: var(--ease-ios); }
::view-transition-old(clx-hero), ::view-transition-new(clx-hero) { height: 100%; object-fit: cover; overflow: clip; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: 240ms; }
.clx-in { display: flex; flex-direction: column; height: 100%; }
.clx.is-drop .clx-scroll { box-shadow: inset 0 0 0 2px var(--border-strong); }

/* the bar across the top: Back, then the page's name or title; its controls on the right */
.clx-bar { display: flex; flex: none; align-items: center; justify-content: space-between; gap: var(--space-3); height: var(--shell-header-height); padding: 0 var(--space-4); border-bottom: 1px solid var(--border-faint); background: var(--surface); }
.clx-bar-l, .clx-bar-r { display: flex; align-items: center; gap: var(--space-2); min-width: 0; }
.clx-bar-l { flex: 1; }
.clx-back { gap: var(--space-1); padding: 0 var(--space-2-5) 0 var(--space-1-5); }
.clx-bar-sep { flex: none; width: 1px; height: 20px; margin: 0 var(--space-1); background: var(--border); }
.clx-bar-h { margin: 0; font-size: var(--text-md); font-weight: var(--fw-semibold); color: var(--text-strong); }
.clx-bar-title { overflow: hidden; min-width: 0; white-space: nowrap; text-overflow: ellipsis; font-size: var(--text-md); font-weight: var(--fw-semibold); color: var(--text-strong); }
.clx-bar-input {
  width: min(440px, 100%); height: var(--control-sm); padding: 0 var(--space-2); margin-left: calc(var(--space-1) * -1); border: 0; border-radius: var(--radius-md);
  background: transparent; font-family: inherit; text-overflow: ellipsis;
}
@media (hover: hover) and (pointer: fine) { .clx-bar-input:hover { background: var(--surface-hover); } }
.clx-bar-input:focus { background: var(--surface-sunk); text-overflow: clip; }
.clx-scroll { flex: 1; min-height: 0; overflow-y: auto; }
.clx-busy { display: flex; align-items: center; gap: var(--space-2); }

/* ---- the library: the videos as cards ---- */
.clx-lib { max-width: 1680px; margin: 0 auto; padding: var(--space-7) var(--space-8) var(--space-12); }
.clx-h2 { margin: 0 0 var(--space-5); font-size: var(--text-xl); font-weight: var(--fw-medium); letter-spacing: -0.01em; color: var(--text-strong); }
.clx-h2 span { margin-left: var(--space-1); color: var(--text-soft); }
.clx-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-4); }
@media (min-width: 640px) { .clx-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-6); } }
@media (min-width: 1024px) { .clx-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1280px) { .clx-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (min-width: 1680px) { .clx-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
.clx-card {
  position: relative; display: flex; flex-direction: column; min-width: 0; overflow: hidden; cursor: pointer;
  border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface);
  transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}
@media (hover: hover) and (pointer: fine) { .clx-card:not(.clx-card--skel):hover { border-color: var(--border-strong); box-shadow: var(--shadow-sm); } }
.clx-card--skel { cursor: default; }
.clx-thumb { position: relative; aspect-ratio: 16 / 9; overflow: hidden; background: var(--surface-sunk); border-bottom: 1px solid var(--border-faint); }
.clx-thumb.skel { border-radius: 0; }
.clx-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: filter var(--dur) var(--ease), opacity 320ms var(--ease); }
.clx-thumb img.is-in { opacity: 1; }
.clx-thumb:has(img:not(.is-in)) { background: var(--gray-150); animation: skel-pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite; }
.clx-grid.is-rising .clx-card { animation: clx-rise 420ms var(--ease-ios) both; animation-delay: calc(var(--i, 0) * 45ms); }
@keyframes clx-rise { from { opacity: 0; transform: translateY(10px); } }
@media (hover: hover) and (pointer: fine) { .clx-card:hover .clx-thumb img { filter: brightness(0.9); } }
.clx-card.is-busy .clx-thumb img { opacity: 0.7; }
.clx-thumb-ph { position: absolute; inset: 0; display: grid; place-items: center; color: var(--text-placeholder); }
.clx-thumb-ph svg { width: 28px; height: 28px; }
.clx-dur {
  position: absolute; left: var(--space-3); bottom: var(--space-3); display: inline-flex; align-items: center; height: 20px; padding: 0 var(--space-2);
  border-radius: var(--radius-full); background: var(--overlay-media-strong); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); color: var(--text-invert);
  font-size: var(--text-2xs); font-weight: var(--fw-medium); font-variant-numeric: tabular-nums;
}
.clx-progress { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: var(--overlay-media); }
.clx-progress span { display: block; width: 100%; height: 100%; background: var(--text-invert); transform-origin: left; transform: scaleX(var(--p, 0)); transition: transform var(--dur) var(--ease); }
/* Copy link and ⋯, stacked at the top right on hover */
.clx-card-acts { position: absolute; top: var(--space-2); right: var(--space-2); z-index: 1; display: flex; flex-direction: column; gap: var(--space-2); opacity: 0; transition: opacity var(--dur-fast) var(--ease); }
.clx-card-btn {
  display: grid; place-items: center; width: 32px; height: 32px; padding: 0; border: 1px solid var(--border); border-radius: var(--radius-full);
  background: var(--surface); color: var(--text); box-shadow: var(--shadow-xs); cursor: pointer;
}
.clx-card-btn svg { width: 15px; height: 15px; }
.clx-card:focus-within .clx-card-acts { opacity: 1; }
@media (hover: hover) and (pointer: fine) { .clx-card:hover .clx-card-acts { opacity: 1; } .clx-card-btn:hover { background: var(--surface-hover); color: var(--text-strong); } }
@media (hover: none) { .clx-card-acts { opacity: 1; } }
.clx-card-body { display: flex; flex-direction: column; min-width: 0; padding: var(--space-3-5) var(--space-4) var(--space-3-5); }
.clx-card--skel .clx-card-body { gap: var(--space-2); }
.clx-card-title { overflow: hidden; margin: 0; white-space: nowrap; text-overflow: ellipsis; font-size: var(--text-md); font-weight: var(--fw-medium); line-height: 20px; color: var(--text-strong); }
.clx-card-meta { overflow: hidden; margin: 2px 0 0; white-space: nowrap; text-overflow: ellipsis; font-size: var(--text-sm); color: var(--text-soft); }
.clx-card-foot { display: flex; align-items: center; gap: var(--space-4); margin-top: var(--space-3); }
.clx-stat { display: inline-flex; align-items: center; gap: var(--space-1-5); font-size: var(--text-sm); color: var(--text-muted); }
.clx-stat svg { width: 15px; height: 15px; color: var(--text-soft); }

/* ---- a clip: who made it, then the video in its card and the Summary / Transcript card beside it, the same height ---- */
.clx-clip { flex: 1; min-height: 0; overflow-y: auto; }
.clx-clip-in { max-width: 1440px; margin: 0 auto; padding: var(--space-5) var(--space-8) var(--space-10); }
.clx-clip-grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: var(--space-6); align-items: stretch; }
.clx-meta { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2-5) var(--space-3); margin-bottom: var(--space-4); }
.clx-avatar { display: grid; place-items: center; flex-shrink: 0; width: 32px; height: 32px; overflow: hidden; border-radius: var(--radius-full); background: var(--gray-150); color: var(--text-strong); font-size: var(--text-xs); font-weight: var(--fw-semibold); }
.clx-avatar img, .wch-avatar img { display: block; width: 100%; height: 100%; object-fit: cover; }
.clx-who { display: flex; flex-direction: column; line-height: 1.3; }
.clx-who b { font-size: var(--text-md); font-weight: var(--fw-medium); color: var(--text-strong); }
.clx-who small { font-size: var(--text-xs); color: var(--text-soft); }
.clx-chip {
  display: inline-flex; align-items: center; gap: var(--space-1-5); height: var(--control-sm); padding: 0 var(--space-3); margin-left: var(--space-1);
  border: 1px solid var(--border); border-radius: var(--radius-full); background: var(--surface); font: inherit; font-size: var(--text-sm); color: var(--text); cursor: pointer;
}
.clx-chip svg { width: 14px; height: 14px; color: var(--text-soft); }
@media (hover: hover) and (pointer: fine) { .clx-chip:hover { background: var(--surface-hover); } }
.clx-url { display: inline-flex; align-items: center; gap: var(--space-1); max-width: 340px; height: var(--btn-height); padding: 0 2px 0 var(--btn-pad-x); border: 1px solid var(--border); border-radius: var(--btn-radius); background: var(--surface-sunk); font-size: var(--text-sm); color: var(--text-muted); }
.clx-url span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.clx-url .icon-ghost { flex: none; width: 26px; height: 26px; border-radius: calc(var(--btn-radius) - 3px); }
.clx-url .icon-ghost svg { width: 15px; height: 15px; }
.clx-url.is-off { opacity: 0.55; }
.clx-player { overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius-2xl); background: var(--surface-sunk); box-shadow: var(--shadow-card); }
.clx-poster { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; background: var(--gray-150); }
img.clx-poster { opacity: 0; transition: opacity 320ms var(--ease); }
img.clx-poster.is-in { opacity: 1; }
.clx-wait { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--space-2); aspect-ratio: 16 / 9; padding: var(--space-6); text-align: center; font-size: var(--text-sm); color: var(--text-muted); }
.clx-wait b { font-size: var(--text-md); font-weight: var(--fw-semibold); color: var(--text-strong); }
/* the card beside the video: as tall as the video (its own content scrolls), never shorter than a few lines */
.clx-rail { position: relative; min-height: 420px; }
.clx-rail > .crl { position: absolute; inset: 0; }

/* ---- New clip: the Mac app or this browser, two even cards; "Opening Magnet Clips…" while the app opens ---- */
.clx-choose { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); }
.clx-way { display: flex; flex-direction: column; gap: var(--space-4); padding: var(--space-5); border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); }
.clx-way-ico { display: grid; place-items: center; width: 40px; height: 40px; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface); color: var(--text-strong); box-shadow: var(--shadow-xs); }
.clx-way-ico svg { width: 20px; height: 20px; }
.clx-way-text b { display: block; font-size: var(--text-md); font-weight: var(--fw-semibold); color: var(--text-strong); }
.clx-way-text p { margin: var(--space-1) 0 0; font-size: var(--text-sm); line-height: 1.5; color: var(--text-muted); }
.clx-way-btn { width: 100%; justify-content: center; margin-top: auto; text-decoration: none; }
.clx-way-alt { min-height: 18px; margin: calc(var(--space-2) * -1) 0 0; font-size: var(--text-xs); line-height: 18px; text-align: center; color: var(--text-soft); }
.clx-way-alt a, .clx-way-link { padding: 0; border: 0; background: none; font: inherit; color: var(--text-strong); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
button.clx-way-alt { width: 100%; margin: 0; border: 0; background: none; font: inherit; font-size: var(--text-xs); cursor: pointer; }
@media (hover: hover) and (pointer: fine) { button.clx-way-alt:hover, .clx-way-link:hover { color: var(--text-strong); } }
.clx-opening { display: flex; flex-direction: column; align-items: center; gap: var(--space-2); padding: var(--space-4) 0 var(--space-2); text-align: center; }
.clx-opening b { font-size: var(--text-md); font-weight: var(--fw-semibold); color: var(--text-strong); }
.clx-opening p { margin: 0 0 var(--space-3); font-size: var(--text-sm); color: var(--text-muted); }
.clx-opening-ico { display: grid; place-items: center; width: 56px; height: 56px; margin-bottom: var(--space-2); border: 1px solid var(--border); border-radius: var(--radius-lg); color: var(--text-strong); box-shadow: var(--shadow-sm); animation: clx-breathe 1.6s var(--ease) infinite; }
.clx-opening-ico svg { width: 28px; height: 28px; }
@keyframes clx-breathe { 50% { transform: scale(0.94); opacity: 0.7; } }

/* ---- Connect Magnet Clips (the Mac app's Sign in): the two side by side, who and what, Connect; waiting; done ---- */
.clx-connect { display: flex; flex-direction: column; align-items: center; padding: var(--space-4) var(--space-2) var(--space-2); text-align: center; }
.clx-connect-logos { display: flex; align-items: center; gap: var(--space-3); margin-bottom: var(--space-5); }
.clx-connect-app, .clx-connect-magnet { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 14px; box-shadow: var(--shadow-md); }
.clx-connect-app { background: var(--text-strong); color: var(--surface); }
.clx-connect-app svg { width: 24px; height: 24px; }
.clx-connect-magnet { border: 1px solid var(--border); background: var(--surface); }
.clx-connect-magnet img { width: 30px; height: 30px; border-radius: 7px; }
.clx-connect-dots { display: flex; gap: 4px; }
.clx-connect-dots i { width: 5px; height: 5px; border-radius: var(--radius-full); background: var(--border-strong); }
.clx-connect.is-waiting .clx-connect-dots i { animation: clx-dot 1.2s var(--ease) infinite; }
.clx-connect.is-waiting .clx-connect-dots i:nth-child(2) { animation-delay: 150ms; }
.clx-connect.is-waiting .clx-connect-dots i:nth-child(3) { animation-delay: 300ms; }
.clx-connect.is-done .clx-connect-dots i { background: var(--success-600); }
@keyframes clx-dot { 30% { background: var(--text-strong); transform: scale(1.35); } }
.clx-connect-h { margin: 0; font-size: var(--text-lg); font-weight: var(--fw-semibold); color: var(--text-strong); }
.clx-connect-p { max-width: 340px; margin: var(--space-2) auto 0; font-size: var(--text-sm); line-height: 1.55; color: var(--text-muted); }
.clx-connect-p b { font-weight: var(--fw-medium); color: var(--text-strong); }
.clx-connect-who { display: flex; align-items: center; gap: var(--space-2-5); width: 100%; margin-top: var(--space-5); padding: var(--space-2-5) var(--space-3); border: 1px solid var(--border); border-radius: var(--radius-lg); text-align: left; }
.clx-connect-who > span:last-child { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.clx-connect-who b { font-size: var(--text-sm); font-weight: var(--fw-medium); color: var(--text-strong); }
.clx-connect-who small { overflow: hidden; font-size: var(--text-xs); white-space: nowrap; text-overflow: ellipsis; color: var(--text-soft); }
.clx-connect-list { display: flex; flex-direction: column; gap: var(--space-2-5); width: 100%; margin: var(--space-4) 0 0; padding: 0; list-style: none; text-align: left; }
.clx-connect-list li { display: flex; align-items: center; gap: var(--space-2-5); font-size: var(--text-sm); color: var(--text); }
.clx-connect-list svg { flex: none; width: 16px; height: 16px; color: var(--text-soft); }
.clx-connect-acts { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-2); width: 100%; margin-top: var(--space-6); }
.clx-connect-acts:has(> :only-child) { grid-template-columns: 1fr; }
.clx-connect-acts .btn { justify-content: center; }
.clx-connect-small { display: flex; align-items: center; justify-content: center; gap: var(--space-2); min-height: 20px; margin: var(--space-5) 0 0; font-size: var(--text-xs); color: var(--text-soft); }
.clx-connect-small a { color: var(--text-strong); }
.clx-connect-tick { display: grid; place-items: center; width: 48px; height: 48px; margin: 0 auto var(--space-3); border-radius: var(--radius-full); background: var(--success-bg); color: var(--success-700); }
.clx-connect-tick svg { width: 24px; height: 24px; }

/* ---- the Summary / Transcript card (clipRail): the shared .tabs pills at the top, its panel under them ---- */
.crl { display: flex; flex-direction: column; width: 100%; min-height: 0; overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius-2xl); background: var(--surface); box-shadow: var(--shadow-card); }
.crl-head { flex: none; padding: var(--space-2-5); border-bottom: 1px solid var(--border-faint); }
.crl-head .tabs { display: flex; }
.crl-head .tabs button { flex: 1; }
.crl-body { position: relative; flex: 1; min-height: 0; overflow: hidden; }
.crl-panel { position: absolute; inset: 0; overflow-y: auto; }
.crl-in { animation: crl-fade 240ms var(--ease) both; }
@keyframes crl-fade { from { opacity: 0; } }
.crl-skel { display: flex; flex-direction: column; gap: var(--space-6); }
.crl-skel > div { display: flex; flex-direction: column; gap: var(--space-2-5); }
.crl-skel > div .skel:first-child { margin-bottom: var(--space-1); }
.crl-skel--rows { gap: var(--space-4); padding: var(--space-4) var(--space-5); }
.crl-skel-row { display: flex; align-items: center; gap: var(--space-3); }
.crl-skel-row .skel:last-child { flex: none; }
.crl-in-r { animation: crl-in-r 260ms var(--ease-ios) both; }
.crl-in-l { animation: crl-in-l 260ms var(--ease-ios) both; }
@keyframes crl-in-r { from { opacity: 0; transform: translateX(28px); } }
@keyframes crl-in-l { from { opacity: 0; transform: translateX(-28px); } }
.crl-pad { display: flex; flex-direction: column; gap: var(--space-6); padding: var(--space-4) var(--space-4) var(--space-8); }
.crl-h { margin: 0 0 var(--space-2); font-size: var(--text-lg); font-weight: var(--fw-medium); color: var(--text-strong); }
.crl-p { margin: 0; font-size: var(--text-md); line-height: 1.6; color: var(--text); }
.crl-points { margin: var(--space-3) 0 0; padding-left: var(--space-5); list-style: disc; font-size: var(--text-md); line-height: 1.6; color: var(--text); }
.crl-points li { margin: var(--space-1) 0; }
.crl-points li::marker { color: var(--text-soft); }
.crl-chapters { display: flex; flex-direction: column; }
.crl-chapters button {
  display: flex; align-items: center; width: 100%; padding: var(--space-2); border: 0; border-bottom: 1px solid var(--border-faint); border-radius: var(--radius-xs);
  background: none; font: inherit; text-align: left; cursor: pointer; transition: background var(--dur-fast) var(--ease);
}
.crl-chapters button:last-child { border-bottom: 0; }
.crl-chapters span:first-child { flex: none; width: 64px; font-size: var(--text-xs); font-variant-numeric: tabular-nums; color: var(--text-soft); }
.crl-chapters span:last-child { font-size: var(--text-md); color: var(--text); }
@media (hover: hover) and (pointer: fine) { .crl-chapters button:hover { background: var(--gray-100); } }
.crl-suggest, .cle-suggest { display: flex; align-items: center; gap: var(--space-2); margin: 0; padding: var(--space-2) var(--space-2) var(--space-2) var(--space-3); border: 1px solid var(--border-faint); border-radius: var(--radius-lg); background: var(--surface-sunk); font-size: var(--text-sm); color: var(--text-muted); }
.crl-suggest > span, .cle-suggest > span { flex: 1; min-width: 0; }
.crl-suggest b, .cle-suggest b { font-weight: var(--fw-medium); color: var(--text-strong); }
.crl-suggest svg, .cle-suggest svg { flex: none; width: 15px; height: 15px; color: var(--text-soft); }
/* Analytics: four figures, views by day (bars), where people stop (a curve), the latest views; a tip on hover */
.crl-sub { margin: calc(var(--space-1) * -1) 0 var(--space-3); font-size: var(--text-xs); color: var(--text-soft); }
.crl-pad > .crl-sub { margin: 0; }
.crl-kpis { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-2); }
.crl-kpi { display: flex; flex-direction: column; gap: var(--space-1); padding: var(--space-3); border: 1px solid var(--border-faint); border-radius: var(--radius-lg); background: var(--surface-sunk); }
.crl-kpi span:first-child { font-size: var(--text-xs); color: var(--text-soft); }
.crl-kpi b { font-size: var(--text-xl); font-weight: var(--fw-semibold); font-variant-numeric: tabular-nums; letter-spacing: -0.01em; color: var(--text-strong); }
.crl-bars { position: relative; display: grid; grid-template-columns: repeat(14, minmax(0, 1fr)); gap: 2px; align-items: end; height: 96px; border-bottom: 1px solid var(--chart-axis-line); }
.crl-bar { display: block; height: max(2px, calc(var(--h, 0) * 100%)); border-radius: 4px 4px 0 0; background: linear-gradient(to bottom, var(--chart-bar-fill-top), var(--chart-bar-fill-bottom)); box-shadow: inset 0 2px 0 var(--chart-trend); cursor: default; outline-offset: 2px; transition: background var(--dur-fast) var(--ease); }
.crl-bar.is-today, .crl-bar:hover, .crl-bar:focus-visible { background: var(--chart-point); box-shadow: none; }
.crl-axis { display: flex; justify-content: space-between; margin-top: var(--space-1-5); font-size: var(--text-2xs); font-variant-numeric: tabular-nums; color: var(--chart-axis-text); }
.crl-ret { position: relative; height: 96px; border-bottom: 1px solid var(--chart-axis-line); cursor: crosshair; }
.crl-ret svg { display: block; width: 100%; height: 100%; overflow: visible; }
.crl-ret-area { fill: color-mix(in srgb, var(--chart-point) 7%, transparent); }
.crl-ret-line { fill: none; stroke: var(--chart-point); stroke-width: 2px; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.crl-ret-guide { position: absolute; top: 0; bottom: 0; left: calc(var(--x, 0) * 100%); width: 0; border-left: 1px dashed var(--chart-guide); pointer-events: none; }
.crl-ret-guide::after { content: ""; position: absolute; left: -5px; top: calc((1 - var(--y, 0)) * 95% + 2.5%); width: 8px; height: 8px; margin-top: -4px; border: 2px solid var(--surface); border-radius: var(--radius-full); background: var(--chart-point); }
.crl-ret-guide[hidden] { display: none; }
.crl-tip {
  position: absolute; bottom: calc(100% + var(--space-1-5)); left: clamp(64px, calc(var(--x, 0) * 100%), calc(100% - 64px)); z-index: 2; transform: translateX(-50%); padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm); background: var(--overlay-dark); color: var(--text-invert); font-size: var(--text-2xs); font-variant-numeric: tabular-nums; white-space: nowrap; pointer-events: none;
}
.crl-tip[hidden] { display: none; }
.crl-recent { display: flex; flex-direction: column; margin: 0; padding: 0; list-style: none; }
.crl-recent li { display: grid; grid-template-columns: 1fr auto auto; gap: var(--space-3); padding: var(--space-2) 0; border-bottom: 1px solid var(--border-faint); font-size: var(--text-sm); color: var(--text); }
.crl-recent li:last-child { border-bottom: 0; }
.crl-recent li span:not(:first-child) { font-variant-numeric: tabular-nums; color: var(--text-soft); }
.crl-tr { display: flex; flex-direction: column; overflow: hidden; }
.crl-tr-head { display: flex; flex: none; align-items: center; justify-content: space-between; gap: var(--space-2); padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--border-faint); }
.crl-lang { display: inline-flex; align-items: center; gap: var(--space-1-5); height: 28px; padding: 0 var(--space-2-5); border: 1px solid var(--border); border-radius: var(--radius-full); font-size: var(--text-2xs); font-weight: var(--fw-medium); color: var(--text-muted); }
.crl-lang svg { width: 12px; height: 12px; color: var(--text-soft); }
.crl-acts { position: relative; display: flex; gap: var(--space-1); }
.crl-act { display: grid; place-items: center; width: 28px; height: 28px; padding: 0; border: 0; border-radius: var(--radius-full); background: transparent; color: var(--text-soft); cursor: pointer; }
.crl-act svg { width: 14px; height: 14px; }
@media (hover: hover) and (pointer: fine) { .crl-act:hover { background: var(--gray-100); color: var(--text-strong); } }
.crl-pop { position: absolute; top: calc(100% + var(--space-1)); right: 0; z-index: 5; display: flex; flex-direction: column; width: 208px; padding: var(--space-1) 0; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow-lg); }
.crl-pop button { display: block; padding: var(--space-2) var(--space-3); border: 0; background: none; font: inherit; text-align: left; cursor: pointer; }
.crl-pop b { display: block; font-size: var(--text-xs); font-weight: var(--fw-medium); color: var(--text-strong); }
.crl-pop span { display: block; margin-top: 2px; font-size: var(--text-2xs); color: var(--text-soft); }
@media (hover: hover) and (pointer: fine) { .crl-pop button:hover { background: var(--surface-sunk); } }
.crl-scroll { flex: 1; min-height: 0; overflow-y: auto; }
.crl-rows { display: flex; flex-direction: column; padding: var(--space-3); }
.crl-row { display: flex; align-items: baseline; gap: var(--space-2-5); width: 100%; padding: var(--space-1-5) var(--space-2); border: 0; border-radius: var(--radius-sm); background: transparent; font: inherit; text-align: left; cursor: pointer; transition: background var(--dur-fast) var(--ease); }
.crl-row-t { flex-shrink: 0; min-width: 36px; font-size: var(--text-2xs); line-height: 22px; font-variant-numeric: tabular-nums; color: var(--text-soft); }
.crl-row-x { flex: 1; min-width: 0; font-size: var(--text-sm); line-height: 22px; color: var(--text); }
.crl-row.is-on { background: var(--gray-100); }
.crl-row.is-on .crl-row-x { color: var(--text-strong); }
@media (hover: hover) and (pointer: fine) { .crl-row:not(.is-on):hover { background: var(--surface-sunk); } }
.crl-note { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 100%; padding: var(--space-7); text-align: center; }
.crl-note-ico { display: grid; place-items: center; width: 40px; height: 40px; margin-bottom: var(--space-4); border-radius: var(--radius-full); background: var(--gray-100); color: var(--text-soft); }
.crl-note-ico svg { width: 18px; height: 18px; }
.crl-note > .spinner { margin-bottom: var(--space-4); }
.crl-note-h { margin: 0; font-size: var(--text-sm); font-weight: var(--fw-semibold); color: var(--text-strong); }
.crl-note-sub { max-width: 240px; margin: var(--space-1-5) 0 0; font-size: var(--text-2xs); line-height: 18px; color: var(--text-soft); }
.crl-note .btn { margin-top: var(--space-4); }
.crl-loading { display: grid; place-items: center; min-height: 100%; margin: 0; }

/* ---- the editor (Cap's): on grey, the preview, the settings and the timeline each in a white card ---- */
.cle { display: flex; flex-direction: column; height: 100%; background: var(--surface-sunk); }
.cle > .clx-bar { border-bottom: 0; background: transparent; }
.cle-saved { flex: none; font-size: var(--text-xs); color: var(--text-soft); }
.cle.is-fwd .cle-preview, .cle.is-back .cle-preview { animation: cle-rise 340ms var(--ease-ios) both; }
.cle.is-fwd .cle-side, .cle.is-back .cle-side { animation: cle-rise 340ms 50ms var(--ease-ios) both; }
.cle.is-fwd .cle-timeline, .cle.is-back .cle-timeline { animation: cle-rise 340ms 100ms var(--ease-ios) both; }
@keyframes cle-rise { from { opacity: 0; transform: translateY(12px); } }
.cle-body { display: grid; flex: 1; grid-template-columns: minmax(0, 1fr) 368px; gap: var(--space-2); min-height: 0; padding: 0 var(--space-2); }
.cle-card { min-width: 0; min-height: 0; border-radius: var(--radius-lg); background: var(--surface); box-shadow: 0 0 0 1px var(--border-faint), var(--shadow-xs); }
.cle-preview { display: flex; flex-direction: column; }
.cle-tool { display: flex; flex: none; align-items: center; justify-content: space-between; height: 44px; padding: 0 var(--space-2); }
.cle-tool-l { display: flex; align-items: center; gap: 2px; }
.cle-tool .btn svg:last-child:not(:first-child) { width: 14px; height: 14px; color: var(--text-soft); }
.cle-stage { display: flex; flex: 1; align-items: center; justify-content: center; min-height: 0; padding: var(--space-1) var(--space-4); container-type: size; }
.cle-stage .clp { width: min(100cqw, calc(100cqh * var(--clp-ar, 1.78))); border-radius: 6px; box-shadow: 0 0 0 1px var(--border-faint), 0 12px 32px -8px var(--overlay-media); }
.cle-transport { display: grid; flex: none; grid-template-columns: 1fr auto 1fr; align-items: center; gap: var(--space-3); height: 56px; padding: 0 var(--space-3); }
.cle-time { font-size: var(--text-sm); font-variant-numeric: tabular-nums; color: var(--text-soft); white-space: nowrap; }
.cle-time b { font-weight: var(--fw-medium); color: var(--text-strong); }
.cle-play-row { display: flex; align-items: center; gap: var(--space-3); }
.cle-play-row .icon-ghost svg { width: 18px; height: 18px; }
.cle-play { display: grid; place-items: center; width: 38px; height: 38px; padding: 0; border: 0; border-radius: var(--radius-full); background: var(--text-strong); color: var(--surface); cursor: pointer; transition: transform var(--dur-fast) var(--ease); }
.cle-play svg { width: 18px; height: 18px; }
.cle-play:active { transform: scale(0.94); }
.cle-tools-r { display: flex; align-items: center; justify-self: end; gap: var(--space-1-5); }
.btn.cle-split { border-color: transparent; background: var(--gray-100); box-shadow: none; }
@media (hover: hover) and (pointer: fine) { .btn.cle-split:hover { background: var(--gray-150); } }
.cle-tz { width: 76px; }
.cle-side { display: flex; flex-direction: column; overflow: hidden; }
.cle-tabs { display: flex; flex: none; align-items: center; justify-content: space-around; height: 52px; padding: 0 var(--space-3); border-bottom: 1px solid var(--border-faint); }
.cle-tabs button { display: grid; place-items: center; width: 44px; height: 32px; padding: 0; border: 0; border-radius: 9px; background: transparent; color: var(--text-soft); cursor: pointer; transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease); }
.cle-tabs svg { width: 17px; height: 17px; }
.cle-tabs button.is-on { background: var(--gray-100); color: var(--text-strong); }
@media (hover: hover) and (pointer: fine) { .cle-tabs button:not(.is-on):hover { background: var(--surface-sunk); color: var(--text); } }
.cle-panel { display: flex; flex: 1; flex-direction: column; gap: var(--space-4); min-height: 0; padding: var(--space-3-5) var(--space-4) var(--space-6); overflow-y: auto; }
.cle-sec { display: flex; flex-direction: column; gap: var(--space-3); }
.cle-sec + .cle-sec, .cle-panel > p + .cle-sec { padding-top: var(--space-4); border-top: 1px solid var(--border-faint); }
.cle-sec-h { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); min-height: 24px; font-size: var(--text-sm); color: var(--text-soft); }
.cle-link { display: inline-flex; align-items: center; gap: var(--space-1); padding: 0; border: 0; background: none; font: inherit; color: var(--text-soft); cursor: pointer; }
.cle-link svg { width: 14px; height: 14px; }
@media (hover: hover) and (pointer: fine) { .cle-link:hover { color: var(--text-strong); } }
.cle-count { font-size: var(--text-xs); font-variant-numeric: tabular-nums; color: var(--text-soft); }
.cle-hint { margin: 0; font-size: var(--text-xs); line-height: 1.5; color: var(--text-soft); }
.cle-busy { display: flex; align-items: center; gap: var(--space-2); }
.cle-switch { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); min-height: 34px; font-size: var(--text-sm); color: var(--text); cursor: pointer; }
/* a row: name, slider, value (Cap's) */
.cle-row { display: grid; grid-template-columns: 84px minmax(0, 1fr) 44px; align-items: center; gap: var(--space-2-5); min-height: 34px; font-size: var(--text-sm); }
.cle-row--seg { grid-template-columns: 84px minmax(0, 1fr); }
.cle-row-l { color: var(--text); }
.cle-row-v { font-size: var(--text-2xs); font-style: normal; font-variant-numeric: tabular-nums; text-align: right; color: var(--text-soft); }
.cle-row.is-off { opacity: 0.45; }
.cle-row .segmented button { white-space: nowrap; }
/* the wallpapers: rounded tiles, the chosen one ringed in ink (STYLE-GUIDE §1c: selected, never the accent) */
.cle-walls { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: var(--space-1-5); }
.cle-wall { aspect-ratio: 1; padding: 0; border: 0; border-radius: var(--radius-sm); box-shadow: inset 0 0 0 1px var(--border-faint); cursor: pointer; transition: transform var(--dur-fast) var(--ease); }
.cle-wall.is-on { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--text-strong); }
.cle-wall[data-bg="lilac"] { background: var(--clip-bg-lilac); }
.cle-wall[data-bg="sky"] { background: var(--clip-bg-sky); }
.cle-wall[data-bg="peach"] { background: var(--clip-bg-peach); }
.cle-wall[data-bg="mint"] { background: var(--clip-bg-mint); }
.cle-wall[data-bg="ocean"] { background: var(--clip-bg-ocean); }
.cle-wall[data-bg="sun"] { background: var(--clip-bg-sun); }
.cle-wall[data-bg="ink"] { background: var(--clip-bg-ink); }
.cle-wall[data-bg="paper"] { background: var(--clip-bg-paper); }
@media (hover: hover) and (pointer: fine) { .cle-wall:not(.is-on):hover { transform: scale(1.06); } }
/* a slider: a thin track filled in ink to the thumb (--v), a white thumb */
.cle-range { width: 100%; height: 20px; margin: 0; background: transparent; cursor: pointer; -webkit-appearance: none; appearance: none; }
.cle-range:disabled { cursor: default; }
.cle-range::-webkit-slider-runnable-track { height: 3px; border-radius: var(--radius-full); background: linear-gradient(to right, var(--text-strong) calc(var(--v, 0) * 100%), var(--gray-200) 0); }
.cle-range::-moz-range-track { height: 3px; border-radius: var(--radius-full); background: linear-gradient(to right, var(--text-strong) calc(var(--v, 0) * 100%), var(--gray-200) 0); }
.cle-range::-webkit-slider-thumb { width: 14px; height: 14px; margin-top: -5.5px; border: 1px solid var(--border-strong); border-radius: var(--radius-full); background: var(--surface); box-shadow: var(--shadow-sm); -webkit-appearance: none; }
.cle-range::-moz-range-thumb { width: 14px; height: 14px; border: 1px solid var(--border-strong); border-radius: var(--radius-full); background: var(--surface); box-shadow: var(--shadow-sm); }
.cle-tz::-webkit-slider-runnable-track { background: var(--gray-200); }
.cle-tz::-moz-range-track { background: var(--gray-200); }
/* the bubble's corner: a little screen, a spot in each corner */
.cle-corners { position: relative; height: 120px; border: 1px solid var(--border-faint); border-radius: var(--radius-md); background: var(--surface-sunk); }
.cle-corner { position: absolute; width: 24px; height: 24px; padding: 0; border: 1.5px solid var(--border-strong); border-radius: var(--radius-full); background: var(--surface); cursor: pointer; transition: transform var(--dur-fast) var(--ease); }
.cle-corner--tl { top: var(--space-3); left: var(--space-3); } .cle-corner--tr { top: var(--space-3); right: var(--space-3); }
.cle-corner--bl { bottom: var(--space-3); left: var(--space-3); } .cle-corner--br { bottom: var(--space-3); right: var(--space-3); }
.cle-corner.is-on { border-color: var(--text-strong); background: var(--text-strong); }
@media (hover: hover) and (pointer: fine) { .cle-corner:not(.is-on):hover { transform: scale(1.1); } }
/* a zoom or a part picked on the timeline: Done, what it is, Delete; its settings in a grey box */
.cle-pickbar { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); font-size: var(--text-sm); font-weight: var(--fw-medium); color: var(--text-strong); }
.cle-box { display: flex; flex-direction: column; gap: var(--space-2-5); padding: var(--space-3-5); border-radius: var(--radius-lg); background: var(--surface-sunk); }
.cle-box .btn { align-self: flex-start; }
.cle-point { position: relative; overflow: hidden; border-radius: var(--radius-md); background: var(--gray-900); box-shadow: 0 0 0 1px var(--border-faint); cursor: crosshair; touch-action: none; }
.cle-point canvas { display: block; width: 100%; height: auto; min-height: 120px; }
.cle-point-dot { position: absolute; left: calc(var(--x, 0.5) * 100%); top: calc(var(--y, 0.5) * 100%); width: 24px; height: 24px; border: 2px solid var(--text-invert); border-radius: var(--radius-full); background: var(--overlay-media); box-shadow: 0 0 0 1px var(--gray-900), var(--shadow-md); transform: translate(-50%, -50%); pointer-events: none; }
.cle-lines { display: flex; flex-direction: column; max-height: 360px; margin: 0 calc(var(--space-2) * -1); overflow-y: auto; }
.cle-timeline { flex: none; margin: var(--space-2); padding: var(--space-2-5) var(--space-3) var(--space-3-5); }

/* ---- the timeline (Cap's): each row one grey bar with its name at the left, the ruler over them, a red playhead ---- */
.clt { display: grid; grid-template-columns: 96px minmax(0, 1fr); -webkit-user-select: none; user-select: none; }
.clt-names, .clt-lanes { display: grid; grid-template-rows: 26px 38px 38px; row-gap: var(--space-1-5); }
.clt-name { display: flex; align-items: center; gap: var(--space-2); padding: 0 var(--space-2-5); border-radius: var(--radius-md) 0 0 var(--radius-md); background: var(--surface-sunk); font-size: var(--text-sm); color: var(--text-muted); }
.clt-name-ico { display: grid; place-items: center; flex: none; width: 22px; height: 22px; border-radius: 6px; background: var(--gray-150); color: var(--text-muted); }
.clt-name-ico svg { width: 13px; height: 13px; }
.clt-name:nth-child(2) .clt-name-ico { background: var(--info-bg); color: var(--info-600); }
.clt-view { min-width: 0; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.clt-view::-webkit-scrollbar { display: none; }
.clt-lanes { position: relative; width: calc(100% * var(--clt-k, 1)); touch-action: none; }
/* the ruler: each second named over a short tick */
.clt-ruler { position: relative; cursor: pointer; }
.clt-tick { position: absolute; top: 0; bottom: 0; left: calc(var(--x) * 100%); pointer-events: none; }
.clt-tick::before { content: ""; position: absolute; left: 0; bottom: 0; width: 1px; height: 6px; background: var(--border-strong); }
.clt-tick.is-minor::before { height: 4px; background: var(--border); }
.clt-tick b { position: absolute; top: 1px; left: 0; transform: translateX(-50%); font-size: var(--text-2xs); font-weight: var(--fw-regular); font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--text-soft); }
.clt-tick:first-child b { transform: none; }
.clt-track { position: relative; border-radius: 0 var(--radius-md) var(--radius-md) 0; background: var(--surface-sunk); }
.clt-clip { cursor: pointer; }
.clt-parts { position: absolute; inset: 0; }
/* a part of the clip: a light blue block, a short blue bar inside its left edge, its name and length */
.clt-part {
  position: absolute; top: 0; bottom: 0; left: calc(var(--s) * 100% + 1px); width: calc((var(--e) - var(--s)) * 100% - 2px); display: flex; align-items: center;
  padding: 0 0 0 var(--space-4); overflow: hidden; border: 1px solid color-mix(in srgb, var(--info-600) 30%, transparent); border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--info-600) 9%, var(--surface)); font: inherit; text-align: left; cursor: pointer;
}
.clt-part::before { content: ""; position: absolute; top: 7px; bottom: 7px; left: 5px; width: 3px; border-radius: 2px; background: var(--info-600); }
.clt-part-label { position: relative; z-index: 1; display: flex; align-items: baseline; gap: var(--space-1-5); white-space: nowrap; font-size: var(--text-sm); color: var(--info-text); }
.clt-part-label b { font-weight: var(--fw-medium); }
.clt-part-label span { font-size: var(--text-xs); opacity: 0.7; }
.clt-part.is-cut { border-color: var(--border); background: repeating-linear-gradient(135deg, var(--surface-sunk) 0 5px, var(--gray-150) 5px 7px); }
.clt-part.is-cut::before { background: var(--border-strong); }
.clt-part.is-cut .clt-part-label { color: var(--text-soft); }
.clt-part.is-on { box-shadow: 0 0 0 1.5px var(--text-strong); }
/* a faint line at each second through the clip */
.clt-grid { position: absolute; inset: 1px 0; pointer-events: none; }
.clt-grid span { position: absolute; top: 0; bottom: 0; left: calc(var(--x) * 100%); width: 1px; background: color-mix(in srgb, var(--info-600) 14%, transparent); }
.clt-dim { position: absolute; top: 0; bottom: 0; z-index: 1; background: color-mix(in srgb, var(--surface) 72%, transparent); pointer-events: none; }
.clt-dim--l { left: 0; width: calc(var(--clt-a, 0) * 100%); }
.clt-dim--r { right: 0; width: calc((1 - var(--clt-b, 1)) * 100%); border-radius: 0 var(--radius-md) var(--radius-md) 0; }
/* the trim grips: a dark bar at either end, shown on hover */
.clt-handle { position: absolute; top: 0; bottom: 0; z-index: 2; display: grid; place-items: center; width: 14px; cursor: ew-resize; opacity: 0; transition: opacity var(--dur-fast) var(--ease); }
.clt-handle::after { content: ""; width: 3px; height: 16px; border-radius: 2px; background: var(--text-strong); }
.clt-handle--l { left: calc(var(--clt-a, 0) * 100%); }
.clt-handle--r { left: calc(var(--clt-b, 1) * 100% - 14px); }
.clt-handle:focus-visible, .clt.is-dragging .clt-handle { opacity: 1; }
@media (hover: hover) and (pointer: fine) { .clt-clip:hover .clt-handle { opacity: 1; } }
@media (hover: none) { .clt-handle { opacity: 1; } }
/* the zoom row: each zoom a slate block; empty, "Add zooms automatically", Generate and ✕ */
.clt-zooms { cursor: copy; }
.clt-empty { position: absolute; inset: 0; display: none; align-items: center; justify-content: center; gap: var(--space-3); font-size: var(--text-sm); color: var(--text-soft); pointer-events: none; }
.clt-empty button { pointer-events: auto; }
.clt-zooms.is-empty .clt-empty { display: flex; }
.clt-gen { height: 28px; padding: 0 var(--space-3); border: 0; border-radius: var(--radius-sm); background: var(--text-strong); color: var(--surface); font: inherit; font-size: var(--text-sm); font-weight: var(--fw-medium); cursor: pointer; }
@media (hover: hover) and (pointer: fine) { .clt-gen:hover { opacity: 0.88; } }
.clt-gen:active { transform: scale(0.97); }
.clt-gen-x { position: absolute; top: 50%; right: var(--space-2); display: grid; place-items: center; width: 26px; height: 26px; padding: 0; border: 0; border-radius: var(--radius-sm); background: none; color: var(--text-soft); transform: translateY(-50%); cursor: pointer; }
.clt-gen-x svg { width: 15px; height: 15px; }
@media (hover: hover) and (pointer: fine) { .clt-gen-x:hover { background: var(--gray-150); color: var(--text-strong); } }
.clt-zoom {
  position: absolute; top: 0; bottom: 0; left: calc(var(--s) * 100% + 1px); width: calc((var(--e) - var(--s)) * 100% - 2px); display: flex; align-items: center; justify-content: center;
  min-width: 0; padding: 0 var(--space-2-5) 0 var(--space-4); overflow: hidden; border: 1px solid color-mix(in srgb, var(--gray-500) 32%, transparent); border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--gray-500) 12%, var(--surface)); font: inherit; font-size: var(--text-sm); font-weight: var(--fw-medium); color: var(--text-muted);
  cursor: grab; container-type: inline-size; animation: clt-zoom-in 260ms var(--ease-ios) both;
}
.clt-zoom::before { content: ""; position: absolute; top: 7px; bottom: 7px; left: 5px; width: 3px; border-radius: 2px; background: var(--gray-500); }
@keyframes clt-zoom-in { from { opacity: 0; transform: scaleX(0.85); } }
.clt-zoom-in { display: flex; align-items: center; gap: var(--space-1-5); white-space: nowrap; }
.clt-zoom-in svg { flex: none; width: 13px; height: 13px; }
.clt-zoom-z { font-size: var(--text-xs); font-weight: var(--fw-regular); color: var(--text-soft); }
@container (max-width: 139px) { .clt-zoom-kind { display: none; } }
@container (max-width: 60px) { .clt-zoom-z { display: none; } }
.clt-zoom.is-on { box-shadow: 0 0 0 1.5px var(--text-strong); }
.clt.is-dragging .clt-zoom { cursor: grabbing; }
.clt-zoom-edge { position: absolute; top: 0; bottom: 0; z-index: 1; width: 10px; cursor: ew-resize; }
.clt-zoom-edge--l { left: 0; } .clt-zoom-edge--r { right: 0; }
.clt-ghost { position: absolute; top: 0; bottom: 0; left: calc(var(--s, 0) * 100% + 1px); width: calc((var(--e, 0) - var(--s, 0)) * 100% - 2px); display: none; place-items: center; border: 1px dashed var(--border-strong); border-radius: var(--radius-sm); color: var(--text-soft); pointer-events: none; }
.clt-ghost svg { width: 14px; height: 14px; }
.clt.is-ghost .clt-ghost { display: grid; }
/* where the pointer is (a faint line), and the playhead: a red line from a dot under the ruler */
.clt-hover { position: absolute; top: 26px; bottom: 0; left: calc(var(--clt-h, 0) * 100%); z-index: 2; width: 1px; background: var(--border-strong); opacity: 0; pointer-events: none; }
@media (hover: hover) and (pointer: fine) { .clt-lanes:hover .clt-hover { opacity: 1; } }
.clt.is-dragging .clt-hover { opacity: 0; }
.clt-head { position: absolute; top: 26px; bottom: 0; left: calc(var(--clt-t, 0) * 100%); z-index: 3; width: 1.5px; margin-left: -0.75px; background: var(--danger-600); cursor: ew-resize; }
.clt-head::before { content: ""; position: absolute; top: -6px; left: 50%; width: 12px; height: 12px; margin-left: -6px; border-radius: var(--radius-full); background: var(--danger-600); box-shadow: 0 0 0 2px var(--surface); }
.clt-head::after { content: ""; position: absolute; top: -8px; bottom: 0; left: -6px; width: 13px; }
.clt-bubble {
  position: absolute; bottom: calc(100% + var(--space-2)); left: 50%; transform: translateX(-50%); padding: 2px var(--space-1-5);
  border-radius: var(--radius-xs); background: var(--overlay-dark); color: var(--text-invert); font-size: var(--text-2xs); font-variant-numeric: tabular-nums;
  white-space: nowrap; opacity: 0; pointer-events: none; transition: opacity var(--dur-fast) var(--ease);
}
.clt.is-dragging .clt-bubble, .clt-head:focus-visible .clt-bubble { opacity: 1; }

/* ---- the player ---- */
.clp {
  position: relative; width: 100%; aspect-ratio: var(--clp-ar, 16 / 9); overflow: hidden; container-type: inline-size; font-family: var(--font-sans);
  border-radius: inherit; background: var(--clp-bg, var(--clp-black));
  -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent;
}
/* the picture: its pieces are placed by clipLayout (parts of its width and height, as --clp-s* / --clp-c*), and
   their corners and shadow are parts of its width (cqw), so a thumbnail and full screen look the same */
.clp-frame { position: absolute; inset: 0; overflow: hidden; container-type: inline-size; }
.clp.is-full .clp-frame { inset: auto; top: 50%; left: 50%; width: min(100vw, 100vh * var(--clp-ar, 1.78)); aspect-ratio: var(--clp-ar, 16 / 9); transform: translate(-50%, -50%); }
.clp-stage {
  position: absolute; overflow: hidden; background: var(--clp-black);
  left: calc(var(--clp-sx, 0) * 100%); top: calc(var(--clp-sy, 0) * 100%); width: calc(var(--clp-sw, 1) * 100%); height: calc(var(--clp-sh, 1) * 100%);
  /* a zoom (Cap's): the whole framed screen magnified about its point, growing over the wallpaper; the picture's edge
     cuts it off. A slight blur while it moves (--clp-zb, px) */
  transform-origin: calc(var(--clp-zx, 0.5) * 100%) calc(var(--clp-zy, 0.5) * 100%); transform: scale(var(--clp-z, 1));
  filter: blur(calc(var(--clp-zb, 0) * 1px));
}
.clp.is-framed .clp-stage { border-radius: var(--clp-r, 1.4cqw); box-shadow: var(--clp-frame-shadow); }
.clp.is-camonly .clp-stage { visibility: hidden; }   /* (it still plays: the screen carries the sound) */
.clp-screen { display: block; width: 100%; height: 100%; object-fit: contain; background: var(--clp-black); transition: opacity 360ms var(--ease); }
.clp-cam {
  position: absolute; object-fit: cover; background: var(--overlay-dark); border-radius: 1.4cqw; pointer-events: none;
  left: calc(var(--clp-cx, 0) * 100%); top: calc(var(--clp-cy, 0) * 100%); width: calc(var(--clp-cw, 0.2) * 100%); height: calc(var(--clp-ch, 0.2) * 100%);
}
/* loading: the frame shimmers until there's a picture, which then fades in (the camera too, once it has a frame) */
.clp.is-loading .clp-screen, .clp-cam:not(.is-in) { opacity: 0; }
.clp-cam { transition: opacity 360ms var(--ease); }
.clp.is-loading .clp-big { opacity: 0; pointer-events: none; }
.clp.is-loading .clp-stage::after {
  content: ""; position: absolute; inset: 0; background: linear-gradient(100deg, transparent 30%, var(--clp-glyph-hover) 50%, transparent 70%);
  background-size: 250% 100%; animation: clp-shine 1.5s var(--ease) infinite;
}
@keyframes clp-shine { from { background-position: 120% 0; } to { background-position: -20% 0; } }
/* waiting for more of the video: a white ring in the middle, after a moment */
.clp-spin {
  position: absolute; top: 50%; left: 50%; z-index: 1; width: 40px; height: 40px; margin: -20px 0 0 -20px; border: 3px solid var(--clp-track); border-top-color: var(--text-invert);
  border-radius: var(--radius-full); opacity: 0; pointer-events: none; animation: spin 0.8s linear infinite;
}
.clp.is-buffering:not(.is-paused) .clp-spin { opacity: 1; transition: opacity var(--dur) var(--ease) 400ms; }
/* the bubble shrinks towards its corner while a zoom is on (clipLayout camShrink: --clp-ck) */
.clp.cam-round .clp-cam { border-radius: var(--clp-cr, 50%); box-shadow: var(--clp-cam-ring); transform: scale(var(--clp-ck, 1)); transform-origin: var(--clp-co, 0% 100%); }
.clp.is-framed:not(.cam-round) .clp-cam { border-radius: var(--clp-r, 1.4cqw); box-shadow: var(--clp-frame-shadow); }
/* bare: the editor's preview, its controls under it instead */
.clp.is-bare .clp-bar, .clp.is-bare .clp-big { display: none; }
.clp.is-bare.is-idle { cursor: default; }
.clp.no-cam .clp-cam, .clp-cam.is-off { visibility: hidden; }
.clp-big {
  position: absolute; top: 50%; left: 50%; display: grid; place-items: center; width: clamp(52px, 11cqw, 88px); height: clamp(52px, 11cqw, 88px); transform: translate(-50%, -50%);
  border: 0; border-radius: var(--radius-full); background: var(--text-invert); color: var(--clp-on-white); box-shadow: var(--shadow-lg);
  cursor: pointer; opacity: 0; pointer-events: none; transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.clp-big svg { width: 42%; height: 42%; }
.clp.is-paused:not(.is-scrubbing) .clp-big { opacity: 1; pointer-events: auto; }
@media (hover: hover) and (pointer: fine) { .clp-big:hover { transform: translate(-50%, -50%) scale(1.05); } }
/* captions: a black pill with bold white words, low over the picture, lifted while the controls show */
.clp-cap {
  position: absolute; left: 50%; bottom: max(12%, 92px); z-index: 1; max-width: 82%; margin: 0; padding: 0.4em 0.9em;
  transform: translateX(-50%); border-radius: 0.9em; background: var(--clp-cap-bg); color: var(--text-invert);
  font-size: max(13px, 2.1cqw); font-weight: var(--fw-semibold); line-height: 1.35; text-align: center; text-wrap: balance;
  pointer-events: none; transition: bottom var(--dur) var(--ease);
}
.clp-cap[hidden] { display: none; }
.clp.is-idle .clp-cap, .clp.is-start:not(:hover):not(:focus-within) .clp-cap { bottom: 6%; }
.clp-btn.is-on { background: var(--clp-glyph-hover); }
.clp-msg { position: absolute; inset: auto var(--space-6) 50%; transform: translateY(50%); text-align: center; font-size: var(--text-sm); color: var(--text-invert); }
.clp.is-error .clp-big, .clp.is-error .clp-bar { display: none; }

/* the controls (Cap's): the scrubber across the top, the buttons under it, on a dark gradient */
.clp-bar {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 2; display: flex; flex-direction: column; gap: 2px;
  padding: var(--space-8) var(--space-3) var(--space-2); background: var(--clp-scrim); color: var(--text-invert);
  transition: opacity var(--dur) var(--ease);
}
.clp.is-start:not(:hover):not(:focus-within) .clp-bar,
.clp.is-idle:not(.is-menu) .clp-bar { opacity: 0; }
.clp.is-idle:not(.is-menu) { cursor: none; }
.clp-row { display: flex; align-items: center; gap: 2px; min-width: 0; }
.clp-gap { flex: 1; }
.clp-btn {
  display: inline-grid; place-items: center; flex-shrink: 0; width: 36px; height: 36px; padding: 0;
  border: 0; border-radius: var(--radius-md); background: transparent; color: inherit; cursor: pointer;
}
.clp-btn[hidden] { display: none; }
.clp-btn svg { width: 20px; height: 20px; }
.clp-skip svg { width: 21px; height: 21px; }
@media (hover: hover) and (pointer: fine) { .clp-btn:hover { background: var(--clp-glyph-hover); } }
.clp-time { flex-shrink: 0; padding: 0 var(--space-2); font-size: var(--text-sm); font-weight: var(--fw-medium); font-variant-numeric: tabular-nums; white-space: nowrap; }
/* the sound: a slider slides out beside the button */
.clp-vol { display: inline-flex; align-items: center; }
.clp-vol-r {
  width: 0; height: 36px; margin: 0; opacity: 0; background: transparent; cursor: pointer; -webkit-appearance: none; appearance: none;
  transition: width var(--dur) var(--ease), opacity var(--dur) var(--ease), margin var(--dur) var(--ease);
}
.clp-vol:focus-within .clp-vol-r { width: 64px; margin: 0 var(--space-1-5) 0 var(--space-1); opacity: 1; }
@media (hover: hover) and (pointer: fine) { .clp-vol:hover .clp-vol-r { width: 64px; margin: 0 var(--space-1-5) 0 var(--space-1); opacity: 1; } }
.clp-vol-r::-webkit-slider-runnable-track { height: 4px; border-radius: var(--radius-full); background: linear-gradient(to right, var(--text-invert) calc(var(--clp-vol, 1) * 100%), var(--clp-track) 0); }
.clp-vol-r::-moz-range-track { height: 4px; border-radius: var(--radius-full); background: linear-gradient(to right, var(--text-invert) calc(var(--clp-vol, 1) * 100%), var(--clp-track) 0); }
.clp-vol-r::-webkit-slider-thumb { width: 12px; height: 12px; margin-top: -4px; border: 0; border-radius: var(--radius-full); background: var(--text-invert); -webkit-appearance: none; }
.clp-vol-r::-moz-range-thumb { width: 12px; height: 12px; border: 0; border-radius: var(--radius-full); background: var(--text-invert); }
/* Settings: the speed, in a small dark menu above the button */
.clp-set { position: relative; display: inline-flex; }
.clp-menu {
  position: absolute; right: 0; bottom: calc(100% + var(--space-2)); display: flex; flex-direction: column; min-width: 148px; padding: var(--space-1);
  border-radius: var(--radius-lg); background: var(--clp-cap-bg); box-shadow: var(--shadow-lg); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
}
.clp-menu[hidden] { display: none; }
.clp-menu-h { padding: var(--space-1-5) var(--space-2-5) var(--space-1); font-size: var(--text-xs); font-weight: var(--fw-medium); color: var(--clp-glyph-soft); }
.clp-menu button {
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); height: 32px; padding: 0 var(--space-2-5);
  border: 0; border-radius: var(--radius-md); background: transparent; color: inherit; font: inherit; font-size: var(--text-sm); cursor: pointer;
}
.clp-menu button svg { width: 15px; height: 15px; visibility: hidden; }
.clp-menu button[aria-checked="true"] svg { visibility: visible; }
@media (hover: hover) and (pointer: fine) { .clp-menu button:hover { background: var(--clp-glyph-hover); } }
/* the scrubber: a 4px line, played in white, the chapters gapped on it; a white thumb on hover */
.clp-scrub { position: relative; height: 20px; margin: 0 var(--space-1-5); cursor: pointer; touch-action: none; }
.clp-scrub-track { position: absolute; top: 50%; left: 0; right: 0; height: 4px; margin-top: -2px; border-radius: var(--radius-full); background: var(--clp-track); overflow: hidden; transition: height var(--dur-fast) var(--ease), margin var(--dur-fast) var(--ease); }
.clp-scrub-fill { display: block; width: 100%; height: 100%; background: var(--text-invert); transform-origin: left; transform: scaleX(var(--clp-p, 0)); }
.clp-marks span { position: absolute; top: 50%; left: calc(var(--x) * 100%); width: 3px; height: 8px; margin: -4px 0 0 -1.5px; background: var(--clp-black); opacity: 0.55; pointer-events: none; }
.clp-scrub-thumb {
  position: absolute; top: 50%; left: calc(var(--clp-p, 0) * 100%); width: 12px; height: 12px; margin: -6px 0 0 -6px;
  border-radius: var(--radius-full); background: var(--text-invert); box-shadow: var(--shadow-sm);
  transform: scale(0); transition: transform var(--dur-fast) var(--ease);
}
.clp-scrub:focus-visible .clp-scrub-thumb, .clp.is-scrubbing .clp-scrub-thumb { transform: scale(1); }
@media (hover: hover) and (pointer: fine) { .clp-scrub:hover .clp-scrub-thumb { transform: scale(1); } .clp-scrub:hover .clp-scrub-track { height: 6px; margin-top: -3px; } }
@media (hover: none) { .clp-scrub-thumb { transform: scale(1); } }
/* hovering the scrubber: the frame there, its chapter and its time */
.clp-tip {
  position: absolute; bottom: calc(100% + var(--space-2)); left: clamp(84px, calc(var(--x, 0) * 100%), calc(100% - 84px)); display: none; flex-direction: column; align-items: center; gap: var(--space-1);
  width: 168px; transform: translateX(-50%); pointer-events: none;
}
.clp.is-tip:not(.is-scrubbing) .clp-tip { display: flex; }
.clp-tip-pic { display: block; width: 168px; aspect-ratio: var(--clp-ar, 16 / 9); overflow: hidden; border: 2px solid var(--text-invert); border-radius: var(--radius-md); background: var(--clp-black); box-shadow: var(--shadow-lg); }
.clp-tip-pic video { display: block; width: 100%; height: 100%; object-fit: contain; }
.clp-tip-ch { max-width: 100%; overflow: hidden; font-size: var(--text-xs); font-weight: var(--fw-semibold); white-space: nowrap; text-overflow: ellipsis; text-shadow: 0 1px 2px var(--clp-black); }
.clp-tip-ch:empty { display: none; }
.clp-tip-t { padding: 1px var(--space-1-5); border-radius: var(--radius-xs); background: var(--clp-cap-bg); font-size: var(--text-xs); font-variant-numeric: tabular-nums; }
@container (max-width: 520px) { .clp-skip, .clp-vol-r { display: none; } }


/* ---- the browser recorder ---- */
.clr-setup { display: flex; flex-direction: column; align-items: center; gap: var(--space-4); }
.clr-preview { position: relative; width: 120px; height: 120px; overflow: hidden; border-radius: var(--radius-full); background: var(--surface-sunk); box-shadow: inset 0 0 0 1px var(--border); }
.clr-preview video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }   /* a mirror, as a camera preview is (the recording isn't) */
.clr-preview-off { position: absolute; inset: 0; display: none; flex-direction: column; align-items: center; justify-content: center; gap: var(--space-1); font-size: var(--text-xs); color: var(--text-soft); }
.clr-preview-off svg { width: 20px; height: 20px; }
.clr-preview.is-off video { display: none; }
.clr-preview.is-off .clr-preview-off { display: flex; }
.clr-fields { display: flex; flex-direction: column; gap: var(--space-3); width: 100%; }
.clr-field { display: flex; flex-direction: column; gap: var(--space-1-5); }
.clr-label { display: inline-flex; align-items: center; gap: var(--space-1-5); font-size: var(--text-sm); font-weight: var(--fw-medium); color: var(--text-strong); }
.clr-label svg { width: 15px; height: 15px; color: var(--text-soft); }
/* the mic's level: live sound shows as a green bar (status: it hears you) */
.clr-meter { display: block; height: 4px; margin-top: calc(var(--space-1-5) * -1); border-radius: var(--radius-full); background: var(--surface-sunk); overflow: hidden; }
.clr-meter[hidden] { display: none; }
.clr-meter > span { display: block; width: 100%; height: 100%; background: var(--success-600); transform-origin: left; transform: scaleX(var(--lvl, 0)); transition: transform 60ms linear; }
.clr-note { margin: 0; font-size: var(--text-xs); line-height: 1.45; text-align: center; color: var(--text-soft); }
.clr-actions { display: flex; justify-content: flex-end; gap: var(--space-2); width: 100%; }
.clr-dot { width: 8px; height: 8px; border-radius: var(--radius-full); background: var(--danger-600); }


/* the recording bar: Stop (red: it's recording), the time, then pause / start again / delete */
.clr-bar {
  display: inline-flex; align-items: center; gap: var(--space-1); height: 48px; padding: 0 var(--space-2) 0 var(--space-1-5);
  border: 1px solid var(--border); border-radius: var(--radius-full); background: var(--surface); box-shadow: var(--shadow-lg);
  font-family: var(--font-sans); color: var(--text);
}
.clr-stop { display: grid; place-items: center; width: 34px; height: 34px; border: 0; border-radius: var(--radius-full); background: var(--danger-600); cursor: pointer; }
.clr-stop-sq { width: 11px; height: 11px; border-radius: 2px; background: var(--text-invert); }
@media (hover: hover) and (pointer: fine) { .clr-stop:hover { background: var(--danger-700); } }
.clr-time { min-width: 44px; padding: 0 var(--space-1); font-size: var(--text-md); font-weight: var(--fw-semibold); font-variant-numeric: tabular-nums; color: var(--text-strong); }
.clr-state { font-size: var(--text-xs); color: var(--text-soft); white-space: nowrap; }
.clr-state:empty { display: none; }
.clr-sep { width: 1px; height: 20px; margin: 0 var(--space-1); background: var(--border); }
.clr-btn { display: grid; place-items: center; width: 32px; height: 32px; padding: 0; border: 0; border-radius: var(--radius-full); background: transparent; color: var(--text-muted); cursor: pointer; }
.clr-btn svg { width: 17px; height: 17px; }
.clr-btn:disabled { opacity: 0.4; cursor: default; }
@media (hover: hover) and (pointer: fine) { .clr-btn:not(:disabled):hover { background: var(--nav-hover-bg); color: var(--text-strong); } }
.clr-btn.is-armed { background: var(--danger-bg); color: var(--danger-700); }
.is-paused .clr-time { color: var(--text-soft); }
.is-counting .clr-time { visibility: hidden; width: 0; min-width: 0; padding: 0; }
/* in the floating window: the bar is the page */
body.clr-pip { display: grid; place-items: center; min-height: 100vh; margin: 0; overflow: hidden; background: var(--surface); }
body.clr-pip .clr-bar { width: 100%; height: 100vh; border: 0; border-radius: 0; box-shadow: none; }
/* docked at the bottom of the tab when there's no floating window */
.clr-dock { position: fixed; left: 50%; bottom: max(var(--space-6), env(safe-area-inset-bottom)); z-index: var(--z-sheet); transform: translateX(-50%); }

.clr-link { padding: 0; border: 0; background: none; font: inherit; color: var(--text-strong); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
@media (prefers-reduced-motion: reduce) {
  .clp-bar, .clp-big, .clp-scrub-thumb, .clp-scrub-track, .clp-vol-r, .clx-progress span, .clt-bubble, .clr-meter > span, .clp-cap, .clp-screen, .clp-cam, .clx-thumb img, img.clx-poster,
  .clx-card-acts, .clx-thumb img, .clt-handle, .cle-wall, .cle-corner, .cle-play { transition: none; }
  .clx.is-entering, .clx.is-leaving, .clx-page.is-fwd, .clx-page.is-back, .crl-in-r, .crl-in-l, .crl-in, .clx-grid.is-rising .clx-card,
  .clp.is-loading .clp-stage::after, .clx-thumb:has(img:not(.is-in)), .clt-zoom, .clx-opening-ico, .crl-bar, .clx-connect-dots i,
  .cle.is-fwd .cle-preview, .cle.is-fwd .cle-side, .cle.is-fwd .cle-timeline, .cle.is-back .cle-preview, .cle.is-back .cle-side, .cle.is-back .cle-timeline { animation: none; }
}

/* the top bar's Clips button sits beside the bell (the bell's size); phones keep their short bar */
.topbar-clips { width: var(--control-md); height: var(--control-md); }

@media (max-width: 1024px) {
  .clx-clip-grid { grid-template-columns: minmax(0, 1fr); }
  .clx-rail { height: 60svh; min-height: 360px; }
  .cle-body { grid-template-columns: minmax(0, 1fr) 300px; }
  .clx-url { display: none; }
}
@media (max-width: 640px) {
  .clx-lib { padding: var(--space-4) var(--space-4) var(--space-8); }
  .clx-clip-in { padding: var(--space-4) var(--space-4) var(--space-6); }
  .clx-bar .btn:not(.btn-primary):not(.clx-back) span, .clx-back span { display: none; }
  .clx-choose { grid-template-columns: 1fr; }
  .cle-body { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; }
  .cle-side { max-height: 40vh; }
  .cle-tools-r .cle-tz, .cle-tools-r [data-tz], .cle-tools-r .clx-bar-sep { display: none; }
  .clt { grid-template-columns: 0 minmax(0, 1fr); }
  .clt-names { visibility: hidden; }
  .topbar-clips { display: none; }
}
