/* 无名冒险 v0.2 样式 */
:root {
  --paper: #eee9df; --ink: #171714; --muted: #5f5c55;
  --line: #aaa397; --seal: #a62e24; --card: #fffdf8;
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
body {
  background: var(--paper); color: var(--ink);
  font-family: "Noto Serif SC", "Songti SC", serif;
  min-height: 100vh; display: flex; justify-content: center;
  padding: 12px; touch-action: manipulation;
}
#app { width: 100%; max-width: 980px; }
.screen { display: none; }
.screen.active { display: block; }
h1 { font-size: 1.8rem; margin-bottom: .5rem; }
h1 small { font-size: .9rem; color: var(--muted); font-weight: normal; }
h2 { font-size: 1.4rem; margin: 1rem 0 .6rem; }
h3 { font-size: 1.1rem; margin: 1.2rem 0 .5rem; color: var(--seal); }
h4 { font-size: 1rem; margin: .8rem 0 .3rem; }
.muted { color: var(--muted); font-size: .9rem; }
.small { font-size: .8rem; }
button {
  background: var(--seal); color: #fff; border: none;
  padding: .5rem 1rem; border-radius: 4px; cursor: pointer; font-size: .9rem;
}
button:hover { opacity: .85; }
button.danger { background: #888; }
input {
  padding: .6rem; font-size: 1rem; border: 1px solid var(--line);
  border-radius: 4px; width: 100%; max-width: 320px; margin: 1rem 0;
  background: var(--card);
}
/* 创建 */
.class-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin-top: 1rem; }
.class-card {
  background: var(--card); border: 1px solid var(--line); border-radius: 8px;
  padding: 1rem; cursor: pointer;
}
.class-card:hover { border-color: var(--seal); }
.class-card h3 { margin: 0 0 .4rem; }
.mini-stats { font-size: .85rem; margin: .5rem 0; color: var(--muted); }
.skills-prev { font-size: .85rem; color: var(--seal); }
/* HUD */
#hud {
  display: flex; justify-content: space-between; align-items: flex-start;
  background: var(--card); border: 1px solid var(--line); border-radius: 8px;
  padding: .7rem 1rem; margin-bottom: 10px;
}
#hud small { color: var(--muted); }
.canvas-wrap { display: flex; justify-content: center; }
#map-canvas, #battle-canvas { border: 1px solid var(--line); border-radius: 8px; background: #222; max-width: 100%; }
/* 战斗血条 */
.battle-hpbar {
  position: relative; height: 22px; background: #333; border-radius: 6px;
  margin: 8px 0; overflow: hidden;
}
#battle-hp-p { height: 100%; background: #4caf50; width: 100%; transition: width .2s; }
#battle-hp-p-text {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: .8rem;
}
/* 动作条（香草味：深色底 + 金色描边） */
#skill-bar {
  display: flex; gap: 4px; justify-content: center; margin: 12px 0;
  flex-wrap: nowrap;
}
.abtn {
  position: relative; width: 52px; height: 64px; cursor: pointer; user-select: none;
  flex-shrink: 0;
}
.abtn-icon {
  width: 44px; height: 44px; margin: 0 auto;
  border: 2px solid #ffd54a; border-radius: 4px;
  background: #1a1a1a; color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem; font-weight: bold; position: relative; z-index: 1;
}
.abtn.empty .abtn-icon { border-color: #444; }
.abtn-cd {
  position: absolute; top: 0; left: 4px; width: 44px; height: 44px;
  border-radius: 4px; z-index: 2; pointer-events: none;
}
.abtn-cdnum {
  position: absolute; top: 0; left: 4px; width: 44px; height: 44px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 1.1rem; font-weight: bold; z-index: 3;
  pointer-events: none; text-shadow: 0 0 4px #000;
}
.abtn-icon.oom { filter: sepia(1) hue-rotate(180deg) saturate(2); }
.abtn.ready .abtn-icon { box-shadow: 0 0 8px rgba(255,213,74,.8); }
.abtn-key {
  text-align: center; font-size: .65rem; color: #ffd54a; margin-top: 1px;
  font-family: ui-monospace, monospace;
}
/* 技能书 */
#spellbook {
  display: none; position: fixed; inset: 0; z-index: 50;
  background: rgba(0,0,0,.6); align-items: center; justify-content: center;
}
#spellbook.show { display: flex; }
#spellbook-inner {
  background: var(--bg); border: 2px solid #ffd54a; border-radius: 8px;
  max-width: 560px; width: 92vw; max-height: 84vh; overflow-y: auto; padding: 16px;
}
#spellbook-list { display: flex; flex-direction: column; gap: 6px; margin: 8px 0; }
.sb-item {
  display: flex; gap: 10px; align-items: center; padding: 6px;
  border: 1px solid var(--line); border-radius: 4px; cursor: grab;
  background: #1a1a1a;
}
.sb-item.pick { border-color: #ffd54a; box-shadow: 0 0 8px rgba(255,213,74,.5); }
.sb-icon {
  width: 40px; height: 40px; flex-shrink: 0; border: 2px solid #fff; border-radius: 4px;
  background: #2b2f3a; color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem; font-weight: bold;
}
.sb-info b { display: block; }
.sb-info small { display: block; }
#spellbook-bar { display: flex; gap: 4px; flex-wrap: wrap; margin: 8px 0; }
.sb-slot {
  position: relative; width: 48px; height: 60px; cursor: pointer;
}
.sb-slot-icon {
  width: 40px; height: 40px; margin: 0 auto; border: 2px dashed #555; border-radius: 4px;
  background: #1a1a1a; color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 1rem; font-weight: bold;
}
.sb-slot-key { text-align: center; font-size: .6rem; color: #ffd54a; font-family: ui-monospace, monospace; }
.sb-slot-x {
  position: absolute; top: -4px; right: 0; width: 16px; height: 16px;
  background: #a62e24; color: #fff; border-radius: 50%; font-size: 12px;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
}
@media (max-width: 768px) {
  .abtn { width: 44px; height: 56px; }
  .abtn-icon, .abtn-cd, .abtn-cdnum { width: 36px; height: 36px; }
  .abtn-cd, .abtn-cdnum { left: 4px; }
  .abtn-icon { font-size: 1rem; }
}
/* 结算 */
#result-body p { margin: .5rem 0; }
#screen-result button, #screen-panel > button { margin-top: 1.5rem; }
/* 面板 */
.stat-row, .equip-row, .talent-row, .quest-row, .keybind-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: .4rem 0; border-bottom: 1px dashed var(--line); font-size: .95rem;
}
.equip-row, .talent-row { gap: .5rem; }
.equip-row small, .talent-row small { color: var(--muted); }
.talent-row.learned { color: var(--seal); }
.quest-row { display: block; }
.quest-row.cur { border-left: 3px solid var(--seal); padding-left: .6rem; }
.quest-row.done { opacity: .6; }
/* 虚拟摇杆 */
#joystick {
  position: fixed; left: 24px; bottom: 24px; width: 120px; height: 120px;
  border-radius: 50%; background: rgba(0,0,0,0.25);
  border: 2px solid rgba(255,255,255,0.4); z-index: 50;
  touch-action: none;
}
#joy-knob {
  position: absolute; left: 50%; top: 50%; width: 52px; height: 52px;
  margin: -26px 0 0 -26px; border-radius: 50%;
  background: rgba(255,255,255,0.55);
}
/* NPC 对话框 */
#dialog-box {
  display: none; position: fixed; inset: 0; z-index: 60;
  background: rgba(0,0,0,0.45); align-items: flex-end; justify-content: center;
}
#dialog-box.show { display: flex; }
#dialog-inner {
  background: var(--card); border-radius: 12px 12px 0 0; padding: 1.2rem 1.4rem;
  max-width: 640px; width: 100%; margin-bottom: 0;
}
#dialog-inner h3 { margin: 0 0 .5rem; }
#dialog-inner p { line-height: 1.8; margin-bottom: 1rem; }
#dialog-inner button { width: 100%; }
/* toast */
#toast {
  position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: #333; color: #fff; padding: .7rem 1.2rem; border-radius: 6px;
  opacity: 0; transition: all .3s; pointer-events: none; z-index: 70;
  max-width: 90vw; text-align: center;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
