:root {
  --bg: #f4f5f8;
  --card-bg: #ffffff;
  --blue: #3457f5;
  --blue-dark: #2843d6;
  --blue-light: #eef1ff;
  --blue-border: #c3ccfb;
  --blue-disabled: #c7d0fb;
  --text: #111827;
  --text-muted: #6b7280;
  --border: #e5e7eb;
  --error: #dc2626;
  --radius-lg: 20px;
  --radius-md: 12px;
  --shadow: 0 20px 40px -12px rgba(17, 24, 39, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 64px 20px 40px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
}

.brand-icon {
  width: 40px;
  height: 40px;
  border-radius: 11px;
  background: var(--blue);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  flex-shrink: 0;
}

.brand-text {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.brand-text span {
  color: var(--blue);
}

.card {
  width: 100%;
  max-width: 480px;
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 36px;
  position: relative;
  overflow: hidden;
}

.progress-segments {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 28px;
}

.seg {
  height: 6px;
  border-radius: 999px;
  background: var(--border);
  overflow: hidden;
}

.seg-fill {
  height: 100%;
  width: 0%;
  background: var(--blue);
  border-radius: 999px;
  transition: width 0.4s ease;
}

.seg.filled .seg-fill {
  width: 100%;
}

.step {
  animation: stepIn 0.28s ease;
}

.step[hidden] {
  display: none;
}

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

h1.step-title {
  font-size: 24px;
  font-weight: 800;
  text-align: center;
  margin: 0 0 8px;
  letter-spacing: -0.01em;
}

p.step-subtitle {
  font-size: 15px;
  color: var(--text-muted);
  text-align: center;
  margin: 0 0 24px;
  line-height: 1.4;
}

.options-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 20px;
}

.option-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 20px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  background: #fff;
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.1s ease, color 0.15s ease;
  font-family: inherit;
}

.option-btn svg {
  width: 26px;
  height: 26px;
  stroke: var(--text-muted);
  transition: stroke 0.15s ease;
}

.option-btn:hover {
  border-color: var(--blue-border);
  background: var(--blue-light);
}

.option-btn:active {
  transform: scale(0.98);
}

.option-btn.selected {
  border-color: var(--blue);
  background: var(--blue-light);
  color: var(--blue-dark);
}

.option-btn.selected svg {
  stroke: var(--blue);
}

.notice-box {
  font-size: 13px;
  line-height: 1.5;
  color: #9a6b00;
  background: #fff3d6;
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin: 4px 0 4px;
  text-align: center;
}

.field-label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text);
}

.zip-input {
  width: 100%;
  padding: 14px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 16px;
  font-family: inherit;
  color: var(--text);
  margin-bottom: 6px;
  transition: border-color 0.15s ease;
}

.zip-input:focus {
  outline: none;
  border-color: var(--blue);
}

.zip-input.invalid {
  border-color: var(--error);
}

.error-text {
  color: var(--error);
  font-size: 13px;
  margin: 4px 0 16px;
  min-height: 16px;
}

.btn-continue {
  width: 100%;
  padding: 15px;
  border: none;
  border-radius: var(--radius-md);
  background: var(--blue-disabled);
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  cursor: not-allowed;
  font-family: inherit;
  transition: background 0.15s ease, transform 0.1s ease;
  margin-top: 4px;
}

.btn-continue.enabled {
  background: var(--blue);
  cursor: pointer;
}

.btn-continue.enabled:hover {
  background: var(--blue-dark);
}

.btn-continue.enabled:active {
  transform: scale(0.99);
}

.btn-back {
  display: block;
  margin: 14px auto 0;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}

.btn-back:hover {
  color: var(--text);
}

/* Step 4 — matching / redirect */
.step-final {
  text-align: center;
  padding: 12px 0 4px;
}

.final-state[hidden] {
  display: none;
}

.spinner {
  width: 56px;
  height: 56px;
  margin: 0 auto 22px;
  border-radius: 50%;
  border: 4px solid var(--blue-light);
  border-top-color: var(--blue);
  animation: spin 0.85s linear infinite;
}

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

.redirect-dots {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  height: 18px;
  margin: 0 auto 22px;
}

.redirect-dots .dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--blue);
  opacity: 0;
  transform: scale(0.4);
}

.redirect-dots.run .dot {
  animation: dotPop 0.3s ease forwards;
}

.redirect-dots.run .dot:nth-child(1) {
  animation-delay: 0ms;
}

.redirect-dots.run .dot:nth-child(2) {
  animation-delay: 500ms;
}

.redirect-dots.run .dot:nth-child(3) {
  animation-delay: 1000ms;
}

.redirect-dots.run .dot:nth-child(4) {
  animation-delay: 1500ms;
}

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

.match-check {
  width: 56px;
  height: 56px;
  margin: 0 auto 22px;
  border-radius: 50%;
  background: var(--blue-light);
  display: flex;
  align-items: center;
  justify-content: center;
}

.match-check svg {
  width: 28px;
  height: 28px;
  stroke: var(--blue);
}

.disclaimer {
  max-width: 480px;
  text-align: center;
  color: #9ca3af;
  font-size: 12.5px;
  line-height: 1.6;
  margin-top: 24px;
}

.disclaimer .links {
  margin-top: 6px;
}

.disclaimer a {
  color: #9ca3af;
  text-decoration: underline;
}

.disclaimer a:hover {
  color: var(--text-muted);
}

@media (max-width: 420px) {
  .card {
    padding: 26px 20px;
  }
}
