*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  20% {
    transform: translateX(-8px);
  }
  40% {
    transform: translateX(8px);
  }
  60% {
    transform: translateX(-6px);
  }
  80% {
    transform: translateX(6px);
  }
}

html {
  min-height: 100vh;
  min-height: 100dvh;
}

body {
  font-family: "Montserrat", sans-serif;
  overflow-x: hidden;
  min-height: 100vh;
  min-height: 100dvh;
}

.quiz {
  width: 100%;
  max-width: 1920px;
  margin-inline: auto;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;

  .quiz-screen {
    display: none;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    width: 100%;
    overflow: auto;
    &.is-active {
      display: flex;
    }
  }

  .quiz-screen--intro {
    position: relative;

    &::before {
      content: "";
      position: fixed;
      inset: 0;
      background: url("images/bg-step-intro.webp") 85% 75% / cover no-repeat;
      z-index: -1;
    }

    .quiz-progress__track {
      background: rgba(255, 255, 255, 0.2);
    }
    .quiz-progress__fill {
      background: #fff;
    }

    .quiz-step {
      flex: 1;
      justify-content: center;
      padding-block: clamp(1.25rem, 3vh, 2.5rem);
      padding-inline-start: clamp(1rem, 4vw, 5rem);
      padding-inline-end: clamp(1rem, 6vw, 5rem);
      gap: clamp(1rem, 4vh, 3rem);
    }

    .quiz-step__title {
      max-width: 59%;
      font-size: clamp(40px, 4.167vw, 80px);
      font-weight: 700;
      color: #fff;
      text-transform: uppercase;
      line-height: 1.25;
      text-shadow: 0 2px 16px rgba(0, 0, 0, 0.2);
    }

    .quiz-step__subtitle {
      max-width: 45%;
      font-size: clamp(21px, 2.1875vw, 42px);
      font-weight: 500;
      color: #fff;
      line-height: 1.1;
      text-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
    }

    .quiz-btn {
      align-self: flex-start;
    }
  }

  .quiz-screen--main {
    position: relative;

    &::before {
      content: "";
      position: fixed;
      inset: 0;
      background: url("images/bg-step-main.webp") center bottom / cover
        no-repeat;
      z-index: -1;
    }

    .quiz-progress__track {
      background: rgba(0, 0, 0, 0.1);
    }
    .quiz-progress__fill {
      background: #0061af;
    }

    .quiz-form {
      display: flex;
      flex-direction: column;
      flex: 1;
      min-height: 0;
      align-items: center;
      justify-content: center;
      width: 100%;
    }

    .quiz-step {
      flex: none;
      padding-block: clamp(2rem, 8svh, 6.875rem) clamp(1.5rem, 4svh, 2.5rem);
      padding-inline: clamp(1.25rem, 5vw, 2.5rem);
      align-items: center;
      gap: 0;
      max-width: 1044px;
      width: 100%;

      .quiz-step__top {
        flex-shrink: 0;
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 16px;
      }

      .quiz-step__title-block {
        flex-shrink: 0;
        display: flex;
        flex-direction: column;
        justify-content: flex-end;
        align-items: center;
        width: 100%;
        min-height: calc(2 * 1.333 * clamp(30px, 3.125vw, 60px));
      }

      .quiz-step__wrapper {
        flex-shrink: 0;
        display: flex;
        flex-direction: column;
        width: 100%;
        min-height: 450px;
        min-height: min(450px, 45dvh);
      }

      .quiz-step__wrapper > .quiz-step__hint {
        flex-shrink: 0;
        margin-top: 16px;
        margin-bottom: 0;
        text-align: center;
      }

      .quiz-step__content-inner {
        flex: 1;
        min-height: 0;
        width: 100%;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        padding-block: clamp(2rem, 7svh, 4rem);
      }

      > .quiz-btn,
      > a.quiz-btn,
      > .quiz-step__actions {
        flex-shrink: 0;
      }

      .quiz-step__actions {
        position: relative;
        display: inline-flex;
        justify-content: center;
      }

      .quiz-radio-error {
        position: absolute;
        left: 50%;
        bottom: calc(100% + 8px);
        transform: translateX(-50%);
        font-size: 16px;
        font-weight: 500;
        color: #e0002f;
        opacity: 0;
        pointer-events: none;
        white-space: nowrap;
        transition: opacity 0.2s ease;
      }

      .quiz-step__actions.is-error .quiz-radio-error {
        opacity: 1;
      }

      .quiz-step__title {
        color: #0061af;

        font-size: clamp(30px, 3.125vw, 60px);
        font-style: normal;
        font-weight: 700;
        line-height: 1.333;
        text-align: center;
      }

      .quiz-step__hint {
        font-size: clamp(16px, 1.25vw, 24px);
        font-style: normal;
        font-weight: 400;
        line-height: 1.25;

        color: #000;
      }

      .quiz-step__bonus {
        display: flex;
        align-items: center;
        flex-direction: column;
        gap: 20px;

        p {
          font-size: clamp(14px, 1.146vw, 22px);
          font-weight: 700;
          line-height: 1.636;
          text-transform: uppercase;
          max-width: 600px;
          text-align: center;
        }
      }

      .quiz-step__success {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: clamp(14px, 1.25vw, 24px);
        background: rgba(255, 255, 255, 0.88);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        border-radius: 24px;
        padding: clamp(20px, 1.875vw, 36px) clamp(24px, 2.5vw, 48px);
        max-width: 540px;
        width: 100%;
        box-shadow:
          0 8px 40px rgba(0, 97, 175, 0.14),
          0 2px 8px rgba(0, 0, 0, 0.06);
        border: 1px solid rgba(0, 97, 175, 0.1);

        .quiz-step__success-lead {
          font-size: clamp(14px, 1.042vw, 20px);
          font-weight: 600;
          color: #0b1f3a;
          text-align: center;
          line-height: 1.4;
        }

        .quiz-step__success-list {
          list-style: none;
          display: flex;
          flex-direction: column;
          gap: 14px;
          width: 100%;

          li {
            display: flex;
            align-items: center;
            gap: clamp(10px, 0.729vw, 14px);
            font-size: clamp(13px, 0.9375vw, 18px);
            font-weight: 500;
            color: #0b1f3a;
            line-height: 1.4;

            &::before {
              content: "✓";
              display: inline-flex;
              align-items: center;
              justify-content: center;
              width: clamp(18px, 1.5625vw, 30px);
              height: clamp(18px, 1.5625vw, 30px);
              min-width: clamp(18px, 1.5625vw, 30px);
              background: #0061af;
              color: #fff;
              border-radius: 50%;
              font-size: clamp(10px, 0.781vw, 15px);
              font-weight: 700;
            }
          }
        }
      }
    }
  }

  .quiz-header {
    display: flex;
    align-items: flex-end;
    padding: clamp(20px, 2.083vw, 40px) clamp(30px, 3.125vw, 60px) 0;
    gap: clamp(12px, 1.042vw, 20px);

    .quiz-logo {
      flex-shrink: 0;
      height: clamp(25px, 2.083vw, 40px);
    }

    .quiz-progress {
      flex: 1;
    }

    .quiz-progress__track {
      height: 6px;
      border-radius: 50px;
      overflow: hidden;
    }

    .quiz-progress__fill {
      height: 100%;
      border-radius: 50px;
      width: 0%;
      transition: width 0.4s ease;
    }
  }

  .quiz-step {
    display: none;
    flex-direction: column;
    flex: 1;

    &.is-active {
      display: flex;
    }
  }

  .quiz-radios {
    display: flex;
    gap: clamp(16px, 1.667vw, 32px);
    flex-direction: column;

    &.is-error {
      animation: shake 0.4s ease;
    }

    .quiz-radio {
      display: flex;
      align-items: center;
      gap: 14px;
      font-size: clamp(16px, 1.25vw, 24px);
      font-weight: 600;
      color: #000;
      cursor: pointer;

      input[type="radio"] {
        width: clamp(16px, 1.458vw, 28px);
        height: clamp(16px, 1.458vw, 28px);
        accent-color: #0061af;
        cursor: pointer;
        flex-shrink: 0;
        border-radius: 50%;
        transition:
          accent-color 0.2s ease,
          outline-color 0.2s ease;
      }
    }
  }

  .quiz-radios.is-error-flash .quiz-radio input[type="radio"]:not(:checked) {
    accent-color: #e0002f;
  }

  .quiz-inputs {
    display: flex;
    flex-direction: column;
    gap: 9px;
    width: 100%;
    max-width: 43.75rem;

    .quiz-input-wrap {
      display: flex;
      flex-direction: column;
      gap: 6px;
    }

    .quiz-input-error {
      font-size: 13px;
      color: #e0002f;
      padding-left: 26px;
      opacity: 0;
    }

    .quiz-input-wrap.is-error .quiz-input {
      border-color: #e0002f;
    }

    .quiz-input-wrap.is-error .quiz-input-error {
      opacity: 1;
    }

    .quiz-input {
      width: 100%;
      max-width: 43.75rem;
      min-height: clamp(36px, 2.708vw, 52px);
      height: auto;
      padding: 0 clamp(14px, 1.354vw, 26px);
      border: 1px solid #0061af;
      border-radius: 26px;
      background: #fff;
      font-family: "Montserrat", sans-serif;
      font-size: 16px;
      color: #0b1f3a;
      outline: none;
    }
  }

  .quiz-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 100px;
    font-family: "Montserrat", sans-serif;
    font-size: clamp(14px, 0.9375vw, 18px);
    font-weight: 600;
    line-height: 1.333;
    cursor: pointer;
    transition: background 0.2s ease;
    text-decoration: none;
    text-align: center;
  }

  /* Висота 70px — крок 1, крок 5 */
  .quiz-btn--lg {
    min-height: clamp(44px, 3.646vw, 70px);
    height: auto;
    padding: 0 clamp(20px, 2.083vw, 40px);
  }

  /* Висота 52px — кроки 2–4 */
  .quiz-btn--sm {
    min-height: clamp(36px, 2.708vw, 52px);
    height: auto;
    padding: 0 clamp(16px, 1.563vw, 30px);
  }

  .quiz-btn--red {
    background: #ff0d42;
    color: #fff;
  }
  .quiz-btn--red:hover {
    background: #e0002f;
  }

  .quiz-btn--blue {
    background: #0061af;
    color: #fff;
  }
  .quiz-btn--blue:hover {
    background: #004d8f;
  }
}

