/* converter.love — components. Logic hooks are data-cv-*; classes are visuals only. */

/* ───────── Wordmark & mark motion ───────── */
.cv-wordmark .cv-wm-vheart { stroke-dasharray: 1; stroke-dashoffset: 1; opacity: 0; }
.cv-wordmark .cv-wm-v { transition: opacity var(--cv-dur-2) var(--cv-ease); }
.cv-wordmark .cv-wm-heart { stroke-dasharray: 1; stroke-dashoffset: 0; transform-box: fill-box; transform-origin: 50% 62%; }
.cv-wordmark .cv-wm-dot { transform-box: fill-box; transform-origin: center; }

/* Once per page load: the heart in "love" draws itself. */
.cv-intro .cv-wordmark .cv-wm-heart { animation: cv-draw 720ms var(--cv-ease) 180ms both; }
.cv-intro .cv-wordmark .cv-wm-dot { animation: cv-pop 420ms var(--cv-ease-spring) 80ms both; }
/* Hover: one soft beat. */
.cv-brand:hover .cv-wm-heart, .cv-brand:focus-visible .cv-wm-heart { animation: cv-beat 520ms var(--cv-ease) both; }
.cv-brand:hover .cv-mark-l, .cv-brand:focus-visible .cv-mark-l { animation: cv-meet-l 520ms var(--cv-ease) both; }
.cv-brand:hover .cv-mark-r, .cv-brand:focus-visible .cv-mark-r { animation: cv-meet-r 520ms var(--cv-ease) both; }
/* After a successful conversion: the "v" in converter becomes a heart too. */
.cv-loved .cv-wordmark .cv-wm-v { opacity: 0; }
.cv-loved .cv-wordmark .cv-wm-vheart { opacity: 1; animation: cv-draw var(--cv-dur-love) var(--cv-ease) both; }
.cv-loved .cv-wordmark .cv-wm-heart { animation: cv-beat 520ms var(--cv-ease) 380ms both; }
.cv-mark .cv-mark-l, .cv-mark .cv-mark-r { transform-box: view-box; }

@keyframes cv-draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@keyframes cv-pop { from { transform: scale(0); } to { transform: scale(1); } }
@keyframes cv-beat { 0%, 100% { transform: scale(1); } 30% { transform: scale(1.16); } 55% { transform: scale(.96); } }
@keyframes cv-meet-l { 0%, 100% { transform: none; } 40% { transform: translateX(-1.6px); } }
@keyframes cv-meet-r { 0%, 100% { transform: none; } 40% { transform: translateX(1.6px); } }

/* ───────── Buttons ───────── */
.cv-btn {
  --_bg: var(--cv-surface); --_fg: var(--cv-text); --_bd: var(--cv-border-strong);
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--cv-tap); padding: 0 18px; border-radius: var(--cv-r-sm);
  border: 1px solid var(--_bd); background: var(--_bg); color: var(--_fg);
  font-weight: 500; font-size: var(--cv-fs-16); line-height: 1; text-decoration: none; white-space: nowrap;
  transition: background-color var(--cv-dur-1) var(--cv-ease), border-color var(--cv-dur-1) var(--cv-ease), color var(--cv-dur-1) var(--cv-ease), transform var(--cv-dur-1) var(--cv-ease);
  user-select: none;
}
.cv-btn:hover { --_bg: var(--cv-surface-muted); }
.cv-btn:active { transform: scale(.98); }
.cv-btn svg { width: 18px; height: 18px; flex: none; }
.cv-btn--primary { --_bg: var(--cv-cta); --_fg: var(--cv-cta-ink); --_bd: var(--cv-cta); padding-inline: 22px; font-weight: 600; }
.cv-btn--primary:hover { --_bg: var(--cv-cta-hover); --_bd: var(--cv-cta-hover); }
.cv-btn--ghost { --_bg: transparent; --_bd: transparent; }
.cv-btn--ghost:hover { --_bg: var(--cv-surface-muted); }
.cv-btn--soft { --_bg: var(--cv-accent-soft); --_bd: transparent; --_fg: var(--cv-accent-strong); }
.cv-btn--soft:hover { --_bg: color-mix(in srgb, var(--cv-accent-soft) 70%, var(--cv-accent) 10%); }
.cv-btn--sm { min-height: 36px; padding: 0 12px; font-size: var(--cv-fs-14); border-radius: var(--cv-r-xs); }
.cv-btn--icon { width: var(--cv-tap); padding: 0; }
.cv-btn:disabled, .cv-btn[aria-disabled="true"] { --_bg: var(--cv-surface-muted); --_fg: var(--cv-text-muted); --_bd: var(--cv-border); transform: none; }
.cv-btn--primary:disabled { --_bg: var(--cv-surface-sunk); --_fg: var(--cv-text-muted); --_bd: var(--cv-surface-sunk); }
/* The primary CTA carries a tiny heart that warms on hover — barely noticeable. */
.cv-btn .cv-btn-heart { width: 14px; height: 14px; transform: scale(.85); opacity: .55; transition: transform var(--cv-dur-2) var(--cv-ease-spring), opacity var(--cv-dur-2) var(--cv-ease); }
.cv-btn:hover:not(:disabled) .cv-btn-heart { transform: scale(1); opacity: 1; }
.cv-btn .cv-btn-heart path { fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linejoin: round; }
.cv-btn--primary:hover:not(:disabled) .cv-btn-heart path { stroke: var(--cv-accent-tint); }

