:root {
  color-scheme: light;
  --page-background: #ffffff;
  --text-color: #101828;
  --accent-color: #2563eb;
  --accent-text-color: #ffffff;
  --muted-text: #475467;
}

* {
  box-sizing: border-box;
}

body {
  background: var(--page-background);
  color: var(--text-color);
  margin: 0;
  padding: 0;
  font-size: clamp(0.92rem, calc(0.75rem + 0.15vw + 0.15vh), 1rem);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  width: 100%;
}

body.is-embedded {
  padding: 0;
  min-height: auto;
  align-items: stretch;
}

body.is-embedded .survey-shell {
  width: 100%;
  max-width: 600px;
  border-radius: 0;
  box-shadow: none;
}

body.is-embedded .survey-shell .survey-progress {
  border-top: none;
}

body.session-expired .survey-shell,
body.session-expired .survey-progress {
  filter: blur(4px);
  pointer-events: none;
}

.timeout-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(16, 24, 40, 0.72);
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 1.5rem;
}

.timeout-dialog {
  background: #ffffff;
  border-radius: 1rem;
  padding: clamp(1.5rem, 2vw + 1rem, 2.5rem);
  max-width: 420px;
  width: 100%;
  text-align: center;
  box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.35);
}

.timeout-dialog__title {
  margin: 0 0 0.75rem;
  font-size: clamp(1.4rem, 2vw + 1rem, 2rem);
  font-weight: 600;
}

.timeout-dialog__message {
  margin: 0 0 1.5rem;
  color: var(--muted-text);
  font-size: 1rem;
  line-height: 1.5;
}

.timeout-dialog__button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  padding: 0.85rem 1.75rem;
  border-radius: 999px;
  border: none;
  background: var(--accent-color);
  color: var(--accent-text-color);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
}

.timeout-dialog__button:hover,
.timeout-dialog__button:focus-visible {
  background: #1d4ed8;
  outline: none;
  transform: translateY(-1px);
}

.survey-progress {
  width: 100%;
  height: 4px;
  z-index: 10;
  position: sticky;
  top: 0;
}

.survey-progress__track {
  width: 100%;
  height: 100%;
  background: #e4e7ec;
}

.survey-progress__bar {
  height: 100%;
  width: 0;
  background: var(--accent-color);
  transition: width 280ms ease;
}

.survey-shell {
  width: min(100%, 600px);
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  align-items: center;
  background: #ffffff;
  border-radius: 0;
  box-shadow: none;
  margin: 0 auto;
}

@media (min-width: 768px) {
  .survey-shell {
    width: min(70vw, 600px);
  }
}

@media (min-width: 1280px) {
  .survey-shell {
    width: min(45vw, 600px);
  }
}

.question-stage {
  min-height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  width: 100%;
}

.question-card {
  width: 100%;
  max-width: 520px;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  margin: 0 auto;
}

.question-title {
  font-size: clamp(1.2rem, 2vw + 0.8rem, 1.8rem);
  font-weight: 400;
  margin: 0;
  text-align: center;
}

.question-helper {
  margin: 0;
  color: var(--muted-text);
  font-size: 0.95rem;
  text-align: center;
}


.input-stack {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  width: 100%;
  padding: 0 10%;
}

.input-stack > * {
  width: 100%;
}

.input-stack .input-stack {
  padding: 0;
}

