/* ============= 基础重置 ============= */
* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  /* ===== 极简浅灰 + 典雅蓝色 新版配色 ===== */
  --bg: #f7f8fa;          /* 页面背景：极浅灰蓝，干净不刺眼 */
  --bg-deep: #eef1f5;     /* 深层背景：按钮/卡片内层 */
  --card: #ffffff;        /* 卡片：纯白 */
  --card-stroke: #e5e9f0; /* 卡片描边：极淡的冷灰 */
  --text: #1d2433;        /* 主文字：深蓝黑，比纯黑更柔和 */
  --text-soft: #5b6478;   /* 次文字：冷灰蓝 */
  --text-light: #98a2b3;  /* 淡文字 */
  --line: #e5e9f0;        /* 分隔线 */
  --line-soft: #f1f4f8;   /* 更淡的分隔 */
  /* 主色：干净典雅的靛青蓝 (Indigo-Teal) */
  --primary: #4f7cff;
  --primary-deep: #3a63e6;
  --primary-soft: #eef3ff;
  /* 辅色 */
  --gold: #e5a13a;
  --gold-soft: #fff6e3;
  --vip: #b45309;
  --danger: #ef4444;
  --win: #16a34a;
  --lose: #ef4444;
  /* 圆角：适中，简约不花哨 */
  --radius: 16px;
  --radius-sm: 10px;
  /* 阴影：更淡更短，简约干净 */
  --shadow: 0 1px 2px rgba(30,41,59,0.04), 0 6px 20px -8px rgba(30,41,59,0.08);
  --shadow-lg: 0 8px 24px -8px rgba(30,41,59,0.12), 0 30px 60px -24px rgba(30,41,59,0.16);
}
html, body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
body {
  padding-bottom: 70px; /* 移动端底部导航占位 */
  /* 极简背景：去掉多余的渐变斑点，只有极淡的冷色点缀 */
  background-image:
    radial-gradient(circle at 12% 0%, rgba(79,124,255,0.04), transparent 45%),
    radial-gradient(circle at 100% 100%, rgba(22,163,74,0.03), transparent 40%);
  background-attachment: fixed;
}
@media (min-width: 769px) {
  body { padding-bottom: 20px; }
}

