/* ===== THEME VARIABLES ===== */
:root {
  --bg: #0a0f1e;
  --bg-secondary: #131b2e;
  --bg-card: #131b2e;
  --bg-card-hover: #1c2742;
  --border: #2a3550;
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --accent: #f59e0b;
  --accent-hover: #fbbf24;
  --footer-bg: #0d1424;
}

/* ===== BASE ===== */
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

/* ===== LOADING / SKELETON STATES =====
   Prevents content "popping" between empty container and rendered data.
   Containers reserve vertical space (no layout shift), and empty containers
   show a subtle shimmer so the wait reads as intentional. */
@keyframes skeletonShimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
#gamesGrid:empty,
#eventsGrid:empty,
#playersBody:empty,
#globalLb:empty,
#featuredEvent:empty,
#playerProfile:empty,
#gamePage:empty {
  border-radius: 14px;
  background: linear-gradient(
    90deg,
    var(--bg-card) 0%,
    var(--bg-card-hover) 50%,
    var(--bg-card) 100%
  );
  background-size: 200% 100%;
  animation: skeletonShimmer 1.6s ease-in-out infinite;
  border: 1px solid var(--border);
  opacity: 0.55;
}
#gamesGrid:empty       { min-height: 240px; }
#eventsGrid:empty      { min-height: 320px; }
#playersBody:empty     { min-height: 320px; }
#globalLb:empty        { min-height: 480px; }
#featuredEvent:empty   { min-height: 240px; }
#playerProfile:empty   { min-height: 720px; }
#gamePage:empty        { min-height: 600px; }

/* Body-wide fade-in for first paint after Supabase resolves.
   Prevents the visible flash when JS replaces empty containers with content. */
body { transition: opacity 0.18s ease; }
body.is-loading main,
body.is-loading section { opacity: 0.92; }

/* ===== CUSTOM SCROLLBAR ===== */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(245, 158, 11, 0.25);
  border-radius: 99px;
}
::-webkit-scrollbar-thumb:hover { background: rgba(245, 158, 11, 0.5); }
::-webkit-scrollbar-corner { background: transparent; }
* { scrollbar-width: thin; scrollbar-color: rgba(245,158,11,0.25) transparent; }
h1, h2, h3, h4, h5, h6 { font-family: 'Archivo Black', Arial, sans-serif; letter-spacing: 0.03em; }
body {
  font-family: 'Nunito', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background 0.25s, color 0.25s;
  position: relative;
  overflow-x: clip;
}

/* Callisto-style background: starfield + top radial glow + deep navy base */
body::before {
  content: '';
  position: fixed;
  inset: -20%;
  z-index: -2;
  pointer-events: none;
  background:
    radial-gradient(ellipse 110% 65% at 50% -5%, rgba(59, 130, 246, 0.45), transparent 55%),
    radial-gradient(ellipse 70% 50% at 15% 25%, rgba(37, 99, 235, 0.18), transparent 65%),
    radial-gradient(ellipse 60% 45% at 88% 45%, rgba(56, 189, 248, 0.14), transparent 65%),
    radial-gradient(ellipse 90% 55% at 50% 115%, rgba(30, 64, 175, 0.28), transparent 55%);
  animation: glowBreath 9s ease-in-out infinite alternate;
}

@keyframes glowBreath {
  0%   { opacity: 0.35; transform: scale(1)    translateY(0); }
  100% { opacity: 1;    transform: scale(1.22) translateY(-4%); }
}


@media (prefers-reduced-motion: reduce) {
  body::before { animation: none; }
}
a { color: inherit; text-decoration: none; }

/* ===== SHIMMER ===== */
@keyframes shimmer {
  0% { background-position: 200% center; }
  100% { background-position: 0% center; }
}

.gold-shimmer {
  background: linear-gradient(
    90deg, #f59e0b 0%, #fde68a 20%, #ffffff 35%, #fde68a 50%,
    #f59e0b 65%, #ffffff 80%, #f59e0b 100%
  );
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: shimmer 5s linear infinite;
  filter: drop-shadow(0 1px 8px rgba(245, 158, 11, 0.25));
}

/* ===== NAVBAR ===== */
/* ===== NAVBAR (Apple liquid glass) ===== */
/* Wrapper that holds the navbar — provides centering and side padding for the morph */
.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 28px;
  background: transparent;
  border: 1px solid transparent;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  margin: 0;
  z-index: 100;
  transition:
    background 0.5s cubic-bezier(0.22, 1, 0.36, 1),
    backdrop-filter 0.5s cubic-bezier(0.22, 1, 0.36, 1),
    -webkit-backdrop-filter 0.5s cubic-bezier(0.22, 1, 0.36, 1),
    border-color 0.5s cubic-bezier(0.22, 1, 0.36, 1),
    border-radius 0.5s cubic-bezier(0.22, 1, 0.36, 1),
    margin 0.5s cubic-bezier(0.22, 1, 0.36, 1),
    padding 0.5s cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

/* Scrolled state — morphs into a floating frosted pill */
.navbar.scrolled {
  /* Bigger horizontal padding pulls the contents inward smoothly,
     creating the "centered pill" look without changing max-width. */
  margin: 12px max(20px, calc((100vw - 1100px) / 2)) 0;
  padding: 10px 28px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--bg) 55%, transparent);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-color: color-mix(in srgb, var(--text) 12%, transparent);
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.25),
    inset 0 1px 0 color-mix(in srgb, var(--text) 8%, transparent);
}


/* Pages without a hero need top padding so content isn't covered by the floating nav */
body:not(:has(.hero)):not(:has(.event-hero)) { padding-top: 70px; }

.wiki-toc { top: 80px; }

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.1rem;
}

.brand-text {
  background: linear-gradient(90deg, #f59e0b, #fde68a, #ffffff, #fde68a, #f59e0b);
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: shimmer 4s linear infinite;
}

.brand-icon {
  font-size: 1.5rem;
  filter: drop-shadow(0 0 6px rgba(245, 158, 11, 0.5));
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
}

.crown-logo-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
}

/* ===== FEATURED EVENT CARD (homepage) ===== */
.featured-section { padding-top: 40px; }

.featured-card {
  display: grid;
  grid-template-columns: 360px 1fr;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.featured-card:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
  box-shadow: 0 12px 40px rgba(245, 158, 11, 0.15);
}

.featured-thumb {
  background: linear-gradient(135deg, #334155 0%, #1e293b 100%);
  background-size: cover;
  background-position: center;
  min-height: 220px;
}

.featured-info {
  padding: 28px 32px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.featured-badges {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
}
.featured-badges .badge {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
}

.featured-title {
  font-size: 1.8rem;
  font-weight: 800;
  margin-bottom: 12px;
}

.featured-meta {
  display: flex;
  gap: 18px;
  color: var(--text-muted);
  font-size: 0.88rem;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.featured-meta span { display: inline-flex; align-items: center; gap: 6px; }

.featured-desc {
  color: var(--text-muted);
  font-size: 0.92rem;
  line-height: 1.6;
  margin-bottom: 18px;
}

.featured-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--accent);
  font-weight: 600;
  font-size: 0.92rem;
}
.featured-card:hover .featured-cta { gap: 12px; transition: gap 0.2s; }

/* ===== CROWN LOGO PREVIEW (admin) ===== */
.crown-logo-preview {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  overflow: hidden;
  flex-shrink: 0;
}
.crown-logo-preview img {
  width: 80%;
  height: 80%;
  object-fit: contain;
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
}

.nav-links {
  display: flex;
  gap: 36px;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}

.nav-link {
  color: var(--text-muted);
  font-size: 0.95rem;
  font-weight: 500;
  transition: color 0.2s;
  padding: 6px 2px;
}
.nav-link:hover { color: var(--text); }
.nav-link.active { color: var(--text); font-weight: 600; }

.sound-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  border-radius: 50%;
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.2s;
  flex-shrink: 0;
}
.sound-btn:hover { background: var(--bg-card); color: var(--text); border-color: var(--border); }
.sound-btn.playing { color: var(--accent); animation: soundPulse 0.6s ease-in-out infinite alternate; }
.sound-btn.no-sound { opacity: 0.25; cursor: default; pointer-events: none; }
@keyframes soundPulse { from { transform: scale(1); } to { transform: scale(1.2); } }

/* ===== HERO ===== */
.hero, .event-hero {
  position: relative;
  min-height: 420px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: transparent;
  background-size: cover;
  background-position: center;
  overflow: hidden;
  opacity: 0;
  transition: opacity 0.7s ease;
  /* Fade the bottom 25% of the hero image to transparent so it blends into the body's starfield */
  -webkit-mask-image: linear-gradient(
    180deg,
    #000 0%,
    #000 70%,
    rgba(0,0,0,0.6) 88%,
    transparent 100%
  );
  mask-image: linear-gradient(
    180deg,
    #000 0%,
    #000 70%,
    rgba(0,0,0,0.6) 88%,
    transparent 100%
  );
}

.event-hero {
  min-height: 380px;
  /* Less aggressive fade than the homepage hero — keep the image visible
     where the prev/next buttons overlap it. */
  -webkit-mask-image: linear-gradient(
    180deg,
    #000 0%,
    #000 80%,
    rgba(0,0,0,0.85) 95%,
    rgba(0,0,0,0.6) 100%
  );
  mask-image: linear-gradient(
    180deg,
    #000 0%,
    #000 80%,
    rgba(0,0,0,0.85) 95%,
    rgba(0,0,0,0.6) 100%
  );
}

/* Overlay no longer needs to fade the bottom — the hero itself does that now */
.hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    rgba(10, 15, 30, 0.35) 0%,
    rgba(10, 15, 30, 0.5) 60%,
    rgba(10, 15, 30, 0.7) 100%
  );
}

.hero-content {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 60px 20px;
  width: 100%;
  max-width: 680px;
}

.hero-badges {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 20px;
}

.badge {
  background: rgba(30, 41, 59, 0.75);
  backdrop-filter: blur(8px);
  color: var(--text);
  padding: 5px 14px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 500;
  border: 1px solid rgba(255,255,255,0.08);
}

.hero-title {
  font-size: 3rem;
  font-weight: 800;
  margin-bottom: 12px;
  letter-spacing: -0.02em;
  color: var(--text);
  text-shadow: 0 2px 16px rgba(0, 0, 0, 0.5);
}

.hero-subtitle {
  color: #e2e8f0;
  font-size: 1rem;
  margin-bottom: 28px;
  text-shadow: 0 2px 8px rgba(0,0,0,0.6);
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #e2e8f0;
  font-size: 0.85rem;
  margin-bottom: 16px;
  padding: 6px 14px;
  background: rgba(30, 41, 59, 0.75);
  border-radius: 999px;
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.08);
  transition: background 0.2s;
}
.back-link:hover { background: rgba(30, 41, 59, 0.9); }

/* ===== SEARCH ===== */
.search-box {
  position: relative;
  max-width: 500px;
  margin: 0 auto;
}
.search-box i {
  position: absolute;
  left: 18px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 0.9rem;
}
.search-box input {
  width: 100%;
  padding: 14px 18px 14px 46px;
  background: rgba(30, 41, 59, 0.85);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px;
  color: var(--text);
  font-size: 0.95rem;
  font-family: inherit;
}
.search-box input::placeholder { color: var(--text-muted); }
.search-box input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.15);
}
/* ===== PLAYER SEARCH AUTOCOMPLETE ===== */
@keyframes dropdownOpen {
  from { opacity: 0; transform: translateY(-6px) scaleY(0.95); }
  to   { opacity: 1; transform: translateY(0)    scaleY(1); }
}

