/* ==========================================================================
   Destiny Hub — Астральная Арена и Игры (games.css)
   ========================================================================== */

:root {
  --arena-bg: rgba(13, 10, 25, 0.45);
  --arena-border: rgba(255, 255, 255, 0.08);
  --arena-glow: rgba(167, 139, 250, 0.15);
  --arena-success: #10b981;
  --arena-success-glow: rgba(16, 185, 129, 0.2);
  --arena-danger: #ef4444;
  --arena-danger-glow: rgba(239, 68, 68, 0.25);
  --glass-glow: 0 8px 32px 0 rgba(31, 38, 135, 0.37);
}

.games-feature-sync {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
  margin: 18px 0 22px;
}

.games-feature-card {
  min-height: 118px;
  padding: 14px;
  border: 1px solid var(--border, rgba(255, 255, 255, 0.14));
  border-radius: 16px;
  background: var(--card, rgba(18, 14, 36, 0.78));
  color: var(--text, #fff);
  text-decoration: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.2);
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.games-feature-card:hover {
  transform: translateY(-2px);
  border-color: rgba(250, 204, 21, 0.45);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.28);
}

.games-feature-card.is-primary {
  background:
    linear-gradient(135deg, rgba(250, 204, 21, 0.16), rgba(139, 92, 246, 0.14)),
    var(--card, rgba(18, 14, 36, 0.78));
}

.games-feature-icon {
  font-size: 1.45rem;
  line-height: 1;
}

.games-feature-title {
  font-size: 0.98rem;
  font-weight: 850;
  line-height: 1.2;
}

.games-feature-desc {
  font-size: 0.78rem;
  line-height: 1.35;
  color: var(--muted, rgba(255, 255, 255, 0.72));
}

/* Стили Арены Тотемов */
.arena-battleground {
  display: grid;
  grid-template-columns: 1fr 1.5fr 1fr;
  gap: 24px;
  align-items: center;
  margin-top: 24px;
  padding: 28px;
  background: var(--arena-bg);
  border-radius: 24px;
  border: 1px solid var(--arena-border);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  position: relative;
  overflow: visible;
  box-shadow: var(--glass-glow);
  transition: all 0.3s ease;
}

.arena-battleground::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 24px;
  padding: 1px;
  background: linear-gradient(135deg, rgba(255,255,255,0.1), rgba(255,255,255,0.01) 50%, rgba(167, 139, 250, 0.2));
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

.arena-fighter {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  padding: 15px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.03);
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.arena-fighter:hover {
  background: rgba(255, 255, 255, 0.04);
  transform: translateY(-5px);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

.arena-hud {
  width: 100%;
  text-align: center;
}

.arena-name {
  font-size: 1.1rem;
  font-weight: 800;
  color: #fff;
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  text-shadow: 0 0 15px rgba(255, 255, 255, 0.3);
}

.arena-hp-bar {
  width: 100%;
  height: 18px;
  background: rgba(0, 0, 0, 0.4);
  border-radius: 12px;
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.6);
}

.arena-hp-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, var(--arena-success), #34d399);
  transition: width 0.5s cubic-bezier(0.19, 1, 0.22, 1);
  box-shadow: 0 0 10px var(--arena-success-glow);
}

.enemy-fighter .arena-hp-fill {
  background: linear-gradient(90deg, #f87171, var(--arena-danger));
  box-shadow: 0 0 10px var(--arena-danger-glow);
}

.arena-hp-val {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 900;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0,0,0,0.9);
  letter-spacing: 0.5px;
}

.arena-pet-wrapper {
  width: 140px;
  height: 160px;
  position: relative;
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  display: flex;
  align-items: center;
  justify-content: center;
}

.arena-pet-wrapper svg, .arena-pet-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 5px 15px rgba(167, 139, 250, 0.4));
}

