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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: "Microsoft YaHei", Arial, sans-serif;
  background: #000;
  color: #fff;
  user-select: none;
}

#gameCanvas {
  display: block;
  width: 100vw;
  height: 100vh;
  cursor: none;
}

/* 准星 */
#crosshair {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: rgba(255, 255, 255, 0.85);
  font-size: 22px;
  font-weight: bold;
  text-shadow: 0 0 4px rgba(0, 0, 0, 0.9);
  pointer-events: none;
  z-index: 10;
}

/* HUD 生命值/饥饿值 */
#stats {
  position: fixed;
  bottom: 70px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 2px;
  align-items: center;
  z-index: 10;
  pointer-events: none;
}
.stat-row {
  display: flex;
  gap: 2px;
}
.heart, .drumstick {
  width: 18px;
  height: 18px;
  display: inline-block;
  background-size: contain;
  background-repeat: no-repeat;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.8));
}
.heart { background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'><path d='M16 28 C3 18 5 8 11 8 C14 8 16 11 16 11 C16 11 18 8 21 8 C27 8 29 18 16 28 Z' fill='%23e23b3b' stroke='%23000' stroke-width='2'/></svg>"); }
.heart.empty { background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'><path d='M16 28 C3 18 5 8 11 8 C14 8 16 11 16 11 C16 11 18 8 21 8 C27 8 29 18 16 28 Z' fill='%23333' stroke='%23000' stroke-width='2'/></svg>"); }
.drumstick { background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'><path d='M10 22 C4 18 6 8 12 8 C16 8 18 12 18 14 L24 8 C25 7 27 9 26 10 L20 16 C22 18 22 20 18 22 C16 24 14 26 10 22 Z' fill='%23c08a3e' stroke='%23000' stroke-width='2'/></svg>"); }
.drumstick.empty { background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'><path d='M10 22 C4 18 6 8 12 8 C16 8 18 12 18 14 L24 8 C25 7 27 9 26 10 L20 16 C22 18 22 20 18 22 C16 24 14 26 10 22 Z' fill='%23333' stroke='%23000' stroke-width='2'/></svg>"); }

/* 物品栏 */
#hotbar {
  position: fixed;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 4px;
  padding: 6px;
  background: rgba(0, 0, 0, 0.45);
  border: 2px solid rgba(255, 255, 255, 0.25);
  border-radius: 6px;
  z-index: 10;
}
.slot {
  width: 48px;
  height: 48px;
  background: rgba(0, 0, 0, 0.4);
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color 0.1s;
}
.slot.active { border-color: #fff; box-shadow: 0 0 8px rgba(255,255,255,0.4); }
.slot-icon {
  width: 36px;
  height: 36px;
  background-size: cover;
  background-position: center;
  image-rendering: pixelated;
}
.slot-count {
  position: absolute;
  right: 3px;
  bottom: 1px;
  font-size: 13px;
  font-weight: bold;
  color: #fff;
  text-shadow: 1px 1px 2px #000;
}

/* 全屏覆盖面板 */
.screen {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.78);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  backdrop-filter: blur(4px);
}
.screen.hidden { display: none; }

.menu-card, .crafting-card {
  background: linear-gradient(180deg, #2b2b3a, #1a1a25);
  border: 2px solid rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  padding: 30px 40px;
  text-align: center;
  min-width: 320px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.6);
}
.crafting-card { min-width: 420px; max-width: 560px; }

.title {
  font-size: 38px;
  margin-bottom: 4px;
  background: linear-gradient(90deg, #7fd, #6bf, #a6f);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: 2px;
}
.subtitle { color: #aaa; margin-bottom: 24px; font-size: 14px; }

.btn {
  display: block;
  width: 100%;
  padding: 12px 20px;
  margin: 10px 0;
  background: #3a3a4a;
  color: #fff;
  border: 2px solid rgba(255,255,255,0.15);
  border-radius: 6px;
  font-size: 16px;
  cursor: pointer;
  transition: all 0.15s;
}
.btn:hover:not(:disabled) { background: #4a4a5a; transform: translateY(-1px); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-primary { background: #2a7a4a; }
.btn-primary:hover:not(:disabled) { background: #34925a; }

.tips {
  margin-top: 24px;
  padding: 16px;
  background: rgba(0,0,0,0.3);
  border-radius: 6px;
  text-align: left;
  font-size: 13px;
  color: #ccc;
}
.tips h3 { margin-bottom: 8px; color: #fff; }
.tips ul { list-style: none; padding: 0; }
.tips li { margin: 4px 0; }
.tips b { color: #ffd; }

/* 合成列表 */
#recipeList {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 16px 0;
  max-height: 320px;
  overflow-y: auto;
}
.recipe-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  background: rgba(0,0,0,0.3);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 4px;
  cursor: pointer;
  text-align: left;
}
.recipe-item:hover { background: rgba(255,255,255,0.08); }
.recipe-item.disabled { opacity: 0.4; cursor: not-allowed; }
.recipe-icon { width: 32px; height: 32px; background-size: cover; image-rendering: pixelated; }
.recipe-name { font-size: 13px; color: #eee; }
.recipe-cost { font-size: 11px; color: #aaa; }

#saveStatus { margin-top: 12px; font-size: 13px; color: #8f8; min-height: 18px; }

/* Toast 提示 */
.toast {
  position: fixed;
  top: 80px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.8);
  color: #fff;
  padding: 8px 16px;
  border-radius: 4px;
  z-index: 200;
  font-size: 14px;
  pointer-events: none;
  transition: opacity 0.3s;
}
.toast.hidden { opacity: 0; }

/* 死亡画面 */
#deathScreen {
  background: rgba(80, 0, 0, 0.6);
}
