* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --orange-500: hsl(25, 97%, 53%);
  --white: hsl(0, 100%, 100%);
  --grey-500: hsl(217, 12%, 63%);
  --grey-500-transparent-073: hsla(217, 12%, 63%, 0.073);
  --grey-500-transparent-1: hsla(217, 12%, 63%, 0.1);
  --grey-900: hsl(213, 19%, 18%);
  --grey-950: hsl(216, 12%, 8%);
}

body {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100vw;
  height: 100vh;
  font-size: 15px;
  font-weight: 400;
  font-family: "Overpass", sans-serif;
  background-color: var(--grey-950);
}

main {
  width: 418px;
  height: 422px;
  margin-top: 6px;
  border-radius: 32px;
  background: radial-gradient(circle at top, rgba(36, 43, 53, 1), rgba(23, 30, 40, 0.79));
  border: 3px solid #111518;
}

.background-circle-star {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background-color: var(--grey-500-transparent-073);
  margin: 32px 0 0 32px;
  padding-left: 1px;
  display: flex;
  justify-content: center;
  align-items: center;
}

#rating-title {
  color: var(--white);
  font-size: 27.7px;
  letter-spacing: 0.37px;
  font-weight: 500;
  margin: 37px 0 0 32px;
}

#rating-description {
  color: var(--grey-500);
  margin: 10px 31px 0 32px;
  font-size: 15px;
  line-height: 1.61;
}

fieldset {
  display: flex;
  border: none;
  margin: 22px 31px 0 32px;
}

.background-circle:nth-of-type(2) {
  margin-left: 21px;
}

.background-circle:nth-of-type(3) {
  margin-left: 22px;
}

.background-circle:nth-of-type(4) {
  margin-left: 21px;
}

.background-circle:nth-of-type(5) {
  margin-left: 22px;
}


.background-circle {
  width: 51px;
  height: 51px;
  border-radius: 50%;
  background-color: var(--grey-500-transparent-1);
  padding: 3px 0 0 1px;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
}

.background-circle:hover {
  background-color: var(--orange-500);
}

.background-circle.active {
  background-color: var(--white);
  color: var(--grey-950);
}

.background-circle label {
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  color: var(--grey-500);
}

.background-circle:hover label {
  color: var(--grey-950);
}

.background-circle.active label {
  color: var(--grey-950);
}

.background-circle:nth-of-type(2) label {
  transform: translateX(-1px);
}

.background-circle:nth-of-type(4) label {
  transform: translateX(-1px);
}

.background-circle:nth-of-type(5) label {
  transform: translateX(-1px);
}

.background-circle input[type="radio"] {
  display: none;
}

button[type="submit"] {
  width: 341px;
  font-family: "Overpass", sans-serif;
  height: 45px;
  border: none;
  border-radius: 22px;
  background-color: var(--orange-500);
  color: var(--grey-950);
  font-size: 15px;
  font-weight: bold;
  cursor: pointer;
  text-align: center;
  margin: 32px 31px 0 32px;
  padding: 4px 0 0 1px;
  display: block;
  letter-spacing: 2px;
}

button[type="submit"]:hover {
  background-color: var(--white);
}

.thank-you-state {
  display: none;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 45px 32px 0;
}

.thank-you-state[aria-hidden="false"] {
  display: flex;
}

.thank-you-state img {
  margin-right: 8px;
}

.selected-rating-feedback{
  color: var(--orange-500);
}

.selected-rating-background {
  background-color: var(--grey-500-transparent-1);
  width: 193px;
  height: 32px;
  border-radius: 20px;
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
  margin-top: 32px;
  padding: 3px 0 0 2px;
}

#thank-you-title {
  color: var(--white);
  font-size: 27.7px;
  letter-spacing: 0.37px;
  font-weight: 500;
  margin-top: 39px;
}

.thank-you-description {
  color: var(--grey-500);
  font-size: 15px;
  line-height: 1.61;
  margin-right: 9px;
  text-align: center;
  margin-top: 10px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.error-message {
  position: absolute;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  background-color: rgba(255, 99, 71, 0.9);
  color: white;
  padding: 12px 20px;
  border-radius: 8px;
  text-align: center;
  z-index: 1000;
  animation: fadeIn 0.3s ease-out forwards;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translate(-50%, -20px);
  }

  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

@keyframes fadeOut {
  from {
    opacity: 1;
    transform: translate(-50%, 0);
  }

  to {
    opacity: 0;
    transform: translate(-50%, -20px);
  }
}

.error-message.fade-out {
  animation: fadeOut 0.3s ease-in forwards;
}

@media (max-width: 465px) {
  main {
    width: 333px;
    height: 366px;
    border-radius: 20px;
  }

  .background-circle-star {
    width: 40px;
    height: 40px;
    margin: 24px 0 0 24px;
  }

  .background-circle-star img {
    width: 14px;
    height: 14px;
  }

  #rating-title {
    font-size: 23.5px;
    letter-spacing: 0.48px;
    margin: 22px 0 0 24px;
  }

  #rating-description {
    margin: 13px 24px 0 24px;
    font-size: 14px;
    line-height: 1.6;
  }

  fieldset {
    margin: 21px 24px 0 24px;
  }

.background-circle {
    width: 42px;
    height: 42px;
    padding: 2px 0 0 1px;
  }

  .background-circle:nth-of-type(2) {
    margin-left: 17px;
  }

  .background-circle:nth-of-type(3) {
    margin-left: 18px;
  }

  .background-circle:nth-of-type(4) {
    margin-left: 18px;
  }

  .background-circle:nth-of-type(5) {
    margin-left: 18px;
  }

  .background-circle label {
    font-size: 13.7px;
  }

  button[type="submit"] {
    width: 279px;
    font-size: 14px;
    margin: 24px 31px 0 24px;
    padding: 3px 0 0 0;
    letter-spacing: 1.8px;
  }

  .thank-you-state {
    padding: 34px 24px 0;
  }

  .thank-you-state img {
    width: 144px;
    height: 96px;
    margin-right: 0px;
  }


  .selected-rating-background {
    width: 168px;
    height: 32px;
    margin-top: 24px;
    padding: 3px 0 0 1px;
    letter-spacing: 0.1px;
  }

  .selected-rating-feedback {
    font-size: 13.8px;
  }

  #thank-you-title {
    font-size: 23.7px;
    margin-top: 30px;
  }

  .thank-you-description {
    font-size: 13.7px;
    line-height: 1.64;
    letter-spacing: 0.15px;
    margin-right: 0px;
    margin-left: 0px;
    margin-top: 13px;
  }

  .error-message {
    width: 85%;
    font-size: 14px;
    padding: 10px 15px;
  }

}
