/* ============================================
   光隙旅人 — 全局样式 (v2)
   ============================================ */

/* -- 重置 & 基础 -- */
*, *::before, *::after {
  margin: 0; padding: 0; box-sizing: border-box;
}

body {
  background: linear-gradient(135deg, #0f0f23 0%, #1a1a2e 100%);
  color: #e0e0e0;
  font-family: 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  overflow: hidden;
  font-size: 16px;
}

/* -- 游戏容器 -- */
#game-wrapper {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  max-width: 100vw;
}

/* -- 标题栏 -- */
#title-bar h1 {
  font-size: 1.3rem;
  letter-spacing: 4px;
  color: #FFD700;
  text-shadow: 0 0 12px rgba(255, 215, 0, 0.5);
}
#title-bar .sub {
  font-size: 0.65rem;
  color: #888;
  letter-spacing: 2px;
}

/* -- 画布 -- */
#gameCanvas {
  border: 1px solid rgba(255, 215, 0, 0.15);
  border-radius: 6px;
  background: #0f0f23;
  box-shadow: 0 0 40px rgba(255, 215, 0, 0.05);
  cursor: crosshair;
  max-width: 100vw;
  touch-action: none;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

/* -- HUD 状态栏 -- */
#hud {
  display: flex;
  gap: 10px;
  font-size: 0.85rem;
  flex-wrap: wrap;
  justify-content: center;
}
.hud-item {
  background: rgba(255, 255, 255, 0.05);
  padding: 5px 12px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  white-space: nowrap;
}
.hud-item span {
  color: #FFD700;
}

/* -- 移动端技能快捷栏 -- */
#mobile-skillbar {
  display: none; /* 默认PC端隐藏 */
  gap: 10px;
  justify-content: center;
  padding: 6px 0;
}
.skill-btn {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  font-size: 1.5rem;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 215, 0, 0.2);
  color: #FFD700;
  letter-spacing: 0;
}
.skill-btn:active {
  background: rgba(255, 215, 0, 0.3);
  transform: scale(0.92);
}

