/* === 全局基础 === */
body {
  font-family: "Microsoft YaHei", sans-serif;
  background-color: #0e0e0e;
  color: #e0e0e0;
  margin: 0;
  padding: 0;
}

/* === 顶部区域 === */
header {
  background: #1a1a1a;
  padding: 12px 16px;
  border-bottom: 2px solid #333;
}

h2 {
  margin: 0;
  color: #ffaa33;
}

/* === 顶部状态区 === */
.adventure-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 10px;
}

.adventure-equip,
.adventure-backpack {
  flex: 1;
  padding: 10px;
  background: #222;
  border-radius: 8px;
  box-shadow: 0 0 4px rgba(255, 255, 255, 0.05);
}

.adventure-equip h4,
.adventure-backpack h4 {
  margin: 0 0 6px;
  color: #ffaa33;
  font-size: 16px;
  border-bottom: 1px solid #444;
  padding-bottom: 4px;
}

/* === 状态栏 === */
#playerStatus {
  margin-top: 8px;
  font-size: 15px;
  color: #33aaff;
  font-weight: bold;
  transition: color 0.3s;
  padding: 6px;
  border-radius: 6px;
}

/* === 主内容 === */
.content {
  padding: 15px;
}

.warehouse, .inventory {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
  align-items: flex-start;
}

/* === 物品显示 === */
.item {
  padding: 6px 10px;
  background: #333;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid #444;
  flex-shrink: 0;
  white-space: nowrap;
}
.item:hover {
  background: #444;
  transform: scale(1.02);
  box-shadow: 0 2px 12px rgba(255, 170, 51, 0.4);
}

/* === 等级颜色 === */
.lvl1 { color: #00ff00; }
.lvl2 { color: #33aaff; }
.lvl3 { color: #bb66ff; }
.lvl4 { color: #ffaa33; }

/* === 按钮样式 === */
button {
  margin: 6px;
  padding: 8px 12px;
  border: none;
  border-radius: 8px;
  background: #333;
  color: #eee;
  cursor: pointer;
  transition: 0.2s;
  font-size: 14px;
}
button:hover {
  background: #555;
  transform: scale(1.05);
}

/* === 行动按钮组 === */
.action-buttons {
  margin-top: 12px;
  text-align: center;
}

/* === 日志与敌人信息 === */
#adventureLog {
  max-height: 300px;
  overflow-y: auto;
  padding: 10px;
  background: #1a1a1a;
  border-radius: 8px;
  border: 1px solid #333;
}

.log {
  background: #222;
  padding: 10px;
  border-radius: 8px;
  margin-top: 10px;
  border-left: 3px solid #ffaa33;
}

.enemy-area {
  margin-top: 15px;
}

/* === 获得物资 === */
#acquiredItems {
  background: #181818;
  padding: 12px;
  border-radius: 8px;
  margin-top: 20px;
  border: 1px solid #333;
}

/* === 详情弹窗 === */
#itemDetail, .item-detail {
  background: #222;
  border: 1px solid #333;
  border-radius: 8px;
  padding: 12px;
  margin-top: 10px;
  box-shadow: 0 0 6px rgba(0,0,0,0.5);
}

/* === 背包内物品 === */
#adventureBackpack .item, #bagStatus .item {
  font-size: 13px;
  background: #2a2a2a;
  border: 1px solid #3a3a3a;
}
#adventureBackpack .item:hover, #bagStatus .item:hover {
  background: #444;
}

/* === 提示 === */
.hint {
  font-size: 13px;
  color: #888;
  background: #1a1a1a;
  padding: 6px 8px;
  border-left: 3px solid #ffaa33;
  border-radius: 4px;
  margin: 8px 0;
}

/* === 新物品获得动画 === */
.new-item {
  animation: pulse 0.6s ease-out;
}
@keyframes pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.1); background: #556; }
  100% { transform: scale(1); }
}

/* === HP 变化动画 === */
.damage-flash {
  animation: damageFlash 0.6s ease;
}
.heal-flash {
  animation: healFlash 0.6s ease;
}
@keyframes damageFlash {
  0% { background: #400; }
  50% { background: #a00; }
  100% { background: none; }
}
@keyframes healFlash {
  0% { background: #040; }
  50% { background: #0f0; }
  100% { background: none; }
}

/* === 界面淡入淡出动画 === */
.fade-in { animation: fadeIn 0.6s ease; }
.fade-out { animation: fadeOut 0.6s ease; }
@keyframes fadeIn { from {opacity:0;} to {opacity:1;} }
@keyframes fadeOut { from {opacity:1;} to {opacity:0;} }

/* === 响应式优化 === */
@media (max-width: 768px) {
  .adventure-header {
    flex-direction: column;
    gap: 12px;
  }
  .adventure-equip, .adventure-backpack {
    padding: 12px;
  }
  #adventureLog {
    max-height: 200px;
  }
}

/* === 手机端交互优化（480px以下） === */
@media (max-width: 480px) {
  .action-buttons {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
  }
  .action-buttons button {
    width: 48%;
    margin: 4px 1%;
    padding: 12px 0;
    font-size: 16px;
  }
}

/* ==========================
   弹窗显示优化样式（桌面 + 移动通用）
   ========================== */

/* 基础弹窗样式 */
#itemDetail {
  position: fixed;
  left: 50%;
  top: 15vh;
  transform: translateX(-50%);
  width: 380px;
  max-height: 60vh;
  overflow-y: auto;
  background: rgba(20,20,20,0.95);
  border: 1px solid #555;
  border-radius: 16px;
  box-shadow: 0 0 25px rgba(0,0,0,0.45);
  padding: 18px;
  color: #ddd;
  z-index: 2000;
  opacity: 0;
  transition: opacity 0.25s ease, transform 0.25s ease;
  display: none;
}
#itemDetail.show {
  display: block;
  opacity: 1;
  transform: translate(-50%, 0);
}

/* 按钮美化 */
#itemDetail button.dynamic {
  background: #333;
  color: #eee;
  border: 1px solid #555;
  border-radius: 8px;
  padding: 6px 12px;
  margin: 6px;
  cursor: pointer;
  transition: background 0.2s;
}
#itemDetail button.dynamic:hover {
  background: #555;
}

/* 装备栏弹窗更靠近装备 */
#itemDetail.equip-mode {
  width: 280px;
  left: auto;
  transform: none;
  background: rgba(30,30,30,0.95);
  border-color: #666;
  box-shadow: 0 0 16px rgba(0,0,0,0.4);
}

/* 背包弹窗（气泡） */
#itemDetail.bag-mode {
  width: 260px;
  max-height: none;
  background: rgba(40,40,40,0.96);
  box-shadow: 0 4px 12px rgba(0,0,0,0.5);
  border-radius: 12px;
}

/* 遮罩层（点击关闭） */
#detailOverlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 1500;
  display: none;
  opacity: 0;
  transition: opacity 0.2s;
}
#detailOverlay.show {
  display: block;
  opacity: 1;
}
