/*
 * Reusable pieces: surfaces, buttons, section titles, chips, rank medallions, the podium,
 * leaderboard tables, run feeds and the cards/tiles of games, records and levels.
 * See docs/design.md.
 */

/* ── Surfaces ─────────────────────────────────────────────────────────────── */
.card,
.surface {
  --bs-card-bg: transparent;
  --bs-card-border-color: var(--cs-glass-border);
  --bs-card-border-radius: var(--cs-radius);
  --bs-card-inner-border-radius: calc(var(--cs-radius) - 1px);
  --bs-card-cap-bg: rgba(255, 255, 255, 0.025);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent 120px),
    color-mix(in srgb, var(--cs-surface) 88%, transparent);
  border: 1px solid var(--cs-glass-border);
  border-radius: var(--cs-radius);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04), var(--cs-shadow);
}

.card-header {
  border-bottom: 1px solid var(--cs-glass-border);
  font-weight: 600;
}

.card-footer {
  border-top: 1px solid var(--cs-glass-border);
}

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.btn-accent {
  --bs-btn-color: var(--cs-accent-contrast);
  --bs-btn-border-color: transparent;
  --bs-btn-hover-color: var(--cs-accent-contrast);
  --bs-btn-hover-border-color: transparent;
  --bs-btn-active-color: var(--cs-accent-contrast);
  --bs-btn-active-border-color: transparent;
  background: linear-gradient(135deg, color-mix(in srgb, var(--cs-accent) 80%, #fff) 0%, var(--cs-accent) 45%, color-mix(in srgb, var(--cs-accent) 80%, #000) 100%);
  box-shadow: 0 6px 18px -8px var(--cs-glow), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.btn-accent:hover,
.btn-accent:focus-visible {
  transform: translateY(-1px);
  box-shadow: 0 10px 26px -8px var(--cs-glow), inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.btn-gold {
  --bs-btn-color: #2b1d03;
  --bs-btn-border-color: transparent;
  --bs-btn-hover-color: #2b1d03;
  --bs-btn-hover-border-color: transparent;
  --bs-btn-active-color: #2b1d03;
  --bs-btn-active-border-color: transparent;
  background: var(--cs-gold-grad);
  box-shadow: 0 8px 24px -10px rgba(242, 201, 76, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.btn-gold:hover,
.btn-gold:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 14px 34px -10px rgba(242, 201, 76, 0.8), inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.btn-ghost {
  --bs-btn-color: var(--cs-text);
  --bs-btn-bg: rgba(255, 255, 255, 0.04);
  --bs-btn-border-color: var(--cs-glass-border);
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: rgba(255, 255, 255, 0.08);
  --bs-btn-hover-border-color: rgba(255, 255, 255, 0.18);
  --bs-btn-active-color: #fff;
  --bs-btn-active-bg: rgba(255, 255, 255, 0.12);
  --bs-btn-active-border-color: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(6px);
}

.btn-ghost:hover {
  transform: translateY(-1px);
}

/* ── Typography pieces ────────────────────────────────────────────────────── */
.kicker {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0 0 0.75rem;
  font-family: var(--cs-font-display);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--cs-gold);
}

.kicker::before,
.kicker::after {
  content: "";
  width: 1.75rem;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--cs-gold));
}

.kicker::after {
  transform: scaleX(-1);
}

.section-title {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin: 0 0 1.1rem;
  font-family: var(--cs-font-display);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--cs-gold-light);
}

.section-title::before {
  content: "";
  flex: none;
  width: 0.55rem;
  height: 0.55rem;
  transform: rotate(45deg);
  background: var(--cs-gold-grad);
  box-shadow: 0 0 12px rgba(242, 201, 76, 0.6);
}

.section-title::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, rgba(242, 201, 76, 0.45), transparent);
}

.section-title .section-note {
  font-family: var(--cs-font-body);
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  color: var(--cs-muted);
}

.time,
.mono {
  font-family: var(--cs-font-mono);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.time {
  font-weight: 600;
}

.time a {
  color: var(--cs-text);
}

.time a:hover {
  color: var(--cs-accent);
}

/* ── Chips and badges ─────────────────────────────────────────────────────── */
.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  list-style: none;
  padding: 0;
  margin: 0;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
  border: 1px solid var(--cs-glass-border);
  background: rgba(255, 255, 255, 0.045);
  color: var(--cs-muted);
  font-size: 0.8rem;
  font-weight: 500;
  white-space: nowrap;
}

