/* =========================
   未来科技主题（霓虹蓝 · 均衡）
   说明：
   - 仅视觉增强，不改变DOM结构
   - 统一CSS变量：色彩/发光/圆角/动效时长
   - Modal 兼容多种显隐类：.show/.open/.active
   - GPU友好：transform/opacity，尽量避免重排
   ========================= */

/* 主题令牌 */
:root {
  /* 色板 */
  --bg-0: #080b16;         /* 深空底色 */
  --bg-1: #0d1224;         /* 次级底色 */
  --card: rgba(18, 25, 50, 0.5);  /* 玻璃卡片 */
  --stroke: rgba(120, 200, 255, 0.15);

  --txt-1: #e6f1ff;
  --txt-2: #a8c1ff;
  --muted: #7d8db3;

  --primary: #00e5ff;      /* 霓虹蓝青 */
  --primary-2: #3b82f6;    /* 高亮蓝 */
  --accent: #9d4dff;       /* 品紫高光 */
  --danger: #ff5c93;
  --success: #31e28a;
  --warning: #ffd166;

  /* 发光与阴影 */
  --glow-soft: 0 0 10px rgba(0, 229, 255, 0.35), 0 0 24px rgba(59, 130, 246, 0.25);
  --glow-strong: 0 0 12px rgba(0, 229, 255, 0.6), 0 0 32px rgba(59, 130, 246, 0.5), 0 0 64px rgba(157, 77, 255, 0.35);
  --inner-glow: inset 0 0 16px rgba(0, 229, 255, 0.25);
  --shadow-card: 0 8px 32px rgba(0, 0, 0, 0.35);

  /* 玻璃与圆角 */
  --blur: 12px;
  --radius-xs: 8px;
  --radius-sm: 12px;
  --radius-md: 25px;
  --radius-lg: 20px;
  --radius-pill: 999px;

  /* 动效节奏（8pt节奏） */
  --t-fast: 80ms;
  --t-mid: 160ms;
  --t-slow: 240ms;
  --bezier: cubic-bezier(.2, .8, .2, 1);

  /* 边框 */
  --bd-1: 1px solid rgba(120, 200, 255, 0.18);
  --bd-2: 1px solid rgba(120, 200, 255, 0.28);

  /* 棋盘网格参数 */
  --grid-cells: 9; /* 典型9x9，可按需调整 */
  --grid-line-color: rgba(0, 229, 255, 0.22);
  --grid-line-color-strong: rgba(59, 130, 246, 0.35);

  /* 性能档位（均衡为默认强度） */
  --fx-blur: var(--blur);
  --fx-glow: var(--glow-soft);
  --fx-glow-strong: var(--glow-strong);
}

/* 可选档位：低/高（后续可通过给body加 data-fx 属性启用） */
body[data-fx="low"] {
  --fx-blur: 6px;
  --fx-glow: 0 0 8px rgba(0, 229, 255, 0.25);
  --fx-glow-strong: 0 0 16px rgba(59, 130, 246, 0.35);
}
body[data-fx="high"] {
  --fx-blur: 16px;
  --fx-glow: 0 0 12px rgba(0, 229, 255, 0.5), 0 0 28px rgba(59, 130, 246, 0.45);
  --fx-glow-strong: 0 0 16px rgba(0, 229, 255, 0.75), 0 0 40px rgba(59, 130, 246, 0.6), 0 0 72px rgba(157, 77, 255, 0.5);
}

/* 基础重置与排版 */
* { box-sizing: border-box; }
html, body {
  height: 100%;
}
html {
  -webkit-tap-highlight-color: transparent;
}
body {
  margin: 0;
  color: var(--txt-1);
  background:
    radial-gradient(1200px 800px at 20% -10%, rgba(0, 229, 255, 0.08), transparent 60%),
    radial-gradient(1000px 700px at 110% 10%, rgba(157, 77, 255, 0.06), transparent 60%),
    linear-gradient(180deg, var(--bg-0), var(--bg-1));
  font-family: 'PixelFont';
  letter-spacing: .2px;
}

body.game-page {
  overflow: hidden; /* 禁止游戏主页面滚动 */
  display: flex;
  justify-content: center;
  /* margin-top: 10px; */
  min-height: 100vh;
}

/* 通用工具类 */
.glass {
  background: var(--card);
  backdrop-filter: blur(var(--fx-blur));
  -webkit-backdrop-filter: blur(var(--fx-blur));
  border: var(--bd-1);
  box-shadow: var(--shadow-card);
}
.neon {
  box-shadow: var(--fx-glow);
}
.neon-strong {
  box-shadow: var(--fx-glow-strong);
}

/* 布局：容器 */
.game-container {
  width: calc(100% - 20px);
  max-width: 450px;
  margin: 10px auto 80px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* 信息面板（左侧） */
.glass-card {
  /* 复用玻璃卡片质感 */
  background: linear-gradient(180deg, rgba(18, 25, 50, 0.6), rgba(12, 18, 36, 0.55));
  backdrop-filter: blur(var(--fx-blur));
  -webkit-backdrop-filter: blur(var(--fx-blur));
  border: var(--bd-2);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-card), inset 0 0 0 1px rgba(255,255,255,0.02);
}

.info-panel {
  padding: 16px;
}

.info-grid {
  display: flex;
  flex-direction: column-reverse; /* Score row on top, next-bead row on bottom */
  gap: 10px;
}

.top-row, .game-stats {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* 下一步珠子预览 */
.next-beads {
  flex-grow: 1;
  height: 46px;
  border-radius: var(--radius-sm);
  background: linear-gradient(180deg, rgba(11,18,36,0.85), rgba(10,14,28,0.85));
  border: 1px solid rgba(120, 200, 255, 0.32);
  display: flex;
  justify-content: center;
  align-items: center;
}
.next-beads .bead-preview {
  display: flex;
}
.next-beads .bead {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  position: relative;
  vertical-align: middle; /* 确保canvas对齐 */
}

/* 新游戏按钮 */
#newGameBtn {
  -webkit-appearance: none;
  width: 100px; 
  padding: 0;
  color: var(--primary);
  font-size: 20px;
  appearance: none;
  border: var(--bd-1);
  background: linear-gradient(180deg, rgba(22, 30, 60, 0.7), rgba(16, 22, 42, 0.6));
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform var(--t-fast) var(--bezier), box-shadow var(--t-fast), background var(--t-fast);
  will-change: transform;
}
#newGameBtn img {
  height: 30px;
  width: auto;
  filter: drop-shadow(0 0 8px rgba(0,229,255,0.25));
}
#newGameBtn:hover { transform: translateY(-1px); box-shadow: var(--fx-glow-strong); }
#newGameBtn:active { transform: translateY(0); }

