:root {
  color-scheme: dark;
  --bg: #050a09;
  --panel: rgba(11, 20, 18, 0.88);
  --panel-2: rgba(16, 28, 25, 0.92);
  --line: rgba(126, 255, 200, 0.14);
  --line-strong: rgba(85, 242, 173, 0.35);
  --text: #f2fff9;
  --muted: #8ba69b;
  --mint: #55f2ad;
  --mint-strong: #23d68c;
  --mint-glow: rgba(85, 242, 173, 0.35);
  --danger: #ff7777;
  --radius-lg: 24px;
  --radius-md: 14px;
  --radius-sm: 10px;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  min-width: 320px;
  min-height: 100vh;
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ============ WEBGL ФОН ============ */
#bg-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  display: block;
  pointer-events: none;
  transform: translateZ(0);
  contain: strict;
}

/* Плавающие частицы */
.particles {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  overflow: hidden;
}
.particles span {
  position: absolute;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--mint);
  box-shadow: 0 0 10px var(--mint), 0 0 20px var(--mint-glow);
  opacity: 0.5;
  animation: float-up linear infinite;
}
.particles span:nth-child(1) { left: 8%;  animation-duration: 22s; animation-delay: 0s; }
.particles span:nth-child(2) { left: 22%; animation-duration: 28s; animation-delay: 3s; }
.particles span:nth-child(3) { left: 37%; animation-duration: 19s; animation-delay: 6s; }
.particles span:nth-child(4) { left: 55%; animation-duration: 25s; animation-delay: 1s; }
.particles span:nth-child(5) { left: 68%; animation-duration: 31s; animation-delay: 4s; }
.particles span:nth-child(6) { left: 82%; animation-duration: 20s; animation-delay: 8s; }
.particles span:nth-child(7) { left: 15%; animation-duration: 26s; animation-delay: 10s; }
.particles span:nth-child(8) { left: 48%; animation-duration: 23s; animation-delay: 12s; }
.particles span:nth-child(9) { left: 74%; animation-duration: 29s; animation-delay: 7s; }
.particles span:nth-child(10){ left: 92%; animation-duration: 24s; animation-delay: 2s; }

@keyframes float-up {
  0%   { transform: translateY(110vh) scale(0.6); opacity: 0; }
  10%  { opacity: 0.6; }
  90%  { opacity: 0.6; }
  100% { transform: translateY(-10vh) scale(1.1); opacity: 0; }
}

