body { overflow: hidden; }

/* ---------- Screens ---------- */
.screen { display: none; width: 100%; max-width: 500px; padding: 20px; text-align: center; }
.screen.active { display: flex; flex-direction: column; align-items: center; }

/* ---------- Menu ---------- */
#menu h1 { font-size: 2rem; margin-bottom: 8px; }
#menu p { opacity: .8; margin-bottom: 24px; }

.table-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  width: 100%;
  max-width: 320px;
  margin-bottom: 24px;
}

.table-btn {
  background: rgba(255,255,255,.15);
  border: 2px solid rgba(255,255,255,.3);
  border-radius: 12px;
  color: #fff;
  font-size: 1.4rem;
  font-weight: 700;
  padding: 14px 0;
  cursor: pointer;
  transition: .2s;
}
.table-btn:hover { background: rgba(255,255,255,.3); transform: scale(1.08); }
.table-btn.selected { background: #fff; color: #764ba2; border-color: #fff; }

.start-btn {
  background: #fff;
  color: #764ba2;
  border: none;
  border-radius: 50px;
  padding: 14px 48px;
  font-size: 1.2rem;
  font-weight: 700;
  cursor: pointer;
  transition: .2s;
  opacity: .4;
  pointer-events: none;
}
.start-btn.ready { opacity: 1; pointer-events: auto; }
.start-btn.ready:hover { transform: scale(1.05); box-shadow: 0 4px 20px rgba(0,0,0,.25); }

/* ---------- Game ---------- */
#game {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  max-width: none;
  padding: 0;
  overflow: hidden;
}
#game.active { display: block; }

/* HUD */
.game-hud {
  position: absolute;
  top: 0; left: 0; right: 0;
  z-index: 10;
  padding: 44px 20px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(0,0,0,.18);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.hud-lives {
  font-size: 1.3rem;
  min-width: 80px;
}

.hud-question {
  font-size: 2rem;
  font-weight: 800;
  text-shadow: 0 2px 10px rgba(0,0,0,.25);
  flex: 1;
  text-align: center;
}

.hud-score-timer {
  text-align: right;
  font-size: 1rem;
  font-weight: 700;
  min-width: 80px;
  line-height: 1.5;
}
.hud-score-timer .timer { font-size: 1.2rem; display: block; }

/* ---------- Balloon field ---------- */
#balloonField {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
}

/* Sur grands écrans, éviter la zone des pubs latérales (160px + 10px marge) */
@media (min-width: 1201px) {
  #balloonField { left: 180px; right: 180px; }
  .game-hud { left: 180px; right: 180px; }
}

.balloon-wrapper {
  position: absolute;
  bottom: -160px;
  display: flex;
  flex-direction: column;
  align-items: center;
  animation: floatUp linear forwards;
  cursor: pointer;
}

@keyframes floatUp {
  from { transform: translateY(0); }
  to   { transform: translateY(calc(-100vh - 220px)); }
}

.balloon {
  --color: #ff6b6b;
  width: 75px;
  height: 90px;
  border-radius: 50%;
  background: var(--color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  font-weight: 800;
  color: #fff;
  text-shadow: 0 1px 4px rgba(0,0,0,.3);
  filter: drop-shadow(0 4px 10px rgba(0,0,0,.25));
  position: relative;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: transform .1s;
}

/* Triangle pointe en bas */
.balloon::after {
  content: '';
  position: absolute;
  bottom: -10px;
  left: 50%;
  transform: translateX(-50%);
  border-left: 7px solid transparent;
  border-right: 7px solid transparent;
  border-top: 12px solid var(--color);
}

.balloon-string {
  width: 2px;
  height: 38px;
  background: rgba(255,255,255,.5);
}

.balloon-wrapper:active .balloon { transform: scale(.93); }

/* Pop animation (bonne réponse) */
@keyframes popBalloon {
  0%   { transform: scale(1);   opacity: 1; }
  50%  { transform: scale(1.7); opacity: .5; }
  100% { transform: scale(0);   opacity: 0; }
}
.balloon.pop {
  animation: popBalloon .3s ease forwards;
  pointer-events: none;
}

/* Shake animation (mauvaise réponse) */
@keyframes shakeBalloon {
  0%, 100% { transform: translateX(0); }
  25%      { transform: translateX(-9px); }
  75%      { transform: translateX(9px); }
}
.balloon.wrong {
  animation: shakeBalloon .4s ease;
  filter: brightness(.65) drop-shadow(0 0 12px #f44);
}

/* ---------- Results ---------- */
#results {
  max-height: 100dvh;
  overflow-y: auto;
  padding-bottom: 40px;
}
#results h2 { font-size: 2rem; margin-bottom: 8px; }
#results .final-score { font-size: 3.2rem; font-weight: 800; margin: 16px 0; }
#results .stats { opacity: .85; margin-bottom: 24px; line-height: 1.8; font-size: 1.1rem; }

.replay-btn {
  background: #fff;
  color: #764ba2;
  border: none;
  border-radius: 50px;
  padding: 14px 48px;
  font-size: 1.2rem;
  font-weight: 700;
  cursor: pointer;
  transition: .2s;
  margin-top: 8px;
}
.replay-btn:hover { transform: scale(1.05); }

/* ---------- Mobile ---------- */
@media (max-width: 600px) {
  .game-hud { padding: 44px 14px 10px; }
  .hud-question { font-size: 1.5rem; }
  .hud-lives { font-size: 1rem; min-width: 64px; }
  .hud-score-timer { font-size: .85rem; min-width: 64px; }
  .hud-score-timer .timer { font-size: 1rem; }
  .balloon { width: 62px; height: 74px; font-size: 1.3rem; }
  .balloon-string { height: 28px; }
}
