:root {
  --bg: #0f0f1a;
  --card: #1a1a2e;
  --card2: #16213e;
  --accent: #6c63ff;
  --accent2: #ff6584;
  --accent3: #43e97b;
  --accent4: #f7971e;
  --text: #e0e0e0;
  --text2: #8888aa;
  --glass-border: rgba(255, 255, 255, 0.07);
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  --radius-lg: 22px;
  --radius-md: 16px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { color-scheme: dark; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text",
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ===== 极光背景层 ===== */
.aurora {
  position: fixed; inset: 0; z-index: 0;
  pointer-events: none; overflow: hidden;
}
.orb {
  position: absolute; border-radius: 50%;
  filter: blur(90px); opacity: 0.4;
  will-change: transform;
}
.o1 {
  width: 640px; height: 640px; left: -160px; top: -180px;
  background: radial-gradient(circle, rgba(108, 99, 255, 0.5), transparent 65%);
  animation: drift1 26s ease-in-out infinite alternate;
}
.o2 {
  width: 560px; height: 560px; right: -140px; top: 6%;
  background: radial-gradient(circle, rgba(255, 101, 132, 0.32), transparent 65%);
  animation: drift2 32s ease-in-out infinite alternate;
}
.o3 {
  width: 720px; height: 720px; left: 28%; bottom: -320px;
  background: radial-gradient(circle, rgba(46, 196, 255, 0.24), transparent 65%);
  animation: drift1 38s ease-in-out infinite alternate-reverse;
}
@keyframes drift1 {
  from { transform: translate(0, 0) scale(1); }
  to { transform: translate(70px, 40px) scale(1.12); }
}
@keyframes drift2 {
  from { transform: translate(0, 0) scale(1); }
  to { transform: translate(-60px, 50px) scale(1.08); }
}

/* 粒子画布 */
#particles-canvas {
  position: fixed; top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 0; pointer-events: none;
}

/* 玻璃主体 */
.topbar, main, footer { position: relative; z-index: 1; }

/* ===== Header（旧版风格：渐变标题 + 流光底线） ===== */
.topbar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 12px; padding: 16px 26px;
  position: sticky; top: 0; z-index: 10;
  background: linear-gradient(180deg, rgba(22, 20, 40, 0.82), rgba(15, 15, 26, 0.6));
  backdrop-filter: blur(24px) saturate(170%);
  -webkit-backdrop-filter: blur(24px) saturate(170%);
  border-bottom: 1px solid rgba(108, 99, 255, 0.18);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}
.topbar::after {
  content: '';
  position: absolute;
  bottom: 0; left: 50%;
  transform: translateX(-50%);
  width: 220px; height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  animation: headerPulse 2.4s ease-in-out infinite;
}
@keyframes headerPulse {
  0%, 100% { opacity: 0.35; width: 200px; }
  50% { opacity: 1; width: 320px; }
}
.title h1 {
  font-size: 1.5rem; font-weight: 800; letter-spacing: 1px;
  background: linear-gradient(135deg, #6c63ff, #ff6584, #f7971e);
  background-size: 200% 200%;
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: gradientShift 5s ease infinite;
}
@keyframes gradientShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}
.title p { color: var(--text2); font-size: 0.8rem; margin-top: 4px; font-variant-numeric: tabular-nums; }
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.filters label {
  color: var(--text2); font-size: 0.83rem;
  display: flex; align-items: center; gap: 6px;
}
.filters input, .filters select {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text); border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 10px; padding: 7px 10px; font-size: 0.83rem;
  outline: none; transition: all 0.3s ease;
}
.filters input:focus, .filters select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 20px rgba(108, 99, 255, 0.18);
}
.filters option { background: var(--bg); color: var(--text); }

.banner {
  margin: 14px 26px 0; padding: 10px 14px; border-radius: 12px;
  background: rgba(255, 101, 132, 0.12);
  border: 1px solid rgba(255, 101, 132, 0.35);
  color: #ffc4cd; font-size: 0.84rem;
  backdrop-filter: blur(16px);
}
.hidden { display: none; }

main { padding: 22px 26px 34px; max-width: 1440px; margin: 0 auto; }

