/* Base component styles. Per-screen colors come from the config's css_variables. */

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

html, body {
  margin: 0;
  background: var(--background, #FFFDF8);
  color: #2B2521;
  font-family: Urbanist, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

#funnel { min-height: 100vh; min-height: 100dvh; padding-bottom: env(safe-area-inset-bottom, 0px); }

button { font-family: inherit; }
button:focus-visible, a:focus-visible { outline: 2px solid var(--active-element, #D97757); outline-offset: 2px; }

.quiz__screen {
  max-width: 540px;
  margin: 0 auto;
  padding: 16px 12px 24px;
  text-align: center;
  font-size: 16px;
  line-height: 1;
}

.container-type { margin: 16px 0; }
.container-type-html { margin: 0; }
.container-type-html:empty { display: none; }

/* ---------- title / paragraph ---------- */

.type-title {
  margin: 8px 0;
  font-size: 20px;
  line-height: 1.35;
  font-weight: 700;
  color: var(--type-title-text-color, var(--type-title-color, #2B2521));
}

.type-paragraph {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
  color: var(--type-paragraph-color, #746B63);
}

/* ---------- single-choice options ---------- */

.type-options { display: grid; gap: 12px; }
.type-options.columns-2 { grid-template-columns: 1fr 1fr; }

.type-options__item {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 51px;
  padding: 16px 40px 16px 16px;
  border: 1px solid transparent;
  border-radius: var(--type-options-border-radius, 8px);
  background: var(--type-options-descr-background, #FFFDFC);
  box-shadow: 0 8px 16px rgba(75, 52, 37, .05);
  color: var(--type-options-descr-color, var(--type-options-text-color, #746B63));
  font-size: 16px;
  font-weight: 700;
  line-height: 1.5;
  text-align: start;
  cursor: pointer;
  transition: background-color .15s, border-color .15s, color .15s;
}
.type-options__item:hover { border-color: var(--type-options-border-color, #DED4C8); }
.type-options__item.is-selected {
  background: var(--type-options-selected-background-color, #F4DED2);
  color: var(--type-options-selected-text-color, #B85C3B);
  border-color: var(--type-options-selected-text-color, #B85C3B);
}

.type-options__arrow {
  position: absolute;
  right: 12px;
  top: 50%;
  width: 9px;
  height: 14px;
  transform: translateY(-50%);
}
.type-options__arrow::before {
  content: "";
  position: absolute;
  left: 0; top: 3px;
  width: 8px; height: 8px;
  border-right: 2px solid var(--active-element, #D97757);
  border-top: 2px solid var(--active-element, #D97757);
  transform: rotate(45deg);
}

/* ---------- multiple-choice options ---------- */

.type-options--multiple .type-options__item { padding-right: 48px; }
.type-options__check {
  position: absolute;
  right: 14px;
  top: 50%;
  width: 22px;
  height: 22px;
  transform: translateY(-50%);
  border: 1.5px solid var(--type-options-border-color, #DED4C8);
  border-radius: 6px;
  background: #fff;
}
.type-options--multiple .is-selected .type-options__check {
  background: var(--active-element, #D97757);
  border-color: var(--active-element, #D97757);
}
.type-options--multiple .is-selected .type-options__check::after {
  content: "";
  position: absolute;
  left: 7px; top: 3px;
  width: 6px; height: 11px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

/* ---------- image options (gender) ---------- */

.type-options-images {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--type-options-images-gap, 6px);
}
.type-options-images__item {
  display: flex;
  flex-direction: column;
  padding: var(--type-options-images-padding, 0);
  border: 1px solid var(--type-options-images-border-color, #DED4C8);
  border-radius: var(--type-options-images-border-radius, 16px);
  background: var(--type-options-images-background, #FFFDFC);
  overflow: hidden;
  cursor: pointer;
}
.type-options-images__item.is-selected {
  border-color: var(--type-options-images-selected-border-color, #D97757);
  background: var(--type-options-images-selected-background, #F4DED2);
}
.type-options-images__img {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  height: var(--type-options-images-image-height, 230px);
  min-height: var(--type-options-images-image-min-height, 230px);
}
.type-options-images__img img { max-width: 100%; max-height: 100%; object-fit: contain; display: block; }
.type-options-images__name {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 10px;
  background: var(--type-options-images-name-background, #D97757);
  color: var(--type-options-images-name-color, #fff);
  font-size: var(--type-options-images-name-font-size, 16px);
  font-weight: 500;
  text-align: left;
}
.type-options-images__chev { font-size: 20px; line-height: 1; }

/* ---------- image ---------- */

.type-image img {
  display: block;
  margin: 0 auto;
  width: var(--type-image-width, 100%);
  max-width: var(--type-image-max-width, 100%);
  height: var(--type-image-height, auto);
  max-height: var(--type-image-max-height, none);
  object-fit: var(--type-image-object-fit, contain);
  border-radius: var(--type-image-border-radius, 0);
}

/* ---------- review ---------- */

.type-review {
  padding: 14px 16px;
  border-radius: 14px;
  background: #FFFDFC;
  box-shadow: 0 8px 16px rgba(75, 52, 37, .05);
  text-align: left;
}
.type-review__title { color: #E3A008; font-size: 15px; letter-spacing: 1px; margin-bottom: 6px; }
.type-review__img { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; float: right; }
.type-review__content { font-size: 14px; line-height: 1.5; color: #2B2521; }
.type-review__name { margin-top: 8px; font-size: 13px; font-weight: 700; color: #746B63; }

/* ---------- graph ---------- */

.type-graph {
  padding: 12px 8px 4px;
  border-radius: 16px;
  background: var(--type-graph-background, transparent);
}
.type-graph svg { display: block; width: 100%; height: auto; overflow: visible; }
.type-graph .tg-axis { font-size: 10px; fill: #746B63; }
.type-graph .tg-note { font-size: 9.5px; fill: #5F5148; }
.type-graph .tg-pin rect { fill: #F4DED2; }
.type-graph .tg-pin text { font-size: 9.5px; font-weight: 700; fill: #B85C3B; }
.type-graph .tg-line { stroke-dasharray: 600; stroke-dashoffset: 600; animation: tgDraw 1.4s ease-out .2s forwards; }
@keyframes tgDraw { to { stroke-dashoffset: 0; } }

/* ---------- primary button ---------- */

.container-type-button { margin: 16px 0; }
.type-button {
  position: var(--type-button-position, static);
  left: var(--type-button-left, auto);
  bottom: var(--type-button-bottom, auto);
  transform: var(--type-button-transform, none);
  z-index: var(--type-button-z-index, auto);
  display: block;
  width: var(--type-button-width, 100%);
  max-width: min(var(--type-button-max-width, 400px), 400px);
  min-height: var(--type-button-min-height, 54px);
  margin: 0 auto;
  padding: 16px 24px;
  border: 0;
  border-radius: var(--type-button-border-radius, 13px);
  background: var(--type-button-background-color, #D97757);
  color: var(--type-button-text-color, var(--type-button-color, #fff));
  box-shadow: var(--type-button-box-shadow, none);
  font-family: Arial, Helvetica, sans-serif;
  font-size: var(--type-button-font-size, 21.2px);
  font-weight: var(--type-button-font-weight, 700);
  line-height: 1.2;
  cursor: pointer;
}
.type-button:active { filter: brightness(.95); }
@media (max-width: 600px) {
  .type-button { font-size: min(var(--type-button-font-size, 18px), 18px); }
}

/* ---------- top badge + default progress ---------- */

.fn-topbar {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 29px;
  padding: 0 44px;
  background: #D6C2B8;
  font-size: 15px;
  color: #000;
}
.fn-topbar__rating { position: absolute; right: 14px; font-weight: 600; }
.fn-progress-row {
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 540px;
  margin: 10px auto 0;
  padding: 0 12px;
}
.fn-back {
  flex: none;
  width: 28px; height: 28px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #2B2521;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}
.fn-progress { flex: 1; height: 8px; border-radius: 8px; background: #fff; overflow: hidden; }
.fn-progress__bar { height: 100%; border-radius: 8px; background: #7D944D; transition: width .3s ease; }

/* ---------- popups ---------- */

.fn-popup-open, .fn-popup-open body { overflow: hidden; }
.fn-popup {
  position: fixed;
  inset: 0;
  z-index: 20000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(43, 37, 33, .45);
}
@media (min-width: 640px) { .fn-popup { align-items: center; } }
.fn-popup__panel {
  position: relative;
  width: 100%;
  max-width: 600px;
  max-height: 88vh;
  overflow: auto;
  padding: 28px 20px 24px;
  border-radius: 20px 20px 0 0;
  background: var(--background, #FFFDF8);
  text-align: left;
}
@media (min-width: 640px) { .fn-popup__panel { border-radius: 20px; } }
.fn-popup__close {
  position: absolute;
  top: 8px; right: 10px;
  width: 36px; height: 36px;
  border: 0;
  background: transparent;
  font-size: 28px;
  line-height: 1;
  color: #746B63;
  cursor: pointer;
}
.fn-popup__body .container-type:first-child { margin-top: 0; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .type-graph .tg-line { stroke-dashoffset: 0; }
}
