@import url("https://cdnjs.cloudflare.com/ajax/libs/animate.css/4.1.1/animate.min.css");
@import url("https://fonts.googleapis.com/css2?family=Eczar:wght@600&display=swap");
@import url("https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@0;1&family=Space+Grotesk:wght@400;500;600;700&display=swap");

:root {
  --yellow-brand: #ffe600;
  --pink-brand: #fe7fd3;
  --orange-brand: #f07030;
  --headings-font-family: "Eczar";
  --bs-body-bg: #000;

  /* Stats palette — warmer accents on top of the dark base. */
  --stat-card-bg: #1f1a14;
  --stat-card-bg-soft: #262019;
  --stat-card-border: #3a3128;
  --stat-text: #f5efe6;
  --stat-text-muted: #9a9088;
  --stat-orange: #f07030;
  --stat-yellow: #f5c842;
  --stat-pink: #e8547a;
  --stat-blue: #6791e8;
  --stat-mint: #42c4a8;
}

.text-orange-brand {
  color: var(--orange-brand) !important;
}

.title-font {
  font-family: var(--headings-font-family), serif;
}

h1,
h2,
h3,
h4,
h5,
h6,
.navbar-brand {
  font-family: var(--headings-font-family), serif;
}

.bg-yellow-brand {
  background-color: var(--yellow-brand) !important;
}
.bg-pink-brand {
  background-color: var(--pink-brand) !important;
}

.border-yellow-brand {
  border-color: var(--yellow-brand) !important;
}

.border-pink-brand {
  border-color: var(--pink-brand) !important;
}

.border-dashed {
  border-style: dashed !important;
}

.text-yellow-brand {
  color: var(--yellow-brand) !important;
}

.text-pink-brand {
  color: var(--pink-brand) !important;
}

.navbar-text {
  overflow-x: hidden;
  width: 100%;
}

.infinite-scroll {
  animation: infiniteScroll 20s linear infinite;
}

@keyframes infiniteScroll {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(calc(0px - 50%));
  }
}

.card-overlay {
  background-color: rgba(0, 0, 0, 0.6);
}

.dialog::backdrop {
  background: black;
}

.fs-8 {
  font-size: 0.6rem;
}

// Rank icons
.rank-icon {
  background: black;
  display: flex;
  justify-content: center;
  align-items: center;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  color: #343a40;
  font-size: 0.8rem;
}

.rank-icon-yellow {
  color: var(--yellow-brand) !important;
}

.rank-icon-pink {
  color: var(--pink-brand) !important;
}

/* ============================================================
 * Stats dashboard
 * ============================================================ */

.stats-page {
  font-family: "Space Grotesk", system-ui, sans-serif;
  color: var(--stat-text);
  padding-bottom: 4rem;
}

.stats-page h1,
.stats-page h2,
.stats-page h3,
.stats-page h4,
.stats-page h5,
.stats-page .stats-bignum,
.stats-page .stats-bignum-sm,
.stats-page .stats-italic,
.stats-page .stats-profile-name {
  font-family: "Instrument Serif", "Eczar", serif;
  font-weight: 400;
  letter-spacing: -0.01em;
}

.stats-italic {
  font-style: italic;
  color: var(--stat-orange);
}

.stats-title { color: var(--stat-text); font-weight: 400; line-height: 1; }

.stats-eyebrow {
  color: var(--stat-orange);
  letter-spacing: 0.12em;
  font-family: "Space Grotesk", sans-serif;
  font-weight: 500;
}

.stats-muted { color: var(--stat-text-muted); }

.stats-section-title {
  font-size: 1.6rem;
  margin-top: 1.5rem;
  margin-bottom: 0.25rem;
  color: var(--stat-text);
}

.stats-kicker {
  font-family: "Space Grotesk", sans-serif;
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--stat-text-muted);
  margin-bottom: 0.25rem;
}

.stats-bignum { font-size: 2.6rem; line-height: 1; margin-bottom: 0; color: var(--stat-text); }
.stats-bignum-sm { font-size: 1.5rem; line-height: 1; }

