/* La Guerre des Bananes — habillage */
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background: radial-gradient(1200px 700px at 50% 30%, #14351f, #07160d 75%);
  display: flex; align-items: center; justify-content: center;
  font-family: "Trebuchet MS", "Segoe UI", Verdana, sans-serif;
  color: #f3efe4; overflow: hidden;
  user-select: none; -webkit-user-select: none;
  overscroll-behavior: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}
button { touch-action: manipulation; }
#stage { position: relative; width: min(100vw, calc(100vh * 16 / 9)); aspect-ratio: 16 / 9; }
canvas {
  position: absolute; inset: 0; width: 100%; height: 100%; display: block;
  border-radius: 10px; box-shadow: 0 12px 60px rgba(0, 0, 0, .55);
  touch-action: none; cursor: crosshair;
}
.hidden { display: none !important; }

/* ---- HUD ---- */
#hud {
  position: absolute; top: 12px; left: 14px; right: 14px;
  display: flex; justify-content: space-between; align-items: flex-start;
  pointer-events: none;
}
.playercard {
  background: rgba(10, 26, 16, .72); border: 2px solid rgba(255, 255, 255, .12);
  border-radius: 12px; padding: 8px 12px; min-width: 185px;
  backdrop-filter: blur(3px);
  transition: box-shadow .25s, border-color .25s;
}
.playercard.active { border-color: #ffd23f; box-shadow: 0 0 14px rgba(255, 210, 63, .45); }
.pname { font-weight: 700; font-size: 15px; letter-spacing: .4px; }
.hpbar { height: 10px; background: rgba(0, 0, 0, .5); border-radius: 6px; margin-top: 6px; overflow: hidden; }
.hpfill { height: 100%; width: 100%; background: linear-gradient(#7ae06c, #3fae4a); border-radius: 6px; transition: width .3s; }
.hpfill.mid { background: linear-gradient(#ffd23f, #e8a020); }
.hpfill.low { background: linear-gradient(#ff7a6b, #d8402f); }
.trophies { margin-top: 4px; font-size: 13px; min-height: 18px; letter-spacing: 2px; }
#centerhud { text-align: center; }
#roundlabel, #windind {
  background: rgba(10, 26, 16, .72); padding: 4px 12px; border-radius: 10px;
  display: inline-block; font-size: 14px;
}
#roundlabel { font-weight: 700; }
#windind { margin-top: 6px; }
#windind b { color: #9fd8ff; }

#bottombar {
  position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%);
  background: rgba(10, 26, 16, .78); padding: 7px 16px; border-radius: 12px;
  font-size: 14px; display: flex; gap: 18px; align-items: center;
  pointer-events: none; white-space: nowrap; max-width: 96%;
}
#aimreadout { font-weight: 700; color: #ffd23f; }
#hint { opacity: .75; font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; }

#cornerbtns { position: absolute; right: 12px; bottom: 12px; display: flex; gap: 8px; z-index: 30; }
#cornerbtns button {
  width: 46px; height: 46px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .2); background: rgba(10, 26, 16, .8);
  color: #fff; font-size: 18px; cursor: pointer;
}
#cornerbtns button:hover { border-color: #ffd23f; }

/* ---- Contrôles tactiles (tablette / téléphone) ---- */
#touchbar {
  position: absolute; left: 50%; bottom: 8px; transform: translateX(-50%);
  display: flex; gap: 14px; align-items: center; z-index: 12;
  background: rgba(10, 26, 16, .78); border-radius: 18px; padding: 8px 12px;
  transition: opacity .25s;
}
#touchbar.disabled { opacity: .45; pointer-events: none; }
.tgroup {
  display: flex; align-items: center; gap: 8px;
  background: rgba(0, 0, 0, .25); border-radius: 14px; padding: 4px;
}
.tlabel {
  min-width: 96px; text-align: center; font-size: 14px; font-weight: 700;
  color: #ffd23f; font-variant-numeric: tabular-nums;
}
.tbtn {
  width: 52px; height: 52px; border-radius: 12px; border: 2px solid rgba(255, 255, 255, .22);
  background: rgba(255, 255, 255, .10); color: #f3efe4;
  font-size: 26px; font-weight: 800; cursor: pointer; font-family: inherit;
}
.tbtn:active { background: rgba(255, 210, 63, .35); border-color: #ffd23f; }
#tFire {
  height: 56px; padding: 0 22px; border: none; border-radius: 14px;
  background: linear-gradient(#ffd23f, #f0a828); color: #4a2f10;
  font-size: 19px; font-weight: 800; cursor: pointer; font-family: inherit;
  box-shadow: 0 4px 0 #a06818;
}
#tFire:active { transform: translateY(3px); box-shadow: 0 1px 0 #a06818; }
@media (max-width: 900px) {
  .tlabel { min-width: 74px; font-size: 12.5px; }
  .tbtn { width: 46px; height: 46px; }
  #tFire { padding: 0 14px; font-size: 16px; }
}

/* ---- Superpositions (menu, fin de partie) ---- */
.overlay {
  position: absolute; inset: 0; z-index: 20;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 18px; text-align: center; padding: 20px;
  background: rgba(4, 14, 8, .82); backdrop-filter: blur(4px); border-radius: 10px;
}
.overlay h1 { font-size: clamp(28px, 5vw, 52px); text-shadow: 0 4px 0 rgba(0, 0, 0, .4); }
.tagline { opacity: .85; font-size: 16px; margin-top: -6px; }
.menurow { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
button.choice {
  background: rgba(255, 255, 255, .08); color: #f3efe4;
  border: 2px solid rgba(255, 255, 255, .22); padding: 10px 18px;
  border-radius: 12px; font-size: 16px; cursor: pointer; font-family: inherit;
}
button.choice:hover { border-color: #ffd23f; }
button.choice.selected { background: #2f7d3a; border-color: #7ae06c; }
#btnStart, #btnReplay, #btnBackMenu {
  background: linear-gradient(#ffd23f, #f0a828); border: none; color: #4a2f10;
  font-weight: 800; font-size: 20px; padding: 13px 34px; border-radius: 14px;
  cursor: pointer; font-family: inherit; box-shadow: 0 5px 0 #a06818;
}
#btnStart:active, #btnReplay:active, #btnBackMenu:active { transform: translateY(3px); box-shadow: 0 2px 0 #a06818; }
#btnBackMenu { background: rgba(255, 255, 255, .12); color: #f3efe4; box-shadow: 0 5px 0 rgba(0, 0, 0, .4); font-size: 16px; }
.howto { font-size: 13.5px; opacity: .8; line-height: 1.7; max-width: 600px; }

/* ---- Bannière centrale ---- */
#banner {
  position: absolute; left: 50%; top: 34%; transform: translate(-50%, -50%);
  font-size: clamp(22px, 4vw, 42px); font-weight: 800;
  text-shadow: 0 3px 0 rgba(0, 0, 0, .5);
  background: rgba(10, 26, 16, .75); padding: 14px 34px; border-radius: 16px;
  z-index: 15; pointer-events: none; white-space: nowrap;
  animation: pop .35s ease-out;
}
#banner.small { font-size: 17px; padding: 8px 20px; top: 20%; opacity: .95; }
@keyframes pop { from { transform: translate(-50%, -50%) scale(.6); opacity: 0; } }
