/*!
 * NorthFiveFun — main.css
 * ---------------------------------------------------------------------------
 * Layout, components, typography, spacing. THEME-AGNOSTIC.
 * Every colour in this file comes from a CSS custom property that is defined
 * in assets/css/theme-dark.css and assets/css/theme-light.css.
 *
 * Mobile-first: base styles target ~390px. Everything wider is a min-width
 * query. Desktop is the SAME mobile card design scaled into 2-3 columns
 * inside a max ~720px column — never a different editorial grid.
 *
 * Class names and variables follow CONTRACT.md §5 and CONTRACT_MARKUP.md §11.
 */

/* ==========================================================================
   1. RESET & BASE
   ========================================================================== */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + var(--search-h) + env(safe-area-inset-top) + 12px);
  overflow-x: clip; /* belt-and-braces: never a horizontal scrollbar at 320px */
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  min-height: 100svh;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
  background-color: var(--bg);
  background-image: var(--hero-glow);
  background-repeat: no-repeat;
  background-position: top center;
  background-size: 100% 460px;
  overflow-wrap: break-word;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1,
h2,
h3,
h4 {
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: -0.02em;
}

p {
  margin: 0;
}

img,
svg,
video,
iframe {
  max-width: 100%;
  border: 0;
}

img {
  height: auto;
  display: block;
}

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

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

ul,
ol {
  margin: 0;
  padding: 0;
}

::selection {
  background: var(--accent-soft);
  color: var(--text);
}

/* Focus ring — visible, high-contrast, never removed. */
:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

/* ==========================================================================
   2. UTILITIES
   ========================================================================== */

/* Screen-reader-only text. */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* Skip link — off-screen until focused, then pinned to the top-left. */
.skip-link {
  position: absolute;
  left: 8px;
  top: -120px;
  z-index: 200;
  display: inline-block;
  padding: 12px 18px;
  border-radius: 0 0 var(--radius) var(--radius);
  background: var(--accent-strong);
  color: var(--accent-ink);
  font-size: 14px;
  font-weight: 800;
  text-decoration: none;
  transition: top 0.18s ease;
}

.skip-link:focus,
.skip-link:focus-visible {
  top: 0;
  box-shadow: 0 0 0 4px var(--focus-halo);
  outline-offset: 3px;
}

/* ==========================================================================
   3. PAGE SCAFFOLDING
   ========================================================================== */

/* The single centred content column. */
.wrapper,
.container {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: max(var(--gutter), env(safe-area-inset-left), env(safe-area-inset-right));
}

.site-main {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: max(var(--gutter), env(safe-area-inset-left), env(safe-area-inset-right));
  padding-bottom: 24px;
}

/* A wrapper nested directly in main must not double the gutter. */
.site-main > .wrapper,
.site-main > .container {
  max-width: none;
  padding-inline: 0;
}

/* ==========================================================================
   4. HEADER
   ========================================================================== */

.site-header {
  position: sticky;
  top: 0;
  z-index: 60;
  padding-top: env(safe-area-inset-top);
  background: var(--header-bg);
  -webkit-backdrop-filter: blur(14px) saturate(1.4);
  backdrop-filter: blur(14px) saturate(1.4);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  max-width: var(--maxw);
  min-height: var(--header-h);
  margin-inline: auto;
  padding-inline: max(var(--gutter), env(safe-area-inset-left), env(safe-area-inset-right));
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: var(--tap);
  color: var(--text);
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: -0.025em;
  text-decoration: none;
}

.brand img {
  width: 32px;
  height: 32px;
  border-radius: 9px;
}

.brand-name {
  font-size: 17px;
  line-height: 1;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: var(--tap);
  height: var(--tap);
  min-width: var(--tap);
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--card-2);
  color: var(--text);
  cursor: pointer;
  transition: background-color 0.18s ease, color 0.18s ease, border-color 0.18s ease, transform 0.12s ease;
}

.icon-btn__ico {
  font-size: 18px;
  line-height: 1;
}