/* ───────── Chips / badges ───────── */
.cv-chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 0 12px;
  border: 1px solid var(--cv-border); border-radius: var(--cv-r-pill); background: var(--cv-surface);
  font-size: var(--cv-fs-14); font-weight: 500; color: var(--cv-text); text-decoration: none; white-space: nowrap;
  transition: border-color var(--cv-dur-1) var(--cv-ease), background-color var(--cv-dur-1) var(--cv-ease), transform var(--cv-dur-1) var(--cv-ease);
}
a.cv-chip:hover { border-color: var(--cv-border-strong); background: var(--cv-surface-muted); }
a.cv-chip:active { transform: scale(.98); }
.cv-badge {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: var(--cv-r-pill);
  font-size: var(--cv-fs-12); font-weight: 500; line-height: 1.5; white-space: nowrap;
  background: var(--cv-surface-muted); color: var(--cv-text-muted);
}
.cv-badge--soon { background: var(--cv-warning-soft); color: var(--cv-warning); }
.cv-badge--device { background: var(--cv-success-soft); color: var(--cv-success); }
.cv-badge--beta { background: var(--cv-accent-soft); color: var(--cv-accent-strong); }
.cv-badge svg { width: 12px; height: 12px; }

/* ───────── Inputs ───────── */
.cv-field { display: grid; gap: 6px; }
.cv-label { font-size: var(--cv-fs-14); font-weight: 500; color: var(--cv-text); }
.cv-hint { font-size: var(--cv-fs-13); color: var(--cv-text-muted); }
.cv-input {
  width: 100%; min-height: var(--cv-tap); padding: 0 14px; border-radius: var(--cv-r-sm);
  border: 1px solid var(--cv-border-strong); background: var(--cv-surface); color: var(--cv-text);
  transition: border-color var(--cv-dur-1) var(--cv-ease), box-shadow var(--cv-dur-1) var(--cv-ease);
}
.cv-input::placeholder { color: var(--cv-text-faint); }
.cv-input:hover { border-color: var(--cv-text-faint); }
.cv-input:focus-visible { outline: none; border-color: var(--cv-accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--cv-accent) 18%, transparent); }
.cv-search { position: relative; }
.cv-search svg { position: absolute; left: 14px; top: 50%; width: 18px; height: 18px; transform: translateY(-50%); color: var(--cv-text-muted); pointer-events: none; }
.cv-search .cv-input { padding-left: 42px; min-height: 52px; font-size: var(--cv-fs-16); border-radius: var(--cv-r-md); }

/* Range — thin line, heart-free; the thumb is a small graphite disc */
.cv-range { -webkit-appearance: none; appearance: none; width: 100%; height: 28px; background: transparent; --_p: 50%; }
.cv-range::-webkit-slider-runnable-track { height: 4px; border-radius: 4px; background: linear-gradient(to right, var(--cv-text) var(--_p), var(--cv-border) var(--_p)); }
.cv-range::-moz-range-track { height: 4px; border-radius: 4px; background: var(--cv-border); }
.cv-range::-moz-range-progress { height: 4px; border-radius: 4px; background: var(--cv-text); }
.cv-range::-webkit-slider-thumb { -webkit-appearance: none; width: 20px; height: 20px; margin-top: -8px; border-radius: 50%; background: var(--cv-surface); border: 2px solid var(--cv-text); transition: transform var(--cv-dur-1) var(--cv-ease); }
.cv-range::-moz-range-thumb { width: 16px; height: 16px; border-radius: 50%; background: var(--cv-surface); border: 2px solid var(--cv-text); }
.cv-range:active::-webkit-slider-thumb { transform: scale(1.12); }
.cv-range:focus-visible { outline: none; }
.cv-range:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 4px color-mix(in srgb, var(--cv-accent) 28%, transparent); border-color: var(--cv-accent); }
.cv-range:focus-visible::-moz-range-thumb { box-shadow: 0 0 0 4px color-mix(in srgb, var(--cv-accent) 28%, transparent); border-color: var(--cv-accent); }

/* Segmented control (radio group) */
.cv-seg { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 3px; border-radius: var(--cv-r-sm); background: var(--cv-surface-muted); border: 1px solid var(--cv-border); }
.cv-seg label { position: relative; }
.cv-seg input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.cv-seg span {
  display: inline-flex; align-items: center; min-height: 36px; padding: 0 12px; border-radius: 7px;
  font-size: var(--cv-fs-14); font-weight: 500; color: var(--cv-text-muted);
  transition: background-color var(--cv-dur-2) var(--cv-ease), color var(--cv-dur-2) var(--cv-ease), box-shadow var(--cv-dur-2) var(--cv-ease);
}
.cv-seg input:checked + span { background: var(--cv-surface); color: var(--cv-text); box-shadow: 0 1px 2px rgba(32,37,46,.08), 0 0 0 1px var(--cv-border); }
.cv-seg input:focus-visible + span { outline: 2px solid var(--cv-focus); outline-offset: 1px; }

