body {
  margin: 0;
  padding: 0;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  font-family: Arial, sans-serif;
  user-select: none;
  -webkit-user-select: none; /* Safari */
  -moz-user-select: none; /* Firefox */
  -ms-user-select: none; /* IE/Edge */
  touch-action: manipulation;
  -webkit-touch-callout: none; /* iOS Safari */
}

#game-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.instructions {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background-color: rgba(0, 0, 0, 0.7);
  padding: 20px;
  border-radius: 8px;
  font-size: 18px;
  color: #fff;
  z-index: 100;
  max-width: 400px;
  text-align: center;
}

.crosshair {
  position: fixed;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 1000;
  display: none; 
}

.crosshair.active {
  display: block;
}

.crosshair::before,
.crosshair::after {
  content: "";
  position: absolute;
  background-color: white;
}

.crosshair::before {
  top: 9px;
  left: 0;
  width: 20px;
  height: 2px;
}

.crosshair::after {
  top: 0;
  left: 9px;
  width: 2px;
  height: 20px;
}

#joystick-container {
  position: fixed;
  bottom: 50px;
  left: 20px;
  width: 150px;  
  height: 150px; 
  z-index: 1000;
  display: none; 
  touch-action: none;
  background-color: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
}

#jump-button {
  position: fixed;
  bottom: 50px;
  right: 20px;
  width: 80px;
  height: 80px;
  background-color: rgba(255, 255, 255, 0.5);
  border-radius: 50%;
  display: none; 
  z-index: 1000;
  touch-action: none;
  text-align: center;
  line-height: 80px;
  font-weight: bold;
  color: #333;
  user-select: none;
}

#camera-controls {
  position: fixed;
  bottom: 10px;
  right: 10px;
  background-color: rgba(0, 0, 0, 0.3);
  color: white;
  padding: 5px;
  border-radius: 5px;
  font-size: 12px;
  z-index: 100;
}

.player-name {
  position: absolute;
  font-size: 14px;
  color: white;
  background-color: rgba(0, 0, 0, 0.5);
  padding: 2px 6px;
  border-radius: 8px;
  pointer-events: none;
  white-space: nowrap;
  transform: translate(-50%, -100%);
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

.chat-message {
  position: absolute;
  font-size: 14px;
  color: white;
  background-color: rgba(0, 0, 0, 0.6);
  padding: 4px 8px;
  border-radius: 8px;
  pointer-events: none;
  white-space: nowrap;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  transform: translate(-50%, -100%);
  margin-top: -35px;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
}

.health-bar-container {
  position: absolute;
  width: 60px;
  height: 6px;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 3px;
  pointer-events: none;
  transform: translate(-50%, -50%);
  overflow: hidden;
}

.health-bar-fill {
  width: 100%;
  height: 100%;
  background: #ff3333;
  transition: width 0.2s ease-out;
}

#ui-overlay {
  position: fixed;
  top: 10px;
  left: 10px;
  right: 10px;
  bottom: 10px;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  z-index: 1000;
}

.signup-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at center, rgba(30, 30, 45, 0.95), rgba(10, 10, 15, 1));
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 3000;
  backdrop-filter: blur(8px);
}

.signup-card {
  background: rgba(40, 40, 50, 0.8);
  padding: 40px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
  width: 340px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  color: white;
  position: relative;
  overflow: hidden;
}

.card-glow {
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle at 50% 50%, rgba(76, 175, 80, 0.1), transparent 70%);
  pointer-events: none;
  animation: rotateGlow 10s linear infinite;
}

@keyframes rotateGlow {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.signup-card h2 {
  margin: 0;
  text-align: center;
  color: #fff;
  font-size: 28px;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.signup-card .subtitle {
  text-align: center;
  margin: -15px 0 0 0;
  font-size: 12px;
  color: #888;
  letter-spacing: 0.5px;
}

.signup-card .input-group label {
  font-size: 12px;
  text-transform: uppercase;
  color: #aaa;
  font-weight: bold;
  margin-bottom: 8px;
}

.signup-card .input-group input {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: white;
  padding: 12px;
  font-size: 14px;
  border-radius: 8px;
  transition: border-color 0.3s, box-shadow 0.3s;
}

.signup-card .input-group input:focus {
  outline: none;
  border-color: #4CAF50;
  box-shadow: 0 0 8px rgba(76, 175, 80, 0.3);
}

.checkbox-group {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  font-size: 13px;
  color: #ccc;
}

.checkbox-group input {
  width: 20px;
  height: 20px;
  accent-color: #4CAF50;
  cursor: pointer;
}

#signup-button {
  padding: 16px;
  background: linear-gradient(135deg, #4CAF50, #45a049);
  color: white;
  border: none;
  border-radius: 10px;
  font-weight: bold;
  cursor: pointer;
  font-size: 16px;
  text-transform: uppercase;
  letter-spacing: 1px;
  box-shadow: 0 4px 15px rgba(76, 175, 80, 0.3);
  transition: transform 0.2s, box-shadow 0.2s;
}

#signup-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(76, 175, 80, 0.4);
}

.footer-note {
  text-align: center;
  font-size: 10px;
  color: #555;
  text-transform: uppercase;
  letter-spacing: 2px;
}

/* Webtcha Styles */
.webtcha-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 4000;
}

