* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Press Start 2P', cursive;
  background: #0a0a1a;
  color: #fff;
  overflow: hidden;
  height: 100vh;
  width: 100vw;
}

/* Screens */
.screen {
  display: none;
  width: 100%;
  height: 100%;
}

.screen.active {
  display: flex;
}

/* Entry Screen */
#entry-screen {
  justify-content: center;
  align-items: center;
  background: linear-gradient(135deg, #0a0a1a 0%, #1a1a3a 100%);
}

.entry-container {
  text-align: center;
  padding: 40px;
}

.logo-container {
  margin-bottom: 20px;
}

#logo-canvas {
  image-rendering: pixelated;
  border-radius: 50%;
  box-shadow: 0 0 60px rgba(99, 102, 241, 0.5);
}

h1 {
  font-size: 48px;
  margin-bottom: 10px;
  background: linear-gradient(90deg, #6366f1, #a855f7, #6366f1);
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: shine 3s linear infinite;
}

@keyframes shine {
  to { background-position: 200% center; }
}

.tagline {
  font-size: 12px;
  color: #888;
  margin-bottom: 40px;
}

.entry-form {
  display: flex;
  flex-direction: column;
  gap: 15px;
  max-width: 300px;
  margin: 0 auto 30px;
}

input[type="text"] {
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid #333;
  padding: 15px;
  font-family: inherit;
  font-size: 10px;
  color: #fff;
  text-align: center;
  transition: all 0.3s;
}

input[type="text"]:focus {
  outline: none;
  border-color: #6366f1;
  box-shadow: 0 0 20px rgba(99, 102, 241, 0.3);
}

.btn {
  padding: 15px 25px;
  font-family: inherit;
  font-size: 10px;
  border: none;
  cursor: pointer;
  transition: all 0.3s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.btn-primary {
  background: linear-gradient(90deg, #6366f1, #a855f7);
  color: #fff;
}

.btn-primary:hover {
  transform: scale(1.05);
  box-shadow: 0 0 30px rgba(99, 102, 241, 0.5);
}

.btn-secondary {
  background: transparent;
  border: 2px solid #444;
  color: #888;
}

.btn-secondary:hover {
  border-color: #666;
  color: #fff;
}

.token-info {
  font-size: 8px;
  color: #666;
}

.token-info .highlight {
  color: #a855f7;
}

.buy-link {
  color: #6366f1;
  text-decoration: none;
  display: inline-block;
  margin-top: 10px;
}

.buy-link:hover {
  text-decoration: underline;
}

.wallet-support {
  font-size: 6px;
  color: #666;
  margin-top: 10px;
}

/* Game Screen */
#game-screen {
  position: relative;
}

#game-container {
  width: 100%;
  height: 100%;
}

#game-container canvas {
  display: block;
}

/* HUD */
#hud {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  padding: 15px;
  display: flex;
  justify-content: space-between;
  pointer-events: none;
}

.hud-left, .hud-right {
  pointer-events: auto;
}

.minimap {
  width: 150px;
  height: 100px;
  background: rgba(0, 0, 0, 0.7);
  border: 2px solid #333;
  margin-bottom: 10px;
}

.player-info {
  background: rgba(0, 0, 0, 0.7);
  padding: 10px;
  font-size: 8px;
  border: 2px solid #333;
}

#player-coords {
  color: #888;
  display: block;
  margin-top: 5px;
}

.online-count {
  background: rgba(0, 0, 0, 0.7);
  padding: 10px 15px;
  font-size: 10px;
  border: 2px solid #333;
  display: flex;
  align-items: center;
  gap: 8px;
}

.pulse {
  width: 8px;
  height: 8px;
  background: #4ade80;
  border-radius: 50%;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* Chat */
#chat-container {
  position: absolute;
  bottom: 15px;
  left: 15px;
  width: 350px;
  background: rgba(0, 0, 0, 0.8);
  border: 2px solid #333;
}

#chat-messages {
  height: 150px;
  overflow-y: auto;
  padding: 10px;
  font-size: 8px;
  line-height: 1.8;
}

#chat-messages::-webkit-scrollbar {
  width: 6px;
}

#chat-messages::-webkit-scrollbar-thumb {
  background: #444;
}

.chat-message {
  margin-bottom: 5px;
  word-wrap: break-word;
}

.chat-message.system {
  color: #888;
  font-style: italic;
}

.chat-message .name {
  font-weight: bold;
}

.chat-input-container {
  display: flex;
  border-top: 2px solid #333;
}

#chat-input {
  flex: 1;
  background: transparent;
  border: none;
  padding: 10px;
  font-family: inherit;
  font-size: 8px;
  color: #fff;
}

#chat-input:focus {
  outline: none;
}

#send-chat-btn {
  background: #6366f1;
  border: none;
  padding: 10px 15px;
  color: #fff;
  cursor: pointer;
  font-size: 12px;
}

/* Mobile Controls */
#mobile-controls {
  display: none;
  position: absolute;
  bottom: 20px;
  right: 20px;
}

.dpad {
  display: grid;
  grid-template-areas:
    ". up ."
    "left . right"
    ". down .";
  gap: 5px;
}

.dpad-btn {
  width: 50px;
  height: 50px;
  background: rgba(255, 255, 255, 0.2);
  border: 2px solid rgba(255, 255, 255, 0.3);
  color: #fff;
  font-size: 16px;
  cursor: pointer;
}

.dpad-btn.up { grid-area: up; }
.dpad-btn.left { grid-area: left; }
.dpad-btn.right { grid-area: right; }
.dpad-btn.down { grid-area: down; }

@media (max-width: 768px) {
  #mobile-controls {
    display: block;
  }
  
  #chat-container {
    width: calc(100% - 100px);
  }
  
  h1 {
    font-size: 32px;
  }
}

@media (max-width: 480px) {
  .entry-container {
    padding: 20px;
  }
  
  h1 {
    font-size: 24px;
  }
  
  .minimap {
    display: none;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════════
   MODAL SYSTEM - Base styles for all modals
   ═══════════════════════════════════════════════════════════════════════════════ */

.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.85);
  z-index: 1000;
  justify-content: center;
  align-items: center;
  padding: 20px;
  overflow-y: auto;
}

.modal.active {
  display: flex;
}

.modal-content {
  background: #1a1a2e;
  border: 3px solid #333;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  animation: modalFadeIn 0.3s ease-out;
}

@keyframes modalFadeIn {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(-20px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.modal-header {
  padding: 15px;
  text-align: center;
  position: relative;
}

.modal-header h2 {
  font-size: 12px;
  color: #fff;
  margin: 0;
}

.close-btn {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: #888;
  font-size: 16px;
  cursor: pointer;
  padding: 5px 10px;
  transition: color 0.2s;
}

.close-btn:hover {
  color: #ff6b6b;
}

/* Scrollbar for modals */
.modal-content::-webkit-scrollbar {
  width: 6px;
}

.modal-content::-webkit-scrollbar-track {
  background: #0a0a1a;
}

.modal-content::-webkit-scrollbar-thumb {
  background: #444;
  border-radius: 3px;
}

.modal-content::-webkit-scrollbar-thumb:hover {
  background: #555;
}
