.demo-page {
  min-height: 100svh;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 50% 8%, rgba(255, 255, 255, 0.88), rgba(246, 250, 247, 0.7) 38%, rgba(216, 238, 223, 0.58) 100%),
    var(--bg);
}

.demo-page.is-summary {
  overflow-y: auto;
}

.demo-background {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.demo-background iframe {
  width: 100%;
  height: 100%;
  border: 0;
  opacity: 0.24;
  filter: blur(14px) saturate(0.9);
  transform: scale(1.04);
  transform-origin: center top;
}

.demo-background::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(246, 250, 247, 0.78), rgba(246, 250, 247, 0.9)),
    radial-gradient(circle at 52% 40%, rgba(255, 255, 255, 0.64), rgba(216, 238, 223, 0.56) 52%, rgba(246, 250, 247, 0.94) 100%);
}

.demo-shell {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-rows: auto 1fr;
  min-height: 100svh;
  padding: clamp(16px, 3vw, 26px);
  overflow: visible;
}

.demo-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(100%, 1180px);
  margin: 0 auto;
}

.demo-header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.demo-back-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  padding: 0 20px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.56);
  color: var(--primary);
  font-size: 0.92rem;
  font-weight: 500;
  box-shadow: 0 18px 46px rgba(33, 74, 50, 0.08);
  backdrop-filter: blur(16px);
  isolation: isolate;
  overflow: hidden;
  transition:
    transform 220ms cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 220ms cubic-bezier(0.22, 1, 0.36, 1),
    background 220ms ease,
    color 220ms ease;
}

.demo-back-link::before,
.step-button::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  border-radius: inherit;
  background:
    linear-gradient(115deg, transparent 0%, rgba(255, 255, 255, 0.22) 42%, transparent 68%);
  pointer-events: none;
  transform: translateX(-125%);
  transition: transform 520ms cubic-bezier(0.22, 1, 0.36, 1);
}

.demo-back-link:hover,
.step-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 44px rgba(33, 74, 50, 0.16);
}

.demo-back-link:hover::before,
.step-button:hover::before {
  transform: translateX(125%);
}

.demo-back-link:active,
.step-button:active {
  transform: translateY(0) scale(0.99);
  box-shadow: 0 10px 26px rgba(33, 74, 50, 0.12);
}

.demo-back-link:focus-visible,
.step-button:focus-visible {
  outline: 0;
  box-shadow:
    0 0 0 4px rgba(168, 213, 181, 0.42),
    0 18px 44px rgba(33, 74, 50, 0.14);
}

.demo-card {
  align-self: start;
  width: min(100%, 1040px);
  margin: 0 auto;
  padding: clamp(34px, 7vh, 74px) 0 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}

.demo-progress {
  display: grid;
  gap: 9px;
  margin-bottom: clamp(22px, 3vw, 34px);
  color: rgba(90, 106, 96, 0.72);
  font-size: 0.8rem;
  font-weight: 500;
}

.demo-progress-track {
  height: 3px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(33, 74, 50, 0.055);
}

.demo-progress-track span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: rgba(33, 74, 50, 0.42);
  transition: width 240ms ease;
}

.demo-step {
  animation: stepEnter 220ms ease both;
}

.demo-step.is-leaving {
  animation: stepLeave 160ms ease both;
}

