/* ============================================================
   iGamesLab.com — Global Stylesheet
   ------------------------------------------------------------
   Design language: NYT Games-inspired (flat, minimal, serif
   headings, generous whitespace, restrained accent color).

   Structure:
     1. Design tokens (CSS custom properties)
     2. Reset & base elements
     3. Layout primitives (container, grid, flex helpers)
     4. Header & navigation (with responsive burger menu)
     5. Footer
     6. Game card grid
     7. Google AdSense placeholder slots
     8. Page-specific blocks (hero, game detail, fullscreen)
     9. Static content pages (about / terms / privacy / support)
    10. Responsive breakpoints
   ============================================================ */


/* ============================================================
   1. DESIGN TOKENS
   ============================================================ */
:root {
  /* Color palette — warm editorial, NYT Games-inspired */
  --color-bg:          #ffffff;
  --color-bg-soft:     #f7f4f0;   /* warm off-white */
  --color-bg-panel:    #fbfaf8;
  --color-text:        #121212;
  --color-text-soft:   #5a5a5a;
  --color-text-muted:  #8a8a8a;
  --color-border:      #e5e0d8;
  --color-accent:      #d64545;   /* terracotta / coral, Color Me vibe */
  --color-accent-soft: #f3d4d0;
  --color-link:        #1a5fb4;

  /* Typography */
  --font-serif: 'Georgia', 'Times New Roman', 'Songti SC', serif;
  --font-sans:  -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Arial, 'PingFang SC', sans-serif;

  /* Spacing scale */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 64px;

  /* Radii & shadows */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --shadow-card: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);

  /* Layout */
  --header-height: 56px;
  --container-max: 1200px;
  --container-narrow: 760px;
}

/* ------------------------------------------------------------
   Dark theme overrides — applied when <html data-theme="dark">.
   Toggled by the .theme-toggle button in the header. The initial
   theme is set by an inline script in <head> based on
   localStorage or prefers-color-scheme.
   ------------------------------------------------------------ */
[data-theme="dark"] {
  --color-bg:          #161412;
  --color-bg-soft:     #1f1c19;
  --color-bg-panel:    #252220;
  --color-text:        #f4f1ec;
  --color-text-soft:   #b8b0a4;
  --color-text-muted:  #807870;
  --color-border:      #38322c;
  --color-accent:      #ff6f6f;   /* slightly brighter for dark bg */
  --color-accent-soft: #3a2424;
  --color-link:        #6db4ff;
}


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

html {
  -webkit-text-size-adjust: 100%;
  /* Prevent horizontal scroll on mobile caused by any element slightly
     wider than the viewport (e.g. shadows, transforms, 100vw blocks). */
  overflow-x: hidden;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* Match html: no horizontal scroll. */
  overflow-x: hidden;
  /* Remove the default grey tap-highlight flash on iOS/Android.
     Combined with the touch-action rule below, this prevents buttons
     and links from staying visually "hovered" after the user lifts
     their finger — a common mobile annoyance. */
  -webkit-tap-highlight-color: transparent;
}

/* On touch-only devices (no real hover capability), neutralise :hover
   states so they don't "stick" after a tap. Browsers that DO support
   hover (desktop, some hybrids) get the normal hover experience.

   IMPORTANT: we use `transparent` (NOT `inherit`) for background and
   border-color. `inherit` would fall back to `currentColor` for
   border-color (since border-color doesn't inherit by default), which
   would actually SHOW a border in the text color — the exact bug we
   are trying to fix. `transparent` matches each element's idle state.

   NOTE: .btn-play is EXCLUDED from this block. Its :hover only sets
   `opacity: 0.85` (no sticky bg/border issue), and including it here
   would strip its ink background + white text — breaking the button
   on mobile tap and after bfcache restore. .btn-play keeps its own
   :focus rule below to preserve its style. */
