#homeRecentGamesSection {
  margin: 18px 0;
  padding: 18px;
  border: 1px solid rgba(37, 99, 235, 0.12);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 16px 38px rgba(15, 23, 42, 0.07);
}

#homeRecentGamesSection .recent-games-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

#homeRecentGamesSection .recent-games-title {
  margin: 0;
  color: #0f172a;
  font-size: 1.18rem;
  line-height: 1.2;
  font-weight: 900;
  letter-spacing: -0.02em;
}

#homeRecentGamesSection .recent-games-subtitle {
  margin: 4px 0 0;
  color: #64748b;
  font-size: 0.86rem;
  line-height: 1.35;
}

#homeRecentGamesSection .recent-games-view-all {
  flex: 0 0 auto;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  color: #2563eb;
  font-size: 0.84rem;
  font-weight: 800;
  text-decoration: none;
}

#homeRecentGamesSection .recent-games-view-all:focus-visible,
#homeRecentGamesSection .recent-game-item:focus-visible,
#homeRecentGamesSection .recent-games-state button:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.35);
  outline-offset: 3px;
}

#homeRecentGamesSection .recent-games-list,
#homeRecentGamesSection .recent-games-loading {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  max-width: 100%;
  padding: 3px 2px 8px;
  scroll-snap-type: x proximity;
  overscroll-behavior-inline: contain;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

#homeRecentGamesSection .recent-games-list::-webkit-scrollbar,
#homeRecentGamesSection .recent-games-loading::-webkit-scrollbar {
  display: none;
}

#homeRecentGamesSection .recent-game-item {
  width: 82px;
  min-width: 82px;
  min-height: 106px;
  padding: 2px;
  border: 0;
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  scroll-snap-align: start;
  background: transparent;
  color: #1e293b;
  font: inherit;
  cursor: pointer;
}

#homeRecentGamesSection .recent-game-avatar {
  position: relative;
  width: 68px;
  height: 68px;
  padding: 3px;
  border: 4px solid #F59E0B;
  border-radius: 50%;
  display: block;
  background: #f1f5f9;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.12);
}

.recent-game-avatar-premium {
  position: absolute;
  right: -3px;
  bottom: -3px;
  z-index: 4;
  width: 22px;
  height: 22px;
  display: inline-block;
  background: linear-gradient(135deg, #4c8dff 0%, #0866ff 100%);
  clip-path: polygon(50% 0%, 60% 13%, 76% 7%, 82% 23%, 99% 24%, 92% 40%, 100% 50%, 92% 60%, 99% 76%, 82% 77%, 76% 93%, 60% 87%, 50% 100%, 40% 87%, 24% 93%, 18% 77%, 1% 76%, 8% 60%, 0% 50%, 8% 40%, 1% 24%, 18% 23%, 24% 7%, 40% 13%);
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.22));
}

.recent-game-avatar-premium::after {
  content: "";
  position: absolute;
  left: 6px;
  top: 6px;
  width: 10px;
  height: 7px;
  border-left: 3px solid #fff;
  border-bottom: 3px solid #fff;
  transform: rotate(-45deg);
}

#homeRecentGamesSection .recent-game-avatar img {
  width: 100%;
  height: 100%;
  display: block;
  border-radius: 50%;
  object-fit: cover;
  background: #e2e8f0;
}

#homeRecentGamesSection .recent-game-name {
  width: 100%;
  min-height: 34px;
  display: -webkit-box;
  overflow: hidden;
  color: #334155;
  font-size: 0.8rem;
  line-height: 1.25;
  font-weight: 750;
  text-align: center;
  text-overflow: ellipsis;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

#homeRecentGamesSection .recent-game-avatar.game-status-pending {
  border-color: #F59E0B;
}

#homeRecentGamesSection .recent-game-avatar.game-status-win {
  border-color: #22C55E;
}

#homeRecentGamesSection .recent-game-avatar.game-status-loss {
  border-color: #EF4444;
}

#homeRecentGamesSection .recent-game-avatar.game-status-canceled {
  border-color: #9CA3AF;
}

#homeRecentGamesSection .recent-games-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 7px 14px;
  margin-top: 9px;
  color: #64748b;
  font-size: 0.72rem;
  font-weight: 700;
}

#homeRecentGamesSection .recent-games-legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

#homeRecentGamesSection .recent-games-legend i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #F59E0B;
}

#homeRecentGamesSection .recent-games-legend i.game-status-win { background: #22C55E; }
#homeRecentGamesSection .recent-games-legend i.game-status-loss { background: #EF4444; }
#homeRecentGamesSection .recent-games-legend i.game-status-canceled { background: #9CA3AF; }

