:root {
  --ink: #1f2933;
  --ink-2: #52606d;
  --ink-3: #9aa5b1;
  --line: #e4e7eb;
  --bg: #fbfaf7;
  --surface: #ffffff;
  --felt: #1e7a5f;
  --felt-dark: #155e4a;
  --felt-line: rgba(255, 255, 255, 0.25);
  --accent: #185fa5;
  --radius: 10px;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.7;
  font-size: 16px;
}
.wrap { max-width: 980px; margin: 0 auto; padding: 0 20px; }

.site-header { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 56px; }
.brand { font-size: 20px; font-weight: 700; color: var(--felt-dark); text-decoration: none; letter-spacing: 0.3px; }
.main-nav a { color: var(--ink-2); text-decoration: none; margin-left: 18px; font-size: 14.5px; }
.main-nav a:hover { color: var(--felt-dark); }
@media (max-width: 640px) { .main-nav { display: none; } }

main { padding: 28px 20px 56px; }

.hero { text-align: center; padding: 36px 0 20px; }
.hero h1 { font-size: 32px; line-height: 1.25; }
.hero p { max-width: 640px; margin: 14px auto 0; color: var(--ink-2); }
@media (max-width: 640px) { .hero h1 { font-size: 25px; } }

h2 { font-size: 23px; margin: 34px 0 14px; }
h3 { font-size: 17px; margin: 18px 0 6px; }

.game-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.game-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 16px 14px; text-decoration: none; color: var(--ink); display: block;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.game-card:hover { border-color: var(--felt); transform: translateY(-2px); }
.game-card .gc-thumb {
  display: block; width: 100%; height: auto; aspect-ratio: 2 / 1;
  border-radius: 6px; margin: 0 0 10px; background: var(--felt);
}
.game-card .gc-name { font-weight: 600; font-size: 16.5px; color: var(--felt-dark); }
.game-card .gc-tags { margin: 6px 0 6px; display: flex; flex-wrap: wrap; gap: 6px; }
.game-card .gc-desc { font-size: 13.5px; color: var(--ink-2); }
.tag {
  display: inline-block; font-size: 12px; color: var(--ink-2);
  background: #eef2ef; border-radius: 99px; padding: 1px 10px;
}

.game-page h1 { font-size: 28px; margin-bottom: 10px; }
.game-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.intro { color: var(--ink-2); font-size: 16.5px; max-width: 720px; }
.breadcrumb { font-size: 13px; color: var(--ink-3); margin-bottom: 12px; }
.breadcrumb a { color: var(--ink-3); text-decoration: none; }
.breadcrumb em { color: var(--ink-2); font-style: normal; }

.game-board-wrap { margin: 22px 0 8px; }
.game-felt {
  background: var(--felt); border-radius: 14px; padding: 22px;
  min-height: 320px; position: relative; overflow: hidden;
  background-image: radial-gradient(rgba(255,255,255,0.06) 1px, transparent 1px);
  background-size: 22px 22px;
}
.felt-row { display: flex; gap: 10px; justify-content: center; }
.felt-row.tableau { margin-top: 16px; }
.slot { width: 52px; height: 72px; border: 1.5px dashed var(--felt-line); border-radius: 6px; background: rgba(0,0,0,0.08); }
.slot-back { background: rgba(0,0,0,0.18); border-style: solid; }
.spacer { flex: 1; }
.mini-col { display: flex; flex-direction: column; align-items: center; }
.card { width: 44px; height: 61px; border-radius: 5px; background: #ffffff; border: 1px solid #cfd6dd; margin-top: -34px; box-shadow: 0 1px 2px rgba(0,0,0,0.25); }
.card:first-child { margin-top: 0; }
.card.c1 { margin-top: 0; }
.card.c2 { margin-top: -38px; margin-left: 14px; }
.card.c3 { margin-top: -38px; margin-left: -14px; }

/* Original SVG card faces. The sprite that supplies them lives in
   games-src/engine/card-faces.js; each card is one <svg> + one <use>,
   so keeping them tight matters more than it looks - a Spider board is 104. */
.card .cface {
  position: absolute; inset: 0; width: 100%; height: 100%;
  display: block; pointer-events: none;
}
/* spoken-only card name ("Q of hearts"); stays in textContent for AT and tests */
.card .cv {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}
/* Resume bar: shown by save.js when an unfinished board was restored, and it
   doubles as the lifetime record for that game. Inserted as the first child of
   #game-app, so it sits above the HUD without touching any engine's markup. */
.g-recap {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px;
  margin-bottom: 10px; padding: 8px 12px;
  background: rgba(255,255,255,0.9); border: 1px solid rgba(0,0,0,0.12);
  border-radius: 10px; font-size: 12.5px; line-height: 1.5; color: var(--ink-2);
}
.g-recap-line b { color: var(--ink); }
.g-recap-stats { color: var(--ink-2); opacity: 0.85; }
.g-recap-acts { margin-left: auto; }
.g-recap-btn {
  font: inherit; font-size: 12px; padding: 4px 10px; cursor: pointer;
  background: transparent; color: var(--ink);
  border: 1px solid rgba(0,0,0,0.28); border-radius: 6px;
}
.g-recap-btn:hover { border-color: rgba(0,0,0,0.5); }
@media (max-width: 640px) {
  .g-recap { font-size: 12px; gap: 4px 10px; }
  .g-recap-acts { margin-left: 0; }
}
.board-note {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  background: rgba(255,255,255,0.94); border-radius: 10px; padding: 18px 26px;
  text-align: center; max-width: 340px; box-shadow: 0 4px 18px rgba(0,0,0,0.25);
}
.board-note strong { display: block; font-size: 16px; margin-bottom: 4px; color: var(--felt-dark); }
.board-note span { font-size: 13.5px; color: var(--ink-2); }
@media (max-width: 640px) {
  .game-felt { padding: 12px; min-height: 240px; }
  .slot { width: 34px; height: 48px; }
  .card { width: 30px; height: 42px; }
  .felt-row.tableau { gap: 5px; }
}

.steps { margin: 8px 0 8px 22px; }
.steps li { margin: 7px 0; }
.tips li { margin: 7px 0; }
.tips { margin-left: 22px; }
.variant-note {
  background: #e6f1fb; border-left: 4px solid var(--accent); border-radius: 6px;
  padding: 10px 16px; margin: 14px 0; font-size: 14.5px; color: #0c447c;
}
.rules p { max-width: 720px; }

details.faq-item {
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px;
  margin: 8px 0; padding: 0 16px;
}
details.faq-item summary {
  cursor: pointer; font-weight: 600; padding: 12px 0; list-style-position: outside;
}
details.faq-item[open] summary { border-bottom: 1px solid var(--line); }
details.faq-item p { padding: 10px 0 14px; color: var(--ink-2); }

.seo-copy { margin-top: 44px; max-width: 720px; }
.seo-copy p { color: var(--ink-2); margin-bottom: 12px; }

.site-footer { background: var(--surface); border-top: 1px solid var(--line); padding: 22px 0 28px; }
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; align-items: center; }
.site-footer p { font-size: 13.5px; color: var(--ink-3); }
.footer-nav a { color: var(--ink-2); text-decoration: none; font-size: 13.5px; margin-left: 16px; }