/* Swatches (radio group) */
.cv-swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.cv-swatch { position: relative; }
.cv-swatch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.cv-swatch span {
  display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 0 12px 0 6px;
  border: 1px solid var(--cv-border); border-radius: var(--cv-r-pill); font-size: var(--cv-fs-14); background: var(--cv-surface);
  transition: border-color var(--cv-dur-1) var(--cv-ease), box-shadow var(--cv-dur-1) var(--cv-ease);
}
.cv-swatch i { width: 24px; height: 24px; border-radius: 50%; background: var(--_c); box-shadow: inset 0 0 0 1px rgba(32,37,46,.14); }
.cv-swatch input:checked + span { border-color: var(--cv-text); box-shadow: inset 0 0 0 1px var(--cv-text); }
.cv-swatch input:focus-visible + span { outline: 2px solid var(--cv-focus); outline-offset: 2px; }

/* Toggle */
.cv-toggle { display: inline-flex; align-items: center; gap: 10px; min-height: var(--cv-tap); cursor: pointer; }
.cv-toggle input { -webkit-appearance: none; appearance: none; margin: 0; width: 38px; height: 22px; border-radius: 22px; background: var(--cv-border-strong); position: relative; cursor: pointer; transition: background-color var(--cv-dur-2) var(--cv-ease); }
.cv-toggle input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: transform var(--cv-dur-2) var(--cv-ease-spring); }
.cv-toggle input:checked { background: var(--cv-text); }
.cv-toggle input:checked::after { transform: translateX(16px); }

/* ───────── The studio (converter) ───────── */
.cv-studio {
  position: relative;
  background: var(--cv-surface); border: 1px solid var(--cv-border); border-radius: var(--cv-r-lg);
  box-shadow: var(--cv-shadow-2);
  isolation: isolate;
}
.cv-studio-head { padding: clamp(18px, 3vw, 28px) clamp(18px, 3vw, 32px) 0; }
.cv-studio-body { padding: clamp(16px, 2.4vw, 24px) clamp(18px, 3vw, 32px); display: grid; gap: var(--cv-s5); }
.cv-studio-foot {
  position: sticky; bottom: 0; z-index: 3;
  display: flex; align-items: center; flex-wrap: wrap; gap: 12px 16px;
  padding: 14px clamp(18px, 3vw, 32px) calc(14px + env(safe-area-inset-bottom, 0px));
  background: color-mix(in srgb, var(--cv-surface) 92%, transparent);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  border-top: 1px solid var(--cv-border);
  border-radius: 0 0 var(--cv-r-lg) var(--cv-r-lg);
}
.cv-actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
@media (max-width: 520px) {
  .cv-actions { width: 100%; margin-left: 0; }
  .cv-actions .cv-btn--primary { flex: 1 1 auto; }
}

/* Pair picker — the sentence is the control: "Convert [PNG] to [JPG]" */
.cv-picker { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; font-size: var(--cv-fs-picker); font-weight: 600; letter-spacing: -0.025em; line-height: 1.1; }
.cv-picker-word { color: var(--cv-text-muted); font-weight: 500; }
.cv-picker-slot { position: relative; }
.cv-fmt-btn {
  display: inline-flex; align-items: center; gap: 10px; min-height: 56px; padding: 0 14px 0 16px;
  border: 1px solid var(--cv-border-strong); border-radius: var(--cv-r-md); background: var(--cv-surface);
  font-size: inherit; font-weight: inherit; letter-spacing: inherit;
  transition: border-color var(--cv-dur-1) var(--cv-ease), background-color var(--cv-dur-1) var(--cv-ease), box-shadow var(--cv-dur-1) var(--cv-ease);
}
.cv-fmt-btn:hover { border-color: var(--cv-text-muted); }
.cv-fmt-btn[aria-expanded="true"] { border-color: var(--cv-text); box-shadow: 0 0 0 3px color-mix(in srgb, var(--cv-text) 8%, transparent); }
.cv-fmt-btn .cv-caret { width: 16px; height: 16px; color: var(--cv-text-muted); transition: transform var(--cv-dur-2) var(--cv-ease); }
.cv-fmt-btn[aria-expanded="true"] .cv-caret { transform: rotate(180deg); }
.cv-fmt-btn--to { border-color: color-mix(in srgb, var(--cv-accent) 45%, var(--cv-border-strong)); }
.cv-fmt-btn--to:hover { border-color: var(--cv-accent); }
/* Odometer roll when the value changes */
.cv-roll { display: inline-grid; overflow: hidden; height: 1.15em; line-height: 1.15em; }
.cv-roll > span { grid-area: 1 / 1; }
.cv-roll > .is-out { animation: cv-roll-out var(--cv-dur-2) var(--cv-ease-in) both; }
.cv-roll > .is-in { animation: cv-roll-in var(--cv-dur-3) var(--cv-ease) both; }
@keyframes cv-roll-out { to { transform: translateY(-100%); opacity: 0; } }
@keyframes cv-roll-in { from { transform: translateY(100%); opacity: 0; } }

