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

body {
  font-family: 'Inter', sans-serif;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  background: linear-gradient(135deg, #1a0a00, #2d1600, #1a0a00);
  color: #e0e0e0;
  padding: 16px;
}

#app {
  position: relative; z-index: 1;
  background: rgba(20, 20, 35, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 24px;
  padding: 28px 24px 24px;
  max-width: 560px;
  width: 100%;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  text-align: center;
}

.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.back-link {
  font-size: 0.85rem;
  color: #fb923c;
  text-decoration: none;
  font-weight: 600;
  transition: color 0.2s;
}
.back-link:hover { color: #fdba74; }

h1 {
  font-size: 1.35rem;
  font-weight: 800;
  background: linear-gradient(90deg, #fb923c, #f97316, #ea580c);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.diff-badge {
  font-size: 0.8rem;
  color: #fdba74;
  font-weight: 700;
}

.info-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding: 10px 16px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  gap: 12px;
}

.info-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.88rem;
  font-weight: 700;
}
.info-icon { font-size: 1.1rem; }

/* Arena */
.arena {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  margin-bottom: 20px;
  min-height: 160px;
}

.arena-side {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.arena-label {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
}
.arena-label-joueur { color: #fb923c; }
.arena-label-ia { color: #f87171; }

.arena-circle {
  width: 110px;
  height: 110px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3.2rem;
  background: rgba(15, 23, 42, 0.8);
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.4);
  transition: transform 0.3s, box-shadow 0.3s;
  user-select: none;
}

.arena-circle-joueur {
  border: 3px solid #fb923c;
}
.arena-circle-ia {
  border: 3px solid #f87171;
}

.arena-circle.reveal {
  animation: revealPop 0.4s ease-out;
}

@keyframes revealPop {
  0% { transform: scale(0.3); opacity: 0.3; }
  60% { transform: scale(1.15); }
  100% { transform: scale(1); opacity: 1; }
}

.arena-vs {
  font-size: 1.6rem;
  font-weight: 900;
  color: #64748b;
  text-shadow: 0 0 8px rgba(100, 116, 139, 0.3);
}

.result-text {
  font-size: 1.1rem;
  font-weight: 700;
  min-height: 1.5em;
  margin-bottom: 16px;
  transition: opacity 0.3s;
}
.result-win { color: #4ade80; }
.result-lose { color: #f87171; }
.result-draw { color: #fbbf24; }

/* Choice buttons */
.choices {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.choice-btn {
  width: 80px;
  height: 80px;
  border-radius: 16px;
  border: 2px solid rgba(249, 115, 22, 0.3);
  background: rgba(15, 23, 42, 0.7);
  cursor: pointer;
  font-size: 2.6rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  user-select: none;
  position: relative;
}

.choice-btn:hover:not(.disabled) {
  background: rgba(249, 115, 22, 0.15);
  border-color: #fb923c;
  transform: translateY(-4px);
  box-shadow: none;
}

.choice-btn:active:not(.disabled) {
  transform: translateY(-1px);
}

.choice-btn.disabled {
  opacity: 0.4;
  cursor: default;
}

.choice-btn.selected {
  border-color: #fb923c;
  background: rgba(249, 115, 22, 0.2);
  box-shadow: inset 0 0 0 2px rgba(249, 115, 22, 0.4);
}

.choice-label {
  position: absolute;
  bottom: -18px;
  font-size: 0.6rem;
  font-weight: 600;
  color: #94a3b8;
  white-space: nowrap;
}

.hint {
  font-size: 0.78rem;
  color: #64748b;
  margin-bottom: 12px;
}

/* History */
.history-section {
  margin-top: 8px;
  margin-bottom: 12px;
}

.history-label {
  font-size: 0.7rem;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.history-badges {
  display: flex;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
}

.history-badge {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.badge-win { background: rgba(74, 222, 128, 0.15); border-color: rgba(74, 222, 128, 0.3); }
.badge-lose { background: rgba(248, 113, 113, 0.15); border-color: rgba(248, 113, 113, 0.3); }
.badge-draw { background: rgba(251, 191, 36, 0.15); border-color: rgba(251, 191, 36, 0.3); }

/* Overlay */
.overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.85);
  z-index: 100;
  justify-content: center;
  align-items: center;
}
.overlay.visible { display: flex; }

.overlay-box {
  background: rgba(30, 27, 60, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 20px;
  padding: 32px;
  text-align: center;
  max-width: 400px;
  width: 90%;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.overlay-box h2 {
  font-size: 1.6rem;
  font-weight: 800;
  margin-bottom: 8px;
}

.overlay-box .win-text { color: #4ade80; }
.overlay-box .lose-text { color: #f87171; }
.overlay-box .draw-text { color: #fbbf24; }

.overlay-box p {
  color: #94a3b8;
  font-size: 0.9rem;
  margin-bottom: 20px;
}

.overlay-score-recap {
  font-size: 1.3rem;
  font-weight: 800;
  margin-bottom: 12px;
}

.btn {
  font-family: 'Inter', sans-serif;
  font-size: 0.9rem;
  font-weight: 700;
  padding: 10px 24px;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  color: #fff;
  transition: transform 0.2s, box-shadow 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  text-decoration: none;
}
.btn:hover { transform: translateY(-2px); }

.btn-primary {
  background: #f97316;
  box-shadow: none;
}

.btn-secondary {
  background: #ea580c;
  box-shadow: none;
}

.overlay-btns {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.cta-score-msg {
  color: #fb923c;
  font-size: 0.85rem;
  margin-bottom: 12px;
}

.cta-auth-btns {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-bottom: 16px;
}

.partage-score {
  margin-bottom: 16px;
}

/* Confetti */
.confetti {
  position: fixed;
  top: -10px;
  z-index: 200;
  pointer-events: none;
  font-size: 1.2rem;
  animation: confetti-fall 3s ease-in forwards;
}
@keyframes confetti-fall { to { transform: translateY(110vh) rotate(720deg); opacity: 0; } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 10%, 30%, 50%, 70%, 90% { transform: translateX(-4px); } 20%, 40%, 60%, 80% { transform: translateX(4px); } }
.shake { animation: shake 0.5s; }

/* Footer */
footer { font-size: 0.78rem; color: #64748b; margin-top: 8px; }
footer a { color: #fb923c; text-decoration: none; }
footer a:hover { color: #fdba74; }

@media (max-width: 480px) {
  #app { padding: 18px 12px 16px; border-radius: 18px; }
  h1 { font-size: 1.15rem; }
  .arena-circle { width: 85px; height: 85px; font-size: 2.4rem; }
  .arena { gap: 12px; min-height: 130px; }
  .choice-btn { width: 64px; height: 64px; font-size: 2rem; border-radius: 12px; }
  .choice-label { font-size: 0.55rem; }
  .info-bar { padding: 8px 10px; gap: 8px; }
  .info-item { font-size: 0.78rem; }
  .choices { gap: 8px; }
}
