:root {
  /* Design Tokens */
  --color-bg: #0a0f1e;
  --color-surface: #111827;
  --color-surface-2: #1a2235;
  --color-border: rgba(255, 255, 255, 0.08);
  --color-primary: #3b82f6;
  --color-primary-hover: #2563eb;
  --color-accent: #10b981;
  --color-danger: #ef4444;
  --color-text: #f1f5f9;
  --color-text-muted: #94a3b8;
  --color-text-subtle: #64748b;

  /* Typography */
  --font-display: 'DM Sans', sans-serif;
  --font-body: 'Inter', sans-serif;

  /* Spacing & Borders */
  --radius: 20px;
  --radius-sm: 12px;
  --max-width: 620px;

  /* Animations */
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
  --duration: 350ms;
}

/* Reset & Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px 16px 80px;
  overflow-x: hidden;
  position: relative;
}

/* Ambient Background Glows */
.bg-glow {
  position: fixed;
  width: 500px;
  height: 500px;
  border-radius: 50%;
  filter: blur(120px);
  z-index: -1;
  opacity: 0.12;
  pointer-events: none;
}
.bg-glow-1 {
  background: var(--color-primary);
  top: -10%;
  left: -10%;
}
.bg-glow-2 {
  background: var(--color-accent);
  bottom: -10%;
  right: -10%;
}

/* Page Shell Layout */
.page-wrapper {
  width: 100%;
  max-width: var(--max-width);
  display: flex;
  flex-direction: column;
  gap: 0;
  z-index: 1;
}

/* Premium Header */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  margin: 10px auto 30px;
  padding: 0 4px;
}
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
}
.logo-icon {
  font-size: 24px;
  user-select: none;
}
.logo-text {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 20px;
  letter-spacing: -0.02em;
  color: var(--color-text);
  background: linear-gradient(135deg, #fff, var(--color-text-muted));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.header-tag {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  background: rgba(59, 130, 246, 0.1);
  color: var(--color-primary);
  padding: 4px 12px;
  border-radius: 99px;
  border: 1px solid rgba(59, 130, 246, 0.15);
}

/* Progress Bar */
.progress-bar {
  height: 6px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 99px;
  margin-bottom: 40px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.05);
  position: relative;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--color-primary), var(--color-accent));
  border-radius: 99px;
  width: 0%;
  transition: width var(--duration) var(--ease-smooth);
  box-shadow: 0 0 12px rgba(59, 130, 246, 0.4);
}

/* Quiz Container */
.quiz-container {
  width: 100%;
}

/* Premium Glassmorphism Step Card */
.step-card {
  background: rgba(17, 24, 39, 0.7);
  backdrop-filter: blur(16px) saturate(120%);
  -webkit-backdrop-filter: blur(16px) saturate(120%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius);
  padding: 44px 40px;
  display: none;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  animation: slideUp var(--duration) var(--ease-spring) both;
}
.step-card.active {
  display: block;
}

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

/* Step Label */
.step-label {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-primary);
  margin-bottom: 14px;
  background: rgba(59, 130, 246, 0.08);
  padding: 3px 8px;
  border-radius: 4px;
  border: 1px solid rgba(59, 130, 246, 0.15);
}

/* Headings */
.step-title {
  font-family: var(--font-display);
  font-size: clamp(22px, 5vw, 28px);
  font-weight: 700;
  line-height: 1.25;
  margin-bottom: 10px;
  letter-spacing: -0.01em;
}
.step-subtitle {
  font-size: 15px;
  color: var(--color-text-muted);
  line-height: 1.6;
  margin-bottom: 28px;
}

/* Form Fields & Styling */
.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 24px;
}
.field label {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text-muted);
  letter-spacing: 0.01em;
}
.field input {
  background: rgba(26, 34, 53, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: 15px;
  padding: 14px 16px;
  width: 100%;
  outline: none;
  transition: all var(--duration) var(--ease-smooth);
}
.field input:focus {
  border-color: var(--color-primary);
  background: rgba(26, 34, 53, 0.9);
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.15), 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Phone Input Row */
.phone-row {
  display: flex;
  align-items: center;
  background: rgba(26, 34, 53, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
  padding: 4px 16px;
  gap: 12px;
  width: 100%;
  transition: all var(--duration) var(--ease-smooth);
}
.phone-row:focus-within {
  border-color: var(--color-primary);
  background: rgba(26, 34, 53, 0.9);
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.15), 0 4px 12px rgba(0, 0, 0, 0.2);
}
.phone-flag {
  font-size: 22px;
  cursor: default;
  user-select: none;
}
.phone-prefix {
  font-size: 15px;
  font-weight: 600;
  color: var(--color-text-muted);
  user-select: none;
}
.phone-row input {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  padding: 10px 0 !important;
  width: 100%;
  outline: none;
  font-size: 15px;
  color: var(--color-text);
}

/* Option Cards (Grid Layout) */
.option-grid {
  display: grid;
  gap: 12px;
  margin-bottom: 24px;
}
.option-grid.cols-3 {
  grid-template-columns: repeat(3, 1fr);
}
.option-grid.cols-2 {
  grid-template-columns: repeat(2, 1fr);
}

.option-card {
  background: rgba(26, 34, 53, 0.4);
  border: 2px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-sm);
  padding: 18px 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 14px;
  transition: all var(--duration) var(--ease-smooth);
  user-select: none;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}