.field-input,
textarea,
select {
  font: inherit;
  padding: 0.75rem 0.85rem;
  border: 1px solid #d0d5dd;
  border-radius: 0.65rem;
  color: var(--text-color);
  background: #ffffff;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.field-input:focus,
textarea:focus,
select:focus {
  outline: 2px solid var(--accent-color);
  outline-offset: 1px;
  border-color: var(--accent-color);
}

.bare-input {
  font: inherit;
  padding: 0.5rem 0.25rem 0.35rem;
  border: none;
  border-bottom: 2px solid #d0d5dd;
  border-radius: 0;
  background: transparent;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.bare-input:focus {
  outline: none;
  border-color: var(--accent-color);
  background: rgba(37, 99, 235, 0.05);
}

textarea {
  min-height: 140px;
  resize: vertical;
}

.choice-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.choice-button,
.boolean-button {
  padding: 0.68rem 0.9rem;
  border-radius: 0.4rem;
  border: 1px solid #d0d5dd;
  background: #ffffff;
  color: var(--text-color);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  font-size: clamp(1.02rem, 0.9vw + 0.85rem, 1.18rem);
  line-height: 1.45;
}

.choice-button:hover,
.boolean-button:hover,
.choice-button:focus-visible,
.boolean-button:focus-visible {
  border-color: var(--accent-color);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.25);
  outline: none;
}

.choice-button.active,
.boolean-button.active {
  background: var(--accent-color);
  border-color: var(--accent-color);
  color: var(--accent-text-color);
}

.choice-box {
  display: block;
  width: 100%;
  border-radius: 0.45rem;
  border: 1px solid #d0d5dd;
  background: rgba(37, 99, 235, 0);
  color: var(--text-color);
  padding: 0.68rem 0.9rem;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
  font-size: clamp(1.05rem, 1vw + 0.9rem, 1.22rem);
  line-height: 1.45;
}

.choice-box:hover,
.choice-box:focus-visible {
  border-color: var(--accent-color);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.18);
  outline: none;
}

.choice-box.active {
  background: rgba(37, 99, 235, 0.3);
  border-color: var(--accent-color);
}

.rating-scale {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.rating-option {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1px solid #d0d5dd;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #ffffff;
  color: var(--text-color);
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease;
}

.rating-option:hover,
.rating-option:focus-visible {
  border-color: var(--accent-color);
  outline: none;
}

.rating-option.active {
  background: var(--accent-color);
  border-color: var(--accent-color);
  color: var(--accent-text-color);
}

.survey-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  width: min(520px, 100%);
  padding: 0 10%;
}

.action-button {
  border: none;
  border-radius: 0.5rem;
  padding: 0.72rem 1.5rem;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.action-button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.action-button.primary {
  background: var(--accent-color);
  color: var(--accent-text-color);
  box-shadow: 0 10px 20px -12px rgba(37, 99, 235, 0.8);
}

.action-button.primary:hover:not(:disabled),
.action-button.primary:focus-visible:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 14px 24px -12px rgba(37, 99, 235, 0.85);
  outline: none;
}

.action-button.secondary {
  background: transparent;
  color: var(--accent-color);
  border: 1px solid var(--accent-color);
}

