/* ---------- Fonts (hosted with the site, nothing loaded from third parties) ---------- */
@font-face { font-family: "Fredoka"; font-weight: 600; font-style: normal; font-display: swap; src: url("../fonts/fredoka-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Fredoka"; font-weight: 700; font-style: normal; font-display: swap; src: url("../fonts/fredoka-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Nunito"; font-weight: 400; font-style: normal; font-display: swap; src: url("../fonts/nunito-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Nunito"; font-weight: 700; font-style: normal; font-display: swap; src: url("../fonts/nunito-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Nunito"; font-weight: 800; font-style: normal; font-display: swap; src: url("../fonts/nunito-latin-800-normal.woff2") format("woff2"); }

:root {
  --night: #0e1a4a;
  --night-2: #13245f;
  --night-3: #1b3078;
  --line: rgba(160, 190, 255, 0.22);
  --sky: #1e88ff;
  --sky-light: #4fb3ff;
  --sun: #ffd23f;
  --sun-deep: #f5b400;
  --leaf: #5fd068;
  --bubble: #ff7eb6;
  --white: #ffffff;
  --mist: #c9d6ff;

  --font-display: "Fredoka", "Baloo 2", "Trebuchet MS", system-ui, sans-serif;
  --font-body: "Nunito", "Segoe UI", system-ui, -apple-system, sans-serif;

  --page: min(1320px, 100% - 2 * clamp(16px, 4vw, 48px));
  --cover-w: clamp(230px, 23vw, 340px);
  --radius-card: 18px;
  --radius-pill: 999px;
}

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

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

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.55;
  color: var(--white);
  background-color: var(--night);
  /* Starry sky */
  background-image:
    radial-gradient(2px 2px at 8% 12%, #fff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 22% 38%, #cfe0ff 50%, transparent 51%),
    radial-gradient(2px 2px at 41% 9%, #fff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 63% 27%, #cfe0ff 50%, transparent 51%),
    radial-gradient(2px 2px at 78% 14%, #fff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 91% 41%, #cfe0ff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 33% 66%, #cfe0ff 50%, transparent 51%),
    radial-gradient(2px 2px at 84% 72%, #fff 50%, transparent 51%),
    radial-gradient(1200px 600px at 50% -10%, #1d3a96 0%, transparent 70%);
  background-attachment: fixed;
}

main { flex: 1; }

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

a { color: inherit; }

:focus-visible {
  outline: 3px solid var(--sun);
  outline-offset: 3px;
  border-radius: 8px;
}

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---------- Header ---------- */
.site-header {
  width: var(--page);
  margin: 16px auto 0;
  min-height: 76px;
}

.nav-bar {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 10px 14px 10px 22px;
  background: rgba(19, 36, 95, 0.75);
  border: 1.5px solid var(--line);
  border-radius: 26px;
  backdrop-filter: blur(6px);
}

.logo {
  display: inline-flex;
  align-items: baseline;
  gap: 1px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.75rem;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  letter-spacing: -0.01em;
}
.logo-img { height: 46px; width: auto; display: block; }
.footer-inner .logo-img { height: 34px; }
.play-logo img { width: 34px; height: 34px; display: block; border-radius: 8px; }
.logo-rocket { font-size: 1.4rem; margin-right: 6px; transform: translateY(-2px); }
.logo-tech { color: var(--white); }
.logo-quik { color: var(--sun); }
.logo-kids {
  margin-left: 0.25em;
  background: linear-gradient(90deg, var(--sky-light), var(--leaf));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.nav-links {
  display: flex;
  gap: 6px;
  margin: 0 auto;
}

.nav-link {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.125rem;
  text-decoration: none;
  padding: 10px 22px;
  border-radius: var(--radius-pill);
  color: var(--white);
  transition: background-color 0.15s ease;
}
.nav-link:hover { background: rgba(255, 255, 255, 0.08); }
.nav-link.is-active {
  color: var(--night);
  background: linear-gradient(180deg, #ffe066, var(--sun));
  box-shadow: 0 4px 0 var(--sun-deep);
}

.parents-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  font-weight: 700;
  font-size: 0.95rem;
  text-decoration: none;
  color: var(--mist);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-pill);
  white-space: nowrap;
}
.parents-link svg { width: 22px; height: 22px; }
.parents-link:hover, .parents-link[aria-current="page"] { color: var(--white); border-color: var(--mist); }

/* ---------- Home: hero ---------- */
.hero {
  width: var(--page);
  margin: clamp(28px, 5vw, 56px) auto 0;
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  align-items: center;
  gap: clamp(24px, 4vw, 56px);
}

.hero h1 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(3rem, 7.2vw, 6rem);
  line-height: 0.95;
  letter-spacing: -0.02em;
  text-shadow: 0 6px 0 rgba(5, 12, 40, 0.45);
}
.hero h1 .line { display: block; }
.hero h1 .fun { color: var(--sun); }

.hero-sub {
  margin: 22px 0 32px;
  max-width: 34ch;
  font-size: clamp(1.1rem, 1.6vw, 1.3rem);
  color: var(--mist);
}

.btn-play {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px 16px 34px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.4rem, 2.4vw, 1.9rem);
  color: var(--night);
  text-decoration: none;
  background: linear-gradient(180deg, #ffe066, var(--sun));
  border-radius: var(--radius-pill);
  box-shadow: 0 6px 0 var(--sun-deep), 0 14px 30px rgba(255, 210, 63, 0.25);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.btn-play svg { width: 44px; height: 44px; }
.btn-play:hover { transform: translateY(-2px); }
.btn-play:active { transform: translateY(4px); box-shadow: 0 2px 0 var(--sun-deep); }

/* Fanned covers standing in for hero art */
.hero-fan {
  position: relative;
  height: clamp(300px, 34vw, 440px);
}
.hero-fan .cover {
  position: absolute;
  top: 50%;
  left: 50%;
  width: clamp(240px, 30vw, 420px);
  box-shadow: 0 24px 50px rgba(3, 8, 30, 0.55);
}
.hero-fan .fan-1 { transform: translate(-50%, -38%) rotate(-3deg); z-index: 3; }
.hero-fan .fan-2 { transform: translate(-72%, -100%) rotate(-9deg); z-index: 2; }
.hero-fan .fan-3 { transform: translate(-22%, -88%) rotate(7deg); z-index: 1; }
.hero-fan.count-1 .fan-1 { transform: translate(-50%, -50%) rotate(-3deg); }
.hero-fan[hidden] { display: none; }

.hero-art { width: 100%; height: auto; }

/* ---------- Home: feature cards ---------- */
.features {
  width: var(--page);
  margin: clamp(40px, 6vw, 72px) auto 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}
.feature {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 22px 24px;
  border-radius: 24px;
  border: 2px solid var(--glow);
  background: linear-gradient(135deg, color-mix(in srgb, var(--glow) 22%, transparent), rgba(14, 26, 74, 0.6));
  box-shadow: 0 0 18px color-mix(in srgb, var(--glow) 45%, transparent), inset 0 0 22px color-mix(in srgb, var(--glow) 12%, transparent);
}
.feature-icon { width: 72px; height: 72px; flex: none; filter: drop-shadow(0 6px 10px rgba(0,0,0,.35)); }
.feature h2 {
  margin: 0 0 2px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.5rem;
  line-height: 1.15;
  color: var(--white);
}
.feature p { margin: 0; font-size: 1rem; color: var(--glow-text); }
.feature-free { --glow: #2f8dff; --glow-text: #8fc4ff; }
.feature-safe { --glow: #2fcf7f; --glow-text: #9be8bf; }
.feature-new  { --glow: #b45cff; --glow-text: #d9b3ff; }

/* ---------- Home: space hero ---------- */
body.overlay-header .site-header {
  position: absolute;
  left: 0;
  right: 0;
  z-index: 10;
}
.space-hero {
  position: relative;
  min-height: clamp(420px, 44vw, 640px);
  display: grid;
  place-items: center;
  overflow: hidden;
  isolation: isolate;
}
.space-hero-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 40%;
  z-index: -2;
}
.space-hero::after {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 22%;
  background: linear-gradient(180deg, transparent, var(--night));
  z-index: -1;
}
.space-hero-content {
  text-align: center;
  padding: 110px 20px 70px;
}
.rainbow-title {
  margin: 0 0 26px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(2.6rem, 6.6vw, 6rem);
  line-height: 1;
  letter-spacing: -0.01em;
  -webkit-text-stroke: 8px #0b1440;
  paint-order: stroke fill;
  text-shadow: 0 6px 0 rgba(5, 10, 40, 0.6), 0 0 30px rgba(10, 20, 80, 0.6);
}
.w-yellow { color: var(--sun); }
.w-blue { color: #3fd0ff; }
.w-pink { color: #ff5fb8; }
.home-rows { margin-top: -10px; }

/* ---------- Inner pages: slim space banner ---------- */
.page-banner {
  position: relative;
  min-height: clamp(250px, 22vw, 340px);
  display: grid;
  place-items: center;
  overflow: hidden;
  isolation: isolate;
}
.page-banner-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center bottom;
  z-index: -2;
}
.page-banner::after {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 30%;
  background: linear-gradient(180deg, transparent, var(--night));
  z-index: -1;
}
.page-banner-content { text-align: center; padding: 104px 20px 34px; }
.page-title { font-size: clamp(2.2rem, 5vw, 4rem); margin-bottom: 8px; -webkit-text-stroke-width: 7px; }
.page-banner-content p {
  margin: 0;
  font-weight: 700;
  font-size: clamp(1rem, 1.6vw, 1.2rem);
  color: var(--mist);
  text-shadow: 0 2px 8px rgba(5, 10, 40, 0.9);
}
.page-banner + .age-toggle { margin-top: 0; }
.page-banner + .prose { margin-top: 8px; }
.page-banner + .fav-grid, .page-banner ~ .fav-empty { margin-top: 10px; }

/* ---------- A game's own page ---------- */
.game-detail {
  width: var(--page);
  margin: 10px auto 24px;
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: clamp(20px, 3vw, 40px);
  align-items: center;
}
.game-detail-cover img {
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 22px;
  box-shadow: 0 18px 40px rgba(3, 8, 30, 0.6);
  transition: transform 0.18s ease;
}
.game-detail-cover:hover img { transform: scale(1.02); }
.game-detail-desc { margin: 0 0 16px; font-size: 1.15rem; color: var(--white); }
.chips { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; padding: 0; margin: 0 0 22px; }
.chips li {
  padding: 5px 12px;
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--white);
  background: var(--night-3);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-pill);
}
.prose ol { padding-left: 1.4em; margin: 0; }
.prose ol li { color: var(--white); font-weight: 700; }
.prose ol li + li { margin-top: 6px; }
.az { width: var(--page); margin: 36px auto 0; }
.az .row-title { width: auto; }
.az-list { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.az-list a {
  display: inline-block;
  padding: 6px 14px;
  font-weight: 700;
  color: var(--mist);
  text-decoration: none;
  background: var(--night-2);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-pill);
}
.az-list a:hover { color: var(--white); border-color: var(--mist); }

/* ---------- Collection pages (e.g. Halloween) ---------- */
.collection-intro { width: var(--page); max-width: 760px; margin: 6px auto 26px; text-align: center; font-size: 1.12rem; color: var(--white); }
.collection-grid {
  list-style: none;
  padding: 0;
  width: var(--page);
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
  gap: 20px;
}
.collection-card { display: flex; flex-direction: column; gap: 10px; }
.collection-play img {
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: var(--radius-card);
  box-shadow: 0 12px 28px rgba(3, 8, 30, 0.5);
  transition: transform 0.18s ease;
}
.collection-play:hover img { transform: scale(1.03); }
.collection-name { font-family: var(--font-display); font-weight: 700; font-size: 1.2rem; color: var(--white); text-decoration: none; }
.collection-name:hover { color: var(--sun); }
.collection-more { width: var(--page); margin: 30px auto 0; text-align: center; font-weight: 800; }
.collection-more a { color: var(--sun); }
.part-of { margin: -6px 0 16px; font-weight: 700; color: var(--mist); }
.part-of a { color: var(--sun); }
.az-list a.az-collection { color: var(--sun); border-color: rgba(255, 210, 63, 0.5); }

/* ---------- Breadcrumbs, share, tips, similar ---------- */
.crumbs { width: var(--page); margin: 14px auto 4px; font-size: 0.92rem; font-weight: 700; color: var(--mist); }
.crumbs a { color: var(--mist); text-decoration: none; }
.crumbs a:hover { color: var(--white); text-decoration: underline; }
.crumbs [aria-current] { color: var(--white); }
.crumb-sep { margin: 0 4px; opacity: 0.7; }
.game-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; }
.btn-share {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 20px;
  font-family: var(--font-display); font-weight: 700; font-size: 1.1rem;
  color: var(--white); background: var(--night-3);
  border: 1.5px solid var(--line); border-radius: var(--radius-pill);
  cursor: pointer;
}
.btn-share svg { width: 22px; height: 22px; }
.btn-share:hover { border-color: var(--mist); }
.prose h3 { margin: 16px 0 4px; font-family: var(--font-display); font-weight: 700; font-size: 1.12rem; color: var(--white); }
.prose h3 + p { margin-top: 0; }
.shots { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.shots img { width: 100%; height: auto; border-radius: 14px; }
.similar { width: var(--page); margin: 10px auto 0; }
.similar .row-title { width: auto; }
.other-lists { width: var(--page); margin: 30px auto 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.other-lists a {
  padding: 8px 16px; font-weight: 800; color: var(--white); text-decoration: none;
  background: var(--night-2); border: 1.5px solid var(--line); border-radius: var(--radius-pill);
}
.other-lists a:hover { border-color: var(--mist); }
.static-games { margin-top: 24px; }

/* ---------- Parent guides ---------- */
.guide-title { font-size: clamp(1.7rem, 3.6vw, 2.8rem); max-width: 22ch; margin-left: auto; margin-right: auto; }
.guide .byline { color: var(--mist); font-size: 0.92rem; font-weight: 700; margin: 0 0 14px; }
.guide-body p, .guide-body li { color: #dbe4ff; line-height: 1.7; }
.guide-body h2 { margin-top: 26px; }
.guide-body ol, .guide-body ul { padding-left: 1.3em; margin: 0 0 12px; }
.guide-body li + li { margin-top: 6px; }
.guide-list { list-style: none; padding: 0; width: var(--page); max-width: 860px; margin: 0 auto; display: grid; gap: 14px; }
.guide-card a {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 16px;
  padding: 18px 22px;
  text-decoration: none;
  background: var(--night-2);
  border: 1.5px solid var(--line);
  border-radius: 20px;
}
.guide-card a:hover { border-color: var(--mist); }
.guide-emoji { grid-row: span 2; width: 56px; height: 56px; align-self: center; }
.guide-card-title { font-family: var(--font-display); font-weight: 700; font-size: 1.25rem; color: var(--white); }
.guide-card-desc { color: var(--mist); font-size: 0.98rem; }
.skills { columns: 2; column-gap: 28px; }
.skills li { break-inside: avoid; }

.inline-icon { display: inline-block; width: 1.3em; height: 1.3em; vertical-align: -0.3em; }
.title-icon { display: inline-block; width: 1em; height: 1em; vertical-align: -0.12em; filter: drop-shadow(0 4px 0 rgba(5, 10, 40, 0.5)); }
.az-list a .inline-icon, .other-lists a .inline-icon { margin-right: 2px; }

.collection-pic { position: relative; }
.collection-pic .collection-play { display: block; }
.collection-quickplay {
  position: absolute;
  right: 10px;
  bottom: 10px;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--sky);
  border: 3px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 4px 12px rgba(3, 8, 30, 0.5);
}
.collection-quickplay svg { width: 20px; height: 20px; fill: #fff; margin-left: 2px; }
.collection-quickplay:hover { transform: scale(1.1); }

/* ---------- Home = games hub ---------- */
.home-hub .space-hero { min-height: clamp(320px, 30vw, 460px); }
.home-hub .space-hero-content { padding: 96px 20px 44px; }
.home-hub .rainbow-title { font-size: clamp(2.4rem, 5.4vw, 4.8rem); margin-bottom: 18px; }
.home-games { scroll-margin-top: 12px; }
.home-games .type-filter { margin-top: 4px; }

/* ---------- Home: about text ---------- */
.home-about { width: var(--page); max-width: 820px; margin: 44px auto 0; text-align: center; }
.home-about h2 { font-family: var(--font-display); font-weight: 700; font-size: clamp(1.4rem, 2.6vw, 1.9rem); margin: 0 0 8px; }
.home-about p { margin: 0; color: var(--mist); }
.home-about a { color: var(--sun); font-weight: 700; }

/* ---------- Ad spots ---------- */
.ad-slot {
  width: var(--page);
  margin: 40px auto;
  text-align: center;
}
.ad-label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--mist);
  opacity: 0.8;
}
/* Until Google has actually filled the ad, the spot takes up no space at all
   (collapsed rather than hidden, so Google can still measure its width and load an ad) */
.ad-slot:not(:has(ins[data-ad-status="filled"])) {
  max-height: 0;
  overflow: hidden;
  margin-top: 0;
  margin-bottom: 0;
}
.ad-slot:not(:has(ins[data-ad-status="filled"])) .ad-label { visibility: hidden; }

/* ---------- Page headings (inner pages) ---------- */
.page-head {
  width: var(--page);
  margin: clamp(28px, 4vw, 44px) auto 0;
}
.page-head h1 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(2.2rem, 4.5vw, 3.2rem);
  line-height: 1.05;
}
.page-head p { margin: 8px 0 0; color: var(--mist); max-width: 60ch; }

/* ---------- Games: age toggle ---------- */
.age-toggle {
  display: flex;
  width: max-content;
  max-width: 100%;
  margin: 22px auto 0;
  padding: 6px;
  gap: 4px;
  background: rgba(19, 36, 95, 0.8);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-pill);
}
.age-toggle button {
  font: inherit;
  font-weight: 700;
  font-size: 1rem;
  color: var(--white);
  background: transparent;
  border: 0;
  padding: 9px 26px;
  border-radius: var(--radius-pill);
  cursor: pointer;
}
.age-toggle button:hover { background: rgba(255, 255, 255, 0.08); }
.age-toggle button[aria-pressed="true"] { background: var(--white); color: var(--night); }

/* ---------- Games: type filter ---------- */
.type-filter {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  width: var(--page);
  margin: 0 auto;
}
.type-filter button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.02rem;
  color: var(--white);
  background: rgba(19, 36, 95, 0.85);
  border: 1.5px solid var(--line);
  padding: 8px 18px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  white-space: nowrap;
}
.type-filter button img { width: 22px; height: 22px; }
.type-filter button:hover { border-color: var(--mist); }
.type-filter button[aria-pressed="true"] {
  color: var(--night);
  background: linear-gradient(180deg, #ffe066, var(--sun));
  border-color: transparent;
  box-shadow: 0 3px 0 var(--sun-deep);
}
.type-grid { margin-top: 24px; }

/* ---------- Games: rows ---------- */
.rows { margin-top: 10px; padding-bottom: 20px; }

.game-row { margin-top: clamp(18px, 3vw, 30px); }

.row-title {
  width: var(--page);
  margin: 0 auto 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.4rem, 2.4vw, 1.9rem);
  line-height: 1.1;
}
.row-icon img { width: 1.5em; height: 1.5em; display: block; }
.row-emoji { font-size: 1.3em; line-height: 1; }
.row-more {
  margin-left: auto;
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--sun);
  text-decoration: none;
  padding: 4px 12px;
  border: 1.5px solid rgba(255, 210, 63, 0.5);
  border-radius: var(--radius-pill);
}
.row-more:hover { background: rgba(255, 210, 63, 0.12); }
.filter-emoji { font-size: 1.15em; line-height: 1; }
.type-filter button.is-collection:not([aria-pressed="true"]) { border-color: rgba(255, 150, 60, 0.7); box-shadow: 0 0 12px rgba(255, 140, 40, 0.35); }

.row-wrap { position: relative; }

.row-track {
  display: flex;
  gap: clamp(12px, 1.4vw, 18px);
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-padding-left: calc((100% - var(--page)) / 2);
  padding: 10px calc((100% - var(--page)) / 2) 18px;
  scrollbar-width: none;
}
.row-track::-webkit-scrollbar { display: none; }
.row-track .cover { flex: none; width: var(--cover-w); scroll-snap-align: start; }

.row-arrow {
  position: absolute;
  top: 10px;
  bottom: 18px;
  width: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  color: var(--white);
  cursor: pointer;
  z-index: 5;
}
.row-arrow svg { width: 30px; height: 30px; filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5)); }
.row-prev { left: 0; background: linear-gradient(90deg, rgba(14, 26, 74, 0.95), transparent); }
.row-next { right: 0; background: linear-gradient(270deg, rgba(14, 26, 74, 0.95), transparent); }
.row-arrow[hidden] { display: none; }

.empty-note {
  width: var(--page);
  margin: 40px auto;
  font-size: 1.15rem;
  color: var(--mist);
}

/* ---------- Cover card ---------- */
.cover {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius-card);
  overflow: hidden;
  background: linear-gradient(160deg, var(--c1, #38b6ff), var(--c2, #1f4fd8));
  box-shadow: 0 10px 24px rgba(3, 8, 30, 0.45);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.cover::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  border: 3px solid transparent;
  pointer-events: none;
  transition: border-color 0.18s ease;
}
.row-track .cover:hover,
.row-track .cover:focus-within,
.fav-grid .cover:hover,
.fav-grid .cover:focus-within {
  transform: scale(1.04);
  box-shadow: 0 18px 36px rgba(3, 8, 30, 0.6);
  z-index: 2;
}
.cover:hover::after, .cover:focus-within::after { border-color: rgba(255, 255, 255, 0.9); }

.cover-art {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 7% 6% 6%;
  text-align: center;
}
.cover-art img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cover-art.has-image { justify-content: flex-end; }
.cover-art.with-title::before {
  content: "";
  position: absolute;
  inset: 45% 0 0;
  background: linear-gradient(180deg, transparent, rgba(10, 18, 60, 0.85));
  z-index: 1;
}
.cover-art.with-title .cover-title { position: relative; z-index: 2; }

.cover-icon {
  font-size: calc(var(--cover-w) * 0.2);
  line-height: 1;
  filter: drop-shadow(0 8px 10px rgba(0, 0, 0, 0.3));
}
.hero-fan .cover-icon { font-size: clamp(48px, 5vw, 76px); }
.hero-fan .cover-badge { display: none; }

.cover-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.15rem, 1.9vw, 1.65rem);
  line-height: 1;
  color: var(--white);
  -webkit-text-stroke: 5px rgba(10, 18, 60, 0.85);
  paint-order: stroke fill;
  text-shadow: 0 4px 0 rgba(10, 18, 60, 0.5);
}

.cover-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  padding: 3px 10px;
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--night);
  background: rgba(255, 255, 255, 0.92);
  border-radius: var(--radius-pill);
}

