Document the L'Anneau identity and version its reference page (#81)
CI / core (pull_request) Successful in 1m37s
CI / core (push) Successful in 1m31s

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit was merged in pull request #90.
This commit is contained in:
nessarandClaude Sonnet 5.5 committed 2026-11-21 11:33:12 +01:00
1 parent 8784c6eb6c
commit d42125724e
3 files changed
+730 -6

No files matched your search

+689
View File
@@ -0,0 +1,689 @@
<!doctype html>
<html lang="fr">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Arena Tracker · Identité « L'Anneau »</title>
<!-- Référence visuelle de l'identité « L'Anneau » (itération B3, « La Bannière ») : couleurs du logo,
anneau de progression, bannière illustrée, animations de fin de Partie, entrée en sélection et survol.
Les animations reproduisent ce que GPUI sait faire : ni rotation, ni mise à l'échelle d'un élément,
ni espacement des lettres animé ; un voile plutôt qu'un filtre sur les cartes voisines.
Saison fictive (graine fixe). Illustrations chargées depuis Data Dragon : il faut une connexion. -->
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Unbounded:wght@600;800&display=swap">
<style>
/* Les couleurs du logo : anneau doré autour d'un disque bleu nuit. Sombre d'abord, clair en papier froid.
Le texte posé sur une illustration reste clair dans les deux thèmes. */
:root {
--bg: #11152a; --band: #151a33; --surface: #181e38; --raised: #20274a; --line: #283053;
--fg: #edeaf7; --muted: #8b91b1; --faint: #3a4166;
--gold: #f5b83d; --gold-ink: #f5b83d; --gold-soft: rgba(245, 184, 61, .34); --gold-glow: rgba(245, 184, 61, .55);
--on-gold: #161b2e; --ban: #ff7a7a;
--art-ink: #ffffff; --art-soft: rgba(255, 255, 255, .74); --art-shade: rgba(9, 11, 24, .94); --art-chip: rgba(17, 21, 42, .88);
--display: Unbounded, "Segoe UI", system-ui, sans-serif;
--body: Inter, "Segoe UI Variable Text", "Segoe UI", system-ui, sans-serif;
--bar-bg: #fdfd96; --bar-fg: #141414;
color-scheme: dark;
}
:root[data-mode="light"] {
--bg: #eef0f7; --band: #e5e8f3; --surface: #ffffff; --raised: #e4e8f4; --line: #d2d7e9;
--fg: #161b2e; --muted: #596082; --faint: #c5cbe0;
--gold: #e3a21a; --gold-ink: #8f5d00; --gold-soft: rgba(212, 146, 14, .4); --gold-glow: rgba(227, 162, 26, .45);
--on-gold: #161b2e; --ban: #c62f2f;
color-scheme: light;
}
* { box-sizing: border-box; }
html, body { min-height: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 14px/1.45 var(--body); transition: background-color .3s; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
[hidden] { display: none !important; }
.frame { max-width: 1264px; margin: 0 auto; padding: 0 clamp(16px, 4vw, 48px) 150px; }
.top { display: flex; align-items: center; gap: 28px; flex-wrap: wrap; min-height: 64px; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; font: 600 16px/1 var(--display); letter-spacing: -.02em; white-space: nowrap; }
.brand svg { width: 28px; height: 28px; }
.nav { display: flex; gap: 4px; }
.nav button { font-size: 13px; font-weight: 600; color: var(--muted); padding: 7px 13px; border-radius: 999px; border: 0; background: transparent; cursor: pointer; transition: background-color .2s, color .2s; }
.nav button:hover:not(:disabled) { color: var(--fg); background: var(--raised); }
.nav button[aria-current="page"] { color: var(--on-gold); background: var(--gold); }
.nav button:disabled { opacity: .4; cursor: default; }
.screen { padding-top: 22px; }
.crown-ic { width: 1em; height: 1em; fill: currentColor; flex: none; }
@keyframes fade-in { from { opacity: 0; } }
/* ---- Bannière : l'anneau, le texte, le splash recadré sur le champion. ---- */
.banner { position: relative; isolation: isolate; overflow: hidden; border-radius: 16px; min-height: clamp(220px, 26vw, 310px); display: flex; align-items: center; gap: clamp(16px, 3vw, 40px); padding: 24px clamp(16px, 3vw, 36px); background: var(--band); }
.art-box { position: absolute; top: 0; right: 0; width: 72%; height: 100%; z-index: -2; overflow: hidden; }
.art { position: absolute; max-width: none; opacity: 0; transition: opacity .5s ease; }
.art.on { opacity: 1; }
.art.settle { animation: settle 1.8s cubic-bezier(.2,.7,.2,1); }
/* Dans l'appli : l'image est agrandie dans la bannière qui la découpe, puis revient à sa taille. */
@keyframes settle { from { transform: scale(1.07); } }
.grade { position: absolute; inset: 0; z-index: -1; pointer-events: none;
background: linear-gradient(90deg, var(--band) 30%, color-mix(in srgb, var(--band) 72%, transparent) 46%, transparent 74%),
linear-gradient(to top, color-mix(in srgb, var(--band) 55%, transparent), transparent 45%); }
.ring { position: relative; width: clamp(120px, 16vw, 200px); flex: none; aspect-ratio: 1; }
.ring svg { width: 100%; height: 100%; display: block; overflow: visible; }
.tick { stroke-linecap: round; transition: opacity .4s, stroke .2s; }
.tick.done { stroke: var(--gold); stroke-width: 4; }
.tick.played { stroke: var(--gold-soft); stroke-width: 3; }
.tick.never { stroke: var(--faint); stroke-width: 3; }
.tick.anvil { stroke-width: 7; }
.tick.lit { stroke: var(--fg); stroke-width: 7; }
.tick.ignite { animation: ignite 1.3s ease-out; }
@keyframes ignite { 0% { stroke: var(--fg); stroke-width: 11; } 100% { } }
.tick.step { animation: step 1.4s ease-out; }
@keyframes step { 0% { stroke: var(--gold); stroke-width: 9; } 100% { } }
.tick.blink { animation: blink .9s ease-in-out; }
@keyframes blink { 0%, 100% { } 40% { stroke: var(--fg); stroke-width: 6; } }
.ring.dim .tick:not(.anvil) { opacity: .16; }
.disc { fill: var(--bg); }
.crown { fill: var(--gold); transform-box: fill-box; transform-origin: 50% 100%; }
.crown.bounce { animation: bounce .8s cubic-bezier(.3,1.8,.4,1); }
@keyframes bounce { 0% { transform: scale(.6) translateY(8px); } 100% { transform: none; } }
.comet { fill: var(--fg); }
.trail { fill: none; stroke: var(--gold); stroke-width: 5; stroke-linecap: round; }
.copy { min-width: 0; max-width: 46%; }
.kicker { font: 600 12px/1.3 var(--body); letter-spacing: .08em; text-transform: uppercase; color: var(--gold-ink); }
.title { margin: 8px 0 10px; font: 600 clamp(22px, 2.8vw, 34px)/1.12 var(--display); letter-spacing: -.035em; text-wrap: balance; }
.count { display: inline-block; font-weight: 800; color: var(--gold-ink); }
.count.roll { animation: roll .7s cubic-bezier(.2,1.4,.4,1); }
@keyframes roll { 0% { transform: translateY(10px); opacity: 0; } 100% { transform: none; opacity: 1; } }
.lines { display: grid; gap: 3px; }
.line { margin: 0; color: var(--muted); font-size: 14px; }
.line b { color: var(--fg); font-weight: 600; }
.line.fresh { animation: fade-in .7s ease both; }
.stage-title.in { animation: title-in .7s cubic-bezier(.2,.8,.2,1) both; }
/* Dans l'appli : fondu et montée, GPUI n'anime pas l'espacement des lettres. */
@keyframes title-in { from { opacity: 0; transform: translateY(8px); } }
@media (max-width: 680px) {
.banner { flex-direction: column; align-items: flex-start; }
.art-box { width: 100%; }
.grade { background: linear-gradient(to top, var(--band) 40%, color-mix(in srgb, var(--band) 40%, transparent) 75%, transparent); }
.copy { max-width: none; }
}
/* ---- Outils et grille de l'accueil, comme dans #78. ---- */
.tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 28px 0 16px; }
.tools h2 { margin: 0 auto 0 0; font: 600 20px/1.2 var(--display); letter-spacing: -.03em; display: flex; align-items: center; gap: 8px; }
.n { font: 550 12px var(--body); color: var(--muted); border: 1px solid var(--line); border-radius: 6px; padding: 2px 7px; letter-spacing: 0; }
.tabs { display: flex; padding: 2px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
.tabs button { border: 0; background: transparent; border-radius: 6px; padding: 5px 10px; font-size: 12px; font-weight: 600; color: var(--muted); cursor: pointer; }
.tabs button[aria-pressed="true"] { background: var(--raised); color: var(--fg); }
.sort { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 0 4px 0 10px; }
.sort select { border: 0; background: transparent; color: var(--fg); font-size: 12px; padding: 7px 4px; }
.sort select option { background: var(--surface); }
.search { width: min(100%, 240px); background: var(--surface); color: var(--fg); border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; font-size: 13px; }
.search:focus { border-color: var(--gold); outline: none; }
.empty { grid-column: 1 / -1; color: var(--muted); padding: 30px 0; }
/* ---- La carte : la même partout, avec le même survol. ---- */
.cards { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 1000px) { .cards { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 720px) { .cards { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 480px) { .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.card { position: relative; isolation: isolate; display: block; width: 100%; aspect-ratio: .68; padding: 0; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--surface); text-align: left; color: var(--art-ink); cursor: default;
transition: transform .35s cubic-bezier(.2,.8,.2,1), box-shadow .35s, border-color .2s; }
.card img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 24%; z-index: -2; transition: transform .7s cubic-bezier(.2,.8,.2,1), filter .5s; }
.card.dim img { filter: grayscale(1) brightness(.7); }
.shade { position: absolute; inset: 0; z-index: -1; background: linear-gradient(to bottom, rgba(9,11,24,0) 40%, rgba(9,11,24,.35) 58%, var(--art-shade) 92%); }
.reasons { position: absolute; top: 8px; left: 8px; right: 8px; display: flex; flex-wrap: wrap; gap: 3px; }
.reason { display: inline-flex; align-items: center; gap: 4px; font-size: 10px; font-weight: 650; padding: 3px 6px; border-radius: 4px; background: var(--art-chip); color: var(--art-ink); }
.reason.gold { background: #f5b83d; color: #161b2e; }
.reason.ban { color: #ffa0a0; }
.reason.appear { animation: pop .5s cubic-bezier(.2,1.4,.4,1) both; }
@keyframes pop { from { opacity: 0; transform: scale(.4); } }
.cap { position: absolute; left: 11px; right: 8px; bottom: 10px; transition: opacity .2s, transform .3s; }
.name { display: block; font-weight: 650; font-size: clamp(14px, 1.35vw, 18px); line-height: 1.15; letter-spacing: -.02em; }
.marks { display: flex; gap: 4px 9px; margin-top: 6px; flex-wrap: wrap; }
.mark { display: inline-flex; align-items: center; gap: 4px; font-size: 10px; font-weight: 600; color: var(--art-soft); }
.mark::before { content: ""; width: 7px; height: 7px; border-radius: 50%; border: 1px solid var(--art-soft); transition: background-color .4s, border-color .4s; }
.mark.on { color: var(--art-ink); }
.mark.on::before { background: #f5b83d; border-color: #f5b83d; }
.mark.fresh::before { animation: fill 1.2s ease-out; }
@keyframes fill { 0% { background: transparent; box-shadow: 0 0 0 0 rgba(245,184,61,.9); } 40% { background: #f5b83d; box-shadow: 0 0 0 5px rgba(245,184,61,0); } }
.sheet { position: absolute; inset: auto 0 0 0; display: flex; flex-direction: column; justify-content: flex-end; gap: 3px; padding: 44px 12px 12px; font-size: 12px;
background: linear-gradient(to bottom, rgba(13,16,33,0), rgba(13,16,33,.93) 34%); opacity: 0; visibility: hidden; transform: translateY(14px);
transition: opacity .22s, transform .3s cubic-bezier(.2,.8,.2,1), visibility .22s; }
.sheet strong { font: 600 15px/1.2 var(--display); letter-spacing: -.02em; margin-bottom: 6px; }
.sheet span { display: flex; justify-content: space-between; gap: 6px; color: var(--art-soft); }
.sheet b { color: var(--art-ink); font-weight: 600; font-variant-numeric: tabular-nums; }
/* Survol ou focus : la carte monte (sans grossir), l'illustration zoome à l'intérieur, la fiche glisse du bas. */
.card:hover, .card:focus-visible { z-index: 2; transform: translateY(-10px); border-color: var(--gold); box-shadow: 0 18px 34px -14px rgba(0,0,0,.65), 0 0 28px -8px var(--gold-glow); outline: none; }
.card:hover img, .card:focus-visible img { transform: scale(1.07); }
.card:hover .sheet, .card:focus-visible .sheet { opacity: 1; visibility: visible; transform: none; }
.card:hover .cap, .card:focus-visible .cap { opacity: 0; transform: translateY(6px); }
.card.dim:hover, .card.dim:focus-visible { transform: translateY(-4px); box-shadow: 0 12px 24px -14px rgba(0,0,0,.6); border-color: var(--line); }
/* Dans la main seulement, un voile sur les voisines (GPUI n'a pas de filtre de luminosité). */
.card::after { content: ""; position: absolute; inset: 0; background: rgba(9, 11, 24, .42); opacity: 0; transition: opacity .3s; pointer-events: none; }
.hand:has(.card:hover) .card:not(:hover)::after { opacity: 1; }
/* ---- Sélection : balayage, titre, main distribuée, « Autres champions ». ---- */
.stage { display: grid; gap: 16px; }
.stage-sub { margin: 0; color: var(--muted); font-size: 14px; }
.stage-sub b { color: var(--gold-ink); }
.sweep { position: fixed; inset: 0; z-index: 40; pointer-events: none; background: linear-gradient(100deg, transparent 36%, var(--gold-soft) 48.5%, rgba(255,255,255,.16) 50%, var(--gold-soft) 51.5%, transparent 64%); background-size: 300% 100%; animation: sweep .9s ease-out both; }
@keyframes sweep { 0% { background-position: 100% 0; opacity: 1; } 100% { background-position: 0 0; opacity: 0; } }
.hand { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; max-width: 1000px; }
@media (max-width: 720px) { .hand { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
/* Distribuées depuis le bas, l'une après l'autre ; sans rotation dans l'appli. */
.hand .card.deal { animation: deal .7s cubic-bezier(.2,1.25,.35,1) both; }
@keyframes deal { 0% { transform: translateY(60vh); opacity: 0; } 100% { transform: none; opacity: 1; } }
.hand .card.taken { transform: translateY(8px); }
.hand .card.taken:hover { transform: translateY(5px); }
.hand .card.leave { transition: transform .32s ease-in, opacity .32s; transform: translateY(48px); opacity: 0; }
.others { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); margin-top: 8px; }
.others summary { display: flex; align-items: center; gap: 10px; min-height: 50px; cursor: pointer; font-weight: 600; list-style: none; }
.others summary::-webkit-details-marker { display: none; }
.others summary::before { content: "›"; font-size: 18px; color: var(--muted); transition: transform .2s; }
.others[open] summary::before { transform: rotate(90deg); }
.others .count-n { color: var(--muted); font-weight: 500; }
.others-body { display: grid; gap: 14px; padding-bottom: 18px; }
/* ---- Statistiques. ---- */
.stats { display: grid; gap: 14px; }
.stats-head { display: flex; align-items: end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 6px; }
.stats-head h1 { margin: 0; font: 600 clamp(24px, 3vw, 34px)/1.1 var(--display); letter-spacing: -.03em; }
.stats-head p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.stats-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 720px) { .stats-grid { grid-template-columns: minmax(0, 1fr); } }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 18px 20px; min-width: 0; }
.panel.wide { grid-column: 1 / -1; }
.panel h2 { margin: 0; font: 600 15px/1.2 var(--display); letter-spacing: -.01em; }
.panel p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.panel svg { display: block; width: 100%; height: auto; margin-top: 14px; overflow: visible; }
.panel svg text { font: 500 10px var(--body); fill: var(--muted); font-variant-numeric: tabular-nums; }
.panel svg .value { fill: var(--fg); font-weight: 650; }
.grid-line { stroke: var(--line); stroke-width: 1; }
.curve { fill: none; stroke: var(--gold); stroke-width: 2; stroke-linejoin: round; }
.curve-area { fill: var(--gold); opacity: .12; }
.bar { fill: var(--faint); }
.bar.lead { fill: var(--gold); }
.hit { fill: transparent; }
.hit:hover { fill: var(--gold-soft); opacity: .25; }
/* ---- Barre de démonstration, hors identité. ---- */
.demo { position: fixed; z-index: 1000; left: 50%; bottom: 12px; transform: translateX(-50%); width: max-content; max-width: calc(100vw - 24px);
display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 4px; padding: 5px; border-radius: 14px;
border: 2px solid var(--bar-fg); background: var(--bar-bg); color: var(--bar-fg); box-shadow: 4px 4px 0 var(--bar-fg); font: 600 12px/1.2 Inter, system-ui, sans-serif; }
.demo b { padding: 0 8px; }
.demo button { color: var(--bar-fg); background: transparent; border: 1.5px solid transparent; border-radius: 9px; padding: 7px 10px; cursor: pointer; }
.demo button:hover { border-color: var(--bar-fg); }
.demo button[aria-pressed="true"] { background: var(--bar-fg); color: var(--bar-bg); }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: 1ms !important; transition-duration: 1ms !important; } }
</style>
</head>
<body>
<div class="frame">
<header class="top" id="top"></header>
<main class="screen" id="screen"></main>
</div>
<nav class="demo" aria-label="Démonstration">
<b>Démo</b>
<button id="demo-match" type="button" title="Une Partie suivie en direct se termine, avec un champion et un Placement au hasard">Partie au hasard</button>
<button id="demo-top1" type="button" title="Une Partie suivie en direct se termine sur un top 1">Top 1 au hasard</button>
<button id="demo-select" type="button" aria-pressed="false">Sélection</button>
<button id="demo-theme" type="button">Thème clair</button>
<button id="demo-reset" type="button">Réinitialiser</button>
</nav>
<script>
(() => {
// [clé Data Dragon, nom, focus x %, focus y %]. Le focus situe l'art de chargement dans le splash ;
// l'appli le calcule au téléchargement, ces valeurs viennent de ce calcul (et de son repli).
const CHAMPS = [["Aatrox","Aatrox",65,30],["Ahri","Ahri",61,28],["Akali","Akali",50,30],["Akshan","Akshan",48,30],["Alistar","Alistar",61,30],["Ambessa","Ambessa",49,21],["Amumu","Amumu",68,30],["Anivia","Anivia",55,33],["Annie","Annie",78,33],["Aphelios","Aphelios",56,29],["Ashe","Ashe",68,30],["AurelionSol","Aurelion Sol",51,29],["Aurora","Aurora",56,24],["Azir","Azir",71,31],["Bard","Bard",62,30],["Belveth","Bel'Veth",49,26],["Blitzcrank","Blitzcrank",63,30],["Brand","Brand",76,31],["Braum","Braum",76,30],["Briar","Briar",55,33],["Caitlyn","Caitlyn",75,30],["Camille","Camille",72,20],["Cassiopeia","Cassiopeia",64,33],["Chogath","Cho'Gath",59,30],["Corki","Corki",69,34],["Darius","Darius",55,29],["Diana","Diana",67,39],["DrMundo","Dr. Mundo",52,29],["Draven","Draven",72,34],["Ekko","Ekko",72,24],["Elise","Elise",71,25],["Evelynn","Evelynn",52,28],["Ezreal","Ezreal",62,33],["Fiddlesticks","Fiddlesticks",57,40],["Fiora","Fiora",67,30],["Fizz","Fizz",82,28],["Galio","Galio",47,29],["Gangplank","Gangplank",71,33],["Garen","Garen",76,28],["Gnar","Gnar",72,37],["Gragas","Gragas",56,30],["Graves","Graves",71,30],["Gwen","Gwen",51,27],["Hecarim","Hecarim",66,25],["Heimerdinger","Heimerdinger",72,30],["Hwei","Hwei",57,30],["Illaoi","Illaoi",65,29],["Irelia","Irelia",50,30],["Ivern","Ivern",48,30],["Janna","Janna",79,33],["JarvanIV","Jarvan IV",73,30],["Jax","Jax",67,35],["Jayce","Jayce",72,37],["Jhin","Jhin",65,32],["Jinx","Jinx",69,28],["KSante","K'Santé",38,26],["Kaisa","Kai'Sa",49,26],["Kalista","Kalista",60,30],["Karma","Karma",72,25],["Karthus","Karthus",67,25],["Kassadin","Kassadin",63,24],["Katarina","Katarina",65,33],["Kayle","Kayle",76,35],["Kayn","Kayn",50,51],["Kennen","Kennen",75,33],["Khazix","Kha'Zix",80,35],["Kindred","Kindred",63,30],["Kled","Kled",75,30],["KogMaw","Kog'Maw",65,37],["Leblanc","LeBlanc",51,27],["LeeSin","Lee Sin",64,29],["Leona","Leona",75,25],["Lillia","Lillia",43,26],["Lissandra","Lissandra",68,24],["Locke","Locke",62,24],["Lucian","Lucian",71,47],["Lulu","Lulu",69,31],["Lux","Lux",62,28],["Malphite","Malphite",65,37],["Malzahar","Malzahar",63,30],["Maokai","Maokai",59,30],["MasterYi","Maître Yi",78,30],["Mel","Mel",44,30],["Milio","Milio",51,30],["MissFortune","Miss Fortune",69,39],["MonkeyKing","Wukong",62,30],["Mordekaiser","Mordekaiser",47,30],["Morgana","Morgana",73,32],["Naafiri","Naafiri",23,24],["Nami","Nami",75,33],["Nasus","Nasus",67,25],["Nautilus","Nautilus",75,27],["Neeko","Neeko",49,30],["Nidalee","Nidalee",74,24],["Nilah","Nilah",64,33],["Nocturne","Nocturne",65,30],["Nunu","Nunu et Willump",51,51],["Olaf","Olaf",62,33],["Orianna","Orianna",74,29],["Ornn","Ornn",50,33],["Pantheon","Pantheon",51,28],["Poppy","Poppy",67,30],["Pyke","Pyke",49,31],["Qiyana","Qiyana",52,30],["Quinn","Quinn",59,30],["Rakan","Rakan",57,30],["Rammus","Rammus",61,30],["RekSai","Rek'Sai",56,30],["Rell","Rell",47,21],["Renata","Renata Glasc",56,30],["Renekton","Renekton",58,30],["Rengar","Rengar",65,30],["Riven","Riven",75,30],["Rumble","Rumble",70,30],["Ryze","Ryze",62,35],["Samira","Samira",58,32],["Sejuani","Sejuani",54,29],["Senna","Senna",53,30],["Seraphine","Séraphine",50,26],["Sett","Sett",49,21],["Shaco","Shaco",71,28],["Shen","Shen",70,25],["Shyvana","Shyvana",51,30],["Singed","Singed",71,30],["Sion","Sion",68,30],["Sivir","Sivir",56,21],["Skarner","Skarner",52,35],["Smolder","Smolder",50,30],["Sona","Sona",80,30],["Soraka","Soraka",56,26],["Swain","Swain",67,30],["Sylas","Sylas",50,40],["Syndra","Syndra",51,24],["TahmKench","Tahm Kench",18,25],["Taliyah","Taliyah",72,30],["Talon","Talon",63,30],["Taric","Taric",71,25],["Teemo","Teemo",59,30],["Thresh","Thresh",64,30],["Tristana","Tristana",63,27],["Trundle","Trundle",59,30],["Tryndamere","Tryndamere",71,30],["TwistedFate","Twisted Fate",71,30],["Twitch","Twitch",57,32],["Udyr","Udyr",54,29],["Urgot","Urgot",58,23],["Varus","Varus",52,30],["Vayne","Vayne",77,24],["Veigar","Veigar",67,30],["Velkoz","Vel'Koz",56,32],["Vex","Vex",62,30],["Vi","Vi",71,30],["Viego","Viego",71,21],["Viktor","Viktor",49,30],["Vladimir","Vladimir",70,32],["Volibear","Volibear",56,26],["Warwick","Warwick",76,35],["Xayah","Xayah",89,33],["Xerath","Xerath",57,29],["XinZhao","Xin Zhao",52,29],["Yasuo","Yasuo",76,32],["Yone","Yone",58,21],["Yorick","Yorick",62,30],["Yunara","Yunara",65,28],["Yuumi","Yuumi",46,30],["Zaahen","Zaahen",56,23],["Zac","Zac",64,30],["Zed","Zed",66,26],["Zeri","Zeri",55,28],["Ziggs","Ziggs",73,30],["Zilean","Zilean",57,30],["Zoe","Zoé",52,27],["Zyra","Zyra",75,25]];
const DDRAGON = "https://ddragon.leagueoflegends.com/cdn/img/champion";
const SPLASH = { w: 1215, h: 717 };
const SEASON = { name: "Saison 2 · 2026", start: Date.UTC(2026, 8, 10), days: 72 };
const TODAY = SEASON.days - 1;
const CROWN = "M68 186 L52 86 L98 126 L128 66 L158 126 L204 86 L188 186 Z";
const CROWN_ICON = `<svg class="crown-ic" viewBox="40 56 176 140" aria-hidden="true"><path d="${CROWN}"/></svg>`;
const LOGO = `<svg viewBox="0 0 256 256" aria-hidden="true"><circle cx="128" cy="128" r="124" fill="#f5b83d"/><circle cx="128" cy="128" r="100" fill="#161b2e"/><path fill="#f5b83d" d="${CROWN}"/></svg>`;
const reduced = matchMedia("(prefers-reduced-motion: reduce)").matches;
const $ = id => document.getElementById(id);
const wait = ms => new Promise(done => setTimeout(done, ms));
const esc = s => String(s).replace(/[&<>"]/g, ch => ({ "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;" }[ch]));
const norm = s => s.toLocaleLowerCase("fr").normalize("NFD").replace(/\p{M}|[^a-z0-9]/gu, "");
const collator = new Intl.Collator("fr", { sensitivity: "base" });
const dayFmt = new Intl.DateTimeFormat("fr-FR", { day: "numeric", month: "short", timeZone: "UTC" });
const longFmt = new Intl.DateTimeFormat("fr-FR", { day: "2-digit", month: "2-digit", year: "numeric", timeZone: "UTC" });
const day = d => dayFmt.format(new Date(SEASON.start + d * 86400000));
const date = d => longFmt.format(new Date(SEASON.start + d * 86400000));
const points = n => new Intl.NumberFormat("fr-FR").format(n);
const place = p => p == null ? "—" : p === 1 ? "1ᵉʳ" : p + "ᵉ";
const plural = (n, w) => `${n} ${w}${n > 1 ? "s" : ""}`;
// ---- Saison fictive. ----
function rng(seed) {
return () => {
seed = (seed + 0x6D2B79F5) | 0;
let t = Math.imul(seed ^ (seed >>> 15), 1 | seed);
t = (t + Math.imul(t ^ (t >>> 7), 61 | t)) ^ t;
return ((t ^ (t >>> 14)) >>> 0) / 4294967296;
};
}
const placementOf = x => x < .17 ? 1 : x < .34 ? 2 : x < .52 ? 3 : x < .68 ? 4 : x < .84 ? 5 : 6;
const isPlayed = c => c.matches.length > 0;
const isCompleted = c => c.matches.some(m => m.p === 1);
const hasWin = c => c.matches.some(m => m.p <= 3);
const firstTop1 = c => c.matches.find(m => m.p === 1)?.day ?? null;
const attempts = c => { const i = c.matches.findIndex(m => m.p === 1); return i < 0 ? c.matches.length : i + 1; };
const best = c => c.matches.length ? Math.min(...c.matches.map(m => m.p)) : null;
function generate() {
const r = rng(20261121);
const champions = CHAMPS.map(([key, name, fx, fy], i) => {
const mastery = Math.round(Math.pow(r(), 2.6) * 420000);
const played = r() < .3 + .55 * (mastery / 420000) + .12;
const matches = [];
if (played) {
const count = 1 + Math.floor(Math.pow(r(), 1.25) * 6);
const days = Array.from({ length: count }, () => Math.floor(r() * (SEASON.days - 2))).sort((a, b) => a - b);
for (const d of days) matches.push({ p: placementOf(r()), day: d, seq: 0 });
}
return { id: i + 1, key, name, fx, fy, mastery, matches };
}).sort((a, b) => collator.compare(a.name, b.name));
const byM = list => list.sort((a, b) => b.mastery - a.mastery);
const completed = byM(champions.filter(isCompleted));
const remaining = byM(champions.filter(c => isPlayed(c) && !isCompleted(c)));
const never = byM(champions.filter(c => !isPlayed(c)));
const anvil = [completed[2], remaining[0], remaining[3], remaining[5], never[1]];
anvil.forEach(c => c.anvil = true);
anvil[2].ban = "Banni";
anvil[3].ban = "Pris par un allié";
anvil[3].later = true;
return champions;
}
const state = { champions: generate(), seq: 0, selection: false, allyTaken: false, screen: "defi", query: "", filter: "all", sort: "mastery", pending: null };
const find = id => state.champions.find(c => c.id === id);
const byMastery = list => [...list].sort((a, b) => b.mastery - a.mastery || collator.compare(a.name, b.name));
const byName = list => [...list].sort((a, b) => collator.compare(a.name, b.name));
const completedCount = () => state.champions.filter(isCompleted).length;
const total = () => state.champions.length;
const anvil = () => byMastery(state.champions.filter(c => c.anvil));
const others = () => byMastery(state.champions.filter(c => !c.anvil));
// Validations dans l'ordre, la plus ancienne d'abord ; deux du même jour gardent leur ordre d'arrivée.
function validations() {
const seqOf = c => c.matches.find(m => m.p === 1).seq;
return state.champions.filter(isCompleted).map(c => ({ c, day: firstTop1(c) }))
.sort((a, b) => a.day - b.day || seqOf(a.c) - seqOf(b.c) || a.c.id - b.c.id);
}
function reasons(c) {
const out = [];
if (isCompleted(c)) out.push("Validé");
if (state.selection && c.ban && (!c.later || state.allyTaken)) out.push(c.ban);
return out;
}
const pickable = c => !reasons(c).length;
// ---- La ligne « Dernière Partie », tirée des Parties enregistrées. ----
function lastMatch() {
let found = null;
for (const c of state.champions) c.matches.forEach((m, i) => {
if (!found || m.day > found.m.day || (m.day === found.m.day && m.seq > found.m.seq)) found = { c, m, i };
});
return found;
}
function lastMatchLine() {
const last = lastMatch();
if (!last) return "";
const { c, m, i } = last;
const first = c.matches.findIndex(x => x.p === 1);
let detail = "";
if (first === i) detail = i === 0 ? " · validé du premier coup" : ` · validé en ${i + 1} Tentatives`;
else if (first < 0 || i < first) detail = ` · ${i === 0 ? "1ʳᵉ" : `${i + 1}ᵉ`} Tentative`;
return `Dernière Partie : <b>${esc(c.name)}</b>, ${place(m.p)}${detail}`;
}
// ---- L'anneau : une jauge à l'ordre fixe, qui ne suit pas le tri choisi. ----
const SIZE = 520, C = SIZE / 2, R1 = 214, R2 = 246, PAD = 20, BOX = SIZE + 2 * PAD;
function ringOrder() {
const played = byMastery(state.champions.filter(c => isPlayed(c) && !isCompleted(c)));
const never = byMastery(state.champions.filter(c => !isPlayed(c)));
return [...validations().map(v => v.c), ...played, ...never];
}
const angleOf = (i, n) => -Math.PI / 2 + (i + .5) * 2 * Math.PI / n;
const at = (a, r) => [C + r * Math.cos(a), C + r * Math.sin(a)];
function ring() {
const list = ringOrder(), n = list.length;
const ticks = list.map((c, i) => {
const a = angleOf(i, n), done = isCompleted(c) && state.pending !== c.id;
const k = done ? "done" : isPlayed(c) ? "played" : "never";
const [x1, y1] = at(a, done ? R1 : k === "played" ? R1 + 10 : R1 + 18);
const [x2, y2] = at(a, done ? R2 : k === "played" ? R2 - 6 : R1 + 21);
return `<line class="tick ${k} ${state.selection && c.anvil ? "anvil" : ""}" data-tick="${c.id}" x1="${x1.toFixed(1)}" y1="${y1.toFixed(1)}" x2="${x2.toFixed(1)}" y2="${y2.toFixed(1)}"/>`;
}).join("");
return `<div class="ring ${state.selection ? "dim" : ""}"><svg viewBox="${-PAD} ${-PAD} ${BOX} ${BOX}" role="img" aria-label="${completedCount()} champions validés sur ${n}">
<circle class="disc" cx="${C}" cy="${C}" r="${R1 - 18}"/><g>${ticks}</g>
<g transform="translate(${C - 82} ${C - 92}) scale(.64)"><path class="crown" d="${CROWN}"/></g>
<path class="trail" opacity="0"/><circle class="comet" r="9" opacity="0" style="filter: drop-shadow(0 0 10px #f5b83d)"/></svg></div>`;
}
// ---- Les cartes. ----
function card(c, { lazy = true, deal = -1, appear = "" } = {}) {
const rs = reasons(c);
const badges = rs.map(r => `<span class="reason ${r === "Validé" ? "gold" : "ban"} ${appear === r ? "appear" : ""}">${r === "Validé" ? CROWN_ICON : ""}${esc(r)}</span>`).join("");
const lines = [["Parties", c.matches.length], ["Victoires", c.matches.filter(m => m.p <= 3).length], ["Meilleur Placement", place(best(c))], ["Tentatives", attempts(c)], ["Points de maîtrise", points(c.mastery)]];
if (isCompleted(c)) lines.push(["Premier top 1", date(firstTop1(c))]);
const style = deal >= 0 ? ` style="animation-delay:${reduced ? 0 : 380 + deal * 110}ms"` : "";
return `<button type="button" class="card ${rs.length ? "dim" : ""} ${deal >= 0 && !reduced ? "deal" : ""}" data-id="${c.id}" aria-label="${esc(c.name + (rs.length ? ", " + rs.join(", ") : ""))}"${style}>
<img alt="" draggable="false" ${lazy ? 'loading="lazy"' : ""} src="${DDRAGON}/loading/${c.key}_0.jpg"><span class="shade"></span>
<span class="reasons">${badges}</span>
<span class="cap"><span class="name">${esc(c.name)}</span><span class="marks"><span class="mark ${isPlayed(c) ? "on" : ""}" data-mark="played">Joué</span><span class="mark ${hasWin(c) ? "on" : ""}" data-mark="win">Victoire</span></span></span>
<span class="sheet" aria-hidden="true"><strong>${esc(c.name)}</strong>${lines.map(([k, v]) => `<span>${k}<b>${esc(v)}</b></span>`).join("")}</span>
</button>`;
}
// ---- La bannière, à l'accueil et en sélection. ----
const ART = `<div class="art-box"><img class="art" alt=""><img class="art" alt=""></div><div class="grade"></div>`;
const restChampion = () => state.selection
? anvil().find(c => pickable(c) && !isCompleted(c)) || anvil()[0]
: validations().map(v => v.c).filter(c => c.id !== state.pending).at(-1);
function homeCopy() {
const last = restChampion();
const count = completedCount() - (state.pending ? 1 : 0);
return `<div class="copy"><span class="kicker">${SEASON.name}</span>
<h1 class="title"><span class="count">${count}</span> / ${total()} champions validés</h1>
<div class="lines"><p class="line" data-line="validated">${last ? `Dernier champion validé : <b>${esc(last.name)}</b>, le ${day(firstTop1(last))}` : "Aucun champion validé pour l'instant."}</p>
<p class="line" data-line="match">${lastMatchLine()}</p></div></div>`;
}
function stageCopy() {
const open = anvil().filter(c => pickable(c) && !isCompleted(c)).length;
return `<div class="copy"><span class="kicker">${SEASON.name} · ${completedCount()} / ${total()} validés</span>
<h1 class="title stage-title ${reduced ? "" : "in"}">Sélection des champions</h1>
<p class="stage-sub">Champions de l'Enclume · <b data-open>${open}</b> à valider et disponibles</p></div>`;
}
// Une fenêtre d'environ 80 % de la largeur du splash, centrée sur le champion et bornée à ses bords.
function frameArt(img, c) {
const box = img.parentElement.getBoundingClientRect();
if (!box.width) return;
const scale = Math.max(box.width / (SPLASH.w * .8), box.height / SPLASH.h);
const w = SPLASH.w * scale, h = SPLASH.h * scale;
const clamp = (v, lo) => Math.min(0, Math.max(lo, v));
Object.assign(img.style, {
width: `${w}px`, height: `${h}px`,
left: `${clamp(box.width / 2 - c.fx / 100 * w, box.width - w)}px`,
top: `${clamp(box.height / 2 - c.fy / 100 * h, box.height - h)}px`,
});
}
let token = 0;
function paint(c, { instant = false, settle = false } = {}) {
const imgs = [...document.querySelectorAll(".banner .art")];
if (!imgs.length || !c) return;
const front = imgs.find(i => i.classList.contains("on"));
if (front && front.dataset.id === String(c.id)) return;
const back = imgs.find(i => i !== front);
const mine = ++token;
back.dataset.id = c.id;
back.classList.remove("settle");
frameArt(back, c);
back.onload = () => {
if (mine !== token) return;
if (instant) back.style.transition = "none";
if (settle && !reduced) back.classList.add("settle");
back.classList.add("on");
front?.classList.remove("on");
if (instant) requestAnimationFrame(() => { back.style.transition = ""; });
};
back.src = `${DDRAGON}/splash/${c.key}_0.jpg`;
}
addEventListener("resize", () => document.querySelectorAll(".banner .art").forEach(img => img.dataset.id && frameArt(img, find(Number(img.dataset.id)))));
// ---- Écrans. ----
const host = $("screen");
function visible() {
const q = norm(state.query);
const keep = c => (state.filter === "all" || (state.filter === "done") === isCompleted(c)) && norm(c.name).includes(q);
const list = state.champions.filter(keep);
return state.sort === "name" ? byName(list) : byMastery(list);
}
function grid() {
const list = visible();
host.querySelector(".n").textContent = list.length;
host.querySelector("#grid").innerHTML = list.map(c => card(c)).join("") || `<p class="empty">Aucun champion trouvé.</p>`;
}
function home() {
host.innerHTML = `<section class="banner">${ART}${ring()}${homeCopy()}</section>
<div class="tools"><h2>Champions <span class="n"></span></h2>
<div class="tabs" role="group" aria-label="Filtrer les champions">${[["all", "Tous"], ["todo", "Restants"], ["done", "Validés"]].map(([k, l]) => `<button type="button" data-filter="${k}" aria-pressed="${state.filter === k}">${l}</button>`).join("")}</div>
<label class="sort">Trier <select id="sort"><option value="mastery" ${state.sort === "mastery" ? "selected" : ""}>Points de maîtrise</option><option value="name" ${state.sort === "name" ? "selected" : ""}>A–Z</option></select></label>
<input class="search" id="search" type="search" placeholder="Rechercher…" aria-label="Rechercher un champion" value="${esc(state.query)}"></div>
<div class="cards" id="grid"></div>`;
host.querySelectorAll("[data-filter]").forEach(b => b.onclick = () => {
state.filter = b.dataset.filter;
host.querySelectorAll("[data-filter]").forEach(x => x.setAttribute("aria-pressed", String(x === b)));
grid();
});
host.querySelector("#sort").onchange = e => { state.sort = e.target.value; grid(); };
host.querySelector("#search").oninput = e => { state.query = e.target.value; grid(); };
grid();
}
function stage() {
host.innerHTML = `<section class="stage" aria-label="Sélection des champions">
${reduced ? "" : `<div class="sweep" aria-hidden="true"></div>`}
<div class="banner">${ART}${ring()}${stageCopy()}</div>
<div class="hand">${anvil().map((c, i) => card(c, { lazy: false, deal: i })).join("")}</div>
<details class="others"><summary>Autres champions <span class="count-n">${others().length}</span></summary><div class="others-body"></div></details></section>`;
host.querySelector(".sweep")?.addEventListener("animationend", e => e.target.remove());
// Une fois distribuée, la carte perd son animation d'entrée, sinon son état final bloquerait la montée au survol.
host.querySelector(".hand").addEventListener("animationend", e => {
if (e.animationName === "deal") { e.target.classList.remove("deal"); e.target.style.animationDelay = ""; }
});
const fold = host.querySelector(".others");
fold.addEventListener("toggle", () => {
const body = fold.querySelector(".others-body");
if (!fold.open) { body.replaceChildren(); return; }
body.innerHTML = `<input class="search" type="search" placeholder="Rechercher…" aria-label="Rechercher parmi les autres champions"><div class="cards"></div>`;
const fill = q => { body.querySelector(".cards").innerHTML = others().filter(c => norm(c.name).includes(norm(q))).map(c => card(c)).join("") || `<p class="empty">Aucun champion trouvé.</p>`; };
body.querySelector("input").oninput = e => fill(e.target.value);
fill("");
});
}
function stats() {
const v = validations();
const perDay = Array.from({ length: SEASON.days }, (_, d) => v.filter(x => x.day <= d).length);
const W = 640, H = 170, L = 34, B = 24, T = 10, R = 12;
const max = Math.max(10, Math.ceil(completedCount() / 10) * 10);
const x = d => L + d / (SEASON.days - 1) * (W - L - R), y = n => T + (1 - n / max) * (H - T - B);
const line = perDay.map((n, d) => `${d ? "L" : "M"}${x(d).toFixed(1)} ${y(n).toFixed(1)}`).join(" ");
const end = perDay.at(-1);
const curve = `<svg viewBox="0 0 ${W} ${H}" role="img" aria-label="Champions validés au fil de la Saison : ${end} aujourd'hui">
${[0, max / 2, max].map(n => `<line class="grid-line" x1="${L}" x2="${W - R}" y1="${y(n)}" y2="${y(n)}"/><text x="${L - 8}" y="${y(n) + 4}" text-anchor="end">${n}</text>`).join("")}
${[0, Math.round((SEASON.days - 1) / 2), SEASON.days - 1].map((d, i) => `<text x="${x(d)}" y="${H - 6}" text-anchor="${["start", "middle", "end"][i]}">${day(d)}</text>`).join("")}
<path class="curve-area" d="${line} L${x(SEASON.days - 1)} ${y(0)} L${x(0)} ${y(0)} Z"/><path class="curve" d="${line}"/>
<circle cx="${x(SEASON.days - 1)}" cy="${y(end)}" r="4.5" fill="var(--gold)" stroke="var(--surface)" stroke-width="2"/>
<text class="value" x="${x(SEASON.days - 1) - 10}" y="${y(end) - 10}" text-anchor="end">${end}</text>
${perDay.map((n, d) => `<rect class="hit" x="${(x(d) - 4).toFixed(1)}" y="${T}" width="8" height="${H - T - B}"><title>${day(d)} · ${n} validés</title></rect>`).join("")}</svg>`;
const bars = (counts, labels, caption) => {
const BW = 300, BH = 140, top = Math.max(...counts, 1), slot = BW / counts.length;
return `<svg viewBox="0 0 ${BW} ${BH + 20}" role="img" aria-label="${caption}"><line class="grid-line" x1="0" x2="${BW}" y1="${BH}" y2="${BH}"/>${counts.map((n, i) => {
const h = Math.max(n ? 3 : 0, n / top * (BH - 22)), bx = i * slot + slot * .2, bw = slot * .6;
return `<path class="bar ${i === 0 ? "lead" : ""}" d="M${bx} ${BH} V${BH - h + 4} q0 -4 4 -4 h${bw - 8} q4 0 4 4 V${BH} Z"><title>${labels[i]} · ${n}</title></path>
<text x="${bx + bw / 2}" y="${BH + 15}" text-anchor="middle">${labels[i]}</text>${i === 0 ? `<text class="value" x="${bx + bw / 2}" y="${BH - h - 6}" text-anchor="middle">${n}</text>` : ""}`;
}).join("")}</svg>`;
};
const placements = [1, 2, 3, 4, 5, 6].map(p => state.champions.reduce((s, c) => s + c.matches.filter(m => m.p === p).length, 0));
const tries = [1, 2, 3, 4, 5].map(k => v.filter(e => k < 5 ? attempts(e.c) === k : attempts(e.c) >= 5).length);
host.innerHTML = `<section class="stats"><div class="stats-head"><div><h1>Statistiques</h1><p>${SEASON.name} · tous les Formats</p></div><p>${completedCount()} / ${total()} champions validés</p></div>
<div class="stats-grid"><article class="panel wide"><h2>Courbe des validations</h2><p>Champions validés, cumulés jour après jour.</p>${curve}</article>
<article class="panel"><h2>Placements</h2><p>Toutes les Parties de la Saison.</p>${bars(placements, ["1ᵉʳ", "2ᵉ", "3ᵉ", "4ᵉ", "5ᵉ", "6ᵉ"], "Parties par Placement")}</article>
<article class="panel"><h2>Tentatives</h2><p>Parties jouées jusqu'au premier top 1.</p>${bars(tries, ["1", "2", "3", "4", "5+"], "Champions validés par nombre de Tentatives")}</article></div></section>`;
}
function fill() {
cancelAnimationFrame(raf);
state.pending = null;
if (state.screen === "stats") return stats();
state.selection ? stage() : home();
paint(restChampion(), { instant: true });
}
function renderTop() {
const sel = state.selection;
$("top").innerHTML = `<span class="brand">${LOGO}Arena Tracker</span>
<nav class="nav" aria-label="Navigation"><button type="button" data-screen="defi" ${state.screen === "defi" ? 'aria-current="page"' : ""}>Défi</button>
<button type="button" data-screen="stats" ${state.screen === "stats" ? 'aria-current="page"' : ""} ${sel ? "disabled" : ""}>Statistiques</button></nav>`;
$("top").querySelectorAll("[data-screen]").forEach(b => b.onclick = () => go(b.dataset.screen));
}
// Changement d'écran : court, dans le sens du trajet ; la barre du haut ne bouge pas.
let swapSeq = 0;
async function swap(fn, kind) {
const seq = ++swapSeq;
host.getAnimations?.().forEach(a => a.cancel());
if (reduced || !host.animate) return fn();
if (kind === "stage-out") {
host.querySelectorAll(".hand .card").forEach((c, i, all) => { c.classList.remove("deal"); c.style.transitionDelay = `${(all.length - 1 - i) * 35}ms`; c.classList.add("leave"); });
await wait(240);
if (seq !== swapSeq) return;
}
const out = { forward: "translateX(-14px)", back: "translateX(14px)", "stage-in": "translateY(-6px)", "stage-out": "translateY(16px)" }[kind];
await host.animate([{ opacity: 1, transform: "none" }, { opacity: 0, transform: out }], { duration: 130, easing: "ease-in", fill: "forwards" }).finished.catch(() => {});
if (seq !== swapSeq) return;
fn();
host.getAnimations().forEach(a => a.cancel());
const from = { forward: "translateX(18px)", back: "translateX(-18px)", "stage-out": "translateY(10px)" }[kind];
if (from) host.animate([{ opacity: 0, transform: from }, { opacity: 1, transform: "none" }], { duration: 280, easing: "cubic-bezier(.2,.8,.2,1)" });
}
function go(name) {
if (name === state.screen || (name === "stats" && state.selection)) return;
state.screen = name;
renderTop();
swap(fill, name === "stats" ? "forward" : "back");
}
// ---- Survol : la graduation du champion s'allume ; en sélection la bannière le montre. ----
let hovered = null;
function hover(id) {
if (id === hovered) return;
hovered = id;
host.querySelectorAll(".tick.lit").forEach(t => t.classList.remove("lit"));
if (id) host.querySelector(`.tick[data-tick="${id}"]`)?.classList.add("lit");
if (state.selection && state.screen === "defi") paint(id ? find(id) : restChampion());
}
const idOf = t => { const el = t?.closest?.("[data-id]"); return el && host.contains(el) ? Number(el.dataset.id) : null; };
host.addEventListener("pointerover", e => hover(idOf(e.target)));
host.addEventListener("pointerleave", () => hover(null));
host.addEventListener("focusin", e => hover(idOf(e.target)));
host.addEventListener("focusout", e => hover(host.contains(e.relatedTarget) ? idOf(e.relatedTarget) : null));
// ---- Fin d'une Partie suivie en direct : une animation à la mesure de ce qu'elle apporte. ----
let raf = 0;
function redrawRing() {
const old = host.querySelector(".ring");
old.insertAdjacentHTML("afterend", ring());
old.remove();
return host.querySelector(".ring svg");
}
function refreshCard(c, appear) {
const el = host.querySelector(`#grid .card[data-id="${c.id}"]`);
if (el) el.outerHTML = card(c, { appear });
return host.querySelector(`#grid .card[data-id="${c.id}"]`);
}
function matchEnded(c, kind, gained) {
if (state.screen !== "defi" || state.selection) { if (state.screen === "stats") stats(); return; }
hover(null);
if (kind === "top1") return comet(c);
const svg = redrawRing();
const tick = svg.querySelector(`.tick[data-tick="${c.id}"]`);
tick.classList.add(kind === "mark" ? "step" : "blink");
const lineEl = host.querySelector('[data-line="match"]');
lineEl.innerHTML = lastMatchLine();
lineEl.classList.remove("fresh"); void lineEl.offsetWidth; lineEl.classList.add("fresh");
const el = refreshCard(c);
for (const m of gained) el?.querySelector(`[data-mark="${m}"]`)?.classList.add("fresh");
}
// Top 1 : la comète part de midi jusqu'à la graduation, puis la bannière change de champion.
function comet(c) {
cancelAnimationFrame(raf);
state.pending = c.id;
const svg = redrawRing();
const list = ringOrder(), n = list.length, index = list.findIndex(x => x.id === c.id);
const finish = () => {
if (state.pending !== c.id) return;
state.pending = null;
const a = angleOf(index, n), [x1, y1] = at(a, R1), [x2, y2] = at(a, R2);
const tick = svg.querySelector(`.tick[data-tick="${c.id}"]`);
tick.setAttribute("class", "tick done ignite");
tick.setAttribute("x1", x1); tick.setAttribute("y1", y1); tick.setAttribute("x2", x2); tick.setAttribute("y2", y2);
if (!reduced) svg.querySelector(".crown").classList.add("bounce");
host.querySelector(".copy").outerHTML = homeCopy();
if (!reduced) host.querySelector(".count").classList.add("roll");
host.querySelectorAll(".line").forEach(l => l.classList.add("fresh"));
paint(c, { settle: true });
refreshCard(c, "Validé");
};
if (reduced) return finish();
const dot = svg.querySelector(".comet"), trail = svg.querySelector(".trail");
const start = angleOf(0, n) - Math.PI / n, end = angleOf(index, n), r = (R1 + R2) / 2;
const t0 = performance.now(), duration = 650 + 550 * (index / n);
const ease = t => 1 - Math.pow(1 - t, 3);
function fly(now) {
const t = Math.min(1, (now - t0) / duration), a = start + (end - start) * ease(t);
const [x, y] = at(a, r);
dot.setAttribute("cx", x); dot.setAttribute("cy", y); dot.setAttribute("opacity", "1");
const [sx, sy] = at(Math.max(start, a - .9), r);
trail.setAttribute("d", `M ${sx} ${sy} A ${r} ${r} 0 0 1 ${x} ${y}`);
trail.setAttribute("opacity", String(.85 * (1 - t * .6)));
if (t < 1) raf = requestAnimationFrame(fly);
else { dot.setAttribute("opacity", "0"); trail.setAttribute("opacity", "0"); raf = 0; finish(); }
}
raf = requestAnimationFrame(fly);
}
function playMatch(forceTop1) {
const pool = state.champions.filter(c => forceTop1 ? isPlayed(c) && !isCompleted(c) : true);
const c = pool[Math.floor(Math.random() * pool.length)];
if (!c) return;
const p = forceTop1 ? 1 : placementOf(Math.random());
const was = { played: isPlayed(c), win: hasWin(c), completed: isCompleted(c) };
c.matches.push({ p, day: TODAY, seq: ++state.seq });
const gained = [!was.played && "played", !was.win && p <= 3 && "win"].filter(Boolean);
const kind = !was.completed && p === 1 ? "top1" : gained.length ? "mark" : "match";
matchEnded(c, kind, gained);
}
// ---- Démo. ----
let allyTimer = 0;
function toggleSelection() {
clearTimeout(allyTimer);
const from = state.screen;
state.selection = !state.selection;
state.allyTaken = false;
state.screen = "defi";
$("demo-select").setAttribute("aria-pressed", String(state.selection));
renderTop();
// Une sélection ouvre toujours « Défi », même depuis « Statistiques ».
swap(fill, state.selection ? "stage-in" : from === "stats" ? "back" : "stage-out");
if (state.selection) allyTimer = setTimeout(() => {
state.allyTaken = true;
const c = anvil().find(x => x.later);
const el = host.querySelector(`.hand .card[data-id="${c.id}"]`);
if (!el) return;
el.querySelector(".reasons").insertAdjacentHTML("beforeend", `<span class="reason ban appear">${esc(c.ban)}</span>`);
el.classList.add("dim", "taken");
const open = host.querySelector("[data-open]");
if (open) open.textContent = anvil().filter(x => pickable(x) && !isCompleted(x)).length;
if (!hovered) paint(restChampion());
}, 2600);
}
const root = document.documentElement;
const themeLabel = () => { $("demo-theme").textContent = root.dataset.mode === "light" ? "Thème sombre" : "Thème clair"; };
$("demo-theme").onclick = () => { root.dataset.mode = root.dataset.mode === "light" ? "dark" : "light"; themeLabel(); };
if (matchMedia("(prefers-color-scheme: light)").matches) root.dataset.mode = "light";
themeLabel();
$("demo-match").onclick = () => playMatch(false);
$("demo-top1").onclick = () => playMatch(true);
$("demo-select").onclick = toggleSelection;
$("demo-reset").onclick = () => {
clearTimeout(allyTimer);
Object.assign(state, { champions: generate(), seq: 0, selection: false, allyTaken: false, screen: "defi", query: "", filter: "all", pending: null });
$("demo-select").setAttribute("aria-pressed", "false");
renderTop();
fill();
};
window.AT = { state, playMatch, toggleSelection, go, lastMatchLine };
renderTop();
fill();
})();
</script>
</body>
</html>