/* Catalog and ranking pages (S19): /games, /games/:id, /rankings, /h/:slug, /u/:name, /about.
   On top of style.css + platform.css; logical properties for RTL; no font faces, no images in CSS. */

/* ------------------------------------------------------------ shared */
.pg-page main { min-width: 0; }
.pg-page h1 { margin-top: 0; }
.pg-page .pitch, .pg-page .lead { color: var(--muted); max-width: 70ch; }
.pg-page .crumb { margin: 0 0 10px; font-size: 0.85rem; color: var(--muted); }
.pg-page .two-col { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: var(--pg-gap); align-items: start; margin-top: var(--pg-gap); }
.pg-page .two-col > * { min-width: 0; }
.pg-page .two-col .card + .card { margin-top: var(--pg-gap); }
.pg-page .card { margin-top: var(--pg-gap); }
.pg-page .row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.pg-page .row.between { justify-content: space-between; }
.pg-page .small { font-size: 0.85rem; }
.pg-page .not-found { text-align: center; padding: 40px 0; }
.pg-page .match-list { list-style: none; margin: 0; padding: 0; }
.pg-page .match-list li { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 0.92rem; }
.pg-page .match-list li:last-child { border-bottom: 0; }
.pg-page .match-list .game { font-weight: 700; letter-spacing: 0.04em; font-size: 0.8rem; color: var(--muted); }
.pg-page .match-list .line { flex: 1 1 auto; min-width: 0; }
.pg-page .match-list .score { font-family: var(--mono); font-size: 0.85rem; color: var(--muted); white-space: nowrap; }
.pg-page .match-list .when { color: var(--muted); font-size: 0.8rem; white-space: nowrap; }
.pg-page .match-list .delta { font-family: var(--mono); font-size: 0.85rem; white-space: nowrap; }
.pg-page .match-list .delta.up { color: var(--ok); }
.pg-page .match-list .delta.down { color: var(--danger); }
.pg-page table.pg a { color: var(--text); text-decoration: none; font-weight: 600; }
.pg-page table.pg a:hover { color: var(--accent); }
.pg-page table.pg tr.provisional td { color: var(--muted); }
.pg-page table.pg tr.provisional td a { color: var(--muted); font-weight: 500; }
.pg-page table.pg tr.house td { color: var(--pg-house); font-style: italic; }
.pg-page table.pg tr.house-only td.rank, .pg-page table.pg tr.provisional td.rank, .pg-page table.pg tr.house td.rank { color: var(--muted); }
.pg-page table.pg tr.inactive td { opacity: 0.6; }
.pg-page table.pg td.rank .badge { font-size: 0.7rem; padding: 1px 6px; }
.pg-page table.pg .sub { display: block; color: var(--muted); font-size: 0.78rem; font-weight: 400; }
.pg-page table.pg td.axes { font-family: var(--mono); font-size: 0.8rem; color: var(--muted); white-space: nowrap; }
.pg-page .delta.up { color: var(--ok); }
.pg-page .delta.down { color: var(--danger); }
.pg-page .ssr-note { display: none; }

