@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap');

*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg-primary: #0d0d0d;
  --bg-card: #1a1a1a;
  --bg-card-hover: #242424;
  --gold: #c9a84c;
  --gold-dim: rgba(201, 168, 76, 0.15);
  --red: #e74c3c;
  --green: #2ecc71;
  --text-primary: #ffffff;
  --text-secondary: #999999;
  --text-muted: #555555;
  --divider: #2a2a2a;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

img {
  max-width: 100%;
  display: block;
}

/* ── Navbar ── */

.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 2rem;
  background: rgba(13, 13, 13, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--divider);
}

.navbar-brand {
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gold);
}

.navbar-brand span {
  color: var(--text-secondary);
  font-weight: 500;
}

.navbar-links a {
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-secondary);
  transition: color 0.2s;
}

.navbar-links a:hover {
  color: var(--gold);
}

/* ── Homepage Hero ── */

.site-hero {
  padding: 8rem 2rem 3rem;
  text-align: center;
}

.site-hero h1 {
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  line-height: 1.1;
}

.site-hero h1 .gold {
  color: var(--gold);
}

.site-hero p {
  margin-top: 1rem;
  font-size: 1.1rem;
  color: var(--text-secondary);
  max-width: 500px;
  margin-inline: auto;
}

/* ── Leaderboard Table ── */

.leaderboard-section {
  max-width: 700px;
  margin: 2rem auto 3rem;
  padding: 0 2rem;
}

.leaderboard-section h2 {
  font-size: 1.1rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--divider);
}

.leaderboard-table {
  width: 100%;
  border-collapse: collapse;
}

.leaderboard-table th {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  text-align: left;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--divider);
}

.leaderboard-table th:last-child {
  text-align: right;
}

.leaderboard-table td {
  padding: 0.85rem 0;
  border-bottom: 1px solid rgba(42, 42, 42, 0.5);
  vertical-align: middle;
}

.leaderboard-table tr:last-child td {
  border-bottom: none;
}

.leaderboard-table tr[data-href] {
  cursor: pointer;
  transition: background 0.2s;
}

.leaderboard-table tr[data-href]:hover {
  background: var(--bg-card);
}

.leaderboard-table tr[data-href]:active {
  background: var(--bg-card-hover);
}

.leaderboard-table td:last-child {
  text-align: right;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.leaderboard-rank {
  font-weight: 700;
  color: var(--text-muted);
  width: 2rem;
}

.leaderboard-player {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.leaderboard-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--bg-card);
}

.leaderboard-name {
  font-weight: 600;
  font-size: 0.95rem;
}

.leaderboard-name a:hover {
  color: var(--gold);
  transition: color 0.2s;
}

/* ── Player Card Grid ── */

.players-section {
  max-width: 1100px;
  margin: 0 auto 4rem;
  padding: 0 2rem;
}

.section-title {
  font-size: 1.1rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--divider);
}

.players-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1.25rem;
}

.player-card {
  background: var(--bg-card);
  border-radius: 12px;
  overflow: hidden;
  transition: transform 0.25s ease, background 0.25s ease;
  cursor: pointer;
}

.player-card:hover {
  transform: translateY(-4px);
  background: var(--bg-card-hover);
}

.player-card-img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  background: #222;
}

.player-card-body {
  padding: 1rem;
  text-align: center;
}

.player-card-name {
  font-size: 0.95rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.player-card-profit {
  margin-top: 0.35rem;
  font-size: 1.1rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

/* ── Color Utilities ── */

.positive {
  color: var(--gold);
}

.negative {
  color: var(--red);
}

.neutral {
  color: var(--text-secondary);
}

/* ── Player Profile: Hero ── */

.profile-hero {
  position: relative;
  width: 100%;
  height: 340px;
  overflow: hidden;
  margin-top: 57px;
}

.profile-hero img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-hero::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 70%;
  background: linear-gradient(to top, var(--bg-primary) 0%, transparent 100%);
}

.profile-hero-content {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  max-width: 800px;
  margin: 0 auto;
  padding: 0 3rem 1.5rem;
  z-index: 2;
}

.profile-name {
  font-size: clamp(2.5rem, 6vw, 4rem);
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  line-height: 1;
}

/* ── Player Profile: Stats ── */

.profile-body {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 3rem;
}

.profile-earnings {
  margin-top: 1.5rem;
}

.profile-earnings-amount {
  font-size: 2.2rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.profile-earnings-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 0.15rem;
}

.profile-divider {
  border: none;
  border-top: 1px solid var(--divider);
  margin: 1.5rem 0;
}

.profile-stats-row {
  display: flex;
  gap: 0;
  margin-bottom: 0.5rem;
}

.profile-stat {
  flex: 1;
  padding: 0.5rem 0;
}

.profile-stat:not(:last-child) {
  border-right: 1px solid var(--divider);
  padding-right: 1.5rem;
  margin-right: 1.5rem;
}

.profile-stat-value {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--gold);
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}

.profile-stat-label {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 0.15rem;
}

/* ── Player Profile: Session Results ── */

.profile-sessions {
  margin-top: 2.5rem;
  padding-bottom: 4rem;
}

