.apex-games-page {
  display: grid;
  gap: 14px;
}

/* ---------- Category tabs ---------- */

.apex-games-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.apex-games-tabs a {
  display: grid;
  grid-template-columns: 20px max-content;
  grid-auto-flow: column;
  gap: 7px;
  align-items: center;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--apex-panel) 76%, #050101);
  color: var(--apex-text);
  font-size: 12.5px;
  text-decoration: none;
  white-space: nowrap;
  transition: background .15s ease, color .15s ease;
}

.apex-games-tabs a:hover {
  background: color-mix(in srgb, var(--apex-panel) 60%, var(--apex-primary));
}

.apex-games-tabs a.is-active {
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--apex-primary) 82%, var(--apex-panel)), color-mix(in srgb, var(--apex-primary) 48%, #080101));
  color: var(--apex-accent);
  box-shadow: inset 0 -2px 0 var(--apex-accent);
}

.apex-games-tabs a b {
  padding: 2px 6px;
  border-radius: 6px;
  background: var(--apex-accent);
  color: color-mix(in srgb, var(--apex-bg) 92%, #000);
  font-size: 9px;
  line-height: 1;
  letter-spacing: .04em;
}

.apex-games-tabs .apex-icon {
  width: 20px;
  height: 20px;
}

/* ---------- Hero & provider head ---------- */

.apex-games-hero {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 15px;
  border-radius: 12px;
  background:
    radial-gradient(circle at 100% 0, color-mix(in srgb, var(--apex-accent) 9%, transparent), transparent 150px),
    linear-gradient(180deg, rgba(255, 255, 255, .035), transparent 38.2%),
    color-mix(in srgb, var(--apex-panel) 88%, var(--apex-bg));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .045), 0 8px 18px rgba(0, 0, 0, .2);
}

.apex-games-hero-icon {
  display: grid;
  width: 54px;
  height: 54px;
  place-items: center;
  border-radius: 50%;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--apex-accent) 84%, #fff0aa), color-mix(in srgb, var(--apex-accent) 50%, var(--apex-primary)));
  color: color-mix(in srgb, var(--apex-bg) 92%, #000);
  box-shadow: 0 10px 18px color-mix(in srgb, var(--apex-accent) 22%, transparent);
}

.apex-games-hero-icon .apex-icon {
  width: 27px;
  height: 27px;
}

.apex-games-hero span {
  color: var(--apex-muted);
}

.apex-games-hero h1 {
  margin: 2px 0;
  color: var(--apex-text);
  font-size: 24px;
  line-height: 1.1;
}

.apex-games-hero p {
  margin: 0;
  color: var(--apex-muted);
  font-size: 13px;
  line-height: 1.35;
}

.apex-games-provider-head {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 54px;
  padding: 6px 14px;
  border-radius: 12px;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--apex-primary) 80%, var(--apex-accent-soft)), color-mix(in srgb, var(--apex-primary) 70%, var(--apex-panel)));
  color: var(--apex-text);
  box-shadow: inset 0 -1px 0 color-mix(in srgb, var(--apex-line) 72%, transparent);
}

.apex-games-provider-head a {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: 10px;
  color: var(--apex-text);
  text-decoration: none;
  transition: background .15s ease;
}

.apex-games-provider-head a:hover {
  background: color-mix(in srgb, var(--apex-panel) 55%, transparent);
}

.apex-games-provider-head a .apex-icon {
  width: 26px;
  height: 26px;
}

.apex-games-provider-head h1 {
  margin: 0;
  overflow: hidden;
  color: var(--apex-text);
  font-size: 20px;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.apex-games-provider-head-badge {
  margin-left: auto;
  padding: 4px 10px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--apex-bg) 55%, transparent);
  color: var(--apex-accent);
  font-size: 11px;
  letter-spacing: .05em;
  text-transform: uppercase;
}

/* ---------- Provider grid ---------- */

.apex-games-provider-section,
.apex-games-list-section {
  display: grid;
  gap: 14px;
}

