:root {
  --bg: #f5f5f7;
  --card: rgba(255, 255, 255, 0.72);
  --card-solid: #ffffff;
  --accent: #0071e3;
  --accent2: #ff9500;
  --accent3: #34c759;
  --accent4: #ff3b30;
  --text: #1d1d1f;
  --text2: #6e6e73;
  --glass-border: rgba(0, 0, 0, 0.06);
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 32px rgba(0, 0, 0, 0.08);
  --radius-lg: 20px;
  --radius-md: 14px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { color-scheme: light; }
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;
}

/* ===== 柔和光晕背景层（Apple 风格：克制的淡彩光晕） ===== */
.aurora {
  position: fixed; inset: 0; z-index: 0;
  pointer-events: none; overflow: hidden;
}
.orb {
  position: absolute; border-radius: 50%;
  filter: blur(110px); opacity: 0.7;
  will-change: transform;
}
.o1 {
  width: 640px; height: 640px; left: -160px; top: -180px;
  background: radial-gradient(circle, rgba(0, 113, 227, 0.14), transparent 65%);
  animation: drift1 26s ease-in-out infinite alternate;
}
.o2 {
  width: 560px; height: 560px; right: -140px; top: 6%;
  background: radial-gradient(circle, rgba(175, 82, 222, 0.12), transparent 65%);
  animation: drift2 32s ease-in-out infinite alternate;
}
.o3 {
  width: 720px; height: 720px; left: 28%; bottom: -320px;
  background: radial-gradient(circle, rgba(90, 200, 250, 0.16), 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); }
}

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

/* ===== 顶栏（Apple.com 毛玻璃导航） ===== */
.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: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
}
.title h1 {
  font-size: 1.5rem; font-weight: 700; letter-spacing: -0.02em;
  color: var(--text);
}
.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: var(--card-solid);
  color: var(--text);
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 12px; padding: 7px 10px; font-size: 0.83rem;
  outline: none; transition: all 0.25s ease;
}
.filters input:focus, .filters select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.15);
}
.filters option { background: var(--card-solid); color: var(--text); }

.banner {
  margin: 14px 26px 0; padding: 10px 14px; border-radius: 12px;
  background: rgba(255, 59, 48, 0.08);
  border: 1px solid rgba(255, 59, 48, 0.28);
  color: #d70015; font-size: 0.84rem;
  backdrop-filter: blur(16px);
}
.hidden { display: none; }

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

