* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { width: 100%; height: 100%; overflow: hidden; background: #0b0e1a; font-family: "PingFang SC", "Microsoft YaHei", sans-serif; color: #fff; user-select: none; }
#game-root { position: relative; width: 100vw; height: 100vh; }
canvas#scene { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.hidden { display: none !important; }

/* 顶部 */
#topbar { position: absolute; top: 14px; left: 50%; transform: translateX(-50%); text-align: center; text-shadow: 0 2px 6px #000; pointer-events: none; }
#region-name { font-size: 22px; font-weight: 700; letter-spacing: 2px; }
#clock { font-size: 13px; opacity: .8; }

/* 活力 */
#vitals { position: absolute; left: 18px; bottom: 18px; width: 240px; }
.bar { position: relative; height: 18px; background: rgba(0,0,0,.45); border: 1px solid rgba(255,255,255,.25); border-radius: 9px; overflow: hidden; margin-bottom: 8px; }
.bar span { position: absolute; left: 0; top: 0; bottom: 0; display: block; transition: width .15s; }
.bar label { position: absolute; left: 8px; top: 0; line-height: 18px; font-size: 11px; text-shadow: 0 1px 2px #000; }
.bar.hp span { background: linear-gradient(90deg,#ff5b6e,#ff9a3c); width: 100%; }
.bar.energy span { background: linear-gradient(90deg,#48d1ff,#9b6bff); width: 0%; }
#char-tag { font-size: 12px; opacity: .85; margin-top: 2px; }

/* 技能栏 */
#skillbar { position: absolute; right: 18px; bottom: 18px; display: flex; gap: 10px; }
.skill { position: relative; width: 58px; height: 58px; padding: 6px 4px; background: rgba(10,14,30,.6); border: 1px solid rgba(255,255,255,.25); border-radius: 12px; text-align: center; overflow: hidden; }
.skill b { display: block; font-size: 18px; margin-top: 8px; }
.skill i { display: block; font-size: 12px; line-height: 1.5; opacity: .9; font-style: normal; }
.skill .cd { position: absolute; inset: 0; background: rgba(0,0,0,.6); transform-origin: bottom; transform: scaleY(0); transition: transform .1s; }
.skill.ready { box-shadow: 0 2px 10px rgba(5,3,20,.6); border-color: #9b6bff; }
/* 滚轮缩放提示：只作提示，不参与冷却表现 */
#sk-zoom b { font-size: 13px; margin-top: 12px; letter-spacing: .5px; }
#sk-zoom { cursor: default; }

/* 小地图 */
#minimap { position: absolute; right: 18px; top: 18px; border-radius: 12px; border: 2px solid rgba(255,255,255,.3); background: rgba(0,0,0,.4); }

/* 任务 */
#quest-track { position: absolute; left: 18px; top: 18px; background: rgba(10,14,30,.5); border: 1px solid rgba(255,255,255,.2); border-radius: 10px; padding: 8px 12px; font-size: 13px; }
.qt-title { font-weight: 700; margin-bottom: 4px; color: #ffd56b; }

/* 提示 */
#hint { position: absolute; left: 50%; bottom: 110px; transform: translateX(-50%); background: rgba(0,0,0,.6); padding: 8px 16px; border-radius: 20px; font-size: 14px; }

/* 对话 */
#dialogue { position: absolute; left: 50%; bottom: 30px; transform: translateX(-50%); width: min(720px, 86%); background: rgba(12,16,34,.92); border: 1px solid rgba(255,255,255,.25); border-radius: 16px; display: flex; padding: 14px; gap: 14px; box-shadow: 0 8px 30px rgba(0,0,0,.5); }
#dlg-portrait { width: 96px; height: 128px; object-fit: cover; border-radius: 12px; background: #1a2138; border: 1px solid rgba(255,255,255,.2); }
#dlg-body { flex: 1; }
#dlg-name { font-weight: 700; color: #ffd56b; margin-bottom: 6px; }
#dlg-text { font-size: 14px; line-height: 1.6; min-height: 64px; }
#dlg-next { text-align: right; font-size: 12px; opacity: .7; }

/* 菜单/弹窗 */
#menu, #pause, #help, #map-screen { position: absolute; inset: 0; background: radial-gradient(circle at 50% 30%, #1b2350, #070a16); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; z-index: 20; }
#menu h1 { font-size: 56px; letter-spacing: 8px; color: #ffd56b; }
.sub { opacity: .8; letter-spacing: 4px; }
.menu-btns { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }
button { cursor: pointer; font-family: inherit; font-size: 16px; padding: 10px 34px; border-radius: 24px; border: 1px solid rgba(255,255,255,.3); background: rgba(255,255,255,.08); color: #fff; transition: .15s; }
button:hover { background: rgba(155,107,255,.35); border-color: #9b6bff; }
.tip { opacity: .55; font-size: 12px; margin-top: 16px; }
#help, #map-screen { gap: 18px; }
#help ul { line-height: 2; font-size: 15px; }
#anchor-list { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; max-width: 640px; }
.anchor-card { width: 140px; padding: 12px; border-radius: 12px; background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.2); text-align: center; cursor: pointer; }
.anchor-card.locked { opacity: .4; cursor: not-allowed; }
.anchor-card:hover:not(.locked) { border-color: #9b6bff; }

/* 加载 */
#loading { position: absolute; inset: 0; background: #070a16; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; z-index: 30; }
.spin { width: 44px; height: 44px; border: 4px solid rgba(255,255,255,.2); border-top-color: #9b6bff; border-radius: 50%; animation: sp 1s linear infinite; }
@keyframes sp { to { transform: rotate(360deg); } }

/* 伤害飘字 */
.dmg-float {
  position: absolute; transform: translate(-50%, -50%);
  font-size: 20px; font-weight: 800; color: #ffd56b;
  text-shadow: 0 2px 5px rgba(0,0,0,.9);
  pointer-events: none; z-index: 12;
  animation: dmgUp .8s ease-out forwards;
}
@keyframes dmgUp {
  0%   { opacity: 0; transform: translate(-50%, -40%) scale(.6); }
  18%  { opacity: 1; transform: translate(-50%, -70%) scale(1.18); }
  100% { opacity: 0; transform: translate(-50%, -190%) scale(1); }
}

/* 屏幕暗角（增强电影感） */
#vignette-overlay {
  position: absolute; inset: 0; pointer-events: none; z-index: 5;
  background: radial-gradient(ellipse at center, rgba(0,0,0,0) 45%, rgba(0,0,0,.35) 100%);
}

/* 血条/能量条光泽 */
.bar span::after {
  content: ''; position: absolute; left: 0; right: 0; top: 0; height: 45%;
  background: linear-gradient(180deg, rgba(255,255,255,.35), rgba(255,255,255,0));
}

/* 技能就绪脉冲 */
.skill.ready { animation: skillPulse 1.6s ease-in-out infinite; }
@keyframes skillPulse {
  0%,100% { box-shadow: 0 2px 8px rgba(5,3,20,.5); }
  50%     { box-shadow: 0 2px 14px rgba(5,3,20,.8); }
}
