/* ============================================
   AM PREM BY DILZXY — Neo-Brutalism Design
   ============================================ */

:root {
  --primary: #2563EB;
  --primary-dark: #1D4ED8;
  --primary-light: #3B82F6;
  --secondary: #FFFFFF;
  --bg: #F1F5F9;
  --text: #111827;
  --text-muted: #6B7280;
  --border: #111827;
  --card-bg: #FFFFFF;
  --shadow: 4px 4px 0 #111827;
  --shadow-hover: 6px 6px 0 #111827;
  --shadow-pressed: 2px 2px 0 #111827;
  --radius: 14px;
  --radius-sm: 10px;
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --font: 'Inter', system-ui, -apple-system, sans-serif;
}

[data-theme="dark"] {
  --primary: #3B82F6;
  --primary-dark: #2563EB;
  --primary-light: #60A5FA;
  --secondary: #111827;
  --bg: #080D18;
  --text: #F9FAFB;
  --text-muted: #9CA3AF;
  --border: #E5E7EB;
  --card-bg: #111827;
  --shadow: 4px 4px 0 #E5E7EB;
  --shadow-hover: 6px 6px 0 #E5E7EB;
  --shadow-pressed: 2px 2px 0 #E5E7EB;
}

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

html {
  scroll-behavior: smooth;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  line-height: 1.5;
  overflow-x: hidden;
  transition: background var(--transition), color var(--transition);
}

/* Background Pattern */
.bg-pattern {
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image:
    radial-gradient(circle at 20% 30%, rgba(37, 99, 235, 0.06) 0%, transparent 50%),
    radial-gradient(circle at 80% 70%, rgba(37, 99, 235, 0.05) 0%, transparent 45%);
  pointer-events: none;
}

[data-theme="dark"] .bg-pattern {
  background-image:
    radial-gradient(circle at 20% 30%, rgba(59, 130, 246, 0.08) 0%, transparent 50%),
    radial-gradient(circle at 80% 70%, rgba(59, 130, 246, 0.06) 0%, transparent 45%);
}

/* Theme Toggle */
.theme-toggle {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 100;
  width: 48px;
  height: 48px;
  border: 3px solid var(--border);
  border-radius: 12px;
  background: var(--card-bg);
  box-shadow: var(--shadow);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  transition: transform var(--transition), box-shadow var(--transition);
}

.theme-toggle:hover {
  transform: translate(-2px, -2px);
  box-shadow: var(--shadow-hover);
}

.theme-toggle:active {
  transform: translate(1px, 1px);
  box-shadow: var(--shadow-pressed);
}

.theme-toggle .icon-moon { display: none; }
[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
[data-theme="dark"] .theme-toggle .icon-moon { display: inline; }

/* Container */
.container {
  max-width: 440px;
  margin: 0 auto;
  padding: 24px 16px 48px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

/* Header */
.header {
  text-align: center;
  padding-top: 12px;
}

.logo-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  background: var(--primary);
  color: #fff;
  font-weight: 800;
  font-size: 1.5rem;
  border: 3px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  margin-bottom: 14px;
  letter-spacing: -0.5px;
}

.header h1 {
  font-size: 1.55rem;
  font-weight: 800;
  letter-spacing: -0.4px;
  line-height: 1.2;
  margin-bottom: 4px;
}

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

/* Limit Badge */
.limit-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: var(--card-bg);
  border: 3px solid var(--border);
  border-radius: 999px;
  box-shadow: 3px 3px 0 var(--border);
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 0.3px;
}

.limit-badge.warning {
  background: #FEF3C7;
  border-color: #D97706;
  color: #92400E;
  box-shadow: 3px 3px 0 #D97706;
}

[data-theme="dark"] .limit-badge.warning {
  background: #78350F;
  border-color: #FBBF24;
  color: #FEF3C7;
  box-shadow: 3px 3px 0 #FBBF24;
}

.limit-badge.exhausted {
  background: #FEE2E2;
  border-color: #DC2626;
  color: #991B1B;
  box-shadow: 3px 3px 0 #DC2626;
}

[data-theme="dark"] .limit-badge.exhausted {
  background: #7F1D1D;
  border-color: #F87171;
  color: #FECACA;
  box-shadow: 3px 3px 0 #F87171;
}

/* Card */
.card {
  width: 100%;
  background: var(--card-bg);
  border: 3px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px 22px;
  transition: background var(--transition), border-color var(--transition), box-shadow var(--transition);
}

/* Stages */
.stage {
  display: none;
  animation: fadeIn 0.35s ease;
}

