.user-input-section {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2.25rem 1rem;
  overflow: hidden;
}

.user-input-section[hidden],
.user-input-section.hidden {
  display: none !important;
}

.input-container {
  width: min(680px, 100%);
  border-radius: 20px;
  border: 3px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.02);
  padding: 1.5rem;
  box-shadow: var(--shadow);
}

.wizard-form {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  position: relative;
  /* Keep all steps stacked in one cell. */
  grid-template-areas:
    "head"
    "step"
    "err"
    "act";
}

.wizard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  grid-area: head;
}

.wizard-form > .wizard-error {
  grid-area: err;
}

.wizard-form > .wizard-actions {
  grid-area: act;
}

.wizard-kicker,
.wizard-progress {
  margin: 0;
  color: var(--text-soft);
  font-size: 0.9rem;
}

.wizard-step {
  grid-area: step;
  min-height: 0;
  opacity: 0;
  visibility: hidden;
  transform: translateX(28px);
  pointer-events: none;
  /* Exiting steps hide immediately; only incoming step animates. */
  transition: none;
  width: 100%;
  position: relative;
  z-index: 0;
}

.wizard-step.is-active {
  opacity: 1;
  visibility: visible;
  transform: translateX(0);
  pointer-events: auto;
  transition: opacity 260ms ease, transform 260ms ease;
  z-index: 1;
  min-height: 156px;
}

.wizard-step:not(.is-active) {
  /* Remove inactive content from flow to prevent overlap/gaps. */
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  overflow: hidden;
  height: 0;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem 1.25rem;
}

.field-grid-single {
  grid-template-columns: 1fr;
}

.age-input-container,
.gender-select-container {
  display: grid;
  gap: 0.45rem;
}

.age-input-container label,
.gender-select-container label {
  color: var(--text-soft);
  font-size: 0.9rem;
}

.age-input,
.input-select {
  width: 100%;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.03);
  padding: 0.85rem 0.95rem;
  outline: none;
  transition: border-color 150ms ease, box-shadow 150ms ease;
  color: #f2f5ff;
}

.input-select {
  padding-right: 2.5rem;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, rgba(255, 255, 255, 0.75) 50%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.75) 50%, transparent 50%);
  background-position:
    calc(100% - 1rem) calc(50% - 2px),
    calc(100% - 0.7rem) calc(50% - 2px);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}

.input-select option {
  color: #0d0f16;
}

.age-input:focus,
.input-select:focus {
  border-color: rgba(223, 122, 254, 0.45);
  box-shadow: 0 0 0 3px rgba(223, 122, 254, 0.12);
}

.wizard-review h3 {
  margin: 0 0 0.5rem;
  font-size: clamp(1.15rem, 2vw, 1.35rem);
}

.wizard-review p {
  margin: 0;
  color: var(--text-soft);
}

.wizard-error {
  min-height: 1.25rem;
  margin: 0;
  color: #ff9ab5;
  font-size: 0.9rem;
}

.wizard-actions {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
}

.wizard-actions .btn {
  min-width: 140px;
}

.wizard-actions .btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}

/* `.btn { display: inline-flex }` in theme CSS overrides the UA `[hidden]` rule; enforce hide when JS sets hidden=true */
.wizard-actions .btn[hidden] {
  display: none !important;
}

@media (max-width: 700px) {
  .user-input-section {
    padding: 1.5rem 0.75rem;
  }

  .input-container {
    padding: 1rem;
  }

  .wizard-step.is-active {
    min-height: 180px;
  }

  .field-grid {
    grid-template-columns: 1fr;
    gap: 0.85rem;
  }

  .wizard-actions {
    flex-direction: column;
  }

  .wizard-actions .btn {
    width: 100%;
    min-width: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .wizard-step,
  .wizard-step.is-active {
    transition: none;
  }
}