.option-card:hover {
  border-color: rgba(59, 130, 246, 0.4);
  background: rgba(59, 130, 246, 0.04);
  transform: translateY(-2px);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
}
.option-card:active {
  transform: translateY(0);
}
.option-card.selected {
  border-color: var(--color-primary);
  background: rgba(59, 130, 246, 0.08);
  box-shadow: 0 0 0 1px var(--color-primary), 0 8px 20px rgba(59, 130, 246, 0.1);
}
.option-card .icon {
  font-size: 28px;
  flex-shrink: 0;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1));
}
.option-card .label-text {
  font-size: 15px;
  font-weight: 600;
  color: var(--color-text);
}
.option-card .label-sub {
  font-size: 13px;
  color: var(--color-text-muted);
  margin-top: 3px;
  line-height: 1.4;
}

/* Benefits Grid (Step 0) */
.benefits-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 28px;
}
.benefit-card {
  background: rgba(26, 34, 53, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: var(--radius-sm);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: border-color var(--duration) var(--ease-smooth);
}
.benefit-card:hover {
  border-color: rgba(255, 255, 255, 0.08);
}
.benefit-icon {
  font-size: 24px;
  margin-bottom: 2px;
}
.benefit-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text);
}
.benefit-desc {
  font-size: 12px;
  color: var(--color-text-muted);
  line-height: 1.4;
}

/* Info Block */
.info-block {
  background: rgba(59, 130, 246, 0.06);
  border: 1px solid rgba(59, 130, 246, 0.15);
  border-radius: var(--radius-sm);
  padding: 18px 20px;
  font-size: 14.5px;
  color: var(--color-text-muted);
  line-height: 1.6;
  margin-bottom: 24px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.02);
}
.info-block strong {
  color: var(--color-text);
  font-weight: 600;
}

/* Typing Animation Box (Step 4) */
.typing-demo {
  background: rgba(10, 15, 30, 0.5);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 18px;
  margin-bottom: 28px;
  font-family: 'Courier New', Courier, monospace;
  font-size: 15px;
  color: var(--color-accent);
  min-height: 58px;
  display: flex;
  align-items: center;
  gap: 4px;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
}
.typing-cursor {
  display: inline-block;
  width: 2px;
  height: 17px;
  background: var(--color-accent);
  animation: blink 1s step-end infinite;
}
@keyframes blink {
  50% { opacity: 0; }
}

/* Inline Validation Error Messages */
.error-msg {
  color: var(--color-danger);
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 16px;
  display: none;
  align-items: center;
  gap: 8px;
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.15);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  animation: fadeIn var(--duration) ease;
}
.error-msg::before {
  content: "⚠️";
  font-size: 15px;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Primary Action Buttons */
.btn-primary {
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-hover));
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
  padding: 16px 32px;
  width: 100%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all var(--duration) var(--ease-smooth);
  margin-top: 8px;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}
.btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, var(--color-primary-hover), #1d4ed8);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(59, 130, 246, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}
.btn-primary:active {
  transform: translateY(0);
}
.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

/* Loading Spinner */
.spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: #fff;
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Un-dismissible Rejection Modal */
.rejection-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 7, 15, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 1000;
  animation: modalFadeIn 250ms ease both;
}
@keyframes modalFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
.rejection-card {
  background: rgba(17, 24, 39, 0.95);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: var(--radius);
  padding: 44px 36px;
  max-width: 480px;
  width: 100%;
  text-align: center;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(239, 68, 68, 0.1);
  animation: scaleIn 400ms var(--ease-spring) both;
}
@keyframes scaleIn {
  from { transform: scale(0.9); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
.rejection-icon {
  font-size: 56px;
  margin-bottom: 20px;
  filter: drop-shadow(0 4px 12px rgba(239, 68, 68, 0.3));
}
.rejection-title {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 14px;
  letter-spacing: -0.01em;
}
.rejection-text {
  font-size: 15px;
  color: var(--color-text-muted);
  line-height: 1.6;
}

/* Final Success Step */
.final-card {
  text-align: center;
}
.final-card .big-icon {
  font-size: 72px;
  margin-bottom: 24px;
  display: block;
  filter: drop-shadow(0 8px 16px rgba(59, 130, 246, 0.2));
}
.tg-button {
  background: linear-gradient(135deg, #229ED9, #1a8abf);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
  padding: 18px 32px;
  width: 100%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: all var(--duration) var(--ease-smooth);
  margin-top: 24px;
  text-decoration: none;
  box-shadow: 0 4px 12px rgba(34, 158, 217, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}
.tg-button:hover {
  background: linear-gradient(135deg, #1d8dbf, #1579a6);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(34, 158, 217, 0.5);
}
.tg-button:active {
  transform: translateY(0);
}

/* Custom Layout Fix for Last Window Option */
#win-grid .option-card:last-child {
  grid-column: span 2;
}

/* Responsive Queries */
@media (max-width: 580px) {
  .step-card {
    padding: 32px 20px;
  }
  .option-grid.cols-3,
  .option-grid.cols-2 {
    grid-template-columns: 1fr;
  }
  #win-grid .option-card:last-child {
    grid-column: span 1;
  }
  .benefits-grid {
    grid-template-columns: 1fr;
  }
  .progress-bar {
    margin-bottom: 28px;
  }
}
