@font-face {
  font-family: Vazirmatn;
  src: url("/assets/fonts/Vazirmatn.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #0c0d14;
  --bg-2: #12131c;
  --rail: #15161f;
  --line: rgba(255, 255, 255, 0.08);
  --text: #ffffff;
  --muted: #9b9bb0;
  --brand: #8b7cff;
  --cta: #d4f562;
  --on-cta: #14160c;
  --card: #1a1b26;
  --card-2: #14151e;
  --radius: 14px;
  --radius-shell: 20px;
  --rail-w: 72px;
  --font: "Vazirmatn", "Segoe UI", Tahoma, sans-serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --space-1: 8px;
  --space-2: 12px;
  --space-3: 16px;
  --space-4: 24px;
  --space-5: 40px;
}

*,
*::before,
*::after { box-sizing: border-box; }

html, body {
  margin: 0;
  background:
    radial-gradient(880px 480px at 100% -8%, rgba(124, 58, 237, 0.16), transparent 62%),
    var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-weight: 500;
  line-height: 1.5;
  max-width: 100%;
  overflow-x: clip;
}

h1, h2, .hero-band h1 {
  font-family: var(--font);
  font-weight: 800;
  line-height: 1.25;
}

a { color: inherit; text-decoration: none; }
button, input { font: inherit; color: inherit; }
img { display: block; max-width: 100%; }

[hidden] { display: none !important; }

.app {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  min-height: 100dvh;
  padding-bottom: calc(58px + env(safe-area-inset-bottom));
}

/* CrazyGames-style mobile bottom nav (default) */
.rail {
  position: fixed;
  inset-inline: 0;
  bottom: 0;
  top: auto;
  height: calc(56px + env(safe-area-inset-bottom));
  background: rgba(15, 16, 24, 0.96);
  backdrop-filter: blur(16px);
  border-inline-end: 0;
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-around;
  gap: 0;
  padding: 0 8px env(safe-area-inset-bottom);
  z-index: 40;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.rail-desk { display: none !important; }
.rail-tab {
  flex: 1 1 0;
  max-width: 88px;
}
.rail::-webkit-scrollbar { display: none; width: 0; height: 0; }

.rail-gap {
  flex: 0 0 1px;
  width: 1px;
  height: 28px;
  border-top: 0;
  border-inline-start: 1px solid var(--line);
  margin: 0 4px;
  align-self: center;
}

.rail-btn {
  position: relative;
  flex: 0 0 auto;
  width: 48px;
  height: 48px;
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: #9b8cff;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background 0.18s var(--ease), color 0.18s var(--ease);
}

.rail-btn svg {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  display: block;
  overflow: visible;
}

.rail-btn:hover { background: rgba(124, 58, 237, 0.16); color: #fff; }

.rail-btn.active {
  background: rgba(124, 58, 237, 0.22);
  color: #fff;
}

.rail-btn.active::after {
  content: "";
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 6px;
  top: auto;
  height: 3px;
  width: auto;
  border-radius: 999px;
  background: var(--brand);
}

.rail-btn:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

@media (min-width: 981px) {
  .app {
    grid-template-columns: var(--rail-w) minmax(0, 1fr);
    padding-bottom: 0;
  }
  .rail-desk { display: grid !important; }
  .rail-gap.rail-desk { display: block !important; }
  .rail-tab:not(#rail-home) { display: none !important; }
  .rail {
    position: sticky;
    top: 0;
    inset-inline: auto;
    bottom: auto;
    height: 100dvh;
    width: var(--rail-w);
    flex-direction: column;
    justify-content: flex-start;
    gap: 6px;
    padding: max(12px, env(safe-area-inset-top)) 0 12px;
    border-top: 0;
    border-inline-end: 1px solid var(--line);
    overflow-x: hidden;
    overflow-y: auto;
    background: var(--rail);
    backdrop-filter: none;
    z-index: 30;
  }
  .rail-gap {
    flex: none;
    height: 8px;
    width: 28px;
    border-inline-start: 0;
    border-top: 1px solid var(--line);
    margin: 6px 0;
  }
  .rail-btn,
  .rail-tab {
    flex: none;
    max-width: none;
  }
  .rail-btn.active::after {
    left: auto;
    right: auto;
    inset-inline-end: 5px;
    top: 12px;
    bottom: 12px;
    width: 3px;
    height: auto;
  }
}

.shell, main, .block, .play-page, .related { min-width: 0; max-width: 100%; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: max(12px, env(safe-area-inset-top)) 20px 12px;
  background: rgba(11, 11, 18, 0.8);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
}

/* RTL: logo+search pack to the right; login sits flush on the visual left */
.topbar .top-actions {
  margin-inline-start: auto;
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  color: inherit;
  text-decoration: none;
}

.logo-mark,
.brand-mark {
  width: auto;
  height: 46px;
  max-width: 132px;
  object-fit: contain;
  display: block;
  flex-shrink: 0;
}

.logo-words,
.brand-name { display: none; }

.search-wrap {
  flex: 1;
  max-width: 560px;
  margin-inline: auto;
  position: relative;
}

.search-toggle {
  display: none;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 999px;
  background: var(--card);
  color: #fff;
  place-items: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.search-toggle svg { width: 20px; height: 20px; display: block; overflow: visible; }

.search-wrap input {
  width: 100%;
  height: 44px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: var(--card);
  padding-inline: 18px 44px;
  outline: none;
  font-size: 16px;
  font-weight: 500;
}

.search-wrap input:focus {
  border-color: rgba(124, 58, 237, 0.7);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.28);
}

.search-wrap .search-ico {
  position: absolute;
  inset-inline-end: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: #b7bfd0;
  pointer-events: none;
  display: grid;
  place-items: center;
}
.search-wrap .search-ico svg { width: 18px; height: 18px; display: block; }

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.count-chip {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 700;
}

.login-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 40px;
  padding: 0 16px;
  border: 0;
  border-radius: 999px;
  background: var(--cta);
  color: var(--on-cta);
  font-weight: 800;
  cursor: pointer;
  text-decoration: none;
  transition: filter 0.18s var(--ease);
}
.login-btn:hover { filter: brightness(1.08); }
.login-btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 3px; }

main { padding: 18px 20px var(--space-5); }

.collections {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(228px, 1fr);
  gap: 12px;
  overflow-x: auto;
  max-width: 100%;
  padding: 2px 2px 8px;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}
.collections::-webkit-scrollbar { display: none; height: 0; }

.collection {
  --col: rgba(124, 58, 237, 0.72);
  position: relative;
  isolation: isolate;
  overflow: hidden;
  text-decoration: none;
  min-height: 158px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 22px;
  cursor: pointer;
  text-align: start;
  padding: 16px;
  color: #fff;
  scroll-snap-align: start;
  background:
    radial-gradient(120% 90% at 100% 0%, var(--col), transparent 58%),
    linear-gradient(165deg, #1c1c2a, #101018 72%);
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.28);
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-rows: auto auto;
  column-gap: 14px;
  row-gap: 14px;
  align-items: center;
}
.collection::after {
  content: "";
  position: absolute;
  z-index: -1;
  width: 140px;
  height: 140px;
  inset-inline-end: -36px;
  bottom: -48px;
  border-radius: 50%;
  background: var(--col);
  filter: blur(26px);
  opacity: 0.42;
}
.collection[data-cat="Puzzle"] { --col: rgba(124, 58, 237, 0.78); }
.collection[data-cat="Action"] { --col: rgba(244, 63, 94, 0.78); }
.collection[data-cat="Casual"] { --col: rgba(245, 158, 11, 0.72); }
.collection[data-cat="Arcade"] { --col: rgba(34, 211, 238, 0.7); }
.collection[data-cat="Racing"] { --col: rgba(249, 115, 22, 0.78); }
.collection[data-cat="Adventure"] { --col: rgba(52, 211, 153, 0.7); }
.collection[data-cat="Sports"] { --col: rgba(96, 165, 250, 0.75); }
.collection[data-cat="Simulation"] { --col: rgba(167, 139, 250, 0.75); }

.collection:hover { border-color: rgba(255, 255, 255, 0.18); }
.collection:active { transform: scale(0.985); }
.collection:focus-visible { outline: 2px solid var(--brand); outline-offset: 3px; }
.collection.active {
  border-color: transparent;
  box-shadow: 0 0 0 2px #c4b5fd, 0 16px 34px rgba(0, 0, 0, 0.32);
}

.col-ico {
  width: 58px;
  height: 58px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.1);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
  overflow: hidden;
  grid-row: 1;
}

.col-ico img, .col-art {
  width: 58px;
  height: 58px;
  object-fit: contain;
  display: block;
}

.col-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.col-copy strong {
  font-size: 1.18rem;
  font-weight: 800;
  line-height: 1.25;
}

.col-copy em {
  font-style: normal;
  color: var(--muted);
  font-weight: 500;
  font-size: 0.82rem;
  line-height: 1.35;
}

.col-count {
  grid-column: 1 / -1;
  justify-self: start;
  width: max-content;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 700;
}

.block { margin-top: var(--space-4); }
#grid-section, #fresh-section, #featured-section { scroll-margin-top: 84px; }

.block h2, .block-head h2 {
  margin: 0 0 12px;
  font-size: 1.35rem;
  color: #f4f7fb;
}

.block-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.block-head span { color: var(--muted); font-size: 0.9rem; font-weight: 600; }

.stage {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr) minmax(0, 1fr);
  gap: var(--space-2);
  align-items: stretch;
}