/* ------------------------------------------------------------ /games */
.catalog-page .catalog { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: var(--pg-gap); margin-top: var(--pg-gap); }
.catalog-page article.game-card { display: grid; grid-template-rows: auto 1fr auto; background: var(--bg-2); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; min-width: 0; }
.catalog-page article.game-card img.cover { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; display: block; background: var(--bg-3); }
.catalog-page article.game-card .body { padding: 14px 16px 10px; }
.catalog-page article.game-card h2 { margin: 0 0 6px; font-size: 1.15rem; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.catalog-page article.game-card h2 a { color: var(--text); text-decoration: none; }
.catalog-page article.game-card h2 a:hover { color: var(--accent); }
.catalog-page article.game-card .meta { display: flex; gap: 6px 10px; flex-wrap: wrap; align-items: center; color: var(--muted); font-size: 0.82rem; margin: 0 0 8px; }
.catalog-page article.game-card .line { margin: 0 0 8px; }
.catalog-page article.game-card .top3 { margin: 8px 0 0; padding: 0; list-style: none; font-size: 0.85rem; }
.catalog-page article.game-card .top3 li { display: flex; gap: 8px; padding: 2px 0; }
.catalog-page article.game-card .top3 .n { color: var(--muted); font-family: var(--mono); width: 2ch; }
.catalog-page article.game-card .top3 a { color: var(--text); text-decoration: none; font-weight: 600; flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.catalog-page article.game-card .foot { padding: 10px 16px; border-top: 1px solid var(--line); display: flex; gap: 8px 12px; align-items: center; flex-wrap: wrap; font-size: 0.85rem; color: var(--muted); }
.catalog-page article.game-card .foot .credit { flex: 1 1 auto; }
.catalog-page article.game-card.coming_soon { opacity: 0.75; }
.catalog-page .roadmap { margin-top: 32px; }
.catalog-page .roadmap-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; list-style: none; margin: 12px 0 0; padding: 0; }
.catalog-page .roadmap-list li { border: 1px dashed var(--line); border-radius: 10px; padding: 10px 12px; font-size: 0.88rem; background: transparent; }
.catalog-page .roadmap-list li strong { display: block; margin-bottom: 4px; }
.catalog-page .roadmap-list li .meta { color: var(--muted); font-size: 0.78rem; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-top: 6px; }

/* ------------------------------------------------------------ /games/:id */
.game-page .game-hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(220px, 360px); gap: var(--pg-gap); align-items: start; }
.game-page .game-hero img.cover { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 12px; border: 1px solid var(--line); background: var(--bg-3); }
.game-page .game-hero h1 { margin: 0 0 6px; }
.game-page .game-hero .meta { display: flex; gap: 6px 10px; flex-wrap: wrap; align-items: center; color: var(--muted); font-size: 0.88rem; margin: 0 0 10px; }
.game-page .game-hero .ctas { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.game-page pre.launch, .game-page pre.rules { white-space: pre-wrap; word-break: break-word; max-height: 28rem; overflow: auto; font-size: 0.82rem; line-height: 1.45; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.game-page pre.rules { max-height: 40rem; }
.game-page .role-pick select { background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 4px 8px; font: inherit; }
.game-page table.ladder td.level { font-weight: 700; text-transform: capitalize; }
.game-page table.ladder td.bots { font-family: var(--mono); font-size: 0.85rem; overflow-wrap: anywhere; }
/* Under 720 px the four-column ladder stacks one card per level (data-label from game.js), like the rankings board:
   its minimum content width (LEVEL · BOTS · ANCHOR · BEATS THE LEVEL BELOW, "not measured yet") was above 390 px and
   Chromium widened the layout viewport to 444 px, drawing the whole page at 88 % (UX-final-fixes 2). */
@media (max-width: 720px) {
  .game-page table.ladder { display: block; width: 100%; border-collapse: collapse; }
  .game-page table.ladder thead { display: none; }
  .game-page table.ladder tbody { display: block; }
  .game-page table.ladder tr { display: grid; grid-template-columns: minmax(0, 1fr); row-gap: 2px; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin: 0 0 10px; background: var(--bg-2, #171310); }
  .game-page table.ladder td { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding: 2px 0; border: 0; text-align: start; min-width: 0; white-space: normal; }
  .game-page table.ladder td::before { content: attr(data-label); color: var(--muted); font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; flex: 0 0 auto; font-family: var(--font, inherit); }
  .game-page table.ladder td.level { font-size: 1.05rem; }
  .game-page table.ladder td.level::before { content: none; }
  .game-page table.ladder td.num { text-align: end; }
}

/* ------------------------------------------------------------ /rankings */
.rankings-page .boards { display: flex; gap: 4px; flex-wrap: wrap; margin: 16px 0 10px; }
.rankings-page .boards a { background: var(--bg-3); color: var(--text); border: 1px solid var(--line); border-radius: 999px; padding: 5px 12px; font-size: 0.85rem; font-weight: 600; text-decoration: none; }
.rankings-page .boards a[aria-current="page"] { background: var(--accent); color: #1a1208; border-color: transparent; }
.rankings-page .boards a.speed[aria-current="page"] { background: var(--pg-speed); }
.rankings-page .boards a.smart[aria-current="page"] { background: var(--pg-smart); }
.rankings-page .boards a.teamwork[aria-current="page"] { background: var(--pg-teamwork); }
.rankings-page .boards .boards-games { display: contents; }
.rankings-page .filters { display: flex; gap: 6px 16px; flex-wrap: wrap; font-size: 0.85rem; color: var(--muted); margin: 0 0 12px; }
.rankings-page .filters label { display: inline-flex; gap: 6px; align-items: center; cursor: pointer; min-height: 28px; }
.rankings-page .filters input[type="checkbox"] { width: 18px; height: 18px; margin: 0; accent-color: var(--accent); }
.rankings-page .board { overflow-x: auto; }
.rankings-page table.board { table-layout: auto; min-width: 720px; }
.rankings-page table.pg td.rating { font-family: var(--mono); white-space: nowrap; }
.rankings-page table.pg td.rating .rd { color: var(--muted); font-size: 0.85em; }
.rankings-page .board-meta { margin: 8px 0 0; }
.rankings-page .house-panel table td.level { font-weight: 700; text-transform: capitalize; }
.rankings-page .house-panel table td.bots { font-family: var(--mono); font-size: 0.85rem; }

/* ------------------------------------------------------------ /h/:slug and /u/:name */
.harness-page .profile, .user-page .profile { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: var(--pg-gap); align-items: start; }
.harness-page .profile .avatar, .user-page .profile .avatar { width: 72px; height: 72px; border-radius: 50%; object-fit: cover; border: 1px solid var(--line); background: var(--bg-3); }
.harness-page .profile h1, .user-page .profile h1 { margin: 0 0 4px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.harness-page .profile .meta, .user-page .profile .meta { display: flex; gap: 6px 10px; flex-wrap: wrap; align-items: center; color: var(--muted); font-size: 0.88rem; margin: 0 0 8px; }
.harness-page .profile .description { margin: 6px 0; max-width: 70ch; }
.harness-page .profile .links { display: flex; gap: 10px; flex-wrap: wrap; font-size: 0.88rem; }
.harness-page .profile .actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.harness-page .profile .summary { margin: 10px 0 0; display: flex; gap: 6px 14px; flex-wrap: wrap; font-size: 0.95rem; }
.harness-page .profile .summary .overall { font-weight: 700; }
.harness-page .profile .form-line { margin-top: 6px; color: var(--muted); font-size: 0.88rem; }
.harness-page .curves { display: grid; gap: var(--pg-gap); }
.harness-page .curve h3 { margin: 0 0 6px; font-size: 0.95rem; display: flex; gap: 8px; align-items: center; }
.harness-page .curve .pg-empty { padding: 6px 0; }
.rating-curve { width: 100%; height: auto; display: block; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; }
.rating-curve .rc-band { fill: var(--pg-smart); fill-opacity: 0.12; stroke: none; }
.rating-curve .rc-line { stroke: var(--pg-smart); stroke-width: 1.6; fill: none; }
.rating-curve .rc-dot { fill: var(--pg-smart); }
.rating-curve .rc-dot.provisional { fill: var(--muted); fill-opacity: 0.7; }
.rating-curve .rc-anchor { stroke: var(--line); stroke-width: 1; stroke-dasharray: 3 4; }
.rating-curve .rc-axis { fill: var(--muted); font-size: 10px; font-family: var(--mono); }
.rating-curve .rc-marker { stroke: var(--accent-2); stroke-width: 1; stroke-dasharray: 2 3; }
.rating-curve .rc-marker-label { fill: var(--accent-2); font-size: 10px; }
.rating-curve .rc-empty { fill: var(--muted); font-size: 12px; }
.harness-page .owner-tools .pg-key { margin: 6px 0; }
.harness-page .owner-tools .owner-grid { display: grid; gap: 14px; }
.harness-page .owner-tools .badge-md { font-family: var(--mono); font-size: 0.8rem; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; word-break: break-all; user-select: all; }
.harness-page .owner-tools form.edit { display: grid; gap: 10px; max-width: 520px; }
.harness-page .owner-tools .new-key { border-color: var(--ok); }
.user-page .harness-cards { list-style: none; margin: 10px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.user-page .harness-cards li { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: var(--bg-2); }
.user-page .harness-cards li a { font-weight: 700; color: var(--text); text-decoration: none; }
.user-page .harness-cards li .meta { color: var(--muted); font-size: 0.82rem; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-top: 4px; }

/* ------------------------------------------------------------ /about */
.about-page .about-hero { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: var(--pg-gap); align-items: center; }
.about-page .about-hero img { border-radius: 50%; border: 1px solid var(--line); }
.about-page .about-toc { display: flex; gap: 4px 12px; flex-wrap: wrap; margin: 14px 0 4px; font-size: 0.88rem; }
.about-page .prose { max-width: 80ch; }
.about-page .prose p, .about-page .prose li { line-height: 1.55; }
.about-page .prose h3 { margin: 18px 0 6px; }
.about-page pre.formulas { white-space: pre; overflow-x: auto; font-size: 0.82rem; line-height: 1.5; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; }
.about-page .table-wrap { overflow-x: auto; }
.about-page table.examples, .about-page table.anchors { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.about-page table.examples th, .about-page table.examples td, .about-page table.anchors th, .about-page table.anchors td { text-align: start; padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.about-page table.examples td:not(:first-child), .about-page table.anchors td:not(:first-child) { font-family: var(--mono); white-space: nowrap; }
.about-page table.examples td.check { width: 2ch; }
.about-page table.examples tr.ok td.check::before { content: "✓"; color: var(--ok); }
.about-page table.examples tr.bad td.check::before { content: "✗"; color: var(--danger); }
.about-page table.examples tr.bad td { color: var(--danger); }
.about-page .faq details { border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; margin: 8px 0; }
.about-page .faq summary { cursor: pointer; font-weight: 600; }
.about-page .faq details p { margin: 8px 0 2px; }
.about-page .press-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.about-page .press-list li { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.about-page .press-list img { border-radius: 8px; border: 1px solid var(--line); }

@media (max-width: 760px) {
  .pg-page .two-col, .game-page .game-hero, .harness-page .profile, .user-page .profile, .about-page .about-hero { grid-template-columns: 1fr; }
  .game-page .game-hero img.cover { order: -1; }
}

/* Boards under 720 px (UX-FAST 6; /rankings and the game page top 10): one card per row, every cell labelled by its column (data-label), no overlap. */
@media (max-width: 720px) {
  .rankings-page .board { overflow: visible; }
  .pg-page table.board { min-width: 0; width: 100%; display: block; }
  .pg-page table.board thead { display: none; }
  .pg-page table.board tbody { display: block; }
  .pg-page table.board tr { display: grid; grid-template-columns: max-content minmax(0, 1fr); column-gap: 10px; row-gap: 2px; align-items: center; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin: 0 0 10px; background: var(--bg-2); }
  .pg-page table.board tbody tr:hover { background: var(--bg-2); }
  .pg-page table.board td { display: flex; justify-content: space-between; align-items: center; gap: 10px; grid-column: 1 / -1; border: 0; padding: 2px 0; text-align: start; min-width: 0; white-space: normal; font-family: inherit; }
  .pg-page table.board td::before { content: attr(data-label); color: var(--muted); font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; flex: 0 0 auto; }
  .pg-page table.board td.rank { grid-column: 1; width: auto; font-family: var(--mono); font-size: 1.05rem; font-weight: 700; color: var(--accent); padding: 0; }
  .pg-page table.board td.rank::before { content: "#"; font-size: 0.85rem; color: var(--muted); }
  .pg-page table.board td.rank .badge { font-size: 0.7rem; }
  .pg-page table.board td.rank .badge ~ *::before, .pg-page table.board tr.house td.rank::before, .pg-page table.board tr.house-only td.rank::before, .pg-page table.board tr.provisional td.rank::before { content: none; }
  .pg-page table.board td.who { grid-column: 2; display: block; padding: 0; font-size: 1.05rem; }
  .pg-page table.board td.who::before { content: none; }
  .pg-page table.board td.who .sub { font-size: 0.78rem; }
  .pg-page table.board td.rating, .pg-page table.board td.num { font-family: inherit; }
  .pg-page table.board td.rating .r, .pg-page table.board td.num, .pg-page table.board td.axes { font-family: var(--mono); }
  .pg-page table.board td.axes { font-size: 0.82rem; }
  .pg-page table.board td:empty, .pg-page table.board td.model:empty { display: none; }
  .rankings-page .filters { gap: 8px 14px; }
  .rankings-page .filters label { min-height: 40px; }
}

/* Tap targets (audit 2026-10-10, UX-FAST 6): the plain links of the catalog bodies reach 40 px on phones (crumbs, card
   titles, "Rules for agents", the /about table of contents, "Full board", board and match-list links); desktop keeps the text size. */
@media (max-width: 760px) {
  .pg-page .crumb a, .catalog-page article.game-card h2 a, .catalog-page article.game-card .foot a, .about-page .about-toc a,
  .game-page #full-board, .game-page #casual-link, .harness-page .profile .links a, .harness-page .profile .meta a, .user-page .harness-cards li > a,
  .rankings-page .pitch a, .pg-page table.pg a, .pg-page .match-list a.line, .pg-page .pgc-signin a { display: inline-flex; align-items: center; min-height: 40px; }
  .pg-page .crumb { margin-bottom: 4px; }
  .rankings-page .filters input[type="checkbox"] { width: 24px; height: 24px; }
  .catalog-page article.game-card .top3 a { padding: 9px 0; } /* a flex item already: padding keeps its ellipsis */
  .about-page .about-toc { gap: 0 14px; margin: 8px 0 0; }
}

