/* =========================================================
   OGACIAL — game.css
   In-game UI: HUD, hotbar, health/hunger/armor bars,
   boss health bar, chat, pause, death screen, crosshair,
   status effects, notifications, action indicator
   ========================================================= */

/* ---------- Game Canvas ---------- */
#game-screen {
  width: 100vw;
  height: 100vh;
  background: #000;
  position: relative;
  overflow: hidden;
}
#gameCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  cursor: none;
}

/* ---------- HUD ---------- */
.hud {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 10;
}
.hud.hidden { display: none; }

/* Crosshair */
.crosshair {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 24px;
  height: 24px;
  pointer-events: none;
}
.ch-h, .ch-v {
  position: absolute;
  background: rgba(255,255,255,0.85);
  box-shadow: 0 0 0 1px rgba(0,0,0,0.5);
}
.ch-h { width: 20px; height: 2px; top: 50%; left: 50%; transform: translate(-50%,-50%); }
.ch-v { width: 2px; height: 20px; top: 50%; left: 50%; transform: translate(-50%,-50%); }

/* ---------- Debug info ---------- */
.debug-info {
  position: absolute;
  top: 10px;
  left: 10px;
  background: rgba(0,0,0,0.55);
  border-radius: 4px;
  padding: 8px 12px;
  font-size: 11px;
  font-weight: 500;
  color: #e8ecf4;
  line-height: 1.8;
  font-family: 'DM Sans', monospace;
  pointer-events: none;
}
.debug-info.hidden { display: none; }
#fpsDisplay { color: #22c55e; }
#biomeDisplay { color: #38bdf8; }
#dimensionDisplay { color: #a855f7; }

/* ---------- Time display (top right) ---------- */
.hud-top-right {
  position: absolute;
  top: 10px;
  right: 14px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}
.time-display {
  background: rgba(0,0,0,0.5);
  border-radius: 4px;
  padding: 6px 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  color: #e8ecf4;
}

/* ---------- Bottom HUD ---------- */
.hud-bottom {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding-bottom: 10px;
}

/* Status bars */
.status-bars {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: 100%;
  max-width: 364px;
}

.bar-group {
  display: flex;
  align-items: center;
  gap: 1px;
}
.bar-icons {
  display: flex;
  gap: 1px;
}
.bar-icon {
  width: 18px;
  height: 18px;
  image-rendering: pixelated;
  display: block;
}

/* Specific bar group layouts */
.health-bar-group { justify-content: flex-start; }
.hunger-bar-group { justify-content: flex-end; }
.armor-bar-group  { justify-content: flex-start; }

/* XP bar */
.exp-bar-wrap {
  position: relative;
  width: 100%;
  max-width: 364px;
  height: 5px;
  background: rgba(0,0,0,0.5);
  border-radius: 2px;
  overflow: visible;
}
.exp-bar {
  height: 100%;
  background: #7cfc00;
  border-radius: 2px;
  transition: width 0.4s ease;
  box-shadow: 0 0 6px rgba(124,252,0,0.6);
}
.exp-level {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 10px;
  font-weight: 700;
  color: #7cfc00;
  text-shadow: 0 0 4px rgba(0,0,0,0.8);
  pointer-events: none;
}

/* ---------- Hotbar ---------- */
.hotbar {
  display: flex;
  gap: 2px;
  pointer-events: auto;
}
.hotbar-slot {
  width: 40px;
  height: 40px;
  background: rgba(15,20,30,0.78);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  cursor: pointer;
  transition: border-color 0.1s;
  image-rendering: pixelated;
  overflow: hidden;
}
.hotbar-slot:hover { border-color: rgba(255,255,255,0.5); }
.hotbar-slot.selected {
  border-color: #fff;
  border-width: 2px;
  background: rgba(255,255,255,0.12);
}
.hotbar-slot img {
  width: 28px;
  height: 28px;
  image-rendering: pixelated;
}
.hotbar-slot .slot-count {
  position: absolute;
  bottom: 2px;
  right: 3px;
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  text-shadow: 1px 1px 0 #000;
  line-height: 1;
}
.hotbar-slot .slot-durability {
  position: absolute;
  bottom: 0;
  left: 1px;
  right: 1px;
  height: 3px;
  background: rgba(0,0,0,0.3);
  border-radius: 0 0 2px 2px;
}
.hotbar-slot .slot-durability-fill {
  height: 100%;
  background: #22c55e;
  transition: width 0.2s;
}

/* Slot number label */
.hotbar-slot::before {
  content: attr(data-num);
  position: absolute;
  top: 2px;
  left: 3px;
  font-size: 9px;
  color: rgba(255,255,255,0.45);
  line-height: 1;
}

/* ---------- Status Effects ---------- */
.status-effects {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 6px;
  pointer-events: none;
  flex-wrap: wrap;
  justify-content: center;
  max-width: 600px;
}
.status-effect {
  background: rgba(0,0,0,0.65);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 4px;
  padding: 4px 8px;
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: #e8ecf4;
  animation: effectIn 0.25s ease;
}
.status-effect img { width: 14px; height: 14px; image-rendering: pixelated; }
.status-effect .effect-time { color: rgba(255,255,255,0.55); }
.status-effect.buff { border-color: rgba(92,143,255,0.4); }
.status-effect.debuff { border-color: rgba(239,68,68,0.4); }
@keyframes effectIn { from { opacity: 0; transform: scale(0.8); } to { opacity: 1; transform: scale(1); } }

