/* mini zoo — one stylesheet for the whole site. Tokens first, then layout. */

:root {
  --bg: #f7f5f0;
  --surface: #ffffff;
  --text: #1c1a17;
  --muted: #6b6560;
  --dim: #8a837a;
  --border: #e4dfd6;
  --subtle: #efebe3;
  --field: #fbfaf7;
  --dash: #c9c2b6;
  --accent: #c2410c;
  --accent-ink: #ffffff;
  --link: #b45309;
  --link-hover: #92400e;
  --shadow: 0 8px 24px rgba(28, 26, 23, 0.12);

  --head: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --body: Manrope, "Segoe UI", system-ui, sans-serif;
  --maxw: 1200px;
  --radius: 10px;
}

/* Dark is true black so OLED phones can switch pixels off. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #000000; --surface: #141210; --text: #ece8e1; --muted: #9a938a;
    --dim: #8a837a; --border: #2a2723; --subtle: #1a1815; --field: #1a1815;
    --dash: #3a3631; --accent: #e8622a; --link: #f0a26b; --link-hover: #f5b98b;
    --shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
  }
}
[data-theme="dark"] {
  --bg: #000000; --surface: #141210; --text: #ece8e1; --muted: #9a938a;
  --dim: #8a837a; --border: #2a2723; --subtle: #1a1815; --field: #1a1815;
  --dash: #3a3631; --accent: #e8622a; --link: #f0a26b; --link-hover: #f5b98b;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

h1, h2, h3 { font-family: var(--head); letter-spacing: -0.01em; margin: 0; }
h1 { font-size: 44px; font-weight: 800; line-height: 1.1; }
h2 { font-size: 26px; font-weight: 700; }
h3 { font-size: 17px; font-weight: 700; }
p { margin: 0; }
a { color: var(--link); text-decoration: none; }
a:hover { color: var(--link-hover); text-decoration: underline; }
ol, ul { margin: 0; padding-left: 22px; display: flex; flex-direction: column; gap: 6px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* Header ------------------------------------------------------------------ */

.site-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 20px; height: 64px; padding: 0 40px;
  border-bottom: 1px solid var(--border); background: var(--surface);
}
.brand {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--head); font-weight: 800; font-size: 20px; color: var(--text);
}
.brand:hover { text-decoration: none; color: var(--text); }
.header-right { display: flex; align-items: center; gap: 24px; }
.nav { display: flex; gap: 28px; font-weight: 600; font-size: 15px; }
.nav a { color: var(--text); }
.nav a[aria-current="page"] { color: var(--accent); }
.icon-btn {
  width: 44px; height: 44px; display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border); border-radius: 999px; background: var(--surface);
  color: var(--text); cursor: pointer; padding: 0;
}
.icon-btn:hover { border-color: var(--text); }
.nav-toggle { display: none; }

/* Layout ------------------------------------------------------------------ */

.wrap { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 40px; }
main { flex-grow: 1; }
.columns { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 32px; padding: 28px 0 48px; }
.col-main { grid-column: span 8; display: flex; flex-direction: column; gap: 28px; }
.col-side { grid-column: span 4; display: flex; flex-direction: column; gap: 28px; padding-top: 44px; }
.stack { display: flex; flex-direction: column; gap: 28px; }
.tight { display: flex; flex-direction: column; gap: 14px; }
.crumbs { display: flex; gap: 8px; font-size: 13px; color: var(--muted); }
.crumbs a { color: var(--muted); }
.lede { font-size: 18px; color: var(--muted); }
.hero { display: flex; flex-direction: column; align-items: center; gap: 16px; padding: 56px 0 32px; text-align: center; }
.hero h1 { font-size: 52px; max-width: 760px; }
.hero .lede { max-width: 600px; }

/* Cards and controls ------------------------------------------------------ */

.card { border: 1px solid var(--border); border-radius: 12px; background: var(--surface); padding: 32px; }
.grid { display: grid; gap: 20px; }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.tile {
  display: flex; flex-direction: column; gap: 12px; padding: 22px;
  border: 1px solid var(--border); border-radius: 12px; background: var(--surface); color: var(--text);
}
.tile:hover { border-color: var(--text); text-decoration: none; color: var(--text); }
.tile strong { font-family: var(--head); font-weight: 700; font-size: 18px; }
.tile span { font-size: 14px; color: var(--muted); }
.tile svg { color: var(--accent); }