@media (hover: none) {
  .game-card:hover,
  .footer-link:hover,
  .nav-menu__list a:hover,
  .header-btn:hover,
  .game-detail__link:hover,
  .footer-bottom nav a:hover {
    background: transparent !important;
    border-color: transparent !important;
    color: inherit !important;
    text-decoration: none !important;
    transform: none !important;
  }
  /* Plain links (a:hover) only need color + text-decoration reset.
     Do NOT reset background/border here — would break .btn-play. */
  a:hover {
    text-decoration: none !important;
  }
  /* Footer/link color reset only for non-btn links. The :hover color
     is reset to the element's normal color via `unset`. */
  .footer-link:hover,
  .nav-menu__list a:hover,
  .game-detail__link:hover,
  .footer-bottom nav a:hover {
    color: unset !important;
  }
}

h1, h2, h3, h4 {
  font-family: var(--font-serif);
  font-weight: 700;
  line-height: 1.2;
  margin: 0 0 var(--space-4);
  color: var(--color-text);
  letter-spacing: -0.012em;   /* slight tracking for editorial serif headings */
}

h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.2rem; }

p { margin: 0 0 var(--space-4); }

a {
  color: var(--color-link);
  text-decoration: none;
  transition: color 0.15s ease;
}
a:hover { color: var(--color-accent); }

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

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
}


/* ============================================================
   3. LAYOUT PRIMITIVES
   ============================================================ */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--space-4);
}

.container--narrow { max-width: var(--container-narrow); }

/* ------------------------------------------------------------
   Section spacing — tighter vertical rhythm, NYT-style.
   ------------------------------------------------------------ */
.section { padding: var(--space-6) 0; }       /* was space-7 */
.section--tight { padding: var(--space-4) 0; }


/* ============================================================
   4. HEADER & NAVIGATION
   ------------------------------------------------------------
   The header is a fixed-height bar with:
     - burger button (left)
     - site name (center-left)
   The burger toggles a slide-down menu with category links
   and utility links (About / Terms / Privacy / Support).
   ============================================================ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-height);
  background: var(--color-bg);
  border-bottom: 1px solid var(--color-border);
}

.site-header__inner {
  height: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--space-4);
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

/* ------------------------------------------------------------
   Shared header button style — used by .burger, .nav-close,
   and .theme-toggle. All three are 36×36, transparent, with
   a subtle bg-soft hover. This keeps the header chrome
   visually unified.
   ------------------------------------------------------------ */
.header-btn {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--color-text);
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.header-btn:hover,
.header-btn:active {
  background: var(--color-bg-soft);
  border-color: var(--color-border);
}

/* CRITICAL: after a click, browsers keep the button in :focus state,
   which would leave the hover styling (bg + border) stuck on. To make
   the button look identical to its idle state after release, we
   explicitly reset background, border-color, and outline for :focus
   and :focus-visible on header buttons and links. :hover still works
   on actual mouse hover; .btn-play keeps its own :active opacity. */
.header-btn:focus,
.header-btn:focus-visible,
a:focus,
a:focus-visible,
button:focus,
button:focus-visible {
  outline: none;
  background: transparent;
  border-color: transparent;
}
/* Keep :hover working on real hover-capable devices even when the
   element is also in :focus (e.g. right after a click). */
@media (hover: hover) {
  .header-btn:hover:focus,
  .header-btn:hover:focus-visible {
    background: var(--color-bg-soft);
    border-color: var(--color-border);
  }
}

/* Burger button — uses .header-btn as base */
.burger {
  flex-direction: column;
  gap: 4px;
}
.burger span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--color-text);
  transition: transform 0.2s ease, opacity 0.2s ease;
}
.burger.is-open span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.burger.is-open span:nth-child(2) { opacity: 0; }
.burger.is-open span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* Nav-close button (✕) — inside the nav menu, top-right corner.
   Uses the same .header-btn base as the burger and theme-toggle. */
.nav-close {
  position: absolute;
  top: var(--space-3);
  right: var(--space-3);
  font-size: 1.4rem;
  font-weight: 300;
  line-height: 1;
}
.nav-close::before { content: "×"; }

.site-name {
  font-family: var(--font-serif);
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--color-text);
}
.site-name:hover { color: var(--color-accent); }
.site-name .accent { color: var(--color-accent); }