.stage .game-card:first-child {
  grid-column: 1;
  grid-row: 1 / span 2;
}

.stage .game-card:first-child .thumb {
  height: 100%;
  min-height: 280px;
  aspect-ratio: auto;
}

.mosaic {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(220px, 280px);
  gap: var(--space-2);
  overflow-x: auto;
  max-width: 100%;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}
.mosaic::-webkit-scrollbar { display: none; height: 0; }
.mosaic .game-card { scroll-snap-align: start; }

.game-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: var(--space-2);
}

.game-card {
  display: block;
  cursor: pointer;
  min-width: 0;
  border-radius: var(--radius);
  transition: transform 0.18s var(--ease);
}

.game-grid .game-card {
  content-visibility: auto;
  contain-intrinsic-size: auto 168px;
}

.thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--card);
  border: 1px solid var(--line);
  transition: box-shadow 0.18s var(--ease);
}

.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb video.card-motion {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
}

.thumb-fallback {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 1.4rem;
}

.thumb-scrim {
  position: absolute;
  inset-inline: 0;
  bottom: 0;
  height: 52%;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.78));
  pointer-events: none;
  z-index: 1;
}

.card-chip {
  position: absolute;
  top: 8px;
  inset-inline-start: 8px;
  z-index: 2;
  max-width: calc(100% - 16px);
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(11, 11, 18, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#viplay-reward {
  position: fixed !important;
  inset: 0 !important;
  width: 100vw !important;
  height: 100dvh !important;
  z-index: 2147483646 !important;
  background: #000 !important;
  display: block !important;
}
#viplay-reward video {
  position: absolute !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
  object-fit: contain !important;
  display: block !important;
  opacity: 1 !important;
  visibility: visible !important;
  background: #000 !important;
}

