* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  background: #0b0d12;
  color: #e6e6e6;
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  overflow: hidden;
  height: 100%;
}

#game-wrap {
  position: relative;
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #08090d;
}

canvas#game {
  background: #12141c;
  display: block;
  box-shadow: 0 0 60px rgba(0,0,0,0.8);
  image-rendering: pixelated;
  max-width: 100vw;
  max-height: 100vh;
}

/* ---------- HUD ---------- */
#hud {
  position: absolute;
  inset: 0;
  pointer-events: none;
  font-size: 14px;
}

#objective-box {
  position: absolute;
  top: 16px;
  left: 16px;
  background: rgba(10,12,18,0.82);
  border: 1px solid rgba(120,140,180,0.3);
  border-left: 3px solid #7fa8ff;
  padding: 10px 14px;
  border-radius: 6px;
  min-width: 250px;
  max-width: 300px;
}

#quest-title {
  font-weight: 700;
  color: #cfe0ff;
  margin-bottom: 6px;
  font-size: 13px;
}

#objective-list {
  line-height: 1.6;
}
#objective-list .obj {
  list-style: none;
  display: flex;
  gap: 6px;
  color: #9fb0c8;
  font-size: 12px;
}
#objective-list .obj.done { color: #6fcf6f; text-decoration: line-through; }
#objective-list .obj.cur { color: #fff; }
#objective-list .obj .mark { color: inherit; }

#world-indicator {
  position: absolute;
  top: 16px;
  right: 16px;
  background: rgba(10,12,18,0.82);
  border: 1px solid rgba(120,140,180,0.3);
  padding: 8px 14px;
  border-radius: 6px;
  color: #cfe0ff;
}
#world-indicator.worldB { border-color: rgba(0,180,255,0.5); color: #7fe0ff; }
#world-indicator.worldA { border-color: rgba(255,180,90,0.4); color: #ffd9a0; }

#actor-indicator {
  position: absolute;
  top: 58px;
  right: 16px;
  background: rgba(10,12,18,0.82);
  border: 1px solid rgba(120,140,180,0.3);
  padding: 6px 12px;
  border-radius: 6px;
  color: #dfe;
  font-size: 13px;
}

.bar-label { font-size: 11px; color: #8aa0bb; margin-bottom: 3px; }
.bar-label.small { margin-top: 8px; }

.bar-track {
  width: 170px;
  height: 10px;
  background: rgba(0,0,0,0.55);
  border-radius: 5px;
  border: 1px solid rgba(255,255,255,0.15);
  overflow: hidden;
  position: relative;
}
.bar-track.blue { border-color: rgba(90,160,255,0.4); }
.bar-track.green { border-color: rgba(120,220,120,0.4); }
.bar-track .fill-off {
  position: absolute; top:0; bottom:0; right:0; width:0;
  background: rgba(0,0,0,0.4);
}

#visibility-bar, #interference-bar, #b-hud {
  position: absolute;
  left: 16px;
  color: #9fb0c8;
}
#visibility-bar { bottom: 120px; left: 16px; }
#interference-bar { bottom: 84px; left: 16px; }
#b-hud { bottom: 16px; left: 16px; }

#visibility-num, #interference-num, #hp-num {
  position: absolute;
  right: -34px;
  top: 14px;
  font-size: 12px;
  color: #dfe;
}

#visibility-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #ffffff, #9fb8d8, #4e8bff, #c44bff);
  transition: width 0.2s, background 0.4s;
}
#visibility-fill.hot { background: linear-gradient(90deg,#ff7b7b,#ff4b4b,#c410e0); }
#interference-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg,#4bd0ff,#7fb8ff);
  transition: width 0.15s;
}
#hp-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg,#3fbf6f,#8ae08a);
  transition: width 0.2s;
}
#stealth-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg,#8f6bff,#d0b0ff);
}

#controls-help {
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(10,12,18,0.72);
  border-radius: 20px;
  padding: 5px 14px;
  font-size: 11px;
  color: #9db2cc;
  white-space: nowrap;
}
#controls-help .hl {
  color: #7fd6ff;
  font-weight: 600;
}

#prompt {
  position: absolute;
  bottom: 46px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.75);
  border: 1px solid rgba(255,255,255,0.3);
  padding: 6px 14px;
  border-radius: 14px;
  color: #fff;
  font-size: 13px;
  pointer-events: none;
}