/* 分数显示 */
.game-stats .score input#score {
  height: 46px;
  width: 100%; /* 宽度自适应 */
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: linear-gradient(180deg, rgba(11,18,36,0.85), rgba(10,14,28,0.85));
  color: var(--primary);
  font-weight: 700;
  font-size: 22px;
  letter-spacing: 1px;
  border: 1px solid rgba(120, 200, 255, 0.32);
  outline: none;
  text-align: right;
}

#soundBtn {
  border-radius: 25px;
  margin-left: 0; /* Reset margin */
}

/* 控制按钮（排行榜/统计/帮助） */
.button-controls {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}
.control-btn {
  -webkit-appearance: none;
  appearance: none;
  min-width: 46px;
  height: 46px;
  border-radius: 12px;
  border: var(--bd-1);
  background: linear-gradient(180deg, rgba(22, 30, 60, 0.7), rgba(16, 22, 42, 0.6));
  color: var(--txt-1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform var(--t-fast) var(--bezier), box-shadow var(--t-fast), background var(--t-fast);
  will-change: transform;
}
.control-btn span { font-size: 25px; filter: drop-shadow(0 0 8px rgba(0,229,255,0.25)); }
.control-btn:hover { transform: translateY(-1px); box-shadow: var(--fx-glow-strong); }
.control-btn:active { transform: translateY(0); }
.control-btn:focus-visible {
  outline: 2px solid rgba(0,229,255,0.6);
  outline-offset: 2px;
}

/* FX 档位切换 */
.fx-toggle { display: flex; gap: 8px; margin-left: 8px; }
.fx-btn.is-active { outline: 2px solid rgba(0,229,255,0.7); box-shadow: var(--fx-glow-strong); }
.fx-btn[data-fx="low"] { color: var(--muted); }
.fx-btn[data-fx="balanced"] { color: var(--primary); }
.fx-btn[data-fx="high"] { color: var(--accent); }

/* 画布（棋盘） */
#gameCanvas {
  width: 100%;
  height: auto;
  max-width: 600px;
  aspect-ratio: 1 / 1;
  display: block;
  position: relative;
  /* overflow: hidden; */
  border-radius: var(--radius-sm);
  background:
    linear-gradient(180deg, rgba(10, 16, 32, 0.85), rgba(8, 12, 24, 0.9));
  border: 1px solid rgba(120, 200, 255, 0.2);
}

/* 棋盘网格发光覆盖层 */
#gameCanvas::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background-image:
    repeating-linear-gradient(to right,
      var(--grid-line-color) 0,
      var(--grid-line-color) 2px,
      transparent 2px,
      transparent calc(100% / var(--grid-cells))
    ),
    repeating-linear-gradient(to bottom,
      var(--grid-line-color) 0,
      var(--grid-line-color) 2px,
      transparent 2px,
      transparent calc(100% / var(--grid-cells))
    );
  mix-blend-mode: screen;
  opacity: 0.75;
  transition: opacity var(--t-fast) var(--bezier);
}
#gameCanvas:hover::after { opacity: 0.85; }
body[data-fx="low"] #gameCanvas::after { opacity: 0.45; }

/* 棋盘能量背景动态层（轻量） */
#gameCanvas::before {
  content: "";
  position: absolute;
  inset: -15%;
  border-radius: inherit;
  pointer-events: none;
  background:
    radial-gradient(60% 60% at 30% 30%, rgba(0,229,255,0.06), transparent 60%),
    radial-gradient(40% 40% at 80% 20%, rgba(157,77,255,0.05), transparent 70%),
    linear-gradient(120deg, rgba(0,229,255,0.06), rgba(157,77,255,0.04), rgba(0,229,255,0.06));
  background-size: 120% 120%, 140% 140%, 200% 200%;
  animation: bgFlow 12s linear infinite;
  mix-blend-mode: screen;
  opacity: 0.5;
}
body[data-fx="low"] #gameCanvas::before { opacity: 0.25; }

@keyframes bgFlow {
  0% { background-position: 0% 0%, 100% 0%, 0% 0%; }
  100% { background-position: 100% 100%, 0% 100%, 100% 100%; }
}

/* Modal 遮罩与内容 */
.modal {
  position: fixed;
  inset: 0;
  padding: 5px;
  display: none;                /* 默认隐藏 */
  align-items: center;
  justify-content: center;
  background: radial-gradient(60% 60% at 50% 50%, rgba(4, 8, 16, 0.6), rgba(4, 8, 16, 0.85));
  z-index: 1000;
}
.modal.show,
.modal.open,
.modal.active {
  display: flex;                /* 兼容多种控制方式 */
  animation: fadeIn var(--t-mid) var(--bezier);
}
.modal.show .modal-content,
.modal.open .modal-content,
.modal.active .modal-content {
  animation: modalIn var(--t-mid) var(--bezier);
}
@keyframes fadeIn {
  from { opacity: 0 }
  to { opacity: 1 }
}
@keyframes modalIn {
  from { transform: translateY(8px) scale(.98); opacity: 0 }
  to { transform: translateY(0) scale(1); opacity: 1 }
}
.modal-content {
  max-height: 85vh;
  width: calc(100% - 10px);
  max-width: 450px;
  padding: 18px;
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.modal-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 6px 14px;
  border-bottom: 1px dashed rgba(120, 200, 255, 0.25);
  flex-shrink: 0;
}
.modal-title {
  margin: 0;
  font-size: 20px;
  letter-spacing: .5px;
  color: var(--txt-1);
  text-shadow: 0 0 10px rgba(0,229,255,0.25);
}
.modal-close {
  position: absolute;
  right: 12px;
  top: 10px;
  cursor: pointer;
  user-select: none;
  padding: 6px 8px;
  border-radius: 10px;
  border: var(--bd-1);
  background: linear-gradient(180deg, rgba(22, 30, 60, 0.55), rgba(16, 22, 42, 0.5));
  box-shadow: var(--fx-glow);
  transition: transform var(--t-fast) var(--bezier), box-shadow var(--t-fast);
}
.modal-close:hover { transform: translateY(-1px); box-shadow: var(--fx-glow-strong); }

.modal-body,
.confirm-modal-body {
  color: var(--txt-2);
  white-space: pre-line; /* 保留换行，优化规则文本可读性 */
}

