.game-history-page {
  padding: var(--pages-frame-pad-top, clamp(12px, 2vw, 32px))
    var(--pages-frame-pad-x, clamp(10px, 2.5vw, 44px))
    var(--pages-frame-pad-bottom, clamp(14px, 2vw, 28px));
  direction: rtl;
}

.game-history-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.game-history-card {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 8px;
  min-height: 128px;
  padding: 10px 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background:
    linear-gradient(180deg, rgba(28, 21, 48, 0.28), rgba(10, 7, 18, 0.34)),
    url("/icons/bg-items-small.webp") center / 100% 100% no-repeat;
  color: inherit;
  font: inherit;
  text-align: right;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.game-history-card.is-won {
  background:
    linear-gradient(
      165deg,
      rgba(72, 120, 88, 0.22) 0%,
      rgba(36, 68, 48, 0.28) 45%,
      rgba(18, 36, 28, 0.36) 100%
    ),
    url("/icons/bg-items-small.webp") center / 100% 100% no-repeat;
  border-color: rgba(140, 180, 140, 0.28);
  box-shadow: 0 8px 22px rgba(20, 40, 28, 0.28);
}

.game-history-card.is-lost {
  background:
    linear-gradient(
      165deg,
      rgba(140, 78, 78, 0.2) 0%,
      rgba(88, 42, 46, 0.26) 45%,
      rgba(42, 22, 26, 0.36) 100%
    ),
    url("/icons/bg-items-small.webp") center / 100% 100% no-repeat;
  border-color: rgba(190, 130, 130, 0.28);
  box-shadow: 0 8px 22px rgba(40, 18, 22, 0.28);
}

.game-history-card.is-neutral {
  background:
    linear-gradient(180deg, rgba(48, 42, 62, 0.28), rgba(18, 14, 28, 0.34)),
    url("/icons/bg-items-small.webp") center / 100% 100% no-repeat;
  border-color: rgba(180, 170, 150, 0.22);
}

.game-history-card.is-won:hover,
.game-history-card.is-won:focus-visible {
  border-color: rgba(160, 200, 160, 0.42);
  box-shadow: 0 0 0 1px rgba(120, 170, 130, 0.2), 0 8px 24px rgba(20, 40, 28, 0.35);
}

.game-history-card.is-lost:hover,
.game-history-card.is-lost:focus-visible {
  border-color: rgba(210, 150, 150, 0.42);
  box-shadow: 0 0 0 1px rgba(180, 110, 110, 0.2), 0 8px 24px rgba(40, 18, 22, 0.35);
}

.game-history-card-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.game-history-card-role {
  flex: none;
  width: 42px;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(0, 0, 0, 0.25);
  align-self: center;
}

.game-history-card-role--god {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  background: linear-gradient(180deg, rgba(255, 240, 180, 0.35), rgba(120, 80, 10, 0.4));
  border-color: rgba(255, 230, 150, 0.45);
}

.game-history-card:hover,
.game-history-card:focus-visible {
  outline: none;
}

.game-history-card-date {
  font-size: 11px;
  font-weight: 700;
  color: var(--p-gold-light, #ffd56a);
  line-height: 1.35;
}

.game-history-card-winner {
  font-size: 12px;
  font-weight: 800;
  color: #f7f2ea;
}

.game-history-card-winner.is-mafia {
  color: #ff8f8f;
}

.game-history-card-winner.is-city {
  color: #8fb6ff;
}

.game-history-card-scenario {
  font-size: 10px;
  font-weight: 700;
  color: var(--p-gold-light, #ffd56a);
  opacity: 0.75;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.game-history-card-role-name {
  font-size: 11px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.82);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.game-history-card-meta {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-top: auto;
  font-size: 11px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.78);
}

.game-history-card-points {
  color: #ffdd66;
}

.game-history-card-prize {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: #ffe08a;
}

.game-history-card-prize img {
  width: 12px;
  height: 12px;
  object-fit: contain;
}

.game-history-empty,
.game-history-loading,
.game-history-error {
  text-align: center;
  padding: 28px 12px;
  opacity: 0.85;
  font-size: 14px;
}

.game-history-error {
  color: #ff8f8f;
}

.game-history-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 8px;
  margin-bottom: 70px;
  padding: 6px 4px;
}

.game-history-pagination[hidden] {
  display: none !important;
}

.game-history-page-btn {
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  border: 0;
  font-size: 0;
  line-height: 0;
  color: transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.game-history-page-btn--prev {
  background: url("/achievements/ui/achievement-previous.png") center / contain no-repeat;
}

.game-history-page-btn--next {
  background: url("/achievements/ui/achievement-next.png") center / contain no-repeat;
}

.game-history-page-btn:hover:not(:disabled) {
  filter: brightness(1.08);
}

.game-history-page-btn:disabled {
  filter: grayscale(100%) opacity(0.45);
  cursor: default;
}

.game-history-page-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: rgba(255, 244, 216, 0.85);
  min-width: 3.2rem;
  text-align: center;
}

@media (max-width: 380px) {
  .game-history-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }

  .game-history-card {
    gap: 6px;
    padding: 8px 6px;
    min-height: 110px;
  }

  .game-history-card-date {
    font-size: 10px;
  }

  .game-history-card-winner {
    font-size: 11px;
  }

  .game-history-card-scenario,
  .game-history-card-role-name,
  .game-history-card-meta {
    font-size: 10px;
  }
}
