:root {
  --beton: #25272b;
  --beton2: #3a3d42;
  --jaune: #ffd400;
  --bleu: #2a4fa8;
  --orange: #ff7a1a;
  --rouge: #ff4b4b;
  --blanc: #f4f4f0;
  --font: "Arial Black", "Arial Bold", Impact, system-ui, sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; height: 100%; overflow: hidden; background: var(--beton);
  color: var(--blanc); font-family: var(--font);
  overscroll-behavior: none; user-select: none; -webkit-user-select: none;
  touch-action: none;
}
canvas { display: block; position: fixed; inset: 0; width: 100vw; height: 100vh; touch-action: none; }
.hidden { display: none !important; }
button { font-family: var(--font); cursor: pointer; touch-action: manipulation; }

/* ---------- HUD ---------- */
#hud { position: fixed; inset: 0; pointer-events: none; }
#xpbar {
  position: absolute; top: env(safe-area-inset-top, 0); left: 0; right: 0; height: 16px;
  background: #111; border-bottom: 2px solid #000;
}
#xpfill { height: 100%; width: 0; background: linear-gradient(#5fd0ff, #2a8fd8); transition: width .1s; }
#lvl { position: absolute; right: 8px; top: 0; font-size: 11px; line-height: 16px; text-shadow: 1px 1px 0 #000; }
#topline {
  position: absolute; top: calc(env(safe-area-inset-top, 0px) + 20px); left: 10px; right: 10px;
  display: flex; align-items: center; justify-content: space-between;
}
#timer { font-size: 26px; text-shadow: 2px 2px 0 #000; position: absolute; left: 50%; transform: translateX(-50%); }
#kills { font-size: 13px; text-shadow: 1px 1px 0 #000; }
#kills b { color: var(--jaune); font-size: 18px; }
#btnPause {
  pointer-events: auto; width: 38px; height: 38px; border-radius: 8px; border: 2px solid #000;
  background: rgba(0,0,0,.45); color: #fff; font-size: 14px; margin-left: auto;
}
#combo {
  position: absolute; top: calc(env(safe-area-inset-top, 0px) + 56px); left: 0; right: 0; text-align: center;
  font-size: 16px; color: var(--orange); text-shadow: 2px 2px 0 #000; opacity: 0; transition: opacity .2s;
}
#combo.on { opacity: 1; }
#bossbar {
  position: absolute; top: calc(env(safe-area-inset-top, 0px) + 104px); left: 50%; transform: translateX(-50%);
  width: min(420px, 80vw); height: 14px; background: #200; border: 2px solid #000; border-radius: 3px;
}
#bossfill { height: 100%; background: linear-gradient(#ff5050, #b00000); width: 100%; }
#bossname { position: absolute; top: -17px; left: 0; right: 0; text-align: center; font-size: 12px; text-shadow: 1px 1px 0 #000; color: #ffb3b3; }
#owned {
  position: absolute; top: calc(env(safe-area-inset-top, 0px) + 62px); left: 8px;
  display: flex; flex-direction: column; gap: 2px; font-size: 14px;
}
#owned span { display: block; line-height: 18px; text-shadow: 1px 1px 0 #000; font-family: system-ui, sans-serif; }
#owned span i { font-style: normal; font-family: var(--font); font-size: 9px; color: var(--jaune); vertical-align: top; }
#banner {
  position: absolute; top: 34%; left: 0; right: 0; text-align: center; font-size: clamp(20px, 5.5vw, 40px); line-height: 1.1;
  color: var(--jaune); text-shadow: 3px 3px 0 #000, -1px -1px 0 #000; opacity: 0; transform: scale(.6);
  padding: 0 12px;
}
#banner.show { animation: bannerIn 2.2s ease-out forwards; }
#banner.red { color: var(--rouge); }
#banner.boss { color: #ff7bd0; }
#banner.night { color: #9fb6ff; }
@keyframes bannerIn {
  0% { opacity: 0; transform: scale(1.8); }
  12% { opacity: 1; transform: scale(1); }
  80% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(.95) translateY(-20px); }
}

