/* copy-edit-motion.css — the copy-edit page's look and motion.
 *
 * Loaded AFTER the page's inline <style>, so it wins on equal specificity
 * without editing those rules in place.
 *
 * Two constraints shaped everything here:
 *
 * 1. LYRC design standard (CLAUDE.md rule 8): one blue accent #3B82F6, no
 *    gradients on controls, no clipped labels, real empty states. The page
 *    had drifted to a pink gradient title and purple pills everywhere.
 *
 * 2. The render is a REALTIME capture. Anything that costs main-thread time
 *    while it records is baked into the video as lag - the bug fixed on
 *    2026-10-12 was exactly that. So every animation below touches only
 *    transform and opacity, which the compositor runs off the main thread,
 *    and decorative loops are paused outright while .cfm-rendering is set.
 */

/* ── tokens ─────────────────────────────────────────────────────────── */
body .cf-copy-shell {
  --sb-accent: #3B82F6;
  --portal-accent: #3B82F6;
  --portal-border-hot: rgba(59, 130, 246, 0.85);
  --cfm-canvas: #000000;
  --cfm-timeline: #0B0C10;
  --cfm-card: #1A1B22;
  --cfm-raised: #1C1E26;
  --cfm-hover: #22242E;
  --cfm-line: #1F2128;
  --cfm-line-strong: #2A2C36;
  --cfm-text: #FFFFFF;
  --cfm-dim: rgba(255, 255, 255, 0.70);
  --cfm-faint: rgba(255, 255, 255, 0.50);
  --cfm-ghost: rgba(255, 255, 255, 0.30);
  --cfm-accent: #3B82F6;
  --cfm-accent-soft: rgba(59, 130, 246, 0.16);
  --cfm-accent-line: rgba(59, 130, 246, 0.45);
  --cfm-ok: #34D399;
  --cfm-r-sm: 6px;
  --cfm-r-md: 8px;
  --cfm-r-lg: 12px;
  /* One easing family everywhere, so the page moves like one thing. */
  --cfm-out: cubic-bezier(0.16, 1, 0.3, 1);
  --cfm-io: cubic-bezier(0.65, 0, 0.35, 1);
  --cfm-fast: 140ms;
  --cfm-med: 320ms;
  --cfm-slow: 560ms;
}

/* ── the [hidden] fix ───────────────────────────────────────────────── */
/* `.cf-progress { display: flex }` and friends override the UA rule for
   [hidden], so the page showed "Working…" on an empty page, and Download,
   Re-build and an empty video player before any footage existed. */
.cf-copy-shell [hidden] { display: none !important; }