.cv-swap {
  width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--cv-border); background: var(--cv-surface-muted);
  display: grid; place-items: center; color: var(--cv-text-muted);
  transition: background-color var(--cv-dur-1) var(--cv-ease), color var(--cv-dur-1) var(--cv-ease), transform var(--cv-dur-3) var(--cv-ease-spring);
}
.cv-swap svg { width: 18px; height: 18px; }
.cv-swap:hover:not(:disabled) { color: var(--cv-text); background: var(--cv-surface); }
.cv-swap.is-spun { transform: rotate(180deg); }
.cv-swap:disabled { opacity: .45; }

@media (max-width: 560px) {
  .cv-picker { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 8px; }
  .cv-picker-word { display: none; }
  .cv-picker-slot:first-of-type { order: 1; }
  .cv-swap { order: 2; }
  .cv-picker-slot:last-of-type { order: 3; }
  .cv-fmt-btn { width: 100%; justify-content: space-between; min-height: 56px; }
}
.cv-pair-note { margin-top: var(--cv-s3); color: var(--cv-text-muted); font-size: var(--cv-fs-14); display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; min-height: 22px; }

/* Popover / bottom sheet for formats */
.cv-pop {
  position: absolute; z-index: 30; top: calc(100% + 8px); left: 0; width: min(380px, calc(100vw - 32px));
  background: var(--cv-surface); border: 1px solid var(--cv-border); border-radius: var(--cv-r-md);
  box-shadow: var(--cv-shadow-pop); font-size: var(--cv-fs-16); font-weight: 400; letter-spacing: 0; line-height: var(--cv-lh);
  transform-origin: 24px 0; animation: cv-pop-in var(--cv-dur-2) var(--cv-ease) both;
  display: flex; flex-direction: column; max-height: min(460px, 70vh);
}
@keyframes cv-pop-in { from { opacity: 0; transform: translateY(-4px) scale(.98); } }
.cv-pop-head { padding: 10px; border-bottom: 1px solid var(--cv-border); }
.cv-pop-head .cv-input { min-height: 40px; }
.cv-pop-list { overflow: auto; padding: 6px; overscroll-behavior: contain; }
.cv-pop-group { padding: 10px 10px 4px; font-size: var(--cv-fs-12); font-weight: 600; color: var(--cv-text-muted); }
.cv-opt {
  display: grid; grid-template-columns: 56px 1fr auto; align-items: center; gap: 10px; width: 100%;
  min-height: 44px; padding: 6px 10px; border: 0; border-radius: var(--cv-r-xs); background: transparent; text-align: left;
}
.cv-opt .cv-ext { font-size: var(--cv-fs-14); }
.cv-opt-name { font-size: var(--cv-fs-14); color: var(--cv-text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cv-opt.is-active, .cv-opt:hover { background: var(--cv-surface-muted); }
.cv-opt[aria-selected="true"] { background: var(--cv-accent-soft); }
.cv-opt[aria-selected="true"] .cv-ext { color: var(--cv-accent-strong); }
.cv-pop-empty { padding: 18px 12px; color: var(--cv-text-muted); font-size: var(--cv-fs-14); }
.cv-pop-foot { padding: 10px 14px; border-top: 1px solid var(--cv-border); font-size: var(--cv-fs-13); color: var(--cv-text-muted); }
.cv-pop-scrim { display: none; }
@media (max-width: 640px) {
  .cv-pop {
    position: fixed; left: 0; right: 0; bottom: 0; top: auto; width: auto; max-height: 78vh;
    border-radius: var(--cv-r-lg) var(--cv-r-lg) 0 0; padding-bottom: env(safe-area-inset-bottom, 0px);
    animation: cv-sheet-in var(--cv-dur-3) var(--cv-ease) both;
  }
  .cv-pop::before { content: ""; display: block; width: 36px; height: 4px; border-radius: 4px; background: var(--cv-border-strong); margin: 8px auto 0; }
  .cv-pop-scrim { display: block; position: fixed; inset: 0; z-index: 29; background: rgba(32,37,46,.28); animation: cv-fade var(--cv-dur-2) var(--cv-ease) both; }
  .cv-pop-head .cv-input { min-height: 48px; }
  .cv-opt { min-height: 52px; }
}
@keyframes cv-sheet-in { from { transform: translateY(100%); } }
@keyframes cv-fade { from { opacity: 0; } }

/* Dropzone */
.cv-drop {
  position: relative; display: grid; justify-items: center; text-align: center; gap: 6px;
  padding: clamp(28px, 6vw, 52px) 20px;
  border: 1.5px dashed var(--cv-border-strong); border-radius: var(--cv-r-md);
  background: var(--cv-bg);
  transition: border-color var(--cv-dur-2) var(--cv-ease), background-color var(--cv-dur-2) var(--cv-ease), padding var(--cv-dur-3) var(--cv-ease);
}
.cv-drop-art { width: 64px; height: 64px; margin-bottom: 8px; color: var(--cv-text); }
.cv-drop-art .cv-da-sheet { fill: var(--cv-surface); stroke: currentColor; stroke-width: 1.6; transition: transform var(--cv-dur-3) var(--cv-ease); transform-box: fill-box; transform-origin: 50% 100%; }
.cv-drop-art .cv-da-back { fill: var(--cv-surface-muted); stroke: var(--cv-border-strong); stroke-width: 1.4; transition: transform var(--cv-dur-3) var(--cv-ease); transform-box: fill-box; transform-origin: 50% 100%; }
.cv-drop-art .cv-da-l, .cv-drop-art .cv-da-r { fill: none; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; transition: transform var(--cv-dur-3) var(--cv-ease-spring); }
.cv-drop-art .cv-da-l { stroke: var(--cv-text); }
.cv-drop-art .cv-da-r { stroke: var(--cv-accent); }
.cv-drop-title { font-size: var(--cv-fs-18); font-weight: 600; letter-spacing: -0.01em; }
.cv-drop-or { color: var(--cv-text-muted); font-size: var(--cv-fs-14); }
.cv-drop-choose { margin-top: 6px; }
.cv-drop-hint { margin-top: 8px; font-size: var(--cv-fs-13); color: var(--cv-text-muted); }
.cv-drop:has(input:focus-visible) .cv-drop-choose { outline: 2px solid var(--cv-focus); outline-offset: 3px; }
/* Dragging: the back sheet slides out, the heart halves open to receive. */
.cv-studio.is-dragover .cv-drop { border-color: var(--cv-accent); background: var(--cv-accent-soft); }
.cv-studio.is-dragover .cv-da-back { transform: translate(-5px, -3px) rotate(-6deg); }
.cv-studio.is-dragover .cv-da-sheet { transform: translateY(-3px); }
.cv-studio.is-dragover .cv-da-l { transform: translateX(-2px); }
.cv-studio.is-dragover .cv-da-r { transform: translateX(2px); }
/* With files: the dropzone compacts into an "add more" row */
.cv-studio:not([data-cv-state="idle"]):not([data-cv-state="unsupported"]) .cv-drop { grid-auto-flow: column; justify-content: start; align-items: center; text-align: left; padding: 10px 14px; gap: 12px; }
.cv-studio:not([data-cv-state="idle"]):not([data-cv-state="unsupported"]) .cv-drop-art { width: 32px; height: 32px; margin: 0; }
.cv-studio:not([data-cv-state="idle"]):not([data-cv-state="unsupported"]) .cv-drop-title { font-size: var(--cv-fs-14); font-weight: 500; }
.cv-studio:not([data-cv-state="idle"]):not([data-cv-state="unsupported"]) .cv-drop-or,
.cv-studio:not([data-cv-state="idle"]):not([data-cv-state="unsupported"]) .cv-drop-hint { display: none; }
.cv-studio:not([data-cv-state="idle"]):not([data-cv-state="unsupported"]) .cv-drop-choose { margin: 0 0 0 auto; min-height: 36px; font-size: var(--cv-fs-14); padding: 0 12px; }
.cv-studio[data-cv-state="converting"] .cv-drop, .cv-studio[data-cv-state="preparing"] .cv-drop, .cv-studio[data-cv-state="done"] .cv-drop { display: none; }
@media (max-width: 420px) {
  .cv-studio:not([data-cv-state="idle"]) .cv-drop-title { display: none; }
}

/* Touch devices: there is nothing to drag — lead with the button */
@media (pointer: coarse) {
  .cv-studio[data-cv-state="idle"] .cv-drop-title, .cv-studio[data-cv-state="idle"] .cv-drop-or { display: none; }
  .cv-studio[data-cv-state="idle"] .cv-drop-choose { --_bg: var(--cv-cta); --_fg: var(--cv-cta-ink); --_bd: var(--cv-cta); min-height: 52px; padding-inline: 28px; font-weight: 600; }
}
.cv-studio[data-cv-state="done"] .cv-item[data-status="done"] { display: none; }

/* Whole-page drop catcher */
.cv-dropveil { position: fixed; inset: 0; z-index: 60; pointer-events: none; opacity: 0; transition: opacity var(--cv-dur-2) var(--cv-ease); background: color-mix(in srgb, var(--cv-accent-soft) 70%, transparent); box-shadow: inset 0 0 0 3px var(--cv-accent); }
.cv-dropveil.is-on { opacity: 1; }

/* Unavailable / unsupported panel */
.cv-unavail { display: none; gap: 10px; padding: 18px 20px; border-radius: var(--cv-r-md); background: var(--cv-warning-soft); color: var(--cv-text); }
.cv-unavail strong { color: var(--cv-warning); }
.cv-studio[data-cv-state="unsupported"] .cv-unavail { display: grid; }
.cv-studio[data-cv-state="unsupported"] .cv-drop { display: none; }

/* Queue */
.cv-queue { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.cv-queue:empty { display: none; }
.cv-item {
  display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; align-items: center; gap: 12px;
  padding: 8px 8px 8px 8px; border-radius: var(--cv-r-md); border: 1px solid var(--cv-border); background: var(--cv-surface);
  animation: cv-enter var(--cv-dur-3) var(--cv-ease) both;
  transition: border-color var(--cv-dur-2) var(--cv-ease), background-color var(--cv-dur-2) var(--cv-ease);
}
.cv-item.is-leaving { animation: cv-leave var(--cv-dur-2) var(--cv-ease-in) both; }
@keyframes cv-enter { from { opacity: 0; transform: translateY(6px); } }
@keyframes cv-leave { to { opacity: 0; transform: translateX(8px); } }
.cv-thumb { width: 44px; height: 44px; border-radius: 8px; background: var(--cv-surface-muted) center / cover no-repeat; display: grid; place-items: center; overflow: hidden; border: 1px solid var(--cv-border); }
.cv-thumb img { width: 100%; height: 100%; object-fit: cover; animation: cv-fade var(--cv-dur-3) var(--cv-ease) both; }
.cv-thumb .cv-ext { font-size: 11px; color: var(--cv-text-muted); }
.cv-item-main { min-width: 0; display: grid; gap: 2px; }
.cv-item-name { display: flex; min-width: 0; font-weight: 500; font-size: var(--cv-fs-14); white-space: nowrap; }
.cv-item-name > span:first-child { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.cv-item-name > span:last-child { flex: none; }
.cv-item-meta { font-size: var(--cv-fs-13); color: var(--cv-text-muted); display: flex; align-items: center; gap: 8px; min-height: 20px; }
.cv-item-meta .cv-ico { width: 14px; height: 14px; flex: none; }
.cv-item-bar { height: 3px; border-radius: 3px; background: var(--cv-surface-sunk); overflow: hidden; margin-top: 4px; display: none; }
.cv-item-bar > i { display: block; height: 100%; width: 100%; background: var(--cv-text); transform-origin: left; transform: scaleX(var(--_p, 0)); transition: transform var(--cv-dur-2) var(--cv-ease); }
.cv-item[data-status="converting"] .cv-item-bar { display: block; }
.cv-item[data-status="converting"][data-indeterminate] .cv-item-bar > i { width: 35%; transform: none; animation: cv-indet 1.3s var(--cv-ease) infinite; }
.cv-item[data-status="error"] { border-color: color-mix(in srgb, var(--cv-error) 40%, var(--cv-border)); background: var(--cv-error-soft); }
.cv-item[data-status="error"] .cv-item-meta { color: var(--cv-error); }
.cv-item[data-status="done"] .cv-item-meta { color: var(--cv-success); }
.cv-item-remove { width: 40px; height: 40px; border: 0; border-radius: var(--cv-r-sm); background: transparent; color: var(--cv-text-muted); display: grid; place-items: center; transition: background-color var(--cv-dur-1) var(--cv-ease), color var(--cv-dur-1) var(--cv-ease); }
.cv-item-remove:hover { background: var(--cv-surface-muted); color: var(--cv-text); }
.cv-item-remove svg { width: 16px; height: 16px; }
.cv-studio[data-cv-state="converting"] .cv-item-remove, .cv-studio[data-cv-state="preparing"] .cv-item-remove { visibility: hidden; }
@keyframes cv-indet { from { transform: translateX(-110%); } to { transform: translateX(320%); } }

/* Options */
.cv-options { display: grid; gap: 0; border: 1px solid var(--cv-border); border-radius: var(--cv-r-md); overflow: hidden; }
.cv-options:empty { display: none; }
.cv-options-sum {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 52px; padding: 10px 16px;
  border: 0; background: var(--cv-surface-muted); text-align: left;
}
.cv-options-sum b { font-weight: 600; font-size: var(--cv-fs-14); }
.cv-options-sum span { color: var(--cv-text-muted); font-size: var(--cv-fs-14); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; flex: 1; }
.cv-options-sum svg { width: 16px; height: 16px; color: var(--cv-text-muted); transition: transform var(--cv-dur-2) var(--cv-ease); flex: none; }
.cv-options-sum[aria-expanded="true"] svg { transform: rotate(180deg); }
.cv-options-panel { display: grid; grid-template-rows: 0fr; transition: grid-template-rows var(--cv-dur-3) var(--cv-ease); }
.cv-options-sum[aria-expanded="true"] + .cv-options-panel { grid-template-rows: 1fr; }
.cv-options-inner { overflow: hidden; }
.cv-options-grid { display: grid; gap: 20px 28px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); padding: 18px 16px 20px; }
.cv-range-row { display: flex; align-items: center; gap: 12px; }
.cv-range-row output { min-width: 3.2em; text-align: right; font-variant-numeric: tabular-nums; font-weight: 500; font-size: var(--cv-fs-14); }
.cv-studio[data-cv-state="converting"] .cv-options, .cv-studio[data-cv-state="preparing"] .cv-options { opacity: .6; pointer-events: none; }
.cv-studio[data-cv-state="done"] .cv-options { display: none; }

/* Status line + progress */
.cv-status { display: flex; align-items: center; gap: 10px; min-height: 24px; font-size: var(--cv-fs-14); color: var(--cv-text-muted); min-width: 0; flex: 1 1 220px; }
.cv-status-text { min-width: 0; }
.cv-status[data-tone="error"] { color: var(--cv-error); }
.cv-status[data-tone="success"] { color: var(--cv-success); }
.cv-status[data-tone="warning"] { color: var(--cv-warning); }
.cv-status .cv-ico { width: 18px; height: 18px; flex: none; }
/* Heart tracer — the loader. A dash runs around the heart outline. */
.cv-tracer { width: 22px; height: 22px; flex: none; }
.cv-tracer path { fill: none; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.cv-tracer .cv-tracer-bg { stroke: var(--cv-surface-sunk); }
.cv-tracer .cv-tracer-fg { stroke: var(--cv-accent); stroke-dasharray: .28 .72; animation: cv-trace 1.4s linear infinite; }
@keyframes cv-trace { to { stroke-dashoffset: -1; } }
.cv-progress { position: absolute; left: 0; right: 0; top: -1px; height: 2px; overflow: hidden; opacity: 0; transition: opacity var(--cv-dur-2) var(--cv-ease); }
.cv-progress > i { display: block; height: 100%; width: 100%; background: var(--cv-text); transform-origin: left; transform: scaleX(var(--_p, 0)); transition: transform var(--cv-dur-3) var(--cv-ease); }
.cv-studio[data-cv-state="converting"] .cv-progress, .cv-studio[data-cv-state="preparing"] .cv-progress { opacity: 1; }
.cv-progress[data-indeterminate] > i { width: 30%; transform: none; animation: cv-indet 1.4s var(--cv-ease) infinite; }

/* State-driven action visibility (no JS needed for show/hide) */
[data-cv-convert], [data-cv-cancel], [data-cv-reset], [data-cv-zip] { display: none; }
.cv-studio:is([data-cv-state="idle"], [data-cv-state="selected"], [data-cv-state="validating"], [data-cv-state="error"], [data-cv-state="cancelled"], [data-cv-state="unsupported"]) [data-cv-convert] { display: inline-flex; }
.cv-studio:is([data-cv-state="preparing"], [data-cv-state="converting"]) [data-cv-cancel] { display: inline-flex; }
.cv-studio:is([data-cv-state="done"], [data-cv-state="error"], [data-cv-state="cancelled"]) [data-cv-reset] { display: inline-flex; }
.cv-studio[data-cv-state="done"] [data-cv-zip]:not([data-empty]) { display: inline-flex; }

/* Results */
.cv-results { display: grid; gap: 10px; }
.cv-results:empty { display: none; }
.cv-results-head { display: flex; align-items: center; gap: 14px; padding: 4px 0 6px; }
.cv-results-head h3 { font-size: var(--cv-fs-18); }
.cv-results-head p { font-size: var(--cv-fs-14); color: var(--cv-text-muted); }
.cv-result {
  display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; align-items: center; gap: 12px;
  padding: 8px; border-radius: var(--cv-r-md); border: 1px solid var(--cv-border); background: var(--cv-surface);
  animation: cv-enter var(--cv-dur-3) var(--cv-ease) both; animation-delay: calc(var(--_i, 0) * 50ms + 380ms);
}
.cv-result .cv-thumb { border-color: color-mix(in srgb, var(--cv-success) 30%, var(--cv-border)); }
.cv-result-size { font-variant-numeric: tabular-nums; }
.cv-result-delta { color: var(--cv-success); }
.cv-result-delta.is-up { color: var(--cv-text-muted); }
@media (max-width: 460px) {
  .cv-result, .cv-item { grid-template-columns: 40px minmax(0, 1fr) auto; gap: 10px; }
  .cv-result .cv-btn-label { display: none; }
  .cv-result .cv-btn { width: var(--cv-tap); padding: 0; }
}

/* ───────── The love moment: two file cards meet, a heart forms, the result lands ─────────
   Purely decorative (aria-hidden). Correctness never waits for it. */
.cv-moment { position: relative; width: 76px; height: 48px; flex: none; }
.cv-moment-card {
  position: absolute; top: 4px; width: 32px; height: 40px; border-radius: 6px;
  background: var(--cv-surface); border: 1.5px solid var(--cv-text);
  display: grid; place-items: end center; padding-bottom: 4px;
  font: 600 8px/1 var(--cv-mono); letter-spacing: .02em; text-transform: uppercase; color: var(--cv-text);
}
.cv-moment-card::before { content: ""; position: absolute; top: -1.5px; right: -1.5px; width: 9px; height: 9px; background: var(--cv-bg); border-left: 1.5px solid var(--cv-text); border-bottom: 1.5px solid var(--cv-text); border-bottom-left-radius: 3px; }
.cv-moment-a { left: 2px; }
.cv-moment-b { left: 42px; border-color: var(--cv-accent); color: var(--cv-accent-strong); }
.cv-moment-b::before { border-color: var(--cv-accent); }
.cv-moment-heart { position: absolute; left: 50%; top: 50%; width: 22px; height: 22px; margin: -11px 0 0 -11px; opacity: 0; }
.cv-moment-heart path { fill: var(--cv-accent); }
.cv-moment.is-playing .cv-moment-a { animation: cv-m-a var(--cv-dur-love) var(--cv-ease) both; }
.cv-moment.is-playing .cv-moment-b { animation: cv-m-b var(--cv-dur-love) var(--cv-ease) both; }
.cv-moment.is-playing .cv-moment-heart { animation: cv-m-heart var(--cv-dur-love) var(--cv-ease-spring) both; }
@keyframes cv-m-a { 0% { transform: translateX(-8px) rotate(-8deg); opacity: 0; } 25% { opacity: 1; } 55% { transform: translateX(10px) rotate(-4deg); } 100% { transform: none; } }
@keyframes cv-m-b { 0% { transform: translateX(8px) rotate(8deg); opacity: 0; } 25% { opacity: 1; } 55% { transform: translateX(-10px) rotate(4deg); } 100% { transform: none; } }
@keyframes cv-m-heart { 0%, 38% { opacity: 0; transform: scale(.2); } 60% { opacity: 1; transform: scale(1.15) translateY(-2px); } 100% { opacity: 1; transform: scale(.62) translateY(-17px); } }

/* Notes & callouts */
.cv-note { display: flex; gap: 10px; align-items: flex-start; font-size: var(--cv-fs-14); color: var(--cv-text-muted); }
.cv-note svg { width: 18px; height: 18px; flex: none; margin-top: 2px; color: var(--cv-success); }
.cv-callout { padding: 14px 16px; border-radius: var(--cv-r-md); background: var(--cv-surface-muted); font-size: var(--cv-fs-14); }
.cv-callout--warn { background: var(--cv-warning-soft); }
.cv-callout--warn strong { color: var(--cv-warning); }
.cv-error-action { display: inline-flex; margin-left: 4px; padding: 0; border: 0; background: none; color: var(--cv-accent-strong); font: inherit; font-weight: 500; text-decoration: underline; text-underline-offset: .2em; }

/* Table (format comparisons on pair pages) */
.cv-table-wrap { overflow-x: auto; border: 1px solid var(--cv-border); border-radius: var(--cv-r-md); background: var(--cv-surface); }
.cv-table { width: 100%; border-collapse: collapse; font-size: var(--cv-fs-14); min-width: 420px; }
.cv-table th, .cv-table td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--cv-border); vertical-align: top; }
.cv-table thead th { background: var(--cv-surface-muted); font-weight: 600; }
.cv-table tbody tr:last-child > * { border-bottom: 0; }

/* FAQ */
.cv-faq { border-top: 1px solid var(--cv-border); }
.cv-faq details { border-bottom: 1px solid var(--cv-border); }
.cv-faq summary { display: flex; justify-content: space-between; align-items: center; gap: 16px; min-height: 56px; padding: 12px 0; cursor: pointer; font-weight: 500; list-style: none; }
.cv-faq summary::-webkit-details-marker { display: none; }
.cv-faq summary::after { content: ""; width: 10px; height: 10px; flex: none; border-right: 1.5px solid var(--cv-text-muted); border-bottom: 1.5px solid var(--cv-text-muted); transform: translateY(-3px) rotate(45deg); transition: transform var(--cv-dur-2) var(--cv-ease); }
.cv-faq details[open] summary::after { transform: translateY(2px) rotate(225deg); }
.cv-faq details > div { padding: 0 0 18px; color: var(--cv-text-muted); max-width: 68ch; }

/* Breadcrumbs */
.cv-crumbs ol { display: flex; flex-wrap: wrap; gap: 4px; list-style: none; margin: 0; padding: 0; font-size: var(--cv-fs-13); color: var(--cv-text-muted); }
.cv-crumbs li { display: inline-flex; align-items: center; gap: 4px; }
.cv-crumbs li + li::before { content: ""; width: 5px; height: 5px; border-right: 1.2px solid currentColor; border-top: 1.2px solid currentColor; transform: rotate(45deg); margin: 0 6px 0 2px; opacity: .6; }
.cv-crumbs a { text-decoration: none; padding: 4px 0; }
.cv-crumbs a:hover { color: var(--cv-text); text-decoration: underline; }
.cv-crumbs [aria-current] { color: var(--cv-text); }

/* Toast (rare: e.g. "Switched to JPG to match your file") */
.cv-toast-region { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); z-index: 70; transform: translateX(-50%); display: grid; gap: 8px; pointer-events: none; width: max-content; max-width: calc(100vw - 32px); }
.cv-toast { pointer-events: auto; padding: 12px 16px; border-radius: var(--cv-r-md); background: var(--cv-text); color: #fff; font-size: var(--cv-fs-14); box-shadow: var(--cv-shadow-pop); animation: cv-toast-in var(--cv-dur-3) var(--cv-ease) both; }
.cv-toast.is-leaving { animation: cv-leave var(--cv-dur-2) var(--cv-ease-in) both; }
@keyframes cv-toast-in { from { opacity: 0; transform: translateY(10px) scale(.98); } }

@media (prefers-reduced-motion: reduce) {
  .cv-tracer .cv-tracer-fg { animation: none; stroke-dasharray: none; }
  .cv-progress[data-indeterminate] > i, .cv-item[data-indeterminate] .cv-item-bar > i { animation: none; width: 100%; opacity: .35; }
  .cv-moment.is-playing .cv-moment-a, .cv-moment.is-playing .cv-moment-b { animation: none; }
  .cv-moment.is-playing .cv-moment-heart { animation: none; opacity: 1; transform: scale(.62) translateY(-17px); }
  .cv-intro .cv-wordmark .cv-wm-heart, .cv-intro .cv-wordmark .cv-wm-dot { animation: none; }
}
