/* 雷电风暴 · 街机游戏界面 */
:root {
  --bg: #05070d;
  --ink: #eef4ff;
  --gold: #e8d5a3;
  --cyan: #4de1ff;
  --magenta: #ff4d9a;
  --danger: #ff5c6c;
  --font: "PingFang SC", "Microsoft YaHei", "Segoe UI", system-ui, sans-serif;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  width: 100%; height: 100%;
  background: var(--bg); color: var(--ink); font-family: var(--font);
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}
#app {
  position: relative; width: 100vw; height: 100vh;
  display: grid; place-items: center;
  background:
    radial-gradient(900px 500px at 50% 0%, rgba(77, 225, 255, 0.08), transparent 55%),
    radial-gradient(700px 400px at 80% 100%, rgba(232, 213, 163, 0.08), transparent 50%),
    #05070d;
}

/* 舞台 */
#stage {
  position: relative;
  width: min(100vw, calc(100vh * 0.62));
  height: min(100vh, calc(100vw / 0.62));
  max-width: 560px;
  max-height: 900px;
  background: #02040a;
  border-radius: 18px;
  overflow: hidden;
  box-shadow:
    0 0 0 1px rgba(232, 213, 163, 0.18),
    0 30px 80px rgba(0, 0, 0, 0.65),
    0 0 60px rgba(77, 225, 255, 0.08);
}
#game {
  display: block;
  width: 100%;
  height: 100%;
  background: #02040a;
}

/* CRT 质感 */
.crt {
  pointer-events: none;
  position: absolute; inset: 0;
  background:
    repeating-linear-gradient(
      0deg,
      rgba(255, 255, 255, 0.03) 0px,
      rgba(255, 255, 255, 0.03) 1px,
      transparent 1px,
      transparent 3px
    );
  mix-blend-mode: overlay;
  opacity: 0.45;
  z-index: 5;
}
.vignette {
  pointer-events: none;
  position: absolute; inset: 0;
  background: radial-gradient(ellipse at center, transparent 48%, rgba(0, 0, 0, 0.55) 100%);
  z-index: 6;
}

/* HUD */
.hud {
  position: absolute; top: 0; left: 0; right: 0;
  z-index: 10;
  padding: 12px 14px;
  display: flex; justify-content: space-between; align-items: flex-start;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(2, 4, 10, 0.72), transparent);
}
.hud-block { min-width: 88px; }
.hud-label {
  font-size: 10px; letter-spacing: 0.14em; color: rgba(232, 213, 163, 0.75);
  text-transform: uppercase;
}
.hud-value {
  font-size: 20px; font-weight: 800; line-height: 1.15;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 18px rgba(77, 225, 255, 0.35);
}
.hud-right { text-align: right; }
.lives {
  display: flex; gap: 5px; justify-content: flex-end; margin-top: 4px;
}
.life {
  width: 14px; height: 14px;
  background: linear-gradient(135deg, var(--gold), #b09a6c);
  clip-path: polygon(50% 0%, 100% 80%, 78% 100%, 50% 72%, 22% 100%, 0% 80%);
  box-shadow: 0 0 10px rgba(232, 213, 163, 0.55);
}
.bombs {
  display: flex; gap: 5px; justify-content: flex-end; margin-top: 4px;
}
.bomb {
  width: 12px; height: 12px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fff, var(--magenta) 55%, #7a1038);
  box-shadow: 0 0 10px rgba(255, 77, 154, 0.55);
}
.power-bar {
  width: 88px; height: 5px; margin-top: 6px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.12); overflow: hidden;
}
.power-bar > i {
  display: block; height: 100%; width: 20%;
  background: linear-gradient(90deg, var(--cyan), var(--gold));
  box-shadow: 0 0 12px rgba(77, 225, 255, 0.55);
  transition: width 0.2s ease;
}