/* ── palette: back to LYRC ──────────────────────────────────────────── */
.cf-copy-hero h1 {
  background: none !important;
  -webkit-background-clip: border-box !important;
  background-clip: border-box !important;
  color: var(--cfm-text) !important;
  letter-spacing: -0.025em;
}
.cf-how {
  background: var(--cfm-timeline) !important;
  border-color: var(--cfm-line) !important;
}
.cf-how-head::before,
.cf-how-dot { background: var(--cfm-accent) !important; box-shadow: 0 0 10px rgba(59, 130, 246, 0.6) !important; }
.cf-how-num {
  background: var(--cfm-accent-soft) !important;
  color: #9CC3FF !important;
  border: 1px solid var(--cfm-accent-line);
  box-shadow: none !important;
}
.cf-shot-pill--tx { background: rgba(59, 130, 246, 0.85) !important; border-color: rgba(147, 197, 253, 0.6) !important; color: #fff !important; }
.cf-breakdown-chip.is-tx { background: var(--cfm-accent-soft) !important; border-color: var(--cfm-accent-line) !important; }
.cf-shot-bar span { background: var(--cfm-accent) !important; }
.cf-clip-tag--energy-lo { color: #9CC3FF !important; background: var(--cfm-accent-soft) !important; border-color: var(--cfm-accent-line) !important; }
.cf-plan-score { background: var(--cfm-accent-soft) !important; border-color: var(--cfm-accent-line) !important; color: #CFE1FF !important; }
.cf-orient-btn.is-active,
.cf-orient-btn[aria-pressed="true"] {
  background: var(--cfm-accent-soft) !important;
  border-color: var(--cfm-accent-line) !important;
  color: #fff !important;
}

/* Flat surfaces, LYRC radii. Panels are decorative, but flat reads cleaner
   against black and matches the beat timeline. */
.cf-drop,
.cf-stat,
.cf-clip,
.cf-plan,
.cf-timeline,
.cf-orient,
.cf-progress,
.cf-output {
  background: var(--cfm-timeline) !important;
  border-color: var(--cfm-line) !important;
}
.cf-stat, .cf-clip, .cf-shot { border-radius: var(--cfm-r-md) !important; }
.cf-drop, .cf-plan, .cf-timeline, .cf-orient, .cf-progress, .cf-output { border-radius: var(--cfm-r-lg) !important; }

/* Controls: flat accent, real hover / press / focus. */
.cf-copy-shell .sb-bt-btn--primary {
  background: var(--cfm-accent) !important;
  border: 1px solid transparent !important;
  box-shadow: none !important;
  transition: transform var(--cfm-fast) var(--cfm-out), background-color var(--cfm-fast) ease-out;
}
.cf-copy-shell .sb-bt-btn--primary:hover:not(:disabled) { background: #4F8FF7 !important; transform: translateY(-1px); }
.cf-copy-shell .sb-bt-btn:active:not(:disabled) { transform: translateY(0) scale(0.97); }
.cf-copy-shell .sb-bt-btn:focus-visible { outline: none; box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.5) !important; }
.cf-copy-shell .sb-bt-btn:disabled { opacity: 0.55; }

/* ── the drop zones ─────────────────────────────────────────────────── */
.cf-drop { position: relative; overflow: hidden; isolation: isolate; transition: transform var(--cfm-med) var(--cfm-out), border-color var(--cfm-fast); }
.cf-drop:hover { border-color: var(--cfm-line-strong) !important; }
/* A slow breathing rim: the page looks awake before anyone touches it. */
.cf-drop::before {
  content: ""; position: absolute; inset: -1px; border-radius: inherit; pointer-events: none; z-index: -1;
  box-shadow: inset 0 0 0 1px var(--cfm-accent-line), 0 0 42px rgba(59, 130, 246, 0.16);
  opacity: 0; animation: cfm-breathe 4.6s var(--cfm-io) infinite;
}
.cf-drop.is-drag { transform: scale(1.008) !important; border-color: var(--cfm-accent) !important; background: var(--cfm-timeline) !important; }
.cf-drop.is-drag::before { animation: none; opacity: 1; }
.cf-drop-icon { display: inline-block; animation: cfm-float 5.5s var(--cfm-io) infinite; }
@keyframes cfm-breathe { 0%, 100% { opacity: 0; } 50% { opacity: 0.85; } }
@keyframes cfm-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }

/* ── entrances ──────────────────────────────────────────────────────── */
@keyframes cfm-rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes cfm-pop  { from { opacity: 0; transform: translateY(8px) scale(0.965); } to { opacity: 1; transform: none; } }
@keyframes cfm-fade { from { opacity: 0; } to { opacity: 1; } }

.cf-copy-hero, .cf-how, #cfDrop { animation: cfm-rise var(--cfm-slow) var(--cfm-out) both; }
.cf-how { animation-delay: 60ms; }
#cfDrop { animation-delay: 120ms; }

/* Sections play their entrance when they first appear (display none ->
   shown restarts a CSS animation, so no JS is needed for any of this). */
#cfResults:not([hidden]) > *,
#cfFootage:not([hidden]) > * { animation: cfm-rise var(--cfm-slow) var(--cfm-out) both; }
#cfResults:not([hidden]) > *:nth-child(2) { animation-delay: 90ms; }
#cfResults:not([hidden]) > *:nth-child(3) { animation-delay: 180ms; }

/* Staggered cards. Capped so a 60-card grid doesn't trickle in for seconds. */
.cf-stat, .cf-shot, .cf-clip, .cf-plan-row { animation: cfm-pop var(--cfm-slow) var(--cfm-out) both; }
.cf-stat:nth-child(1) { animation-delay: 0ms; }   .cf-stat:nth-child(2) { animation-delay: 45ms; }
.cf-stat:nth-child(3) { animation-delay: 90ms; }  .cf-stat:nth-child(4) { animation-delay: 135ms; }
.cf-stat:nth-child(5) { animation-delay: 180ms; } .cf-stat:nth-child(6) { animation-delay: 225ms; }
.cf-stat:nth-child(7) { animation-delay: 270ms; } .cf-stat:nth-child(8) { animation-delay: 315ms; }
.cf-stat:nth-child(9) { animation-delay: 360ms; } .cf-stat:nth-child(n+10) { animation-delay: 400ms; }
/* Shot, clip and plan-row delays are set as cards arrive (copy-edit-motion.js). */

/* Cards respond to the pointer. */
.cf-shot, .cf-clip { transition: transform var(--cfm-med) var(--cfm-out), border-color var(--cfm-fast) ease-out !important; }
.cf-shot:hover, .cf-clip:hover { transform: translateY(-3px) !important; border-color: var(--cfm-accent-line) !important; }
.cf-shot img, .cf-clip-thumb img { transition: transform var(--cfm-slow) var(--cfm-out); }
.cf-shot:hover img, .cf-clip:hover .cf-clip-thumb img { transform: scale(1.045); }
.cf-shot-thumb, .cf-clip-thumb { overflow: hidden; }

/* ── plan rows: the overlapping labels ──────────────────────────────── */
/* In a five-across grid each card is ~200px: two 56px thumbnails, an arrow
   and the score badge leave nothing for the text. It used to wrap one word
   per line under the badge; squeezing it onto one line just hid it. The text
   gets its own full-width line under the thumbnails instead. */
.cf-plan-row { flex-wrap: wrap !important; gap: 8px 10px !important; align-items: center !important; }
.cf-plan-score { flex: 0 0 auto !important; position: static !important; margin-left: auto; }
.cf-plan-body { order: 10; flex: 1 0 100% !important; min-width: 0 !important; }
.cf-plan-name, .cf-plan-meta { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── live panels (built by copy-edit-motion.js) ─────────────────────── */
/* The plain spinner line stays in the DOM for screen readers and as the
   fallback, but the panel above it does the talking. */
.cf-progress.cfm-has-stage { display: block !important; padding: 18px 20px !important; }
.cf-progress.cfm-has-stage[hidden] { display: none !important; }
.cf-progress.cfm-has-stage > .cf-spinner { display: none; }
.cf-progress.cfm-has-stage > .cf-progress-msg {
  display: block; margin-top: 12px; font-size: 12.5px; color: var(--cfm-faint);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cf-progress.is-error.cfm-has-stage > .cf-progress-msg { color: #ffb4c4; white-space: normal; }

.cfm-head { display: flex; align-items: center; gap: 10px; min-height: 22px; }
.cfm-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--cfm-accent); position: relative; flex: 0 0 auto; }
.cfm-dot::after {
  content: ""; position: absolute; inset: 0; border-radius: 50%; background: var(--cfm-accent);
  animation: cfm-ping 1.6s var(--cfm-out) infinite;
}
.cfm-dot.is-done { background: var(--cfm-ok); }
.cfm-dot.is-done::after { animation: none; opacity: 0; }
@keyframes cfm-ping { from { transform: scale(1); opacity: 0.55; } to { transform: scale(3.2); opacity: 0; } }
.cfm-title { font-size: 15px; font-weight: 700; letter-spacing: -0.01em; color: var(--cfm-text); }
.cfm-title-swap { display: inline-block; animation: cfm-rise var(--cfm-med) var(--cfm-out) both; }
.cfm-meta { margin-left: auto; font-size: 12.5px; color: var(--cfm-dim); font-variant-numeric: tabular-nums; white-space: nowrap; }
.cfm-meta b { color: var(--cfm-text); font-weight: 700; font-size: 15px; margin-right: 3px; }

/* The strip: frames tile in as they're decoded, cuts drop onto them. */
.cfm-strip {
  position: relative; height: 76px; margin-top: 14px; border-radius: var(--cfm-r-md);
  background: var(--cfm-canvas); overflow: hidden; contain: strict;
  box-shadow: inset 0 0 0 1px var(--cfm-line);
}
.cfm-frames, .cfm-cuts, .cfm-veil, .cfm-light { position: absolute; inset: 0; }
.cfm-frame {
  position: absolute; top: 0; bottom: 0; object-fit: cover; height: 100%;
  animation: cfm-frame-in 420ms var(--cfm-out) both;
}
@keyframes cfm-frame-in { from { opacity: 0; transform: scale(1.12); } to { opacity: 1; transform: none; } }

/* What hasn't been read yet is dimmed; the veil slides off as the head moves. */
.cfm-veil {
  background: rgba(0, 0, 0, 0.62);
  transform-origin: right center;
  transform: scaleX(1);
  transition: transform 420ms var(--cfm-out);
}
.cfm-scan {
  position: absolute; top: 0; bottom: 0; left: 0; width: 100%; pointer-events: none;
  transform: translateX(-100%); transition: transform 420ms var(--cfm-out);
}
.cfm-scan::after {
  content: ""; position: absolute; right: -1px; top: 0; bottom: 0; width: 2px;
  background: #fff; box-shadow: 0 0 14px 2px rgba(59, 130, 246, 0.9), 0 0 2px rgba(255, 255, 255, 0.9);
}
.cfm-scan::before {
  content: ""; position: absolute; right: 0; top: 0; bottom: 0; width: 90px;
  background: linear-gradient(90deg, rgba(59, 130, 246, 0), rgba(59, 130, 246, 0.22));
}
.cfm-strip.is-read .cfm-scan { opacity: 0; transition: opacity 500ms ease-out, transform 420ms var(--cfm-out); }

.cfm-cut {
  position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px;
  background: #fff; box-shadow: 0 0 8px rgba(255, 255, 255, 0.55);
  transform-origin: top center;
  animation: cfm-cut-in 520ms var(--cfm-out) both;
}
@keyframes cfm-cut-in {
  0% { opacity: 0; transform: scaleY(0); }
  60% { opacity: 1; transform: scaleY(1.04); }
  100% { opacity: 0.9; transform: scaleY(1); }
}

/* The shot being worked on in the later passes. */
.cfm-light {
  left: 0; width: 100%; transform-origin: left center;
  transform: translateX(0) scaleX(0); opacity: 0;
  box-shadow: inset 0 0 0 2px var(--cfm-accent);
  background: rgba(59, 130, 246, 0.14);
  transition: transform 300ms var(--cfm-out), opacity 300ms ease-out;
  will-change: transform;
}

/* Steps: pending -> active -> done. */
.cfm-steps { display: flex; flex-wrap: wrap; gap: 6px; margin: 14px 0 0; padding: 0; list-style: none; }
.cfm-step {
  display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px;
  border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap;
  color: var(--cfm-ghost); background: transparent; border: 1px solid var(--cfm-line);
  transition: color var(--cfm-med) ease-out, background-color var(--cfm-med) ease-out, border-color var(--cfm-med) ease-out;
}
.cfm-step::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: 0.6;
  transition: transform var(--cfm-med) var(--cfm-out);
}
.cfm-step.is-active { color: #fff; background: var(--cfm-accent-soft); border-color: var(--cfm-accent-line); }
.cfm-step.is-active::before { background: var(--cfm-accent); opacity: 1; animation: cfm-beat 1s var(--cfm-io) infinite; }
.cfm-step.is-done { color: var(--cfm-dim); border-color: var(--cfm-line-strong); }
.cfm-step.is-done::before { background: var(--cfm-ok); opacity: 1; }
@keyframes cfm-beat { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.6); } }

/* Footage: one row per file. */
.cfm-files { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.cfm-file {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 4px 12px;
  animation: cfm-rise var(--cfm-med) var(--cfm-out) both;
}
.cfm-file-name { font-size: 13px; font-weight: 600; color: var(--cfm-text); min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cfm-file-pct { font-size: 12px; color: var(--cfm-dim); font-variant-numeric: tabular-nums; }
.cfm-bar { grid-column: 1 / -1; height: 4px; border-radius: 4px; background: var(--cfm-line); overflow: hidden; }
.cfm-bar > i {
  display: block; height: 100%; width: 100%; background: var(--cfm-accent); border-radius: inherit;
  transform-origin: left center; transform: scaleX(0); transition: transform 360ms var(--cfm-out);
}
.cfm-file.is-done .cfm-bar > i { background: var(--cfm-ok); }
.cfm-file.is-done .cfm-file-pct { color: var(--cfm-ok); }

/* Render: the plan as a timeline, with a playhead in step with the recording.

   Built to cost the recording as close to nothing as possible. A first
   version swept a veil across the whole timeline and ran 38 segment
   entrances at the instant recording began; in an A/B render through the
   real UI it measured 23.5 new frames/sec against 25.5 with the panel
   removed. Now the only continuous motion is a 2px playhead - a tiny layer
   translated on the compositor - and segments change brightness one at a
   time, instantly, on each shot change. */
.cfm-tl {
  position: relative; height: 64px; margin-top: 14px; border-radius: var(--cfm-r-md);
  background: var(--cfm-canvas); overflow: hidden; contain: strict;
  box-shadow: inset 0 0 0 1px var(--cfm-line);
}
.cfm-seg {
  position: absolute; top: 0; bottom: 0; background-size: cover; background-position: center;
  box-shadow: inset -1px 0 0 rgba(0, 0, 0, 0.7);
  opacity: 0.34;
}
.cfm-seg.is-past, .cfm-seg.is-now { opacity: 1; }
.cfm-seg.is-now { box-shadow: inset 0 0 0 2px #fff, inset -1px 0 0 rgba(0, 0, 0, 0.7); z-index: 1; }
.cfm-ph {
  position: absolute; left: -1px; top: 0; bottom: 0; width: 2px; pointer-events: none; z-index: 2;
  background: #fff; box-shadow: 0 0 12px 2px rgba(59, 130, 246, 0.9);
  transform: translateX(0); will-change: transform;
}
.cfm-tl.is-running .cfm-ph { animation: cfm-sweep var(--cfm-dur, 30s) linear forwards; }
/* Offline: the playhead follows real progress, eased between updates. */
.cfm-tl.is-offline .cfm-ph { transition: transform 240ms linear; }
@keyframes cfm-sweep { from { transform: translateX(0); } to { transform: translateX(var(--cfm-tlw, 1000px)); } }
.cfm-tl.is-checking .cfm-ph { animation: none; transform: translateX(var(--cfm-tlw, 1000px)); }
.cfm-tl.is-checking .cfm-seg { opacity: 1; }
.cfm-tl.is-checking::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.16), transparent);
  transform: translateX(-100%); animation: cfm-shimmer 1.1s var(--cfm-io) infinite;
}
@keyframes cfm-shimmer { to { transform: translateX(100%); } }
.cfm-sub { margin-top: 10px; font-size: 12.5px; color: var(--cfm-dim); }
.cfm-sub b { color: var(--cfm-text); font-variant-numeric: tabular-nums; }

/* ── the finished video ─────────────────────────────────────────────── */
#cfOutput:not([hidden]) { animation: cfm-pop 700ms var(--cfm-out) both; position: relative; }
#cfOutput:not([hidden])::before {
  content: ""; position: absolute; inset: -1px; border-radius: inherit; pointer-events: none;
  box-shadow: 0 0 0 1px var(--cfm-accent), 0 0 60px rgba(59, 130, 246, 0.35);
  animation: cfm-glow-once 1.8s var(--cfm-out) both;
}
@keyframes cfm-glow-once { 0% { opacity: 0; } 25% { opacity: 1; } 100% { opacity: 0; } }
#cfOutput video { border-radius: var(--cfm-r-md); }