/* ------------------------------------------------------------
   Theme toggle button — top-right of header.
   Inherits .header-btn for base styling. Contains two inline
   SVG icons (sun + moon); CSS shows only the relevant one.
   ------------------------------------------------------------ */
.theme-toggle {
  margin-left: auto;             /* push to the right of the header */
}
.theme-toggle__icon {
  width: 20px;
  height: 20px;
  display: block;
}
/* Show moon icon in light mode (click → go dark),
   show sun icon in dark mode (click → go light). */
.theme-toggle__icon--sun  { display: none; }
.theme-toggle__icon--moon { display: block; }
[data-theme="dark"] .theme-toggle__icon--sun  { display: block; }
[data-theme="dark"] .theme-toggle__icon--moon { display: none; }

/* Slide-down nav menu */
.nav-menu {
  position: absolute;
  top: var(--header-height);
  left: 0;
  right: 0;
  background: var(--color-bg);
  border-bottom: 1px solid var(--color-border);
  /* Match the header's inner container: same max-width + centering,
     so the menu content aligns perfectly with the header content
     on both left and right edges. The padding matches
     .site-header__inner (var(--space-4)). */
  max-width: var(--container-max);
  margin: 0 auto;
  padding: var(--space-4) var(--space-4) var(--space-5);
  box-shadow: 0 6px 16px rgba(0,0,0,0.06);
  /* Collapsed: translate off-screen AND hide visibility + pointer events
     so the menu cannot intercept clicks on the header or content beneath. */
  transform: translateY(-110%);
  visibility: hidden;
  pointer-events: none;
  transition: transform 0.25s ease, visibility 0s linear 0.25s;
  z-index: 99;
}
.nav-menu.is-open {
  transform: translateY(0);
  visibility: visible;
  pointer-events: auto;
  transition: transform 0.25s ease, visibility 0s linear 0s;
}

.nav-menu__group { margin-bottom: var(--space-4); }
.nav-menu__group:last-child { margin-bottom: 0; }
.nav-menu__group-title {
  font-family: var(--font-sans);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--color-text-muted);
  margin: 0 0 var(--space-2);
}

/* Nav menu links — each group is a single inline row separated by "·".
   Uses the SAME font/color/size as footer links so the menu feels
   typographically consistent with the footer. Categories use the
   footer-link style; the Site group uses footer-link--tag style
   (softer color, lighter weight) to differentiate them at a glance. */
.nav-menu__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: block;
  line-height: 1.8;
}
.nav-menu__list li {
  display: inline;
  margin: 0;
}
.nav-menu__list a {
  color: var(--color-text);
  font-size: 0.9rem;              /* matches .footer-link */
  font-weight: 500;               /* matches .footer-link */
  text-decoration: none;
  transition: color 0.15s ease;
}
.nav-menu__list a:hover {
  color: var(--color-accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}
/* "·" separator between inline links in the same row.
   display: inline-block keeps the dot glued to its <li> (no split
   across lines). The space inside content (" · ") provides the wrap
   opportunity — when the line breaks at the space, the next <li>
   starts hard-left with no leading whitespace (inline-block content
   doesn't create collapsible leading whitespace the way a bare text
   node would). */
.nav-menu__list li + li::before {
  content: " · ";
  display: inline-block;
  color: var(--color-border);
  padding: 0 4px;
}
/* The Site group (Home / About / Support / Terms / Privacy) uses the
   softer footer-link--tag color/weight to distinguish it from the
   primary Game Categories group. */
.nav-menu__group--site .nav-menu__list a {
  color: var(--color-text-soft);
  font-weight: 400;
}
.nav-menu__group--site .nav-menu__list a:hover {
  color: var(--color-accent);
}


/* ============================================================
   5. FOOTER  (categories + tag cloud, JS-rendered, compact)
   ------------------------------------------------------------
   Top:    7 categories as plain text links (underline on hover)
   Middle: 7 tags as plain text links (no #, underline on hover)
   Bottom: copyright + About/Terms/Privacy/Support
   ============================================================ */
.site-footer {
  background: var(--color-bg-soft);
  border-top: 1px solid var(--color-border);
  padding: var(--space-5) 0 var(--space-4);   /* was space-6/space-5 — tighter */
  margin-top: var(--space-6);
}

/* Each footer block (Categories / Tags) — tighter to reduce overall height. */
.footer-cats, .footer-tags {
  margin-bottom: var(--space-3);   /* was space-5 */
}
.footer-cats:last-of-type, .footer-tags:last-of-type { margin-bottom: var(--space-4); }

.footer-cats h4, .footer-tags h4 {
  font-family: var(--font-sans);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-muted);
  margin: 0 0 var(--space-2);   /* was space-4 — pull links closer to label */
}

