/* =========================================================================
   scores.css — highscores.php et lastscores.php.

   À charger APRÈS style.css et site-chrome.css. style.css reste nécessaire
   pour la pastille de niveau (.xp-level-badge) rendue par lib/xp_rank.php ;
   les quelques neutralisations en tête annulent ce qu'elle fait fuir dans
   ces pages (images arrondies, couleurs de liens et de titres).
   ========================================================================= */

.sc {
  position: relative;
  padding-bottom: 70px;
  isolation: isolate;
  color: var(--text);
  font-family: 'Figtree', system-ui, -apple-system, sans-serif;
  line-height: 1.55;
  /* Même correction que sur le profil : sans fond, la page s'arrête au dégradé
     du hero puis retombe sur le radial que style.css pose sur <html>, plus
     clair à cette hauteur. La cassure se voit à l'endroit où le hero se termine.
     --void étant la couleur sur laquelle il finit, la jonction devient
     invisible. */
  background: var(--void);
}
.sc *, .sc *::before, .sc *::after { box-sizing: border-box; }
.sc img { border-radius: 0; }
/* `:where()` ne compte pas dans la specificite : la regle vaut (0,0,1), juste
   assez pour battre le `a { color:#DDDDDD }` de style.css par l'ordre de
   chargement, et assez peu pour ceder devant tout composant qui pose sa propre
   couleur — `.btn-prime`, `.sc-period.is-active`… Ecrite `.sc a`, elle valait
   (0,1,1) et rendait ces composants illisibles. */
:where(.sc) a { color: inherit; text-decoration: none; }
/* `:where()` neutralise la spécificité : sans lui la règle vaut (0,1,1) et
   l'emporte sur `.display` (0,1,0), si bien que tous les titres retombaient
   sur Figtree au lieu d'Archivo. Même correction que pour les liens. */
:where(.sc) h1, :where(.sc) h2, :where(.sc) h3, :where(.sc) h4 { color: var(--text); font-family: inherit; }
.sc p { color: inherit; }

/* ------------------------------------------------------------------ hero -- */

.sc-hero { position: relative; padding: 46px 0 34px; }
.sc-hero-bg { position: absolute; inset: -120px 0 0; z-index: -1; overflow: hidden; pointer-events: none; }
.sc-hero-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(4, 5, 12, .3) 0%, rgba(4, 5, 12, .7) 60%, var(--void) 100%),
    repeating-linear-gradient(0deg, rgba(0, 0, 0, .3) 0 1px, transparent 1px 3px);
}

.sc .kicker { color: var(--muted); }
.sc-hero h1 { font-size: clamp(2.2rem, 4.6vw, 3.6rem); margin: 12px 0 14px; }
.sc-hero p.sc-lede { color: var(--muted); font-size: 1.02rem; max-width: 52ch; margin: 0; line-height: 1.6; }

