body {
  font-family: "Nanum Pen Script", cursive;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #f8e8a6, #f2d7b0);
  margin: 0;
  padding: 20px;
  color: #333;
  box-sizing: border-box;
  overflow-x: hidden;
  text-align: center;
}

.game-container {
  background-color: rgba(255, 255, 255, 0.85);
  border-radius: 20px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
  padding: 20px;
  width: 95%;
  max-width: 800px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 10px;
}

#logo {
  width: 60px;
  height: 60px;
}

header h1 {
  color: #e74c3c;
  font-size: 40px;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
  margin: 0;
}

main {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.candidates-info {
  display: flex;
  justify-content: space-around;
  align-items: center;
  flex-wrap: wrap;
  gap: 20px;
  font-size: 20px;
}

.candidate {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
}

.candidate-image {
  width: 70px;
  height: 70px;
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.candidate-details {
  display: flex;
  align-items: center;
  gap: 5px;
}

.candidate-name {
  font-weight: bold;
}

.candidate-support {
  color: #3498db;
  font-size: 24px;
}

.current-day {
  font-size: 18px;
  font-weight: bold;
}

.game-actions {
  display: flex;
  justify-content: center;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 10px;
}

.button-container {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}

.button {
  background-color: #3498db;
  border: none;
  color: white;
  padding: 16px 32px;
  text-align: center;
  text-decoration: none;
  display: inline-block;
  font-size: 20px;
  border-radius: 15px;
  cursor: pointer;
  transition: background-color 0.3s ease, transform 0.2s ease;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  min-width: 150px;
  flex: 1 1 auto;
}

.button:hover {
  background-color: #2980b9;
  transform: scale(1.03);
}

.button:disabled {
  background-color: #cccccc;
  cursor: default;
  box-shadow: none;
}

.chart-section {
  width: 100%;
}

#supportChart {
  width: 100%;
  height: 350px;
  max-width: 100%;
}

.game-result {
  width: 100%;
}

#result {
  font-size: 20px;
  color: #333;
  text-align: center;
  opacity: 0;
  transition: opacity 0.5s ease-in-out;
}

#result.show {
  opacity: 1;
}

#popupOverlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.7);
  justify-content: center;
  align-items: center;
  z-index: 10;
}

#popupOverlay.active {
  display: flex;
}

.popup {
  background-color: #fff;
  padding: 30px;
  border-radius: 20px;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
  text-align: center;
  max-width: 500px;
  width: 90%;
  box-sizing: border-box;
  animation: popupScale 0.4s ease-in-out;
}

.popup h2 {
  margin-bottom: 20px;
  color: #e74c3c;
  font-size: 32px;
}

.popup p {
  margin-bottom: 20px;
  font-size: 20px;
  line-height: 1.6;
}

.popup button {
  background-color: #2ecc71;
  border: none;
  color: white;
  padding: 12px 24px;
  text-align: center;
  text-decoration: none;
  display: inline-block;
  font-size: 18px;
  border-radius: 15px;
  cursor: pointer;
  transition: background-color 0.3s ease, transform 0.2s ease;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  min-width: 100px;
}

.popup button:hover {
  background-color: #27ae60;
  transform: scale(1.03);
}

@media (max-width: 768px) {
  .game-container {
    padding: 15px;
  }

  header {
    flex-direction: column;
    gap: 5px;
  }

  #logo {
    width: 50px;
    height: 50px;
  }

  header h1 {
    font-size: 32px;
  }

  .candidates-info {
    font-size: 16px;
    gap: 10px;
  }

  .candidate-image {
    width: 50px;
    height: 50px;
  }

  .candidate-support {
    font-size: 20px;
  }

  .current-day {
    font-size: 14px;
  }

  .game-actions {
    flex-direction: row;
    gap: 10px;
  }

  .button {
    padding: 12px 24px;
    font-size: 16px;
    min-width: 120px;
    flex: 1 1 auto;
  }

  #supportChart {
    height: 250px;
  }

  #result {
    font-size: 16px;
  }

  .popup {
    padding: 20px;
    max-width: 350px;
  }

  .popup h2 {
    font-size: 28px;
  }

  .popup p {
    font-size: 16px;
  }

  .popup button {
    padding: 10px 20px;
    font-size: 14px;
    min-width: 80px;
  }
}

@media (max-width: 768px) and (orientation: landscape) {
  .game-container {
    padding: 10px;
  }

  .candidates-info {
    font-size: 14px;
  }

  .button-container {
    gap: 10px;
  }

  .button {
    padding: 10px 20px;
    font-size: 14px;
    min-width: 100px;
  }

  #supportChart {
    height: 200px;
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes popupScale {
  from {
    transform: scale(0.9);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}