/* Footer links: inline text flow (not flexbox) so wrapped lines
   always left-align naturally — fixes the iPhone SE wrap bug where
   the second line appeared indented.
   Generous line-height so links have visible breathing room.
   The "·" separator is a CSS ::before pseudo-element with a space
   on each side, giving the browser a clean break opportunity
   between any two links. */
.footer-links {
  display: block;
  line-height: 2.2;               /* was 1.8 — more air between wrapped lines */
  text-align: left;
  /* Allow long words to break if absolutely needed (rare). */
  word-break: normal;
  overflow-wrap: break-word;
}
.footer-links--tags { line-height: 2.2; }

/* "·" separator generated AFTER every link except the last.
   Using ::after (not ::before) is the KEY fix for the second-line
   indent bug: when the line wraps, the next link starts hard-left
   with no leading padding. With ::before, the separator's padding-left
   would create a visible indent on the wrapped line. With ::after,
   the separator stays glued to the PREVIOUS link (which remains on
   the first line), and the next link starts clean.
   display: inline-block prevents the separator from splitting. */
.footer-link--sep-after::after {
  content: " · ";
  display: inline-block;
  color: var(--color-border);
}

.footer-link {
  color: var(--color-text);
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
  transition: color 0.15s ease;
}
.footer-link:hover {
  color: var(--color-accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.footer-link--tag {
  color: var(--color-text-soft);
  font-weight: 400;
}

.footer-bottom {
  border-top: 1px solid var(--color-border);
  padding-top: var(--space-4);
  margin-top: var(--space-2);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-3);
  font-size: 0.85rem;
  color: var(--color-text-muted);
}
.footer-bottom nav { display: flex; gap: var(--space-4); flex-wrap: wrap; }
.footer-bottom nav a { color: var(--color-text-muted); }
.footer-bottom nav a:hover { color: var(--color-accent); }


/* ============================================================
   6. GAME CARD GRID + SECTION TITLES
   ------------------------------------------------------------
   NYT-style section heading: small uppercase sans-serif label
   with a hairline rule below, used as the single editorial
   divider above each games section (replaces the older
   eyebrow + H2 combination).

   Grid responsive columns:
     Desktop (default): 4 columns
     Tablet  (≤1024px): 3 columns
     Mobile  (≤768px):  2 columns  (per spec "мобильный 2 игры в колонке")
   ============================================================ */
.section-heading {
  display: block;
  font-family: var(--font-sans);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--color-accent);
  margin: 0 0 var(--space-4);
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--color-border);
}

/* Kept for backwards compatibility with category.html / game.html
   which still use the two-element eyebrow + title pattern. */
.section-title {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.012em;
  margin: 0 0 var(--space-4);
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--color-text);
}
.section-title--accent { border-bottom-color: var(--color-accent); }

.games-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  /* Asymmetric gap: more vertical space between rows so each card's
     meta line (category · tags) is clearly associated with the icon
     above it, not the icon below. 12px columns, 32px rows. */
  column-gap: var(--space-3);
  row-gap: var(--space-6);
}

/* ============================================================
   GAME CARD
   ------------------------------------------------------------
   Hover behavior: NO border, NO shadow, NO transform.
   Only the title gets underlined (per spec).
   ============================================================ */
.game-card {
  display: block;
  background: transparent;
  border-radius: var(--radius-md);
  text-decoration: none;
  color: inherit;
}

/* Icon: square tile with colored background (from --icon-bg),
   optional image OR emoji overlay, optional badge(s) in corner.
   All icons share the same standard --color-border hairline for
   visual consistency — no per-game border colors. */
