/* ==========================================================================
   /swap — обмін чужого QR-коду на свій.

   Власний візуальний стиль, свідомо НЕ схожий на /scanner:
     · м'які круглі картки (radius 16–22px) замість брутальних зрізаних кутів;
     · «рейка» кроків із круглими номерами й пунктирними з'єднувачами;
     · кнопки-пігулки замість прямокутних чипів;
     · прев'ю — рівна картка без подвійної білої рамки .qr-halo.
   Файл окремий, щоб не чіпати styles.css (18k рядків і багато залежних).
   ========================================================================== */

.ex-main {
  max-width: 1040px;
  margin: 0 auto;
  padding: 18px 14px 46px;
}

.ex-shell {
  display: grid;
  gap: 18px;
  padding: 24px 22px 22px;
  border: 1px solid #1f1f28;
  border-radius: 22px;
  background:
    radial-gradient(120% 90% at 50% -30%, rgba(109, 112, 224, 0.16) 0%, transparent 62%),
    #0b0b10;
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.45);
}

@media (max-width: 680px) {
  .ex-shell {
    padding: 15px 12px 16px;
    border-radius: 16px;
    gap: 13px;
  }
}

/* ── шапка ───────────────────────────────────────────────────────────── */
.ex-head {
  display: grid;
  gap: 10px;
  justify-items: center;
  text-align: center;
}

.ex-viz {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
}

.ex-viz-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.ex-viz-card {
  position: relative;
  width: 74px;
  height: 74px;
}

.ex-viz-paper {
  position: absolute;
  inset: 0;
  border-radius: 16px;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.ex-viz-qr {
  display: block;
  width: 50px;
  height: 50px;
}

/* старий код: світліший, обірваний і погризений по краях */
.ex-viz-card.is-old .ex-viz-paper {
  color: #d5d5e0;
  background: #111117;
  border: 1px solid #26263a;
  clip-path: polygon(
    0% 13%, 5% 13%, 5% 6%, 13% 6%, 13% 0%,
    34% 0%, 34% 5%, 52% 5%, 52% 0%,
    78% 0%, 78% 8%, 88% 8%, 88% 0%,
    100% 0%, 96% 13%, 100% 19%,
    100% 33%, 93% 37%, 93% 47%, 100% 52%,
    100% 67%, 91% 72%, 91% 84%, 98% 91%,
    89% 100%, 70% 100%, 70% 93%, 58% 93%, 58% 100%,
    34% 100%, 34% 92%, 22% 92%, 22% 100%,
    6% 100%, 6% 91%, 0% 87%, 0% 69%,
    6% 63%, 6% 53%, 0% 49%, 0% 33%, 7% 29%, 7% 19%, 0% 17%
  );
  animation: ex-viz-old 5.2s ease-in-out infinite;
}

.ex-viz-tear {
  position: absolute;
  left: -10%;
  right: -10%;
  top: 56%;
  height: 2px;
  background: linear-gradient(90deg, transparent, #08080c 12%, #08080c 64%, transparent 88%);
  transform: rotate(-12deg);
  transform-origin: left center;
}

.ex-viz-card.is-old .ex-viz-paper::after {
  content: none;
}

/* позначки: червоний хрестик на старому, зелена галочка на новому */
.ex-viz-flag {
  position: absolute;
  top: -7px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: grid;
  place-items: center;
}

.ex-viz-flag svg {
  display: block;
  width: 13px;
  height: 13px;
}

.ex-viz-flag.is-bad {
  inset-inline-start: -7px;
  color: #ff5b5b;
  background: #1d0b0d;
  border: 1px solid rgba(255, 91, 91, 0.45);
  box-shadow: 0 0 0 3px rgba(255, 91, 91, 0.08);
  animation: ex-viz-bad 5.2s ease-in-out infinite;
}

.ex-viz-flag.is-ok {
  inset-inline-end: -7px;
  color: #3ee08a;
  background: #0a1a12;
  border: 1px solid rgba(62, 224, 138, 0.45);
  box-shadow: 0 0 0 3px rgba(62, 224, 138, 0.08);
  animation: ex-viz-ok 5.2s ease-in-out infinite;
}

/* анімована стрілка */
.ex-viz-link {
  position: relative;
  display: flex;
  align-items: center;
  color: var(--yellow);
}

.ex-viz-link svg {
  display: block;
  width: 58px;
  height: 15px;
  overflow: visible;
}

.ex-viz-line {
  animation: ex-viz-flow 0.85s linear infinite;
}

.ex-viz-spark {
  position: absolute;
  top: 50%;
  left: 2px;
  width: 7px;
  height: 7px;
  margin-top: -3.5px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 0 12px 3px rgba(255, 242, 0, 0.7);
  animation: ex-viz-spark 2.4s cubic-bezier(0.45, 0, 0.55, 1) infinite;
}

/* новий код: блискучий, з підсвіткою */
.ex-viz-card.is-new .ex-viz-paper {
  color: var(--yellow);
  background:
    radial-gradient(120% 120% at 30% 20%, rgba(255, 242, 0, 0.16), transparent 60%),
    radial-gradient(110% 110% at 80% 92%, rgba(46, 49, 146, 0.55), transparent 70%),
    #101109;
  border: 1px solid rgba(255, 242, 0, 0.45);
  box-shadow:
    0 0 0 3px rgba(255, 242, 0, 0.06),
    0 0 20px rgba(255, 242, 0, 0.18),
    0 10px 24px rgba(0, 0, 0, 0.55);
  animation: ex-viz-new 5.2s ease-in-out infinite;
}

/* тонка внутрішня рамка — додає «дорогого» вигляду */
.ex-viz-card.is-new .ex-viz-paper::before {
  content: "";
  position: absolute;
  inset: 4px;
  border-radius: 12px;
  border: 1px solid rgba(255, 242, 0, 0.16);
  pointer-events: none;
}

.ex-viz-card.is-new .ex-viz-qr {
  filter: drop-shadow(0 0 7px rgba(255, 242, 0, 0.4));
}

.ex-viz-shine {
  position: absolute;
  top: -40%;
  bottom: -40%;
  left: -34px;
  width: 26px;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.7), transparent);
  transform: skewX(-18deg);
  animation: ex-viz-shine 5.2s ease-in-out infinite;
}

