/* ==========================================================================
   Ludiko Apps — ludikoapps.com
   Design system: DESIGN.md ("Tactile Bento & Clean Utility").
   All colors come from the tokens below — no raw HEX in components.
   ========================================================================== */

/* 1. Tokens
   ========================================================================== */
:root {
  /* Backgrounds & surfaces */
  --bg-canvas: #f8f9fb;
  --bg-surface: #ffffff;
  --bg-subtle: #f1f4f9;
  /* Page backdrop: cool top → neutral canvas → warm bottom, under a faint grain */
  --bg-canvas-top: #f4f5ff;
  --bg-canvas-bottom: #fbf8f3;
  --bg-grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.05'/%3E%3C/svg%3E");

  /* Text */
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;

  /* Brand accents */
  --accent-primary: #4f46e5;
  --accent-primary-hover: #4338ca;
  --accent-secondary: #f59e0b;

  /* Per-game accents */
  --game-caesar-cipher: #7c3aed;
  --game-chess-academy: #0f766e;
  --game-cryptogram: #d97706;
  --game-math-academy: #2563eb;
  --game-sort-puzzle: #ec4899;
  --game-sudoku: #059669;

  /* Borders & elevation */
  --border-subtle: #e2e8f0;
  --shadow-card: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-card-hover: 0 12px 24px -8px rgba(15, 23, 42, 0.08);

  /* Typography */
  --font-display: "Plus Jakarta Sans", ui-sans-serif, system-ui, sans-serif;
  --font-sans: "Inter", ui-sans-serif, system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;

  /* Radii */
  --radius-card: 24px;
  --radius-control: 12px;

  /* Current game accent; pages and cards override it (e.g. style="--game: var(--game-sudoku)") */
  --game: var(--accent-primary);
  --warn-text: color-mix(in oklab, var(--accent-secondary) 55%, black);

  /* Form states (≥ 4.5:1 on white) */
  --danger: #b91c1c;
  --success: #047857;
}

/* Derived game tints. Declared again wherever --game is overridden: a custom property is computed
   where it is declared, so tints declared only on :root would keep the brand color everywhere. */
:root,
[style*="--game"] {
  --game-tint: color-mix(in oklab, var(--game) 8%, var(--bg-surface));
  --game-soft: color-mix(in oklab, var(--game) 18%, var(--bg-surface));
  --game-line: color-mix(in oklab, var(--game) 28%, var(--bg-surface));
  --game-text: color-mix(in oklab, var(--game) 78%, black); /* ≥ 4.5:1 on light tints */
}

/* 2. Base
   ========================================================================== */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-canvas);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* fixed backdrop layer: stays put while scrolling (background-attachment: fixed is ignored on iOS) */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    var(--bg-grain),
    linear-gradient(180deg, var(--bg-canvas-top) 0%, var(--bg-canvas) 45%, var(--bg-canvas-bottom) 100%);
}

main {
  flex: 1;
}

h1,
h2,
h3,
p,
ul,
ol,
figure {
  margin: 0;
}

ul,
ol {
  padding: 0;
  list-style: none;
}

h1,
h2,
h3 {
  font-family: var(--font-display);
  color: var(--text-primary);
  overflow-wrap: break-word;
}

/* Russian words run long ("конфиденциальности") — a smaller mobile minimum keeps H1 on screen. */
:lang(ru) h1 {
  font-size: clamp(1.875rem, 4vw, 3.5rem);
}

h1 {
  font-size: clamp(2.25rem, 4vw, 3.5rem);
  line-height: 1.1;
  font-weight: 700;
  letter-spacing: -0.02em;
}

h2 {
  font-size: clamp(1.75rem, 3vw, 2.25rem);
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: -0.02em;
}

h3 {
  font-size: 1.25rem;
  line-height: 1.3;
  font-weight: 700;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

img,
svg {
  flex-shrink: 0;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

:focus-visible {
  outline: 2px solid var(--accent-primary);
  outline-offset: 2px;
}

.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-link {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 100;
  padding: 8px 16px;
  border-radius: var(--radius-control);
  background: var(--accent-primary);
  color: #fff;
  transform: translateY(-200%);
}

.skip-link:focus {
  transform: none;
}

/* 3. Layout primitives
   ========================================================================== */
.container {
  width: 100%;
  max-width: calc(1200px + 2 * 24px);
  margin-inline: auto;
  padding-inline: 24px;
}

.section {
  padding-block: 80px;
}

.section--surface {
  background: var(--bg-surface);
  border-block: 1px solid var(--border-subtle);
}

.section--top {
  padding-top: 64px;
}

.pb-section {
  padding-bottom: 80px;
}

@media (min-width: 768px) {
  .container {
    max-width: calc(1200px + 2 * 32px);
    padding-inline: 32px;
  }

  .section {
    padding-block: 112px;
  }

  .section--top {
    padding-top: 96px;
  }

  .pb-section {
    padding-bottom: 112px;
  }
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 24px;
  align-items: flex-start;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.lead {
  max-width: 36rem;
  font-size: 1.125rem;
  color: var(--text-secondary);
}

/* текст из редактора раздела («Описание»): несколько абзацев подряд */
.lead > p + p,
.page-intro > div > p + p {
  margin-top: 0.75em;
}

.text-secondary {
  color: var(--text-secondary);
}

.text-muted {
  color: var(--text-muted);
}

.small {
  font-size: 0.875rem;
}

/* 4. Components: card, icon, buttons, tags
   ========================================================================== */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  transition:
    transform 200ms ease,
    box-shadow 200ms ease;
}

.card--hover:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-card-hover);
}

/* iOS squircle app icon, tinted with --game */
.app-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border-radius: 22%;
  background: var(--game);
  color: #fff;
}

.app-icon--sm {
  width: 32px;
  height: 32px;
}

.app-icon--md {
  width: 48px;
  height: 48px;
}

.app-icon--lg {
  width: 80px;
  height: 80px;
}

.app-icon--xl {
  width: 96px;
  height: 96px;
  box-shadow: 0 12px 24px -8px color-mix(in oklab, var(--game) 45%, transparent);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding-inline: 16px;
  border: 1px solid transparent;
  border-radius: var(--radius-control);
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  transition:
    background-color 150ms ease,
    color 150ms ease;
}

.btn--lg {
  min-height: 52px;
  padding-inline: 24px;
  font-size: 1rem;
}

.btn--primary {
  background: var(--accent-primary);
  color: #fff;
}

.btn--primary:hover {
  background: var(--accent-primary-hover);
}

.btn--secondary {
  background: var(--bg-surface);
  border-color: var(--border-subtle);
  color: var(--text-primary);
}

.btn--secondary:hover {
  background: var(--bg-subtle);
}

.btn--game {
  background: var(--game);
  color: #fff;
}

.btn--game:hover {
  background: color-mix(in oklab, var(--game) 85%, black);
}

.btn--light {
  background: var(--bg-surface);
  color: var(--text-primary);
}

.btn--light:hover {
  background: var(--bg-subtle);
}

.btn[aria-disabled="true"] {
  background: var(--bg-subtle);
  border-color: var(--border-subtle);
  color: var(--text-secondary);
  cursor: default;
}

.btn:disabled {
  opacity: 0.5;
  cursor: default;
}

.eyebrow {
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-primary);
}

.tag {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  padding: 2px 10px;
  border-radius: 9999px;
  background: var(--bg-subtle);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border: 1px solid var(--border-subtle);
  border-radius: 9999px;
  background: var(--bg-surface);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.pill__dot {
  width: 8px;
  height: 8px;
  border-radius: 9999px;
  background: var(--accent-secondary);
}

.link-arrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 8px;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--accent-primary);
}

.link-arrow:hover {
  color: var(--accent-primary-hover);
}

.link-inline {
  font-weight: 500;
  color: var(--accent-primary);
  text-decoration: underline;
  text-underline-offset: 4px;
}

.link-inline:hover {
  color: var(--accent-primary-hover);
}

.icon-box {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border-radius: var(--radius-control);
  background: color-mix(in oklab, var(--accent-primary) 10%, var(--bg-surface));
  color: var(--accent-primary);
}

.icon-box--game {
  background: var(--game-tint);
  color: var(--game-text);
}

:lang(ru) {
  --font-display: "Manrope", ui-sans-serif, system-ui, sans-serif;
}

