/*
 * Havoc Leaderboard: the admin dashboard's leaderboard, scoped to
 * .havoc-lb-root so the site's theme and these styles don't affect each other.
 * Generated from client/src/features/stats/stats.css, plus the small helpers and theme
 * resets below.
 */

@font-face {
  font-family: 'Rajdhani';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('fonts/rajdhani-latin-600-normal.woff2') format('woff2');
}

@font-face {
  font-family: 'Rajdhani';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('fonts/rajdhani-latin-700-normal.woff2') format('woff2');
}

/* The dashboard's theme tokens the pages use (dashboard light theme). */
.havoc-lb-root {
  --accent: #d6232f;
  --text: #1f1d24;
  --muted: #6b6375;
  --border: #e5e4e7;
  --row-hover: #faf9fb;
  --neutral-bg: rgba(107, 99, 117, 0.12);
  --success: #1b7f4b;
  --danger: #c62828;
  box-sizing: border-box;
  font-family: system-ui, 'Segoe UI', Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  max-width: 1200px;
  margin: 0 auto;
  text-align: left;
}

/* Keep theme styles for tables, headings, lists and links out of the board. */
.havoc-lb-root *,
.havoc-lb-root *::before,
.havoc-lb-root *::after {
  box-sizing: border-box;
}

.havoc-lb-root h1,
.havoc-lb-root h2,
.havoc-lb-root h3,
.havoc-lb-root p {
  margin: 0;
  padding: 0;
  border: 0;
  text-transform: none;
  letter-spacing: normal;
}

.havoc-lb-root ol,
.havoc-lb-root ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.havoc-lb-root li::before,
.havoc-lb-root li::marker {
  content: none;
}

.havoc-lb-root a,
.havoc-lb-root a:hover,
.havoc-lb-root a:focus {
  text-decoration: none;
  box-shadow: none;
}

.havoc-lb-root table {
  margin: 0;
  border: 0;
  table-layout: auto;
  background: transparent;
}

.havoc-lb-root th,
.havoc-lb-root td {
  border: 0;
  background: transparent;
  vertical-align: middle;
}

.havoc-lb-root tr:nth-child(odd) td,
.havoc-lb-root tr:nth-child(even) td {
  background: transparent;
}

/* Helpers the dashboard gets from its global styles. */
.havoc-lb-root .table-wrap {
  overflow-x: auto;
}

.havoc-lb-root .stack-cell {
  display: flex;
  flex-direction: column;
}

.havoc-lb-root .strong {
  font-weight: 700;
}

.havoc-lb-root .error {
  color: var(--danger);
}

.havoc-lb-root .lb-state.error {
  color: #ff8a93;
}

/* Leaderboard: a dark game look in both themes */

.havoc-lb-root .lb {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 26px 28px 20px;
  border-radius: 20px;
  color: var(--ps-text);
  background:
    radial-gradient(90% 60% at 50% 0%, rgba(255, 42, 61, 0.22), transparent 70%),
    repeating-linear-gradient(135deg, transparent 0 14px, rgba(255, 255, 255, 0.022) 14px 15px),
    var(--ps-bg);
  border: 1px solid rgba(255, 42, 61, 0.3);
  box-shadow: 0 20px 50px -24px rgba(255, 42, 61, 0.45);
}

.havoc-lb-root .lb-head {
  text-align: center;
}

.havoc-lb-root .lb-kicker {
  font-family: var(--ps-font);
  font-weight: 700;
  font-size: 0.8rem;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  color: var(--ps-red);
}

.havoc-lb-root .dashboard .lb-title,
.havoc-lb-root .lb-title {
  margin: 0;
  font-family: var(--ps-font);
  font-weight: 700;
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: linear-gradient(180deg, #fff 30%, #ffb3ba);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.havoc-lb-root .lb-sub {
  margin: 6px 0 0;
  color: var(--ps-muted);
  font-size: 0.85rem;
}

.havoc-lb-root .lb-state {
  margin: 0;
  padding: 24px 0;
  text-align: center;
  color: var(--ps-muted);
}

.havoc-lb-root .lb-handle {
  color: var(--ps-muted);
  font-size: 0.85rem;
}

/* Podium */

.havoc-lb-root .lb-podium {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 220px));
  justify-content: center;
  align-items: end;
  gap: 14px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.havoc-lb-root .lb-step {
  --tone: #cfd4dc;
  animation: ps-rise 0.5s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.havoc-lb-root .lb-step-1 {
  --tone: #ffc93d;
  animation-delay: 0.1s;
}

.havoc-lb-root .lb-step-2 {
  animation-delay: 0.2s;
}

.havoc-lb-root .lb-step-3 {
  --tone: #e0955a;
  animation-delay: 0.3s;
}

.havoc-lb-root .lb-step-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 18px 12px 16px;
  border-radius: 16px 16px 6px 6px;
  color: var(--ps-text);
  text-align: center;
  text-decoration: none;
  background: linear-gradient(180deg, color-mix(in srgb, var(--tone) 16%, transparent), transparent 70%), var(--ps-panel);
  border: 1px solid color-mix(in srgb, var(--tone) 45%, transparent);
  border-bottom: 3px solid var(--tone);
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease;
}

.havoc-lb-root .lb-step-1 .lb-step-card {
  padding-top: 30px;
  padding-bottom: 28px;
  box-shadow: 0 0 40px -12px color-mix(in srgb, var(--tone) 70%, transparent);
}

.havoc-lb-root .lb-step-name {
  max-width: 100%;
  margin-top: 6px;
  font-family: var(--ps-font);
  font-weight: 700;
  font-size: 1.35rem;
  line-height: 1.05;
  text-transform: uppercase;
  overflow-wrap: anywhere;
}

