:root {
  --bg: #0a0e1a;
  --bg-card: rgba(248, 250, 255, 0.045);
  --border: rgba(248, 250, 255, 0.09);
  --gold: #f5a623;
  --gold-light: #fbbf24;
  --violet: #8b5cf6;
  --violet-deep: #6d28d9;
  --success: #34d399;
  --text: #f8fafc;
  --text-dim: #97a1b8;
  --text-faint: #5b6478;
}

* {
  box-sizing: border-box;
}

html, body {
  height: 100%;
  margin: 0;
}

body {
  position: relative;
  min-height: 100vh;
  overflow-x: hidden;
  background: var(--bg);
  font-family: 'DM Sans', system-ui, sans-serif;
  color: var(--text);
  isolation: isolate;
}

/* ---------- ambient background ---------- */

.aurora {
  position: fixed;
  inset: 0;
  z-index: -2;
  overflow: hidden;
}

.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  mix-blend-mode: screen;
  opacity: 0.55;
  will-change: transform;
}

.blob-gold {
  width: 46vw;
  height: 46vw;
  left: -12vw;
  top: -14vw;
  background: radial-gradient(circle, rgba(245, 166, 35, 0.55), transparent 70%);
  animation: driftA 26s ease-in-out infinite;
}

.blob-violet {
  width: 50vw;
  height: 50vw;
  right: -16vw;
  top: 8vw;
  background: radial-gradient(circle, rgba(139, 92, 246, 0.5), transparent 70%);
  animation: driftB 32s ease-in-out infinite;
}

.blob-deep {
  width: 40vw;
  height: 40vw;
  left: 20vw;
  bottom: -20vw;
  background: radial-gradient(circle, rgba(109, 40, 217, 0.4), transparent 70%);
  animation: driftC 30s ease-in-out infinite;
}

@keyframes driftA {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(6vw, 5vw) scale(1.12); }
}

@keyframes driftB {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-5vw, 6vw) scale(0.9); }
}

@keyframes driftC {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(4vw, -4vw) scale(1.08); }
}

.grid-veil {
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(rgba(248, 250, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(248, 250, 255, 0.035) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: radial-gradient(ellipse 70% 60% at 50% 40%, black 10%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 40%, black 10%, transparent 75%);
}

.grain {
  position: fixed;
  inset: 0;
  z-index: 50;
  pointer-events: none;
  opacity: 0.05;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- layout ---------- */

.scene {
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 24px;
}

.card {
  position: relative;
  width: min(440px, 100%);
  padding: 52px 40px 40px;
  border-radius: 28px;
  text-align: center;
  background: linear-gradient(165deg, rgba(248, 250, 255, 0.07), rgba(248, 250, 255, 0.015));
  border: 1px solid var(--border);
  backdrop-filter: blur(22px) saturate(140%);
  -webkit-backdrop-filter: blur(22px) saturate(140%);
  box-shadow:
    0 30px 80px -20px rgba(0, 0, 0, 0.65),
    0 0 0 1px rgba(0, 0, 0, 0.2),
    0 0 60px -18px rgba(245, 166, 35, 0.18);
  overflow: hidden;
}

.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 12%;
  right: 12%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold-light), var(--violet), transparent);
  opacity: 0.7;
}

/* ---------- emblem ---------- */

.emblem {
  position: relative;
  width: 48px;
  height: 48px;
  margin: 0 auto 6px;
}

.emblem svg {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
}

.emblem-glow {
  position: absolute;
  inset: -14px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(245, 166, 35, 0.35), transparent 70%);
  animation: emblemPulse 2.6s ease-in-out infinite;
}

@keyframes emblemPulse {
  0%, 100% { opacity: 0.35; transform: scale(0.9); }
  50% { opacity: 0.75; transform: scale(1.15); }
}

.emblem-check {
  stroke-dasharray: 22;
  stroke-dashoffset: 22;
  animation: drawCheck 2.6s ease-in-out infinite;
}

@keyframes drawCheck {
  0%, 20% { stroke-dashoffset: 22; }
  45%, 100% { stroke-dashoffset: 0; }
}

/* ---------- loader ---------- */

.loader {
  position: relative;
  width: 104px;
  height: 104px;
  margin: 26px auto 24px;
}

.ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2.5px solid transparent;
}

.ring-1 {
  border-top-color: var(--gold-light);
  border-right-color: rgba(251, 191, 36, 0.25);
  animation: spin 2.2s cubic-bezier(0.6, 0.1, 0.4, 0.9) infinite;
}

.ring-2 {
  inset: 14px;
  border-top-color: var(--violet);
  border-left-color: rgba(139, 92, 246, 0.25);
  animation: spin 1.6s cubic-bezier(0.6, 0.1, 0.4, 0.9) infinite reverse;
}