.card-title {
  position: absolute;
  inset-inline: 10px;
  bottom: 8px;
  z-index: 2;
  font-size: 0.84rem;
  font-weight: 800;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.play-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(6, 8, 16, 0.28);
  opacity: 0;
  pointer-events: none;
  z-index: 1;
}

.play-overlay span {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--cta);
  color: var(--on-cta);
}

.play-overlay svg { width: 22px; height: 22px; display: block; overflow: visible; }

@media (hover: hover) and (pointer: fine) {
  .game-card:hover,
  .game-card:focus-visible {
    transform: translateY(-3px);
  }
  .game-card:hover .thumb,
  .game-card:focus-visible .thumb {
    box-shadow: 0 16px 32px rgba(0, 0, 0, 0.45);
  }
  .game-card:hover .play-overlay,
  .game-card:focus-visible .play-overlay { opacity: 1; }
}

.game-card:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 3px;
}

.game-card:active,
.collection:active,
.login-btn:active,
.btn:active,
.rail-btn:active,
.cat-btn:active { opacity: 0.92; }

@keyframes card-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.stage .game-card,
.mosaic .game-card { animation: card-in 0.42s var(--ease) both; }
.stage .game-card:nth-child(2),
.mosaic .game-card:nth-child(2) { animation-delay: 40ms; }
.stage .game-card:nth-child(3),
.mosaic .game-card:nth-child(3) { animation-delay: 80ms; }
.stage .game-card:nth-child(4),
.mosaic .game-card:nth-child(4) { animation-delay: 120ms; }
.stage .game-card:nth-child(5),
.mosaic .game-card:nth-child(5) { animation-delay: 160ms; }
.stage .game-card:nth-child(6),
.mosaic .game-card:nth-child(6) { animation-delay: 200ms; }
.stage .game-card:nth-child(7),
.mosaic .game-card:nth-child(7) { animation-delay: 240ms; }
.stage .game-card:nth-child(8),
.mosaic .game-card:nth-child(8) { animation-delay: 280ms; }
.stage .game-card:nth-child(n + 9),
.mosaic .game-card:nth-child(n + 9) { animation: none; }

