/* Jeu Addition - Invaders : feuille de style scopée au wrapper du shortcode */

.jeu-addition-wrapper,
.jeu-addition-wrapper * {
  box-sizing: border-box;
}

.jeu-addition-wrapper {
  max-width: 640px;
  margin: 20px auto;
  padding: clamp(6px, 2.5vw, 14px);
  background: radial-gradient(ellipse at center, #0a0a2a 0%, #030310 70%);
  border-radius: 16px;
  font-family: 'Trebuchet MS', 'Comic Sans MS', sans-serif;
  color: #fff;
  -webkit-text-size-adjust: 100%;
}

.jeu-addition-wrapper.jeu-addition-login-required {
  text-align: center;
  padding: 30px 14px;
}
.jeu-addition-wrapper.jeu-addition-login-required a {
  display: inline-block;
  margin-top: 10px;
  padding: 10px 22px;
  background: #7CFC00;
  color: #05051a;
  font-weight: 800;
  border-radius: 10px;
  text-decoration: none;
  box-shadow: 0 0 14px #7CFC00;
}

.jeu-addition-wrapper h1 {
  text-align: center;
  font-size: clamp(16px, 5.5vw, 22px);
  margin: 0 0 6px;
  color: #7CFC00;
  text-shadow: 0 0 10px #7CFC00;
  letter-spacing: 1px;
}

.jeu-addition-wrapper #instructions {
  text-align: center;
  font-size: clamp(11px, 3.2vw, 14px);
  color: #b9c3ff;
  margin-bottom: 8px;
  padding: 0 4px;
}

.jeu-addition-wrapper #controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-bottom: 8px;
}

.jeu-addition-wrapper .ctrlBtn {
  background: rgba(255,255,255,0.08);
  border: 2px solid #4444aa;
  color: #fff;
  font-size: clamp(12px, 3.4vw, 14px);
  font-weight: 700;
  padding: clamp(5px, 1.6vw, 6px) clamp(10px, 3vw, 14px);
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
}
.jeu-addition-wrapper .ctrlBtn:hover { background: rgba(255,255,255,0.18); }
.jeu-addition-wrapper .ctrlBtn.active {
  background: #ffb703;
  color: #05051a;
  border-color: #ffb703;
  box-shadow: 0 0 10px #ffb703;
}

.jeu-addition-wrapper #hud {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px clamp(8px, 3vw, 14px);
  background: rgba(255,255,255,0.05);
  border: 2px solid #4444aa;
  border-radius: 10px 10px 0 0;
  font-size: clamp(14px, 4.2vw, 18px);
  font-weight: bold;
}

.jeu-addition-wrapper #score { color: #ffe066; }
.jeu-addition-wrapper #lives { letter-spacing: 3px; }

.jeu-addition-wrapper #equation {
  text-align: center;
  font-size: clamp(20px, 7.5vw, 30px);
  font-weight: 900;
  padding: clamp(8px, 3vw, 12px) 4px;
  background: rgba(20,20,60,0.7);
  border-left: 2px solid #4444aa;
  border-right: 2px solid #4444aa;
  color: #66f9ff;
  text-shadow: 0 0 12px #66f9ff;
  letter-spacing: 2px;
  word-spacing: 2px;
}

.jeu-addition-wrapper #playfield {
  position: relative;
  width: 100%;
  height: clamp(300px, 62vh, 440px);
  overflow: hidden;
  background: #05051a;
  border: 2px solid #4444aa;
  border-radius: 0 0 10px 10px;
  cursor:
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='34' height='34'><circle cx='17' cy='17' r='11' fill='none' stroke='%2366f9ff' stroke-width='2.5'/><line x1='17' y1='0' x2='17' y2='9' stroke='%2366f9ff' stroke-width='2.5'/><line x1='17' y1='25' x2='17' y2='34' stroke='%2366f9ff' stroke-width='2.5'/><line x1='0' y1='17' x2='9' y2='17' stroke='%2366f9ff' stroke-width='2.5'/><line x1='25' y1='17' x2='34' y2='17' stroke='%2366f9ff' stroke-width='2.5'/><circle cx='17' cy='17' r='2.2' fill='%2366f9ff'/></svg>") 17 17,
    crosshair;
}

.jeu-addition-wrapper #playfield.paused .invader {
  pointer-events: none;
  filter: grayscale(0.6) brightness(0.6);
}

.jeu-addition-wrapper #stars {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  pointer-events: none;
}

.jeu-addition-wrapper .star {
  position: absolute;
  background: #fff;
  border-radius: 50%;
  animation: jeuAdditionTwinkle 2s ease-in-out infinite;
}

@keyframes jeuAdditionTwinkle {
  0%, 100% { opacity: 0.2; }
  50% { opacity: 1; }
}

.jeu-addition-wrapper #limitLine {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 18%;
  border-top: 2px dashed rgba(255, 77, 77, 0.65);
  z-index: 1;
  pointer-events: none;
}
.jeu-addition-wrapper #limitLine::before {
  content: "⚠ limite";
  position: absolute;
  left: 6px;
  top: -18px;
  font-size: 11px;
  color: rgba(255, 120, 120, 0.85);
  font-weight: 700;
  letter-spacing: 1px;
}

.jeu-addition-wrapper .invader {
  position: absolute;
  width: 58px;
  height: 58px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  background: linear-gradient(160deg, #5b2c9e, #2b0f5c);
  border: 2px solid #b388ff;
  box-shadow: 0 0 12px #9b5cffaa;
  cursor: inherit;
  user-select: none;
  transition: transform 0.1s;
  z-index: 2;
}

.jeu-addition-wrapper .invader:hover {
  transform: scale(1.08);
}

.jeu-addition-wrapper .invader .icon {
  font-size: 18px;
  line-height: 1;
}

.jeu-addition-wrapper .invader .num {
  font-size: 19px;
  font-weight: 900;
  color: #fff;
}

.jeu-addition-wrapper .invader.blinking {
  animation: jeuAdditionBlink 0.22s steps(1, start) infinite;
  border-color: #ff4d4d;
  box-shadow: 0 0 20px #ff4d4d;
}
@keyframes jeuAdditionBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.15; }
}

