/* ====================================
   BlockCraft 全局样式
   ==================================== */
* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  width: 100%; height: 100%;
  overflow: hidden; background: #000;
  font-family: 'Press Start 2P', 'Courier New', monospace;
  -webkit-user-select: none; user-select: none;
}

#game { position: fixed; inset: 0; }
#game canvas { display: block; }

/* ---------- 兼容模式：隐藏系统光标（由 main.js 给 body 添加 .compat） ---------- */
body.compat #hud { cursor: none; }

/* ====================================
   HUD（准星/信息/物品栏）
   ==================================== */
#hud {
  position: fixed; inset: 0;
  pointer-events: none;
  color: #fff;
  z-index: 5;
}

/* 准星 */
#crosshair {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  font-size: 26px;
  color: rgba(255, 255, 255, 0.92);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.7);
  pointer-events: none;
}

/* 顶部信息（FPS / 坐标） */
#info-top {
  position: absolute; top: 12px; left: 14px;
  display: flex; flex-direction: column; gap: 6px;
  pointer-events: none;
}
#fps, #coords {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.9);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.85);
}

/* 底部目标方块提示 */
#blockinfo {
  position: absolute; bottom: 110px; left: 50%;
  transform: translateX(-50%);
  font-size: 13px;
  color: rgba(255, 255, 240, 0.95);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.85);
  pointer-events: none;
}

/* 物品栏容器（居中底部） */
#hotbar-wrap {
  position: absolute; bottom: 18px; left: 50%;
  transform: translateX(-50%);
  padding: 6px;
  background: rgba(0, 0, 0, 0.45);
  border-radius: 10px;
  border: 2px solid rgba(255, 255, 255, 0.25);
  pointer-events: auto;   /* 允许点击切换槽位 */
}
#hotbar {
  display: flex; gap: 6px;
}
#hotbar .slot {
  width: 52px; height: 52px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0, 0, 0, 0.35);
  cursor: pointer;
  position: relative;
  transition: background .12s, border-color .12s;
}
#hotbar .slot:hover { background: rgba(255,255,255,.12); }
#hotbar .slot.active {
  border-color: #fff;
  background: rgba(255, 255, 255, 0.18);
  box-shadow: 0 0 12px rgba(255, 255, 255, 0.45);
}
#hotbar .slot canvas { width: 36px; height: 36px; image-rendering: pixelated; }
#hotbar .slot .key {
  position: absolute; top: 2px; left: 4px;
  font-size: 9px;
  color: rgba(255, 255, 255, 0.85);
}

/* ====================================
   遮罩（菜单 / 暂停）
   ==================================== */
.overlay {
  position: fixed; inset: 0; z-index: 10;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  background: rgba(6, 14, 26, 0.82);
  backdrop-filter: blur(3px);
  color: #fff; text-align: center; padding: 20px;
}

#menu h1 {
  font-size: 34px; margin-bottom: 8px;
  color: #7ddb4e; letter-spacing: 2px;
  text-shadow: 3px 3px 0 #3f7d1e;
}
#menu .subtitle {
  font-size: 11px; color: #b8d4f0;
  margin-bottom: 24px;
}

.controls-grid {
  display: grid; grid-template-columns: auto auto;
  gap: 9px 26px; font-size: 11px;
  margin-bottom: 28px; color: #cfe4ff; text-align: left;
}
.controls-grid b { color: #ffe28a; }

.btn-row { display: flex; gap: 16px; flex-wrap: wrap; justify-content: center; }

.btn {
  font-family: inherit; font-size: 14px; padding: 14px 30px;
  color: #fff; cursor: pointer;
  border-radius: 6px;
  background: linear-gradient(#7ab648, #5a8a2f);
  border: 3px solid #2e4d14;
  box-shadow: 0 4px 0 #2e4d14;
  transition: transform .05s, filter .1s, box-shadow .05s;
}
.btn:hover  { filter: brightness(1.12); }
.btn:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 #2e4d14;
}

/* 暂停界面（默认隐藏，指针退出锁定时显示） */
#paused { display: none; }
.pause-title { margin-bottom: 24px; color: #ffd76e; }

/* ====================================
   Toast 提示（由 main.js 动态创建）
   ==================================== */
#toast {
  position: fixed; top: 18%; left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.82);
  color: #ffd76e;
  padding: 10px 18px; border-radius: 8px;
  z-index: 99; pointer-events: none;
  font-size: 12px; opacity: 0;
  transition: opacity .3s;
  max-width: 86vw; text-align: center;
  font-family: 'Courier New', monospace;
}

/* ====================================
   小屏适配
   ==================================== */
@media (max-width: 640px) {
  #menu h1 { font-size: 22px; }
  .controls-grid { grid-template-columns: auto; gap: 6px 0; }
  #hotbar .slot { width: 40px; height: 40px; }
  #hotbar .slot canvas { width: 28px; height: 28px; }
}