/*!
 * 霓虹打砖块 · NEON BREAKER —— 页面样式
 * 画布只负责游戏画面，HUD 与弹窗都用 DOM 实现，这样文字更清晰、也更好改。
 */

:root {
  --bg: #04060d;
  --bg-soft: #0a1224;
  --cyan: #22d3ee;
  --violet: #a855f7;
  --amber: #f59e0b;
  --text: #e2e8f0;
  --muted: #8ea0bd;
  --line: rgba(56, 189, 248, 0.22);
  --panel-bg: rgba(7, 12, 26, 0.86);

  --font: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", system-ui, sans-serif;
  --mono: "JetBrains Mono", "SFMono-Regular", Consolas, "Courier New", monospace;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  background:
    radial-gradient(1200px 600px at 50% -12%, rgba(34, 211, 238, 0.14), transparent 62%),
    radial-gradient(900px 520px at 88% 110%, rgba(168, 85, 247, 0.13), transparent 60%),
    var(--bg);
  color: var(--text);
  font-family: var(--font);
  display: flex;
  justify-content: center;
  padding: 22px 16px 34px;
  -webkit-font-smoothing: antialiased;
}

.app {
  width: 100%;
  max-width: 980px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* ---------------------------------- 顶部信息栏 --------------------------------- */

.hud {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(12, 20, 38, 0.92), rgba(7, 12, 26, 0.92));
  backdrop-filter: blur(6px);
}

.hud__brand {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.16em;
  color: var(--cyan);
  text-shadow: 0 0 18px rgba(34, 211, 238, 0.55);
  white-space: nowrap;
}

.hud__brand span {
  color: var(--violet);
  text-shadow: 0 0 18px rgba(168, 85, 247, 0.55);
}

.hud__stats {
  display: flex;
  gap: 22px;
  flex: 1;
  flex-wrap: wrap;
}

.stat {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 62px;
}

.stat__label {
  font-size: 11px;
  letter-spacing: 0.14em;
  color: var(--muted);
}

.stat__value {
  font-family: var(--mono);
  font-size: 19px;
  font-weight: 700;
  line-height: 1.1;
}

.stat__value--lives {
  color: #fb7185;
  letter-spacing: 0.12em;
}

.stat__value--best {
  color: var(--amber);
}

.hud__actions {
  display: flex;
  gap: 8px;
}

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(15, 24, 46, 0.9);
  color: var(--text);
  font-size: 16px;
  cursor: pointer;
  transition: transform 0.12s ease, border-color 0.12s ease, background 0.12s ease;
}

.icon-btn:hover {
  border-color: rgba(34, 211, 238, 0.6);
  background: rgba(24, 39, 74, 0.95);
}

.icon-btn:active {
  transform: scale(0.94);
}

/* ------------------------------------ 舞台 ------------------------------------ */

.stage {
  position: relative;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid var(--line);
  box-shadow:
    0 26px 70px rgba(4, 8, 20, 0.85),
    0 0 0 1px rgba(4, 8, 20, 0.6) inset;
  background: var(--bg);
  touch-action: none;
}

#game {
  display: block;
  width: 100%;
  aspect-ratio: 900 / 600;
  cursor: none;
}

/* ------------------------------------ 弹窗 ------------------------------------ */

.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 22px;
  background: radial-gradient(circle at 50% 40%, rgba(6, 10, 22, 0.72), rgba(3, 5, 12, 0.92));
  backdrop-filter: blur(3px);
  transition: opacity 0.24s ease, visibility 0.24s ease;
}

.overlay.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.panel {
  width: min(520px, 100%);
  text-align: center;
  padding: 26px 26px 22px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel-bg);
  box-shadow: 0 0 60px rgba(34, 211, 238, 0.12);
  animation: panel-in 0.26s ease;
}

@keyframes panel-in {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.panel__eyebrow {
  margin: 0 0 10px;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.26em;
  color: var(--cyan);
  text-transform: uppercase;
}

.panel__title {
  margin: 0 0 12px;
  font-size: clamp(24px, 3.4vw, 32px);
  letter-spacing: 0.04em;
}

.panel__text {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.75;
}

.panel__keys {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-bottom: 18px;
  font-size: 13px;
  color: var(--muted);
}

.panel__keys[hidden] {
  display: none;
}

kbd {
  display: inline-block;
  padding: 1px 7px;
  margin: 0 1px;
  border-radius: 6px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-bottom-width: 2px;
  background: rgba(30, 41, 59, 0.7);
  color: var(--text);
  font-family: var(--mono);
  font-size: 11px;
}

.cta {
  width: 100%;
  padding: 13px 20px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--cyan), var(--violet));
  color: #04060d;
  font-family: var(--font);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.08em;
  cursor: pointer;
  box-shadow: 0 12px 30px rgba(34, 211, 238, 0.24);
  transition: transform 0.12s ease, box-shadow 0.12s ease, filter 0.12s ease;
}

.cta:hover {
  filter: brightness(1.08);
  box-shadow: 0 16px 38px rgba(34, 211, 238, 0.32);
}

.cta:active {
  transform: translateY(1px) scale(0.99);
}

.panel__actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cta--ghost {
  background: transparent;
  border: 1px solid rgba(244, 114, 182, 0.55);
  color: #f9a8d4;
  box-shadow: none;
}

.cta--ghost:hover {
  filter: none;
  background: rgba(244, 114, 182, 0.14);
  box-shadow: 0 0 24px rgba(244, 114, 182, 0.22);
}

.cta[hidden],
.stat[hidden] {
  display: none;
}

.stat__value--p2 {
  color: #f9a8d4;
}

.panel__hint {
  margin: 14px 0 0;
  font-size: 12px;
  color: rgba(142, 160, 189, 0.75);
}

/* ------------------------------------ 提示条 ----------------------------------- */

.toast {
  position: absolute;
  left: 50%;
  /* 放在砖块区上方的空白带里，避免遮住下方的挡板 */
  top: 16px;
  transform: translate(-50%, -12px);
  padding: 9px 18px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(6, 12, 26, 0.92);
  color: var(--cyan);
  font-size: 13px;
  letter-spacing: 0.06em;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ------------------------------------ 页脚 ------------------------------------ */

.foot {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 0 4px;
  font-size: 12px;
  color: rgba(142, 160, 189, 0.7);
}

.foot__tip {
  font-family: var(--mono);
}

/* ----------------------------------- 移动端 ----------------------------------- */

@media (max-width: 640px) {
  body {
    padding: 12px 10px 22px;
  }

  .hud {
    gap: 12px;
    padding: 10px 12px;
  }

  .hud__stats {
    gap: 14px;
  }

  .stat__value {
    font-size: 16px;
  }

  .hud__brand {
    font-size: 13px;
  }

  .panel {
    padding: 20px 16px 18px;
  }

  .foot {
    display: none;
  }
}