/* ---------- Dialogue ---------- */
#dialogue {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 200px;
  background: linear-gradient(transparent, rgba(5,7,10,0.95) 30%);
  pointer-events: none;
  display: flex;
  align-items: flex-end;
  padding: 0 26px 30px;
}
#dialogue-body {
  background: rgba(14,17,24,0.96);
  border: 1px solid rgba(140,170,220,0.35);
  border-left: 4px solid #7fa8ff;
  border-radius: 8px;
  padding: 14px 18px 10px;
  width: 100%;
  min-height: 120px;
  pointer-events: auto;
}
#dialogue-speaker {
  color: #9fdcff;
  font-weight: 700;
  margin-bottom: 6px;
}
#dialogue-speaker.b { color: #ffc77f; }
#dialogue-text {
  font-size: 15px;
  line-height: 1.6;
  color: #eef2fa;
  margin-bottom: 6px;
}
#dialogue-choices { margin-top: 4px; }
#dialogue-choices .choice {
  display: inline-block;
  margin: 4px 8px 0 0;
  padding: 5px 12px;
  background: rgba(120,150,220,0.15);
  border: 1px solid rgba(150,180,240,0.4);
  border-radius: 16px;
  cursor: pointer;
  font-size: 13px;
}
#dialogue-choices .choice:hover { background: rgba(120,150,220,0.35); }
#dialogue-skip {
  text-align: right;
  font-size: 11px;
  color: #6f85a0;
}

/* ---------- 情报墙 ---------- */
#info-wall {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.72);
  display: flex;
  align-items: center;
  justify-content: center;
}
#info-wall-inner {
  width: 520px;
  max-height: 80vh;
  overflow: auto;
  background: #131722;
  border: 1px solid rgba(140,170,220,0.4);
  border-radius: 12px;
  padding: 24px;
}
#info-wall h2 { color: #cfe0ff; margin-bottom: 14px; }
.clue {
  background: rgba(255,255,255,0.05);
  border-left: 3px solid #7fa8ff;
  padding: 10px 12px;
  margin-bottom: 10px;
  border-radius: 4px;
}
.clue h4 { color: #ffd9a0; font-size: 13px; margin-bottom: 4px; }
.clue p { color: #c5d3e8; font-size: 12.5px; line-height: 1.5; }
#info-close {
  margin-top: 14px;
  padding: 8px 18px;
  background: #2a3550;
  border: 1px solid #5a7290;
  color: #eef2fa;
  border-radius: 6px;
  cursor: pointer;
}

/* ---------- 浮层 ---------- */
#overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.78);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 30;
}
#overlay-title { font-size: 28px; font-weight: 800; margin-bottom: 14px; color: #fff; }
#overlay-title.fail { color: #ff6b6b; }
#overlay-title.win { color: #7dffb0; }
#overlay-text { color: #cfd8ea; font-size: 15px; margin-bottom: 20px; text-align:center; max-width: 520px; line-height: 1.7; }
#overlay-btn {
  padding: 10px 28px;
  background: #2a6cff;
  border: none;
  color: #fff;
  border-radius: 8px;
  cursor: pointer;
  font-size: 15px;
}

/* ---------- 标题 ---------- */
#title-screen {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 30%, #1a2340, #070a12 70%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 20;
}
#title-screen h1 {
  font-size: 72px;
  letter-spacing: 24px;
  color: #fff;
  text-shadow: 0 0 40px #4b8bff;
  margin-left: 24px;
}
#title-screen p { color: #9fb0c8; margin: 4px 0 26px; font-size: 15px; }
.title-controls {
  background: rgba(0,0,0,0.5);
  border: 1px solid rgba(140,170,220,0.3);
  border-radius: 10px;
  padding: 18px 26px;
  columns: 2;
  column-gap: 40px;
  margin-bottom: 26px;
}
.title-controls div { color: #c5d3e8; font-size: 14px; line-height: 1.9; }
.title-controls b { color: #7fa8ff; }
#start-btn {
  padding: 12px 46px;
  font-size: 18px;
  background: #2a6cff;
  border: none;
  color: #fff;
  border-radius: 30px;
  cursor: pointer;
  box-shadow: 0 6px 30px rgba(42,108,255,0.5);
}
#start-btn:hover { background: #3a7cff; }

#fail-toast {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(220,40,60,0.9);
  color: #fff;
  padding: 10px 20px;
  border-radius: 22px;
  opacity: 0;
  transition: opacity 0.3s;
  z-index: 40;
}
#fail-toast.show { opacity: 1; }