.chip strong {
  color: var(--cs-text);
  font-weight: 650;
}

.chip .bi-star-fill {
  color: var(--cs-gold);
  font-size: 0.7rem;
}

.chip-game {
  border-color: color-mix(in srgb, var(--cs-accent) 40%, transparent);
  background: color-mix(in srgb, var(--cs-accent) 13%, transparent);
  color: var(--cs-text);
}

.badge-wr {
  display: inline-flex;
  align-items: center;
  padding: 0.18rem 0.5rem;
  border-radius: 0.35rem;
  background: var(--cs-gold-grad);
  color: #2b1d03;
  font-family: var(--cs-font-mono);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  box-shadow: 0 0 14px rgba(242, 201, 76, 0.45);
  vertical-align: middle;
}

.badge-tag {
  font-weight: 500;
  background: var(--tag-color, var(--cs-surface-3));
}

.tier-dot {
  display: inline-block;
  width: 0.8rem;
  height: 0.8rem;
  border-radius: 50%;
  vertical-align: middle;
  background: var(--tier-color, var(--cs-muted));
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.45), 0 0 10px color-mix(in srgb, var(--tier-color, transparent) 60%, transparent);
}

.flag {
  border-radius: 2px;
  margin-right: 0.4rem;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35);
}

.player-link {
  white-space: nowrap;
}

.player-link a {
  color: var(--cs-text);
  font-weight: 550;
}

.player-link a:hover {
  color: var(--cs-accent);
}

/* ── Rank medallions ──────────────────────────────────────────────────────── */
.rank {
  position: relative;
  isolation: isolate;
  display: inline-grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  border: 1px solid var(--cs-glass-border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--cs-muted);
  font-family: var(--cs-font-mono);
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1;
}

.rank-1,
.rank-2,
.rank-3 {
  border: 0;
  color: #241703;
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.6), inset 0 -2px 3px rgba(0, 0, 0, 0.25);
}

.rank-1 {
  background: var(--cs-gold-grad);
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.6), inset 0 -2px 3px rgba(0, 0, 0, 0.25), 0 0 16px rgba(242, 201, 76, 0.55);
}

.rank-1::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: -0.55rem -0.7rem -0.35rem;
  background: var(--cs-gold-grad);
  mask: url("/assets/img/laurel.svg") center / contain no-repeat;
  opacity: 0.9;
}

.rank-2 {
  background: var(--cs-silver-grad);
  color: #1d2530;
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.7), inset 0 -2px 3px rgba(0, 0, 0, 0.2), 0 0 12px rgba(207, 216, 227, 0.35);
}

.rank-3 {
  background: var(--cs-bronze-grad);
  color: #2e1a0a;
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.5), inset 0 -2px 3px rgba(0, 0, 0, 0.25), 0 0 12px rgba(208, 138, 79, 0.35);
}

.rank-lg {
  width: 3rem;
  height: 3rem;
  font-size: 1.15rem;
}

.rank-lg.rank-1::before {
  inset: -0.85rem -1.05rem -0.5rem;
}

.rank-xl {
  width: 4.2rem;
  height: 4.2rem;
  font-size: 1.6rem;
}

.rank-xl.rank-1::before {
  inset: -1.2rem -1.5rem -0.7rem;
}

/* Text colors of places (run page, rankings) */
.place-1 { color: var(--cs-gold); }
.place-2 { color: var(--cs-silver); }
.place-3 { color: var(--cs-bronze); }

/* ── Leaderboard tables ───────────────────────────────────────────────────── */
.board {
  margin-bottom: 0;
  font-size: 0.94rem;
}

.board > :not(caption) > * > * {
  padding: 0.7rem 0.85rem;
}

.board th {
  color: var(--cs-faint);
  font-weight: 650;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  white-space: nowrap;
  border-bottom-color: var(--cs-glass-border);
}

.board td {
  vertical-align: middle;
}

.board tbody tr:last-child > * {
  border-bottom: 0;
}

.board .place {
  width: 4rem;
  text-align: center;
}