/* Boss 血条 */
.boss-bar {
  position: absolute; left: 10%; right: 10%; top: 54px;
  z-index: 11; display: none;
  pointer-events: none;
}
.boss-bar.show { display: block; }
.boss-bar .name {
  font-size: 11px; letter-spacing: 0.18em; color: var(--danger);
  text-align: center; margin-bottom: 6px;
  text-shadow: 0 0 12px rgba(255, 92, 108, 0.6);
}
.boss-bar .track {
  height: 10px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 92, 108, 0.35);
  overflow: hidden;
}
.boss-bar .fill {
  height: 100%; width: 100%;
  background: linear-gradient(90deg, #ff4d6d, #ff9a4d, #ffd76a);
  box-shadow: 0 0 18px rgba(255, 77, 109, 0.55);
  transition: width 0.15s linear;
}

/* 覆盖层 */
.overlay {
  position: absolute; inset: 0; z-index: 20;
  display: grid; place-items: center;
  background: rgba(2, 4, 10, 0.72);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  opacity: 0; visibility: hidden; transition: 0.3s ease;
}
.overlay.show { opacity: 1; visibility: visible; }
.panel-box {
  width: min(92%, 380px);
  padding: 28px 24px 24px;
  border-radius: 22px;
  background: linear-gradient(165deg, rgba(22, 32, 52, 0.95), rgba(10, 14, 26, 0.96));
  border: 1px solid rgba(232, 213, 163, 0.22);
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.55), 0 0 50px rgba(232, 213, 163, 0.08);
  text-align: center;
}
.panel-box .kicker {
  font-size: 11px; letter-spacing: 0.22em; color: var(--gold);
  margin-bottom: 10px;
}
.panel-box h1 {
  font-size: 34px; line-height: 1.15; margin-bottom: 8px;
  background: linear-gradient(120deg, #fff2c8, var(--gold), #c2b59b);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.panel-box h2 {
  font-size: 26px; margin-bottom: 10px;
}
.panel-box p {
  color: rgba(238, 244, 255, 0.72); font-size: 13px; line-height: 1.7;
  margin-bottom: 18px;
}
.panel-box .score-line {
  font-size: 42px; font-weight: 900; letter-spacing: 0.04em;
  color: var(--gold);
  text-shadow: 0 0 28px rgba(232, 213, 163, 0.4);
  margin: 8px 0 4px;
}
.panel-box .best {
  font-size: 12px; color: rgba(238, 244, 255, 0.55); margin-bottom: 18px;
}
.btn-row { display: flex; flex-direction: column; gap: 10px; }
.btn {
  appearance: none; border: none; cursor: pointer;
  padding: 14px 18px; border-radius: 999px;
  font-size: 15px; font-weight: 700; font-family: inherit;
  transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}
.btn:active { transform: scale(0.97); }
.btn-primary {
  background: linear-gradient(135deg, #f7e7b8, var(--gold) 45%, #b09a6c);
  color: #1a1408;
  box-shadow: 0 12px 34px rgba(232, 213, 163, 0.28);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 18px 42px rgba(232, 213, 163, 0.38); }
.btn-ghost {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(232, 213, 163, 0.28);
  color: var(--gold);
}
.btn-ghost:hover { background: rgba(232, 213, 163, 0.12); }

/* 控制按钮 */
.controls {
  position: absolute; right: 10px; top: 10px; z-index: 15;
  display: flex; gap: 8px;
}
.ctrl-btn {
  width: 38px; height: 38px; border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: rgba(238, 244, 255, 0.85);
  display: grid; place-items: center;
  cursor: pointer;
  pointer-events: auto;
  font-size: 14px;
}
.ctrl-btn:hover { background: rgba(232, 213, 163, 0.16); color: #fff; }

/* 触屏提示 */
.touch-hint {
  position: absolute; left: 0; right: 0; bottom: 14px;
  text-align: center; font-size: 11px; color: rgba(238, 244, 255, 0.4);
  z-index: 8; pointer-events: none;
}

/* 侧边装饰 */
.side-deco {
  position: absolute; z-index: 1;
  width: 180px; height: 180px; border-radius: 50%;
  filter: blur(60px); opacity: 0.35; pointer-events: none;
}
.side-deco.a { left: -40px; top: 10%; background: rgba(77, 225, 255, 0.35); }
.side-deco.b { right: -40px; bottom: 12%; background: rgba(232, 213, 163, 0.3); }

@media (max-width: 640px) {
  #stage {
    width: 100vw; height: 100vh; max-width: none; max-height: none; border-radius: 0;
    box-shadow: none;
  }
  /* 右上角 .controls 固定 top:10px 高 38px，与 HUD 右侧 HIGH 同高会压住数值。
     把 HUD 右侧整块下移让出顶部 48px。 */
  .hud-right { margin-top: 46px; }
  .hud-value { font-size: 16px; }
  .panel-box h1 { font-size: 28px; }
  .touch-hint { display: block; }
}
@media (min-width: 641px) {
  .touch-hint { opacity: 0.35; }
}

#shopOverlay { z-index: 40; }
#shopOverlay .panel-box { max-height: 88vh; overflow: auto; }

.shop-item-info .exp-cd {
  margin-top: 4px; font-size: 11px; color: #7dff8a; font-weight: 600;
}
.shop-item-info .exp-cd .exp-t { color: #ffd76a; font-variant-numeric: tabular-nums; }
.shop-item-info .exp-cd.is-dead { color: #ff8090; }


/* ==================== z10 · 美术精修 / 放雷单一化 ==================== */
/* 舞台：发丝边 + 上沿高光 + 底部压暗，玻璃感不靠多层叠图 */
#stage::after {
  content: ""; position: absolute; inset: 0; z-index: 7; pointer-events: none;
  border-radius: inherit;
  box-shadow:
    inset 0 0 0 1px rgba(232, 213, 163, 0.10),
    inset 0 1px 0 rgba(255, 255, 255, 0.055),
    inset 0 -60px 80px rgba(0, 0, 0, 0.26);
}

/* 放雷边缘脉冲：单个 DOM 层，JS 强制重排后只播一次；不产生叠加 */
#thunderPulse {
  --pulse-col: rgba(77, 225, 255, 0.50);
  position: absolute; inset: 0; z-index: 9; pointer-events: none;
  border-radius: inherit; opacity: 0;
  box-shadow:
    inset 0 0 0 1px var(--pulse-col),
    inset 0 0 70px 12px var(--pulse-col);
}
#thunderPulse.on { animation: rdPulse 0.95s cubic-bezier(.16, 1, .3, 1) forwards; }
@keyframes rdPulse {
  0%   { opacity: 0;    transform: scale(1.015); }
  12%  { opacity: 0.85; }
  100% { opacity: 0;    transform: scale(1); }
}

/* HUD：玻璃底 + 1px 发丝边 + 上沿高光 */
.hud {
  padding: 12px 12px 10px;
  background: linear-gradient(180deg, rgba(2, 4, 10, 0.78), rgba(2, 4, 10, 0.26) 62%, transparent);
}
.hud-block {
  min-width: 96px; padding: 9px 11px 10px; border-radius: 14px;
  background: linear-gradient(160deg, rgba(14, 24, 44, 0.60), rgba(6, 10, 22, 0.42));
  border: 1px solid rgba(232, 213, 163, 0.16);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07), 0 10px 26px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.hud-label { font-size: 9px; letter-spacing: 0.2em; color: rgba(232, 213, 163, 0.62); }
.hud-value { text-shadow: 0 0 18px rgba(77, 225, 255, 0.45), 0 1px 0 rgba(0, 0, 0, 0.6); }
#scoreVal {
  background: linear-gradient(180deg, #ffffff, #9fe9ff 55%, #4db8e8);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  text-shadow: 0 0 22px rgba(77, 225, 255, 0.45);
}
#formVal {
  display: inline-block; padding: 3px 8px; border-radius: 999px;
  background: rgba(77, 225, 255, 0.10); border: 1px solid rgba(77, 225, 255, 0.22);
  color: #a8f0ff !important; font-size: 11px !important;
  letter-spacing: 0.04em !important; white-space: nowrap;
}
.power-bar {
  height: 6px; background: rgba(255, 255, 255, 0.10);
  border: 1px solid rgba(77, 225, 255, 0.14);
}
.power-bar > i {
  background: linear-gradient(90deg, #2fd4f5, #4de1ff 46%, #e8d5a3);
  box-shadow: 0 0 14px rgba(77, 225, 255, 0.6);
}
.bomb { background: radial-gradient(circle at 35% 35%, #fff, #7be9ff 40%, #ff4d9a 78%, #7a1038); }
.boss-bar .track {
  border: 1px solid rgba(255, 92, 108, 0.45);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.55), 0 0 16px rgba(255, 77, 109, 0.18);
}
.boss-bar .fill {
  background: linear-gradient(90deg, #ff4d6d, #ff9a4d, #ffd76a);
  box-shadow: 0 0 18px rgba(255, 77, 109, 0.65);
}
.ctrl-btn {
  background: linear-gradient(160deg, rgba(20, 30, 50, 0.72), rgba(8, 12, 24, 0.55));
  border: 1px solid rgba(232, 213, 163, 0.18);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 6px 16px rgba(0, 0, 0, 0.30);
  transition: transform 0.15s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.ctrl-btn:hover {
  border-color: rgba(77, 225, 255, 0.55);
  box-shadow: 0 0 18px rgba(77, 225, 255, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.12);
}
/* 放雷按钮：唯一可点的移动端放雷入口，常驻一层（不是多层）呼吸光圈 */
.item-btn[data-normal-thunder] {
  border-color: rgba(125, 255, 138, 0.55);
  box-shadow: 0 0 0 1px rgba(125, 255, 138, 0.10), 0 0 16px rgba(125, 255, 138, 0.18),
              inset 0 1px 0 rgba(255, 255, 255, 0.10);
}
.item-btn[data-normal-thunder]::after {
  content: ""; position: absolute; inset: 2px; border-radius: 12px;
  border: 1px solid rgba(125, 255, 138, 0.35); pointer-events: none;
  animation: rdBreathe 2.4s ease-in-out infinite;
}
@keyframes rdBreathe {
  0%, 100% { opacity: 0.25; transform: scale(0.96); }
  50%      { opacity: 0.75; transform: scale(1.02); }
}
@media (max-width: 640px) {
  .hud-block { padding: 7px 9px 8px; min-width: 88px; }
  .hud-right { margin-top: 46px; }
}

/* z11：能量条与右侧数值对齐（原来是 block 靠左，差 8px） */
.power-bar { margin-left: auto; margin-right: 0; }

/* z12：HUD 独立合成层 --------------------------------------------------
 * 部分软件合成路径会把 .hud-block 的渐变底+圆角错扩成半屏玻璃带
 * （DOM 实测 .hud-right 仅 116px 宽，属绘制伪影而非布局错误）。
 * 强制独立层并去掉外阴影扩散，消除该伪影，布局与配色完全不变。 */
.hud { isolation: isolate; }
.hud-block { isolation: isolate; transform: translateZ(0); }

/* z13：Boss 血条分段刻度 + 危险呼吸（同一元素多背景，不新增 DOM 层） */
.boss-bar .fill {
  background-image:
    repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.22) 0 2px, transparent 2px 26px),
    linear-gradient(90deg, #ff4d6d, #ff9a4d, #ffd76a);
  animation: rdBossPulse 1.8s ease-in-out infinite;
}
@keyframes rdBossPulse {
  0%, 100% { filter: brightness(1); }
  50%      { filter: brightness(1.16); }
}

/* z14：Boss 出场演出 —— 单个 DOM 元素 + 两个伪元素，1.5s 一次性播放 */
#bossIntro {
  position: absolute; left: 0; right: 0; top: 34%; z-index: 16;
  pointer-events: none; opacity: 0; text-align: center;
  padding: 16px 0;
  background: linear-gradient(90deg, transparent, rgba(255, 77, 109, 0.12) 30%,
                              rgba(255, 77, 109, 0.12) 70%, transparent);
  font-size: 19px; font-weight: 800; letter-spacing: 0.3em; color: #ffe3e6;
  text-shadow: 0 0 22px rgba(255, 77, 109, 0.85), 0 2px 0 rgba(0, 0, 0, 0.5);
}
#bossIntro::before { content: attr(data-name); display: block; }
#bossIntro::after {
  content: ""; display: block; margin: 12px auto 0; width: 46%; height: 2px;
  background: linear-gradient(90deg, transparent, #ff4d6d 30%, #ffd76a 70%, transparent);
  box-shadow: 0 0 14px rgba(255, 77, 109, 0.7);
}
#bossIntro.on { animation: rdBossIntro 1.5s cubic-bezier(.16, 1, .3, 1) forwards; }
@keyframes rdBossIntro {
  0%   { opacity: 0; transform: translateY(10px) scale(0.94); letter-spacing: 0.5em; }
  14%  { opacity: 1; transform: translateY(0) scale(1); }
  70%  { opacity: 1; }
  100% { opacity: 0; transform: translateY(-8px) scale(1.02); letter-spacing: 0.34em; }
}
@media (max-width: 640px) { #bossIntro { font-size: 15px; letter-spacing: 0.18em; } }

/* z24：平板/桌面 HUD 右上避让 ------------------------------------------
 * 768x1024 实测 .controls(top:10px,高38px) 会压住 .hud-right 的 HIGH/LIVES；
 * 原避让只写在 @media (max-width:640px) 里，641px 以上全部失效。全局下移。 */
.hud-right { margin-top: 46px; }

/* z26 · 全屏雷暴：仍只有一个 #thunderPulse DOM 层，不新增绘制层 ---------- */
#thunderPulse {
  background:
    repeating-linear-gradient(112deg, transparent 0 34px, rgba(190,240,255,.13) 34px 36px, transparent 36px 72px),
    radial-gradient(circle at 50% 44%, rgba(255,255,255,.26), rgba(120,200,255,.08) 42%, transparent 70%);
  background-size: 220% 220%, 100% 100%;
  box-shadow: inset 0 0 0 2px var(--pulse-col), inset 0 0 130px 28px var(--pulse-col);
}
#thunderPulse.on { animation: rdThunderFull .9s cubic-bezier(.16,1,.3,1) forwards; }
@keyframes rdThunderFull {
  0%   { opacity: 0; transform: scale(1.05); background-position: 0 0, 0 0; }
  10%  { opacity: 1; }
  26%  { opacity: .88; background-position: -28% 22%, 0 0; }
  100% { opacity: 0; transform: scale(1); background-position: -72% 58%, 0 0; }
}
/* z26 · 形态徽章 / 技能栏夸张反馈（不新增 DOM，布局零风险） */
#formVal {
  font-size: 13px !important; font-weight: 800; letter-spacing: .04em !important;
  padding: 5px 12px; border-radius: 999px;
  background: linear-gradient(120deg, rgba(47,212,245,.20), rgba(232,213,163,.16));
  border: 1px solid rgba(47,212,245,.55);
  box-shadow: 0 0 18px rgba(47,212,245,.35), inset 0 1px 0 rgba(255,255,255,.14);
  text-shadow: 0 0 12px rgba(47,212,245,.8);
  animation: rdFormGlow 2.4s ease-in-out infinite;
}
@keyframes rdFormGlow {
  0%,100% { box-shadow: 0 0 12px rgba(47,212,245,.25), inset 0 1px 0 rgba(255,255,255,.10); }
  50%     { box-shadow: 0 0 28px rgba(47,212,245,.60), inset 0 1px 0 rgba(255,255,255,.20); }
}
#formVal.shield-on {
  border-color: rgba(255,212,120,.85); color: #fff3cf !important;
  background: linear-gradient(120deg, rgba(255,180,60,.30), rgba(255,230,150,.18));
  text-shadow: 0 0 16px rgba(255,200,90,.95);
  animation: rdShieldBadge .7s ease-in-out infinite alternate;
}
@keyframes rdShieldBadge { from { box-shadow: 0 0 14px rgba(255,190,70,.4); } to { box-shadow: 0 0 30px rgba(255,210,110,.85); } }
#formVal.levelup { animation: rdLevelUp .75s cubic-bezier(.16,1,.3,1) 1; }
@keyframes rdLevelUp { 0% { transform: scale(.86); filter: brightness(2.2); } 100% { transform: scale(1); filter: brightness(1); } }
.item-btn[data-item]::after {
  content: ""; position: absolute; inset: 2px; border-radius: 12px;
  border: 1px solid rgba(232,213,163,.30); pointer-events: none;
  animation: rdItemBreath 2.6s ease-in-out infinite;
}
@keyframes rdItemBreath { 0%,100% { opacity:.20; transform:scale(.96); } 50% { opacity:.62; transform:scale(1.02); } }
.item-btn[data-item]:hover { box-shadow: 0 0 22px rgba(47,212,245,.45); }

/* z27 护盾透明覆盖层（单层 DOM，两个渲染后端共用） */
#shieldLayer { position:absolute; inset:0; width:100%; height:100%; z-index:8; pointer-events:none; }