.game-card__icon {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: var(--radius-md);
  /* Background comes from a CSS custom property set inline by main.js
     (--icon-bg). Border uses the shared --color-border token — no
     per-game customization, all icons look consistent. */
  background: var(--icon-bg, var(--color-bg-soft));
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  margin-bottom: var(--space-3);
  border: 1px solid var(--color-border);
}
.game-card__icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
/* Emoji / first-letter overlay */
.game-card__swatch {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-serif);
  font-size: 2.6rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.95);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}

/* Badges — small editorial stamps in the top-right corner of
   the icon. NYT-style restraint: neutral dark translucent
   background, thin white border, white text, and a single
   colored dot (from badge.color) before the text. No colored
   pill backgrounds — they clashed with the site palette. */
.game-card__badges {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: flex-end;
  z-index: 1;
}
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;              /* taller: was 4px 10px 4px 9px */
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.78);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.22);
  font-family: var(--font-sans);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  line-height: 1.3;
  white-space: nowrap;
  min-height: 22px;               /* ensure visible height even with tiny text */
}
.badge__dot {
  width: 7px;                      /* slightly larger dot to match new size */
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
  background: #fff;
}
.badge__text { line-height: 1; }

/* Title — underlined on hover (no other visual change) */
.game-card__title {
  font-family: var(--font-serif);
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0 0 var(--space-1);
  color: var(--color-text);
  text-decoration: none;
}
/* Hover (desktop) and :active (mobile tap) underline the title.
   The icon border stays transparent — no border highlight on hover,
   per design spec. Only the title gets visual feedback. */
.game-card:hover .game-card__title,
.game-card:active .game-card__title {
  text-decoration: underline;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 3px;
  text-decoration-color: var(--color-accent);
}

/* Category + tags meta line under the title.
   Plain text: "Category · tag1 · tag2" */
.game-card__meta {
  font-size: 0.78rem;
  color: var(--color-text-muted);
  line-height: 1.4;
}


/* ============================================================
   7. GOOGLE ADSENSE PLACEHOLDER SLOTS — COMMENTED OUT
   ------------------------------------------------------------
   All ad-related CSS is commented out. The ad banners are also
   commented out in main.js (search for "AD SLOT"). To re-enable
   ads, uncomment both the HTML in main.js and the CSS below.

   Replace .ad-slot content with real <ins class="adsbygoogle"> tag.
   Sizes (real pixel dimensions, matching the text inside):
     - .ad-banner--desktop → 728×90 leaderboard (desktop only)
     - .ad-banner--mobile  → 320×50 banner (mobile only)
     - .ad-sky             → 160×600 sidebar (desktop only)
   ============================================================ */
/*
.ad-slot {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-bg-soft);
  border: 1px dashed var(--color-border);
  color: var(--color-text-muted);
  font-size: 0.75rem;
  font-family: var(--font-sans);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  text-align: center;
  margin: var(--space-5) auto;
}

.ad-banner--desktop {
  width: 728px;
  height: 90px;
  display: flex;
}
.ad-banner--mobile {
  width: 320px;
  height: 50px;
  display: none;
}

.ad-sky {
  width: 160px;
  height: 600px;
}

@media (max-width: 768px) {
  .ad-banner--desktop { display: none; }
  .ad-banner--mobile  { display: flex; }
}
*/

/* Production AdSense markup template (commented for reference):
   <ins class="adsbygoogle"
        style="display:block"
        data-ad-client="ca-pub-XXXXXXXXXXXX"
        data-ad-slot="XXXXXXXXXX"
        data-ad-format="auto"
        data-full-width-responsive="true"></ins>
   <script>(adsbygoogle = window.adsbygoogle || []).push({});<\/script>
*/


/* ============================================================
   8. PAGE-SPECIFIC BLOCKS
   ============================================================ */

