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

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: #1a1a2e;
  color: #fff;
  overflow: hidden;
}

/* Login Screen */
#login-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
}

.login-box {
  text-align: center;
  padding: 40px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  backdrop-filter: blur(10px);
}

.login-box h1 {
  font-size: 4em;
  color: #e94560;
  text-shadow: 0 0 20px rgba(233, 69, 96, 0.5);
  margin-bottom: 10px;
}

.login-box p {
  color: #aaa;
  margin-bottom: 30px;
}

#player-name {
  width: 100%;
  padding: 15px 20px;
  font-size: 1.2em;
  border: none;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  text-align: center;
  margin-bottom: 20px;
  outline: none;
}

#player-name:focus {
  background: rgba(255, 255, 255, 0.2);
}

#play-btn {
  width: 100%;
  padding: 15px 40px;
  font-size: 1.3em;
  font-weight: bold;
  border: none;
  border-radius: 10px;
  background: #e94560;
  color: #fff;
  cursor: pointer;
  transition: all 0.3s;
}

#play-btn:hover {
  background: #ff6b6b;
  transform: scale(1.05);
}

.instructions {
  margin-top: 30px;
  text-align: left;
  color: #888;
  font-size: 0.9em;
}

.instructions p {
  margin: 5px 0;
}

/* Game Screen */
#game-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

#game-canvas {
  display: block;
  background: #3d5a3d;
}

/* UI */
#ui {
  position: fixed;
  pointer-events: none;
}

#ui > * {
  pointer-events: auto;
}

/* Health Bar */
#health-bar {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  width: 300px;
  height: 30px;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 15px;
  overflow: hidden;
}

#health-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #e94560, #ff6b6b);
  transition: width 0.2s;
}

#health-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-weight: bold;
  text-shadow: 1px 1px 2px #000;
}

/* Age/XP Bar */
#age-bar {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 10px;
}

#age-indicator {
  background: rgba(0, 0, 0, 0.7);
  padding: 8px 15px;
  border-radius: 20px;
  font-weight: bold;
  font-size: 1.1em;
  color: #f7c545;
  text-shadow: 1px 1px 2px #000;
}

#age-text {
  color: #fff;
  font-size: 1.2em;
}

#xp-bar-container {
  position: relative;
  width: 200px;
  height: 20px;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 10px;
  overflow: hidden;
}

#xp-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #f7c545, #ffd700);
  transition: width 0.3s;
}

#xp-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 0.8em;
  font-weight: bold;
  text-shadow: 1px 1px 2px #000;
}

/* Inventory */
#inventory {
  position: fixed;
  bottom: 60px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 10px;
}

.inv-item {
  background: rgba(0, 0, 0, 0.5);
  padding: 10px 15px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.inv-icon {
  width: 20px;
  height: 20px;
  border-radius: 4px;
}

/* Current Tool */
#current-tool {
  position: fixed;
  bottom: 110px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.5);
  padding: 8px 20px;
  border-radius: 10px;
  font-size: 0.9em;
}

/* Leaderboard */
#leaderboard {
  position: fixed;
  top: 20px;
  right: 20px;
  background: rgba(0, 0, 0, 0.5);
  padding: 15px;
  border-radius: 10px;
  min-width: 150px;
}

#leaderboard h3 {
  margin-bottom: 10px;
  font-size: 0.9em;
  color: #e94560;
}

#leaderboard-list {
  padding-left: 20px;
  font-size: 0.85em;
}

#leaderboard-list li {
  margin: 5px 0;
}

/* Minimap */
#minimap {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 150px;
  height: 150px;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 10px;
  border: 2px solid rgba(255, 255, 255, 0.2);
}

/* Craft Menu */
#craft-menu {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, 0.95);
  padding: 20px;
  border-radius: 15px;
  z-index: 100;
  border: 2px solid #3d3f42;
}

#craft-menu h2 {
  text-align: center;
  margin-bottom: 15px;
  color: #e94560;
  font-size: 1.3em;
}

.craft-columns {
  display: flex;
  gap: 15px;
}

.craft-section {
  min-width: 120px;
}

.craft-section h3 {
  margin-bottom: 8px;
  font-size: 0.75em;
  color: #e94560;
  text-align: center;
  padding-bottom: 5px;
  border-bottom: 1px solid #3d3f42;
}

.craft-btn {
  display: block;
  width: 100%;
  padding: 8px 10px;
  margin: 5px 0;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  border-radius: 6px;
  color: #fff;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
  font-size: 0.85em;
}

.craft-btn:hover {
  background: rgba(233, 69, 96, 0.4);
  transform: scale(1.02);
}

.craft-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

.craft-btn.age-locked {
  opacity: 0.3;
  background: rgba(100, 100, 100, 0.3);
  position: relative;
}

.craft-btn.age-locked::after {
  content: '🔒';
  position: absolute;
  right: 5px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.9em;
}

.craft-btn small {
  color: #888;
  font-size: 0.75em;
}

.hint {
  text-align: center;
  color: #666;
  font-size: 0.8em;
  margin-top: 15px;
}

/* Death Screen */
#death-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 200;
}

.death-box {
  text-align: center;
  padding: 40px;
}

.death-box h1 {
  color: #e94560;
  font-size: 3em;
  margin-bottom: 20px;
}

#death-message {
  margin-bottom: 30px;
  color: #888;
}

#respawn-btn {
  padding: 15px 40px;
  font-size: 1.2em;
  font-weight: bold;
  border: none;
  border-radius: 10px;
  background: #e94560;
  color: #fff;
  cursor: pointer;
  transition: all 0.3s;
}

#respawn-btn:hover {
  background: #ff6b6b;
}

/* Ping Display */
#ping-container {
  position: fixed;
  top: 20px;
  left: 20px;
  background: rgba(0, 0, 0, 0.6);
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 0.85em;
  font-family: 'Consolas', 'Monaco', monospace;
}

#ping-label {
  color: #888;
  margin-right: 5px;
}

#ping-display {
  color: #4CAF50;
  font-weight: bold;
}
