/* ====== 嘟嘟跳 2 样式（职业系统版 · 分支成长） ====== */
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: "Comic Sans MS", "Marker Felt", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  background: #f4f1e8;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

#game-root {
  position: relative;
  width: 100vw;
  height: 100vh;
  max-width: 480px;
  margin: 0 auto;
  background: #fbfaf3;
  overflow: hidden;
}

.screen {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 24px;
  z-index: 10;
  background:
    repeating-linear-gradient(0deg, transparent 0, transparent 39px, rgba(0,0,0,0.04) 40px),
    repeating-linear-gradient(90deg, transparent 0, transparent 39px, rgba(0,0,0,0.04) 40px),
    #fbfaf3;
}

.screen.hidden, .hidden { display: none !important; }
.screen.active { display: flex; }

#game-canvas {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  z-index: 1;
  pointer-events: none;
}

/* ====== 菜单 ====== */
.title-wrap { text-align: center; margin-bottom: 30px; }
.game-title {
  font-size: 56px;
  color: #ff5757;
  text-shadow:
    3px 3px 0 #fff,
    5px 5px 0 #2a2a2a;
  letter-spacing: 4px;
  transform: rotate(-2deg);
}
.subtitle {
  margin-top: 8px;
  color: #777;
  font-size: 14px;
  letter-spacing: 2px;
}

