:root {
  --bg: #d6ebff;
  --bg-dots: rgba(80, 110, 200, 0.1);
  --surface: #ffffff;
  --surface-2: #f1f4ff;
  --text: #1d2144;
  --muted: #5b6386;
  --accent: #6c4cff;
  --accent-text: #ffffff;
  --accent-2: #ffcc33;
  --border: rgba(29, 33, 68, 0.1);
  --shadow: 0 4px 14px rgba(40, 50, 120, 0.14);
  --shadow-lg: 0 10px 30px rgba(40, 50, 120, 0.22);
  --radius: 16px;
  --t: 116px;
  --gap: 12px;
  --font: ui-rounded, 'SF Pro Rounded', 'Nunito', 'Segoe UI', system-ui, -apple-system, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #10132b;
    --bg-dots: rgba(140, 160, 255, 0.07);
    --surface: #1c2147;
    --surface-2: #252b58;
    --text: #eef0ff;
    --muted: #a3a9d1;
    --accent: #8e75ff;
    --border: rgba(255, 255, 255, 0.1);
    --shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.5);
    color-scheme: dark;
  }
}
@media (max-width: 520px) {
  :root {
    --gap: 10px;
    --t: calc((100vw - 32px - 2 * var(--gap)) / 3);
  }
}

* {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
}
body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background-color: var(--bg);
  background-image: radial-gradient(var(--bg-dots) 2px, transparent 2px);
  background-size: 22px 22px;
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a {
  color: inherit;
}
img {
  max-width: 100%;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.skip {
  position: absolute;
  left: -999px;
  top: 8px;
  z-index: 100;
  background: var(--surface);
  padding: 8px 14px;
  border-radius: 10px;
}
.skip:focus {
  left: 8px;
}
:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.header-row {
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 1440px;
  margin: 0 auto;
  padding: 10px 16px;
}
.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  font-weight: 900;
  font-size: 22px;
  letter-spacing: -0.02em;
  flex-shrink: 0;
}
.logo img {
  width: 36px;
  height: 36px;
  display: block;
}
.search {
  position: relative;
  flex: 1;
  max-width: 420px;
  margin-left: auto;
}
.search input {
  width: 100%;
  font: inherit;
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  background: var(--surface-2);
  border: 2px solid transparent;
  border-radius: 999px;
  padding: 9px 16px 9px 40px;
  outline: none;
}
.search input:focus {
  border-color: var(--accent);
}
.search svg {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--muted);
  pointer-events: none;
}
.search-results {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 6px;
  max-height: 70vh;
  overflow: auto;
}
.search-results[hidden] {
  display: none;
}
.search-results a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px;
  border-radius: 12px;
  text-decoration: none;
  font-weight: 700;
}
.search-results a:hover,
.search-results a[aria-selected='true'] {
  background: var(--surface-2);
}
.search-results img {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  object-fit: cover;
  flex-shrink: 0;
}
.search-results .empty {
  padding: 10px;
  color: var(--muted);
}
.icon-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font: inherit;
  font-weight: 800;
  font-size: 15px;
  color: var(--accent-text);
  background: var(--accent);
  border: 0;
  border-radius: 999px;
  padding: 9px 14px;
  cursor: pointer;
  text-decoration: none;
  flex-shrink: 0;
}
.icon-btn svg {
  width: 18px;
  height: 18px;
}
.cats {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 16px 10px;
}
.cats::-webkit-scrollbar {
  display: none;
}
.chip {
  flex-shrink: 0;
  text-decoration: none;
  font-weight: 800;
  font-size: 14px;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--surface-2);
  white-space: nowrap;
}
.chip:hover {
  background: var(--accent);
  color: var(--accent-text);
}
.chip[aria-current='page'] {
  background: var(--accent);
  color: var(--accent-text);
}
@media (max-width: 520px) {
  .logo span {
    display: none;
  }
  .icon-btn .label {
    display: none;
  }
}

/* Layout */
main {
  flex: 1;
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  padding: 20px 16px 40px;
}
.page-head {
  margin: 0 0 16px;
}
.page-head h1 {
  margin: 0;
  font-size: clamp(24px, 4vw, 34px);
  font-weight: 900;
  letter-spacing: -0.02em;
  line-height: 1.15;
}
.page-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-weight: 600;
}
.section-title {
  font-size: 20px;
  font-weight: 900;
  margin: 28px 0 12px;
}

/* Game grid */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, var(--t));
  grid-auto-rows: var(--t);
  grid-auto-flow: dense;
  gap: var(--gap);
  justify-content: center;
}
.grid.left {
  justify-content: start;
}
.tile {
  position: relative;
  display: block;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface-2);
  box-shadow: var(--shadow);
  text-decoration: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.tile--big {
  grid-column: span 2;
  grid-row: span 2;
}
.tile__title {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 18px 8px 7px;
  color: #fff;
  font-weight: 800;
  font-size: 13px;
  line-height: 1.2;
  text-align: center;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.75));
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.15s ease, transform 0.15s ease;
}
.tile--big .tile__title {
  font-size: 17px;
  opacity: 1;
  transform: none;
}
.tile:hover,
.tile:focus-visible {
  transform: scale(1.04);
  box-shadow: var(--shadow-lg);
  z-index: 2;
}
.tile:hover .tile__title,
.tile:focus-visible .tile__title {
  opacity: 1;
  transform: none;
}
.badge {
  position: absolute;
  top: 7px;
  left: 7px;
  background: var(--accent-2);
  color: #1d2144;
  font-size: 11px;
  font-weight: 900;
  padding: 2px 8px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.row-scroll {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: var(--t);
  grid-auto-rows: var(--t);
  gap: var(--gap);
  overflow-x: auto;
  padding: 4px 4px 10px;
  scrollbar-width: thin;
}
#recent[hidden] {
  display: none;
}

