/* ============================================
   太空冒险游戏厅 — 共享样式表
   ============================================ */

/* --- CSS 自定义属性（主题色） --- */
:root {
  --color-bg: #0f0a2e;
  --color-bg-card: rgba(255, 255, 255, 0.06);
  --color-bg-glass: rgba(255, 255, 255, 0.08);
  --color-primary: #6366f1;
  --color-accent: #a855f7;
  --color-cyan: #06b6d4;
  --color-text: #e2e8f0;
  --color-text-dim: #94a3b8;
  --color-border: rgba(255, 255, 255, 0.12);
  --radius: 16px;
  --radius-sm: 10px;
  --shadow-card: 0 8px 32px rgba(0, 0, 0, 0.4);
  --transition: 0.25s ease;
}

/* --- 全局重置 --- */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", "Helvetica Neue", sans-serif;
  background: linear-gradient(135deg, #0f0a2e 0%, #1a1040 50%, #0d1b3e 100%);
  color: var(--color-text);
  min-height: 100vh;
  line-height: 1.6;
  padding: 20px;
}

/* --- 容器 --- */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 16px;
}

/* --- 渐变标题 --- */
.gradient-title {
  font-size: 2.8rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--color-primary), var(--color-accent), var(--color-cyan));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  text-align: center;
  margin-bottom: 8px;
  letter-spacing: -0.02em;
}

.subtitle {
  text-align: center;
  color: var(--color-text-dim);
  font-size: 1.1rem;
  margin-bottom: 32px;
}

/* --- 导航栏 --- */
.nav-bar {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 40px;
}

.nav-bar a {
  color: var(--color-text-dim);
  text-decoration: none;
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  background: var(--color-bg-glass);
  border: 1px solid var(--color-border);
  font-size: 0.95rem;
  transition: all var(--transition);
}

.nav-bar a:hover {
  color: var(--color-text);
  background: rgba(99, 102, 241, 0.2);
  border-color: var(--color-primary);
  transform: translateY(-2px);
}

/* --- 卡片网格 --- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
  margin: 24px 0;
}

/* --- 卡片 --- */
.card {
  background: var(--color-bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 28px 24px;
  box-shadow: var(--shadow-card);
  transition: all var(--transition);
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  display: block;
}

.card:hover {
  transform: translateY(-6px);
  border-color: var(--color-primary);
  box-shadow: 0 12px 40px rgba(99, 102, 241, 0.25);
}

.card:active {
  transform: translateY(-2px) scale(0.98);
}

.card-icon {
  font-size: 2.4rem;
  margin-bottom: 12px;
}

.card h3 {
  font-size: 1.3rem;
  margin-bottom: 8px;
  color: var(--color-text);
}

.card p {
  color: var(--color-text-dim);
  font-size: 0.95rem;
  line-height: 1.5;
}

/* --- 按钮 --- */
.btn {
  display: inline-block;
  padding: 12px 28px;
  border-radius: var(--radius-sm);
  border: none;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  text-align: center;
}

.btn-primary {
  background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
  color: #fff;
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.35);
}

.btn-primary:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.5);
}

.btn-primary:active {
  transform: translateY(-1px) scale(0.97);
}

.btn-ghost {
  background: transparent;
  color: var(--color-text);
  border: 1px solid var(--color-border);
}

.btn-ghost:hover {
  border-color: var(--color-primary);
  background: rgba(99, 102, 241, 0.1);
}

/* --- 游戏容器 --- */
.game-wrapper {
  max-width: 700px;
  margin: 0 auto;
  text-align: center;
}

.game-canvas {
  display: block;
  margin: 20px auto;
  border-radius: var(--radius);
  border: 1px solid var(--color-border);
  background: #0a0720;
  max-width: 100%;
}

/* --- 游戏 HUD (分数/生命) --- */
.game-hud {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 20px;
  background: var(--color-bg-glass);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  font-size: 1.1rem;
}

.game-hud .score,
.game-hud .lives {
  font-weight: 700;
}

.game-hud .score span,
.game-hud .lives span {
  color: var(--color-accent);
}

/* --- 游戏结束遮罩 --- */
.game-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}

.game-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.game-overlay .overlay-box {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 40px;
  text-align: center;
  max-width: 400px;
  width: 90%;
}

.game-overlay .overlay-box h2 {
  font-size: 1.8rem;
  margin-bottom: 12px;
}

.game-overlay .overlay-box p {
  color: var(--color-text-dim);
  margin-bottom: 20px;
}

/* --- 返回首页链接 --- */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--color-text-dim);
  text-decoration: none;
  font-size: 0.95rem;
  margin-bottom: 20px;
  transition: color var(--transition);
}

.back-link:hover {
  color: var(--color-primary);
}

/* --- 页脚 --- */
footer {
  text-align: center;
  padding: 32px 0 16px;
  color: var(--color-text-dim);
  font-size: 0.85rem;
  border-top: 1px solid var(--color-border);
  margin-top: 48px;
}

/* --- 响应式 --- */
@media (max-width: 640px) {
  body { padding: 12px; }
  .gradient-title { font-size: 1.8rem; }
  .card-grid { grid-template-columns: 1fr; }
  .game-hud { flex-direction: column; gap: 8px; }
}