/* 手机适配 */
@media (max-width: 640px) {
  body { padding: 8px; }
  h1 { font-size: 1.4rem; }
  .skill-btn { width: 72px; height: 88px; }
  .skill-icon { width: 56px; height: 56px; font-size: 1.3rem; }
  .skill-cd { left: 8px; width: 56px; height: 56px; }
  #hud { flex-direction: column; gap: 8px; }
}
/* v0.3：面板分页 */
.tabs { display: flex; gap: 8px; margin: 12px 0; }
.tab { padding: 8px 28px; border: 1px solid var(--line); background: var(--bg);
  border-radius: 8px 8px 0 0; cursor: pointer; font-size: 1rem; color: var(--ink); }
.tab.active { background: var(--seal); color: #fff; border-color: var(--seal); font-weight: 700; }
/* v0.3：魔兽世界式天赋树 */
.talent-grid { display: flex; gap: 10px; justify-content: space-around; margin-top: 6px; }
.talent-col { flex: 1; max-width: 180px; display: flex; flex-direction: column; align-items: center; }
.talent-branch { font-size: .85rem; color: var(--muted); margin-bottom: 8px; letter-spacing: .1em; }
.talent-branch small { color: var(--seal); }
.talent-node { width: 52px; height: 52px; border: 2px solid #555; border-radius: 8px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: #222; color: #777; position: relative; }
.talent-node span { font-size: 1.25rem; line-height: 1; }
.talent-node i { font-style: normal; font-size: .6rem; margin-top: 2px; max-width: 48px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.talent-node.locked { opacity: .55; }
.talent-node.avail { cursor: pointer; color: #fff; background: #1c2a3a;
  box-shadow: 0 0 8px rgba(74,168,255,.5); }
.talent-node.learned { color: #ffd54a; border-color: #ffd54a !important;
  background: #3a2f10; box-shadow: 0 0 8px rgba(255,213,74,.55); }
.talent-link { width: 2px; height: 12px; background: #444; }
.talent-link.on { background: #ffd54a; }
