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

html, body {
  width: 100%;
  height: 100%;
  background: #000;
  color: #fff;
  overflow: hidden;
}

#three-container {
  position: fixed;
  inset: 0;
}

.center {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  pointer-events: none;
}

h1 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: clamp(3rem, 7vw, 5rem);
  font-weight: 400;
  letter-spacing: 0.25em;
  text-transform: uppercase;
}

p {
  margin-top: 1rem;
  font-size: 0.85rem;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  opacity: 0.45;
}

/* Game button */
.game-btn {
  margin-top: 3rem;
  padding: 0.8rem 2rem;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.7rem;
  font-weight: 300;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.5);
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.15);
  cursor: pointer;
  pointer-events: auto;
  transition: all 0.4s ease;
}

.game-btn:hover {
  color: rgba(255, 255, 255, 0.9);
  border-color: rgba(255, 255, 255, 0.4);
  background: rgba(255, 255, 255, 0.03);
}

.game-btn.hidden {
  opacity: 0;
  pointer-events: none;
}

/* Game canvas */
#game-canvas {
  position: fixed;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.5s ease;
}

#game-canvas.active {
  opacity: 1;
  pointer-events: auto;
}

/* Game score */
#game-score {
  position: fixed;
  top: 2rem;
  right: 2rem;
  z-index: 15;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.2rem;
  font-weight: 300;
  letter-spacing: 0.2em;
  color: rgba(255, 255, 255, 0.6);
  opacity: 0;
  transition: opacity 0.5s ease;
}

#game-score.active {
  opacity: 1;
}

/* Game quit hint */
#game-quit {
  position: fixed;
  bottom: 5rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 15;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.65rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.25);
  opacity: 0;
  transition: opacity 0.5s ease;
}

#game-quit.active {
  opacity: 1;
}

/* Game controls */
#game-controls {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 15;
  display: flex;
  gap: 2rem;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.65rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.35);
  opacity: 0;
  transition: opacity 0.5s ease;
}

#game-controls.active {
  opacity: 1;
}

.control {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.key {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.4rem;
  height: 1.4rem;
  padding: 0 0.4rem;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 3px;
  font-size: 0.6rem;
  color: rgba(255, 255, 255, 0.5);
}

/* Mobile controls */
#mobile-controls {
  display: none;
  position: fixed;
  bottom: 2rem;
  left: 0;
  right: 0;
  z-index: 20;
  justify-content: space-between;
  padding: 0 1.5rem;
  opacity: 0;
  transition: opacity 0.5s ease;
  pointer-events: none;
}

#mobile-controls.active {
  opacity: 1;
  pointer-events: auto;
}

.mobile-left,
.mobile-right {
  display: flex;
  gap: 0.8rem;
  align-items: center;
}

.mobile-btn {
  width: 4rem;
  height: 4rem;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  color: rgba(255, 255, 255, 0.6);
  font-size: 1.4rem;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
  transition: all 0.15s ease;
}

.mobile-btn.mobile-dir {
  width: 3rem;
  height: 3rem;
  font-size: 1rem;
  opacity: 0.5;
}

.mobile-btn:active,
.mobile-btn.pressed {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.5);
  transform: scale(0.95);
}

/* Highscore button */
#highscore-btn {
  position: fixed;
  top: 2rem;
  left: 2rem;
  z-index: 15;
  padding: 0.4rem 0.8rem;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.6rem;
  font-weight: 300;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.35);
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.15);
  cursor: pointer;
  opacity: 0;
  transition: all 0.4s ease;
  pointer-events: none;
}

#highscore-btn.active {
  opacity: 1;
  pointer-events: auto;
}

#highscore-btn:hover {
  color: rgba(255, 255, 255, 0.7);
  border-color: rgba(255, 255, 255, 0.3);
}

/* Highscore modal */
#highscore-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.85);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

#highscore-modal.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  text-align: center;
  padding: 2rem 3rem;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(0, 0, 0, 0.5);
}

.modal-content h2 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.9rem;
  font-weight: 400;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.6);
  margin-bottom: 1.5rem;
}

#highscore-list {
  margin-bottom: 1.5rem;
}

.highscore-entry {
  display: flex;
  justify-content: space-between;
  gap: 2rem;
  padding: 0.5rem 0;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.8rem;
  letter-spacing: 0.15em;
  color: rgba(255, 255, 255, 0.5);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.highscore-entry:last-child {
  border-bottom: none;
}

.highscore-entry .rank {
  color: rgba(255, 255, 255, 0.25);
  min-width: 1.5rem;
}

.highscore-entry .name {
  text-transform: uppercase;
  flex: 1;
  text-align: left;
}

.highscore-entry .score {
  color: rgba(255, 255, 255, 0.7);
}

.highscore-entry.empty {
  color: rgba(255, 255, 255, 0.2);
}

#pseudo-input {
  margin-bottom: 1.5rem;
}

#pseudo-input p {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.6);
  margin-bottom: 1rem;
  opacity: 1;
}

#pseudo {
  width: 5rem;
  padding: 0.5rem;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1rem;
  letter-spacing: 0.3em;
  text-align: center;
  text-transform: uppercase;
  color: #fff;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.3);
  outline: none;
}

#pseudo::placeholder {
  color: rgba(255, 255, 255, 0.2);
}

#pseudo-submit {
  margin-left: 0.5rem;
  padding: 0.5rem 1rem;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.6);
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.3);
  cursor: pointer;
  transition: all 0.3s ease;
}

#pseudo-submit:hover {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.5);
}

#modal-close {
  padding: 0.5rem 1.5rem;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.65rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.4);
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.15);
  cursor: pointer;
  transition: all 0.3s ease;
}

#modal-close:hover {
  color: rgba(255, 255, 255, 0.7);
  border-color: rgba(255, 255, 255, 0.3);
}

.hidden {
  display: none !important;
}

/* Show mobile controls on touch devices */
@media (pointer: coarse) {
  #mobile-controls {
    display: flex;
  }

  #game-controls {
    display: none !important;
  }

  #game-quit {
    display: none !important;
  }

  #highscore-btn {
    top: auto;
    bottom: 7rem;
    left: 50%;
    transform: translateX(-50%);
  }
}