.gameovermodal-body {
  color: var(--txt-2);
  white-space: pre-line;
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none; /* 隐藏 Firefox 滚动条 */
  -ms-overflow-style: none; /* 隐藏 IE/Edge 滚动条 */
  margin-bottom: 16px;
}

.gameovermodal-body::-webkit-scrollbar {
  display: none; /* 隐藏 Webkit 滚动条 */
}

/* 统计列表排版（游戏统计） */
.game-over-stats {
  display: grid;
  gap: 10px;
}
.stat-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px dashed rgba(120, 200, 255, 0.25);
  background: linear-gradient(180deg, rgba(18, 25, 50, 0.35), rgba(12, 18, 36, 0.25));
}
.stat-label { color: var(--muted); }
.stat-value { color: var(--primary); font-weight: 700; text-shadow: 0 0 8px rgba(0,229,255,.25); }

/* 统计页 · 指标条形可视化 */
.stat-bar {
  position: relative;
  height: 6px;
  border-radius: 999px;
  margin-top: 8px;
  background: linear-gradient(180deg, rgba(18,25,50,.6), rgba(12,18,36,.5));
  border: 1px solid rgba(120,200,255,.18);
  overflow: hidden;
}
.stat-bar__fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: var(--w, 0%);
  background: linear-gradient(90deg, rgba(0,229,255,.65), rgba(59,130,246,.65), rgba(157,77,255,.5));
  box-shadow: 0 0 12px rgba(0,229,255,.35);
  border-right: 1px solid rgba(255,255,255,.25);
  transition: width var(--t-mid) var(--bezier);
}
body[data-fx="low"] .stat-bar__fill {
  background: linear-gradient(90deg, rgba(0,229,255,.5), rgba(59,130,246,.5));
  box-shadow: 0 0 8px rgba(0,229,255,.25);
}

/* 排行榜列表 */
#highScoresList {
  font-family:'PixelFont';
  margin: 10px 0 2px;
  padding: 0 2px 8px 24px; /* 保留有序列表计数 */
  line-height: 1.7;
}
#highScoresList li {
  padding: 8px 12px;
  margin: 8px 0;
  list-style: decimal;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(120, 200, 255, 0.22);
  background: linear-gradient(180deg, rgba(18, 25, 50, 0.35), rgba(12, 18, 36, 0.25));
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.02);
}

/* 排行榜增强样式（名次徽章 + 卡片化布局） */
#rankModal #highScoresList { list-style: none; padding-left: 0; }
#rankModal #highScoresList li { 
  list-style: none; 
  display: grid; 
  grid-template-columns: 56px 1fr auto; 
  align-items: center; 
  gap: 12px; 
  transition: transform var(--t-fast) var(--bezier), box-shadow var(--t-fast);
}
#rankModal #highScoresList li .rank {
  width: 44px; height: 44px; border-radius: 50%;
  display: grid; place-items: center;
  position: relative;
  font-weight: 800; font-size: 16px; letter-spacing: .5px;
  color: var(--txt-1);
  background: linear-gradient(180deg, rgba(18,25,50,.7), rgba(12,18,36,.55));
  border: var(--bd-2);
  box-shadow: var(--fx-glow);
}
#rankModal #highScoresList li:nth-child(1) .rank {
  box-shadow: 0 0 14px rgba(255,215,0,.5), 0 0 30px rgba(255,215,0,.25);
  color: #fff59d;
}
#rankModal #highScoresList li:nth-child(2) .rank {
  box-shadow: 0 0 14px rgba(180,200,255,.5), 0 0 30px rgba(180,200,255,.25);
  color: #dbeafe;
}
#rankModal #highScoresList li:nth-child(3) .rank {
  box-shadow: 0 0 14px rgba(255,180,120,.5), 0 0 30px rgba(255,180,120,.25);
  color: #ffe0b2;
}
#rankModal #highScoresList li .score {
  font-size: 22px; font-weight: 800; color: var(--accent);
  text-shadow: 0 0 10px rgba(0,229,255,.25);
}
#rankModal #highScoresList li .time-container {
  text-align: right; color: var(--muted); font-size: 12px;
}
#rankModal #highScoresList li .time-container .date { opacity: .9; }
#rankModal #highScoresList li .time-container .time { opacity: .8; }

/* 前三名小图标（冠/银/铜） */
#rankModal #highScoresList li .rank::after {
  content: "";
  position: absolute;
  right: -6px; top: -6px;
  width: 20px; height: 20px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 14px; line-height: 1;
  background: radial-gradient(50% 50% at 50% 50%, rgba(255,255,255,.15), rgba(0,0,0,.0));
  box-shadow: 0 0 10px rgba(0,229,255,.35);
  pointer-events: none;
}
#rankModal #highScoresList li:nth-child(1) .rank::after { content: "👑"; text-shadow: 0 0 8px rgba(255,215,0,.6); }
#rankModal #highScoresList li:nth-child(2) .rank::after { content: "🥈"; text-shadow: 0 0 8px rgba(180,200,255,.6); }
#rankModal #highScoresList li:nth-child(3) .rank::after { content: "🥉"; text-shadow: 0 0 8px rgba(255,180,120,.6); }

#rankModal #highScoresList li:hover { 
  transform: translateY(-1px); 
  box-shadow: var(--fx-glow-strong), inset 0 0 0 1px rgba(255,255,255,0.03);
}

/* Modal 按钮 */
.modal-btn {
  -webkit-appearance: none;
  appearance: none;
  border: var(--bd-2);
  background: linear-gradient(180deg, rgba(18, 25, 50, 0.7), rgba(12, 18, 36, 0.55));
  color: var(--txt-1);
  border-radius: var(--radius-pill);
  padding: 10px 18px;
  margin-top: 12px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  transition: transform var(--t-fast) var(--bezier), box-shadow var(--t-fast), background var(--t-fast);
  box-shadow: var(--fx-glow);
}
.modal-btn:hover { transform: translateY(-1px); box-shadow: var(--fx-glow-strong); }
.modal-buttons {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  flex-shrink: 0;
  margin-top: auto;
}
.modal-btn.cancel {
  border-color: rgba(120,200,255,0.18);
  color: var(--muted);
}



/* ===== 认证表单样式 ===== */
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin: 16px 0;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-family: 'PixelFont';
  font-size: 14px;
  color: var(--txt-1);
  text-shadow: 0 0 6px rgba(0, 229, 255, 0.3);
}

.form-input {
  padding: 10px 12px;
  font-family: 'PixelFont';
  font-size: 14px;
  border: 1px solid rgba(120, 200, 255, 0.3);
  border-radius: var(--radius-sm);
  background: linear-gradient(180deg, rgba(22, 30, 60, 0.4), rgba(16, 22, 42, 0.3));
  color: var(--txt-1);
  transition: all 0.3s ease;
}

