:root {
  --bg: #c7ff6e; /* lime hero background */
  --bg-2: #d6ff9d;
  --bg-1-transparent: rgba(199,255,110,0.85);
  --bg-2-transparent: rgba(214,255,157,0.55);
  --panel: #0f1629;
  --panel-alt: #0c1324;
  --text: #0b0f1a; /* dark body text to match lime hero */
  --panel-text: #e5e7eb; /* light text inside dark panels */
  --muted: #566074;
  --accent: #0b0f1a;
  --accent-2: #7c3aed;
  --border: #1f2a44;
  --success: #22c55e;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  background: radial-gradient(1200px 800px at 80% -10%, rgba(124,58,237,0.12), transparent 60%),
              radial-gradient(1000px 700px at -10% 0%, rgba(0,0,0,0.05), transparent 60%),
              linear-gradient(180deg, var(--bg), var(--bg-2));
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, Helvetica Neue, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  line-height: 1.5;
}

.bg-default {
  background-image:
    radial-gradient(1200px 800px at 80% -10%, rgba(124,58,237,0.10), transparent 60%),
    radial-gradient(1000px 700px at -10% 0%, rgba(0,0,0,0.06), transparent 30%),
    linear-gradient(15deg, var(--bg-1-transparent), var(--bg-2-transparent)),
    url('/bg.webp');
  background-size: cover, cover, cover, cover;
  background-position: center, top, center, top;
  background-repeat: no-repeat, no-repeat, no-repeat, no-repeat;
  background-blend-mode: screen, multiply, normal, normal;
}

.container {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px;
}

.title {
  font-size: 40px;
  font-weight: 700;
  letter-spacing: 0.2px;
  margin: 8px 0 18px;
  background: linear-gradient(90deg, #fff, #c1eaff 40%, #a78bfa 80%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-align: center;
}

.panel {
  background: linear-gradient(180deg, var(--panel), var(--panel-alt));
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.25), inset 0 1px 0 rgba(255,255,255,0.04);
  color: var(--panel-text);
}

.table-wrap { overflow: auto; }
/* Improve mobile momentum scrolling */
.table-wrap { -webkit-overflow-scrolling: touch; }
/* Zebra rows for better readability */
tbody tr:nth-child(even) { background: rgba(255,255,255,0.015); }
.tiers {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  scroll-snap-type: x mandatory;
}
.tier-item {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 8px 12px;
  background: rgba(255,255,255,0.02);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  position: relative;
  scroll-snap-align: start;
}
.tier-item { cursor: pointer; }
.tier-item.active { outline: 2px solid rgba(255,255,255,0.35); outline-offset: 0; }
.tier-dot { width: 8px; height: 8px; border-radius: 999px; background: rgba(255,255,255,0.5); display: inline-block; }
.tier-name { font-weight: 700; letter-spacing: 0.2px; font-size: 14px; color: var(--panel-text); }
.tier-meta { color: var(--panel-text); font-size: 11px; font-weight: 600; opacity: 0.8; }

/* Count badge in corner */
.tier-count {
  position: absolute;
  top: -6px;
  right: -6px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.06);
  color: var(--panel-text);
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 999px;
}

/* Tier color themes - adjust names to match API values */
/* Tier level-based colors (1..10) - distinct per level */
.tier-item[class*="tier-l"] { position: relative; }
.tier-item .tier-name { text-transform: capitalize; }