/* ===== 领奖台（Apple 风格白玻璃） ===== */
.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: var(--card);
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 24px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  animation: fadeSlideUp 0.9s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.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;
}
@keyframes medalFloat {
  0%, 100% { transform: translateY(0) rotate(-2deg); }
  50% { transform: translateY(-6px) rotate(2deg); }
}
.podium-name {
  margin-top: 8px; font-weight: 600; font-size: 1rem;
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.podium-tokens {
  margin-top: 2px; font-size: 1.3rem; font-weight: 700;
  color: var(--text);
  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(0, 0, 0, 0.07); border-radius: 3px;
  margin-top: 10px; overflow: hidden;
}
.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, #f5a623, #ffd60a); }
.podium-bar-2 { background: linear-gradient(90deg, #aeb0b4, #d1d1d6); }
.podium-bar-3 { background: linear-gradient(90deg, #cd7f32, #e8b87a); }
.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(245, 166, 35, 0.3), rgba(245, 166, 35, 0.06));
  border: 1px solid rgba(245, 166, 35, 0.2);
  border-bottom: none;
}
.podium-stand-2 {
  height: 58px;
  background: linear-gradient(180deg, rgba(142, 142, 147, 0.22), rgba(142, 142, 147, 0.05));
  border: 1px solid rgba(142, 142, 147, 0.16);
  border-bottom: none;
}
.podium-stand-3 {
  height: 42px;
  background: linear-gradient(180deg, rgba(205, 127, 50, 0.22), rgba(205, 127, 50, 0.05));
  border: 1px solid rgba(205, 127, 50, 0.16);
  border-bottom: none;
}
.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(0, 0, 0, 0.1);
  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(0, 0, 0, 0.06);
  border-radius: var(--radius-md);
  padding: 20px 16px 16px;
  box-shadow: var(--shadow);
  overflow: hidden;
  backdrop-filter: blur(18px) saturate(180%);
  -webkit-backdrop-filter: blur(18px) saturate(180%);
  animation: fadeSlideUp 0.7s cubic-bezier(0.22, 1, 0.36, 1) backwards;
  transition: transform 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}
.kpi:hover { transform: translateY(-3px); border-color: rgba(0, 113, 227, 0.28); box-shadow: var(--shadow-lg); }
.kpi-v {
  font-size: 1.45rem; font-weight: 700; color: var(--text);
  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.72rem; margin-top: 6px; font-weight: 500; letter-spacing: 0.4px; }

/* ===== 图表玻璃卡 ===== */
.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: var(--card);
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: var(--shadow);
  overflow: hidden;
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  animation: fadeSlideUp 0.7s cubic-bezier(0.22, 1, 0.36, 1) backwards;
  transition: transform 0.3s ease, border-color 0.3s ease, box-shadow 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:hover { transform: translateY(-3px); border-color: rgba(0, 113, 227, 0.2); box-shadow: var(--shadow-lg); }
.card h2 {
  font-size: 0.95rem; color: var(--text); font-weight: 600;
  letter-spacing: -0.01em; margin-bottom: 12px;
  display: flex; align-items: center; gap: 8px;
}
.card h2 .badge {
  font-size: 0.62rem; font-weight: 500;
  background: rgba(0, 113, 227, 0.1); color: var(--accent);
  padding: 2px 8px; border-radius: 6px; letter-spacing: 0.4px;
}
.chart { height: 300px; width: 100%; }

/* ===== 明细表（Apple 风格浅色表格） ===== */
table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
thead th {
  text-align: left; padding: 11px 14px;
  background: rgba(0, 0, 0, 0.02);
  color: var(--text2);
  font-weight: 500; font-size: 0.72rem;
  text-transform: uppercase; letter-spacing: 0.4px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  position: sticky; top: 0; z-index: 1;
  backdrop-filter: blur(12px);
}
th, td { padding: 10px 14px; text-align: right; border-bottom: 1px solid rgba(0, 0, 0, 0.06); }
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(--text2); cursor: pointer; user-select: none; font-weight: 500; }
th:hover { color: var(--accent); }
td { font-variant-numeric: tabular-nums; }
tbody tr { transition: all 0.3s ease; animation: rowFadeIn 0.4s ease backwards; }
tbody tr:hover { background: rgba(0, 113, 227, 0.05); transform: scale(1.002); }
tbody tr:nth-child(even) { background: rgba(0, 0, 0, 0.02); }
tbody tr.model-row { background: transparent !important; animation: none; }
tbody tr.model-row:hover { background: rgba(0, 113, 227, 0.04) !important; transform: none; }
tbody tr.model-row td { padding-top: 6px; padding-bottom: 6px; font-size: 0.82em; color: var(--text2); border-bottom-color: rgba(0, 0, 0, 0.03); }
.model-cell { display: flex; align-items: center; gap: 8px; padding-left: 30px; font-family: var(--mono, ui-monospace, SFMono-Regular, Menlo, monospace); }
.model-branch { color: var(--accent); opacity: 0.7; font-weight: 600; }
@keyframes rowFadeIn {
  from { opacity: 0; transform: translateX(-10px); }
  to { opacity: 1; transform: translateX(0); }
}
.rank { font-weight: 600; color: var(--text2); }
.rank-1 { color: #f5a623 !important; }
.rank-2 { color: #8e8e93 !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 2px 8px rgba(0, 0, 0, 0.15);
}

@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.85rem; margin-bottom: 8px; }
  .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.78rem; }
  th, td { padding: 7px 4px; }
}

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