.m2-wrap { min-width: 0; max-width: 100%; }
.m2-composer {
  position: relative;
  min-width: 0;
  max-width: 100%;
  background: rgba(19, 22, 31, 0.92);
  backdrop-filter: blur(22px);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 18px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.62);
}
.m2-composer::before,
.m2-composer::after {
  content: '';
  position: absolute;
  width: 14px;
  height: 14px;
  pointer-events: none;
  z-index: 3;
}
.m2-composer::before {
  top: 8px;
  left: 8px;
  border-top: 2px solid var(--accent);
  border-left: 2px solid var(--accent);
  border-top-left-radius: 6px;
}
.m2-composer::after {
  bottom: 8px;
  right: 8px;
  border-bottom: 2px solid var(--accent);
  border-right: 2px solid var(--accent);
  border-bottom-right-radius: 6px;
}

.m2-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  border-radius: 18px 18px 0 0;
  background: rgba(10, 11, 14, 0.62);
}
.m2-mode-pills {
  display: inline-flex;
  flex-wrap: wrap;
  padding: 3px;
  border-radius: 999px;
  background: var(--bg);
  border: 1px solid var(--border);
  gap: 3px;
}
.m2-tab {
  min-height: 36px;
  padding: 6px 13px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.m2-tab:hover { color: var(--fg); }
.m2-tab[aria-selected="true"] { background: var(--primary); color: var(--fg); }
.m2-tab-short { display: none; }
.m2-tab-tag {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent);
}
.m2-tab[aria-selected="true"] .m2-tab-tag { color: var(--fg); }

.m2-top-tools { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.m2-model-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 4px 11px;
  border: 1px solid var(--border-hi);
  border-radius: 999px;
  background: rgba(15, 118, 110, 0.16);
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
}
.m2-mini-btn {
  min-height: 32px;
  padding: 4px 11px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--card-2);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: border-color 0.15s ease, background-color 0.15s ease, color 0.15s ease;
}
.m2-mini-btn:hover { border-color: var(--accent); background: rgba(15, 118, 110, 0.28); }
.m2-mini-btn[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); }
.m2-enhance-btn {
  border-color: var(--border-hi);
  background: rgba(15, 118, 110, 0.24);
  color: var(--accent);
  font-weight: 600;
}
.m2-enhance-btn:hover:not(:disabled) {
  background: var(--primary);
  border-color: var(--accent);
  color: var(--fg);
}
.m2-enhance-btn:disabled { opacity: 0.65; cursor: wait; }
.m2-enhance-tag {
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(10, 11, 14, 0.48);
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--fg);
}
.m2-undo-btn {
  border-color: rgba(245, 158, 11, 0.45);
  background: rgba(245, 158, 11, 0.12);
  color: var(--amber);
}
.m2-undo-btn:hover { background: rgba(245, 158, 11, 0.24); border-color: var(--amber); }
.m2-mini-ghost {
  border-color: transparent;
  background: transparent;
  color: var(--muted);
  padding: 4px 8px;
}
.m2-mini-ghost:hover { border-color: var(--border); background: rgba(255, 255, 255, 0.05); color: var(--fg); }

.m2-body { padding: 16px 18px 14px; min-width: 0; }

/* First / Last Frame tray */
.m2-kf-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  margin-bottom: 14px;
}
.m2-swap-btn {
  min-width: 36px;
  min-height: 36px;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card-2);
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 14px;
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}
.m2-swap-btn:hover { border-color: var(--accent); background: var(--primary); color: var(--fg); }

.m2-upload-box {
  min-height: 68px;
  padding: 10px 14px;
  border: 1.5px dashed rgba(255, 255, 255, 0.22);
  border-radius: 12px;
  background: rgba(10, 11, 14, 0.56);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}
