* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #000; color: #eee; font-family: 'Special Elite', 'Courier New', monospace; user-select: none; }
#game canvas { display: block; }
.hidden { display: none !important; }

/* grain de pellicule + vignette */
#grain { position: fixed; inset: -50%; pointer-events: none; opacity: 0.07; z-index: 2;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  animation: grain 0.5s steps(4) infinite; }
@keyframes grain { 0% { transform: translate(0, 0); } 25% { transform: translate(-5%, 3%); } 50% { transform: translate(4%, -6%); } 75% { transform: translate(-3%, 5%); } 100% { transform: translate(2%, -2%); } }
#vignette { position: fixed; inset: 0; pointer-events: none; z-index: 2; background: radial-gradient(ellipse at center, transparent 50%, rgba(0,0,0,0.75) 100%); }
#blood { position: fixed; inset: 0; pointer-events: none; z-index: 3; opacity: 0; background: radial-gradient(ellipse at center, transparent 35%, rgba(150,0,0,0.85) 100%); transition: opacity 0.1s; }
#flash { position: fixed; inset: 0; pointer-events: none; z-index: 4; background: #fff; opacity: 0; transition: opacity 0.4s; }
#flash.on { opacity: 0.9; transition: none; }
body.downed #game { filter: saturate(0.25) contrast(1.1) blur(0.6px); }

#hud { position: fixed; inset: 0; pointer-events: none; z-index: 5; }