.player-search-dropdown {
  position: fixed; /* overridden inline; fixed here as fallback */
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
  z-index: 9999;
  transform-origin: top center;
  animation: dropdownOpen 0.18s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.player-search-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 500;
  transition: background 0.15s;
  border-bottom: 1px solid var(--border);
}
.player-search-item:last-child { border-bottom: none; }
.player-search-item:hover,
.player-search-item.active { background: var(--bg-card-hover); color: var(--accent); }
.player-search-item .mc-head { border-radius: 4px; flex-shrink: 0; }

.search-box--page { margin: 24px auto 0; }
.search-box--page input {
  background: var(--bg-card);
  border-color: var(--border);
}

/* ===== PAGE HEADER ===== */
.page-header { text-align: center; padding: 60px 20px 32px; }
.page-title {
  font-size: 2.4rem;
  font-weight: 800;
  margin-bottom: 8px;
  display: inline-flex;
  align-items: center;
  gap: 14px;
}
.page-title i { color: var(--text); }
.page-subtitle { color: var(--text-muted); font-size: 1rem; margin-bottom: 28px; }

.filter-tabs {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}
.filter-tab {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 8px 18px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s;
}
.filter-tab:hover { background: var(--bg-card-hover); color: var(--text); }
.filter-tab.active { background: #475569; color: #fff; border-color: #475569; }

/* ===== SECTION ===== */
.section { padding: 20px 0 80px; flex: 1; }
.container { max-width: 1280px; margin: 0 auto; padding: 0 40px; }

.section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
}
.section-title i { color: var(--accent); font-size: 1.1rem; }

.section-subtitle {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 22px;
}

.subsection-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  margin: 28px 0 12px;
}

/* ===== GAMES GRID ===== */
.games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 18px;
}

.game-card {
  background: linear-gradient(
    135deg,
    color-mix(in srgb, var(--game-color) 8%, var(--bg-card)) 0%,
    var(--bg-card) 70%
  );
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  display: flex;
  gap: 16px;
  transition: transform 0.2s, border-color 0.2s;
  position: relative;
  overflow: hidden;
}

.game-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 3px;
  height: 100%;
  background: var(--game-color);
}

.game-card:hover {
  transform: translateY(-2px);
  border-color: var(--game-color);
}

.game-icon {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.2rem;
  flex-shrink: 0;
  box-shadow: 0 6px 16px rgba(0,0,0,0.3);
  overflow: hidden;
}
.game-icon img {
  width: 70%;
  height: 70%;
  object-fit: contain;
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
}

.game-info h3 {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--text);
}

.game-info p {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* ===== TEAM CARDS ===== */
.team-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
}

.team-card {
  background: linear-gradient(
    135deg,
    color-mix(in srgb, var(--team-color) 10%, var(--bg-card)) 0%,
    var(--bg-card) 60%
  );
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  position: relative;
  transition: transform 0.2s, border-color 0.2s;
}

.team-card::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 64px;
  height: 2px;
  background: var(--team-color);
}

.team-card:hover {
  transform: translateY(-2px);
  border-color: var(--team-color);
}

.team-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
}

.team-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1rem;
  box-shadow: 0 4px 12px rgba(0,0,0,0.25);
  overflow: hidden;
  flex-shrink: 0;
}

.team-icon img {
  width: 78%;
  height: 78%;
  object-fit: contain;
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
}

.team-name { font-weight: 700; font-size: 1rem; }
.team-body {
  padding: 18px 16px;
  color: var(--text-muted);
  font-size: 0.88rem;
}

/* ===== EVENTS ===== */
.events-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  max-width: 1200px;
  margin: 0 auto;
}
.event-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  transition: transform 0.2s, border-color 0.2s;
  display: block;
}
.event-card:hover { transform: translateY(-3px); border-color: var(--accent); }
.event-thumb {
  height: 150px;
  background: linear-gradient(135deg, #334155 0%, #1e293b 100%);
  background-size: cover;
  background-position: center;
}
.event-info { padding: 16px 18px; }
.event-info h3 {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 10px;
  color: var(--text);
}
.event-meta {
  display: flex;
  gap: 14px;
  color: var(--text-muted);
  font-size: 0.82rem;
  flex-wrap: wrap;
}
.event-meta span { display: inline-flex; align-items: center; gap: 5px; }

/* ===== EVENT DETAIL PAGE ===== */
.event-tabs-wrap {
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

/* Prev / Next event navigation arrows — overlap the bottom of the hero so the
   event image continues behind them, then a gradient fades into the page bg. */
.event-nav-wrap {
  position: relative;
  z-index: 5;
  margin-top: -110px;
  padding: 70px 0 16px;
  background: linear-gradient(
    180deg,
    transparent 0%,
    rgba(10, 15, 30, 0.65) 45%,
    var(--bg) 90%
  );
}
.event-nav {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
}
.event-nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 4px;
  background: none;
  border: none;
  color: var(--accent);
  text-decoration: none;
  font-family: 'Nunito', Arial, sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  transition: color 0.18s ease, transform 0.2s ease;
}
.event-nav-btn:hover {
  color: var(--accent-hover);
  background: none;
}
.event-nav-prev { grid-column: 1; justify-self: start; }
.event-nav-next { grid-column: 3; justify-self: end; }
.event-nav-prev:hover { transform: translateX(-3px); }
.event-nav-next:hover { transform: translateX(3px); }
.event-nav-btn i { font-size: 0.95rem; color: inherit; }
.event-nav-label { line-height: 1; }
.event-nav-spacer { width: 0; height: 0; visibility: hidden; padding: 0; }

/* ===== EVENT PAGE — SLIDE TRANSITION ===== */
@keyframes ccEvSlideOutLeft  { from { opacity: 1; transform: translateX(0); } to { opacity: 0; transform: translateX(-40px); } }
@keyframes ccEvSlideOutRight { from { opacity: 1; transform: translateX(0); } to { opacity: 0; transform: translateX(40px); } }
@keyframes ccEvSlideInRight  { from { opacity: 0; transform: translateX(40px); } to { opacity: 1; transform: translateX(0); } }
@keyframes ccEvSlideInLeft   { from { opacity: 0; transform: translateX(-40px); } to { opacity: 1; transform: translateX(0); } }

body.is-leaving-next .event-hero,
body.is-leaving-next .event-nav-wrap,
body.is-leaving-next .event-tabs-wrap,
body.is-leaving-next > section.section { animation: ccEvSlideOutLeft 0.24s cubic-bezier(0.4, 0, 1, 1) both; }

body.is-leaving-prev .event-hero,
body.is-leaving-prev .event-nav-wrap,
body.is-leaving-prev .event-tabs-wrap,
body.is-leaving-prev > section.section { animation: ccEvSlideOutRight 0.24s cubic-bezier(0.4, 0, 1, 1) both; }

body.is-entering-next .event-hero,
body.is-entering-next .event-nav-wrap,
body.is-entering-next .event-tabs-wrap,
body.is-entering-next > section.section { animation: ccEvSlideInRight 0.32s cubic-bezier(0.22, 1, 0.36, 1) both; }

body.is-entering-prev .event-hero,
body.is-entering-prev .event-nav-wrap,
body.is-entering-prev .event-tabs-wrap,
body.is-entering-prev > section.section { animation: ccEvSlideInLeft 0.32s cubic-bezier(0.22, 1, 0.36, 1) both; }

.event-tabs {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  padding: 0;
}

.event-tab {
  background: none;
  border: none;
  color: var(--text-muted);
  padding: 16px 22px;
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 500;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color 0.2s, border-color 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.event-tab:hover { color: var(--text); }
.event-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.event-pane { display: none; }
.event-pane.active { display: block; }

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

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

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

.overview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.overview-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 18px;
}

.ov-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
}

.ov-value {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text);
}

.event-description {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 10px;
  padding: 18px 22px;
  color: var(--text-muted);
  line-height: 1.7;
}

/* ===== LEADERBOARD ===== */
.leaderboard-table {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

.lb-header {
  display: grid;
  grid-template-columns: 80px 1fr 120px 120px;
  gap: 16px;
  padding: 14px 22px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.lb-body { display: flex; flex-direction: column; }

.lb-row {
  display: grid;
  grid-template-columns: 80px 1fr 120px 120px;
  gap: 16px;
  padding: 14px 22px;
  align-items: center;
  border-bottom: 1px solid var(--border);
  transition: background 0.2s;
}
.lb-row:last-child { border-bottom: none; }
.lb-row:hover { background: var(--bg-card-hover); }

.lb-rank {
  font-weight: 700;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.lb-team {
  display: flex;
  align-items: center;
  gap: 10px;
}
.lb-team.lb-team-col {
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}
.lb-team-name-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.lb-team-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.lb-team-pill {
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(255,255,255,0.07);
  border-radius: 20px;
  padding: 2px 8px 2px 3px;
  font-size: 0.76rem;
  color: var(--text-muted);
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}
a.lb-team-pill:hover {
  background: rgba(245, 158, 11, 0.18);
  color: var(--text);
  transform: translateY(-1px);
}
.lb-team-pill img {
  width: 18px;
  height: 18px;
  border-radius: 3px;
  image-rendering: pixelated;
}

.lb-team-dot {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 0.78rem;
  overflow: hidden;
  flex-shrink: 0;
}
.lb-team-dot img {
  width: 75%;
  height: 75%;
  object-fit: contain;
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
}

/* ===== EMPTY STATE ===== */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.empty-state i {
  font-size: 3rem;
  display: block;
  margin-bottom: 16px;
  opacity: 0.4;
}

/* ===== ADMIN GATE ===== */
.admin-gate {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
}

.admin-gate-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 40px 34px;
  width: 100%;
  max-width: 400px;
  text-align: center;
}

.admin-gate-icon {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--accent);
  color: #0f172a;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  margin: 0 auto 20px;
  box-shadow: 0 8px 24px rgba(245, 158, 11, 0.3);
}

.admin-gate-box h2 {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 6px;
}
.admin-gate-box > p {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 22px;
}

.admin-gate-box input {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.95rem;
  font-family: inherit;
  margin-bottom: 12px;
}
.admin-gate-box input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.15);
}

.admin-login-btn {
  width: 100%;
  padding: 12px;
  background: var(--accent);
  color: #0f172a;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.2s;
}
.admin-login-btn:hover { background: var(--accent-hover); }

.admin-gate-error {
  color: #ef4444;
  font-size: 0.85rem;
  min-height: 18px;
  margin-top: 12px;
}

/* ===== ADMIN PAGE ===== */
.admin-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
  flex-wrap: wrap;
  gap: 14px;
}

.admin-body {
  display: flex;
  flex-direction: column;
  gap: 0;
}


.admin-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 18px;
}

.admin-section h3 {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}
.admin-section h3 i { color: var(--accent); font-size: 0.95rem; }

.admin-hint {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.event-images-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}

.event-images-grid .event-admin-block { margin-bottom: 0; }
.event-images-grid .banner-preview { max-height: 200px; }

.event-admin-block {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 12px;
}

.event-admin-block h4 {
  font-size: 0.95rem;
  color: var(--text);
}