/* 5. Header & navigation
   ========================================================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.8);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 64px;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border-radius: var(--radius-control);
  font-family: var(--font-display);
  font-size: 1.125rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.logo__mark {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 2px;
  width: 32px;
  height: 32px;
  padding: 6px;
  border-radius: 22%;
  background: var(--accent-primary);
}

.logo__mark span {
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.6);
}

.logo__mark span:first-child {
  background: #fff;
}

.logo__mark span:last-child {
  background: var(--accent-secondary);
}

.nav {
  display: none;
  align-items: center;
  gap: 4px;
}

.nav__link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 8px 12px;
  border: 0;
  border-radius: var(--radius-control);
  background: transparent;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition:
    background-color 150ms ease,
    color 150ms ease;
}

.nav__link:hover,
.nav__link[aria-current="page"] {
  background: var(--bg-subtle);
  color: var(--text-primary);
}

.nav__link svg {
  transition: transform 150ms ease;
}

.nav__link[aria-expanded="true"] svg {
  transform: rotate(180deg);
}

.nav__games {
  position: relative;
}

.dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  width: min(560px, 90vw);
  margin-top: 8px;
  padding: 12px;
  box-shadow: var(--shadow-card-hover);
}

.dropdown[hidden],
.mobile-nav[hidden] {
  display: none;
}

.dropdown__grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 4px;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border-radius: var(--radius-control);
  transition: background-color 150ms ease;
}

.menu-item:hover {
  background: var(--bg-subtle);
}

.menu-item__name {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
}

.menu-item__genre {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.dropdown__all {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
  padding: 12px 10px 4px;
  border-top: 1px solid var(--border-subtle);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--accent-primary);
}

.dropdown__all:hover {
  color: var(--accent-primary-hover);
}

.menu-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: var(--radius-control);
  background: transparent;
  color: var(--text-primary);
}

.menu-toggle:hover {
  background: var(--bg-subtle);
}

.menu-toggle .icon-close,
.menu-toggle[aria-expanded="true"] .icon-open {
  display: none;
}

.menu-toggle[aria-expanded="true"] .icon-close {
  display: block;
}

.mobile-nav {
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  padding-block: 16px;
}

.mobile-nav__label {
  padding: 0 8px 8px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.mobile-nav__list {
  display: grid;
  gap: 4px;
}

.mobile-nav__list .menu-item {
  padding: 8px;
}

.mobile-nav__links {
  display: grid;
  gap: 4px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border-subtle);
}

.mobile-nav__links a {
  display: block;
  padding: 10px 8px;
  border-radius: var(--radius-control);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.mobile-nav__links a:hover {
  background: var(--bg-subtle);
  color: var(--text-primary);
}

@media (min-width: 768px) {
  .nav {
    display: flex;
  }

  .menu-toggle,
  .mobile-nav {
    display: none !important;
  }
}

.site-header__right {
  display: flex;
  align-items: center;
  gap: 4px;
}

.lang-switch {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-control);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition:
    background-color 150ms ease,
    color 150ms ease;
}

.lang-switch:hover {
  background: var(--bg-subtle);
  color: var(--text-primary);
}

@media (min-width: 768px) {
  .lang-switch {
    margin-left: 8px;
  }
}

/* 6. Footer
   ========================================================================== */
.site-footer {
  margin-top: auto;
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-surface);
}

.site-footer__grid {
  display: grid;
  gap: 40px;
  padding-block: 56px;
}

.site-footer__about {
  max-width: 24rem;
}

.site-footer__about p {
  margin-top: 16px;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.site-footer__title {
  font-family: var(--font-display);
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: 0;
}

.site-footer__links {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.site-footer__links a {
  border-radius: 6px;
  font-size: 0.875rem;
  color: var(--text-secondary);
  transition: color 150ms ease;
}

.site-footer__links a:hover {
  color: var(--text-primary);
}

.site-footer__bottom {
  border-top: 1px solid var(--border-subtle);
}

.site-footer__bottom p {
  padding-block: 24px;
  font-size: 0.875rem;
  color: var(--text-muted);
}

@media (min-width: 768px) {
  .site-footer__grid {
    grid-template-columns: 1.5fr 1fr 1fr;
  }
}

/* 6a. Cookie notice
   Окно о cookie: themes/template-{en,ru}/modules/cookie-notice.tpl (подключено в footer.tpl),
   показ и скрытие — themes/assets/js/cookie-notice.js (класс .is-visible). Перенесено из lscms.shop.loc.
   Mobile-first: на телефоне — колонкой во всю ширину, с 640px — в строку, справа внизу, не шире 560px.
   ========================================================================== */
.cookie-notice {
  position: fixed;
  z-index: 60;
  right: 16px;
  bottom: 16px;
  left: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-control);
  background: var(--bg-surface);
  box-shadow: var(--shadow-card-hover);
  font-size: 0.9375rem;
  line-height: 1.5;
  color: var(--text-primary);
  opacity: 0;
  transform: translateY(calc(100% + 32px));
  transition:
    opacity 0.35s ease,
    transform 0.35s ease;
}

.cookie-notice[hidden] {
  display: none;
}

.cookie-notice.is-visible {
  opacity: 1;
  transform: none;
}

.cookie-notice__text {
  margin: 0;
  color: var(--text-secondary);
}

.cookie-notice__text a {
  font-weight: 500;
  color: var(--accent-primary);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.cookie-notice__text a:hover {
  color: var(--accent-primary-hover);
}

@media (min-width: 640px) {
  .cookie-notice {
    left: auto;
    flex-direction: row;
    align-items: center;
    gap: 20px;
    max-width: 560px;
    padding: 20px 24px;
  }

  .cookie-notice__btn {
    flex-shrink: 0;
  }
}

/* 7. Section heading
   ========================================================================== */
.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 40px;
}

.section-head__text {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 42rem;
}

.section-head__text > p:not(.eyebrow) {
  font-size: 1.125rem;
  color: var(--text-secondary);
}

@media (min-width: 768px) {
  .section-head {
    margin-bottom: 48px;
  }
}

/* 8. Home: hero, bento, reasons, CTA
   ========================================================================== */
.hero {
  padding-block: 64px 80px;
}

.hero__grid {
  display: grid;
  align-items: center;
  gap: 56px;
}

.hero .actions {
  padding-top: 8px;
}

@media (min-width: 768px) {
  .hero {
    padding-block: 96px 112px;
  }
}

@media (min-width: 1024px) {
  .hero__grid {
    grid-template-columns: 1.1fr 1fr;
  }
}

.icon-wall {
  padding: 32px 32px 56px;
  border-radius: 32px;
}

.icon-wall__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.icon-wall__item {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1;
  border-radius: 22%;
  background: var(--game);
  color: #fff;
}

.icon-wall__item svg {
  width: 44%;
  height: 44%;
}

.icon-wall__item:nth-child(3n + 2) {
  transform: translateY(24px);
}

@media (min-width: 640px) {
  .icon-wall {
    padding: 40px 40px 64px;
  }

  .icon-wall__grid {
    gap: 24px;
  }
}

/* Particle hero (assets/js/particles.js)
   html.pf-on — WebGL works: canvas instead of the icon wall;
   html.pf-scroll — wide screen: tall section, the stage sticks and follows scroll */
.pf-hero {
  --header-h: 65px;
  position: relative;
  /* the canvas bleeds past the stage for the swirl; clip (not hidden) keeps the sticky stage working */
  overflow-x: clip;
}

.pf-stage {
  display: grid;
  justify-items: center;
  gap: 16px;
}

.pf-canvas-wrap {
  position: relative;
  width: 100%;
  max-width: 520px;
}

.pf-canvas {
  display: none;
}

.pf-caption,
.pf-steps,
.pf-hint {
  display: none;
}

html.pf-on .pf-fallback {
  display: none;
}

/* ambient glow behind the hero in the colour of the game on stage (follows --game set by particles.js) */
.pf-hero__sticky {
  position: relative;
  isolation: isolate;
}

.pf-hero__sticky::before {
  content: "";
  position: absolute;
  inset: calc(-1 * var(--header-h)) 0 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(60% 70% at 72% 45%, color-mix(in oklab, var(--game) 16%, transparent), transparent 70%),
    radial-gradient(40% 50% at 10% 10%, color-mix(in oklab, var(--accent-primary) 8%, transparent), transparent 70%);
  transition: background 0.6s ease;
}

html.pf-on .pf-canvas-wrap {
  aspect-ratio: 1;
}

/* soft glow in the color of the game on stage */
html.pf-on .pf-canvas-wrap::before {
  content: "";
  position: absolute;
  inset: 8%;
  border-radius: 50%;
  background: radial-gradient(closest-side, var(--game-soft), transparent);
  opacity: 0.9;
  transition: background 0.6s ease;
}

html.pf-on .pf-canvas {
  display: block;
  position: absolute;
  inset: -10%;
  width: 120%;
  height: 120%;
  opacity: 0;
  transition: opacity 0.8s ease;
}

.pf-hero.pf-ready .pf-canvas {
  opacity: 1;
}

html.pf-on .pf-caption {
  display: block;
  width: 100%;
  max-width: 520px;
  margin: 0;
}

/* fixed grid: name and genre stacked on the left, CTA pinned right —
   switching games changes only the text, nothing shifts or wraps differently */
.pf-caption a {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "name  cta"
    "genre cta";
  align-items: center;
  gap: 4px 16px;
  padding: 8px 12px;
  border-radius: var(--radius-control);
  color: var(--text-primary);
  text-decoration: none;
}

.pf-caption__name {
  grid-area: name;
  overflow: hidden;
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.pf-caption .tag {
  grid-area: genre;
  justify-self: start;
  align-self: center;
  max-width: 100%;
  overflow: hidden;
  line-height: 1.5;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.pf-caption__cta {
  grid-area: cta;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  color: var(--game-text);
}

/* narrow phones: CTA goes under the genre, still a fixed layout */
@media (max-width: 400px) {
  .pf-caption a {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "name"
      "genre"
      "cta";
  }
}

.pf-caption a:hover .pf-caption__cta svg {
  transform: translateX(3px);
}

.pf-caption__cta svg {
  transition: transform 0.2s ease;
}

html.pf-on .pf-steps {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.pf-step {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-control);
  background: var(--bg-surface);
  color: var(--game-text);
  transition: background 0.25s ease, color 0.25s ease, border-color 0.25s ease, transform 0.25s ease;
}

.pf-step:hover {
  border-color: var(--game-line);
  background: var(--game-tint);
}

.pf-step[aria-current="true"] {
  border-color: transparent;
  background: var(--game);
  color: #fff;
  transform: translateY(-2px);
}

.pf-hint {
  align-items: center;
  gap: 6px;
  margin: 0;
  font-size: 0.875rem;
  color: var(--text-muted);
  transition: opacity 0.4s ease;
}

.pf-hint svg {
  animation: pf-nudge 1.8s ease-in-out infinite;
}

.pf-paused .pf-hint svg {
  animation: none;
}

.pf-hint.is-hidden {
  opacity: 0;
}

@keyframes pf-nudge {
  50% {
    transform: translateY(3px);
  }
}

html.pf-scroll .pf-hint {
  display: inline-flex;
}

/* the game on stage: its slogan under the lead, the main button in its color */
.pf-now {
  display: none;
}

html.pf-on .pf-now {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 1.5em;
  margin: 0;
  font-weight: 600;
  color: var(--game-text);
  transition: color 0.4s ease;
}

.pf-now__dot {
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--game);
  box-shadow: 0 0 0 4px var(--game-tint);
  transition: background 0.4s ease, box-shadow 0.4s ease;
}

[data-pf-tagline] {
  transition: opacity 0.22s ease, transform 0.22s ease;
}

[data-pf-tagline].is-swapping {
  opacity: 0;
  transform: translateY(4px);
}

html.pf-on .pf-hero .btn--primary {
  background: var(--game);
  transition: background 0.4s ease, filter 0.2s ease;
}

html.pf-on .pf-hero .btn--primary:hover {
  background: var(--game);
  filter: brightness(1.08);
}

/* progress through the games */
.pf-progress {
  display: none;
}

.pf-controls {
  display: none;
}

html.pf-on .pf-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  width: min(100%, 360px);
}

/* pause / resume the animation (WCAG 2.2.2) */
.pf-pause {
  display: grid;
  flex: none;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--border-subtle);
  border-radius: 50%;
  background: var(--bg-surface);
  color: var(--text-secondary);
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease;
}

