/* General body styles */
body {
  display: flex;
  justify-content: center;
  height: 100vh;
  margin: 0;
  background: linear-gradient(rgba(27, 27, 27, 0.7), rgba(41, 41, 41, 0.7)),
    url("img/apt.webp");
  background-size: cover;
  background-position: center;
  position: relative;
  overflow: hidden;
  font-family: "Bungee", "Gugi", sans-serif;
}

button {
  padding: 12px 30px;
  font-family: "Bungee", "Gugi", sans-serif;
  font-size: 20px;
  cursor: pointer;
  border: none;
  border-radius: 30px;
  background: linear-gradient(135deg, #f56b8f 0%, #f78ca0 100%);
  color: white;
  font-weight: 600;
  box-shadow: 0 4px 15px rgba(245, 107, 143, 0.3);
  transition: all 0.3s ease;
  text-transform: uppercase;
  letter-spacing: 1px;
}

button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(245, 107, 143, 0.4);
  background: linear-gradient(135deg, #f45c83, #f67a95 100%);
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* Typography styles */
#typography {
  margin: 0;
  position: fixed;
  right: 6vw;
  bottom: 15vw;
  display: flex;
  flex-direction: column;
  color: rgba(255, 255, 255, 0.95);
  line-height: 1.05;
  font-weight: 700;
  transform: rotate(-16deg);
}

#typography > .author {
  font-size: 48px;
}

#typography > .title {
  font-size: 148px;
}

/* Countdown styles */
#countdown {
  font-size: 200px;
  font-weight: 700;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: rgba(255, 255, 255, 0.9);
  text-shadow: 0 0 20px rgba(255, 182, 193, 0.6);
}

#countdown::before {
  content: attr(data-count);
  display: block;
  transform-origin: center;
  animation: pulse 1s infinite;
}

/* Controls styles */
#controls {
  position: absolute;
  bottom: 20px;
  z-index: 10;
  display: flex;
  gap: 15px;
}

/* Hand styles */
#hands {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  width: 100%;
  height: 100%;
  position: relative;
  z-index: -1;
}

.hand {
  width: 200px;
  position: absolute;
  transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.2));
  bottom: 50px;
}

/* Ready game styles */
#ready-game {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  background: rgba(0, 0, 0, 0.4);
  padding: 40px;
  border-radius: 12px;
  backdrop-filter: blur(10px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

#ready-game > h2 {
  color: #fff;
}

#ready-game > div::after {
  content: " 층";
  font-size: 0.6em;
  letter-spacing: -4px;
}

#random-number {
  font-size: 60px;
  font-weight: bold;
  color: #fff;
  text-shadow: 0 0 10px rgba(255, 182, 193, 0.8);
  margin-bottom: 20px;
}

#start-btn {
  font-size: 24px;
  padding: 15px 40px;
}

/* Score box styles */
#score-box {
  position: absolute;
  top: 20px;
  right: 20px;
  padding: 15px 25px;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(10px);
  color: white;
  font-size: 18px;
  font-weight: 600;
  border-radius: 8px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  border: none;
  text-align: center;
}

#score {
  font-size: 32px;
}

/* Result floor styles */
#result-floor {
  position: absolute;
  top: 150px;
  right: 20px;
  background: linear-gradient(135deg, #f56b8f 0%, #f78ca0 100%);
  color: white;
  font-size: 38px;
  font-weight: 800;
  padding: 25px;
  border-radius: 8px;
  display: none;
  box-shadow: 0 6px 20px rgba(245, 107, 143, 0.4);
  animation: floatAnimation 2s infinite;
}

/* Rank board styles */
#rank-board {
  position: absolute;
  top: 20px;
  left: 20px;
  width: 300px;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(10px);
  border: none;
  border-radius: 8px;
  padding: 12px;
  color: white;
  box-shadow: 0 8px 32px (0, 0, 0, 0.1);
}

#rank-board > h3 {
  text-align: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 10px;
  margin-top: 0;
  margin-bottom: 8px;
  font-size: 18px;
}

.rank-item {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  text-align: center;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  transition: background-color 0.3s ease;
}

.rank-item:hover {
  background: rgba(255, 255, 255, 0.05);
}

.rank {
  font-weight: 700;
  font-size: 18px;
  color: #f56b8f;
}

/* Game over styles */
#game-over {
  display: none;
  position: absolute;
  align-items: center;
  flex-direction: column;
  justify-content: center;
  gap: 15px;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 20;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(15px);
  padding: 40px 60px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
  color: white;
}

.game-over-title {
  margin: 0;
  font-size: 36px;
  color: #f56b8f;
}

#game-over-score {
  font-size: 48px;
  font-weight: 700;
  color: white;
}

/* Record input styles */
.record {
  display: none;
  text-align: center;
  margin: 20px 0;
}

.record input {
  margin-right: 10px;
  width: 200px;
  padding: 12px 20px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.3);
  color: white;
  font-size: 16px;
  outline: none;
}

.record > button {
  padding: 12px 20px;
  font-size: 16px;
  background: linear-gradient(135deg, #f56b8f 0%, #f78ca0 100%);
  border: none;
  border-radius: 8px;
  color: white;
  cursor: pointer;
  transition: background 0.3s ease;
}

.record > button:hover {
  background: linear-gradient(135deg, #f45c83 0%, #f67a95 100%);
}

/* Responsive design */
@media (max-width: 560px) {
  #rank-board {
    top: 10px;
    left: 10px;
    width: 220px;
    padding: 10px;
  }

  #rank-board.hidden {
    display: none;
  }

  #rank-board > h3 {
    font-size: 16px;
    margin-bottom: 8px;
    padding-bottom: 8px;
  }

  .rank-item {
    font-size: 13px;
    padding: 6px 0;
  }

  .rank {
    font-size: 13px;
  }

  .hand {
    width: 140px;
  }

  #score-box {
    top: 10px;
    right: 10px;
    padding: 8px 12px;
    font-size: 16px;
  }

  #score {
    font-size: 24px;
  }

  #ready-game {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    padding: 20px;
    border-radius: 8px;
  }

  #ready-game > h2 {
    font-size: 16px;
  }

  #random-number {
    font-size: 30px;
    margin-bottom: 15px;
  }

  #start-btn {
    font-size: 20px;
    padding: 10px 30px;
  }

  #result-floor {
    top: 100px;
    right: 10px;
    font-size: 28px;
    padding: 15px;
  }

  #game-over {
    width: 80%;
    padding: 30px;
  }

  .game-over-title {
    font-size: 28px;
  }

  .game-over-score {
    font-size: 36px;
  }

  button {
    padding: 10px 20px;
    font-size: 16px;
  }

  .record input {
    width: 150px;
    padding: 8px 15px;
  }

  #typography {
    right: 5vw;
    bottom: 10vh;
    transform: rotate(-10deg);
  }

  #typography > .author {
    font-size: 32px;
  }

  #typography > .title {
    font-size: 96px;
  }
}

/* Pulse animation for countdown */
@keyframes pulse {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.1);
  }
  100% {
    transform: scale(1);
  }
}

/* FloatAnimation animation for result box */
@keyframes floatAnimation {
  0% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-5px);
  }
  100% {
    transform: translateY(0);
  }
}