/* ── while recording: nothing decorative moves ──────────────────────── */
body.cfm-rendering .cf-drop::before,
body.cfm-rendering .cf-drop-icon,
body.cfm-rendering .cf-spinner,
body.cfm-rendering .cfm-dot::after { animation-play-state: paused !important; }
body.cfm-rendering .cfm-dot::after { opacity: 0; }

/* ── reduced motion ─────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .cf-copy-shell *,
  .cf-copy-shell *::before,
  .cf-copy-shell *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
  }
  /* The playhead and veil carry information, so they still move - just
     without easing flourishes. */
  .cfm-tl.is-running .cfm-ph { animation-duration: var(--cfm-dur, 30s) !important; }
}

@media (max-width: 640px) {
  .cfm-strip { height: 58px; }
  .cfm-tl { height: 52px; }
  .cfm-title { font-size: 14px; }
}

/* ── viewfinder motion graphics (copy-edit-motion.js, 2026-10-13) ──────
   The reference viewfinder and the live render window. During analysis and
   the frame-exact render nothing here can affect the output, so these are
   allowed to move a lot. The realtime fallback gets a static thumbnail per
   shot and paused loops (body.cfm-rendering). */
.cfm-grid {
  display: grid; grid-template-columns: minmax(0, 1fr) 240px; gap: 18px; margin-top: 14px; align-items: stretch;
}
.cfm-hero {
  --ar: 16 / 9;
  position: relative; aspect-ratio: var(--ar); max-height: 340px; width: 100%;
  border-radius: var(--cfm-r-md); overflow: hidden; background: #000; isolation: isolate;
  box-shadow: inset 0 0 0 1px var(--cfm-line), 0 0 0 0 rgba(59, 130, 246, 0);
  transition: box-shadow 400ms var(--cfm-out), transform 600ms var(--cfm-out), opacity 600ms var(--cfm-out);
  justify-self: center;
}
.cfm-hero-img, .cfm-hero-ghost, .cfm-live {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block;
}
.cfm-hero-img { transition: transform 900ms var(--cfm-out); }
.cfm-ren .cfm-hero-img { display: none; }
.cfm-ren .cfm-hero.is-thumb .cfm-hero-img { display: block; }
.cfm-live { display: none; }
.cfm-hero.is-live .cfm-live { display: block; }
.cfm-hero-img:not([src]) { opacity: 0; }

