@import url("https://fonts.googleapis.com/css2?family=Pixelify+Sans:wght@400..700&display=swap");

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

html {
  height: 100%;
}

body {
  font-family: "Arial", sans-serif;
  background-color: #0f0f1a;
  background-image: radial-gradient(#444cf7 0.5px, #0f0f1a 0.5px);
  background-size: 10px 10px;
  color: #ffffff;
  height: 100%;
  position: relative;
  text-align: center;
  z-index: 1;
}

body::after {
  content: "";
  position: absolute;
  background: rgba(0, 0, 0, 0.3);
  z-index: -1;
}

h1,
h2,
h3 {
  font-family: "Pixelify Sans", sans-serif;
}

.screen {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
}

.screen.hidden {
  display: none;
}

/* Start Screen Styles */
.start-container {
  max-width: 900px;
  margin: 0 auto;
  width: 100%;
  text-align: center;
  position: relative;
  z-index: 1;
  padding: 3em 0;
}

.game-title {
  font-size: 6rem;
  margin-bottom: 0.5rem;
  font-weight: 900;
  position: relative;
  display: inline-block;
  background: linear-gradient(135deg, #fff 0%, #a8b3ff 50%, #fff 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: 0 0 40px rgba(68, 76, 247, 0.5);
  filter: drop-shadow(0 0 30px rgba(68, 76, 247, 0.4));
}

.game-subtitle {
  font-size: 1.2rem;
  color: rgba(168, 179, 255, 0.8);
  margin-bottom: 2rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  font-weight: 300;
  text-shadow: 0 0 20px rgba(68, 76, 247, 0.3);
}

.info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  margin-bottom: 2.5rem;
}

.info-card {
  background: rgba(15, 15, 26, 0.85);
  border: 1px solid rgba(68, 76, 247, 0.2);
  border-radius: 15px;
  padding: 1.5rem;
  backdrop-filter: blur(20px);
  transition: all 0.3s ease;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.info-card:hover {
  border-color: rgba(68, 76, 247, 0.4);
  box-shadow: 0 8px 32px rgba(68, 76, 247, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
  transform: translateY(-2px);
}

.card-header {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin-bottom: 1.2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid rgba(68, 76, 247, 0.2);
}

.card-header .icon {
  display: none;
}

.card-header h3 {
  font-size: 1.3rem;
  margin: 0;
  color: #a8b3ff;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  font-weight: 700;
  text-shadow: 0 0 20px rgba(68, 76, 247, 0.3);
}

.card-content {
  text-align: left;
}

.control-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  padding: 0.8rem;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(68, 76, 247, 0.1);
  border-radius: 8px;
  transition: all 0.2s ease;
}

.control-item:hover {
  background: rgba(68, 76, 247, 0.1);
  border-color: rgba(68, 76, 247, 0.3);
}

.control-key {
  font-weight: 700;
  background: linear-gradient(135deg, #444cf7, #6b73ff);
  padding: 0.5rem 1rem;
  border-radius: 6px;
  font-size: 0.9rem;
  letter-spacing: 0.2em;
  box-shadow: 0 4px 15px rgba(68, 76, 247, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.control-desc {
  color: rgba(168, 179, 255, 0.9);
  font-size: 1rem;
  font-weight: 500;
}

.phase-item {
  display: flex;
  gap: 1rem;
  margin-bottom: 1rem;
  padding: 0.8rem;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(68, 76, 247, 0.1);
  border-radius: 8px;
  align-items: flex-start;
  transition: all 0.2s ease;
}

.phase-item:hover {
  background: rgba(68, 76, 247, 0.1);
  border-color: rgba(68, 76, 247, 0.3);
}

.phase-number {
  font-size: 1.5rem;
  font-weight: 900;
  min-width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: linear-gradient(135deg, #444cf7, #6b73ff);
  box-shadow: 0 4px 15px rgba(68, 76, 247, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.phase-item.phase-2 .phase-number {
  background: linear-gradient(135deg, #ff4757, #ff6b7a);
  box-shadow: 0 4px 15px rgba(255, 71, 87, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.phase-details {
  flex: 1;
}

.phase-details strong {
  display: block;
  font-size: 1.1rem;
  margin-bottom: 0.3rem;
  color: #a8b3ff;
  font-weight: 700;
}

.phase-item.phase-2 .phase-details strong {
  color: #ff8a95;
}

.phase-details p {
  font-size: 0.9rem;
  color: rgba(168, 179, 255, 0.7);
  margin: 0;
}

.control-tip {
  margin-top: 1rem;
  padding: 0.8rem;
  background: rgba(68, 76, 247, 0.15);
  border-left: 3px solid #444cf7;
  border-radius: 4px;
  font-size: 0.9rem;
  color: rgba(168, 179, 255, 0.9);
  font-weight: 500;
}

.difficulty-section {
  margin-bottom: 2.5rem;
}

.difficulty-title {
  font-size: 1.5rem;
  margin-bottom: 1.5rem;
  color: #a8b3ff;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-weight: 700;
  text-shadow: 0 0 20px rgba(68, 76, 247, 0.3);
}

.difficulty-buttons {
  display: flex;
  gap: 1.5rem;
  justify-content: center;
}

.difficulty-btn {
  flex: 1;
  max-width: 180px;
  padding: 1.5rem 1rem;
  background: rgba(15, 15, 26, 0.85);
  border: 2px solid rgba(68, 76, 247, 0.2);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  align-items: center;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.difficulty-btn:hover {
  transform: translateY(-5px);
  background: rgba(68, 76, 247, 0.1);
  border-color: rgba(68, 76, 247, 0.4);
  box-shadow: 0 8px 25px rgba(68, 76, 247, 0.2);
}

.difficulty-btn.active {
  background: rgba(68, 76, 247, 0.2);
  border-color: #444cf7;
  box-shadow: 0 0 30px rgba(68, 76, 247, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  transform: scale(1.05);
}

.diff-icon {
  display: none;
}

.diff-name {
  font-size: 1.2rem;
  font-weight: 700;
  color: #ffffff;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.1);
}

.diff-desc {
  font-size: 0.85rem;
  color: rgba(168, 179, 255, 0.6);
}

.difficulty-btn.easy.active .diff-name {
  color: #a8b3ff;
  text-shadow: 0 0 20px rgba(68, 76, 247, 0.5);
}

.difficulty-btn.medium.active .diff-name {
  color: #ffd98a;
  text-shadow: 0 0 20px rgba(255, 193, 7, 0.5);
}

.difficulty-btn.hard.active .diff-name {
  color: #ff8a95;
  text-shadow: 0 0 20px rgba(255, 71, 87, 0.5);
}

.start-btn {
  padding: 1.5rem 4rem;
  font-size: 1.5rem;
  font-weight: 900;
  background: linear-gradient(135deg, #444cf7, #6b73ff);
  color: white;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 50px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: all 0.3s ease;
  text-transform: uppercase;
  letter-spacing: 0.25em;
  box-shadow: 0 10px 40px rgba(68, 76, 247, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.start-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 15px 50px rgba(68, 76, 247, 0.7),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.3);
}

.start-btn:active {
  transform: translateY(-1px);
}

.btn-text {
  position: relative;
  z-index: 2;
}

.btn-glow {
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.4),
    transparent
  );
  transition: left 0.5s;
}

.start-btn:hover .btn-glow {
  left: 100%;
}

/* Old button styles for other screens */
h1 {
  font-size: 3rem;
  margin-bottom: 2rem;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.btn {
  padding: 15px 40px;
  font-size: 1.2rem;
  background-color: #4caf50;
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 0.3s, transform 0.1s;
}

.btn:hover {
  background-color: #45a049;
  transform: scale(1.05);
}

.btn:active {
  transform: scale(0.95);
}

#gameScreen {
  position: relative;
  padding: 0;
}

.stats {
  position: absolute;
  top: 20px;
  left: 20px;
  width: 240px;
  background: rgba(0, 0, 0, 0.3);
  border-left: 2px solid rgba(255, 255, 255, 0.2);
  padding: 12px 16px;
  z-index: 10;
  backdrop-filter: blur(5px);
  font-size: 0.75rem;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.stat-label {
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.65rem;
  letter-spacing: 1px;
  font-weight: 600;
}

.stat-value {
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.9rem;
  font-weight: bold;
}

.progress-bar {
  width: 100%;
  height: 3px;
  background: rgba(255, 255, 255, 0.1);
  margin: 8px 0;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(
    90deg,
    rgba(76, 175, 80, 0.6),
    rgba(76, 175, 80, 0.8)
  );
  transition: width 0.3s ease, background 0.5s ease;
}

.progress-fill.phase2 {
  background: linear-gradient(
    90deg,
    rgba(244, 67, 54, 0.6),
    rgba(244, 67, 54, 0.8)
  );
}

.phase-indicator {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  text-align: center;
  font-size: 0.6rem;
  color: rgba(76, 175, 80, 0.7);
  letter-spacing: 1.5px;
  font-weight: 600;
}

.phase-indicator.phase2 {
  color: rgba(244, 67, 54, 0.9);
}

.stats-header {
  display: none;
}

.username {
  display: none;
}

.phase-badge {
  display: none;
}

.phase-message {
  display: none;
}

.progress-container {
  display: none;
}

.progress-label {
  display: none;
}

.progress-time {
  display: none;
}

.stats-grid {
  display: none;
}

.stat-item {
  display: none;
}

@keyframes shimmer {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(100%);
  }
}

.progress-time {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.8);
  margin-top: 6px;
  text-align: center;
  font-weight: bold;
}

.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.stat-item {
  background: rgba(0, 0, 0, 0.3);
  padding: 12px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  text-align: center;
}

.stat-label {
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.6);
  margin-bottom: 4px;
  letter-spacing: 1.5px;
  font-weight: bold;
}

.stat-value {
  font-size: 1.8rem;
  font-weight: bold;
  color: #ffffff;
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
}

#phaseIndicator {
  margin-top: 10px;
  font-size: 1.2rem;
  font-weight: bold;
  color: #4caf50;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.9);
  transition: color 0.5s;
  display: none;
}

#phaseIndicator.phase2 {
  color: #f44336;
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.7;
  }
}

.bloody-vignette {
  position: absolute;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 5;
  background: radial-gradient(
    ellipse at center,
    rgba(0, 0, 0, 0) 0%,
    rgba(0, 0, 0, 0) 40%,
    rgba(139, 0, 0, 0.3) 70%,
    rgba(139, 0, 0, 0.5) 100%
  );
  opacity: 0;
  transition: opacity 2s ease-in;
}

.bloody-vignette.active {
  opacity: 1;
}

#gameCanvas {
  display: block;
  /* background-color: #2a2a2a; */
}

#gameOverScreen {
  height: 100%;
}

#gameOverScreen p {
  font-size: 1.5rem;
  margin-bottom: 2rem;
}

/* Win Screen Styles */
#winScreen {
  height: 100%;
  background: linear-gradient(
    135deg,
    rgba(255, 215, 0, 0.05) 0%,
    rgba(68, 76, 247, 0.1) 50%,
    rgba(147, 51, 234, 0.05) 100%
  );
  animation: victoryBgPulse 3s ease-in-out infinite;
}

@keyframes victoryBgPulse {
  0%,
  100% {
    filter: brightness(1);
  }
  50% {
    filter: brightness(1.2);
  }
}

.win-container {
  max-width: 700px;
  width: 90%;
  text-align: center;
  position: relative;
  z-index: 1;
  animation: slideInUp 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes slideInUp {
  from {
    opacity: 0;
    transform: translateY(60px) scale(0.9);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.victory-banner {
  margin-bottom: 3rem;
  position: relative;
}

.trophy-icon {
  font-size: 6rem;
  margin-bottom: 1rem;
  animation: trophyBounce 1s ease-in-out infinite,
    trophyGlow 2s ease-in-out infinite;
  filter: drop-shadow(0 0 30px rgba(255, 215, 0, 0.8));
}

@keyframes trophyBounce {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-20px);
  }
}

@keyframes trophyGlow {
  0%,
  100% {
    filter: drop-shadow(0 0 30px rgba(255, 215, 0, 0.8));
  }
  50% {
    filter: drop-shadow(0 0 50px rgba(255, 215, 0, 1));
  }
}

.victory-title {
  font-size: 5rem;
  font-weight: 900;
  margin-bottom: 0.5rem;
  background: linear-gradient(
    135deg,
    #ffd700 0%,
    #ffed4e 25%,
    #fff 50%,
    #ffed4e 75%,
    #ffd700 100%
  );
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: goldShine 3s linear infinite;
  filter: drop-shadow(0 0 40px rgba(255, 215, 0, 0.6));
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

@keyframes goldShine {
  to {
    background-position: 200% center;
  }
}

.victory-subtitle {
  font-size: 1.3rem;
  color: rgba(255, 215, 0, 0.9);
  margin-bottom: 0;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  font-weight: 600;
  text-shadow: 0 0 20px rgba(255, 215, 0, 0.5);
  animation: subtitlePulse 2s ease-in-out infinite;
}

@keyframes subtitlePulse {
  0%,
  100% {
    opacity: 0.9;
  }
  50% {
    opacity: 1;
  }
}

.win-stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  margin-bottom: 2.5rem;
  animation: statsReveal 0.8s ease-out 0.3s both;
}

@keyframes statsReveal {
  from {
    opacity: 0;
    transform: scale(0.8);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.win-stat-card {
  background: rgba(15, 15, 26, 0.9);
  border-radius: 20px;
  padding: 2rem 1.5rem;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.win-stat-icon {
  font-size: 2.5rem;
  margin-bottom: 0.8rem;
  filter: drop-shadow(0 0 10px rgba(255, 215, 0, 0.5));
}

.win-stat-label {
  font-size: 0.9rem;
  color: rgba(255, 215, 0, 0.8);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.win-stat-value {
  font-size: 3rem;
  font-weight: 900;
}

.win-actions {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  animation: actionsReveal 0.8s ease-out 0.6s both;
}

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

.win-btn {
  position: relative;
  padding: 1.2rem 3rem;
  font-size: 1.2rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
  overflow: hidden;
  font-family: "Pixelify Sans", sans-serif;
}

.win-btn.primary {
  background: linear-gradient(135deg, #ffd700, #ffed4e);
  color: #0f0f1a;
  box-shadow: 0 8px 25px rgba(255, 215, 0, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.win-btn.primary:hover {
  transform: translateY(-3px) scale(1.05);
  box-shadow: 0 12px 35px rgba(255, 215, 0, 0.6),
    inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.win-btn.primary:active {
  transform: translateY(-1px) scale(1.02);
}

.win-btn .btn-text {
  position: relative;
  z-index: 2;
}

.win-btn .btn-glow {
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(
    45deg,
    transparent,
    rgba(255, 255, 255, 0.3),
    transparent
  );
  transform: rotate(45deg);
  animation: btnGlowSweep 3s linear infinite;
}

@keyframes btnGlowSweep {
  0% {
    left: -150%;
  }
  100% {
    left: 150%;
  }
}

/* Responsive Design for Win Screen */
@media (max-width: 768px) {
  .victory-title {
    font-size: 3.5rem;
  }

  .trophy-icon {
    font-size: 4rem;
  }

  .win-stats-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .win-stat-value {
    font-size: 2.5rem;
  }

  .win-message p {
    font-size: 1rem;
  }
}

@media (max-width: 480px) {
  .victory-title {
    font-size: 2.5rem;
  }

  .trophy-icon {
    font-size: 3rem;
  }

  .win-stat-value {
    font-size: 2rem;
  }

  .win-btn {
    padding: 1rem 2rem;
    font-size: 1rem;
  }
}