/* ============= 顶部导航 ============= */
.topbar {
  background: rgba(255,255,255,0.88);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--line-soft);
  position: sticky;
  top: 0;
  z-index: 100;
}
.topbar-inner {
  max-width: 980px;
  margin: 0 auto;
  padding: 0 20px;
  height: 58px;
  display: flex;
  align-items: center;
  gap: 16px;
}
.brand {
  font-size: 17px;
  font-weight: 800;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 6px;
  letter-spacing: 0.3px;
}
.brand::before {
  content: "●";
  color: var(--primary);
  font-size: 14px;
  filter: drop-shadow(0 1px 2px rgba(79,124,255,0.35));
}
.nav-menu {
  display: flex;
  gap: 2px;
  flex: 1;
  justify-content: center;
}
.nav-menu a {
  padding: 8px 16px;
  border-radius: 999px;
  color: var(--text-soft);
  font-size: 14px;
  font-weight: 600;
  transition: all 0.2s ease;
}
.nav-menu a:hover {
  background: var(--bg-deep);
  color: var(--text);
}
.nav-menu a.active {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 4px 12px rgba(79,124,255,0.28);
}
.user-area {
  display: flex;
  align-items: center;
  gap: 8px;
}
.user-link {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--bg-deep);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  border: 1px solid transparent;
}
.coin-icon {
  background: linear-gradient(135deg, #ffe8b0, #e5a13a);
  color: #7a4a0a;
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 11px;
  box-shadow: 0 2px 4px rgba(229,161,58,0.2);
}
.btn-logout, .btn-admin, .btn-login, .btn-register {
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  transition: all 0.2s ease;
}
.btn-login { background: var(--bg-deep); color: var(--text-soft); border: none; }
.btn-register {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 4px 12px rgba(79,124,255,0.28);
}
.btn-register:hover { transform: translateY(-1px); filter: brightness(1.03); }
.btn-logout { background: #fef2f2; color: #991b1b; }
.btn-admin { background: var(--gold-soft); color: #7a4a0a; }

/* ============= 主容器 ============= */
.container {
  max-width: 780px;
  margin: 0 auto;
  padding: 20px 16px;
  width: 100%;
}

/* ============= 按钮 ============= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 22px;
  background: var(--primary);
  color: #fff !important;
  border: none;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
  transition: all 0.18s ease;
  font-family: inherit;
  box-shadow: 0 4px 12px rgba(79,124,255,0.25);
}
.btn:hover { opacity: 0.96; transform: translateY(-1px); box-shadow: 0 8px 20px rgba(79,124,255,0.32); }
.btn:active { transform: translateY(0); box-shadow: 0 2px 6px rgba(79,124,255,0.22); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-lg { padding: 13px 28px; font-size: 15px; }
.btn-block { display: flex; width: 100%; }
.btn-outline {
  background: #fff; border: 1.5px solid var(--line); color: var(--text) !important;
  box-shadow: none;
}
.btn-outline:hover { background: var(--bg-deep); box-shadow: none; transform: translateY(-1px); }
.btn-gray {
  background: var(--bg-deep); color: var(--text-soft) !important;
  border: none;
  box-shadow: none;
}
.btn-gray:hover { background: #e3e8ef; color: var(--text) !important; }
.btn-sm { padding: 6px 14px; font-size: 12px; }
.btn-danger {
  background: #ef4444;
  box-shadow: 0 4px 12px rgba(239,68,68,0.25);
}
.btn-success {
  background: #16a34a;
  box-shadow: 0 4px 12px rgba(22,163,74,0.25);
}
.btn-gold {
  background: linear-gradient(135deg, #ffd98a, #e5a13a);
  color: #7a4a0a !important;
  box-shadow: 0 4px 12px rgba(229,161,58,0.25);
}

/* ============= 卡片通用 ============= */
.card {
  background: var(--card);
  border: 1px solid var(--card-stroke);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  margin-bottom: 14px;
}
.card-title {
  font-size: 15px;
  font-weight: 800;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line-soft);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: space-between;
  letter-spacing: 0.2px;
}
.card-title .tabs {
  display: flex;
  gap: 12px;
  font-size: 12px;
  font-weight: 600;
}
.card-title .tabs .tab { color: var(--text-light); cursor: pointer; }
.card-title .tabs .tab.active { color: var(--primary-deep); }

/* ============= 首页 hero ============= */
.hero {
  background: #fff;
  border: 1px solid var(--card-stroke);
  border-radius: var(--radius);
  padding: 34px 24px;
  text-align: center;
  margin-bottom: 18px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: "";
  position: absolute;
  top: -80px; right: -60px;
  width: 240px; height: 240px;
  background: radial-gradient(circle, rgba(79,124,255,0.08), transparent 70%);
  border-radius: 50%;
}
.hero::after {
  content: "";
  position: absolute;
  bottom: -80px; left: -40px;
  width: 260px; height: 260px;
  background: radial-gradient(circle, rgba(229,161,58,0.06), transparent 70%);
  border-radius: 50%;
}
.hero > * { position: relative; z-index: 1; }
.hero-title { font-size: 24px; font-weight: 800; margin-bottom: 6px; letter-spacing: 0.2px; color: var(--text); }
.hero-sub { font-size: 14px; color: var(--text-soft); margin-bottom: 20px; }
.hero-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* ============= 公告 ============= */
.notice-item {
  padding: 12px 0;
  border-bottom: 1px dashed var(--line);
}
.notice-item:last-child { border-bottom: none; }
.notice-title { font-weight: 700; margin-bottom: 4px; font-size: 14px; }
.notice-title small { color: var(--text-light); font-weight: 500; font-size: 12px; margin-left: 8px; }
.notice-content { color: var(--text-soft); font-size: 13px; }

/* ============= 功能卡片网格 ============= */
.features {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 18px;
}
.feature-card {
  background: var(--card);
  border: 1px solid var(--card-stroke);
  border-radius: var(--radius);
  padding: 18px 14px;
  box-shadow: var(--shadow);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  position: relative;
  overflow: hidden;
}
.feature-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}
.feature-icon {
  width: 42px; height: 42px;
  background: var(--primary-soft);
  border: 1px solid #dce6ff;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  margin-bottom: 10px;
}
.feature-card:nth-child(2) .feature-icon { background: var(--gold-soft); border-color: #ffe8b0; }
.feature-card:nth-child(3) .feature-icon { background: #fff1f2; border-color: #fecdd3; }
.feature-card:nth-child(4) .feature-icon { background: #eef0ff; border-color: #d5d9ff; }
.feature-card h3 { font-size: 14px; font-weight: 700; margin-bottom: 4px; }
.feature-card p { font-size: 12px; color: var(--text-light); margin-bottom: 8px; line-height: 1.6; }
.feature-link {
  font-size: 12px;
  font-weight: 700;
  color: var(--primary-deep);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* ============= 统计行 ============= */
.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.stat-box {
  background: var(--card);
  border: 1px solid var(--card-stroke);
  border-radius: var(--radius-sm);
  padding: 16px 10px;
  text-align: center;
  box-shadow: var(--shadow);
}
.stat-num {
  font-size: 22px;
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary), var(--primary-deep));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.stat-label { color: var(--text-light); font-size: 11px; margin-top: 2px; font-weight: 600; }

/* ============= 表单 ============= */
.form-group { margin-bottom: 14px; }
.form-group label {
  display: block;
  margin-bottom: 6px;
  font-weight: 700;
  color: var(--text);
  font-size: 13px;
}
.form-group input, .form-group select, .form-group textarea {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg);
  border: 1.5px solid transparent;
  border-radius: var(--radius-sm);
  font-size: 14px;
  transition: all 0.2s ease;
  font-family: inherit;
  color: var(--text);
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  outline: none;
  background: #fff;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-soft);
}
.form-group small { font-size: 12px; color: var(--text-light); margin-top: 5px; display: block; }

/* ============= 登录注册 ============= */
.auth-box {
  max-width: 400px;
  margin: 30px auto 18px;
}
.auth-card {
  background: var(--card);
  border: 1px solid var(--card-stroke);
  border-radius: 22px;
  padding: 28px 24px;
  box-shadow: var(--shadow-lg);
}
.auth-title {
  text-align: center;
  margin-bottom: 22px;
  font-size: 20px;
  font-weight: 800;
}
.auth-foot {
  text-align: center;
  margin-top: 18px;
  color: var(--text-soft);
  font-size: 13px;
}
.auth-foot a { color: var(--primary-deep); font-weight: 700; }

/* ============= 提示框 ============= */
.alert {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  margin-bottom: 14px;
  font-size: 13px;
  line-height: 1.65;
  font-weight: 500;
  border: 1px solid transparent;
}
.alert-error   { background: #fff5f5; color: #991b1b; border-color: #ffdada; }
.alert-success { background: #f0fdf4; color: #166534; border-color: #bbf7d0; }
.alert-info    { background: #eff6ff; color: #1e40af; border-color: #bfdbfe; }
.alert-warning { background: #fffbeb; color: #92400e; border-color: #fde68a; }

/* ============= 表格 ============= */
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.table th, .table td {
  padding: 10px 8px;
  text-align: left;
  border-bottom: 1px solid var(--line-soft);
}
.table th {
  background: var(--bg);
  font-weight: 700;
  color: var(--text-soft);
  font-size: 12px;
}
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: #faf6eb; }
.text-win { color: var(--win); font-weight: 700; }
.text-lose { color: var(--lose); font-weight: 700; }
.empty { text-align: center; color: var(--text-light); padding: 40px 10px; font-size: 13px; }

/* ============= 排行榜 ============= */
.rank { text-align: center; font-weight: 800; font-size: 15px; }
.rank.gold { color: #d97706; }
.rank.silver { color: #6b7280; }
.rank.bronze { color: #b45309; }
.rank.gold::before { content: "🥇 "; }
.rank.silver::before { content: "🥈 "; }
.rank.bronze::before { content: "🥉 "; }

/* ============= 分页 ============= */
.pagination {
  display: flex;
  gap: 6px;
  justify-content: center;
  margin-top: 16px;
  flex-wrap: wrap;
}
.pagination a {
  min-width: 34px;
  height: 34px;
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--card);
  border: 1px solid var(--card-stroke);
  border-radius: 10px;
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 700;
  transition: all 0.2s ease;
}
.pagination a:hover { background: var(--bg-deep); transform: translateY(-1px); }
.pagination a.cur {
  background: linear-gradient(135deg, var(--primary), var(--primary-deep));
  color: #fff;
  border-color: transparent;
  box-shadow: 0 4px 10px rgba(61,143,123,0.22);
}

/* ============= 游戏页面 ============= */
.game-wrap {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.mode-tabs {
  display: flex;
  justify-content: center;
  margin-bottom: 2px;
}
.mode-tab {
  background: var(--card);
  border: 1px solid var(--card-stroke);
  padding: 7px 20px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 13px;
  box-shadow: var(--shadow);
  color: var(--text);
}
.board-area {
  background: var(--card);
  border: 1px solid var(--card-stroke);
  border-radius: var(--radius);
  padding: 18px 12px 20px;
  box-shadow: var(--shadow);
  position: relative;
}
#board-canvas {
  display: block;
  margin: 0 auto;
  border-radius: 14px;
  cursor: pointer;
  max-width: 100%;
  height: auto;
  /* 简约：去掉大阴影的木纹感，只用浅边框阴影 */
  box-shadow:
    0 0 0 1px rgba(30,41,59,0.04),
    0 12px 36px -16px rgba(30,41,59,0.18);
}
.game-side {
  background: var(--card);
  border: 1px solid var(--card-stroke);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}
.game-status {
  text-align: center;
  padding: 12px;
  background: var(--primary-soft);
  border: 1px solid #dce6ff;
  border-radius: 12px;
  margin-bottom: 12px;
  font-size: 14px;
  font-weight: 700;
  color: var(--primary-deep);
}
.game-status .turn-dot {
  display: inline-block;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  vertical-align: middle;
  margin-right: 6px;
}
.turn-dot.black { background: #1d2433; box-shadow: 0 1px 2px rgba(0,0,0,0.25); }
.turn-dot.white { background: #fff; border: 1.5px solid #cbd3de; }
.players-vs {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
}
.player-card {
  background: var(--bg-deep);
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.player-card .avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1d2433, #3b4559);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
  box-shadow: 0 3px 8px rgba(29,36,51,0.18);
}
.player-card.white-side .avatar {
  background: linear-gradient(135deg, #ffffff, #eef1f5);
  color: var(--text);
  border: 1.5px solid var(--line);
  box-shadow: 0 2px 6px rgba(29,36,51,0.06);
}
.player-card .info {
  min-width: 0;
}
.player-card .name { font-weight: 700; font-size: 13px; }
.player-card .stat { font-size: 11px; color: var(--text-light); font-weight: 500; }
.vs-badge {
  text-align: center;
  color: var(--text-light);
  font-weight: 800;
  font-size: 12px;
}
.vs-badge small { display: block; font-weight: 600; font-size: 10px; color: var(--text-light); }

.game-info {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
}
.info-item {
  background: var(--bg-deep);
  border: 1px solid transparent;
  padding: 10px 6px;
  border-radius: 10px;
  text-align: center;
  font-size: 12px;
}
.info-item .label { color: var(--text-light); display: block; font-size: 11px; margin-bottom: 3px; font-weight: 600; }
.info-item .value { font-weight: 700; font-size: 14px; color: var(--text); }
.info-item .value.gold { color: var(--gold); }

.move-history {
  max-height: 130px;
  overflow-y: auto;
  background: var(--bg-deep);
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 12px;
  font-family: ui-monospace, Consolas, monospace;
  color: var(--text-soft);
}
.move-history div { padding: 3px 0; border-bottom: 1px dashed var(--line); }
.move-history div:last-child { border-bottom: none; }

.game-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}
.game-actions .btn { flex: 1; }

/* 弹窗 */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(29, 36, 51, 0.42);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}
.modal-box {
  background: var(--card);
  border: 1px solid var(--card-stroke);
  border-radius: 22px;
  padding: 26px 22px;
  max-width: 400px;
  width: 100%;
  text-align: center;
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.28s cubic-bezier(.2,.9,.3,1.2);
}
@keyframes modalIn {
  from { transform: scale(0.94) translateY(8px); opacity: 0; }
  to { transform: scale(1) translateY(0); opacity: 1; }
}
.modal-box .badge-free {
  display: inline-block;
  background: linear-gradient(135deg, #ffd98a, #e5a13a);
  color: #7a4a0a;
  padding: 5px 16px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 12px;
  box-shadow: 0 3px 8px rgba(229,161,58,0.22);
}
.modal-box .remain {
  color: var(--text-soft);
  font-size: 13px;
  margin-bottom: 12px;
  font-weight: 500;
}
.modal-box .vip-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--gold-soft);
  color: var(--vip);
  padding: 6px 16px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 12px;
}
.modal-box .play-btn {
  display: block;
  width: 100%;
  padding: 14px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
  margin-bottom: 10px;
  font-family: inherit;
  box-shadow: 0 6px 16px rgba(79,124,255,0.3);
  transition: all 0.18s ease;
}
.modal-box .play-btn:hover { transform: translateY(-1px); filter: brightness(1.03); }
.modal-box .play-btn:active { transform: translateY(0); }
.modal-box .status-tag {
  margin-top: 8px;
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 500;
}
.modal-box .status-tag .lose-tag { color: var(--lose); font-weight: 700; }

/* 房间 */
.room-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}
.room-card {
  background: var(--card);
  border: 1px solid var(--card-stroke);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.room-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.room-code {
  font-size: 22px;
  font-weight: 800;
  color: var(--primary-deep);
  letter-spacing: 3px;
  margin-bottom: 6px;
}
.room-info { font-size: 13px; color: var(--text-soft); margin-bottom: 4px; font-weight: 500; }
.room-actions { margin-top: 10px; display: flex; gap: 8px; }

/* 用户中心 */
.profile-header {
  background: #fff;
  border: 1px solid var(--card-stroke);
  border-radius: var(--radius);
  padding: 24px 20px;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
.profile-header::after {
  content: "";
  position: absolute;
  top: -40px; right: -40px;
  width: 180px; height: 180px;
  background: radial-gradient(circle, rgba(79,124,255,0.08), transparent 70%);
  border-radius: 50%;
}
.profile-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-deep));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  color: #fff;
  font-weight: 700;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
  box-shadow: 0 6px 16px rgba(79,124,255,0.3);
}
.profile-info { position: relative; z-index: 1; flex: 1; min-width: 0; }
.profile-info h2 { font-size: 18px; margin-bottom: 4px; font-weight: 800; }
.profile-info .coins {
  font-size: 15px;
  color: var(--gold);
  font-weight: 800;
}
.profile-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}

/* 页脚 */
.footer {
  background: transparent;
  color: var(--text-light);
  padding: 20px;
  text-align: center;
  font-size: 12px;
  margin-top: 20px;
  font-weight: 500;
}

/* Badge */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}
.badge-success { background: #dcfce7; color: #166534; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-danger  { background: #fee2e2; color: #991b1b; }
.badge-info    { background: #dbeafe; color: #1e40af; }

/* ============= 移动端底部导航 ============= */
.mobile-nav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-top: 1px solid var(--line-soft);
  padding: 8px 4px 10px;
  z-index: 99;
  padding-bottom: calc(10px + env(safe-area-inset-bottom));
}
.mobile-nav a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 6px 4px;
  color: var(--text-light);
  font-size: 11px;
  font-weight: 600;
  border-radius: 12px;
  transition: all 0.2s ease;
}
.mobile-nav a .icon { font-size: 20px; line-height: 1; }
.mobile-nav a.active {
  color: var(--primary-deep);
  background: var(--primary-soft);
  font-weight: 800;
}
.mobile-nav a.active .icon { transform: translateY(-1px); }

/* ============= 后台 ============= */
.admin-wrap {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 16px;
}
.admin-sidebar {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px 12px;
  box-shadow: var(--shadow);
  height: fit-content;
}
.admin-sidebar a {
  display: block;
  padding: 10px 14px;
  border-radius: 12px;
  color: var(--text-soft);
  margin-bottom: 4px;
  font-size: 14px;
  font-weight: 500;
}
.admin-sidebar a:hover, .admin-sidebar a.active {
  background: var(--primary-soft);
  color: var(--primary-deep);
  font-weight: 700;
}
.admin-content {
  background: var(--card);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
  min-height: 400px;
}

/* ============= 响应式 ============= */
@media (max-width: 768px) {
  .topbar-inner {
    height: 56px;
    padding: 0 14px;
    gap: 10px;
  }
  .nav-menu { display: none; }
  .user-area .username { display: none; }
  .btn-logout, .btn-admin { padding: 5px 10px; font-size: 12px; }
  .btn-login, .btn-register { padding: 5px 12px; font-size: 12px; }

  .mobile-nav { display: flex; }
  .container { padding: 14px 12px; padding-bottom: 76px; }

  .hero { padding: 28px 18px; border-radius: 20px; }
  .hero-title { font-size: 22px; }

  .features { grid-template-columns: 1fr 1fr; gap: 10px; }
  .feature-card { padding: 16px 14px; }

  .stats-row { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .stat-box { padding: 14px 8px; border-radius: 12px; }
  .stat-num { font-size: 20px; }
  .stat-label { font-size: 11px; }

  .profile-header { flex-direction: column; text-align: center; padding: 22px 18px; }
  .profile-stats { grid-template-columns: repeat(4, 1fr); }
  .profile-stats .stat-box { padding: 12px 4px; }
  .profile-stats .stat-num { font-size: 17px; }

  .admin-wrap { grid-template-columns: 1fr; }
  .admin-sidebar {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 10px;
  }
  .admin-sidebar a {
    padding: 8px 12px;
    margin-bottom: 0;
    flex: 1 1 auto;
    text-align: center;
    font-size: 13px;
  }
  .admin-content { padding: 16px; }

  .players-vs { gap: 6px; }
  .player-card { padding: 10px 8px; gap: 8px; }
  .player-card .avatar { width: 36px; height: 36px; font-size: 11px; }
  .player-card .name { font-size: 13px; }

  .game-actions { flex-wrap: wrap; }
  .game-actions .btn { flex: 1 1 calc(50% - 4px); }

  .card { padding: 16px; border-radius: 14px; }
  .auth-card { padding: 24px 20px; }
  .table { font-size: 12px; }
  .table th, .table td { padding: 8px 6px; }
}

@media (max-width: 480px) {
  .features { grid-template-columns: 1fr 1fr; }
  .stats-row { grid-template-columns: repeat(3, 1fr); }
  .profile-stats { grid-template-columns: repeat(4, 1fr); }
  .game-info { grid-template-columns: 1fr 1fr; }
  .hero-actions { flex-direction: column; padding: 0 20px; }
  .hero-actions .btn { width: 100%; }
  .brand { font-size: 16px; }
  .card-title { font-size: 15px; }
}

@media (max-width: 360px) {
  .container { padding: 12px 10px; }
  .card { padding: 14px; }
  .hero { padding: 22px 14px; }
  .hero-title { font-size: 19px; }
  .btn { padding: 10px 18px; font-size: 13px; }
  .btn-lg { padding: 12px 22px; font-size: 14px; }
  .table th, .table td { padding: 6px 4px; font-size: 11px; }
  .features { gap: 8px; }
  .feature-card { padding: 12px 10px; }
  .feature-icon { width: 40px; height: 40px; font-size: 20px; }
  .feature-card h3 { font-size: 13px; }
  .feature-card p { font-size: 11px; }
  .mobile-nav a { font-size: 10px; }
  .mobile-nav a .icon { font-size: 18px; }
}

/* ============= 自定义精美弹窗（替代原生 alert/confirm）============= */
.gx-mask {
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 9999;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  opacity: 0;
  transition: opacity .2s ease;
}
.gx-mask.show { opacity: 1; }
.gx-dialog {
  background: #fff;
  width: 100%;
  max-width: 380px;
  border-radius: 22px;
  box-shadow:
    0 20px 60px rgba(0, 0, 0, 0.22),
    0 2px 8px rgba(0, 0, 0, 0.08);
  overflow: hidden;
  transform: translateY(18px) scale(.96);
  transition: transform .26s cubic-bezier(.2,.9,.3,1.2);
}
.gx-mask.show .gx-dialog { transform: translateY(0) scale(1); }
.gx-dlg-head {
  padding: 28px 24px 6px;
  text-align: center;
}
.gx-dlg-icon {
  width: 64px; height: 64px;
  margin: 0 auto 14px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 30px;
  animation: gx-bounce .5s cubic-bezier(.2,.9,.3,1.4);
}
.gx-dlg-icon.info { background: linear-gradient(135deg, #dbeafe, #bfdbfe); }
.gx-dlg-icon.success { background: linear-gradient(135deg, #dcfce7, #bbf7d0); }
.gx-dlg-icon.warn { background: linear-gradient(135deg, #fef3c7, #fde68a); }
.gx-dlg-icon.error { background: linear-gradient(135deg, #fee2e2, #fecaca); }
.gx-dlg-icon.confirm { background: linear-gradient(135deg, #fde68a, #fbbf24); }
.gx-dlg-title {
  font-size: 18px;
  font-weight: 800;
  color: #111827;
  margin-bottom: 8px;
  line-height: 1.4;
}
.gx-dlg-body {
  padding: 6px 24px 22px;
  text-align: center;
  color: #4b5563;
  font-size: 14px;
  line-height: 1.7;
  white-space: pre-line;
  word-break: break-word;
}
.gx-dlg-foot {
  display: flex;
  gap: 10px;
  padding: 0 20px 22px;
}
.gx-dlg-foot .gx-btn {
  flex: 1;
  border: none;
  border-radius: 12px;
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all .18s ease;
  font-family: inherit;
}
.gx-dlg-foot .gx-btn:active { transform: scale(.97); }
.gx-btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 6px 16px rgba(79, 124, 255, 0.32);
}
.gx-btn-primary:hover { filter: brightness(1.04); }
.gx-btn-secondary {
  background: var(--bg-deep);
  color: var(--text-soft);
}
.gx-btn-secondary:hover { background: #e1e6ef; color: var(--text); }
@keyframes gx-bounce {
  0% { transform: scale(.3); opacity: 0; }
  60% { transform: scale(1.12); opacity: 1; }
  100% { transform: scale(1); }
}
@media (max-width: 480px) {
  .gx-dlg-icon { width: 56px; height: 56px; font-size: 26px; }
  .gx-dlg-title { font-size: 16px; }
  .gx-dlg-body { font-size: 13px; }
  .gx-dlg-foot .gx-btn { padding: 11px 14px; font-size: 14px; border-radius: 12px; }
}