@keyframes ex-viz-flow {
  to { stroke-dashoffset: -14; }
}

@keyframes ex-viz-spark {
  0% { left: 2px; opacity: 0; }
  12% { opacity: 1; }
  88% { opacity: 1; }
  100% { left: 44px; opacity: 0; }
}

@keyframes ex-viz-shine {
  0%, 42% { left: -34px; }
  76%, 100% { left: 96px; }
}

@keyframes ex-viz-new {
  0%, 52%, 100% { transform: none; }
  66% { transform: translateY(-2px) scale(1.05); }
}

@keyframes ex-viz-old {
  0%, 100% { opacity: 0.95; transform: rotate(-4deg); }
  52% { opacity: 0.72; transform: rotate(-5.5deg) translateX(-1px); }
}

@keyframes ex-viz-bad {
  0%, 44%, 100% { transform: none; opacity: 0.8; }
  22% { transform: scale(1.08); opacity: 1; }
}

@keyframes ex-viz-ok {
  0%, 52%, 100% { transform: none; opacity: 0.55; }
  66% { transform: scale(1.14); opacity: 1; }
  80% { opacity: 1; }
}

[dir="rtl"] .ex-viz-link {
  transform: scaleX(-1);
}

@media (max-width: 480px) {
  .ex-viz {
    gap: 10px;
  }
  .ex-viz-card {
    width: 58px;
    height: 58px;
  }
  .ex-viz-paper {
    border-radius: 13px;
  }
  .ex-viz-qr {
    width: 38px;
    height: 38px;
  }
  .ex-viz-flag {
    top: -6px;
    width: 20px;
    height: 20px;
  }
  .ex-viz-flag svg {
    width: 11px;
    height: 11px;
  }
  .ex-viz-flag.is-bad {
    inset-inline-start: -6px;
  }
  .ex-viz-flag.is-ok {
    inset-inline-end: -6px;
  }
  .ex-viz-link svg {
    width: 40px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ex-viz-paper,
  .ex-viz-line,
  .ex-viz-spark,
  .ex-viz-shine,
  .ex-viz-flag {
    animation: none !important;
  }
  .ex-viz-spark {
    left: 50%;
  }
  .ex-viz-flag.is-ok {
    opacity: 1;
  }
  .ex-viz-flag.is-bad {
    opacity: 1;
  }
}

.ex-head h1 {
  margin: 0;
  font-size: clamp(20px, 4.4vw, 28px);
  line-height: 1.15;
  letter-spacing: -0.01em;
}

.ex-lead {
  margin: 0 auto;
  /* 184 символи українського ліда / 3 рядки — тому 66ch. Шрифт моноширинний,
     тож «ch» тут точний: 66 знаків ≈ 535px. */
  max-width: 66ch;
  font-size: 13.5px;
  line-height: 1.62;
  color: #b9b9c4;
  font-weight: 500;
  text-align: justify;
  text-wrap: balance;
  hyphens: auto;
}

/* лід у шапці — рівний прямокутник: обидва краї збігаються на будь-якій ширині */
.ex-head .ex-lead {
  text-align-last: justify;
}

/* планшет: ширина картки, рядків стає більше, але краї рівні */
@media (max-width: 860px) {
  .ex-lead {
    max-width: 100%;
    font-size: 13px;
    line-height: 1.6;
  }
}

/* телефон: дрібніше, щоб не рвати слова */
@media (max-width: 480px) {
  .ex-lead {
    font-size: 12.5px;
    line-height: 1.58;
  }
}

/* ── рейка кроків ────────────────────────────────────────────────────── */
.ex-steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
}