.btn {
  height: 44px; padding: 0 18px; display: inline-flex; align-items: center; justify-content: center;
  gap: 8px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface);
  color: var(--text); font-family: var(--body); font-weight: 700; font-size: 15px; cursor: pointer;
}
.btn:hover { border-color: var(--text); text-decoration: none; color: var(--text); }
.btn-primary {
  border: 0; background: var(--accent); color: var(--accent-ink);
  font-family: var(--head); font-weight: 800;
}
.btn-primary:hover { color: var(--accent-ink); filter: brightness(1.06); }
.btn-big { height: 56px; padding: 0 40px; font-size: 20px; }
.btn-block { width: 100%; }

input[type="text"], input[type="number"], textarea, select {
  font-family: var(--body); font-size: 16px; color: var(--text);
  background: var(--surface); border: 1px solid var(--dash); border-radius: 8px;
  padding: 10px 12px; width: 100%;
}
input[type="text"], input[type="number"], select { height: 44px; padding: 0 12px; }
textarea { min-height: 160px; resize: vertical; line-height: 1.6; }
label { font-size: 13px; font-weight: 600; color: var(--muted); }
.field { display: flex; flex-direction: column; gap: 6px; }
.row { display: flex; gap: 8px; align-items: center; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 8px 14px; border: 1px solid var(--border); border-radius: 999px;
  background: var(--surface); color: var(--text); font-weight: 600; font-size: 14px; cursor: pointer;
}
.chip:hover { border-color: var(--text); text-decoration: none; color: var(--text); }
.chip[aria-pressed="true"], .chip.on { border: 2px solid var(--text); }
.pill-list { display: flex; flex-direction: column; gap: 8px; }
.pill {
  display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 6px 12px;
  border: 1px solid var(--border); border-radius: 8px; background: var(--field);
}
.pill .grow { flex-grow: 1; }
.pill .x { border: 0; background: none; color: var(--dim); font-size: 20px; line-height: 1; cursor: pointer; padding: 0 6px; }
.pill .x:hover { color: var(--text); }
.swatch { width: 12px; height: 12px; border-radius: 3px; flex-shrink: 0; }

.result-line { font-size: 13px; color: var(--dim); }
.result-line strong { color: var(--text); }
.big-result {
  font-family: var(--head); font-weight: 800; font-size: 44px; line-height: 1.1;
  text-align: center; word-break: break-word;
}
.muted { color: var(--muted); font-size: 14px; }
.list-box { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); overflow: hidden; }
.list-box > * { display: flex; justify-content: space-between; align-items: center; min-height: 44px; padding: 8px 14px; border-bottom: 1px solid var(--subtle); font-size: 14px; }
.list-box > *:last-child { border-bottom: 0; }

.side-links { display: flex; flex-direction: column; gap: 6px; }
.side-links a {
  display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 8px 12px;
  border: 1px solid var(--border); border-radius: 8px; background: var(--surface);
  color: var(--text); font-weight: 600; font-size: 14px;
}
.side-links a:hover { border-color: var(--text); text-decoration: none; color: var(--text); }
.side-links svg { color: var(--accent); flex-shrink: 0; }

/* Ads --------------------------------------------------------------------- */

/* Ads.
   Every slot reserves its height before anything loads: an ad that arrives and
   pushes the page down is a layout shift, and Google measures those.
   The margin is deliberate too. An ad hard against a button collects mis-taps,
   which is an invalid-traffic problem, not a revenue one. */
.ad {
  display: flex; justify-content: center;
  margin: 28px 0;
  /* Nothing interactive should sit within a thumb's width of a unit. */
  padding: 4px 0;
}
.ad::before {
  content: "";
}
.ad-slot {
  display: flex; align-items: center; justify-content: center;
  border: 1px dashed var(--dash); background: var(--subtle); color: var(--dim);
  font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; width: 100%;
}
.ad-leaderboard .ad-slot, .ad-leaderboard ins { max-width: 728px; min-height: 90px; }
.ad-billboard .ad-slot, .ad-billboard ins { max-width: 970px; min-height: 250px; }
.ad-inarticle .ad-slot, .ad-inarticle ins { min-height: 120px; }
.ad-rect .ad-slot, .ad-rect ins { max-width: 300px; min-height: 250px; }
.ad-skyscraper .ad-slot, .ad-skyscraper ins { max-width: 300px; min-height: 600px; }
.ad-mobile .ad-slot, .ad-mobile ins { max-width: 320px; min-height: 100px; }
.ad-slot { height: 100%; }
.ad ins { display: block; width: 100%; }

/* On a phone the leaderboard is a smaller unit; the label should not claim
   otherwise. */
@media (max-width: 780px) {
  .ad-leaderboard .ad-slot, .ad-leaderboard ins { min-height: 100px; }
  .ad-billboard .ad-slot, .ad-billboard ins { min-height: 250px; }
}

/* Recent, popular, consent ------------------------------------------------ */