@keyframes stepEnter {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes stepLeave {
  from {
    opacity: 1;
  }

  to {
    opacity: 0;
  }
}

.step-title {
  max-width: 820px;
  min-height: 2em;
  margin: 0;
  color: var(--text);
  font-size: clamp(2.15rem, 5.4vw, 4.05rem);
  line-height: 1;
  font-weight: 400;
  letter-spacing: -0.04em;
}

.step-description {
  max-width: 680px;
  min-height: 3.1em;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: clamp(1rem, 2vw, 1.14rem);
  line-height: 1.52;
  font-weight: 400;
}

.step-field {
  display: grid;
  gap: 12px;
  margin-top: clamp(22px, 3vw, 32px);
}

.step-field label,
.consent-row {
  color: var(--text);
  font-size: 0.96rem;
  font-weight: 500;
}

.demo-input,
.demo-textarea {
  width: 100%;
  border: 1px solid rgba(33, 74, 50, 0.11);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.44);
  color: var(--text);
  outline: none;
  box-shadow: none;
  transition: border-color 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

.demo-input {
  min-height: 62px;
  padding: 0 20px;
  font-size: clamp(1.12rem, 3vw, 1.58rem);
  font-weight: 400;
}

.demo-textarea {
  min-height: 136px;
  padding: 18px 20px;
  resize: vertical;
  font-size: 1.08rem;
  line-height: 1.5;
  overflow-y: auto;
}

.demo-step[data-step-key="notes"] .demo-textarea {
  min-height: clamp(190px, 28vh, 240px);
}

.demo-input::placeholder,
.demo-textarea::placeholder {
  color: rgba(18, 32, 24, 0.34);
}

.demo-input:focus,
.demo-textarea:focus {
  border-color: rgba(33, 74, 50, 0.34);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 0 0 5px rgba(168, 213, 181, 0.28);
}

.choice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: clamp(22px, 3vw, 32px);
}

.choice-card {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  min-height: 60px;
  padding: 14px 18px;
  border: 1px solid rgba(33, 74, 50, 0.14);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.42);
  color: var(--text);
  cursor: pointer;
  text-align: left;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

.choice-card:hover {
  transform: translateY(-1px);
  border-color: rgba(33, 74, 50, 0.24);
  background: rgba(255, 255, 255, 0.62);
}

.choice-card.is-selected {
  border-color: rgba(33, 74, 50, 0.38);
  background: linear-gradient(180deg, rgba(216, 238, 223, 0.72), rgba(255, 255, 255, 0.52));
  box-shadow: inset 0 0 0 1px rgba(33, 74, 50, 0.06);
}

.choice-card span:first-child {
  font-size: 1rem;
  line-height: 1.24;
  font-weight: 500;
}

.choice-card.is-selected span:first-child {
  color: var(--primary);
}

.choice-check {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  border: 1px solid rgba(33, 74, 50, 0.2);
  color: transparent;
  font-size: 0.85rem;
  transition: background 160ms ease, color 160ms ease, border-color 160ms ease;
}

.choice-card.is-selected .choice-check {
  border-color: var(--primary);
  background: var(--primary);
  color: #ffffff;
}

.other-field {
  margin-top: 18px;
}

.step-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: clamp(16px, 2.5vw, 26px);
}

.step-button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 50px;
  padding: 0 28px;
  border: 0;
  border-radius: 999px;
  background: var(--primary);
  color: #ffffff;
  cursor: pointer;
  font-weight: 500;
  isolation: isolate;
  overflow: hidden;
  transition:
    transform 220ms cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 220ms cubic-bezier(0.22, 1, 0.36, 1),
    opacity 160ms ease,
    background 220ms ease,
    color 220ms ease;
}

.step-button[disabled] {
  cursor: not-allowed;
  opacity: 0.62;
  transform: none;
}

.step-button-secondary {
  background: rgba(33, 74, 50, 0.08);
  color: var(--primary);
}

.step-button-ghost {
  padding-inline: 0;
  background: transparent;
  color: var(--muted);
}

.step-button-ghost::before,
.demo-back-link::before {
  background:
    linear-gradient(115deg, transparent 0%, rgba(33, 74, 50, 0.08) 42%, transparent 68%);
}

.step-button-ghost[disabled] {
  opacity: 0.35;
}

.step-error,
.submit-error {
  margin: 10px 0 0;
  color: #9c3d2f;
  font-size: 0.95rem;
  line-height: 1.4;
}

.step-error:empty,
.submit-error:empty {
  display: none;
}

.summary-grid {
  display: grid;
  gap: 0;
  margin-top: clamp(30px, 5vw, 46px);
  border-top: 1px solid rgba(33, 74, 50, 0.1);
}

.summary-item {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.4fr) auto;
  gap: 18px;
  align-items: center;
  padding: 18px 0;
  border-bottom: 1px solid rgba(33, 74, 50, 0.1);
  border-radius: 0;
  background: transparent;
}