.form-input:focus {
  outline: none;
  border-color: rgba(120, 200, 255, 0.6);
  box-shadow: 0 0 12px rgba(0, 229, 255, 0.3);
  background: linear-gradient(180deg, rgba(22, 30, 60, 0.6), rgba(16, 22, 42, 0.5));
}

.form-input::placeholder {
  color: var(--muted);
  opacity: 0.7;
}

.auth-submit-btn {
  padding: 12px 20px;
  font-family: 'PixelFont';
  font-size: 16px;
  border: 1px solid rgba(120, 200, 255, 0.4);
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.3), rgba(139, 92, 246, 0.3));
  color: var(--txt-1);
  cursor: pointer;
  transition: all 0.3s ease;
  text-shadow: 0 0 6px rgba(0, 229, 255, 0.3);
  margin-top: 8px;
}

.auth-submit-btn:hover {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.5), rgba(139, 92, 246, 0.5));
  border-color: rgba(120, 200, 255, 0.6);
  box-shadow: 0 0 16px rgba(0, 229, 255, 0.4);
  transform: translateY(-1px);
}

.auth-submit-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.auth-switch {
  text-align: center;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px dashed rgba(120, 200, 255, 0.25);
}

.auth-switch-text {
  font-family: 'PixelFont';
  font-size: 14px;
  color: var(--txt-2);
  margin-bottom: 8px;
}

.auth-switch-link {
  font-family: 'PixelFont';
  font-size: 14px;
  color: rgba(120, 200, 255, 0.8);
  cursor: pointer;
  text-decoration: underline;
  transition: color 0.3s ease;
}

.auth-switch-link:hover {
  color: rgba(120, 200, 255, 1);
  text-shadow: 0 0 8px rgba(0, 229, 255, 0.4);
}

.auth-error {
  padding: 8px 12px;
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.2), rgba(220, 38, 38, 0.2));
  border: 1px solid rgba(239, 68, 68, 0.4);
  border-radius: var(--radius-sm);
  color: var(--txt-1);
  font-family: 'PixelFont';
  font-size: 12px;
  text-align: center;
  margin-bottom: 12px;
}

.auth-success {
  padding: 8px 12px;
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.2), rgba(16, 185, 129, 0.2));
  border: 1px solid rgba(34, 197, 94, 0.4);
  border-radius: var(--radius-sm);
  color: var(--txt-1);
  font-family: 'PixelFont';
  font-size: 12px;
  text-align: center;
  margin-bottom: 12px;
}