.survey-result {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.survey-result-message {
  font-size: 1.05rem;
  text-align: center;
  color: var(--text-color);
}

.compound-stack {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.compound-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}


.compound-field--phone {
  gap: 0.5rem;
}

.compound-field--phone .phone-input-row {
  width: 100%;
  display: flex;
  align-items: stretch;
  position: relative;
}

.compound-field--phone .phone-input-row > input {
  flex: 1 1 auto;
  width: 100%;
}


.compound-field--phone .phone-input-row--intl {
  border-bottom: 2px solid #d0d5dd;
  padding: 0;
  transition: border-color 0.2s ease, background 0.2s ease;
  background: transparent;
}

.compound-field--phone .phone-input-row--intl:focus-within {
  border-color: var(--accent-color);
  background: rgba(37, 99, 235, 0.05);
}

.compound-field--phone .phone-input-row--intl .bare-input {
  border: none;
  border-radius: 0;
  padding: 0.5rem 0.25rem 0.35rem;
  background: transparent;
}

.compound-field--phone .phone-input-row--intl .iti {
  display: flex !important;
  align-items: center;
  gap: 0.65rem;
  background: transparent;
  border: none;
  border-radius: 0;
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
}

.compound-field--phone .phone-input-row--intl .iti__flag-container {
  position: relative !important;
  display: flex;
  align-items: center;
  justify-content: center !important;
  gap: 0.45rem;
  padding: 0 !important;
  margin-right: 0.35rem;
  background: transparent;
  min-width: clamp(92px, 24%, 150px);
  flex: 0 1 clamp(92px, 24%, 150px);
}

.compound-field--phone .phone-input-row--intl .iti__selected-flag {
  width: 100%;
  padding: 0 0.5rem !important;
  background: transparent !important;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  justify-content: center !important;
  text-align: center;
  cursor: pointer;
}

.compound-field--phone .phone-input-row--intl .iti__selected-flag:focus-visible {
  outline: none;
}

.compound-field--phone .phone-input-row--intl .iti__flag {
  flex: 0 0 auto;
  box-shadow: 0 0 0 1px rgba(16, 24, 40, 0.08);
}

.compound-field--phone .phone-input-row--intl .iti__selected-dial-code {
  font-weight: 600;
  color: var(--text-color);
}

.compound-field--phone .phone-input-row--intl .iti__arrow {
  margin-left: auto;
}

.compound-field--phone .phone-input-row--intl .iti .iti__tel-input,
.compound-field--phone .phone-input-row--intl .iti input {
  flex: 1 1 auto;
  min-width: 0;
  border: none !important;
  border-radius: 0;
  padding: 0.5rem 0 0.35rem 0.45rem !important;
  font: inherit;
  background: transparent;
  color: var(--text-color);
  text-align: left !important;
}

.compound-field--phone .phone-input-row--intl .iti .iti__tel-input:focus,
.compound-field--phone .phone-input-row--intl .iti input:focus {
  outline: none;
  box-shadow: none;
}

.compound-field--phone .phone-input-row--intl .iti .iti__tel-input::placeholder,
.compound-field--phone .phone-input-row--intl .iti input::placeholder {
  color: var(--muted-text);
}

.compound-field--phone .phone-input-row--intl .iti__dropdown-content {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 1000;
}

.compound-field--phone .phone-input-row--intl .iti__country-list {
  font-size: 0.95rem;
  max-height: 240px;
}

.bare-input--phone {
  padding-left: 0;
}

.choice-list.choice-list--columns {
  display: grid;
  column-gap: 0.75rem;
  row-gap: 0.75rem;
}

.choice-list.choice-list--columns-2 {
  --choice-columns: 2;
  grid-template-columns: repeat(var(--choice-columns), minmax(0, 1fr));
}

.choice-list.choice-list--columns-3 {
  --choice-columns: 3;
  grid-template-columns: repeat(var(--choice-columns), minmax(0, 1fr));
}

@media (max-width: 600px) {
  body:not(.is-embedded) {
    justify-content: flex-start;
    align-items: stretch;
    padding: 0;
  }

  body:not(.is-embedded) .survey-shell {
    padding: 0;
  }

  .survey-shell {
    width: 100%;
  }

  .question-stage {
    min-height: 190px;
  }

  .choice-box,
  .choice-button,
  .boolean-button {
    font-size: clamp(1.05rem, 2vw + 0.95rem, 1.25rem);
  }

  .input-stack {
    padding: 0;
  }

  .action-button {
    flex: 1 1 auto;
    width: 100%;
  }

  .survey-controls {
    width: 100%;
    flex-direction: column-reverse;
    align-items: stretch;
    padding: 0 1rem;
  }

  .choice-list.choice-list--columns {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 420px) {
  body:not(.is-embedded) {
    padding: 0;
  }

  body:not(.is-embedded) .survey-shell {
    padding: 0;
  }

  .survey-shell {
    gap: 1.5rem;
  }

  .question-title {
    font-size: clamp(1.15rem, 2.5vw + 0.85rem, 1.6rem);
  }

  .rating-option {
    width: 44px;
    height: 44px;
  }
}

.compound-label {
  font-weight: 500;
  color: var(--text-color);
}

.field-error {
  font-size: 0.85rem;
  color: #b42318;
  min-height: 1.1em;
  display: block;
}

.compound-field .field-error {
  min-height: 0;
}

.compound-field .field-error:empty {
  display: none;
}

.error {
  color: #b42318;
  border: 1px solid #f97066;
  padding: 1.5rem;
  border-radius: 0.75rem;
  background: #fee4e2;
}

.slide-in-right {
  animation: slide-in-right 250ms ease forwards;
}

.slide-in-left {
  animation: slide-in-left 250ms ease forwards;
}

.slide-out-left {
  animation: slide-out-left 220ms ease forwards;
}

.slide-out-right {
  animation: slide-out-right 220ms ease forwards;
}

@keyframes slide-in-right {
  from {
    opacity: 0;
    transform: translateX(40px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slide-in-left {
  from {
    opacity: 0;
    transform: translateX(-40px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slide-out-left {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(-40px);
  }
}

@keyframes slide-out-right {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(40px);
  }
}
