/* ============================================================
   ATM Pulse — 浅色蓝调 (daylight-blue)
   柔和蓝渐变底 · 纯白圆角卡片 · 一套系统无衬线 · 克制的排版
   ============================================================ */

:root {
  color-scheme: light;

  /* surfaces / planes */
  --surface: #ffffff;
  --surface-soft: #f4f7fd;
  --surface-mute: #eef3fb;
  --page: #eaf1fc;

  --line: rgba(30, 60, 110, 0.1);
  --line-strong: rgba(30, 60, 110, 0.16);

  /* text */
  --text: #14203a;
  --text-dim: #55637a;
  --text-faint: #8a97ac;

  /* primary accent — the only highlight color */
  --blue: #2f7bf0;
  --blue-strong: #1e5fd0;
  --blue-soft: rgba(47, 123, 240, 0.1);
  --blue-glow: rgba(47, 123, 240, 0.22);

  /* secondary series color (used only for a 2nd data series) */
  --teal: #16b8a6;
  --rose: #ef4d6a;

  --tier-bronze: #c78b52;
  --tier-silver: #8493a8;
  --tier-gold: #c8961e;
  --tier-platinum: #3f93cf;

  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Noto Sans CJK SC", "Segoe UI", Roboto, sans-serif;

  --radius: 16px;
  --radius-sm: 12px;

  --shadow: 0 1px 2px rgba(30, 60, 110, 0.05),
    0 10px 30px -14px rgba(30, 60, 110, 0.14);
  --shadow-lift: 0 2px 4px rgba(30, 60, 110, 0.06),
    0 22px 48px -18px rgba(30, 60, 110, 0.2);
}

* {
  box-sizing: border-box;
}

html {
  scrollbar-color: var(--line-strong) transparent;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(1200px 620px at 82% -12%, rgba(47, 123, 240, 0.14), transparent 55%),
    linear-gradient(180deg, #dde8fb 0%, #ebf1fc 30%, #ffffff 82%);
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--font);
  font-size: 14.5px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
}

a {
  color: inherit;
  text-decoration: none;
}

.wrap {
  position: relative;
  z-index: 1;
  width: min(1280px, calc(100vw - 48px));
  margin: 0 auto;
  padding-bottom: 96px;
}

/* ---------- top nav ---------- */

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 26px 0 8px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0.01em;
  color: var(--text);
}

.brand-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--blue);
  box-shadow: 0 0 0 4px var(--blue-soft);
  animation: pulse-dot 2.4s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(0.7); opacity: 0.6; }
}

.brand-sub {
  color: var(--text-faint);
  font-size: 13px;
  font-weight: 500;
}

.nav-note {
  color: var(--text-faint);
  font-size: 13px;
}

.nav-note strong {
  color: var(--text-dim);
  font-weight: 600;
}

.nav-note a:hover {
  color: var(--blue);
}

.nav-cta {
  flex: none;
  border: 0;
  border-radius: 999px;
  padding: 9px 18px;
  background: var(--blue);
  color: #fff;
  font-size: 13.5px;
  font-weight: 600;
  box-shadow: 0 6px 16px -6px var(--blue-glow);
  transition: background 140ms ease, transform 140ms ease,
    box-shadow 140ms ease;
}

.nav-cta:hover {
  background: var(--blue-strong);
  transform: translateY(-1px);
  box-shadow: 0 10px 22px -8px var(--blue-glow);
}

/* ---------- hero (index) ---------- */

.hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
  gap: 40px;
  align-items: center;
  padding: 40px 0 36px;
}

.hero h1 {
  margin: 0;
  font-size: clamp(38px, 5vw, 54px);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.1;
  color: var(--text);
}

.hero h1 em {
  font-style: normal;
  color: var(--blue);
}

.hero p {
  margin: 14px 0 0;
  max-width: 42ch;
  color: var(--text-dim);
  font-size: 14.5px;
}

