/* 魔界村 · 暗黑哥特 UI */
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  width: 100%; height: 100%;
  background: #0B0A12;
  color: #F2E6C8;
  font-family: "Noto Sans SC", "Microsoft YaHei", sans-serif;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

#stage {
  position: relative;
  width: 100vw; height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at center, #1A1228 0%, #0B0A12 70%);
}

#game {
  width: min(100vw, calc(100vh * 16 / 9));
  height: min(100vh, calc(100vw * 9 / 16));
  max-width: 100vw; max-height: 100vh;
  background: #0B0A12;
  display: block;
  image-rendering: auto;
  box-shadow: 0 0 80px rgba(194, 59, 46, 0.25);
}

.hidden { display: none !important; }

/* ===== HUD ===== */
.hud {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 52px;
  background: transparent !important;
  pointer-events: none;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 18px;
  background: linear-gradient(180deg, rgba(11,10,18,0.92), rgba(11,10,18,0));
  pointer-events: none;
  z-index: 20;
}
.hud-left, .hud-right { display: flex; align-items: center; gap: 12px; }
.hud-center { text-align: center; }
.hud-level {
  font-size: 13px; color: #E8D5A3; letter-spacing: 1px;
  text-shadow: 0 2px 8px rgba(0,0,0,0.8);
}
.hud-score {
  font-size: 11px; color: #a8b3c7; letter-spacing: 2px;
}
.hud-score b {
  color: #FFD76A; font-size: 16px;
  font-family: "JetBrains Mono", Consolas, monospace;
  margin-left: 4px;
}
.hud-lives { display: flex; gap: 4px; }
.life {
  width: 18px; height: 18px; border-radius: 4px;
  background: linear-gradient(135deg, #E8D5A3, #C23B2E);
  box-shadow: 0 0 8px rgba(232,213,163,0.5);
}
.life.off { background: #2a2438; box-shadow: none; }
.hud-weapon {
  padding: 4px 12px; border-radius: 999px;
  background: rgba(232,213,163,0.12);
  border: 1px solid rgba(232,213,163,0.28);
  font-size: 12px; color: #E8D5A3;
}
.hud-armor {
  padding: 4px 12px; border-radius: 999px;
  background: rgba(94,200,232,0.15);
  border: 1px solid rgba(94,200,232,0.4);
  font-size: 12px; color: #5EC8E8;
}
.hud-armor.broken {
  background: rgba(194,59,46,0.2);
  border-color: rgba(194,59,46,0.5);
  color: #ff8a7a;
}
.icon-btn {
  width: 36px; height: 36px; border-radius: 10px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(232,213,163,0.2);
  color: #E8D5A3; font-size: 16px; cursor: pointer;
  pointer-events: auto;
}
.icon-btn:hover { background: rgba(232,213,163,0.18); }

/* ===== Boss bar ===== */
.boss-bar {
  position: absolute;
  top: 58px; left: 50%; transform: translateX(-50%);
  width: min(480px, 80%);
  z-index: 22;
  pointer-events: none;
}
.boss-name {
  text-align: center;
  font-size: 13px; letter-spacing: 3px;
  color: #ffb4a8;
  text-shadow: 0 2px 12px rgba(194,59,46,0.8);
  margin-bottom: 6px;
}
.boss-hp-track {
  height: 10px; border-radius: 999px;
  background: rgba(0,0,0,0.55);
  border: 1px solid rgba(194,59,46,0.5);
  overflow: hidden;
}
.boss-hp-fill {
  height: 100%; width: 100%;
  background: linear-gradient(90deg, #C23B2E, #ff6b5a);
  transition: width 0.25s ease;
  box-shadow: 0 0 12px rgba(194,59,46,0.8);
}

/* ===== Overlays ===== */
.overlay {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  z-index: 30;
  background: rgba(11,10,18,0.72);
  backdrop-filter: blur(6px);
}
.title-bg {
  position: absolute; inset: 0;
  background-size: cover; background-position: center 30%;
  filter: saturate(1.15) brightness(0.5) contrast(1.08);
  transform: scale(1.05);
  animation: kenburns 24s ease-in-out infinite alternate;
}
@keyframes kenburns {
  from { transform: scale(1.05) translate3d(0,0,0); }
  to   { transform: scale(1.12) translate3d(-1.5%, -1%, 0); }
}
.title-veil {
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse at 30% 40%, rgba(194,59,46,0.18), transparent 55%),
    linear-gradient(180deg, rgba(11,10,18,0.2), rgba(11,10,18,0.85));
}
.title-card {
  position: relative; z-index: 2;
  text-align: center;
  padding: 36px 40px 28px;
  max-width: 620px;
  border-radius: 22px;
  background: linear-gradient(165deg, rgba(26,18,40,0.42), rgba(11,10,18,0.55));
  border: 1px solid rgba(232,213,163,0.18);
  box-shadow: 0 30px 90px rgba(0,0,0,0.45);
  backdrop-filter: blur(2px);
}
.title-kicker {
  font-size: 12px; letter-spacing: 4px;
  color: #E8D5A3; opacity: 0.85;
  margin-bottom: 10px;
}
.game-title {
  font-family: "Cinzel", "Noto Serif SC", "Microsoft YaHei", serif;
  font-size: clamp(56px, 11vw, 96px);
  font-weight: 700;
  letter-spacing: 16px;
  background:
    linear-gradient(180deg, #FFF8E8 0%, #E8D5A3 35%, #B8862D 55%, #F2E0A8 72%, #8A5A18 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter:
    drop-shadow(0 2px 0 rgba(90,50,10,0.85))
    drop-shadow(0 10px 36px rgba(232,213,163,0.45))
    drop-shadow(0 0 60px rgba(194,59,46,0.35));
  line-height: 1.05;
}
.game-sub {
  margin: 12px 0 16px;
  font-size: 15px; color: #d8c9a8;
  letter-spacing: 2px;
}
.title-tags {
  display: flex; flex-wrap: wrap; gap: 8px; justify-content: center;
  margin-bottom: 22px;
}
.title-tags span {
  padding: 5px 12px; border-radius: 999px;
  font-size: 12px;
  background: rgba(232,213,163,0.1);
  border: 1px solid rgba(232,213,163,0.25);
  color: #E8D5A3;
}
.title-actions {
  display: flex; gap: 12px; justify-content: center; flex-wrap: wrap;
  margin-bottom: 18px;
}

.btn-gold {
  padding: 14px 32px;
  border: none; border-radius: 14px;
  background: linear-gradient(135deg, #E8D5A3, #C9A24D);
  color: #1A1228;
  font-size: 16px; font-weight: 700;
  letter-spacing: 2px;
  cursor: pointer;
  box-shadow: 0 8px 28px rgba(232,213,163,0.35);
  transition: transform .15s, box-shadow .15s;
}
.btn-gold:hover { transform: translateY(-2px); box-shadow: 0 12px 32px rgba(232,213,163,0.5); }
.btn-gold:active { transform: translateY(0); }

.btn-ghost {
  padding: 14px 28px;
  border-radius: 14px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(232,213,163,0.3);
  color: #E8D5A3;
  font-size: 15px;
  cursor: pointer;
  transition: background .15s;
}
.btn-ghost:hover { background: rgba(232,213,163,0.14); }

.diff-row {
  display: flex; align-items: center; justify-content: center;
  gap: 8px;
}
.diff-label { font-size: 12px; color: #a8b3c7; margin-right: 4px; }
.diff-btn {
  padding: 6px 14px; border-radius: 999px;
  background: transparent;
  border: 1px solid rgba(232,213,163,0.25);
  color: #a8b3c7; font-size: 12px; cursor: pointer;
}
.diff-btn.is-on {
  background: rgba(232,213,163,0.18);
  border-color: #E8D5A3;
  color: #F2E6C8;
}

.panel {
  position: relative; z-index: 2;
  width: min(420px, 90vw);
  padding: 32px 28px;
  border-radius: 20px;
  background: rgba(26,18,40,0.92);
  border: 1px solid rgba(232,213,163,0.22);
  box-shadow: 0 24px 80px rgba(0,0,0,0.55);
  text-align: center;
}
.panel h2 {
  font-family: "Cinzel", "Noto Serif SC", serif;
  font-size: 28px; letter-spacing: 4px;
  color: #E8D5A3; margin-bottom: 18px;
}
.panel h2.danger { color: #ff8a7a; }
.panel h2.gold { color: #FFD76A; }

.how-list {
  list-style: none;
  text-align: left;
  margin: 0 0 16px;
}
.how-list li {
  padding: 8px 0;
  border-bottom: 1px solid rgba(232,213,163,0.1);
  font-size: 14px; color: #d8c9a8;
}
.how-list b { color: #E8D5A3; margin-right: 8px; }
.how-note {
  font-size: 12px; color: #a8b3c7; line-height: 1.6;
  margin-bottom: 10px;
}
.pause-actions {
  display: flex; flex-direction: column; gap: 10px;
}
.clear-stats {
  display: flex; flex-direction: column; gap: 8px;
  margin: 8px 0 20px;
}
.stat-row {
  display: flex; justify-content: space-between;
  padding: 10px 14px; border-radius: 12px;
  background: rgba(255,255,255,0.05);
  font-size: 13px; color: #a8b3c7;
}
.stat-row b {
  color: #F2E6C8;
  font-family: "JetBrains Mono", Consolas, monospace;
}
.win-text {
  font-size: 14px; color: #d8c9a8; margin-bottom: 12px;
  line-height: 1.7;
}

/* ===== Touch ===== */
.touch-ui {
  position: absolute; inset: 0;
  z-index: 25;
  pointer-events: none;
}
.t-left {
  position: absolute; left: 20px; bottom: 24px;
  pointer-events: auto;
}
.t-stick {
  width: 120px; height: 120px; border-radius: 50%;
  background: rgba(232,213,163,0.1);
  border: 2px solid rgba(232,213,163,0.28);
  position: relative;
}
.t-knob {
  width: 48px; height: 48px; border-radius: 50%;
  background: rgba(232,213,163,0.45);
  position: absolute; left: 36px; top: 36px;
}
.t-right {
  position: absolute; right: 18px; bottom: 24px;
  display: flex; gap: 12px; align-items: flex-end;
  pointer-events: auto;
}
.t-btn {
  width: 64px; height: 64px; border-radius: 50%;
  border: 2px solid rgba(232,213,163,0.35);
  background: rgba(26,18,40,0.72);
  color: #E8D5A3; font-size: 16px; font-weight: 700;
  cursor: pointer;
}
.t-jump { width: 72px; height: 72px; background: rgba(94,200,232,0.25); }
.t-atk { background: rgba(194,59,46,0.35); }
.t-btn:active { transform: scale(0.94); }

@media (max-width: 640px) {
  .game-title { letter-spacing: 6px; }
  .title-card { padding: 18px 16px; }
  .hud { padding: 0 10px; height: 46px; }
  .hud-weapon, .hud-armor { display: none; }
}


/* 画布内已绘制经典 HUD；DOM 仅保留暂停按钮 */
.hud-left, .hud-center, .hud-weapon, .hud-armor { display:none !important; }
.hud { background: transparent !important; }
.hud-right { margin-left: auto; }
.icon-btn { pointer-events: auto !important; background: rgba(8,6,12,0.55) !important; }
