* {
  box-sizing: border-box;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #141219;
  font-family: "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", sans-serif;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* 9:16 竖屏漫画相框主容器 */
#app-shell {
  position: relative;
  width: 100%;
  height: 100%;
  max-width: min(100vw, 56.25vh);
  max-height: 100vh;
  aspect-ratio: 9 / 16;
  background: #231f29;
  border: 4px solid #141218;
  border-radius: 20px;
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.8), 0 0 0 3px #ffd43b;
  overflow: hidden;
}

@media (max-width: 540px) {
  #app-shell {
    max-width: 100vw;
    max-height: 100vh;
    border-radius: 0;
    border-width: 0;
    box-shadow: none;
  }
}

#game-canvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* 复古美漫印刷网点遮罩 */
#halftone-overlay {
  display: none;
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 5;
  background-image: radial-gradient(rgba(20, 18, 24, 0.13) 1.1px, transparent 1.15px);
  background-size: 7px 7px;
  mix-blend-mode: multiply;
}

/* 技能冲刺速度线 */
#speed-lines {
  position: absolute;
  inset: -12%;
  pointer-events: none;
  z-index: 6;
  opacity: 0;
  transition: opacity 0.2s ease;
  background: repeating-conic-gradient(
    from 0deg at 50% 50%,
    rgba(255, 255, 255, 0) 0deg 4deg,
    rgba(255, 248, 220, 0.44) 4.4deg 5.2deg,
    rgba(255, 255, 255, 0) 5.6deg 10deg
  );
  -webkit-mask-image: radial-gradient(circle at 50% 50%, transparent 34%, black 72%);
  mask-image: radial-gradient(circle at 50% 50%, transparent 34%, black 72%);
}

#speed-lines.active {
  opacity: 1;
  animation: spinLines 0.26s linear infinite;
}

@keyframes spinLines {
  0% { transform: rotate(0deg) scale(1); }
  50% { transform: rotate(6deg) scale(1.04); }
  100% { transform: rotate(12deg) scale(1); }
}

/* 受击警报红框 */
#danger-vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 7;
  opacity: 0;
  box-shadow: inset 0 0 48px 15px rgba(224, 49, 49, 0.78);
  transition: opacity 0.22s ease;
}

#danger-vignette.active {
  opacity: 1;
  animation: pulseDanger 0.65s ease-in-out infinite alternate;
}

@keyframes pulseDanger {
  from { opacity: 0.4; }
  to { opacity: 1; }
}

/* 轻量 Toast 提示（替代 alert） */
#toast-msg {
  position: absolute;
  top: 58px;
  left: 50%;
  transform: translateX(-50%) translateY(-10px);
  z-index: 60;
  background: #1a1a1a;
  color: #ffd43b;
  border: 3px solid #ffd43b;
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 900;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  white-space: nowrap;
}

#toast-msg.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* 通用美漫风硬边卡片与按钮 */
.comic-card {
  background: #fff9db;
  border: 3.5px solid #1a1a1a;
  border-radius: 16px;
  box-shadow: 4px 4px 0 #1a1a1a;
  color: #1a1a1a;
}

.comic-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  font-weight: 900;
  border: 3.5px solid #1a1a1a;
  border-radius: 14px;
  box-shadow: 4px 4px 0 #1a1a1a;
  cursor: pointer;
  transition: transform 0.08s ease, box-shadow 0.08s ease;
  color: #1a1a1a;
  letter-spacing: 0.4px;
}

.comic-btn:active {
  transform: translate(2px, 2px);
  box-shadow: 2px 2px 0 #1a1a1a;
}

