:root {
  --bg: #eef8f1;
  --text: #0b2416;
  --muted: #5f7668;
  --line: #d5e8db;
  --green: #16a34a;
  --green-d: #0f7a37;
  --green-l: #d7f5e1;
  --green-xl: #f0fbf4;
  --mint: #34d399;
  --red: #dc2626;
  --red-l: #fdecec;
  --amber: #d97706;
  --amber-l: #fff4de;
  --glass: rgba(255, 255, 255, .8);
  --shadow: 0 30px 70px -30px rgba(11, 92, 42, .35), 0 2px 8px rgba(11, 36, 22, .05);

  /* Плавные кривые: выход без рывка и мягкое «пружинящее» появление */
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --ease-io: cubic-bezier(.65, 0, .35, 1);
  --ease-spring: cubic-bezier(.34, 1.4, .64, 1);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  font-family: Manrope, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ---------- фон ---------- */
.bg { position: fixed; inset: 0; z-index: -1; overflow: hidden; }
.blob { position: absolute; border-radius: 50%; filter: blur(70px); opacity: .5; animation: float 26s ease-in-out infinite; will-change: transform; }
.b1 { width: 520px; height: 520px; background: #a7f3c4; top: -160px; left: -120px; }
.b2 { width: 460px; height: 460px; background: #6ee7b7; bottom: -180px; right: -120px; animation-delay: -9s; }
.b3 { width: 300px; height: 300px; background: #bbf7d0; top: 40%; left: 60%; animation-delay: -17s; opacity: .4; }
.grid {
  position: absolute; inset: 0;
  background-image: linear-gradient(rgba(15, 122, 55, .05) 1px, transparent 1px), linear-gradient(90deg, rgba(15, 122, 55, .05) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(ellipse at 50% 30%, #000 20%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse at 50% 30%, #000 20%, transparent 75%);
}
@keyframes float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(36px, 28px) scale(1.06); }
}

.wrap {
  max-width: 560px; margin: 0 auto;
  padding: 56px max(16px, env(safe-area-inset-right)) max(40px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
}

/* ---------- язык ---------- */
.wrap { position: relative; }
.lang {
  position: absolute; top: 18px; right: max(16px, env(safe-area-inset-right)); z-index: 5;
  display: grid; grid-template-columns: 1fr 1fr; padding: 3px; border-radius: 999px;
  background: rgba(255, 255, 255, .75); border: 1px solid rgba(15, 122, 55, .12);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 6px 18px -10px rgba(11, 92, 42, .35);
  animation: fadeIn .8s .3s ease both;
}
.lang-pill {
  position: absolute; top: 3px; bottom: 3px; left: 3px; width: calc(50% - 3px); border-radius: 999px;
  background: var(--green-d); transition: transform .5s var(--ease-out);
}
.lang[data-active="en"] .lang-pill { transform: translateX(100%); }
.lang button {
  position: relative; z-index: 1; border: 0; background: transparent; cursor: pointer;
  min-width: 40px; padding: 6px 10px; font: inherit; font-size: 12px; font-weight: 800; letter-spacing: .04em;
  color: var(--muted); transition: color .35s ease;
}
.lang button.active { color: #fff; }

/* ---------- шапка ---------- */
.hero { text-align: center; margin-bottom: 26px; animation: rise .9s var(--ease-out) both; }
.logo {
  width: 56px; height: 56px; margin: 0 auto 16px; border-radius: 16px;
  background: linear-gradient(135deg, var(--mint), var(--green-d));
  display: grid; place-items: center;
  box-shadow: 0 12px 30px -10px rgba(15, 122, 55, .6), inset 0 1px 0 rgba(255,255,255,.35);
  animation: bob 6s ease-in-out infinite;
}
.logo svg { width: 28px; height: 28px; fill: none; stroke: #fff; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.hero h1 { font-size: 34px; font-weight: 800; letter-spacing: -.03em; margin: 0 0 8px; }
.hero h1 span {
  background: linear-gradient(90deg, var(--green-d), var(--mint), var(--green-d));
  background-size: 200% auto;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: shine 8s linear infinite;
}
.sub { color: var(--muted); font-size: 15px; margin: 0; }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
@keyframes shine { to { background-position: 200% center; } }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ---------- панель ---------- */
.panel {
  background: var(--glass);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  border: 1px solid rgba(255, 255, 255, .9);
  border-radius: 24px;
  padding: 8px 8px 28px;
  box-shadow: var(--shadow);
  animation: rise .9s .1s var(--ease-out) both;
}
.pane { padding: 0 24px; }

.tabs {
  position: relative; display: grid; grid-template-columns: 1fr 1fr;
  padding: 5px; margin-bottom: 26px; border-radius: 16px; background: rgba(15, 122, 55, .07);
}
.tab-pill {
  position: absolute; top: 5px; bottom: 5px; left: 5px; width: calc(50% - 5px);
  border-radius: 12px; background: #fff; box-shadow: 0 4px 14px -4px rgba(11, 92, 42, .3);
  transition: transform .55s var(--ease-out);
}
.tabs[data-active="check"] .tab-pill { transform: translateX(100%); }
.tab {
  position: relative; z-index: 1; border: 0; background: transparent; padding: 12px 10px; min-height: 44px;
  font: inherit; font-size: 14px; font-weight: 700; color: var(--muted); cursor: pointer; transition: color .4s ease;
}
.tab.active { color: var(--green-d); }

/* ---------- степпер ---------- */
.stepper { list-style: none; display: flex; align-items: center; padding: 0; margin: 0 0 26px; }
.stepper li[data-step] { display: flex; align-items: center; gap: 8px; flex: none; }
.stepper .dot {
  width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  font-size: 12px; font-weight: 800; color: var(--muted); background: #fff; border: 2px solid var(--line);
  transition: background-color .5s ease, border-color .5s ease, color .5s ease, box-shadow .5s ease, transform .5s var(--ease-spring);
}
.stepper .lbl { font-size: 13px; font-weight: 600; color: var(--muted); transition: color .5s ease; white-space: nowrap; }
.stepper .bar { flex: 1; height: 2px; margin: 0 10px; background: var(--line); border-radius: 2px; position: relative; overflow: hidden; }
.stepper .bar::after {
  content: ""; position: absolute; inset: 0; background: var(--green);
  transform: scaleX(0); transform-origin: left; transition: transform .8s var(--ease-io);
}
.stepper .bar.done::after { transform: scaleX(1); }
.stepper li.active .dot { border-color: var(--green); color: var(--green-d); box-shadow: 0 0 0 5px var(--green-l); transform: scale(1.06); }
.stepper li.active .lbl { color: var(--text); }
.stepper li.done .dot { background: var(--green); border-color: var(--green); color: #fff; }
.stepper li.done .lbl { color: var(--green-d); }

/* ---------- шаги ---------- */
.step { animation: stepIn .6s var(--ease-out) both; }
@keyframes stepIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.step h2 { font-size: 22px; font-weight: 800; letter-spacing: -.02em; margin: 0 0 6px; }
.muted { color: var(--muted); font-size: 14px; margin: 0 0 20px; line-height: 1.5; }
.small { font-size: 12px; color: var(--muted); margin-top: 2px; }
.center-text { text-align: center; }

.field { position: relative; }
.field-ico {
  position: absolute; left: 15px; top: 50%; width: 19px; height: 19px; transform: translateY(-50%);
  fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; transition: stroke .3s ease;
}
.field:focus-within .field-ico { stroke: var(--green); }
.input {
  width: 100%; padding: 15px 16px 15px 46px; border: 1.5px solid var(--line); border-radius: 14px;
  font: inherit; font-size: 15px; color: var(--text); background: #fff; outline: none;
  transition: border-color .3s ease, box-shadow .3s ease;
  -webkit-appearance: none; appearance: none;
}
.input.plain { padding-left: 16px; }
textarea.input { resize: vertical; min-height: 130px; font-size: 12px; line-height: 1.55; }
.input:focus { border-color: var(--green); box-shadow: 0 0 0 4px var(--green-l); }
.input::placeholder { color: #a3b5aa; }
.mono { font-family: "JetBrains Mono", ui-monospace, Consolas, monospace; }
input.mono { letter-spacing: .06em; text-transform: uppercase; }
input.mono::placeholder { text-transform: none; }
input.plain.mono { text-transform: none; letter-spacing: .02em; }

.label { display: block; font-size: 13px; font-weight: 700; margin-bottom: 8px; }
.req { color: var(--red); }

/* ---------- кнопки ---------- */
.btn {
  position: relative; overflow: hidden; width: 100%; min-height: 50px;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  margin-top: 16px; padding: 14px 22px; border: 0; border-radius: 14px;
  font: inherit; font-size: 15px; font-weight: 700; color: #fff; text-decoration: none; cursor: pointer;
  background: linear-gradient(135deg, var(--green), var(--green-d));
  box-shadow: 0 12px 24px -12px rgba(15, 122, 55, .7);
  transition: transform .35s var(--ease-out), box-shadow .35s ease, opacity .3s ease, background-color .3s ease;
  touch-action: manipulation;
}
.btn::before {
  content: ""; position: absolute; top: 0; left: -60%; width: 45%; height: 100%;
  background: linear-gradient(100deg, transparent, rgba(255,255,255,.22), transparent);
  transform: skewX(-20deg); pointer-events: none;
}
@keyframes sheen { from { left: -60%; } to { left: 130%; } }
.btn:active:not(:disabled) { transform: scale(.985); transition-duration: .12s; }
.btn:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }
.btn .arrow { transition: transform .4s var(--ease-out); }
.btn.loading .arrow { display: none; }
.btn.loading .btn-text::before {
  content: ""; display: inline-block; width: 15px; height: 15px; margin-right: 10px; vertical-align: -3px;
  border: 2px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: spin 1s linear infinite;
}
.btn-outline { background: #fff; color: var(--green-d); border: 1.5px solid var(--green); box-shadow: none; }
/* Вторичная кнопка: «Отмена» */
.btn-secondary {
  background: #fff; color: var(--green-d); border: 1.5px solid var(--line);
  box-shadow: 0 8px 18px -14px rgba(11, 92, 42, .45);
}
.btn-secondary::before { display: none; }
.btn-ico { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; transition: transform .5s var(--ease-out); }

/* Кнопки «Отмена» и «Активировать» в один ряд */
.actions { display: flex; gap: 10px; margin-top: 16px; }
.actions .btn { margin-top: 0; }
.actions .btn-secondary { flex: 1; }
.actions .btn[type="submit"] { flex: 1.8; }

/* «Активировать другой ключ» */
.btn-again { margin-top: 18px; }
.btn-again .again-ico { width: 19px; height: 19px; }

/* Эффекты наведения — только для мыши, чтобы на телефоне ничего не «залипало» */
@media (hover: hover) {
  .btn:hover:not(:disabled)::before { animation: sheen 2.4s var(--ease-io); }
  .btn:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 16px 28px -12px rgba(15, 122, 55, .75); }
  .btn:hover:not(:disabled) .arrow { transform: translateX(4px); }
  .btn-outline:hover:not(:disabled) { background: var(--green-xl); box-shadow: none; transform: none; }
  .btn-secondary:hover:not(:disabled) { background: var(--green-xl); border-color: var(--green-l); box-shadow: 0 10px 20px -14px rgba(11, 92, 42, .5); }
  .btn-secondary:hover .btn-ico { transform: translateX(-3px); }
  .btn-again:hover .again-ico { transform: rotate(-200deg); }
  .tab:hover { color: var(--green-d); }
  .back:hover { color: var(--green-d); }
}

.back { border: 0; background: none; color: var(--muted); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; padding: 6px 0; margin-bottom: 10px; transition: color .3s ease; }

/* ---------- шаг 2 ---------- */
.product {
  display: flex; align-items: center; gap: 14px; padding: 16px; margin-bottom: 20px;
  background: linear-gradient(135deg, var(--green-xl), #fff); border: 1.5px solid var(--green-l); border-radius: 16px;
  animation: pop .7s .15s var(--ease-out) both;
}
.product-icon {
  width: 42px; height: 42px; border-radius: 12px; flex: none; display: grid; place-items: center;
  color: #fff; font-weight: 800; font-size: 18px; background: linear-gradient(135deg, var(--mint), var(--green-d));
}
.product-name { font-weight: 800; font-size: 16px; }
@keyframes pop { from { opacity: 0; transform: scale(.96); } to { opacity: 1; transform: none; } }

.seg { display: flex; gap: 6px; padding: 4px; margin-bottom: 18px; border-radius: 12px; background: rgba(15, 122, 55, .06); }
.seg:empty { display: none; }
.seg button {
  flex: 1; border: 0; background: transparent; padding: 10px; min-height: 40px; border-radius: 9px;
  font: inherit; font-size: 13px; font-weight: 700; color: var(--muted); cursor: pointer;
  transition: background-color .35s ease, color .35s ease, box-shadow .35s ease;
}
.seg button.active { background: #fff; color: var(--green-d); box-shadow: 0 3px 10px -4px rgba(11, 92, 42, .3); }

/* ---------- инструкция ---------- */
.guide {
  margin: 0 0 20px; padding: 20px; border-radius: 18px;
  background: linear-gradient(160deg, #fff 0%, var(--green-xl) 100%);
  border: 1.5px solid var(--green-l);
}
.guide.in { animation: guideIn .55s var(--ease-out) both; }
@keyframes guideIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.guide-head { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; }
.guide-ico {
  width: 46px; height: 46px; flex: none; border-radius: 14px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--green-xl), #fff); border: 1.5px solid var(--green-l);
  box-shadow: 0 6px 16px -10px rgba(11, 92, 42, .4);
}
.guide-ico svg { width: 24px; height: 24px; fill: none; stroke: var(--green-d); stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.guide-kicker { font-size: 11px; font-weight: 800; letter-spacing: .18em; text-transform: uppercase; color: var(--green); margin-bottom: 3px; }
.guide-title { font-size: 19px; font-weight: 800; letter-spacing: -.02em; line-height: 1.2; }
.guide-intro { font-size: 13.5px; color: var(--muted); line-height: 1.55; margin: 0 0 16px; }

.guide-steps { list-style: none; margin: 0 0 16px; padding: 0; }
.guide-steps li { position: relative; display: flex; gap: 14px; padding-bottom: 16px; animation: rowIn .5s var(--ease-out) both; }
.guide-steps li:nth-child(2) { animation-delay: .08s; }
.guide-steps li:nth-child(3) { animation-delay: .16s; }
.guide-steps li:last-child { padding-bottom: 0; }
/* Линия, соединяющая номера шагов */
.guide-steps li:not(:last-child)::before {
  content: ""; position: absolute; left: 16px; top: 36px; bottom: 2px; width: 1.5px; background: var(--line);
}
.guide-num {
  width: 34px; height: 34px; flex: none; border-radius: 10px; display: grid; place-items: center;
  font-family: "JetBrains Mono", monospace; font-size: 11.5px; color: var(--green-d);
  background: #fff; border: 1.5px solid var(--green-l);
}
.guide-body { padding-top: 6px; min-width: 0; }
.guide-step-title { font-size: 14.5px; font-weight: 800; margin-bottom: 4px; }
.guide-step-text { font-size: 13px; color: var(--muted); line-height: 1.6; overflow-wrap: anywhere; }
.guide-step-text a { color: var(--green-d); font-weight: 700; text-decoration: underline; text-decoration-color: rgba(22, 163, 74, .4); text-underline-offset: 3px; }
.guide-step-text code {
  font-family: "JetBrains Mono", monospace; font-size: 11.5px; background: var(--green-xl); color: var(--green-d);
  padding: 1px 6px; border-radius: 5px; border: 1px solid var(--green-l);
}
kbd {
  display: inline-block; min-width: 22px; padding: 1px 6px; border-radius: 6px; text-align: center;
  font-family: "JetBrains Mono", monospace; font-size: 11px; color: var(--text); background: #fff;
  border: 1px solid var(--line); box-shadow: 0 2px 0 var(--line);
}

.guide-link {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 16px; border-radius: 14px; text-decoration: none; color: var(--text);
  background: #fff; border: 1.5px solid var(--green-l);
  transition: border-color .35s ease, box-shadow .35s ease, transform .35s var(--ease-out);
}
.guide-link small {
  display: block; font-size: 10.5px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 3px;
}
.guide-link > span:first-child { font-size: 14.5px; font-weight: 800; }
.guide-arrow { font-size: 18px; color: var(--green); transition: transform .4s var(--ease-out); }
@media (hover: hover) {
  .guide-link:hover { border-color: var(--green); box-shadow: 0 10px 22px -14px rgba(15, 122, 55, .5); transform: translateY(-1px); }
  .guide-link:hover .guide-arrow { transform: translate(2px, -2px); }
}
.guide-note {
  display: flex; gap: 10px; align-items: flex-start; margin-top: 12px; padding: 11px 13px; border-radius: 12px;
  font-size: 12.5px; line-height: 1.5; color: var(--green-d); background: rgba(22, 163, 74, .07);
}
.guide-note svg { width: 16px; height: 16px; flex: none; margin-top: 1px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.hint { font-size: 12.5px; color: var(--muted); margin-top: 10px; line-height: 1.6; }
.hint code { font-family: "JetBrains Mono", monospace; font-size: 11.5px; background: var(--green-xl); color: var(--green-d); padding: 1px 6px; border-radius: 5px; word-break: break-all; }
.hint a { color: var(--green-d); font-weight: 600; }

.check { position: relative; display: flex; align-items: flex-start; gap: 10px; margin-top: 18px; padding: 4px 0; font-size: 13.5px; cursor: pointer; user-select: none; }
.check input { position: absolute; opacity: 0; pointer-events: none; }
.check .box {
  width: 22px; height: 22px; flex: none; border-radius: 7px; border: 1.5px solid var(--line); background: #fff;
  display: grid; place-items: center; transition: background-color .3s ease, border-color .3s ease;
}
.check .box::after {
  content: ""; width: 5px; height: 10px; margin-top: -2px; border: solid #fff; border-width: 0 2.5px 2.5px 0;
  transform: rotate(45deg) scale(0); transition: transform .4s var(--ease-spring);
}
.check input:checked + .box { background: var(--green); border-color: var(--green); }
.check input:checked + .box::after { transform: rotate(45deg) scale(1); }
.check input:focus-visible + .box { box-shadow: 0 0 0 4px var(--green-l); }

/* ---------- шаг 3: анимация активации ----------
   Ожидание: мягкое свечение + равномерно вращающаяся дуга + пульсирующая молния.
   Результат: ожидание плавно гаснет, по кругу прорисовывается обводка,
   затем галочка/крестик, в конце — лёгкое «покачивание». */

.anim { position: relative; width: 136px; height: 136px; margin: 8px auto 24px; --c: var(--green); --cl: var(--green-xl); }
.anim[data-state="fail"] { --c: var(--red); --cl: var(--red-l); }
.anim[data-state="warn"] { --c: var(--amber); --cl: var(--amber-l); }

.halo {
  position: absolute; inset: -10px; border-radius: 50%;
  background: radial-gradient(circle, rgba(52, 211, 153, .28) 0%, rgba(52, 211, 153, 0) 68%);
  animation: halo 3.2s ease-in-out infinite;
  transition: opacity .6s ease;
}
@keyframes halo { 0%, 100% { transform: scale(.92); opacity: .55; } 50% { transform: scale(1.06); opacity: 1; } }

.track, .spinner { position: absolute; inset: 8px; border-radius: 50%; transition: opacity .5s ease; }
.track { border: 7px solid var(--green-l); }
.spinner {
  background: conic-gradient(from 0deg, rgba(22, 163, 74, 0) 0deg, rgba(22, 163, 74, .12) 90deg, var(--green) 300deg, var(--mint) 360deg);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 7px), #000 calc(100% - 6.5px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 7px), #000 calc(100% - 6.5px));
  animation: spin 1.8s linear infinite;
}
/* Скруглённая «голова» дуги */
.spinner::after {
  content: ""; position: absolute; top: 0; left: 50%; width: 7px; height: 7px; margin-left: -3.5px;
  border-radius: 50%; background: var(--mint);
}

.core {
  position: absolute; inset: 32px; border-radius: 50%;
  background: linear-gradient(135deg, #fff, var(--green-xl));
  box-shadow: 0 8px 24px -10px rgba(15, 122, 55, .45), inset 0 0 0 1px var(--green-l);
  display: grid; place-items: center;
  transition: opacity .45s ease, transform .6s var(--ease-out);
}
.core-ico { width: 30px; height: 30px; fill: var(--green); animation: corePulse 2.4s ease-in-out infinite; }
@keyframes corePulse { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(.88); opacity: .75; } }

.anim:not([data-state="spin"]) .halo,
.anim:not([data-state="spin"]) .track,
.anim:not([data-state="spin"]) .spinner { opacity: 0; }
.anim:not([data-state="spin"]) .core { opacity: 0; transform: scale(.7); }

.result { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.res-bg {
  fill: var(--cl); opacity: 0; transform: scale(.6);
  transform-box: fill-box; transform-origin: center;
}
.res-circle {
  fill: none; stroke: var(--c); stroke-width: 6; stroke-linecap: round;
  stroke-dasharray: 340; stroke-dashoffset: 340;
}
.res-mark {
  fill: none; stroke: var(--c); stroke-width: 7; stroke-linecap: round; stroke-linejoin: round;
  stroke-dasharray: 100; stroke-dashoffset: 100; opacity: 0;
}

.anim:not([data-state="spin"]) .res-bg { animation: resBg .7s .25s var(--ease-out) forwards; }
.anim:not([data-state="spin"]) .res-circle { animation: draw .9s .2s var(--ease-io) forwards; }
.anim[data-state="ok"] .res-mark.ok,
.anim[data-state="fail"] .res-mark.fail,
.anim[data-state="warn"] .res-mark.warn { opacity: 1; animation: draw .6s .95s var(--ease-out) forwards; }

.anim[data-state="ok"] .result { animation: settle .8s 1.45s var(--ease-out); }
.anim[data-state="fail"] .result { animation: nudge .6s 1.5s ease-in-out; }
.anim[data-state="warn"] .result { animation: settle .8s 1.45s var(--ease-out); }

/* Мягкая волна после успеха */
.anim::after {
  content: ""; position: absolute; inset: 8px; border-radius: 50%; pointer-events: none;
  border: 2px solid var(--c); opacity: 0;
}
.anim[data-state="ok"]::after { animation: wave 1.4s 1.4s var(--ease-out); }

@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes resBg { to { opacity: 1; transform: scale(1); } }
@keyframes settle { 0% { transform: scale(1); } 40% { transform: scale(1.05); } 100% { transform: scale(1); } }
@keyframes nudge {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  50% { transform: translateX(4px); }
  75% { transform: translateX(-2px); }
}
@keyframes wave { 0% { opacity: .6; transform: scale(1); } 100% { opacity: 0; transform: scale(1.35); } }

.status-title { text-align: center; font-size: 22px; font-weight: 800; margin: 0 0 6px; }
.status-title, #status-text { animation: rise .6s var(--ease-out) both; }

.stages { list-style: none; padding: 16px; margin: 4px 0 6px; border-radius: 16px; background: rgba(15, 122, 55, .05); }
.stages li { display: flex; align-items: center; gap: 12px; padding: 7px 0; font-size: 14px; font-weight: 600; color: #9fb3a6; transition: color .5s ease; }
.s-ico {
  position: relative; width: 22px; height: 22px; flex: none; border-radius: 50%; border: 2px solid var(--line);
  transition: background-color .45s ease, border-color .45s ease;
}
.s-ico::after {
  content: ""; position: absolute; left: 6px; top: 2.5px; width: 5px; height: 10px;
  border: solid #fff; border-width: 0 2.5px 2.5px 0;
  transform: rotate(45deg) scale(0); transition: transform .45s var(--ease-spring);
}
.stages li.active { color: var(--text); }
.stages li.active .s-ico { border-color: var(--green-l); border-top-color: var(--green); animation: spin 1.1s linear infinite; }
.stages li.done { color: var(--green-d); }
.stages li.done .s-ico { background: var(--green); border-color: var(--green); }
.stages li.done .s-ico::after { transform: rotate(45deg) scale(1); }
/* Этапы отмечаются по очереди, а не все сразу */
.stages li:nth-child(2), .stages li:nth-child(2) .s-ico, .stages li:nth-child(2) .s-ico::after { transition-delay: .25s; }
.stages li:nth-child(3), .stages li:nth-child(3) .s-ico, .stages li:nth-child(3) .s-ico::after { transition-delay: .55s; }
.stages li.fail { color: var(--red); }
.stages li.fail .s-ico { background: var(--red); border-color: var(--red); }
.stages li.fail .s-ico::after {
  content: "×"; left: 0; top: 0; width: 100%; height: 100%; border: 0; transform: none;
  display: grid; place-items: center; color: #fff; font-size: 15px; font-weight: 800; line-height: 1;
}
.stages li.warn { color: var(--amber); }
.stages li.warn .s-ico { background: var(--amber); border-color: var(--amber); }

.order { text-align: center; font-size: 12.5px; color: var(--muted); margin-top: 12px; animation: fadeIn .6s ease both; }
.order:empty { display: none; }
.order b { color: var(--text); font-family: "JetBrains Mono", monospace; font-weight: 500; word-break: break-all; }
#verify-btn, #restart { animation: rise .6s var(--ease-out) both; }

/* ---------- ошибки и результат ---------- */
.error {
  margin-top: 16px; padding: 12px 14px; border-radius: 12px; font-size: 13.5px; font-weight: 600; line-height: 1.45;
  background: var(--red-l); color: var(--red); border: 1px solid #f9c9c9;
  animation: errIn .5s var(--ease-out) both;
}
@keyframes errIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.pane > .error { margin: 16px 0 0; }

.result-table { margin-top: 22px; border-radius: 16px; overflow: hidden; border: 1.5px solid var(--line); background: #fff; animation: fadeIn .4s ease both; }
.result-row {
  display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 13px 16px; font-size: 13.5px;
  animation: rowIn .55s var(--ease-out) both;
}
.result-row + .result-row { border-top: 1px solid var(--line); }
.result-row:nth-child(2) { animation-delay: .07s; }
.result-row:nth-child(3) { animation-delay: .14s; }
.result-row:nth-child(4) { animation-delay: .21s; }
.result-row:nth-child(5) { animation-delay: .28s; }
.result-row:nth-child(6) { animation-delay: .35s; }
.result-row:nth-child(7) { animation-delay: .42s; }
.result-row span:first-child { color: var(--muted); flex: none; }
.result-row span:last-child { text-align: right; font-weight: 700; word-break: break-word; min-width: 0; }
@keyframes rowIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.g { background: var(--green-l); color: var(--green-d); }
.badge.r { background: var(--red-l); color: var(--red); }
.badge.a { background: var(--amber-l); color: var(--amber); }
.badge.a::before { animation: blink 1.6s ease-in-out infinite; }
.badge.n { background: #eef3ef; color: var(--muted); }
@keyframes blink { 50% { opacity: .25; } }

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

#confetti { position: fixed; inset: 0; pointer-events: none; z-index: 50; }

/* ---------- телефоны ---------- */
@media (max-width: 560px) {
  .wrap { padding-top: max(28px, env(safe-area-inset-top)); }
  .hero { margin-bottom: 20px; }
  .logo { width: 48px; height: 48px; border-radius: 14px; margin-bottom: 12px; }
  .logo svg { width: 24px; height: 24px; }
  .hero h1 { font-size: 27px; }
  .sub { font-size: 14px; }

  .panel { border-radius: 20px; padding: 6px 6px 22px; }
  .pane { padding: 0 12px; }
  .tabs { margin-bottom: 20px; }
  .tab { font-size: 13.5px; }

  /* Подписи шагов под кружками, чтобы всё помещалось */
  .stepper { margin-bottom: 22px; align-items: flex-start; }
  .stepper li[data-step] { flex-direction: column; gap: 5px; width: 64px; }
  .stepper .lbl { font-size: 11px; }
  .stepper .bar { margin: 13px -14px 0; }

  .step h2 { font-size: 20px; }
  .muted { font-size: 13.5px; margin-bottom: 16px; }

  /* 16px — чтобы iPhone не увеличивал страницу при фокусе на поле */
  .input, textarea.input { font-size: 16px; }
  textarea.input { min-height: 150px; }

  .lang { top: max(12px, env(safe-area-inset-top)); }
  .lang button { min-width: 36px; padding: 5px 8px; font-size: 11.5px; }
  .guide { padding: 16px 14px; border-radius: 16px; }
  .guide-ico { width: 40px; height: 40px; border-radius: 12px; }
  .guide-title { font-size: 17px; }
  .guide-steps li { gap: 12px; }
  .guide-num { width: 30px; height: 30px; font-size: 11px; }
  .guide-steps li:not(:last-child)::before { left: 14px; top: 32px; }
  .guide-body { padding-top: 4px; }
  .product { padding: 13px; gap: 12px; }
  .product-icon { width: 38px; height: 38px; }
  .product-name { font-size: 15px; }

  .anim { width: 120px; height: 120px; margin-bottom: 20px; }
  .core { inset: 28px; }
  .status-title { font-size: 20px; }
  .stages { padding: 12px 14px; }
  .stages li { font-size: 13.5px; }

  .result-row { padding: 12px 13px; font-size: 13px; gap: 12px; }

  /* Размытие тяжёлое для слабых телефонов — делаем фон проще */
  .blob { filter: blur(50px); opacity: .4; }
  .b1 { width: 340px; height: 340px; }
  .b2 { width: 300px; height: 300px; }
  .b3 { display: none; }
}

@media (max-width: 360px) {
  .hero h1 { font-size: 24px; }
  .pane { padding: 0 8px; }
  .stepper li[data-step] { width: 58px; }
  .result-row { flex-wrap: wrap; }
  .result-row span:last-child { text-align: left; }
}

/* При отключённых анимациях в системе убираем фоновое движение и покачивания */
@media (prefers-reduced-motion: reduce) {
  .blob, .logo, .hero h1 span, .halo { animation: none; }
  .anim .result { animation: none !important; }
}