#homeRecentGamesSection .recent-game-skeleton {
  width: 82px;
  min-width: 82px;
  height: 104px;
  border-radius: 16px;
  background:
    radial-gradient(circle at 50% 34px, #e7edf5 0 31px, transparent 32px),
    linear-gradient(90deg, #f1f5f9 25%, #e7edf5 50%, #f1f5f9 75%);
  background-size: auto, 220% 100%;
  animation: recentGamesSkeleton 1.3s linear infinite;
}

@keyframes recentGamesSkeleton {
  from { background-position: center, 100% 0; }
  to { background-position: center, -100% 0; }
}

#homeRecentGamesSection .recent-games-state {
  min-height: 96px;
  padding: 14px;
  border: 1px dashed #cbd5e1;
  border-radius: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: #64748b;
  background: #f8fafc;
}

#homeRecentGamesSection .recent-games-state ion-icon {
  flex: 0 0 auto;
  color: #2563eb;
  font-size: 30px;
}

#homeRecentGamesSection .recent-games-state strong,
#homeRecentGamesSection .recent-games-state span {
  display: block;
}

#homeRecentGamesSection .recent-games-state strong {
  color: #334155;
  font-size: 0.88rem;
}

#homeRecentGamesSection .recent-games-state span {
  margin-top: 3px;
  font-size: 0.8rem;
}

#homeRecentGamesSection .recent-games-state.is-error {
  border-color: rgba(239, 68, 68, 0.26);
  background: #fff7f7;
}

#homeRecentGamesSection .recent-games-state.is-error ion-icon {
  color: #dc2626;
}

.recent-game-modal .modal-dialog {
  max-width: 510px;
}

.recent-game-modal .modal-content {
  overflow: hidden;
  border: 0;
  border-radius: 24px;
  box-shadow: 0 30px 80px rgba(15, 23, 42, 0.2);
}

.recent-game-modal .recent-game-modal-handle {
  display: none;
}

.recent-game-modal .recent-game-modal-eyebrow {
  color: #2563eb;
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.recent-game-modal .modal-title {
  margin-top: 2px;
  color: #0f172a;
  font-size: 1.25rem;
  font-weight: 900;
}

.recent-game-modal .recent-game-summary-loading,
.recent-game-modal .recent-game-summary-state {
  min-height: 190px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: #64748b;
  text-align: center;
}

.recent-game-modal .recent-game-summary-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 16px;
}

.recent-game-modal .recent-game-summary-meta span {
  padding: 9px 10px;
  border-radius: 12px;
  background: #f8fafc;
  color: #475569;
  font-size: 0.78rem;
}

.recent-game-modal .recent-game-matchup {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 16px;
  border-radius: 18px;
  background: #f8fbff;
}

.recent-game-modal .recent-game-summary-player {
  min-width: 0;
  text-align: center;
}

.recent-game-modal .recent-game-summary-avatar {
  position: relative;
  width: 58px;
  height: 58px;
  display: inline-block;
}

.recent-game-modal .recent-game-summary-player img {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  object-fit: cover;
  background: #e2e8f0;
}

.recent-game-modal .recent-game-summary-player strong {
  display: block;
  overflow: hidden;
  margin-top: 7px;
  color: #1e293b;
  font-size: 0.82rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recent-game-modal .recent-game-summary-score {
  margin-top: 14px;
  color: #0f172a;
  font-size: 1.05rem;
  font-weight: 900;
  text-align: center;
}

.recent-game-modal .recent-game-summary-status {
  margin-top: 9px;
  color: #475569;
  font-size: 0.85rem;
  font-weight: 750;
  text-align: center;
}

@media (max-width: 575.98px) {
  #homeRecentGamesSection {
    margin-left: -2px;
    margin-right: -2px;
    padding: 16px 14px;
    border-radius: 20px;
  }

  #homeRecentGamesSection .recent-games-header {
    gap: 10px;
  }

  #homeRecentGamesSection .recent-games-subtitle {
    max-width: 230px;
  }

  .recent-game-modal .modal-dialog {
    min-height: 100%;
    margin: 0;
    display: flex;
    align-items: flex-end;
  }

  .recent-game-modal .modal-content {
    border-radius: 26px 26px 0 0;
    padding-bottom: env(safe-area-inset-bottom);
  }

  .recent-game-modal .recent-game-modal-handle {
    width: 42px;
    height: 5px;
    margin: 9px auto 0;
    border-radius: 999px;
    display: block;
    background: #cbd5e1;
  }
}

@media (prefers-reduced-motion: reduce) {
  #homeRecentGamesSection .recent-game-skeleton {
    animation: none;
  }
}
