*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg: #0a0a14;
  --bg-layer: #0e0e1c;
  --card-bg: #212121;
  --card-border: rgba(255,255,255,0.08);
  --text: #e0e0e0;
  --text-muted: #8888a0;
  --accent-start: #f857a6;
  --accent-end: #ff5858;
  --avatar-start: #f857a6;
  --avatar-end: #ff5858;
  --input-bg: #1a1a1a;
  --input-border: #333;
  --input-focus: #f857a6;
  --radius: 16px;
  --font: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

html, body {
  height: 100%;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
}

/* ========== Layered Background (matches MAX website) ========== */
.bg-pattern {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.bg-pattern::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 50% at 50% 0%, rgba(40, 30, 80, 0.7) 0%, transparent 60%),
    radial-gradient(ellipse 60% 40% at 30% 20%, rgba(20, 20, 60, 0.5) 0%, transparent 50%),
    var(--bg);
}

.bg-pattern::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url('pattern.svg');
  background-repeat: repeat;
  background-size: 280px 280px;
  opacity: 0.07;
}

/* ========== Header ========== */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
}

.header__logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  cursor: pointer;
}

.header__logo-icon {
  width: 32px;
  height: 32px;
  object-fit: contain;
}

.header__logo-text {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 2px;
  color: #fff;
}

.header__download {
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  text-decoration: none;
  padding: 10px 20px;
  border-radius: 12px;
  border: none;
  background: radial-gradient(136.12% 140.74% at 99.77% 99.04%, #8d28c8 0%, #7c42fa 20%, #007aff 80%, #609ceb 100%);
  transition: opacity 0.2s;
}

.header__download:hover {
  opacity: 0.9;
}

/* ========== Main Layout ========== */
.main {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 80px 16px 40px;
}

/* ========== Card ========== */
.card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 40px 36px 32px;
  width: 100%;
  max-width: 420px;
  text-align: center;
  position: absolute;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

/* Step transitions */
.step {
  opacity: 0;
  transform: translateY(24px) scale(0.97);
  pointer-events: none;
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.step.active {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* ========== Avatar ========== */
.card__avatar {
  width: 72px;
  height: 72px;
  margin: 0 auto 24px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--avatar-start), var(--avatar-end));
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 32px rgba(248, 87, 166, 0.35);
}

.card__avatar--success {
  background: linear-gradient(135deg, #00c853, #00e676);
  box-shadow: 0 8px 32px rgba(0, 200, 83, 0.35);
}

/* ========== Typography ========== */
.card__title {
  font-size: 20px;
  font-weight: 600;
  line-height: 1.35;
  margin-bottom: 10px;
  color: #fff;
}

.card__subtitle {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 28px;
  line-height: 1.5;
}

.card__terms {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 20px;
  line-height: 1.5;
}

.card__terms a {
  color: #6c9df7;
  text-decoration: none;
}

.card__terms a:hover {
  text-decoration: underline;
}

/* ========== Inputs ========== */
.input-label {
  display: block;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.input {
  width: 100%;
  padding: 14px 16px;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: 10px;
  color: #fff;
  font-size: 16px;
  font-family: var(--font);
  outline: none;
  transition: border-color 0.25s, box-shadow 0.25s;
}

.input::placeholder {
  color: #555570;
}

.input:focus {
  border-color: #6c5ce7;
  box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.2);
}

.input--code {
  text-align: center;
  font-size: 24px;
  letter-spacing: 12px;
  font-weight: 600;
}

.input--error {
  border-color: #ef4444 !important;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.25) !important;
  animation: shake 0.35s ease;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}

.password-wrap {
  position: relative;
  margin-bottom: 0;
}

.password-wrap .input {
  padding-right: 48px;
}

.password-toggle {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  transition: color 0.2s;
}

.password-toggle:hover {
  color: #fff;
}

/* ========== Button ========== */
.btn {
  display: block;
  width: 100%;
  padding: 14px 24px;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.2s, opacity 0.2s;
  margin-top: 20px;
}

.btn--primary {
  background: radial-gradient(136.12% 140.74% at 99.77% 99.04%, #8d28c8 0%, #7c42fa 20%, #007aff 80%, #609ceb 100%);
  color: #fff;
  box-shadow: 0 6px 24px rgba(0, 122, 255, 0.3);
}

.btn--primary:hover {
  opacity: 0.9;
}

.btn--primary:active {
  transform: scale(0.97);
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.btn__text,
.btn__loader {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

/* ========== Spinner ========== */
.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.spinner--large {
  width: 36px;
  height: 36px;
  border-width: 3px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loader-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 20px 0;
  color: var(--text-muted);
}

/* ========== Hidden utility ========== */
.hidden {
  display: none !important;
}

/* ========== Responsive ========== */
@media (max-width: 480px) {
  .card {
    padding: 32px 20px 24px;
    border-radius: 12px;
  }
  .card__title {
    font-size: 18px;
  }
  .header__download {
    font-size: 11px;
    padding: 6px 12px;
  }
}
