.fm-dialog {
  width: min(680px, calc(100% - 32px));
  max-width: none;
  max-height: calc(100dvh - 48px);
  margin: auto;
  padding: 0;
  overflow: hidden;
  border: 1px solid #363638;
  border-radius: 8px;
  background: #141416;
  color: var(--ink);
  box-shadow: 0 24px 80px #0009;
  letter-spacing: 0;
  font-size: 14px;
  line-height: 1.6;
}
.fm-dialog[open] { display: flex; flex-direction: column; }
.fm-dialog::backdrop { background: #000b; backdrop-filter: blur(5px); }
html.has-custom-cursor .fm-dialog,
html.has-custom-cursor .fm-dialog *,
html.has-custom-cursor .fm-dialog::backdrop {
  cursor: var(--cursor-default) !important;
}
html.has-custom-cursor .fm-dialog :is(a, button, [role="button"], label, summary, input[type="checkbox"], input[type="radio"], input[type="file"], input[type="range"], .btn) {
  cursor: var(--cursor-pointer) !important;
}
.fm-dialog-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 24px 28px 20px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.fm-dialog h2 { margin: 0; font: 700 22px/1.35 var(--sans); letter-spacing: 0; overflow-wrap: anywhere; }
.fm-dialog-eyebrow { color: var(--muted); font-size: 12px; margin: 0 0 6px; }
.fm-dialog-close {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--line-2);
  border-radius: 6px;
  flex-shrink: 0;
  color: var(--muted);
}
.fm-dialog-close:hover { background: #ffffff0c; color: var(--ink); }
.fm-dialog-body { overflow-y: auto; overscroll-behavior: contain; min-height: 0; padding: 24px 28px; }
.fm-dialog-footer {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  padding: 16px 28px;
  background: #1b1b1e;
  border-top: 1px solid var(--line-2);
}
.fm-dialog .btn { min-height: 44px; border-radius: 6px; font-size: 14px; white-space: normal; text-align: center; letter-spacing: 0; }
.fm-dialog-footer .btn-primary { min-width: 180px; }
.fm-dialog-hint { color: var(--muted); font-size: 12px; margin-right: auto; max-width: 24ch; }
.checkout-consent-dialog { width: min(900px, calc(100% - 32px)); }
.checkout-consent-dialog .fm-dialog-body { display: grid; grid-template-columns: minmax(220px, 0.75fr) minmax(0, 1.7fr); gap: 28px; padding-block: 20px; }
.checkout-order { padding-right: 28px; border-right: 1px solid var(--line); }
.checkout-order-top { display: flex; justify-content: space-between; gap: 20px; align-items: baseline; }
.checkout-order h3 { font: 700 20px/1.4 var(--sans); letter-spacing: 0; }
.checkout-price { text-align: right; }
.checkout-price strong { display: block; font-size: 20px; line-height: 1.4; font-variant-numeric: tabular-nums; }
.checkout-price span { display: block; color: var(--muted); font-size: 12px; }
.checkout-order-quota { display: flex; align-items: center; gap: 8px; margin: 12px 0; color: var(--ink-2); }
.checkout-order-quota .ico { color: var(--blue-3); }
.checkout-renewal { margin: 2px 0 0; color: var(--ink-2); font-size: 14px; line-height: 1.55; }
.checkout-breakdown { display: grid; gap: 8px; margin: 16px 0 0; padding: 14px 16px; border: 1px solid var(--line); border-radius: 10px; background: #ffffff06; font-size: 13px; }
.checkout-breakdown[hidden], .checkout-consents[hidden] { display: none; }
.checkout-breakdown > div { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; }
.checkout-breakdown dt { color: var(--muted); }
.checkout-breakdown dd { margin: 0; color: var(--ink-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.checkout-breakdown .is-credit dd { color: #7fd6a4; }
.checkout-breakdown .is-total { margin-top: 2px; padding-top: 10px; border-top: 1px solid var(--line); }
.checkout-breakdown .is-total dt, .checkout-breakdown .is-total dd { color: var(--ink); font-weight: 700; font-size: 14px; }
.checkout-consent-dialog.is-schedule { width: min(560px, calc(100% - 32px)); }
.checkout-consent-dialog.is-schedule .fm-dialog-body { display: block; }
.checkout-consent-dialog.is-schedule .checkout-order { padding-right: 0; border-right: 0; }
.checkout-footer { align-items: center; }
.checkout-footer-row { display: flex; width: 100%; align-items: center; justify-content: flex-end; gap: 12px; }
.checkout-spinner { width: 16px; height: 16px; flex: 0 0 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: checkout-spin .7s linear infinite; }
.checkout-consent-dialog[aria-busy="true"] .fm-dialog-body { opacity: .72; pointer-events: none; }
.checkout-consent-dialog[aria-busy="true"] .fm-dialog-close { opacity: .45; }
@keyframes checkout-spin { to { transform: rotate(360deg); } }
.checkout-details { margin-top: 12px; font-size: 13px; color: var(--muted); }
.checkout-details summary { color: var(--ink-2); cursor: pointer; width: fit-content; padding: 4px 0; }
.checkout-details ul { padding-left: 18px; margin-top: 8px; display: grid; gap: 6px; }
.checkout-consent-heading { margin: 0 0 2px; font: 650 15px/1.5 var(--sans); letter-spacing: 0; }
.fm-dialog .checkout-check {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  gap: 12px;
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  font-size: 14px;
  line-height: 1.65;
  color: var(--ink-2);
}
.fm-dialog .checkout-check:last-child { border-bottom: 0; padding-bottom: 0; }
.fm-dialog .checkout-check input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--blue); cursor: pointer; }
.checkout-check-title { display: flex; align-items: baseline; flex-wrap: wrap; gap: 5px 12px; margin-bottom: 5px; }
.checkout-check-title strong { font-weight: 650; color: var(--ink); }
.checkout-check-title small { font-size: 11px; color: var(--muted); }
.fm-dialog .checkout-check a { color: #94b0ff; text-decoration: underline; text-underline-offset: 3px; }
.fm-dialog .checkout-check.is-optional { font-size: 13px; color: var(--muted); }
.fm-dialog .checkout-consent-hint { margin: 18px 0 0; padding-left: 12px; border-left: 2px solid var(--amber); color: #e8bf79; font-size: 13px; line-height: 1.65; }
.account-confirm-dialog { width: min(480px, calc(100% - 32px)); }
.account-confirm-dialog .fm-dialog-body { color: var(--ink-2); font-size: 14px; }
@media (max-width: 560px) {
  .fm-dialog { width: calc(100% - 20px); max-height: calc(100dvh - 20px); }
  .fm-dialog-head { padding: 18px; gap: 12px; }
  .fm-dialog h2 { font-size: 20px; }
  .fm-dialog-body { padding: 18px; }
  .fm-dialog-footer { padding: 14px 18px; gap: 10px; flex-wrap: wrap; }
  .checkout-footer-row { flex-wrap: wrap; }
  .fm-dialog-footer .btn { flex: 1; min-width: 0; padding: 10px 12px; }
  .fm-dialog-hint { flex-basis: 100%; max-width: none; }
  .checkout-order-top { gap: 12px; }
  .checkout-price { max-width: 55%; }
  .checkout-price strong { font-size: 18px; }
}
@media (max-width: 760px) {
  .checkout-consent-dialog .fm-dialog-body { display: block; }
  .checkout-order { padding: 0 0 18px; border-right: 0; border-bottom: 1px solid var(--line); }
  .checkout-consent-heading { margin-top: 18px; }
}

/* ── Format picker (16:9 / 9:16) ── */
.fmt-dialog { width: min(720px, calc(100% - 32px)); }
.fmt-lead { margin: 0 0 20px; color: var(--muted); }
.fmt-options { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.fmt-option {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  padding: 0;
  border: 1px solid var(--line-2);
  border-radius: 10px;
  background: #1a1a1d;
  color: var(--ink);
  text-align: left;
  overflow: hidden;
  transition: border-color .18s ease, transform .18s ease, background .18s ease;
}
.fmt-option:hover { border-color: #ffffff40; background: #1f1f23; transform: translateY(-2px); }
.fmt-option:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.fmt-option.is-current { border-color: #ffffffa0; }
.fmt-stage {
  display: grid;
  place-items: center;
  height: 230px;
  background:
    radial-gradient(circle at 50% 60%, #ffffff10, transparent 65%),
    #111113;
  border-bottom: 1px solid var(--line);
}
.fmt-copy { display: flex; flex-direction: column; gap: 2px; padding: 14px 16px 16px; }
.fmt-copy strong { font: 700 16px/1.3 var(--sans); }
.fmt-ratio {
  align-self: flex-start;
  margin-bottom: 6px;
  padding: 2px 8px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  color: var(--muted);
  font: 600 12px/1.5 var(--sans);
}
.fmt-hint { color: var(--muted); font-size: 13px; }

/* Phone illustration: the body is the same, it just turns 90°. */
.fmt-phone {
  position: relative;
  padding: 7px;
  border-radius: 18px;
  background: linear-gradient(145deg, #3a3a3f, #1c1c20);
  box-shadow: 0 0 0 1px #ffffff1f, 0 18px 40px #000a;
  transition: transform .35s cubic-bezier(.2,.8,.2,1);
}
.fmt-phone.is-portrait { width: 104px; height: 196px; }
.fmt-phone.is-landscape { width: 196px; height: 104px; }
.fmt-option:hover .fmt-phone.is-portrait { transform: rotate(-4deg) scale(1.04); }
.fmt-option:hover .fmt-phone.is-landscape { transform: rotate(3deg) scale(1.04); }
.fmt-phone-notch {
  position: absolute;
  z-index: 2;
  border-radius: 99px;
  background: #0b0b0d;
}
.fmt-phone.is-portrait .fmt-phone-notch { top: 11px; left: 50%; width: 26px; height: 6px; transform: translateX(-50%); }
.fmt-phone.is-landscape .fmt-phone-notch { left: 11px; top: 50%; width: 6px; height: 26px; transform: translateY(-50%); }
.fmt-screen {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  border-radius: 12px;
  background: #050506;
}
.fmt-screen-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.fmt-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  padding: 12px;
}
.fmt-phone.is-landscape .fmt-placeholder { padding: 10px 14px 10px 24px; }
.fmt-ph { display: block; border-radius: 4px; background: linear-gradient(90deg, #ffffff14, #ffffff2a, #ffffff14); background-size: 200% 100%; animation: fmt-shimmer 2.4s linear infinite; }
.fmt-ph-tall { flex: 1; max-height: 70%; }
.fmt-ph-wide { flex: 1; }
.fmt-ph-line { height: 6px; width: 80%; }
.fmt-ph-line.short { width: 50%; }
@keyframes fmt-shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) {
  .fmt-ph { animation: none; }
  .fmt-phone, .fmt-option { transition: none; }
}
@media (max-width: 560px) {
  .fmt-options { gap: 10px; }
  .fmt-stage { height: 170px; }
  .fmt-phone.is-portrait { width: 78px; height: 148px; }
  .fmt-phone.is-landscape { width: 132px; height: 72px; }
  .fmt-copy { padding: 12px; }
  .fmt-hint { font-size: 12px; }
}

/* ── Style variant picker ── */
.var-dialog { width: min(1080px, calc(100% - 32px)); }
.var-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.var-option {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0;
  border: 1px solid var(--line-2);
  border-radius: 10px;
  background: #1a1a1d;
  color: var(--ink);
  text-align: left;
  overflow: hidden;
  transition: border-color .18s ease, transform .18s ease, background .18s ease;
}
.var-option:hover { border-color: #ffffff40; background: #1f1f23; transform: translateY(-2px); }
.var-option:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.var-option.is-current { border-color: #ffffffa0; }
.var-thumb { position: relative; display: block; aspect-ratio: 16 / 9; background: #0b0b0d; }
.var-thumb video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.var-num {
  position: absolute;
  left: 6px;
  top: 6px;
  padding: 1px 6px;
  border-radius: 5px;
  background: #000a;
  color: #fff;
  font: 600 11px/1.5 var(--sans);
}
.var-label { padding: 8px 10px 10px; font: 600 13px/1.3 var(--sans); }
@media (max-width: 900px) { .var-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 560px) { .var-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; } }
@media (prefers-reduced-motion: reduce) { .var-option { transition: none; } }