.board .time {
  font-size: 0.98rem;
}

@media (max-width: 575.98px) {
  .board .hide-sm {
    display: none;
  }
}

.board tr.obsolete td {
  opacity: 0.45;
}

/* On the row, not the cells, so the gradient spans the whole row */
.board tr.is-record {
  background: linear-gradient(90deg, rgba(242, 201, 76, 0.13), rgba(242, 201, 76, 0.03) 45%, transparent 80%);
}

.board tr.is-record > :first-child {
  box-shadow: inset 3px 0 0 var(--cs-gold);
}

.board tr.is-record .time a {
  background: var(--cs-gold-grad);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  font-weight: 750;
}

.board .bi-camera-video {
  font-size: 1.05rem;
  color: var(--cs-muted);
  transition: color 0.15s ease;
}

.board a:hover .bi-camera-video {
  color: var(--cs-accent);
}

/* Board header and controls */
.page-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1rem 1.5rem;
  margin-bottom: 1.5rem;
}

.page-title {
  margin: 0.15rem 0 0.6rem;
  font-size: clamp(1.7rem, 4vw, 2.6rem);
  font-weight: 800;
  line-height: 1.1;
  text-shadow: 0 0 40px var(--cs-glow);
}

.crumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  color: var(--cs-faint);
}

.crumbs a {
  color: var(--cs-muted);
}

.crumbs a:hover {
  color: #fff;
}

.crumbs .bi {
  font-size: 0.7rem;
}

.page-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* Full-game categories above a Speedruns board */
.category-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  margin-bottom: 1.5rem;
}

.category-row .dropdown-toggle.active {
  border-color: var(--cs-accent);
  color: #fff;
}

.subcategory-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  margin-bottom: 0.75rem;
}

.subcategory-label {
  font-size: 0.7rem;
  font-weight: 650;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--cs-faint);
}

.segmented {
  display: inline-flex;
  flex-wrap: nowrap;
  gap: 0.25rem;
  max-width: 100%;
  overflow-x: auto;
  padding: 0.25rem;
  margin: 0;
  list-style: none;
  border-radius: 999px;
  border: 1px solid var(--cs-glass-border);
  background: rgba(255, 255, 255, 0.03);
  scrollbar-width: none;
}

.segmented::-webkit-scrollbar {
  display: none;
}

.segmented .nav-link {
  padding: 0.35rem 0.95rem;
  border-radius: 999px;
  color: var(--cs-muted);
  font-size: 0.86rem;
  font-weight: 550;
  white-space: nowrap;
  transition: color 0.15s ease, background-color 0.15s ease, box-shadow 0.2s ease;
}

.segmented .nav-link:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.05);
}

