/* 打砖块 · NEON — 配色取自站点主题的 7 个霓虹色 */
:root {
  --c1: #ff4e6a; --c2: #ff761e; --c3: #ffb900; --c4: #33d57a;
  --c5: #00dbff; --c6: #1a98ff; --c7: #9090ff;
  --bg: #08090e; --panel: #12151f; --line: #232a3d;
  --ink: #e9eefb; --dim: #8b96b4;
  --radius: 14px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans CJK SC", "Microsoft YaHei", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  background:
    radial-gradient(1200px 600px at 50% -10%, #131a2e 0%, transparent 60%),
    var(--bg);
}

#wrap {
  max-width: 940px;
  margin: 0 auto;
  padding: 14px clamp(10px, 2.5vw, 22px) 40px;
}

/* ---------- 顶栏 ---------- */
#bar { display: flex; align-items: center; gap: 12px; margin: 4px 0 12px; }
#bar h1 {
  font-size: clamp(17px, 3.6vw, 23px); margin: 0; letter-spacing: .04em; font-weight: 800;
}
#bar h1 span {
  font-family: var(--mono); font-weight: 500; letter-spacing: .18em;
  background: linear-gradient(90deg, var(--c5), var(--c7));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
#back {
  color: var(--dim); text-decoration: none; font-size: 13px;
  border: 1px solid var(--line); border-radius: 999px; padding: 5px 11px;
  transition: .18s;
}
#back:hover { color: var(--ink); border-color: var(--c5); }
#bar-btns { margin-left: auto; display: flex; gap: 8px; }

button {
  font: inherit; cursor: pointer; border-radius: 10px; padding: 9px 16px;
  border: 1px solid var(--line); background: #171b28; color: var(--ink);
  transition: .16s transform, .16s background, .16s border-color;
}
button:hover { border-color: var(--c5); }
button:active { transform: translateY(1px); }
button.ghost { background: transparent; padding: 7px 11px; font-size: 14px; }
button.primary {
  background: linear-gradient(135deg, var(--c1), var(--c2));
  border-color: transparent; font-weight: 700; letter-spacing: .02em;
  box-shadow: 0 6px 22px -8px var(--c1);
}
button.primary:hover { filter: brightness(1.08); }
button.ghost[aria-pressed="false"] { opacity: .45; }

/* ---------- HUD ---------- */
#hud {
  display: flex; align-items: center; gap: clamp(8px, 2vw, 20px);
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 9px clamp(10px, 2vw, 16px);
  font-size: clamp(12px, 2.4vw, 14px);
}
.hud-cell { display: flex; flex-direction: column; gap: 2px; min-width: 46px; }
.hud-cell.grow { flex: 1; min-width: 120px; }
.hud-cell .k { color: var(--dim); font-size: 11px; letter-spacing: .06em; }
.hud-cell .k b { color: var(--c5); font-family: var(--mono); }
.hud-cell .v { font-family: var(--mono); font-weight: 700; }
.hud-cell .v.dim { color: var(--dim); font-weight: 500; }
#hud-lives { color: var(--c1); letter-spacing: .12em; }
#energy {
  height: 9px; border-radius: 999px; background: #1c2233; overflow: hidden;
  border: 1px solid var(--line);
}
#energy i {
  display: block; height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--c4), var(--c5));
  transition: width .08s linear;
}
#energy.low i { background: linear-gradient(90deg, var(--c2), var(--c1)); }

/* ---------- 舞台 ---------- */
#stage {
  position: relative;
  border: 1px solid var(--line); border-top: 0;
  border-radius: 0 0 var(--radius) var(--radius);
  overflow: hidden;
  background: #0a0c13;
  touch-action: none;
}
#game { display: block; width: 100%; height: auto; aspect-ratio: 4 / 3; }

/* 连击浮字（DOM，便于不同分辨率下清晰） */
#fx { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.pop {
  position: absolute; font-family: var(--mono); font-weight: 800;
  transform: translate(-50%, -50%); white-space: nowrap;
  animation: pop .8s ease-out forwards; text-shadow: 0 0 14px currentColor;
}
@keyframes pop {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(.6); }
  25% { opacity: 1; transform: translate(-50%, -60%) scale(1.06); }
  100% { opacity: 0; transform: translate(-50%, -140%) scale(.96); }
}

/* ---------- 覆盖层 ---------- */
.overlay {
  position: absolute; inset: 0; z-index: 3;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px; text-align: center; padding: clamp(16px, 4vw, 36px);
  background: rgba(8, 9, 14, .82);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.overlay.hidden { display: none; }
.overlay h2 { margin: 0; font-size: clamp(20px, 4.4vw, 30px); letter-spacing: .03em; }
.overlay h2 em {
  font-family: var(--mono); font-style: normal; letter-spacing: .16em;
  background: linear-gradient(90deg, var(--c5), var(--c7));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.overlay h2 b { color: var(--c5); }
.lead { margin: 0; max-width: 40em; color: #c3cbe2; font-size: clamp(13px, 2.6vw, 15px); line-height: 1.7; }
.lead b { color: var(--c5); }
.tiny { margin: 0; color: var(--dim); font-size: clamp(11px, 2.2vw, 12.5px); line-height: 1.7; }
.keys {
  display: grid; gap: 7px; font-size: clamp(11.5px, 2.3vw, 13px); color: #b9c2da;
  text-align: left; background: #10131d; border: 1px solid var(--line);
  border-radius: 12px; padding: 12px 15px; max-width: 460px;
}
kbd {
  font-family: var(--mono); font-size: .92em; background: #1d2333;
  border: 1px solid #2c3549; border-bottom-width: 2px;
  border-radius: 6px; padding: 1px 6px; margin: 0 1px; color: #dbe3f7;
}
.row { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }


/* ---------- 触屏实体按键 ---------- */
#pad {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(76px, 1fr));
  gap: 8px;
  margin-top: 8px;
  padding: 9px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  position: sticky;
  bottom: 6px;
  z-index: 4;
  box-shadow: 0 -8px 24px -18px #000;
}
.ctl {
  min-height: 48px;
  padding: 6px 8px;
  font-size: clamp(12px, 2.6vw, 14px);
  font-weight: 600;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  border-radius: 11px;
  background: #171d2b;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.ctl kbd { font-size: 9.5px; opacity: .55; padding: 0 4px; border-bottom-width: 1px; }
.ctl.hold { border-color: #2d4257; }
.ctl.hold:active, .ctl.hold.on { background: #14304a; border-color: var(--c5); color: #dff4ff; }
.ctl.toggle.on { background: #2a1d3f; border-color: var(--c7); color: #e9e2ff; }
#pad .ctl:nth-child(5) { border-color: #3a3448; }

/* ---------- 道具条 ---------- */
#powerbar {
  display: flex; gap: 8px; flex-wrap: wrap; min-height: 30px;
  padding: 10px 2px 0; font-family: var(--mono); font-size: 12px;
}
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px;
  background: #131826; color: #cfd8ef;
}
.chip i { font-style: normal; }
.chip u { text-decoration: none; color: var(--dim); }

/* ---------- 页脚 ---------- */
#foot {
  margin-top: 18px; color: var(--dim); font-size: 12px; line-height: 1.9;
}
#foot a { color: #9fb2dd; }
#foot b { color: #c8d2ec; }
#foot .sep { margin: 0 6px; opacity: .5; }

@media (max-width: 560px) {
  .hud-cell .k { font-size: 10px; }
  .keys { grid-template-columns: 1fr; }
  #foot { font-size: 11.5px; }
}

@media (prefers-reduced-motion: reduce) {
  .pop { animation-duration: .35s; }
}