.sc-rail { display: flex; align-items: stretch; margin-top: 28px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.sc-rail div { flex: 1; padding: 15px 0 14px; border-left: 1px solid var(--line-soft); }
.sc-rail div:first-child { border-left: 0; padding-left: 0; }
.sc-rail div:not(:first-child) { padding-left: 20px; }
.sc-rail b {
  display: block;
  font-family: 'Archivo', sans-serif;
  font-stretch: 112%;
  font-weight: 800;
  font-size: 1.7rem;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.sc-rail div.is-live b { color: var(--score); }
.sc-rail span { display: block; margin-top: 7px; font-size: 9.5px; letter-spacing: .15em; text-transform: uppercase; color: var(--dim); font-weight: 700; }

/* --------------------------------------------------------------- filtres -- */
/* Les deux <select> deviennent des contrôles visibles : on voit d'un coup
   d'œil quel jeu et quelle période sont actifs, et tout fonctionne sans JS. */

.sc-filters { margin: 26px 0 30px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; }
.sc-filters > div { min-width: 0; }
.sc-filter-head { display: flex; align-items: baseline; gap: 14px; margin-bottom: 11px; }
.sc-filter-head .kicker { margin: 0; }
.sc-filter-line { flex: 1; height: 1px; background: linear-gradient(90deg, var(--line), transparent); }

/* Rangée de jeux : icônes PNG transparentes, sans aplat de couleur. */
.sc-games {
  display: flex;
  max-width: 100%;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 6px;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}
.sc-games::-webkit-scrollbar { height: 5px; }
.sc-games::-webkit-scrollbar-thumb { background: var(--line); border-radius: 999px; }

.sc-game {
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 92px;
  padding: 10px 6px 11px;
  border-radius: var(--r-md);
  border: 1px solid transparent;
  transition: border-color .25s, background .25s, transform .25s;
}
.sc-game img { width: 52px; height: 52px; object-fit: contain; transition: transform .25s; }
.sc-game-all {
  display: grid;
  place-items: center;
  width: 52px; height: 52px;
  border-radius: 15px;
  border: 1px solid var(--line-soft);
  background: rgba(140, 160, 255, .05);
  color: var(--muted);
  transition: transform .25s, color .25s, border-color .25s;
}
.sc-game-all svg { width: 22px; height: 22px; }
.sc-game:hover .sc-game-all { transform: translateY(-3px) scale(1.05); color: var(--text); }
.sc-game.is-active .sc-game-all { color: var(--text); border-color: rgba(140, 160, 255, .3); }
.sc-game span {
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: .04em;
  text-align: center;
  color: var(--dim);
  line-height: 1.25;
  transition: color .25s;
}
.sc-game:hover { border-color: var(--line-soft); background: rgba(140, 160, 255, .04); }
.sc-game:hover img { transform: translateY(-3px) scale(1.05); }
.sc-game:hover span { color: var(--muted); }
.sc-game.is-active {
  border-color: rgba(140, 160, 255, .32);
  background: rgba(140, 160, 255, .07);
  box-shadow: 0 0 30px -14px rgba(126, 107, 255, .8);
}
.sc-game.is-active span { color: var(--text); }

/* Segments de période. */
.sc-periods { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px; border-radius: 999px; border: 1px solid var(--line-soft); background: rgba(140, 160, 255, .04); }
.sc-period {
  display: inline-flex;
  align-items: center;
  height: 32px;
  padding: 0 15px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--dim);
  transition: color .2s, background .2s;
}
.sc-period:hover { color: var(--text); background: rgba(140, 160, 255, .07); }
.sc-period.is-active { color: #05060F; background: var(--prime, linear-gradient(100deg, #17C8FF 0%, #6FE6FF 42%, #FFFFFF 100%)); }

/* --------------------------------------------------------------- layout -- */

.sc-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 340px); gap: 26px; align-items: start; }
.sc-main { min-width: 0; display: grid; gap: 20px; }
.sc-aside { display: grid; gap: 18px; }

/* ------------------------------------------------------ bandeau du jeu --- */

.sc-game-head {
  position: relative;
  border-radius: var(--r-lg);
  overflow: hidden;
  clip-path: inset(0);
  border: 1px solid var(--line-soft);
  background: var(--panel);
  min-height: 190px;
  display: flex;
  align-items: flex-end;
}
.sc-game-head > img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: -1;
}
.sc-game-head.is-icon > img { object-fit: contain; object-position: right center; padding: 18px; opacity: .9; }
.sc-game-head::before {
  content: "";
  position: absolute;
  inset: -1px;
  background: linear-gradient(100deg, var(--panel) 22%, rgba(10, 13, 27, .82) 52%, rgba(10, 13, 27, .3) 100%);
}
.sc-game-head-body { position: relative; padding: 22px 24px; max-width: 60ch; }
.sc-game-head h2 { font-size: clamp(1.5rem, 3vw, 2.1rem); margin: 0 0 8px; }
.sc-game-head p { color: var(--muted); margin: 0 0 16px; font-size: .92rem; line-height: 1.5; max-width: 46ch; }
.sc-game-meta { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.sc-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 27px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--line-soft);
  background: rgba(4, 5, 12, .55);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .11em;
  text-transform: uppercase;
  color: var(--muted);
}

/* --------------------------------------------------------------- podium -- */