.upload-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.upload-row label {
  flex: 1;
  min-width: 180px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.upload-btn {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 7px 14px;
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.82rem;
  cursor: pointer;
  transition: background 0.2s;
}
.upload-btn:hover { background: var(--bg-card-hover); }

.clear-btn {
  background: transparent;
  border: 1px solid #ef4444;
  color: #ef4444;
  padding: 7px 12px;
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.8rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.clear-btn:hover { background: rgba(239, 68, 68, 0.1); }

.team-upload-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.team-upload {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
}

.team-upload-top {
  display: flex;
  align-items: center;
  gap: 10px;
}

.team-upload-preview {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 0.85rem;
  flex-shrink: 0;
}
.team-upload-preview img {
  width: 75%;
  height: 75%;
  object-fit: contain;
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
}

.team-upload-name {
  flex: 1;
  font-size: 0.82rem;
  font-weight: 600;
}

.team-upload-btns { display: flex; gap: 4px; }

.team-upload button {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.72rem;
  padding: 5px 9px;
  border-radius: 4px;
  cursor: pointer;
  font-family: inherit;
}
.team-upload button:hover { color: var(--text); }

.admin-status {
  font-size: 0.82rem;
  margin-top: 8px;
  min-height: 16px;
}

/* ===== FOOTER ===== */
.footer {
  background: var(--footer-bg);
  padding: 50px 40px 24px;
  margin-top: auto;
  color: var(--text-muted);
}

.footer-grid {
  max-width: 1280px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr 1fr;
  gap: 40px;
  padding-bottom: 32px;
  border-bottom: 1px solid var(--border);
}

.footer-brand-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.05rem;
  color: var(--text);
  margin-bottom: 10px;
}

.footer-tag {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-bottom: 18px;
  max-width: 320px;
}

.support-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #f87171;
  color: #fff;
  padding: 8px 16px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.88rem;
  transition: background 0.2s;
}
.support-btn:hover { background: #ef4444; }

.footer-col h4 {
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 14px;
}
.footer-col a {
  display: block;
  color: var(--text-muted);
  font-size: 0.88rem;
  padding: 5px 0;
  transition: color 0.2s;
}
.footer-col a:hover { color: var(--text); }
.footer-col a i { margin-right: 8px; width: 16px; }
.footer-col a .bsky-icon {
  width: 14px;
  height: 14px;
  margin-right: 8px;
  vertical-align: -2px;
  display: inline-block;
}

.footer-bottom {
  max-width: 1280px;
  margin: 0 auto;
  text-align: center;
  padding-top: 22px;
  font-size: 0.82rem;
  color: var(--text-dim);
}
.copyright { margin-top: 6px; }

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
  .team-grid { grid-template-columns: repeat(3, 1fr); }
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 30px; }
}
@media (max-width: 768px) {
  .navbar { padding: 14px 18px; flex-wrap: wrap; }
  .nav-links {
    position: static;
    transform: none;
    order: 3;
    width: 100%;
    justify-content: center;
    margin-top: 14px;
    gap: 22px;
  }
  .hero-title { font-size: 2rem; }
  .team-grid { grid-template-columns: repeat(2, 1fr); }
  .container { padding: 0 20px; }
  .lb-header, .lb-row { grid-template-columns: 50px 1fr 80px; }
  .lb-header > :last-child, .lb-row > :last-child { display: none; }
  .footer { padding: 36px 20px 20px; }
  .team-upload-grid { grid-template-columns: 1fr; }
  .games-grid { grid-template-columns: 1fr; }
  .featured-card { grid-template-columns: 1fr; }
  .featured-thumb { min-height: 180px; }
  .featured-info { padding: 22px; }
  .featured-title { font-size: 1.4rem; }
}
@media (max-width: 480px) {
  .team-grid { grid-template-columns: 1fr; }
  .hero-title { font-size: 1.6rem; }
  .page-title { font-size: 1.7rem; }
}

/* ===== ADMIN TABS ===== */
.admin-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}

.admin-tab {
  background: none;
  border: none;
  color: var(--text-muted);
  padding: 14px 20px;
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 500;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color 0.2s, border-color 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}
.admin-tab:hover { color: var(--text); }
.admin-tab.active { color: var(--accent); border-bottom-color: var(--accent); }

.admin-tab-pane { display: none; }
.admin-tab-pane.active { display: block; animation: tabSlideIn 0.22s cubic-bezier(0.22, 1, 0.36, 1) both; }

/* ===== ADMIN FORMS ===== */
.admin-form {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: stretch;
}

.admin-form-grid {
  flex-direction: column;
}

.admin-form input[type="text"],
.admin-form input[type="number"],
.admin-form select,
.admin-form textarea,
.admin-list-row input,
.admin-list-row select,
.admin-badge-row input,
.event-admin-block input,
.event-admin-block select,
.event-admin-block textarea,
.score-table-row input {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 14px;
  border-radius: 7px;
  font-size: 0.9rem;
  font-family: inherit;
  flex: 1;
  min-width: 160px;
}

.admin-form input:focus,
.admin-form select:focus,
.admin-form textarea:focus,
.admin-list-row input:focus,
.admin-list-row select:focus,
.event-admin-block input:focus,
.event-admin-block textarea:focus,
.score-table-row input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.15);
}

.admin-form textarea { resize: vertical; min-height: 70px; }

.primary-btn {
  background: var(--accent);
  color: #0f172a;
  border: none;
  padding: 10px 18px;
  border-radius: 7px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.9rem;
  transition: background 0.2s;
}
.primary-btn:hover { background: var(--accent-hover); }

.secondary-btn {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  font-family: inherit;
  font-size: 0.88rem;
  transition: background 0.2s, color 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.secondary-btn:hover { background: var(--accent); color: #0f172a; }

.checkbox-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.88rem;
  color: var(--text-muted);
  cursor: pointer;
}
.checkbox-row input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
}

.games-checklist {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 12px 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}
.checklist-label {
  width: 100%;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}

/* ===== ADMIN LIST (players) ===== */
.admin-list { display: flex; flex-direction: column; gap: 8px; }

.admin-list-row {
  display: grid;
  grid-template-columns: 40px 1fr 180px 40px;
  gap: 10px;
  align-items: center;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
}

.admin-list-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 0.9rem;
}

.icon-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  width: 36px;
  height: 36px;
  border-radius: 7px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
}
.icon-btn:hover { color: var(--text); }
.icon-btn.danger:hover { color: #ef4444; border-color: #ef4444; background: rgba(239, 68, 68, 0.08); }

.event-admin-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}
.event-admin-head h4 { margin: 0; }
.event-admin-head .icon-btn {
  width: auto;
  padding: 6px 12px;
  gap: 6px;
  font-size: 0.8rem;
}

/* ===== SCORE TABLES ===== */
.score-table {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.score-table-head {
  display: grid;
  grid-template-columns: 1fr 120px 120px;
  gap: 14px;
  padding: 10px 16px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.score-table-row {
  display: grid;
  grid-template-columns: 1fr 120px 120px;
  gap: 14px;
  padding: 10px 16px;
  align-items: center;
  border-bottom: 1px solid var(--border);
}
.score-table-row:last-child { border-bottom: none; }

.score-team {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.9rem;
}

.team-icon-inline {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 0.78rem;
  overflow: hidden;
  flex-shrink: 0;
}
.team-icon-inline img {
  width: 75%;
  height: 75%;
  object-fit: contain;
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
}

.score-table-row input[type="number"] {
  padding: 8px 12px;
  text-align: center;
  min-width: 0;
}

/* ===== PLAYERS PAGE ===== */
.players-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.players-table-header {
  display: grid;
  gap: 12px;
  padding: 10px 16px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  align-items: center;
  min-width: max-content;
}

.player-game-col-head,
.player-total-col-head {
  text-align: center;
}

.player-card {
  display: grid;
  align-items: center;
  gap: 12px;
  min-width: max-content;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  transition: transform 0.2s, border-color 0.2s;
}
.player-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
}

.player-card-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.player-card-name {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  margin: 0;
}

.player-game-cell {
  text-align: center;
  font-size: 1.1rem;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: 0.01em;
}

.player-total-cell {
  text-align: center;
  font-size: 1.1rem;
  font-weight: 700;
  color: #ffffff;
}

/* ===== PLAYER PROFILE ===== */
.back-link-inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  font-size: 0.88rem;
  margin-bottom: 20px;
  transition: color 0.2s;
}
.back-link-inline:hover { color: var(--text); }

.player-profile-header {
  display: flex;
  align-items: center;
  gap: 24px;
  margin-bottom: 30px;
  padding: 30px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
}

.player-profile-meta { flex: 1; }

.player-profile-name {
  font-size: 2rem;
  font-weight: 800;
  margin-bottom: 10px;
}

.player-profile-team {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 0.95rem;
  font-weight: 600;
}

/* ===== PLAYER BADGES ===== */
.player-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.player-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  background: color-mix(in srgb, var(--badge-color) 15%, var(--bg-secondary));
  border: 1px solid color-mix(in srgb, var(--badge-color) 40%, transparent);
  color: var(--badge-color);
  cursor: default;
  transition: background 0.15s, transform 0.15s;
}
.player-badge:hover {
  background: color-mix(in srgb, var(--badge-color) 25%, var(--bg-secondary));
  transform: translateY(-1px);
}
.player-badge i { font-size: 0.75rem; }

.player-badge[data-tooltip] { position: relative; }
.player-badge[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 0.75rem;
  font-weight: 400;
  white-space: nowrap;
  padding: 6px 10px;
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s, transform 0.15s;
  z-index: 100;
}
.player-badge[data-tooltip]:hover::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ===== ADMIN: Custom badge editor ===== */
.admin-search-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0 14px;
  margin-bottom: 12px;
  transition: border-color 0.15s;
}
.admin-search-row:focus-within { border-color: var(--accent); }
.admin-search-row i { color: var(--text-muted); font-size: 0.85rem; }
.admin-search-row input {
  flex: 1;
  background: transparent !important;
  border: none !important;
  padding: 10px 0 !important;
  color: var(--text);
  font-size: 0.88rem;
  font-family: inherit;
  outline: none;
}
.admin-search-row input::placeholder { color: var(--text-muted); }
.admin-search-empty { padding: 20px; text-align: center; }

.admin-player-block { margin-bottom: 4px; }
.admin-badge-count {
  font-size: 0.7rem;
  font-weight: 800;
  color: var(--accent);
  margin-left: 2px;
}
.admin-badge-editor {
  margin: 0 0 6px 0;
}
.admin-badge-editor-inner {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  margin-top: 4px;
}
.admin-badge-editor-inner h4 {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.admin-badge-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}
.admin-badge-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 10px;
}
.admin-badge-row-top {
  display: grid;
  grid-template-columns: minmax(140px, 200px) 1fr 1.6fr 38px;
  gap: 8px;
  align-items: center;
}
.admin-badge-row-bottom {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.admin-badge-row input[type="text"] { padding: 6px 10px !important; font-size: 0.78rem; }
.admin-badge-preview {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  background: color-mix(in srgb, var(--badge-color) 15%, var(--bg-secondary));
  border: 1px solid color-mix(in srgb, var(--badge-color) 40%, transparent);
  color: var(--badge-color);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.admin-badge-preview i { font-size: 0.7rem; }
.admin-badge-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

/* Icon picker dropdown */
.admin-badge-icon-picker { position: relative; }
.admin-badge-icon-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 600;
  font-family: inherit;
  min-width: 160px;
}
.admin-badge-icon-btn > i:first-child {
  color: var(--badge-color);
  font-size: 1rem;
}
.admin-badge-icon-btn > span { flex: 1; text-align: left; }
.admin-badge-icon-chev { font-size: 0.7rem; color: var(--text-muted); }
.admin-badge-icon-btn:hover { border-color: var(--accent); }
.admin-badge-icon-list {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 100;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 6px;
  display: none;
  grid-template-columns: repeat(8, 32px);
  gap: 2px;
  max-height: 280px;
  overflow-y: auto;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.55);
}
.admin-badge-icon-list.is-open { display: grid; }
.admin-badge-icon-opt {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
  padding: 0;
}
.admin-badge-icon-opt i { font-size: 0.95rem; }
.admin-badge-icon-opt:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent);
  color: var(--text);
}
.admin-badge-icon-opt.is-active {
  background: rgba(245, 158, 11, 0.16);
  border-color: var(--accent);
  color: var(--accent);
}

.admin-badge-color-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
}
.admin-badge-color-label input[type="color"] {
  height: 36px;
  width: 50px;
  padding: 2px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
}
.admin-badge-color-text {
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.admin-facts-textarea {
  width: 100%;
  min-height: 110px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.85rem;
  line-height: 1.5;
  resize: vertical;
}
.admin-facts-textarea:focus {
  outline: none;
  border-color: var(--accent);
}

/* Player profile — Facts list */
.player-facts-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.player-facts-list li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 14px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 8px;
  font-size: 0.9rem;
  color: var(--text);
  line-height: 1.4;
}
.player-facts-list li i {
  color: var(--accent);
  font-size: 0.78rem;
  margin-top: 4px;
  flex-shrink: 0;
}

