/* ============================================
   矿井逃生 — 共享样式表
   暗色工业风 · 高对比警示色 · 响应式
   ============================================ */

/* --- CSS 自定义属性（主题色） --- */
:root {
  --color-bg: #0a0e14;
  --color-bg-card: #141a22;
  --color-bg-hover: #1c2430;
  --color-primary: #f59e0b;
  --color-primary-glow: #fbbf24;
  --color-danger: #ef4444;
  --color-danger-glow: #f87171;
  --color-success: #22c55e;
  --color-text: #e2e8f0;
  --color-text-dim: #94a3b8;
  --color-border: #2a3342;
  --color-accent: #06b6d4;
  --shadow-card: 0 4px 20px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 30px rgba(245, 158, 11, 0.3);
  --radius: 12px;
  --radius-sm: 8px;
  --transition: 0.25s ease;
}

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

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, var(--color-bg) 0%, #111827 50%, var(--color-bg) 100%);
  color: var(--color-text);
  min-height: 100vh;
  line-height: 1.6;
  padding: 20px;
}

/* --- 渐变标题 --- */
.gradient-title {
  font-size: 2.2rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--color-primary), var(--color-danger), var(--color-accent));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 0.5rem;
}

.gradient-title-sm {
  font-size: 1.5rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--color-primary), var(--color-danger));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 0.4rem;
}

/* --- 导航栏 --- */
.nav-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 20px;
  background: rgba(20, 26, 34, 0.85);
  backdrop-filter: blur(10px);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.nav-bar .logo {
  font-weight: 800;
  font-size: 1.1rem;
  color: var(--color-primary);
  text-decoration: none;
  margin-right: auto;
}

.nav-bar a {
  color: var(--color-text-dim);
  text-decoration: none;
  font-size: 0.9rem;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
}

.nav-bar a:hover {
  color: var(--color-text);
  background: var(--color-bg-hover);
}

.nav-bar a.active {
  color: var(--color-primary);
  background: rgba(245, 158, 11, 0.1);
}

/* --- 卡片 --- */
.card {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-card);
  transition: all var(--transition);
}

.card:hover {
  border-color: var(--color-primary);
  box-shadow: var(--shadow-card), var(--shadow-glow);
  transform: translateY(-2px);
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
  margin: 20px 0;
}

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

.btn-primary {
  background: linear-gradient(135deg, var(--color-primary), #d97706);
  color: #000;
  box-shadow: 0 0 20px rgba(245, 158, 11, 0.2);
}

.btn-primary:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 0 30px rgba(245, 158, 11, 0.4);
}

.btn-primary:active {
  transform: translateY(0) scale(0.98);
}

.btn-danger {
  background: linear-gradient(135deg, var(--color-danger), #b91c1c);
  box-shadow: 0 0 20px rgba(239, 68, 68, 0.2);
}

.btn-danger:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 0 30px rgba(239, 68, 68, 0.4);
}

.btn-danger:active {
  transform: translateY(0) scale(0.98);
}

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

.btn-ghost:hover {
  background: var(--color-bg-hover);
  color: var(--color-text);
  border-color: var(--color-primary);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

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

/* --- 游戏画布容器 --- */
.canvas-wrapper {
  position: relative;
  border: 2px solid var(--color-border);
  border-radius: var(--radius);
  overflow: hidden;
  margin: 16px 0;
  background: #000;
}

.canvas-wrapper canvas {
  display: block;
  width: 100%;
  height: auto;
}

/* --- 状态条（HUD） --- */
.hud {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 20px;
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  margin: 12px 0;
  flex-wrap: wrap;
  gap: 8px;
}

.hud-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.9rem;
  color: var(--color-text-dim);
}

.hud-item .value {
  color: var(--color-primary);
  font-weight: 700;
  font-size: 1.1rem;
}

.hud-item .value.danger {
  color: var(--color-danger);
  animation: pulse 1s infinite;
}

/* --- 动画 --- */
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  10%, 30%, 50%, 70%, 90% { transform: translateX(-4px); }
  20%, 40%, 60%, 80% { transform: translateX(4px); }
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes glowPulse {
  0%, 100% { box-shadow: 0 0 10px rgba(245, 158, 11, 0.2); }
  50% { box-shadow: 0 0 30px rgba(245, 158, 11, 0.6); }
}

@keyframes confettiFall {
  0% { transform: translateY(0) rotate(0deg); opacity: 1; }
  100% { transform: translateY(110vh) rotate(720deg); opacity: 0; }
}

.shake {
  animation: shake 0.4s ease;
}

.fade-in {
  animation: fadeIn 0.5s ease forwards;
}

/* --- 爆炸遮罩 --- */
.explosion-overlay {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle, #fff 0%, #f59e0b 20%, #ef4444 50%, #000 80%);
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.1s ease;
}

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

.explosion-overlay h1 {
  font-size: 4rem;
  color: #fff;
  text-shadow: 0 0 40px rgba(255, 255, 255, 0.8);
  animation: shake 0.3s ease infinite;
}

/* --- 响应式 --- */
@media (max-width: 600px) {
  body { padding: 12px; }
  .gradient-title { font-size: 1.6rem; }
  .gradient-title-sm { font-size: 1.2rem; }
  .card-grid { grid-template-columns: 1fr; }
  .nav-bar { padding: 10px 14px; }
  .nav-bar a { font-size: 0.8rem; padding: 4px 10px; }
  .btn { padding: 10px 20px; font-size: 0.9rem; }
  .hud { flex-direction: column; align-items: stretch; }
  .explosion-overlay h1 { font-size: 2.5rem; }
}

/* --- 工具类 --- */
.text-center { text-align: center; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-2 { margin-bottom: 16px; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.gap-2 { gap: 12px; }

/* --- 登录弹窗 --- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal-box {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  width: 90%;
  max-width: 400px;
  box-shadow: var(--shadow-card);
  animation: fadeIn 0.2s ease;
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--color-border);
}
.modal-header h2 {
  font-size: 1.1rem;
  color: var(--color-primary);
}
.modal-close {
  color: var(--color-text-dim);
  transition: color var(--transition);
}
.modal-close:hover {
  color: var(--color-text);
}
.modal-body {
  padding: 20px;
}
.account-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  cursor: pointer;
  transition: all var(--transition);
  color: var(--color-text);
}
.account-item:hover {
  border-color: var(--color-primary);
  background: var(--color-bg-hover);
}