/* réticule */
#crosshair { --gap: 8px; position: absolute; left: 50%; top: 50%; transition: opacity 0.1s; }
#crosshair i { position: absolute; background: rgba(255,255,255,0.85); box-shadow: 0 0 2px #000; }
#crosshair i:nth-child(1) { width: 2px; height: 9px; left: -1px; top: calc(-9px - var(--gap)); }
#crosshair i:nth-child(2) { width: 2px; height: 9px; left: -1px; top: var(--gap); }
#crosshair i:nth-child(3) { width: 9px; height: 2px; top: -1px; left: calc(-9px - var(--gap)); }
#crosshair i:nth-child(4) { width: 9px; height: 2px; top: -1px; left: var(--gap); }
#hitmarker { position: absolute; left: 50%; top: 50%; width: 22px; height: 22px; margin: -11px; opacity: 0;
  background: linear-gradient(45deg, transparent 45%, #fff 45%, #fff 55%, transparent 55%), linear-gradient(-45deg, transparent 45%, #fff 45%, #fff 55%, transparent 55%);
  -webkit-mask: radial-gradient(circle, transparent 5px, #000 6px); mask: radial-gradient(circle, transparent 5px, #000 6px); }
#hitmarker.head { filter: drop-shadow(0 0 2px red) sepia(1) saturate(8) hue-rotate(-30deg); }
#hitmarker.show { animation: hm 0.25s ease-out; }
@keyframes hm { from { opacity: 1; transform: scale(1.2); } to { opacity: 0; transform: scale(1); } }

/* messages */
#msg { position: absolute; top: 22%; width: 100%; text-align: center; font-family: 'Creepster', Georgia, serif; font-size: 44px; opacity: 0; text-shadow: 0 0 8px #000, 0 0 2px #000; letter-spacing: 2px; }
#msg.big { font-size: 80px; }
#msg.show { animation: msgIn 0.4s ease-out forwards; }
@keyframes msgIn { from { opacity: 0; transform: scale(1.4); } to { opacity: 1; transform: scale(1); } }
#feed { position: absolute; left: 20px; top: 20px; font-size: 15px; text-shadow: 0 0 4px #000; }
#feed div { margin-bottom: 4px; animation: fade 5s forwards; }
@keyframes fade { 0%, 80% { opacity: 1; } 100% { opacity: 0; } }
#left { position: absolute; top: 18px; width: 100%; text-align: center; font-size: 15px; color: #bbb; text-shadow: 0 0 4px #000; }
#hint { position: absolute; bottom: 30%; width: 100%; text-align: center; font-size: 20px; text-shadow: 0 0 5px #000, 0 0 2px #000; transition: opacity 0.15s; color: #f2f2f2; }
#hint.poor { color: #ff8a7a; }
#hint.deny { animation: shake 0.3s; color: #ff4040; }
@keyframes shake { 25% { transform: translateX(-8px); } 75% { transform: translateX(8px); } }

#revive { position: absolute; left: 50%; top: 58%; width: 260px; height: 12px; margin-left: -130px; border: 2px solid #ddd; background: rgba(0,0,0,0.5); }
#revive-fill { height: 100%; background: #e8e8e8; width: 0; }
#downed-ui { position: absolute; top: 34%; width: 100%; text-align: center; }
#downed-text { display: inline-block; font-size: 22px; color: #ff5a4a; background: rgba(0,0,0,0.45); padding: 8px 18px; text-shadow: 0 0 6px #000; }

/* manche (en bas à gauche, rouge façon craie) */
#bottom-left { position: absolute; left: 34px; bottom: 18px; }
#round { font-family: 'Creepster', Georgia, serif; color: #b30d0a; font-size: 110px; line-height: 1; text-shadow: 0 0 12px rgba(120,0,0,0.8), 2px 2px 0 #200; transition: color 0.4s; }
#round .tally { letter-spacing: 6px; font-weight: bold; font-family: Georgia, serif; font-size: 100px; }
#round .tally s { text-decoration-thickness: 8px; }
#round.blink { animation: blink 0.8s infinite; }
#round.pulse { animation: pulse 1.2s 3; }
@keyframes blink { 50% { color: #fff; } }
@keyframes pulse { 50% { color: #fff; transform: scale(1.12); } }
#perks { display: flex; gap: 6px; margin-bottom: 6px; }
#perks span { width: 34px; height: 34px; display: flex; align-items: center; justify-content: center; font-family: Arial, sans-serif; font-weight: bold; font-size: 13px; color: #fff; border-radius: 50%; border: 2px solid rgba(255,255,255,0.7); box-shadow: 0 0 10px rgba(0,0,0,0.8); }

#powers { position: absolute; bottom: 30px; width: 100%; text-align: center; }
.pw { display: inline-block; margin: 0 8px; padding: 4px 10px; font-size: 18px; border: 2px solid; background: rgba(0,0,0,0.4); font-family: Arial, sans-serif; font-weight: bold; }
.pw.insta { color: #ff4a3a; } .pw.dbl { color: #ffd84a; }

#bottom-right { position: absolute; right: 34px; bottom: 22px; text-align: right; }
#scores { margin-bottom: 14px; }
.score { font-size: 26px; text-shadow: 0 0 6px #000, 1px 1px 0 #000; display: flex; justify-content: flex-end; gap: 12px; align-items: baseline; }
.score .sn { font-size: 14px; opacity: 0.75; }
.score.mine .sp { font-size: 32px; }
#pops { position: relative; height: 0; }
.pop { position: absolute; bottom: 20px; color: #ffd84a; font-size: 20px; font-weight: bold; text-shadow: 0 0 4px #000; animation: pop 0.9s ease-out forwards; }
.pop.big { font-size: 26px; color: #fff176; }
@keyframes pop { from { opacity: 1; transform: translate(0, 0); } to { opacity: 0; transform: translate(-30px, -50px); } }
#wname { font-size: 16px; color: #ccc; text-shadow: 0 0 4px #000; }
#ammo { font-size: 38px; text-shadow: 0 0 6px #000; font-family: Georgia, serif; }
#ammo small { font-size: 22px; color: #aaa; }
#ammo .low { color: #ff4030; }
#nades { color: #9fae7a; font-size: 18px; letter-spacing: 3px; }

#scoreboard { position: absolute; left: 50%; top: 18%; transform: translateX(-50%); background: rgba(0,0,0,0.75); border: 1px solid #555; padding: 14px 22px; }
#scoreboard table, #go-stats { border-collapse: collapse; font-size: 18px; }
#scoreboard td, #scoreboard th, #go-stats td, #go-stats th { padding: 5px 16px; text-align: left; }
#scoreboard th, #go-stats th { color: #999; font-size: 14px; border-bottom: 1px solid #444; }

/* menus */
.overlay { position: fixed; inset: 0; z-index: 10; display: flex; align-items: center; justify-content: center; background: radial-gradient(ellipse at center, rgba(20,5,5,0.55), rgba(0,0,0,0.92)); padding: 16px; }
.panel { max-width: 640px; width: 100%; text-align: center; background: rgba(10,8,8,0.75); border: 1px solid #3a1a16; padding: 26px 30px; box-shadow: 0 0 60px rgba(120,0,0,0.35); }
.panel.small { max-width: 380px; }
h1 { font-family: 'Creepster', Georgia, serif; font-weight: normal; font-size: 64px; margin: 0 0 6px; color: #c0140f; text-shadow: 0 0 18px rgba(200,0,0,0.6); line-height: 1; letter-spacing: 3px; }
h2 { font-family: 'Creepster', Georgia, serif; font-weight: normal; font-size: 40px; margin: 0 0 10px; color: #c0140f; }
.sub { color: #bbb; margin: 6px 0 18px; }
form { display: flex; gap: 10px; justify-content: center; margin-bottom: 14px; flex-wrap: wrap; }
input[type=text], #name { font: inherit; font-size: 20px; padding: 10px 14px; background: #111; color: #eee; border: 1px solid #555; width: 240px; }
button { font-family: 'Creepster', Georgia, serif; font-size: 26px; padding: 8px 28px; background: #6a0a08; color: #fff; border: 1px solid #b02018; cursor: pointer; letter-spacing: 2px; }
button:hover { background: #8e100c; }
.row { display: flex; gap: 10px; justify-content: center; align-items: center; margin: 10px 0; color: #bbb; }
.controls { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 18px; text-align: left; font-size: 14px; color: #aaa; margin: 16px 0 10px; }
.controls b { color: #eee; }
.tip { font-size: 13px; color: #888; line-height: 1.5; }
.red { color: #c0140f; }
#go-stats { margin: 10px auto; }
@media (max-width: 600px) { h1 { font-size: 44px; } .controls { grid-template-columns: 1fr; } #round { font-size: 70px; } }

/* lunette du fusil de précision */
#scope { position: absolute; inset: 0; background: radial-gradient(circle at center, transparent 0, transparent 39.5vh, rgba(0,0,0,0.6) 40vh, #000 41.5vh); }
#scope::after { content: ''; position: absolute; inset: 0; background: radial-gradient(circle at center, transparent 30vh, rgba(0,0,0,0.35) 40vh, transparent 40.1vh); }
#scope i { position: absolute; background: rgba(0,0,0,0.9); }
#scope i:nth-child(1) { left: 50%; top: calc(50% - 40vh); width: 1px; height: 80vh; }
#scope i:nth-child(2) { top: 50%; left: calc(50% - 40vh); height: 1px; width: 80vh; }
.pw.air { color: #ffb040; }
select { font: inherit; background: #111; color: #eee; border: 1px solid #555; padding: 4px 8px; }
#fps { position: absolute; right: 12px; top: 10px; font: 12px monospace; color: #9f9; text-shadow: 0 0 3px #000; }
/* indicateur de direction des dégâts */
#dmgdir { position: absolute; left: 50%; top: 50%; width: 0; height: 0; opacity: 0; }
#dmgdir i { position: absolute; left: -70px; top: -190px; width: 140px; height: 26px; border-top: 7px solid rgba(255,40,30,0.9); border-radius: 50% 50% 0 0 / 100% 100% 0 0; filter: drop-shadow(0 0 6px red); }
#dmgdir.show { animation: dmg 1.1s ease-out; }
@keyframes dmg { 0% { opacity: 1; } 70% { opacity: 0.8; } 100% { opacity: 0; } }