.segmented .nav-link.active {
  color: var(--cs-accent-contrast);
  background: linear-gradient(135deg, color-mix(in srgb, var(--cs-accent) 80%, #fff), var(--cs-accent) 50%, color-mix(in srgb, var(--cs-accent) 80%, #000));
  box-shadow: 0 4px 14px -4px var(--cs-glow);
}

.filter-bar {
  padding: 0;
  margin-bottom: 1rem;
}

.filter-bar > summary {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.8rem 1.1rem;
  list-style: none;
  cursor: pointer;
  color: var(--cs-muted);
  font-weight: 550;
  font-size: 0.9rem;
}

.filter-bar > summary::-webkit-details-marker {
  display: none;
}

.filter-bar > summary::after {
  content: "\F282"; /* bi-chevron-down */
  margin-left: auto;
  font-family: "bootstrap-icons";
  font-size: 0.8rem;
  transition: transform 0.2s var(--cs-ease);
}

.filter-bar[open] > summary::after {
  transform: rotate(180deg);
}

.filter-bar > summary:hover {
  color: #fff;
}

.filter-bar > form {
  padding: 0 1.1rem 1.1rem;
  border-top: 1px solid var(--cs-glass-border);
}

.filter-label {
  margin-bottom: 0.35rem;
  font-size: 0.7rem;
  font-weight: 650;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--cs-faint);
}

/* ── Podium ───────────────────────────────────────────────────────────────── */
.podium {
  display: grid;
  grid-template-columns: 1fr 1.16fr 1fr;
  align-items: end;
  gap: clamp(0.5rem, 2vw, 1.25rem);
  margin: 2.25rem auto 2rem;
  padding: 0;
  max-width: 56rem;
  list-style: none;
}

.podium-step {
  --tone: var(--cs-muted);
  position: relative;
  isolation: isolate;
  grid-row: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
  padding: 1.6rem 0.9rem 1.1rem;
  border-radius: var(--cs-radius-lg) var(--cs-radius-lg) 0.6rem 0.6rem;
  border: 1px solid color-mix(in srgb, var(--tone) 32%, transparent);
  background:
    radial-gradient(120% 70% at 50% 0%, color-mix(in srgb, var(--tone) 20%, transparent), transparent 70%),
    linear-gradient(180deg, color-mix(in srgb, var(--cs-surface-2) 90%, transparent), color-mix(in srgb, var(--cs-surface) 70%, transparent));
  box-shadow: 0 30px 50px -30px color-mix(in srgb, var(--tone) 55%, transparent), inset 0 1px 0 rgba(255, 255, 255, 0.07);
  text-align: center;
  animation: podium-rise 0.9s var(--cs-ease) both;
}

.podium-step::after {
  content: attr(data-numeral);
  position: absolute;
  z-index: -1;
  right: 0.7rem;
  bottom: -0.35rem;
  font-family: var(--cs-font-display);
  font-size: 4.8rem;
  font-weight: 900;
  line-height: 1;
  color: var(--tone);
  opacity: 0.06;
}

.podium-step-1 {
  grid-column: 2;
  min-height: 15.5rem;
  padding-top: 2.6rem;
}

.podium-step-2 {
  grid-column: 1;
  min-height: 12.75rem;
  animation-delay: 0.15s;
}

.podium-step-3 {
  grid-column: 3;
  min-height: 11.25rem;
  animation-delay: 0.3s;
}

.tone-1 { --tone: var(--cs-gold); }
.tone-2 { --tone: var(--cs-silver); }
.tone-3 { --tone: var(--cs-bronze); }

.podium-step.tone-1 {
  border-color: rgba(242, 201, 76, 0.5);
  animation: podium-rise 0.9s var(--cs-ease) both, champion-glow 4s ease-in-out 1s infinite;
}

.podium-step .rank {
  margin-bottom: 0.35rem;
}

.podium-players {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.95rem;
}

.podium-time {
  font-family: var(--cs-font-mono);
  font-size: clamp(1.05rem, 2.6vw, 1.65rem);
  font-weight: 750;
  line-height: 1.15;
  color: #fff;
  white-space: nowrap;
}

.podium-time:hover {
  color: var(--cs-accent);
}

.tone-1 .podium-time {
  font-size: clamp(1.2rem, 3.2vw, 2.05rem);
  background: var(--cs-gold-shimmer);
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: shimmer 7s linear infinite;
}

.podium-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.25rem 0.6rem;
  font-size: 0.78rem;
  color: var(--cs-faint);
}

.podium-meta a {
  color: var(--cs-muted);
}

.podium-meta a:hover {
  color: var(--cs-accent);
}

@keyframes podium-rise {
  from {
    opacity: 0;
    translate: 0 1.5rem;
  }

  to {
    opacity: 1;
    translate: 0 0;
  }
}

@keyframes champion-glow {
  0%,
  100% { box-shadow: 0 30px 50px -30px rgba(242, 201, 76, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.07); }
  50% { box-shadow: 0 30px 70px -22px rgba(242, 201, 76, 0.85), 0 0 40px -12px rgba(242, 201, 76, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.1); }
}

@media (max-width: 575.98px) {
  .podium-step {
    padding: 1.2rem 0.45rem 0.8rem;
  }

  .podium-step-1 {
    min-height: 12.5rem;
    padding-top: 2rem;
  }

  .podium-step-2 { min-height: 10.5rem; }
  .podium-step-3 { min-height: 9.5rem; }

  .podium-step::after {
    font-size: 3.2rem;
  }

  .podium-players {
    font-size: 0.82rem;
  }

  .podium-meta .podium-platform {
    display: none;
  }
}

