:root {
  --ink: #eef4ff;
  --muted: #8fa3c0;
  --yellow: #ffd23f;
  --line: rgba(150, 190, 255, 0.22);
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Noto Sans SC", "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html,
body {
  height: 100%;
  margin: 0;
  overflow: hidden;
  overscroll-behavior: none;
  background: #02040a;
  color: var(--ink);
  font-family: var(--font);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

#stage {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

button {
  font-family: inherit;
  touch-action: manipulation;
  cursor: pointer;
}

.hidden { display: none !important; }

/* ---------- 顶部 HUD ---------- */
.hud {
  position: fixed;
  left: 0;
  right: 0;
  top: 0;
  z-index: 5;
  padding: calc(env(safe-area-inset-top, 0px) + 10px) 14px 0;
  pointer-events: none;
}

.hud-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 720px;
  margin: 0 auto;
}

.stat .k {
  display: block;
  font-size: 11px;
  letter-spacing: 0.15em;
  color: var(--muted);
}

.stat .v {
  font-size: 24px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #fff8dc;
  text-shadow: 0 0 12px rgba(255, 210, 63, 0.35);
}

.stat.right { text-align: right; }

.msg {
  font-size: 14px;
  letter-spacing: 0.1em;
  color: var(--yellow);
  text-shadow: 0 0 10px rgba(255, 210, 63, 0.4);
}

.hud-row.sub {
  margin-top: 6px;
  font-size: 13px;
  color: var(--muted);
}

.hud-row.sub b { color: var(--ink); }

.lives {
  color: var(--yellow);
  letter-spacing: 0.2em;
  text-shadow: 0 0 8px rgba(255, 210, 63, 0.5);
}

.pause-btn {
  pointer-events: auto;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(8, 12, 24, 0.6);
  color: var(--ink);
  font-size: 12px;
}

/* ---------- 菜单 / 暂停 / 结算 ---------- */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(2, 4, 10, 0.6);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

.panel {
  width: 100%;
  max-width: 380px;
  padding: 26px 22px 22px;
  text-align: center;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(18, 28, 50, 0.88), rgba(8, 12, 24, 0.92));
  box-shadow: 0 0 60px -20px rgba(255, 210, 63, 0.25);
}

.eyebrow {
  margin: 0;
  font-size: 12px;
  letter-spacing: 0.3em;
  color: var(--yellow);
}

h1 {
  margin: 8px 0 12px;
  font-size: clamp(30px, 8vw, 40px);
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--yellow);
  text-shadow: 0 0 24px rgba(255, 210, 63, 0.35);
}

h2 {
  margin: 4px 0 16px;
  font-size: 26px;
  letter-spacing: 0.08em;
  color: #f4f8ff;
}

.tip {
  margin: 0 0 14px;
  font-size: 14px;
  line-height: 1.7;
  color: var(--muted);
}

.tip.small { font-size: 13px; }

.primary,
.ghost {
  display: block;
  width: 100%;
  margin-top: 10px;
  padding: 13px;
  border-radius: 12px;
  font-size: 17px;
  letter-spacing: 0.15em;
}

.primary {
  border: 1px solid rgba(255, 210, 63, 0.7);
  background: linear-gradient(180deg, rgba(255, 210, 63, 0.26), rgba(200, 150, 30, 0.2));
  color: #fff9e0;
  box-shadow: 0 0 22px -8px rgba(255, 210, 63, 0.6);
}

.ghost {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-size: 15px;
}

.best {
  min-height: 18px;
  margin: 14px 0 0;
  font-size: 13px;
  color: var(--muted);
}

.over-title {
  color: #ff8a7a;
}

.over-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.over-stats > div {
  padding: 14px 8px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
}

.over-stats .k {
  display: block;
  font-size: 12px;
  letter-spacing: 0.12em;
  color: var(--muted);
}

.over-stats b {
  display: block;
  margin-top: 4px;
  font-size: 30px;
  font-variant-numeric: tabular-nums;
  color: #fff8dc;
}

@media (max-width: 380px) {
  .stat .v { font-size: 20px; }
  .msg { font-size: 12px; }
}