@media (max-width: 720px) {
  .admin-badge-row-top {
    grid-template-columns: 1fr 38px;
  }
  .admin-badge-preview { grid-column: 1 / -1; }
  .admin-badge-icon-list { grid-template-columns: repeat(6, 32px); }
}

/* ===== TEAM PLAYERS LIST (on team cards) ===== */
.team-players {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.team-player {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--text);
}

.player-avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 0.7rem;
  flex-shrink: 0;
}

.team-empty {
  color: var(--text-muted);
  font-size: 0.85rem;
  font-style: italic;
}

@media (max-width: 768px) {
  .admin-list-row { grid-template-columns: 32px 1fr 120px 36px; }
  .score-table-head,
  .score-table-row { grid-template-columns: 1fr 80px 80px; gap: 8px; padding: 8px 10px; }
  .player-profile-header { flex-direction: column; text-align: center; padding: 20px; }
}

/* ===== MINECRAFT HEAD ===== */
.mc-head {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 3px;
  overflow: hidden;
  position: relative;
  flex-shrink: 0;
  background: var(--bg-secondary);
}
.mc-head img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
}
.mc-head-fallback {
  display: none;
  width: 100%;
  height: 100%;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: #0f172a;
  font-weight: 700;
  font-size: 0.9em;
}

/* Override player card avatar to use mc-head */
.player-card { position: relative; }
.player-card .mc-head { border-radius: 4px; }

.player-card-stats {
  display: flex;
  gap: 12px;
  font-size: 0.82rem;
  color: var(--text-muted);
  flex-shrink: 0;
}
.player-card-stats span { display: inline-flex; align-items: center; gap: 4px; }

.stat-icon {
  width: 1em;
  height: 1em;
  object-fit: contain;
  vertical-align: middle;
  display: inline-block;
}

/* Team players list — make MC heads sit right */
.team-player {
  cursor: pointer;
  transition: color 0.15s;
}
.team-player:hover { color: var(--accent); }
.team-player .mc-head { border-radius: 4px; }

.player-skin-wrap {
  width: 140px;
  flex-shrink: 0;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  overflow: hidden;
}

.player-skin-img {
  width: 100%;
  display: block;
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
}


.player-profile-team {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 0.95rem;
  font-weight: 600;
}

.player-profile-team .dim {
  color: var(--text-muted);
  font-weight: 400;
  font-size: 0.85rem;
}

.profile-section-title {
  font-size: 1.2rem;
  font-weight: 700;
  margin: 32px 0 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.profile-section-title i { color: var(--accent); font-size: 0.95rem; }

/* ===== RADAR CHART ===== */
.radar-wrapper {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 70px 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: visible;
}

.radar-container {
  position: relative;
  width: 100%;
  max-width: 560px;
  aspect-ratio: 1 / 1;
}

.radar-svg {
  width: 100%;
  height: 100%;
}

.radar-grid {
  fill: none;
  stroke: var(--border);
  stroke-width: 1;
  opacity: 0.6;
}

.radar-axis {
  stroke: var(--border);
  stroke-width: 1;
  opacity: 0.4;
}

.radar-data {
  fill: rgba(245, 158, 11, 0.25);
  stroke: var(--accent);
  stroke-width: 2;
  stroke-linejoin: round;
}

.radar-data-dot {
  fill: var(--accent);
  stroke: var(--bg-card);
  stroke-width: 2;
}

.radar-ring-label {
  fill: var(--text-muted);
  font-size: 11px;
  font-family: 'Nunito', Arial, sans-serif;
  opacity: 0.7;
}

.radar-game-marker {
  position: absolute;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  pointer-events: none;
}

.radar-game-icon {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1rem;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  overflow: hidden;
}
.radar-game-icon img {
  width: 70%; height: 70%; object-fit: contain;
  image-rendering: pixelated;
}

.radar-game-label {
  text-align: center;
  font-size: 0.7rem;
  white-space: nowrap;
  background: var(--bg-secondary);
  padding: 3px 8px;
  border-radius: 4px;
  border: 1px solid var(--border);
}

.radar-game-name { font-weight: 600; color: var(--text); }
.radar-game-value { color: var(--accent); font-weight: 700; font-size: 0.75rem; }

/* ===== HISTORY CARDS ===== */
.history-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.history-card {
  display: grid;
  grid-template-columns: 60px 1fr auto;
  gap: 18px;
  align-items: center;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 18px;
  transition: transform 0.2s, border-color 0.2s;
}

.history-card:hover {
  transform: translateX(4px);
  filter: brightness(1.15);
}

.history-rank {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--accent);
  text-align: center;
}

.history-info h4 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 4px;
  color: var(--text);
}

.history-meta {
  display: flex;
  gap: 14px;
  font-size: 0.82rem;
  color: var(--text-muted);
  flex-wrap: wrap;
  align-items: center;
}

.history-meta span { display: inline-flex; align-items: center; gap: 5px; }

.history-stats {
  display: flex;
  gap: 14px;
  font-size: 0.88rem;
  color: var(--text);
  font-weight: 500;
}
.history-stats span { display: inline-flex; align-items: center; gap: 5px; }
.history-stats .dim { color: var(--text-muted); font-weight: 400; }

.team-icon-inline-tiny {
  width: 18px; height: 18px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 0.6rem;
  vertical-align: middle;
  margin-right: 4px;
  overflow: hidden;
}
.team-icon-inline-tiny img {
  width: 75%; height: 75%; object-fit: contain;
  image-rendering: pixelated;
}

/* ===== ROSTER ADMIN ===== */
.roster-section h3 {
  display: flex;
  align-items: center;
  gap: 10px;
}
.roster-section .dim { color: var(--text-muted); font-weight: 400; font-size: 0.85rem; }

.roster-players {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.roster-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 10px 4px 4px;
  font-size: 0.85rem;
}
.roster-chip span { font-weight: 500; }

.chip-remove {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.85rem;
  padding: 2px 4px;
  border-radius: 4px;
}
.chip-remove:hover { color: #ef4444; }

/* ===== STATS TABLE DIVIDER ===== */
.score-team-divider {
  padding: 6px 14px;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ===== PLAYER LB ROW ===== */
.lb-row-player {
  grid-template-columns: 60px 1fr 140px 100px 80px;
}

.lb-player {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  color: var(--text);
}
.lb-player:hover { color: var(--accent); }
.lb-team-mark {
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
  background: transparent;
}
.lb-team-mark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: pixelated;
}

@media (max-width: 768px) {
  .history-card { grid-template-columns: 50px 1fr; }
  .history-stats { grid-column: 1 / -1; padding-top: 8px; border-top: 1px solid var(--border); }
  .lb-row-player { grid-template-columns: 40px 1fr 70px; }
  .lb-row-player > :nth-child(3),
  .lb-row-player > :nth-child(5) { display: none; }
  .radar-game-icon { width: 28px; height: 28px; font-size: 0.8rem; }
  .radar-game-label { font-size: 0.6rem; }
}

/* ===== JSON IMPORT ===== */
.import-preview {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-left: 3px solid #10b981;
  border-radius: 8px;
  padding: 16px 20px;
  margin-top: 14px;
}
.import-preview h4 {
  font-size: 0.95rem;
  margin-bottom: 10px;
  color: var(--text);
}
.import-preview ul {
  list-style: none;
  padding: 0;
  margin-bottom: 6px;
}
.import-preview li {
  font-size: 0.85rem;
  color: var(--text-muted);
  padding: 3px 0;
}
.import-preview li strong { color: var(--text); }

.json-example {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  font-family: 'Courier New', monospace;
  font-size: 0.78rem;
  color: var(--text-muted);
  overflow-x: auto;
  margin-bottom: 12px;
  line-height: 1.5;
}

.admin-hint code {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 0.78rem;
  color: var(--accent);
}

/* ===== PLAIN ICONS (no background) ===== */
.game-icon-plain {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  font-size: 1.4rem;
  flex-shrink: 0;
  background: none;
  box-shadow: none;
}
.game-icon-plain img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
}

.team-icon-plain {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
  background: none;
  box-shadow: none;
}
.team-icon-plain img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
}

.radar-game-icon-plain {
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  font-size: 1rem;
  background: none;
  box-shadow: none;
}
.radar-game-icon-plain img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
}

/* Game card no longer needs the colored left bar or hover-color tint */
.game-card {
  background: var(--bg-card);
  border-color: var(--border);
}
.game-card::before { display: none; }
.game-card:hover { border-color: var(--accent); }
.game-card .game-info h3 { color: var(--text); }

/* Team card: keep the team color accent line under the header, remove icon-tile */
@media (max-width: 768px) {
  .game-icon-plain { width: 38px; height: 38px; font-size: 1.1rem; }
  .team-icon-plain { width: 28px; height: 28px; font-size: 0.9rem; }
  .radar-game-icon-plain { width: 28px; height: 28px; font-size: 0.8rem; }
}

/* ===== SYNC TAB ===== */
.endpoint-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.endpoint-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 8px 12px;
  font-size: 0.85rem;
  flex-wrap: wrap;
}
.endpoint-method {
  font-weight: 700;
  font-size: 0.7rem;
  padding: 3px 8px;
  border-radius: 4px;
  letter-spacing: 0.05em;
}
.endpoint-method.get { background: #10b98133; color: #10b981; }
.endpoint-row code {
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 0.82rem;
  color: var(--accent);
}
.endpoint-desc {
  color: var(--text-muted);
  font-size: 0.82rem;
  margin-left: auto;
}
.endpoint-desc code {
  background: none;
  border: none;
  padding: 0;
  color: var(--text-muted);
}

.sync-log-list {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.sync-log-list h4 {
  font-size: 0.9rem;
  margin-bottom: 6px;
  color: var(--text);
}
.sync-log-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.85rem;
}
.sync-log-row code {
  background: var(--bg);
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 0.78rem;
  color: var(--accent);
}
.sync-log-row.success { border-left: 3px solid #10b981; }
.sync-log-row.error { border-left: 3px solid #ef4444; }
.sync-log-row.success i { color: #10b981; }
.sync-log-row.error i { color: #ef4444; }
.sync-log-row button { margin-left: auto; }
.sync-log-empty {
  padding: 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.88rem;
}

/* ===== EVENT GAMES ROW (in About section) ===== */
.games-row-hint {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 14px;
}

.games-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: stretch;
}

.games-row-item {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 12px 10px;
  min-width: 88px;
  flex: 0 0 auto;
  cursor: default;
  transition: transform 0.15s, border-color 0.15s, background 0.15s;
}

.games-row-item:hover,
.games-row-item:focus {
  transform: translateY(-2px);
  border-color: var(--accent);
  background: var(--bg-card-hover);
  outline: none;
}

.games-row-num {
  position: absolute;
  top: 4px;
  left: 6px;
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--text-muted);
  background: var(--bg-secondary);
  border-radius: 4px;
  padding: 1px 5px;
  letter-spacing: 0.05em;
}

.games-row-icon {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  color: var(--text);
  margin-bottom: 6px;
}
.games-row-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
}

.games-row-name {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text);
  text-align: center;
  line-height: 1.2;
  max-width: 90px;
}

.games-row-tooltip {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  width: 240px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.35);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s, transform 0.15s;
  z-index: 20;
}

.games-row-tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: var(--border);
}
.games-row-tooltip::before {
  content: '';
  position: absolute;
  top: calc(100% - 1px);
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: var(--bg-secondary);
  z-index: 1;
}