.session-group-title {
  font-size: 1.4rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 1.5rem;
}

.session-group-title span {
  color: var(--text-secondary);
  font-weight: 500;
}

.session-timeline {
  position: relative;
  padding-left: 2.5rem;
}

.session-timeline::before {
  content: '';
  position: absolute;
  left: 0.45rem;
  top: 0.5rem;
  bottom: 0.5rem;
  width: 2px;
  background: var(--divider);
}

.session-entry {
  position: relative;
  padding-bottom: 2rem;
  display: flex;
  gap: 1.5rem;
}

.session-entry:last-child {
  padding-bottom: 0;
}

.session-dot {
  position: absolute;
  left: -2.1rem;
  top: 0.35rem;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--gold);
}

.session-date {
  flex-shrink: 0;
  width: 4.5rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
  padding-top: 0.1rem;
}

.session-details {
  flex: 1;
}

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

.session-result {
  font-size: 0.95rem;
  font-weight: 600;
  margin-top: 0.25rem;
}

/* ── Entrance Animations ── */

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.navbar {
  animation: fadeIn 0.5s ease both;
}

.site-hero h1 {
  animation: fadeUp 0.6s ease both;
  animation-delay: 0.1s;
}

.site-hero p {
  animation: fadeUp 0.6s ease both;
  animation-delay: 0.25s;
}

.leaderboard-section {
  animation: fadeUp 0.5s ease both;
  animation-delay: 0.3s;
}

.leaderboard-table tr {
  animation: fadeUp 0.4s ease both;
}

.leaderboard-table tr:nth-child(1) { animation-delay: 0.35s; }
.leaderboard-table tr:nth-child(2) { animation-delay: 0.40s; }
.leaderboard-table tr:nth-child(3) { animation-delay: 0.45s; }
.leaderboard-table tr:nth-child(4) { animation-delay: 0.50s; }
.leaderboard-table tr:nth-child(5) { animation-delay: 0.55s; }
.leaderboard-table tr:nth-child(6) { animation-delay: 0.60s; }
.leaderboard-table tr:nth-child(7) { animation-delay: 0.65s; }

.section-title {
  animation: fadeUp 0.5s ease both;
  animation-delay: 0.5s;
}

.player-card {
  animation: fadeUp 0.45s ease both;
}

.player-card:nth-child(1) { animation-delay: 0.55s; }
.player-card:nth-child(2) { animation-delay: 0.60s; }
.player-card:nth-child(3) { animation-delay: 0.65s; }
.player-card:nth-child(4) { animation-delay: 0.70s; }
.player-card:nth-child(5) { animation-delay: 0.75s; }
.player-card:nth-child(6) { animation-delay: 0.80s; }
.player-card:nth-child(7) { animation-delay: 0.85s; }

.profile-hero {
  animation: fadeIn 0.7s ease both;
}

.profile-name {
  animation: fadeUp 0.5s ease both;
  animation-delay: 0.2s;
}

.profile-earnings {
  animation: fadeUp 0.5s ease both;
  animation-delay: 0.3s;
}

.profile-stats-row {
  animation: fadeUp 0.5s ease both;
  animation-delay: 0.4s;
}

.profile-sessions {
  animation: fadeUp 0.5s ease both;
  animation-delay: 0.5s;
}

.session-entry {
  animation: fadeUp 0.4s ease both;
}

.session-entry:nth-child(1) { animation-delay: 0.55s; }
.session-entry:nth-child(2) { animation-delay: 0.60s; }
.session-entry:nth-child(3) { animation-delay: 0.65s; }
.session-entry:nth-child(4) { animation-delay: 0.70s; }
.session-entry:nth-child(5) { animation-delay: 0.75s; }

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

/* ── Footer ── */

.site-footer {
  border-top: 1px solid var(--divider);
  padding: 2rem;
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ── Responsive ── */

@media (max-width: 768px) {
  .navbar {
    padding: 0.85rem 1.25rem;
  }

  .navbar-brand {
    font-size: 0.7rem;
    letter-spacing: 0.04em;
  }

  .navbar-links a {
    font-size: 0.7rem;
  }

  .site-hero {
    padding: 7rem 1.25rem 2rem;
  }

  .profile-hero {
    height: 260px;
  }

  .profile-hero-content {
    padding: 0 1.5rem 1rem;
  }

  .profile-body {
    padding: 0 1.5rem;
  }

  .profile-stat:not(:last-child) {
    padding-right: 1rem;
    margin-right: 1rem;
  }

  .profile-stat-value {
    font-size: 1.4rem;
  }

  .players-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1rem;
  }

  .leaderboard-section,
  .players-section {
    padding: 0 1.25rem;
  }
}

@media (max-width: 480px) {
  .profile-hero {
    height: 220px;
  }

  .profile-stats-row {
    flex-direction: column;
    gap: 1rem;
  }

  .profile-stat:not(:last-child) {
    border-right: none;
    border-bottom: 1px solid var(--divider);
    padding-right: 0;
    margin-right: 0;
    padding-bottom: 1rem;
    margin-bottom: 0;
  }

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