/* ── Reset & Base ─────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --player:   #7c3aed;   /* violet  */
  --cpu:      #ef4444;   /* red     */
  --win:      #059669;   /* emerald */
  --lose:     #ef4444;
  --draw:     #6366f1;
  --neutral:  #64748b;
  --bg:       #f1f5ff;
  --card:     #ffffff;
  --text:     #1e1b4b;
  --muted:    #94a3b8;
  --radius:   1.2rem;
  --spring:   cubic-bezier(.34,1.56,.64,1);
}

body {
  font-family: 'Nunito', sans-serif;
  background: var(--bg);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
  overflow-x: hidden;
  position: relative;
}

/* ── Decorative Blobs ─────────────────────────────────── */
.blob {
  position: fixed;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.18;
  pointer-events: none;
  z-index: 0;
}
.blob-1 {
  width: 420px; height: 420px;
  background: var(--player);
  top: -100px; left: -100px;
}
.blob-2 {
  width: 320px; height: 320px;
  background: var(--cpu);
  bottom: -80px; right: -80px;
}
.blob-3 {
  width: 200px; height: 200px;
  background: #f59e0b;
  top: 45%; left: 55%;
}

/* ── Game Wrapper ─────────────────────────────────────── */
.game-wrapper {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 560px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.6rem;
}

/* ── Header ───────────────────────────────────────────── */
.game-header {
  text-align: center;
}

.game-header h1 {
  font-size: 2.2rem;
  font-weight: 900;
  color: var(--text);
  letter-spacing: -0.5px;
}

.subtitle {
  font-size: 0.95rem;
  color: var(--muted);
  font-weight: 600;
  margin-top: 0.3rem;
}

/* ── Scoreboard ───────────────────────────────────────── */
.scoreboard {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: 0 4px 24px rgba(0,0,0,0.07);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 1.4rem 2rem;
  gap: 0;
}

.score-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  flex: 1;
}

.score-label {
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.player-side .score-label { color: var(--player); }
.cpu-side    .score-label { color: var(--cpu); }

.score-num {
  font-size: 3.5rem;
  font-weight: 900;
  line-height: 1;
  color: var(--text);
  transition: transform 0.3s var(--spring);
}

.score-num.bump {
  animation: scoreBump 0.4s var(--spring);
}

.score-divider {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 1.5rem;
}

.vs-text {
  font-size: 1.1rem;
  font-weight: 900;
  color: var(--muted);
  letter-spacing: 2px;
}

/* ── Battle Arena ─────────────────────────────────────── */
.battle-arena {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: 0 4px 24px rgba(0,0,0,0.07);
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.6rem 2rem;
  gap: 1rem;
}

.arena-side {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.7rem;
  flex: 1;
}

.arena-label {
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
}

.arena-icon {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 3px solid transparent;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
  overflow: hidden;
}

#userArena .arena-icon  { border-color: #e9d5ff; }
#compArena .arena-icon  { border-color: #fecaca; }

.arena-icon img {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: 50%;
  animation: popIn 0.4s var(--spring);
}

.placeholder-icon {
  font-size: 2.5rem;
  color: #cbd5e1;
  font-weight: 900;
}

.arena-icon.reveal {
  animation: iconReveal 0.45s var(--spring);
}

.arena-bolt {
  font-size: 2rem;
  flex-shrink: 0;
}

/* ── Result Message ───────────────────────────────────── */
.msg-container {
  width: 100%;
  text-align: center;
}

#msg {
  display: inline-block;
  font-size: 1.15rem;
  font-weight: 800;
  padding: 0.75rem 2rem;
  border-radius: 100px;
  transition: background 0.3s ease, color 0.15s ease, transform 0.3s var(--spring);
}

#msg.msg-neutral {
  background: #e2e8f0;
  color: var(--neutral);
}
#msg.msg-win {
  background: #d1fae5;
  color: var(--win);
  animation: msgPop 0.4s var(--spring);
}
#msg.msg-lose {
  background: #fee2e2;
  color: var(--lose);
  animation: msgPop 0.4s var(--spring);
}
#msg.msg-draw {
  background: #e0e7ff;
  color: var(--draw);
  animation: msgPop 0.4s var(--spring);
}

/* ── Choices ──────────────────────────────────────────── */
.choices {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1.2rem;
  width: 100%;
}

.choice {
  background: var(--card);
  border: 3px solid #e2e8f0;
  border-radius: 1.4rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 1.2rem 1rem;
  cursor: pointer;
  transition: transform 0.2s var(--spring), border-color 0.2s ease,
              box-shadow 0.2s ease;
  flex: 1;
  max-width: 155px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
  -webkit-tap-highlight-color: transparent;
}

.choice:hover {
  transform: translateY(-6px) scale(1.04);
  border-color: var(--player);
  box-shadow: 0 10px 30px rgba(124,58,237,0.18);
}

.choice:active {
  transform: scale(0.94);
}

.choice.selected {
  border-color: var(--player);
  box-shadow: 0 0 0 4px rgba(124,58,237,0.15);
  animation: choicePick 0.35s var(--spring);
}

.choice img {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 50%;
  pointer-events: none;
}

.choice-label {
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ── Reset Button ─────────────────────────────────────── */
.reset-btn {
  background: transparent;
  border: 2px solid #e2e8f0;
  color: var(--muted);
  font-family: 'Nunito', sans-serif;
  font-size: 0.88rem;
  font-weight: 700;
  padding: 0.6rem 1.6rem;
  border-radius: 100px;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s, background 0.2s;
  letter-spacing: 0.3px;
}

.reset-btn:hover {
  border-color: var(--cpu);
  color: var(--cpu);
  background: #fff1f2;
}

/* ── Thinking Spinner (CPU) ───────────────────────────── */
.thinking-dots {
  display: flex;
  gap: 5px;
  align-items: center;
  justify-content: center;
}

.thinking-dots span {
  width: 8px;
  height: 8px;
  background: var(--cpu);
  border-radius: 50%;
  animation: dotBounce 0.6s ease-in-out infinite;
}
.thinking-dots span:nth-child(2) { animation-delay: 0.15s; }
.thinking-dots span:nth-child(3) { animation-delay: 0.3s; }

/* ── Keyframe Animations ──────────────────────────────── */
@keyframes scoreBump {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.4); }
  70%  { transform: scale(0.9); }
  100% { transform: scale(1); }
}

@keyframes popIn {
  0%   { transform: scale(0) rotate(-20deg); opacity: 0; }
  70%  { transform: scale(1.1) rotate(5deg); opacity: 1; }
  100% { transform: scale(1) rotate(0deg); }
}

@keyframes iconReveal {
  0%   { transform: scale(0.5) rotate(-15deg); opacity: 0; }
  70%  { transform: scale(1.12) rotate(4deg); }
  100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

@keyframes choicePick {
  0%   { transform: scale(1); }
  40%  { transform: scale(0.88); }
  70%  { transform: scale(1.08); }
  100% { transform: scale(1); }
}

@keyframes msgPop {
  0%   { transform: scale(0.8); opacity: 0; }
  70%  { transform: scale(1.06); }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes dotBounce {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-6px); }
}

/* ── Responsive ───────────────────────────────────────── */
@media (max-width: 480px) {
  .game-header h1 { font-size: 1.7rem; }
  .score-num      { font-size: 2.8rem; }
  .arena-icon     { width: 74px; height: 74px; }
  .arena-icon img { width: 52px; height: 52px; }
  .choice         { padding: 0.9rem 0.6rem; }
  .choice img     { width: 56px; height: 56px; }
  .choices        { gap: 0.7rem; }
}