.icon-btn:active {
  transform: scale(0.94);
}

.theme-toggle {
  background: var(--accent-soft);
  border-color: transparent;
  color: var(--accent);
}

/* Set by main.js once the page is scrolled — depth cue, no layout shift. */
.site-header.is-stuck {
  border-bottom-color: var(--border-strong);
  box-shadow: var(--shadow);
}

/* The hamburger is the primary navigation affordance on mobile. */
.drawer-toggle {
  background: var(--accent-strong);
  border-color: transparent;
  color: var(--accent-ink);
}

/* ==========================================================================
   5. SEARCH
   ========================================================================== */

.search-bar {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding: 0 max(var(--gutter), env(safe-area-inset-left), env(safe-area-inset-right)) 10px;
}

.search-input {
  flex: 1 1 auto;
  min-width: 0;
  min-height: var(--tap);
  padding: 0 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--card-2);
  color: var(--text);
  font-size: 14px;
  -webkit-appearance: none;
  appearance: none;
}

.search-input::placeholder {
  color: var(--text-mute);
}

.search-input:focus {
  border-color: var(--accent);
}

.search-btn {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: var(--tap);
  height: var(--tap);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--accent-soft);
  color: var(--accent-soft-ink);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  transition: transform 0.12s ease;
}

.search-btn:active {
  transform: scale(0.94);
}

.search-suggest {
  position: absolute;
  top: calc(100% + 6px);
  left: max(var(--gutter), env(safe-area-inset-left));
  right: max(var(--gutter), env(safe-area-inset-right));
  z-index: 70;
  max-height: 60vh;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--bg-elev);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
}

.search-suggest a,
.search-suggest li,
.search-suggest button {
  display: flex;
  align-items: center;
  min-height: var(--tap);
  padding: 10px 14px;
  border: 0;
  border-bottom: 1px solid var(--divider);
  background: transparent;
  color: var(--text);
  font-size: 14px;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.search-suggest li:last-child a,
.search-suggest a:last-child,
.search-suggest button:last-child {
  border-bottom: 0;
}

.search-suggest [aria-selected="true"],
.search-suggest .is-active {
  background: var(--accent-soft);
  color: var(--accent-soft-ink);
}

/* Suggestion rows built by main.js.
   The selector is qualified so it outranks the generic `.search-suggest a`
   rule above (which is a class + type = 0,1,1). */
.search-suggest .search-suggest__item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  min-height: var(--tap);
  padding: 9px 14px;
  border-bottom: 1px solid var(--divider);
  color: var(--text);
  font-size: 14px;
  text-decoration: none;
}

.search-suggest .search-suggest__title {
  font-size: 14px;
  font-weight: 700;
  line-height: 1.3;
}

.search-suggest .search-suggest__dev {
  color: var(--text-mute);
  font-size: 12px;
  line-height: 1.3;
}

.search-suggest .search-suggest__all {
  align-items: center;
  justify-content: center;
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
  text-align: center;
}

.search-suggest__item[aria-selected="true"],
.search-suggest__item:hover {
  background: var(--accent-soft);
  color: var(--accent-soft-ink);
}

.search-suggest__item[aria-selected="true"] .search-suggest__dev,
.search-suggest__item:hover .search-suggest__dev {
  color: var(--accent-soft-ink);
}

/* ==========================================================================
   6. DRAWER (off-canvas, right side)
   ========================================================================== */

/* Scrim. `hidden` is neutralised so the fade can actually transition. */
.drawer-scrim {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: block;
  background: var(--scrim);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.26s ease, visibility 0.26s ease;
}

.drawer-scrim[hidden] {
  display: block;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.drawer-scrim:not([hidden]),
.drawer-scrim.is-open,
.drawer-scrim.open,
.drawer-scrim.is-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  width: min(88vw, 340px);
  max-width: 100%;
  height: 100%;
  height: 100dvh;
  padding-top: env(safe-area-inset-top);
  padding-right: env(safe-area-inset-right);
  background: var(--bg-elev);
  border-left: 1px solid var(--border-strong);
  box-shadow: var(--shadow-lg);
  transform: translateX(100%);
  visibility: hidden;
  overscroll-behavior: contain;
  transition: transform 0.3s cubic-bezier(0.22, 0.61, 0.36, 1), visibility 0.3s ease;
}