.m2-upload-box:hover,
.m2-upload-box.is-drag { border-color: var(--accent); background: rgba(45, 212, 191, 0.08); }
.m2-plus {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: var(--card-2);
  border: 1px solid var(--border);
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.m2-upload-copy { text-align: left; }
.m2-upload-title { margin: 0; font-size: 13px; font-weight: 600; color: var(--fg); }
.m2-upload-badge {
  display: inline-flex;
  align-items: center;
  margin-left: 6px;
  padding: 1px 7px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  vertical-align: middle;
}
.m2-upload-badge.is-req {
  border-color: var(--border-hi);
  background: rgba(15, 118, 110, 0.2);
  color: var(--accent);
}
.m2-upload-sub { margin: 2px 0 0; font-size: 12px; color: var(--muted); }
.m2-preview-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--border-hi);
  border-radius: 12px;
  background: rgba(10, 11, 14, 0.65);
}
.m2-preview-thumb { width: 52px; height: 38px; object-fit: cover; border-radius: 6px; flex-shrink: 0; }
.m2-preview-meta { flex: 1; min-width: 0; }
.m2-preview-name { margin: 0; font-size: 12px; font-weight: 600; color: var(--fg); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m2-preview-dims { margin: 2px 0 0; font-family: var(--font-mono); font-size: 12px; color: var(--muted); }
.m2-clear-btn {
  min-height: 32px;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card-2);
  color: var(--fg);
  font-size: 12px;
  cursor: pointer;
}

/* Multi-Reference Omni Filmstrip */
.m2-ref-panel {
  margin-bottom: 14px;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(10, 11, 14, 0.56);
}
.m2-ref-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}
.m2-ref-title { font-size: 13px; font-weight: 600; color: var(--fg); }
.m2-ref-count { font-family: var(--font-mono); font-size: 12px; color: var(--accent); }
.m2-ref-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.m2-ref-add {
  width: 78px;
  height: 58px;
  border: 1.5px dashed rgba(255, 255, 255, 0.24);
  border-radius: 9px;
  background: var(--card);
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
}
.m2-ref-add:hover { border-color: var(--accent); background: rgba(45, 212, 191, 0.1); }
.m2-ref-thumb {
  position: relative;
  width: 78px;
  height: 58px;
  border-radius: 9px;
  overflow: hidden;
  border: 1px solid var(--border-hi);
  background: var(--bg-deep);
}
.m2-ref-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.m2-ref-rm {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: 50%;
  background: rgba(10, 11, 14, 0.84);
  color: var(--fg);
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
}
.m2-ref-rm::after {
  content: '';
  position: absolute;
  inset: -10px;
}
.m2-ref-hint { margin: 8px 0 0; font-size: 12px; color: var(--muted); }

