/* ── Reset ────────────────────────────────────────────────── */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* ── Theme variables ─────────────────────────────────────── */
:root {
  --bg: #f4f4f8;
  --bg-card: #ffffff;
  --bg-card-border: #e0e0ea;
  --text: #1a1a2e;
  --text-muted: #2f2f32;
  --accent: #6c5ce7;
  --accent-glow: rgba(108, 92, 231, 0.18);
  --accent-subtle: rgba(108, 92, 231, 0.06);
  --accent-border: rgba(108, 92, 231, 0.12);
  --green: #10b981;
  --yellow: #f59e0b;
  --red: #ef4444;
  --btn-secondary-bg: #ededf5;
  --btn-secondary-border: #d4d4e2;
  --radius: 14px;
  --radius-btn: 12px;
}

/* ── Base ─────────────────────────────────────────────────── */
html {
  font-size: clamp(13.5px, 3.7vw, 16px);
  -webkit-text-size-adjust: 100%;
}

body {
  font-family:
    "Manrope",
    -apple-system,
    BlinkMacSystemFont,
    sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}

a {
  color: var(--accent);
  text-decoration: none;
}

/* ── Animations ──────────────────────────────────────────── */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid var(--bg-card-border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.spinner--lg {
  width: 32px;
  height: 32px;
  border-width: 3px;
  margin-bottom: 16px;
}

/* ── Wizard layout ───────────────────────────────────────── */
.wizard {
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
  padding: 20px 16px 40px;
}

.wizard-header {
  text-align: center;
  padding: 0 0 24px;
}

.wizard-header__name {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.wizard-header__tagline {
  font-size: 14px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ── Steps bar ───────────────────────────────────────────── */
.steps-bar {
  display: flex;
  gap: 6px;
  margin-bottom: 28px;
}

.steps-bar__dot {
  flex: 1;
  height: 3px;
  border-radius: 2px;
  background: var(--bg-card-border);
  transition: background 0.3s;
}

.steps-bar__dot.active {
  background: var(--accent);
}
.steps-bar__dot.done {
  background: var(--green);
}

/* ── Steps ───────────────────────────────────────────────── */
.step {
  animation: fadeIn 0.3s ease;
}

.step__title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 12px;
  letter-spacing: -0.3px;
}

.step__text {
  font-size: 15px;
  color: var(--text-muted);
  margin-bottom: 20px;
}

.step__center {
  text-align: center;
  padding: 20px 0;
}

.step__status {
  text-align: center;
  font-size: 14px;
  min-height: 24px;
  margin-top: 12px;
}

.step__status.error {
  color: var(--red);
}
.step__status.success {
  color: var(--green);
  font-weight: 600;
}

/* ── Captcha ─────────────────────────────────────────────── */
.captcha-wrap {
  display: flex;
  justify-content: center;
}

#captcha-canvas {
  border-radius: var(--radius);
  touch-action: none;
  cursor: grab;
  max-width: 100%;
}

#captcha-canvas:active {
  cursor: grabbing;
}

/* ── Device grid ─────────────────────────────────────────── */
.device-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 20px;
}

.device-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 24px 16px;
  background: var(--bg-card);
  border: 2px solid var(--bg-card-border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 16px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s;
}

.device-btn:hover {
  background: var(--btn-secondary-bg);
}
.device-btn:active {
  transform: scale(0.97);
}
.device-btn.selected {
  border-color: var(--accent);
  background: var(--accent-subtle);
}
.device-btn__icon {
  font-size: 36px;
}

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 14px 20px;
  border: none;
  border-radius: var(--radius-btn);
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition:
    transform 0.12s,
    opacity 0.12s;
  -webkit-tap-highlight-color: transparent;
}

.btn:active {
  transform: scale(0.97);
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn--primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 4px 20px var(--accent-glow);
}

.btn--secondary {
  background: var(--btn-secondary-bg);
  color: var(--text);
  border: 1px solid var(--btn-secondary-border);
}

.btn--success {
  background: var(--green);
  color: #fff;
}

.btn--outline {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
}

.btn__icon {
  font-size: 1.1rem;
  line-height: 1;
}

.wiz-btn {
  margin-bottom: 12px;
  font-size: 16px;
}

/* ── Alerts ──────────────────────────────────────────────── */
.alert {
  padding: 14px 16px;
  border-radius: var(--radius);
  font-size: 14px;
  margin-bottom: 16px;
}

.alert--success {
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.2);
  color: var(--green);
}

.alert--warning {
  background: rgba(251, 191, 36, 0.1);
  border: 1px solid rgba(251, 191, 36, 0.2);
  color: var(--yellow);
}

.alert--error {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.2);
  color: var(--red);
}

/* ── Info cards ──────────────────────────────────────────── */
.info-card {
  background: var(--bg-card);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
}

.info-card--telegram {
  border-color: var(--accent);
}

.info-card__title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.info-card__text {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 10px;
}

/* ── Verification code ───────────────────────────────────── */
.verification-code {
  text-align: center;
  font-size: 24px;
  font-weight: 700;
  font-family: "SF Mono", "Fira Code", monospace;
  letter-spacing: 3px;
  color: var(--accent);
  padding: 12px;
  margin-bottom: 12px;
  cursor: pointer;
  background: var(--accent-subtle);
  border-radius: var(--radius);
  transition: opacity 0.15s;
}

.verification-code:hover {
  opacity: 0.85;
}

/* ── Error page ──────────────────────────────────────────── */
.error-page {
  text-align: center;
  padding-top: 60px;
}

.error-page__icon {
  font-size: 48px;
  margin-bottom: 16px;
}
.error-page__title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 8px;
}
.error-page__text {
  color: var(--text-muted);
  font-size: 15px;
}

/* ── Email step ──────────────────────────────────────────── */
.email-form {
  margin-bottom: 16px;
}

.email-input {
  width: 100%;
  font-size: 16px;
  font-family: inherit;
  padding: 12px 14px;
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius);
  background: var(--bg-card);
  color: inherit;
  outline: none;
  transition:
    border-color 0.15s,
    box-shadow 0.15s;
  box-sizing: border-box;
}

.email-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.step__status--error {
  color: var(--red);
  font-size: 13px;
  margin-top: 6px;
  min-height: 1em;
}

/* ── Success step ────────────────────────────────────────── */
.success-icon {
  font-size: 64px;
  text-align: center;
  margin-bottom: 12px;
}

.cabinet-link {
  background: var(--bg-card);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cabinet-link__url {
  font-family: "SF Mono", "Fira Code", monospace;
  font-size: 13px;
  color: var(--text-muted);
  word-break: break-all;
  user-select: all;
}

.btn--small {
  font-size: 14px;
  padding: 8px 12px;
  align-self: flex-start;
}