.btn-orange { background: linear-gradient(180deg, #ffa94d 0%, #f76707 100%); color: #fff; text-shadow: 1.5px 1.5px 0 #1a1a1a; }
.btn-purple { background: linear-gradient(180deg, #b197fc 0%, #7048e8 100%); color: #fff; text-shadow: 1.5px 1.5px 0 #1a1a1a; }
.btn-primary { background: linear-gradient(180deg, #74c0fc 0%, #228be6 100%); color: #fff; text-shadow: 1.5px 1.5px 0 #1a1a1a; }
.btn-green { background: linear-gradient(180deg, #69db7c 0%, #2f9e44 100%); color: #fff; text-shadow: 1.5px 1.5px 0 #1a1a1a; }
.btn-cream { background: #fff9db; color: #1a1a1a; }
.btn-danger { background: linear-gradient(180deg, #ff8787 0%, #e03131 100%); color: #fff; text-shadow: 1.5px 1.5px 0 #1a1a1a; }

/* ======================== 1. 主菜单 Main Menu ======================== */
#main-menu-ui {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: none;
  flex-direction: column;
  justify-content: space-between;
  padding: 12px 12px 14px;
  pointer-events: none;
}

#main-menu-ui.show { display: flex; }

.menu-top-bar {
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.stat-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #fff9db;
  border: 3px solid #1a1a1a;
  border-radius: 999px;
  box-shadow: 3px 3px 0 #1a1a1a;
  padding: 4px 9px;
  font-size: 12px;
  font-weight: 900;
  color: #1a1a1a;
}

.title-banner {
  margin-top: 4px;
  text-align: center;
  pointer-events: none;
}

.title-sub-tag {
  display: inline-block;
  background: #1a1a1a;
  color: #ffd43b;
  font-size: 10px;
  font-weight: 900;
  padding: 2px 10px;
  border-radius: 999px;
  letter-spacing: 1px;
  margin-bottom: 3px;
}

.title-main {
  display: inline-block;
  background: linear-gradient(180deg, #ffe066 0%, #fcc419 100%);
  border: 4px solid #1a1a1a;
  border-radius: 18px;
  box-shadow: 5px 5px 0 #1a1a1a;
  padding: 5px 18px;
  font-size: 26px;
  font-weight: 900;
  color: #e03131;
  text-shadow: 2px 2px 0 #1a1a1a, -1px -1px 0 #fff;
  transform: rotate(-1.5deg);
  line-height: 1.15;
}

.menu-top-section {
  position: relative;
}

.endless-record-badge {
  position: absolute;
  top: 44px;
  left: 0;
  width: clamp(74px, 21.5%, 94px);
  pointer-events: none;
  z-index: 4;
  background: linear-gradient(180deg, #ffe066 0%, #fcc419 58%, #f59f00 100%);
  border: 3.5px solid #1a1a1a;
  border-radius: 14px;
  box-shadow: 4px 4px 0 #1a1a1a, inset 0 2px 0 rgba(255, 255, 255, 0.7);
  padding: 4px 4px 5px;
  text-align: center;
  transform: rotate(-2.5deg);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.endless-record-tag {
  width: 100%;
  background: #1a1a1a;
  color: #ffd43b;
  font-size: 10px;
  font-weight: 900;
  line-height: 1.25;
  padding: 2px 3px;
  border-radius: 7px;
  letter-spacing: 0.5px;
  text-shadow: 1px 1px 0 #000;
  white-space: nowrap;
}

.endless-record-score {
  font-size: clamp(14px, 3.9vw, 18px);
  font-weight: 900;
  color: #e03131;
  line-height: 1.1;
  margin-top: 1px;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow:
    1px 1px 0 #1a1a1a,
    2px 2px 0 #1a1a1a,
    3px 3px 0 #1a1a1a,
    -1px -1px 0 #fff9db,
    1px -1px 0 #1a1a1a,
    -1px 1px 0 #1a1a1a;
}

.endless-record-unit {
  font-size: 10px;
  margin-left: 1px;
}

.endless-record-dist {
  display: inline-block;
  max-width: 100%;
  background: linear-gradient(180deg, #b197fc 0%, #7048e8 100%);
  border: 2px solid #1a1a1a;
  border-radius: 999px;
  box-shadow: 2px 2px 0 #1a1a1a;
  padding: 1px 7px;
  font-size: 10px;
  font-weight: 900;
  color: #fff9db;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow:
    1px 1px 0 #1a1a1a,
    2px 2px 0 #1a1a1a;
}

.menu-bottom {
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.selected-char-strip {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 249, 219, 0.96);
  border: 3px solid #1a1a1a;
  border-radius: 14px;
  box-shadow: 4px 4px 0 #1a1a1a;
  padding: 6px 10px;
}

.strip-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 3px solid #1a1a1a;
  background: #fff;
  object-fit: cover;
  flex-shrink: 0;
}

.strip-info {
  flex: 1;
  min-width: 0;
}

.strip-name {
  font-size: 13.5px;
  font-weight: 900;
  color: #1a1a1a;
}

.strip-skill {
  font-size: 11px;
  font-weight: 800;
  color: #d9480f;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 今日拦路BOSS预览条 */
.npc-preview-strip {
  background: rgba(35, 32, 42, 0.94);
  border: 3px solid #1a1a1a;
  border-radius: 14px;
  box-shadow: 4px 4px 0 #1a1a1a;
  padding: 7px 8px 8px;
}

.npc-preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
  font-size: 11px;
  font-weight: 900;
  color: #ffd43b;
}

.npc-preview-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.npc-mini-card {
  display: flex;
  align-items: center;
  gap: 5px;
  background: #fff9db;
  border: 2.5px solid #1a1a1a;
  border-radius: 10px;
  padding: 4px 5px;
  cursor: pointer;
}

.npc-mini-card:active { transform: scale(0.96); }

.npc-mini-card img {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 2px solid #1a1a1a;
  object-fit: cover;
  background: #fff;
  flex-shrink: 0;
}

.npc-mini-name {
  font-size: 11px;
  font-weight: 900;
  color: #1a1a1a;
  line-height: 1.1;
}

.npc-mini-title {
  font-size: 9px;
  font-weight: 800;
  color: #e03131;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.menu-cta-row {
  display: grid;
  grid-template-columns: 1.25fr 1fr;
  gap: 8px;
}

.menu-cta-row .comic-btn {
  padding: 11px 8px;
  font-size: 15px;
}

.menu-sub-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 7px;
}

.menu-sub-row .comic-btn {
  padding: 9px 4px;
  font-size: 12px;
}

/* 通用二级页面顶栏 */
.screen-top-bar {
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.back-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #ffd43b;
  font-size: 20px;
  line-height: 1;
  flex-shrink: 0;
}

.skew-banner {
  background: #ffd43b;
  border: 3.5px solid #1a1a1a;
  border-radius: 12px;
  box-shadow: 4px 4px 0 #1a1a1a;
  padding: 5px 12px;
  font-size: 14px;
  font-weight: 900;
  color: #1a1a1a;
  transform: skewX(-6deg);
}

.import-mini-btn {
  padding: 5px 9px;
  font-size: 11px;
  border-radius: 10px;
  background: #fff9db;
  white-space: nowrap;
}

/* 欧美3D立体漫画文字特效 */
.comic-3d-text {
  font-family: "Impact", "Arial Black", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-weight: 900;
  letter-spacing: 0.8px;
  color: #ffffff;
  -webkit-text-stroke: 1.5px #1a1a1a;
  text-shadow:
    0 1px 0 #c92a2a,
    0 2px 0 #a61e4d,
    0 3px 0 #1a1a1a,
    2px 4px 0 #1a1a1a,
    -1px -1px 0 #1a1a1a;
}

.hud-score-banner {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  background: linear-gradient(180deg, #ff922b 0%, #e8590c 100%);
  border: 3px solid #1a1a1a;
  border-radius: 12px;
  box-shadow: 3px 3px 0 #1a1a1a;
  padding: 2px 10px 3px;
  transform: rotate(-1.5deg);
  transition: transform 0.1s ease;
}

.hud-score-banner.bump {
  transform: rotate(-1.5deg) scale(1.14);
}

.hud-score-label {
  font-size: 11px;
  font-weight: 900;
  color: #fff9db;
  text-shadow: 1.5px 1.5px 0 #1a1a1a;
}

.hud-score-val {
  font-size: 20px;
  line-height: 1.05;
}

/* ======================== 2. 角色选择 Character Select ======================== */
#char-select-ui {
  position: absolute;
  inset: 0;
  z-index: 32;
  display: none;
  flex-direction: column;
  justify-content: space-between;
  padding: 12px 12px 14px;
  pointer-events: none;
}

#char-select-ui.show { display: flex; }

.char-bottom-panel {
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.char-tabs {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
}

.char-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  background: #fff9db;
  border: 3px solid #1a1a1a;
  border-radius: 12px;
  box-shadow: 2px 2px 0 #1a1a1a;
  padding: 5px 2px;
  cursor: pointer;
  transition: transform 0.1s ease;
}

.char-tab.active {
  background: #ffd43b;
  transform: translateY(-4px);
  box-shadow: 3px 5px 0 #1a1a1a;
}

.char-tab img {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2.5px solid #1a1a1a;
  background: #fff;
  object-fit: cover;
}

.char-tab span {
  font-size: 11px;
  font-weight: 900;
  color: #1a1a1a;
}

.char-detail-card {
  background: rgba(255, 249, 219, 0.97);
  border: 3.5px solid #1a1a1a;
  border-radius: 16px;
  box-shadow: 5px 5px 0 #1a1a1a;
  padding: 10px 12px;
}

.char-detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 5px;
}

.char-detail-name {
  font-size: 18px;
  font-weight: 900;
  color: #1a1a1a;
}

.char-skill-badge {
  background: #ff6b6b;
  color: #fff;
  border: 2.5px solid #1a1a1a;
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 11.5px;
  font-weight: 900;
}

.char-detail-desc {
  font-size: 12px;
  font-weight: 800;
  color: #343a40;
  line-height: 1.45;
  margin-bottom: 8px;
}

/* ======================== 2B. NPC 图鉴页面 ======================== */
#npc-codex-ui {
  position: absolute;
  inset: 0;
  z-index: 34;
  display: none;
  flex-direction: column;
  justify-content: space-between;
  padding: 12px 12px 16px;
  pointer-events: none;
}

#npc-codex-ui.show { display: flex; }

.codex-bottom-panel {
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.codex-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.codex-tab {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: #fff9db;
  border: 3px solid #1a1a1a;
  border-radius: 12px;
  box-shadow: 2px 2px 0 #1a1a1a;
  padding: 8px 6px;
  font-size: 13px;
  font-weight: 900;
  color: #1a1a1a;
  cursor: pointer;
}

.codex-tab.active {
  background: #ff6b6b;
  color: #fff;
  transform: translateY(-4px);
  box-shadow: 3px 5px 0 #1a1a1a;
}

.codex-card {
  background: rgba(255, 249, 219, 0.97);
  border: 4px solid #1a1a1a;
  border-radius: 16px;
  box-shadow: 5px 5px 0 #1a1a1a;
  padding: 11px;
  display: flex;
  gap: 11px;
  align-items: flex-start;
}

.codex-portrait-wrap {
  width: 98px;
  height: 114px;
  border-radius: 12px;
  border: 3px solid #1a1a1a;
  box-shadow: 3px 3px 0 #1a1a1a;
  overflow: hidden;
  background: #fff;
  flex-shrink: 0;
}

.codex-portrait-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.codex-info {
  flex: 1;
  min-width: 0;
}

.codex-name-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  margin-bottom: 4px;
}

.codex-name {
  font-size: 16px;
  font-weight: 900;
  color: #1a1a1a;
}

.codex-danger {
  font-size: 10px;
  font-weight: 900;
  color: #e03131;
  background: #ffe3e3;
  border: 2px solid #1a1a1a;
  border-radius: 999px;
  padding: 1px 6px;
  white-space: nowrap;
}

.codex-bio {
  font-size: 12px;
  font-weight: 800;
  color: #2b2633;
  line-height: 1.48;
  margin-bottom: 6px;
}

.codex-quote {
  font-size: 11px;
  font-weight: 800;
  color: #e8590c;
  background: #fff;
  border: 2px dashed #1a1a1a;
  border-radius: 8px;
  padding: 4px 7px;
  line-height: 1.35;
}

/* ======================== 3. 36关路线图 Level Select ======================== */
#level-select-ui {
  position: absolute;
  inset: 0;
  z-index: 33;
  display: none;
  flex-direction: column;
  background: #f8f0dc;
  padding: 12px;
}

#level-select-ui.show { display: flex; }

.unlock-toggle-btn {
  font-size: 11px;
  padding: 5px 9px;
  border-radius: 999px;
}

.roadmap-scroll {
  flex: 1;
  overflow-y: auto;
  margin-top: 10px;
  padding-right: 4px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.chapter-block {
  background: #fff9db;
  border: 3.5px solid #1a1a1a;
  border-radius: 16px;
  box-shadow: 4px 4px 0 #1a1a1a;
  padding: 10px;
}

.chapter-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  padding-bottom: 5px;
  border-bottom: 2.5px dashed #1a1a1a;
}

.chapter-title {
  font-size: 14px;
  font-weight: 900;
  color: #1a1a1a;
}

.chapter-tag {
  font-size: 10.5px;
  font-weight: 900;
  background: #1a1a1a;
  color: #ffd43b;
  padding: 2px 8px;
  border-radius: 999px;
}

.level-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.level-row {
  display: flex;
  align-items: center;
  gap: 9px;
  background: #fff;
  border: 2.5px solid #1a1a1a;
  border-radius: 12px;
  padding: 7px 9px;
  cursor: pointer;
}

.level-row.locked {
  opacity: 0.52;
  background: #e9ecef;
  cursor: not-allowed;
}

.lvl-num-badge {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #ff922b;
  border: 2.5px solid #1a1a1a;
  color: #fff;
  font-weight: 900;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.lvl-meta {
  flex: 1;
  min-width: 0;
}

.lvl-name {
  font-size: 13px;
  font-weight: 900;
  color: #1a1a1a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lvl-sub {
  font-size: 10.5px;
  font-weight: 800;
  color: #868e96;
}

.lvl-stars {
  font-size: 13px;
  letter-spacing: 1px;
  color: #fcc419;
  text-shadow: 1px 1px 0 #1a1a1a;
}

/* ======================== 4. 开场漫画分镜 Cutscene ======================== */
#cutscene-ui {
  position: absolute;
  inset: 0;
  z-index: 25;
  display: none;
  flex-direction: column;
  justify-content: space-between;
  padding: 12px;
  pointer-events: none;
}

#cutscene-ui.show { display: flex; }

.cutscene-top {
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.time-chip {
  background: #ffd43b;
  border: 3px solid #1a1a1a;
  border-radius: 10px;
  box-shadow: 3px 3px 0 #1a1a1a;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 900;
  color: #1a1a1a;
}

.skip-btn {
  background: #fff9db;
  padding: 5px 11px;
  font-size: 12px;
  border-radius: 10px;
}

.cutscene-dialog-box {
  pointer-events: auto;
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  background: #fff9db;
  border: 4px solid #1a1a1a;
  border-radius: 18px;
  box-shadow: 5px 5px 0 #1a1a1a;
  padding: 16px 12px 12px;
  cursor: pointer;
}

.cutscene-avatar {
  width: 58px;
  height: 58px;
  border-radius: 12px;
  border: 3px solid #1a1a1a;
  background: #fff;
  object-fit: cover;
  flex-shrink: 0;
}

.cutscene-text-col {
  flex: 1;
  min-width: 0;
}

.speaker-pill {
  position: absolute;
  top: -15px;
  left: 14px;
  background: #f76707;
  color: #fff;
  border: 3px solid #1a1a1a;
  border-radius: 999px;
  padding: 2px 12px;
  font-size: 12.5px;
  font-weight: 900;
}

.speaker-pill.player {
  background: #2f9e44;
}

.dialog-text {
  font-size: 14px;
  font-weight: 900;
  color: #1a1a1a;
  line-height: 1.45;
  min-height: 40px;
}

.dialog-next-hint {
  text-align: right;
  font-size: 11px;
  font-weight: 900;
  color: #e03131;
  margin-top: 3px;
}

/* ======================== 5. 游戏内 HUD ======================== */
#hud {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: none;
  flex-direction: column;
  justify-content: space-between;
  padding: 10px 10px 14px;
  pointer-events: none;
}

#hud.show { display: flex; }

.hud-top {
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.hud-row-1 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.hud-badge {
  background: #ff6b6b;
  color: #fff;
  border: 3px solid #1a1a1a;
  border-radius: 11px;
  box-shadow: 3px 3px 0 #1a1a1a;
  padding: 4px 10px;
  font-size: 13px;
  font-weight: 900;
  text-shadow: 1px 1px 0 #1a1a1a;
}

.hp-box {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: #2b2633;
  border: 3px solid #1a1a1a;
  border-radius: 11px;
  box-shadow: 3px 3px 0 #1a1a1a;
  padding: 4px 8px;
  font-size: 13px;
}

.coin-box {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #fff9db;
  border: 3px solid #1a1a1a;
  border-radius: 11px;
  box-shadow: 3px 3px 0 #1a1a1a;
  padding: 4px 10px;
  font-size: 13px;
  font-weight: 900;
  color: #1a1a1a;
}

.pause-btn {
  background: #ffd43b;
  padding: 4px 10px;
  font-size: 12.5px;
  border-radius: 11px;
}

/* 追击与出口进度条 */
.progress-track-wrap {
  position: relative;
  height: 22px;
  background: #2b2633;
  border: 3px solid #1a1a1a;
  border-radius: 999px;
  box-shadow: 3px 3px 0 #1a1a1a;
  padding: 2px 4px;
  display: flex;
  align-items: center;
}

.progress-track-wrap.warn-flash {
  animation: trackFlash 0.32s ease-in-out 3;
}

@keyframes trackFlash {
  0%, 100% { border-color: #1a1a1a; }
  50% { border-color: #ff4d4f; box-shadow: 0 0 12px #ff4d4f; }
}

.progress-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, #ff922b 0%, #ffd43b 65%, #51cf66 100%);
  transition: width 0.1s linear;
}

.track-marker {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2.5px solid #1a1a1a;
  background: #fff;
  overflow: hidden;
  z-index: 3;
}

.track-marker img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.track-marker.boss {
  border-color: #e03131;
  z-index: 2;
}

.exit-flag {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  background: #40c057;
  color: #fff;
  border: 2px solid #1a1a1a;
  border-radius: 8px;
  font-size: 9.5px;
  font-weight: 900;
  padding: 1px 5px;
}

.hud-sub-stats {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 900;
  color: #fff9db;
  text-shadow: 1.5px 1.5px 0 #1a1a1a;
  padding: 0 2px;
}

#zone-banner {
  align-self: center;
  background: #1a1a1a;
  color: #ffd43b;
  border: 3px solid #ffd43b;
  border-radius: 999px;
  padding: 5px 16px;
  font-size: 13px;
  font-weight: 900;
  opacity: 0;
  transform: translateY(-10px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

#zone-banner.show {
  opacity: 1;
  transform: translateY(0);
}

/* 底部技能能量槽（无任何左右跳滑虚拟按键） */
.hud-bottom {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

.energy-wrap {
  flex: 1;
  background: #fff9db;
  border: 3.5px solid #1a1a1a;
  border-radius: 14px;
  box-shadow: 4px 4px 0 #1a1a1a;
  padding: 6px 10px;
}

.energy-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 900;
  color: #1a1a1a;
  margin-bottom: 4px;
}

.energy-bar-bg {
  height: 12px;
  background: #dee2e6;
  border: 2.5px solid #1a1a1a;
  border-radius: 999px;
  overflow: hidden;
}

.energy-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #ff922b 0%, #f03e3e 100%);
  transition: width 0.12s ease;
}

.skill-trigger-btn {
  width: 74px;
  height: 74px;
  border-radius: 50%;
  background: #adb5bd;
  color: #fff;
  font-size: 13px;
  line-height: 1.15;
  text-align: center;
  padding: 4px;
  flex-shrink: 0;
}

.skill-trigger-btn.ready {
  background: radial-gradient(circle at 30% 30%, #ffe066, #f76707 70%, #e03131 100%);
  animation: pulseSkill 0.65s ease-in-out infinite alternate;
}

@keyframes pulseSkill {
  from { transform: scale(1); }
  to { transform: scale(1.08); }
}

/* 漫画飘字层 */
#comic-popups {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 22;
  overflow: hidden;
}

.comic-pop {
  position: absolute;
  left: 50%;
  top: 40%;
  transform: translate(-50%, -50%) scale(0.4);
  font-size: 25px;
  font-weight: 900;
  color: #ffd43b;
  text-shadow: 2.5px 2.5px 0 #1a1a1a, -1.5px -1.5px 0 #1a1a1a, 1.5px -1.5px 0 #1a1a1a, -1.5px 1.5px 0 #1a1a1a;
  white-space: nowrap;
  animation: popUpAnim 0.85s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.comic-pop.big {
  font-size: 34px;
  color: #ff6b6b;
  background: #ffd43b;
  padding: 6px 16px;
  border: 4px solid #1a1a1a;
  border-radius: 16px;
  box-shadow: 5px 5px 0 #1a1a1a;
}

.comic-pop.stamp {
  font-size: 30px;
  color: #2f9e44;
  background: #fff9db;
  padding: 4px 16px;
  border: 4px solid #2f9e44;
  border-radius: 10px;
  transform: translate(-50%, -50%) rotate(-12deg);
}

@keyframes popUpAnim {
  0% { opacity: 0; transform: translate(-50%, -30%) scale(0.4); }
  25% { opacity: 1; transform: translate(-50%, -55%) scale(1.1); }
  100% { opacity: 0; transform: translate(-50%, -115%) scale(0.95); }
}

/* ======================== 6. 通关舞台 & 加班失败 & 暂停 ======================== */
#victory-stage-ui, #overtime-fail-ui {
  position: absolute;
  inset: 0;
  z-index: 35;
  display: none;
  flex-direction: column;
  justify-content: space-between;
  padding: 14px;
  pointer-events: none;
}

#victory-stage-ui.show, #overtime-fail-ui.show { display: flex; }

.result-banner {
  align-self: center;
  background: #ffd43b;
  border: 4px solid #1a1a1a;
  border-radius: 18px;
  box-shadow: 5px 5px 0 #1a1a1a;
  padding: 8px 22px;
  font-size: 26px;
  font-weight: 900;
  color: #2f9e44;
  text-shadow: 1.5px 1.5px 0 #1a1a1a;
}

.result-banner.fail {
  background: #ff6b6b;
  color: #fff;
}

.result-bottom-card {
  pointer-events: auto;
  background: rgba(255, 249, 219, 0.97);
  border: 4px solid #1a1a1a;
  border-radius: 18px;
  box-shadow: 5px 5px 0 #1a1a1a;
  padding: 12px;
}

.stars-row {
  text-align: center;
  font-size: 30px;
  letter-spacing: 6px;
  color: #fcc419;
  text-shadow: 2px 2px 0 #1a1a1a;
  margin-bottom: 6px;
}

.result-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-bottom: 10px;
  text-align: center;
}

.res-stat-cell {
  background: #fff;
  border: 2.5px solid #1a1a1a;
  border-radius: 10px;
  padding: 5px 4px;
}

.res-stat-cell span {
  display: block;
  font-size: 10px;
  font-weight: 800;
  color: #868e96;
}

.res-stat-cell strong {
  font-size: 14px;
  font-weight: 900;
  color: #1a1a1a;
}

.result-btn-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1.3fr;
  gap: 7px;
}

.result-btn-row .comic-btn {
  padding: 10px 4px;
  font-size: 12.5px;
}

#pause-modal {
  position: absolute;
  inset: 0;
  z-index: 40;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(20, 18, 24, 0.68);
  padding: 20px;
}

#pause-modal.show { display: flex; }

.pause-card {
  width: 100%;
  max-width: 280px;
  padding: 18px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pause-card h3 {
  font-size: 20px;
  font-weight: 900;
  margin-bottom: 4px;
}

.pause-card .comic-btn {
  width: 100%;
  padding: 11px;
  font-size: 14px;
}

.coin-svg-icon {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
  display: inline-block;
  vertical-align: middle;
  filter: drop-shadow(1px 1px 0 #1a1a1a);
}