.apex-games-provider-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}

.apex-games-provider-grid a {
  position: relative;
  display: grid;
  align-content: end;
  aspect-ratio: 7 / 9;
  overflow: hidden;
  border-radius: 13px;
  background:
    radial-gradient(circle at 50% 20%, color-mix(in srgb, var(--apex-accent) 14%, transparent), transparent 45%),
    color-mix(in srgb, var(--apex-panel) 84%, #000);
  color: var(--apex-text);
  text-decoration: none;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--apex-line) 72%, transparent);
  transition: transform .15s ease, box-shadow .15s ease;
}

.apex-games-provider-grid a:hover {
  transform: translateY(-2px);
  box-shadow:
    inset 0 0 0 1px color-mix(in srgb, var(--apex-accent) 55%, var(--apex-line)),
    0 12px 24px rgba(0, 0, 0, .32);
}

.apex-games-provider-grid img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.apex-games-provider-grid a:not(.has-portrait) img {
  position: static;
  width: 64%;
  height: auto;
  max-height: 55%;
  margin: auto;
  object-fit: contain;
}

.apex-games-provider-grid a>.apex-icon {
  position: absolute;
  top: 26%;
  left: 50%;
  width: 42px;
  height: 42px;
  translate: -50% -50%;
  color: var(--apex-accent);
}

.apex-games-provider-grid strong {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  padding: 38px 9px 10px;
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, .72));
  color: var(--apex-text);
  font-size: 13px;
  line-height: 1.15;
  text-align: center;
  text-shadow: 0 2px 5px rgba(0, 0, 0, .8);
}

.apex-games-provider-grid a:not(.has-portrait) strong {
  background: transparent;
}

/* ---------- Toolbar: filter strip + search ---------- */

.apex-games-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
}

.apex-games-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.apex-games-filter a {
  display: grid;
  min-height: 38px;
  place-items: center;
  padding: 0 14px;
  border: 1px solid color-mix(in srgb, var(--apex-line) 74%, transparent);
  border-radius: 9px;
  background: color-mix(in srgb, var(--apex-panel) 72%, #080101);
  color: var(--apex-text);
  font-size: 12.5px;
  line-height: 1.15;
  text-decoration: none;
  transition: border-color .15s ease, color .15s ease;
}

.apex-games-filter a:hover {
  border-color: color-mix(in srgb, var(--apex-accent) 55%, var(--apex-line));
}

.apex-games-filter a.is-active {
  border-color: color-mix(in srgb, var(--apex-accent) 80%, var(--apex-line));
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--apex-primary) 76%, var(--apex-accent)), color-mix(in srgb, var(--apex-primary) 70%, var(--apex-panel)));
  color: var(--apex-accent);
  box-shadow: inset 0 -2px 0 var(--apex-accent);
}

.apex-games-search {
  flex: 1 1 240px;
  max-width: 340px;
}

.apex-games-search label {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  align-items: center;
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid color-mix(in srgb, var(--apex-line) 74%, transparent);
  border-radius: 9px;
  background: color-mix(in srgb, var(--apex-panel) 72%, #080101);
  transition: border-color .15s ease;
}

.apex-games-search label:focus-within {
  border-color: color-mix(in srgb, var(--apex-accent) 65%, var(--apex-line));
}

.apex-games-search .apex-icon {
  width: 20px;
  height: 20px;
  color: var(--apex-muted);
}

.apex-games-search input {
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--apex-text);
  font: inherit;
  font-size: 13px;
}

.apex-games-search input::placeholder {
  color: color-mix(in srgb, var(--apex-muted) 72%, transparent);
}

.apex-games-search input::-webkit-search-cancel-button,
.apex-games-search input::-webkit-search-decoration {
  appearance: none;
  -webkit-appearance: none;
}

.apex-games-list-meta {
  margin: -4px 0 0;
  color: var(--apex-muted);
  font-size: 12.5px;
  line-height: 1.35;
}

