/* ===== Auth page ===== */

:root {
  --au-bg: #060608;
  --au-card: rgba(14, 13, 16, 0.82);
  --au-line: rgba(255, 255, 255, 0.08);
  --au-line-strong: rgba(255, 255, 255, 0.14);
  --au-text: #f4f2f3;
  --au-dim: rgba(244, 242, 243, 0.56);
  --au-faint: rgba(244, 242, 243, 0.36);
  --au-accent: #ff4d4d;
  --au-accent-soft: rgba(255, 77, 77, 0.12);
  --au-ok: #34d399;
  --au-warn: #f5b942;
  --au-discord: #5865f2;
  --au-ease: cubic-bezier(0.22, 1, 0.36, 1);
}

*, *::before, *::after { box-sizing: border-box; }

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

body {
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--au-bg);
  color: var(--au-text);
  font-family: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased;
}

.au-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(700px 420px at 50% -120px, rgba(255, 77, 77, 0.22), transparent 70%),
    radial-gradient(520px 420px at 100% 100%, rgba(255, 77, 77, 0.07), transparent 70%),
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px) 0 0 / 100% 44px,
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px) 0 0 / 44px 100%;
  -webkit-mask-image: radial-gradient(ellipse 90% 70% at 50% 20%, #000 40%, transparent 100%);
          mask-image: radial-gradient(ellipse 90% 70% at 50% 20%, #000 40%, transparent 100%);
}

.au-shell {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: max(24px, env(safe-area-inset-top)) 16px max(28px, env(safe-area-inset-bottom));
}

.au-back {
  align-self: center;
  width: min(100%, 440px);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--au-dim);
  text-decoration: none;
  transition: color 0.2s ease;
}
.au-back:hover { color: var(--au-text); }

/* ---- Card ---- */
.au-card {
  position: relative;
  width: min(100%, 440px);
  padding: 32px 28px 28px;
  border-radius: 24px;
  background: var(--au-card);
  border: 1px solid var(--au-line);
  box-shadow: 0 40px 100px -30px rgba(0, 0, 0, 0.85), inset 0 1px 0 rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  animation: auIn 0.6s var(--au-ease) both;
}

.au-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 24px;
  right: 24px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 77, 77, 0.6), transparent);
}

@keyframes auIn {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}

.au-head { text-align: center; }

.au-logo {
  width: 56px;
  height: 56px;
  margin: 0 auto 18px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: #120d10;
  border: 1px solid rgba(255, 77, 77, 0.28);
  box-shadow: 0 0 34px -8px rgba(255, 77, 77, 0.6);
}
.au-logo img { width: 36px; height: 36px; }

.au-title { margin: 0; font-size: 24px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.2; }
.au-sub { margin: 8px 0 0; font-size: 14px; line-height: 1.55; color: var(--au-dim); }

/* ---- Progress ---- */
.au-steps {
  list-style: none;
  margin: 24px 0 22px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.au-steps-item { display: flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 700; color: var(--au-faint); transition: color 0.3s ease; }

.au-steps-num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 12px;
  border: 1px solid var(--au-line-strong);
  background: rgba(255, 255, 255, 0.03);
  transition: background 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}

.au-steps-item.is-current { color: var(--au-text); }
.au-steps-item.is-current .au-steps-num { background: var(--au-accent); border-color: var(--au-accent); color: #fff; box-shadow: 0 0 0 4px var(--au-accent-soft); }
.au-steps-item.is-done { color: var(--au-dim); }
.au-steps-item.is-done .au-steps-num { background: rgba(52, 211, 153, 0.14); border-color: rgba(52, 211, 153, 0.4); color: var(--au-ok); font-size: 0; }
.au-steps-item.is-done .au-steps-num::before { content: '✓'; font-size: 12px; }

.au-steps-line { width: 40px; height: 1px; background: var(--au-line-strong); }

/* ---- Alert ---- */
.au-alert {
  --tone: var(--au-accent);
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 18px;
  padding: 12px 14px;
  border-radius: 14px;
  background: color-mix(in srgb, var(--tone) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--tone) 30%, transparent);
  animation: auIn 0.4s var(--au-ease) both;
}
.au-alert[hidden] { display: none; }
.au-alert.is-ok   { --tone: var(--au-ok); }
.au-alert.is-warn { --tone: var(--au-warn); }