.cover-link {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding-top: 0;
  border-radius: inherit;
}
.cover-link:focus-visible { outline-offset: -4px; }

.cover-play {
  z-index: 3;
  position: absolute;
  right: 10px;
  bottom: 10px;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--tone, var(--sky));
  border: 3px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 4px 12px rgba(3, 8, 30, 0.5);
  transition: transform 0.15s ease;
}
.cover-play svg { width: 20px; height: 20px; fill: #fff; margin-left: 2px; }
.cover:hover .cover-play, .cover-play:focus-visible { transform: scale(1.12); }
.cover-play:focus-visible { outline: 3px solid var(--sun); outline-offset: 2px; }
.tone-0 { --tone: #1e88ff; }
.tone-1 { --tone: #2fbf4f; }
.tone-2 { --tone: #ff4fa3; }
.tone-3 { --tone: #8c5cff; }

.fav-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 3;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(10, 18, 60, 0.55);
  cursor: pointer;
}
.fav-btn svg { width: 22px; height: 22px; fill: transparent; stroke: #fff; stroke-width: 2; }
.fav-btn[aria-pressed="true"] svg { fill: var(--bubble); stroke: var(--bubble); }
.fav-btn:hover { background: rgba(10, 18, 60, 0.8); }
.fav-btn.pop svg { animation: pop 0.3s ease; }
@keyframes pop { 50% { transform: scale(1.35); } }

/* ---------- Favourites page ---------- */
.fav-grid {
  width: var(--page);
  margin: 28px auto 40px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(var(--cover-w), 1fr));
  gap: 18px;
}
.fav-empty {
  width: var(--page);
  margin: 36px auto 60px;
  padding: 36px;
  text-align: center;
  background: var(--night-2);
  border: 1.5px dashed var(--line);
  border-radius: 24px;
}
.fav-empty .big { width: 84px; height: 84px; margin: 0 auto; display: block; }
.fav-empty h2 { font-family: var(--font-display); font-size: 1.6rem; margin: 12px 0 6px; }
.fav-empty p { margin: 0 auto 22px; color: var(--mist); max-width: 40ch; }
.fav-empty .btn-play { font-size: 1.3rem; padding: 12px 14px 12px 26px; }
.fav-empty .btn-play svg { width: 34px; height: 34px; }

/* ---------- Text pages (About, Parents) ---------- */
.prose {
  width: var(--page);
  margin: 24px auto 60px;
}
.prose section {
  max-width: 72ch;
  margin-left: auto;
  margin-right: auto;
  padding: 26px 30px;
  margin-bottom: 18px;
  background: var(--night-2);
  border: 1.5px solid var(--line);
  border-radius: 22px;
}
.prose h2 {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.5rem;
  color: var(--sun);
}
.prose p, .prose li { color: var(--mist); }
.prose p:last-child { margin-bottom: 0; }
.prose ul { padding-left: 1.2em; margin: 0; }
.prose li + li { margin-top: 6px; }
.prose a { color: var(--sky-light); }
.prose strong { color: var(--white); }
.prose .kid-box { border: 2px solid var(--sun); background: linear-gradient(135deg, rgba(255, 210, 63, 0.14), var(--night-2)); }
.prose .kid-box li { color: var(--white); font-weight: 700; }

/* ---------- Play page ---------- */
.play-page {
  height: 100vh;
  height: 100dvh;
  height: var(--app-height, 100dvh);
  min-height: 0;
  overflow: hidden;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  box-sizing: border-box;
}
.play-page .play-bar { padding-left: max(12px, env(safe-area-inset-left)); padding-right: max(12px, env(safe-area-inset-right)); }
.play-fs {
  flex: none;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  color: var(--white);
  background: var(--night-3);
  border: 1.5px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
}
.play-fs[hidden] { display: none; }
.play-fs svg { width: 22px; height: 22px; }
.play-fs .fs-off, .play-fs.is-on .fs-on { display: none; }
.play-fs.is-on .fs-off { display: block; }

.play-bar {
  flex: none;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  padding-top: max(8px, env(safe-area-inset-top));
  background: var(--night-2);
  border-bottom: 1.5px solid var(--line);
}
.play-back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 7px 16px 7px 10px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--night);
  text-decoration: none;
  background: var(--sun);
  border-radius: var(--radius-pill);
  box-shadow: 0 3px 0 var(--sun-deep);
}
.play-back svg { width: 20px; height: 20px; }
.play-title {
  flex: 1;
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.3rem;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.play-logo { font-size: 1.4rem; padding: 4px 8px; }
.play-stage { flex: 1; min-height: 0; display: flex; position: relative; }
.play-frame { flex: 1; width: 100%; border: 0; background: var(--night); transition: opacity 0.35s ease; }
.play-frame.is-loading { opacity: 0; }
/* Short screens (tablets and phones held sideways): slimmer bar, more room for the game */
@media (max-height: 560px) {
  .play-bar { padding-top: max(4px, env(safe-area-inset-top)); padding-bottom: 4px; }
  .play-back { padding: 4px 12px 4px 8px; font-size: 0.95rem; }
  .play-title { font-size: 1.05rem; }
  .play-fs { width: 34px; height: 34px; }
  .play-logo img { width: 28px; height: 28px; }
}

/* Loading screen shown over the game until it has finished loading */
.play-loader {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: var(--night);
  transition: opacity 0.4s ease;
}
.play-loader.is-done { opacity: 0; pointer-events: none; }
.play-loader-bg {
  position: absolute;
  inset: -40px;
  width: calc(100% + 80px);
  height: calc(100% + 80px);
  object-fit: cover;
  filter: blur(28px) brightness(0.45) saturate(1.2);
}
.play-loader-box { position: relative; width: min(420px, 86%); text-align: center; }
.play-loader-cover {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 20px;
  box-shadow: 0 18px 44px rgba(3, 8, 30, 0.6);
}
.play-loader-title {
  margin: 18px 0 14px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.5rem, 5vw, 2rem);
  color: var(--white);
  text-shadow: 0 3px 0 rgba(5, 10, 40, 0.6);
}
.play-loader-bar {
  height: 12px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.18);
  overflow: hidden;
}
.play-loader-bar span {
  display: block;
  width: 40%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--sun), #ff7eb6, var(--sky-light));
  animation: loadbar 1.2s ease-in-out infinite;
}
@keyframes loadbar { 0% { transform: translateX(-110%); } 100% { transform: translateX(260%); } }
.play-loader-text { margin: 12px 0 0; font-weight: 700; color: var(--mist); }