.ex-step-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0;
  border: 0;
  background: none;
  color: #6e6e7b;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  transition: color 0.18s ease;
}

.ex-step-chip i {
  font-style: normal;
  display: grid;
  place-items: center;
  width: 27px;
  height: 27px;
  border-radius: 50%;
  border: 1px solid #2a2a34;
  background: #0d0d13;
  color: #86868f;
  font-size: 11px;
  font-weight: 800;
  flex: none;
  transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.ex-step-chip:not(:last-child)::after {
  content: "";
  width: clamp(12px, 5vw, 38px);
  height: 1px;
  margin: 0 10px;
  background: repeating-linear-gradient(90deg, #30303b 0 3px, transparent 3px 7px);
}

.ex-step-chip.is-on {
  color: var(--yellow);
}

.ex-step-chip.is-on i {
  background: var(--yellow);
  border-color: var(--yellow);
  color: #0a0a0d;
  box-shadow: 0 0 0 5px rgba(255, 242, 0, 0.1);
}

.ex-step-chip.is-done {
  color: #c9c9d4;
}

.ex-step-chip.is-done i {
  border-color: rgba(255, 242, 0, 0.45);
  color: var(--yellow);
}

@media (max-width: 620px) {
  .ex-step-chip span {
    display: none;
  }
  .ex-step-chip.is-on span {
    display: inline;
  }
  .ex-step-chip:not(:last-child)::after {
    margin: 0 7px;
  }
}

/* ── кроки ───────────────────────────────────────────────────────────── */
.ex-step {
  display: grid;
  gap: 12px;
  animation: ex-step-in 0.26s ease;
}

.ex-step[hidden] {
  display: none !important;
}

@keyframes ex-step-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .ex-step {
    animation: none;
  }
}

.ex-hint {
  margin: 0;
  font-size: 12px;
  line-height: 1.5;
  color: #adadb9;
  font-weight: 600;
}

.ex-hint-error {
  color: #ff9a9a;
}

/* ── кнопки-пігулки ──────────────────────────────────────────────────── */
.ex-btn {
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: 999px;
  border: 1px solid #2b2b36;
  background: #14141b;
  color: #eaeaf1;
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration: none;
  text-align: center;
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease, color 0.16s ease;
}

.ex-btn:hover {
  border-color: #3b3b4a;
  transform: translateY(-1px);
}

.ex-btn:focus-visible {
  outline: 2px solid rgba(255, 242, 0, 0.55);
  outline-offset: 2px;
}

.ex-btn:disabled {
  opacity: 0.55;
  cursor: default;
  transform: none;
}

.ex-btn.is-primary {
  background: var(--yellow);
  border-color: var(--yellow);
  color: #0a0a0d;
}

.ex-btn.is-primary:hover {
  background: #fff95c;
}

.ex-btn.is-ghost {
  background: transparent;
  color: #a3a3b2;
}

.ex-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: stretch;
}

