* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
  background: #0b0e1a;
  overflow: hidden;
  font-family: "Press Start 2P", "Courier New", monospace;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: none;
}

#game-shell {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
}

#game-wrap {
  position: relative;
  width: 100%;
  max-width: 1100px;
  aspect-ratio: 16 / 9;
  max-height: calc(100vh - 16px);
  max-height: calc(100dvh - 16px);
  box-shadow: 0 0 0 4px #1a2340, 0 12px 40px rgba(0,0,0,.6);
  background: #000;
}

@supports not (aspect-ratio: 16/9) {
  #game-wrap { height: min(56.25vw, calc(100vh - 16px)); width: auto; }
}

canvas#game {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  display: block;
}

/* ---------- HUD ---------- */
#hud {
  position: absolute;
  top: 0; left: 0; right: 0;
  display: flex;
  justify-content: space-between;
  padding: 10px 12px;
  pointer-events: none;
  font-size: clamp(7px, 1.4vw, 12px);
  color: #fff;
  text-shadow: 2px 2px 0 #000;
  z-index: 5;
}
.hud-left, .hud-right { display: flex; gap: 14px; align-items: center; }
.hud-item span { color: #ffd94d; }
#hud-combo { color: #7df9ff; }
.boost-wrap { display: flex; align-items: center; gap: 6px; }
#boost-meter {
  width: clamp(50px, 9vw, 90px);
  height: 10px;
  border: 2px solid #fff;
  background: #111;
  box-shadow: 2px 2px 0 #000;
}
#boost-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #2f7dff, #7df9ff);
  transition: width .1s linear;
}
#boost-fill.full { animation: pulse .3s infinite alternate; }
@keyframes pulse { from { filter: brightness(1);} to { filter: brightness(1.8);} }

/* progression vers l'Élysée */
#goal-track {
  position: absolute;
  top: clamp(26px, 6vh, 44px);
  left: 50%;
  transform: translateX(-50%);
  width: 34%;
  height: 8px;
  border: 2px solid #fff;
  background: #111;
  box-shadow: 2px 2px 0 #000;
}
#goal-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #2e5cff, #fff, #ff3b47);
  transition: width .2s linear;
}
#goal-flag {
  position: absolute;
  right: -6px;
  top: 50%;
  transform: translateY(-56%);
  font-size: clamp(12px, 2.4vw, 18px);
  filter: drop-shadow(2px 2px 0 #000);
}

/* ---------- Overlays ---------- */
.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(8px, 2vh, 18px);
  background: rgba(8, 10, 24, .72);
  z-index: 10;
  text-align: center;
  padding: 12px;
}
.hidden { display: none !important; }

/* écran titre : visuel LISNARD ÉLYSÉE RUN 2027 + bouton JOUER */
#start-screen {
  background:
    linear-gradient(to bottom, rgba(4,8,24,0) 55%, rgba(4,8,24,.55) 100%),
    url("assets/menu.png?v=26") center / cover no-repeat;
  justify-content: flex-end;
  padding-bottom: 5%;
}
#start-screen .hint { text-shadow: 2px 2px 0 #000, -2px 2px 0 #000, 2px -2px 0 #000, -2px -2px 0 #000; }

.title {
  font-size: clamp(16px, 4.2vw, 38px);
  color: #ffd94d;
  text-shadow: 3px 3px 0 #b3541e, 6px 6px 0 #000;
  line-height: 1.5;
  letter-spacing: 1px;
}
.title span { color: #7df9ff; text-shadow: 3px 3px 0 #145a8d, 6px 6px 0 #000; }
.title.go { color: #ff5252; text-shadow: 3px 3px 0 #7a1010, 6px 6px 0 #000; }
.title.win { color: #ffd94d; text-shadow: 3px 3px 0 #1a6e2e, 6px 6px 0 #000; }

.subtitle {
  font-size: clamp(8px, 1.8vw, 14px);
  color: #fff;
  text-shadow: 2px 2px 0 #000;
}
.hint {
  font-size: clamp(7px, 1.5vw, 12px);
  color: #9fb4ff;
  text-shadow: 2px 2px 0 #000;
}
.blink { animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: .2; } }

.px-btn {
  font-family: inherit;
  font-size: clamp(10px, 2.2vw, 18px);
  color: #fff;
  background: #2f7dff;
  border: 0;
  padding: clamp(10px, 2vh, 16px) clamp(22px, 5vw, 40px);
  cursor: pointer;
  box-shadow: 0 5px 0 #123e8a, 0 8px 0 #000;
  text-shadow: 2px 2px 0 #000;
  transition: transform .05s, box-shadow .05s;
}
.px-btn:hover { background: #4a90ff; }
.px-btn:active {
  transform: translateY(5px);
  box-shadow: 0 0 0 #123e8a, 0 3px 0 #000;
}

/* rangée de boutons secondaires (partage) */
.btn-row {
  display: flex;
  gap: clamp(8px, 2vw, 16px);
  align-items: center;
  justify-content: center;
}
.px-btn.share {
  background: #e5007d;             /* rose flashy : le bouton qui donne envie */
  box-shadow: 0 5px 0 #6e003c, 0 8px 0 #000;
  font-size: clamp(8px, 1.7vw, 13px);
  padding: clamp(8px, 1.6vh, 12px) clamp(14px, 3vw, 24px);
}
.px-btn.share:hover { background: #ff2d9a; }
.px-btn.share:active { box-shadow: 0 0 0 #6e003c, 0 3px 0 #000; }
.px-btn.x {
  background: #14171c;             /* noir X */
  box-shadow: 0 5px 0 #000, 0 8px 0 #000;
  font-size: clamp(10px, 2vw, 16px);
  padding: clamp(8px, 1.6vh, 12px) clamp(14px, 3vw, 22px);
}
.px-btn.x:hover { background: #2a2f38; }
.px-btn.x:active { box-shadow: 0 0 0 #000, 0 3px 0 #000; }

.stats {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: clamp(7px, 1.5vw, 12px);
  color: #cdd6ff;
  text-shadow: 2px 2px 0 #000;
}
.stat { display: flex; justify-content: space-between; gap: 24px; min-width: min(420px, 78vw); }
.stat b { color: #ffd94d; }

#btn-sound {
  position: absolute;
  bottom: 8px;
  right: 8px;
  z-index: 20;
  font-size: 16px;
  background: rgba(10,14,30,.7);
  color: #fff;
  border: 2px solid #3a4a80;
  width: 40px;
  height: 40px;
  cursor: pointer;
  line-height: 1;
}
#btn-sound.off { opacity: .45; }

/* Portrait mobile : UI plus compacte */
@media (max-width: 640px) and (orientation: portrait) {
  #game-shell { padding: 4px; }
  #hud { padding: 6px 8px; }
  .hud-left, .hud-right { gap: 8px; }
}
