/* === Custom Font === */
body {
  font-family: "LXGW WenKai", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* 标签页字体 */
.md-tabs__link {
  font-family: "LXGW WenKai", sans-serif;
}

/* 侧边栏导航字体 */
.md-nav__link {
  font-family: "LXGW WenKai", sans-serif;
}

/* 目录字体 */
.md-nav--secondary .md-nav__link {
  font-family: "LXGW WenKai", sans-serif;
}

/* 返回顶部按钮字体 */
button.md-top {
  font-family: "LXGW WenKai", sans-serif;
  font-weight: bold;
}

/* === Table Styles === */
.md-typeset table:not([class]) {
  width: 100%;
  display: table;
  table-layout: auto;
}

.md-typeset table:not([class]) th,
.md-typeset table:not([class]) td {
  min-width: 0;
}

.md-typeset__table {
  width: 100%;
}

.md-typeset__scrollwrap {
  overflow-x: visible;
}

/* === Grid Background Effect === */
body::before {
  --size: 40px;
  --line: rgba(0, 0, 0, 0.06);
  content: '';
  height: 100vh;
  width: 100vw;
  position: fixed;
  background: linear-gradient(
        90deg,
        var(--line) 1px,
        transparent 1px var(--size)
      )
      50% 50% / var(--size) var(--size),
    linear-gradient(var(--line) 1px, transparent 1px var(--size)) 50% 50% /
      var(--size) var(--size);
  -webkit-mask: linear-gradient(-20deg, transparent 50%, white);
          mask: linear-gradient(-20deg, transparent 50%, white);
  top: 0;
  left: 0;
  transform-style: flat;
  pointer-events: none;
  z-index: -1;
}

[data-md-color-scheme="slate"] body::before {
  --line: rgba(255, 255, 255, 0.06);
}

@supports (color: color-mix(in srgb, black, white)) {
  body::before {
    --line: color-mix(in srgb, var(--md-default-fg-color), transparent 90%);
  }
}

@media (max-width: 768px) {
  body::before {
    display: none;
  }
}

/* === Minimal Navigation Tabs === */
.md-tabs__list {
  display: flex;
  justify-content: space-evenly;
  width: 100%;
}

.md-tabs__item {
  height: 2.4rem;
  background: none !important;
  flex: 1;
  text-align: center;
}

.md-tabs {
  /* 防止透明度变化导致的布局移位 */
  will-change: opacity;
  transition: opacity 0.3s ease;
}

.md-tabs--hidden {
  pointer-events: none;
}
  padding: 0 0.8rem;
  font-weight: 500;
  opacity: 0.6;
  transition: opacity 0.25s ease;
  background: none !important;
  box-shadow: none !important;
  border: none !important;
  border-radius: 0 !important;
}

.md-tabs__link:hover {
  opacity: 0.85;
}

.md-tabs__item--active .md-tabs__link,
.md-tabs__link--active {
  opacity: 1;
  font-weight: 600;
  color: inherit;
  border-bottom: none !important;
}

/* 移除标签下方的黑色指示线 */
.md-tabs__link--active::after,
.md-tabs__item--active .md-tabs__link::after {
  display: none !important;
}

.md-tabs__link::before,
.md-tabs__link::after,
.md-tabs__item::before,
.md-tabs__item::after {
  display: none !important;
}

/* === Sidebar Navigation Styles === */
.md-nav__link {
  padding: 0.5rem 0.8rem;
  transition: color 0.2s ease, background-color 0.2s ease;
  border-radius: 0.25rem;
}

/* 统一有子菜单项的容器样式 */
.md-nav__item--nested > .md-nav__link,
.md-nav__container {
  padding: 0 !important;
}

.md-nav__container > .md-nav__link {
  padding: 0.5rem 0.8rem;
  font-size: 0.7rem;
  font-weight: 400;
}

/* 调整子菜单缩进 - 减小左侧留白 */
.md-nav--primary .md-nav__list .md-nav__list {
  margin-left: 0.3rem;
  padding-left: 0.4rem;
  border-left: 1px solid var(--md-default-fg-color--lightest);
}

.md-nav__link:hover {
  background-color: var(--md-accent-fg-color--transparent);
}

.md-nav__link--active,
.md-nav__item--active > .md-nav__link {
  background-color: var(--md-accent-fg-color--transparent);
  color: var(--md-accent-fg-color);
  font-weight: 600;
}

