body {
  font-family: Arial, Helvetica Neue, Helvetica, sans-serif;
  background-color: #f7f7f7;
}

.container {
  max-width: 800px;
  margin: 0 auto;
  text-align: center;
  padding: 2rem;
}

h2 {
  font-size: 24px;
  margin-bottom: 1rem;
}

p {
  font-size: 16px;
  margin-bottom: 2rem;
}

#coin {
  position: relative;
  margin: 2rem auto;
  transform-style: preserve-3d;
  transform: rotateX(0deg);
  width: calc(100vw - 40px);
  max-width: 470px;
  height: calc(100vw - 40px);
  max-height: 470px;
}

.side {
  border: 2px solid;
  outline: 2px solid white;
  outline-offset: -10px;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  backface-visibility: hidden;
  background-size: contain;
  position: absolute;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  text-align: center;
  color: white;
  font-weight: bold;
  font-size: 94px;
  transform-style: preserve-3d;
}
.heads .side {
  border-color: #a16ae8; /* Border color for heads side */
}

.tails .side {
  border: 2px solid #f79e39; /* Border color for tails side */
}
.heads {
  background-color: #a16ae8;
  transform: rotateX(0deg);
}

.tails {
  background-color: #f79e39;
  transform: rotateX(180deg);
}
#flip {
  background-color: black; /* Complementary color */
  color: white; /* Text color */
  padding: 12px 22px;
  font-size: 20px;
  font-weight: bolder;
}

@keyframes flipHeadsHorizontally {
  from {
    transform: rotateX(0deg);
  }
  to {
    transform: rotateX(1800deg);
  }
}

@keyframes flipTailsHorizontally {
  from {
    transform: rotateX(0deg);
  }
  to {
    transform: rotateX(1620deg);
  }
}

#coin.animate-heads {
  animation: flipHeadsHorizontally 3s;
  animation-fill-mode: forwards;
}

#coin.animate-tails {
  animation: flipTailsHorizontally 3s;
  animation-fill-mode: forwards;
}

@media (max-width: 600px) {
  .container {
    padding: 1rem;
  }

  h2 {
    font-size: 20px;
  }

  p {
    font-size: 14px;
    margin-bottom: 1rem;
  }

  #coin {
    width: calc(100vw - 20px);
    max-width: 320px;
    height: calc(100vw - 20px);
    max-height: 320px;
    margin: 1rem auto;
  }

  .side {
    font-size: 64px;
  }
}
