/* ─── Scan failure dialog ──────────────────────────────────────────── */
.scan-failure-dialog {
  border: none;
  border-radius: 20px;
  background: #16112a;
  color: var(--text, #f3f4f6);
  padding: 0;
  max-width: 400px;
  width: calc(100% - 2rem);
  box-shadow:
    0 32px 80px rgba(0, 0, 0, 0.65),
    0 0 0 1px rgba(255, 255, 255, 0.07);
}

.scan-failure-dialog::backdrop {
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.scan-failure-dialog__inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 2.25rem 2rem 2rem;
  gap: 0.9rem;
}

.scan-failure-dialog__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: rgba(251, 146, 60, 0.12);
  color: #fb923c;
  border: 1px solid rgba(251, 146, 60, 0.22);
  flex-shrink: 0;
  margin-bottom: 0.25rem;
}

.scan-failure-dialog__title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text, #f3f4f6);
  margin: 0;
  line-height: 1.3;
}

.scan-failure-dialog__message {
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--text-soft, rgba(243, 248, 255, 0.7));
  margin: 0;
}

.scan-failure-dialog__btn {
  margin-top: 0.5rem;
  width: 100%;
  padding: 0.85rem 1.5rem;
  cursor: pointer;
}
/* ─────────────────────────────────────────────────────────────────── */

/* ─── Face scan info dialog — opened from the (i) button ───────────── */
.face-scan-info-dialog {
  border: none;
  border-radius: 20px;
  background: #16112a;
  color: var(--text, #f3f4f6);
  padding: 0;
  max-width: 420px;
  width: calc(100% - 2rem);
  box-shadow:
    0 32px 80px rgba(0, 0, 0, 0.65),
    0 0 0 1px rgba(255, 255, 255, 0.07);
}

.face-scan-info-dialog::backdrop {
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.face-scan-info-dialog__inner {
  position: relative;
  padding: 2rem 1.85rem 1.85rem;
}

.face-scan-info-dialog__close {
  position: absolute;
  top: 0.9rem;
  right: 0.9rem;
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text, #f3f4f6);
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  transition: background-color 150ms ease, border-color 150ms ease;
}

.face-scan-info-dialog__close:hover {
  border-color: rgba(76, 227, 255, 0.4);
  background: rgba(76, 227, 255, 0.1);
}

.face-scan-info-dialog__title {
  margin: 0 1.8rem 0.35rem 0;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text, #f3f4f6);
}

.face-scan-info-dialog__subtitle {
  margin: 0 0 1.1rem;
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--text-soft, rgba(243, 248, 255, 0.7));
}

.face-scan-info-dialog__subhead {
  margin: 0 0 0.6rem;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #8fe9ff;
}

.face-scan-info-dialog__list {
  margin: 0;
  padding-left: 1.15rem;
  color: var(--text-soft, rgba(243, 248, 255, 0.7));
  font-size: 0.9rem;
  line-height: 1.55;
}

.face-scan-info-dialog__list li + li {
  margin-top: 0.4rem;
}
/* ─────────────────────────────────────────────────────────────────── */

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

.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);
  overflow: visible;
}

/* Analyzing: drop the wizard outer card so only the progress card remains.
   Scoped to the active face-scan step so music / voice / results keep the
   normal wizard chrome (inactive steps can still contain a visible panel). */
.input-container:has(.wizard-step.is-active #panel-result:not(.hidden)) {
  border: none;
  background: transparent;
  box-shadow: none;
  padding: 0;
  width: min(420px, 100%);
}

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

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

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

.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;
  /* Allow the recording wheel to sit half above the camera frame. */
  overflow: visible;
}

.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: flex-end;
  gap: 0.75rem;
}

/* Music, voice, and results: center Continue / Done under the content. */
.wizard-form:has(.wizard-step[data-step="2"].is-active) .wizard-actions,
.wizard-form:has(.wizard-step[data-step="3"].is-active) .wizard-actions,
.wizard-form:has(.wizard-step[data-step="5"].is-active) .wizard-actions {
  justify-content: center;
}

.wizard-actions:has(.btn[hidden]:only-child),
.wizard-actions:not(:has(.btn:not([hidden]))) {
  display: none;
}

.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;
  }

  /* The camera is the primary interaction on scan steps. Reclaim the nested
     wizard padding so it remains large and usable on narrow phones. */
  .user-input-section:has(.wizard-step.is-active .app) {
    padding-left: max(0.375rem, env(safe-area-inset-left, 0px));
    padding-right: max(0.375rem, env(safe-area-inset-right, 0px));
  }

  .input-container {
    padding: 1rem;
  }

  .input-container:has(.wizard-step.is-active .app) {
    padding: 0.65rem;
    border-width: 1px;
    border-radius: 16px;
  }

  .input-container:has(.wizard-step.is-active #panel-result:not(.hidden)) {
    border: none;
    background: transparent;
    box-shadow: none;
    padding: 0;
    width: min(420px, 100%);
  }

  .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;
  }
}
