:root {
  --ink: #2f2f2c;
  --ink-soft: #6b6b66;
  --teal: #ee1c25;
  --teal-deep: #c4141c;
  --teal-soft: #fdecec;
  --navy: #4a4a45;
  --surface: rgba(255, 255, 255, 0.92);
  --line: #e4e0dc;
  --danger: #b42318;
  --danger-bg: #fef3f2;
  --radius: 18px;
  --shadow: 0 18px 50px rgba(47, 47, 44, 0.1);
  --font-sans: "Outfit", system-ui, sans-serif;
  --font-serif: "Source Serif 4", Georgia, serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-sans);
  color: var(--ink);
  background: #f5f3f1;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

[hidden] {
  display: none !important;
}

.page-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(ellipse 80% 50% at 10% -10%, rgba(238, 28, 37, 0.12), transparent 55%),
    radial-gradient(ellipse 60% 40% at 100% 0%, rgba(74, 74, 69, 0.1), transparent 50%),
    linear-gradient(165deg, #f7f4f2 0%, #faf9f7 45%, #f1eeeb 100%);
}

.page-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.35;
  background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ee1c25' fill-opacity='0.06'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

.shell {
  width: min(640px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 2rem 0 3rem;
}

.brand-header {
  text-align: center;
  margin-bottom: 1.5rem;
  animation: rise-in 0.7s var(--ease) both;
}

.brand-mark {
  margin: 0 auto 0.85rem;
  max-width: min(280px, 72vw);
}

.brand-mark img {
  display: block;
  width: 100%;
  height: auto;
  mix-blend-mode: multiply;
}

.brand-title {
  margin: 0;
  font-family: var(--font-serif);
  font-size: clamp(1.35rem, 3.5vw, 1.75rem);
  font-weight: 600;
  color: var(--teal);
}

.brand-training {
  margin: 0.55rem auto 0;
  max-width: 32rem;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--navy);
  letter-spacing: 0.01em;
}

.brand-sub {
  margin: 0.65rem auto 0;
  max-width: 28rem;
  color: var(--ink-soft);
  font-size: 0.98rem;
}

.card {
  background: var(--surface);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(228, 224, 220, 0.95);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem 1.35rem 1.35rem;
  animation: rise-in 0.75s var(--ease) 0.08s both;
}

@media (min-width: 640px) {
  .card {
    padding: 1.85rem 1.85rem 1.5rem;
  }
}

.alert {
  border-radius: 12px;
  padding: 0.85rem 1rem;
  margin-bottom: 1rem;
  font-size: 0.95rem;
  animation: rise-in 0.4s var(--ease) both;
}

.alert-error {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid #fecdca;
}

.progress {
  margin-bottom: 1.5rem;
}

.progress-track {
  height: 4px;
  background: var(--line);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 0.85rem;
}

.progress-fill {
  height: 100%;
  width: 25%;
  background: linear-gradient(90deg, var(--teal), var(--teal-deep));
  border-radius: inherit;
  transition: width 0.45s var(--ease);
}

.progress-steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.25rem;
  font-size: 0.68rem;
  text-align: center;
  color: var(--ink-soft);
  font-weight: 500;
}

.progress-steps li.is-active {
  color: var(--teal-deep);
  font-weight: 600;
}

.progress-steps li.is-done {
  color: var(--teal);
}

.form-step {
  border: 0;
  margin: 0;
  padding: 0;
  min-width: 0;
}

.form-step[hidden] {
  display: none !important;
}

.form-step.is-active {
  animation: step-in 0.4s var(--ease) both;
}

.form-step legend {
  font-family: var(--font-serif);
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--navy);
  padding: 0;
  margin-bottom: 0.25rem;
}

.step-hint {
  margin: 0 0 1.25rem;
  color: var(--ink-soft);
  font-size: 0.92rem;
}

.progress-steps li.is-skipped {
  opacity: 0.45;
  text-decoration: line-through;
}

.referral-card {
  margin-bottom: 1rem;
  padding: 1rem 1rem 0.25rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.65);
}

.referral-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.referral-card-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--navy);
}

.btn-remove-referral {
  padding: 0.35rem 0.65rem;
  font-size: 0.82rem;
  margin-right: 0;
}

#btn-add-referral {
  width: 100%;
  margin-bottom: 0.5rem;
}

.field {
  margin-bottom: 1.15rem;
}

.field label,
.rating-label {
  display: block;
  font-size: 0.9rem;
  font-weight: 550;
  margin-bottom: 0.4rem;
  color: var(--ink);
}

.req {
  color: var(--teal);
}

.field input[type="text"],
.field input[type="email"],
.field input[type="tel"],
.field input[type="date"],
.field textarea {
  width: 100%;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  padding: 0.8rem 0.95rem;
  font: inherit;
  font-size: 1rem;
  color: var(--ink);
  background: #fff;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.field input:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(238, 28, 37, 0.15);
}

.field textarea {
  resize: vertical;
  min-height: 120px;
}

.field-error {
  display: block;
  min-height: 1.1em;
  margin-top: 0.3rem;
  font-size: 0.8rem;
  color: var(--danger);
}

.field.has-error input,
.field.has-error textarea {
  border-color: #f04438;
}