.pf-pause:hover {
  border-color: var(--game-line);
  color: var(--game-text);
}

.pf-pause:focus-visible {
  outline: 2px solid var(--game);
  outline-offset: 2px;
}

.pf-pause__go,
.pf-pause[aria-pressed="true"] .pf-pause__stop {
  display: none;
}

.pf-pause[aria-pressed="true"] .pf-pause__go {
  display: block;
}

html.pf-on .pf-progress {
  display: block;
  flex: 1;
  height: 3px;
  overflow: hidden;
  border-radius: 3px;
  background: var(--border-subtle);
}

.pf-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--game);
  transform: scaleX(0);
  transform-origin: left;
  transition: background 0.4s ease;
}

/* a drag on the figure stirs it; the page still scrolls vertically */
html.pf-on .pf-canvas-wrap {
  touch-action: pan-y;
  cursor: pointer;
}

/* wide screens: the section is as tall as the games, the stage sticks under the header */
html.pf-scroll .pf-hero {
  height: calc(var(--pf-steps, 6) * 70svh + 30svh);
  padding-block: 0;
  /* the stage is centred in the viewport: pull the next section up by the empty space under it */
  margin-bottom: calc(-1 * var(--pf-gap, 0px));
}

/* …and keep that section above the (transparent) end of the sticky stage, so its links stay clickable */
html.pf-scroll .pf-hero + * {
  position: relative;
}

html.pf-scroll .pf-hero__sticky {
  position: sticky;
  top: var(--header-h);
  display: flex;
  align-items: center;
  height: calc(100svh - var(--header-h));
}

html.pf-scroll .pf-hero__sticky > .container {
  width: 100%;
}

html.pf-scroll .pf-canvas-wrap {
  max-width: min(520px, calc(100svh - var(--header-h) - 210px));
}

@media (prefers-reduced-motion: reduce) {
  .pf-hint svg {
    animation: none;
  }
}

/* Game page: demo card in the hero (article-game.tpl, .game-demo) */
.game-demo {
  position: relative;
  /* opened as …/#demo: keep the card clear of the sticky header */
  scroll-margin-top: 96px;
}

/* Game page: particle ribbons that pour into the game icon on scroll (article-game.tpl, assets/js/game-waves.js).
   The canvas is fixed to the screen and sits between the section backgrounds (not positioned) and the
   content (.container, z-index 1); the sticky header (z-index 50) stays above. Decorative. */
.gw-canvas {
  position: fixed;
  z-index: 0;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  /* as tall as the largest viewport: no stretching while mobile toolbars slide away */
  height: 100lvh;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.8s ease;
}

.gw-canvas.is-ready {
  opacity: 1;
}

.game-page .container {
  position: relative;
  z-index: 1;
}

/* frosted feature tiles: the icon of particles shows through them */
.game-page .tiles--game .tile {
  background: linear-gradient(
    180deg,
    color-mix(in oklab, var(--game-tint) 62%, transparent),
    color-mix(in oklab, var(--bg-surface) 45%, transparent) 60%
  );
  -webkit-backdrop-filter: blur(1.5px);
  backdrop-filter: blur(1.5px);
}

@media (prefers-reduced-motion: reduce) {
  .gw-canvas {
    transition: none;
  }
}

.game-grid {
  display: grid;
  gap: 20px;
}

@media (min-width: 768px) {
  .game-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .game-grid .span-full {
    grid-column: span 2;
  }
}

@media (min-width: 1024px) {
  .game-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .game-grid .span-2 {
    grid-column: span 2;
  }

  .game-grid .span-full {
    grid-column: span 3;
  }
}

.game-card {
  display: flex;
  flex-direction: column;
  gap: 24px;
  height: 100%;
  padding: 24px;
}

.game-card__body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 16px;
}

.game-card__head {
  display: flex;
  align-items: center;
  gap: 14px;
}

.game-card__head > div {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.game-card__summary {
  color: var(--text-secondary);
}

.game-card__cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: auto;
  padding-top: 8px;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--game-text);
}

.game-card__cta svg {
  transition: transform 150ms ease;
}

.game-card:hover .game-card__cta svg {
  transform: translateX(2px);
}

@media (min-width: 640px) {
  .game-card--wide {
    flex-direction: row;
    align-items: center;
  }

  .game-card--wide .game-card__preview {
    width: 300px;
    flex-shrink: 0;
  }
}

@media (min-width: 768px) {
  .game-card {
    padding: 32px;
  }
}

.tiles {
  display: grid;
  gap: 20px;
}

@media (min-width: 640px) {
  .tiles {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .tiles--4 {
    grid-template-columns: repeat(4, 1fr);
  }
}

.tile {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 28px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-card);
  background: var(--bg-canvas);
}

.tile--row {
  flex-direction: row;
  gap: 20px;
}

.tile--row > div {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tile h3 {
  font-size: 1.125rem;
}

.tile p {
  font-size: 0.9375rem;
  color: var(--text-secondary);
}

.cta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
  padding: 32px;
  border-radius: 32px;
  background: var(--text-primary);
  color: #fff;
}

.cta__text {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 36rem;
}

.cta h2 {
  color: #fff;
}

.cta p {
  font-size: 1.125rem;
  color: rgba(255, 255, 255, 0.75);
}

.cta a:not(.btn) {
  color: #fff;
  text-decoration: underline;
  text-underline-offset: 4px;
}

@media (min-width: 640px) {
  .cta {
    padding: 48px;
  }
}

@media (min-width: 768px) {
  .cta {
    padding: 56px;
  }
}

/* 9. Card previews (static, decorative)
   ========================================================================== */
.preview {
  padding: 16px;
  border-radius: 16px;
  background: var(--game-tint);
  font-family: var(--font-mono);
  font-weight: 500;
}