.stats-bold-orange { color: var(--stat-orange); font-weight: 600; }
.stats-bold-yellow { color: var(--stat-yellow); font-weight: 600; }
.stats-bold-pink   { color: var(--stat-pink);   font-weight: 600; }
.stats-bold-mint   { color: var(--stat-mint);   font-weight: 600; }

.text-orange-stat { color: var(--stat-orange) !important; }
.text-yellow-stat { color: var(--stat-yellow) !important; }
.text-pink-stat   { color: var(--stat-pink) !important; }
.text-blue-stat   { color: var(--stat-blue) !important; }
.text-mint-stat   { color: var(--stat-mint) !important; }

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

.stats-card {
  background: var(--stat-card-bg);
  border: 1px solid var(--stat-card-border);
  border-radius: 18px;
  padding: 1.1rem 1.2rem;
  margin-bottom: 1rem;
}

.stats-card--accent-orange { border-top: 3px solid var(--stat-orange); }
.stats-card--accent-yellow { border-top: 3px solid var(--stat-yellow); }
.stats-card--accent-pink   { border-top: 3px solid var(--stat-pink); }
.stats-card--accent-mint   { border-top: 3px solid var(--stat-mint); }

.stats-card--list { padding: 0.4rem 0.6rem; }

.stats-card--podium {
  background: linear-gradient(135deg, rgba(240,112,48,0.12), rgba(245,200,66,0.08));
  border: 1px solid rgba(245,200,66,0.3);
}

.stats-grid { display: grid; gap: 0.75rem; margin-bottom: 0.5rem; }
.stats-grid--two { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.stats-tabs-wrapper {
  overflow-x: auto;
  -ms-overflow-style: none;
  scrollbar-width: none;
}
.stats-tabs-wrapper::-webkit-scrollbar { display: none; }

.stats-tabs {
  background: var(--stat-card-bg);
  padding: 0.3rem;
  border-radius: 999px;
  border: 1px solid var(--stat-card-border);
  width: max-content;
  min-width: 100%;
  gap: 0.15rem;
}

.stats-tabs .nav-link {
  color: var(--stat-text-muted);
  background: transparent;
  border-radius: 999px;
  font-family: "Space Grotesk", sans-serif;
  font-size: 0.85rem;
  font-weight: 500;
  padding: 0.4rem 0.95rem;
  white-space: nowrap;
  border: none;
}
.stats-tabs .nav-link:hover { color: var(--stat-text); }
.stats-tabs .nav-link.active { background: var(--stat-orange); color: #fff; font-weight: 600; }

/* Fact rows */
.stats-fact {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--stat-card-border);
}
.stats-fact:last-child { border-bottom: none; }

.stats-fact-icon {
  font-size: 1.4rem;
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.04);
  flex-shrink: 0;
}
.stats-fact-icon--orange { color: var(--stat-orange); }
.stats-fact-icon--yellow { color: var(--stat-yellow); }
.stats-fact-icon--pink   { color: var(--stat-pink); }
.stats-fact-icon--blue   { color: var(--stat-blue); }
.stats-fact-icon--mint   { color: var(--stat-mint); }

.stats-fact-label {
  margin-bottom: 0;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--stat-text-muted);
}
.stats-fact-value {
  margin-bottom: 0;
  font-family: "Space Grotesk", sans-serif;
  font-size: 0.95rem;
  color: var(--stat-text);
}

/* Top-3 podium on overview */
.stats-podium-row {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.65rem 0;
  border-bottom: 1px solid rgba(245,200,66,0.18);
}
.stats-podium-row:last-child { border-bottom: none; }