/* Upload Consent Box */
.m2-consent-box {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 12px;
  padding: 9px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  background: rgba(255, 255, 255, 0.03);
  font-size: 12px;
  line-height: 1.48;
  color: var(--muted);
  cursor: pointer;
  transition: border-color 0.16s ease, background-color 0.16s ease, color 0.16s ease;
}
.m2-consent-box:hover { border-color: rgba(255, 255, 255, 0.18); }
.m2-consent-box:has(input:checked) {
  border-color: rgba(45, 212, 191, 0.34);
  background: rgba(15, 118, 110, 0.1);
  color: var(--fg);
}
.m2-consent-box input {
  -webkit-appearance: none;
  appearance: none;
  margin: 2px 0 0;
  width: 18px;
  height: 18px;
  border-radius: 5px;
  border: 1.5px solid rgba(255, 255, 255, 0.3);
  background: rgba(7, 9, 13, 0.85);
  flex-shrink: 0;
  cursor: pointer;
  position: relative;
  transition: background-color 0.14s ease, border-color 0.14s ease, box-shadow 0.14s ease;
}
.m2-consent-box input:checked {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(45, 212, 191, 0.2);
}
.m2-consent-box input:checked::after {
  content: '';
  position: absolute;
  left: 5px;
  top: 2px;
  width: 5px;
  height: 9px;
  border: solid #041312;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.m2-consent-box input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.m2-consent-box a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* Prompt Canvas */
.m2-prompt-box {
  border-radius: 12px;
  transition: border-color 0.16s ease, box-shadow 0.2s ease;
}
.m2-prompt-box.is-enhanced {
  box-shadow: 0 0 0 2px rgba(45, 212, 191, 0.35);
}
.m2-textarea {
  width: 100%;
  min-height: 108px;
  padding: 4px 2px;
  border: 0;
  background: transparent;
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  resize: vertical;
  transition: min-height 0.18s ease;
}
.m2-textarea.is-expanded { min-height: 230px; }
.m2-textarea::placeholder { color: var(--muted); opacity: 0.78; }
.m2-textarea:focus { outline: none; }

.m2-prompt-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}
.m2-prompt-tools {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.m2-prompt-right {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}
.m2-enhance-note {
  margin: 6px 2px 0;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent);
}
.m2-enhance-note.is-err { color: var(--amber); }
.m2-prompt-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
  min-width: 0;
}
.m2-chips { display: flex; flex-wrap: wrap; gap: 6px; min-width: 0; }
.m2-chip {
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  font-family: var(--font-body);
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
}
.m2-chip:hover { border-color: var(--accent); color: var(--fg); }
.m2-meta-right { display: inline-flex; align-items: center; gap: 10px; }
.m2-reset-link {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 12px;
  cursor: pointer;
  padding: 4px 6px;
}
.m2-reset-link:hover { color: var(--fg); }
.m2-char { font-family: var(--font-mono); font-size: 12px; color: var(--muted); }

/* Bottom Pro Studio Dock with Popovers */
.m2-dock {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  border-radius: 0 0 18px 18px;
  background: rgba(10, 11, 14, 0.78);
  min-width: 0;
}
.m2-dock-controls { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; min-width: 0; }

.m2-pop-wrap { position: relative; }
.m2-pop-btn {
  min-height: 40px;
  padding: 6px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--fg);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.m2-pop-btn:hover,
.m2-pop-btn[aria-expanded="true"] { border-color: var(--accent); color: var(--accent); }
.m2-ar-icon {
  display: inline-block;
  border: 1.5px solid currentColor;
  border-radius: 2px;
  width: 16px;
  height: 10px;
  transition: width 0.14s ease, height 0.14s ease;
}
.m2-ar-icon[data-ar="9:16"] { width: 10px; height: 16px; }
.m2-ar-icon[data-ar="1:1"]  { width: 13px; height: 13px; }
.m2-ar-icon[data-ar="21:9"] { width: 19px; height: 9px; }
.m2-ar-icon[data-ar="4:3"]  { width: 15px; height: 11px; }
.m2-ar-icon[data-ar="3:4"]  { width: 11px; height: 15px; }
.m2-popover {
  position: absolute;
  left: 0;
  bottom: calc(100% + 8px);
  z-index: 30;
  min-width: 276px;
  padding: 12px;
  border-radius: 14px;
  background: var(--card);
  border: 1px solid var(--border-hi);
  box-shadow: var(--shadow-md);
}
.m2-pop-handle { display: none; }
.m2-pop-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}
.m2-pop-hd {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
}
.m2-pop-close {
  display: none;
  width: 44px;
  height: 44px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card-2);
  color: var(--fg);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.m2-ratio-list,
.m2-dur-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.m2-ratio-opt,
.m2-dur-opt {
  min-height: 46px;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  color: var(--fg);
  text-align: left;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}