.pv-sudoku {
  display: grid;
  grid-template-columns: repeat(3, 48px);
  width: fit-content;
  margin-inline: auto;
  overflow: hidden;
  border: 2px solid var(--text-primary);
  border-radius: var(--radius-control);
  background: var(--bg-surface);
  font-size: 1.25rem;
}

.pv-sudoku span {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 48px;
  border: 1px solid var(--border-subtle);
}

.pv-sudoku .is-accent {
  color: var(--game-text);
}

.pv-sudoku .is-empty {
  background: var(--game-tint);
  box-shadow: inset 0 0 0 2px var(--game);
}

.pv-chess {
  display: grid;
  grid-template-columns: repeat(4, 40px);
  width: fit-content;
  margin-inline: auto;
  overflow: hidden;
  border-radius: 8px;
  font-size: 26px;
  line-height: 1;
}

.pv-chess span {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 40px;
  background: var(--bg-surface);
}

.pv-chess .is-dark {
  background: var(--game-soft);
}

.pv-chess .is-hl {
  box-shadow: inset 0 0 0 3px var(--accent-secondary);
}

.pv-caesar {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pv-caesar__row {
  display: flex;
  gap: 8px;
  font-size: 1.25rem;
}

.pv-caesar__row--code {
  color: var(--game-text);
}

.pv-caesar__shift {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-sans);
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.pv-caesar__shift span {
  padding: 2px 8px;
  border: 1px solid var(--border-subtle);
  border-radius: 9999px;
  background: var(--bg-surface);
}

.pv-crypto {
  display: flex;
  gap: 6px;
}

.pv-crypto__letter {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.pv-crypto__letter b {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 36px;
  border-bottom: 2px solid var(--text-primary);
  font-size: 1.25rem;
  font-weight: 500;
}

.pv-crypto__letter b:empty {
  border-color: var(--game);
  border-radius: 6px 6px 0 0;
  background: var(--bg-surface);
}

.pv-crypto__letter small {
  font-size: 0.75rem;
  color: var(--game-text);
}

.pv-math {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.pv-math__prompt {
  font-size: 1.25rem;
}

.pv-math__prompt span {
  color: var(--game-text);
}

.pv-math__options {
  display: flex;
  gap: 8px;
}

.pv-math__options span {
  display: flex;
  flex: 1;
  align-items: center;
  justify-content: center;
  height: 44px;
  border: 1px solid var(--game-line);
  border-radius: var(--radius-control);
  background: var(--bg-surface);
}

.pv-math__options .is-answer {
  border: 2px solid var(--game);
  color: var(--game-text);
}

.pv-sort {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 16px;
  padding-block: 4px;
}

.pv-sort__tube {
  display: flex;
  flex-direction: column-reverse;
  gap: 3px;
  width: 40px;
  height: 144px;
  padding: 4px;
  overflow: hidden;
  border: 2px solid var(--game-line);
  border-top: 0;
  border-radius: 0 0 20px 20px;
  background: var(--bg-surface);
}

.pv-sort__tube.is-lifted {
  border-color: var(--game);
  transform: translateY(-8px);
}

.pv-sort__tube span {
  height: 28px;
  flex-shrink: 0;
  border-radius: 6px;
}

.pv-sort__tube span:first-child {
  border-radius: 6px 6px 16px 16px;
}

/* 9a. Breadcrumbs
   Хлебные крошки: themes/template-{en,ru}/modules/breadcrumb.tpl.
   Подключены на странице игры (article-game.tpl) и юридических страницах (page-legal.tpl).
   Mobile-first: пункты переносятся, длинное название текущей страницы обрезается многоточием.
   ========================================================================== */
.breadcrumbs {
  margin-bottom: 24px;
  font-size: 0.875rem;
  font-weight: 500;
}

.breadcrumbs__list {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.breadcrumbs__item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.breadcrumbs__sep {
  flex-shrink: 0;
  color: var(--text-muted);
}

.breadcrumbs__link {
  border-radius: 6px;
  color: var(--text-secondary);
}

.breadcrumbs__link:hover {
  color: var(--text-primary);
}

.breadcrumbs__current {
  overflow: hidden;
  max-width: 60vw;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: var(--text-primary);
}

/* 10. Game page
   ========================================================================== */
/* хлебные крошки на странице игры — с отступом до hero, как раньше у ссылки «← Все игры» */
.game-hero .breadcrumbs {
  margin-bottom: 40px;
}

.game-hero {
  padding-block: 32px 80px;
}

.game-hero__grid {
  display: grid;
  align-items: start;
  gap: 48px;
}

.genre-pill {
  padding: 4px 12px;
  border-radius: 9999px;
  background: var(--game-tint);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--game-text);
}

/* Genre + status badges of a game (modules/game-badges.tpl) */
.game-badges {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.status-pill {
  padding: 2px 10px;
  border: 1px solid var(--game-line);
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--game-text);
}

.status-pill--new {
  border-color: transparent;
  background: var(--game-soft);
}

.tagline {
  font-family: var(--font-display);
  font-size: 1.375rem;
  font-weight: 600;
  line-height: 1.3;
}

.game-hero .lead {
  font-size: 1.0625rem;
}

@media (min-width: 768px) {
  .game-hero {
    padding-block: 40px 112px;
  }

  .game-hero .breadcrumbs {
    margin-bottom: 56px;
  }
}

@media (min-width: 1024px) {
  .game-hero__grid {
    grid-template-columns: 1fr 1fr;
    gap: 56px;
  }

  .game-hero__content {
    padding-top: 24px;
  }
}

.steps {
  display: grid;
  gap: 20px;
}

.step {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 28px;
}

.step__num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 9999px;
  background: var(--game);
  font-family: var(--font-mono);
  font-weight: 500;
  color: #fff;
}

.step p {
  color: var(--text-secondary);
}

@media (min-width: 768px) {
  .steps {
    grid-template-columns: repeat(3, 1fr);
  }
}

.shots {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.shot {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  aspect-ratio: 9 / 19.5;
  padding: 16px;
  border: 1px solid var(--border-subtle);
  border-radius: 28px;
  background: var(--bg-subtle);
  text-align: center;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.shot:nth-child(even) {
  background: var(--game-tint);
}

.shot svg {
  color: var(--game-text);
}

@media (min-width: 768px) {
  .shots {
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
  }
}

/* Баннер игры (основная картинка статьи) */
.game-banner {
  margin: 0 0 24px;
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  border-radius: 24px;
  background: var(--bg-subtle);
}

.game-banner img {
  display: block;
  width: 100%;
  height: auto;
}

/* Скриншоты из галереи статьи: лента с прокруткой, картинки любых пропорций одной высоты */
.shots--gallery {
  display: flex;
  gap: 16px;
  /* room for the screenshot shadow (0 24px 40px -28px, ~36px below) — see .phones */
  margin: 0 -16px -24px;
  padding: 4px 16px 40px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-padding-inline: 16px;
  overscroll-behavior-x: contain;
}

.shots--gallery:focus-visible {
  outline: 2px solid var(--game-text, currentColor);
  outline-offset: 2px;
  border-radius: 12px;
}

.shot-img {
  flex: none;
  scroll-snap-align: start;
}

.shot-img img {
  display: block;
  width: auto;
  height: clamp(360px, 110vw, 520px);
  border: 1px solid var(--border-subtle);
  border-radius: 28px;
  background: var(--bg-subtle);
}

@media (min-width: 768px) {
  .shots--gallery {
    gap: 20px;
    margin: 0;
    padding-inline: 0;
    scroll-padding-inline: 0;
  }

  .shot-img img {
    height: 560px;
  }
}

.faq-layout {
  display: grid;
  gap: 40px;
}

.faq-layout__intro {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

@media (min-width: 1024px) {
  .faq-layout {
    grid-template-columns: 1fr 1.6fr;
    gap: 56px;
  }
}

.faq {
  border-top: 1px solid var(--border-subtle);
}

.faq details {
  border-bottom: 1px solid var(--border-subtle);
}

.faq summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-block: 20px;
  border-radius: 8px;
  list-style: none;
  cursor: pointer;
  font-family: var(--font-display);
  font-size: 1.125rem;
  font-weight: 600;
}

.faq summary::-webkit-details-marker {
  display: none;
}

.faq summary svg {
  color: var(--text-secondary);
  transition: transform 200ms ease;
}

.faq details[open] summary svg {
  transform: rotate(180deg);
}

.faq details p {
  padding-bottom: 20px;
  color: var(--text-secondary);
}

.more-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.mini-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  height: 100%;
  padding: 20px;
}

.mini-card__name {
  display: block;
  font-family: var(--font-display);
  font-weight: 700;
}

.mini-card__genre {
  display: block;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

@media (min-width: 640px) {
  .more-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 1024px) {
  .more-grid {
    grid-template-columns: repeat(5, 1fr);
  }
}

/* Game page polish: hero glow, demo stage, feature tiles, steps flow, gallery, closing CTA
   ========================================================================== */
.game-page {
  overflow-x: clip;
}

/* soft wash in the colour of the game behind the hero, bleeding under the sticky header */
.game-hero {
  position: relative;
  isolation: isolate;
}

.game-hero::before {
  content: "";
  position: absolute;
  z-index: -1;
  top: calc(-1 * var(--header-h, 65px));
  bottom: 0;
  left: 50%;
  width: 100vw;
  transform: translateX(-50%);
  pointer-events: none;
  background:
    radial-gradient(42% 60% at 76% 42%, color-mix(in oklab, var(--game) 14%, transparent), transparent 72%),
    radial-gradient(36% 46% at 12% 8%, color-mix(in oklab, var(--game) 7%, transparent), transparent 70%);
}

.game-hero h1 {
  font-size: clamp(2.5rem, 5vw, 4rem);
  line-height: 1.05;
}

.game-hero .tagline {
  color: var(--game-text);
}

.game-devices {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.875rem;
  color: var(--text-muted);
}

/* demo card on stage: larger, tinted frame, deeper shadow */
.game-hero .mg {
  gap: 28px;
  padding: 28px;
  border-color: var(--game-line);
  background:
    linear-gradient(180deg, var(--game-tint), var(--bg-surface) 140px),
    var(--bg-surface);
  box-shadow:
    0 1px 2px rgba(15, 23, 42, 0.04),
    0 32px 64px -32px color-mix(in oklab, var(--game) 45%, transparent);
}

.game-hero .mg__title {
  font-size: 1.125rem;
}

@media (min-width: 640px) {
  .game-hero .mg {
    padding: 36px;
  }

  .game-hero .mg__title {
    font-size: 1.375rem;
  }

  .game-hero .cr {
    gap: 22px 32px;
  }

  .game-hero .cr-input {
    width: 52px;
    height: 60px;
    font-size: 1.625rem;
  }

  .game-hero .cr-code {
    font-size: 0.875rem;
  }
}

@media (min-width: 1024px) {
  .game-hero__grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
    align-items: center;
    gap: 72px;
  }

  .game-hero__content {
    padding-top: 0;
  }
}

/* feature tiles: tinted top, larger icon, lift on hover */
.tiles--game .tile {
  gap: 14px;
  background: linear-gradient(180deg, var(--game-tint), var(--bg-surface) 60%);
  transition:
    transform 200ms ease,
    box-shadow 200ms ease,
    border-color 200ms ease;
}

.tiles--game .tile:hover {
  border-color: var(--game-line);
  box-shadow: var(--shadow-card-hover);
  transform: translateY(-2px);
}

.tiles--game .icon-box {
  width: 52px;
  height: 52px;
  margin-bottom: 8px;
  border-radius: 16px;
  background: var(--game-soft);
}

/* steps joined by a dashed line through the numbers */
.steps--flow {
  position: relative;
}

.steps--flow .step {
  position: relative;
  gap: 20px;
}

.steps--flow .step__num {
  width: 48px;
  height: 48px;
  font-size: 1.125rem;
  box-shadow: 0 0 0 6px var(--game-tint);
}

.steps--flow .step p {
  font-size: 1.0625rem;
  color: var(--text-primary);
}

@media (min-width: 768px) {
  .steps--flow::before {
    content: "";
    position: absolute;
    z-index: 1;
    /* from the centre of the first number to the centre of the last (padding 28 + radius 24) */
    top: 51px;
    left: 52px;
    right: calc((100% - 40px) / 3 - 52px);
    border-top: 2px dashed var(--game-line);
    pointer-events: none;
  }

  .steps--flow .step__num {
    position: relative;
    z-index: 2;
  }
}

/* screenshot gallery: arrows in the heading, edges fade where there is more to scroll */
.gallery-nav {
  display: none;
  gap: 8px;
}

[data-carousel]:not(.is-static) .gallery-nav {
  display: flex;
}

.shots--gallery {
  --fade: 64px;
  scrollbar-width: none;
}

.shots--gallery::-webkit-scrollbar {
  display: none;
}

.shots--gallery[data-more="right"] {
  mask-image: linear-gradient(to right, #000 calc(100% - var(--fade)), transparent);
}

.shots--gallery[data-more="left"] {
  mask-image: linear-gradient(to left, #000 calc(100% - var(--fade)), transparent);
}

.shots--gallery[data-more="both"] {
  mask-image: linear-gradient(to right, transparent, #000 var(--fade), #000 calc(100% - var(--fade)), transparent);
}

.shot-img img {
  box-shadow: 0 24px 40px -28px color-mix(in oklab, var(--game) 50%, transparent);
}

.game-banner {
  border-color: var(--game-line);
}

/* closing CTA */
.game-cta {
  position: relative;
  display: grid;
  gap: 24px;
  justify-items: start;
  padding: 32px;
  overflow: hidden;
  border: 1px solid var(--game-line);
  border-radius: 32px;
  background:
    radial-gradient(60% 120% at 100% 0%, var(--game-soft), transparent 70%),
    var(--game-tint);
}

.game-cta .app-icon {
  box-shadow: 0 16px 32px -12px color-mix(in oklab, var(--game) 55%, transparent);
}

.game-cta__text {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 34rem;
}

.game-cta__text p {
  color: var(--text-secondary);
}

.game-cta .btn--secondary {
  background: var(--bg-surface);
}

@media (min-width: 1024px) {
  .game-cta {
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 32px;
    padding: 48px;
  }

  .game-cta__actions {
    justify-content: flex-end;
  }
}

/* other games: fill the row, horizontal cards with an arrow */
.game-page .more-grid {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.game-page .mini-card {
  flex-direction: row;
  align-items: center;
  gap: 16px;
}

.game-page .mini-card > span:nth-child(2) {
  flex: 1;
  min-width: 0;
}

.mini-card__go {
  display: inline-flex;
  color: var(--text-muted);
  transition:
    transform 200ms ease,
    color 200ms ease;
}

.mini-card:hover .mini-card__go {
  color: var(--game-text);
  transform: translateX(3px);
}

@media (prefers-reduced-motion: reduce) {
  .tiles--game .tile,
  .mini-card__go {
    transition: none;
  }

  .tiles--game .tile:hover,
  .mini-card:hover .mini-card__go {
    transform: none;
  }
}

/* 11. Mini-games (rendered by assets/js/main.js)
   ========================================================================== */
.mg {
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 24px;
  border-radius: 32px;
}

.mg__body {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.mg__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.mg__title {
  font-size: 1.25rem;
  letter-spacing: 0;
}

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

.mg__badge {
  padding: 4px 10px;
  border-radius: 9999px;
  background: color-mix(in oklab, var(--accent-secondary) 15%, var(--bg-surface));
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: var(--radius-control);
  background: transparent;
  color: var(--text-secondary);
}

.icon-btn:hover {
  background: var(--bg-subtle);
  color: var(--text-primary);
}

.mg__hint {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.mg__hint svg {
  margin-top: 2px;
  color: var(--accent-secondary);
}

.mg__success {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px;
  border-radius: 16px;
  background: var(--game-tint);
  font-size: 0.9375rem;
}

.mg__success svg {
  margin-top: 1px;
  color: var(--game-text);
}

.mg__noscript {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.mg__panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 16px;
  border-radius: 16px;
  background: var(--game-tint);
}

.mg__label {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.mg__group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.key-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  flex-shrink: 0;
  border: 1px solid var(--game-line);
  border-radius: var(--radius-control);
  background: var(--bg-surface);
  font-family: var(--font-mono);
  font-size: 1.125rem;
  font-weight: 500;
  color: var(--game-text);
  transition: background-color 150ms ease;
}

.key-btn:hover {
  background: var(--bg-subtle);
}

.key-btn--sm {
  width: 44px;
  height: 44px;
}

.key-btn--neutral {
  border-color: var(--border-subtle);
  color: var(--text-secondary);
}

@media (min-width: 768px) {
  .mg {
    padding: 32px;
  }

  .mg__panel {
    padding: 20px;
  }
}

/* Caesar Cipher */
.cz-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-family: var(--font-mono);
  font-weight: 500;
}

.cz-space {
  width: 12px;
}

.cz-tile {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--bg-subtle);
  font-size: 1.125rem;
  color: var(--text-secondary);
}

.cz-tile--plain {
  height: 48px;
  border-radius: 10px;
  background: var(--game-tint);
  font-size: 1.375rem;
  color: var(--game-text);
  transition: background-color 200ms ease;
}

.is-solved .cz-tile--plain {
  background: var(--game-soft);
  color: var(--text-primary);
}

.cz-controls {
  display: flex;
  align-items: center;
  gap: 12px;
}

.cz-slider {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 6px;
}

.cz-slider label {
  display: flex;
  justify-content: space-between;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.cz-slider output {
  font-family: var(--font-mono);
  font-weight: 500;
  color: var(--game-text);
}

.cz-slider input {
  width: 100%;
  accent-color: var(--game);
}

.cz-wheel {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 500;
}

.cz-wheel span {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  width: 18px;
  color: var(--text-muted);
}

.cz-wheel b {
  font-weight: 500;
  color: var(--game-text);
}

/* Sudoku */
.sd {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.sd-grid {
  display: grid;
  grid-template-columns: repeat(4, 64px);
  overflow: hidden;
  border: 2px solid var(--text-primary);
  border-radius: var(--radius-control);
  background: var(--bg-surface);
  font-family: var(--font-mono);
  font-size: 1.5rem;
  font-weight: 500;
}

.sd-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 64px;
  padding: 0;
  border: 1px solid var(--border-subtle);
  background: transparent;
  font: inherit;
  color: var(--game-text);
  transition: background-color 150ms ease;
}

.sd-cell.is-given {
  color: var(--text-primary);
}

.sd-cell.is-col-edge {
  border-right: 2px solid var(--text-primary);
}

.sd-cell.is-row-edge {
  border-bottom: 2px solid var(--text-primary);
}

.sd-cell.is-selected {
  background: var(--game-tint);
  box-shadow: inset 0 0 0 2px var(--game);
}

.sd-cell.is-conflict {
  background: color-mix(in oklab, var(--accent-secondary) 15%, var(--bg-surface));
  color: var(--warn-text);
}

.sd-pad {
  display: flex;
  gap: 8px;
}

@media (min-width: 640px) {
  .sd-grid {
    grid-template-columns: repeat(4, 72px);
  }

  .sd-cell {
    height: 72px;
  }
}

/* Chess */
.ch {
  display: flex;
  justify-content: center;
}

.ch-board {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  width: 100%;
  max-width: 360px;
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-control);
}

.ch-sq {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1;
  padding: 0;
  border: 0;
  background: var(--bg-surface);
  font-size: clamp(1.5rem, 6vw, 2.1rem);
  line-height: 1;
  color: var(--text-primary);
}

.ch-sq.is-dark {
  background: var(--game-soft);
}

.ch-sq.is-selected {
  box-shadow: inset 0 0 0 3px var(--accent-secondary);
}

.ch-dot {
  width: 12px;
  height: 12px;
  border-radius: 9999px;
  background: var(--game);
  opacity: 0.6;
}

.ch-coord {
  position: absolute;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-secondary);
}

.ch-coord--rank {
  top: 2px;
  left: 4px;
}

.ch-coord--file {
  right: 4px;
  bottom: 2px;
}

/* Cryptogram */
.cr {
  display: flex;
  flex-wrap: wrap;
  gap: 16px 24px;
}

.cr-word {
  display: flex;
  gap: 6px;
}

.cr-letter {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.cr-input {
  width: 40px;
  height: 48px;
  padding: 0;
  border: 0;
  border-bottom: 2px solid var(--game);
  border-radius: 8px 8px 0 0;
  background: var(--bg-surface);
  text-align: center;
  text-transform: uppercase;
  font-family: var(--font-mono);
  font-size: 1.375rem;
  font-weight: 500;
  color: var(--game-text);
}

.cr-input[readonly] {
  border-bottom-color: var(--text-primary);
  background: transparent;
  color: var(--text-primary);
}

.cr-input.is-wrong {
  border-bottom-color: var(--accent-secondary);
  color: var(--text-primary);
}

.cr-code {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--game-text);
}

@media (min-width: 640px) {
  .cr-input {
    width: 44px;
  }
}

/* Math */
.mt-top {
  display: flex;
  justify-content: space-between;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.mt-top span:last-child {
  font-family: var(--font-mono);
  font-weight: 500;
}

.mt-prompt {
  font-family: var(--font-mono);
  font-size: 1.75rem;
  font-weight: 500;
}

.mt-options {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.mt-opt {
  height: 56px;
  border: 1px solid var(--game-line);
  border-radius: var(--radius-control);
  background: var(--bg-surface);
  font-family: var(--font-mono);
  font-size: 1.125rem;
  font-weight: 500;
  color: var(--text-primary);
}

.mt-opt:hover:not(:disabled) {
  background: var(--bg-subtle);
}

.mt-opt:disabled {
  opacity: 0.5;
  cursor: default;
}

.mt-opt.is-answer {
  border: 2px solid var(--game);
  color: var(--game-text);
  opacity: 1;
}

.mt-opt.is-wrong {
  border: 2px solid var(--accent-secondary);
  text-decoration: line-through;
  opacity: 1;
}

.mt-next {
  align-self: flex-end;
}

/* Sort Puzzle */
.st-panel {
  align-items: center;
  gap: 20px;
  padding: 24px 16px;
}

.st-tubes {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 8px;
}

.st-tube {
  display: flex;
  flex-direction: column-reverse;
  gap: 3px;
  width: 40px;
  height: 192px;
  padding: 4px;
  overflow: hidden;
  border: 2px solid var(--game-line);
  border-top: 0;
  border-radius: 0 0 24px 24px;
  background: var(--bg-surface);
  transition: transform 150ms ease;
}

.st-tube.is-selected {
  border-color: var(--game);
  transform: translateY(-12px);
}

.st-layer {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 42px;
  flex-shrink: 0;
  border-radius: 6px;
  font-size: 0.75rem;
  color: #fff;
}

.st-layer:first-child {
  border-radius: 6px 6px 20px 20px;
}

.st-footer {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.st-footer span {
  font-family: var(--font-mono);
}

@media (min-width: 640px) {
  .st-tubes {
    gap: 20px;
  }

  .st-tube {
    width: 56px;
  }
}

/* 12. Catalog / simple page intro
   ========================================================================== */
.page-intro {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 42rem;
  margin-bottom: 48px;
}

.page-intro > p:not(.eyebrow) {
  font-size: 1.125rem;
  color: var(--text-secondary);
}

/* 13. About
   ========================================================================== */
.about-grid {
  display: grid;
  align-items: center;
  gap: 56px;
}

.about-icons {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  padding: 32px;
  border-radius: 32px;
}

.about-icons a {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 4px;
  border-radius: 16px;
  text-align: center;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.about-icons a:hover {
  color: var(--text-primary);
}

.about-icons .app-icon {
  width: 64px;
  height: 64px;
}

@media (min-width: 640px) {
  .about-icons .app-icon {
    width: 80px;
    height: 80px;
  }
}

@media (min-width: 1024px) {
  .about-grid {
    grid-template-columns: 1.2fr 1fr;
  }
}

/* 14. Support
   ========================================================================== */
.support-grid {
  display: grid;
  align-items: start;
  gap: 40px;
}

.support-aside {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.aside-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 24px;
}

.aside-card h2 {
  font-size: 1.125rem;
  letter-spacing: 0;
}

.aside-card .menu-item {
  padding: 8px;
}

@media (min-width: 1024px) {
  .support-grid {
    grid-template-columns: 1.5fr 1fr;
  }
}

.form {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 24px;
}

.form__grid {
  display: grid;
  gap: 20px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field label {
  font-size: 0.875rem;
  font-weight: 500;
}

.field label span {
  font-weight: 400;
  color: var(--text-muted);
}

.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-control);
  background: var(--bg-surface);
  font-size: 0.9375rem;
  color: var(--text-primary);
}

.field textarea {
  resize: vertical;
}

.field ::placeholder {
  color: var(--text-muted);
}

.field input:focus-visible,
.field select:focus-visible,
.field textarea:focus-visible {
  border-color: var(--accent-primary);
}

/* Свой выпадающий список (select[data-select] → main.js): кнопка как поле ввода, список — карточка */
.select {
  position: relative;
}

.field .select__button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-control);
  background: var(--bg-surface);
  font-size: 0.9375rem;
  color: var(--text-primary);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s ease;
}

.select__value {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.select__value--empty {
  color: var(--text-secondary);
}

.select__button svg {
  flex: none;
  color: var(--text-muted);
  transition: transform 0.2s ease;
}

.field .select__button:hover {
  border-color: color-mix(in oklab, var(--accent-primary) 35%, var(--border-subtle));
}

.field .select__button:focus-visible,
.select.is-open .select__button {
  border-color: var(--accent-primary);
}

.select.is-open .select__button svg {
  transform: rotate(180deg);
}

.select__list {
  position: absolute;
  z-index: 20;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  max-height: 280px;
  margin: 0;
  padding: 6px;
  overflow-y: auto;
  list-style: none;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-control);
  background: var(--bg-surface);
  box-shadow: var(--shadow-card-hover);
  outline: none;
}

.select--up .select__list {
  top: auto;
  bottom: calc(100% + 6px);
}

.select__option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 0.9375rem;
  cursor: pointer;
}

.select__option svg {
  flex: none;
  color: var(--accent-primary);
  visibility: hidden;
}

.select__option[aria-selected="true"] {
  font-weight: 600;
  color: var(--accent-primary);
}

.select__option[aria-selected="true"] svg {
  visibility: visible;
}

.select__option.is-active {
  background: var(--bg-subtle);
}

.select__list:focus-visible .select__option.is-active {
  outline: 2px solid var(--accent-primary);
  outline-offset: -2px;
}

@media (prefers-reduced-motion: reduce) {
  .field .select__button,
  .select__button svg {
    transition: none;
  }
}

.form__footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.form__note {
  max-width: 28rem;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.form__status:empty {
  display: none;
}

.form__status {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.form__status--error {
  color: var(--danger);
}

.form__status--success {
  color: var(--success);
}

.field--error input,
.field--error select,
.field--error textarea,
.field--error input:focus-visible,
.field--error textarea:focus-visible {
  border-color: var(--danger);
}

.field__error {
  font-size: 0.8125rem;
  color: var(--danger);
}

/* Отправка: кнопка неактивна, вместо иконки — спиннер */
.form button[type="submit"]:disabled {
  cursor: progress;
  opacity: 0.7;
}

.form.is-sending button[type="submit"] svg {
  visibility: hidden;
}

.form.is-sending button[type="submit"] {
  position: relative;
}

.form.is-sending button[type="submit"]::before {
  content: "";
  position: absolute;
  left: 24px; /* на месте иконки: отступ .btn--lg */
  width: 18px;
  height: 18px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: form-spin 0.8s linear infinite;
}

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

@media (prefers-reduced-motion: reduce) {
  .form.is-sending button[type="submit"]::before {
    animation: none;
  }
}

@media (min-width: 640px) {
  .form__grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (min-width: 768px) {
  .form {
    padding: 32px;
  }
}

/* 15. Legal pages
   ========================================================================== */
.legal {
  padding-block: 40px 80px;
}

.legal-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 40px;
}

.legal-nav a {
  padding: 6px 14px;
  border: 1px solid var(--border-subtle);
  border-radius: 9999px;
  background: var(--bg-surface);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.legal-nav a:hover {
  color: var(--text-primary);
}

.legal-nav a[aria-current="page"] {
  border-color: var(--text-primary);
  background: var(--text-primary);
  color: #fff;
}

.legal-header {
  max-width: 48rem;
}

.legal-header .updated {
  margin-top: 16px;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.legal-header .lead {
  margin-top: 24px;
  max-width: none;
}

.legal-layout {
  display: grid;
  gap: 48px;
  margin-top: 48px;
}

.toc__title {
  margin-bottom: 12px;
  font-size: 0.875rem;
  font-weight: 600;
}

.toc ol {
  display: grid;
  gap: 8px;
  border-left: 1px solid var(--border-subtle);
  font-size: 0.875rem;
}

.toc a {
  display: block;
  margin-left: -1px;
  padding: 2px 0 2px 16px;
  border-left: 1px solid transparent;
  color: var(--text-secondary);
}

.toc a:hover {
  border-left-color: var(--text-primary);
  color: var(--text-primary);
}

@media (min-width: 768px) {
  .legal {
    padding-block: 56px 112px;
  }
}

@media (min-width: 1024px) {
  .legal-layout {
    grid-template-columns: 240px minmax(0, 1fr);
    gap: 64px;
  }

  .toc {
    position: sticky;
    top: 96px;
    align-self: start;
  }
}

.prose-legal {
  max-width: 48rem;
  color: var(--text-secondary);
}

.prose-legal h2 {
  margin: 48px 0 16px;
  font-size: 1.5rem;
  scroll-margin-top: 96px;
}

.prose-legal section:first-child h2 {
  margin-top: 0;
}

.prose-legal h3 {
  margin: 28px 0 8px;
  font-size: 1.125rem;
}

.prose-legal p,
.prose-legal ul {
  margin-bottom: 16px;
}

.prose-legal ul {
  padding-left: 20px;
  list-style: disc;
}

.prose-legal li + li {
  margin-top: 6px;
}

.prose-legal a {
  color: var(--accent-primary);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.prose-legal strong {
  font-weight: 600;
  color: var(--text-primary);
}

/* 16. 404 (themes/template-*/error-404.tpl)
   ========================================================================== */
.not-found-wrap {
  position: relative;
  overflow: hidden;
  isolation: isolate;
}

/* частицы — themes/assets/js/main.js, initLostParticles */
.not-found__canvas {
  position: absolute;
  inset: 0;
  z-index: -1;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: 0;
  transition: opacity 800ms ease;
}

.not-found__canvas.is-on {
  opacity: 1;
}

.not-found {
  display: flex;
  flex-direction: column;
  gap: 64px;
}

.not-found__hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 40px;
  text-align: center;
}

.not-found__body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.not-found__body .lead {
  margin-inline: auto;
}

.not-found__body .actions {
  justify-content: center;
}

.not-found__help {
  font-size: 0.9375rem;
  color: var(--text-muted);
}

.not-found__help a {
  color: var(--accent-primary);
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.not-found__help a:hover {
  color: var(--accent-primary-hover);
}

/* декоративная доска «4 0 4» — главный элемент страницы, клетки в духе судоку/шифра */
.not-found__board {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(8px, 2vw, 16px);
  width: min(100%, 34rem);
  padding: clamp(10px, 2.5vw, 18px);
  border: 1px solid var(--border-subtle);
  border-radius: calc(var(--radius-card) + 4px);
  background: var(--bg-surface);
  box-shadow: var(--shadow-card-hover);
  cursor: pointer;
  user-select: none;
  animation: not-found-rise 700ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.not-found__board.is-shaken {
  animation: not-found-shake 450ms ease;
}

.not-found__tile {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1;
  border-radius: clamp(12px, 3vw, 20px);
  background: var(--bg-subtle);
  font-family: var(--font-mono);
  font-size: clamp(4rem, 22vw, 8.5rem);
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.04em;
  color: var(--text-primary);
  animation: not-found-drop 650ms cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.not-found__tile:nth-child(1) { animation-delay: 150ms; }
.not-found__tile:nth-child(3) { animation-delay: 450ms; }

.not-found__tile--accent {
  background: var(--accent-primary);
  color: var(--bg-surface);
  box-shadow: 0 16px 32px -12px color-mix(in oklab, var(--accent-primary) 60%, transparent);
  animation:
    not-found-drop 650ms cubic-bezier(0.34, 1.56, 0.64, 1) 300ms both,
    not-found-wobble 2.8s ease-in-out 1.4s infinite;
}

.not-found__body > * {
  animation: not-found-fade 600ms ease both;
  animation-delay: 550ms;
}

@keyframes not-found-rise {
  from { opacity: 0; transform: translateY(24px) scale(0.96); }
  to { opacity: 1; transform: none; }
}

@keyframes not-found-drop {
  from { opacity: 0; transform: translateY(-60px) rotate(-12deg); }
  to { opacity: 1; transform: none; }
}

@keyframes not-found-fade {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}

@keyframes not-found-shake {
  0%, 100% { transform: none; }
  20% { transform: translateX(-8px) rotate(-1deg); }
  40% { transform: translateX(7px) rotate(1deg); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(3px); }
}

@keyframes not-found-wobble {
  0%, 70%, 100% { transform: rotate(0); }
  76% { transform: rotate(-6deg); }
  82% { transform: rotate(5deg); }
  88% { transform: rotate(-3deg); }
}

/* сетка игр «Или сразу перейдите к головоломке» */
.not-found__games {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding-top: 40px;
  border-top: 1px solid var(--border-subtle);
}

.not-found__games-title {
  font-size: 1.25rem;
  line-height: 1.3;
}

.not-found__grid {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.not-found__game {
  display: flex;
  align-items: center;
  gap: 14px;
  height: 100%;
  padding: 14px 16px;
  border-radius: 20px;
  color: var(--text-primary);
}

.not-found__game:focus-visible {
  outline: 2px solid var(--accent-primary);
  outline-offset: 2px;
}

.not-found__game-text {
  flex: 1;
  min-width: 0;
}

.not-found__game-name {
  display: block;
  font-weight: 600;
}

.not-found__game-genre {
  display: block;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.not-found__game-arrow {
  flex-shrink: 0;
  color: var(--text-muted);
  transition: transform 150ms ease, color 150ms ease;
}

.not-found__game:hover .not-found__game-arrow {
  transform: translateX(3px);
  color: var(--game-text);
}

@media (min-width: 640px) {
  .not-found__grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .not-found__grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (prefers-reduced-motion: reduce) {
  .not-found__board,
  .not-found__board.is-shaken,
  .not-found__tile,
  .not-found__tile--accent,
  .not-found__body > * {
    animation: none;
  }

  .not-found__game-arrow {
    transition: none;
  }
}

/* 16a. Maintenance (maintenance.tpl, 503)
   ========================================================================== */
.maintenance {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 32px;
  min-height: 100vh;
  padding-block: 48px;
  text-align: center;
}

.maintenance__card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  width: 100%;
  max-width: 40rem;
  padding: 40px 24px;
  box-shadow: var(--shadow-card-hover);
}

.maintenance__card h1 {
  font-size: clamp(1.75rem, 5vw, 2.5rem);
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.maintenance__text {
  margin-inline: auto;
}

.maintenance__label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--game-tint);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--game-text);
}

.maintenance__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-secondary);
  animation: maintenance-pulse 1.6s ease-in-out infinite;
}

/* six tiles in the game colors, lifting one after another like pieces being sorted */
.maintenance__board {
  display: grid;
  grid-template-columns: repeat(3, 40px);
  gap: 8px;
  padding: 12px;
  border-radius: 20px;
  background: var(--bg-subtle);
}

.maintenance__board span {
  height: 40px;
  border-radius: var(--radius-control);
  background: var(--game);
  box-shadow: inset 0 -3px 0 color-mix(in oklab, var(--game) 70%, black);
  animation: maintenance-tile 3.6s ease-in-out infinite;
}

.maintenance__board span:nth-child(2) { animation-delay: 0.3s; }
.maintenance__board span:nth-child(3) { animation-delay: 0.6s; }
.maintenance__board span:nth-child(6) { animation-delay: 0.9s; }
.maintenance__board span:nth-child(5) { animation-delay: 1.2s; }
.maintenance__board span:nth-child(4) { animation-delay: 1.5s; }

@keyframes maintenance-tile {
  0%, 30%, 100% { transform: none; }
  12% { transform: translateY(-6px) rotate(-4deg); }
}

@keyframes maintenance-pulse {
  50% { opacity: 0.35; }
}

@media (min-width: 768px) {
  .maintenance__card {
    padding: 56px 48px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .maintenance__board span,
  .maintenance__dot {
    animation: none;
  }
}

/* 17. Motion preferences
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
  }

  .card--hover:hover {
    transform: none;
  }
}

/* CMS: preview of a game without a dedicated mini demo */
.pv-icon {
  display: grid;
  place-items: center;
  color: var(--game, var(--accent-primary));
}

.toc[hidden] {
  display: none;
}

/* Scroll reveal (main.js initReveal): only when the script has marked the page */
html.js-reveal .reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.7s ease var(--reveal-delay, 0ms), transform 0.7s cubic-bezier(0.2, 0.7, 0.2, 1) var(--reveal-delay, 0ms);
}

html.js-reveal .reveal.is-visible {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  html.js-reveal .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

/* ==========================================================================
   Game showcase (items/game-showcase.tpl): text + iPhone carousel, rows alternate
   ========================================================================== */
.showcases {
  display: grid;
  gap: 72px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.showcase {
  display: grid;
  gap: 32px;
  align-items: center;
}

.showcase__text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 16px;
  max-width: 480px;
}

.showcase__text .app-icon--lg {
  box-shadow: 0 12px 24px -10px color-mix(in oklab, var(--game) 55%, transparent);
}

.showcase__title {
  margin: 0;
  font-size: clamp(1.75rem, 1.25rem + 1.6vw, 2.5rem);
  line-height: 1.15;
}

.showcase__title a {
  display: inline-flex;
  align-items: center;
  gap: 16px;
  border-radius: 12px;
}

.showcase__go {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 9999px;
  background: var(--game-tint);
  color: var(--game-text);
  transition: background-color 150ms ease, color 150ms ease, transform 150ms ease;
}

.showcase__title a:hover .showcase__go {
  background: var(--game);
  color: #fff;
  transform: translate(2px, -2px);
}

.showcase__summary {
  margin: 0;
  color: var(--text-secondary);
  font-size: 1.0625rem;
  line-height: 1.6;
}

.showcase__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 24px;
  margin-top: 8px;
}

/* App Store button in badge style */
.store-badge {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 6px 18px 6px 14px;
  border: 1px solid var(--text-primary);
  border-radius: var(--radius-control);
  background: var(--text-primary);
  color: var(--bg-surface);
  font-size: 1.1875rem;
  font-weight: 600;
  line-height: 1.05;
  transition: background-color 150ms ease;
}

.store-badge small {
  display: block;
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.01em;
}

a.store-badge:hover {
  background: color-mix(in oklab, var(--text-primary) 85%, var(--game));
}

.store-badge.is-soon {
  border-color: var(--border-subtle);
  background: var(--bg-subtle);
  color: var(--text-secondary);
  cursor: default;
}

.showcase__media {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

/* iPhone carousel */
.phones {
  --fade: 56px;
  display: flex;
  gap: 20px;
  /* the phone shadow reaches ~44px below the frame (0 28px 40px -24px): overflow-x clips at the
     padding box, so the bottom padding makes room for it and the negative margin keeps the spacing */
  margin: 0 0 -24px;
  padding: 8px 4px 52px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-padding-inline: 4px;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  list-style: none;
}

.phones::-webkit-scrollbar {
  display: none;
}

.phones:focus-visible {
  outline: 2px solid var(--game-text);
  outline-offset: 4px;
  border-radius: 16px;
}

.phones[data-more="right"] {
  mask-image: linear-gradient(to right, #000 calc(100% - var(--fade)), transparent);
}

.phones[data-more="left"] {
  mask-image: linear-gradient(to left, #000 calc(100% - var(--fade)), transparent);
}

.phones[data-more="both"] {
  mask-image: linear-gradient(to right, transparent, #000 var(--fade), #000 calc(100% - var(--fade)), transparent);
}

.phone {
  position: relative;
  flex: 0 0 auto;
  width: clamp(188px, 52vw, 236px);
  aspect-ratio: 9 / 19.5;
  padding: 7px;
  border-radius: 40px;
  background: #1d1b24;
  box-shadow:
    inset 0 0 0 1.5px color-mix(in oklab, var(--game) 40%, #1d1b24),
    0 28px 40px -24px color-mix(in oklab, var(--game) 55%, transparent);
  scroll-snap-align: start;
}

/* Dynamic Island */
.phone::before {
  content: "";
  position: absolute;
  z-index: 1;
  top: 17px;
  left: 50%;
  width: 30%;
  height: 20px;
  border-radius: 9999px;
  background: #000;
  transform: translateX(-50%);
}

.phone__screen {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  border-radius: 33px;
  background: var(--bg-surface);
}

.phone__screen--img picture,
.phone__screen--img img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.phone__screen--demo {
  gap: 14px;
  padding: 52px 12px 16px;
  background: linear-gradient(180deg, var(--game-tint), var(--bg-surface) 75%);
}

.phone__bar {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8125rem;
  font-weight: 600;
}

.phone__screen--demo .preview {
  display: flex;
  justify-content: center;
  padding: 12px 8px;
  background: var(--bg-surface);
  box-shadow: inset 0 0 0 1px var(--game-line);
}

.phone__screen--demo .preview > * {
  zoom: 0.78;
}

.phone__tagline {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.3;
  text-wrap: balance;
}

.phone__cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: auto;
  padding: 10px;
  border-radius: 9999px;
  background: var(--game);
  color: #fff;
  font-size: 0.8125rem;
  font-weight: 600;
}

.phone__screen--feature {
  justify-content: center;
  gap: 12px;
  padding: 56px 18px 24px;
  background: linear-gradient(165deg, var(--game-tint), var(--bg-surface) 70%);
}

.phone__screen--feature .icon-box {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: var(--game-soft);
}

.phone__screen--feature strong {
  font-family: var(--font-display);
  font-size: 1.125rem;
  line-height: 1.25;
}

.phone__screen--feature span:last-child {
  color: var(--text-secondary);
  font-size: 0.875rem;
  line-height: 1.5;
}

.showcase__nav {
  display: flex;
  gap: 12px;
}

.showcase__media.is-static .showcase__nav {
  display: none;
}

.round-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border: 1px solid var(--border-subtle);
  border-radius: 9999px;
  background: var(--bg-surface);
  color: var(--text-primary);
  cursor: pointer;
  transition: background-color 150ms ease, opacity 150ms ease;
}

.round-btn:hover:not(:disabled) {
  background: var(--bg-subtle);
}

.round-btn:disabled {
  opacity: 0.4;
  cursor: default;
}

@media (min-width: 1024px) {
  .showcases {
    gap: 120px;
  }

  .showcase {
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
    gap: 64px;
  }

  .showcase--flip {
    grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  }

  .showcase--flip .showcase__text {
    order: 2;
  }
}

/* Об игре — развёрнутое описание на странице игры (поле about)
   ========================================================================== */
.game-about {
  max-width: 48rem;
  color: var(--text-secondary);
}

.game-about h3 {
  margin: 28px 0 8px;
  font-size: 1.125rem;
  color: var(--text-primary);
}

.game-about h3:first-child {
  margin-top: 0;
}
