/* === 全局重置 + 移动端适配 === */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; user-select: none; }
html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  background: #2a2a35;
  font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
  touch-action: none;
  overscroll-behavior: none;
  position: fixed;
  top: 0; left: 0;
  -webkit-user-select: none; user-select: none;
}

/* === 画布 === */
#游戏画布 {
  display: block;
  width: 100vw; height: 100vh;
  position: fixed; top: 0; left: 0;
  z-index: 1;
}

/* === 开始游戏界面 === */
#开始界面 {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #1f2b3e 0%, #111a28 100%);
  z-index: 500;
  padding: 20px;
}
#开始界面.隐藏 { display: none !important; }
.菜单框 {
  background: rgba(30, 42, 58, 0.9);
  border: 3px solid #ffc107;
  border-radius: 20px;
  padding: 30px 24px;
  width: 100%;
  max-width: 340px;
  display: flex; flex-direction: column;
  gap: 20px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
  text-align: center;
}
.游戏标题 {
  font-size: 32px;
  font-weight: 900;
  color: #ffc107;
  text-shadow: 2px 2px 0 #000, 0 0 10px rgba(255,193,7,0.4);
  letter-spacing: 2px;
}
.种子框 {
  display: flex; flex-direction: column;
  gap: 8px;
  text-align: left;
}
.种子框 label {
  color: #ddd;
  font-size: 14px;
  font-weight: bold;
}
.种子框 input {
  padding: 12px;
  border-radius: 8px;
  border: 2px solid #555;
  background: #111;
  color: #fff;
  font-size: 16px;
  outline: none;
  text-align: center;
}
.种子框 input:focus { border-color: #ffc107; }
.按钮组 {
  display: flex; flex-direction: column;
  gap: 10px;
}
.菜单按钮 {
  padding: 14px 0;
  border-radius: 12px;
  font-size: 16px;
  font-weight: bold;
  border: none;
  cursor: pointer;
  background: #ffc107;
  color: #111;
  text-shadow: 1px 1px 0 rgba(255,255,255,0.4);
  box-shadow: 0 4px 10px rgba(255,193,7,0.3);
}
.菜单按钮:active { transform: scale(0.96); box-shadow: none; }
.菜单按钮.次要 {
  background: #3e4a61;
  color: #eee;
  text-shadow: none;
  box-shadow: none;
}

/* === 通用面板 === */
.面板 {
  position: fixed;
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 12px;
  line-height: 1.6;
  pointer-events: none;
  z-index: 10;
  border: 1px solid rgba(255,255,255,0.15);
}
.左上 { top: env(safe-area-inset-top, 10px); left: 10px; }

/* === 右上菜单 === */
#右上菜单 {
  position: fixed; top: env(safe-area-inset-top, 10px); right: 10px;
  display: flex; flex-direction: column; gap: 10px;
  z-index: 20;
}
.圆形按钮 {
  width: 48px; height: 48px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.65);
  border: 2px solid rgba(255, 255, 255, 0.75);
  color: #fff;
  font-size: 18px; font-weight: bold;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  touch-action: manipulation;
  box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}
.圆形按钮:active { background: rgba(255, 193, 7, 0.6); transform: scale(0.9); }

/* === 摇杆 === */
#摇杆底座 {
  position: fixed; left: 24px; bottom: calc(env(safe-area-inset-bottom, 0px) + 110px);
  width: 140px; height: 140px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  border: 3px solid rgba(255, 255, 255, 0.45);
  z-index: 20;
  touch-action: none;
  box-shadow: 0 4px 12px rgba(0,0,0,0.25);
}
#摇杆头 {
  position: absolute; left: 50%; top: 50%;
  width: 60px; height: 60px;
  margin: -30px 0 0 -30px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.45);
  border: 2px solid rgba(255, 255, 255, 0.75);
  pointer-events: none;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

/* === 右下动作区 (飞，升，降) === */
#动作区 {
  position: fixed; right: 24px; bottom: calc(env(safe-area-inset-bottom, 0px) + 110px);
  display: flex; flex-direction: column; gap: 10px;
  align-items: center;
  z-index: 20;
}
.动作按钮 {
  width: 50px; height: 50px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.6);
  border: 2px solid rgba(255,255,255,0.7);
  color: #fff;
  font-size: 16px; font-weight: bold;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  touch-action: manipulation;
  box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}
.动作按钮:active { transform: scale(0.9); background: rgba(255,193,7,0.5); }

/* === 挖掘进度环（跟随在触屏手指处） === */
#挖掘进度环 {
  position: absolute;
  z-index: 100;
  display: flex; align-items: center; justify-content: center;
  pointer-events: none;
  width: 56px; height: 56px;
  transform: translate(-50%, -50%); /* 居中于手指 */
}
#挖掘进度环.隐藏 { display: none !important; }
#挖掘进度_文字 {
  position: absolute;
  color: #ffc107; font-size: 12px; font-weight: bold;
  text-shadow: 0 0 4px #000;
}

