@font-face {
  font-family: "PixelEmulator";
  src: url("fonts/PixelEmulator.ttf") format("truetype");
  font-weight: normal;
  font-style: normal;
}

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

body,
html {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: "PixelEmulator", sans-serif;
}

#game-canvas {
  display: block;
  width: 100%;
  height: 100%;
}

#start-button {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: 120px;
  height: 120px;
  border-radius: 50%;
  border: none;
  color: white;
  font-size: 20px;
  font-weight: bold;
  font-family: "PixelEmulator", sans-serif;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
  cursor: pointer;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3), 0 6px 6px rgba(0, 0, 0, 0.2),
    inset 0 -5px 10px rgba(0, 0, 0, 0.2);
  transition: all 0.3s ease;
  z-index: 100;
}

#start-button {
  bottom: 50px;
  background: linear-gradient(145deg, #ff5722, #e91e63);
}

#start-button:hover {
  transform: translateX(-50%) scale(1.05);
  box-shadow: 0 15px 25px rgba(0, 0, 0, 0.4), 0 10px 10px rgba(0, 0, 0, 0.3),
    inset 0 -7px 12px rgba(0, 0, 0, 0.3);
}

#start-button:active {
  transform: translateX(-50%) scale(0.95);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2), 0 3px 3px rgba(0, 0, 0, 0.1),
    inset 0 -3px 8px rgba(0, 0, 0, 0.1);
}

/* Health display */
#health-container {
  position: absolute;
  top: 20px;
  right: 20px;
  display: flex;
  gap: 10px;
  z-index: 100;
}

.heart {
  width: 30px;
  height: 30px;
  filter: drop-shadow(2px 2px 4px rgba(0, 0, 0, 0.5));
  transition: all 0.3s ease;
}

/* Score display */
#score-container {
  position: absolute;
  top: 20px;
  left: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 100;
  font-size: 20px;
  font-weight: bold;
  font-family: "PixelEmulator", sans-serif;
  color: white;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

#score-label {
  margin-right: 5px;
}

#score-value {
  min-width: 30px;
}

/* Direction buttons */
#direction-buttons {
  position: absolute;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  z-index: 100;
  display: none; /* Initially hidden */
}

.horizontal-buttons {
  display: flex;
  gap: 120px;
}

#up-button {
  background: linear-gradient(145deg, #4285f4, #3367d6);
}

#down-button {
  background: linear-gradient(145deg, #b37feb, #9254de);
}

#left-button {
  background: linear-gradient(145deg, #95de64, #73d13d);
}

#right-button {
  background: linear-gradient(145deg, #ff7875, #ff4d4f);
}

.direction-btn {
  width: 80px;
  height: 80px;
  border-radius: 15px;
  border: none;

  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: 0 8px 15px rgba(0, 0, 0, 0.3), 0 4px 6px rgba(0, 0, 0, 0.2),
    inset 0 -4px 8px rgba(0, 0, 0, 0.2);
  transition: all 0.2s ease;
}

.direction-btn img {
  width: 50%;
  height: 50%;
  filter: drop-shadow(1px 1px 2px rgba(0, 0, 0, 0.3));
}

.direction-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.4), 0 6px 8px rgba(0, 0, 0, 0.3),
    inset 0 -5px 10px rgba(0, 0, 0, 0.3);
}

.direction-btn:active, .direction-btn.active {
  transform: scale(0.95);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2), 0 2px 4px rgba(0, 0, 0, 0.1),
    inset 0 -2px 5px rgba(0, 0, 0, 0.1);
}

/* Sequence container */
#sequence-container {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  gap: 15px;
  z-index: 100;
}

.sequence-item {
  width: 60px;
  height: 60px;
  background-color: rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  position: relative;
}

.sequence-item img {
  width: 70%;
  height: 70%;
  filter: drop-shadow(2px 2px 3px rgba(0, 0, 0, 0.3));
}

/* Rhythm game ring */
.rhythm-ring {
  position: absolute;
  border: 8px solid #4285f4;
  border-radius: 10px;
  box-shadow: 0 0 20px rgba(66, 133, 244, 0.8);
  animation: shrink-ring 2s linear forwards;
  pointer-events: none;
  z-index: -1;
}