/* ============ ОБЁРТКА ============ */
.page-shell {
  position: relative;
  z-index: 3;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

/* ============ КАРТОЧКА ============ */
.verify-card {
  position: relative;
  width: min(100%, 520px);
  border-radius: var(--radius-lg);
}

/* Статичный градиентный бордер */
.card-border {
  position: absolute;
  inset: -1px;
  border-radius: calc(var(--radius-lg) + 1px);
  background: linear-gradient(
    135deg,
    rgba(85, 242, 173, 0.0) 0%,
    rgba(85, 242, 173, 0.35) 30%,
    rgba(85, 242, 173, 0.55) 50%,
    rgba(85, 242, 173, 0.35) 70%,
    rgba(85, 242, 173, 0.0) 100%
  );
  z-index: 0;
  pointer-events: none;
}

.card-inner {
  position: relative;
  z-index: 1;
  overflow: hidden;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow:
    0 28px 90px rgba(0, 0, 0, 0.6),
    0 0 0 1px rgba(255, 255, 255, 0.02) inset,
    0 1px 0 rgba(255, 255, 255, 0.05) inset,
    0 40px 80px -40px rgba(35, 214, 140, 0.12) inset,
    0 0 120px 30px rgba(3, 7, 6, 0.55);

  transform: translateZ(0);
  backface-visibility: hidden;
}

.hero-copy, .status-line, .captcha-panel, .success-panel {
  position: relative;
  z-index: 1;
  padding-inline: 32px;
}

/* ============ HERO ============ */
.hero-copy {
  padding-top: 42px;
  text-align: center;
}

h1 {
  margin: 0;
  font-size: clamp(26px, 5.6vw, 34px);
  line-height: 1.1;
  letter-spacing: -0.035em;
  font-weight: 800;
}

.gradient-text {
  background: linear-gradient(120deg, #ffffff 0%, var(--mint) 45%, #a8ffd4 100%);
  -webkit-background-clip: text;
          background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 22px rgba(85, 242, 173, 0.35));
}

.lead {
  max-width: 390px;
  margin: 14px auto 0;
  color: var(--muted);
  font-size: 14.5px;
  line-height: 1.55;
}

.status-line {
  margin: 26px 32px 30px;
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 11px;
  border-radius: var(--radius-md);
  color: #bdd3ca;
  background: var(--panel-2);
  border: 1px solid var(--line);
  font-size: 13px;
}

.spinner {
  width: 16px; height: 16px;
  border: 2px solid rgba(85, 242, 173, 0.18);
  border-top-color: var(--mint);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============ CAPTCHA ============ */
.captcha-panel {
  padding-top: 26px;
  padding-bottom: 30px;
  animation: fade-up 0.5s ease both;
}
@keyframes fade-up {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.captcha-image-wrap {
  position: relative;
  height: 124px;
  overflow: hidden;
  border: 1px solid rgba(85, 242, 173, 0.2);
  border-radius: var(--radius-md);
  background: #07100e;
  box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.55), 0 12px 28px rgba(0, 0, 0, 0.2);
}

.captcha-image-wrap::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(180deg, transparent 0 3px, rgba(255, 255, 255, 0.018) 3px 4px);
}

.captcha-image-wrap img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.icon-button {
  position: absolute;
  z-index: 2;
  top: 10px;
  right: 10px;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 10px;
  color: var(--text);
  background: rgba(5, 10, 9, 0.9);
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.icon-button svg { width: 18px; height: 18px; }
.icon-button:hover {
  border-color: var(--line-strong);
  background: rgba(85, 242, 173, 0.18);
  transform: rotate(18deg);
}

label {
  display: block;
  margin: 18px 0 8px;
  color: #b5cbc2;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.input-wrap { position: relative; }

#captcha-answer {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 56px;
  padding: 0 18px;
  border: 1px solid rgba(139, 166, 155, 0.22);
  border-radius: var(--radius-md);
  outline: none;
  color: var(--text);
  background: #07100e;
  font: 800 20px/1 "JetBrains Mono", ui-monospace, monospace;
  letter-spacing: 0.3em;
  text-align: center;
  text-transform: uppercase;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

#captcha-answer::placeholder { color: rgba(139, 166, 155, 0.35); }
#captcha-answer:focus {
  border-color: rgba(85, 242, 173, 0.7);
  background: #08130f;
  box-shadow: 0 0 0 4px rgba(85, 242, 173, 0.09), 0 0 30px rgba(85, 242, 173, 0.15);
}

.input-glow {
  position: absolute;
  inset: -1px;
  border-radius: calc(var(--radius-md) + 1px);
  pointer-events: none;
  background: linear-gradient(90deg, transparent, var(--mint-glow), transparent);
  opacity: 0;
  filter: blur(8px);
  transition: opacity 0.3s;
}

#captcha-answer:focus ~ .input-glow { opacity: 0.7; }

.website-field {
  position: absolute !important;
  left: -10000px !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

/* ============ КНОПКА ============ */
.primary-button {
  position: relative;
  overflow: hidden;
  width: 100%;
  height: 56px;
  margin-top: 16px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 13px;
  border: 0;
  border-radius: var(--radius-md);
  cursor: pointer;
  color: #04100b;
  background: linear-gradient(135deg, #8bffca 0%, #3ce6a0 55%, #23d68c 100%);
  font-weight: 800;
  font-size: 14px;
  font-family: Inter, sans-serif;
  letter-spacing: 0.01em;
  box-shadow:
    0 14px 34px rgba(35, 214, 140, 0.28),
    0 0 0 1px rgba(255, 255, 255, 0.15) inset,
    0 1px 0 rgba(255, 255, 255, 0.5) inset;

  transform: translateZ(0);
  backface-visibility: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;

  transition: box-shadow 0.25s ease, background 0.2s ease;
}

.primary-button:hover:not(:disabled) {
  background: linear-gradient(135deg, #9dffd4 0%, #4aebaa 55%, #2ce09a 100%);
  box-shadow:
    0 18px 42px rgba(35, 214, 140, 0.42),
    0 0 0 1px rgba(255, 255, 255, 0.22) inset,
    0 1px 0 rgba(255, 255, 255, 0.6) inset;
}

.primary-button:active:not(:disabled) {
  box-shadow:
    0 8px 20px rgba(35, 214, 140, 0.32),
    0 0 0 1px rgba(255, 255, 255, 0.18) inset,
    0 1px 0 rgba(255, 255, 255, 0.5) inset;
}

.primary-button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.btn-arrow {
  display: inline-block;
  transition: transform 0.25s ease;
  font-size: 16px;
}
.primary-button:hover:not(:disabled) .btn-arrow {
  transform: translateX(4px);
}

.btn-ripple {
  position: absolute;
  border-radius: 50%;
  transform: scale(0);
  background: rgba(255, 255, 255, 0.55);
  pointer-events: none;
  animation: ripple 0.7s ease-out;
}
@keyframes ripple {
  to { transform: scale(4); opacity: 0; }
}

.form-message {
  min-height: 18px;
  margin: 12px 0 0;
  text-align: center;
  color: var(--danger);
  font-size: 12px;
  font-weight: 600;
}

/* ============ УСПЕХ ============ */
.success-panel {
  padding-top: 34px;
  padding-bottom: 42px;
  text-align: center;
  animation: fade-up 0.5s ease both;
}
.success-check {
  width: 76px; height: 76px;
  margin: 0 auto 20px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #06150f;
  background: linear-gradient(135deg, #b6ffe0, var(--mint-strong));
  box-shadow:
    0 0 42px rgba(85, 242, 173, 0.5),
    0 12px 30px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.7);
  animation: check-pop 0.55s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
.success-check svg { width: 34px; height: 34px; }
@keyframes check-pop {
  0%   { transform: scale(0.4); opacity: 0; }
  100% { transform: scale(1);   opacity: 1; }
}

.success-panel h2 {
  margin: 0;
  font-size: 26px;
  letter-spacing: -0.02em;
}
.success-panel p {
  margin: 11px auto 0;
  max-width: 360px;
  color: var(--muted);
  line-height: 1.55;
  font-size: 14px;
}

[hidden] { display: none !important; }

/* ============ АДАПТИВ ============ */
@media (max-width: 560px) {
  .page-shell { padding: 6px; }
  .verify-card { border-radius: 19px; }
  .card-inner { border-radius: 19px; }
  .hero-copy, .captcha-panel, .success-panel { padding-inline: 20px; }
  .status-line { margin-inline: 20px; }
  .hero-copy { padding-top: 28px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  #bg-canvas { display: none; }
}