.m2-ratio-opt > span:last-child { min-width: 0; flex: 1; }
.m2-dur-opt {
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 2px;
}
.m2-ratio-opt:hover,
.m2-dur-opt:hover { border-color: var(--border-hi); }
.m2-ratio-opt[aria-pressed="true"],
.m2-dur-opt[aria-pressed="true"] {
  border-color: var(--accent);
  background: rgba(15, 118, 110, 0.24);
}
.m2-dur-top {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}
.m2-dur-cr {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--amber);
}
.m2-ar-sm { display: inline-block; border: 1.5px solid var(--accent); border-radius: 2px; flex-shrink: 0; }
.m2-ar-16-9 { width: 20px; height: 12px; }
.m2-ar-9-16 { width: 11px; height: 19px; }
.m2-ar-1-1  { width: 15px; height: 15px; }
.m2-ar-4-3  { width: 18px; height: 14px; }
.m2-ar-3-4  { width: 13px; height: 17px; }
.m2-ar-21-9 { width: 22px; height: 10px; }
.m2-ratio-main { display: block; font-family: var(--font-mono); font-size: 12px; font-weight: 600; line-height: 1.25; }
.m2-ratio-sub { display: block; font-size: 12px; color: var(--muted); line-height: 1.3; overflow-wrap: break-word; }

/* Seed popover */
.m2-seed-row { display: flex; gap: 6px; }
.m2-seed-input {
  flex: 1;
  min-width: 0;
  min-height: 40px;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-mono);
  font-size: 14px;
}
.m2-seed-input:focus { outline: none; border-color: var(--accent); }
.m2-seed-btn {
  min-height: 40px;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--card-2);
  color: var(--fg);
  font-family: var(--font-mono);
  font-size: 12px;
  cursor: pointer;
}
.m2-seed-btn:hover { border-color: var(--accent); }
.m2-seed-note { margin: 8px 0 0; font-size: 12px; color: var(--muted); }

.m2-sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 135;
  background: rgba(6, 7, 10, 0.72);
  backdrop-filter: blur(8px);
}

.m2-audio-pill {
  min-height: 40px;
  padding: 6px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.m2-audio-pill[aria-pressed="true"] {
  border-color: var(--border-hi);
  color: var(--accent);
  background: rgba(15, 118, 110, 0.18);
}
.m2-audio-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.m2-audio-pill[aria-pressed="true"] .m2-audio-dot { background: var(--accent); }

.m2-dock-submit { display: inline-flex; align-items: center; gap: 10px; min-width: 0; }
.m2-cost-row { display: inline-flex; align-items: center; }
.m2-cost-meta-mob { display: none; }
.m2-cost-tag { font-family: var(--font-mono); font-size: 12px; font-weight: 600; color: var(--amber); white-space: nowrap; flex-shrink: 0; }
.m2-submit {
  min-height: 44px;
  padding: 10px 22px;
  border: 0;
  border-radius: 999px;
  background: var(--fg);
  color: var(--bg);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: opacity 0.15s ease, transform 0.12s ease;
}
.m2-submit:hover:not(:disabled) { opacity: 0.92; transform: translateY(-1px); }
.m2-submit:disabled { opacity: 0.55; cursor: not-allowed; }
.m2-kbd {
  font-family: var(--font-mono);
  font-size: 12px;
  opacity: 0.65;
}

.m2-foot-note { margin: 12px 4px 0; text-align: center; font-size: 13px; color: var(--muted); }
.m2-foot-note a { color: var(--accent); text-decoration: none; font-weight: 500; }
.m2-foot-note a:hover { text-decoration: underline; }
.m2-safety-note { margin: 6px 4px 0; text-align: center; font-size: 12px; color: var(--muted); }
.m2-safety-note a { color: var(--accent); text-decoration: none; }
.m2-safety-note a:hover { text-decoration: underline; }
.m2-foot-linkbtn {
  border: 0;
  background: transparent;
  padding: 0;
  color: var(--accent);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
}
.m2-foot-linkbtn:hover { color: var(--fg); }

.m2-status {
  margin-top: 14px;
  padding: 14px 18px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.5;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--fg);
}
.m2-status--error { border-color: var(--amber); }
.m2-status--info { border-color: var(--border-hi); }
.m2-status--ok { border-color: var(--accent); }
.m2-status-actions { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 8px; }
.m2-inline-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 44px;
  padding: 8px 18px;
  border-radius: 999px;
  border: 0;
  background: var(--primary);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
