/* public/styles.css */
body {
  margin: 0;
  overflow: hidden;
  background: #001122;
  font-family: monospace, sans-serif;
}

/* Portal effect styles */
#portal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1000;
  display: none;
  justify-content: center;
  align-items: center;
  pointer-events: none;
  background: transparent;
  will-change: opacity, transform;
}

#portal-overlay.active {
  display: flex !important;
}

#portal-overlay.fade-out {
  opacity: 0;
  transition: opacity 0.5s ease-out;
}

.portal-ring {
  position: absolute;
  border-radius: 50%;
  border: 4px solid transparent;
  opacity: 0.8;
  transform: scale(1) rotate(270deg);
  will-change: transform, opacity;
}

.portal-ring.animate {
  animation: portalRing 2s ease-in-out infinite;
  animation-delay: -1s; /* Start from middle of animation */
}

.portal-ring:nth-child(1) {
  width: 100px;
  height: 100px;
  border-top-color: #00ffff;
}

.portal-ring:nth-child(2) {
  width: 200px;
  height: 200px;
  border-right-color: #00aaff;
}

.portal-ring:nth-child(3) {
  width: 300px;
  height: 300px;
  border-bottom-color: #0066ff;
}

.portal-center {
  position: absolute;
  width: 50px;
  height: 50px;
  background: radial-gradient(circle, #ffffff 0%, #00ffff 50%, transparent 100%);
  border-radius: 50%;
  opacity: 0.8;
  transform: scale(15);
  will-change: transform, opacity;
}

.portal-center.animate {
  animation: portalCenter 2s ease-in-out infinite;
  animation-delay: -1s; /* Start from middle of animation */
}

@keyframes portalRing {
  0% {
    transform: scale(0) rotate(0deg);
    opacity: 0;
  }
  20% {
    opacity: 1;
  }
  80% {
    transform: scale(1.5) rotate(540deg);
    opacity: 1;
  }
  100% {
    transform: scale(0) rotate(720deg);
    opacity: 0;
  }
}

@keyframes portalCenter {
  0% {
    transform: scale(0);
    opacity: 0;
  }
  20% {
    opacity: 1;
    transform: scale(1);
  }
  80% {
    transform: scale(30);
    opacity: 0.5;
  }
  100% {
    transform: scale(0);
    opacity: 0;
  }
}

@keyframes portalFadeOut {
  0% {
    background: transparent;
  }
  90% {
    background: rgba(0, 255, 255, 0.1);
  }
  100% {
    background: transparent;
    display: none;
  }
}

/* Username screen hidden by default */
#username-screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 11, 30, 0.5);
  backdrop-filter: blur(4px);
  display: none; /* Hidden by default */
  justify-content: center;
  align-items: center;
  z-index: 10;
}

/* When visible, ensure proper display */
#username-screen.visible {
  display: flex;
}

#username-form {
  background: rgba(255, 255, 255, 0.1);
  padding: 20px;
  border-radius: 10px;
  box-shadow: 0 0 10px rgba(0, 255, 255, 0.5);
  text-align: center;
  width: 50%;
  max-width: 500px;
}
h1 {
  color: #00ffff;
  margin: 0 0 20px 0;
  font-size: 3rem;
}
input {
  padding: 15px;
  width: 100%;
  border: none;
  border-radius: 5px;
  margin-bottom: 10px;
  box-sizing: border-box;
  font-size: 1.2rem;
  font-family: monospace, sans-serif;
}

.input-group {
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
}

.input-group input[type="text"] {
  flex: 1;
  margin-bottom: 0;
}

.color-picker-container {
  position: relative;
  width: 50px;
  height: 50px;
}

input[type="color"] {
  width: 50px;
  height: 50px;
  padding: 0;
  border: 2px solid rgba(0, 255, 255, 0.3);
  border-radius: 5px;
  cursor: pointer;
  margin-bottom: 0;
  background: none;
  position: relative;
}

.color-picker-icon {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 24px;
  height: 24px;
  pointer-events: none;
  opacity: 0.7;
}

input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0;
  border-radius: 5px;
  border: none;
}

input[type="color"]::-webkit-color-swatch {
  border: none;
  border-radius: 3px;
}

input[type="color"]:hover {
  border-color: rgba(0, 255, 255, 0.5);
}

input[type="color"]:hover + .color-picker-icon {
  opacity: 1;
}

input:disabled {
  background: #001122;
  color: #00ffff;
  text-align: center;
  font-size: 1.5rem;
}