.ex-actions[hidden] {
  display: none !important;
}

.ex-actions .ex-btn.is-primary {
  flex: 1 1 220px;
}

@media (max-width: 540px) {
  .ex-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
  .ex-actions .ex-btn {
    padding: 12px 10px;
    font-size: 11px;
    letter-spacing: 0.03em;
  }
  .ex-actions .ex-btn.is-primary {
    grid-column: 1 / -1;
    order: -1;
  }
  .ex-actions .ex-btn.is-ghost {
    grid-column: 1 / -1;
  }
}

/* ── картки ──────────────────────────────────────────────────────────── */
.ex-card {
  display: grid;
  gap: 12px;
  padding: 16px 18px;
  border-radius: 16px;
  border: 1px solid #22222b;
  background: #0e0e14;
}

.ex-card[hidden] {
  display: none !important;
}

.ex-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.ex-kicker {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #8a8a97;
}

.ex-tag {
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 4px 11px;
  border-radius: 999px;
  background: rgba(109, 112, 224, 0.18);
  color: #b9baff;
  white-space: nowrap;
}

/* ── крок 1: вбудований сканер ───────────────────────────────────────── */
.ex-scan-card {
  border-radius: 16px;
  overflow: hidden;
  background: transparent;
  min-height: 300px;
  contain: paint;
}

/* fx273: фрейм показуємо лише після того, як сканер усередині вже обрізаний і
   виміряний (swap.js додає .is-ready). Інакше на долі секунди було видно чужий
   hero + SEO-статтю, а потім блок різко осідав до 590 px. */
.ex-scan-card iframe {
  display: block;
  width: 100%;
  height: 590px;
  border: 0;
  background: transparent;
  opacity: 0;
  animation: ex-frame-fallback 0.01s 3s forwards;
}

.ex-scan-card.is-ready iframe {
  opacity: 1;
  transition: opacity 0.18s ease;
}

@keyframes ex-frame-fallback {
  to { opacity: 1; }
}

/* ── крок 2: вміст коду ──────────────────────────────────────────────── */
.ex-fields {
  display: grid;
  gap: 9px;
}

.ex-content .scan-field {
  display: grid;
  gap: 4px;
  padding: 10px 13px;
  border-radius: 12px;
  border: 1px solid #1d1d26;
  background: #0a0a10;
}

.ex-content .scan-field > span {
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #797986;
}

.ex-content .scan-field strong {
  font-size: 13.5px;
  line-height: 1.45;
  color: #f2f2f6;
  overflow-wrap: anywhere;
}

.ex-content .scan-field strong.is-mono {
  font-family: var(--font);
  font-size: 12px;
  line-height: 1.5;
  color: #e6e6ee;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-height: 9em;
  overflow: auto;
}

/* мертве кінцеве посилання */
.ex-dead {
  display: grid;
  gap: 10px;
  justify-items: start;
  padding: 16px 18px;
  border-radius: 16px;
  border: 1px solid rgba(255, 120, 120, 0.34);
  background:
    linear-gradient(180deg, rgba(122, 20, 26, 0.28) 0%, transparent 70%),
    #120a0c;
}

.ex-dead[hidden] {
  display: none !important;
}

.ex-dead strong {
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #ffb3b3;
}

.ex-dead p {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.6;
  color: #f0dcdc;
}

.ex-dead .ex-btn.is-primary {
  margin-top: 2px;
}

