/* Police Monocraft (Idrees Hassan, licence SIL OFL 1.1 : fonts/Monocraft-LICENSE.txt), comme dans Core Wars .io */
@font-face { font-family: 'Monocraft'; src: url('../fonts/Monocraft.ttf') format('truetype'); font-display: block; }

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { width: 100%; height: 100%; overflow: hidden; background: #0b1133; color: #fff; font-family: 'Monocraft', monospace; user-select: none; -webkit-user-select: none; }
canvas#gl { position: fixed; inset: 0; width: 100%; height: 100%; display: block; cursor: crosshair; }
.hidden { display: none !important; }
.t { text-shadow: 2px 2px 0 #000; }
.panel { background: rgba(0, 0, 0, 0.5); border: 2px solid #000; box-shadow: inset 2px 2px 0 rgba(255, 255, 255, 0.12), inset -2px -2px 0 rgba(0, 0, 0, 0.35); }
#hud { position: fixed; inset: 0; pointer-events: none; }

/* Score : les deux camps, une barre jusqu'à 200 */
#score { position: absolute; left: 50%; top: 12px; transform: translateX(-50%); display: flex; align-items: center; gap: 8px; padding: 6px 10px; font-size: 22px; }
#score .sw { width: 14px; height: 14px; border: 2px solid #000; }
#score .bar { width: 120px; height: 10px; background: rgba(0, 0, 0, 0.55); border: 2px solid #000; position: relative; }
#score .bar i { position: absolute; top: 0; bottom: 0; display: block; }
#bB { left: 0; background: #3a5fc0; } #bR { right: 0; background: #c23b3b; }
#score b { min-width: 42px; text-align: center; }

/* Fil des éliminations */
#feed { position: absolute; right: 14px; top: 12px; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; font-size: 14px; }
#feed div { background: rgba(0, 0, 0, 0.45); padding: 3px 8px; display: flex; align-items: center; gap: 7px; text-shadow: 1px 1px 0 #000; }
.ic { display: inline-block; height: 12px; background-size: 100% 100%; image-rendering: pixelated; }
.ic-rifle { width: 30px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 15 6' shape-rendering='crispEdges'%3E%3Cpath d='M0 2h4v3H1V4H0zM4 2h6v2H4zM10 2h5v1h-5zM6 4h2v2H6z' fill='%23e8e8e8'/%3E%3C/svg%3E"); }
.ic-head { width: 12px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 6 6' shape-rendering='crispEdges'%3E%3Cpath d='M1 0h4v1H1zM0 1h6v3H0zM1 4h4v2H1z' fill='%23ff5a4a'/%3E%3C/svg%3E"); }
.ic-tank { width: 26px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 13 6' shape-rendering='crispEdges'%3E%3Cpath d='M4 0h4v2H4zM8 1h5v1H8zM1 2h10v2H1zM0 4h12v2H0z' fill='%23e8e8e8'/%3E%3C/svg%3E"); }
.ic-jeep { width: 24px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 6' shape-rendering='crispEdges'%3E%3Cpath d='M3 0h1v2H3zM0 2h12v2H0zM1 4h3v2H1zM8 4h3v2H8z' fill='%23e8e8e8'/%3E%3C/svg%3E"); }

/* Cœurs (bedwars : pixel, minimalistes, pointe en triangle, faits de rectangles) : 20 points de vie chacun */
#hearts { position: absolute; left: 18px; bottom: 18px; display: flex; gap: 5px; }
#hearts i { width: 28px; height: 24px; display: block; image-rendering: pixelated; background-size: 100% 100%;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 7 6' shape-rendering='crispEdges'%3E%3Cpath d='M1 0h2v1H1zM4 0h2v1H4zM0 1h7v2H0zM1 3h5v1H1zM2 4h3v1H2zM3 5h1v1H3z' fill='%23000' fill-opacity='.55'/%3E%3C/svg%3E"); }
#hearts i.full, #hearts i.half, #hearts i.low { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 7 6' shape-rendering='crispEdges'%3E%3Cpath d='M1 0h2v1H1zM4 0h2v1H4zM0 1h7v2H0zM1 3h5v1H1zM2 4h3v1H2zM3 5h1v1H3z' fill='%23d4302a'/%3E%3Cpath d='M1 1h1v1H1z' fill='%23ff9a8a'/%3E%3C/svg%3E"); }
#hearts i.half { clip-path: inset(0 45% 0 0); }
#hearts i.low { clip-path: inset(0 70% 0 0); }

/* Munitions : une balle par coup dans le chargeur ; la barre de rechargement dessous */
#ammoBox { position: absolute; right: 18px; bottom: 18px; padding: 7px 9px; }
#ammo { display: flex; gap: 4px; }
#ammo i { width: 7px; height: 26px; display: block; background: linear-gradient(#e8c26a 0 28%, #b08a3a 28% 100%); border: 1px solid #000; }
#ammo i.used { background: rgba(255, 255, 255, 0.12); }
#reloadWrap { margin-top: 6px; height: 5px; background: rgba(0, 0, 0, 0.6); }
#reload { height: 100%; width: 0; background: #e8e8e8; }

/* Véhicule : sa vie, le rechargement du canon */
#vehBox { position: absolute; right: 18px; bottom: 18px; width: 220px; padding: 8px; display: flex; flex-direction: column; gap: 6px; }
#vehBox .b { height: 10px; background: rgba(0, 0, 0, 0.6); border: 2px solid #000; }
#vehHp { height: 100%; background: #6ac24a; } #vehReload { height: 100%; background: #e8c26a; }

/* Réticule : petit losange blanc, net (pas de pixels) ; touche : une croix, rouge à la tête */
#reticle, #hitm { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); }
#reticle { width: 14px; height: 14px; }
#hitm { width: 26px; height: 26px; opacity: 0; transition: opacity 0.05s; }
#hitm path { stroke: #fff; }
#hitm.head path { stroke: #ff3b2f; }
#hurt { position: absolute; inset: 0; opacity: 0; background: radial-gradient(ellipse at center, rgba(160, 0, 0, 0) 55%, rgba(160, 0, 0, 0.7) 100%); }

#dead { position: absolute; left: 50%; top: 30%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 12px 18px; font-size: 20px; }
#dead .bar { width: 220px; height: 8px; background: rgba(0, 0, 0, 0.6); border: 2px solid #000; }
#respawnBar { height: 100%; width: 0; background: #e8e8e8; }

/* Tableau des scores (Tab) */
#board { position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); padding: 12px; pointer-events: none; }
#boardWrap { display: flex; gap: 18px; }
table.sb { border-collapse: collapse; font-size: 14px; min-width: 230px; }
table.sb th { text-align: left; padding: 3px 8px; font-weight: normal; border-bottom: 2px solid #000; }
table.sb td { padding: 2px 8px; text-shadow: 1px 1px 0 #000; }
table.sb td + td, table.sb th + th { text-align: right; }
table.sb tr.me td { color: #ffe066; }
#thB { color: #7f9cf0; } #thR { color: #f08080; }

/* Écrans */
.screen { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; background: rgba(5, 7, 26, 0.45); }
.logo { font-size: clamp(40px, 9vw, 92px); letter-spacing: 3px; color: #e8dcc0; text-shadow: 4px 4px 0 #5a4a2a, 7px 7px 0 #000; margin-bottom: 22px; font-weight: normal; }
.end-title { font-size: clamp(40px, 8vw, 80px); text-shadow: 4px 4px 0 #000; }
.end-title.win { color: #ffd84a; } .end-title.lose { color: #e86a5a; }
#endScore { font-size: 34px; text-shadow: 3px 3px 0 #000; margin-bottom: 6px; }
#endBoard { display: flex; gap: 18px; padding: 10px; margin-bottom: 10px; }

/* Boutons de Core Wars .io (button.mc) */
button.mc {
  --mcb: 2px; --mc-hi: #454545; --mc-lo: #181818;
  display: flex; align-items: center; justify-content: center; width: min(360px, 86vw); height: 44px; margin: 2px auto;
  background: #2b2b2b; border: var(--mcb) solid #000; border-radius: 0;
  box-shadow: inset var(--mcb) var(--mcb) 0 var(--mc-hi), inset calc(-1 * var(--mcb)) calc(-1 * var(--mcb)) 0 var(--mc-lo);
  color: #e0e0e0; font: 18px 'Monocraft', monospace; text-shadow: 2px 2px 0 #000; cursor: pointer; outline: none;
}
button.mc:hover { --mc-hi: #5e5e5e; --mc-lo: #1e1e1e; background: #3c3c3c; color: #ffffa0; }
button.mc:focus-visible { border-color: #ffffa0; }
button.mc:active { --mc-hi: #141414; --mc-lo: #3a3a3a; background: #242424; transform: translateY(1px); }
button.mc.mc-green { --mc-hi: #5a9a4a; --mc-lo: #1f4418; background: #3f7a32; color: #fff; }
button.mc.mc-green:hover { --mc-hi: #6cb85a; --mc-lo: #2a5a20; background: #4f9a40; color: #ffffa0; }
button.mc.mc-green:active { --mc-hi: #1f4418; --mc-lo: #5a9a4a; background: #36692b; }
