/* 黄金矿工 · 宝藏猎人 — 金矿工业暗黑质感 */

:root {
  --bg: #09090b;
  --bg-elev: #121217;
  --card: rgba(22, 22, 28, 0.85);
  --text: #f4f4f5;
  --muted: #a1a1aa;
  --gold: #c9a227;
  --gold-2: #f3df95;
  --amber: #f59e0b;
  --blue: #38bdf8;
  --danger: #ef4444;
  --line-soft: rgba(255, 255, 255, 0.08);
  --r-sm: 10px;
  --r-md: 16px;
  --r-lg: 24px;
  --r-pill: 999px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
  width: 100%;
  overflow: hidden;
  background-color: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Segoe UI", "Microsoft YaHei", sans-serif;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}

/* 地底熔金环境光晕 */
body::before, body::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  z-index: 0;
  opacity: 0.12;
  pointer-events: none;
}
body::before {
  width: 320px; height: 320px;
  background: var(--amber);
  top: -80px; left: -60px;
}
body::after {
  width: 280px; height: 280px;
  background: #b45309;
  bottom: -60px; right: -60px;
}

.game-shell {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 480px;
  height: 100%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  padding: calc(10px + env(safe-area-inset-top)) 16px calc(14px + env(safe-area-inset-bottom));
}

/* ---- HUD 顶栏 ---- */
.hud {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line-soft);
  flex-shrink: 0;
}
.hud-back {
  width: 38px; height: 38px;
  display: grid;
  place-items: center;
  border-radius: var(--r-pill);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line-soft);
  color: var(--muted);
  text-decoration: none;
  transition: all 0.2s;
}
.hud-back:hover { color: #fff; border-color: rgba(255, 255, 255, 0.2); }
.hud-back svg { width: 20px; height: 20px; }

.hud-mid { text-align: center; }
.hud-kicker { display: block; font-size: 10px; letter-spacing: 0.2em; color: var(--gold); font-weight: 700; }
.hud-title { display: block; font-size: 15px; font-weight: 700; color: #fff; margin-top: 1px; }

.hud-stats { display: flex; gap: 14px; text-align: right; }
.hud-stat-box { display: flex; flex-direction: column; align-items: flex-end; min-width: 48px; }
.hud-label { display: block; font-size: 10px; color: var(--muted); }
.hud-score { font-size: 19px; font-weight: 800; color: var(--gold-2); font-variant-numeric: tabular-nums; }
.hud-time { font-size: 19px; font-weight: 800; color: var(--blue); font-variant-numeric: tabular-nums; }

/* ---- 游戏舞台 ---- */
.stage-wrap {
  flex: 1;
  position: relative;
  width: 100%;
  margin-top: 10px;
  border-radius: var(--r-md);
  background: radial-gradient(circle at 50% 10%, #1c1511 0%, #0d0a08 70%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.7) inset;
  overflow: hidden;
  touch-action: none;
}

#minerCanvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* 底部发射指引 */
.shoot-prompt {
  position: absolute;
  bottom: 14px;
  left: 0; right: 0;
  text-align: center;
  pointer-events: none;
  z-index: 5;
}
.shoot-prompt span {
  display: inline-block;
  padding: 5px 14px;
  border-radius: var(--r-pill);
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--gold-2);
  animation: pulse-txt 2s infinite ease-in-out;
}
@keyframes pulse-txt {
  0%, 100% { opacity: 0.9; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.96); }
}

/* ---- 蒙层 (开始/结束) ---- */
.overlay {
  position: absolute;
  inset: 0;
  background: rgba(4, 4, 6, 0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  z-index: 20;
}
.overlay.is-open {
  opacity: 1;
  pointer-events: auto;
}

.overlay-card {
  width: 100%;
  max-width: 320px;
  background: linear-gradient(150deg, #1c1815 0%, #100d0b 100%);
  border: 1.5px solid var(--gold);
  border-radius: var(--r-lg);
  padding: 26px 20px 22px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.8), 0 0 25px rgba(201, 162, 39, 0.2);
  transform: translateY(15px);
  transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.overlay.is-open .overlay-card {
  transform: translateY(0);
}

.overlay-icon {
  width: 56px; height: 56px;
  border-radius: var(--r-pill);
  background: rgba(201, 162, 39, 0.15);
  border: 1px solid var(--gold);
  color: var(--gold-2);
  display: grid;
  place-items: center;
  margin-bottom: 14px;
}
.overlay-icon svg { width: 28px; height: 28px; }

h1 { font-size: 20px; font-weight: 800; color: #fff; margin-bottom: 8px; }
h2 { font-size: 17px; font-weight: 800; color: var(--gold-2); margin-bottom: 4px; }
.overlay-kicker { font-size: 11px; letter-spacing: 0.2em; color: var(--amber); font-weight: 700; margin-bottom: 4px; }

.overlay-desc {
  font-size: 13px;
  line-height: 1.6;
  color: var(--muted);
  margin-bottom: 20px;
}
.overlay-best {
  font-size: 12px;
  color: var(--gold-2);
  margin-top: 14px;
}

.end-score {
  font-size: 42px;
  font-weight: 900;
  color: #fff;
  letter-spacing: -0.02em;
  margin-bottom: 6px;
  text-shadow: 0 0 20px rgba(201, 162, 39, 0.4);
}

.end-actions {
  display: flex;
  gap: 10px;
  width: 100%;
  margin-top: 20px;
}

.btn-primary {
  flex: 1;
  padding: 12px 18px;
  background: linear-gradient(135deg, var(--gold-2), var(--gold));
  color: #120e06;
  border: none;
  border-radius: var(--r-pill);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  box-shadow: 0 4px 15px rgba(201, 162, 39, 0.35);
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.btn-primary:active { transform: scale(0.97); }

.btn-ghost {
  flex: 1;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line-soft);
  color: var(--muted);
  border-radius: var(--r-pill);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-ghost:hover { color: #fff; border-color: rgba(255, 255, 255, 0.2); }

.is-hidden { display: none !important; }