@media (min-width: 769px) and (max-width: 1100px) {
  .quiz {
    .quiz-screen--intro {
      &::before {
        background: url("images/bg-step-intro-mob.webp") center / cover
          no-repeat;
      }

      .quiz-header {
        justify-content: center;
      }

      .quiz-progress {
        display: none;
      }

      .quiz-step {
        align-items: center;
        justify-content: center;
        max-width: 100%;
      }

      .quiz-step__title {
        text-align: center;
        font-size: 48px;
        max-width: 600px;
      }

      .quiz-step__subtitle {
        text-align: center;
        font-size: 30px;
        max-width: 500px;
      }

      .quiz-btn {
        align-self: center;
      }
    }
  }
}

@media (max-width: 992px) {
  .quiz {
    .quiz-header {
      padding: 28px 24px 0;
    }

    .quiz-screen--main {
      .quiz-step {
        padding-block: clamp(1.25rem, 5svh, 3.5rem) clamp(1.25rem, 3svh, 2rem);

        .quiz-step__title-block {
          min-height: calc(2 * 1.333 * 48px);
        }

        .quiz-step__wrapper {
          min-height: 400px;
          min-height: min(400px, 42dvh);
        }

        .quiz-step__title {
          font-size: 48px;
        }

        .quiz-step__hint {
          font-size: 20px;
        }

        .quiz-step__bonus p {
          font-size: 20px;
          line-height: 32px;
        }

        .quiz-step__success {
          padding: 28px 24px;

          .quiz-step__success-lead {
            font-size: 18px;
          }

          .quiz-step__success-list li {
            font-size: 16px;
          }
        }

        .quiz-step__content-inner {
          justify-content: center;
          align-items: center;
        }
      }
    }

    .quiz-radios .quiz-radio {
      font-size: 20px;
    }
  }
}