.games-row-item:hover .games-row-tooltip,
.games-row-item:focus .games-row-tooltip {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.tooltip-name {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}

.tooltip-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.games-row-empty {
  color: var(--text-muted);
  font-size: 0.85rem;
  font-style: italic;
}

@media (max-width: 768px) {
  .games-row { gap: 8px; }
  .games-row-item { min-width: 70px; padding: 12px 8px 8px; }
  .games-row-icon { width: 36px; height: 36px; font-size: 1.1rem; }
  .games-row-name { font-size: 0.7rem; }
  .games-row-tooltip { width: 200px; }
}

/* ===== GAME WIKI PAGE ===== */
.wiki-header {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  margin-bottom: 22px;
  overflow: hidden;
}

/* The top portion holds the icon + text. Was the whole header before. */
.wiki-header-top {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 28px 32px;
}

/* When there's a banner inside the header, the top portion gets a divider below it */
.wiki-header--with-banner .wiki-header-top {
  padding-bottom: 24px;
}

/* Banner inside the header — moderate height, slight crop top/bottom for compactness */
.wiki-header-banner {
  width: 100%;
  height: 320px;
  overflow: hidden;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
}

.wiki-header-banner img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Glowing type-color bar on the left edge */
.wiki-header::before,
.wiki-section::before {
  content: '';
  position: absolute;
  left: 0; top: 0;
  width: 5px;
  height: 100%;
  background: var(--game-type-bar, transparent);
  z-index: 1;
  pointer-events: none;
}

@keyframes sliverShimmer {
  0%   { background-position: 0% 0%; }
  100% { background-position: 0% 200%; }
}

.wiki-header-icon {
  width: 84px;
  height: 84px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.6rem;
  color: var(--text);
  flex-shrink: 0;
}
.wiki-header-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
}

.wiki-header-text { flex: 1; }

.wiki-header-id {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.12em;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.wiki-type-badge {
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  padding: 2px 8px;
  border-radius: 20px;
  border: 1px solid currentColor;
  opacity: 0.9;
}
.wiki-type-badge--movement { color: #3b82f6; background: rgba(59,130,246,0.12); }
.wiki-type-badge--pvp      { color: #ef4444; background: rgba(239,68,68,0.12); }
.wiki-type-badge--team     { color: #22c55e; background: rgba(34,197,94,0.12); }

.wiki-title {
  font-size: 2.2rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 6px;
  color: var(--game-color, var(--accent));
}

.wiki-tagline {
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.5;
}

/* Table of contents — sticky bar of section jump links */
.wiki-toc {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px;
  margin-bottom: 24px;
  position: sticky;
  top: 70px;
  z-index: 30;
  backdrop-filter: blur(8px);
}

.wiki-toc a {
  padding: 7px 14px;
  font-size: 0.85rem;
  color: var(--text-muted);
  border-radius: 6px;
  transition: color 0.15s, background 0.15s;
  position: relative;
  z-index: 1;
}

.wiki-toc a:hover {
  background: var(--bg-card-hover);
  color: var(--text);
}

.wiki-toc a.is-active {
  color: var(--accent);
}

.wiki-toc-indicator {
  position: absolute;
  bottom: 4px;
  left: 0;
  width: 0;
  height: 3px;
  background: var(--accent);
  border-radius: 999px;
  pointer-events: none;
  opacity: 0;
  transition:
    left 0.32s cubic-bezier(0.22, 1, 0.36, 1),
    width 0.32s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.18s ease;
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.45);
}
.wiki-toc-indicator.is-active { opacity: 1; }

/* Wiki sections */
.wiki-section {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 22px 26px;
  margin-bottom: 16px;
  scroll-margin-top: 130px;
  overflow: hidden;
}

/* (bar defined above on .wiki-header::before, .wiki-section::before) */

.wiki-section h2 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.wiki-section h2 i {
  color: var(--accent);
  font-size: 1rem;
}

.wiki-section p {
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.7;
}

.wiki-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.wiki-list li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 14px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 7px;
  font-size: 0.9rem;
  color: var(--text);
  line-height: 1.5;
}

.wiki-list li i {
  color: var(--accent);
  font-size: 0.78rem;
  margin-top: 4px;
  flex-shrink: 0;
}

.wiki-empty {
  color: var(--text-muted);
  font-size: 0.88rem;
  font-style: italic;
}

/* Top single-event scores list (game wiki) */
.wiki-top-scores {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.wiki-top-score-row {
  display: grid;
  grid-template-columns: 50px 1fr auto auto;
  align-items: center;
  gap: 14px;
  padding: 10px 14px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 10px;
  transition: border-color 0.15s, transform 0.15s;
}
.wiki-top-score-row:hover {
  border-color: var(--game-color, var(--accent));
  transform: translateX(2px);
}
.wiki-top-score-rank {
  font-family: 'Archivo Black', Arial, sans-serif;
  font-size: 0.95rem;
  color: var(--text-muted);
  text-align: center;
}
.wiki-top-score-rank--gold   { color: #fbbf24; text-shadow: 0 0 12px rgba(251,191,36,0.4); }
.wiki-top-score-rank--silver { color: #d1d5db; text-shadow: 0 0 12px rgba(209,213,219,0.3); }
.wiki-top-score-rank--bronze { color: #d97706; text-shadow: 0 0 12px rgba(217,119,6,0.3); }
.wiki-top-score-player {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
  min-width: 0;
}
.wiki-top-score-player .mc-head { border-radius: 4px; }
.wiki-top-score-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color 0.15s;
}
.wiki-top-score-player:hover .wiki-top-score-name {
  color: var(--game-color, var(--accent));
}
.wiki-top-score-event {
  font-size: 0.82rem;
  color: var(--text-muted);
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.15s;
}
.wiki-top-score-event:hover { color: var(--game-color, var(--accent)); }
.wiki-top-score-coins {
  font-family: 'Archivo Black', Arial, sans-serif;
  font-size: 1rem;
  color: var(--text);
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

@media (max-width: 600px) {
  .wiki-top-score-row { grid-template-columns: 38px 1fr auto; padding: 9px 12px; gap: 10px; }
  .wiki-top-score-event { display: none; }
}

.wiki-appearances {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 10px;
}

.wiki-appearance-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  transition: transform 0.15s, border-color 0.15s;
}
.wiki-appearance-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
}

.wiki-appearance-name {
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
  font-size: 0.92rem;
}

.wiki-appearance-meta {
  display: flex;
  gap: 12px;
  font-size: 0.78rem;
  color: var(--text-muted);
  flex-wrap: wrap;
}
.wiki-appearance-meta span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* ===== ADMIN WIKI EDITOR ===== */
.game-type-btns {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.game-type-btn {
  padding: 5px 14px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.game-type-btn.active,
.game-type-btn:hover { border-color: currentColor; opacity: 1; }
.game-type-btn--movement { color: #3b82f6; }
.game-type-btn--movement.active { background: rgba(59,130,246,0.15); }
.game-type-btn--pvp { color: #ef4444; }
.game-type-btn--pvp.active { background: rgba(239,68,68,0.15); }
.game-type-btn--team { color: #22c55e; }
.game-type-btn--team.active { background: rgba(34,197,94,0.15); }

.wiki-edit-row {
  margin-bottom: 16px;
}

.wiki-edit-row label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

.wiki-edit-row textarea {
  width: 100%;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 14px;
  border-radius: 7px;
  font-size: 0.9rem;
  font-family: inherit;
  line-height: 1.5;
  resize: vertical;
}

.wiki-edit-row textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.15);
}

@media (max-width: 768px) {
  .wiki-header-top {
    flex-direction: column;
    text-align: center;
    padding: 22px 18px;
  }
  .wiki-header-icon { width: 64px; height: 64px; font-size: 2rem; }
  .wiki-title { font-size: 1.6rem; }
  .wiki-toc { top: 60px; }
  .wiki-section { padding: 16px 18px; }
  .wiki-header-banner { height: 160px; }
}

/* ===== GLOBAL PLAYER LEADERBOARD ===== */
.lb-row-player-global {
  display: grid;
  grid-template-columns: 80px 1fr 90px 90px 110px;
  gap: 16px;
  padding: 14px 22px;
  align-items: center;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
  color: var(--text);
}
.lb-row-player-global:last-child { border-bottom: none; }
.lb-row-player-global:hover {
  background: var(--bg-card-hover);
}

.lb-rank-gold {
  color: #fbbf24;
  text-shadow: 0 0 12px rgba(251, 191, 36, 0.4);
}
.lb-rank-silver {
  color: #d1d5db;
  text-shadow: 0 0 12px rgba(209, 213, 219, 0.3);
}
.lb-rank-bronze {
  color: #d97706;
  text-shadow: 0 0 12px rgba(217, 119, 6, 0.3);
}

@media (max-width: 768px) {
  .lb-row-player-global { grid-template-columns: 50px 1fr 70px; }
  .lb-row-player-global > :nth-child(3),
  .lb-row-player-global > :nth-child(4) { display: none; }
}

/* ===== ADMIN: PLAIN ICON PREVIEW (for games — no background) ===== */
.team-upload-preview--plain {
  background: none !important;
  color: var(--text);
}

/* ===== WIKI BANNER (after description) ===== */
/* (wiki-banner replaced by .wiki-header-banner inside .wiki-header) */

/* ===== MAP CARD GRID (wiki page) ===== */
.map-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}

.map-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  transition: transform 0.2s, border-color 0.2s;
}

.map-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
}

.map-card-image {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.map-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.map-card-placeholder {
  color: var(--text-dim);
  font-size: 2rem;
  opacity: 0.4;
}

.map-card-body { padding: 12px 14px; }

.map-card-body h3 {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 4px;
  color: var(--text);
}

.map-card-body p {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin: 0;
}

/* ===== ADMIN: BANNER UPLOAD ===== */
.banner-edit-block {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.banner-preview {
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: 280px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.banner-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.banner-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: var(--text-dim);
  font-size: 0.85rem;
}

.banner-placeholder i { font-size: 2rem; opacity: 0.5; }

.banner-controls {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.img-url-row {
  display: flex;
  gap: 6px;
  align-items: center;
  width: 100%;
}

.img-url-input {
  flex: 1;
  min-width: 0;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 0.82rem;
  font-family: inherit;
}
.img-url-input::placeholder { color: var(--text-muted); }
.img-url-input:focus { outline: none; border-color: var(--accent); }

/* ===== ADMIN: MAP EDITOR ===== */
.maps-editor {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.map-admin-row {
  display: grid;
  grid-template-columns: 140px 1fr auto;
  gap: 12px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  align-items: stretch;
}

.map-admin-image {
  position: relative;
  width: 140px;
  aspect-ratio: 16 / 9;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 7px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.map-admin-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.map-admin-placeholder {
  color: var(--text-dim);
  font-size: 1.5rem;
  opacity: 0.4;
}

.map-img-upload {
  position: absolute;
  bottom: 4px;
  right: 4px;
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.15);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 0.78rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}
.map-img-upload:hover { background: rgba(0, 0, 0, 0.85); }

.map-admin-fields {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.map-admin-fields input,
.map-admin-fields textarea {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 12px;
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.88rem;
}
.map-admin-fields input:focus,
.map-admin-fields textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.15);
}
.map-admin-fields textarea {
  resize: vertical;
  font-size: 0.82rem;
  line-height: 1.5;
}

.map-admin-actions {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.admin-id-badge {
  font-family: 'Courier New', monospace;
  font-size: 0.7rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 2px 8px;
  border-radius: 4px;
  margin-left: 6px;
  vertical-align: middle;
}

@media (max-width: 768px) {
  .map-admin-row { grid-template-columns: 1fr; }
  .map-admin-image { width: 100%; }
  .map-admin-actions { flex-direction: row; justify-content: flex-end; }
}

/* ===== ADMIN: EVENT IMAGE PREVIEWS ===== */
.event-img-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 8px;
}

.event-img-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.event-img-block label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
}

.banner-preview--small {
  aspect-ratio: 16 / 9;
  max-height: 160px;
}

@media (max-width: 768px) {
  .event-img-row { grid-template-columns: 1fr; }
}

/* ── Custom Select ─────────────────────────────────────────── */
.csel-wrap {
  position: relative;
  display: inline-flex;
  width: 100%;
}
.csel-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 14px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.11);
  border-radius: 10px;
  color: var(--text);
  font-family: 'Nunito', Arial, sans-serif;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.18s, border-color 0.18s, box-shadow 0.18s;
  text-align: left;
  outline: none;
  white-space: nowrap;
  overflow: hidden;
}
.csel-btn:hover {
  background: rgba(255,255,255,0.09);
  border-color: rgba(255,255,255,0.2);
}
.csel-btn:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(245,158,11,0.18);
}
.csel-label {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
}
.csel-chevron {
  flex-shrink: 0;
  font-size: 0.72rem;
  color: var(--text-muted);
  transition: transform 0.28s cubic-bezier(0.22,1,0.36,1);
}
.csel-wrap.open .csel-chevron {
  transform: rotate(180deg);
}
.csel-list {
  position: fixed; /* portalled to body — escapes any overflow/stacking context */
  background: #0e1628;
  border: 1px solid rgba(255,255,255,0.13);
  border-radius: 12px;
  overflow: hidden;
  z-index: 99999;
  max-height: 300px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 56px rgba(0,0,0,0.55), 0 0 0 1px rgba(255,255,255,0.04) inset;
  visibility: hidden;
  opacity: 0;
  transform: translateY(-6px) scale(0.97);
  transform-origin: top center;
  pointer-events: none;
  transition: opacity 0.16s, transform 0.22s cubic-bezier(0.22,1,0.36,1), visibility 0s 0.22s;
}
.csel-list.csel-open {
  visibility: visible;
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
  transition: opacity 0.16s, transform 0.22s cubic-bezier(0.22,1,0.36,1);
}
.csel-search {
  flex-shrink: 0;
  width: 100%;
  padding: 8px 12px;
  background: transparent;
  border: none;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  color: var(--text);
  font-size: 0.85rem;
  font-family: 'Nunito', Arial, sans-serif;
  outline: none;
}
.csel-search::placeholder { color: var(--text-muted); }
.csel-search:focus { background: rgba(255,255,255,0.04); }
.csel-options {
  overflow-y: auto;
  padding: 4px;
  flex: 1;
}
.csel-options::-webkit-scrollbar { width: 4px; }
.csel-options::-webkit-scrollbar-track { background: transparent; }
.csel-options::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.14); border-radius: 4px; }
.csel-option {
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.88rem;
  color: var(--text);
  transition: background 0.12s, color 0.12s;
  display: flex;
  align-items: center;
  gap: 8px;
  user-select: none;
}
.csel-option:hover { background: rgba(255,255,255,0.07); }
.csel-option.csel-selected {
  color: var(--accent);
  font-weight: 700;
}
.csel-option.csel-selected::before {
  content: '✓';
  font-size: 0.72rem;
  color: var(--accent);
  flex-shrink: 0;
}
select.csel-native { display: none !important; }

/* UUID badge */
.uuid-badge {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-family: 'Courier New', monospace;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 5px;
  padding: 2px 6px;
  cursor: default;
}
.uuid-cell { font-size: 0.78rem; color: var(--text-muted); }

/* ── Individual Leaderboard Filter ─────────────────────────── */
.lb-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}
.lb-filter-btn {
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.15);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  transition: all 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.lb-filter-btn:hover { background: rgba(255,255,255,0.07); color: var(--text); }
.lb-filter-btn.active { background: var(--accent); color: #0f172a; border-color: var(--accent); }

/* ── Dodgebolt Finale ───────────────────────────────────────── */
.dodgebolt-card {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,215,0,0.18);
  border-radius: 14px;
  padding: 28px 24px 22px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}