.summary-label {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 500;
}

.summary-value {
  color: var(--text);
  font-size: 1rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.summary-edit {
  position: relative;
  border: 0;
  background: transparent;
  color: var(--primary);
  cursor: pointer;
  font-weight: 600;
}

.summary-edit::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: -3px;
  left: 0;
  height: 1px;
  border-radius: 999px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 320ms cubic-bezier(0.22, 1, 0.36, 1);
}

.summary-edit:hover::after,
.summary-edit:focus-visible::after {
  transform: scaleX(1);
}

.summary-edit:focus-visible {
  outline: 0;
}

.consent-row {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: start;
  margin-top: 28px;
  padding: 18px 0 0;
  border-top: 1px solid rgba(33, 74, 50, 0.1);
  border-radius: 0;
  background: transparent;
}

.consent-row input {
  width: 20px;
  height: 20px;
  margin-top: 2px;
  accent-color: var(--primary);
}

.success-panel {
  display: grid;
  justify-items: center;
  text-align: center;
}

.success-icon {
  display: grid;
  place-items: center;
  width: 66px;
  height: 66px;
  margin-bottom: 28px;
  border-radius: 999px;
  background: var(--primary);
  color: #ffffff;
  font-size: 1.7rem;
}

.success-panel .step-title {
  max-width: 720px;
}

.success-panel .step-description {
  max-width: 620px;
}

.success-note {
  margin: 26px 0 0;
  color: var(--muted);
  font-size: 0.98rem;
}

.success-panel .step-actions {
  margin-top: clamp(34px, 5vw, 54px);
}

@media (max-width: 760px) {
  .demo-shell {
    padding: 16px;
  }

  .demo-header {
    gap: 12px;
  }

  .demo-header-left {
    gap: 10px;
  }

  .demo-back-link {
    display: inline-flex;
    min-height: 36px;
    padding: 0 12px;
    font-size: 0.78rem;
    white-space: nowrap;
  }

  .demo-card {
    width: 100%;
    padding: 18px 0 8px;
  }

  .summary-item {
    grid-template-columns: 1fr;
  }

  .choice-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-top: 18px;
  }

  .choice-card {
    min-height: 46px;
    padding: 9px 10px;
    border-radius: 15px;
  }

  .choice-card span:first-child {
    font-size: 0.82rem;
    line-height: 1.18;
  }

  .demo-progress {
    margin-bottom: 16px;
  }

  .step-title {
    font-size: clamp(1.82rem, 8.4vw, 2.46rem);
    min-height: 2.72em;
    line-height: 1.03;
  }

  .step-description {
    min-height: 3.5em;
    margin-top: 12px;
    font-size: 0.94rem;
    line-height: 1.42;
  }

  .step-field {
    margin-top: 18px;
  }

  .demo-input {
    min-height: 56px;
    padding-inline: 18px;
    font-size: 1.12rem;
  }

  .demo-textarea {
    min-height: 112px;
  }

  .demo-step[data-step-key="notes"] .demo-textarea {
    min-height: min(230px, 30svh);
    padding: 16px 18px;
  }

  .choice-check {
    width: 20px;
    height: 20px;
    font-size: 0.76rem;
  }

  .summary-item {
    gap: 8px;
  }

  .summary-edit {
    justify-self: start;
  }

  .step-actions {
    display: grid;
    grid-template-columns: minmax(94px, 0.62fr) minmax(0, 1fr);
    position: static;
    align-items: center;
    justify-content: stretch;
    gap: 10px;
    margin-top: 18px;
  }

  .step-actions .step-button {
    width: 100%;
    min-height: 46px;
    padding-inline: 18px;
  }

  .step-button-ghost {
    order: 0;
    padding-inline: 18px;
    background: rgba(33, 74, 50, 0.06);
  }

  .success-panel .step-actions {
    margin-top: 34px;
  }

  .demo-page.is-summary .step-button-ghost,
  .demo-page.is-success .step-button-ghost {
    order: 2;
    background: transparent;
  }
}