button {
  padding: 15px 20px;
  background: #00aaff;
  border: none;
  border-radius: 5px;
  color: white;
  cursor: pointer;
  width: 100%;
  font-family: monospace, sans-serif;
  font-size: 1.5rem;
}
button:hover {
  background: #00ccff;
}
canvas {
  display: block;
}
#leaderboard {
  position: absolute;
  top: 10px;
  right: 10px;
  color: #ffffff;
  font-family: monospace, sans-serif;
  background: rgba(0, 17, 34, 0.8);
  padding: 12px 16px;
  border-radius: 8px;
  border: 1px solid rgba(0, 255, 255, 0.3);
  box-shadow: 0 0 8px rgba(0, 255, 255, 0.2);
  z-index: 5;
  line-height: 1.4;
  max-width: 40%;
  max-height: 60%;
  overflow: hidden;
}
#leaderboard strong {
  font-size: 2rem;
  color: #00ffff;
}
#leaderboard span {
  font-size: 1.8rem;
  color: #e0f7ff;
}
#debug-ui {
  position: absolute;
  top: 10px;
  left: 10px;
  color: #ffffff;
  font-family: monospace, sans-serif;
  background: rgba(0, 17, 34, 0.8);
  padding: 12px 16px;
  border-radius: 8px;
  border: 1px solid rgba(0, 255, 255, 0.3);
  box-shadow: 0 0 8px rgba(0, 255, 255, 0.2);
  z-index: 5;
  line-height: 1.4;
}
#debug-ui span {
  font-size: 1.2rem;
  color: #e0f7ff;
}

/* New styles for disconnect-ui */
#disconnect-ui {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(34, 0, 0, 0.9);
  color: #ffffff;
  padding: 20px;
  border-radius: 10px;
  text-align: center;
  font-family: monospace, sans-serif;
  z-index: 100;
  display: none;
}
#disconnect-ui h2 {
  margin: 0;
  color: #ff4444;
  font-size: 2rem;
}
#disconnect-ui p {
  margin: 10px 0;
  color: #ffffff;
  font-size: 1.2rem;
}

@media (max-width: 768px) {
  #username-form {
    padding: 15px;
    width: 80%;
  }
  #leaderboard {
    padding: 8px;
  }
  #leaderboard strong {
    font-size: 1.2rem;
  }
  #leaderboard span {
    font-size: 1.1rem;
  }
  #debug-ui {
    padding: 8px;
  }
  #debug-ui span {
    font-size: 1rem;
  }
  #disconnect-ui {
    padding: 15px;
  }
  #disconnect-ui h2 {
    font-size: 1.5rem;
  }
  #disconnect-ui p {
    font-size: 1rem;
  }
}

/* Fullscreen styles */
:fullscreen {
  background-color: #000B1E;
}

:fullscreen canvas:not(#radar) {
  width: 100vw !important;
  height: 100vh !important;
}

:fullscreen #radar {
  position: absolute !important;
  bottom: 15px !important;
  right: 15px !important;
  width: 150px !important;
  height: 150px !important;
}

:fullscreen #radar canvas {
  width: 150px !important;
  height: 150px !important;
}

:fullscreen #joystick-container {
  bottom: 100px !important;
}

/* Webkit fullscreen */
:-webkit-full-screen {
  background-color: #000B1E;
}

:-webkit-full-screen canvas:not(#radar) {
  width: 100vw !important;
  height: 100vh !important;
}

:-webkit-full-screen #radar {
  position: absolute !important;
  bottom: 15px !important;
  right: 15px !important;
  width: 150px !important;
  height: 150px !important;
}

:-webkit-full-screen #radar canvas {
  width: 150px !important;
  height: 150px !important;
}

:-webkit-full-screen #joystick-container {
  bottom: 100px !important;
}

/* Firefox fullscreen */
:-moz-full-screen {
  background-color: #000B1E;
}

:-moz-full-screen canvas:not(#radar) {
  width: 100vw !important;
  height: 100vh !important;
}

:-moz-full-screen #radar {
  position: absolute !important;
  bottom: 15px !important;
  right: 15px !important;
  width: 150px !important;
  height: 150px !important;
}

:-moz-full-screen #radar canvas {
  width: 150px !important;
  height: 150px !important;
}

:-moz-full-screen #joystick-container {
  bottom: 100px !important;
}

/* MS fullscreen */
:-ms-fullscreen {
  background-color: #000B1E;
}

:-ms-fullscreen canvas:not(#radar) {
  width: 100vw !important;
  height: 100vh !important;
}

:-ms-fullscreen #radar {
  position: absolute !important;
  bottom: 15px !important;
  right: 15px !important;
  width: 150px !important;
  height: 150px !important;
}

:-ms-fullscreen #radar canvas {
  width: 150px !important;
  height: 150px !important;
}

:-ms-fullscreen #joystick-container {
  bottom: 100px !important;
}

.leave-game-button {
  transition: background-color 0.2s;
}

.leave-game-button:hover {
  background: rgba(0, 0, 0, 0.7) !important;
}

@media (max-width: 768px) {
  .leave-game-button {
    top: 10px !important;
    left: 100px !important;
    width: 35px !important;
    height: 35px !important;
    font-size: 20px !important;
  }
}