/* Server stats page. Shared scoreboard parts live in scoreboard.css. */
.icon-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}
.stats-body {
  display: grid;
  gap: 28px;
}
.stats-body > .score-totals {
  margin: 0;
}
.stats-card {
  min-width: 0;
  padding: 24px 26px 26px;
  background: #202526;
  border: 1px solid #434c40;
}
.stats-card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 18px;
  margin-bottom: 18px;
}
.stats-card-head h2 {
  margin: 0;
  font: 800 clamp(1.9rem, 3vw, 2.45rem)/1 var(--display);
  letter-spacing: 0.01em;
}
.stats-card-head p {
  margin: 0;
  font-size: 0.875rem;
  color: #aebba3;
}
.stats-none {
  margin: 0;
  color: #bdc7b4;
}

/* Weapons: the leaderboard's table rules, with a two-line weapon cell. */
.stats-weapons.stats-card {
  padding: 0;
}
.stats-weapons .stats-card-head {
  margin: 0;
  padding: 24px 24px 8px;
}
.stats-weapons .stats-none {
  padding: 8px 24px 26px;
}
.weapon-name {
  display: block;
  font-weight: 650;
  color: var(--cream);
  overflow-wrap: anywhere;
}
.weapon-kind {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
  font-size: 0.8125rem;
  color: #a7b39b;
}
.kind-icon {
  flex: none;
  width: 15px;
  height: 15px;
  fill: none;
  stroke: var(--orange);
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.stats-weapons td {
  padding-block: 12px;
}

/* Maps and busy hours share the left column; long shots take the right. */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: auto 1fr;
  gap: 28px;
  align-items: start;
}
.stats-maps-card {
  grid-column: 1;
  grid-row: 1;
}
.stats-longest-card {
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: stretch;
}
.stats-grid > .stats-hours {
  grid-column: 1;
  grid-row: 2;
  align-self: stretch;
  display: flex;
  flex-direction: column;
}