.ring-3 {
  inset: 28px;
  border-top-color: rgba(248, 250, 255, 0.7);
  animation: spin 3s linear infinite;
}

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

.loader-core {
  position: absolute;
  inset: 38px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(245, 166, 35, 0.55), rgba(139, 92, 246, 0.25) 65%, transparent 75%);
  animation: corePulse 2.2s ease-in-out infinite;
}

@keyframes corePulse {
  0%, 100% { transform: scale(0.85); opacity: 0.55; }
  50% { transform: scale(1.05); opacity: 0.95; }
}

.loader-check {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  transform: scale(0.7);
  transition: opacity 0.4s ease, transform 0.4s ease;
}

#checkPath {
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  transition: stroke-dashoffset 0.6s ease 0.15s;
}

/* success state, toggled via JS */
.loader.is-success .ring,
.loader.is-success .loader-core {
  opacity: 0;
  transform: scale(0.6);
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.loader.is-success .loader-check {
  opacity: 1;
  transform: scale(1);
}

.loader.is-success #checkPath {
  stroke-dashoffset: 0;
}

/* ---------- start state ---------- */

.is-hidden {
  display: none !important;
}

.notify-btn {
  margin-top: 22px;
  padding: 14px 28px;
  border: none;
  border-radius: 14px;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 15px;
  font-weight: 600;
  color: #17131a;
  background: linear-gradient(120deg, var(--gold-light), var(--violet));
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
  box-shadow: 0 12px 30px -10px rgba(245, 166, 35, 0.45);
}

.notify-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 16px 36px -10px rgba(139, 92, 246, 0.5);
}

.notify-btn:active:not(:disabled) {
  transform: translateY(0);
}

.notify-btn:disabled {
  cursor: default;
  opacity: 0.7;
}

/* ---------- text ---------- */

.title {
  margin: 0 0 10px;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 23px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.status {
  margin: 0 auto;
  max-width: 320px;
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--text-dim);
  transition: opacity 0.25s ease;
}

.status.is-updating {
  opacity: 0.4;
}

/* ---------- steps ---------- */

.steps {
  position: relative;
  display: flex;
  justify-content: space-between;
  list-style: none;
  margin: 34px 0 0;
  padding: 0;
}

.steps::before,
.steps::after {
  content: '';
  position: absolute;
  top: 5px;
  left: 24px;
  right: 24px;
  height: 2px;
}

.steps::before {
  background: rgba(248, 250, 255, 0.1);
}

.steps::after {
  background: linear-gradient(90deg, var(--gold-light), var(--violet));
  width: calc(50% - 24px);
  transition: width 0.6s cubic-bezier(0.65, 0, 0.35, 1);
}

.steps[data-progress="1"]::after { width: 0%; }
.steps[data-progress="2"]::after { width: calc(50% - 24px); }
.steps[data-progress="3"]::after { width: calc(100% - 48px); }

.step {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 33.33%;
}

.step-dot {
  position: relative;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #171d2e;
  border: 2px solid var(--text-faint);
  transition: border-color 0.4s ease, background 0.4s ease;
}

.step-dot i {
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  opacity: 0;
}

.step.is-done .step-dot,
.step.is-active .step-dot {
  border-color: var(--gold-light);
  background: var(--gold-light);
  box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.18);
}

.step.is-active .step-dot i {
  opacity: 1;
  border: 2px solid var(--violet);
  animation: dotPing 1.6s cubic-bezier(0, 0, 0.2, 1) infinite;
}

@keyframes dotPing {
  0% { transform: scale(0.6); opacity: 0.7; }
  100% { transform: scale(1.8); opacity: 0; }
}

.step-label {
  font-size: 11.5px;
  color: var(--text-faint);
  letter-spacing: 0.02em;
  transition: color 0.4s ease;
}

.step.is-done .step-label,
.step.is-active .step-label {
  color: var(--text-dim);
}

/* ---------- meta row ---------- */

.meta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-top: 32px;
  font-size: 12px;
  color: var(--text-faint);
}

.meta-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.meta-item svg {
  opacity: 0.8;
}

#timer {
  font-variant-numeric: tabular-nums;
  font-family: 'Space Grotesk', sans-serif;
}

.meta-divider {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--text-faint);
  opacity: 0.6;
}

.footnote {
  font-size: 12px;
  color: var(--text-faint);
  opacity: 0.7;
  text-align: center;
}

/* ---------- responsive ---------- */

@media (max-width: 480px) {
  .card {
    padding: 44px 26px 32px;
    border-radius: 22px;
  }

  .title {
    font-size: 20px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .blob, .ring, .loader-core, .emblem-glow, .emblem-check, .step-dot i {
    animation: none !important;
  }
}