.recent { display: flex; justify-content: center; padding-bottom: 32px; }
.recent-inner {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px 10px 18px;
  border: 1px solid var(--border); border-radius: 999px; background: var(--surface);
  flex-wrap: wrap; justify-content: center;
}
.recent-inner span { font-size: 13px; font-weight: 600; color: var(--muted); }
.recent-inner a {
  display: flex; align-items: center; min-height: 36px; padding: 4px 14px;
  border-radius: 999px; background: var(--subtle); color: var(--text);
  font-weight: 600; font-size: 14px;
}
.recent-inner a:hover { text-decoration: none; background: var(--border); color: var(--text); }

.popular { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 32px; }
.popular > div:first-child { grid-column: span 4; display: flex; flex-direction: column; gap: 8px; }
.popular ol { grid-column: span 8; margin: 0; padding: 0; list-style: none; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 24px; }
.popular li { display: flex; align-items: center; gap: 12px; min-height: 44px; border-bottom: 1px solid var(--subtle); }
.popular li b { width: 24px; font-family: var(--head); font-weight: 800; color: var(--accent); }
.popular li a { color: var(--text); font-weight: 600; }

.consent {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  width: min(720px, calc(100vw - 32px)); display: flex; align-items: center; gap: 20px;
  padding: 16px 20px 16px 24px; border: 1px solid var(--text); border-radius: 12px;
  background: var(--surface); box-shadow: var(--shadow); z-index: 50;
}
.consent svg { color: var(--accent); flex-shrink: 0; }
.consent div { display: flex; flex-direction: column; gap: 2px; flex-grow: 1; }
.consent strong { font-size: 15px; }
.consent p { font-size: 14px; color: var(--muted); }
.consent .row { flex-shrink: 0; }

/* Article and FAQ --------------------------------------------------------- */

.prose { font-size: 17px; color: var(--text); display: flex; flex-direction: column; gap: 24px; }
.prose h2 { font-size: 28px; }
.faq { display: flex; flex-direction: column; gap: 16px; }
.faq > div { display: flex; flex-direction: column; gap: 4px; }
.facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; padding: 18px 20px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.facts > div { display: flex; flex-direction: column; gap: 2px; }
.facts span { font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }

/* Footer ------------------------------------------------------------------ */

.site-footer {
  margin-top: auto; border-top: 1px solid var(--border); background: var(--surface);
  padding: 28px 40px; display: flex; justify-content: space-between; align-items: center;
  gap: 16px; font-size: 13px; color: var(--muted); flex-wrap: wrap;
}
.site-footer a { color: var(--muted); }

/* Phones ------------------------------------------------------------------ */

@media (max-width: 900px) {
  h1 { font-size: 32px; }
  h2 { font-size: 22px; }
  .hero { padding: 32px 0 24px; }
  .hero h1 { font-size: 36px; }
  .site-header { padding: 0 16px; height: 56px; gap: 8px; }
  .wrap { padding: 0 16px; }
  .columns { grid-template-columns: 1fr; gap: 24px; padding: 16px 0 32px; }
  .col-main, .col-side { grid-column: auto; padding-top: 0; }
  .card { padding: 20px 16px; }
  .grid-4, .grid-3, .grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .popular { grid-template-columns: 1fr; gap: 16px; }
  .popular > div:first-child, .popular ol { grid-column: auto; }
  .popular ol { grid-template-columns: 1fr; }
  .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .nav { display: none; }
  .nav.open {
    display: flex; flex-direction: column; gap: 0; position: absolute; top: 56px; left: 0; right: 0;
    background: var(--surface); border-bottom: 1px solid var(--border); padding: 8px 16px; z-index: 40;
  }
  .nav.open a { display: flex; align-items: center; min-height: 48px; }
  .nav-toggle { display: flex; }
  .site-header { position: relative; }
  .consent { flex-direction: column; align-items: flex-start; gap: 12px; bottom: 12px; }
  .consent .row { width: 100%; }
  .consent .row .btn { flex-grow: 1; }
  .site-footer { flex-direction: column; align-items: flex-start; padding: 20px 16px; }
}

@media (max-width: 460px) {
  .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; }
}