/* 可访问性与细节 */
:focus-visible {
  outline: 2px solid rgba(0,229,255,0.6);
  outline-offset: 2px;
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* 小装饰：轻呼吸与能量脉冲（后续组件可复用） */
@keyframes breathe {
  0%, 100% { filter: drop-shadow(0 0 6px rgba(0,229,255,0.25)); }
  50% { filter: drop-shadow(0 0 10px rgba(0,229,255,0.45)); }
}
@keyframes pulse {
  0% { box-shadow: var(--fx-glow); }
  50% { box-shadow: var(--fx-glow-strong); }
  100% { box-shadow: var(--fx-glow); }
}

/* ===== 结算页 · 动效与样式（增强版） ===== */
.go-enter { animation: goEnter var(--t-mid) var(--bezier); }
@keyframes goEnter {
  from { transform: translateY(8px) scale(.98); opacity: 0 }
  to { transform: translateY(0) scale(1); opacity: 1 }
}

/* 增强的游戏结束包装器 */
.gameover-wrap-enhanced {
  display: grid;
  gap: 16px;
  padding: 6px;
}

/* 结果头部重新设计 */
.result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 12px;
  background: linear-gradient(135deg, 
    rgba(18, 25, 50, 0.8) 0%, 
    rgba(12, 18, 36, 0.6) 50%, 
    rgba(18, 25, 50, 0.8) 100%);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(120, 200, 255, 0.3);
  box-shadow: 
    var(--fx-glow),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

/* 增强的评级徽章设计 */
.grade-ring-enhanced {
  position: relative;
  width: 90px;
  height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--grade-bg, linear-gradient(145deg, #64748b, #475569));
  border: 3px solid var(--grade-border, #64748b);
  box-shadow: 
    0 0 20px var(--grade-glow, rgba(100, 116, 139, 0.4)),
    inset 0 2px 4px rgba(255, 255, 255, 0.2),
    inset 0 -2px 4px rgba(0, 0, 0, 0.3);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

.grade-ring-enhanced::before {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  background: conic-gradient(
    from 0deg,
    var(--grade-glow, rgba(100, 116, 139, 0.6)) 0deg,
    transparent 90deg,
    transparent 270deg,
    var(--grade-glow, rgba(100, 116, 139, 0.6)) 360deg
  );
  animation: rotate 3s linear infinite;
  z-index: -1;
}

@keyframes rotate {
  to { transform: rotate(360deg); }
}

.grade-inner {
  text-align: center;
  z-index: 2;
}

.grade-ring-enhanced .grade-text {
  display: block;
  font-weight: 900;
  font-size: 32px;
  color: #fff;
  text-shadow: 
    0 0 10px var(--grade-glow, rgba(100, 116, 139, 0.8)),
    0 2px 4px rgba(0, 0, 0, 0.6);
  line-height: 1;
}

.grade-sub {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.8);
  font-weight: 600;
  margin-top: 2px;
  letter-spacing: 0.5px;
}

.grade-glow {
  position: absolute;
  inset: 10px;
  border-radius: 50%;
  background: radial-gradient(
    circle at center,
    var(--grade-glow, rgba(100, 116, 139, 0.3)) 0%,
    transparent 70%
  );
  animation: breathe 2s ease-in-out infinite;
}

@keyframes breathe {
  0%, 100% { opacity: 0.6; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.05); }
}

/* S级 - 传奇金色 */
.grade-ring-enhanced[data-grade="S"] {
  --grade-bg: linear-gradient(145deg, #ffd700, #ffb300, #ff8f00);
  --grade-border: #ffc107;
  --grade-glow: rgba(255, 193, 7, 0.8);
}

/* A级 - 精英银色 */
.grade-ring-enhanced[data-grade="A"] {
  --grade-bg: linear-gradient(145deg, #e3f2fd, #bbdefb, #90caf9);
  --grade-border: #2196f3;
  --grade-glow: rgba(33, 150, 243, 0.8);
}

.grade-ring-enhanced[data-grade="A"] .grade-text {
  color: #1565c0;
  text-shadow: 
    0 0 10px rgba(33, 150, 243, 0.6),
    0 1px 2px rgba(255, 255, 255, 0.8);
}

/* B级 - 卓越铜色 */
.grade-ring-enhanced[data-grade="B"] {
  --grade-bg: linear-gradient(145deg, #ff8a65, #ff5722, #d84315);
  --grade-border: #ff5722;
  --grade-glow: rgba(255, 87, 34, 0.8);
}

/* C级 - 稳定灰色 */
.grade-ring-enhanced[data-grade="C"] {
  --grade-bg: linear-gradient(145deg, #90a4ae, #607d8b, #455a64);
  --grade-border: #607d8b;
  --grade-glow: rgba(96, 125, 139, 0.8);
}

.grade-ring-enhanced:hover {
  transform: translateY(-2px) scale(1.05);
  box-shadow: 
    0 0 30px var(--grade-glow, rgba(100, 116, 139, 0.6)),
    inset 0 2px 4px rgba(255, 255, 255, 0.3),
    inset 0 -2px 4px rgba(0, 0, 0, 0.2);
}

/* 分数区域 */
.score-section {
  text-align: right;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.final-score {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

.score-label {
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
  letter-spacing: 0.5px;
}

.new-record-badge {
  padding: 4px 12px;
  background: linear-gradient(145deg, 
    rgba(255, 215, 0, 0.2), 
    rgba(255, 193, 7, 0.1));
  border: 1px solid rgba(255, 193, 7, 0.4);
  border-radius: var(--radius-pill);
  color: #ffc107;
  font-size: 11px;
  font-weight: 700;
  text-shadow: 0 0 8px rgba(255, 193, 7, 0.3);
  animation: newRecordGlow 2s ease-in-out infinite;
}

@keyframes newRecordGlow {
  0%, 100% { box-shadow: 0 0 10px rgba(255, 193, 7, 0.3); }
  50% { box-shadow: 0 0 20px rgba(255, 193, 7, 0.6); }
}

/* 奖励区域 */
.rewards-section {
  text-align: center;
}

.rewards-list {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.reward-badge {
  font-size: 13px;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(120, 200, 255, 0.3);
  background: linear-gradient(135deg, 
    rgba(18, 25, 50, 0.8), 
    rgba(12, 18, 36, 0.6));
  color: var(--primary);
  font-weight: 600;
  box-shadow: 
    var(--fx-glow),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  transition: all 0.3s ease;
}

.reward-badge:hover {
  transform: translateY(-1px);
  box-shadow: var(--fx-glow-strong);
}

.reward-badge.muted {
  color: var(--muted);
  border-color: rgba(120, 200, 255, 0.15);
  background: linear-gradient(135deg, 
    rgba(18, 25, 50, 0.4), 
    rgba(12, 18, 36, 0.3));
  box-shadow: none;
}

/* 统计网格 */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 8px;
}

.stat-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: linear-gradient(135deg, 
    rgba(18, 25, 50, 0.7), 
    rgba(12, 18, 36, 0.5));
  border: 1px solid rgba(120, 200, 255, 0.2);
  border-radius: var(--radius-sm);
  box-shadow: 
    var(--fx-glow),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
  transition: all 0.3s ease;
}

.stat-card:hover {
  transform: translateY(-1px);
  box-shadow: var(--fx-glow-strong);
  border-color: rgba(120, 200, 255, 0.35);
}

.stat-card.primary {
  border-color: rgba(0, 229, 255, 0.4);
  background: linear-gradient(135deg, 
    rgba(0, 229, 255, 0.1), 
    rgba(18, 25, 50, 0.7));
}

.stat-card.accent {
  border-color: rgba(157, 77, 255, 0.4);
  background: linear-gradient(135deg, 
    rgba(157, 77, 255, 0.1), 
    rgba(18, 25, 50, 0.7));
}

.stat-icon {
  font-size: 18px;
  min-width: 20px;
  text-align: center;
  filter: drop-shadow(0 0 6px rgba(0, 229, 255, 0.3));
}

.stat-content {
  flex: 1;
  min-width: 0;
}

.stat-card .stat-value {
  display: block;
  font-size: 16px;
  font-weight: 800;
  color: var(--primary);
  text-shadow: 0 0 8px rgba(0, 229, 255, 0.3);
  line-height: 1.2;
  font-family: 'PixelFont';
}

.stat-card .stat-label {
  display: block;
  font-size: 10px;
  color: var(--muted);
  font-weight: 500;
  margin-top: 1px;
  letter-spacing: 0.3px;
}

/* 表现区域 */
.performance-section {
  display: grid;
  gap: 6px;
  padding: 12px;
  background: linear-gradient(135deg, 
    rgba(157, 77, 255, 0.1), 
    rgba(18, 25, 50, 0.6));
  border: 1px solid rgba(157, 77, 255, 0.3);
  border-radius: var(--radius-sm);
  box-shadow: 
    0 0 15px rgba(157, 77, 255, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.performance-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
}

.perf-label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}

.perf-value {
  color: var(--accent);
  font-size: 14px;
  font-weight: 700;
  text-shadow: 0 0 8px rgba(157, 77, 255, 0.3);
  font-family: 'PixelFont';
}

/* 向下兼容原有样式 */
.gameover-wrap { display: grid; gap: 14px; }
.result-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; }

/* 移动端响应式优化 */
@media (max-width: 480px) {
  .result-header {
    flex-direction: column;
    gap: 12px;
    text-align: center;
    padding: 10px;
  }
  
  .score-section {
    align-items: center;
  }
  
  .score-flip {
    font-size: 28px;
    text-align: center;
  }
  
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
  }
  
  .stat-card {
    padding: 8px 10px;
    gap: 8px;
  }
  
  .stat-card .stat-value {
    font-size: 14px;
  }
  
  .stat-icon {
    font-size: 16px;
  }
  
  .grade-ring-enhanced {
    width: 70px;
    height: 70px;
  }
  
  .grade-ring-enhanced .grade-text {
    font-size: 24px;
  }
  
  .grade-sub {
    font-size: 9px;
  }
  
  .gameover-wrap-enhanced {
    gap: 12px;
    padding: 4px;
  }
  
  .performance-section {
    padding: 10px;
  }
}

/* 极小屏幕优化 */
@media (max-width: 360px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 4px;
  }
  
  .stat-card {
    justify-content: space-between;
    padding: 6px 8px;
  }
  
  .stat-card .stat-value {
    font-size: 13px;
  }
  
  .stat-icon {
    font-size: 14px;
  }
  
  .performance-section {
    padding: 8px;
  }
  
  .grade-ring-enhanced {
    width: 60px;
    height: 60px;
  }
  
  .grade-ring-enhanced .grade-text {
    font-size: 20px;
  }
}

/* 评级徽章 (新设计) */
.grade-ring {
  width: 80px;
  height: 80px;
  position: relative;
  display: grid;
  place-items: center;
  border-radius: 50%; /* 改为圆形 */
  background: var(--grade-bg);
  border: 4px solid var(--grade-border);
  box-shadow: 
    inset 0 2px 4px rgba(255, 255, 255, 0.4), /* 内高光 */
    0 5px 10px rgba(0, 0, 0, 0.3), /* 外阴影 */
    inset 0 -2px 3px rgba(0,0,0,0.3); /* 内阴影 */
  transition: transform .3s, box-shadow .3s;
}

.grade-ring .grade-text {
  font-weight: 900;
  font-size: 36px;
  color: #fff;
  text-shadow: 
    0 0 5px var(--grade-glow),
    0 2px 3px rgba(0, 0, 0, 0.5);
}

.grade-ring:hover {
  transform: translateY(-3px) scale(1.05);
  box-shadow: 
    inset 0 2px 4px rgba(255, 255, 255, 0.4),
    0 8px 15px rgba(0, 0, 0, 0.4),
    inset 0 -2px 3px rgba(0,0,0,0.3);
}

/* 按评级着色 (新调色板) */
.grade-ring[data-grade="S"] {
  --grade-bg: linear-gradient(145deg, #ffd700, #f0c400);
  --grade-border: #ffc700;
  --grade-glow: #ffc700;
}

.grade-ring[data-grade="A"] {
  --grade-bg: linear-gradient(145deg, #c0c0c0, #a9a9a9);
  --grade-border: #b0b0b0;
  --grade-glow: #e0e0e0;
}
.grade-ring[data-grade="A"] .grade-text {
  color: #333; /* 银色背景上深色文字更好看 */
  text-shadow: 0 1px 1px rgba(255,255,255,0.7);
}

.grade-ring[data-grade="B"] {
  --grade-bg: linear-gradient(145deg, #cd7f32, #b87329);
  --grade-border: #c0722a;
  --grade-glow: #e69138;
}

.grade-ring[data-grade="C"] {
  --grade-bg: linear-gradient(145deg, #8c92ac, #71768a);
  --grade-border: #7d8296;
  --grade-glow: #aab0c4;
}

/* 分数翻牌（增强版） */
.score-flip {
  min-width: 120px;
  text-align: right;
  font-size: 36px;
  font-weight: 900;
  color: var(--primary);
  text-shadow: 
    0 0 15px rgba(0, 229, 255, 0.4),
    0 0 30px rgba(0, 229, 255, 0.2);
  animation: flipPop 600ms var(--bezier);
  font-family: 'PixelFont';
  letter-spacing: 1px;
  line-height: 1;
}

@keyframes flipPop {
  0% { 
    transform: rotateX(60deg) scale(.9);
    opacity: 0;
    filter: blur(4px);
  }
  50% { 
    transform: rotateX(0deg) scale(1.08);
    opacity: 1;
    filter: blur(0px);
  }
  100% { 
    transform: rotateX(0) scale(1);
    filter: blur(0px);
  }
}



/* 档位自适应（游戏结束界面）*/
body[data-fx="low"] .grade-ring-enhanced::before {
  animation: none;
  background: var(--grade-glow, rgba(100, 116, 139, 0.3));
}

body[data-fx="low"] .grade-glow {
  animation: none;
  opacity: 0.4;
}

body[data-fx="low"] .new-record-badge {
  animation: none;
  box-shadow: 0 0 8px rgba(255, 193, 7, 0.2);
}

body[data-fx="low"] .stat-card:hover {
  transform: none;
  box-shadow: var(--fx-glow);
}

body[data-fx="low"] .grade-ring-enhanced:hover {
  transform: none;
  box-shadow: 
    0 0 15px var(--grade-glow, rgba(100, 116, 139, 0.4)),
    inset 0 2px 4px rgba(255, 255, 255, 0.2),
    inset 0 -2px 4px rgba(0, 0, 0, 0.3);
}

/* 档位自适应 */
body[data-fx="low"] .grade-ring::before { filter: blur(4px); opacity: .45; }
body[data-fx="low"] .score-flip { text-shadow: 0 0 8px rgba(0,229,255,.2); }

/* ===== 分数与连击效果 (重构) ===== */
.score-effect, .combo-effect {
  position: fixed;
  pointer-events: none !important;
  z-index: 8888;
  font-family: 'PixelFont';
  letter-spacing: 0.02em;
  will-change: transform, opacity;
}

/* 分数效果 */
.score-effect {
  font-size: 22px;
  font-weight: 700;
  color: #ff00dd;
  animation: score-anim 2.5s ease-out;
}

@keyframes score-anim {
  0% {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
  80% {
    opacity: 1;
  }
  100% {
    transform: translateY(-30px) scale(0.9);
    opacity: 0;
  }
}

/* 连击效果 */
.combo-effect {
  font-size: 20px;
  font-weight: 700;
  color: #FF5E3A;
  animation: combo-anim 2s ease-in-out;
}

@keyframes combo-anim {
  0% {
    transform: translateY(0) scale(0.8);
    opacity: 0;
  }
  20% {
    transform: translateY(-10px) scale(1.2);
    opacity: 1;
  }
  80% {
    transform: translateY(-15px) scale(1.15);
    opacity: 1;
  }
  100% {
    transform: translateY(-20px) scale(1.1);
    opacity: 0;
  }
}

/* ===== 帮助页 · 样式与动效 ===== */
.guide-steps { display: grid; gap: 10px; }
.step-card {
  display: grid; grid-template-columns: 36px 1fr; align-items: center;
  gap: 10px; padding: 10px 12px; border-radius: var(--radius-sm);
  border: 1px dashed rgba(120,200,255,.25);
  background: linear-gradient(180deg, rgba(18,25,50,.45), rgba(12,18,36,.35));
  box-shadow: var(--fx-glow);
  transition: transform var(--t-fast) var(--bezier), box-shadow var(--t-fast);
  will-change: transform;
}
.step-card:hover { transform: translateY(-1px); box-shadow: var(--fx-glow-strong); }
.step-card .no {
  width: 28px; height: 28px; border-radius: 50%;
  display: grid; place-items: center; font-weight: 800; color: var(--txt-1);
  background: radial-gradient(60% 60% at 50% 50%, rgba(255,255,255,.18), rgba(255,255,255,0) 70%),
              linear-gradient(180deg, rgba(18,25,50,.8), rgba(12,18,36,.6));
  border: 1px solid rgba(120,200,255,.3);
  box-shadow: var(--fx-glow);
}
.step-card .txt { color: var(--txt-2); }

.guide-demo {
  margin-top: 12px; padding: 12px; border-radius: var(--radius-sm);
  border: 1px dashed rgba(120,200,255,.25);
  background: linear-gradient(180deg, rgba(18,25,50,.45), rgba(12,18,36,.35));
}
.guide-demo .mini-board {
  display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.guide-demo .dot {
  width: 12px; height: 12px; border-radius: 50%;
  border: 1px solid rgba(120,200,255,.35);
  background:
    radial-gradient(60% 60% at 35% 35%, rgba(255,255,255,.85), rgba(255,255,255,.08) 60%, rgba(255,255,255,0) 70%),
    radial-gradient(120% 120% at 70% 70%, rgba(0,229,255,.3), rgba(0,229,255,.05) 60%, transparent 70%);
  box-shadow: 0 0 8px rgba(0,229,255,.25);
}
.guide-demo .dot.c1 { background-color: #00e5ff; }
.guide-demo .dot.c2 { background-color: #3b82f6; }
.guide-demo .dot.c3 { background-color: #9d4dff; }
.guide-demo .dot.c4 { background-color: #31e28a; }
.guide-demo .dot.c5 { background-color: #ffd166; }

.guide-demo .arrow { margin: 0 8px; opacity: .85; text-shadow: 0 0 8px rgba(0,229,255,.25); }
.guide-demo .label { font-size: 12px; color: var(--primary); text-shadow: 0 0 8px rgba(0,229,255,.25); }
.guide-demo .tip { margin-top: 8px; color: var(--muted); font-size: 12px; }

details.faq {
  margin-top: 12px; border-radius: var(--radius-sm);
  border: 1px dashed rgba(120,200,255,.25);
  background: linear-gradient(180deg, rgba(18,25,50,.45), rgba(12,18,36,.35));
  padding: 8px 10px;
}
details.faq > summary {
  list-style: none; cursor: pointer; user-select: none;
  display: flex; align-items: center; gap: 8px; color: var(--txt-1);
}
details.faq > summary::-webkit-details-marker { display: none; }
details.faq > summary::before {
  content: "▸"; display: inline-block; transform: rotate(0deg);
  transition: transform var(--t-fast) var(--bezier);
  color: var(--primary);
}
details.faq[open] > summary::before { transform: rotate(90deg); }
details.faq ul { margin: 8px 0 0 18px; padding: 0; }
details.faq li { margin: 6px 0; color: var(--txt-2); }

/* 档位自适应（帮助页） */
body[data-fx="low"] .step-card { box-shadow: none; }
body[data-fx="low"] .guide-demo .dot { box-shadow: 0 0 6px rgba(0,229,255,.18); }

/* ===== 帮助页 · 统一样式 (重构) ===== */
#rulesModal .modal-content {
  max-width: 560px; /* 适当加宽以容纳内容 */
}

#rulesModal .modal-body {
  display: flex;
  flex-direction: column;
  gap: 16px; /* 统一控制各区域间距 */
}

.rules-section {
  margin-top: 0; /* 由父级 gap 控制 */
  padding: 14px 16px;
  border: 1px solid rgba(120, 200, 255, 0.2);
  border-radius: var(--radius-sm);
  background: linear-gradient(180deg, rgba(18, 25, 50, 0.4), rgba(12, 18, 36, 0.3));
}

.rules-section h3 {
  margin: 0 0 12px;
  font-size: 16px;
  font-weight: 600;
  color: var(--primary);
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(120, 200, 255, 0.25);
  text-shadow: 0 0 8px rgba(0,229,255,0.3);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* 为标题添加小图标 */
.rules-section.gameplay h3::before { content: '📖'; }
.rules-section.demo h3::before { content: '✨'; }
.rules-section.faq-section h3::before { content: '❓'; }
.rules-section.scoring h3::before { content: '🧮'; }
.rules-section h3::before {
  font-size: 18px;
  opacity: 0.8;
}


/* 玩法介绍列表 */
.rules-list {
  list-style: decimal;
  padding-left: 20px;
  margin: 0;
  color: var(--txt-2);
  line-height: 1.65;
  font-size: 14px;
}

.rules-list li {
  margin-bottom: 8px;
  padding-left: 4px;
}
.rules-list li:last-child {
  margin-bottom: 0;
}

/* 演示区域 */
#rulesModal .guide-demo {
  margin-top: 0;
  padding: 12px;
  border: none;
  background: rgba(0,0,0,0.15);
  border-radius: var(--radius-sm);
}

/* FAQ区域 */
.faq-section .faq-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

#rulesModal .faq {
  margin-top: 0;
  padding: 10px 14px;
  border: 1px solid rgba(120, 200, 255, 0.15);
  background: rgba(0,0,0,0.15);
  transition: background .2s;
}

#rulesModal .faq[open] {
  background: rgba(0,0,0,0.25);
  border-color: rgba(120, 200, 255, 0.25);
}

#rulesModal .faq > summary {
  padding: 0;
  font-weight: 600;
  font-size: 14px;
}

#rulesModal .faq p {
  margin: 8px 0 0;
  padding-left: 20px;
  color: var(--txt-2);
  line-height: 1.6;
  font-size: 13px;
}

/* 分数计算区域 */
.rules-section.scoring {
  padding: 14px 16px;
  border-color: rgba(157, 77, 255, 0.3); /* 用紫色区分 */
  background: linear-gradient(180deg, rgba(25, 18, 50, 0.4), rgba(18, 12, 36, 0.3));
}
.rules-section.scoring h3 {
  color: var(--accent);
  text-shadow: 0 0 8px rgba(157, 77, 255, 0.4);
  border-color: rgba(157, 77, 255, 0.3);
}

.scoring-details {
  display: grid;
  gap: 14px;
  font-size: 14px;
}

.scoring-category {
  color: var(--txt-2);
  text-align: center;
}

.scoring-title {
  font-weight: 600;
  color: var(--txt-1);
  margin-bottom: 6px;
  font-size: 13px;
}

.scoring-category p {
  margin: 0;
}

.bead-count-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--radius-xs);
  font-size: 12px;
  font-weight: 700;
  border: 1px solid;
  min-width: 45px;
  text-align: center;
}

.bead-count-tag.tier-1 {
  color: #a8c1ff;
  border-color: rgba(168, 193, 255, 0.4);
  background-color: rgba(168, 193, 255, 0.1);
}

.bead-count-tag.tier-2 {
  color: #60a5fa;
  border-color: rgba(59, 130, 246, 0.5);
  background-color: rgba(59, 130, 246, 0.15);
}

.bead-count-tag.tier-3 {
  color: #31e28a;
  border-color: rgba(49, 226, 138, 0.5);
  background-color: rgba(49, 226, 138, 0.15);
}

.scoring-tip {
  margin-top: 12px;
  padding: 10px;
  border-radius: var(--radius-sm);
  background: rgba(11, 15, 26, 0.5);
  font-size: 12px;
  color: var(--muted);
  border: 1px dashed rgba(157, 77, 255, 0.25);
}

.scoring-tip strong {
  color: var(--txt-2);
}

/* ===== 本局记录 · 统计区布局 (重构为2x2网格) ===== */
#recordStats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  padding: 10px;
  border-radius: var(--radius-sm);
  background: rgba(0,0,0,0.15);
  border: 1px dashed rgba(120, 200, 255, 0.25);
}

#recordStats .stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px;
  border-radius: var(--radius-sm);
  background: rgba(0,0,0,0.2);
}

#recordStats .stat-label {
  font-size: 12px;
  color: var(--muted);
}

#recordStats .stat-value {
  font-size: 18px;
  font-weight: 700;
  color: var(--primary);
  text-shadow: 0 0 8px rgba(0,229,255,.25);
}

/* ===== 用户认证区域样式 ===== */
.user-auth-area {
  width: 100%;
  min-height: 46px;
  padding: 8px;
  background: linear-gradient(180deg, rgba(22, 30, 60, 0.7), rgba(16, 22, 42, 0.6));
  border: 1px solid rgba(120, 200, 255, 0.25);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* 认证按钮样式 */
.auth-buttons {
  display: flex;
  gap: 12px;
  align-items: center;
}

.auth-btn {
  padding: 8px 16px;
  font-family: 'PixelFont';
  font-size: 14px;
  border: 1px solid rgba(120, 200, 255, 0.4);
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(139, 92, 246, 0.2));
  color: var(--txt-1);
  cursor: pointer;
  transition: all 0.3s ease;
  text-shadow: 0 0 6px rgba(0, 229, 255, 0.3);
}

.auth-btn:hover {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.4), rgba(139, 92, 246, 0.4));
  border-color: rgba(120, 200, 255, 0.6);
  box-shadow: 0 0 12px rgba(0, 229, 255, 0.3);
  transform: translateY(-1px);
}

.login-btn {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.2), rgba(16, 185, 129, 0.2));
}