/* файл у коді */
.ex-file {
  border-color: rgba(255, 200, 80, 0.45);
  background:
    linear-gradient(180deg, rgba(120, 82, 6, 0.26) 0%, transparent 60%),
    #12100a;
}

.ex-file strong {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #ffd98a;
}

.ex-file p {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.55;
  color: #f0e6d2;
}

/* редагування вмісту */
.ex-edit {
  border-color: rgba(255, 242, 0, 0.32);
}

.ex-field {
  display: grid;
  gap: 6px;
}

.ex-field > span {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #9a9aa7;
}

.ex-field input,
.ex-field textarea,
#ex-file-link,
#ex-raw {
  width: 100%;
  font: inherit;
  font-family: var(--font);
  font-size: 13px;
  color: #fff;
  background: #08080b;
  border: 1px solid #2a2a34;
  border-radius: 10px;
  padding: 10px 12px;
  outline: none;
}

#ex-raw {
  resize: vertical;
  min-height: 96px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.ex-field input:focus,
.ex-field textarea:focus,
#ex-file-link:focus,
#ex-raw:focus {
  border-color: rgba(255, 242, 0, 0.6);
}

/* ── крок 3: стиль ───────────────────────────────────────────────────── */
.ex-style-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 296px);
  gap: 14px;
  align-items: start;
}

.ex-style-wrap > .style-studio {
  padding: 16px;
  border-radius: 16px;
  border: 1px solid #22222b;
  background: #0e0e14;
}

.ex-preview {
  display: grid;
  gap: 10px;
  align-content: start;
  position: sticky;
  top: 14px;
}

.ex-preview-card {
  padding: 12px;
  border-radius: 18px;
  border: 1px solid #23232d;
  background: #0d0d13;
}

/* Прев'ю не «пливе»: рендер ставить інлайн-розміри в px, тому і ширину,
   і висоту тримаємо з !important — канвас масштабується рівномірно
   за власним співвідношенням сторін. */
.ex-preview-card canvas {
  display: block;
  width: 100% !important;
  height: auto !important;
  max-width: 100%;
}

.ex-random {
  width: 100%;
  justify-content: center;
}

@media (max-width: 820px) {
  .ex-style-wrap {
    grid-template-columns: 1fr;
  }
  .ex-preview {
    order: -1;
    position: static;
    max-width: 320px;
    margin-inline: auto;
    width: 100%;
  }
}

/* ── антибот + статус ────────────────────────────────────────────────── */
.ex-gate {
  display: flex;
  justify-content: center;
  padding: 2px 0;
}

.ex-gate[hidden] {
  display: none !important;
}

.ex-status {
  margin: 0;
  font-size: 12px;
  line-height: 1.45;
  color: #bdbdbd;
  text-align: center;
  font-weight: 600;
}

.ex-status[hidden] {
  display: none !important;
}

.ex-status.is-error {
  color: #ff9a9a;
}

.ex-status.is-warn {
  color: #ffd98a;
}

#ex-limit-cta {
  display: flex;
  justify-content: center;
}

#ex-limit-cta.hidden {
  display: none !important;
}

/* ── крок 4: готово ──────────────────────────────────────────────────── */
.ex-done {
  display: grid;
  gap: 12px;
  justify-items: center;
  text-align: center;
  padding: 22px 18px;
  border-radius: 16px;
  border: 1px solid #22222b;
  background:
    radial-gradient(110% 80% at 50% 0%, rgba(255, 242, 0, 0.08) 0%, transparent 60%),
    #0e0e14;
}

.ex-done-title {
  margin: 0;
  font-size: clamp(18px, 3.6vw, 23px);
  line-height: 1.2;
}

.ex-done-card {
  width: 100%;
  max-width: 320px;
  margin-inline: auto;
}

.ex-done .ex-actions {
  width: 100%;
  justify-content: center;
}

.ex-dest {
  margin: 0;
  font-family: var(--font);
  font-size: 11.5px;
  line-height: 1.5;
  color: #8f8f9d;
  overflow-wrap: anywhere;
  max-width: 46ch;
}

.ex-account-note {
  color: #a8a8b5;
}