@media print {
  .site-header, .site-footer, .ad, .consent, .recent, .no-print { display: none !important; }
  body { background: #fff; color: #000; }
}

/* Rules library ------------------------------------------------------------ */

.searchfield {
  flex-grow: 1; height: 56px; display: flex; align-items: center; gap: 12px;
  padding: 0 18px; border: 2px solid var(--text); border-radius: 12px; background: var(--surface);
}
.searchfield svg { color: var(--muted); flex-shrink: 0; }
.searchfield input {
  border: 0; background: none; padding: 0; height: auto; font-size: 17px; width: 100%;
}
.searchfield input:focus { outline: none; }
.searchfield:focus-within { box-shadow: 0 0 0 3px var(--subtle); }

.answer {
  display: flex; flex-direction: column; gap: 10px; padding: 18px 20px;
  border: 2px solid var(--text); border-radius: 12px; background: var(--surface); color: var(--text);
}
.answer:hover { text-decoration: none; color: var(--text); }
.answer .where { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--accent); font-weight: 700; }
.answer h3 { font-size: 22px; }
.answer p { font-size: 15px; color: var(--text); }

.hit {
  display: flex; flex-direction: column; gap: 4px; padding: 14px 16px;
  border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text);
}
.hit:hover { border-color: var(--text); text-decoration: none; color: var(--text); }
.hit strong { font-size: 15px; }
.hit span { font-size: 13px; color: var(--muted); }

.region-block { display: flex; flex-direction: column; gap: 8px; }
.region-block strong { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }

.game-card {
  display: flex; flex-direction: column; gap: 4px; padding: 16px;
  border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text);
}
.game-card:hover { border-color: var(--text); text-decoration: none; color: var(--text); }
.game-card strong { font-size: 16px; }
.game-card span { font-size: 13px; color: var(--muted); }
.grid-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
@media (max-width: 900px) { .grid-6 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* An expansion or edition label above a rules section heading. */
.prose .where {
  font-size: 12px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--accent); font-weight: 700;
}
.prose section.tight { gap: 8px; }
.prose section.tight .where + h2 { margin-top: -2px; }

/* Wordmark ------------------------------------------------------------------ */

.brand { display: flex; align-items: center; }
.wordmark { display: block; }
/* Only the header mark is resized by breakpoint; elsewhere the mark keeps
   whatever height it was asked for. */
@media (max-width: 900px) { .brand .wordmark { height: 24px; width: auto; } }
@media (max-width: 380px) { .brand .wordmark { height: 21px; width: auto; } }

/* Browsing a category -------------------------------------------------------- */

.games-list { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
/* Twelve on a desktop, six on a phone. The rest stay in the HTML for crawlers. */
.games-list.collapsed > *:nth-child(n+13) { display: none; }
.games-list > [hidden] { display: none !important; }

.game-row {
  display: flex; flex-direction: column; gap: 4px; padding: 14px 16px;
  border: 1px solid var(--border); border-radius: 10px; background: var(--surface);
  color: var(--text); min-height: 76px;
}
a.game-row:hover { border-color: var(--text); text-decoration: none; color: var(--text); }
.game-row .n { font-weight: 700; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.game-row .n .rules { font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--accent); }
.game-row .m { font-size: 13px; color: var(--muted); }
.game-row .aka { font-size: 12px; color: var(--dim); }

.browse-bar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.browse-bar .searchfield { height: 48px; flex-grow: 1; min-width: 220px; }
.browse-bar .searchfield input { font-size: 16px; }

@media (max-width: 900px) {
  .games-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .games-list.collapsed > *:nth-child(n+7) { display: none; }
}
@media (max-width: 460px) {
  .games-list { grid-template-columns: 1fr; }
}

/* A catalogue row that has no rules page yet opens in place instead. */
details.game-row { padding: 0; }
details.game-row > summary {
  display: flex; flex-direction: column; gap: 4px; padding: 14px 16px;
  cursor: pointer; list-style: none; min-height: 76px; box-sizing: border-box;
  border-radius: 10px;
}
details.game-row > summary::-webkit-details-marker { display: none; }
details.game-row > summary::after {
  content: ""; position: absolute; right: 14px; top: 20px;
  width: 8px; height: 8px; border-right: 2px solid var(--dim); border-bottom: 2px solid var(--dim);
  transform: rotate(45deg); transition: transform .15s ease;
}
details.game-row { position: relative; }
details.game-row[open] > summary::after { transform: rotate(-135deg); }
details.game-row > summary:hover { background: var(--subtle); }
details.game-row[open] { border-color: var(--text); }
details.game-row .more { padding: 0 16px 16px; display: flex; flex-direction: column; gap: 10px; }
details.game-row dl { margin: 0; display: flex; flex-direction: column; gap: 6px; }
details.game-row dl > div { display: flex; gap: 10px; font-size: 13px; }
details.game-row dt { color: var(--muted); min-width: 82px; flex-shrink: 0; }
details.game-row dd { margin: 0; color: var(--text); }
details.game-row .more p { font-size: 13px; }
details.game-row .more a { font-size: 13px; font-weight: 600; }

/* The two kinds of row should not look identical before you click. */
a.game-row.has-rules { border-left: 3px solid var(--accent); }
