/* 重力迷宫 · 科技紫主题 */

:root {
  --bg: #050508;
  --card: rgba(15, 10, 25, 0.7);
  --text: #f4f4f5;
  --muted: #a1a1aa;
  --accent: #a855f7; /* 紫色 */
  --accent-2: #e879f9;
  --accent-dim: rgba(168, 85, 247, .14);
  --on-accent: #1e053a;
  --line: rgba(168, 85, 247, .2);
  --line-soft: rgba(255, 255, 255, .08);
  --danger: #ef4444;
  --r-md: 16px;
  --r-lg: 20px;
  --r-pill: 999px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }

body {
  background: linear-gradient(rgba(10, 15, 25, 0.75), rgba(10, 15, 25, 0.85)), url('../img/bg.jpg') center/cover no-repeat;
  background-color: var(--bg);
  color: var(--text);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "PingFang SC", sans-serif;
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
  position: relative;
  overflow: hidden;
}

body::before {
  content: '';
  position: absolute;
  width: 60vmax; height: 60vmax;
  background: radial-gradient(circle, rgba(168,85,247,0.15) 0%, transparent 60%);
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  z-index: 0;
  pointer-events: none;
}

.game-shell {
  height: 100dvh; display: flex; flex-direction: column;
  max-width: 560px; margin: 0 auto; position: relative; z-index: 1;
  background: rgba(0,0,0,0.65); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}

/* ---- HUD ---- */
.hud {
  display: flex; align-items: center; gap: 12px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  border-bottom: 1px solid var(--line-soft);
  background: rgba(5,5,8,0.8); backdrop-filter: blur(16px);
}
.hud-back {
  width: 36px; height: 36px; display: grid; place-items: center;
  color: var(--muted); border: 1px solid var(--line-soft);
  border-radius: var(--r-pill); text-decoration: none;
}
.hud-back svg { width: 18px; height: 18px; }
.hud-mid { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.hud-kicker { font-size: 10px; letter-spacing: .22em; color: var(--accent); font-weight: 700; }
.hud-title { font-size: 17px; font-weight: 700; }

.hud-time {
  font-size: 14px; font-weight: 700; color: var(--accent-2);
  border: 1px solid var(--line); border-radius: var(--r-pill);
  padding: 4px 12px; background: var(--accent-dim);
}

/* ---- Stage ---- */
.stage-wrap { position: relative; flex: 1; min-height: 0; display: flex; justify-content: center; align-items: center; padding: 20px;}
#stage { width: 100%; max-width: 400px; max-height: 100%; aspect-ratio: 1/1; touch-action: none; border-radius: 20px; box-shadow: 0 0 30px rgba(168,85,247,0.2), 0 0 0 1px var(--line-soft); }

/* ---- Overlays ---- */
.overlay {
  position: absolute; inset: 0; display: grid; place-items: center;
  padding: 24px; background: rgba(5,5,8,.8); backdrop-filter: blur(12px);
  opacity: 0; pointer-events: none; transition: opacity .3s; z-index: 10;
}
.overlay.is-open { opacity: 1; pointer-events: auto; }

.overlay-card {
  width: 100%; max-width: 340px; background: var(--card);
  border: 1px solid var(--line); border-radius: 24px;
  box-shadow: 0 30px 60px rgba(0,0,0,.6), 0 0 40px rgba(168,85,247,0.1);
  padding: 32px 24px 28px; text-align: center;
}
.overlay.is-open .overlay-card { animation: card-in .4s cubic-bezier(0.2, 0.8, 0.2, 1) forwards; }
@keyframes card-in { from { opacity: 0; transform: translateY(20px) scale(0.95); } to { opacity: 1; transform: none; } }

.overlay-icon {
  width: 64px; height: 64px; margin: 0 auto 16px; display: grid; place-items: center;
  color: var(--accent); background: linear-gradient(135deg, var(--accent-dim), transparent);
  border: 1px solid var(--line); border-radius: var(--r-pill);
}
.overlay-icon svg { width: 32px; height: 32px; }

.overlay-kicker { font-size: 11px; letter-spacing: .2em; color: var(--accent); font-weight: 700; }
.overlay-card h1, .overlay-card h2 { font-size: 1.7rem; font-weight: 800; margin: 8px 0 12px; color: var(--accent-2); }
.overlay-card p { font-size: 14px; color: var(--muted); line-height: 1.7; margin-bottom: 24px; }

.end-score { font-size: 3.5rem; font-weight: 800; color: var(--accent-2); margin-bottom: 8px; text-shadow: 0 0 20px rgba(168,85,247,0.5); }
.end-meta { font-size: 14px; color: var(--muted); margin-bottom: 0 !important; }

.end-actions { display: flex; flex-direction: column; gap: 12px; margin-top: 24px; }

.btn-primary {
  display: block; width: 100%; padding: 14px 0; font-size: 16px; font-weight: 700;
  color: var(--on-accent); background: linear-gradient(135deg, var(--accent-2), var(--accent));
  border: none; border-radius: var(--r-pill); cursor: pointer; transition: all 0.2s;
}
.btn-primary:active { transform: scale(.96); }
.btn-ghost {
  display: block; width: 100%; padding: 13px 0; font-size: 15px; font-weight: 600;
  color: var(--text); background: transparent; border: 1px solid var(--line);
  border-radius: var(--r-pill); cursor: pointer; transition: all 0.2s;
}
.btn-ghost:active { transform: scale(.96); }
.is-hidden { display: none !important; }