/* ── Run feed ─────────────────────────────────────────────────────────────── */
.feed {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 30rem), 1fr));
  gap: 0.75rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.feed-item {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.9rem;
  padding: 0.85rem 1rem 0.85rem 1.15rem;
  border-radius: var(--cs-radius);
  border: 1px solid var(--cs-glass-border);
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--cs-accent) 12%, transparent), transparent 45%),
    color-mix(in srgb, var(--cs-surface) 88%, transparent);
  transition: transform 0.25s var(--cs-ease), border-color 0.2s ease, box-shadow 0.25s ease;
}

.feed-item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.75rem;
  bottom: 0.75rem;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--cs-accent);
  box-shadow: 0 0 12px var(--cs-accent);
}

.feed-item:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--cs-accent) 45%, transparent);
  box-shadow: 0 16px 30px -18px var(--cs-glow);
}

.feed-item.is-record {
  border-color: rgba(242, 201, 76, 0.3);
}

.feed-item.is-record::before {
  background: var(--cs-gold-grad);
  box-shadow: 0 0 12px rgba(242, 201, 76, 0.7);
}

.feed-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
  font-weight: 600;
}

.feed-title a {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--cs-text);
}

.feed-title a:hover {
  color: #fff;
}

.feed-players {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.88rem;
  color: var(--cs-muted);
}

.feed-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.2rem;
}

.feed-time {
  font-family: var(--cs-font-mono);
  font-size: 1.12rem;
  font-weight: 700;
  color: #fff;
}

.feed-item.is-record .feed-time {
  background: var(--cs-gold-grad);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.feed-meta {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.75rem;
  color: var(--cs-faint);
}

.feed-meta .chip {
  padding: 0.1rem 0.5rem;
  font-size: 0.7rem;
}

/* Links over a stretched link stay clickable */
.feed-item .player-link a,
.feed-item .feed-video,
.record-card .player-link a,
.record-card .record-time {
  position: relative;
  z-index: 2;
}

@media (max-width: 575.98px) {
  .feed-item {
    gap: 0.7rem;
    padding-right: 0.8rem;
  }

  .feed-title a {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    white-space: normal;
  }

  .feed-meta .chip {
    display: none;
  }
}

.feed-video {
  color: var(--cs-muted);
}

.feed-video:hover {
  color: var(--cs-accent);
}

.empty-state {
  padding: 2.5rem 1rem;
  text-align: center;
  color: var(--cs-muted);
  border: 1px dashed var(--cs-border-strong);
  border-radius: var(--cs-radius);
}

.empty-state .bi {
  display: block;
  margin-bottom: 0.5rem;
  font-size: 1.8rem;
  color: var(--cs-faint);
}

/* ── Game cards (home) ────────────────────────────────────────────────────── */
.game-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr));
  gap: 1.25rem;
}

.game-card {
  position: relative;
  isolation: isolate;
  display: flex;
  align-items: flex-end;
  min-height: 17rem;
  padding: 1.75rem;
  overflow: hidden;
  border-radius: var(--cs-radius-lg);
  border: 1px solid color-mix(in srgb, var(--cs-accent) 35%, transparent);
  background: var(--cs-bg-deep);
  color: #fff;
  box-shadow: 0 30px 60px -35px var(--cs-glow), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  transition: transform 0.35s var(--cs-ease), box-shadow 0.35s ease, border-color 0.3s ease;
}

.game-card:hover {
  color: #fff;
  transform: translateY(-6px);
  border-color: color-mix(in srgb, var(--cs-accent) 70%, #fff);
  box-shadow: 0 40px 70px -30px var(--cs-glow), 0 0 0 1px color-mix(in srgb, var(--cs-accent) 30%, transparent), inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

/* Pointer spotlight (modules/spotlight.js sets --mx/--my) */
.game-card::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 0%), rgba(255, 255, 255, 0.13), transparent 45%);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.game-card:hover::after {
  opacity: 1;
}

.game-art {
  position: absolute;
  inset: 0;
  z-index: -2;
  background:
    var(--game-art, radial-gradient(circle at 80% 15%, color-mix(in srgb, var(--cs-accent) 50%, transparent), transparent 55%)),
    radial-gradient(circle at 10% 110%, color-mix(in srgb, var(--cs-accent) 35%, transparent), transparent 55%),
    linear-gradient(160deg, color-mix(in srgb, var(--cs-accent) 22%, var(--cs-bg-deep)), var(--cs-bg-deep) 75%);
  transition: transform 0.6s var(--cs-ease);
}