.arena-match3-wrapper {
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid var(--arena-border);
  border-radius: 24px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: center;
  position: relative;
  overflow: hidden;
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.arena-board-header {
  font-size: 0.85rem;
  font-weight: 900;
  letter-spacing: 2px;
  color: rgba(255, 255, 255, 0.5);
  text-shadow: 0 2px 4px rgba(0,0,0,0.6);
  text-transform: uppercase;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  width: 100%;
  text-align: center;
  padding-bottom: 8px;
}

.arena-m3-board {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
  width: 280px;
  height: 280px;
}

.arena-m3-cell {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
  position: relative;
}

.arena-m3-cell:hover {
  background: rgba(255, 255, 255, 0.07);
  transform: scale(1.08);
  border-color: rgba(255,255,255,0.18);
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.arena-m3-cell:active {
  transform: scale(0.95);
}

.arena-selected {
  background: rgba(167, 139, 250, 0.15) !important;
  border-color: #a78bfa !important;
  box-shadow: 0 0 15px rgba(167, 139, 250, 0.35) !important;
  animation: arenaSelectedPulse 1.4s infinite ease-in-out;
  transform: scale(1.04);
}

@keyframes arenaSelectedPulse {
  0%, 100% { transform: scale(1.04); box-shadow: 0 0 15px rgba(167, 139, 250, 0.35); }
  50% { transform: scale(1.1); box-shadow: 0 0 25px rgba(167, 139, 250, 0.55); }
}

.arena-gem-pop {
  animation: arenaGemPopAnim 0.45s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes arenaGemPopAnim {
  0% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.4); opacity: 0.9; filter: brightness(1.6) saturate(1.2); }
  100% { transform: scale(0); opacity: 0; }
}

/* Модалка на Арене */
.arena-modal {
  position: absolute;
  inset: 0;
  background: rgba(10, 8, 20, 0.92);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  border-radius: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
  animation: arenaModalIn 0.35s cubic-bezier(0.19, 1, 0.22, 1);
}

@keyframes arenaModalIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.arena-modal-content {
  text-align: center;
  padding: 30px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  align-items: center;
}

.arena-modal-content h2 {
  font-size: 1.6rem;
  font-weight: 900;
  color: #fff;
  background: linear-gradient(135deg, #fff, #a78bfa);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 2px 10px rgba(167,139,250,0.3));
}

.arena-modal-content p {
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.7);
  line-height: 1.5;
  max-width: 250px;
}

.arena-award {
  background: rgba(250, 204, 21, 0.08);
  border: 1px solid rgba(250, 204, 21, 0.3);
  padding: 12px 24px;
  border-radius: 16px;
  font-size: 0.95rem;
  font-weight: 800;
  color: #facc15;
  box-shadow: 0 4px 20px rgba(250, 204, 21, 0.15);
  display: flex;
  align-items: center;
  gap: 8px;
  animation: awardPulse 2s infinite ease-in-out;
}

@keyframes awardPulse {
  0%, 100% { transform: scale(1); box-shadow: 0 4px 20px rgba(250, 204, 21, 0.15); }
  50% { transform: scale(1.05); box-shadow: 0 4px 30px rgba(250, 204, 21, 0.3); }
}

/* Адаптивность */
@media (max-width: 992px) {
  .arena-battleground {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
    gap: 20px;
    padding: 20px;
  }

  .arena-fighter {
    flex-direction: row;
    justify-content: space-between;
    width: 100%;
    max-width: 380px;
    margin: 0 auto;
  }

  .arena-hud {
    text-align: left;
    max-width: 200px;
  }

  .arena-pet-wrapper {
    width: 100px;
    height: 100px;
  }

  .enemy-fighter {
    grid-row: 3;
  }

  .enemy-fighter .arena-hud {
    text-align: right;
    order: 2;
  }

  .enemy-fighter .arena-pet-wrapper {
    order: 1;
  }
}

@media (max-width: 480px) {
  .games-feature-sync {
    grid-template-columns: 1fr;
    gap: 10px;
    margin-top: 14px;
  }

  .games-feature-card {
    min-height: 96px;
    padding: 12px;
  }

  .arena-battleground {
    padding: 16px;
    border-radius: 16px;
  }

  .arena-m3-board {
    width: 240px;
    height: 240px;
    gap: 6px;
  }

  .arena-m3-cell {
    border-radius: 10px;
    font-size: 1.3rem;
  }

  .arena-fighter {
    padding: 12px;
  }

  .arena-name {
    font-size: 0.95rem;
  }

  .arena-hp-bar {
    height: 14px;
  }

  .arena-hp-val {
    font-size: 0.65rem;
  }
}
