/* Lumins Arène : interface franche et saturée, contours épais, boutons « en relief ». Distincte de Lumins (verre clair). */
:root {
  --ink: #1d1236;
  --night: #2b1d5c;
  --night2: #3d2a7a;
  --gold: #ffc93c;
  --gold2: #ff9f1c;
  --blue: #2f8cff;
  --blue2: #1a5fd6;
  --red: #ff4d5e;
  --red2: #d62839;
  --mint: #3ddc97;
  --gem: #c77dff;
  --cream: #fff6e5;
  --display: 'Titan One', system-ui, sans-serif;
  --body: 'Fredoka', system-ui, sans-serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; }
html, body {
  margin: 0; height: 100%; overflow: hidden; background: var(--night); color: #fff;
  font-family: var(--body); font-weight: 600; -webkit-user-select: none; user-select: none;
  touch-action: none; -webkit-tap-highlight-color: transparent; -webkit-touch-callout: none; overscroll-behavior: none;
}
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }
canvas#gl, canvas#overlay { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
canvas#overlay { pointer-events: none; }
.screen { position: fixed; inset: 0; display: flex; flex-direction: column; }
.hidden { display: none !important; }
.outline { text-shadow: 0 3px 0 var(--ink), 2px 0 0 var(--ink), -2px 0 0 var(--ink), 0 -2px 0 var(--ink); }