.jeu-addition-wrapper .explode-good {
  animation: jeuAdditionPopGood 0.35s forwards;
  pointer-events: none;
}
.jeu-addition-wrapper .explode-bad {
  animation: jeuAdditionPopBad 0.35s forwards;
  pointer-events: none;
}

@keyframes jeuAdditionPopGood {
  to { transform: scale(1.7); opacity: 0; filter: brightness(2) hue-rotate(60deg); }
}
@keyframes jeuAdditionPopBad {
  to { transform: scale(1.4); opacity: 0; filter: brightness(2) hue-rotate(-40deg) saturate(3); }
}

.jeu-addition-wrapper .laser {
  position: absolute;
  height: 4px;
  background: linear-gradient(90deg, transparent, #66f9ff, #fff);
  box-shadow: 0 0 8px #66f9ff;
  transform-origin: 0 50%;
  pointer-events: none;
  z-index: 3;
}

/* ---------- Canon ---------- */
.jeu-addition-wrapper #cannon {
  position: absolute;
  bottom: 4px;
  left: 50%;
  transform: translateX(-50%);
  width: 54px;
  height: 46px;
  z-index: 1;
}
.jeu-addition-wrapper .cannon-base {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 26px;
  background: radial-gradient(circle at 50% 0%, #8b93a1, #374151 70%);
  border: 2px solid #1f2937;
  border-radius: 27px 27px 8px 8px;
  box-shadow: 0 0 12px rgba(124, 252, 0, 0.35), inset 0 2px 3px rgba(255,255,255,0.25);
}
.jeu-addition-wrapper .cannon-base::before,
.jeu-addition-wrapper .cannon-base::after {
  content: "";
  position: absolute;
  bottom: 3px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #2b3341;
  border: 1px solid #0f1420;
}
.jeu-addition-wrapper .cannon-base::before { left: 6px; }
.jeu-addition-wrapper .cannon-base::after { right: 6px; }

.jeu-addition-wrapper .cannon-barrel {
  position: absolute;
  left: 50%;
  top: -4px;
  width: 15px;
  height: 30px;
  transform: translateX(-50%);
  background: linear-gradient(180deg, #e5e7eb, #9ca3af 45%, #4b5563 100%);
  border: 1.5px solid #1f2937;
  border-radius: 5px 5px 2px 2px;
  box-shadow: 0 0 6px rgba(255,255,255,0.3);
}
.jeu-addition-wrapper .cannon-barrel::after {
  content: "";
  position: absolute;
  left: 2px;
  top: 3px;
  width: 3px;
  height: 18px;
  background: rgba(255,255,255,0.35);
  border-radius: 2px;
}

.jeu-addition-wrapper .cannon-light {
  position: absolute;
  left: 50%;
  top: -9px;
  width: 8px;
  height: 8px;
  transform: translateX(-50%);
  background: #7CFC00;
  border-radius: 50%;
  box-shadow: 0 0 8px #7CFC00, 0 0 16px #7CFC00;
}

.jeu-addition-wrapper .feedback {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  font-size: clamp(18px, 5.5vw, 26px);
  font-weight: 900;
  pointer-events: none;
  animation: jeuAdditionFloatUp 0.7s forwards;
  z-index: 4;
  white-space: nowrap;
}
.jeu-addition-wrapper .feedback.good { color: #7CFC00; text-shadow: 0 0 10px #7CFC00; }
.jeu-addition-wrapper .feedback.bad { color: #ff4d4d; text-shadow: 0 0 10px #ff4d4d; }

@keyframes jeuAdditionFloatUp {
  0% { opacity: 1; top: 10px; }
  100% { opacity: 0; top: -20px; }
}

.jeu-addition-wrapper #pauseOverlay,
.jeu-addition-wrapper #gameover {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(3,3,15,0.92);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  z-index: 10;
  padding: 10px;
}
.jeu-addition-wrapper #pauseOverlay.hidden,
.jeu-addition-wrapper #gameover.hidden { display: none; }

.jeu-addition-wrapper #pauseOverlay h2 {
  color: #ffb703;
  font-size: clamp(22px, 6vw, 30px);
  margin: 0;
  text-shadow: 0 0 12px #ffb703;
}
.jeu-addition-wrapper #pauseOverlay p {
  font-size: clamp(12px, 3.4vw, 14px);
  color: #b9c3ff;
  margin-top: 6px;
}

.jeu-addition-wrapper #gameover {
  cursor: pointer;
}
.jeu-addition-wrapper #gameover h2 {
  color: #ff4d4d;
  font-size: clamp(22px, 6vw, 30px);
  margin: 0 0 6px;
  text-shadow: 0 0 12px #ff4d4d;
}
.jeu-addition-wrapper #gameover p { font-size: clamp(14px, 4vw, 18px); margin: 4px 0 18px; }
.jeu-addition-wrapper #restartBtn {
  background: #7CFC00;
  color: #05051a;
  border: none;
  font-size: clamp(15px, 4.4vw, 18px);
  font-weight: 800;
  padding: 10px 26px;
  border-radius: 10px;
  cursor: pointer;
  box-shadow: 0 0 14px #7CFC00;
}
.jeu-addition-wrapper #restartBtn:hover { filter: brightness(1.1); }
