* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Arial', sans-serif;
  background: #70C5CE;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 20px;
}

.game-container {
  position: relative;
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  justify-content: center;
  gap: 30px;
  max-width: 100%;
  flex-wrap: wrap;
}

h1 {
  color: #fff;
  font-size: 2rem;
  font-weight: bold;
  text-shadow: 2px 2px 0px #000;
  margin-bottom: 5px;
  text-align: center;
  letter-spacing: 2px;
}

.subtitle {
  color: #fff;
  font-size: 1rem;
  text-shadow: 1px 1px 0px #000;
  text-align: center;
  margin-bottom: 15px;
  font-weight: bold;
}

.canvas-container {
  position: relative;
  border: 3px solid #000;
  border-radius: 0;
  overflow: hidden;
  box-shadow: 5px 5px 0px #000;
  background: #fff;
  padding: 0;
}

#canvas {
  display: block;
  background: #70C5CE;
  width: 100%;
  height: auto;
}

.character-selection {
  background: rgba(0, 0, 0, 0.3);
  border: 2px solid #000;
  border-radius: 0;
  padding: 20px;
  box-shadow: 3px 3px 0px #000;
  min-width: 200px;
}

.character-selection h3 {
  margin: 0 0 15px 0;
  font-family: 'Courier New', monospace;
  font-weight: bold;
  text-align: center;
}

.character-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.char-btn {
  background: #fff;
  border: 2px solid #000;
  border-radius: 0;
  padding: 10px;
  cursor: pointer;
  font-family: 'Courier New', monospace;
  font-weight: bold;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: all 0.2s;
  box-shadow: 2px 2px 0px #000;
}

.char-btn:hover {
  background: #FFD700;
  box-shadow: 1px 1px 0px #000;
}

.char-btn.active {
  background: #FFD700;
  box-shadow: 1px 1px 0px #000;
}

.char-preview {
  font-size: 1.5rem;
  width: 30px;
  text-align: center;
}

.controls {
  color: #fff;
  text-align: center;
  font-size: 0.9rem;
  margin-top: 15px;
  text-shadow: 1px 1px 0px #000;
  font-family: 'Courier New', monospace;
  font-weight: bold;
  clear: both;
  width: 100%;
}

.score-display {
  position: absolute;
  top: 10px;
  right: 10px;
  background: none;
  color: #fff;
  padding: 5px 10px;
  font-size: 1.2rem;
  font-weight: bold;
  text-shadow: 2px 2px 0px #000;
  font-family: 'Courier New', monospace;
  z-index: 10;
}



.game-over {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: #FFD700;
  color: #000;
  padding: 20px;
  border: 3px solid #000;
  border-radius: 0;
  text-align: center;
  box-shadow: 5px 5px 0px #000;
  display: none;
  font-family: 'Courier New', monospace;
}

.game-over h2 {
  margin-bottom: 10px;
  font-size: 1.5rem;
  text-shadow: none;
}

.game-start {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #FFD700;
    color: #000;
    padding: 20px;
    border: 3px solid #000;
    border-radius: 0;
    text-align: center;
    box-shadow: 5px 5px 0px #000;
    display: block;
    font-family: 'Courier New', monospace;
  }
  
  .game-start h2 {
    margin-bottom: 10px;
    font-size: 1.5rem;
    text-shadow: none;
  }

/* Center and emphasize the final score text inside the game-over block */
.game-over #finalScore {
  margin-top: 5px;
  font-size: 1.3rem;
  font-weight: bold;
}

.restart-btn {
  background: #FFD700;
  color: #000;
  border: 2px solid #000;
  padding: 8px 16px;
  font-size: 1rem;
  cursor: pointer;
  font-family: 'Courier New', monospace;
  font-weight: bold;
  margin-top: 15px;
  box-shadow: 2px 2px 0px #000;
}

.restart-btn:hover {
  background: #FFA500;
  box-shadow: 1px 1px 0px #000;
}

@media (max-width: 900px) {
  .game-container {
    flex-direction: column;
    align-items: center;
    gap: 20px;
  }

  .character-selection {
    min-width: 300px;
    max-width: 400px;
  }

  .character-buttons {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
  }

  .char-btn {
    min-width: 120px;
    flex-direction: column;
    text-align: center;
    gap: 5px;
  }
}

@media (max-width: 600px) {
  body {
    padding: 10px;
  }

  h1 {
    font-size: 1.5rem;
  }

  .subtitle {
    font-size: 0.8rem;
  }

  .canvas-container {
    border-width: 2px;
    box-shadow: 3px 3px 0px #000;
  }

  .character-selection {
    min-width: auto;
    max-width: 100%;
  }

  .character-buttons {
    flex-direction: column;
  }

  .char-btn {
    min-width: auto;
  }

  .controls {
    font-size: 0.8rem;
  }
}

/* ---------- CANVAS RESPONSIVE FIX ---------- */
.canvas-wrapper {
    width: 100%;
    max-width: 400px;
    aspect-ratio: 400 / 512;
  }
  
  #canvas {
    width: 100%;
    height: 100%;
    display: block;
  }
  
  /* ---------- CONTAINER ---------- */
  .game-container {
    width: 100%;
    justify-content: center;
  }
  
  /* ---------- OVERLAYS ---------- */
  .game-over,
  .game-start {
    width: 90%;
    max-width: 320px;
  }
  
  /* ---------- MOBILE FIRST ---------- */
  @media (max-width: 768px) {
    body {
      padding: 12px;
    }
  
    .game-container {
      gap: 16px;
    }
  
    .score-display {
      font-size: 1rem;
      top: 6px;
      right: 6px;
    }
  
    .restart-btn {
      width: 100%;
      font-size: 0.95rem;
    }
  
    .game-over h2,
    .game-start h2 {
      font-size: 1.2rem;
    }
  }
  
  /* ---------- SMALL PHONES ---------- */
  @media (max-width: 480px) {
    body {
      padding: 8px;
    }
  
    .canvas-container {
      border-width: 2px;
      box-shadow: 2px 2px 0px #000;
    }
  
    .score-display {
      font-size: 0.9rem;
    }
  
    .game-over,
    .game-start {
      padding: 14px;
    }
  }
  