.static-page { max-width: 720px; }
.static-page h1 { font-size: 26px; margin-bottom: 14px; }
.static-page p { margin-bottom: 12px; color: var(--ink-2); }
/* ---- guides ---- */
.guide-meta { margin: 10px 0 4px; display: flex; flex-wrap: wrap; gap: 8px; }
.guide-page h2 { font-size: 21px; margin: 30px 0 10px; color: var(--felt-dark); }
.guide-page h2:first-of-type { margin-top: 24px; }
.guide-page p { font-size: 16px; line-height: 1.72; color: var(--ink); margin: 0 0 14px; }
.guide-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.guide-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 15px; text-decoration: none; color: var(--ink); display: block;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.guide-card:hover { border-color: var(--felt); transform: translateY(-2px); }
.guide-card .gc-name { font-weight: 600; font-size: 15.5px; color: var(--felt-dark); line-height: 1.35; }
.guide-card .gc-desc { font-size: 13px; color: var(--ink-2); margin-top: 6px; line-height: 1.5; }
.glossary { margin: 6px 0 18px; }
.glossary dt { font-weight: 600; color: var(--felt-dark); margin-top: 14px; font-size: 15.5px; }
.glossary dd { font-size: 15px; line-height: 1.7; color: var(--ink); margin: 3px 0 0; }
.table-wrap { overflow-x: auto; margin: 10px 0 20px; -webkit-overflow-scrolling: touch; }
table.cmp { width: 100%; border-collapse: collapse; font-size: 14.5px; min-width: 520px; }
table.cmp th, table.cmp td {
  text-align: left; padding: 9px 11px; border-bottom: 1px solid var(--line); vertical-align: top;
}
table.cmp thead th {
  background: var(--felt); color: #fff; font-weight: 600; border-bottom: none;
}
table.cmp tbody tr:nth-child(even) { background: #f6f8f7; }
table.cmp td:first-child { font-weight: 600; color: var(--ink); white-space: nowrap; }

/* below 700px the comparison table becomes one stacked card per row, so no
   column is ever hidden behind a horizontal scrollbar */
@media (max-width: 700px) {
  .table-wrap { overflow-x: visible; }
  table.cmp { min-width: 0; display: block; }
  table.cmp thead { display: none; }
  table.cmp tbody { display: block; }
  table.cmp tr {
    display: block; background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--radius); padding: 10px 12px; margin-bottom: 10px;
  }
  table.cmp tbody tr:nth-child(even) { background: var(--surface); }
  table.cmp td { display: block; border: none; padding: 2px 0; font-size: 14.5px; }
  table.cmp td:first-child {
    font-weight: 700; color: var(--felt-dark); white-space: normal; margin-bottom: 4px;
  }
  table.cmp td[data-col]::before {
    content: attr(data-col) ": "; font-weight: 600; color: var(--ink-2);
  }
}
.static-page h2 { font-size: 18px; margin: 20px 0 8px; }

/* daily challenge page: the game area is mounted by games-src/engine/daily.js */
.daily-wrap { margin: 18px 0 26px; }
.daily-page h1 { font-size: 27px; margin-bottom: 10px; }
.noscript-note {
  background: #fff8e1; border: 1px solid #f0dca8; border-radius: var(--radius);
  padding: 10px 14px; font-size: 14.5px; color: #6b5510;
}