/* Game page */
.game-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 20px;
  align-items: start;
}
@media (max-width: 960px) {
  .game-layout {
    grid-template-columns: minmax(0, 1fr);
  }
}
.player-col {
  container-type: inline-size;
  min-width: 0;
}
.player {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  height: min(calc(100cqw * var(--ratio, 0.625)), 78vh);
  min-height: 260px;
  background: #0c0e22;
  border-radius: var(--radius) var(--radius) 0 0;
  overflow: hidden;
}
@supports (height: 1cqw) {
  .player {
    aspect-ratio: auto;
  }
}
.player iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
  background: #0c0e22;
}
.player__cover {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 0;
  padding: 0;
  margin: 0;
  width: 100%;
  cursor: pointer;
  background: #0c0e22;
  color: #fff;
  font: inherit;
}
.player__bg {
  position: absolute;
  inset: -40px;
  width: calc(100% + 80px);
  height: calc(100% + 80px);
  max-width: none;
  object-fit: cover;
  filter: blur(28px) brightness(0.55);
}
.player__card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}
.player__thumb {
  width: min(180px, 34cqw);
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 24px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
}
.player__name {
  font-size: clamp(20px, 3.4cqw, 30px);
  font-weight: 900;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
  text-align: center;
  padding: 0 12px;
}
.play-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 900;
  font-size: 20px;
  padding: 12px 34px;
  border-radius: 999px;
  background: var(--accent-2);
  color: #1d2144;
  box-shadow: 0 5px 0 #c99a00;
  transition: transform 0.1s ease;
}
.player__cover:hover .play-btn {
  transform: scale(1.06);
}
.player-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--surface);
  border-radius: 0 0 var(--radius) var(--radius);
  box-shadow: var(--shadow);
}
.player-bar h1 {
  margin: 0;
  font-size: 20px;
  font-weight: 900;
  line-height: 1.2;
  flex: 1;
  min-width: 0;
}
.bar-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 0;
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
}
.bar-btn svg {
  width: 20px;
  height: 20px;
}
.player:fullscreen {
  border-radius: 0;
  height: 100%;
}
.player.pseudo-fs {
  position: fixed;
  inset: 0;
  z-index: 1000;
  height: 100%;
  border-radius: 0;
}
.exit-fs {
  display: none;
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 5;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
}
.player.pseudo-fs .exit-fs {
  display: inline-flex;
}
.about {
  margin-top: 20px;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 22px;
}
.about h2 {
  font-size: 18px;
  font-weight: 900;
  margin: 0 0 6px;
}
.about p {
  margin: 0 0 16px;
  color: var(--muted);
  max-width: 75ch;
}
.about .chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.side .grid {
  --t: 94px;
  --gap: 10px;
  justify-content: start;
}
.side h2 {
  font-size: 18px;
  font-weight: 900;
  margin: 0 0 10px;
}
@media (max-width: 960px) {
  .side .grid {
    --t: 116px;
    justify-content: center;
  }
}
@media (max-width: 520px) {
  .side .grid {
    --gap: 10px;
    --t: calc((100vw - 32px - 2 * var(--gap)) / 3);
  }
}

/* Ads */
.ad {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 16px auto;
  overflow: hidden;
}
.ad--placeholder {
  border: 2px dashed var(--border);
  border-radius: 12px;
  color: var(--muted);
  font-weight: 700;
  font-size: 13px;
  background: repeating-linear-gradient(45deg, transparent, transparent 10px, var(--bg-dots) 10px, var(--bg-dots) 20px);
}
.ad--leader {
  width: 100%;
  max-width: 728px;
  min-height: 90px;
}
.ad--rect {
  width: 300px;
  min-height: 250px;
  margin-top: 0;
}

/* Text pages */
.prose {
  max-width: 760px;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px 28px;
}
.prose h1 {
  margin-top: 0;
  font-weight: 900;
}
.prose h2 {
  font-size: 19px;
  margin: 24px 0 6px;
}
.prose p,
.prose li {
  color: var(--muted);
}
.seo-text {
  max-width: 900px;
  margin: 40px auto 0;
  color: var(--muted);
  font-size: 15px;
}
.seo-text h2 {
  color: var(--text);
  font-size: 18px;
}

/* Footer */
.site-footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
}
.footer-row {
  max-width: 1440px;
  margin: 0 auto;
  padding: 20px 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  align-items: center;
  font-size: 14px;
  color: var(--muted);
}
.footer-row a {
  text-decoration: none;
  font-weight: 700;
}
.footer-row a:hover {
  color: var(--accent);
}
.footer-row .copy {
  margin-left: auto;
}

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