:root {
  --bg-top: #f5f7fb;
  --bg-bottom: #e9eef8;
  --card: rgba(255, 255, 255, 0.72);
  --card-strong: rgba(255, 255, 255, 0.84);
  --line: rgba(15, 23, 42, 0.08);
  --line-strong: rgba(15, 23, 42, 0.14);
  --text: #0f172a;
  --muted: #64748b;
  --accent: #0071e3;
  --accent-soft: rgba(0, 113, 227, 0.12);
  --success: #14805e;
  --danger: #b42318;
  --shadow: 0 24px 70px rgba(15, 23, 42, 0.12);
  --shadow-soft: 0 12px 40px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100vh;
}

body {
  font-family:
    "SF Pro Display",
    "SF Pro Text",
    "PingFang SC",
    "Hiragino Sans GB",
    "Segoe UI",
    sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.95), transparent 28%),
    radial-gradient(circle at 85% 10%, rgba(0, 113, 227, 0.12), transparent 24%),
    linear-gradient(180deg, var(--bg-top) 0%, var(--bg-bottom) 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.3), transparent 36%),
    radial-gradient(circle at 10% 20%, rgba(255, 255, 255, 0.6), transparent 18%);
}

button {
  font: inherit;
}

.shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 48px;
  position: relative;
  z-index: 1;
}

.hero {
  display: grid;
  grid-template-columns: 1.65fr 1fr;
  gap: 16px;
  margin-bottom: 18px;
}

.hero-copy,
.hero-panel,
.summary-card,
.board,
.tabs {
  backdrop-filter: blur(26px) saturate(160%);
  -webkit-backdrop-filter: blur(26px) saturate(160%);
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.hero-copy {
  border-radius: 32px;
  padding: 26px;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--accent);
  font-size: 0.82rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-weight: 700;
}

h1 {
  margin: 0;
  font-size: clamp(2.6rem, 7vw, 4.8rem);
  line-height: 0.95;
  letter-spacing: -0.04em;
  font-weight: 700;
}

.subtitle {
  margin: 14px 0 0;
  max-width: 36rem;
  color: var(--muted);
  line-height: 1.68;
  font-size: 0.96rem;
}

.hero-panel {
  border-radius: 32px;
  padding: 14px;
  display: grid;
  gap: 12px;
}

.stat-card,
.summary-card {
  border-radius: 24px;
  padding: 16px 18px;
  background: var(--card-strong);
  box-shadow: var(--shadow-soft);
}

.stat-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.stat-card strong,
.summary-card strong,
.board-title,
.rank-number,
.user-name,
.token-value {
  letter-spacing: -0.02em;
}

.stat-label,
.stat-hint,
.summary-label,
.board-meta,
.user-meta,
.token-label {
  color: var(--muted);
}

.controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.tabs {
  display: inline-flex;
  gap: 8px;
  padding: 8px;
  border-radius: 999px;
}

.tab,
.refresh-button {
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  transition:
    transform 0.18s ease,
    box-shadow 0.18s ease,
    background 0.18s ease,
    color 0.18s ease;
}

.tab {
  background: transparent;
  color: var(--muted);
  padding: 11px 18px;
  font-weight: 600;
}

.tab:hover,
.refresh-button:hover {
  transform: translateY(-1px);
}