/* scan line: a bright band sweeping down the frame */
.cfm-scanline {
  position: absolute; left: 0; right: 0; top: 0; height: 100%; pointer-events: none; z-index: 2;
  background: linear-gradient(180deg, transparent 0%, rgba(59, 130, 246, 0) 40%, rgba(147, 197, 253, 0.30) 49%,
              rgba(255, 255, 255, 0.85) 50%, rgba(147, 197, 253, 0.30) 51%, rgba(59, 130, 246, 0) 60%, transparent 100%);
  transform: translateY(-60%); animation: cfm-scanline 2.2s var(--cfm-io) infinite; mix-blend-mode: screen;
}
@keyframes cfm-scanline { from { transform: translateY(-60%); } to { transform: translateY(60%); } }
/* faint CRT lines over everything */
.cfm-hero::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 3;
  background: repeating-linear-gradient(180deg, rgba(0, 0, 0, 0.22) 0 1px, transparent 1px 3px);
  mix-blend-mode: multiply;
}

/* corner brackets: a camera viewfinder */
.cfm-br { position: absolute; width: 22px; height: 22px; z-index: 4; pointer-events: none;
  border: 0 solid rgba(255, 255, 255, 0.9); animation: cfm-bracket 2.4s var(--cfm-io) infinite; }
