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

body {
  background: #0a0a0a;
  color: #d8d8d8;
  font-family: "Segoe UI", "DejaVu Sans", sans-serif;
  overflow: hidden;
  height: 100vh;
}

#app { width: 100vw; height: 100vh; display: flex; align-items: center; justify-content: center; }

.screen {
  width: 100%;
  max-width: 1100px;
  height: 100vh;
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  overflow-y: auto;
}

#gameScreen { overflow: visible; height: auto; }
#gameOver { overflow: visible; height: auto; }

.hidden { display: none !important; }

.title {
  font-size: 42px;
  letter-spacing: 4px;
  color: #ffb347;
  text-shadow: 0 0 12px #ff6b00, 2px 2px 0 #220;
}

.subtitle { color: #888; font-size: 14px; }

.gold-display {
  background: #222;
  border: 1px solid #555;
  padding: 8px 18px;
  border-radius: 6px;
  font-size: 18px;
  color: #ffd54a;
}

.menu-buttons { display: flex; gap: 20px; }

.big-btn {
  background: linear-gradient(#3a3a3a, #222);
  border: 2px solid #ffb347;
  color: #ffe0b3;
  font-size: 18px;
  padding: 14px 30px;
  border-radius: 8px;
  cursor: pointer;
  transition: transform .1s, background .2s;
}
.big-btn:hover { background: linear-gradient(#4a4a4a, #2a2a2a); transform: translateY(-2px); }

.panel {
  background: #161616;
  border: 1px solid #333;
  border-radius: 8px;
  padding: 14px 18px;
  width: 100%;
  max-width: 760px;
}
.panel h2 { color: #ffb347; font-size: 16px; margin-bottom: 10px; letter-spacing: 1px; }
.hint { color: #777; font-size: 12px; margin-top: 8px; }

.difficulty-row { display: flex; flex-wrap: wrap; gap: 16px; }
.difficulty-row label { cursor: pointer; font-size: 14px; }
.difficulty-row input { margin-right: 4px; }

.skin-shop {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
}
.skin-card {
  background: #1f1f1f;
  border: 2px solid #333;
  border-radius: 8px;
  padding: 8px;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s;
}
.skin-card.equipped { border-color: #4caf50; }
.skin-card.locked { opacity: .6; }
.skin-card:hover { border-color: #ffb347; }
.skin-preview { width: 100%; height: 70px; background: #000; border-radius: 4px; margin-bottom: 6px; }
.skin-name { font-size: 13px; color: #eee; }
.skin-cost { font-size: 12px; color: #ffd54a; }
.skin-status { font-size: 11px; margin-top: 4px; }

.controls-grid { display: flex; gap: 30px; justify-content: center; font-size: 13px; color: #bbb; }
.controls-info { max-width: 600px; }

/* Marché des améliorations */
.upgrade-shop { display: flex; flex-direction: column; gap: 10px; }
.upgrade-row { display: flex; align-items: center; justify-content: space-between; background: #1f1f1f; border: 1px solid #333; border-radius: 6px; padding: 10px 12px; }
.up-info { font-size: 13px; color: #ddd; }
.small-btn { font-size: 14px; padding: 8px 16px; }

/* Boutique arme de départ */
.starter-shop { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.starter-card { background: #1f1f1f; border: 2px solid #333; border-radius: 8px; padding: 8px; text-align: center; cursor: pointer; font-size: 12px; color: #ddd; transition: border-color .15s; }
.starter-card.active { border-color: #4caf50; }
.starter-card:hover { border-color: #ffb347; }
.starter-card canvas { background: #000; border-radius: 4px; margin-bottom: 6px; }

.ffa-btn { border-color: #b14dff; color: #e0b3ff; }
.colyse-btn { border-color: #ffcf3f; color: #ffe9b0; background: linear-gradient(#5a4a12, #2a2208); }
.colyse-btn:hover { background: linear-gradient(#6a5a18, #3a2e0c); }
.folie-btn { border-color: #ff6b00; color: #ffc39a; background: linear-gradient(#4a1a08, #220a02); }
.folie-btn:hover { background: linear-gradient(#5a200a, #2e0e03); }
.record-panel { border-color: #6a2aa0; }
.record-panel p { font-weight: bold; font-size: 14px; }

/* HUD */
#gameScreen { gap: 6px; }
#hud {
  width: 1024px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}
.hud-player {
  background: #111;
  border: 1px solid #333;
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 12px;
  min-width: 200px;
}
.hp-bar { height: 12px; background: #400; border-radius: 4px; overflow: hidden; margin: 4px 0; }
.hp-fill { height: 100%; background: linear-gradient(#e53935,#b71c1c); transition: width .2s; }
.shot-counter { display: inline-block; margin: 4px 0; padding: 2px 8px; border: 1px solid #ffd54a; border-radius: 4px; background: #2a2205; color: #ffd54a; font-weight: bold; }
.ammo-list { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.weapon-slot { background: #222; border: 1px solid #444; border-radius: 3px; padding: 2px 6px; font-size: 11px; }
.weapon-slot.active { border-color: #ffb347; color: #ffb347; }

#roundInfo {
  background: #111;
  border: 1px solid #333;
  border-radius: 6px;
  padding: 8px 14px;
  font-size: 14px;
  color: #ffb347;
  text-align: center;
}

#canvas {
  border: 2px solid #333;
  background: #000;
  display: block;
  cursor: crosshair;
  -webkit-user-drag: none;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

#gameMsg {
  position: fixed;
  top: 40%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 36px;
  color: #ffb347;
  text-shadow: 0 0 14px #ff6b00;
  text-align: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity .4s;
}
#gameMsg.show { opacity: 1; }

#gameOver { text-align: center; }
#goTitle { color: #e53935; text-shadow: 0 0 12px #b71c1c; }
#goStats { font-size: 18px; margin: 16px 0; color: #eee; }

/* Boutons fixes */
.top-right-btns { position: fixed; top: 10px; right: 10px; z-index: 1000; display: flex; flex-direction: column; gap: 8px; }
.save-btn { background: linear-gradient(#2e7d32, #1b5e20); border-color: #66bb6a; color: #c8e6c9; font-size: 15px; padding: 10px 18px; }
.save-btn:hover { background: linear-gradient(#388e3c, #2e7d32); }
.options-btn { background: linear-gradient(#37474f, #263238); border-color: #607d8b; color: #b0bec5; font-size: 14px; padding: 8px 16px; }
.top-left-btn { position: fixed; top: 10px; left: 10px; z-index: 1000; display: flex; flex-direction: column; gap: 8px; }

/* Modales */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.7); z-index: 2000; display: flex; align-items: center; justify-content: center; }
.modal { background: #161616; border: 1px solid #444; border-radius: 10px; padding: 20px 24px; max-width: 560px; width: 92%; max-height: 85vh; overflow-y: auto; color: #ddd; }
.modal h2 { color: #ffb347; margin-bottom: 12px; }
.modal h3 { color: #ffb347; margin: 12px 0 4px; font-size: 14px; }
.modal label, .modal .opt-row { display: block; margin: 10px 0; font-size: 14px; }
.modal .opt-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.modal select, .modal input[type="range"] { margin-left: 8px; }
#tutorialContent p { line-height: 1.6; margin: 6px 0; font-size: 13px; color: #ccc; }

/* Toast */
.toast { position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%); background: #2e7d32; color: #e8f5e9; padding: 12px 24px; border-radius: 8px; font-size: 16px; z-index: 3000; box-shadow: 0 0 12px #2e7d32; }

/* Boutique mascottes */
.pet-shop { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.pet-card { background: #1f1f1f; border: 2px solid #333; border-radius: 8px; padding: 8px; text-align: center; cursor: pointer; font-size: 12px; color: #ddd; transition: border-color .15s; }
.pet-card.equipped { border-color: #4caf50; }
.pet-card:hover { border-color: #ffb347; }
.pet-card canvas { background: #000; border-radius: 4px; margin-bottom: 6px; }

/* Boutique potions */
.potion-shop { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; max-height: 420px; overflow-y: auto; }
.potion-card { background: #1f1f1f; border: 2px solid #333; border-radius: 8px; padding: 8px; text-align: center; font-size: 12px; color: #ddd; }
.potion-card canvas { background: #000; border-radius: 4px; margin-bottom: 4px; }
.potion-buy { margin-top: 6px; padding: 6px 12px; font-size: 12px; }
.potion-loadout { display: flex; gap: 14px; justify-content: center; margin: 8px 0; }
.loadout-slot { background: #1f1f1f; border: 2px dashed #555; border-radius: 8px; padding: 8px 12px; text-align: center; min-width: 110px; cursor: pointer; font-size: 12px; color: #ccc; }
.loadout-slot.filled { border-style: solid; border-color: #ffb347; }
.panel-sub { color: #ffb347; font-size: 14px; margin: 12px 0 6px; }
.slot-picker { margin-top: 6px; display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.slot-picker button { padding: 4px 8px; font-size: 11px; }

/* Encyclopédie */
.ency-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }
.ency-card { background: #1f1f1f; border: 1px solid #333; border-radius: 6px; padding: 8px; font-size: 12px; color: #ddd; }
.ency-card.locked { opacity: .5; color: #666; }
.ency-name { color: #eee; font-weight: bold; margin-bottom: 4px; }
.ency-card .hint { margin-top: 4px; }

/* Marché des pouvoirs — compact : 2 à 3 par ligne */
.power-shop { display: grid; grid-template-columns: repeat(auto-fill, minmax(205px, 1fr)); gap: 8px; max-height: 520px; overflow-y: auto; }
.power-card { background: #1f1f1f; border: 2px solid #444; border-radius: 8px; padding: 7px 9px; text-align: center; font-size: 11px; color: #ddd; cursor: pointer; transition: border-color .15s; display: flex; flex-direction: column; align-items: center; }
.power-card:hover { border-color: #b14dff; }
.power-card.owned { border-color: #4caf50; cursor: default; }
.power-card.owned:hover { border-color: #4caf50; }
.power-card.equipped { border-color: #4caf50; box-shadow: 0 0 10px rgba(76,175,80,0.35); }
.power-badge {
  width: 38px; height: 38px; line-height: 38px; margin: 0 auto 4px;
  border-radius: 50%; color: #0a0a0a; font-weight: bold; font-size: 17px;
  border: 2px solid rgba(0,0,0,0.5); box-shadow: 0 0 8px rgba(255,255,255,0.15);
}
.power-card .hint { margin-top: 3px; line-height: 1.25; }
.power-toggle { margin-top: 5px; font-size: 11px; padding: 4px 8px; }

/* Badge "Vainqueur du Colisée" (menu) */
.colyse-badge {
  display: inline-block; margin: 4px auto 10px; padding: 8px 20px;
  border-radius: 30px; font-weight: bold; font-size: 16px; letter-spacing: 1px;
  background: linear-gradient(180deg, #fff3b0, #ffd700 45%, #b8860b);
  color: #3a2a00; text-shadow: 0 1px 0 rgba(255,255,255,0.6);
  box-shadow: 0 0 26px #ffd700, inset 0 0 12px rgba(255,255,255,0.7);
  animation: colyseGlow 1.6s ease-in-out infinite alternate;
}
.colyse-badge.hidden { display: none; }
@keyframes colyseGlow { from { filter: brightness(0.9); } to { filter: brightness(1.25); } }

/* Journal (encyclopédie) : armes cliquables une fois l'encyclopédie complète */
.ency-card.pickable { cursor: pointer; }
.ency-card.pickable:hover { outline: 1px solid #ffb347; }
.ency-card.picked { outline: 2px solid #ffd700; box-shadow: 0 0 14px #ffd700; }

/* Configuration / étalonnage de la manette */
.gamepad-config { display: flex; flex-direction: column; gap: 4px; margin: 10px 0; max-height: 46vh; overflow-y: auto; }
.gp-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 4px 8px; border: 1px solid #333; border-radius: 5px; background: #141414; }
.gp-row.capturing { border-color: #ffb347; box-shadow: 0 0 10px rgba(255,179,71,0.5); }
.gp-label { font-size: 12px; color: #ddd; }
.gp-value { font-size: 12px; font-weight: bold; color: #7ab648; min-width: 64px; text-align: right; }
.gp-row.capturing .gp-value { color: #ffb347; }