.tab.is-active {
  background: linear-gradient(180deg, #1185ff 0%, #0071e3 100%);
  color: white;
  box-shadow: 0 10px 24px rgba(0, 113, 227, 0.24);
}

.refresh-button {
  padding: 12px 20px;
  color: white;
  background: linear-gradient(180deg, #1185ff 0%, #0071e3 100%);
  box-shadow: 0 14px 30px rgba(0, 113, 227, 0.24);
  font-weight: 600;
}

.refresh-button:disabled {
  opacity: 0.72;
  cursor: default;
  transform: none;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 14px;
}

.summary-card strong {
  display: block;
  margin-top: 8px;
  font-size: clamp(1.4rem, 3vw, 2.1rem);
}

.summary-inline {
  margin-top: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.summary-note {
  color: var(--muted);
  font-size: 0.84rem;
}

.summary-cost {
  color: var(--text);
  font-size: 0.88rem;
  font-weight: 600;
}

.board {
  border-radius: 32px;
  padding: 18px;
}

.board-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.board-title {
  margin: 0 0 6px;
  font-size: 1.45rem;
  font-weight: 700;
}

.status-pill {
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(20, 128, 94, 0.12);
  color: var(--success);
  font-size: 0.92rem;
  font-weight: 700;
  border: 1px solid rgba(20, 128, 94, 0.14);
}

.leaderboard-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.leaderboard-item {
  display: grid;
  grid-template-columns: 120px 1fr 150px;
  gap: 16px;
  align-items: center;
  padding: 14px 16px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-soft);
}

.leaderboard-item:nth-child(1) {
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.78), rgba(244, 248, 255, 0.88)),
    var(--card-strong);
  border-color: rgba(0, 113, 227, 0.18);
}

.leaderboard-gold {
  background:
    linear-gradient(135deg, rgba(255, 250, 227, 0.96), rgba(255, 255, 255, 0.86)),
    var(--card-strong);
  border-color: rgba(221, 170, 39, 0.28);
}

.leaderboard-silver {
  background:
    linear-gradient(135deg, rgba(244, 247, 252, 0.96), rgba(255, 255, 255, 0.86)),
    var(--card-strong);
  border-color: rgba(148, 163, 184, 0.28);
}

.leaderboard-bronze {
  background:
    linear-gradient(135deg, rgba(251, 236, 223, 0.96), rgba(255, 255, 255, 0.86)),
    var(--card-strong);
  border-color: rgba(180, 111, 66, 0.28);
}

.leaderboard-empty {
  grid-template-columns: 1fr;
  text-align: center;
  color: var(--muted);
  min-height: 120px;
  place-items: center;
}

.rank-block,
.user-block,
.token-block {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.rank-number {
  font-size: 1.15rem;
  font-weight: 700;
}

.rank-medal {
  min-height: 1.2rem;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 700;
}

.leaderboard-gold .rank-medal {
  color: #b88306;
}

.leaderboard-silver .rank-medal {
  color: #667085;
}

.leaderboard-bronze .rank-medal {
  color: #b15b2d;
}

.rank-badge {
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 600;
}

.user-name {
  font-size: 1rem;
  font-weight: 700;
}

.user-meta {
  font-size: 0.86rem;
}

.token-block {
  align-items: flex-end;
}

.token-value {
  font-size: 1.12rem;
  font-weight: 700;
}

.token-label {
  font-size: 0.82rem;
}

.cost-value {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.82rem;
}

.loading-state,
.error-box,
.debug-box {
  border-radius: 20px;
  padding: 18px;
}

.loading-state {
  min-height: 280px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--muted);
}

.spinner {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 3px solid rgba(15, 23, 42, 0.12);
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}

.error-box {
  margin-bottom: 14px;
  color: var(--danger);
  background: rgba(180, 35, 24, 0.08);
  border: 1px solid rgba(180, 35, 24, 0.12);
}

.debug-box {
  margin-bottom: 14px;
  overflow-x: auto;
  background: #111827;
  color: #f8fafc;
  line-height: 1.55;
  font-size: 0.84rem;
}

.hidden {
  display: none;
}

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

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

  .controls,
  .board-header {
    flex-direction: column;
    align-items: stretch;
  }

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

  .leaderboard-item {
    grid-template-columns: 1fr;
  }

  .token-block {
    align-items: flex-start;
  }

  .shell {
    width: min(100%, calc(100% - 20px));
    padding: 16px 0 28px;
  }

  .hero-copy,
  .hero-panel,
  .board {
    border-radius: 26px;
  }
}
