/* --- GLOBAL & FONTS --- */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Ubuntu', sans-serif;
  font-weight: 700;
  user-select: none;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #cdcdcd; /* Base game background */
  touch-action: none;
}

canvas {
  display: block;
}

#game {
  position: fixed;
  inset: 0;
}

/* --- .IO STYLE TEXT OUTLINES --- */
.title-text {
  font-size: 46px;
  color: #fff;
  letter-spacing: 2px;
  margin-bottom: 16px;
  /* Chunky .io text stroke effect */
  text-shadow: 
    -3px -3px 0 #444,  
     3px -3px 0 #444,
    -3px  3px 0 #444,
     3px  3px 0 #444,
     0px  4px 0 #222;
}

/* --- SCREENS & OVERLAYS --- */
.screen {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* The home screen hides the map completely with an .io grid */
#home-screen {
  background-color: #f0f0f0;
  background-image: 
    linear-gradient(rgba(0, 0, 0, 0.07) 2px, transparent 2px),
    linear-gradient(90deg, rgba(0, 0, 0, 0.07) 2px, transparent 2px);
  background-size: 30px 30px;
  background-position: center center;
}

/* Death/Disconnect screens get the 10% opacity grey overlay */
.overlay {
  background: rgba(80, 80, 80, 0.85); /* Dark grey overlay */
}

.hidden {
  display: none !important;
}

/* --- PANELS (Menus) --- */
.panel {
  width: min(400px, calc(100vw - 40px));
  background: #e6e6e6;
  border: 4px solid #444;
  border-radius: 6px;
  padding: 30px 24px;
  text-align: center;
  box-shadow: 0 8px 0 rgba(0,0,0,0.15); /* Flat 3D drop shadow */
}

.small-text {
  font-size: 16px;
  color: #555;
  margin-bottom: 20px;
}

/* --- INPUTS & BUTTONS --- */
#username-input {
  width: 100%;
  padding: 14px;
  font-size: 20px;
  text-align: center;
  color: #333;
  background: #fff;
  border: 4px solid #444;
  border-radius: 6px;
  outline: none;
  margin-bottom: 16px;
  transition: border-color 0.1s;
}

#username-input:focus {
  border-color: #00b2e1;
}

.button-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

button {
  width: 100%;
  padding: 16px;
  font-size: 20px;
  color: #fff;
  border: 4px solid #444;
  border-radius: 6px;
  cursor: pointer;
  text-shadow: -1px -1px 0 #444, 1px -1px 0 #444, -1px 1px 0 #444, 1px 1px 0 #444;
  transition: transform 0.1s, filter 0.1s;
}

button:hover {
  filter: brightness(1.1);
}

button:active {
  transform: translateY(4px); /* Pushes down */
  box-shadow: none;
}

.btn-green {
  background: #7bd46e; /* Arras.io style green */
  box-shadow: 0 4px 0 #5b9e52;
}

.btn-green:active { box-shadow: 0 0px 0 #5b9e52; }

.btn-grey {
  background: #a3a3a3;
  box-shadow: 0 4px 0 #7a7a7a;
}

.btn-grey:active { box-shadow: 0 0px 0 #7a7a7a; }

/* --- HUD & IN-GAME UI --- */
#hud {
  position: fixed;
  left: 20px;
  top: 20px;
  pointer-events: none;
  z-index: 3;
}

.hud-text {
  color: #fff;
  text-shadow: -2px -2px 0 #444, 2px -2px 0 #444, -2px 2px 0 #444, 2px 2px 0 #444;
  letter-spacing: 1px;
}

#title {
  font-size: 28px;
  margin-bottom: 8px;
}

#name-tag {
  font-size: 18px;
  margin-bottom: 10px;
}

/* Chunky Health Bar */
#hp-wrap {
  width: 280px;
  height: 24px;
  background: #555;
  border: 4px solid #444;
  border-radius: 4px;
  overflow: hidden;
}

#hp-bar {
  width: 100%;
  height: 100%;
  background: #7bd46e;
  transition: width 0.1s linear;
}

/* --- MINIMAP --- */
#minimap-wrap {
  position: fixed;
  right: 20px;
  top: 20px;
  z-index: 3;
  pointer-events: none;
  background: rgba(220, 220, 220, 0.9);
  border: 4px solid #444;
  border-radius: 4px;
  box-shadow: 0 4px 0 rgba(0,0,0,0.1);
}

#minimap {
  display: block;
}