.m2-inline-btn:hover { background: var(--primary-hover); color: var(--fg); }

.m2-output-drawer {
  margin-top: 16px;
  background: var(--card);
  border: 1px solid var(--border-hi);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--shadow-md);
}
.m2-output-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding: 10px 16px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent);
}
.m2-ai-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--border-hi);
  background: rgba(15, 118, 110, 0.22);
  color: var(--fg);
  font-size: 12px;
  font-weight: 600;
}
.m2-loader { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 38px 16px; text-align: center; }
.m2-wave { display: flex; align-items: center; gap: 6px; height: 36px; }
.m2-wave span { display: block; width: 4px; height: 10px; border-radius: 3px; background: var(--accent); animation: m2-eq 1s ease-in-out infinite; }
.m2-wave span:nth-child(2) { animation-delay: 0.14s; background: var(--amber); }
.m2-wave span:nth-child(3) { animation-delay: 0.28s; }
.m2-wave span:nth-child(4) { animation-delay: 0.42s; background: var(--amber); }
.m2-wave span:nth-child(5) { animation-delay: 0.56s; }
.m2-loader-text { margin: 0; font-size: 15px; font-weight: 600; color: var(--fg); }
.m2-loader-time { margin: 0; font-family: var(--font-mono); font-size: 12px; color: var(--muted); }
.m2-loader-hint { margin: 4px 0 0; max-width: 48ch; font-size: 12px; line-height: 1.5; color: var(--muted); }
.m2-loader-hint a { color: var(--accent); text-decoration: none; font-weight: 500; }
.m2-loader-hint a:hover { text-decoration: underline; }

.m2-result-wrap { padding: 14px; background: var(--bg-deep); }
.m2-result-video { width: 100%; max-height: 440px; border-radius: 10px; background: var(--bg-deep); }
.m2-result-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
}
.m2-res-right { display: flex; flex-wrap: wrap; gap: 8px; }
.m2-dl-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 8px 18px;
  border-radius: 999px;
  background: var(--primary);
  color: var(--fg);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}
.m2-dl-btn:hover { background: var(--primary-hover); color: var(--fg); }
.m2-sec-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card-2);
  color: var(--fg);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

.m2-history {
  margin-top: 14px;
  padding: 14px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(19, 22, 31, 0.82);
}
.m2-history-head { margin: 0 0 10px; font-family: var(--font-mono); font-size: 12px; color: var(--muted); text-transform: uppercase; }
.m2-history-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.m2-history-item { border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: var(--bg-deep); cursor: pointer; padding: 0; }
.m2-history-item video { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }

/* Desktop Floating Studio Bar (Spotlight-style + Footer Avoidance + Minimize) */
.m2-float-dock {
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translate(-50%, 110px);
  opacity: 0;
  pointer-events: none;
  z-index: 45;
  width: min(740px, calc(100% - 32px));
  padding: 7px 8px 7px 10px;
  border-radius: 999px;
  background: rgba(17, 21, 31, 0.94);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(45, 212, 191, 0.34);
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.68), inset 0 1px 0 rgba(255, 255, 255, 0.07);
  display: flex;
  align-items: center;
  gap: 8px;
  transition: transform 0.24s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.22s ease, width 0.22s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}