/* ---------- Game grid & cards ---------- */

.apex-games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
}

.apex-game-card {
  display: grid;
  overflow: hidden;
  border-radius: 12px;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--apex-primary) 40%, var(--apex-panel)), color-mix(in srgb, var(--apex-panel) 86%, #080101));
  color: var(--apex-text);
  text-decoration: none;
  box-shadow:
    inset 0 0 0 1px color-mix(in srgb, var(--apex-line) 65%, transparent),
    0 6px 14px rgba(0, 0, 0, .24);
  transition: transform .15s ease, box-shadow .15s ease;
}

.apex-game-card:hover {
  transform: translateY(-2px);
  box-shadow:
    inset 0 0 0 1px color-mix(in srgb, var(--apex-accent) 55%, var(--apex-line)),
    0 12px 24px rgba(0, 0, 0, .32);
}

.apex-game-card figure {
  display: grid;
  place-items: center;
  aspect-ratio: 1 / 1;
  margin: 0;
  overflow: hidden;
  background: color-mix(in srgb, var(--apex-panel) 70%, #000);
}

.apex-game-card figure img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.apex-game-card figure .apex-icon {
  width: 34px;
  height: 34px;
  color: var(--apex-accent);
}

.apex-game-card>div {
  display: grid;
  gap: 5px;
  min-height: 92px;
  padding: 9px;
  text-align: left;
}

.apex-game-card strong {
  overflow: hidden;
  color: var(--apex-text);
  font-size: 13px;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.apex-game-card>div>span {
  overflow: hidden;
  color: color-mix(in srgb, var(--apex-muted) 76%, transparent);
  font-size: 11px;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.apex-game-rtp {
  position: relative;
  display: block;
  height: 18px;
  overflow: hidden;
  border-radius: 999px;
  background: color-mix(in srgb, var(--apex-bg) 80%, #000);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--apex-accent) 28%, transparent);
}

.apex-game-rtp i {
  position: absolute;
  inset: 3px auto 3px 3px;
  min-width: 34%;
  border-radius: inherit;
  background:
    linear-gradient(90deg, color-mix(in srgb, #1aa84b 82%, var(--apex-accent)), color-mix(in srgb, #4fd16f 78%, var(--apex-accent)));
}

.apex-game-rtp b {
  position: relative;
  z-index: 1;
  display: grid;
  height: 100%;
  place-items: center;
  color: #fffbe8;
  font-size: 10px;
  line-height: 1;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .75);
}

.apex-game-prize {
  display: grid;
  gap: 1px;
  padding: 5px 7px;
  border-radius: 8px;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--apex-accent) 16%, transparent), color-mix(in srgb, var(--apex-bg) 72%, transparent));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--apex-line) 48%, transparent);
}

.apex-game-prize span {
  color: color-mix(in srgb, var(--apex-muted) 82%, transparent);
  font-size: 9px;
  letter-spacing: .03em;
  text-transform: uppercase;
}

.apex-game-prize b {
  overflow: hidden;
  color: var(--apex-accent);
  font-size: 11px;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- Pagination ---------- */

.apex-games-pagination {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 8px;
  align-items: center;
}

.apex-games-pagination a,
.apex-games-pagination span,
.apex-games-pagination b {
  display: grid;
  min-height: 40px;
  place-items: center;
  border-radius: 10px;
  background: color-mix(in srgb, var(--apex-panel) 72%, #050101);
  color: var(--apex-text);
  font-size: 12.5px;
  text-decoration: none;
}

.apex-games-pagination a:hover {
  background: color-mix(in srgb, var(--apex-panel) 60%, var(--apex-primary));
}

.apex-games-pagination span {
  opacity: .5;
}

.apex-games-pagination b {
  min-width: 80px;
  color: var(--apex-accent);
}

/* ---------- Empty state ---------- */

.apex-games-empty {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 11px;
  align-items: center;
  padding: 16px;
  border-radius: 12px;
  background:
    radial-gradient(circle at 100% 0, color-mix(in srgb, var(--apex-accent) 9%, transparent), transparent 150px),
    color-mix(in srgb, var(--apex-panel) 88%, var(--apex-bg));
}

.apex-games-empty>.apex-icon {
  width: 42px;
  height: 42px;
  color: var(--apex-accent);
}

.apex-games-empty strong {
  display: block;
  color: var(--apex-accent);
  font-size: 16px;
}

.apex-games-empty p {
  margin: 3px 0 0;
  color: var(--apex-muted);
  font-size: 13px;
  line-height: 1.35;
}

/* ---------- Launch popup (apex-modal convention) ---------- */

.apex-modal {
  position: fixed;
  z-index: 120;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
}

.apex-modal[hidden] {
  display: none;
}

.apex-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, .72);
}

