:root {
  --bg: #0f1117;
  --card: #1a1d27;
  --card-border: rgba(255, 255, 255, 0.06);
  --text: #f0f0f5;
  --muted: #8b8fa3;
  --primary: #635bff;
  --primary-glow: rgba(99, 91, 255, 0.35);
  --primary-2: #7c75ff;
  --ok: #34d399;
  --ok-bg: rgba(52, 211, 153, 0.1);
  --err: #f87171;
  --err-bg: rgba(248, 113, 113, 0.1);
  --surface: #232633;
  --numpad-btn: #2a2d3a;
  --numpad-hover: #363a4a;
  --numpad-active: #4a4e60;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'SF Pro Display', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: url('/static/images/bg_bot.jpeg') center/cover no-repeat;
  z-index: 0;
}

body::after {
  content: '';
  position: fixed;
  inset: 0;
  background: rgba(15, 17, 23, 0.25);
  z-index: 0;
}

.wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  position: relative;
  z-index: 1;
}

/* ── Card ── */
.card {
  width: 100%;
  max-width: 400px;
  background: rgba(26, 29, 39, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  padding: 28px 24px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  animation: cardIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes cardIn {
  from { opacity: 0; transform: translateY(30px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.card.slide-out {
  animation: cardOut 0.3s cubic-bezier(0.4, 0, 1, 1) forwards;
}

@keyframes cardOut {
  to { opacity: 0; transform: translateY(-20px) scale(0.97); }
}

h1 {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 6px;
}

.sub {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
  margin-bottom: 24px;
}

.sub strong {
  color: var(--primary-2);
}

/* ── Icon header ── */
.icon-wrap {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  background: linear-gradient(135deg, var(--primary), #8b5cf6);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
  box-shadow: 0 8px 24px var(--primary-glow);
  animation: iconPulse 2s ease-in-out infinite;
}

@keyframes iconPulse {
  0%, 100% { box-shadow: 0 8px 24px var(--primary-glow); }
  50%      { box-shadow: 0 8px 36px rgba(99, 91, 255, 0.5); }
}

.icon-wrap svg {
  width: 30px;
  height: 30px;
  fill: #fff;
}

/* ── Buttons ── */
.btn {
  width: 100%;
  border: 0;
  border-radius: 14px;
  padding: 14px 16px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

.btn:active:enabled {
  transform: scale(0.97);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  color: #fff;
  background: linear-gradient(135deg, var(--primary), #8b5cf6);
  box-shadow: 0 4px 16px var(--primary-glow);
}

.btn-primary:hover:enabled {
  box-shadow: 0 6px 24px rgba(99, 91, 255, 0.5);
  transform: translateY(-1px);
}

/* ── OTP display ── */
.otp-display {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-bottom: 24px;
}

.otp-box {
  width: 48px;
  height: 56px;
  border-radius: 12px;
  background: var(--surface);
  border: 2px solid transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
  transition: all 0.15s ease;
}

.otp-box.active {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
  animation: boxPop 0.15s ease;
}

.otp-box.filled {
  border-color: rgba(99, 91, 255, 0.3);
}

@keyframes boxPop {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.08); }
  100% { transform: scale(1); }
}

.otp-cursor {
  width: 2px;
  height: 24px;
  background: var(--primary);
  border-radius: 1px;
  animation: blink 1s step-end infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0; }
}

/* ── Number Pad ── */
.numpad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}

.numpad-btn {
  height: 56px;
  border: 0;
  border-radius: 14px;
  background: var(--numpad-btn);
  color: var(--text);
  font-size: 1.3rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.12s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.numpad-btn:hover {
  background: var(--numpad-hover);
}

.numpad-btn:active {
  background: var(--numpad-active);
  transform: scale(0.93);
}

.numpad-btn.backspace {
  background: transparent;
}

.numpad-btn.backspace svg {
  width: 24px;
  height: 24px;
  fill: var(--muted);
  transition: fill 0.15s;
}

.numpad-btn.backspace:hover svg {
  fill: var(--err);
}

.numpad-btn.empty {
  visibility: hidden;
}

/* ── 2FA field ── */
.field {
  margin-bottom: 16px;
}

.field label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.85rem;
  color: var(--muted);
  font-weight: 500;
}

.field input {
  width: 100%;
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 0.95rem;
  color: var(--text);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.field input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

/* ── Status ── */
.status {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.05);
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.85rem;
  color: var(--muted);
  animation: fadeIn 0.3s ease;
}

.status.ok {
  color: var(--ok);
  background: var(--ok-bg);
  border-color: rgba(52, 211, 153, 0.2);
}

.status.err {
  color: var(--err);
  background: var(--err-bg);
  border-color: rgba(248, 113, 113, 0.2);
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Loader overlay ── */
.loader-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 17, 23, 0.75);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 100;
  animation: fadeIn 0.2s ease;
}

.loader-spinner {
  width: 48px;
  height: 48px;
  border: 3px solid rgba(99, 91, 255, 0.15);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin-bottom: 16px;
}

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

.loader-text {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 500;
}

/* ── Success screen ── */
.success-icon {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: linear-gradient(135deg, #10b981, #34d399);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
  box-shadow: 0 8px 24px rgba(16, 185, 129, 0.3);
  animation: successPop 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes successPop {
  0%   { transform: scale(0); opacity: 0; }
  60%  { transform: scale(1.15); }
  100% { transform: scale(1); opacity: 1; }
}

.success-icon svg {
  width: 36px;
  height: 36px;
  fill: none;
  stroke: #fff;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ── Age verification page ── */
.age-icon {
  font-size: 5rem;
  line-height: 1;
  margin: 0 auto 16px;
  filter: drop-shadow(0 4px 20px rgba(255, 50, 50, 0.4));
}

.btn-age {
  width: 100%;
  border: 0;
  border-radius: 14px;
  padding: 16px;
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  color: #fff;
  background: linear-gradient(135deg, #e879a8, #c957d2);
  box-shadow: 0 4px 20px rgba(201, 87, 210, 0.4);
  transition: all 0.2s ease;
}

.btn-age:hover:enabled {
  box-shadow: 0 6px 28px rgba(201, 87, 210, 0.55);
  transform: translateY(-1px);
}

.btn-age:active:enabled {
  transform: scale(0.97);
}

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

.hidden { display: none !important; }