/* -- 弹窗通用 -- */
.modal {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 100;
  backdrop-filter: blur(4px);
}
.modal.hidden {
  display: none;
}
.modal-content {
  background: linear-gradient(145deg, #1a1a2e, #16213e);
  border: 1px solid rgba(255, 215, 0, 0.2);
  border-radius: 12px;
  padding: 24px 28px;
  text-align: center;
  max-width: 520px;
  width: 92%;
  max-height: 90vh;
  overflow-y: auto;
}
.modal-content h2 {
  color: #FFD700;
  margin-bottom: 16px;
  font-size: 1.2rem;
}

/* -- 技能选择卡片 -- */
#skill-choices {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}
.skill-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 14px;
  width: 140px;
  cursor: pointer;
  transition: all 0.2s;
  min-height: 60px;
}
.skill-card:hover, .skill-card:active {
  border-color: #FFD700;
  box-shadow: 0 0 16px rgba(255, 215, 0, 0.2);
  transform: translateY(-2px);
}
.skill-card .icon { font-size: 1.8rem; margin-bottom: 6px; }
.skill-card .name { color: #FFD700; font-weight: bold; margin-bottom: 4px; font-size: 0.9rem; }
.skill-card .desc { font-size: 0.7rem; color: #aaa; line-height: 1.3; }

/* -- 商店样式 -- */
.shop-content { max-width: 460px; }
.shop-dust { color: #FFD700; margin-bottom: 14px; font-size: 0.95rem; }
#shop-items {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}
.shop-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 10px 14px;
  cursor: pointer;
  transition: all 0.15s;
  min-height: 60px;
}
.shop-item:hover, .shop-item:active {
  border-color: #FFD700;
  background: rgba(255, 215, 0, 0.06);
}
.shop-item.disabled {
  opacity: 0.4;
  pointer-events: none;
}
.shop-item .si-icon { font-size: 1.6rem; }
.shop-item .si-info { flex: 1; text-align: left; }
.shop-item .si-name { color: #fff; font-weight: bold; font-size: 0.85rem; }
.shop-item .si-desc { color: #aaa; font-size: 0.7rem; }
.shop-item .si-cost { color: #FFD700; font-weight: bold; font-size: 0.9rem; white-space: nowrap; }

/* -- 天赋树样式 -- */
.talent-content { max-width: 480px; }
.talent-dust { color: #FFD700; margin-bottom: 12px; }
#talent-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 10px;
}
.talent-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  padding: 10px 12px;
  min-height: 60px;
}
.talent-row .t-icon { font-size: 1.5rem; }
.talent-row .t-info { flex: 1; text-align: left; }
.talent-row .t-name { color: #fff; font-weight: bold; font-size: 0.85rem; }
.talent-row .t-desc { color: #888; font-size: 0.68rem; }
.talent-row .t-level { color: #4ECDC4; font-size: 0.75rem; }
.talent-row .t-btn {
  padding: 6px 14px;
  font-size: 0.75rem;
  border-radius: 15px;
  min-width: 60px;
  min-height: 36px;
}
.talent-row .t-btn.maxed {
  background: #555;
  cursor: default;
}

#relic-list {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
  margin: 8px 0 14px;
  min-height: 30px;
}
.relic-tag {
  background: rgba(149, 225, 211, 0.1);
  border: 1px solid rgba(149, 225, 211, 0.25);
  border-radius: 16px;
  padding: 4px 12px;
  font-size: 0.75rem;
  color: #95E1D3;
}

/* -- 按钮 -- */
button {
  background: linear-gradient(135deg, #FFD700, #e6ac00);
  color: #1a1a2e;
  border: none;
  padding: 10px 28px;
  border-radius: 25px;
  font-size: 0.95rem;
  font-weight: bold;
  cursor: pointer;
  letter-spacing: 2px;
  transition: all 0.2s;
  min-height: 44px;
  min-width: 44px;
}
button:hover {
  box-shadow: 0 0 20px rgba(255, 215, 0, 0.4);
  transform: scale(1.03);
}
button:active {
  transform: scale(0.97);
}
.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: #ccc;
  border: 1px solid rgba(255, 255, 255, 0.15);
  font-weight: normal;
  letter-spacing: 1px;
}
.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.15);
  box-shadow: none;
}
.hidden { display: none !important; }

/* -- 静音按钮 -- */
.hud-btn { cursor: pointer; user-select: none; -webkit-user-select: none; }
.hud-btn:active { transform: scale(0.92); }

/* -- 开始画面 -- */
#start-screen {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: linear-gradient(135deg, #0f0f23 0%, #1a1a2e 100%);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 200;
}
#start-screen.hidden { display: none; }
#start-screen h1 {
  font-size: 2.8rem;
  color: #FFD700;
  text-shadow: 0 0 30px rgba(255, 215, 0, 0.4);
  margin-bottom: 8px;
  letter-spacing: 8px;
}
#start-screen .tagline {
  color: #888;
  font-size: 0.95rem;
  letter-spacing: 4px;
  margin-bottom: 36px;
}
#start-screen .instructions {
  margin-bottom: 28px;
  line-height: 1.9;
  color: #aaa;
  font-size: 0.82rem;
}
#start-btns {
  display: flex;
  gap: 12px;
}

/* ========== 响应式 — 移动端 ========== */
@media (max-width: 820px) {
  body { align-items: flex-start; padding-top: 8px; }

  #title-bar h1 { font-size: 1.1rem; letter-spacing: 2px; }
  #title-bar .sub { display: none; }

  #gameCanvas {
    width: 100vw;
    height: auto;
    border-radius: 0;
    border-left: none;
    border-right: none;
  }

  #hud {
    gap: 6px;
    font-size: 0.78rem;
  }
  .hud-item { padding: 4px 10px; }

  #mobile-skillbar {
    display: flex;
  }

  .skill-card { width: 110px; padding: 10px; }
  .skill-card .icon { font-size: 1.5rem; }

  #start-screen h1 { font-size: 2rem; letter-spacing: 4px; }
  #start-screen .instructions { font-size: 0.78rem; }

  .modal-content { padding: 20px 16px; }
  .modal-content h2 { font-size: 1.1rem; }
}

/* -- 横屏模式 -- */
@media (max-width: 820px) and (orientation: landscape) {
  body { padding-top: 2px; }
  #title-bar { display: none; }
  #hud { font-size: 0.72rem; }
  .hud-item { padding: 3px 8px; }
  #mobile-skillbar { padding: 2px 0; }
  .skill-btn { width: 48px; height: 48px; font-size: 1.2rem; }
}
