* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  background: #0f172a;
  color: white;
}

.screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.screen.active {
  opacity: 1;
  pointer-events: all;
}

/* CHARACTER SELECTION */
#characterSelection {
  background: linear-gradient(135deg, #020024, #090979, #00d4ff);
}

.selection-container {
  text-align: center;
}

.selection-container h1 {
  font-size: clamp(2rem, 8vw, 3rem);
  margin-bottom: 1rem;
  letter-spacing: 2px;
}

.selection-container p {
  font-size: clamp(1rem, 4vw, 1.2rem);
  margin-bottom: 2rem;
  opacity: 0.9;
}

.character-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: clamp(1rem, 3vw, 2rem);
  max-width: 800px;
  padding: 0 1rem;
}

.character-card {
  cursor: pointer;
  padding: clamp(1rem, 3vw, 1.5rem);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid rgba(255, 255, 255, 0.3);
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.8rem;
}

.character-card:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.6);
  transform: scale(1.05);
}

.character-card:active {
  transform: scale(0.95);
}

.character-card img {
  width: clamp(70px, 20vw, 100px);
  height: clamp(70px, 20vw, 100px);
  object-fit: cover;
  border-radius: 12px;
}

.character-card h3 {
  font-size: clamp(0.9rem, 3vw, 1rem);
  text-align: center;
}

#homeBtn, #homeBtn2 {
  margin-top: 2rem;
  background: rgba(255, 255, 255, 0.15);
  border: 2px solid rgba(255, 255, 255, 0.4);
}

#homeBtn:hover, #homeBtn2:hover {
  background: rgba(255, 255, 255, 0.3);
  border-color: rgba(255, 255, 255, 0.7);
}

/* GAME SCREEN */
#gameScreen {
  background: #000;
}

#gameContainer {
  position: relative;
  width: 100%;
  height: 100%;
}

#gifBackground {
  position: absolute;
  inset: 0;
  background-image: url('img/epstein-jeffrey-epstein.gif');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  z-index: 0;
  opacity: 0;
  transition: opacity 0.3s ease;
}

#gifBackground.active {
  opacity: 1;
}

canvas {
  display: block;
  position: absolute;
  top: 0;
  left: 0;
  z-index: 1;
}

#hud {
  position: fixed;
  top: 20px;
  left: 20px;
  right: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 100;
  pointer-events: none;
}

#score {
  font-size: clamp(1.2rem, 4vw, 1.8rem);
  font-weight: bold;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
  pointer-events: all;
}

#pauseBtn {
  pointer-events: all;
  font-size: clamp(0.9rem, 3vw, 1.2rem);
  padding: clamp(0.5rem, 2vw, 0.8rem) clamp(1rem, 3vw, 1.5rem);
  border: none;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.2);
  color: white;
  cursor: pointer;
  transition: all 0.2s ease;
}

#pauseBtn:hover {
  background: rgba(255, 255, 255, 0.4);
}

/* GAME OVER SCREEN */
#gameOverScreen {
  background: rgba(0, 0, 0, 0.9);
}

.game-over-container {
  text-align: center;
  background: rgba(255, 255, 255, 0.1);
  padding: clamp(2rem, 5vw, 3rem);
  border-radius: 20px;
  backdrop-filter: blur(10px);
  max-width: 90vw;
  max-height: 90vh;
  overflow-y: auto;
}

.game-over-container h1 {
  font-size: clamp(2rem, 8vw, 3rem);
  margin-bottom: 1rem;
  color: #ff00cc;
}

#finalScore {
  font-size: clamp(1.2rem, 4vw, 1.5rem);
  margin-bottom: 2rem;
  opacity: 0.9;
}

button {
  margin: 0.5rem;
  padding: clamp(0.8rem, 3vw, 1rem) clamp(1.5rem, 4vw, 2rem);
  font-size: clamp(0.9rem, 3vw, 1rem);
  border: none;
  border-radius: 8px;
  background: linear-gradient(45deg, #ff00cc, #3333ff);
  color: white;
  font-weight: bold;
  cursor: pointer;
  transition: transform 0.2s ease;
  touch-action: manipulation;
}

button:hover {
  transform: scale(1.05);
}

button:active {
  transform: scale(0.98);
}

@media (max-width: 768px) {
  button {
    margin: 0.7rem;
  }
}

/* 1440p (2560x1440) and above */
@media (min-width: 2560px) {
  .selection-container h1 {
    font-size: 4rem;
  }

  .selection-container p {
    font-size: 1.6rem;
    margin-bottom: 3rem;
  }

  .character-grid {
    max-width: 1200px;
    gap: 3rem;
  }

  .character-card {
    padding: 2.5rem;
    border-radius: 24px;
  }

  .character-card img {
    width: 150px;
    height: 150px;
    border-radius: 16px;
  }

  .character-card h3 {
    font-size: 1.4rem;
  }

  #score {
    font-size: 2.5rem;
  }

  #pauseBtn {
    font-size: 1.6rem;
    padding: 1.2rem 2.5rem;
    border-radius: 12px;
  }

  .game-over-container {
    padding: 4rem;
    border-radius: 30px;
  }

  .game-over-container h1 {
    font-size: 4.5rem;
  }

  #finalScore {
    font-size: 2rem;
    margin-bottom: 3rem;
  }

  button {
    padding: 1.4rem 3rem;
    font-size: 1.4rem;
    border-radius: 12px;
  }
}

/* 4K (3840x2160) and above */
@media (min-width: 3840px) {
  .selection-container h1 {
    font-size: 5.5rem;
  }

  .selection-container p {
    font-size: 2rem;
    margin-bottom: 4rem;
  }

  .character-grid {
    max-width: 1600px;
    gap: 4rem;
  }

  .character-card {
    padding: 3.5rem;
    border-radius: 32px;
  }

  .character-card img {
    width: 200px;
    height: 200px;
    border-radius: 20px;
  }

  .character-card h3 {
    font-size: 1.8rem;
  }

  #score {
    font-size: 3.5rem;
  }

  #pauseBtn {
    font-size: 2rem;
    padding: 1.6rem 3.5rem;
    border-radius: 16px;
  }

  .game-over-container {
    padding: 5rem;
    border-radius: 40px;
  }

  .game-over-container h1 {
    font-size: 6rem;
  }

  #finalScore {
    font-size: 2.8rem;
    margin-bottom: 4rem;
  }

  button {
    padding: 1.8rem 4rem;
    font-size: 1.8rem;
    border-radius: 16px;
  }
}