.stage.active {
  display: block;
}

.stage-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.stage-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: var(--primary);
  color: #fff;
  font-weight: 800;
  font-size: 1rem;
  border: 2.5px solid var(--border);
  border-radius: 10px;
  flex-shrink: 0;
}

.stage-header h2 {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.stage-desc {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 22px;
  line-height: 1.55;
}

/* Form */
.form-group {
  margin-bottom: 18px;
}

.form-group label {
  display: block;
  font-weight: 600;
  font-size: 0.875rem;
  margin-bottom: 6px;
}

.form-group input {
  width: 100%;
  padding: 14px 16px;
  font-family: var(--font);
  font-size: 1rem;
  font-weight: 500;
  color: var(--text);
  background: var(--bg);
  border: 3px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.form-group input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}

.form-group input::placeholder {
  color: var(--text-muted);
  opacity: 0.7;
}

.form-group input.error {
  border-color: #DC2626;
}

.error-text {
  display: block;
  color: #DC2626;
  font-size: 0.8rem;
  font-weight: 600;
  margin-top: 6px;
}

[data-theme="dark"] .error-text {
  color: #F87171;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 15px 20px;
  font-family: var(--font);
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.4px;
  border: 3px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.2s ease;
  position: relative;
  overflow: hidden;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: var(--shadow-pressed) !important;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: var(--shadow);
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-dark);
  transform: translate(-2px, -2px);
  box-shadow: var(--shadow-hover);
}

.btn-primary:active:not(:disabled) {
  transform: translate(1px, 1px);
  box-shadow: var(--shadow-pressed);
}

.btn-secondary {
  background: var(--card-bg);
  color: var(--text);
  box-shadow: var(--shadow);
  margin-top: 12px;
}

.btn-secondary:hover:not(:disabled) {
  transform: translate(-2px, -2px);
  box-shadow: var(--shadow-hover);
}

.btn-secondary:active:not(:disabled) {
  transform: translate(1px, 1px);
  box-shadow: var(--shadow-pressed);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border-color: transparent;
  box-shadow: none;
  margin-top: 8px;
  font-weight: 600;
}

.btn-ghost:hover:not(:disabled) {
  color: var(--text);
  background: rgba(0,0,0,0.04);
}

[data-theme="dark"] .btn-ghost:hover:not(:disabled) {
  background: rgba(255,255,255,0.06);
}

/* Spinner */
.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

.btn-loader {
  display: inline-flex;
  align-items: center;
}

/* Verification Status */
.verify-status {
  text-align: center;
  padding: 24px 12px;
  margin-bottom: 8px;
}

.status-icon {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 72px;
  font-size: 2rem;
  margin-bottom: 16px;
}

.status-icon.waiting .pulse-ring {
  position: absolute;
  inset: 0;
  border: 3px solid var(--primary);
  border-radius: 50%;
  animation: pulse 1.6s ease-out infinite;
}

@keyframes pulse {
  0% { transform: scale(0.85); opacity: 0.8; }
  100% { transform: scale(1.35); opacity: 0; }
}

#verifyMessage {
  font-weight: 700;
  font-size: 1.05rem;
  margin-bottom: 8px;
}

.hint {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.5;
  max-width: 280px;
  margin: 0 auto;
}

/* Success */
.success-content {
  text-align: center;
  padding: 12px 0 8px;
}

.check-icon {
  width: 80px;
  height: 80px;
  margin: 0 auto 20px;
}

.checkmark {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  display: block;
  stroke-width: 3;
  stroke: #22C55E;
  stroke-miterlimit: 10;
  box-shadow: inset 0 0 0 #22C55E;
  animation: fill 0.4s ease-in-out 0.4s forwards, scale 0.3s ease-in-out 0.9s both;
}

.checkmark-circle {
  stroke-dasharray: 166;
  stroke-dashoffset: 166;
  stroke-width: 3;
  stroke-miterlimit: 10;
  stroke: #22C55E;
  fill: none;
  animation: stroke 0.6s cubic-bezier(0.65, 0, 0.45, 1) forwards;
}

.checkmark-check {
  transform-origin: 50% 50%;
  stroke-dasharray: 48;
  stroke-dashoffset: 48;
  stroke-width: 3.5;
  animation: stroke 0.3s cubic-bezier(0.65, 0, 0.45, 1) 0.8s forwards;
}

@keyframes stroke {
  100% { stroke-dashoffset: 0; }
}

@keyframes scale {
  0%, 100% { transform: none; }
  50% { transform: scale3d(1.1, 1.1, 1); }
}

