body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    display: flex;
    flex-direction: column;
    align-items: center;
    background-color: #02021a;
    color: white;
    margin: 0;
    overflow: hidden;
    height: 100vh;
    width: 100vw;
    position: fixed;
}

.top-nav {
    width: 100%;
    background-color: rgba(44, 62, 80, 0.8);
    padding: 10px 0;
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 20px;
    z-index: 100;
}

.top-nav a {
    color: white;
    text-decoration: none;
    font-weight: bold;
    font-size: 0.95rem;
    padding: 10px 15px;
    border-radius: 8px;
    transition: background-color 0.2s, transform 0.1s;
}

.top-nav a:hover {
    background-color: #34495e;
}

.top-nav a.active {
    background-color: #348aa7;
    box-shadow: 0 0 10px rgba(52, 138, 167, 0.5);
}

h1 {
    margin: 10px 0;
    text-shadow: 0 0 10px #0fa;
    z-index: 10;
    font-size: 1.5rem;
}

#game-canvas {
    background-color: rgba(0, 0, 0, 0.4);
    border: 2px solid #348aa7;
    border-radius: 10px;
    box-shadow: 0 0 20px rgba(52, 138, 167, 0.5);
    z-index: 10;
    max-width: 95vw;
    max-height: 70vh;
    touch-action: none; /* Critical for mobile touch handling */
}

#game-over-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(0, 0, 0, 0.9);
    padding: 30px;
    border-radius: 20px;
    text-align: center;
    box-shadow: 0 0 30px #ff4e50;
    z-index: 100;
    width: 80%;
    max-width: 300px;
}

#game-over-message {
    font-size: 2rem;
    margin-bottom: 20px;
    color: #ff4e50;
    text-shadow: 0 0 10px #ff4e50;
}

#restart-button {
    padding: 12px 24px;
    font-size: 1.2rem;
    background-color: #4caf50;
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: background-color 0.3s;
}

#restart-button:hover {
    background-color: #45a049;
}

#stars-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  background: radial-gradient(ellipse at bottom, #1B2735 0%, #090A0F 100%);
  overflow: hidden;
}

.star {
  position: absolute;
  background: white;
  border-radius: 50%;
  opacity: 0.5;
  animation: twinkle var(--duration) infinite;
}

@keyframes twinkle {
  0%, 100% { opacity: 0.3; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.2); }
}

@media (max-width: 600px) {
  h1 {
    font-size: 1.2rem;
    margin: 5px 0;
  }
}
