/* Stop double-tap zoom on touch screens (pinch zoom still works). Set on html so it covers the whole page. */
html { touch-action: manipulation; }

/* Game hub home screen: one big tile per game, read from games.json. */

:root {
  --bg: #f6f5f2;
  --surface: #ffffff;
  --text: #1f2430;
  --muted: #5c6370;
  --link: #3451d1;
  --border: #e3e0d9;
  --shadow: 0 1px 2px rgba(30, 30, 40, .06), 0 6px 18px rgba(30, 30, 40, .08);
  --focus: #4a6cf7;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15181d; --surface: #1e2228; --text: #e8eaed; --muted: #9aa1ab; --border: #2e333b; --link: #7b93ff;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 18px rgba(0, 0, 0, .3); --focus: #7b93ff;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.4 var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  padding: max(20px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
}
[hidden] { display: none !important; }

.hub-head { display: flex; align-items: center; gap: 14px; max-width: 1100px; margin: 8px auto 24px; }
.hub-head img { border-radius: 12px; flex: none; }
.hub-head h1 { margin: 0; font-size: 26px; font-weight: 700; letter-spacing: -.01em; }
.hub-head p { margin: 2px 0 0; color: var(--muted); }
.hub-head > div { flex: 1; min-width: 0; }
.support {
  display: inline-flex; align-items: center; gap: 6px; flex: none;
  padding: 8px 14px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font-weight: 600; font-size: 15px; text-decoration: none;
}
.support svg { width: 18px; height: 18px; color: #ef6f6c; }
.support:hover { border-color: #ef6f6c; }
.support:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.support svg path[fill="#f2c14e"] { color: var(--text); }
.support + .support { margin-left: -6px; }
@media (max-width: 420px) {
  .support { padding: 9px; }
  .support span { display: none; }
}

/* Ideas page */
.idea { max-width: 560px; margin: 0 auto; text-align: center; }
.idea .big { font-size: 64px; line-height: 1; margin: 8px 0 4px; }
.idea h1 { margin: 8px 0; font-size: 28px; }
.idea p { color: var(--muted); margin: 8px 0; }
.idea ul { text-align: left; display: inline-block; color: var(--muted); margin: 8px 0 20px; padding-left: 22px; }
.idea .donate { background: #3757e0; font-size: 18px; padding: 14px 28px; }
.idea .addr { font-size: 14px; margin-top: 18px; }
.idea .addr a { color: inherit; }
/* Privacy page */
.doc { max-width: 680px; margin: 0 auto; line-height: 1.6; }
.doc h1 { margin: 8px 0 2px; font-size: 28px; }
.doc h2 { margin: 28px 0 6px; font-size: 19px; }
.doc p, .doc li { margin: 6px 0; }
.doc ul { padding-left: 22px; }
.doc .muted { color: var(--muted); margin-top: 0; }
.doc .lead { font-size: 17px; }
.doc a { color: var(--link); }

/* Footer links under the games */
.foot { margin: 28px 0 8px; text-align: center; font-size: 15px; color: var(--muted); }
.foot a { color: inherit; }
.foot a:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }

.back { display: inline-flex; align-items: center; gap: 6px; color: var(--text); text-decoration: none; font-weight: 600; margin-bottom: 12px; }

main { max-width: 1100px; margin: 0 auto; }
.filters { display: flex; flex-wrap: wrap; gap: 6px; margin: -6px 0 18px; }
.filters button {
  font: inherit; font-weight: 600; font-size: 15px; cursor: pointer; white-space: nowrap;
  padding: 8px 14px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text);
}
.filters button[aria-pressed="true"] { background: var(--text); color: var(--bg); border-color: var(--text); }
.filters button:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
/* Phones: one swipeable row instead of four rows of buttons. */
@media (max-width: 600px) {
  .filters {
    flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none;
    margin-left: -16px; margin-right: -16px; padding: 4px 16px;
    scroll-padding: 0 16px;
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 16px, #000 calc(100% - 28px), transparent);
            mask-image: linear-gradient(90deg, transparent, #000 16px, #000 calc(100% - 28px), transparent);
  }
  .filters::-webkit-scrollbar { display: none; }
  .filters button { flex: none; }
}
.tiles {
  list-style: none; margin: 0; padding: 0;
  display: grid; gap: 18px;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr));
}
.tile {
  display: flex; flex-direction: column; height: 100%;
  background: var(--surface); border: 1px solid var(--border); border-radius: 22px;
  box-shadow: var(--shadow); color: inherit; text-decoration: none; overflow: hidden;
  transition: transform .15s ease, box-shadow .15s ease;
}
.tile:hover { transform: translateY(-2px); }
.tile:active { transform: scale(.98); }
.tile:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.tile-art {
  aspect-ratio: 4 / 3; display: grid; place-items: center;
  background: var(--tile-color, #7b93ff);
}
.tile-art img { width: 46%; max-width: 160px; aspect-ratio: 1; border-radius: 24%; box-shadow: 0 6px 16px rgba(0, 0, 0, .18); }
.tile-text { padding: 14px 16px 18px; }
.tile-text h2 { margin: 0; font-size: 20px; font-weight: 700; }
.tile-text p { margin: 4px 0 0; color: var(--muted); font-size: 15px; }
.empty { color: var(--muted); text-align: center; margin-top: 48px; }

/* Small tiles: 3 across on a phone, picture and name only. */
.tiles.small { gap: 10px; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); }
.tiles.small .tile { border-radius: 16px; }
.tiles.small .tile-art { aspect-ratio: 1; }
.tiles.small .tile-art img { width: 62%; }
.tiles.small .tile-text { padding: 8px 8px 10px; text-align: center; }
.tiles.small .tile-text h2 { font-size: 14px; line-height: 1.2; }
.tiles.small .tile-text p { display: none; }
.tiles.small .tile-fav { top: 4px; right: 4px; width: 34px; height: 34px; }
.tiles.small .tile-fav svg { width: 19px; height: 19px; }
@media (min-width: 700px) { .tiles.small { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 14px; } }
.support { font-family: inherit; cursor: pointer; }
.support[id="size-toggle"] svg { color: var(--text); }