button, .game-card, .rail-btn, .btn { -webkit-tap-highlight-color: transparent; user-select: none; }
.game-info p, .game-info li { user-select: text; }

.chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  max-width: 100%;
  margin-bottom: 14px;
  scrollbar-width: none;
}
.chips::-webkit-scrollbar { display: none; height: 0; }

.cat-btn {
  flex: 0 0 auto;
  height: 40px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: var(--card);
  color: #d5dbe8;
  cursor: pointer;
  font-weight: 700;
  font-size: 0.85rem;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 0.16s var(--ease), color 0.16s var(--ease), border-color 0.16s var(--ease);
}

.cat-btn svg { width: 15px; height: 15px; flex: 0 0 auto; display: block; overflow: visible; }
.cat-btn:hover { background: #221f33; color: #fff; }
.cat-btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.cat-btn.active { background: var(--brand); color: #fff; }
.cat-count { margin-inline-start: 4px; opacity: 0.72; font-weight: 600; }

.empty {
  display: grid;
  justify-items: center;
  gap: 8px;
  margin-top: 8px;
  padding: 48px 16px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: var(--radius-shell);
  background: rgba(22, 22, 31, 0.72);
}

.empty strong { color: var(--text); font-size: 1.05rem; font-weight: 800; }
.empty span { max-width: 28rem; line-height: 1.7; }

.empty-clear {
  margin-top: 8px;
  height: 44px;
  padding: 0 16px;
  border: 0;
  border-radius: 999px;
  background: var(--brand);
  color: #fff;
  font-weight: 800;
  cursor: pointer;
}
.empty-clear:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }

.game-card.is-unplayable { opacity: 0.45; pointer-events: none; }

/* play */
.play-page {
  min-height: 100dvh;
  width: 100%;
  background:
    radial-gradient(720px 360px at 100% 0%, rgba(124, 58, 237, 0.14), transparent 60%),
    var(--bg);
  display: block;
  overflow-x: clip;
}

.play-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  padding: max(8px, env(safe-area-inset-top)) 12px 8px;
  background: rgba(11, 11, 18, 0.8);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
  overflow: hidden;
  position: sticky;
  top: 0;
  z-index: 20;
}

.play-bar .brand { flex: 0 0 auto; min-width: 0; }
.play-bar .btn { flex: 0 0 auto; white-space: nowrap; }

