* {
  box-sizing: border-box;
}
html,
body {
  /* height: 100%; */
  margin: 5px;
  background: #1e1e1e;
  display: grid;
  place-items: center;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  color: white;
}

.login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  width: 40%;
}

.login-form {
  background: #2a2a2a;
  padding: 2rem;
  border-radius: 10px;
  border: 2px solid #fff;
  text-align: center;
  min-width: 300px;
}

.login-form h1 {
  margin-bottom: 1.5rem;
  color: #fff;
}

.login-form input {
  width: 100%;
  padding: 0.75rem;
  margin-bottom: 1rem;
  border: 2px solid #555;
  border-radius: 5px;
  background: #333;
  color: white;
  font-size: 1rem;
}

.login-form input:focus {
  outline: none;
  border-color: #4caf50;
}

.login-form button {
  width: 100%;
  padding: 0.75rem;
  background: #4caf50;
  color: white;
  border: none;
  border-radius: 5px;
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.3s;
}

.login-form button:hover {
  background: #45a049;
}

.login-form button:disabled {
  background: #666;
  cursor: not-allowed;
}

.error-message {
  color: #ff4444;
  margin-top: 0.5rem;
  font-size: 0.9rem;
}

.game-container {
  width: 100%;
  /* height: 500px; */
  border: 3px solid #fff;
  background: linear-gradient(#85c9ff 70%, #4a8a3a 70%);
  overflow: hidden;
  position: relative;
}

.game-info {
  top: -40px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #2a2a2a;
  padding: 0.5rem 1rem;
  border: 2px solid #fff;
  border-bottom: none;
  font-size: 0.9rem;
}

.game-info button {
  padding: 0.25rem 0.75rem;
  background: #ff4444;
  color: white;
  border: none;
  border-radius: 3px;
  cursor: pointer;
  font-size: 0.8rem;
}

.game-info button:hover {
  background: #cc3333;
}

.controls {
  position: absolute;
  bottom: 30px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 0.8rem;
  color: #ccc;
}

#gameCanvas {
  display: block;
  width: 100%;
  height: 100%;
}


.chat-bubble {
  position: absolute;
  bottom: 100%; /* muncul di atas karakter */
  left: 50%;
  transform: translateX(-50%);
  background: white;
  padding: 4px 8px;
  border-radius: 12px;
  border: 1px solid #333;
  font-size: 12px;
  white-space: nowrap;
  pointer-events: none;
  animation: fadeOut 3s forwards;
}

@keyframes fadeOut {
  0% { opacity: 1; }
  80% { opacity: 1; }
  100% { opacity: 0; }
}

#chat-container {
  margin-top: 10px;
}

#chat-input {
  width: 1000px;
  padding: 6px;
  font-size: 14px;
  border: none;
}
#chat-input:focus{
  box-shadow: none;
}

.mobile-controls {
  position: absolute;
  bottom: 5px;
  left: 30px;
  z-index: 100;
  display: none;
}

.mobile-dpad {
  display: grid;
  grid-template-columns: 60px 60px 60px;
  grid-template-rows: 60px 60px 60px;
  gap: 5px;
}

.mobile-btn {
  background: rgba(0,0,0,0.5);
  color: white;
  border-radius: 50%;
  border: 2px solid #fff;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  touch-action: none;
}

.mobile-btn:active {
  background: rgba(255,255,255,0.3);
}

.mobile-actions {
  position: absolute;
  bottom: 65px;
  right: 30px;
  display: none;
  flex-direction: column;
  gap: 10px;
}

.action-btn {
  width: 70px;
  height: 70px;
  background: rgba(0,0,0,0.5);
  color: white;
  border-radius: 50%;
  border: 2px solid #fff;
  font-size: 16px;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  touch-action: none;
}

.action-btn:active {
  background: rgba(255,255,255,0.3);
}