.dodgebolt-matchup {
  display: flex;
  align-items: center;
  gap: 32px;
  width: 100%;
  flex-wrap: wrap;
  justify-content: center;
}
.dodgebolt-team {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 140px;
}
.dodgebolt-team-name {
  font-size: 1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
  text-align: center;
}
.dodgebolt-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  color: #fff;
  flex-shrink: 0;
}
.dodgebolt-rounds {
  display: flex;
  gap: 6px;
  align-items: center;
}
.db-round-icon {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.db-round-icon img { width: 100%; height: 100%; object-fit: contain; }
.db-round-icon.db-win { color: var(--accent); font-size: 1.1rem; }
.db-round-icon.db-loss { color: rgba(255,255,255,0.2); font-size: 1.1rem; }
.dodgebolt-score {
  font-size: 2.4rem;
  font-weight: 900;
  line-height: 1;
}
.dodgebolt-vs {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-muted);
  padding: 0 4px;
}
.dodgebolt-winner {
  font-size: 1rem;
  font-weight: 700;
  color: var(--accent);
  text-align: center;
}

/* ── Dodgebolt admin section ────────────────────────────────── */
.dodgebolt-admin-section {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid rgba(255,255,255,0.08);
}

/* ── Events admin grid ──────────────────────────────────────── */
.events-admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 14px;
}
.event-admin-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}
.event-admin-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: rgba(255,255,255,0.04);
  border-bottom: 1px solid var(--border);
  gap: 8px;
}
.event-admin-card-header h4 {
  font-size: 0.9rem;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.event-admin-card-body {
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.event-card-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.event-card-fields input,
.event-admin-card-body textarea {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 5px 8px;
  color: var(--text);
  font-family: inherit;
  font-size: 0.82rem;
  width: 100%;
}
.event-card-fields input[type="date"] { color-scheme: dark; }
.event-admin-card-body textarea { resize: vertical; min-height: 50px; grid-column: 1/-1; }
.event-card-checks { display: flex; gap: 14px; flex-wrap: wrap; }
.event-card-checks .checkbox-row { font-size: 0.8rem; }
.games-checklist-compact {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
}
.games-checklist-compact .checkbox-row { font-size: 0.77rem; color: var(--text-muted); }

/* Ordered games editor (admin → events) */
.games-order-editor {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.games-order-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 2px;
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--text-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.games-order-title i { color: var(--accent); font-size: 0.78rem; }
.games-order-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.games-order-row {
  display: grid;
  grid-template-columns: 28px 28px 1fr auto auto auto;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
}
.games-order-num {
  font-family: 'Archivo Black', sans-serif;
  color: var(--accent);
  font-size: 0.85rem;
  text-align: center;
}
.games-order-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  color: var(--text);
}
.games-order-icon img {
  width: 22px;
  height: 22px;
  object-fit: contain;
  image-rendering: pixelated;
}
.games-order-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.games-order-row .icon-btn { width: 28px; height: 28px; }
.games-order-row .icon-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}
.games-order-add {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}
.games-order-add select { flex: 1; }

@media (max-width: 600px) { .events-admin-grid { grid-template-columns: 1fr; } }

/* ── Predicted tab ──────────────────────────────────────────── */
.predicted-hint {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 16px;
  line-height: 1.5;
}
.pred-cell {
  font-size: 0.88rem;
  color: rgba(255,255,255,0.45);
  font-style: italic;
}
.pred-tilde {
  font-size: 0.72rem;
  color: rgba(255,255,255,0.35);
  margin-left: 3px;
  font-style: italic;
  vertical-align: middle;
}


/* ── Predicted tab bars ─────────────────────────────────────── */
.pred-bars-section { display: flex; flex-direction: column; }
.pred-bar-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 9px 0;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}
.pred-bar-row:last-child { border-bottom: none; }
.pred-bar-rank {
  width: 32px;
  text-align: right;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-muted);
  flex-shrink: 0;
}
.pred-bar-identity {
  width: 155px;
  flex-shrink: 0;
}
.pred-bar-name {
  display: flex;
  align-items: center;
  gap: 7px;
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--text);
  text-decoration: none;
}
.pred-bar-name:hover { color: var(--accent); }
.pred-bar-team {
  font-size: 0.74rem;
  font-weight: 500;
  margin-top: 2px;
  padding-left: 2px;
}
.pred-bar-charts { flex: 1; display: flex; flex-direction: column; gap: 5px; }
.pred-bar-line { display: flex; align-items: center; gap: 8px; }
.pred-bar-lbl {
  width: 44px;
  font-size: 0.67rem;
  color: var(--text-muted);
  text-align: left;
  flex-shrink: 0;
  font-style: italic;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding-left: 2px;
}
.pred-bar-track {
  flex: 1;
  height: 9px;
  background: rgba(255,255,255,0.06);
  border-radius: 5px;
  overflow: hidden;
}
.pred-bar-fill {
  height: 100%;
  border-radius: 5px;
  transition: width 0.55s cubic-bezier(0.22, 1, 0.36, 1);
  min-width: 2px;
}
.pred-bar-val {
  width: 52px;
  text-align: right;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  flex-shrink: 0;
}

/* ── Dodgebolt wins stepper ─────────────────────────────────── */
.db-stepper {
  display: inline-flex;
  align-items: center;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.11);
  border-radius: 8px;
  overflow: hidden;
}
.db-step-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  width: 30px;
  height: 34px;
  cursor: pointer;
  font-size: 1.05rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
  font-family: inherit;
}
.db-step-btn:hover { background: rgba(255,255,255,0.09); color: var(--text); }
.db-step-val {
  min-width: 28px;
  text-align: center;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text);
  padding: 0 4px;
  border-left: 1px solid rgba(255,255,255,0.08);
  border-right: 1px solid rgba(255,255,255,0.08);
  line-height: 34px;
  user-select: none;
}
/* ===== PLAYER PROFILE — UNIFIED BOX ===== */
.player-profile-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  margin-bottom: 10px;
}

.profile-top {
  display: flex;
  min-height: 420px;
}

.player-skin-wrap {
  width: 220px;
  flex-shrink: 0;
  background: var(--bg-secondary);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  overflow: hidden;
}

.player-skin-img {
  width: 100%;
  display: block;
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
}

.profile-main {
  flex: 1;
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.profile-history-divider { display: none; }

.profile-history-section {
  padding: 24px 28px;
}

.profile-history-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.profile-history-title i { color: var(--accent); }

.profile-stats-grid {
  margin: 0 !important;
}

@media (max-width: 640px) {
  .profile-top { flex-direction: column; }
  .player-skin-wrap { width: 100%; height: 220px; align-items: center; }
  .player-skin-img { width: auto; height: 100%; }
}

/* ===== PLAYERS LIST (pill-filtered) ===== */
.players-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.player-card-row {
  display: grid;
  grid-template-columns: 56px 44px 1fr auto;
  align-items: center;
  gap: 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 18px;
  transition: transform 0.18s, border-color 0.18s;
}
.player-card-row:hover {
  transform: translateX(3px);
  border-color: var(--accent);
}

.player-card-score {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  text-align: right;
  display: flex;
  align-items: center;
  gap: 5px;
  justify-content: flex-end;
  white-space: nowrap;
}

/* ===== RADAR ANIMATION ===== */
@keyframes radarExpand {
  from { transform: scale(0); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}

.radar-data {
  transform-box: view-box;
  transform-origin: 50% 50%;
  animation: radarExpand 0.9s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.radar-data-dot {
  transform-box: fill-box;
  transform-origin: 50% 50%;
  animation: radarExpand 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) 0.5s both;
}

/* Radar game markers — clickable */
.radar-game-marker {
  pointer-events: auto;
  cursor: pointer;
}
.radar-game-marker:hover .radar-game-icon-plain,
.radar-game-marker:hover .radar-game-label {
  opacity: 0.75;
}
.radar-game-marker.active-game .radar-game-icon-plain {
  filter: drop-shadow(0 0 8px var(--accent));
}
.radar-game-marker.active-game .radar-game-value {
  color: var(--accent-hover);
}

/* ===== GAME SCORE HISTORY PANEL ===== */
.game-score-history-panel {
  background: var(--bg-card);
  border: 1px solid var(--accent);
  border-radius: 14px;
  overflow: hidden;
  animation: cardAppear 0.22s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.game-score-history-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-secondary);
}
.game-score-history-header h3 {
  flex: 1;
  font-size: 1rem;
  font-weight: 700;
}
.game-score-history-header .game-score-history-icon {
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; color: var(--text-muted);
}

.game-score-history-list {
  display: flex;
  flex-direction: column;
}

.game-score-history-row {
  display: grid;
  grid-template-columns: 56px 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 12px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  transition: background 0.15s;
}
.game-score-history-row:last-child { border-bottom: none; }
.game-score-history-row:hover { background: rgba(255,255,255,0.03); }

.game-score-history-event {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 0.9rem;
  font-weight: 600;
}

.game-score-history-coins {
  font-size: 1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 5px;
}

/* ===== LEADERBOARD PAGINATION ===== */
.lb-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 18px 0 4px;
}

