/* ─── Design tokens ────────────────────────────────────────────────────────── */
:root {
  --black:        #06080b;
  --surface:      #0b0e14;
  --surface-2:    #101419;
  --border:       #1c2030;
  --border-gold:  rgba(180, 140, 60, 0.25);
  --gold:         #c9a55a;
  --gold-bright:  #e0bc76;
  --gold-dim:     #8a6f38;
  --text:         #e8dfc8;
  --text-muted:   #7a6e5c;
  --text-muted-2: #3f3a30;
  --danger:       #c0392b;
  --danger-bg:    rgba(192,57,43, 0.12);
  --radius:       12px;
  --font:         'Inter', 'Segoe UI', system-ui, sans-serif;
}

/* ─── Reset ────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ─── Body / background ────────────────────────────────────────────────────── */
html, body {
  height: 100%;
  background: var(--black);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

/* Subtle grain texture layered over the background */
.bg-grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 200px 200px;
  opacity: 0.6;
}

/* Radial glow centred behind the card */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse 60% 50% at 50% 48%, rgba(180,140,60,.06) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

/* ─── Layout ────────────────────────────────────────────────────────────────── */
main {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}

/* ─── Card ──────────────────────────────────────────────────────────────────── */
.card {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--border-gold);
  border-radius: var(--radius);
  padding: 48px 40px 40px;
  box-shadow:
    0 0 0 1px rgba(180,140,60,.04),
    0 4px 6px  rgba(0,0,0,.4),
    0 24px 48px rgba(0,0,0,.5),
    inset 0 1px 0 rgba(200,165,90,.07);
  /* entrance animation */
  animation: card-in .35s cubic-bezier(.25,.46,.45,.94) both;
}

@keyframes card-in {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ─── Brand mark ─────────────────────────────────────────────────────────────── */
.brand {
  text-align: center;
  margin-bottom: 36px;
}

.brand-icon {
  width: 44px;
  height: 44px;
  color: var(--gold);
  margin: 0 auto 14px;
  display: block;
  opacity: .85;
}

.brand-label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .22em;
  color: var(--gold-dim);
  text-transform: uppercase;
  margin-bottom: 6px;
}

.brand-title {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: .01em;
  color: var(--text);
  line-height: 1.2;
}

/* ─── Step containers ────────────────────────────────────────────────────────── */
.step {
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.step.hidden { display: none; }

/* ─── Hints ──────────────────────────────────────────────────────────────────── */
.step-hint {
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.6;
}
.step-hint-sub {
  font-size: 11px;
  color: var(--text-muted-2);
  text-align: center;
  margin-top: -10px;
}
.gold { color: var(--gold); }

/* ─── Field ──────────────────────────────────────────────────────────────────── */
.field-wrap { display: flex; flex-direction: column; gap: 7px; }

.field-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.field-input {
  width: 100%;
  height: 46px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  padding: 0 14px;
  outline: none;
  transition: border-color .18s, box-shadow .18s;
}
.field-input::placeholder { color: var(--text-muted-2); }
.field-input:focus {
  border-color: var(--gold-dim);
  box-shadow: 0 0 0 3px rgba(180,140,60,.12);
}
.field-input.error {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px var(--danger-bg);
}

/* ─── Primary button ─────────────────────────────────────────────────────────── */
.btn-primary {
  position: relative;
  width: 100%;
  height: 48px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #0a0800;
  background: linear-gradient(135deg, #c9a55a 0%, #e0bc76 50%, #c9a55a 100%);
  background-size: 200% 100%;
  background-position: 100% 0;
  transition: background-position .35s ease, box-shadow .2s, opacity .15s;
  overflow: hidden;
}
.btn-primary:hover:not(:disabled) {
  background-position: 0% 0;
  box-shadow: 0 0 24px rgba(200,165,90,.3), 0 4px 12px rgba(0,0,0,.4);
}
.btn-primary:active:not(:disabled) { opacity: .85; }
.btn-primary:disabled {
  cursor: not-allowed;
  opacity: .55;
}

/* Loading state */
.btn-primary.loading .btn-text   { opacity: 0; }
.btn-primary.loading .btn-loader { opacity: 1; }
.btn-loader {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  opacity: 0;
  transition: opacity .15s;
}
.btn-loader span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #0a0800;
  animation: dot-pulse 1.2s ease-in-out infinite;
}
.btn-loader span:nth-child(2) { animation-delay: .18s; }
.btn-loader span:nth-child(3) { animation-delay: .36s; }
@keyframes dot-pulse {
  0%, 80%, 100% { transform: scale(.7); opacity: .4; }
  40%            { transform: scale(1);  opacity: 1; }
}

/* ─── Ghost button ────────────────────────────────────────────────────────────── */
.btn-ghost {
  background: none;
  border: none;
  color: var(--gold-dim);
  font-family: inherit;
  font-size: 12px;
  cursor: pointer;
  text-align: center;
  padding: 4px;
  transition: color .15s;
  align-self: center;
}
.btn-ghost:hover { color: var(--gold); }

/* ─── OTP boxes ──────────────────────────────────────────────────────────────── */
.otp-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.otp-dash {
  color: var(--border);
  font-size: 18px;
  line-height: 1;
  margin: 0 2px;
  user-select: none;
}

.otp-box {
  width: 50px;
  height: 58px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 24px;
  font-weight: 600;
  text-align: center;
  outline: none;
  caret-color: transparent;
  transition: border-color .15s, box-shadow .15s, background .15s;
  /* Remove spinner on number inputs */
  -moz-appearance: textfield;
}
.otp-box::-webkit-outer-spin-button,
.otp-box::-webkit-inner-spin-button { -webkit-appearance: none; }

.otp-box:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(200,165,90,.15), inset 0 1px 0 rgba(200,165,90,.08);
  background: #0f1219;
}

.otp-box.filled {
  border-color: var(--gold-dim);
  color: var(--gold-bright);
}

.otp-box.error {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px var(--danger-bg);
  animation: shake .35s ease;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%       { transform: translateX(-5px); }
  60%       { transform: translateX(5px); }
}

/* ─── Error message ──────────────────────────────────────────────────────────── */
.msg-error {
  font-size: 12px;
  color: var(--danger);
  text-align: center;
  line-height: 1.5;
  background: var(--danger-bg);
  border: 1px solid rgba(192,57,43,.2);
  border-radius: 6px;
  padding: 8px 12px;
  margin-top: -4px;
}
.msg-error.hidden { display: none; }