.char-count {
  display: block;
  text-align: right;
  font-size: 0.75rem;
  color: var(--ink-soft);
  margin-top: 0.25rem;
}

.star-rating {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.star {
  cursor: pointer;
  position: relative;
}

.star input {
  position: absolute;
  opacity: 0;
  inset: 0;
  margin: 0;
  cursor: pointer;
}

.star-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3.35rem;
  height: 3.35rem;
  font-size: 2.45rem;
  color: #d2cdc8;
  transition: color 0.15s ease, transform 0.2s var(--ease);
  line-height: 1;
}

.star:hover .star-icon,
.star:focus-within .star-icon {
  transform: scale(1.05);
}

.star-rating .star.is-on .star-icon {
  color: #e8a317;
  transform: scale(1.08);
}

.star input:focus-visible + .star-icon {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
  border-radius: 6px;
}

.choice-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.choice-pill {
  cursor: pointer;
  position: relative;
}

.choice-pill input {
  position: absolute;
  opacity: 0;
  inset: 0;
  margin: 0;
}

.choice-pill span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 5.5rem;
  padding: 0.7rem 1.1rem;
  border-radius: 999px;
  border: 1.5px solid var(--line);
  background: #fff;
  font-weight: 550;
  font-size: 0.95rem;
  transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease, transform 0.2s var(--ease);
}

.choice-pill:hover span {
  border-color: var(--teal);
}

.choice-pill input:checked + span {
  background: var(--teal-soft);
  border-color: var(--teal);
  color: var(--teal-deep);
  transform: translateY(-1px);
}

.choice-pill input:focus-visible + span {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
}

.review-panel {
  background: linear-gradient(180deg, #fff8f8 0%, #ffffff 55%);
  border: 1px solid rgba(238, 28, 37, 0.18);
  border-radius: 14px;
  padding: 1rem 1.1rem;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.review-row {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 0.35rem 1rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid rgba(228, 224, 220, 0.95);
  font-size: 0.92rem;
}

.review-row:last-child {
  border-bottom: 0;
}

.review-row dt {
  margin: 0;
  color: var(--ink-soft);
  font-weight: 500;
}

.review-row dd {
  margin: 0;
  font-weight: 550;
  word-break: break-word;
  color: var(--navy);
}

.review-referrals {
  margin-top: 0.85rem;
  padding-top: 0.85rem;
  border-top: 1px solid rgba(238, 28, 37, 0.16);
}

.review-referrals-title {
  margin: 0 0 0.55rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--navy);
}

.review-table-wrap {
  overflow-x: auto;
  border: 1px solid rgba(238, 28, 37, 0.14);
  border-radius: 10px;
  background: #fff;
}

.review-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
  min-width: 320px;
}

.review-table th,
.review-table td {
  padding: 0.55rem 0.65rem;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.review-table th {
  background: var(--teal-soft);
  color: var(--teal-deep);
  font-weight: 600;
  white-space: nowrap;
}

.review-table tr:last-child td {
  border-bottom: 0;
}

.review-table td:first-child {
  width: 2rem;
  color: var(--ink-soft);
  font-weight: 600;
}

.form-nav {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  align-items: center;
  margin-top: 1.5rem;
  padding-top: 1.15rem;
  border-top: 1px solid var(--line);
}

.form-nav .btn-ghost {
  margin-right: auto;
}

.btn {
  appearance: none;
  border: 0;
  border-radius: 12px;
  padding: 0.8rem 1.25rem;
  font: inherit;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s var(--ease), background 0.2s ease, box-shadow 0.2s ease;
}

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

.btn-primary {
  background: linear-gradient(135deg, var(--teal) 0%, var(--teal-deep) 100%);
  color: #fff;
  box-shadow: 0 8px 20px rgba(238, 28, 37, 0.28);
}

.btn-primary:hover {
  box-shadow: 0 10px 24px rgba(238, 28, 37, 0.35);
}

.btn-secondary {
  background: var(--teal-soft);
  color: var(--teal-deep);
}

.btn-ghost {
  background: transparent;
  color: var(--ink-soft);
}

.btn-ghost:hover {
  color: var(--ink);
  background: #f0eeec;
}

.hp-field {
  position: absolute;
  left: -10000px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.success-card {
  text-align: center;
  padding-top: 2.5rem;
  padding-bottom: 2rem;
}

.success-card h2 {
  font-family: var(--font-serif);
  margin: 0.75rem 0 0.4rem;
  color: var(--navy);
}

.success-card p {
  color: var(--ink-soft);
  margin: 0 0 1.5rem;
}

.success-icon svg {
  display: block;
  margin: 0 auto;
}

.success-circle {
  stroke: var(--teal);
  stroke-dasharray: 166;
  stroke-dashoffset: 166;
  animation: stroke 0.6s var(--ease) forwards;
}

.success-check {
  stroke: var(--teal);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 48;
  stroke-dashoffset: 48;
  animation: stroke 0.35s var(--ease) 0.45s forwards;
}

.page-footer {
  text-align: center;
  margin-top: 1.75rem;
  color: var(--ink-soft);
  font-size: 0.8rem;
}

.page-footer p {
  margin: 0;
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes step-in {
  from {
    opacity: 0;
    transform: translateX(12px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes stroke {
  to {
    stroke-dashoffset: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