.webtcha-card {
  background: white;
  width: 320px;
  padding: 15px;
  border-radius: 4px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
  display: flex;
  flex-direction: column;
  gap: 10px;
  color: #333;
}

.webtcha-header {
  background: #4a90e2;
  color: white;
  padding: 20px;
  margin: -15px -15px 10px -15px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.webtcha-title { font-size: 14px; }
.webtcha-title strong { display: block; font-size: 24px; line-height: 1.1; }
.webtcha-logo { font-weight: bold; font-style: italic; opacity: 0.8; }

.webtcha-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2px;
  background: #ccc;
}

.webtcha-tile {
  width: 90px;
  height: 90px;
  background: #eee;
  cursor: pointer;
  background-size: cover;
  background-position: center;
  position: relative;
  transition: transform 0.1s;
}

.webtcha-tile:active { transform: scale(0.95); }

.webtcha-tile.selected::after {
  content: '✓';
  position: absolute;
  top: 5px;
  left: 5px;
  width: 25px;
  height: 25px;
  background: #4a90e2;
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
}

.webtcha-tile.selected {
  outline: 4px solid #4a90e2;
  outline-offset: -4px;
}

.webtcha-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 10px;
  border-top: 1px solid #eee;
}

#webtcha-verify {
  background: #4a90e2;
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 4px;
  font-weight: bold;
  cursor: pointer;
}

#webtcha-refresh {
  background: none;
  border: none;
  font-size: 20px;
  color: #666;
  cursor: pointer;
}

#chat-log {
  width: 300px;
  max-height: 200px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 8px;
  padding: 10px;
  overflow-y: auto;
  pointer-events: auto;
  color: white;
  font-size: 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.chat-log-entry {
  background: rgba(0, 0, 0, 0.2);
  padding: 4px 8px;
  border-radius: 4px;
  word-wrap: break-word;
}

#customization-panel {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, 0.85);
  padding: 20px;
  border-radius: 12px;
  color: white;
  pointer-events: auto;
  width: 260px;
  display: flex;
  flex-direction: column;
  gap: 15px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}

.hidden { display: none !important; }

#customization-panel h3 { margin: 0; text-align: center; }

.input-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.input-group input {
  padding: 8px;
  border-radius: 4px;
  border: none;
}

#save-customization {
  padding: 10px;
  border-radius: 6px;
  border: none;
  background: #4CAF50;
  color: white;
  font-weight: bold;
  cursor: pointer;
}

#action-buttons {
  display: flex;
  gap: 10px;
  pointer-events: auto;
  justify-content: flex-end;
}

#action-buttons button {
  padding: 12px 20px;
  border-radius: 20px;
  border: none;
  background: rgba(255, 255, 255, 0.8);
  font-weight: bold;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

#ability-bar {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 10px;
  pointer-events: auto;
}

.ability-slot {
  width: 60px;
  height: 60px;
  background: rgba(0, 0, 0, 0.6);
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  color: white;
  font-size: 10px;
  transition: transform 0.1s, border-color 0.2s;
  cursor: pointer;
}

.ability-slot:hover {
  background: rgba(0, 0, 0, 0.8);
  border-color: white;
}

.ability-slot.active {
  transform: scale(0.9);
  border-color: #ffcc00;
}

.ultimate-slot {
  background: rgba(200, 0, 0, 0.6);
  border-color: #ff0000;
  box-shadow: 0 0 10px rgba(255, 0, 0, 0.4);
}

.ultimate-slot:hover {
  background: rgba(255, 0, 0, 0.8);
}

.ultimate-slot .key-hint {
  color: #ff9999;
}

.key-hint {
  position: absolute;
  top: 2px;
  left: 4px;
  font-weight: bold;
  font-size: 12px;
  color: #aaa;
}

.ability-name {
  text-align: center;
  padding: 0 2px;
}

.cooldown-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 0%;
  background: rgba(255, 255, 255, 0.3);
  transition: height 0.1s linear;
}

#chat-input-container {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  width: 80%;
  max-width: 500px;
  background-color: rgba(0, 0, 0, 0.8);
  border-radius: 8px;
  padding: 12px;
  display: none;
  z-index: 2000;
}

#chat-input {
  width: 100%;
  padding: 10px;
  border-radius: 4px;
  border: none;
  background-color: white;
  color: #333;
  font-size: 16px;
}

#close-chat {
  position: absolute;
  top: -10px;
  right: -10px;
  width: 25px;
  height: 25px;
  background-color: #ff4444;
  border-radius: 50%;
  text-align: center;
  line-height: 25px;
  font-weight: bold;
  color: white;
  cursor: pointer;
}

@media (max-width: 768px) {
  #joystick-container {
    display: block;
  }
  
  #jump-button {
    display: block;
  }
  
  .instructions {
    display: none !important; 
  }
}