.login-btn:hover {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.4), rgba(16, 185, 129, 0.4));
}

.register-btn {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.2), rgba(99, 102, 241, 0.2));
}

.register-btn:hover {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.4), rgba(99, 102, 241, 0.4));
}

/* 用户信息显示样式 */
.user-info {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  justify-content: space-between;
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid rgba(120, 200, 255, 0.4);
  box-shadow: 0 0 8px rgba(0, 229, 255, 0.2);
}

.user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.user-details {
  flex: 1;
  text-align: left;
}

.username {
  font-family: 'PixelFont';
  font-size: 16px;
  color: var(--txt-1);
  text-shadow: 0 0 6px rgba(0, 229, 255, 0.3);
  margin-bottom: 2px;
}

.high-score {
  font-family: 'PixelFont';
  font-size: 12px;
  color: var(--txt-2);
  text-shadow: 0 0 4px rgba(0, 229, 255, 0.2);
}

.logout-btn {
  padding: 6px 12px;
  font-family: 'PixelFont';
  font-size: 12px;
  border: 1px solid rgba(239, 68, 68, 0.4);
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.2), rgba(220, 38, 38, 0.2));
  color: var(--txt-1);
  cursor: pointer;
  transition: all 0.3s ease;
}

.logout-btn:hover {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.4), rgba(220, 38, 38, 0.4));
  border-color: rgba(239, 68, 68, 0.6);
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.3);
}