/* Maps: name and share on top, then kills, then a bar. */
.stats-maps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 20px;
}
.stats-maps li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  column-gap: 14px;
  overflow-wrap: anywhere;
}
.map-name {
  font: 700 1.6rem/1.05 var(--display);
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
.map-share {
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: center;
  font: 800 2.1rem/1 var(--display);
  color: var(--orange);
  font-variant-numeric: tabular-nums;
}
.map-kills {
  grid-column: 1;
  font-size: 0.875rem;
  color: #b6c0ac;
  font-variant-numeric: tabular-nums;
}
.map-bar {
  grid-column: 1 / -1;
  display: block;
  width: 100%;
  height: 8px;
  margin-top: 9px;
}
.map-track {
  fill: #313a34;
}
.map-fill {
  fill: var(--orange);
}

/* Long-distance calls: rank, name and metres, then weapon and map. */
.stats-longest {
  list-style: none;
  margin: 0;
  padding: 0;
  counter-reset: shot;
}
.stats-longest li {
  counter-increment: shot;
  display: grid;
  grid-template-columns: 2rem minmax(0, 1fr);
  padding: 10px 0;
  border-bottom: 1px solid #363f34;
  overflow-wrap: anywhere;
}
.stats-longest li:first-child {
  padding-top: 0;
}
.stats-longest li:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}
.stats-longest li::before {
  content: counter(shot);
  grid-row: 1 / span 2;
  font: 800 1.3rem/1.25 var(--display);
  color: #8f9d83;
}
.stats-longest li:nth-child(-n + 3)::before {
  color: var(--orange);
}
.longest-line,
.stats-longest small {
  grid-column: 2;
}
.longest-line {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}
.longest-name {
  min-width: 0;
  font-weight: 650;
}
.longest-meters {
  flex: none;
  font: 800 1.4rem/1 var(--display);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.stats-longest small {
  font-size: 0.8125rem;
  color: #a7b39b;
}

/* Fun kills: one card per tag, the title stamped on in orange. */
.stats-fun-section .stats-card-head {
  margin-bottom: 20px;
}
/* At most three columns, so the six tag cards fill whole rows. */
.stats-fun {
  display: grid;
  grid-template-columns: repeat(
    auto-fit,
    minmax(max(220px, calc((100% - 36px) / 3)), 1fr)
  );
  gap: 18px;
}
.fun-card {
  min-width: 0;
  padding: 20px 20px 18px;
  background: #202526;
  border: 1px solid #434c40;
}
.fun-card h3 {
  display: inline-block;
  margin: 0 0 14px;
  padding: 5px 10px 3px;
  background: var(--orange);
  color: var(--ink-deep);
  font: 800 1.15rem/1.1 var(--display);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
/* Own goals: a count only, on one full-width row. */
.fun-card.fun-card-quiet {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 28px;
}
.fun-card-quiet h3 {
  margin: 0;
  background: #3d473a;
  color: var(--cream);
}
.fun-card-quiet .fun-count {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 12px;
  margin: 0;
}
.fun-card-quiet .fun-none {
  padding-top: 0;
  border-top: 0;
}
.fun-count {
  display: grid;
  gap: 4px;
  margin: 0 0 14px;
}
.fun-count strong {
  font: 800 2.7rem/1 var(--display);
  font-variant-numeric: tabular-nums;
}
.fun-count span {
  font-size: 0.8125rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #acb7a4;
}
.fun-heading,
.fun-none {
  margin: 0;
  padding-top: 12px;
  border-top: 1px solid #363f34;
}
.fun-heading {
  margin-bottom: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #8f9d83;
}
.fun-none {
  font-size: 0.9375rem;
  color: #aebba3;
}
.fun-list {
  margin: 0;
  padding-left: 1.5em;
  font-size: 0.9375rem;
}
.fun-list li {
  padding: 2px 0;
  overflow-wrap: anywhere;
}
.fun-list li::marker {
  color: #8f9d83;
}
.fun-list b {
  color: var(--orange);
  font-variant-numeric: tabular-nums;
}

/* Busy hours: SVG bars only, no inline styles. The chart grows to fill the
   card when long shots make the row taller. */
.hours-chart {
  display: flex;
  flex: 1;
  flex-direction: column;
}
.hours-chart svg {
  display: block;
  flex: 1 0 180px;
  width: 100%;
  min-height: 180px;
  border-bottom: 1px solid #6b7a62;
}
/* At least 3:1 against the card (#202526), so small bars stay visible. */
.hours-chart rect {
  fill: #6b7a62;
}
.hours-chart rect.peak {
  fill: var(--orange);
}
.hours-chart rect:hover {
  fill: var(--cream);
}
.hours-ticks {
  display: flex;
  margin-top: 8px;
  font-size: 0.8125rem;
  color: #aebba3;
}
.hours-ticks span {
  flex: 1;
  white-space: nowrap;
}
.hours-note {
  margin: 14px 0 0;
  font-weight: 650;
}

/* Coming soon: the stats route is not live on this Gramps yet. */
.stats-soon {
  max-width: 680px;
  margin: 8px 0 34px;
  padding: 38px 40px 40px;
  background: var(--cream);
  color: var(--ink-deep);
  border: 1px solid var(--ink-deep);
  box-shadow: 10px 11px 0 var(--orange-dark);
}
.stats-soon h2 {
  margin: 0 0 12px;
  font: 800 clamp(2.2rem, 4vw, 3.1rem)/1 var(--display);
}
.stats-soon p {
  margin: 0 0 24px;
  color: #3d3f3c;
}
.stats-empty {
  margin-bottom: 4px;
}
.stats-shell .leaderboard-explainer {
  margin-top: 30px;
}

@media (min-width: 761px) {
  .fun-card h3 {
    transform: rotate(-2deg);
  }
  .fun-card:nth-child(even) h3 {
    transform: rotate(1.5deg);
  }
  .stats-soon {
    transform: rotate(-1deg);
  }
}
@media (max-width: 760px) {
  .stats-body {
    gap: 22px;
  }
  .stats-grid {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: none;
    gap: 22px;
  }
  .stats-maps-card,
  .stats-longest-card,
  .stats-grid > .stats-hours {
    grid-column: auto;
    grid-row: auto;
  }
  .stats-weapons td {
    padding-block: 10px;
  }
  .stats-card {
    padding: 20px 18px 22px;
  }
  .stats-weapons .stats-card-head {
    padding: 20px 15px 6px 12px;
  }
  .stats-weapons .stats-none {
    padding: 6px 12px 22px;
  }
  .stats-fun {
    grid-template-columns: repeat(
      auto-fit,
      minmax(max(220px, calc((100% - 28px) / 3)), 1fr)
    );
    gap: 14px;
  }
  .fun-card {
    padding: 18px 18px 16px;
  }
  .hours-chart svg {
    flex-basis: 140px;
    min-height: 140px;
  }
  .stats-soon {
    margin-right: 6px;
    padding: 26px 22px 28px;
    box-shadow: 6px 7px 0 var(--orange-dark);
  }
}
@media (max-width: 400px) {
  .weapon-kind {
    font-size: 0.75rem;
  }
  .map-share {
    font-size: 1.8rem;
  }
}