@keyframes fill {
  100% { box-shadow: inset 0 0 0 40px transparent; }
}

.success-title {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.4px;
  margin-bottom: 8px;
  line-height: 1.3;
}

.success-desc {
  color: var(--text-muted);
  font-size: 0.92rem;
  margin-bottom: 16px;
}

.success-email {
  display: inline-block;
  padding: 8px 16px;
  background: var(--bg);
  border: 2.5px solid var(--border);
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.88rem;
  word-break: break-all;
}

/* Developer Button */
.dev-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 28px;
  background: var(--card-bg);
  color: var(--text);
  font-family: var(--font);
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.5px;
  text-decoration: none;
  border: 3px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.2s ease;
}

.dev-btn:hover {
  transform: translate(-2px, -2px);
  box-shadow: var(--shadow-hover);
  background: #0088cc;
  color: #fff;
  border-color: #006699;
}

.dev-btn:active {
  transform: translate(1px, 1px);
  box-shadow: var(--shadow-pressed);
}

.tg-icon {
  flex-shrink: 0;
}

/* Footer */
.footer {
  text-align: center;
  padding-top: 8px;
  padding-bottom: 16px;
}

.footer .brand {
  font-weight: 800;
  font-size: 0.95rem;
  letter-spacing: 0.3px;
  margin-bottom: 4px;
}

.footer .made {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.footer .copy {
  font-size: 0.78rem;
  color: var(--text-muted);
  opacity: 0.8;
}

/* Toast */
.toast-container {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: min(360px, calc(100% - 32px));
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  padding: 14px 18px;
  background: var(--card-bg);
  color: var(--text);
  border: 3px solid var(--border);
  border-radius: 12px;
  box-shadow: 4px 4px 0 var(--border);
  font-weight: 600;
  font-size: 0.9rem;
  animation: toastIn 0.35s ease;
  display: flex;
  align-items: center;
  gap: 10px;
}

.toast.success { border-color: #16A34A; }
.toast.error { border-color: #DC2626; }
.toast.info { border-color: var(--primary); }

.toast.hiding {
  animation: toastOut 0.3s ease forwards;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(16px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes toastOut {
  to { opacity: 0; transform: translateY(12px) scale(0.95); }
}

/* Confetti */
.confetti-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 50;
}

/* Animations */
.fade-in {
  animation: fadeIn 0.5s ease both;
}

.slide-up {
  animation: slideUp 0.5s ease both;
}

.slide-up:nth-of-type(1) { animation-delay: 0.05s; }
.slide-up:nth-of-type(2) { animation-delay: 0.12s; }
.slide-up:nth-of-type(3) { animation-delay: 0.18s; }

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

/* Responsive */
@media (max-width: 400px) {
  .container {
    padding: 16px 12px 40px;
  }
  .card {
    padding: 22px 16px;
  }
  .header h1 {
    font-size: 1.35rem;
  }
  .logo-badge {
    width: 56px;
    height: 56px;
    font-size: 1.3rem;
  }
}

@media (min-width: 640px) {
  .container {
    max-width: 460px;
    padding-top: 36px;
  }
}

/* ========== Steps progress bar ========== */
.steps-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  width: 100%;
  padding: 4px 0 8px;
}

.step-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  opacity: 0.45;
  transition: opacity 0.25s ease;
}

.step-item.active,
.step-item.done {
  opacity: 1;
}

.step-dot {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2.5px solid var(--border);
  background: var(--card-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.85rem;
  box-shadow: 2px 2px 0 var(--border);
  transition: background 0.25s ease, color 0.25s ease;
}

.step-item.active .step-dot {
  background: var(--primary);
  color: #fff;
  border-color: var(--border);
}

.step-item.done .step-dot {
  background: #22C55E;
  color: #fff;
  border-color: var(--border);
}

.step-label {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.2px;
  text-align: center;
  max-width: 72px;
}

.step-line {
  width: 28px;
  height: 3px;
  background: var(--border);
  margin: 0 4px 18px;
  opacity: 0.35;
  border-radius: 2px;
  flex-shrink: 0;
}

/* Textarea (Magic Link) */
.form-group textarea {
  width: 100%;
  padding: 14px 16px;
  font-family: var(--font);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text);
  background: var(--bg);
  border: 3px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
  resize: vertical;
  min-height: 88px;
  transition: border-color var(--transition), box-shadow var(--transition);
  line-height: 1.45;
}

.form-group textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}

.form-group textarea::placeholder {
  color: var(--text-muted);
  opacity: 0.7;
}

.form-group textarea.error {
  border-color: #DC2626;
}