.au-alert-icon {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--tone);
  color: #0b0b0d;
  font-size: 13px;
  font-weight: 800;
}
.au-alert-icon::before { content: '!'; }
.au-alert.is-ok .au-alert-icon::before { content: '✓'; }

.au-alert-body { display: grid; gap: 2px; min-width: 0; }
.au-alert-title { font-size: 13.5px; font-weight: 700; color: var(--au-text); }
.au-alert-text { font-size: 13px; line-height: 1.5; color: var(--au-dim); overflow-wrap: anywhere; }

/* ---- Steps ---- */
.au-step { display: flex; flex-direction: column; gap: 16px; margin: 0; animation: auIn 0.45s var(--au-ease) both; }
.au-step[hidden] { display: none; }

.au-field { display: flex; flex-direction: column; gap: 8px; }
.au-label { font-size: 12px; font-weight: 700; letter-spacing: 0.04em; color: var(--au-dim); }

.au-input {
  position: relative;
  display: flex;
  align-items: center;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--au-line-strong);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}
.au-input:focus-within { border-color: var(--au-accent); box-shadow: 0 0 0 4px var(--au-accent-soft); background: rgba(255, 255, 255, 0.045); }
.au-input.is-valid { border-color: rgba(52, 211, 153, 0.55); }
.au-input.is-valid:focus-within { box-shadow: 0 0 0 4px rgba(52, 211, 153, 0.12); }
.au-input.is-invalid { border-color: var(--au-accent); animation: auShake 0.38s ease; }

@keyframes auShake {
  20%, 60% { transform: translateX(-5px); }
  40%, 80% { transform: translateX(5px); }
}

.au-input-icon { flex-shrink: 0; margin-left: 15px; color: var(--au-faint); transition: color 0.2s ease; }
.au-input:focus-within .au-input-icon { color: var(--au-accent); }

.au-input input {
  flex: 1;
  min-width: 0;
  height: 54px;
  padding: 0 12px;
  border: 0;
  background: transparent;
  color: var(--au-text);
  font-family: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  font-size: 16px; /* 16px stops iOS zooming in */
  font-weight: 600;
  letter-spacing: 0.06em;
  outline: none;
}
.au-input input::placeholder { color: rgba(244, 242, 243, 0.24); letter-spacing: 0.06em; }

.au-paste {
  flex-shrink: 0;
  margin-right: 8px;
  padding: 7px 11px;
  border-radius: 9px;
  border: 1px solid var(--au-line-strong);
  background: rgba(255, 255, 255, 0.04);
  color: var(--au-dim);
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}
.au-paste:hover { background: rgba(255, 255, 255, 0.08); color: var(--au-text); }

.au-input-ok { display: none; flex-shrink: 0; margin-right: 14px; color: var(--au-ok); }
.au-input.is-valid .au-input-ok { display: block; }
.au-input.has-value .au-paste { display: none; }

.au-hint { margin: 0; font-size: 12.5px; line-height: 1.5; color: var(--au-faint); }
.au-hint.is-error { color: #ff8a8a; }

/* ---- Buttons ---- */
.au-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 52px;
  padding: 0 20px;
  border: 0;
  border-radius: 14px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.15s ease, filter 0.2s ease, box-shadow 0.25s ease, background 0.2s ease, opacity 0.2s ease;
}
.au-btn:active:not(:disabled) { transform: scale(0.985); }
.au-btn:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.au-btn:disabled { cursor: not-allowed; opacity: 0.45; }

.au-btn--primary { background: var(--au-accent); box-shadow: 0 12px 30px -12px rgba(255, 77, 77, 0.8); }
.au-btn--primary:hover:not(:disabled) { filter: brightness(1.07); box-shadow: 0 16px 36px -12px rgba(255, 77, 77, 0.9); }

.au-btn--discord { background: var(--au-discord); box-shadow: 0 12px 30px -12px rgba(88, 101, 242, 0.85); }
.au-btn--discord:hover:not(:disabled) { filter: brightness(1.08); }