/* Favorites: a heart on each tile, and the Favorites filter button. */
.tiles > li { position: relative; }
.tile-fav {
  position: absolute; top: 10px; right: 10px; width: 44px; height: 44px; padding: 0;
  display: grid; place-items: center; cursor: pointer;
  border: 0; border-radius: 50%; background: rgba(255, 255, 255, .85); color: #1f2430;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .15);
}
.tile-fav svg { width: 24px; height: 24px; overflow: visible; }
.tile-fav path { fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; }
.tile-fav[aria-pressed="true"] path { fill: #ef4f6c; stroke: #ef4f6c; }
.tile-fav:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.tile-fav.pop svg { animation: fav-pop .35s ease; }
@keyframes fav-pop { 40% { transform: scale(1.35); } }
.fav-filter svg { width: 16px; height: 16px; vertical-align: -2px; }
.fav-filter path, .fav-empty path { fill: #ef4f6c; }
.fav-count:empty { display: none; }
.fav-count { font-weight: 500; opacity: .7; }
.fav-empty { color: var(--muted); text-align: center; margin: 24px 0; }
.fav-empty svg { width: 18px; height: 18px; vertical-align: -3px; }

@media (prefers-reduced-motion: reduce) { .tile { transition: none; } .tile-fav.pop svg { animation: none; } }

.note {
  margin: 32px auto 0; max-width: 560px; padding: 18px 20px; text-align: center;
  background: var(--surface); border: 1px solid var(--border); border-radius: 18px; color: var(--muted);
}
.note h2 { margin: 0 0 6px; font-size: 17px; color: var(--text); }
.note p { margin: 6px 0 0; font-size: 15px; }
.donate {
  display: inline-block; margin-top: 14px; padding: 10px 22px; border-radius: 999px;
  background: #d0403d; color: #fff; font-weight: 650; text-decoration: none;
}
.donate:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