.character-picker {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
  justify-content: center;
}
.char-card {
  width: 78px;
  background: #fff;
  border: 3px solid #2a2a2a;
  border-radius: 14px;
  padding: 8px 4px;
  text-align: center;
  cursor: pointer;
  box-shadow: 3px 3px 0 #2a2a2a;
  transition: transform 0.15s;
  position: relative;
}
.char-card:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 #2a2a2a; }
.char-card.selected { background: #fff7a8; transform: translateY(-4px); }
.char-card.locked { opacity: 0.55; filter: grayscale(0.4); }
.char-card.locked::after {
  content: "🔒";
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  font-size: 28px;
}
.char-svg { width: 56px; height: 56px; margin: 0 auto; }
.char-svg svg { width: 100%; height: 100%; }
.char-level {
  font-size: 11px;
  color: #555;
  margin-top: 2px;
  font-weight: bold;
}

.play-btn {
  background: #4ecb4e;
  color: #fff;
  border: 3px solid #2a2a2a;
  border-radius: 30px;
  padding: 14px 50px;
  font-size: 22px;
  font-weight: bold;
  cursor: pointer;
  box-shadow: 4px 4px 0 #2a2a2a;
  letter-spacing: 2px;
  transition: transform 0.1s;
  font-family: inherit;
}
.play-btn:active { transform: translate(2px, 2px); box-shadow: 2px 2px 0 #2a2a2a; }
.hint { margin-top: 16px; font-size: 12px; color: #999; }

/* ====== HUD ====== */
.hud {
  position: absolute; inset: 0;
  pointer-events: none;
  z-index: 5;
}

/* 积分 — 右上角 */
.hud-score-topright {
  position: absolute;
  top: 10px;
  right: 12px;
  text-align: right;
  line-height: 1;
  pointer-events: none;
}
.hud-score-topright .score-best { font-size: 14px; color: #888; font-weight: bold; }
.hud-score-topright .score-cur { font-size: 36px; color: #2a2a2a; font-weight: bold; margin-top: 2px; text-shadow: 1px 1px 0 #fff; }

/* 生命 — 左上角顶部 */
.hud-lives-topleft {
  position: absolute;
  top: 12px;
  left: 12px;
  background: #ffd54a;
  border: 2px solid #2a2a2a;
  border-radius: 20px;
  padding: 3px 10px;
  display: flex; align-items: center; gap: 3px;
  font-weight: bold;
  font-size: 13px;
  pointer-events: none;
}
.heart-icon { color: #ff5757; font-size: 14px; }
.lives-count { color: #2a2a2a; }

/* 等级职业标签 — 生命下方 */
.hud-class-lv {
  position: absolute;
  top: 42px;
  left: 12px;
  background: linear-gradient(135deg, #ffd54a, #ffb300);
  border: 2px solid #2a2a2a;
  border-radius: 10px;
  padding: 2px 8px;
  font-weight: bold;
  font-size: 11px;
  color: #2a2a2a;
  box-shadow: 2px 2px 0 rgba(42,42,42,0.3);
  pointer-events: none;
}

/* 技能面板 — 经验条下方 */
.skill-panel {
  position: absolute;
  top: 76px;
  left: 12px;
  max-width: 170px;
  pointer-events: auto;
}
.sp-attrs {
  display: flex;
  gap: 8px;
  margin-bottom: 4px;
}
.sp-attrs span {
  background: rgba(0,0,0,0.55);
  color: #ffee88;
  font-size: 10px;
  font-weight: bold;
  padding: 1px 6px;
  border-radius: 6px;
}
.sp-skill {
  display: inline-block;
  background: rgba(0,80,40,0.7);
  color: #88ffcc;
  border: 1px solid rgba(0,255,136,0.5);
  font-size: 10px;
  font-weight: bold;
  padding: 2px 8px;
  border-radius: 8px;
  margin: 2px 4px 2px 0;
  cursor: pointer;
  transition: all 0.15s;
}
.sp-skill:hover {
  background: rgba(0,120,60,0.85);
  border-color: #00ff88;
  box-shadow: 0 0 8px rgba(0,255,136,0.4);
}

/* 技能 tooltip */
.skill-tooltip {
  position: absolute;
  background: rgba(0,0,0,0.88);
  color: #fff;
  border: 2px solid #00ff88;
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 11px;
  line-height: 1.5;
  max-width: 220px;
  z-index: 30;
  pointer-events: none;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}

/* ====== 大招按钮 ====== */
.ult-btn {
  position: absolute;
  right: 12px;
  bottom: 80px;
  width: 64px; height: 64px;
  border-radius: 50%;
  background: rgba(255,170,0,0.25);
  border: 3px solid rgba(255,170,0,0.6);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  cursor: pointer;
  pointer-events: auto;
  box-shadow: 2px 2px 0 rgba(42,42,42,0.3);
  transition: all 0.15s;
  font-family: inherit;
  z-index: 10;
}
.ult-btn:active { transform: scale(0.92); }
.ult-btn.active {
  background: rgba(255,170,0,0.55);
  border-color: #ffaa00;
  box-shadow: 0 0 16px rgba(255,170,0,0.6), 2px 2px 0 rgba(42,42,42,0.3);
}
.ult-btn.disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.ult-label {
  font-size: 13px;
  font-weight: bold;
  color: #ffaa00;
}
.ult-status {
  font-size: 9px;
  color: rgba(255,170,0,0.85);
}

/* ====== 举盾按钮 ====== */
.shield-btn {
  position: absolute;
  right: 84px;
  bottom: 24px;
  width: 58px; height: 58px;
  border-radius: 50%;
  background: rgba(68,136,255,0.25);
  border: 3px solid rgba(68,136,255,0.6);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  cursor: pointer;
  pointer-events: auto;
  box-shadow: 2px 2px 0 rgba(42,42,42,0.3);
  transition: all 0.15s;
  font-family: inherit;
  z-index: 10;
}
.shield-btn:active { transform: scale(0.92); }
.shield-btn.active {
  background: rgba(68,136,255,0.5);
  border-color: #4488ff;
  box-shadow: 0 0 16px rgba(68,136,255,0.6), 2px 2px 0 rgba(42,42,42,0.3);
}
.shield-label {
  font-size: 11px;
  font-weight: bold;
  color: #6699ff;
}

.hud-side-right {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  display: flex; flex-direction: column; gap: 12px;
  pointer-events: auto;
}
.hud-btn {
  width: 52px; height: 52px;
  border-radius: 50%;
  background: #ffd54a;
  border: 3px solid #2a2a2a;
  font-size: 22px;
  cursor: pointer;
  box-shadow: 3px 3px 0 #2a2a2a;
  display: flex; align-items: center; justify-content: center;
  font-family: inherit;
}
.hud-btn:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 #2a2a2a; }

/* ====== 弹窗 ====== */
.overlay {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.45);
  display: flex; align-items: center; justify-content: center;
  z-index: 20;
}
.modal {
  background: #fff;
  border: 4px solid #2a2a2a;
  border-radius: 18px;
  padding: 30px 24px;
  text-align: center;
  box-shadow: 6px 6px 0 #2a2a2a;
  min-width: 260px;
}
.modal h2 { margin-bottom: 16px; color: #2a2a2a; }
.modal-btn {
  display: block;
  width: 100%;
  margin: 8px 0;
  background: #fff;
  border: 3px solid #2a2a2a;
  border-radius: 24px;
  padding: 10px 0;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  font-family: inherit;
}
.modal-btn:first-of-type { background: #4ecb4e; color: #fff; }
.result-score { margin: 6px 0; color: #555; }
.result-score span { color: #2a2a2a; font-weight: bold; font-size: 22px; }

/* ====== 技能选择弹窗 ====== */
.skill-select-modal {
  min-width: 300px;
  max-width: 400px;
  max-height: 90vh;
  overflow-y: auto;
}
.skill-select-hint {
  font-size: 12px;
  color: #888;
  margin-bottom: 16px;
}
.skill-choice {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  background: #f8f8f0;
  border: 3px solid #2a2a2a;
  border-radius: 14px;
  padding: 12px 16px;
  margin: 8px 0;
  cursor: pointer;
  box-shadow: 3px 3px 0 #2a2a2a;
  transition: all 0.15s;
  text-align: left;
}
.skill-choice:hover {
  background: #fff7a8;
  transform: translateY(-2px);
  box-shadow: 4px 5px 0 #2a2a2a;
}
.skill-choice:active {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 #2a2a2a;
}
.skill-choice-name {
  font-size: 18px;
  font-weight: bold;
  color: #2a6a2a;
}
.skill-choice-desc {
  font-size: 12px;
  color: #555;
  line-height: 1.5;
}

/* ====== 世界选择 ====== */
.world-title { margin-bottom: 24px; color: #2a2a2a; }
.world-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 24px;
  max-width: 360px;
}
.world-card {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  cursor: pointer;
}
.world-preview {
  width: 90px; height: 90px;
  border: 3px solid #2a2a2a;
  border-radius: 14px;
  box-shadow: 3px 3px 0 #2a2a2a;
  position: relative;
  overflow: hidden;
}
.world-card.selected .world-preview { background: #fff7a8; }
.world-card span { font-size: 13px; font-weight: bold; }
.world-preview.grass { background: linear-gradient(180deg, #87ceeb 0%, #87ceeb 40%, #6ab04c 40%, #4a8c34 100%); }
.world-preview.desert { background: linear-gradient(180deg, #f6c365 0%, #f6c365 40%, #e0a050 40%, #c98030 100%); }
.world-preview.sleepy { background: linear-gradient(180deg, #2c3e6b 0%, #2c3e6b 40%, #3a2a55 40%, #1a1430 100%); }
.world-preview.sky { background: linear-gradient(180deg, #b3e0ff 0%, #b3e0ff 40%, #8ec3e8 40%, #6ba0c8 100%); }
.world-preview.space { background: linear-gradient(180deg, #1a1a3a 0%, #1a1a3a 40%, #2a1a4a 40%, #0a0a1a 100%); }
.world-preview.rain { background: linear-gradient(180deg, #6a7a8a 0%, #6a7a8a 40%, #3a4555 40%, #1a2535 100%); }
.world-preview.disco { background: linear-gradient(180deg, #ff6bd1 0%, #ff6bd1 40%, #4a3060 40%, #2a1040 100%); }

/* ====== 职业选择 ====== */
.weapon-grid {
  display: flex;
  gap: 16px;
  margin-bottom: 20px;
}
.weapon-card {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  cursor: pointer;
  padding: 14px 10px;
  border: 3px solid #2a2a2a;
  border-radius: 14px;
  box-shadow: 3px 3px 0 #2a2a2a;
  background: #fff;
  transition: transform 0.15s, box-shadow 0.15s;
  width: 105px;
}
.weapon-card:hover { transform: translateY(-2px); box-shadow: 4px 5px 0 #2a2a2a; }
.weapon-card.selected { background: #fff7a8; transform: translateY(-3px); box-shadow: 4px 6px 0 #2a2a2a; }
.weapon-icon { font-size: 36px; line-height: 1; }
.weapon-name { font-size: 14px; font-weight: bold; }
.weapon-desc { font-size: 11px; color: #555; text-align: center; line-height: 1.5; }
.ult-tag {
  color: #ff9800;
  font-weight: bold;
  font-size: 10px;
}