/* === Disable Section Container Links Click === */
.md-nav__container > a.md-nav__link {
  pointer-events: none;
  cursor: default;
}

/* === Mermaid Chart Font (use system font for faster rendering) === */
.mermaid {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
}

/* === Skill Icon Visibility Fix === */
/* 为技能图标添加深色背景，确保浅色模式下可见 */
.md-typeset figure img[width="64"] {
  background-color: #2d2d2d;
  border-radius: 8px;
  padding: 8px;
}

/* === Leaderboard Styles === */
.leaderboard-wrapper {
  --lb-primary: #00bcd4;
  --lb-bg: rgba(255, 255, 255, 0.5);
  --lb-border: rgba(0, 0, 0, 0.1);
  --lb-hover: rgba(0, 0, 0, 0.05);
  --lb-text: #333;
  --lb-text-muted: #666;
  --lb-rank-1: #ffd700;
  --lb-rank-2: #c0c0c0;
  --lb-rank-3: #cd7f32;
  margin: 2rem 0;
  font-family: "LXGW WenKai", sans-serif;
}

[data-md-color-scheme="slate"] .leaderboard-wrapper {
  --lb-primary: #64ffda;
  --lb-bg: rgba(30, 30, 35, 0.6);
  --lb-border: rgba(255, 255, 255, 0.1);
  --lb-hover: rgba(255, 255, 255, 0.05);
  --lb-text: #e0e0e0;
  --lb-text-muted: #999;
}

.leaderboard-header {
  margin-bottom: 1rem;
}

.leaderboard-subtitle {
  font-size: 0.9rem;
  color: var(--lb-text-muted);
}

.leaderboard-content {
  background: var(--lb-bg);
  border-radius: 12px;
  border: 1px solid var(--lb-border);
  backdrop-filter: blur(10px);
  overflow: hidden;
  position: relative;
  min-height: 300px;
}

.leaderboard-table {
  width: 100%;
  border-collapse: collapse;
}

.leaderboard-table th {
  text-align: left;
  padding: 1rem;
  color: var(--lb-text-muted);
  font-weight: normal;
  border-bottom: 1px solid var(--lb-border);
  white-space: nowrap;
}

.leaderboard-table td {
  padding: 0.8rem 1rem;
  color: var(--lb-text);
  border-bottom: 1px solid var(--lb-border);
  font-variant-numeric: tabular-nums;
}

.leaderboard-table tr:last-child td {
  border-bottom: none;
}

.leaderboard-table tr:hover td {
  background-color: var(--lb-hover);
}

.col-rank { width: 80px; min-width: 80px; text-align: center !important; white-space: nowrap; }
.col-player { font-weight: 500; }
.col-stat { text-align: right !important; width: 150px; }
.leaderboard-table thead .col-player,
.leaderboard-table thead .col-stat {
  text-align: center !important;
}
.leaderboard-table .col-empty {
  text-align: center !important;
  color: var(--lb-text-muted);
  padding: 2.2rem 1rem;
}

.rank-badge {
  display: inline-block;
  width: 28px;
  height: 28px;
  line-height: 28px;
  text-align: center;
  border-radius: 50%;
  font-weight: bold;
  color: var(--lb-text-muted);
}

.rank-1 .rank-badge {
  background: linear-gradient(135deg, var(--lb-rank-1), #d4af37);
  color: #fff;
  box-shadow: 0 0 10px var(--lb-rank-1);
}

.rank-2 .rank-badge {
  background: linear-gradient(135deg, var(--lb-rank-2), #a9a9a9);
  color: #fff;
}

.rank-3 .rank-badge {
  background: linear-gradient(135deg, var(--lb-rank-3), #a0522d);
  color: #fff;
}

.loading-container {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  background: var(--lb-bg);
  z-index: 10;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}

.loading-container.active {
  opacity: 1;
  pointer-events: auto;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--lb-border);
  border-top-color: var(--lb-primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@media (max-width: 600px) {
  .leaderboard-title { font-size: 1.4rem; }
  .lb-tab-btn { padding: 0.4rem 0.8rem; font-size: 0.8rem; }
  .leaderboard-table td, .leaderboard-table th { padding: 0.6rem 0.5rem; }
}
