@import url("https://fonts.googleapis.com/css2?family=Karla:ital,wght@0,200..800;1,200..800&display=swap");
*,
::before,
::after {
  box-sizing: border-box;
  padding: 0;
  margin: 0;
}

body {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  font-family: "Karla", sans-serif;
  accent-color: hsl(169, 82%, 27%);
  min-height: 100vh;
  background-color: hsl(148, 38%, 91%);
}

main {
  width: 100%;
}
main > div {
  width: min(32rem, 100% - 4rem);
  background-color: hsl(0, 0%, 100%);
  border-radius: 10px;
  padding: 1rem;
  margin: 0 auto;
}
main h1 {
  font-size: 24px;
  margin-bottom: 1rem;
}

.success {
  opacity: 0;
  max-width: 320px;
  width: min(32rem, 100% - 2rem);
  padding: 1rem;
  border-radius: 10px;
  color: hsl(0, 0%, 100%);
  background-color: hsl(187, 24%, 22%);
  font-weight: 400;
  transition: opacity 750ms;
}
.success div {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.success h1 {
  font-size: 1rem;
}
.success span {
  font-size: 0.7rem;
}

form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
form div,
form fieldset,
form label {
  display: flex;
  gap: 0.5rem;
}
form div:not(:first-of-type) {
  flex-direction: column;
}
form fieldset {
  border: none;
  flex-direction: column;
}
form fieldset legend {
  margin-bottom: 0.5rem;
}
form fieldset label {
  flex-grow: 1;
}
form fieldset label:has(input:checked) {
  background-color: hsl(148, 38%, 91%);
}
form input:hover {
  cursor: pointer;
}
form textarea {
  resize: none;
  height: 4rem;
}
form span {
  color: hsl(0, 66%, 54%);
  font-size: 14px;
  display: none;
}
form label:not(fieldset label)::after,
form legend::after {
  color: hsl(169, 82%, 27%);
  content: " *";
}
form label[for=consent] {
  display: block;
}
form label[for=consent]:hover {
  cursor: pointer;
}
form input[type=text],
form fieldset label,
form textarea {
  padding: 0.5rem 1rem;
  border: none;
  outline: 1px solid hsl(186, 15%, 59%);
  border-radius: 10px;
}
form input[type=text]:hover, form input[type=text]:focus,
form fieldset label:hover,
form fieldset label:focus,
form textarea:hover,
form textarea:focus {
  cursor: pointer;
  outline: 2px solid hsl(169, 82%, 27%);
}
form input[type=submit] {
  padding: 1rem;
  color: hsl(0, 0%, 100%);
  border-radius: 10px;
  background-color: hsl(169, 82%, 27%);
  border: none;
}
form input[type=submit]:hover, form input[type=submit]:focus {
  cursor: pointer;
  background-color: hsl(187, 24%, 22%);
}

.container {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

@media (width <= 480px) {
  main {
    max-width: 400px;
  }
  form div:first-of-type,
  form fieldset {
    flex-direction: column;
  }
  form textarea {
    height: 8rem;
  }
}