.lb-page-btn {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text);
  width: 38px;
  height: 38px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  transition: border-color 0.18s, background 0.18s;
}
.lb-page-btn:hover:not(:disabled) {
  border-color: var(--accent);
  background: rgba(245,158,11,0.1);
}
.lb-page-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

.lb-page-info {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 600;
}

/* ===== PLAYER PROFILE — REDESIGN ===== */
.profile-hero {
  display: grid;
  grid-template-columns: 260px 1fr;
  background: linear-gradient(135deg, var(--bg-card) 0%, var(--bg-secondary) 100%);
  border: 1px solid var(--border);
  border-radius: 18px;
  overflow: hidden;
  margin-bottom: 18px;
  position: relative;
}
.profile-hero::before {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 65%; height: 100%;
  background: radial-gradient(ellipse at top right, rgba(245,158,11,0.10), transparent 65%);
  pointer-events: none;
}
.profile-hero::after {
  content: '';
  position: absolute;
  left: 0; bottom: 0;
  width: 4px; height: 100%;
  background: linear-gradient(180deg, var(--accent), transparent);
}
.profile-skin-col {
  background: linear-gradient(180deg, rgba(245,158,11,0.06) 0%, transparent 60%);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-top: 16px;
  border-right: 1px solid var(--border);
  position: relative;
  z-index: 1;
}
.profile-skin-img {
  width: 100%;
  max-width: 220px;
  display: block;
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
  filter: drop-shadow(0 18px 18px rgba(0,0,0,0.45));
}
.profile-info-col {
  padding: 36px 36px 30px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: relative;
  z-index: 1;
  justify-content: center;
}
.profile-eyebrow {
  font-size: 0.72rem;
  letter-spacing: 0.22em;
  color: var(--accent);
  font-weight: 700;
  text-transform: uppercase;
}
.profile-name {
  font-size: 2.6rem;
  font-weight: 900;
  line-height: 1;
  margin: 0;
  font-family: 'Archivo Black', Arial, sans-serif;
}
.profile-tagline {
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* ===== PROFILE STAT GRID ===== */
.pf-stat-grid {
  display: grid;
  gap: 12px;
  margin-bottom: 14px;
}
.pf-stat-grid--primary {
  grid-template-columns: repeat(4, 1fr);
}
.pf-stat-grid--small {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  margin-bottom: 22px;
}
.pf-stat {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  transition: border-color 0.2s ease, transform 0.2s ease, background 0.2s ease;
  position: relative;
  overflow: hidden;
}
.pf-stat::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 3px; height: 100%;
  background: var(--accent);
  opacity: 0;
  transition: opacity 0.2s ease;
}
.pf-stat:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  background: var(--bg-card-hover);
}
.pf-stat:hover::before { opacity: 1; }
.pf-stat-icon {
  width: 44px;
  height: 44px;
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(245, 158, 11, 0.10);
  color: var(--accent);
  font-size: 1.15rem;
  flex-shrink: 0;
  border: 1px solid rgba(245, 158, 11, 0.18);
}
.pf-stat-body { flex: 1; min-width: 0; }
.pf-stat-value {
  font-size: 1.45rem;
  font-weight: 800;
  line-height: 1.1;
  color: var(--text);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.pf-stat-value .stat-icon { width: 1em; height: 1em; }
.pf-stat-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-top: 4px;
  font-weight: 700;
}
.pf-stat--primary .pf-stat-value { font-size: 1.7rem; }
.pf-stat--primary .pf-stat-icon { width: 50px; height: 50px; font-size: 1.3rem; }

/* ===== PROFILE SECTIONS ===== */
.profile-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 24px 26px;
  margin-bottom: 16px;
}
.profile-section--radar { padding-bottom: 16px; }
.profile-section--radar .radar-wrapper {
  background: transparent;
  border: none;
  padding: 30px 10px 10px;
  margin-top: 4px;
}
.profile-section-title {
  font-size: 1.05rem;
  font-weight: 800;
  margin: 0 0 4px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
}
.profile-section-title i { color: var(--accent); }
.profile-section-subtitle {
  color: var(--text-muted);
  font-size: 0.84rem;
  margin: 0 0 14px;
}

