* { box-sizing: border-box; }
body { font-family: system-ui, Arial, sans-serif; margin: 0; color: #e6e6f0;
  /* Background image of the Tenka Ichi Budokai */
  background: url('./assets/tenkaichibudokai.webp') center / cover no-repeat fixed, #0f1220;
}
/* Improve readability of names over the background */
.fighter .name { font-weight: 700; margin-bottom: 6px; text-shadow: 0 2px 4px rgba(0,0,0,0.55), 0 0 2px rgba(0,0,0,0.5); }
/* Slightly elevate fight panels to stand out on photo */
.fighter { background: rgba(21,26,58,0.88); backdrop-filter: blur(2px); border: 1px solid #2a2f55; border-radius: 8px; padding: 10px; min-height: 90px; position: relative; }
.container { max-width: 1100px; margin: 0 auto; padding: 24px; }
h1 { text-align: center; margin-bottom: 16px; }
.hidden { display: none; }

.grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.grid input { padding: 8px; background: #1a1f3a; border: 1px solid #2a2f55; color: #e6e6f0; border-radius: 6px; }
.actions { margin-top: 12px; display: flex; gap: 8px; }
button { background: #4253ff; color: white; border: none; padding: 8px 12px; border-radius: 6px; cursor: pointer; }
button:hover { background: #5a6aff; }
button:disabled { background: #444a7a; cursor: not-allowed; }

.layout { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.bracket { background: #101433; border: 1px solid #232a5c; border-radius: 8px; padding: 12px; min-height: 400px; overflow-x: auto; }
.arena { background: #101433; border: 1px solid #232a5c; border-radius: 8px; padding: 12px; }

.round { display: grid; gap: 8px; margin-bottom: 12px; }
.round-title { font-weight: bold; margin-bottom: 6px; }
.match { display: grid; grid-template-columns: 1fr; gap: 4px; }
.slot { background: #1a1f3a; border: 1px solid #2a2f55; border-radius: 6px; padding: 6px 8px; display: flex; justify-content: space-between; align-items: center; }
.slot.winner { border-color: #39d98a; }
.slot.loser { opacity: 0.5; }

.fight-area { display: grid; grid-template-columns: 1fr auto 1fr; gap: 12px; align-items: center; margin: 12px 0; }
.hpbar { height: 12px; background: #2a2f55; border-radius: 6px; overflow: hidden; }
.hp { height: 100%; width: 100%; background: linear-gradient(90deg, #39d98a, #1ece7a); transition: width 250ms ease; }
.vs { font-size: 20px; font-weight: 700; opacity: 0.8; }

/* Minimal hit animation */
.hit { animation: hit 200ms ease; }
@keyframes hit { 0% { transform: translateX(0); } 50% { transform: translateX(-6px); } 100% { transform: translateX(0); } }

/* Simple personnages (stick emoji) and animations */
.character {
  position: absolute;
  bottom: 10px;
  left: 10px;
  width: 36px; height: 36px;
  display: grid; place-items: center;
  font-size: 24px;
  transition: transform 200ms ease;
}
#fighter-b .character { left: auto; right: 10px; }
.character.walk-in-left { animation: walkInLeft 500ms ease-out; }
.character.walk-in-right { animation: walkInRight 500ms ease-out; }
.character.attack { animation: attack 320ms ease-out; }
.character.hitFx { animation: gotHit 260ms ease-out; }
.character.victory { animation: victory 900ms ease-in-out infinite alternate; }

@keyframes walkInLeft { from { transform: translateX(-40px); opacity: 0.5; } to { transform: translateX(0); opacity: 1; } }
@keyframes walkInRight { from { transform: translateX(40px); opacity: 0.5; } to { transform: translateX(0); opacity: 1; } }
@keyframes attack { 0% { transform: translateX(0); } 50% { transform: translateX(16px) scale(1.1); } 100% { transform: translateX(0); } }
@keyframes gotHit { 0% { transform: translateX(0); } 30% { transform: translateX(-8px) rotate(-6deg); } 100% { transform: translateX(0); } }
@keyframes victory { 0% { transform: translateY(0) rotate(0); } 100% { transform: translateY(-6px) rotate(3deg); } }

.log { background: #0e1230; border: 1px solid #232a5c; min-height: 120px; max-height: 200px; overflow: auto; border-radius: 8px; padding: 8px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.log p { margin: 0 0 4px 0; }

/* Hall of Fame styles */
#hall { margin-top: 24px; }
#winners.empty::after { content: 'Aucun vainqueur enregistré pour le moment.'; display: block; opacity: 0.7; padding: 8px; }
.winners-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.winner-card { background: radial-gradient(120px 60px at top left, rgba(66,83,255,0.25), transparent 60%), #101433; border: 1px solid #232a5c; border-radius: 10px; padding: 10px; position: relative; overflow: hidden; }
.winner-card .trophy { position: absolute; right: 8px; top: 8px; font-size: 18px; filter: drop-shadow(0 0 6px rgba(255,215,0,0.35)); }
.winner-card .name { font-weight: 700; letter-spacing: 0.3px; }
.winner-card .date { font-size: 12px; opacity: 0.8; margin-top: 4px; }
.winner-card:hover { transform: translateY(-2px); transition: transform 160ms ease; }

@media (max-width: 900px) { .layout { grid-template-columns: 1fr; } .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Winner overlay */
#winner-overlay { position: fixed; inset: 0; background: rgba(5, 7, 16, 0.85); display: grid; place-items: center; z-index: 1000; }
#winner-overlay.hidden { display: none; }
.winner-modal { position: relative; width: min(680px, 92vw); background: linear-gradient(180deg, #13183f, #0e1230); border: 1px solid #3941a8; border-radius: 16px; padding: 28px 20px 24px; text-align: center; overflow: hidden; box-shadow: 0 10px 40px rgba(20,20,60,0.6); }
.winner-title { font-size: 18px; letter-spacing: 2px; text-transform: uppercase; opacity: 0.85; margin-bottom: 6px; }
.winner-name { font-size: clamp(28px, 6vw, 48px); font-weight: 900; line-height: 1.1; text-shadow: 0 0 18px rgba(255,255,255,0.12); margin-bottom: 14px; }
.winner-modal button { margin-top: 8px; }

/* Fireworks glow */
.fireworks::before, .fireworks::after { content: ""; position: absolute; width: 160px; height: 160px; background: radial-gradient(circle, rgba(255,215,0,0.35), rgba(255,215,0,0) 60%); border-radius: 50%; filter: blur(2px); animation: fw 2.2s infinite ease-out; }
.fireworks::after { left: auto; right: 10%; top: 10%; animation-delay: 0.8s; }
.fireworks::before { left: 8%; top: 20%; }
@keyframes fw { 0% { transform: scale(0.2); opacity: 0.6; } 70% { opacity: 0.35; } 100% { transform: scale(1.8); opacity: 0; } }

/* Confetti pieces */
.confetti { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.confetti .piece { position: absolute; top: -12px; width: 10px; height: 16px; opacity: 0.9; transform: rotate(0) translateY(-20px); animation: fall linear forwards; }
.confetti .piece.square { border-radius: 2px; }
.confetti .piece.circle { border-radius: 50%; }
@keyframes fall { to { transform: rotate(360deg) translateY(110vh); } }