/* Open state. `aria-hidden="false"` is the contract hook; the class aliases
   below are tolerated so the panel opens even if the JS uses a different
   convention. */
.drawer[aria-hidden="false"],
.drawer.is-open,
.drawer.open,
.drawer.is-visible,
.drawer[data-open="true"] {
  transform: translateX(0);
  visibility: visible;
}

.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex: 0 0 auto;
  padding: 10px 14px 10px 18px;
  border-bottom: 1px solid var(--border);
}

.drawer-title {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.drawer-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 6px 18px calc(28px + env(safe-area-inset-bottom));
}

.drawer-search {
  margin: 12px 0 4px;
}

.drawer-group {
  padding: 16px 0;
  border-bottom: 1px solid var(--divider);
}

.drawer-group:last-child {
  border-bottom: 0;
}

.drawer-group-title {
  margin: 0 0 6px;
  font-family: var(--font);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-mute);
}

.drawer-list {
  list-style: none;
  display: grid;
  gap: 2px;
}

.drawer-list a {
  display: flex;
  align-items: center;
  min-height: var(--tap);
  padding: 0 10px;
  margin: 0 -10px;
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
}

.drawer-list a:hover {
  background: var(--accent-soft);
  color: var(--accent-soft-ink);
}

.drawer-list--genres {
  grid-template-columns: repeat(auto-fill, minmax(126px, 1fr));
  gap: 2px 6px;
}