.m2-float-dock.is-open { transform: translate(-50%, 0); opacity: 1; pointer-events: auto; }
.m2-float-dock:focus-within {
  width: min(820px, calc(100% - 32px));
  border-color: var(--accent);
  box-shadow: 0 22px 56px rgba(0, 0, 0, 0.76), 0 0 0 3px rgba(45, 212, 191, 0.16);
}
.m2-float-dock.is-near-footer,
.m2-float-dock.is-minimized,
body.m2-modal-open .m2-float-dock {
  transform: translate(-50%, 110px) !important;
  opacity: 0 !important;
  pointer-events: none !important;
}
.m2-float-inspire {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  border: 1px solid rgba(45, 212, 191, 0.28);
  background: rgba(15, 118, 110, 0.18);
  color: var(--accent);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.12s ease;
}
.m2-float-inspire:hover {
  background: rgba(15, 118, 110, 0.36);
  border-color: var(--accent);
  transform: scale(1.05);
}
.m2-float-input {
  flex: 1;
  min-width: 0;
  padding: 6px 4px;
  border: 0;
  background: transparent;
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 14px;
}
.m2-float-input::placeholder { color: var(--muted); }
.m2-float-input:focus { outline: none; }
.m2-float-meta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 4px 11px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(10, 11, 14, 0.65);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: border-color 0.15s ease, color 0.15s ease;
}
.m2-float-meta:hover { border-color: var(--border-hi); color: var(--fg); }
.m2-float-dot { opacity: 0.5; }
.m2-float-cost { font-family: var(--font-mono); font-size: 12px; font-weight: 600; color: var(--amber); white-space: nowrap; }
.m2-float-go {
  min-height: 38px;
  padding: 6px 16px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  background: var(--card-2);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.12s ease, color 0.15s ease;
}
.m2-float-go:hover { border-color: var(--border-hi); color: var(--accent); }
.m2-float-go.is-ready {
  border-color: transparent;
  background: linear-gradient(135deg, #2dd4bf 0%, #0d9488 60%, #0f766e 100%);
  color: #041312;
  font-weight: 700;
  box-shadow: 0 6px 18px rgba(45, 212, 191, 0.28);
}
.m2-float-go.is-ready:hover { color: #041312; opacity: 0.94; transform: translateY(-1px); }
.m2-float-go.is-needs-img {
  border-color: rgba(245, 158, 11, 0.55);
  background: rgba(245, 158, 11, 0.18);
  color: var(--amber);
}
.m2-float-min {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background-color 0.14s ease, color 0.14s ease;
}
.m2-float-min:hover { background: rgba(255, 255, 255, 0.08); color: var(--fg); }

.m2-float-pill {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 45;
  min-height: 42px;
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid var(--border-hi);
  background: rgba(17, 21, 31, 0.94);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.6);
  transition: transform 0.2s ease, opacity 0.2s ease, border-color 0.15s ease;
}
.m2-float-pill:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-2px); }
.m2-float-pill__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px rgba(45, 212, 191, 0.75);
}
.m2-float-pill.is-near-footer,
body.m2-modal-open .m2-float-pill {
  opacity: 0 !important;
  pointer-events: none !important;
  transform: translateY(80px);
}

@keyframes m2-eq { 0%, 100% { height: 10px; } 50% { height: 34px; } }
@keyframes m2-sheet-up { from { transform: translateY(24px); opacity: 0.7; } to { transform: translateY(0); opacity: 1; } }

@media (max-width: 780px) {
  .m2-float-dock,
  .m2-float-pill { display: none !important; }
}

