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

html, body {
  width: 100%;
  min-height: 100vh;
  background: #0a0a12;
  font-family: 'Segoe UI', system-ui, sans-serif;
  color: #fff;
  overflow-x: hidden;
}

/* ─── Animated background orbs ─────────────────────────────────────────────── */
.bg-orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.35;
  pointer-events: none;
  z-index: 0;
  animation: orbFloat 12s ease-in-out infinite;
}

.orb1 {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, #7c3aed, transparent 70%);
  top: -120px;
  left: -100px;
  animation-duration: 14s;
}

.orb2 {
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, #0ea5e9, transparent 70%);
  bottom: -80px;
  right: -80px;
  animation-duration: 10s;
  animation-delay: -4s;
}

.orb3 {
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, #f43f5e, transparent 70%);
  top: 45%;
  left: 55%;
  animation-duration: 16s;
  animation-delay: -8s;
}

@keyframes orbFloat {
  0%, 100% { transform: translateY(0) scale(1); }
  50%       { transform: translateY(-40px) scale(1.08); }
}

/* ─── Main wrapper ──────────────────────────────────────────────────────────── */
.arena-wrapper {
  position: relative;
  z-index: 1;
  max-width: 900px;
  margin: 0 auto;
  padding: 60px 24px 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 48px;
}

/* ─── Header ────────────────────────────────────────────────────────────────── */
.arena-header {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  animation: fadeDown 0.6s ease both;
}

.header-icon {
  font-size: 3.5rem;
  line-height: 1;
  filter: drop-shadow(0 0 20px rgba(124, 58, 237, 0.7));
  animation: iconPulse 3s ease-in-out infinite;
}

@keyframes iconPulse {
  0%, 100% { filter: drop-shadow(0 0 16px rgba(124, 58, 237, 0.6)); transform: scale(1); }
  50%       { filter: drop-shadow(0 0 32px rgba(14, 165, 233, 0.8)); transform: scale(1.07); }
}

.arena-title {
  font-size: clamp(2.8rem, 8vw, 5rem);
  font-weight: 900;
  letter-spacing: -2px;
  background: linear-gradient(135deg, #a78bfa 0%, #60a5fa 50%, #f472b6 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
}

.arena-subtitle {
  font-size: 1rem;
  color: rgba(255, 255, 255, 0.45);
  letter-spacing: 2px;
  text-transform: uppercase;
}

/* ─── Games grid ────────────────────────────────────────────────────────────── */
.games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 28px;
  width: 100%;
}

/* ─── Game card ─────────────────────────────────────────────────────────────── */
.game-card {
  position: relative;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.10);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
  animation: cardRise 0.5s ease both;
  backdrop-filter: blur(12px);
}

.game-card:hover {
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
  border-color: rgba(255, 255, 255, 0.22);
}

/* per-card accent colors */
#card-xdodge:hover { box-shadow: 0 24px 60px rgba(196, 149, 106, 0.25); }
#card-rps:hover    { box-shadow: 0 24px 60px rgba(83, 192, 240, 0.25); }

/* glow overlay that follows mouse (set via JS) */
.card-glow {
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  transition: background 0.1s ease;
  z-index: 1;
}

@keyframes cardRise {
  from { opacity: 0; transform: translateY(30px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0)    scale(1); }
}

/* ─── Badge ─────────────────────────────────────────────────────────────────── */
.card-badge {
  position: absolute;
  top: 16px;
  right: 16px;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 2px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.10);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: rgba(255, 255, 255, 0.7);
  z-index: 2;
}

#card-xdodge .card-badge { background: rgba(196, 149, 106, 0.20); border-color: rgba(196, 149, 106, 0.40); color: #F5C59F; }
#card-rps    .card-badge { background: rgba(83, 192, 240, 0.15); border-color: rgba(83, 192, 240, 0.40); color: #53c0f0; }

/* ─── Preview area ──────────────────────────────────────────────────────────── */
.card-preview {
  position: relative;
  height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

#card-xdodge .card-preview {
  background: linear-gradient(160deg, #2a1a0a 0%, #F5C59F22 100%);
}

#card-rps .card-preview {
  background: linear-gradient(160deg, #0f1a2e 0%, #0f346022 100%);
}

.card-preview-emoji {
  font-size: 6rem;
  line-height: 1;
  user-select: none;
  pointer-events: none;
  transition: transform 0.3s ease;
  z-index: 2;
}

/* X Dodge preview — styled X */
#card-xdodge .card-preview-emoji {
  font-size: 7rem;
  font-weight: 900;
  color: #C4956A;
  text-shadow: 0 0 40px rgba(196, 149, 106, 0.5), 4px 4px 0 #3a2a1a;
  font-family: 'Segoe UI', sans-serif;
  letter-spacing: -4px;
}

/* RPS preview — three emojis in a row */
.rps-emoji {
  display: flex;
  gap: 12px;
  font-size: 3.2rem;
}

.rps-emoji span {
  display: inline-block;
  animation: rpsFloat 2.4s ease-in-out infinite;
}
.rps-emoji span:nth-child(2) { animation-delay: 0.4s; }
.rps-emoji span:nth-child(3) { animation-delay: 0.8s; }

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

.game-card:hover .card-preview-emoji {
  transform: scale(1.1);
}

/* Shimmer line across the preview top */
.card-preview::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255,255,255,0.05) 0%, transparent 60%);
  pointer-events: none;
}

/* ─── Card info ─────────────────────────────────────────────────────────────── */
.card-info {
  padding: 20px 22px 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
  position: relative;
  z-index: 2;
}

.card-title {
  font-size: 1.35rem;
  font-weight: 900;
  letter-spacing: -0.5px;
  color: #fff;
}