/* Ring colors based on direction */
.sequence-item[data-direction="up"] .rhythm-ring {
  border-color: #4285f4;
  box-shadow: 0 0 20px rgba(66, 133, 244, 0.8);
}

.sequence-item[data-direction="down"] .rhythm-ring {
  border-color: #9254de;
  box-shadow: 0 0 20px rgba(146, 84, 222, 0.8);
}

.sequence-item[data-direction="left"] .rhythm-ring {
  border-color: #73d13d;
  box-shadow: 0 0 20px rgba(115, 209, 61, 0.8);
}

.sequence-item[data-direction="right"] .rhythm-ring {
  border-color: #ff4d4f;
  box-shadow: 0 0 20px rgba(255, 77, 79, 0.8);
}

@keyframes shrink-ring {
  0% {
    width: 200%;
    height: 200%;
    top: -50%;
    left: -50%;
    opacity: 0.9;
  }
  100% {
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    opacity: 0.3;
  }
}

/* Judgment feedback */
.judgment {
  position: absolute;
  top: -30px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 18px;
  font-weight: bold;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
  animation: fade-up 1s forwards;
  pointer-events: none;
  z-index: 10;
}

.perfect {
  color: #ffeb3b;
  text-shadow: 0 0 10px rgba(255, 235, 59, 0.8);
}

.good {
  color: #4caf50;
  text-shadow: 0 0 10px rgba(76, 175, 80, 0.8);
}

.miss {
  color: #f44336;
  text-shadow: 0 0 10px rgba(244, 67, 54, 0.8);
}

@keyframes fade-up {
  0% {
    opacity: 1;
    transform: translate(-50%, 0);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -20px);
  }
}

/* Game over message */
#game-over {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 60px;
  font-weight: bold;
  font-family: "PixelEmulator", sans-serif;
  color: #ff0000;
  text-shadow: 0 0 10px rgba(0, 0, 0, 0.7), 0 0 20px rgba(0, 0, 0, 0.5);
  z-index: 200;
  animation: pulse 1.5s infinite alternate;
}

@keyframes pulse {
  from {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
  }
  to {
    transform: translate(-50%, -50%) scale(1.1);
    opacity: 0.8;
  }
}

/* Volume control button */
#volume-control {
  position: absolute;
  right: 20px;
  bottom: 20px;
  /* transform: translateX(-50%); */
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background-color: rgba(255, 255, 255, 0.3);
  cursor: pointer;
  z-index: 100;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  transition: all 0.3s ease;
}

#volume-control:hover {
  background-color: rgba(255, 255, 255, 0.5);
}

#volume-control:active {
  background-color: rgba(255, 255, 255, 0.5);
}

#volume-control.volume-on {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M3 9v6h4l5 5V4L7 9H3zm13.5 3c0-1.77-1.02-3.29-2.5-4.03v8.05c1.48-.73 2.5-2.25 2.5-4.02zM14 3.23v2.06c2.89.86 5 3.54 5 6.71s-2.11 5.85-5 6.71v2.06c4.01-.91 7-4.49 7-8.77s-2.99-7.86-7-8.77z'/%3E%3C/svg%3E");
  background-position: center;
  background-repeat: no-repeat;
  background-size: 24px;
}

#volume-control.volume-off {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M16.5 12c0-1.77-1.02-3.29-2.5-4.03v2.21l2.45 2.45c.03-.2.05-.41.05-.63zm2.5 0c0 .94-.2 1.82-.54 2.64l1.51 1.51C20.63 14.91 21 13.5 21 12c0-4.28-2.99-7.86-7-8.77v2.06c2.89.86 5 3.54 5 6.71zM4.27 3L3 4.27 7.73 9H3v6h4l5 5v-6.73l4.25 4.25c-.67.52-1.42.93-2.25 1.18v2.06c1.38-.31 2.63-.95 3.69-1.81L19.73 21 21 19.73l-9-9L4.27 3zM12 4L9.91 6.09 12 8.18V4z'/%3E%3C/svg%3E");
  background-position: center;
  background-repeat: no-repeat;
  background-size: 24px;
}