/* l1 - subtle opaque white */
.tier-item.tier-l1 { background: rgba(255,255,255,0.12); border-color: rgba(255,255,255,0.28); }
.tier-item.tier-l1 .tier-name { color: #e5e7eb; }
/* l2 - cyan */
.tier-item.tier-l2 { background: rgba(6,182,212,0.18); border-color: rgba(6,182,212,0.6); }
.tier-item.tier-l2 .tier-name { color: #99f6e4; }
/* l3 - indigo (more distinct from cyan) */
.tier-item.tier-l3 { background: rgba(99,102,241,0.20); border-color: rgba(99,102,241,0.6); }
.tier-item.tier-l3 .tier-name { color: #c7d2fe; }
/* l4 - green */
.tier-item.tier-l4 { background: rgba(34,197,94,0.18); border-color: rgba(34,197,94,0.6); }
.tier-item.tier-l4 .tier-name { color: #86efac; }
/* l5 - lime */
.tier-item.tier-l5 { background: rgba(132,204,22,0.18); border-color: rgba(132,204,22,0.55); }
.tier-item.tier-l5 .tier-name { color: #bef264; }
/* l6 - yellow */
.tier-item.tier-l6 { background: rgba(234,179,8,0.18); border-color: rgba(234,179,8,0.55); }
.tier-item.tier-l6 .tier-name { color: #fde68a; }
/* l7 - amber */
.tier-item.tier-l7 { background: rgba(245,158,11,0.18); border-color: rgba(245,158,11,0.55); }
.tier-item.tier-l7 .tier-name { color: #fcd34d; }
/* l8 - orange */
.tier-item.tier-l8 { background: rgba(249,115,22,0.18); border-color: rgba(249,115,22,0.55); }
.tier-item.tier-l8 .tier-name { color: #fdba74; }
/* l9 - pink */
.tier-item.tier-l9 { background: rgba(236,72,153,0.18); border-color: rgba(236,72,153,0.55); }
.tier-item.tier-l9 .tier-name { color: #f9a8d4; }
/* l10 - purple */
.tier-item.tier-l10 { background: rgba(124,58,237,0.2); border-color: rgba(124,58,237,0.6); }
.tier-item.tier-l10 .tier-name { color: #c4b5fd; }
table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}
thead th {
  text-align: left;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #93a1b5;
  padding: 14px 16px;
  position: sticky;
  top: 0;
  background: linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0));
  backdrop-filter: blur(4px);
}
tbody td {
  padding: 14px 16px;
  border-top: 1px solid var(--border);
}
tbody tr:hover {
  background: rgba(255,255,255,0.02);
}

.rank {
  width: 56px;
  color: var(--muted);
}
.herotag {
  font-weight: 600;
}
.user-text { font-size: 16px; }
.address {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  color: var(--muted);
}
.user {
  background: none;
  border: 0;
  padding: 0;
  color: inherit;
  cursor: pointer;
}
.user .herotag { transition: opacity 120ms ease, transform 120ms ease; }
.user:hover .herotag { opacity: 0.7; transform: scale(1.03); }
.copied { margin-left: 10px; font-size: 12px; color: var(--muted); }
.search {
  width: 100%;
  padding: 10px 12px;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--panel-text);
  outline: none;
}
.search::placeholder { color: #9aa4ba; }
.search:focus { box-shadow: 0 0 0 2px rgba(124,58,237,0.24); }
.status {
  font-size: 12px;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(124, 58, 237, 0.12);
  color: #c4b5fd;
  display: inline-block;
}
.status.member { background: rgba(0,224,255,0.14); color: #9be9ff; border-color: rgba(0,224,255,0.55); }
.status.core { background: rgba(124,58,237,0.16); color: #c4b5fd; border-color: rgba(124,58,237,0.55); }
/* Level-based badges to mirror tier cards */
.status.l1 { background: rgba(255,255,255,0.12); color: #e5e7eb; border-color: rgba(255,255,255,0.28); }
.status.l2 { background: rgba(6,182,212,0.18); color: #99f6e4; border-color: rgba(6,182,212,0.6); }
.status.l3 { background: rgba(99,102,241,0.20); color: #c7d2fe; border-color: rgba(99,102,241,0.6); }
.status.l4 { background: rgba(34,197,94,0.18); color: #86efac; border-color: rgba(34,197,94,0.6); }
.status.l5 { background: rgba(132,204,22,0.18); color: #bef264; border-color: rgba(132,204,22,0.55); }
.status.l6 { background: rgba(234,179,8,0.18); color: #fde68a; border-color: rgba(234,179,8,0.55); }
.status.l7 { background: rgba(245,158,11,0.18); color: #fcd34d; border-color: rgba(245,158,11,0.55); }
.status.l8 { background: rgba(249,115,22,0.18); color: #fdba74; border-color: rgba(249,115,22,0.55); }
.status.l9 { background: rgba(236,72,153,0.18); color: #f9a8d4; border-color: rgba(236,72,153,0.55); }
.status.l10 { background: rgba(124,58,237,0.2); color: #c4b5fd; border-color: rgba(124,58,237,0.6); }

.points { font-variant-numeric: tabular-nums; }
.big-points { font-size: 16px; font-weight: 700; }

/* Medals for top ranks */
.medal { display:inline-block; width:10px; height:10px; border-radius:999px; margin-right:8px; vertical-align:middle; }
.medal.m1 { background: linear-gradient(180deg, #ffd700, #e5b600); box-shadow: 0 0 0 1px rgba(229,182,0,0.6); }
.medal.m2 { background: linear-gradient(180deg, #d9d9d9, #b3b3b3); box-shadow: 0 0 0 1px rgba(179,179,179,0.6); }
.medal.m3 { background: linear-gradient(180deg, #cd7f32, #a76426); box-shadow: 0 0 0 1px rgba(167,100,38,0.6); }

/* Responsive adjustments */
@media (max-width: 640px) {
  .container { padding: 16px; }
  .title { font-size: 28px; }
  .header { margin-bottom: 20px; }
  .panel { border-radius: 10px; }

  /* Toolbar stacks on small screens */
  .toolbar { flex-direction: column; align-items: stretch; gap: 8px; padding: 8px 8px 8px !important; }
  .badges { order: 2; flex-wrap: wrap; }
  .search-wrap { order: 1; min-width: 0 !important; }
  .search { font-size: 14px; padding: 9px 11px; }

  /* Tiers become horizontal scroll chips */
  .tiers { padding: 0.5rem 0.2rem; overflow-x: auto; flex-wrap: nowrap; gap: 8px; justify-content: flex-start; padding-bottom: 6px; -webkit-overflow-scrolling: touch; }
  .tier-item { padding: 12px 12px; flex: 0 0 auto; min-height: 36px; }
  .tier-name { font-size: 14px; }
  .tier-meta { font-size: 12px; }

  /* Table compaction */
  thead th, tbody td { padding: 10px 12px; }
  .rank { width: 42px; }
  .user-text { font-size: 15px; }
  .big-points { font-size: 15px; }
  /* Hide Tier column (3rd) to save space */
  table thead th:nth-child(3),
  table tbody td:nth-child(3) { display: none; }
}

@media (max-width: 400px) {
  .title { font-size: 24px; }
  .user-text { font-size: 14px; }
  .big-points { font-size: 14px; }
  .rank { width: 36px; }
}

.header {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 40px;
}
.subtle {
  color: var(--muted);
  font-size: 13px;
}

.badge {
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
}

.link {
  color: var(--accent);
  text-decoration: none;
}
.link:hover { text-decoration: underline; }

.footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 24px;
  flex-wrap: wrap;
}