#card-xdodge .card-title { color: #F5C59F; }
#card-rps    .card-title { color: #60c8f5; }

.card-desc {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.5);
  line-height: 1.55;
}

.card-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.meta-tag {
  font-size: 0.72rem;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.55);
  letter-spacing: 0.5px;
}

/* ─── Play button ───────────────────────────────────────────────────────────── */
.card-play-btn {
  margin: 16px 22px 22px;
  padding: 13px 0;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 0.9rem;
  font-weight: 800;
  letter-spacing: 2px;
  transition: transform 0.15s ease, filter 0.15s ease;
  position: relative;
  z-index: 2;
}

#card-xdodge .card-play-btn {
  background: #3a2a1a;
  color: #F5C59F;
}

#card-rps .card-play-btn {
  background: #0f2744;
  color: #53c0f0;
}

.game-card:hover .card-play-btn {
  filter: brightness(1.3);
  transform: scale(1.02);
}

.game-card:active .card-play-btn {
  transform: scale(0.97);
}

/* ─── New card accent colors ────────────────────────────────────────────────── */

/* Snake — green */
#card-snake .card-preview  { background: linear-gradient(160deg, #0d1f0d 0%, #1a3a1a22 100%); }
#card-snake .card-preview-emoji { font-size: 6rem; }
#card-snake .card-title    { color: #6fcf6f; }
#card-snake .card-badge    { background: rgba(111,207,111,.15); border-color: rgba(111,207,111,.4); color: #6fcf6f; }
#card-snake .card-play-btn { background: #0d2a0d; color: #6fcf6f; }
#card-snake:hover          { box-shadow: 0 24px 60px rgba(111,207,111,.22); }

/* Whack-a-Mole — orange */
#card-whack .card-preview  { background: linear-gradient(160deg, #1f1200 0%, #3a2a0022 100%); }
#card-whack .card-preview-emoji { font-size: 6rem; animation: whackBounce 1.4s ease-in-out infinite; }
#card-whack .card-title    { color: #f4a23a; }
#card-whack .card-badge    { background: rgba(244,162,58,.15); border-color: rgba(244,162,58,.4); color: #f4a23a; }
#card-whack .card-play-btn { background: #2a1800; color: #f4a23a; }
#card-whack:hover          { box-shadow: 0 24px 60px rgba(244,162,58,.22); }

@keyframes whackBounce {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  30%       { transform: translateY(-14px) rotate(-8deg); }
  60%       { transform: translateY(-6px)  rotate(5deg); }
}

/* Memory — purple */
#card-memory .card-preview  { background: linear-gradient(160deg, #140d24 0%, #2a1a4422 100%); }
#card-memory .card-preview-emoji { font-size: 6rem; animation: memoryFlip 2.5s ease-in-out infinite; }
#card-memory .card-title    { color: #b38ef5; }
#card-memory .card-badge    { background: rgba(179,142,245,.15); border-color: rgba(179,142,245,.4); color: #b38ef5; }
#card-memory .card-play-btn { background: #1a0d30; color: #b38ef5; }
#card-memory:hover          { box-shadow: 0 24px 60px rgba(179,142,245,.22); }

@keyframes memoryFlip {
  0%, 100% { transform: rotateY(0deg); }
  40%       { transform: rotateY(180deg); }
  60%       { transform: rotateY(180deg); }
}

/* Breakout — red/brick */
#card-breakout .card-preview  { background: linear-gradient(160deg, #200808 0%, #3a100822 100%); }
#card-breakout .card-preview-emoji { font-size: 6rem; }
#card-breakout .card-title    { color: #f07060; }
#card-breakout .card-badge    { background: rgba(240,112,96,.15); border-color: rgba(240,112,96,.4); color: #f07060; }
#card-breakout .card-play-btn { background: #2a0808; color: #f07060; }
#card-breakout:hover          { box-shadow: 0 24px 60px rgba(240,112,96,.22); }

/* Tic-Tac-Toe — cyan */
#card-ttt .card-preview  { background: linear-gradient(160deg, #081820 0%, #0a2a3822 100%); }
#card-ttt .card-title    { color: #4dd8e8; }
#card-ttt .card-badge    { background: rgba(77,216,232,.15); border-color: rgba(77,216,232,.4); color: #4dd8e8; }
#card-ttt .card-play-btn { background: #062030; color: #4dd8e8; }
#card-ttt:hover          { box-shadow: 0 24px 60px rgba(77,216,232,.22); }

.ttt-emoji {
  display: flex;
  gap: 10px;
  font-size: 2.6rem;
  font-weight: 900;
  color: #4dd8e8;
  font-family: 'Segoe UI', sans-serif;
}
.ttt-emoji span:nth-child(odd)  { color: #4dd8e8; }
.ttt-emoji span:nth-child(even) { color: rgba(77,216,232,.45); }

.snake-emoji { animation: snakeWiggle 2s ease-in-out infinite; }
@keyframes snakeWiggle {
  0%,100% { transform: rotate(0deg); }
  25%      { transform: rotate(-12deg); }
  75%      { transform: rotate(12deg); }
}

/* ─── Footer ────────────────────────────────────────────────────────────────── */
.arena-footer {
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.2);
  letter-spacing: 1px;
  text-align: center;
  padding-bottom: 16px;
  animation: fadeDown 0.8s ease 0.4s both;
}

/* ─── Entrance animations ───────────────────────────────────────────────────── */
@keyframes fadeDown {
  from { opacity: 0; transform: translateY(-16px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ─── Responsive ────────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .arena-wrapper {
    padding: 40px 16px 32px;
    gap: 32px;
  }

  .games-grid {
    grid-template-columns: 1fr;
  }

  .card-preview {
    height: 150px;
  }

  .rps-emoji {
    font-size: 2.6rem;
  }
}