.au-btn--ghost {
  min-height: 44px;
  background: transparent;
  border: 1px solid var(--au-line-strong);
  color: var(--au-dim);
  font-size: 13.5px;
}
.au-btn--ghost:hover { background: rgba(255, 255, 255, 0.04); color: var(--au-text); }

/* loading state: spinner replaces the icon, label stays */
.au-spinner {
  display: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  animation: auSpin 0.7s linear infinite;
}
.au-btn.is-loading { cursor: progress; opacity: 1; }
.au-btn.is-loading .au-spinner { display: block; }
.au-btn.is-loading .au-btn-icon { display: none; }
.au-spinner--lg { display: block; width: 30px; height: 30px; border-width: 3px; border-color: rgba(255, 77, 77, 0.25); border-top-color: var(--au-accent); }

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

.au-foot-text { margin: 2px 0 0; text-align: center; font-size: 13px; color: var(--au-faint); }
.au-fine { margin: -4px 0 0; text-align: center; font-size: 12px; line-height: 1.5; color: var(--au-faint); }

.au-link { color: #ff7a7a; font-weight: 700; text-decoration: none; }
.au-link:hover { text-decoration: underline; }

/* ---- License summary ---- */
.au-license {
  position: relative;
  overflow: hidden;
  padding: 18px 18px 16px;
  border-radius: 16px;
  background:
    radial-gradient(120% 120% at 0% 0%, rgba(255, 77, 77, 0.14), transparent 60%),
    rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 77, 77, 0.22);
}

.au-license-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.au-license-plan { font-size: 12px; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; color: #ff9a9a; }

.au-chip {
  --tone: var(--au-ok);
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--tone);
  background: color-mix(in srgb, var(--tone) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--tone) 32%, transparent);
  white-space: nowrap;
}
.au-chip.is-warn { --tone: var(--au-warn); }

.au-license-time { margin-top: 10px; font-size: 30px; font-weight: 800; letter-spacing: -0.03em; line-height: 1.1; }
.au-license-meta { margin-top: 4px; font-size: 13px; color: var(--au-dim); }
.au-license-key {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px dashed var(--au-line-strong);
  font-family: 'JetBrains Mono', ui-monospace, Menlo, Consolas, monospace;
  font-size: 13px;
  letter-spacing: 0.08em;
  color: var(--au-faint);
}

/* ---- Finish ---- */
.au-finish { align-items: center; text-align: center; gap: 10px; padding: 8px 0 4px; }
.au-finish-icon {
  width: 64px;
  height: 64px;
  margin-bottom: 6px;
  border-radius: 20px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--au-line);
}
.au-finish-icon.is-ok { background: rgba(52, 211, 153, 0.12); border-color: rgba(52, 211, 153, 0.35); color: var(--au-ok); }
.au-finish-icon.is-error { background: var(--au-accent-soft); border-color: rgba(255, 77, 77, 0.35); color: var(--au-accent); }
.au-finish-icon svg { animation: auPop 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) both; }

@keyframes auPop { from { transform: scale(0.4); opacity: 0; } to { transform: none; opacity: 1; } }

.au-finish-title { margin: 0; font-size: 20px; font-weight: 800; }
.au-finish-text { margin: 0; font-size: 14px; line-height: 1.55; color: var(--au-dim); max-width: 320px; }
.au-finish-actions { width: 100%; margin-top: 10px; display: grid; gap: 10px; }
.au-finish-actions[hidden] { display: none; }

.au-help { margin: 0; font-size: 13px; color: var(--au-faint); text-align: center; }

/* ---- Phones ---- */
@media (max-width: 480px) {
  .au-shell { justify-content: flex-start; padding-top: max(16px, env(safe-area-inset-top)); }
  .au-card { padding: 26px 20px 22px; border-radius: 20px; }
  .au-title { font-size: 21px; }
  .au-steps { margin: 20px 0 18px; }
  .au-steps-line { width: 28px; }
  .au-license-time { font-size: 26px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
  .au-spinner, .au-spinner--lg { animation: auSpin 1.2s linear infinite !important; }
}