/* Category page heading — NYT-style editorial pacing. */
.category-header {
  padding: var(--space-5) 0 var(--space-4);
  border-bottom: 1px solid var(--color-border);
  margin-bottom: var(--space-5);
}
.category-header__eyebrow {
  font-family: var(--font-sans);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--color-accent);
  margin: 0 0 var(--space-2);
}
.category-header h1 { margin: 0 0 var(--space-2); }
.category-header p {
  margin: 0;
  color: var(--color-text-soft);
  font-size: 1rem;
  line-height: 1.55;
  max-width: 60ch;
}

/* Game detail page — tightened vertical rhythm.
   The desktop 2-column grid stays; the info column uses a
   consistent 16px (space-4) rhythm between elements. */
.game-detail {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: var(--space-5);             /* was space-6 */
  align-items: start;
  padding: var(--space-5) 0;       /* was space-6 */
}
.game-detail__icon {
  position: relative;
  width: 200px;                    /* was 220 — slightly smaller for balance */
  height: 200px;
  border-radius: var(--radius-md);
  overflow: hidden;
  /* Background from --icon-bg (set inline by game.html), falling back
     to bg-soft. Border uses the shared --color-border token — matches
     the card icon style for visual consistency. */
  background: var(--icon-bg, var(--color-bg-soft));
  border: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: center;
}
.game-detail__icon img { width: 100%; height: 100%; object-fit: cover; }
.game-detail__icon .game-card__swatch { font-size: 4.5rem; }
.game-detail__icon .game-card__badges {
  top: 10px;
  right: 10px;
}
.game-detail__title {
  margin: 0 0 var(--space-2);     /* title → links = 8px */
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: var(--space-3);
}

/* ------------------------------------------------------------
   Category & tag links row — under the title.
   Plain text links with the same font/color as the footer
   (.footer-link). No labels, no chips, no dots. Just text
   separated by "·". Underline on hover.
   ------------------------------------------------------------ */