/* ---------- Notifications ---------- */
.notifications {
  position: absolute;
  top: 60px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 6px;
  pointer-events: none;
  align-items: center;
  z-index: 20;
}
.notification {
  background: rgba(0,0,0,0.75);
  border-radius: 5px;
  padding: 6px 14px;
  font-size: 13px;
  color: #e8ecf4;
  animation: notifIn 0.3s ease forwards;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 380px;
}
.notification img { width: 18px; height: 18px; image-rendering: pixelated; }
.notification.achievement {
  background: rgba(240,180,41,0.18);
  border: 1px solid rgba(240,180,41,0.45);
  color: #f0b429;
  font-weight: 500;
}
.notification.item {
  border: 1px solid rgba(255,255,255,0.1);
}
@keyframes notifIn {
  from { opacity: 0; transform: translateY(-10px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes notifOut {
  from { opacity: 1; transform: translateY(0); }
  to   { opacity: 0; transform: translateY(-10px); }
}

/* ---------- Boss Health Bar ---------- */
.boss-health-bar {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  width: 380px;
  max-width: 90vw;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  pointer-events: none;
}
.boss-health-bar.hidden { display: none; }
.boss-name {
  font-size: 14px;
  font-weight: 600;
  color: #e8ecf4;
  text-shadow: 0 1px 4px rgba(0,0,0,0.8);
  letter-spacing: 0.04em;
}
.boss-bar-bg {
  width: 100%;
  height: 10px;
  background: rgba(0,0,0,0.55);
  border-radius: 5px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.15);
}
.boss-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #e84040, #ff6060);
  border-radius: 5px;
  transition: width 0.3s ease;
  box-shadow: 0 0 8px rgba(232,64,64,0.5);
}

/* ---------- Action Indicator ---------- */
.action-indicator {
  position: absolute;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.6);
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 4px;
  padding: 5px 14px;
  font-size: 12px;
  color: #e8ecf4;
  pointer-events: none;
}
.action-indicator.hidden { display: none; }

/* ---------- Pause Menu ---------- */
.pause-menu {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  backdrop-filter: blur(4px);
  pointer-events: auto;
}
.pause-menu.hidden { display: none; }
.pause-box {
  background: rgba(20,25,41,0.96);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 16px;
  padding: 36px 48px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 280px;
  align-items: center;
  box-shadow: 0 16px 64px rgba(0,0,0,0.8);
}
.pause-box h2 {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 8px;
  color: #fff;
}
.pause-box .menu-btn { width: 220px; }

/* ---------- Death Screen ---------- */
.death-screen {
  position: absolute;
  inset: 0;
  background: rgba(80,0,0,0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 60;
  backdrop-filter: blur(6px);
  pointer-events: auto;
  animation: deathFade 1.2s ease;
}
.death-screen.hidden { display: none; }
.death-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}
.death-title {
  font-size: 56px;
  font-weight: 700;
  color: #ef4444;
  text-shadow: 0 0 30px rgba(239,68,68,0.8);
  letter-spacing: 0.04em;
}
.death-score {
  font-size: 18px;
  color: rgba(255,255,255,0.7);
  margin-bottom: 8px;
}
.death-box .menu-btn { min-width: 200px; }
@keyframes deathFade {
  from { background: rgba(255,0,0,0.0); backdrop-filter: blur(0px); }
  to   { background: rgba(80,0,0,0.75); backdrop-filter: blur(6px); }
}

/* ---------- Chat ---------- */
.chat-box {
  position: absolute;
  bottom: 84px;
  left: 10px;
  width: 440px;
  max-width: 60vw;
  z-index: 30;
  pointer-events: auto;
}
.chat-box.hidden { display: none; }
.chat-messages {
  max-height: 160px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px 0;
}
.chat-message {
  font-size: 13px;
  color: #e8ecf4;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.9);
  padding: 1px 6px;
  border-radius: 2px;
  background: rgba(0,0,0,0.45);
  line-height: 1.5;
  word-break: break-word;
}
.chat-message .chat-name { font-weight: 600; }
.chat-message.system { color: #f0b429; }
.chat-message.server { color: #38bdf8; }
.chat-input-row {
  display: flex;
  gap: 4px;
  margin-top: 2px;
}
.chat-input-row input {
  flex: 1;
  background: rgba(0,0,0,0.75);
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 3px;
  color: #e8ecf4;
  font-size: 13px;
  padding: 6px 10px;
}
.chat-input-row input:focus { border-color: rgba(255,255,255,0.6); outline: none; }
.chat-input-row button {
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 3px;
  color: #e8ecf4;
  padding: 6px 12px;
  cursor: pointer;
  font-size: 13px;
  transition: background 0.1s;
}
.chat-input-row button:hover { background: rgba(255,255,255,0.22); }

/* ---------- Loading overlay ---------- */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg-deepest);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
  z-index: 9999;
}
.loading-overlay.hidden { display: none; }
.loading-player-canvas { image-rendering: pixelated; }
.loading-progress-wrap {
  width: 300px;
  height: 6px;
  background: rgba(255,255,255,0.08);
  border-radius: 3px;
  overflow: hidden;
}
.loading-progress-bar {
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
  transition: width 0.2s ease;
  box-shadow: 0 0 10px rgba(92,143,255,0.6);
}
.loading-status-text {
  font-size: 14px;
  color: var(--text-secondary);
}
.loading-friends-panel {
  position: absolute;
  right: 32px;
  top: 50%;
  transform: translateY(-50%);
  width: 220px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 16px;
}
.loading-friends-title {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
  margin-bottom: 10px;
}
.loading-friend-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 13px;
}
.loading-friend-row:last-child { border-bottom: none; }
.online-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.online-dot.online { background: var(--success); box-shadow: 0 0 4px rgba(34,197,94,0.6); }
.online-dot.offline { background: var(--text-muted); }
