* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  /*Font-size*/
  font-size: 62.5%;

  /*Purple colors*/
  --purple-050: #f8f7ff;
  --purple-100: #e7ddff;
  --purple-200: #8b5cf6;
  --purple-300: #6a3fcb;

  /*Grayscale colors*/
  --white: #ffffff;
  --gray-100: #e2e2e2;
  --gray-200: #3f4658;
  --gray-300: #1e1e1e;

  /*Font-family*/
  --Sora: "Sora", sans-serif;
  --Inter: "Inter", sans-serif;
}

body {
  font-size: 1.6rem;
  max-height: 100vh;
  padding: 6rem 2rem 8rem 2rem;

  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4rem;

  background: var(--purple-050);
  width: 100%;
  max-width: 1024px;
  margin: 0 auto;
}

body.dark {
  background: var(--gray-300);
  color: var(--white);
}

header,
main,
footer {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Header */
#title {
  color: var(--purple-200);
  text-align: center;

  /* Title */
  font-family: var(--Sora);
  font-size: 3.2rem;
  font-style: normal;
  font-weight: 700;
  line-height: normal;
}

/* Main */
main {
  gap: 2rem;
}

#card-counter {
  align-self: stretch;

  color: var(--gray-200);
  text-align: center;
  margin-bottom: 2rem;

  /* Text Md */
  font-family: var(--Inter);
  font-size: 1.6rem;
  font-style: normal;
  font-weight: 500;
  line-height: normal;
}

.card-container {
  display: flex;
  width: 27.2rem;
  height: 24rem;
  padding: 2.4rem;
  justify-content: center;
  align-items: center;
  flex-shrink: 0;

  border-radius: 1.6rem;
  border: 1px solid var(--gray-100);
  background: var(--white);

  cursor: pointer;
}

.card-container.flipped {
  background: var(--purple-100);
}

#cards {
  display: flex;
  flex-direction: column;
  justify-content: center;
  flex: 1 0 0;
  align-self: stretch;

  color: var(--gray-300);
  text-align: center;

  /* Text Lg */
  font-family: var(--Inter);
  font-size: 2.4rem;
  font-style: normal;
  font-weight: 500;
  line-height: normal;
}

#cards.flipped {
  color: var(--gray-200);

  /* Text Md */
  font-size: 1.6rem;
}

/* Animação de flip */
.flashcard-inner {
  transition: transform 0.6s;
  transform-style: preserve-3d;
  width: 100%;
  height: 100%;
  position: relative;
}

.flashcard {
  perspective: 100rem;
}

.card-front,
.card-back {
  backface-visibility: hidden;
  position: absolute;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  color: var(--gray-300);
  text-align: center;
  font-family: var(--Inter);
  border-radius: 1.6rem;
  font-size: 2.4rem;
  font-weight: 500;

  align-items: center;
  text-align: center;
}

.card-back {
  transform: rotateY(180deg);
  font-size: 1.6rem;
  color: var(--gray-200);
}

.flipped .flashcard-inner {
  transform: rotateY(180deg);
}

#card-front,
#card-back {
  transition: opacity 0.3s ease-in-out;
}

#text {
  align-self: stretch;

  color: var(--gray-200);
  text-align: center;
  margin-top: 2rem;

  /* Text Sm */
  font-family: var(--Inter);
  font-size: 1.4rem;
  font-style: normal;
  font-weight: 500;
  line-height: normal;
}

/* Footer */
#next-button {
  display: flex;
  height: 4rem;
  padding: 0rem 1.6rem;
  justify-content: center;
  align-items: center;
  gap: 1rem;

  border-radius: 0.8rem;
  border: none;
  background: var(--purple-300);

  color: var(--white);
  text-align: center;

  /* Button */
  font-family: var(--Inter);
  font-size: 1.4rem;
  font-style: normal;
  font-weight: 600;
  line-height: normal;

  cursor: pointer;
  transition: background 0.3s ease-in-out;
}

#next-button:hover {
  background: var(--purple-200);
}

#next-button:focus {
  outline: 2px solid var(--purple-100);
  outline-offset: 2px;
}

#next-button:disabled {
  cursor: not-allowed;
}

#toggle-dark-mode {
  position: absolute;
  top: 2rem;
  right: 2rem;
  background: var(--purple-200);
  color: white;
  border: none;
  padding: 0.8rem 1.2rem;
  border-radius: 0.8rem;
  cursor: pointer;
  font-family: var(--Inter);
  font-size: 1.2rem;
  transition: background 0.3s ease-in-out;
}

.mode-toggle {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 1000;
  display: flex;
  gap: 0.5rem;
}

.mode-toggle button {
  background-color: transparent;
  border: none;
  cursor: pointer;
  padding: 2rem;
  transition: transform 0.2s ease;
}

.mode-toggle button:hover {
  transform: scale(1.1);
}

.mode-toggle img {
  width: 24px;
  height: 24px;
}

body.dark #card-counter,
body.dark #text,
body.dark .card-front,
body.dark .card-back {
  color: var(--white);
}

body.dark #card-front {
  color: var(--gray-300);
}

body.dark #card-back {
  color: var(--gray-200);
}

/* Responsividade */
@media (max-width: 1024px) {
  body {
    max-width: 100%;
    padding: 6rem 2rem 8rem 2rem;
    height: auto;
    gap: 3.2rem;
  }

  main {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2.4rem;
    width: 100%;
    max-width: 50rem;
  }

  .card-container {
    width: 100%;
    max-width: 36rem;
    height: 28rem;
  }

  #title {
    font-size: 4rem;
  }

  #card-counter,
  #text {
    font-size: 1.6rem;
  }

  .card-front,
  .card-back {
    font-size: 2.2rem;
    padding: 1.2rem;
  }
}