/* ---------- Footer ---------- */
.site-footer {
  margin-top: clamp(40px, 6vw, 70px);
  border-top: 1.5px solid var(--line);
}
.footer-inner {
  width: var(--page);
  margin: 0 auto;
  padding: 22px 0 28px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px 32px;
}
.footer-inner .logo { font-size: 1.3rem; }
.footer-links { display: flex; flex-wrap: wrap; gap: 6px 26px; margin: 0 auto; }
.footer-links a { text-decoration: none; color: var(--mist); font-weight: 700; }
.footer-links a:hover { color: var(--white); text-decoration: underline; }
.footer-copy { margin: 0; flex-basis: 100%; text-align: center; font-size: 0.85rem; color: var(--mist); }

/* ---------- Phone tab bar (hidden on bigger screens) ---------- */
.tab-bar { display: none; }

/* ---------- Smaller screens ---------- */
@media (max-width: 1020px) {
  .nav-bar { flex-wrap: wrap; row-gap: 10px; }
  .nav-links { order: 3; width: 100%; margin: 0; justify-content: center; }
  .parents-link { margin-left: auto; }
  .features { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .site-header { margin-top: 10px; }
  .nav-bar { padding: 10px 12px; border-radius: 20px; }
  .logo { font-size: 1.4rem; }
  .logo-img { height: 34px; }
  .parents-link span { display: none; }
  .parents-link { padding: 8px; }
  .nav-links { overflow-x: auto; justify-content: flex-start; scrollbar-width: none; }
  .nav-links { justify-content: space-between; gap: 2px; }
  .nav-link { padding: 8px 12px; font-size: 0.98rem; }
  .cover-badge { top: 8px; left: 8px; padding: 2px 8px; font-size: 0.66rem; }
  .fav-btn { width: 32px; height: 32px; top: 6px; right: 6px; }
  .fav-btn svg { width: 18px; height: 18px; }
  .hero { grid-template-columns: 1fr; text-align: left; }
  .space-hero { min-height: 460px; }
  .space-hero-img { object-position: 16% 40%; }
  .space-hero-content { padding-top: 140px; }
  .page-banner { min-height: 280px; }
  .page-banner-content { padding-top: 136px; }
  .hero-fan { height: 300px; }
  .hero-fan .cover { width: 240px; }
  .age-toggle button { padding: 8px 16px; }
  .row-arrow { display: none; }
  .footer-links { margin: 0; }
}

/* ---------- Phones ---------- */
@media (max-width: 760px) {
  :root { --cover-w: min(78vw, 340px); }

  /* Slim top bar: logo + parents button; main menu moves to the bottom */
  .site-header { min-height: 0; margin-top: 8px; }
  .nav-bar { padding: 8px 8px 8px 14px; gap: 10px; border-radius: 18px; flex-wrap: nowrap; }
  .nav-links { display: none; }
  .logo-img { height: 30px; }
  .parents-link { display: none; }  /* Parents is in the bottom tab bar on phones */
  .nav-bar { justify-content: center; }

  .tab-bar {
    position: fixed;
    left: 8px;
    right: 8px;
    bottom: calc(8px + env(safe-area-inset-bottom, 0px));
    z-index: 50;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
    padding: 6px;
    background: rgba(19, 36, 95, 0.92);
    border: 1.5px solid var(--line);
    border-radius: 22px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 10px 30px rgba(3, 8, 30, 0.6);
  }
  .tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 6px 2px 5px;
    border-radius: 16px;
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 0.78rem;
    line-height: 1.1;
    color: var(--mist);
    text-decoration: none;
  }
  .tab img { width: 28px; height: 28px; }
  .tab.is-active { background: linear-gradient(180deg, #ffe066, var(--sun)); color: var(--night); }
  body.has-tab-bar { padding-bottom: calc(90px + env(safe-area-inset-bottom, 0px)); }

  /* Homepage hero */
  .home-hub .space-hero { min-height: 330px; }
  .home-hub .space-hero-content { padding: 76px 16px 34px; }
  .space-hero { min-height: 400px; }
  .space-hero-content { padding: 84px 16px 56px; }
  .rainbow-title { font-size: clamp(2.6rem, 12vw, 3.4rem); -webkit-text-stroke-width: 7px; margin-bottom: 22px; }
  .btn-play { font-size: 1.4rem; padding: 12px 14px 12px 26px; }
  .btn-play svg { width: 38px; height: 38px; }

  /* Inner page banners */
  .page-banner { min-height: 210px; }
  .page-banner-img { object-position: 8% bottom; }
  .page-banner-content { padding: 78px 16px 26px; }
  .page-title { font-size: clamp(2rem, 10vw, 2.6rem); -webkit-text-stroke-width: 6px; }
  .page-banner-content p { font-size: 0.95rem; }

  /* Game rows: one big card with the next one peeking in */
  .game-row { margin-top: 16px; }
  .row-title { font-size: 1.35rem; margin-bottom: 6px; }
  .row-track { gap: 12px; }
  .cover-play { width: 40px; height: 40px; }

  /* Type filter: one swipeable line */
  .type-filter { flex-wrap: nowrap; justify-content: flex-start; overflow-x: auto; width: 100%; padding: 2px 16px 6px; scrollbar-width: none; }
  .type-filter::-webkit-scrollbar { display: none; }
  .type-filter button { flex: none; font-size: 0.95rem; padding: 7px 14px; }

  /* Similar games: two small cards per row on phones */
  .similar .collection-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .similar .collection-name { font-size: 0.95rem; }
  .btn-share { padding: 10px 16px; font-size: 1rem; }

  .skills { columns: 1; }

  /* A game's own page */
  .game-detail { grid-template-columns: 1fr; }
  .game-detail-desc { font-size: 1.02rem; }

  /* Feature cards: three compact tiles in a row */
  .features { grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 26px; }
  .feature { flex-direction: column; text-align: center; gap: 6px; padding: 14px 6px; border-radius: 18px; }
  .feature-icon { width: 46px; height: 46px; }
  .feature h2 { font-size: 0.95rem; }
  .feature p { display: none; }

  /* Text pages */
  .prose section { padding: 20px 18px; border-radius: 18px; }
  .prose h2 { font-size: 1.3rem; }
  .fav-empty { padding: 26px 18px; }

  /* Footer */
  .site-footer { margin-top: 32px; }
  .footer-inner { flex-direction: column; text-align: center; gap: 12px; }
  .footer-links { justify-content: center; gap: 6px 14px; font-size: 0.92rem; }
  .footer-copy { font-size: 0.78rem; }
}

@media (max-width: 360px) {
  .feature h2 { font-size: 0.85rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
  .row-track { scroll-behavior: auto; }
}
