:root {
  --bg: #ffffff;
  --text: #111111;
  --muted: #8f8f97;
  --line: #cfcfd6;
  --soft: #f1f1f4;
  --chip: #ededee;
  --blue: #4b5ff7;
  --blue-dark: #384ee0;
  --shadow: 0 14px 28px rgba(75, 95, 247, 0.18);
  --radius-xl: 28px;
  --radius-lg: 18px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: linear-gradient(180deg, #fcfcfe 0%, #f3f5ff 100%);
  color: var(--text);
  font-family: "Inter", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

body {
  display: flex;
  justify-content: center;
  min-height: 100dvh;
}

.page-shell {
  width: 100%;
  min-height: 100dvh;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 0 0 1px rgba(45, 53, 99, 0.06);
}

.brand-bar {
  display: flex;
  align-items: center;
  padding: 18px 24px 14px;
}

.brand-logo {
  display: block;
  width: auto;
  max-width: 220px;
  height: 34px;
  object-fit: contain;
}

.form-stage {
  position: relative;
  min-height: calc(100dvh - 66px);
}

.progress-track {
  position: sticky;
  top: 0;
  z-index: 2;
  width: 100%;
  height: 4px;
  background: transparent;
}

.progress-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #6d7bff 0%, #4b5ff7 100%);
  transition: width 220ms ease;
}

.screen {
  display: none;
  min-height: calc(100dvh - 66px);
  padding: 12px 24px 24px;
}

.screen.active {
  display: block;
}

.screen-inner {
  width: min(100%, 560px);
  min-height: calc(100dvh - 102px);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  will-change: transform, opacity;
}

.screen-inner.animate-in-down {
  animation: slideInDown 320ms cubic-bezier(0.22, 1, 0.36, 1);
}

.screen-inner.animate-in-up {
  animation: slideInUp 320ms cubic-bezier(0.22, 1, 0.36, 1);
}

.screen-inner.animate-out-up {
  animation: slideOutUp 260ms cubic-bezier(0.55, 0.06, 0.68, 0.19);
}

.screen-inner.animate-out-down {
  animation: slideOutDown 260ms cubic-bezier(0.55, 0.06, 0.68, 0.19);
}

.hero {
  padding-bottom: 72px;
}

.ending-screen {
  text-align: center;
  align-items: center;
}

h1,
h2 {
  margin: 0;
  font-size: clamp(1.9rem, 3vw, 3.2rem);
  line-height: 1.04;
  font-weight: 400;
  letter-spacing: -0.03em;
}

h2 {
  font-size: clamp(1.75rem, 2.7vw, 2.7rem);
}

.marker-highlight {
  position: relative;
  display: inline-block;
  z-index: 0;
  padding: 0 0.12em;
}

.marker-highlight::before {
  content: "";
  position: absolute;
  left: -0.12em;
  right: -0.12em;
  top: 50%;
  height: 0.98em;
  background: #d7ff4f;
  transform: translateY(-44%) rotate(1deg);
  z-index: -1;
}

.hero p,
.question-description,
#ending-copy {
  margin: 16px 0 0;
  max-width: 28rem;
  color: #7a7a86;
  font-size: 1rem;
  line-height: 1.45;
}

.primary-button,
.ghost-button {
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease, opacity 160ms ease;
}

.primary-button {
  margin-top: 26px;
  min-height: 54px;
  padding: 0 24px;
  background: linear-gradient(90deg, var(--blue) 0%, #5268ff 100%);
  color: #fff;
  font-size: 1.4rem;
  font-weight: 700;
  box-shadow: var(--shadow);
}

#start-button {
  width: 100%;
  max-width: none;
  border-radius: 999px;
}

.primary-button:hover,
.ghost-button:hover {
  transform: translateY(-1px);
}

.primary-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.time-note {
  margin-top: 10px;
  color: #202026;
  font-size: 0.95rem;
}

#question-title {
  width: 100%;
  max-width: none;
  font-size: clamp(1.7rem, 2.6vw, 2.45rem);
}