@media (max-width: 768px) {
  .quiz {
    min-height: 100vh;
    min-height: 100dvh;

    .quiz-screen {
      min-height: 100vh;
      min-height: 100dvh;
    }

    .quiz-screen--intro {
      &::before {
        background: url("images/bg-step-intro-mob.webp") center 70% / cover
          no-repeat;
      }

      .quiz-header {
        padding: 38px 20px 0;
        justify-content: center;
      }

      .quiz-progress {
        display: none;
      }

      .quiz-logo {
        height: 25px;
      }

      .quiz-step {
        padding: 55px 20px 40px;
        gap: 20px;
        align-items: center;
        justify-content: flex-start;
        max-width: 100%;
      }

      .quiz-step__title {
        color: #fff;
        text-align: center;
        font-family: "Montserrat", sans-serif;
        font-size: clamp(28px, 4.7vw, 36px);
        font-style: normal;
        font-weight: 700;
        line-height: 1.25;
        text-transform: uppercase;
        max-width: clamp(335px, 70vw, 560px);
      }

      .quiz-step__subtitle {
        color: #fff;
        text-align: center;
        font-family: "Montserrat", sans-serif;
        font-size: clamp(18px, 3.125vw, 24px);
        font-style: normal;
        font-weight: 500;
        line-height: 31px;
        max-width: clamp(286px, 60vw, 480px);
      }

      .quiz-btn {
        align-self: center;
        height: 52px;
        padding: 0 30px;
        margin-top: 10px;
      }
    }

    .quiz-screen--main {
      .quiz-header {
        padding: 23px 20px 0;
        align-items: center;
      }

      .quiz-logo {
        height: 25px;
      }

      .quiz-form {
        flex-direction: column;
      }

      .quiz-step {
        padding: 50px 20px 40px;
        gap: 0;
        /*max-width: 375px;*/
        align-items: center;

        .quiz-step__wrapper {
          min-height: 338px;
        }

        .quiz-step__content-inner {
          justify-content: center;
          align-items: center;
        }

        .quiz-step__title-block {
          min-height: calc(2 * 1.1 * 40px);
        }

        .quiz-step__title {
          font-size: 36px;
          line-height: 1.25;
          text-align: center;
        }

        .quiz-step__hint {
          font-size: 18px;
        }
      }

      .quiz-radios {
        gap: 16px;

        .quiz-radio {
          font-size: 18px;
        }
      }

      .quiz-btn--sm {
        min-height: 50px;
        padding: 0 40px;
      }

      .quiz-inputs {
        width: 100%;
      }

      .quiz-input {
        width: 100%;
      }
    }
  }
}