.game-detail__links {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0;                          /* tight — links sit close together */
  margin: 0 0 var(--space-4);      /* links → play button = 16px (consistent rhythm) */
  line-height: 1.5;
}
.game-detail__link {
  color: var(--color-text);
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
  transition: color 0.15s ease;
}
.game-detail__link:hover {
  color: var(--color-accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}
/* Tags use the softer text color (like footer tag links) */
.game-detail__link--tag {
  color: var(--color-text-soft);
  font-weight: 400;
}
.game-detail__link-sep {
  color: var(--color-border);
  font-size: 0.85rem;
  user-select: none;
  padding: 0 4px;                  /* tight padding around "·" */
}

/* Play button — flat, solid, no transform on hover (NYT-style restraint). */
.btn-play {
  display: inline-block;
  background: var(--color-text);          /* ink, not accent — more editorial */
  color: var(--color-bg);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 12px 28px;
  border-radius: var(--radius-sm);        /* sharper, less rounded */
  text-decoration: none;
  transition: background 0.15s ease, opacity 0.15s ease;
}
.btn-play:hover { opacity: 0.85; color: var(--color-bg); }
.btn-play:active { opacity: 0.7; }
/* CRITICAL mobile fix: preserve btn-play's ink background + white text
   in :focus state. After a tap on mobile, the browser keeps the button
   in :focus, and after returning from the game iframe via bfcache the
   focus is restored. Without these `!important` rules, the global
   button:focus reset (transparent bg) would strip the ink background,
   making the button appear with white bg + black text (inverted).
   The !important is needed to win against the global button:focus rule
   which also sets background/border-color. */
.btn-play:focus,
.btn-play:focus-visible {
  background: var(--color-text) !important;
  color: var(--color-bg) !important;
  outline: none;
}

/* Game description block — supports a subset of HTML rendered via
   innerHTML. Styled to match the editorial NYT-Games feel:
   generous line-height, clear hierarchy, modest list spacing. */
.game-description { margin-top: var(--space-5); line-height: 1.65; max-width: 720px; }
.game-description h2 { margin-top: var(--space-5); font-size: 1.2rem; }
.game-description h3 { margin-top: var(--space-4); font-size: 1.05rem; }
.game-description p { margin-bottom: var(--space-3); }

/* HTML description body — ul/ol/strong/em styling.
   The description field can contain: <p>, <h3>, <ul>, <ol>, <li>,
   <strong>, <em>, <a>, <br>. These rules give each element proper
   spacing and typography within the .game-description__body container. */
.game-description__body ul,
.game-description__body ol {
  margin: 0 0 var(--space-3);
  padding-left: var(--space-5);
}
.game-description__body li {
  margin-bottom: var(--space-2);
  line-height: 1.6;
}
.game-description__body li:last-child { margin-bottom: 0; }
.game-description__body strong { font-weight: 700; color: var(--color-text); }
.game-description__body em { font-style: italic; }
.game-description__body a {
  color: var(--color-text);
  text-decoration: underline;
  text-decoration-color: var(--color-border);
  text-underline-offset: 2px;
  transition: color 0.15s ease, text-decoration-color 0.15s ease;
}
.game-description__body a:hover {
  color: var(--color-accent);
  text-decoration-color: var(--color-accent);
}
/* Headings inside the description body */
.game-description__body h3 {
  margin-top: var(--space-4);
  margin-bottom: var(--space-2);
  font-size: 1.05rem;
}
.game-description__body h3:first-child { margin-top: 0; }
/* Paragraphs */
.game-description__body p { margin: 0 0 var(--space-3); }
.game-description__body p:last-child { margin-bottom: 0; }

/* Fullscreen game page — defined entirely in play.html inline <style>.
   The styles here are kept only as a fallback for any browser that
   loads the page without the inline block. Real layout lives in play.html. */
.play-layout {
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: var(--space-3);
  width: 100vw;
  height: 100vh;
  padding: 0;
  background: var(--color-bg);
  overflow: hidden;
}
.play-layout__game {
  flex: 1 1 auto;
  height: 100%;
  display: flex;
  align-items: stretch;
  justify-content: center;
}
.play-layout__game iframe {
  width: 100%;
  height: 100%;
  border: 0;
  background: var(--color-bg);
}
.play-layout__aside {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
}


/* ============================================================
   9. STATIC CONTENT PAGES (about / terms / privacy / support)
   ============================================================ */
/* Body-text links inside .page-prose and .game-description are
   underlined by default — NYT style. Hover tint only. */
.page-prose p a,
.game-description p a,
.game-description li a {
  color: var(--color-text);
  text-decoration: underline;
  text-decoration-color: var(--color-border);
  text-underline-offset: 2px;
  transition: text-decoration-color 0.15s ease, color 0.15s ease;
}
.page-prose p a:hover,
.game-description p a:hover,
.game-description li a:hover {
  color: var(--color-accent);
  text-decoration-color: var(--color-accent);
}
.page-prose {
  max-width: var(--container-narrow);
  margin: 0 auto;
  padding: var(--space-5) var(--space-4);   /* was space-6 */
}
.page-prose h1 { margin-bottom: var(--space-4); }       /* was space-5 */
.page-prose h2 { margin-top: var(--space-5); font-size: 1.25rem; }  /* was space-6, 1.3rem */
.page-prose p, .page-prose li { color: var(--color-text); }
.page-prose ul, .page-prose ol { padding-left: var(--space-5); }
.page-prose li { margin-bottom: var(--space-2); }
.page-prose .lead {
  font-size: 1.08rem;                                    /* was 1.1rem */
  color: var(--color-text-soft);
  margin-bottom: var(--space-4);                         /* was space-5 */
  line-height: 1.6;
}

.support-form {
  display: grid;
  gap: var(--space-3);
  margin-top: var(--space-5);
}
.support-form label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-text-soft);
}
.support-form input,
.support-form textarea {
  font-family: inherit;
  font-size: 1rem;
  padding: var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-bg);
  width: 100%;
}
.support-form button {
  justify-self: start;
  background: var(--color-accent);
  color: #fff;
  font-weight: 600;
  padding: var(--space-3) var(--space-6);
  border-radius: var(--radius-md);
}
.support-form button:hover { background: #b83838; }


/* ============================================================
   10. RESPONSIVE BREAKPOINTS
   ============================================================ */
@media (max-width: 1024px) {
  .games-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 768px) {
  h1 { font-size: 1.5rem; }       /* was 1.6rem — tighter on mobile */
  h2 { font-size: 1.25rem; }      /* was 1.3rem */
  .section { padding: var(--space-4) 0; }   /* was space-5 */

  /* Keep asymmetric gap on mobile too: rows need more breathing room
     than columns so each card's meta line clearly belongs to the icon
     above, not the icon below. */
  .games-grid { grid-template-columns: repeat(2, 1fr); column-gap: var(--space-3); row-gap: var(--space-5); }

  /* Game detail — stack vertically with a CONSISTENT vertical rhythm.
     icon-top → icon → title → links → play = all 16px gaps (space-4).
     This fixes the previous imbalance where the gap above the icon
     was larger than the gap between icon and title. */
  .game-detail { grid-template-columns: 1fr; gap: var(--space-4); padding: var(--space-4) 0; }
  .game-detail__icon { width: 180px; height: 180px; margin: 0 auto; }
  .game-detail__icon .game-card__swatch { font-size: 4rem; }
  .game-detail__title { text-align: center; justify-content: center; margin-bottom: var(--space-2); }
  .game-detail__links { justify-content: center; margin-bottom: var(--space-4); }
  .btn-play { display: block; text-align: center; max-width: 220px; margin: 0 auto; }

  /* Hide side skyscraper ads on mobile — game fills 100% of the viewport */
  .play-layout__aside { display: none; }
  .play-layout { gap: 0; }
}

@media (max-width: 480px) {
  .games-grid { grid-template-columns: repeat(2, 1fr); column-gap: var(--space-3); row-gap: var(--space-5); }
  .game-card__title { font-size: 0.92rem; }
  .game-card__swatch { font-size: 2rem; }
  .game-card__meta { font-size: 0.72rem; }      /* slightly smaller meta on tiny screens */
}

/* ============================================================
   PAGE DESCRIPTION (SEO text block before footer)
   ------------------------------------------------------------ */
.page-description {
  /* max-width: 720px; */
  max-width: var(--container-max);
  margin: var(--space-7) auto var(--space-5);  /* large top gap from games grid */
  padding: 0 var(--space-4);
  font-size: 0.85rem;             /* small, but readable */
  line-height: 1.65;
  color: var(--color-text-soft);
  text-align: left;
}

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

/* ============================================================
   11. MOBILE TAP FEEDBACK  (:active on touch-only devices)
   ------------------------------------------------------------
   On touch-only devices (hover: none), :hover doesn't fire — so
   the user gets no visual feedback when tapping a button or link.
   This block adds :active feedback that mimics the desktop :hover
   effect. The :active state only lasts while the finger is down;
   it disappears the instant the user lifts their finger — exactly
   the behaviour the spec asks for.

   IMPORTANT: this block is placed at the END of the stylesheet so
   it comes AFTER the global button:focus reset (§4). :active and
   :focus can overlap briefly during a tap; by being later in the
   source, :active wins the cascade for same-specificity rules.
   !important is used for extra safety against any future :focus
   rules that might be added above.
   ============================================================ */
@media (hover: none) {
  /* Header buttons (burger, theme-toggle, nav-close):
     same bg-soft + border as desktop :hover. */
  .header-btn:active {
    background: var(--color-bg-soft) !important;
    border-color: var(--color-border) !important;
  }

  /* Footer / nav / game-detail links:
     same accent color + underline as desktop :hover. */
  .footer-link:active,
  .nav-menu__list a:active,
  .game-detail__link:active,
  .footer-bottom nav a:active {
    color: var(--color-accent) !important;
    text-decoration: underline !important;
    text-underline-offset: 2px;
  }

  /* Game cards: title underline during tap (mirrors desktop :hover).
     No icon border highlight — per design spec, only the title
     gets visual feedback on hover/active. */
  .game-card:active .game-card__title {
    text-decoration: underline !important;
    text-decoration-thickness: 1.5px;
    text-underline-offset: 3px;
    text-decoration-color: var(--color-accent);
  }
}

/* ============================================================
   12. ADS Blocks
   ------------------------------------------------------------ */
.igl-ad-placeholder {
  min-height: 0px;
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 24px 0;
}