/* ===== HISTORY BANNER CARDS ===== */
.history-banner-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.history-banner-card {
  display: grid;
  grid-template-columns: 220px 1fr;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  transition: border-color 0.22s ease, transform 0.22s ease, box-shadow 0.22s ease;
  text-decoration: none;
  color: inherit;
  position: relative;
  min-height: 132px;
}
.history-banner-card::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
  background: var(--team-color, var(--accent));
  z-index: 2;
}
.history-banner-card:hover {
  border-color: var(--team-color, var(--accent));
  transform: translateY(-2px);
  box-shadow: 0 14px 32px -16px rgba(0,0,0,0.65);
}
.hbc-image {
  background-image: var(--banner-image);
  background-size: cover;
  background-position: center;
  position: relative;
}
.hbc-image::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 35%, var(--bg-secondary) 100%);
}
.hbc-body {
  padding: 16px 22px 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
}
.hbc-top { display: flex; align-items: flex-start; gap: 16px; }
.hbc-rank {
  font-size: 1.85rem;
  font-weight: 900;
  color: var(--accent);
  min-width: 56px;
  line-height: 1;
  font-family: 'Archivo Black', Arial, sans-serif;
}
.hbc-rank.rank-gold   { color: #fbbf24; text-shadow: 0 0 18px rgba(251, 191, 36, 0.55); }
.hbc-rank.rank-silver { color: #cbd5e1; text-shadow: 0 0 18px rgba(203, 213, 225, 0.45); }
.hbc-rank.rank-bronze { color: #d97706; text-shadow: 0 0 18px rgba(217, 119, 6, 0.5); }
.hbc-name-block { flex: 1; min-width: 0; }
.hbc-name {
  font-size: 1.1rem;
  font-weight: 800;
  line-height: 1.2;
  margin: 0 0 6px;
  color: var(--text);
}
.hbc-meta {
  display: flex;
  gap: 14px;
  font-size: 0.82rem;
  color: var(--text-muted);
  flex-wrap: wrap;
  align-items: center;
}
.hbc-meta span { display: inline-flex; align-items: center; gap: 5px; }
.hbc-meta .dim { opacity: 0.7; }
.hbc-team {
  font-weight: 700;
  color: var(--team-color, var(--text-muted)) !important;
}
.hbc-stats {
  display: flex;
  gap: 22px;
  align-items: flex-end;
  flex-wrap: wrap;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}
.hbc-stat-cell { display: flex; flex-direction: column; gap: 2px; }
.hbc-team-place {
  margin-left: auto;
  align-items: flex-end;
  text-align: right;
}
.hbc-team-place .hbc-stat-num {
  color: #fff;
  font-size: 1.1rem;
}
.hbc-team-place-of {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.78rem;
  margin-left: 2px;
}
.hbc-stat-num {
  font-size: 1rem;
  font-weight: 800;
  color: var(--text);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}
.hbc-stat-num .stat-icon { width: 1em; height: 1em; }

/* Teammates row inside a history banner card */
.hbc-teammates { flex: 1; min-width: 0; }
.hbc-teammates-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  white-space: normal;
  font-weight: 600;
  font-size: 0.85rem;
}
.hbc-teammate {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px 2px 2px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
  text-decoration: none;
}
.hbc-teammate:hover {
  background: rgba(245, 158, 11, 0.18);
  border-color: var(--accent);
  transform: translateY(-1px);
}
.hbc-teammate:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.hbc-teammate .mc-head {
  border-radius: 3px;
  flex-shrink: 0;
}
.hbc-teammate-name {
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
}
.hbc-stat-key {
  font-size: 0.68rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
}

@media (max-width: 720px) {
  .profile-hero { grid-template-columns: 1fr; }
  .profile-skin-col {
    height: 240px;
    padding: 20px 0 0;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .profile-skin-img { width: auto; max-width: none; height: 100%; }
  .profile-info-col { padding: 22px 22px 24px; }
  .profile-name { font-size: 2rem; }
  .pf-stat-grid--primary { grid-template-columns: repeat(2, 1fr); }
  .pf-stat-value { font-size: 1.25rem; }
  .pf-stat--primary .pf-stat-value { font-size: 1.4rem; }
  .history-banner-card { grid-template-columns: 1fr; min-height: 0; }
  .hbc-image { min-height: 130px; }
  .hbc-image::after { background: linear-gradient(180deg, transparent 30%, var(--bg-secondary) 100%); }
  .hbc-stats { gap: 14px; }
}

/* ===== PLAYER PROFILE — SHARE CARD ===== */
.share-card-section { padding: 22px 24px; }
.share-card-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.share-card-toolbar .profile-section-title { margin-bottom: 2px; }
.share-card-toolbar .profile-section-subtitle { margin: 0; }
.share-card-download {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.share-card-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 1200 / 520;
  overflow: hidden;
  border-radius: 20px;
  background: #0a0f1e;
}

/* Render-time loading overlay */
.sc-loader {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: rgba(10, 15, 30, 0.78);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  border-radius: 20px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.18s ease, visibility 0.18s ease;
}
.share-card-frame.is-rendering .sc-loader {
  opacity: 1;
  visibility: visible;
}
.sc-loader-bar {
  width: min(60%, 360px);
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  overflow: hidden;
  position: relative;
}
.sc-loader-fill {
  position: absolute;
  top: 0;
  left: -40%;
  width: 40%;
  height: 100%;
  background: linear-gradient(90deg,
    transparent 0%,
    rgba(245, 158, 11, 0.7) 35%,
    var(--accent) 50%,
    rgba(245, 158, 11, 0.7) 65%,
    transparent 100%);
  border-radius: 999px;
  animation: scLoaderSlide 1.15s cubic-bezier(0.4, 0, 0.6, 1) infinite;
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.4);
}
@keyframes scLoaderSlide {
  0%   { left: -40%; }
  100% { left: 100%; }
}
.sc-loader-text {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.share-card {
  width: 1200px;
  height: 520px;
  position: relative;
  font-family: 'Nunito', sans-serif;
  color: #f1f5f9;
  padding: 26px 32px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  border-radius: 20px;
  overflow: hidden;
  isolation: isolate;
  border: 3px solid var(--sc-tier-edge, #f59e0b);
  box-shadow: 0 0 60px -10px var(--sc-tier-glow-1, rgba(245,158,11,0.30));
  box-sizing: border-box;
}
.sc-bg {
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    /* fine noise dots */
    radial-gradient(circle at 12% 18%, rgba(255,255,255,0.07) 1px, transparent 2px),
    radial-gradient(circle at 24% 75%, rgba(255,255,255,0.05) 1px, transparent 2px),
    radial-gradient(circle at 67% 30%, rgba(255,255,255,0.07) 1px, transparent 2px),
    radial-gradient(circle at 88% 64%, rgba(255,255,255,0.06) 1px, transparent 2px),
    radial-gradient(circle at 50% 88%, rgba(255,255,255,0.05) 1px, transparent 2px),
    radial-gradient(circle at 36% 42%, rgba(255,255,255,0.06) 1px, transparent 2px),
    /* tier-color spotlights pulling in from the corners */
    radial-gradient(ellipse 75% 95% at 100% 0%, var(--sc-tier-glow-1, rgba(245,158,11,0.30)), transparent 65%),
    radial-gradient(ellipse 90% 100% at 0% 100%, var(--sc-tier-glow-2, rgba(245,158,11,0.18)), transparent 70%),
    radial-gradient(ellipse 40% 60% at 50% 50%, var(--sc-tier-haze, rgba(245,158,11,0.10)), transparent 70%),
    /* angled diagonal sheen */
    linear-gradient(135deg, #1a2547 0%, #0d1326 55%, #0a0f1e 100%);
}

/* Header */
.sc-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}
.sc-brand { display: flex; align-items: center; gap: 12px; }
.sc-brand-icon { font-size: 44px; line-height: 1; display: inline-flex; }
.sc-brand-icon img {
  width: 44px;
  height: 44px;
  object-fit: contain;
  image-rendering: -webkit-optimize-contrast;
}
.sc-brand-title {
  font-family: 'Archivo Black', sans-serif;
  font-size: 17px;
  letter-spacing: 0.06em;
  line-height: 1;
}
.sc-brand-sub {
  font-size: 11px;
  color: #94a3b8;
  letter-spacing: 0.22em;
  margin-top: 5px;
  font-weight: 700;
}

.sc-rank { display: flex; align-items: baseline; gap: 12px; }
.sc-rank-label {
  font-size: 11px;
  color: #94a3b8;
  letter-spacing: 0.22em;
  font-weight: 700;
}
.sc-rank-num {
  font-family: 'Archivo Black', sans-serif;
  font-size: 26px;
  color: #f59e0b;
  line-height: 1;
}

/* Body grid: info | games. Skin is absolute-positioned so its feet
   always align just above the CROWN-CHAMPIONSHIP.CC footer text. */
.sc-body {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 26px;
  flex: 1;
  min-height: 0;
  padding-left: 220px;
}
.sc-skin-col {
  position: absolute;
  left: 24px;
  bottom: 48px;
  width: 200px;
  display: flex;
  justify-content: center;
  pointer-events: none;
  z-index: 2;
}
.sc-skin {
  width: 200px;
  height: auto;
  max-height: 380px;
  object-fit: contain;
  object-position: bottom center;
  image-rendering: pixelated;
  filter: drop-shadow(0 14px 26px rgba(0,0,0,0.65));
  display: block;
}

/* Info column (middle) */
.sc-info-col {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}
.sc-tier {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px;
  border: 1px solid var(--tier-color);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.18em;
  color: var(--tier-color);
  background: var(--tier-bg, rgba(255,255,255,0.05));
  align-self: flex-start;
  line-height: 1;
}
.sc-tier i { font-size: 13px; }

/* Share-card badges — same color treatment as the website's .player-badge,
   but using inline-computed rgba (html2canvas can't parse color-mix). */
.sc-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-self: flex-start;
  max-width: 100%;
}
.sc-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  color: var(--badge-color);
  background: var(--badge-bg);
  border: 1px solid var(--badge-border);
  white-space: nowrap;
}
.sc-badge i { font-size: 11px; }

.sc-name-row {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}
.sc-name-head {
  width: 60px;
  height: 60px;
  border-radius: 8px;
  image-rendering: pixelated;
  flex-shrink: 0;
  box-shadow: 0 4px 14px rgba(0,0,0,0.5);
}
.sc-name {
  font-family: 'Archivo Black', sans-serif;
  font-size: 52px;
  line-height: 1;
  margin: 0;
  color: #fff;
  text-shadow: 0 3px 6px rgba(0, 0, 0, 0.55);
  letter-spacing: -0.01em;
  word-break: break-word;
  max-height: 104px;
  overflow: hidden;
  min-width: 0;
}
.sc-meta {
  display: flex;
  gap: 10px;
  font-size: 12px;
  color: #94a3b8;
  letter-spacing: 0.18em;
  font-weight: 700;
  align-items: center;
}
.sc-meta-dot { color: #475569; }
.sc-meta::before {
  content: '';
  display: inline-block;
  width: 26px; height: 2px;
  background: #f59e0b;
  margin-right: 6px;
}
.sc-stats {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 4px;
}
.sc-stat {
  display: grid;
  grid-template-columns: 24px 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 7px 0;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  font-size: 14px;
}
.sc-stat:last-child { border-bottom: none; }
.sc-stat i { color: #f59e0b; font-size: 14px; text-align: center; }
.sc-stat-name { color: #f1f5f9; font-weight: 600; }
.sc-stat-val {
  font-family: 'Archivo Black', sans-serif;
  font-size: 16px;
  color: #fff;
  text-align: right;
}

/* Games column (right) */
.sc-games-col {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.sc-games-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  letter-spacing: 0.22em;
  color: #94a3b8;
  font-weight: 800;
  margin-bottom: 4px;
}
.sc-games-label i { color: #f59e0b; font-size: 9px; }
.sc-game {
  display: grid;
  grid-template-columns: 26px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 7px 12px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.07);
  border-left: 3px solid var(--g-color, #f59e0b);
  border-radius: 8px;
  min-height: 38px;
}
.sc-game-icon {
  width: 22px; height: 22px;
  display: flex; align-items: center; justify-content: center;
}
.sc-game-icon img,
.sc-game-icon i {
  width: 100%; height: 100%;
  font-size: 18px;
  image-rendering: pixelated;
  object-fit: contain;
  display: block;
}
.sc-game-icon i { display: inline-flex; align-items: center; justify-content: center; }
.sc-game-info { display: flex; flex-direction: column; min-width: 0; }
.sc-game-name {
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #fff;
}
.sc-game-key {
  font-size: 9px;
  color: #94a3b8;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  margin-top: 1px;
  font-weight: 700;
}
.sc-game-val {
  font-family: 'Archivo Black', sans-serif;
  font-size: 16px;
  color: var(--g-color, #f59e0b);
  line-height: 1;
}

/* Footer */
.sc-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  letter-spacing: 0.22em;
  color: #94a3b8;
  font-weight: 700;
}
.sc-footer-brand { color: #3b82f6; }
.sc-footer-rank {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
}
.sc-footer-rank strong {
  font-family: 'Archivo Black', sans-serif;
  font-size: 14px;
  color: #f59e0b;
  letter-spacing: 0;
}

/* ===== LEADERBOARD MODE TOGGLE ===== */
.lb-mode-toggle {
  display: inline-flex;
  align-items: center;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px;
  margin: 0 0 18px;
  gap: 2px;
}
.lb-mode-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 8px 18px;
  font-family: 'Nunito', Arial, sans-serif;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  cursor: pointer;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: background 0.18s, color 0.18s;
}
.lb-mode-btn i { font-size: 0.85rem; }
.lb-mode-btn:hover { color: var(--text); }
.lb-mode-btn.active {
  background: var(--accent);
  color: #0f172a;
  box-shadow: 0 0 14px -2px rgba(245, 158, 11, 0.45);
}

/* ===== TIER LEADERBOARD (Bar Score) ===== */
.bar-score-intro {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 12px;
  padding: 14px 18px;
  margin-bottom: 22px;
}
.bar-score-intro-title {
  font-family: 'Archivo Black', Arial, sans-serif;
  font-size: 0.95rem;
  letter-spacing: 0.04em;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.bar-score-intro-title i { color: var(--accent); font-size: 0.85rem; }
.bar-score-intro p {
  margin: 0;
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--text-muted);
}

.tier-section {
  margin-bottom: 18px;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--bg-card);
  transition: border-color 0.25s, box-shadow 0.25s;
}
.tier-section:hover {
  border-color: color-mix(in srgb, var(--tier-color) 55%, var(--border));
  box-shadow: 0 0 22px -6px color-mix(in srgb, var(--tier-color) 50%, transparent);
}

.tier-header {
  display: grid;
  grid-template-columns: 78px 1fr;
  gap: 14px;
  align-items: center;
  padding: 14px 20px;
  background: linear-gradient(
    90deg,
    color-mix(in srgb, var(--tier-color) 24%, transparent) 0%,
    color-mix(in srgb, var(--tier-color) 4%, transparent) 100%
  );
  border-bottom: 1px solid color-mix(in srgb, var(--tier-color) 30%, var(--border));
}

.tier-letter {
  font-family: 'Archivo Black', Arial, sans-serif;
  font-size: 2.1rem;
  line-height: 1;
  text-align: center;
  color: var(--tier-color);
  text-shadow: 0 0 18px color-mix(in srgb, var(--tier-color) 65%, transparent);
  letter-spacing: 0.02em;
}

.tier-name {
  font-family: 'Archivo Black', Arial, sans-serif;
  font-size: 1.05rem;
  letter-spacing: 0.06em;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.tier-threshold {
  font-family: 'Nunito', Arial, sans-serif;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: var(--tier-color);
  background: color-mix(in srgb, var(--tier-color) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--tier-color) 35%, transparent);
  padding: 2px 8px;
  border-radius: 999px;
  white-space: nowrap;
  line-height: 1.4;
}
.tier-meta {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 3px;
}

.tier-rows {
  display: flex;
  flex-direction: column;
}

.tier-row {
  display: grid;
  grid-template-columns: 56px 44px 1fr auto auto;
  align-items: center;
  gap: 14px;
  padding: 11px 20px;
  text-decoration: none;
  color: var(--text);
  background: var(--bg-card);
  border-bottom: 1px solid rgba(255,255,255,0.04);
  transition: background 0.15s, transform 0.15s;
}
.tier-row:last-child { border-bottom: none; }
.tier-row:hover {
  background: color-mix(in srgb, var(--tier-color) 9%, var(--bg-card));
  transform: translateX(3px);
}

.tier-rank {
  font-family: 'Archivo Black', Arial, sans-serif;
  font-size: 0.95rem;
  color: var(--text-muted);
  text-align: center;
}
.tier-rank--gold   { color: #fbbf24; text-shadow: 0 0 12px rgba(251,191,36,0.4); }
.tier-rank--silver { color: #d1d5db; text-shadow: 0 0 12px rgba(209,213,219,0.3); }
.tier-rank--bronze { color: #d97706; text-shadow: 0 0 12px rgba(217,119,6,0.3); }

.tier-row .mc-head {
  border-radius: 4px;
}

.tier-row-name {
  font-size: 1rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tier-row-events {
  font-size: 0.78rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.tier-row-score {
  font-family: 'Archivo Black', Arial, sans-serif;
  font-size: 1.15rem;
  color: var(--tier-color);
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  white-space: nowrap;
  min-width: 92px;
  justify-content: flex-end;
}
.tier-row-score-label {
  font-family: 'Nunito', Arial, sans-serif;
  font-size: 0.62rem;
  letter-spacing: 0.14em;
  color: var(--text-muted);
  font-weight: 800;
}
.tier-row-score--empty {
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.95rem;
}

.tier-section--unranked .tier-letter {
  font-size: 1.7rem;
  color: var(--text-muted);
  text-shadow: none;
}

@media (max-width: 720px) {
  .tier-header { grid-template-columns: 56px 1fr; padding: 11px 14px; }
  .tier-letter { font-size: 1.6rem; }
  .tier-row { grid-template-columns: 38px 36px 1fr auto; padding: 10px 14px; gap: 10px; }
  .tier-row-events { display: none; }
  .tier-row-score { font-size: 1rem; min-width: 0; }
  .tier-row-score-label { display: none; }
}