#ending-title {
  max-width: 18ch;
  font-size: clamp(2.2rem, 4vw, 4rem);
  font-weight: 700;
  line-height: 1.35;
  letter-spacing: -0.04em;
}

#ending-copy {
  max-width: 34rem;
}

.ending-social {
  margin-top: 34px;
}

.ending-social-label {
  margin: 0;
  color: #4d5668;
  font-size: 1rem;
}

.ending-social-links {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-top: 16px;
}

.social-link {
  width: 42px;
  height: 42px;
  border: 1px solid #d2d6e0;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #1d1d21;
  text-decoration: none;
  transition: background 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.social-link svg {
  width: 19px;
  height: 19px;
  fill: currentColor;
}

.social-link:hover {
  background: #f3f5fb;
  border-color: #bfc6d8;
  transform: translateY(-1px);
}

.ending-site-link {
  display: inline-block;
  margin-top: 22px;
  color: #3b4fdc;
  text-decoration: none;
  font-size: 1rem;
  font-weight: 600;
}

.ending-site-link:hover {
  text-decoration: underline;
}

.field-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 24px;
}

.text-input,
.select-input,
.phone-input {
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  color: #222;
  padding: 10px 0 8px;
  font-size: clamp(1.55rem, 2.4vw, 2.1rem);
  outline: none;
}

.text-input::placeholder,
.phone-input::placeholder {
  color: #b7b7bd;
}

.choice-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 22px;
}