/* Live search results injected into the drawer by main.js. */
.drawer-list--results {
  max-height: 42vh;
  margin-top: 4px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.theme-switch {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  padding: 4px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
}

.theme-opt {
  min-height: 40px;
  padding: 0 6px;
  border: 0;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.18s ease, color 0.18s ease;
}

.theme-opt[aria-pressed="true"] {
  background: var(--accent-strong);
  color: var(--accent-ink);
}

/* Body scroll lock while the drawer is open. */
body.drawer-open,
body.nav-open,
body.menu-open,
body.is-drawer-open {
  overflow: hidden;
}

/* ==========================================================================
   7. PAGE HEAD, BREADCRUMBS, SECTIONS
   ========================================================================== */

.page-head {
  padding: 20px 0 4px;
}

.breadcrumbs ol {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  list-style: none;
  font-size: 12px;
  color: var(--text-mute);
}

.breadcrumbs li + li::before {
  content: "/";
  margin-right: 6px;
  color: var(--border-strong);
}

.breadcrumbs a {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  color: var(--text-dim);
  text-decoration: none;
}

.breadcrumbs a:hover {
  color: var(--accent);
}

.page-title {
  margin: 8px 0 6px;
  font-size: 26px;
  line-height: 1.12;
  letter-spacing: -0.03em;
}

.page-sub {
  margin: 0 0 6px;
  color: var(--text-dim);
  font-size: 15px;
  line-height: 1.55;
}

.section {
  margin: 28px 0;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.section-title {
  margin: 0;
  font-size: 19px;
  line-height: 1.25;
  letter-spacing: -0.02em;
}

.section-more {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
  padding-left: 8px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.section-more:hover {
  text-decoration: underline;
}

.section-note {
  margin: 0 0 14px;
  color: var(--text-mute);
  font-size: 13px;
  line-height: 1.55;
}

/* Long-form editorial copy. */
.prose {
  max-width: 68ch;
  color: var(--text-dim);
  font-size: 15.5px;
  line-height: 1.72;
}

.prose p {
  margin: 0 0 1em;
}

.prose h2 {
  margin: 26px 0 8px;
  font-size: 19px;
  line-height: 1.3;
  color: var(--text);
}

.prose h3 {
  margin: 20px 0 6px;
  font-size: 16px;
  line-height: 1.35;
  color: var(--text);
}

.prose ul,
.prose ol {
  margin: 0 0 1em;
  padding-left: 1.25em;
}

.prose li {
  margin-bottom: 0.4em;
}

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

.prose blockquote {
  margin: 0 0 1em;
  padding: 6px 0 6px 14px;
  border-left: 3px solid var(--accent);
  color: var(--text-dim);
}

.prose strong {
  color: var(--text);
}

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

/* Intro paragraph at the top of a category page. */
.prose--page-intro {
  max-width: 72ch;
  margin-bottom: 18px;
  color: var(--text);
  font-size: 16px;
  line-height: 1.68;
}

/* ==========================================================================
   8. GAME CARDS & GRID
   ========================================================================== */

.card-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
}

.game-card {
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

/* Floating score chip on the cover. */
.game-card::before {
  content: "\2605 " attr(data-score);
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  height: 26px;
  padding: 0 9px;
  border-radius: var(--radius-pill);
  background: linear-gradient(135deg, var(--accent-strong), var(--accent-2-strong));
  color: var(--accent-ink);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.01em;
  box-shadow: var(--shadow);
}

.game-card__media {
  position: relative;
  display: block;
  aspect-ratio: 16 / 9;
  background: var(--bg-soft);
}

.game-card__cover {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.game-card__media::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--cover-veil);
  pointer-events: none;
}

/* App logo overlaps the cover as a badge. */
.game-card__logo {
  position: absolute;
  left: 12px;
  bottom: -20px;
  z-index: 2;
  width: 54px;
  height: 54px;
  border: 2px solid var(--card);
  border-radius: 15px;
  background: var(--card-2);
  object-fit: cover;
  box-shadow: var(--shadow);
}

.game-card__body {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  gap: 3px;
  padding: 30px 14px 14px;
}

.game-card__title {
  margin: 0;
  font-size: 15.5px;
  line-height: 1.28;
  letter-spacing: -0.015em;
}

.game-card__title a {
  color: var(--text);
  text-decoration: none;
}

/* Whole card is clickable, but the accessible link stays the title. */
.game-card__title a::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
}

.game-card__dev {
  font-size: 12px;
  color: var(--text-mute);
}

.game-card__sum {
  margin-top: 3px;
  color: var(--text-dim);
  font-size: 13px;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.game-card__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: auto;
  padding-top: 10px;
}

/* ==========================================================================
   9. BADGES, RATINGS, STARS
   ========================================================================== */

.badge {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 9px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.badge--price {
  background: var(--accent-soft);
  color: var(--accent-soft-ink);
}

/* A free title gets a mint badge; paid titles keep the brand violet. */
.game-card[data-price="free"] .badge--price {
  background: var(--success-soft);
  color: var(--success-soft-ink);
}

.game-card[data-price="free"] .badge--price::before {
  content: "";
  width: 5px;
  height: 5px;
  margin-right: 5px;
  border-radius: 50%;
  background: var(--success);
}

.badge--genre {
  background: var(--chip-bg);
  border: 1px solid var(--border);
  color: var(--text-dim);
}

/* Chart position, e.g. "#1" on category pages. */
.badge--rank {
  background: var(--accent-strong);
  color: var(--accent-ink);
  letter-spacing: 0.02em;
}

.rating {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
}

.rating__star {
  color: var(--star);
  font-size: 14px;
  line-height: 1;
}

.rating__val {
  font-variant-numeric: tabular-nums;
}

.rating__count {
  color: var(--text-mute);
  font-size: 12px;
  font-weight: 500;
}

/* A game with no Play Store rating yet. */
.rating--unrated {
  color: var(--text-mute);
  font-size: 12px;
  font-weight: 600;
}

.stars {
  color: var(--star);
  font-family: var(--font-display), "Segoe UI Symbol", "Noto Sans Symbols 2", "Apple Symbols", sans-serif;
  font-size: 15px;
  letter-spacing: 2px;
  line-height: 1;
}

/* Fractional score without a half-star glyph.
   U+2BEA (half star) has no glyph in any common system font and renders as a
   tofu box. Instead the gold row is clipped to --fill (a percentage set inline
   by the generator) over a muted base row, which is font-safe and more precise
   than a half star. */
.stars--fill {
  position: relative;
  display: inline-block;
}

.stars--fill .stars__base {
  color: var(--star-off, var(--border-strong));
}

.stars--fill .stars__over {
  position: absolute;
  inset: 0;
  width: var(--fill, 0%);
  overflow: hidden;
  color: var(--star);
  white-space: nowrap;
  pointer-events: none;
}

.stars--sm {
  font-size: 12px;
  letter-spacing: 1px;
}

/* Star colour follows the rating: gold for 4-5, amber for 3, red for 1-2. */
.review[data-rating="1"] .stars,
.review[data-rating="2"] .stars {
  padding: 2px 7px;
  border-radius: var(--radius-pill);
  background: var(--danger-soft);
  color: var(--danger-soft-ink);
  box-shadow: inset 0 0 0 1px var(--danger);
}

.review[data-rating="3"] .stars {
  padding: 2px 7px;
  border-radius: var(--radius-pill);
  background: var(--warn-soft);
  color: var(--warn-soft-ink);
  box-shadow: inset 0 0 0 1px var(--warn);
}

.review[data-rating="4"] .stars,
.review[data-rating="5"] .stars {
  color: var(--star);
}

.big-score {
  font-family: var(--font-display);
  font-size: 42px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

/* ==========================================================================
   10. BUTTONS & CHIPS
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--tap);
  padding: 0 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--card-2);
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.12s ease, background-color 0.18s ease, border-color 0.18s ease;
}

.btn:active {
  transform: scale(0.98);
}

.btn--primary {
  background: linear-gradient(135deg, var(--accent-strong), var(--accent-2-strong));
  border-color: transparent;
  color: var(--accent-ink);
  box-shadow: var(--shadow);
}

.btn--more {
  width: 100%;
  margin-top: 16px;
}

.chip-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 0 10px;
  list-style: none;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.chip-row::-webkit-scrollbar {
  display: none;
}

.chip {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--card);
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.chip[aria-pressed="true"],
.chip.is-active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-soft-ink);
}

/* Count badge rendered next to a label — "Action 203", "Top Paid 220".
   Used inside .chip, inside .chip-row--list links and inside drawer links. */
.chip__count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  margin-left: 7px;
  padding: 0 6px;
  min-width: 22px;
  height: 1.55em;
  border-radius: var(--radius-pill);
  background: var(--chip-bg);
  color: var(--text-mute);
  font-size: 0.74em;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.01em;
  vertical-align: middle;
  font-variant-numeric: tabular-nums;
}

/* A chip row whose entries are plain anchors (category "More collections"). */
.chip-row--list li {
  flex: 0 0 auto;
}

.chip-row--list a {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--card);
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.chip-row--list a:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ==========================================================================
   11. GAME DETAIL PAGE
   ========================================================================== */

.game-detail {
  padding-bottom: 8px;
}

/* Hero stays stacked at every width: the mobile layout widened, never a
   different editorial grid. */
.game-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
}

.game-hero__media {
  position: relative;
  margin-bottom: 40px;
}

.game-hero__body {
  min-width: 0;
}

.game-hero__cover {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: var(--radius-lg);
  background: var(--bg-soft);
}

.game-hero__media::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: var(--radius-lg);
  background: var(--cover-veil);
  pointer-events: none;
}