/* ===== 领奖台（旧版 Premium 3D 风格） ===== */
.podium {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  max-width: 820px;
  margin-left: auto; margin-right: auto;
  align-items: flex-end; gap: clamp(8px, 2.5vw, 24px);
  margin-bottom: 22px; padding: 34px 22px 0;
  background: linear-gradient(145deg, #1c1c3a, #151528);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 24px;
  box-shadow: 0 0 60px rgba(108, 99, 255, 0.08), 0 8px 40px rgba(0, 0, 0, 0.5);
  overflow: hidden;
  backdrop-filter: blur(24px) saturate(150%);
  -webkit-backdrop-filter: blur(24px) saturate(150%);
  animation: fadeSlideUp 0.9s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.podium::before {
  content: '';
  position: absolute;
  top: -1px; left: -1px; right: -1px;
  height: 3px;
  background: linear-gradient(90deg, #cd7f32, #c0c0c0, #ffd700, #ffd700, #c0c0c0, #cd7f32);
  background-size: 200% 100%;
  animation: podiumBorderShine 3s ease-in-out infinite;
}
@keyframes podiumBorderShine {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}
.podium-card, .podium-slot {
  display: flex; flex-direction: column; align-items: center;
  min-width: 0; text-align: center;
  animation: podiumBounce 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
.podium-card:nth-child(1), .podium-slot:nth-child(1) { animation-delay: 0.3s; }
.podium-card:nth-child(2), .podium-slot:nth-child(2) { animation-delay: 0.1s; }
.podium-card:nth-child(3), .podium-slot:nth-child(3) { animation-delay: 0.5s; }
@keyframes podiumBounce {
  0% { opacity: 0; transform: translateY(80px) scale(0.6); }
  50% { transform: translateY(-12px) scale(1.04); }
  75% { transform: translateY(4px) scale(0.98); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}
.podium-card .medal {
  font-size: 2.2rem; line-height: 1;
  animation: medalFloat 2.5s ease-in-out infinite;
  filter: drop-shadow(0 0 10px rgba(255, 215, 0, 0.3));
}
@keyframes medalFloat {
  0%, 100% { transform: translateY(0) rotate(-2deg); }
  50% { transform: translateY(-6px) rotate(2deg); }
}
.podium-name {
  margin-top: 8px; font-weight: 700; font-size: 1rem;
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.06);
}
.podium-tokens {
  margin-top: 2px; font-size: 1.3rem; font-weight: 800;
  background: linear-gradient(135deg, #fff, #c0c0ff);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  font-variant-numeric: tabular-nums;
}
.podium-sub { color: var(--text2); font-size: 0.76rem; margin-top: 3px; font-variant-numeric: tabular-nums; }
.podium-bar-wrapper {
  width: 100%; max-width: 100px; height: 5px;
  background: rgba(255, 255, 255, 0.06); border-radius: 3px;
  margin-top: 10px; overflow: hidden;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.3);
}
.podium-bar-fill {
  height: 100%; border-radius: 3px;
  transition: width 1.5s cubic-bezier(0.22, 1, 0.36, 1);
}
.podium-bar-1 { background: linear-gradient(90deg, #ffd700, #fff4a0); box-shadow: 0 0 8px rgba(255, 215, 0, 0.3); }
.podium-bar-2 { background: linear-gradient(90deg, #c0c0c0, #e8e8e8); box-shadow: 0 0 6px rgba(192, 192, 192, 0.2); }
.podium-bar-3 { background: linear-gradient(90deg, #cd7f32, #e8b87a); box-shadow: 0 0 6px rgba(205, 127, 50, 0.2); }
.podium-stand {
  width: 100%; max-width: 130px;
  border-radius: 10px 10px 0 0;
  margin-top: 10px;
  position: relative;
}
.podium-stand-1 {
  height: 78px;
  background: linear-gradient(180deg, rgba(255, 215, 0, 0.35), rgba(255, 215, 0, 0.08));
  border: 1px solid rgba(255, 215, 0, 0.16);
  border-bottom: none;
  box-shadow: inset 0 8px 20px rgba(255, 215, 0, 0.06);
}
.podium-stand-1::after {
  content: '';
  position: absolute; top: 0; left: 10%; right: 10%; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 215, 0, 0.4), transparent);
}
.podium-stand-2 {
  height: 58px;
  background: linear-gradient(180deg, rgba(192, 192, 192, 0.26), rgba(192, 192, 192, 0.06));
  border: 1px solid rgba(192, 192, 192, 0.12);
  border-bottom: none;
  box-shadow: inset 0 8px 20px rgba(192, 192, 192, 0.04);
}
.podium-stand-3 {
  height: 42px;
  background: linear-gradient(180deg, rgba(205, 127, 50, 0.26), rgba(205, 127, 50, 0.06));
  border: 1px solid rgba(205, 127, 50, 0.12);
  border-bottom: none;
  box-shadow: inset 0 8px 20px rgba(205, 127, 50, 0.04);
}
.podium-slot { justify-content: flex-end; }
.podium-slot::after {
  content: '';
  width: 100%; max-width: 130px; height: 42px;
  border-radius: 10px 10px 0 0;
  border: 1px dashed rgba(255, 255, 255, 0.05);
  border-bottom: none;
}
/* 彩带 */
.confetti-piece {
  position: absolute; top: -12px; width: 6px; height: 6px;
  border-radius: 2px; z-index: 3; pointer-events: none;
  opacity: 0;
  animation: confettiFall 3.2s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
@keyframes confettiFall {
  0% { opacity: 1; transform: translate(0, 0) rotate(0deg); }
  100% { opacity: 0; transform: translate(var(--dx), 420px) rotate(540deg); }
}

/* ===== KPI 玻璃卡（旧版顶部渐变线 + 扫光） ===== */
.kpis {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 14px; margin-bottom: 20px;
}
.kpi {
  position: relative;
  background: var(--card);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: var(--radius-md);
  padding: 20px 16px 16px;
  box-shadow: var(--shadow);
  overflow: hidden;
  backdrop-filter: blur(18px) saturate(150%);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
  animation: fadeSlideUp 0.7s cubic-bezier(0.22, 1, 0.36, 1) backwards;
  transition: transform 0.3s ease, border-color 0.3s ease;
}
.kpi::after {
  content: '';
  position: absolute; top: 0; left: 0;
  width: 100%; height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  opacity: 0.6;
}
.kpi::before {
  content: '';
  position: absolute; top: 0; left: -100%;
  width: 60%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.035), transparent);
  animation: shimmer 3.5s ease-in-out infinite;
  pointer-events: none;
}
@keyframes shimmer {
  0% { transform: translateX(0); }
  60%, 100% { transform: translateX(300%); }
}
.kpi:hover { transform: translateY(-4px); border-color: rgba(108, 99, 255, 0.25); }
.kpi-v {
  font-size: 1.45rem; font-weight: 800;
  background: linear-gradient(135deg, #fff, #a0a0cc);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  font-variant-numeric: tabular-nums;
  animation: countPop 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) backwards;
}
@keyframes countPop {
  0% { opacity: 0; transform: scale(0.5); }
  100% { opacity: 1; transform: scale(1); }
}
.kpi-t { color: var(--text2); font-size: 0.76rem; margin-top: 6px; text-transform: uppercase; letter-spacing: 0.6px; font-weight: 600; }

/* ===== 图表玻璃卡 ===== */
.grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-bottom: 20px; }
@media (max-width: 1100px) {
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .grid { grid-template-columns: 1fr; }
}
.card {
  position: relative;
  background: linear-gradient(145deg, rgba(108, 99, 255, 0.07), rgba(26, 26, 46, 0.85));
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: var(--shadow);
  overflow: hidden;
  backdrop-filter: blur(20px) saturate(150%);
  -webkit-backdrop-filter: blur(20px) saturate(150%);
  animation: fadeSlideUp 0.7s cubic-bezier(0.22, 1, 0.36, 1) backwards;
  transition: transform 0.3s ease, border-color 0.3s ease;
}
.card:nth-of-type(1) { animation-delay: 0.1s; }
.card:nth-of-type(2) { animation-delay: 0.2s; }
.card:nth-of-type(3) { animation-delay: 0.3s; }
.card:nth-of-type(4) { animation-delay: 0.4s; }
.card:nth-of-type(5) { animation-delay: 0.5s; }
.card::before {
  content: '';
  position: absolute; top: 0; left: 0;
  width: 100%; height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent2), var(--accent4));
  opacity: 0.45;
}
.card:hover { transform: translateY(-3px); border-color: rgba(108, 99, 255, 0.22); }
.card h2 {
  font-size: 0.9rem; color: var(--text2); font-weight: 600;
  letter-spacing: 0.8px; margin-bottom: 12px;
  display: flex; align-items: center; gap: 8px;
  text-transform: uppercase;
}
.card h2 .badge {
  font-size: 0.62rem; font-weight: 400;
  background: rgba(108, 99, 255, 0.2); color: var(--accent);
  padding: 2px 8px; border-radius: 6px; letter-spacing: 0.4px;
}
.chart { height: 300px; width: 100%; }

/* ===== 明细表（旧版紫色表头 + 排名颜色 + 头像） ===== */
table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
thead th {
  text-align: left; padding: 11px 14px;
  background: rgba(108, 99, 255, 0.09);
  color: var(--accent);
  font-weight: 600; font-size: 0.74rem;
  text-transform: uppercase; letter-spacing: 0.6px;
  border-bottom: 2px solid rgba(108, 99, 255, 0.16);
  position: sticky; top: 0; z-index: 1;
  backdrop-filter: blur(12px);
}
th, td { padding: 10px 14px; text-align: right; border-bottom: 1px solid rgba(255, 255, 255, 0.04); }
th:first-child, td:first-child, th:nth-child(2), td:nth-child(2), th:nth-child(3), td:nth-child(3), th:nth-child(4), td:nth-child(4) { text-align: left; }
th { color: var(--accent); cursor: pointer; user-select: none; font-weight: 600; }
th:hover { color: #9b94ff; }
td { font-variant-numeric: tabular-nums; }
tbody tr { transition: all 0.3s ease; animation: rowFadeIn 0.4s ease backwards; }
tbody tr:hover { background: rgba(108, 99, 255, 0.06); transform: scale(1.002); }
tbody tr:nth-child(even) { background: rgba(255, 255, 255, 0.015); }
@keyframes rowFadeIn {
  from { opacity: 0; transform: translateX(-10px); }
  to { opacity: 1; transform: translateX(0); }
}
.rank { font-weight: 700; color: var(--text2); }
.rank-1 { color: #ffd700 !important; }
.rank-2 { color: #c0c0c0 !important; }
.rank-3 { color: #cd7f32 !important; }
.name-cell {
  display: flex; align-items: center; gap: 10px; font-weight: 600;
}
.avatar {
  width: 28px; height: 28px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 0.7rem; font-weight: 700; color: #fff; flex-shrink: 0;
  box-shadow: 0 0 10px rgba(108, 99, 255, 0.25);
}

@keyframes fadeSlideUp {
  0% { opacity: 0; transform: translateY(40px) scale(0.96); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

footer { color: var(--text2); font-size: 0.78rem; text-align: center; padding: 18px; letter-spacing: 0.5px; }

@media (max-width: 900px) {
  main { padding: 12px; }
  .topbar {
    padding: 10px 12px;
    padding-top: calc(10px + env(safe-area-inset-top));
    gap: 8px;
  }
  .title h1 { font-size: 1.12rem; }
  .title p { font-size: 0.68rem; margin-top: 2px; }
  .banner { margin: 10px 12px 0; }

  /* 筛选条：一行可横向滑动，触控目标 ≥40px */
  .filters {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    width: 100%;
  }
  .filters::-webkit-scrollbar { display: none; }
  .filters label { flex-shrink: 0; font-size: 0.78rem; }
  .filters input, .filters select {
    min-height: 40px;
    font-size: 0.9rem;
    padding: 6px 10px;
    border-radius: 12px;
  }

  .podium { padding: 22px 6px 0; gap: 6px; border-radius: 18px; }
  .podium-card .medal { font-size: 1.45rem; }
  .podium-name { font-size: 0.8rem; margin-top: 6px; }
  .podium-tokens { font-size: 0.98rem; }
  .podium-sub { font-size: 0.62rem; }
  .podium-bar-wrapper { max-width: 60px; height: 4px; }
  .podium-block { height: 100px; border-radius: 12px 12px 0 0; }
  .rank-1 .podium-block { height: 118px; }
  .podium-stand { max-width: 96px; }
  .podium-stand-1 { height: 62px; }
  .podium-stand-2 { height: 46px; }
  .podium-stand-3 { height: 34px; }
  .podium-slot::after { max-width: 96px; height: 34px; }

  .grid { gap: 12px; }
  .card { padding: 12px; border-radius: 16px; }
  .card h2 { font-size: 0.78rem; margin-bottom: 8px; letter-spacing: 0.4px; }
  .chart { height: 240px; }

  table { font-size: 0.72rem; }
  th, td { padding: 8px 6px; }
  .avatar { width: 22px; height: 22px; font-size: 0.58rem; }
  .name-cell { gap: 6px; }

  footer { padding: 12px; font-size: 0.66rem; padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
}

@media (max-width: 640px) {
  /* KPI 保持一行 6 卡，但卡片固定最小宽度可横滑，避免数字被压扁 */
  .kpis {
    grid-template-columns: repeat(6, minmax(118px, 1fr));
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 4px;
    gap: 8px;
  }
  .kpis::-webkit-scrollbar { display: none; }
  .kpi { padding: 10px 8px; border-radius: 12px; }
  .kpi-v { font-size: 1.02rem; }
  .kpi-t { font-size: 0.6rem; letter-spacing: 0.2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
}

@media (max-width: 420px) {
  .podium-sub { display: none; }
  .podium-tokens { font-size: 0.88rem; }
  .medal { font-size: 1.25rem; }
  .podium-name { font-size: 0.72rem; }
  .chart { height: 220px; }
  .card h2 { font-size: 0.72rem; }
  th, td { padding: 7px 4px; }
}

@media (prefers-reduced-motion: reduce) {
  .orb, .medal, .topbar::after, .podium::before, .kpi::before, .kpi-v, .title h1, .card, .kpi, .podium, .podium-card, .podium-slot, tbody tr { animation: none !important; }
  * { transition: none !important; }
}