.game-card:hover .game-art {
  transform: scale(1.04);
}

.game-card .game-art::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(0deg, rgba(8, 7, 12, 0.92) 0%, rgba(8, 7, 12, 0.45) 45%, transparent 75%);
}

.game-emblem {
  position: absolute;
  z-index: -1;
  background: linear-gradient(160deg, #fff 0%, color-mix(in srgb, var(--cs-accent) 60%, #fff) 45%, var(--cs-accent) 100%);
  mask: var(--game-emblem, url("/assets/img/emblem.svg")) center / contain no-repeat;
  filter: drop-shadow(0 0 24px var(--cs-glow));
}

.game-card .game-emblem {
  top: 1.25rem;
  right: 1.25rem;
  width: 9.5rem;
  height: 9.5rem;
  opacity: 0.88;
  transition: transform 0.6s var(--cs-ease);
}

.game-card:hover .game-emblem {
  transform: rotate(-6deg) scale(1.06);
}

.game-card-body {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.game-card-year {
  font-family: var(--cs-font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.15em;
  color: color-mix(in srgb, var(--cs-accent) 50%, #fff);
}

.game-card-name {
  font-family: var(--cs-font-display);
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 800;
  line-height: 1.1;
  text-shadow: 0 2px 20px rgba(0, 0, 0, 0.6);
}

.game-card-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin-top: 0.5rem;
  font-size: 0.88rem;
  font-weight: 600;
  color: color-mix(in srgb, var(--cs-accent) 40%, #fff);
}

.game-card-cta .bi {
  transition: transform 0.3s var(--cs-ease);
}

.game-card:hover .game-card-cta .bi {
  transform: translateX(4px);
}

/* ── Record cards (game page) ─────────────────────────────────────────────── */
.record-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 16rem), 1fr));
  gap: 1rem;
}

.record-card {
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 1.25rem 1.25rem 1.1rem;
  overflow: hidden;
  border-radius: var(--cs-radius);
  border: 1px solid rgba(242, 201, 76, 0.22);
  background:
    radial-gradient(90% 60% at 100% 0%, rgba(242, 201, 76, 0.12), transparent 70%),
    color-mix(in srgb, var(--cs-surface) 90%, transparent);
  box-shadow: var(--cs-shadow);
  transition: transform 0.3s var(--cs-ease), border-color 0.25s ease, box-shadow 0.3s ease;
}

.record-card:hover {
  transform: translateY(-3px);
  border-color: rgba(242, 201, 76, 0.5);
  box-shadow: 0 24px 40px -24px rgba(242, 201, 76, 0.45);
}

.record-card.is-empty {
  border-color: var(--cs-glass-border);
  background: color-mix(in srgb, var(--cs-surface) 70%, transparent);
}

.record-card::before {
  content: "";
  position: absolute;
  z-index: -1;
  top: -1.2rem;
  right: -1.5rem;
  width: 8rem;
  height: 7rem;
  background: var(--cs-gold-grad);
  mask: url("/assets/img/laurel.svg") center / contain no-repeat;
  opacity: 0.12;
  transform: rotate(12deg);
}

.record-card.is-empty::before {
  display: none;
}

.record-category {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 650;
  color: var(--cs-text);
}

.record-category:hover {
  color: #fff;
}

.record-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--cs-gold);
}

.record-time {
  font-family: var(--cs-font-mono);
  font-size: 1.85rem;
  font-weight: 750;
  line-height: 1.1;
  background: var(--cs-gold-grad);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  align-self: flex-start;
}