.game-hero__logo {
  position: absolute;
  left: 16px;
  bottom: -34px;
  z-index: 2;
  width: 92px;
  height: 92px;
  border: 3px solid var(--bg);
  border-radius: 24px;
  background: var(--card-2);
  object-fit: cover;
  box-shadow: var(--shadow-lg);
}

.game-title {
  margin: 0 0 4px;
  font-size: 25px;
  line-height: 1.14;
  letter-spacing: -0.03em;
}

.game-dev {
  margin: 0 0 12px;
  color: var(--text-mute);
  font-size: 13px;
}

.game-dev a {
  color: var(--text-dim);
  text-decoration: none;
  border-bottom: 1px solid var(--border-strong);
}

.game-summary {
  margin: 0 0 18px;
  color: var(--text-dim);
  font-size: 15px;
  line-height: 1.6;
}

.game-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 0 0 18px;
}

.stat {
  padding: 12px 10px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-align: center;
}

.stat__val {
  display: block;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}

.stat__label {
  display: block;
  margin-top: 2px;
  color: var(--text-mute);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.game-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 28px;
}

.game-actions .btn {
  flex: 1 1 200px;
}

/* "Also listed in: Top Free, More Arcade games" */
.game-links {
  margin: 12px 0 0;
  color: var(--text-mute);
  font-size: 13px;
  line-height: 1.6;
}

