/* Magi2Free — Extract Frame from Video v3 (Laptop-First Single Screen + Live Frame Inspector) */
.tool-page h1,
.tool-page h2,
.tool-page h3 {
  text-wrap: balance;
}

/* Scoped compact hero ONLY for /extract-frame-from-video so 1280x720 fits all 4 grab buttons above fold */
.tool-page:has([data-gf-tool="extract-frame-from-video"]) .studio-hero {
  padding: 10px 0 8px;
}

.tool-page:has([data-gf-tool="extract-frame-from-video"]) .hero-title {
  font-size: clamp(1.45rem, 2.2vw, 1.95rem);
  line-height: 1.1;
  margin: 0 0 3px;
}

.tool-page:has([data-gf-tool="extract-frame-from-video"]) .hero-subtitle {
  font-size: 0.9375rem;
  line-height: 1.32;
  margin: 0 auto 6px;
}

.tool-page:has([data-gf-tool="extract-frame-from-video"]) .hero-trust {
  gap: 4px 14px;
  font-size: 0.75rem;
}

.tool-page:has([data-gf-tool="extract-frame-from-video"]) .workbench-shell {
  margin-bottom: 40px;
}

[data-gf-tool="extract-frame-from-video"] {
  --m2f-bg: var(--bg, #F5F4F8);
  --m2f-surface: var(--surface, #FFFFFF);
  --m2f-mist: var(--surface-2, #ECEAF3);
  --m2f-border: var(--border, #DFDCEB);
  --m2f-border-strong: var(--border-strong, #C5BFE0);
  --m2f-border-hover: var(--border-hover, #9991BC);
  --m2f-ink: var(--text, #121122);
  --m2f-ink-2: var(--text-secondary, #3B3954);
  --m2f-muted: var(--muted-on-bg, #54516E);
  --m2f-primary: var(--primary, #5236FF);
  --m2f-primary-hover: var(--primary-hover, #3F24E0);
  --m2f-primary-ink: var(--primary-ink, #FFFFFF);
  --m2f-tint: var(--surface-tint, #EEEAFF);
  --m2f-tint-hover: var(--accent-hover-tint, #E3DCFF);
  --m2f-tint-border: var(--accent-border, #CBC0FF);
  --m2f-tint-ink: var(--accent-text, #3F24E0);
  --m2f-coral: var(--coral, #E03E1F);
  --m2f-stage: var(--stage-bg, #121122);
  --m2f-ok-bg: var(--do-bg, #E7F9F1);
  --m2f-ok-border: var(--do-border, #A7F3D0);
  --m2f-ok-ink: var(--do-ink, #046C4E);
  --m2f-warn-bg: var(--warn-bg, #FEF6E6);
  --m2f-warn-border: var(--warn-border, #F3D19E);
  --m2f-warn-ink: var(--warn-ink, #9A4D06);
  --m2f-err-bg: var(--avoid-bg, #FEECEC);
  --m2f-err-border: var(--avoid-border, #FECACA);
  --m2f-err-ink: var(--danger, #B42318);
  --m2f-r-sm: var(--r-sm, 10px);
  --m2f-r-md: var(--r-md, 16px);
  --m2f-r-pill: var(--r-pill, 9999px);
  --m2f-font-display: var(--font-display, 'Sora', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif);
  --m2f-font-sans: var(--font-sans, 'DM Sans', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif);
  --m2f-font-mono: var(--font-mono, 'Geist Mono', ui-monospace, SFMono-Regular, Menlo, monospace);
  --m2f-shadow-sm: var(--shadow-sm, 0 1px 2px rgba(18, 17, 34, 0.05));
  --m2f-shadow-card: 0 12px 32px -12px rgba(18, 17, 34, 0.1), 0 1px 2px rgba(18, 17, 34, 0.04);
  --m2f-shadow-pop: 0 20px 44px -12px rgba(18, 17, 34, 0.18), 0 4px 12px rgba(18, 17, 34, 0.06);

  color: var(--m2f-ink);
  font-family: var(--m2f-font-sans);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

[data-gf-tool="extract-frame-from-video"] *,
[data-gf-tool="extract-frame-from-video"] *::before,
[data-gf-tool="extract-frame-from-video"] *::after {
  box-sizing: border-box;
}

[data-gf-tool="extract-frame-from-video"] [hidden] {
  display: none !important;
}

[data-gf-tool="extract-frame-from-video"] :focus-visible {
  outline: 2px solid var(--m2f-primary);
  outline-offset: 2px;
}

.m2f-root {
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  position: relative;
}

.m2f-sr-input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Main Split Studio Workbench (Desktop Single-Screen Budget <= 675px at 1280x720) */
.m2f-workbench {
  display: grid;
  grid-template-columns: minmax(0, 1.44fr) minmax(364px, 0.96fr);
  gap: 18px;
  align-items: start;
}

.m2f-card {
  background: var(--m2f-surface);
  border: 1px solid var(--m2f-border);
  border-radius: var(--m2f-r-md);
  box-shadow: var(--m2f-shadow-card);
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.m2f-player-card {
  overflow: visible;
  position: relative;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.m2f-player-card.is-dragover {
  border-color: var(--m2f-primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--m2f-primary) 24%, transparent), var(--m2f-shadow-card);
}

/* Top Bar: Compact 44px Row */
.m2f-bar-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 12px;
  border-bottom: 1px solid var(--m2f-border);
  min-height: 44px;
}

.m2f-bar-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1 1 auto;
}

.m2f-upload-btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 31px;
  padding: 5px 11px;
  border-radius: var(--m2f-r-sm);
  border: 1.5px solid var(--m2f-primary);
  background: var(--m2f-tint);
  color: var(--m2f-tint-ink);
  font-family: var(--m2f-font-sans);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  flex: 0 0 auto;
  transition: background-color 140ms ease, color 140ms ease, border-color 140ms ease;
}

.m2f-upload-btn:hover {
  background: var(--m2f-primary);
  color: var(--m2f-primary-ink);
}

.m2f-file-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  flex: 1 1 auto;
}

.m2f-status-dot {
  width: 7px;
  height: 7px;
  border-radius: var(--m2f-r-pill);
  background: var(--m2f-border-hover);
  flex: 0 0 auto;
}

.m2f-status-dot.is-live {
  background: var(--m2f-ok-ink);
}

.m2f-file-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--m2f-ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.m2f-spec-pill {
  font-family: var(--m2f-font-mono);
  font-size: 11px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: var(--m2f-muted);
  background: var(--m2f-mist);
  border: 1px solid var(--m2f-border);
  border-radius: var(--m2f-r-pill);
  padding: 2px 7px;
  white-space: nowrap;
  flex: 0 0 auto;
}

.m2f-bar-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
}

.m2f-privacy-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: var(--m2f-r-pill);
  background: var(--m2f-ok-bg);
  border: 1px solid var(--m2f-ok-border);
  color: var(--m2f-ok-ink);
  font-family: var(--m2f-font-mono);
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
}

.m2f-sample-wrap {
  position: relative;
}

.m2f-ghost-btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 30px;
  padding: 4px 9px;
  border-radius: var(--m2f-r-sm);
  border: 1px solid var(--m2f-border-strong);
  background: var(--m2f-surface);
  color: var(--m2f-ink);
  font-family: var(--m2f-font-sans);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 140ms ease, background-color 140ms ease, color 140ms ease;
}

.m2f-ghost-btn:hover,
.m2f-ghost-btn[aria-expanded="true"] {
  border-color: var(--m2f-primary);
  background: var(--m2f-tint);
  color: var(--m2f-tint-ink);
}

.m2f-sample-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  width: 214px;
  background: var(--m2f-surface);
  border: 1px solid var(--m2f-border-strong);
  border-radius: var(--m2f-r-sm);
  box-shadow: var(--m2f-shadow-pop);
  padding: 6px;
  z-index: 35;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.m2f-sample-item {
  appearance: none;
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-family: var(--m2f-font-sans);
}

.m2f-sample-item strong {
  font-size: 12px;
  font-weight: 600;
  color: var(--m2f-ink);
}

.m2f-sample-item span {
  font-family: var(--m2f-font-mono);
  font-size: 11px;
  color: var(--m2f-muted);
}

.m2f-sample-item:hover {
  background: var(--m2f-mist);
}

.m2f-sample-item.is-active {
  background: var(--m2f-tint);
  border-color: var(--m2f-tint-border);
}

.m2f-sample-item.is-active strong {
  color: var(--m2f-tint-ink);
}

/* Drag-Over Overlay */
.m2f-drop-overlay {
  position: absolute;
  inset: 0;
  z-index: 40;
  border-radius: var(--m2f-r-md);
  background: color-mix(in srgb, var(--m2f-primary) 92%, #121122);
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  pointer-events: none;
}

.m2f-drop-overlay-inner {
  border: 2px dashed rgba(255, 255, 255, 0.55);
  border-radius: var(--m2f-r-sm);
  padding: 24px 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
}

.m2f-drop-overlay-inner strong {
  font-family: var(--m2f-font-display);
  font-size: 17px;
}

.m2f-drop-overlay-inner span {
  font-size: 13px;
  opacity: 0.9;
}

/* Error Alert Banner */
.m2f-alert {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin: 8px 12px 0;
  padding: 8px 12px;
  border-radius: var(--m2f-r-sm);
  background: var(--m2f-err-bg);
  border: 1px solid var(--m2f-err-border);
  color: var(--m2f-err-ink);
  font-size: 12px;
}

.m2f-alert-copy strong {
  display: block;
  font-weight: 600;
  margin-bottom: 2px;
}

.m2f-alert-copy p {
  margin: 0;
  color: var(--m2f-ink-2);
  font-size: 12px;
  line-height: 1.4;
}

.m2f-alert-acts {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
}

.m2f-mini-btn {
  appearance: none;
  min-height: 28px;
  padding: 4px 10px;
  border-radius: var(--m2f-r-sm);
  border: 1px solid var(--m2f-border-strong);
  background: var(--m2f-surface);
  color: var(--m2f-ink);
  font-family: var(--m2f-font-sans);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.m2f-mini-btn:hover {
  border-color: var(--m2f-primary);
  color: var(--m2f-primary);
}

.m2f-icon-close {
  appearance: none;
  width: 28px;
  height: 28px;
  border-radius: var(--m2f-r-pill);
  border: 1px solid transparent;
  background: transparent;
  color: var(--m2f-muted);
  font-size: 18px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex: 0 0 auto;
}

.m2f-icon-close:hover {
  background: var(--m2f-mist);
  color: var(--m2f-ink);
}

/* Shared Tool Buttons (Strictly 1 Primary Studio Violet Style) */
.m2f-btn-primary,
.m2f-btn-secondary {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40px;
  padding: 8px 12px;
  border-radius: var(--m2f-r-sm);
  font-family: var(--m2f-font-sans);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  min-width: 0;
  transition: background-color 140ms ease, border-color 140ms ease, color 140ms ease, box-shadow 140ms ease, transform 100ms ease;
}

.m2f-btn-primary {
  background: var(--m2f-primary);
  color: var(--m2f-primary-ink);
  border: 1px solid var(--m2f-primary);
  box-shadow: 0 8px 20px -8px color-mix(in srgb, var(--m2f-primary) 58%, transparent);
}

.m2f-btn-primary:hover:not(:disabled) {
  background: var(--m2f-primary-hover);
  border-color: var(--m2f-primary-hover);
  color: var(--m2f-primary-ink);
}

.m2f-btn-primary:active:not(:disabled),
.m2f-btn-secondary:active:not(:disabled) {
  transform: translateY(1px);
}

.m2f-btn-primary:disabled,
.m2f-btn-secondary:disabled {
  opacity: 0.48;
  cursor: not-allowed;
  box-shadow: none;
}

.m2f-btn-secondary {
  background: var(--m2f-surface);
  color: var(--m2f-ink);
  border: 1px solid var(--m2f-border-strong);
  box-shadow: var(--m2f-shadow-sm);
}

.m2f-btn-secondary:hover:not(:disabled),
.m2f-btn-secondary[aria-expanded="true"] {
  background: var(--m2f-tint);
  border-color: var(--m2f-primary);
  color: var(--m2f-tint-ink);
}

/* Cinema Viewport (Bounded 306px height on desktop so 1280x720 fits ALL controls <= 640px) */
.m2f-loaded {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
}

.m2f-stage {
  position: relative;
  background: var(--m2f-stage);
  width: 100%;
  height: 306px;
  max-height: 306px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.m2f-video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  background: var(--m2f-stage);
}

.m2f-shutter {
  position: absolute;
  inset: 0;
  background: #FFFFFF;
  opacity: 0;
  pointer-events: none;
  transition: opacity 140ms ease-out;
}

.m2f-shutter.is-flash {
  opacity: 0.45;
  transition: none;
}

.m2f-stage-hint {
  appearance: none;
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 4px 10px;
  border-radius: var(--m2f-r-pill);
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(18, 17, 34, 0.74);
  backdrop-filter: blur(8px);
  color: #FFFFFF;
  font-family: var(--m2f-font-sans);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 140ms ease, border-color 140ms ease;
}

.m2f-stage-hint:hover {
  background: var(--m2f-primary);
  border-color: var(--m2f-primary);
}

.m2f-hud-tc {
  position: absolute;
  left: 10px;
  bottom: 10px;
  padding: 3px 9px;
  border-radius: var(--m2f-r-pill);
  background: rgba(18, 17, 34, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.16);
  backdrop-filter: blur(8px);
  color: #FFFFFF;
  font-family: var(--m2f-font-mono);
  font-size: 11px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}

.m2f-mute-btn {
  position: absolute;
  top: 10px;
  left: 10px;
  width: 34px;
  height: 34px;
  border-radius: var(--m2f-r-pill);
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(18, 17, 34, 0.72);
  backdrop-filter: blur(8px);
  color: #FFFFFF;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 140ms ease, border-color 140ms ease;
}

.m2f-mute-btn:hover {
  background: rgba(18, 17, 34, 0.92);
}

.m2f-mute-btn[aria-pressed="true"] {
  background: var(--m2f-primary);
  border-color: var(--m2f-primary);
}

.m2f-stage-overlay {
  position: absolute;
  inset: 0;
  background: rgba(18, 17, 34, 0.72);
  color: #FFFFFF;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
  z-index: 4;
}

.m2f-spinner {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2.5px solid rgba(255, 255, 255, 0.24);
  border-top-color: #FFFFFF;
  animation: m2fSpin 700ms linear infinite;
}

@keyframes m2fSpin {
  to { transform: rotate(360deg); }
}

/* Compact Merged Scrub + Controls + Capture Deck */
.m2f-deck {
  padding: 8px 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  background: var(--m2f-surface);
  border-radius: 0 0 var(--m2f-r-md) var(--m2f-r-md);
}

.m2f-scrub-wrap {
  display: flex;
  align-items: center;
  min-height: 22px;
}

.m2f-scrubber {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: var(--m2f-r-pill);
  background: var(--m2f-mist);
  outline: none;
  cursor: pointer;
}

.m2f-scrubber::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: var(--m2f-primary);
  border: 2.5px solid var(--m2f-surface);
  box-shadow: 0 0 0 1px var(--m2f-primary), 0 2px 6px rgba(18, 17, 34, 0.22);
  cursor: grab;
  transition: transform 120ms ease;
}

.m2f-scrubber::-webkit-slider-thumb:active {
  transform: scale(1.12);
  cursor: grabbing;
}

.m2f-scrubber::-moz-range-thumb {
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: var(--m2f-primary);
  border: 2.5px solid var(--m2f-surface);
  box-shadow: 0 0 0 1px var(--m2f-primary), 0 2px 6px rgba(18, 17, 34, 0.22);
  cursor: grab;
}

/* Single Merged Controls Bar: Play/-1f/+1f | Timecode | Step FPS */
.m2f-controls-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.m2f-transport-left {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.m2f-ctrl-btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 32px;
  padding: 5px 10px;
  border-radius: 8px;
  border: 1px solid var(--m2f-border-strong);
  background: var(--m2f-surface);
  color: var(--m2f-ink);
  font-family: var(--m2f-font-sans);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 140ms ease, background-color 140ms ease, color 140ms ease;
}

.m2f-ctrl-btn:hover:not(:disabled) {
  border-color: var(--m2f-primary);
  background: var(--m2f-tint);
  color: var(--m2f-tint-ink);
}

.m2f-ctrl-btn:disabled {
  opacity: 0.48;
  cursor: not-allowed;
}

.m2f-tc-group {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--m2f-font-mono);
  font-variant-numeric: tabular-nums;
}

.m2f-tc-current {
  font-size: 13px;
  font-weight: 600;
  color: var(--m2f-ink);
}

.m2f-tc-sep,
.m2f-tc-total {
  font-size: 12px;
  color: var(--m2f-muted);
}

.m2f-frame-num {
  padding: 2px 7px;
  border-radius: var(--m2f-r-pill);
  background: var(--m2f-tint);
  border: 1px solid var(--m2f-tint-border);
  color: var(--m2f-tint-ink);
  font-size: 11px;
  font-weight: 500;
}

.m2f-fps-group {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.m2f-fps-unit {
  font-size: 11px;
  color: var(--m2f-muted);
  font-weight: 500;
}

.m2f-seg {
  display: inline-grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  padding: 2px;
  border-radius: 8px;
  background: var(--m2f-mist);
  border: 1px solid var(--m2f-border);
}

.m2f-seg-btn {
  appearance: none;
  border: 1px solid transparent;
  background: transparent;
  color: var(--m2f-muted);
  font-family: var(--m2f-font-mono);
  font-size: 11px;
  font-weight: 500;
  padding: 2px 7px;
  min-height: 24px;
  border-radius: 6px;
  cursor: pointer;
  font-variant-numeric: tabular-nums;
}

.m2f-seg-btn:hover:not(.is-active) {
  color: var(--m2f-ink);
}

.m2f-seg-btn.is-active {
  background: var(--m2f-surface);
  color: var(--m2f-ink);
  border-color: var(--m2f-border-strong);
  font-weight: 600;
  box-shadow: var(--m2f-shadow-sm);
}

/* Capture Deck (4 Equal Core Actions) */
.m2f-capture-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding-top: 7px;
  border-top: 1px solid var(--m2f-border);
}

.m2f-capture-grid {
  display: grid;
  grid-template-columns: 1.48fr repeat(3, minmax(0, 1fr));
  gap: 7px;
}

/* Batch Extract Upward Popover */
.m2f-batch-pop {
  position: absolute;
  right: 0;
  bottom: calc(100% + 8px);
  width: 326px;
  max-width: 100%;
  background: var(--m2f-surface);
  border: 1px solid var(--m2f-border-strong);
  border-radius: var(--m2f-r-md);
  box-shadow: var(--m2f-shadow-pop);
  padding: 14px;
  z-index: 35;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.m2f-batch-pop-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.m2f-batch-pop-head strong {
  font-family: var(--m2f-font-display);
  font-size: 14px;
  font-weight: 700;
  color: var(--m2f-ink);
}

.m2f-batch-modes {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  padding: 3px;
  border-radius: var(--m2f-r-sm);
  background: var(--m2f-mist);
  border: 1px solid var(--m2f-border);
}

.m2f-mode-btn {
  appearance: none;
  border: 1px solid transparent;
  background: transparent;
  color: var(--m2f-muted);
  font-family: var(--m2f-font-sans);
  font-size: 12px;
  font-weight: 600;
  padding: 6px 4px;
  min-height: 30px;
  border-radius: 7px;
  cursor: pointer;
  white-space: nowrap;
}

.m2f-mode-btn.is-active {
  background: var(--m2f-surface);
  color: var(--m2f-ink);
  border-color: var(--m2f-border-strong);
  box-shadow: var(--m2f-shadow-sm);
}

.m2f-batch-pane {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.m2f-batch-counts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.m2f-count-btn {
  appearance: none;
  min-height: 36px;
  padding: 6px 8px;
  border-radius: var(--m2f-r-sm);
  border: 1px solid var(--m2f-border-strong);
  background: var(--m2f-surface);
  color: var(--m2f-ink-2);
  font-family: var(--m2f-font-mono);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
}

.m2f-count-btn:hover:not(.is-active) {
  border-color: var(--m2f-primary);
  color: var(--m2f-ink);
}

.m2f-count-btn.is-active {
  background: var(--m2f-tint);
  border: 2px solid var(--m2f-primary);
  color: var(--m2f-tint-ink);
  font-weight: 600;
}

.m2f-num-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--m2f-ink-2);
}

.m2f-num-field {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--m2f-border-strong);
  border-radius: 8px;
  background: var(--m2f-bg);
  overflow: hidden;
}

.m2f-num-field input {
  width: 72px;
  border: 0;
  background: transparent;
  padding: 6px 8px;
  font-family: var(--m2f-font-mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--m2f-ink);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.m2f-num-unit {
  padding: 6px 9px 6px 4px;
  font-family: var(--m2f-font-mono);
  font-size: 12px;
  color: var(--m2f-muted);
}

.m2f-est-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 8px;
  background: var(--m2f-bg);
  border: 1px solid var(--m2f-border);
  font-family: var(--m2f-font-mono);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.m2f-est-text {
  font-weight: 600;
  color: var(--m2f-ink);
}

.m2f-est-cap {
  padding: 2px 7px;
  border-radius: var(--m2f-r-pill);
  background: var(--m2f-warn-bg);
  border: 1px solid var(--m2f-warn-border);
  color: var(--m2f-warn-ink);
  font-size: 11px;
  font-weight: 600;
}

.m2f-cap-warn {
  margin: 0;
  font-size: 11px;
  line-height: 1.45;
  color: var(--m2f-warn-ink);
}

.m2f-batch-go {
  width: 100%;
  min-height: 38px;
  font-size: 13px;
}

/* Batch Progress Bar */
.m2f-progress-bar {
  padding: 8px 10px;
  border-radius: var(--m2f-r-sm);
  background: var(--m2f-tint);
  border: 1px solid var(--m2f-tint-border);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.m2f-progress-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--m2f-tint-ink);
}

.m2f-progress-track {
  width: 100%;
  height: 5px;
  border-radius: var(--m2f-r-pill);
  background: color-mix(in srgb, var(--m2f-primary) 18%, var(--m2f-surface));
  overflow: hidden;
}

.m2f-progress-fill {
  height: 100%;
  border-radius: var(--m2f-r-pill);
  background: var(--m2f-primary);
  transition: width 160ms ease;
}

/* ==========================================================================
   RIGHT COLUMN: Live Frame Inspector & Selectable Output Tray
   ========================================================================== */
.m2f-tray-card {
  overflow: hidden;
}

.m2f-tray-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 12px;
  min-height: 44px;
  border-bottom: 1px solid var(--m2f-border);
  flex: 0 0 auto;
}

.m2f-tray-title-row {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.m2f-tray-title {
  margin: 0;
  font-family: var(--m2f-font-display);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.2;
  color: var(--m2f-ink);
}

.m2f-count-pill {
  font-family: var(--m2f-font-mono);
  font-size: 11px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  padding: 1px 7px;
  border-radius: var(--m2f-r-pill);
  background: var(--m2f-tint);
  border: 1px solid var(--m2f-tint-border);
  color: var(--m2f-tint-ink);
}

.m2f-tray-head-acts {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.m2f-live-sync-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: var(--m2f-r-pill);
  background: color-mix(in srgb, var(--m2f-coral) 10%, var(--m2f-surface));
  border: 1px solid color-mix(in srgb, var(--m2f-coral) 28%, var(--m2f-surface));
  color: var(--danger, var(--m2f-coral));
  font-family: var(--m2f-font-mono);
  font-size: 11px;
  font-weight: 600;
}

.m2f-rec-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--m2f-coral);
  flex: 0 0 auto;
}

/* LIVE FRAME INSPECTOR (Tray Count = 0, Zero Whitespace, Full Functionality) */
.m2f-live-inspector {
  flex: 1 1 auto;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  min-height: 0;
}

.m2f-live-preview-box {
  position: relative;
  width: 100%;
  height: 184px;
  border-radius: var(--m2f-r-sm);
  background: var(--m2f-stage);
  border: 1px solid var(--m2f-border);
  overflow: hidden;
  flex: 0 0 auto;
}

.m2f-live-canvas,
.m2f-live-poster {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.m2f-live-canvas {
  z-index: 1;
}

.m2f-live-poster {
  z-index: 0;
}

.m2f-live-badge {
  position: absolute;
  left: 8px;
  bottom: 8px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border-radius: var(--m2f-r-pill);
  background: rgba(18, 17, 34, 0.84);
  border: 1px solid rgba(255, 255, 255, 0.16);
  backdrop-filter: blur(6px);
  color: #FFFFFF;
  font-family: var(--m2f-font-mono);
  font-size: 11px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  max-width: calc(100% - 16px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.m2f-live-zoom {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
}

.m2f-live-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.m2f-live-dl-row {
  display: grid;
  grid-template-columns: 0.85fr 1.25fr 1fr;
  gap: 6px;
}

.m2f-dl-btn.is-add {
  border-color: var(--m2f-tint-border);
  background: var(--m2f-bg);
  color: var(--m2f-tint-ink);
}

.m2f-dl-btn.is-add:hover {
  background: var(--m2f-tint);
  border-color: var(--m2f-primary);
}

.m2f-live-animate {
  width: 100%;
  min-height: 34px;
}

.m2f-quick-batch {
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px solid var(--m2f-border);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.m2f-quick-kicker {
  font-family: var(--m2f-font-mono);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--m2f-muted);
}

.m2f-quick-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.m2f-quick-btn {
  appearance: none;
  text-align: left;
  padding: 7px 9px;
  border-radius: 8px;
  border: 1px solid var(--m2f-border);
  background: var(--m2f-bg);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  transition: border-color 140ms ease, background-color 140ms ease;
}

.m2f-quick-btn strong {
  font-family: var(--m2f-font-sans);
  font-size: 12px;
  font-weight: 600;
  color: var(--m2f-ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.m2f-quick-btn span {
  font-size: 11px;
  color: var(--m2f-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.m2f-quick-btn:hover:not(:disabled) {
  border-color: var(--m2f-primary);
  background: var(--m2f-tint);
}

.m2f-quick-btn:hover:not(:disabled) strong {
  color: var(--m2f-tint-ink);
}

.m2f-quick-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Tray Header Controls (Populated State) */
.m2f-view-seg {
  display: inline-grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 2px;
  border-radius: 8px;
  background: var(--m2f-mist);
  border: 1px solid var(--m2f-border);
}

.m2f-view-btn {
  appearance: none;
  border: 1px solid transparent;
  background: transparent;
  color: var(--m2f-muted);
  font-family: var(--m2f-font-sans);
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  min-height: 24px;
  border-radius: 6px;
  cursor: pointer;
}

.m2f-view-btn.is-active {
  background: var(--m2f-surface);
  color: var(--m2f-ink);
  border-color: var(--m2f-border-strong);
  box-shadow: var(--m2f-shadow-sm);
}

.m2f-text-btn {
  appearance: none;
  border: 1px solid transparent;
  background: transparent;
  color: var(--m2f-primary);
  font-family: var(--m2f-font-sans);
  font-size: 12px;
  font-weight: 600;
  padding: 4px 8px;
  min-height: 28px;
  border-radius: var(--m2f-r-sm);
  cursor: pointer;
  white-space: nowrap;
}

.m2f-text-btn:hover {
  background: var(--m2f-tint);
}

.m2f-text-btn.is-danger {
  color: var(--m2f-muted);
}

.m2f-text-btn.is-danger:hover {
  background: var(--m2f-err-bg);
  color: var(--m2f-err-ink);
}

/* Selection Bar */
.m2f-sel-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 5px 12px;
  background: var(--m2f-bg);
  border-bottom: 1px solid var(--m2f-border);
  font-size: 12px;
  color: var(--m2f-ink-2);
  flex: 0 0 auto;
}

.m2f-sel-all {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--m2f-font-mono);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  user-select: none;
}

.m2f-sel-all input,
.m2f-card-check {
  width: 15px;
  height: 15px;
  accent-color: var(--m2f-primary);
  cursor: pointer;
  margin: 0;
}

/* Scrollable Frame List / Compact 2-Column Grid */
.m2f-tray-list {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scrollbar-width: thin;
  min-height: 0;
}

.m2f-tray-list.is-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-rows: max-content;
  align-content: start;
  gap: 8px;
}

.m2f-frame-card {
  border-radius: var(--m2f-r-sm);
  border: 1px solid var(--m2f-border);
  background: var(--m2f-bg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  flex: 0 0 auto;
  height: auto;
  transition: border-color 140ms ease, box-shadow 140ms ease, opacity 140ms ease;
}

.m2f-frame-card.is-selected {
  border-color: var(--m2f-tint-border);
}

.m2f-frame-card.is-unselected {
  opacity: 0.62;
}

.m2f-frame-media {
  position: relative;
  flex: 0 0 auto;
  width: 100%;
  height: 142px;
  background: var(--m2f-stage);
  overflow: hidden;
  cursor: pointer;
}

.m2f-tray-list.is-grid .m2f-frame-media {
  height: 92px;
}

.m2f-frame-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.m2f-frame-top-left {
  position: absolute;
  top: 6px;
  left: 6px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  z-index: 2;
}

.m2f-check-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(18, 17, 34, 0.16);
  cursor: pointer;
}

.m2f-frame-badge {
  padding: 2px 7px;
  border-radius: var(--m2f-r-pill);
  background: rgba(18, 17, 34, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: #FFFFFF;
  font-family: var(--m2f-font-mono);
  font-size: 11px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.m2f-frame-badge.is-key {
  background: color-mix(in srgb, var(--m2f-primary) 90%, #121122);
}

.m2f-tray-list.is-grid .m2f-frame-badge {
  position: absolute;
  left: 6px;
  bottom: 6px;
  font-size: 10px;
  padding: 2px 6px;
  z-index: 2;
}

.m2f-frame-card-acts {
  position: absolute;
  top: 6px;
  right: 6px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  z-index: 2;
}

.m2f-card-ico-btn {
  appearance: none;
  width: 26px;
  height: 26px;
  border-radius: var(--m2f-r-pill);
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(18, 17, 34, 0.78);
  color: #FFFFFF;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 140ms ease;
}

.m2f-card-ico-btn:hover {
  background: var(--m2f-primary);
}

.m2f-card-ico-btn.is-del:hover {
  background: var(--m2f-err-ink);
}

.m2f-frame-body {
  flex: 0 0 auto;
  padding: 8px;
  background: var(--m2f-surface);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.m2f-tray-list.is-grid .m2f-frame-body {
  padding: 6px;
  gap: 5px;
}

.m2f-frame-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  font-family: var(--m2f-font-mono);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  color: var(--m2f-muted);
}

.m2f-frame-res {
  font-weight: 600;
  color: var(--m2f-ink);
}

.m2f-tray-list.is-grid .m2f-frame-size-detail {
  display: none;
}

.m2f-dl-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.m2f-dl-btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 32px;
  padding: 5px 6px;
  border-radius: 8px;
  border: 1px solid var(--m2f-border-strong);
  background: var(--m2f-surface);
  color: var(--m2f-ink);
  font-family: var(--m2f-font-sans);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  min-width: 0;
  transition: border-color 140ms ease, background-color 140ms ease, color 140ms ease;
}

.m2f-dl-btn:hover:not(:disabled) {
  border-color: var(--m2f-primary);
  background: var(--m2f-tint);
  color: var(--m2f-tint-ink);
}

.m2f-dl-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.m2f-tray-list.is-grid .m2f-dl-btn {
  min-height: 26px;
  font-size: 11px;
  padding: 3px;
}

.m2f-bridge-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px;
}

.m2f-bridge-btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 34px;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid var(--m2f-tint-border);
  background: var(--m2f-tint);
  color: var(--m2f-tint-ink);
  font-family: var(--m2f-font-sans);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  transition: background-color 140ms ease, border-color 140ms ease, color 140ms ease;
}

.m2f-bridge-btn:hover:not(:disabled) {
  background: var(--m2f-primary);
  border-color: var(--m2f-primary);
  color: var(--m2f-primary-ink);
}

.m2f-bridge-btn:disabled {
  opacity: 0.48;
  cursor: not-allowed;
}

.m2f-tray-list.is-grid .m2f-bridge-btn {
  min-height: 26px;
  font-size: 11px;
  padding: 3px 6px;
}

.m2f-tray-list.is-grid .m2f-end-slot-btn {
  display: none;
}

.m2f-end-slot-btn {
  appearance: none;
  min-height: 34px;
  padding: 6px 9px;
  border-radius: 8px;
  border: 1px dashed var(--m2f-border-strong);
  background: var(--m2f-surface);
  color: var(--m2f-muted);
  font-family: var(--m2f-font-mono);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 140ms ease, color 140ms ease, background-color 140ms ease;
}

.m2f-end-slot-btn:hover {
  border-style: solid;
  border-color: var(--m2f-primary);
  background: var(--m2f-tint);
  color: var(--m2f-tint-ink);
}

/* Tray Sticky Footer (ZIP Export + Magi 2 Pair Bridge) */
.m2f-tray-foot {
  padding: 8px 12px 9px;
  border-top: 1px solid var(--m2f-border);
  background: var(--m2f-surface);
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 0 0 auto;
}

.m2f-zip-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px;
  align-items: stretch;
}

.m2f-zip-btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 36px;
  padding: 6px 10px;
  border-radius: var(--m2f-r-sm);
  border: 1px solid var(--m2f-border-strong);
  background: var(--m2f-ink);
  color: #FFFFFF;
  font-family: var(--m2f-font-sans);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  min-width: 0;
  transition: background-color 140ms ease, opacity 140ms ease;
}

.m2f-zip-btn:hover:not(:disabled) {
  background: var(--m2f-primary);
  border-color: var(--m2f-primary);
}

.m2f-zip-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.m2f-zip-fmt {
  display: inline-grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 2px;
  border-radius: var(--m2f-r-sm);
  background: var(--m2f-mist);
  border: 1px solid var(--m2f-border);
}

.m2f-fmt-btn {
  appearance: none;
  border: 1px solid transparent;
  background: transparent;
  color: var(--m2f-muted);
  font-family: var(--m2f-font-mono);
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 7px;
  cursor: pointer;
}

.m2f-fmt-btn.is-active {
  background: var(--m2f-surface);
  color: var(--m2f-ink);
  border-color: var(--m2f-border-strong);
  box-shadow: var(--m2f-shadow-sm);
}

.m2f-pair-btn {
  appearance: none;
  width: 100%;
  min-height: 34px;
  padding: 6px 10px;
  border-radius: var(--m2f-r-sm);
  border: 1px solid var(--m2f-primary);
  background: var(--m2f-tint);
  color: var(--m2f-tint-ink);
  font-family: var(--m2f-font-sans);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 140ms ease, color 140ms ease;
}

.m2f-pair-btn:hover {
  background: var(--m2f-primary);
  color: var(--m2f-primary-ink);
}

.m2f-tray-promo {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 11px;
  color: var(--m2f-muted);
}

.m2f-tray-promo a {
  color: var(--m2f-primary);
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.m2f-tray-promo a:hover {
  text-decoration: underline;
}

/* Modals (Lightbox & Handoff Preview) */
.m2f-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 120;
  background: rgba(18, 17, 34, 0.64);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.m2f-lightbox-card,
.m2f-handoff-card {
  background: var(--m2f-surface);
  border: 1px solid var(--m2f-border);
  border-radius: var(--m2f-r-md);
  box-shadow: var(--m2f-shadow-pop);
  max-width: 920px;
  width: 100%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.m2f-handoff-card {
  max-width: 540px;
}

.m2f-lightbox-head,
.m2f-handoff-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--m2f-border);
}

.m2f-lightbox-meta {
  font-family: var(--m2f-font-mono);
  font-size: 12px;
  color: var(--m2f-ink-2);
}

.m2f-lightbox-stage {
  background: var(--m2f-stage);
  max-height: 75vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
}

.m2f-lightbox-stage img {
  max-width: 100%;
  max-height: 70vh;
  object-fit: contain;
  display: block;
}

.m2f-handoff-kicker {
  display: block;
  font-family: var(--m2f-font-mono);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--m2f-ok-ink);
}

.m2f-handoff-title {
  margin: 2px 0 0;
  font-family: var(--m2f-font-display);
  font-size: 18px;
  font-weight: 700;
  color: var(--m2f-ink);
}

.m2f-handoff-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.m2f-handoff-thumbs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
}

.m2f-handoff-thumb-card {
  border-radius: var(--m2f-r-sm);
  border: 1px solid var(--m2f-border);
  background: var(--m2f-bg);
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.m2f-handoff-thumb-card img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: contain;
  background: var(--m2f-stage);
  border-radius: 6px;
  display: block;
}

.m2f-handoff-thumb-card span {
  font-family: var(--m2f-font-mono);
  font-size: 11px;
  color: var(--m2f-ink-2);
}

.m2f-handoff-note {
  margin: 0;
  font-size: 13px;
  color: var(--m2f-ink-2);
  line-height: 1.5;
}

.m2f-handoff-contract {
  font-family: var(--m2f-font-mono);
  font-size: 11px;
  line-height: 1.5;
  padding: 10px 12px;
  border-radius: var(--m2f-r-sm);
  background: var(--m2f-bg);
  border: 1px solid var(--m2f-border);
  color: var(--m2f-muted);
  word-break: break-word;
}

.m2f-handoff-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 12px 16px 16px;
  border-top: 1px solid var(--m2f-border);
}

/* Non-Blocking Floating Toast */
.m2f-toast {
  position: fixed;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  z-index: 130;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  border-radius: var(--m2f-r-pill);
  background: var(--m2f-ink);
  color: #FFFFFF;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  pointer-events: none;
  box-shadow: var(--m2f-shadow-pop);
  max-width: calc(100vw - 24px);
}

.m2f-toast-act {
  appearance: none;
  pointer-events: auto;
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.16);
  color: #FFFFFF;
  font-family: var(--m2f-font-sans);
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--m2f-r-pill);
  cursor: pointer;
  white-space: nowrap;
}

.m2f-toast-act:hover {
  background: rgba(255, 255, 255, 0.28);
}

/* Responsive Breakpoints */
@media (max-width: 1040px) {
  .m2f-workbench {
    grid-template-columns: 1fr;
  }

  .m2f-tray-card {
    height: auto !important;
    max-height: none !important;
  }

  .m2f-tray-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    overflow-y: visible;
  }
}

@media (max-width: 640px) {
  .tool-page:has([data-gf-tool="extract-frame-from-video"]) .studio-hero {
    padding: 8px 0 8px;
  }

  .tool-page:has([data-gf-tool="extract-frame-from-video"]) .hero-title {
    font-size: 1.55rem;
  }

  .m2f-bar-top {
    padding: 7px 10px;
    gap: 6px;
  }

  .m2f-bar-left {
    gap: 6px;
  }

  .m2f-upload-btn {
    padding: 6px 10px;
    font-size: 12px;
    min-height: 36px;
  }

  .m2f-privacy-pill,
  .m2f-spec-pill,
  .m2f-stage-hint {
    display: none;
  }

  .m2f-stage {
    height: auto;
    aspect-ratio: 16 / 9;
    max-height: 204px;
  }

  .m2f-deck {
    padding: 8px 10px 10px;
    gap: 8px;
  }

  .m2f-scrubber::-webkit-slider-thumb {
    width: 24px;
    height: 24px;
  }

  .m2f-controls-bar {
    gap: 7px;
  }

  .m2f-transport-left {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
  }

  .m2f-ctrl-btn {
    min-height: 44px;
    padding: 8px 6px;
    font-size: 13px;
  }

  .m2f-capture-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }

  .m2f-capture-grid .m2f-btn-primary,
  .m2f-capture-grid .m2f-btn-secondary {
    min-height: 44px;
    padding: 8px 8px;
    font-size: 13px;
    white-space: normal;
    text-align: center;
    line-height: 1.2;
  }

  .m2f-live-dl-row {
    grid-template-columns: 1fr 1.35fr;
  }

  .m2f-live-dl-row .is-add {
    grid-column: 1 / -1;
  }

  .m2f-live-dl-row .m2f-dl-btn,
  .m2f-live-animate {
    min-height: 44px;
    font-size: 12.5px;
    padding: 6px 10px;
  }

  .m2f-tray-list:not(.is-grid) {
    grid-template-columns: 1fr;
  }

  .m2f-tray-list.is-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .m2f-tray-list:not(.is-grid) .m2f-dl-btn,
  .m2f-tray-list:not(.is-grid) .m2f-bridge-btn,
  .m2f-tray-list:not(.is-grid) .m2f-end-slot-btn,
  .m2f-zip-btn,
  .m2f-pair-btn {
    min-height: 44px;
  }

  .m2f-card-ico-btn {
    width: 32px;
    height: 32px;
  }

  .m2f-batch-pop {
    left: 0;
    right: 0;
    width: auto;
  }

  .m2f-handoff-actions {
    flex-direction: column;
    align-items: stretch;
  }
}

@media (prefers-reduced-motion: reduce) {
  .m2f-spinner {
    animation: none;
  }
  .m2f-shutter {
    transition: none;
  }
}
