/* 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; touch-action: none; }
canvas#gl { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
.hidden { display: none !important; }

/* Texte du HUD : blanc, ombre portée nette (comme bedwars) */
.hud-t { color: #fff; text-shadow: 2px 2px 0 #000; }
#hud { position: fixed; inset: 0; pointer-events: none; }
#lap { position: absolute; left: 18px; top: 14px; font-size: 22px; }
#lap .k { font-size: 16px; color: #ffe9a0; }
#time { position: absolute; left: 18px; top: 44px; font-size: 18px; color: #dfe8ff; }
#pos { position: absolute; right: 22px; bottom: 16px; font-size: 64px; line-height: 1; }
#pos span { font-size: 28px; vertical-align: top; margin-left: 2px; }
#pos.p1 b { color: #ffd84a; }
#map { position: absolute; right: 14px; top: 12px; width: 220px; height: 150px; image-rendering: pixelated; }
#count { position: absolute; left: 50%; top: 32%; transform: translate(-50%, -50%); font-size: 96px; }
#count.go { color: #7dff7a; }
#lights { position: absolute; left: 50%; top: 12%; transform: translateX(-50%); display: flex; gap: 10px; padding: 8px; background: #1b1c20; border: 2px solid #000; box-shadow: inset 2px 2px 0 #3a3b40, inset -2px -2px 0 #0e0f12; }
#lights i { width: 30px; height: 30px; background: #3a1414; border: 2px solid #000; display: block; }
#lights i.r { background: #e2382f; box-shadow: inset 2px 2px 0 #ff8a7a; }
#lights i.g { background: #3fd24a; box-shadow: inset 2px 2px 0 #a8ffa0; }

/* Écrans (départ, pause, fin) */
.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: 2px; color: #ffd84a; text-shadow: 4px 4px 0 #8a3a12, 7px 7px 0 #000; margin-bottom: 22px; }
.end-title { font-size: clamp(36px, 7vw, 72px); margin-bottom: 8px; }
table.results { border-collapse: collapse; background: rgba(0, 0, 0, 0.55); border: 2px solid #000; box-shadow: inset 2px 2px 0 #3a3b40, inset -2px -2px 0 #0e0f12; margin-bottom: 12px; font-size: 16px; }
table.results td { padding: 5px 14px; text-shadow: 2px 2px 0 #000; }
table.results tr.me td { color: #ffe066; }
table.results td.sw { width: 14px; padding: 0; }
table.results td.sw i { display: block; width: 12px; height: 12px; border: 2px solid #000; }

/* 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; pointer-events: auto;
}
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; }

/* Commandes tactiles : des carrés, des flèches dessinées en pixels */
#touch { position: fixed; inset: 0; pointer-events: none; }
#touch .tb { position: absolute; width: 84px; height: 84px; background: rgba(20, 22, 30, 0.45); border: 2px solid rgba(0, 0, 0, 0.6); box-shadow: inset 2px 2px 0 rgba(255, 255, 255, 0.18); pointer-events: auto; display: flex; align-items: center; justify-content: center; }
#touch .tb.on { background: rgba(255, 255, 255, 0.28); }
#touch .tb svg { width: 44px; height: 44px; }
#tLeft { left: 18px; bottom: 22px; } #tRight { left: 116px; bottom: 22px; }
#tDrift { right: 18px; bottom: 22px; } #tBrake { right: 18px; bottom: 116px; }
#tPause { left: 50%; top: 10px; transform: translateX(-50%); width: 52px !important; height: 52px !important; }
#tPause svg { width: 26px !important; height: 26px !important; }
body.touch #pos { left: 18px; right: auto; top: 70px; bottom: auto; font-size: 40px; }
body.touch #pos span { font-size: 18px; }
@media (max-width: 700px) { #map { width: 150px; height: 102px; } }
