* { box-sizing: border-box; }
body { margin: 0; overflow: hidden; background: #8fd3ff; font-family: "Trebuchet MS", Verdana, sans-serif; color: #fff; }
canvas { display: block; }
#hud { position: fixed; inset: 0; pointer-events: none; text-shadow: 0 2px 4px #000; }
#stats { position: absolute; top: 12px; left: 14px; display: flex; gap: 22px; font-size: 24px; font-weight: bold; }
#hpbar { position: absolute; top: 52px; left: 14px; width: 260px; height: 18px; border: 3px solid #fff; border-radius: 10px; background: #0006; overflow: hidden; }
#hp { height: 100%; width: 100%; background: #4caf50; transition: width .15s; }
#msg { position: absolute; top: 22%; width: 100%; text-align: center; font-size: 40px; font-weight: bold; }
#msg div { animation: pop 1.8s forwards; color: #ffe14d; }
@keyframes pop { 0% { opacity: 0; transform: scale(.6); } 15% { opacity: 1; transform: scale(1.1); } 80% { opacity: 1; } 100% { opacity: 0; transform: translateY(-30px); } }
#help { position: absolute; bottom: 12px; width: 100%; text-align: center; font-size: 17px; }
#screen { position: fixed; inset: 0; display: none; align-items: center; justify-content: center; background: #0007; }
.panel { background: #1c2541; border: 4px solid #ffe14d; border-radius: 20px; padding: 24px 32px; max-width: 620px; text-align: center; }
.panel h1, .panel h2 { margin: 0 0 8px; color: #ffe14d; }
.panel p { margin: 12px 0 6px; font-size: 18px; }
.row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
button { font: inherit; font-size: 18px; font-weight: bold; padding: 10px 18px; border: 3px solid #fff; border-radius: 14px; background: #3a6ea5; color: #fff; cursor: pointer; }
button:hover { background: #4f8ad0; }
button.on { border-color: #ffe14d; background: #d98c00; }
button:disabled { opacity: .45; cursor: default; }
button.go { background: #2e9e48; font-size: 24px; margin-top: 16px; }
.sw { width: 40px; height: 40px; padding: 0; border-radius: 50%; }
.up { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 8px 0; text-align: left; }
.up small { display: block; font-weight: normal; opacity: .8; }

#wrong { position: fixed; top: 22%; left: 50%; transform: translateX(-50%); background: rgba(229,57,53,.92); color: #fff;
  font: 800 34px system-ui, sans-serif; padding: 14px 28px; border-radius: 16px; text-align: center; pointer-events: none;
  animation: blink .6s infinite alternate; }
#wrong small { display: block; font-size: 20px; font-weight: 600; margin-top: 4px; }
@keyframes blink { from { opacity: 1; } to { opacity: .45; } }

.cars { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 10px 0; }
.car { background: #2b3a67; border: 3px solid #ffe14d; border-radius: 14px; padding: 8px; display: flex; flex-direction: column; gap: 4px; align-items: center; }
.car small { font-size: 13px; }
.car.locked { opacity: .35; filter: grayscale(.6); border-color: #888; }
#timer::before { content: ""; }