.apex-modal-panel {
  position: relative;
  display: grid;
  gap: 14px;
  width: min(100%, 440px);
  padding: 20px;
  border: 1px solid var(--apex-line);
  border-radius: 14px;
  background:
    radial-gradient(circle at 50% 0, color-mix(in srgb, var(--apex-primary) 22%, transparent), transparent 160px),
    color-mix(in srgb, var(--apex-surface) 96%, #000);
  box-shadow: 0 24px 55px rgba(0, 0, 0, .55);
}

.apex-game-popup-card>header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.apex-game-popup-card>header span {
  color: var(--apex-muted);
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.apex-game-popup-card>header h2 {
  margin: 2px 0 0;
  color: var(--apex-text);
  font-size: 18px;
  font-weight: 600;
}

.apex-game-popup-card>header button {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid var(--apex-line);
  border-radius: 8px;
  background: transparent;
  color: var(--apex-muted);
  cursor: pointer;
  transition: color .15s ease, background .15s ease;
}

.apex-game-popup-card>header button:hover {
  color: var(--apex-text);
  background: color-mix(in srgb, var(--apex-panel) 78%, transparent);
}

.apex-game-popup-card>header button .apex-icon {
  width: 16px;
  height: 16px;
}

.apex-game-popup-image {
  display: grid;
  place-items: center;
  margin: 0;
  overflow: hidden;
  border-radius: 12px;
  background: color-mix(in srgb, var(--apex-bg) 82%, #000);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--apex-line) 48%, transparent);
}

.apex-game-popup-image[hidden] {
  display: none;
}

.apex-game-popup-image img {
  display: block;
  width: 100%;
  max-height: 200px;
  object-fit: cover;
}

.apex-game-popup-card>p {
  margin: 0;
  color: var(--apex-muted);
  font-size: 13px;
  line-height: 1.45;
}

.apex-game-popup-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}

.apex-game-popup-actions a {
  display: grid;
  min-height: 44px;
  place-items: center;
  border-radius: 11px;
  background: color-mix(in srgb, var(--apex-panel) 74%, #050101);
  color: var(--apex-text);
  font-size: 14px;
  text-decoration: none;
  transition: background .15s ease;
}

.apex-game-popup-actions a:hover {
  background: color-mix(in srgb, var(--apex-panel) 58%, var(--apex-primary));
}

.apex-game-popup-actions .is-play {
  grid-column: 1 / -1;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--apex-accent) 88%, #fff2aa), color-mix(in srgb, var(--apex-accent) 60%, var(--apex-primary)));
  color: color-mix(in srgb, var(--apex-bg) 94%, #000);
  font-weight: 600;
}

.apex-game-popup.is-guest .is-play {
  display: none;
}

.apex-game-popup:not(.is-guest) [data-game-popup-login],
.apex-game-popup:not(.is-guest) [data-game-popup-register] {
  display: none;
}

@media (max-width: 1280px) {
  .apex-games-grid {
    grid-template-columns: repeat(auto-fill, minmax(145px, 1fr));
  }

  .apex-games-provider-grid {
    grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
  }
}