/* ---------- Screens ---------- */
.screen {
  position: fixed; inset: 0; display: flex; align-items: flex-start; justify-content: center;
  background: rgba(18, 19, 22, .82); overflow-y: auto; touch-action: pan-y;
  padding: calc(env(safe-area-inset-top, 0px) + 18px) 16px calc(env(safe-area-inset-bottom, 0px) + 24px);
}
#menu { background: linear-gradient(rgba(18,19,22,.55), rgba(18,19,22,.9)); }
.inner { width: 100%; max-width: 520px; margin: auto 0; text-align: center; }
.logo { margin: 8px 0 4px; line-height: .9; transform: rotate(-3deg); }
.logo span { display: block; font-size: clamp(30px, 10vw, 54px); text-shadow: 4px 4px 0 #000; letter-spacing: -1px; }
.logo .y { color: var(--jaune); font-size: clamp(36px, 12.5vw, 68px); }
.tag { margin: 10px 0 18px; color: #c9c9c2; font-size: 14px; font-family: system-ui, sans-serif; font-weight: 700; }
h2 { font-size: clamp(28px, 8vw, 44px); margin: 6px 0; color: var(--jaune); text-shadow: 3px 3px 0 #000; }
.big {
  display: block; width: 100%; margin: 10px 0; padding: 16px 12px; font-size: 20px;
  background: var(--jaune); color: #111; border: 3px solid #000; border-radius: 6px;
  box-shadow: 0 5px 0 #000; transition: transform .05s;
}
.big:active { transform: translateY(4px); box-shadow: 0 1px 0 #000; }
.big.alt { background: var(--beton2); color: var(--blanc); font-size: 16px; }
.big small { display: block; font-size: 11px; font-family: system-ui, sans-serif; font-weight: 700; color: #bbb; margin-top: 4px; }
.row { display: flex; gap: 10px; }
.row .big { flex: 1; }
.section { margin: 16px 0 8px; }
.label { font-size: 13px; margin-bottom: 8px; }
.dim { color: #9a9a95; font-family: system-ui, sans-serif; font-weight: 700; }
.small { font-size: 12px; min-height: 16px; margin-top: 6px; }
#starts { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; }
#starts button {
  width: 54px; height: 64px; font-size: 26px; border-radius: 8px; border: 3px solid #000;
  background: var(--beton2); position: relative; font-family: system-ui, sans-serif; padding: 0;
}
#starts img { width: 30px; height: 42px; image-rendering: pixelated; display: block; margin: 4px auto 0; }
#starts button i { position: absolute; left: -6px; top: -8px; font-size: 16px; font-style: normal; }
#startHint b { color: var(--blanc); }
#starts button.sel { background: var(--jaune); }
#starts button.lock { filter: grayscale(1); opacity: .45; }
#starts button.lock::after { content: "🔒"; position: absolute; right: -6px; bottom: -6px; font-size: 14px; }
.best { margin: 12px 0; font-size: 13px; color: #c9c9c2; font-family: system-ui, sans-serif; font-weight: 700; }
.best b { color: var(--jaune); font-family: var(--font); }
.toggles { display: flex; gap: 8px; justify-content: center; }
.toggles button {
  padding: 10px 12px; font-size: 12px; border-radius: 6px; border: 2px solid #000;
  background: var(--beton2); color: #fff;
}
.toggles button.on { background: var(--orange); color: #111; }
.help { font-size: 12px; color: #9a9a95; font-family: system-ui, sans-serif; font-weight: 700; margin-top: 16px; line-height: 1.5; }

.disclaimer b { color: #b0b0aa; }
.disclaimer { font-size: 10.5px; color: #8a8a84; font-family: system-ui, sans-serif; font-style: italic; line-height: 1.4; margin: 10px auto 0; max-width: 380px; }

/* Level-up cards */
#cards { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
.card {
  display: flex; align-items: center; gap: 12px; text-align: left; padding: 12px;
  background: #2f3237; color: var(--blanc); border: 3px solid #000; border-radius: 8px;
  box-shadow: 0 5px 0 #000; animation: cardIn .25s ease-out both;
}
.card:nth-child(2) { animation-delay: .06s; }
.card:nth-child(3) { animation-delay: .12s; }
.card:active { transform: translateY(4px); box-shadow: 0 1px 0 #000; }
.card:hover { border-color: var(--jaune); }
.card .ic { font-size: 36px; width: 52px; text-align: center; flex: none; font-family: system-ui, sans-serif; }
.card .nm { font-size: 16px; }
.card .bd { display: inline-block; font-size: 10px; padding: 2px 6px; border-radius: 3px; background: var(--jaune); color: #111; margin-left: 6px; vertical-align: middle; }
.card .bd.new { background: var(--orange); }
.card .kd { font-size: 10px; color: #9fb6d9; margin-top: 2px; }
.card .ds { font-family: system-ui, sans-serif; font-weight: 600; font-size: 13px; color: #d6d6cf; margin-top: 4px; line-height: 1.3; }
.card .key { margin-left: auto; font-size: 11px; color: #777; flex: none; }
@keyframes cardIn { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: none; } }
@media (min-width: 820px) and (min-height: 500px) {
  #levelup .inner { max-width: 860px; }
  #cards { flex-direction: row; }
  .card { flex: 1; flex-direction: column; text-align: center; padding: 18px 12px; }
  .card .ic { font-size: 48px; width: auto; }
  .card .key { margin: 8px 0 0; }
}

/* Game over */
.ovscore { display: flex; gap: 10px; margin: 14px 0 8px; }
.ovscore div { flex: 1; background: #000; border-radius: 8px; padding: 12px 6px; border: 3px solid #000; }
.ovscore b { display: block; font-size: clamp(30px, 10vw, 44px); color: var(--jaune); }
.ovscore span { font-size: 12px; color: #bbb; }
.record { color: var(--orange); font-size: 18px; margin: 6px 0; animation: pulse .8s infinite alternate; }
@keyframes pulse { to { transform: scale(1.08); } }
blockquote {
  margin: 14px 0; padding: 16px 14px; background: var(--blanc); color: #111; border-radius: 4px;
  font-family: Georgia, "Times New Roman", serif; font-style: italic; font-size: 18px; line-height: 1.35;
  border-left: 8px solid var(--jaune); transform: rotate(-1deg); box-shadow: 4px 4px 0 #000;
}
blockquote:empty { display: none; }
.stats { font-family: system-ui, sans-serif; font-weight: 700; font-size: 13px; color: #c9c9c2; line-height: 1.6; }
.stats b { color: var(--blanc); font-family: var(--font); }
.items { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin: 10px 0; }
.items span {
  background: #2f3237; border: 2px solid #000; border-radius: 6px; padding: 4px 7px; font-size: 18px;
  font-family: system-ui, sans-serif;
}
.items span i { font-style: normal; font-size: 10px; color: var(--jaune); font-family: var(--font); }
/* Dégâts par arme */
.dmg { margin: 10px 0; text-align: left; }
.dmgt { font-size: 11px; color: #9a9a95; margin-bottom: 4px; text-align: center; }
.dmgr { display: flex; align-items: center; gap: 6px; font-size: 12px; margin: 3px 0; font-family: system-ui, sans-serif; font-weight: 700; }
.dmgr .ic { width: 20px; text-align: center; }
.dmgr .nm { width: 34%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #ddd; }
.dmgr .bar { flex: 1; height: 8px; background: #111; border-radius: 4px; overflow: hidden; }
.dmgr .bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--orange), var(--jaune)); }
.dmgr b { width: 40px; text-align: right; font-family: var(--font); font-size: 11px; color: var(--jaune); }
.dmgr em { width: 34px; text-align: right; font-style: normal; color: #888; font-size: 11px; }
/* Évolutions */
.card.evo { background: linear-gradient(135deg, #5a4300, #2f3237 60%); border-color: var(--jaune); box-shadow: 0 5px 0 #000, 0 0 24px rgba(255,212,0,.45); animation: cardIn .25s ease-out both, evoGlow 1s ease-in-out infinite alternate; }
@keyframes evoGlow { to { box-shadow: 0 5px 0 #000, 0 0 40px rgba(255,212,0,.8); } }
.card .bd.evo { background: linear-gradient(90deg, #ffd400, #ff7a1a); }
.card .dl { font-family: system-ui, sans-serif; font-size: 11px; color: #9fdcff; margin-top: 5px; line-height: 1.4; }
.card .dl s { color: #777; }
.card .dl b { color: #7dff8a; }
#owned span.evo i, .items span.evo i { color: #ff7a1a; }
.items span.evo { border-color: var(--jaune); box-shadow: 0 0 8px rgba(255,212,0,.6); }
#xpbar.lvl #xpfill { animation: xpFlash .5s ease-out; }
@keyframes xpFlash { 0% { filter: brightness(3); } 100% { filter: none; } }
#kills b { display: inline-block; transition: transform .09s; }
#kills.bump b { transform: scale(1.35); }
.unlock { background: var(--orange); color: #111; border: 3px solid #000; border-radius: 6px; padding: 10px; font-size: 14px; margin: 10px 0; }

/* Couleur signature des armes */
.card[style*="--wc"] { box-shadow: 0 5px 0 #000, inset 0 4px 0 var(--wc); }
.card[style*="--wc"]:hover { border-color: var(--wc); }
.card[style*="--wc"] .ic { filter: drop-shadow(0 0 10px var(--wc)); }
.card.evo[style*="--wc"] { box-shadow: 0 5px 0 #000, 0 0 24px rgba(255,212,0,.45), inset 0 4px 0 var(--wc); }
#owned span[style*="--wc"] { filter: drop-shadow(0 0 3px var(--wc)); }

/* Soutien : caisse de grève et merch */
a.big { text-decoration: none; text-align: center; box-sizing: border-box; }
.big.caisse { background: var(--orange); }
.big.caisse small { color: #3a2a10; }
.support { display: flex; gap: 14px; justify-content: center; margin-top: 12px; }
.support a { color: var(--jaune); font-family: system-ui, sans-serif; font-weight: 800; font-size: 13px; text-decoration: none; border-bottom: 2px solid currentColor; }
.support a.hidden { display: none; }

/* Lieux */
#maps { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; }
#maps button { position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; width: 86px; padding: 6px 4px; border: 2px solid #000; border-radius: 6px; background: var(--beton2); color: #fff; font-size: 10px; line-height: 1.15; }
#maps button b { font-size: 22px; font-family: system-ui, sans-serif; }
#maps button.sel { background: var(--jaune); color: #111; }
#maps button.lock { filter: grayscale(1); opacity: .45; }
#maps button.lock::after { content: "🔒"; position: absolute; right: -6px; bottom: -6px; font-size: 14px; }
/* Tenues */
#skins { display: flex; justify-content: center; gap: 6px; flex-wrap: wrap; }
#skins button { position: relative; padding: 2px 6px; border: 2px solid #000; border-radius: 6px; background: var(--beton2); }
#skins img { width: 20px; height: 28px; image-rendering: pixelated; display: block; }
#skins button.sel { background: var(--jaune); }
#skins button.lock { filter: grayscale(1) brightness(.6); }
#skins button.lock::after { content: "🔒"; position: absolute; right: -6px; bottom: -6px; font-size: 11px; }
/* Succès */
.ach { margin: 14px auto 0; max-width: 420px; text-align: left; font-family: system-ui, sans-serif; }
.ach summary { cursor: pointer; text-align: center; font-weight: 800; color: var(--jaune); font-size: 14px; list-style: none; }
.ach summary::-webkit-details-marker { display: none; }
#achList { margin-top: 8px; display: grid; gap: 4px; }
#achList div { display: grid; grid-template-columns: 26px 1fr; column-gap: 6px; padding: 6px 8px; border-radius: 6px; background: rgba(255,255,255,.05); opacity: .55; }
#achList div.ok { opacity: 1; background: rgba(255,212,0,.12); }
#achList i { grid-row: span 2; font-style: normal; font-size: 18px; align-self: center; text-align: center; }
#achList b { font-size: 13px; color: #fff; }
#achList span { font-size: 11.5px; color: #b8b8b2; }
#toast { position: absolute; top: 64px; left: 50%; transform: translate(-50%, -20px); opacity: 0; pointer-events: none; z-index: 30;
  background: #1d1f23; border: 3px solid var(--jaune); border-radius: 8px; padding: 8px 14px; text-align: center; box-shadow: 0 4px 0 #000; font-family: system-ui, sans-serif; transition: opacity .25s, transform .25s; max-width: calc(100vw - 32px); }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast b { display: block; color: var(--jaune); font-size: 14px; }
#toast span { display: block; color: #ddd; font-size: 12px; margin-top: 2px; }
#ovAch::before { content: "Succès débloqués : "; }
.big.endless { background: linear-gradient(90deg, #ffd400, #ff7a1a); }
.big.endless small { color: #3a2a10; }

/* Classement du défi du jour */
.lb { list-style: none; margin: 8px auto 0; padding: 0; max-width: 420px; font-family: system-ui, sans-serif; font-size: 13px; }
.lb li { display: grid; grid-template-columns: 26px 1fr auto; gap: 8px; align-items: center; padding: 5px 8px; border-radius: 5px; background: rgba(255,255,255,.05); margin-bottom: 3px; text-align: left; }
.lb li b { color: var(--jaune); text-align: center; }
.lb li:first-child b { font-size: 15px; }
.lb li span { font-weight: 800; color: #fff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb li em { font-style: normal; color: #b8b8b2; font-size: 12px; }
.lb li.empty { display: block; text-align: center; color: #9a9a95; }
.lb.mini { margin-top: -2px; margin-bottom: 6px; font-size: 12px; }
.lbbox { margin: 14px 0; padding: 12px; border: 3px solid #000; border-radius: 8px; background: #2a2d31; }
.lbt { color: var(--jaune); font-size: 15px; margin-bottom: 8px; }
.lbform { display: flex; gap: 6px; max-width: 420px; margin: 0 auto; }
.lbform input { flex: 1; min-width: 0; padding: 10px; border: 2px solid #000; border-radius: 6px; font: 700 15px system-ui, sans-serif; background: #f5f5f0; color: #111; }
.lbform button { padding: 10px 14px; border: 2px solid #000; border-radius: 6px; background: var(--jaune); color: #111; font-size: 13px; }
.lbform button:disabled { opacity: .5; }
#lbMsg { font-family: system-ui, sans-serif; font-weight: 700; font-size: 12.5px; color: #9fdcff; margin-top: 6px; min-height: 1em; }

.disclaimer a.legal { color: #b0b0aa; white-space: nowrap; }