/* Bottom Navigation */
.bottom-nav {
  position: fixed;
  bottom: 10px;
  left: 10px;
  right: 10px;
  max-width: 450px;
  margin: 0 auto;
  height: 60px;
  background: linear-gradient(180deg, rgba(22, 30, 60, 0.7), rgba(16, 22, 42, 0.6));
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(120, 200, 255, 0.25);
  border-radius: var(--radius-sm);
  display: flex;
  justify-content: space-around;
  align-items: center;
  z-index: 100;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  color: var(--txt-2);
  font-size: 12px;
  gap: 4px;
  transition: color 0.2s;
}

.nav-item.active,
.nav-item:hover {
  color: var(--primary);
}

.nav-item span {
  font-size: 24px;
}
.nav-item label {
    font-size: 14px;
}

/* 新增分数容器样式 */
.score-container {
    flex-grow: 1;
    display: flex;
    align-items: stretch;
    height: 46px;
    width: 100%;
    background: linear-gradient(180deg, rgba(11,18,36,0.85), rgba(10,14,28,0.85));
    border: 1px solid rgba(120, 200, 255, 0.32);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.score-base {
    flex: 1;
    display: flex;
    align-items: center;
    /* justify-content: right; */
    justify-content: space-between;
    padding: 0 5px;
    border-right: 1px solid rgba(120, 200, 255, 0.2);
}

#baseScore {
    font-size: 12px;
    font-weight: 700;
    color: var(--success);
}

#rewardScore {
    font-size: 12px;
    font-weight: 700;
    color: var(--danger);
}


.score-details {
    flex: 0 0 45%;
    display: flex;
    flex-direction: column;
}

.score-reward, .score-total {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 8px;
    font-size: 12px;
}

.score-reward {
    border-bottom: 1px solid rgba(120, 200, 255, 0.2);
}

.score-label {
    color: var(--txt-2);
}

#level {
  font-size: 10px;
}

#totalScore {
    font-size: 22px;
    font-weight: 700;
    color: var(--primary);
}

/* 游戏开始动画 */
@keyframes game-start-animation {
  0% {
    transform: scale(0.8);
    opacity: 0;
  }
  50% {
    transform: scale(1.05);
    opacity: 1;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

.game-start {
  animation: game-start-animation 0.5s ease-out;
}