.cfm-br.tl { top: 10px; left: 10px; border-top-width: 2px; border-left-width: 2px; }
.cfm-br.tr { top: 10px; right: 10px; border-top-width: 2px; border-right-width: 2px; animation-delay: 0.15s; }
.cfm-br.bl { bottom: 10px; left: 10px; border-bottom-width: 2px; border-left-width: 2px; animation-delay: 0.3s; }
.cfm-br.br { bottom: 10px; right: 10px; border-bottom-width: 2px; border-right-width: 2px; animation-delay: 0.45s; }
@keyframes cfm-bracket { 0%, 100% { opacity: 0.55; transform: scale(1); } 50% { opacity: 1; transform: scale(1.12); } }

/* HUD text */
.cfm-hud {
  position: absolute; z-index: 5; display: flex; align-items: center; gap: 7px; pointer-events: none;
  font: 700 11px/1 ui-monospace, "JetBrains Mono", "SF Mono", Consolas, monospace; letter-spacing: 0.12em;
  color: #fff; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9), 0 0 10px rgba(59, 130, 246, 0.6);
  padding: 5px 8px; border-radius: 4px; background: rgba(0, 0, 0, 0.42);
}
.cfm-hud.tl { top: 14px; left: 40px; }
.cfm-hud.br { bottom: 14px; right: 40px; font-variant-numeric: tabular-nums; }
.cfm-live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--cfm-accent);
  box-shadow: 0 0 8px var(--cfm-accent); animation: cfm-blink 1s steps(2, start) infinite; }