/* === 快捷栏 === */
#快捷栏 {
  position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom, 0px) + 16px);
  transform: translateX(-50%);
  display: flex; gap: 4px;
  padding: 4px;
  background: rgba(0, 0, 0, 0.65);
  border-radius: 12px;
  z-index: 15;
  pointer-events: auto;
  max-width: 96vw;
  overflow-x: auto;
  border: 1px solid rgba(255,255,255,0.15);
  box-shadow: 0 6px 16px rgba(0,0,0,0.4);
}
.快捷格子 {
  width: 52px; height: 52px;
  border-radius: 10px;
  background: rgba(30, 30, 30, 0.7);
  border: 1.5px solid rgba(255, 255, 255, 0.25);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  position: relative;
  cursor: pointer;
  flex-shrink: 0;
}
.快捷格子.选中 {
  background: rgba(255, 193, 7, 0.2);
  border: 2px solid #ffc107;
  box-shadow: 0 0 8px rgba(255,193,7,0.4);
}
.快捷格子_图标 { width: 26px; height: 24px; image-rendering: pixelated; }
.快捷格子_名称 { font-size: 8px; color: #eee; margin-top: 2px; text-align: center; }

/* === 背包界面 === */
#背包遮罩 {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
  padding: 16px;
}
#背包遮罩.隐藏 { display: none !important; }
#背包面板 {
  background: #1e1e28;
  border: 3px solid #ffc107;
  border-radius: 20px;
  padding: 14px;
  width: 96%;
  max-width: 360px; /* 宽度调大，保证 10 列格子完美并排 */
  max-height: 78vh; /* 高度限幅 */
  color: #fff;
  display: flex; flex-direction: column;
  gap: 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.6);
}
.背包标题 { font-size: 18px; font-weight: bold; text-align: center; color: #ffc107; }
.背包说明 { font-size: 11px; color: #aaa; text-align: center; }
#背包格子列表 {
  display: grid;
  grid-template-columns: repeat(10, 1fr); /* 核心：改为 10 列布局 */
  gap: 4px; /* 间隔微调小一点，确保在手机上一排并列 10 个 */
  overflow-y: auto;
  -webkit-overflow-scrolling: touch; /* 支持流畅滚动 */
  max-height: 42vh; /* 保证内部高度不足时滚动 */
  padding: 4px;
}
.背包格子 {
  aspect-ratio: 1 / 1;
  background: rgba(0, 0, 0, 0.5);
  border: 1.5px solid #444;
  border-radius: 6px; /* 稍微圆角 */
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  cursor: pointer;
  position: relative;
  padding: 1px;
}
.背包格子.选中 { border-color: #ffc107; background: rgba(255, 193, 7, 0.15); }
.背包格子_图标 { width: 20px; height: 18px; image-rendering: pixelated; } /* 缩小图标，让它更细致 */
.背包格子_名称 { display: none; } /* 10 列小布局下不展示格子内的中文名字，靠长按/悬停或底部状态提示，和物品栏一样简洁高画质！ */
.背包格子_数量 {
  position: absolute; right: 2px; bottom: 2px;
  font-size: 9px; color: #ffc107;
  background: rgba(0, 0, 0, 0.85);
  padding: 0 3px; border-radius: 3px;
}
#背包_关闭 {
  padding: 8px 20px;
  background: #ffc107;
  color: #111;
  border: none;
  border-radius: 8px;
  font-size: 14px; font-weight: bold;
  cursor: pointer;
  align-self: center;
}
#背包_关闭:active { transform: scale(0.95); }

/* === 确认弹窗 === */
#确认弹窗 {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex; align-items: center; justify-content: center;
  z-index: 200;
  padding: 16px;
}
#确认弹窗.隐藏 { display: none !important; }
.确认_卡片 {
  background: #1e1e28;
  border: 3px solid #ffc107;
  border-radius: 20px;
  padding: 24px;
  width: 100%; max-width: 300px;
  color: #fff;
  display: flex; flex-direction: column;
  gap: 16px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}
.确认_标题 { font-size: 18px; font-weight: bold; text-align: center; color: #ffc107; }
.确认_内容 { font-size: 13px; color: #ddd; text-align: center; line-height: 1.6; }
.确认_按钮组 { display: flex; gap: 12px; justify-content: center; }
.确认_按钮 {
  flex: 1; max-width: 110px;
  padding: 12px 0;
  border: none;
  border-radius: 10px;
  font-size: 14px; font-weight: bold;
  cursor: pointer;
  color: #fff;
}
.确认_按钮.取消 { background: #3e4a61; }
.确认_按钮.取消:active { transform: scale(0.95); }
.确认_按钮.确定 { background: #d35a4d; }
.确认_按钮.确定:active { transform: scale(0.95); }

/* === 加载提示 === */
#加载提示 {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #1f2b3e 0%, #111a28 100%);
  color: #ffc107; font-size: 20px; font-weight: bold;
  z-index: 999;
}
#加载提示.隐藏 { display: none !important; }

.隐藏 { display: none !important; }