.record-holder {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.record-meta {
  font-size: 0.78rem;
  color: var(--cs-faint);
}

.record-empty {
  margin-top: auto;
  font-size: 0.9rem;
  color: var(--cs-faint);
}

/* ── Category tiles (game page) ───────────────────────────────────────────── */
.tile-list {
  display: grid;
  gap: 0.6rem;
}

.tile-link {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 0.9rem 1.1rem;
  border-radius: var(--cs-radius);
  border: 1px solid var(--cs-glass-border);
  background: color-mix(in srgb, var(--cs-surface) 88%, transparent);
  color: var(--cs-text);
  font-weight: 600;
  transition: transform 0.25s var(--cs-ease), border-color 0.2s ease, background-color 0.2s ease;
}

.tile-link:hover {
  color: #fff;
  transform: translateX(3px);
  border-color: color-mix(in srgb, var(--cs-accent) 45%, transparent);
  background: color-mix(in srgb, var(--cs-accent) 8%, var(--cs-surface));
}

.tile-icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 0.7rem;
  background: color-mix(in srgb, var(--cs-accent) 18%, transparent);
  color: color-mix(in srgb, var(--cs-accent) 50%, #fff);
}

.tile-link .chip {
  margin-left: auto;
}

/* Title + secondary line (guides, resources) */
.tile-body {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.tile-sub {
  font-size: 0.82rem;
  font-weight: 450;
  color: var(--cs-muted);
}

/* ── Level records table (per-level category overview) ───────────────────── */
.records-table .level-col {
  min-width: 11rem;
}

.level-link {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 650;
  color: var(--cs-text);
}

.level-link:hover {
  color: #fff;
}

.level-number {
  display: grid;
  place-items: center;
  flex: none;
  min-width: 1.7rem;
  height: 1.7rem;
  padding: 0 0.3rem;
  border-radius: 0.45rem;
  background: rgba(255, 255, 255, 0.06);
  color: var(--cs-muted);
  font-family: var(--cs-font-mono);
  font-size: 0.78rem;
  font-weight: 700;
}

.records-table .time a {
  font-family: var(--cs-font-mono);
  font-weight: 700;
  color: #fff;
}

.records-table .time a:hover {
  color: var(--cs-gold);
}

/* Warp room, cup... header rows */
.records-table .group-row th {
  padding-top: 1.1rem;
  background: color-mix(in srgb, var(--cs-accent) 9%, transparent);
  color: color-mix(in srgb, var(--cs-accent) 45%, #fff);
  font-family: var(--cs-font-display);
  font-size: 0.78rem;
  letter-spacing: 0.12em;
}

/* A record verified in the last days: gold wash like the board's record row */
.records-table tr.is-recent {
  background: linear-gradient(90deg, rgba(242, 201, 76, 0.13), rgba(242, 201, 76, 0.03) 45%, transparent 80%);
}

.records-table tr.is-recent > :first-child {
  box-shadow: inset 3px 0 0 var(--cs-gold);
}

.badge-new {
  display: inline-flex;
  align-items: center;
  margin-left: 0.35rem;
  padding: 0.12rem 0.4rem;
  border-radius: 0.35rem;
  background: var(--cs-gold-grad);
  color: #2b1d03;
  font-family: var(--cs-font-mono);
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  vertical-align: middle;
}

/* On phones the level stays visible while the table scrolls sideways */
@media (max-width: 575.98px) {
  .records-table .level-col {
    position: sticky;
    left: 0;
    z-index: 1;
    min-width: 8.5rem;
    background: var(--cs-surface);
  }

  .records-table .level-number {
    display: none;
  }
}

/* ── Players ──────────────────────────────────────────────────────────────── */
.player-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 15rem), 1fr));
  gap: 0.75rem;
}

.player-card {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.8rem 1rem;
  border-radius: var(--cs-radius);
  border: 1px solid var(--cs-glass-border);
  background: color-mix(in srgb, var(--cs-surface) 88%, transparent);
  color: var(--cs-text);
  transition: transform 0.25s var(--cs-ease), border-color 0.2s ease;
}

.player-card:hover {
  color: #fff;
  transform: translateY(-2px);
  border-color: rgba(242, 201, 76, 0.4);
}

.player-card-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}

.player-card .chip {
  margin-left: auto;
  font-family: var(--cs-font-mono);
}

/*
 * Scroll reveal (no JavaScript; browsers without scroll timelines skip it). Only for short
 * elements: the animation ends once the element is fully in view.
 */
@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    .reveal {
      animation: reveal-up linear both;
      animation-timeline: view();
      animation-range: entry 0% entry 100%;
    }
  }
}

@keyframes reveal-up {
  from {
    opacity: 0;
    translate: 0 1.75rem;
    scale: 0.98;
  }

  to {
    opacity: 1;
    translate: 0 0;
    scale: 1;
  }
}