.hero-pulse {
  min-width: 0;
  padding: 22px 24px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.hero-pulse .pulse-caption {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  color: var(--text-faint);
  font-size: 12.5px;
  margin-bottom: 8px;
}

.hero-pulse .pulse-caption b {
  color: var(--text-dim);
  font-weight: 600;
}

.pulse-svg {
  display: block;
  width: 100%;
  height: 92px;
}

.pulse-svg .line {
  fill: none;
  stroke: var(--blue);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 2400;
  stroke-dashoffset: 2400;
  animation: draw-line 2s cubic-bezier(0.5, 0, 0.2, 1) 0.25s forwards;
}

.pulse-svg .fill {
  fill: url(#pulseFill);
  opacity: 0;
  animation: fade-in 0.9s ease 1.4s forwards;
}

@keyframes draw-line {
  to { stroke-dashoffset: 0; }
}

/* ---------- community stat band ---------- */

.statband {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
}

.statband > div {
  padding: 18px 20px 20px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.stat-label {
  color: var(--text-faint);
  font-size: 13px;
  font-weight: 500;
}

.stat-value {
  margin-top: 10px;
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  line-height: 1.1;
}

.stat-value .currency-symbol {
  margin-right: 1px;
  color: var(--text-faint);
  font-size: 0.62em;
  font-weight: 600;
}

.stat-value .unit {
  margin-left: 3px;
  color: var(--text-faint);
  font-size: 0.5em;
  font-weight: 600;
}

/* the single highlighted metric */
.stat-value.amber { color: var(--blue); }

/* ---------- community heatmap ---------- */

.activity-strip {
  margin-top: 26px;
  padding: 24px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  width: 100%;
}

.activity-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.activity-head h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
}

.activity-head span {
  color: var(--text-faint);
  font-size: 12.5px;
}

.community-calendar {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  grid-template-rows: 18px auto;
  gap: 7px 10px;
  width: 100%;
}

.community-months {
  grid-column: 2;
  display: grid;
  align-items: center;
  min-width: 0;
  color: var(--text-faint);
  font-size: 11px;
}

.community-months span {
  overflow: visible;
  white-space: nowrap;
}

.community-weekdays {
  grid-column: 1;
  grid-row: 2;
  display: grid;
  grid-template-rows: repeat(7, minmax(0, 1fr));
  align-items: center;
  color: var(--text-faint);
  font-size: 11px;
}

.community-heatmap {
  grid-column: 2;
  grid-row: 2;
  display: grid;
  grid-template-columns: repeat(53, minmax(0, 1fr));
  grid-template-rows: repeat(7, minmax(0, 1fr));
  gap: 4px;
  width: 100%;
  min-height: 168px;
}

.community-hm-cell {
  border-radius: 4px;
  background: var(--surface-mute);
  opacity: 0;
  animation: fade-in 0.35s ease forwards;
}

.community-hm-cell.l0 { background: #eef3fb; }
.community-hm-cell.l1 { background: #dbe8fb; }
.community-hm-cell.l2 { background: #c2d9f6; }
.community-hm-cell.l3 { background: #a6c7f1; }
.community-hm-cell.l4 { background: #86b6ee; }
.community-hm-cell.l5 { background: #6da7ea; }
.community-hm-cell.l6 { background: #4f96e7; }
.community-hm-cell.l7 { background: #2f7bf0; }
.community-hm-cell.l8 { background: #1e5fd0; }
.community-hm-cell.l9 { background: #164ba8; }
.community-hm-cell.filler {
  opacity: 0.5;
}
.community-heatmap-legend {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
  margin-top: 14px;
  color: var(--text-faint);
  font-size: 11.5px;
}

.community-heatmap-legend i {
  width: 13px;
  height: 13px;
  border-radius: 3px;
  display: inline-block;
}

.community-heatmap-legend .l0 { background: #eef3fb; }
.community-heatmap-legend .l1 { background: #dbe8fb; }
.community-heatmap-legend .l2 { background: #c2d9f6; }
.community-heatmap-legend .l3 { background: #a6c7f1; }
.community-heatmap-legend .l4 { background: #86b6ee; }
.community-heatmap-legend .l5 { background: #6da7ea; }
.community-heatmap-legend .l6 { background: #4f96e7; }
.community-heatmap-legend .l7 { background: #2f7bf0; }
.community-heatmap-legend .l8 { background: #1e5fd0; }
.community-heatmap-legend .l9 { background: #164ba8; }

/* ---------- section headers ---------- */

.section {
  margin-top: 52px;
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
}

.section-head h2 {
  margin: 0;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.section-note {
  color: var(--text-faint);
  font-size: 12.5px;
}

/* ---------- window tabs ---------- */

.tabs {
  display: inline-flex;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.tabs button {
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--text-dim);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  padding: 6px 16px;
  cursor: pointer;
  transition: color 140ms ease, background 140ms ease;
}

.tabs button:hover {
  color: var(--text);
}

.tabs button.active {
  background: var(--blue);
  color: #fff;
}

/* ---------- podium (top 3) ---------- */

.podium {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

.podium-card {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 20px;
  opacity: 0;
  transform: translateY(14px);
  animation: rise-in 0.55s cubic-bezier(0.2, 0.7, 0.3, 1) forwards;
}

.podium-card:nth-child(1) { animation-delay: 0.08s; }
.podium-card:nth-child(2) { animation-delay: 0.18s; }
.podium-card:nth-child(3) { animation-delay: 0.28s; }

.podium-card.rank-1 {
  border-color: rgba(47, 123, 240, 0.35);
  background: linear-gradient(165deg, #f3f7ff, var(--surface) 60%);
  box-shadow: var(--shadow-lift);
}

.podium-rank {
  display: inline-block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-faint);
  margin-bottom: 12px;
}

.rank-1 .podium-rank { color: var(--tier-gold); }
.rank-2 .podium-rank { color: var(--tier-silver); }
.rank-3 .podium-rank { color: var(--tier-bronze); }

.podium-user {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-bottom: 14px;
}

.podium-name {
  font-size: 16px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.podium-tokens {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--blue);
}

.podium-tokens .unit {
  color: var(--text-faint);
  font-size: 0.5em;
  font-weight: 600;
}

.podium-meta {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  color: var(--text-faint);
  font-size: 12.5px;
}

.podium-meta b {
  color: var(--text-dim);
  font-weight: 600;
}

/* ---------- avatar sigils ---------- */

.sigil {
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: 11px;
  display: inline-grid;
  place-items: center;
  font-size: 15px;
  font-weight: 700;
  color: #ffffff;
  text-transform: uppercase;
}

.sigil.small {
  width: 28px;
  height: 28px;
  border-radius: 9px;
  font-size: 12px;
}

/* ---------- ledger rows (rank 4+) ---------- */

.ledger {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.ledger-head,
.ledger-row {
  display: grid;
  grid-template-columns: 56px minmax(0, 2.1fr) minmax(0, 1.2fr) 96px 96px 74px;
  gap: 12px;
  align-items: center;
  padding: 0 20px;
}

.ledger-head {
  height: 44px;
  color: var(--text-faint);
  font-size: 12.5px;
  font-weight: 500;
  border-bottom: 1px solid var(--line);
  background: var(--surface-soft);
}

.ledger-row {
  height: 58px;
  border-bottom: 1px solid var(--line);
  transition: background 130ms ease;
}

.ledger-row:last-child {
  border-bottom: 0;
}

.ledger-row:hover {
  background: var(--blue-soft);
}

.ledger-rank {
  font-size: 15px;
  color: var(--text-faint);
}

.ledger-user {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
  font-weight: 600;
}

.ledger-user span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ledger-tool {
  color: var(--text-faint);
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ledger-num {
  font-size: 14.5px;
  text-align: right;
}

.ledger-num.strong {
  color: var(--blue);
  font-weight: 700;
}

.ledger-num .unit,
.recent-table .unit {
  color: var(--text-faint);
  font-size: 0.74em;
}

.ledger-badges {
  text-align: right;
  font-size: 13px;
  color: var(--text-dim);
}

/* ---------- distribution bars ---------- */

.dist-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.dist-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 20px 20px 14px;
}

.dist-panel h3 {
  margin: 0 0 16px;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

.bar-row {
  display: grid;
  grid-template-columns: minmax(0, 150px) minmax(0, 1fr) 76px;
  gap: 12px;
  align-items: center;
  padding: 6px 0;
}

.bar-name {
  font-size: 13px;
  color: var(--text-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bar-track {
  height: 8px;
  border-radius: 999px;
  background: var(--surface-mute);
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--blue);
  width: 0;
  transition: width 0.9s cubic-bezier(0.2, 0.7, 0.3, 1);
}

.bar-fill.teal {
  background: var(--teal);
}

.bar-val {
  font-size: 12.5px;
  color: var(--text-dim);
  text-align: right;
}

/* ---------- profile page ---------- */

.profile-head {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 24px;
  margin-top: 20px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.profile-head .sigil {
  width: 60px;
  height: 60px;
  border-radius: 18px;
  font-size: 23px;
}

.profile-id {
  min-width: 0;
}

.profile-id h1 {
  margin: 0;
  font-size: clamp(22px, 3.4vw, 30px);
  font-weight: 800;
  letter-spacing: -0.02em;
}

.profile-id .pid {
  color: var(--text-faint);
  font-size: 13px;
}

.profile-rank {
  margin-left: auto;
  text-align: right;
}

.profile-rank .stat-label {
  display: block;
}

.profile-rank .stat-value {
  margin-top: 4px;
  color: var(--blue);
}

.profile-rank .of {
  color: var(--text-faint);
  font-size: 0.46em;
  font-weight: 600;
}

/* heatmap */

.heatmap-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 20px;
  overflow: hidden;
}

.profile-calendar {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  grid-template-rows: 18px auto;
  gap: 8px 10px;
  width: 100%;
}

.profile-months {
  grid-column: 2;
  display: grid;
  align-items: center;
  min-width: 0;
  color: var(--text-faint);
  font-size: 11px;
}

.profile-months span {
  overflow: visible;
  white-space: nowrap;
}

.profile-weekdays {
  grid-column: 1;
  grid-row: 2;
  display: grid;
  grid-template-rows: repeat(7, minmax(0, 1fr));
  align-items: center;
  color: var(--text-faint);
  font-size: 11px;
}

.heatmap {
  grid-column: 2;
  grid-row: 2;
  display: grid;
  grid-template-rows: repeat(7, minmax(0, 1fr));
  gap: 4px;
  width: 100%;
  min-height: 152px;
}

.hm-cell {
  border-radius: 4px;
  background: #eef3fb;
  opacity: 0;
  animation: fade-in 0.4s ease forwards;
}

.hm-cell.l0 { background: #eef3fb; }
.hm-cell.l1 { background: #dbe8fb; }
.hm-cell.l2 { background: #c2d9f6; }
.hm-cell.l3 { background: #a6c7f1; }
.hm-cell.l4 { background: #86b6ee; }
.hm-cell.l5 { background: #6da7ea; }
.hm-cell.l6 { background: #4f96e7; }
.hm-cell.l7 { background: #2f7bf0; }
.hm-cell.l8 { background: #1e5fd0; }
.hm-cell.l9 { background: #164ba8; }
.hm-cell.filler {
  opacity: 0.5;
}

.heatmap-legend {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
  margin-top: 14px;
  color: var(--text-faint);
  font-size: 11.5px;
}

.heatmap-legend i {
  width: 13px;
  height: 13px;
  border-radius: 3px;
  display: inline-block;
}

.heatmap-legend .l0 { background: #eef3fb; }
.heatmap-legend .l1 { background: #dbe8fb; }
.heatmap-legend .l2 { background: #c2d9f6; }
.heatmap-legend .l3 { background: #a6c7f1; }
.heatmap-legend .l4 { background: #86b6ee; }
.heatmap-legend .l5 { background: #6da7ea; }
.heatmap-legend .l6 { background: #4f96e7; }
.heatmap-legend .l7 { background: #2f7bf0; }
.heatmap-legend .l8 { background: #1e5fd0; }
.heatmap-legend .l9 { background: #164ba8; }

.private-state b,
.private-state span {
  display: block;
}

.private-state b {
  margin-bottom: 8px;
  color: var(--text);
  font-size: 18px;
}

/* achievements */

.badge-wall {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 14px;
}

.badge {
  position: relative;
  display: flex;
  gap: 13px;
  align-items: flex-start;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 15px;
}

.badge.unlocked {
  border-color: color-mix(in srgb, var(--tier-color) 38%, transparent);
  background: linear-gradient(
    160deg,
    color-mix(in srgb, var(--tier-color) 11%, var(--surface)),
    var(--surface) 60%
  );
}

.badge.locked {
  opacity: 0.5;
  filter: saturate(0.3);
}

.badge-hex {
  flex: none;
  width: 42px;
  height: 46px;
  display: grid;
  place-items: center;
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
  background: color-mix(in srgb, var(--tier-color) 20%, var(--surface-mute));
  color: color-mix(in srgb, var(--tier-color) 70%, #263449);
  font-size: 17px;
}

.badge.unlocked .badge-hex {
  color: color-mix(in srgb, var(--tier-color) 52%, #1a2434);
  box-shadow: 0 6px 16px -8px color-mix(in srgb, var(--tier-color) 55%, transparent);
}

.badge-body b {
  display: block;
  font-size: 14px;
  margin-bottom: 3px;
}

.badge-body small {
  color: var(--text-faint);
  font-size: 12.5px;
  line-height: 1.4;
  display: block;
}

.badge-date {
  margin-top: 6px;
  font-size: 11.5px;
  color: color-mix(in srgb, var(--tier-color) 58%, var(--text-faint));
  white-space: nowrap;
}

/* recent detail table */

.recent-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow-x: auto;
}

.recent-table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
  font-size: 13px;
}

.recent-table th {
  position: sticky;
  top: 0;
  text-align: left;
  padding: 12px 16px;
  color: var(--text-faint);
  font-size: 12.5px;
  font-weight: 500;
  border-bottom: 1px solid var(--line);
  background: var(--surface-soft);
  white-space: nowrap;
}

.recent-table td {
  padding: 11px 16px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.recent-table tr:last-child td {
  border-bottom: 0;
}

.recent-table td.dim {
  color: var(--text-faint);
}

.recent-table td.model {
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.recent-table td.num {
  text-align: right;
}

.recent-table td.num.strong {
  color: var(--blue);
  font-weight: 600;
}

/* ---------- agent / model rankings (index section) ---------- */

/* section-head carrying the title + dimension toggle on the left,
   the window toggle on the right */
.rank-head-row {
  flex-wrap: wrap;
  gap: 14px;
}

.rank-title {
  display: flex;
  align-items: center;
  gap: 16px;
}

.rank-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
  margin-bottom: 18px;
  color: var(--text-faint);
  font-size: 13px;
}

.rank-summary b {
  color: var(--text);
  font-weight: 700;
}

.rank-list {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.rank-head,
.rank-row {
  display: grid;
  grid-template-columns:
    44px minmax(0, 1.7fr) minmax(0, 1.5fr) 92px 62px 84px;
  gap: 14px;
  align-items: center;
  padding: 0 20px;
}

.rank-head {
  height: 44px;
  color: var(--text-faint);
  font-size: 12.5px;
  font-weight: 500;
  border-bottom: 1px solid var(--line);
  background: var(--surface-soft);
}

.rank-row {
  min-height: 62px;
  padding-top: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
  transition: background 130ms ease;
}

.rank-row:last-child {
  border-bottom: 0;
}

.rank-row:hover {
  background: var(--blue-soft);
}

.rank-pos {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-faint);
  background: var(--surface-mute);
}

.rank-pos.top-1 { color: #fff; background: var(--tier-gold); }
.rank-pos.top-2 { color: #fff; background: var(--tier-silver); }
.rank-pos.top-3 { color: #fff; background: var(--tier-bronze); }

.rank-name {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.rank-name b {
  font-size: 14.5px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rank-name small {
  color: var(--text-faint);
  font-size: 12px;
}

.rank-name small .unit {
  font-size: 0.85em;
}

.rank-bar {
  min-width: 0;
}

.rank-bar .bar-track {
  display: block;
  width: 100%;
}

/* Width is inlined at render time; no rAF/transition so the bar is always
   correct regardless of animation timing. `display:block` so the fill span
   honors width/height (inline spans ignore both). */
.rank-bar .bar-fill {
  display: block;
  transition: none;
}

.rank-tokens {
  text-align: right;
  font-size: 14.5px;
  font-weight: 700;
  color: var(--blue);
}

.rank-tokens .unit {
  color: var(--text-faint);
  font-size: 0.74em;
  font-weight: 600;
}

.rank-share {
  text-align: right;
  font-size: 13px;
  color: var(--text-dim);
}

.rank-col-delta {
  text-align: right;
}

.rank-delta {
  display: inline-block;
  font-size: 12.5px;
  font-weight: 600;
}

.rank-delta.up { color: var(--teal); }
.rank-delta.down { color: var(--rose); }
.rank-delta.flat { color: var(--text-faint); font-weight: 500; }

/* ---------- shared bits ---------- */

.empty-state,
.error-state {
  padding: 64px 20px;
  text-align: center;
  color: var(--text-faint);
  font-size: 14px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
}

.error-state {
  color: var(--rose);
}

/* inline loading state: small spinner + label, shares the empty-state frame */
.loader {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 64px 20px;
  color: var(--text-faint);
  font-size: 13.5px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  animation: fade-in 0.3s ease;
}

.loader::before {
  content: "";
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--blue-soft);
  border-top-color: var(--blue);
  animation: spin 0.7s linear infinite;
}

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

.footer {
  margin-top: 72px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  color: var(--text-faint);
  font-size: 12.5px;
}

.footer a {
  color: var(--text-dim);
}

.footer a:hover {
  color: var(--blue);
}

.reveal {
  opacity: 0;
  transform: translateY(14px);
  animation: rise-in 0.55s cubic-bezier(0.2, 0.7, 0.3, 1) forwards;
}

@keyframes rise-in {
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fade-in {
  to { opacity: 1; }
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 860px) {
  .hero {
    grid-template-columns: 1fr;
    gap: 26px;
  }

  .statband {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .community-calendar {
    grid-template-columns: 20px minmax(0, 1fr);
    gap: 6px 8px;
  }

  .profile-calendar {
    grid-template-columns: 20px minmax(0, 1fr);
    gap: 6px 8px;
  }

  .community-heatmap,
  .heatmap {
    gap: 3px;
    min-height: 128px;
  }

  .podium {
    grid-template-columns: 1fr;
  }

  .dist-grid {
    grid-template-columns: 1fr;
  }

  .ledger-head,
  .ledger-row {
    grid-template-columns: 38px minmax(0, 1.35fr) minmax(0, 0.85fr) 72px;
    gap: 8px;
    padding: 0 14px;
  }

  .ledger-head span:nth-child(5),
  .ledger-head span:nth-child(6) {
    display: none;
  }

  .ledger-col-active,
  .ledger-badges {
    display: none;
  }

  .rank-head,
  .rank-row {
    grid-template-columns: 40px minmax(0, 1.5fr) 84px 76px;
    gap: 10px;
    padding: 0 14px;
  }

  .rank-col-bar,
  .rank-col-share {
    display: none;
  }

  .profile-head {
    flex-wrap: wrap;
  }
}

@media (max-width: 560px) {
  .wrap {
    width: min(100vw - 28px, 1280px);
  }

  .nav {
    align-items: flex-start;
  }

  .statband {
    grid-template-columns: 1fr;
  }

  .community-calendar {
    grid-template-columns: 18px minmax(0, 1fr);
    gap: 5px 6px;
  }

  .profile-calendar {
    grid-template-columns: 18px minmax(0, 1fr);
    gap: 5px 6px;
  }

  .community-months,
  .community-weekdays {
    font-size: 10px;
  }

  .community-heatmap {
    gap: 2px;
    min-height: 96px;
  }

  .section-head {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-delay: 0s !important;
    transition-duration: 0.01ms !important;
  }
}