.game-links a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.game-section {
  margin: 30px 0;
  scroll-margin-top: calc(var(--header-h) + var(--search-h) + env(safe-area-inset-top) + 12px);
}

.game-section > h2 {
  margin: 0 0 10px;
  font-size: 20px;
  line-height: 1.25;
}

.shot-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.shot-grid img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: var(--radius-sm);
  background: var(--bg-soft);
}

/* ==========================================================================
   12. REVIEWS
   ========================================================================== */

.rating-summary {
  display: grid;
  gap: 16px;
  margin-bottom: 16px;
  padding: 16px;
  background: var(--card-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.rating-summary__score {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 12px;
}

.rating-count {
  width: 100%;
  color: var(--text-mute);
  font-size: 12px;
}

.rating-bars {
  display: grid;
  gap: 7px;
}

.rating-bar {
  display: grid;
  grid-template-columns: 1.9rem minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  font-size: 12px;
}

/* Track behind the fill (same grid cell). */
.rating-bar::after {
  content: "";
  grid-column: 2;
  grid-row: 1;
  height: 8px;
  border-radius: var(--radius-pill);
  background: var(--border);
}

.rating-bar__label {
  grid-column: 1;
  grid-row: 1;
  color: var(--text-dim);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* The label carries the bare star count ("5"); the glyph is added here. */
.rating-bar__label::after {
  content: "★";
  margin-left: 2px;
  color: var(--star);
  font-size: 0.9em;
}

.rating-bar__count {
  grid-column: 3;
  grid-row: 1;
  color: var(--text-mute);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.rating-bar__fill {
  position: relative;
  z-index: 1;
  grid-column: 2;
  grid-row: 1;
  height: 8px;
  min-width: 4px;
  border-radius: var(--radius-pill);
  background: linear-gradient(90deg, var(--accent-strong), var(--accent-2));
  width: var(--pct, 0%);
  width: attr(data-pct type(<percentage>), var(--pct, 0%));
}

.review-toolbar {
  margin: 0 0 14px;
}

.review-list {
  list-style: none;
  display: grid;
  gap: 12px;
}

.review {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  gap: 12px;
  padding: 14px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.review__avatar {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-strong), var(--accent-2-strong));
  color: var(--accent-ink);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.review__main {
  min-width: 0;
}

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

.review__author {
  font-size: 14px;
  font-weight: 700;
}

.review__date {
  margin-left: auto;
  color: var(--text-mute);
  font-size: 12px;
}

.review__title {
  margin: 6px 0 3px;
  font-size: 15px;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

.review__body {
  color: var(--text-dim);
  font-size: 14px;
  line-height: 1.6;
}

.review__foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px 12px;
  margin-top: 10px;
  color: var(--text-mute);
  font-size: 12px;
}

.review__meta {
  color: var(--text-mute);
  font-size: 12px;
}

.review__helpful {
  color: var(--text-mute);
}

/* Placeholder row when a filter matches no reviews. */
.review--empty {
  display: block;
  padding: 22px 16px;
  color: var(--text-mute);
  font-size: 14px;
  text-align: center;
}

/* ==========================================================================
   13. TOOLBAR, SELECTS, PAGER
   ========================================================================== */

.toolbar {
  display: grid;
  gap: 10px;
  margin: 18px 0 12px;
}

.toolbar__search {
  display: block;
  min-width: 0;
}

.toolbar__search .search-input {
  width: 100%;
}

.toolbar__selects {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.select {
  width: 100%;
  min-height: var(--tap);
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background-color: var(--card-2);
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
}

.select:focus {
  border-color: var(--accent);
}

.result-count {
  margin: 0 0 12px;
  color: var(--text-mute);
  font-size: 13px;
}

.pager {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin: 24px 0;
}

.page-btn {
  display: inline-grid;
  place-items: center;
  min-width: var(--tap);
  min-height: var(--tap);
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--card);
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

.page-btn--active {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
  color: var(--accent-ink);
}

/* Ellipsis between page numbers — decorative, not a button. */
.page-btn--gap {
  background: transparent;
  border-color: transparent;
  color: var(--text-mute);
  cursor: default;
  pointer-events: none;
}

.noscript-note {
  margin: 16px 0;
  padding: 12px 14px;
  background: var(--card-2);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  color: var(--text-dim);
  font-size: 13px;
}

/* ==========================================================================
   14. AD SLOTS (reserved height — no CLS)
   ========================================================================== */

.ad-slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-height: 60px;
  margin: 24px 0;
  padding: 10px 12px;
  border: 1px dashed var(--ad-border);
  border-radius: var(--radius);
  background: var(--ad-bg);
  text-align: center;
}

.ad-label {
  color: var(--ad-label);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.ad-slot--header {
  min-height: 60px;
}

/* CONTRACT_MARKUP.md spells this "ad-slot--infeed"; the generated pages use
   "ad-slot--in-feed". Both are supported so the reserved height is never
   lost (a lost reservation = layout shift when the ad loads). */
.ad-slot--infeed,
.ad-slot--in-feed {
  min-height: 280px;
}

.ad-slot--sidebar {
  min-height: 250px;
}

.ad-slot--footer {
  min-height: 90px;
}

/* ==========================================================================
   15. BACK-TO-TOP
   ========================================================================== */

.back-to-top {
  position: fixed;
  right: 14px;
  bottom: calc(14px + env(safe-area-inset-bottom));
  z-index: 70;
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--accent-strong);
  color: var(--accent-ink);
  box-shadow: var(--shadow-lg);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  transition: transform 0.12s ease;
}

.back-to-top:active {
  transform: scale(0.94);
}

/* ==========================================================================
   16. FOOTER
   ========================================================================== */

.site-footer {
  margin-top: 40px;
  padding: 32px 0 calc(28px + env(safe-area-inset-bottom));
  background: var(--footer-bg);
  border-top: 1px solid var(--border);
}

.footer-inner {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: max(var(--gutter), env(safe-area-inset-left), env(safe-area-inset-right));
}

.footer-brand {
  display: grid;
  justify-items: start;
  gap: 6px;
  margin-bottom: 24px;
}

.footer-brand img {
  width: 36px;
  height: 36px;
  border-radius: 10px;
}

.footer-tag {
  font-weight: 700;
  letter-spacing: -0.01em;
}

.footer-contact {
  color: var(--text-dim);
  font-size: 13px;
}

.footer-cols {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 22px;
}

.footer-col h2 {
  margin: 0 0 6px;
  font-family: var(--font);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-mute);
}

.footer-col ul {
  list-style: none;
  display: grid;
  gap: 2px;
}

.footer-col a {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  color: var(--text-dim);
  font-size: 14px;
  text-decoration: none;
}

.footer-col a:hover {
  color: var(--accent);
}

.copyright {
  margin: 24px 0 0;
  padding-top: 18px;
  border-top: 1px solid var(--divider);
  color: var(--text-mute);
  font-size: 12px;
  line-height: 1.6;
}

/* ==========================================================================
   17. STATES
   ========================================================================== */

.empty-state {
  padding: 36px 18px;
  background: var(--card-2);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  color: var(--text-dim);
  text-align: center;
}

.empty-state h3 {
  margin: 0 0 6px;
  font-size: 16px;
  color: var(--text);
}

.empty-state p {
  margin: 0;
  font-size: 14px;
}

/* ==========================================================================
   18. HOME HERO & PAGE-SCOPE HOOKS
   ========================================================================== */

/* <section class="section hero"> on the home page. */
.hero {
  margin: 14px 0 26px;
}

.hero__copy {
  display: grid;
  gap: 10px;
}

.hero__eyebrow {
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.hero__title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: -0.03em;
}

.hero__text {
  max-width: 56ch;
  color: var(--text-dim);
  font-size: 15.5px;
  line-height: 1.62;
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 6px;
}

/* Contact page call to action (the mailto button). */
.contact-cta {
  margin: 22px 0 0;
  text-align: center;
}

.contact-cta .btn {
  width: 100%;
  max-width: 340px;
}

/* Legal / policy pages: a slightly wider measure for dense policy text. */.page-terms .prose,
.page-privacy .prose,
.page-cookies .prose,
.page-disclaimer .prose,
.page-contact .prose,
.page-about .prose,
.page-advertise .prose,
.page-editorial-policy .prose {
  max-width: 74ch;
}

/* <body class="page-{key}"> — page level hooks. */
.page-home .hero {
  margin-top: 10px;
}

.page-games .page-head {
  padding-top: 14px;
}

.page-category .prose--page-intro {
  margin-bottom: 20px;
}

.page-game .game-links {
  margin-top: 14px;
}

/* ==========================================================================
   19. RESPONSIVE — one layout for every screen size

   NorthFiveFun renders the same phone-width composition everywhere: a single
   centred column (--maxw) with one card per row, the search field on its own
   row under the brand, and the mobile type scale. There is deliberately NO
   wide-screen scale-up - a desktop visitor sees exactly what a phone sees,
   just centred on a larger canvas.
   ========================================================================== */

/* Only very narrow phones get a tighter type scale. */
@media (max-width: 359px) {
  .brand-name {
    font-size: 15px;
  }

  .header-inner {
    gap: 6px;
  }

  .header-actions {
    gap: 6px;
  }

  .game-stats {
    gap: 8px;
  }

  .toolbar__selects {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ==========================================================================
   20. MOTION, HOVER, PRINT
   ========================================================================== */

/* Lazy reveal — opt-in via [data-reveal]; main.js adds .is-revealed.
   Without scripting the content must never stay hidden. */
[data-reveal] {
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.45s ease, transform 0.45s ease;
}

[data-reveal].is-revealed {
  opacity: 1;
  transform: none;
}

@media (scripting: none) {
  [data-reveal] {
    opacity: 1;
    transform: none;
  }
}

@media (hover: hover) {
  .game-card:hover {
    transform: translateY(-3px);
    border-color: var(--accent-2-soft);
    box-shadow: var(--shadow-lg);
  }

  .game-card__title a:hover {
    color: var(--accent);
  }

  .btn:hover {
    border-color: var(--border-strong);
  }

  .btn--primary:hover {
    border-color: transparent;
  }

  .icon-btn:hover {
    border-color: var(--border-strong);
  }

  .page-btn:hover {
    border-color: var(--accent);
  }
}

/* Honour the OS "reduce motion" setting: no animation, no smooth scroll. */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    transition-delay: 0ms !important;
    scroll-behavior: auto !important;
  }
}

@media (prefers-contrast: more) {
  .game-card,
  .review,
  .stat,
  .ad-slot {
    border-width: 2px;
  }
}

@media print {
  .site-header,
  .drawer,
  .drawer-scrim,
  .ad-slot,
  .back-to-top,
  .chip-row {
    display: none !important;
  }

  body {
    background: #fff;
    color: #000;
  }
}
