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

body {
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background: #000;
  font-family: 'Noto Sans', sans-serif;
  touch-action: none;
}

#game {
  width: 100%;
  height: 100%;
  position: relative;
  background: linear-gradient(180deg, #1a1a2e 0%, #0f0f1e 100%);
}

#score, #combo {
  position: absolute;
  color: #fff;
  font-size: 18px;
  font-weight: bold;
  z-index: 10;
}

#score {
  top: 20px;
  left: 20px;
}

#combo {
  top: 20px;
  right: 20px;
}

#player {
  position: absolute;
  bottom: 15%;
  left: 20%;
  width: 80px;
  height: 80px;
}

#playerSprite {
  width: 60px;
  height: 60px;
  background: linear-gradient(135deg, #4FC3F7 0%, #2196F3 100%);
  clip-path: polygon(50% 0%, 45% 15%, 30% 15%, 30% 85%, 45% 85%, 45% 100%, 55% 100%, 55% 85%, 70% 85%, 70% 15%, 55% 15%);
  transition: transform 0.1s;
  box-shadow: 0 0 10px rgba(33, 150, 243, 0.5);
}

#player.parrying #playerSprite {
  transform: translateY(-180px) translateX(80px) rotate(-45deg) scale(1.2);
  filter: brightness(1.5);
  transition: transform 0.15s ease-out;
}

#enemy.vertical-attack ~ #player.parrying #playerSprite {
  transform: translateY(-180px) translateX(0) rotate(0deg) scale(1.2);
}

#enemy.deflected #enemySprite {
  animation: swordDeflect 0.4s ease-out;
}

@keyframes swordDeflect {
  0% {
    transform: translateY(200px) translateX(-120px) rotate(45deg);
  }
  50% {
    transform: translateY(100px) translateX(-100px) rotate(-30deg);
  }
  100% {
    transform: translateY(-50px) translateX(-80px) rotate(-60deg);
    opacity: 0.3;
  }
}

#enemy {
  position: absolute;
  top: 20%;
  right: 20%;
  width: 80px;
  height: 80px;
}

#enemySprite {
  width: 60px;
  height: 60px;
  background: linear-gradient(135deg, #EF5350 0%, #C62828 100%);
  clip-path: polygon(50% 0%, 45% 15%, 30% 15%, 30% 85%, 45% 85%, 45% 100%, 55% 100%, 55% 85%, 70% 85%, 70% 15%, 55% 15%);
  transition: transform 0.3s;
  box-shadow: 0 0 10px rgba(239, 83, 80, 0.5);
}

#enemy.attacking #enemySprite {
  animation: swordSlash var(--attack-speed, 0.6s) ease-in;
}

#enemy.feinting #enemySprite {
  animation: swordFeint 0.3s ease-out;
}

@keyframes swordSlash {
  0% {
    transform: translateY(-30px) translateX(0) rotate(-90deg);
  }
  100% {
    transform: translateY(200px) translateX(-120px) rotate(45deg);
  }
}

#enemy.vertical-attack.attacking #enemySprite {
  animation: swordSlashVertical var(--attack-speed, 0.6s) ease-in;
}

@keyframes swordSlashVertical {
  0% {
    transform: translateY(-30px) translateX(0) rotate(-90deg);
  }
  100% {
    transform: translateY(220px) translateX(0) rotate(-90deg);
  }
}

@keyframes swordFeint {
  0% {
    transform: translateY(100px) translateX(-60px) rotate(20deg);
  }
  100% {
    transform: translateY(-30px) translateX(0) rotate(-90deg);
  }
}

#attackIndicator {
  display: none;
}

#feedback {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 48px;
  font-weight: bold;
  pointer-events: none;
  opacity: 0;
  z-index: 100;
}

#feedback.show {
  animation: feedbackAnim 0.6s ease-out;
}

@keyframes feedbackAnim {
  0% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(0.5);
  }
  50% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.2);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -80%) scale(1);
  }
}

#feedback.perfect {
  color: #FFD700;
  text-shadow: 0 0 20px #FFD700;
}

#feedback.good {
  color: #4CAF50;
  text-shadow: 0 0 20px #4CAF50;
}

#feedback.miss {
  color: #f44336;
  text-shadow: 0 0 20px #f44336;
}

#gameOver {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}

#gameOver.show {
  opacity: 1;
  pointer-events: all;
}

#gameOverContent {
  text-align: center;
  color: #fff;
}

#gameOverContent h1 {
  font-size: 48px;
  margin-bottom: 30px;
  color: #f44336;
}

#gameOverContent p {
  font-size: 24px;
  margin: 15px 0;
}

#restartBtn {
  margin-top: 30px;
  padding: 15px 40px;
  font-size: 20px;
  font-weight: bold;
  background: #2196F3;
  color: #fff;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s;
}

#restartBtn:hover {
  background: #1976D2;
}

#restartBtn:active {
  transform: scale(0.95);
}

#tapArea {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 5;
}

#guideLine {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 60%;
  height: 2px;
  background: rgba(255, 255, 255, 0.2);
  z-index: 1;
}