@keyframes cfm-blink { to { opacity: 0.15; } }

/* white flash on a cut / new shot */
.cfm-flash { position: absolute; inset: 0; z-index: 6; background: #fff; opacity: 0; pointer-events: none; }
.cfm-hero.is-flash .cfm-flash { animation: cfm-flash-hit 240ms var(--cfm-out) both; }
@keyframes cfm-flash-hit { 0% { opacity: 0.55; } 100% { opacity: 0; } }
.cfm-hero.is-flash { box-shadow: inset 0 0 0 1px var(--cfm-accent), 0 0 34px 2px rgba(59, 130, 246, 0.55); }

/* glitch: a displaced, sliced copy of the frame for one hit */
.cfm-hero-ghost { opacity: 0; z-index: 1; mix-blend-mode: screen; pointer-events: none; }
.cfm-hero.is-glitch .cfm-hero-ghost { animation: cfm-glitch 180ms steps(3, end) both; }
.cfm-hero.is-glitch .cfm-hero-img { animation: cfm-shake 180ms steps(3, end) both; }
@keyframes cfm-glitch {
  0%   { opacity: 0.9; transform: translate(-9px, 0) skewX(-8deg); clip-path: inset(8% 0 62% 0); filter: hue-rotate(180deg) saturate(3); }
  33%  { opacity: 0.8; transform: translate(11px, 0) skewX(6deg);  clip-path: inset(46% 0 30% 0); filter: hue-rotate(-90deg) saturate(3); }
  66%  { opacity: 0.7; transform: translate(-5px, 0);              clip-path: inset(70% 0 6% 0);  filter: saturate(4); }
  100% { opacity: 0; transform: none; clip-path: inset(0 0 0 0); }
}
@keyframes cfm-shake { 0% { transform: translate(4px, -2px) scale(1.03); } 50% { transform: translate(-3px, 2px) scale(1.02); } 100% { transform: none; } }

/* targeting reticle while a shot is studied */
.cfm-reticle {
  position: absolute; z-index: 4; left: 50%; top: 50%; width: 38%; aspect-ratio: 1; pointer-events: none;
  transform: translate(-50%, -50%) scale(1.4); opacity: 0;
  border: 1.5px solid rgba(59, 130, 246, 0.95); border-radius: 6px;
  box-shadow: 0 0 22px rgba(59, 130, 246, 0.45), inset 0 0 22px rgba(59, 130, 246, 0.25);
  transition: opacity 300ms ease-out;
}
.cfm-reticle::before, .cfm-reticle::after { content: ""; position: absolute; background: rgba(147, 197, 253, 0.9); }
.cfm-reticle::before { left: 50%; top: -14%; bottom: -14%; width: 1px; }
.cfm-reticle::after  { top: 50%; left: -14%; right: -14%; height: 1px; }
.cfm-reticle > i { position: absolute; left: 50%; top: 50%; width: 10px; height: 10px; margin: -5px 0 0 -5px;
  border-radius: 50%; border: 1.5px solid #fff; }
.cfm-hero.is-study .cfm-reticle { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.cfm-hero.is-lock .cfm-reticle { animation: cfm-lock 520ms var(--cfm-out) both; }
@keyframes cfm-lock { 0% { transform: translate(-50%, -50%) scale(1.6) rotate(-12deg); opacity: 0; }
  60% { transform: translate(-50%, -50%) scale(0.94) rotate(2deg); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(1) rotate(0); opacity: 1; } }
.cfm-hero.is-study .cfm-hero-img { transform: scale(1.08); }

/* finished: the window settles */
.cfm-hero.is-done .cfm-scanline, .cfm-hero.is-done .cfm-reticle { opacity: 0; animation: none; }
.cfm-hero.is-done .cfm-br { animation: none; opacity: 0.35; }

/* side column */
.cfm-side { display: flex; flex-direction: column; justify-content: center; min-width: 0; }
.cfm-big { display: flex; align-items: baseline; gap: 2px; line-height: 1; }
.cfm-big-n { font-size: 56px; font-weight: 800; letter-spacing: -0.04em; color: #fff; font-variant-numeric: tabular-nums;
  text-shadow: 0 0 28px rgba(59, 130, 246, 0.45); }
.cfm-big-u { font-size: 22px; font-weight: 700; color: var(--cfm-dim); }
.cfm-big-l { margin-top: 6px; font-size: 12.5px; color: var(--cfm-dim); }
.cfm-steps--col { flex-direction: column; flex-wrap: nowrap; align-items: flex-start; gap: 5px; margin-top: 16px; }
.cfm-facts { margin: 16px 0 0; display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; }
.cfm-facts div { min-width: 0; }
.cfm-facts dt { font-size: 10.5px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--cfm-faint); }
.cfm-facts dd { margin: 3px 0 0; font-size: 14px; font-weight: 700; color: #fff; font-variant-numeric: tabular-nums;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* realtime fallback: nothing in the viewfinder loops */
body.cfm-rendering .cfm-scanline,
body.cfm-rendering .cfm-br,
body.cfm-rendering .cfm-live-dot { animation-play-state: paused !important; }

@media (max-width: 760px) {
  .cfm-grid { grid-template-columns: 1fr; }
  .cfm-side { flex-direction: row; flex-wrap: wrap; align-items: baseline; gap: 6px 14px; }
  .cfm-steps--col { flex-direction: row; flex-wrap: wrap; margin-top: 4px; width: 100%; }
  .cfm-big-n { font-size: 40px; }
  .cfm-hud.tl { left: 36px; }
  .cfm-hud.br { right: 36px; }
}
@media (prefers-reduced-motion: reduce) {
  .cfm-scanline, .cfm-hero::after { display: none; }
}