.choice-button {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 50px;
  padding: 8px 14px 8px 8px;
  border: 1px solid #8f8f96;
  border-radius: var(--radius-xl);
  background: linear-gradient(180deg, #f3f3f4 0%, #ededee 100%);
  color: #111;
  text-align: left;
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease, box-shadow 160ms ease,
    transform 160ms ease;
}

.choice-button:hover {
  background: linear-gradient(180deg, #e3e3e7 0%, #d9d9de 100%);
}

.choice-button.selected {
  border-color: #4558ea;
  background: linear-gradient(180deg, #eef1ff 0%, #dde3ff 100%);
  box-shadow: 0 0 0 3px rgba(75, 95, 247, 0.12);
}

.choice-key {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  border: 1px solid #808089;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  background: #fff;
}

.choice-label {
  font-size: 1rem;
  line-height: 1.25;
}

.other-input-wrap {
  margin-top: 12px;
  padding-left: 40px;
}

.other-input {
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: #222;
  padding: 8px 0 6px;
  font-size: 1rem;
  outline: none;
}

.other-input::placeholder {
  color: #a8a8b1;
}

.other-input.invalid {
  border-bottom-color: #cc3b3b;
}

.other-error {
  margin-top: 6px;
  color: #cc3b3b;
  font-size: 0.88rem;
}

.select-shell {
  position: relative;
  margin-top: 24px;
}

.select-input {
  appearance: none;
  padding-right: 42px;
  color: #222;
}

.select-input.has-value {
  color: #222;
}

.autocomplete-shell {
  position: relative;
  width: 100%;
}

.autocomplete-list {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 5;
  margin: 0;
  padding: 6px 0;
  list-style: none;
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid #d7d9e3;
  border-radius: 18px;
  box-shadow: 0 14px 30px rgba(30, 39, 82, 0.12);
  max-height: 220px;
  overflow-y: auto;
}

.autocomplete-item {
  padding: 10px 14px;
  color: #222;
  cursor: pointer;
  transition: background 120ms ease;
}

.autocomplete-item:hover,
.autocomplete-item.active {
  background: #eef1ff;
}

.select-caret {
  position: absolute;
  right: 4px;
  bottom: 18px;
  width: 16px;
  height: 16px;
  pointer-events: none;
  border-right: 2px solid #222;
  border-bottom: 2px solid #222;
  transform: rotate(45deg);
}

.phone-row {
  display: grid;
  grid-template-columns: 170px minmax(0, 1fr);
  gap: 12px;
  align-items: end;
  margin-top: 24px;
}

.country-code {
  border-bottom: 1px solid var(--line);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 8px;
  font-size: 1rem;
  cursor: pointer;
}

.country-code-value {
  min-width: 0;
  color: #222;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.country-code-caret {
  flex: 0 0 auto;
  font-size: 0.9rem;
}

.country-code-menu {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(100% + 8px);
  z-index: 6;
  margin: 0;
  padding: 6px 0;
  list-style: none;
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid #d7d9e3;
  border-radius: 18px;
  box-shadow: 0 14px 30px rgba(30, 39, 82, 0.12);
  max-height: 220px;
  overflow-y: auto;
}

.country-code-option {
  padding: 10px 14px;
  color: #222;
  cursor: pointer;
  transition: background 120ms ease;
}

.country-code-option:hover,
.country-code-option.active {
  background: #eef1ff;
}

.form-footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 28px;
  align-items: flex-end;
}

.ghost-button {
  flex: 0 0 auto;
  align-self: flex-end;
  width: 52px;
  min-width: 52px;
  height: 54px;
  min-height: 54px;
  padding: 0;
  background: #eef0f7;
  color: #34384d;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  line-height: 1;
}

.error-message {
  min-height: 1.5rem;
  margin: 14px 0 0;
  color: #cc3b3b;
  font-size: 0.98rem;
}

@media (max-width: 640px) {
  .screen {
    padding: 10px 22px 20px;
  }

  .hero {
    padding-bottom: 56px;
  }

  h1,
  h2 {
    font-size: 1.58rem;
  }

  #question-title {
    font-size: 1.36rem;
  }

  .marker-highlight::before {
    left: -0.1em;
    right: -0.1em;
    height: 0.92em;
  }

  .screen-inner {
    width: 100%;
    min-height: calc(100dvh - 96px);
  }

  .question-description,
  .hero p,
  #ending-copy {
    font-size: 0.86rem;
    line-height: 1.28;
  }

  #ending-title {
    max-width: 14ch;
    font-size: 1.85rem;
    line-height: 1.28;
  }

  .ending-social {
    margin-top: 24px;
  }

  .ending-social-label {
    font-size: 0.92rem;
  }

  .ending-social-links {
    gap: 12px;
  }

  .social-link {
    width: 38px;
    height: 38px;
  }

  .social-link svg {
    width: 17px;
    height: 17px;
  }

  .ending-site-link {
    margin-top: 18px;
    font-size: 0.92rem;
  }

  .primary-button {
    font-size: 1.08rem;
    min-height: 50px;
  }

  #start-button {
    width: 100%;
  }

  .choice-button {
    min-height: 44px;
    gap: 10px;
  }

  .choice-label {
    font-size: 0.82rem;
    line-height: 1.2;
  }

  .choice-key {
    width: 24px;
    height: 24px;
    font-size: 0.78rem;
  }

  .text-input,
  .select-input,
  .phone-input {
    font-size: 0.94rem;
    padding: 8px 0 7px;
  }

  .phone-row {
    grid-template-columns: 148px minmax(0, 1fr);
  }

  .country-code {
    font-size: 0.88rem;
  }

  .brand-logo {
    max-width: 180px;
    height: 28px;
  }

  .time-note,
  .error-message,
  .ghost-button {
    font-size: 0.84rem;
  }

  .ghost-button {
    width: 46px;
    min-width: 46px;
    height: 50px;
    min-height: 50px;
    font-size: 1.1rem;
  }

  .form-footer {
    margin-top: 18px;
  }
}

@media (min-width: 900px) {
  .page-shell {
    max-width: 1280px;
  }

  .brand-bar {
    padding-left: 40px;
    padding-right: 40px;
  }

  .screen {
    padding-left: 40px;
    padding-right: 40px;
  }

  .screen-inner {
    width: min(100%, 760px);
  }

  .brand-logo {
    max-width: 280px;
    height: 42px;
  }

  .choice-label {
    font-size: 1.05rem;
  }
}

@keyframes slideInDown {
  from {
    opacity: 0;
    transform: translateY(48px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideInUp {
  from {
    opacity: 0;
    transform: translateY(-48px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideOutUp {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(-42px);
  }
}

@keyframes slideOutDown {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(42px);
  }
}