.play-title {
  flex: 1 1 auto;
  min-width: 0;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.play-frame-wrap {
  position: relative;
  background: #000;
  height: calc(100dvh - 64px);
  min-height: 420px;
  width: 100%;
  max-width: 100%;
}

.play-frame-wrap iframe { width: 100%; height: 100%; border: 0; display: block; }

.play-frame-wrap:fullscreen,
.play-frame-wrap:-webkit-full-screen {
  width: 100%;
  height: 100%;
  background: #000;
}

.play-loading {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 10px;
  background: #07080e;
  color: var(--muted);
  justify-items: center;
  z-index: 2;
}

.play-loading.hidden { opacity: 0; pointer-events: none; }

.spinner {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 3px solid #2a2e3d;
  border-top-color: var(--brand);
  animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.game-info {
  margin: var(--space-3);
  padding: 20px;
  display: grid;
  gap: 12px;
  width: auto;
  max-width: none;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-shell);
}

.game-info h1, .game-info h2 { margin: 0; }
.game-info h1 { font-size: 1.45rem; }
.game-info h2 { font-size: 0.95rem; color: var(--muted); font-weight: 700; }
.game-info p { margin: 0; line-height: 1.75; color: #e7e7ef; }

.info-cats { display: flex; flex-wrap: wrap; gap: 8px; }

.info-cats a {
  background: rgba(124, 58, 237, 0.16);
  border: 1px solid rgba(124, 58, 237, 0.35);
  border-radius: 999px;
  padding: 6px 12px;
  font-weight: 700;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
}

.info-cats a:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

.controls {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.controls li {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 12px;
  font-weight: 700;
}

.related {
  padding: 8px 16px calc(20px + env(safe-area-inset-bottom));
  background: transparent;
  width: 100%;
  overflow: hidden;
}

.related h2 { margin: 0 0 12px; font-size: 1.05rem; max-width: 100%; }
.related .game-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); width: 100%; }

.btn {
  height: 40px;
  padding: 0 12px;
  border-radius: 999px;
  border: 0;
  cursor: pointer;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn svg { width: 16px; height: 16px; flex: 0 0 auto; }
.btn-ghost { background: var(--card); color: #fff; border: 1px solid var(--line); }
.btn-gold, .btn-accent { background: var(--cta); color: var(--on-cta); }
.btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 3px; }

.brand { display: inline-flex; align-items: center; gap: 8px; }

@media (max-width: 1100px) {
  .game-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .mosaic { grid-auto-columns: minmax(180px, 42vw); }
  .stage {
    display: grid;
    grid-template-columns: 70%;
    grid-auto-flow: column;
    grid-auto-columns: minmax(180px, 42vw);
    overflow-x: auto;
    max-width: 100%;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    align-items: start;
  }
  .stage::-webkit-scrollbar { display: none; height: 0; }
  .stage .game-card { scroll-snap-align: start; }
  .stage .game-card:first-child {
    grid-column: auto;
    grid-row: auto;
    width: auto;
  }
  .stage .game-card:first-child .thumb {
    aspect-ratio: 16 / 9;
    height: auto;
    min-height: 0;
  }
}

@media (max-width: 760px) {
  :root { --rail-w: 64px; }
  .count-chip { display: none; }
  .topbar { gap: 8px; padding: max(10px, env(safe-area-inset-top)) 10px 10px; }
  .search-toggle { display: grid; }
  .search-wrap { display: none; }
  .search-wrap.open {
    display: block;
    position: absolute;
    inset-inline: 8px;
    top: calc(100% + 8px);
    z-index: 40;
    max-width: none;
    margin: 0;
  }
  .search-wrap input { height: 44px; font-size: 16px; }
  .btn, .login-btn, .cat-btn { min-height: 44px; }
  .login-btn { padding: 0 12px; }
  main { padding: 12px; }
  .game-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .mosaic { grid-auto-columns: min(168px, 46vw); }
  .stage { grid-auto-columns: min(168px, 46vw); }
  .collection { min-height: 148px; min-width: 210px; }
  .col-ico, .col-art { width: 52px; height: 52px; }
  .rail-btn svg { width: 26px; height: 26px; }
  .play-frame-wrap { height: calc(100dvh - 60px); min-height: 280px; }
  .logo-mark, .play-bar .brand-mark { width: auto; height: 40px; max-width: 108px; }
  .play-bar .btn { height: 44px; padding: 0 12px; font-size: 0.85rem; }
  .related .game-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .card-title { font-size: 0.78rem; }
  .game-info { margin: 12px; padding: 16px; }
}

.hero-band {
  position: relative;
  margin: 0 0 18px;
  min-height: 210px;
  padding: 22px 18px;
  border-radius: var(--radius-shell);
  overflow: hidden;
  isolation: isolate;
  background:
    radial-gradient(120% 140% at 100% 0%, rgba(124, 58, 237, 0.32), transparent 55%),
    radial-gradient(90% 120% at 0% 100%, rgba(244, 63, 94, 0.12), transparent 50%),
    var(--card-2);
  border: 1px solid var(--line);
  display: grid;
  align-items: end;
}
.hero-band.has-art { min-height: clamp(280px, 56vw, 420px); padding: 0; }
.hero-media {
  position: absolute;
  inset: 0;
  display: block;
  z-index: 0;
}
.hero-art,
.cat-hero-art {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transform: scale(1.04);
  transition: transform 8s linear;
}
.hero-band:hover .hero-art,
.cat-hero:hover .cat-hero-art { transform: scale(1.1); }
.hero-scrim,
.cat-hero-scrim {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(8, 8, 14, 0.18), rgba(8, 8, 14, 0.78) 72%),
    linear-gradient(90deg, rgba(8, 8, 14, 0.55), transparent 58%);
}
.hero-copy,
.cat-hero-copy {
  position: relative;
  z-index: 1;
  padding: 22px 18px;
  max-width: 34rem;
}
.hero-band h1,
.cat-hero h1 { margin: 0 0 8px; font-size: clamp(1.45rem, 3vw, 2.1rem); color: #fff; }
.hero-band p,
.cat-hero p { margin: 0 0 14px; color: rgba(255, 255, 255, 0.86); max-width: 38rem; }
.hero-band .login-btn { display: inline-flex; align-items: center; text-decoration: none; }

.cat-hero {
  position: relative;
  margin: 0 0 18px;
  min-height: clamp(200px, 40vw, 320px);
  border-radius: var(--radius-shell);
  overflow: hidden;
  isolation: isolate;
  background: var(--card-2);
  border: 1px solid var(--line);
  display: grid;
  align-items: end;
}
.cat-hero-media {
  position: absolute;
  inset: 0;
  display: block;
}
.cat-hero .crumbs { margin: 0 0 10px; color: rgba(255, 255, 255, 0.78); }
.cat-hero .crumbs a { color: #fff; }

.ad-slot { margin: 12px 0; min-width: 0; }
.enamad { display: inline-flex; }
.enamad img { width: 72px; height: auto; background: #fff; border-radius: 8px; }

.reg {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(8, 8, 14, 0.72);
  backdrop-filter: blur(8px);
}
.reg[hidden] { display: none !important; }

.reg-card {
  width: min(420px, 100%);
  display: grid;
  gap: 12px;
  background: rgba(22, 22, 31, 0.96);
  border: 1px solid var(--line);
  border-radius: var(--radius-shell);
  padding: 20px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}

.reg-card h2 { margin: 0; font-size: 1.15rem; }
.reg-card p { margin: 0; color: var(--muted); }
.reg-card label { display: grid; gap: 6px; font-weight: 700; }

.reg-card input {
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #0e0e16;
  padding: 0 12px;
  font-size: 16px;
}

.reg-card input:focus {
  outline: none;
  border-color: rgba(124, 58, 237, 0.8);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.28);
}

.reg-card .btn { width: 100%; justify-content: center; min-height: 44px; }
.reg-error { color: #ffb4b4; margin: 0; }

.site-foot {
  position: relative;
  margin-top: 32px;
  padding: 28px 20px calc(18px + env(safe-area-inset-bottom));
  color: var(--muted);
  background:
    radial-gradient(480px 200px at 100% 0%, rgba(124, 58, 237, 0.18), transparent 68%),
    #0e0e16;
  border-top: 1px solid var(--line);
}
.site-foot-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.site-foot-brand p,
.site-foot-label,
.site-foot-bar p { margin: 0; }
.site-foot .logo-mark { height: 76px; max-width: 210px; }
.site-slogan {
  margin-top: 10px;
  color: #fff;
  font-size: 1.05rem;
  font-weight: 800;
}
.site-foot-label {
  margin-bottom: 10px;
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 800;
}
.site-foot-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
}
.site-foot-links a {
  color: var(--muted);
  font-weight: 700;
  text-decoration: none;
}
.site-foot-links a:hover { color: #fff; }
.site-foot-links a:focus-visible,
.site-foot-seal a:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 3px;
}
.site-foot-bar {
  margin-top: 22px;
  padding: 14px 0 0 72px;
  border-top: 1px solid var(--line);
  font-size: 0.85rem;
  text-align: center;
}
.site-foot-seal {
  position: absolute;
  left: 12px;
  right: auto;
  bottom: 12px;
  z-index: 1;
  display: block;
  line-height: 0;
}
.site-foot-seal a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border-radius: 0;
  background: transparent;
  line-height: 0;
  overflow: visible;
}
.site-foot-seal img {
  display: block;
  width: 56px;
  height: auto;
  max-height: 62px;
}
.row-block { scroll-margin-top: 84px; }
.row-block h2 { margin: 0; }
.row-block h2 a {
  color: #fff;
  font-weight: 800;
  text-decoration: none;
}
.row-block h2 a::after,
.block-head h2 a::after { content: " ›"; color: var(--muted); font-weight: 700; }
.block-head h2 a {
  color: #fff;
  font-weight: 800;
  text-decoration: none;
}

.seo-dir, .faq, .game-info .crumbs {
  margin: 8px 20px 24px;
}
.seo-dir h2, .faq h2 {
  margin: 0 0 12px;
  font-size: 1.15rem;
}
.seo-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}
.seo-links a, .crumbs a {
  color: var(--text);
  font-weight: 700;
  text-decoration: none;
}
.seo-links a {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px;
  background: var(--card);
}
.faq details { border-bottom: 1px solid var(--line); padding: 4px 0; }
.faq summary {
  cursor: pointer;
  font-weight: 800;
  font-size: 1rem;
  padding: 12px 0;
  list-style: none;
}
.faq summary::-webkit-details-marker { display: none; }
.faq details p { padding-bottom: 12px; }
.faq p, .cat-page p { margin: 0; color: var(--muted); line-height: 1.7; }
.crumbs { display: flex; flex-wrap: wrap; gap: 6px; color: var(--muted); font-size: 0.9rem; }
.cat-page { max-width: 1180px; margin: 0 auto; padding: 18px 16px 64px; }
.cat-page .topbar, body > .topbar { margin: 0; }
.cat-grid { grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); margin-top: 4px; }
.seo-index { columns: 2; margin: 20px 0 0; padding: 0; list-style: none; }
.seo-index a { display: block; padding: 8px 0; color: var(--text); text-decoration: none; }
.seo-index a:hover { color: #fff; }
@media (max-width: 700px) {
  .seo-index { columns: 1; }
}

.missing {
  min-height: 100dvh;
  display: grid;
  place-content: center;
  justify-items: center;
  text-align: center;
  gap: 12px;
  padding: 24px;
  background:
    radial-gradient(640px 360px at 50% 0%, rgba(124, 58, 237, 0.2), transparent 62%),
    var(--bg);
}

.missing h1 { margin: 8px 0 0; }
.missing p { margin: 0; color: var(--muted); max-width: 28rem; }

/* A phone turned sideways, or an explicit fullscreen request, fills the screen.
   The score stays clear: there is no overlay back button. Browser back leaves the game. */
@media (orientation: landscape) and (max-height: 520px) {
  body.play-page .play-bar,
  body.play-page .related,
  body.play-page .game-info,
  body.play-page .noise,
  body.play-page .ad-slot,
  body.play-page .site-foot {
    display: none;
  }
  body.play-page .play-frame-wrap {
    position: fixed;
    inset: 0;
    z-index: 40;
    width: 100%;
    height: 100dvh;
    min-height: 0;
  }
}

body.play-page.is-immersive .related,
body.play-page.is-immersive .game-info,
body.play-page.is-immersive .noise,
body.play-page.is-immersive .ad-slot,
body.play-page.is-immersive .site-foot,
body.play-page.is-immersive .play-bar > :not(#fullscreen-btn) {
  display: none;
}
body.play-page.is-immersive .play-bar {
  display: flex;
  justify-content: center;
  position: fixed;
  z-index: 60;
  top: auto;
  bottom: max(10px, env(safe-area-inset-bottom));
  inset-inline: 0;
  width: auto;
  padding: 0;
  background: transparent;
  border: 0;
  backdrop-filter: none;
  pointer-events: none;
}
body.play-page.is-immersive #fullscreen-btn {
  pointer-events: auto;
  opacity: 0.72;
}
body.play-page.is-immersive .play-frame-wrap {
  position: fixed;
  inset: 0;
  z-index: 40;
  width: 100%;
  height: 100dvh;
  min-height: 0;
  max-width: none;
}

/* Only a landscape-locked stage is turned. The back control is not drawn on the score. */
body.play-page.rotate-game {
  overflow: hidden;
  height: 100dvh;
}
body.play-page.rotate-game .play-bar,
body.play-page.rotate-game .related,
body.play-page.rotate-game .game-info,
body.play-page.rotate-game .noise,
body.play-page.rotate-game .ad-slot,
body.play-page.rotate-game .enamad,
body.play-page.rotate-game .site-foot {
  display: none;
}
body.play-page.rotate-game .play-frame-wrap {
  position: fixed;
  z-index: 40;
  top: 0;
  left: 100dvw;
  width: 100dvh;
  height: 100dvw;
  min-width: 0;
  min-height: 0;
  max-width: none;
  max-height: none;
  transform: rotate(90deg);
  transform-origin: top left;
}

@media (prefers-reduced-transparency: reduce) {
  .topbar,
  .play-bar,
  .reg,
  .reg-card {
    backdrop-filter: none;
  }
  .topbar,
  .play-bar { background: var(--bg); }
  .reg { background: rgba(8, 8, 14, 0.92); }
  .reg-card { background: var(--card); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}
