/* Berth quiz — multi-step form, premium feel matching the landing. */

.quiz-body {
  background: var(--bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ============================ HEADER ============================ */

.quiz-header {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 18px 28px;
  border-bottom: 1px solid var(--line);
  background: white;
  position: sticky;
  top: 0;
  z-index: 5;
}

.quiz-header .brand-light {
  font-size: 20px;
}

.progress-shell {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 1;
}

.progress-bar {
  flex: 1;
  height: 4px;
  background: var(--line);
  border-radius: 999px;
  overflow: hidden;
  max-width: 480px;
}

.progress-fill {
  height: 100%;
  width: 20%;
  background: var(--accent);
  border-radius: 999px;
  transition: width 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.progress-label {
  font-size: 13px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

@media (max-width: 640px) {
  .quiz-header { padding: 14px 18px; gap: 14px; }
  .progress-bar { max-width: none; }
}

/* ============================ MAIN ============================ */

.quiz-main {
  flex: 1;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 56px 24px 96px;
}

.quiz-form {
  width: 100%;
  max-width: 640px;
}

/* ============================ STEP ============================ */

.quiz-step {
  animation: stepIn 0.45s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.quiz-step .eyebrow {
  margin-bottom: 12px;
}

.quiz-step h2 {
  font-family: 'Fraunces', Georgia, serif;
  font-size: clamp(28px, 4vw, 38px);
  line-height: 1.13;
  letter-spacing: -0.018em;
  font-weight: 500;
  margin-bottom: 36px;
  max-width: 22ch;
}

@keyframes stepIn {
  0%   { opacity: 0; transform: translateY(12px); }
  100% { opacity: 1; transform: none; }
}

/* ============================ FIELDS ============================ */

.field {
  margin-bottom: 28px;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 28px;
}
@media (max-width: 540px) {
  .field-row { grid-template-columns: 1fr; }
}

.field-label {
  display: block;
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--ink);
}

.field-label .muted,
.muted {
  color: var(--ink-3);
  font-weight: 400;
  font-size: 13px;
}

.field-error {
  display: none;
  color: #dc2626;
  font-size: 13px;
  margin-top: 6px;
}
.field-error.show { display: block; }

/* ============================ OPTION GROUPS (radios + checkboxes) ============================ */

.opt-group, .radio-group {
  display: grid;
  gap: 8px;
}

.opt, .radio {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: white;
  font-size: 15px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.opt:hover, .radio:hover {
  border-color: #d6d3c7;
  background: #fbfaf6;
}

.opt input, .radio input {
  width: 18px; height: 18px;
  accent-color: var(--accent);
  flex-shrink: 0;
  cursor: pointer;
}

.opt:has(input:checked), .radio:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.opt span, .radio span {
  font-weight: 500;
}

/* ============================ "OTHER" INPUT ============================ */

.other-input {
  margin-top: 8px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fbfaf6;
}
.other-input input {
  width: 100%;
  border: 0;
  background: transparent;
  padding: 4px 0;
  font-size: 15px;
  font-family: inherit;
  color: var(--ink);
}
.other-input input:focus { outline: none; }

/* ============================ TEXT INPUTS ============================ */

input[type=text],
input[type=email],
input[type=number],
textarea,
select {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 15px;
  font-family: inherit;
  background: white;
  color: var(--ink);
  transition: border-color 0.15s, box-shadow 0.15s;
}

input[type=text]:focus,
input[type=email]:focus,
input[type=number]:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.15);
}

textarea {
  resize: vertical;
  min-height: 92px;
  line-height: 1.5;
}

/* Number with $ prefix */
.input-with-prefix {
  position: relative;
}
.input-with-prefix .input-prefix {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ink-3);
  font-weight: 600;
  pointer-events: none;
}
.input-with-prefix input[type=number] {
  padding-left: 28px;
}

/* Hide native number spinners (cleaner look) */
input[type=number]::-webkit-outer-spin-button,
input[type=number]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
input[type=number] { -moz-appearance: textfield; }

/* Char counter */
.char-counter {
  font-size: 12px;
  color: var(--ink-3);
  margin-top: 6px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.char-counter.warn { color: #d97706; }
.char-counter.error { color: #dc2626; }

/* ============================ CHIP GROUP (currencies) ============================ */

.chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: white;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
  cursor: pointer;
  transition: all 0.15s;
}
.chip:hover {
  border-color: #d6d3c7;
  background: #fbfaf6;
}
.chip.selected {
  border-color: var(--accent);
  background: var(--accent);
  color: white;
}
.chip.selected:hover { background: #b45309; }

/* ============================ SELECT ============================ */

select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 40px;
}

/* ============================ CONSENT ============================ */

.consent {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 14px;
  color: var(--ink-2);
  line-height: 1.5;
  cursor: pointer;
  padding: 8px 0;
}
.consent input[type=checkbox] {
  flex-shrink: 0;
  width: 18px; height: 18px;
  accent-color: var(--accent);
  margin-top: 2px;
  cursor: pointer;
}
.consent a { color: var(--accent); text-decoration: underline; }

/* ============================ TURNSTILE WRAPPER ============================ */

.cf-turnstile {
  display: flex;
  justify-content: flex-start;
  margin-top: 4px;
}

/* ============================ STEP NAV ============================ */

.step-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 40px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.btn {
  padding: 12px 22px;
  border: 0;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
  display: inline-block;
}
.btn-primary {
  background: var(--accent);
  color: white;
  box-shadow: 0 6px 16px -4px rgba(217, 119, 6, 0.45);
}
.btn-primary:hover { background: #b45309; transform: translateY(-1px); }
.btn-primary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}
.btn-ghost {
  background: transparent;
  color: var(--ink-2);
  border: 1px solid var(--line);
}
.btn-ghost:hover { background: var(--bg); color: var(--ink); }
.btn-ghost:disabled { opacity: 0.4; cursor: not-allowed; }

/* ============================ STATE SCREENS (loading, success, error) ============================ */

/* Belt-and-suspenders: ensure [hidden] always wins over any `display:` rule. */
[hidden] { display: none !important; }

.quiz-state {
  display: none;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
}
.quiz-state:not([hidden]) {
  display: flex;
}

.loading-card {
  text-align: center;
  max-width: 480px;
}

.loading-card h2 {
  font-family: 'Fraunces', Georgia, serif;
  font-size: clamp(24px, 3.5vw, 32px);
  font-weight: 500;
  margin: 24px 0 16px;
  letter-spacing: -0.015em;
}

.loading-card p {
  color: var(--ink-2);
  font-size: 16px;
  line-height: 1.6;
  margin-bottom: 12px;
}

.loading-card .loading-hint {
  color: var(--ink-3);
  font-size: 14px;
  margin-top: 18px;
}

.loading-card a {
  color: var(--accent);
}

/* Loading spinner */
.loading-spinner {
  width: 56px; height: 56px;
  border: 4px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  margin: 0 auto;
  animation: spin 0.9s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-status {
  font-style: italic;
  color: var(--accent) !important;
  font-weight: 500;
  min-height: 1.5em;
  transition: opacity 0.3s;
}

/* Success / error glyphs */
.success-mark, .error-mark {
  width: 64px; height: 64px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  font-weight: 700;
  margin: 0 auto;
  color: white;
}
.success-mark { background: #16a34a; }
.error-mark { background: #dc2626; }

.loading-card code {
  font-family: ui-monospace, SFMono-Regular, monospace;
  background: var(--line);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 13px;
}