@media (max-width: 640px) {
  .m2-composer {
    border-radius: 22px;
    background: linear-gradient(180deg, #141925 0%, #10131c 100%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 18px 46px rgba(0, 0, 0, 0.58), inset 0 1px 0 rgba(255, 255, 255, 0.06);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
  .m2-composer::before,
  .m2-composer::after { display: none; }
  .m2-top-bar {
    padding: 12px 12px 10px;
    gap: 0;
    border-bottom: 0;
    border-radius: 22px 22px 0 0;
    background: transparent;
  }
  .m2-mode-pills {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 100%;
    border-radius: 14px;
    padding: 4px;
    background: #090b10;
    border: 1px solid rgba(255, 255, 255, 0.08);
  }
  .m2-tab {
    min-height: 44px;
    padding: 6px 6px;
    border-radius: 10px;
    font-size: 13px;
    white-space: nowrap;
    gap: 4px;
  }
  .m2-tab[aria-selected="true"] {
    background: linear-gradient(135deg, #0f766e 0%, #0d9488 100%);
    box-shadow: 0 4px 14px rgba(15, 118, 110, 0.42);
  }
  .m2-tab-full { display: none; }
  .m2-tab-short { display: inline; }
  .m2-top-tools { display: none; }

  .m2-body { padding: 2px 12px 12px; }
  .m2-prompt-box {
    background: rgba(7, 9, 13, 0.72);
    border: 1px solid rgba(255, 255, 255, 0.09);
    border-radius: 16px;
    padding: 12px 12px 8px;
  }
  .m2-prompt-box:focus-within {
    border-color: var(--border-hi);
    box-shadow: 0 0 0 3px rgba(45, 212, 191, 0.12);
  }
  .m2-textarea { min-height: 100px; font-size: 16px; padding: 0; resize: none; }
  .m2-textarea.is-expanded { min-height: 210px; }
  .m2-prompt-bar {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.07);
    align-items: center;
    gap: 4px;
  }
  .m2-prompt-tools { gap: 4px; }
  .m2-prompt-right { gap: 4px; }
  .m2-mini-btn {
    min-height: 36px;
    padding: 5px 8px;
    font-size: 12px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.09);
    color: var(--fg);
  }
  .m2-enhance-btn {
    background: rgba(15, 118, 110, 0.28);
    border-color: var(--border-hi);
    color: var(--accent);
  }
  .m2-enhance-tag { display: none; }
  .m2-undo-btn {
    background: rgba(245, 158, 11, 0.14);
    border-color: rgba(245, 158, 11, 0.45);
    color: var(--amber);
  }
  .m2-mini-ghost { display: none; }
  .m2-reset-link {
    min-height: 36px;
    padding: 4px 4px;
    display: inline-flex;
    align-items: center;
    font-size: 12px;
  }
  .m2-char { font-size: 12px; opacity: 0.72; white-space: nowrap; letter-spacing: -0.02em; }

  .m2-prompt-meta { flex-direction: column; align-items: stretch; gap: 0; margin-top: 10px; width: 100%; max-width: 100%; }
  .m2-chips {
    display: flex;
    width: 100%;
    max-width: 100%;
    flex-wrap: wrap;
    overflow: visible;
    gap: 6px;
    padding: 0;
  }
  .m2-chip {
    flex: 0 1 auto;
    min-height: 36px;
    padding: 6px 10px;
    font-size: 12px;
    font-weight: 500;
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
    color: var(--fg);
    display: inline-flex;
    align-items: center;
  }

  .m2-kf-wrap {
    position: relative;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 10px;
    align-items: stretch;
  }
  .m2-kf-wrap > div {
    min-width: 0;
    display: flex;
    flex-direction: column;
  }
  .m2-upload-box {
    flex: 1;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    min-height: 98px;
    padding: 12px 14px;
    gap: 6px;
    border-radius: 14px;
    background: rgba(7, 9, 13, 0.68);
    border: 1.5px dashed rgba(255, 255, 255, 0.16);
  }
  .m2-plus {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    background: rgba(15, 118, 110, 0.16);
    border-color: rgba(45, 212, 191, 0.28);
  }
  .m2-upload-copy { text-align: center; }
  .m2-upload-title {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    line-height: 1.25;
  }
  .m2-upload-badge { margin-left: 0; }
  .m2-upload-sub { display: none; }
  .m2-swap-btn {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: 4;
    min-width: 32px;
    min-height: 32px;
    width: 32px;
    height: 32px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #141925;
    border: 1px solid var(--border-hi);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.65);
  }
  .m2-swap-btn::after {
    content: '';
    position: absolute;
    inset: -6px;
  }
  .m2-preview-row {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    padding: 8px;
    border-radius: 14px;
  }
  .m2-preview-thumb { width: 100%; height: 68px; border-radius: 8px; }
  .m2-preview-meta { text-align: left; }
  .m2-clear-btn { width: 100%; min-height: 36px; padding: 6px 10px; border-radius: 9px; }

  .m2-ref-panel {
    margin-bottom: 10px;
    padding: 11px;
    border-radius: 14px;
    background: rgba(7, 9, 13, 0.68);
  }
  .m2-ref-head { align-items: flex-start; }
  .m2-ref-title { font-size: 12px; line-height: 1.35; }
  .m2-ref-count { white-space: nowrap; flex-shrink: 0; }
  .m2-ref-hint { font-size: 12px; line-height: 1.45; }

  .m2-consent-box {
    margin-bottom: 10px;
    padding: 9px 11px;
    gap: 9px;
    font-size: 12px;
    line-height: 1.45;
  }

  .m2-dock {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    max-width: 100%;
    padding: 10px 12px 14px;
    gap: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 0 0 22px 22px;
    background: rgba(9, 11, 16, 0.55);
  }
  .m2-dock-controls {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    padding: 0;
  }
  .m2-dock-controls:has([data-ratio-wrap][hidden]) {
    grid-template-columns: minmax(0, 0.78fr) minmax(0, 1.14fr) minmax(0, 1.08fr);
  }
  .m2-pop-wrap { position: static; min-width: 0; }
  .m2-pop-btn,
  .m2-audio-pill {
    width: 100%;
    min-width: 0;
    overflow: hidden;
    justify-content: center;
    min-height: 44px;
    padding: 8px 8px;
    font-size: 12px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.11);
    white-space: nowrap;
  }
  .m2-audio-pill[aria-pressed="true"] {
    background: rgba(15, 118, 110, 0.22);
    border-color: var(--border-hi);
  }
  .m2-dock-submit {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    gap: 8px;
  }
  .m2-cost-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2px;
  }
  .m2-cost-meta-mob {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--muted);
  }
  .m2-submit {
    width: 100%;
    min-height: 52px;
    padding: 12px 20px;
    border-radius: 16px;
    background: linear-gradient(135deg, #2dd4bf 0%, #0d9488 55%, #0f766e 100%);
    color: #041312;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: -0.01em;
    box-shadow: 0 10px 28px rgba(45, 212, 191, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.35);
  }
  .m2-kbd { display: none; }
  .m2-history-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .m2-popover {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    top: auto;
    z-index: 150;
    width: 100%;
    min-width: 0;
    max-height: 82dvh;
    overflow-y: auto;
    overscroll-behavior: contain;
    border-radius: 22px 22px 0 0;
    border: 1px solid var(--border-hi);
    border-bottom: 0;
    padding: 10px 16px calc(22px + env(safe-area-inset-bottom, 0px));
    box-shadow: 0 -18px 50px rgba(0, 0, 0, 0.78);
    animation: m2-sheet-up 0.2s cubic-bezier(0.22, 1, 0.36, 1);
  }
  .m2-pop-handle {
    display: block;
    width: 36px;
    height: 4px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.24);
    margin: 0 auto 12px;
  }
  .m2-pop-top { margin-bottom: 12px; }
  .m2-pop-hd { font-size: 13px; color: var(--fg); font-weight: 600; }
  .m2-pop-close { display: inline-flex; }
  .m2-ratio-opt,
  .m2-dur-opt { min-height: 54px; padding: 10px 12px; }
  .m2-ratio-main { font-size: 13px; }
  .m2-ratio-sub { font-size: 12px; }
  .m2-seed-input { font-size: 16px; min-height: 44px; }
  .m2-seed-btn { min-height: 44px; padding: 8px 14px; font-size: 13px; }
  .m2-foot-note { margin-top: 10px; font-size: 12px; line-height: 1.45; }
  .m2-safety-note { margin-top: 4px; font-size: 12px; line-height: 1.45; opacity: 0.78; }
}