/* ---------- Accueil ---------- */
#home { padding: calc(var(--safe-top) + 12px) 16px calc(var(--safe-bottom) + 16px); pointer-events: none; }
#home > * { pointer-events: auto; }
.topbar { display: flex; justify-content: space-between; align-items: center; }
.chip {
  display: flex; align-items: center; gap: 8px; padding: 6px 14px 6px 6px; border-radius: 14px;
  background: rgba(29, 18, 54, .72); border: 3px solid var(--ink); box-shadow: 0 4px 0 var(--ink);
}
.chip b { font-family: var(--display); font-weight: 400; font-size: 16px; letter-spacing: .02em; }
.avatar { width: 38px; height: 38px; border-radius: 10px; overflow: hidden; background: #5a3f9e; border: 2px solid var(--ink); }
.avatar img { width: 100%; height: 100%; object-fit: cover; transform: scale(1.25) translateY(6%); }
.ico { display: inline-block; vertical-align: -3px; flex: none; }
.ico svg { width: 100%; height: 100%; display: block; }
.chip .ico { width: 24px; height: 24px; }
.trophies { padding-left: 12px; }
.hero { margin-top: auto; text-align: left; max-width: 420px; }
.role {
  display: inline-block; font-family: var(--display); font-size: 13px; padding: 4px 10px; border-radius: 8px;
  background: var(--gold); color: var(--ink); border: 2px solid var(--ink); transform: rotate(-2deg);
}
.hero h1 { font-family: var(--display); font-weight: 400; font-size: 44px; margin: 6px 0 2px; line-height: 1;
  text-shadow: 0 4px 0 var(--ink), 3px 0 0 var(--ink), -3px 0 0 var(--ink), 0 -3px 0 var(--ink); }
.hero p { margin: 4px 0 10px; font-size: 15px; color: var(--cream); text-shadow: 0 2px 0 rgba(0,0,0,.4); }
.kit { display: flex; gap: 8px; }
.kit div { flex: 1; background: rgba(29, 18, 54, .72); border: 2px solid var(--ink); border-radius: 10px; padding: 6px 8px; }
.kit small { display: block; font-size: 11px; color: #c9b8ff; }
.kit b { font-size: 13px; }
.roster { display: flex; gap: 8px; overflow-x: auto; padding: 14px 2px 6px; scrollbar-width: none; touch-action: pan-x; }
.roster::-webkit-scrollbar { display: none; }
.card {
  flex: 0 0 78px; height: 104px; border-radius: 12px; border: 3px solid var(--ink); position: relative; overflow: hidden;
  display: flex; flex-direction: column; justify-content: flex-end; box-shadow: 0 4px 0 var(--ink);
  background: var(--el);
}
.card img { position: absolute; inset: -4px -4px 26px; width: calc(100% + 8px); height: calc(100% - 22px); object-fit: cover; object-position: 50% 30%; }
.card b, .card small { position: relative; display: flex; align-items: center; justify-content: center; gap: 3px; background: var(--ink); }
.card b { font-family: var(--display); font-weight: 400; font-size: 11px; padding-top: 3px; }
.card small { font-size: 11px; padding-bottom: 4px; color: #ffe08a; }
.card.on { transform: translateY(-5px); border-color: #fff; box-shadow: 0 5px 0 var(--ink), 0 0 0 3px var(--gold); }
.mode { margin-top: 8px; text-align: center; font-size: 13px; color: #d9ccff; }
.mode b { display: block; font-family: var(--display); font-weight: 400; font-size: 16px; color: #fff; }
.play {
  margin-top: 10px; height: 64px; border-radius: 18px; font-family: var(--display); font-size: 28px; letter-spacing: .04em;
  color: var(--ink); background: linear-gradient(180deg, #ffe066, var(--gold) 55%, var(--gold2));
  border: 3px solid var(--ink); box-shadow: 0 6px 0 var(--ink), inset 0 -5px 0 rgba(0,0,0,.12);
}
.play:active { transform: translateY(4px); box-shadow: 0 2px 0 var(--ink); }
.play.small { height: 52px; font-size: 20px; flex: 1; }
.ghost { height: 48px; padding: 0 22px; border-radius: 14px; background: rgba(255,255,255,.12); border: 3px solid var(--ink); font-family: var(--display); font-size: 16px; box-shadow: 0 4px 0 var(--ink); }

/* ---------- File d'attente ---------- */
#queue { align-items: center; justify-content: center; background: rgba(29, 18, 54, .55); }
.queue-card { text-align: center; background: var(--night2); border: 3px solid var(--ink); border-radius: 20px; padding: 24px 22px; box-shadow: 0 6px 0 var(--ink); width: min(320px, 86vw); }
.queue-card h2 { font-family: var(--display); font-weight: 400; margin: 12px 0 6px; }
.queue-card p { margin: 0 0 16px; color: #d9ccff; font-size: 14px; }
.spinner { width: 54px; height: 54px; margin: 0 auto; border-radius: 50%; border: 6px solid rgba(255,255,255,.15); border-top-color: var(--gold); animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Partie ---------- */
#hud { pointer-events: none; }
.score { position: absolute; top: calc(var(--safe-top) + 8px); left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 6px; }
.team { display: flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 12px; border: 3px solid var(--ink); box-shadow: 0 3px 0 var(--ink); }
.team b { font-family: var(--display); font-weight: 400; font-size: 22px; min-width: 24px; text-align: center; text-shadow: 0 2px 0 var(--ink); }
.team.blue { background: var(--blue); }
.team.red { background: var(--red); }
.gem { width: 16px; height: 20px; background: linear-gradient(160deg, #f3d9ff, var(--gem) 50%, #7b2cbf); clip-path: polygon(50% 0, 100% 35%, 50% 100%, 0 35%); }
.clock { font-family: var(--display); font-size: 18px; padding: 4px 10px; border-radius: 10px; background: rgba(29,18,54,.8); border: 3px solid var(--ink); }
.banner {
  position: absolute; top: calc(var(--safe-top) + 62px); left: 50%; transform: translateX(-50%); white-space: nowrap;
  font-family: var(--display); font-size: 20px; padding: 6px 16px; border-radius: 12px; border: 3px solid var(--ink); box-shadow: 0 3px 0 var(--ink);
}
.banner.blue { background: var(--blue); } .banner.red { background: var(--red); }
.respawn { position: absolute; top: 42%; left: 50%; transform: translate(-50%, -50%); text-align: center; font-family: var(--display); font-size: 26px; text-shadow: 0 3px 0 var(--ink); }
.stick { position: absolute; width: 120px; height: 120px; border-radius: 50%; pointer-events: auto; }
.stick .knob { position: absolute; left: 50%; top: 50%; width: 54px; height: 54px; margin: -27px 0 0 -27px; border-radius: 50%; border: 3px solid var(--ink); display: grid; place-items: center; font-family: var(--display); font-size: 22px; }
.stick.move { left: 0; bottom: 0; width: 50vw; height: 55vh; border-radius: 0; }
.stick.move .knob { opacity: 0; background: rgba(255,255,255,.35); }
.stick.move .base { position: absolute; width: 120px; height: 120px; margin: -60px 0 0 -60px; border-radius: 50%; border: 3px solid rgba(255,255,255,.35); background: rgba(29,18,54,.25); }
.stick.attack { right: calc(18px + env(safe-area-inset-right, 0px)); bottom: calc(var(--safe-bottom) + 26px); background: rgba(255, 77, 94, .22); border: 3px solid rgba(255,255,255,.3); }
.stick.attack .knob { background: var(--red); box-shadow: 0 3px 0 var(--ink); }
.stick.super { right: calc(150px + env(safe-area-inset-right, 0px)); bottom: calc(var(--safe-bottom) + 30px); width: 84px; height: 84px; }
.stick.super .knob { width: 50px; height: 50px; margin: -25px 0 0 -25px; background: #6c5a99; color: #b9aedb; }
.stick.super.ready .knob { background: var(--gold); color: var(--ink); box-shadow: 0 0 18px var(--gold); }
.stick.super svg { position: absolute; inset: 0; transform: rotate(-90deg); }
.ring-bg { fill: rgba(29,18,54,.4); stroke: rgba(255,255,255,.18); stroke-width: 7; }
.ring { fill: none; stroke: var(--gold); stroke-width: 7; stroke-linecap: round; stroke-dasharray: 276.5; stroke-dashoffset: 276.5; }
.net { position: absolute; top: calc(var(--safe-top) + 10px); right: 10px; font-size: 11px; opacity: .6; }

/* ---------- Fin ---------- */
#end { align-items: center; justify-content: center; gap: 14px; padding: calc(var(--safe-top) + 20px) 16px calc(var(--safe-bottom) + 20px); background: rgba(29, 18, 54, .55); }
#end h1 { font-family: var(--display); font-weight: 400; font-size: 52px; margin: 0; text-shadow: 0 5px 0 var(--ink), 3px 0 0 var(--ink), -3px 0 0 var(--ink), 0 -3px 0 var(--ink); }
#end h1.win { color: var(--gold); } #end h1.loss { color: #c9b8ff; }
.end-trophies { font-family: var(--display); font-size: 22px; display: flex; align-items: center; gap: 8px; }
.end-teams { display: flex; flex-direction: column; gap: 8px; width: min(420px, 100%); }
.end-row { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 12px; border: 3px solid var(--ink); font-size: 14px; }
.end-row.t0 { background: rgba(47, 140, 255, .85); } .end-row.t1 { background: rgba(255, 77, 94, .85); }
.end-row.me { outline: 3px solid var(--gold); }
.end-row img { width: 36px; height: 36px; border-radius: 8px; background: rgba(29,18,54,.35); object-fit: cover; object-position: 50% 30%; border: 2px solid var(--ink); }
.end-row b { flex: 1; display: flex; align-items: center; gap: 6px; font-family: var(--display); font-weight: 400; }
.end-row span { display: flex; align-items: center; gap: 3px; min-width: 38px; font-family: var(--display); font-size: 14px; }
.end-actions { display: flex; gap: 10px; width: min(420px, 100%); }
.toast { position: fixed; left: 50%; bottom: calc(var(--safe-bottom) + 110px); transform: translateX(-50%); background: var(--ink); padding: 10px 16px; border-radius: 12px; font-size: 14px; max-width: 86vw; text-align: center; z-index: 10; }
/* souris : le joystick de déplacement ne capte pas les clics (ZQSD/WASD à la place) */
@media (hover: hover) and (pointer: fine) { .stick.move { pointer-events: none; } }
.hurt { position: absolute; inset: 0; opacity: 0; pointer-events: none; transition: opacity .25s; background: radial-gradient(ellipse at center, transparent 55%, rgba(214, 40, 57, .55)); }
.top-right { display: flex; gap: 8px; }
.icon-btn { padding: 6px; }
.icon-btn .ico { width: 26px; height: 26px; }

/* ---------- Progression ---------- */
.who { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.05; }
.who small { font-size: 11px; color: #ffe08a; font-weight: 600; }
.card.locked img { filter: grayscale(1) brightness(.55); }
.card.locked { background: #4b3f6b; }
.card .lock { position: absolute; top: 6px; right: 6px; width: 22px; height: 22px; }
.play:disabled { filter: grayscale(.8); opacity: .75; }
#road { background: var(--night); padding: calc(var(--safe-top) + 10px) 16px calc(var(--safe-bottom) + 10px); }
.road-head { display: flex; align-items: center; gap: 12px; }
.road-head h2 { font-family: var(--display); font-weight: 400; margin: 0; font-size: 22px; }
.road-head p { margin: 2px 0 0; font-size: 13px; color: #d9ccff; }
.back { height: 40px; padding: 0 14px; font-size: 14px; }
.road-list { flex: 1; overflow-y: auto; touch-action: pan-y; margin-top: 12px; padding: 10px 0 30px; position: relative; display: flex; flex-direction: column-reverse; gap: 10px; }
.step { display: flex; align-items: center; gap: 12px; padding: 8px 12px; border-radius: 14px; border: 3px solid var(--ink); background: #3d2a7a; box-shadow: 0 3px 0 var(--ink); position: relative; }
.step .at { font-family: var(--display); font-size: 16px; min-width: 64px; display: flex; align-items: center; gap: 4px; }
.step img { width: 50px; height: 50px; border-radius: 10px; border: 2px solid var(--ink); background: rgba(0,0,0,.25); object-fit: cover; object-position: 50% 30%; }
.step .badge { width: 50px; height: 50px; display: grid; place-items: center; }
.step .badge .ico { width: 38px; height: 38px; }
.step b { font-family: var(--display); font-weight: 400; font-size: 15px; display: block; }
.step span { font-size: 12px; color: #d9ccff; }
.step.done { background: #2a6e5a; }
.step.next { background: #5a3f9e; outline: 3px solid var(--gold); }
.step.todo img { filter: grayscale(1) brightness(.6); }
.bar { height: 8px; border-radius: 4px; background: rgba(0,0,0,.35); margin-top: 6px; overflow: hidden; border: 2px solid var(--ink); }
.bar i { display: block; height: 100%; background: var(--gold); }
#reward { align-items: center; justify-content: center; background: rgba(29,18,54,.8); z-index: 5; }
.reward-card { text-align: center; background: var(--night2); border: 3px solid var(--ink); border-radius: 22px; padding: 22px; width: min(320px, 86vw); box-shadow: 0 6px 0 var(--ink); animation: pop .45s cubic-bezier(.2,1.6,.4,1); }
.reward-card small { font-family: var(--display); color: var(--gold); font-size: 15px; letter-spacing: .03em; }
.reward-card img { width: 170px; height: 170px; display: block; margin: 8px auto; object-fit: cover; object-position: 50% 30%; filter: drop-shadow(0 6px 0 rgba(0,0,0,.3)); }
.reward-card h2 { font-family: var(--display); font-weight: 400; font-size: 32px; margin: 4px 0; text-shadow: 0 3px 0 var(--ink); }
.reward-card p { color: #d9ccff; margin: 0 0 14px; font-size: 14px; }
@keyframes pop { from { transform: scale(.5); opacity: 0; } to { transform: scale(1); opacity: 1; } }