.stats-podium-rank {
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: "Instrument Serif", serif;
  font-size: 1.2rem;
  flex-shrink: 0;
}
.stats-podium-row--1 .stats-podium-rank { background: var(--stat-yellow); color: #1a1510; }
.stats-podium-row--2 .stats-podium-rank { background: var(--stat-mint);   color: #1a1510; }
.stats-podium-row--3 .stats-podium-rank { background: var(--stat-pink);   color: #1a1510; }

.stats-podium-name { font-weight: 500; color: var(--stat-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stats-podium-meta { color: var(--stat-text-muted); }
.stats-podium-points { text-align: right; display: flex; flex-direction: column; align-items: flex-end; line-height: 1; flex-shrink: 0; }

/* Points ranking table (rank, name, pts, wks, win) */
.stats-table-head,
.stats-table-row {
  display: grid;
  grid-template-columns: 2rem minmax(0, 1fr) 2.6rem 2.4rem 2.4rem;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 0.3rem;
}

.stats-table-head {
  border-bottom: 1px solid var(--stat-card-border);
  color: var(--stat-text-muted);
  text-transform: uppercase;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
}
.stats-table-row { border-bottom: 1px solid rgba(255,255,255,0.04); }
.stats-table-row:last-child { border-bottom: none; }

.stats-table-rank { text-align: center; }
.stats-table-num  { text-align: right; font-variant-numeric: tabular-nums; font-family: "Space Grotesk", sans-serif; }
.stats-table-name {
  font-family: "Space Grotesk", sans-serif;
  font-weight: 500;
  color: var(--stat-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.stats-rank-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.7rem;
  height: 1.7rem;
  border-radius: 999px;
  font-family: "Space Grotesk", sans-serif;
  font-weight: 600;
  font-size: 0.8rem;
  background: var(--stat-card-bg-soft);
  color: var(--stat-text-muted);
  flex-shrink: 0;
}
.stats-rank-pill--1 { background: var(--stat-yellow); color: #1a1510; }
.stats-rank-pill--2 { background: var(--stat-mint);   color: #1a1510; }
.stats-rank-pill--3 { background: var(--stat-pink);   color: #1a1510; }

/* Podium tally table — wide name, narrow numeric columns */
.stats-podium-table-head,
.stats-podium-table-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 2.2rem 2.2rem 2.2rem 2.2rem;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 0.3rem;
}
.stats-podium-table-head {
  border-bottom: 1px solid var(--stat-card-border);
  color: var(--stat-text-muted);
  text-transform: uppercase;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
}
.stats-podium-table-row { border-bottom: 1px solid rgba(255,255,255,0.04); }
.stats-podium-table-row:last-child { border-bottom: none; }

.stats-podium-table-name {
  font-family: "Space Grotesk", sans-serif;
  font-weight: 500;
  color: var(--stat-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.stats-podium-table-num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-family: "Space Grotesk", sans-serif;
}

/* Indice rows */
.stats-indice-head {
  display: grid;
  grid-template-columns: 2rem minmax(0, 1fr) 4rem;
  gap: 0.4rem;
  padding: 0.55rem 0.3rem;
  border-bottom: 1px solid var(--stat-card-border);
  color: var(--stat-text-muted);
  text-transform: uppercase;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  align-items: center;
}
.stats-indice-head-rank { text-align: center; }
.stats-indice-head-value { text-align: right; }

.stats-indice-row {
  padding: 0.7rem 0.3rem;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}
.stats-indice-row:last-child { border-bottom: none; }

.stats-indice-name {
  font-family: "Space Grotesk", sans-serif;
  font-weight: 500;
  min-width: 0;
}
.stats-indice-value {
  font-family: "Instrument Serif", serif;
  font-size: 1.6rem;
  color: var(--stat-orange);
  line-height: 1;
}

.stats-indice-bars { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.5rem; margin-top: 0.5rem; }

.stats-bar { display: flex; flex-direction: column; gap: 0.15rem; }
.stats-bar-track { height: 6px; background: rgba(255,255,255,0.06); border-radius: 999px; overflow: hidden; }
.stats-bar-fill { height: 100%; border-radius: 999px; }
.stats-bar-fill--orange { background: var(--stat-orange); }
.stats-bar-fill--yellow { background: var(--stat-yellow); }
.stats-bar-fill--pink   { background: var(--stat-pink); }
.stats-bar-label { font-size: 0.7rem; color: var(--stat-text-muted); font-family: "Space Grotesk", sans-serif; }

.stats-badge-muted {
  background: rgba(255,255,255,0.08);
  color: var(--stat-text-muted);
  font-weight: 500;
  font-size: 0.65rem;
  font-family: "Space Grotesk", sans-serif;
}

/* Indice formula card */
.stats-card--formula {
  background: linear-gradient(135deg, rgba(240,112,48,0.08), rgba(232,84,122,0.06));
  border-color: rgba(240,112,48,0.3);
}
.stats-formula-label {
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--stat-text-muted);
  font-family: "Space Grotesk", sans-serif;
}
.stats-formula {
  font-family: "Instrument Serif", serif;
  font-size: 1.3rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  color: var(--stat-text);
}
.stats-formula-token {
  background: var(--stat-card-bg-soft);
  padding: 0.1rem 0.55rem;
  border-radius: 6px;
  font-style: italic;
}
.stats-formula-token--orange { color: var(--stat-orange); }
.stats-formula-token--yellow { color: var(--stat-yellow); }
.stats-formula-token--pink   { color: var(--stat-pink); }
.stats-formula-op { font-family: "Space Grotesk", sans-serif; color: var(--stat-text-muted); }
.stats-formula-list {
  list-style: none;
  padding-left: 0;
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
  font-size: 0.85rem;
  color: var(--stat-text);
}
.stats-formula-list li { padding: 0.25rem 0; display: flex; align-items: center; gap: 0.5rem; }
.stats-formula-dot { width: 0.55rem; height: 0.55rem; border-radius: 50%; flex-shrink: 0; }
.stats-formula-dot--orange { background: var(--stat-orange); }
.stats-formula-dot--yellow { background: var(--stat-yellow); }
.stats-formula-dot--pink   { background: var(--stat-pink); }

/* Top tracks (with rank column) */
.stats-track-row {
  display: grid;
  grid-template-columns: 1.4rem 2.8rem minmax(0, 1fr) 3rem;
  align-items: center;
  gap: 0.55rem;
  padding: 0.55rem 0.2rem;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}
.stats-track-row:last-child { border-bottom: none; }

/* Hall of shame (no rank column — wider name) */
.stats-shame-row {
  display: grid;
  grid-template-columns: 2.4rem minmax(0, 1fr) 3rem;
  align-items: center;
  gap: 0.55rem;
  padding: 0.55rem 0.2rem;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}
.stats-shame-row:last-child { border-bottom: none; }

.stats-track-rank {
  font-family: "Instrument Serif", serif;
  font-size: 1.4rem;
  text-align: center;
  color: var(--stat-text-muted);
}
.stats-track-rank--1 { color: var(--stat-yellow); }
.stats-track-rank--2 { color: var(--stat-mint); }
.stats-track-rank--3 { color: var(--stat-pink); }

.stats-track-thumb {
  width: 2.8rem;
  height: 2.8rem;
  border-radius: 8px;
  object-fit: cover;
  display: block;
}
.stats-track-thumb--small { width: 2.2rem; height: 2.2rem; }
.stats-shame-thumb {
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 8px;
  object-fit: cover;
  display: block;
}
.stats-track-thumb--placeholder {
  background: var(--stat-card-bg-soft);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--stat-text-muted);
}

.stats-track-meta { min-width: 0; overflow: hidden; }
.stats-track-name {
  font-family: "Space Grotesk", sans-serif;
  font-weight: 500;
  color: var(--stat-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.stats-track-sub,
.stats-track-poster {
  color: var(--stat-text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stats-track-score {
  text-align: right;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  line-height: 1;
  flex-shrink: 0;
}

/* Track lines (in profiles) */
.stats-track-line {
  display: grid;
  grid-template-columns: 1.2rem 2.2rem minmax(0, 1fr) 2.8rem;
  align-items: center;
  gap: 0.55rem;
  padding: 0.4rem 0;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}
.stats-track-line:last-child { border-bottom: none; }

.stats-track-line-rank {
  font-family: "Instrument Serif", serif;
  font-size: 1.1rem;
  text-align: center;
  color: var(--stat-text-muted);
}
.stats-track-line--orange .stats-track-line-rank { color: var(--stat-orange); }
.stats-track-line--blue   .stats-track-line-rank { color: var(--stat-blue); }

/* Affinity */
.stats-toggle-btn {
  background: var(--stat-card-bg);
  color: var(--stat-text-muted);
  border: 1px solid var(--stat-card-border);
  font-family: "Space Grotesk", sans-serif;
  font-weight: 500;
}
.stats-toggle-btn:hover { color: var(--stat-text); background: var(--stat-card-bg-soft); }
.btn-check:checked + .stats-toggle-btn {
  background: var(--stat-orange);
  color: #fff;
  border-color: var(--stat-orange);
}

.stats-affinity-name {
  font-family: "Instrument Serif", serif;
  font-size: 1.4rem;
  color: var(--stat-text);
  min-width: 0;
}

.stats-affinity-row {
  display: grid;
  grid-template-columns: minmax(70px, 1.2fr) minmax(50px, 2fr) auto;
  align-items: center;
  gap: 0.55rem;
  padding: 0.35rem 0;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}
.stats-affinity-row:last-child { border-bottom: none; }

.stats-affinity-target {
  font-family: "Space Grotesk", sans-serif;
  font-weight: 500;
  color: var(--stat-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.stats-affinity-bar-track {
  height: 8px;
  background: rgba(255,255,255,0.06);
  border-radius: 999px;
  overflow: hidden;
}
.stats-affinity-bar-fill { height: 100%; border-radius: 999px; }
.stats-affinity-bar-fill--orange { background: linear-gradient(90deg, var(--stat-orange), var(--stat-yellow)); }
.stats-affinity-bar-fill--pink   { background: linear-gradient(90deg, var(--stat-pink), var(--stat-orange)); }

.stats-affinity-num {
  text-align: right;
  font-family: "Space Grotesk", sans-serif;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--stat-text);
  white-space: nowrap;
  flex-shrink: 0;
}

/* Profiles */
.stats-profiles-nav {
  display: flex;
  gap: 0.4rem;
  overflow-x: auto;
  -ms-overflow-style: none;
  scrollbar-width: none;
  padding-bottom: 0.4rem;
}
.stats-profiles-nav::-webkit-scrollbar { display: none; }

.stats-profile-pill {
  background: var(--stat-card-bg);
  border: 1px solid var(--stat-card-border);
  color: var(--stat-text-muted);
  border-radius: 999px;
  padding: 0.35rem 0.95rem;
  font-family: "Space Grotesk", sans-serif;
  font-weight: 500;
  font-size: 0.85rem;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.15s ease;
}
.stats-profile-pill:hover { color: var(--stat-text); border-color: var(--stat-orange); }
.stats-profile-pill.active { background: var(--stat-orange); border-color: var(--stat-orange); color: #fff; }

.stats-profile-card { padding: 1.4rem 1.2rem; }

.stats-profile-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  border-bottom: 1px solid var(--stat-card-border);
  padding-bottom: 0.9rem;
  margin-bottom: 1rem;
}

.stats-profile-name { font-size: 2rem; line-height: 1; color: var(--stat-text); min-width: 0; }

.stats-profile-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.stats-profile-stat {
  background: var(--stat-card-bg-soft);
  border-radius: 12px;
  padding: 0.6rem 0.5rem;
  text-align: center;
}

.stats-profile-podium {
  display: flex;
  justify-content: space-around;
  margin-bottom: 1rem;
  padding: 0.65rem 0;
  background: var(--stat-card-bg-soft);
  border-radius: 12px;
}

.stats-profile-medal {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-family: "Space Grotesk", sans-serif;
  font-size: 0.9rem;
  color: var(--stat-text);
}

.stats-profile-section { margin-top: 1.2rem; }

.stats-profile-subtitle {
  font-family: "Instrument Serif", serif;
  font-size: 1.2rem;
  color: var(--stat-text);
  margin-bottom: 0.5rem;
  border-bottom: 1px dashed var(--stat-card-border);
  padding-bottom: 0.3rem;
}

@media (min-width: 768px) {
  .stats-grid--two { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .stats-bignum { font-size: 3.2rem; }
  .stats-section-title { font-size: 1.9rem; }
}