.sc-podium { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; align-items: end; }
.sc-step {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 9px;
  padding: 20px 14px 18px;
  border-radius: var(--r-md);
  border: 1px solid var(--line-soft);
  background: linear-gradient(180deg, rgba(16, 20, 42, .8), rgba(10, 13, 27, .5));
  text-align: center;
  transition: transform .28s cubic-bezier(.2, .8, .2, 1), border-color .28s;
}
.sc-step:hover { transform: translateY(-4px); border-color: rgba(140, 160, 255, .3); }
.sc-step img { width: 54px; height: 54px; border-radius: 14px; object-fit: cover; }
.sc-step-name { font-weight: 800; font-size: .95rem; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sc-step-score {
  font-family: 'Archivo', sans-serif;
  font-stretch: 112%;
  font-weight: 800;
  font-size: 1.35rem;
  line-height: 1;
  color: var(--score);
  font-variant-numeric: tabular-nums;
}
.sc-medal {
  position: absolute;
  top: -11px;
  left: 50%;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
  height: 22px;
  padding: 0 9px;
  border-radius: 999px;
  font-family: 'Archivo', sans-serif;
  font-stretch: 112%;
  font-weight: 800;
  font-size: 11px;
  color: #05060F;
  font-variant-numeric: tabular-nums;
}

/* Ordre visuel 2 – 1 – 3, avec la première marche surélevée. */
.sc-step.rank-1 { order: 2; padding-top: 30px; padding-bottom: 26px; border-color: rgba(255, 201, 107, .38); background: linear-gradient(180deg, rgba(48, 36, 12, .7), rgba(10, 13, 27, .6)); }
.sc-step.rank-1 img { width: 66px; height: 66px; }
.sc-step.rank-1 .sc-step-score { font-size: 1.6rem; }
.sc-step.rank-2 { order: 1; }
.sc-step.rank-3 { order: 3; }
.sc-step.rank-1 .sc-medal { background: linear-gradient(135deg, #FFE9A8, #FFC96B 55%, #D79A2B); }
.sc-step.rank-2 .sc-medal { background: linear-gradient(135deg, #FFFFFF, #CFD8FF 55%, #8E97C2); }
.sc-step.rank-3 .sc-medal { background: linear-gradient(135deg, #F3C79A, #D69A5C 55%, #9A6530); }

/* ------------------------------------------------------- barres de jeux -- */

.sc-plays { list-style: none; margin: 0; padding: 0; }
.sc-plays li { display: grid; grid-template-columns: 28px 1fr auto; align-items: center; gap: 11px; padding: 9px 0; border-top: 1px solid var(--line-soft); }
.sc-plays li:first-child { border-top: 0; }
.sc-plays img { width: 28px; height: 28px; object-fit: contain; }
.sc-plays-main { min-width: 0; }
.sc-plays-main strong { display: block; font-size: .84rem; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sc-bar { display: block; height: 4px; margin-top: 6px; border-radius: 999px; background: rgba(140, 160, 255, .1); overflow: hidden; }
.sc-bar i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--cyan), var(--violet)); }
.sc-plays em { font-style: normal; font-size: 11px; color: var(--dim); font-variant-numeric: tabular-nums; white-space: nowrap; }


/* ------------------------------------------------------- badges récents -- */

.sc-badges { list-style: none; margin: 0; padding: 0; }
.sc-badges li { display: grid; grid-template-columns: 34px 1fr; align-items: center; gap: 12px; padding: 9px 0; border-top: 1px solid var(--line-soft); }
.sc-badges li:first-child { border-top: 0; }
.sc-badges img { width: 34px; height: 34px; object-fit: contain; }
.sc-badges strong { display: block; font-size: .86rem; font-weight: 700; }
.sc-badges small { display: block; font-size: 11px; color: var(--dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* La pastille de niveau vient de style.css : on l'empêche juste de pousser. */
.sc .xp-level-badge { flex: none; }

/* ---------------------------------------------------------- responsive --- */

@media (max-width: 1000px) {
  .sc-layout { grid-template-columns: minmax(0, 1fr); }
  .sc-aside { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  .sc { padding-bottom: 40px; }
  .sc-hero { padding: 30px 0 24px; }
  .sc-rail { flex-wrap: wrap; }
  .sc-rail div { flex: 1 1 50%; padding-left: 0 !important; border-left: 0; border-top: 1px solid var(--line-soft); padding-top: 13px; }
  .sc-rail div:first-child, .sc-rail div:nth-child(2) { border-top: 0; }
  .sc-aside { grid-template-columns: minmax(0, 1fr); }
  .sc-game { width: 78px; }
  .sc-game img { width: 44px; height: 44px; }
  .sc-game-head { min-height: 0; }
  .sc-game-head-body { padding: 18px; }
  .sc-table th, .sc-table td { padding: 10px 8px; }
  .sc-card { padding: 16px 15px 6px; }
}

@media (max-width: 560px) {
  /* Le podium repasse en colonne : la 1re marche d'abord, comme un classement. */
  .sc-podium { grid-template-columns: minmax(0, 1fr); gap: 18px; }
  .sc-step.rank-1 { order: 1; }
  .sc-step.rank-2 { order: 2; }
  .sc-step.rank-3 { order: 3; }
  .sc-periods { width: 100%; justify-content: space-between; }
  .sc-period { flex: 1; justify-content: center; padding: 0 8px; letter-spacing: .06em; }
}