.havoc-lb-root .lb-step-score {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  font-family: var(--ps-font);
  font-weight: 700;
  font-size: 1.6rem;
  line-height: 1;
}

.havoc-lb-root .lb-step-score small {
  font-size: 0.75rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ps-muted);
}

/* Hexagon rank badges */

.havoc-lb-root .lb-hex {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 36px;
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
  background: rgba(255, 255, 255, 0.08);
  color: var(--ps-text);
  font-family: var(--ps-font);
  font-weight: 700;
  font-size: 1rem;
}

.havoc-lb-root .lb-hex-1 {
  background: linear-gradient(160deg, #ffe07a, #ffb000 60%, #e07b00);
  color: #3d2500;
}

.havoc-lb-root .lb-hex-2 {
  background: linear-gradient(160deg, #ffffff, #c4cad3 60%, #8d96a3);
  color: #22262c;
}

.havoc-lb-root .lb-hex-3 {
  background: linear-gradient(160deg, #ffc28f, #d9874a 60%, #9e5420);
  color: #321703;
}

.havoc-lb-root .lb-hex-big {
  width: 60px;
  height: 68px;
  font-size: 1.5rem;
  filter: drop-shadow(0 0 14px color-mix(in srgb, var(--tone) 60%, transparent));
}

.havoc-lb-root .lb-step-1 .lb-hex-big {
  width: 76px;
  height: 86px;
  font-size: 1.9rem;
  animation: ps-pulse 2.4s ease-in-out infinite;
}

/* Table */

.havoc-lb-root .lb-table-wrap {
  border-radius: 14px;
  border: 1px solid var(--ps-line);
  background: var(--ps-panel);
}

.havoc-lb-root .lb-table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

.havoc-lb-root .lb-table th {
  padding: 12px 14px;
  text-align: left;
  font-family: var(--ps-font);
  font-weight: 700;
  font-size: 0.8rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ps-muted);
  white-space: nowrap;
  border-bottom: 1px solid rgba(255, 42, 61, 0.35);
  background: rgba(255, 42, 61, 0.06);
}

.havoc-lb-root .lb-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--ps-line);
  white-space: nowrap;
}

.havoc-lb-root .lb-table tbody tr {
  transition: background 0.15s ease;
  animation: ps-rise 0.4s ease both;
  animation-delay: calc(0.2s + var(--i) * 30ms);
}

.havoc-lb-root .lb-table tbody tr:last-child td {
  border-bottom: 0;
}

.havoc-lb-root .lb-table tbody tr:hover {
  background: linear-gradient(90deg, rgba(255, 42, 61, 0.16), rgba(255, 42, 61, 0.03));
  box-shadow: inset 3px 0 0 var(--ps-red);
}

.havoc-lb-root .lb-table .num {
  text-align: right;
}

.havoc-lb-root .lb-rank-col {
  width: 1%;
  text-align: center !important;
}

.havoc-lb-root .lb-th {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.havoc-lb-root .lb-th-icon {
  flex: none;
  width: 16px;
  height: 16px;
  background: var(--ps-red);
  -webkit-mask: var(--icon) center / contain no-repeat;
  mask: var(--icon) center / contain no-repeat;
  filter: drop-shadow(0 0 4px rgba(255, 42, 61, 0.6));
}

.havoc-lb-root .lb-step-score .lb-th-icon {
  width: 20px;
  height: 20px;
}

.havoc-lb-root .lb .player-name {
  color: inherit;
  text-decoration: none;
}

.havoc-lb-root .lb .player-name .strong {
  font-family: var(--ps-font);
  font-size: 1.05rem;
  letter-spacing: 0.02em;
}

.havoc-lb-root .lb-score {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

.havoc-lb-root .lb-score-value {
  font-family: var(--ps-font);
  font-weight: 700;
  font-size: 1.2rem;
  line-height: 1;
}

.havoc-lb-root .lb-score-track {
  width: 80px;
  height: 5px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.08);
}

.havoc-lb-root .lb-score-fill {
  display: block;
  width: var(--fill);
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--ps-red-deep), var(--ps-red) 60%, var(--ps-hot));
  box-shadow: 0 0 8px rgba(255, 42, 61, 0.8);
  animation: ps-grow 1s cubic-bezier(0.2, 0.8, 0.2, 1) both;
  animation-delay: calc(0.3s + var(--i) * 30ms);
}

@media (max-width: 640px) {
  .havoc-lb-root .lb {
    padding: 20px 14px 14px;
  }

  .havoc-lb-root .lb-podium {
    gap: 8px;
  }

  .havoc-lb-root .lb-step-name {
    font-size: 1rem;
  }

  .havoc-lb-root .lb-step-score {
    font-size: 1.2rem;
  }

  .havoc-lb-root .lb-step-score small {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .havoc-lb-root .lb-step,
.havoc-lb-root .lb-table tbody tr,
.havoc-lb-root .lb-score-fill,
.havoc-lb-root .lb-step-1 .lb-hex-big {
    animation: none;
  }
}

/* Shared colours and animations (a dark game card in both themes, neon-red accents) */

.havoc-lb-root .lb {
  --ps-bg: #0b0a0f;
  --ps-panel: #14131a;
  --ps-line: rgba(255, 255, 255, 0.07);
  --ps-text: #f5f4f8;
  --ps-muted: #8d8a99;
  --ps-red: #ff2a3d;
  --ps-red-deep: #a8101d;
  --ps-hot: #ff7a45;
  --ps-font: 'Rajdhani', system-ui, sans-serif;
}

@keyframes ps-grow {
  from {
    width: 0;
  }
}

@keyframes ps-rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
}

@keyframes ps-pulse {
  50% {
    filter: drop-shadow(0 0 30px rgba(255, 170, 60, 0.85));
  }
}
