/* BodyArcade content pages: the policies, the FAQ, the guides and the blog.
   Built on the same tokens as the app (design/tokens/tokens.css: content.test.ts checks that every colour here equals the token
   of the same name), the system font stack (no font file is loaded), and the app's own habits: ink text, a flush underline on
   links, a solid edge under the one button, inset borders instead of shadows. Light and dark follow the device. */

:root {
  color-scheme: light dark;
  --ba-bg: #F4F2F8;
  --ba-surface: #FFFFFF;
  --ba-surface-sunken: #ECE9F3;
  --ba-text: #1C1433;
  --ba-text-muted: #5E5677;
  --ba-border: #D9D4E5;
  --ba-border-strong: #1C1433;
  --ba-accent: #FF4F6E;
  --ba-accent-pressed: #F23A5C;
  --ba-accent-edge: #C8264A;
  --ba-on-accent: #1C1433;
  --ba-accent-text: #C8264A;
  --ba-accent-tint: #FFE3E9;
  --ba-focus: #1C1433;
  --ba-focus-halo: #FF4F6E;
  --ba-info: #1F6FB5;
  --ba-hit-text: #0E7A4E;
  --ba-reward-text: #8A5A00;
  --ba-font-display: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; /* the system fonts, with fallback names for each platform */
  --ba-font-text: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; /* the same, for text: fallback names per platform */
  --ba-radius-sm: 10px;
  --ba-radius-md: 14px;
  --ba-radius-lg: 22px;
  --ba-gutter: max(clamp(16px, 4vw, 48px), env(safe-area-inset-left, 0px));
  --top-h: 64px;
}
@media (min-width: 768px) { :root { font-size: 106.25%; } }

@media (prefers-color-scheme: dark) {
  :root {
    --ba-bg: #1A1430;
    --ba-surface: #241C40;
    --ba-surface-sunken: #140F27;
    --ba-text: #F4F2F8;
    --ba-text-muted: #A79FBE;
    --ba-border: #31285A;
    --ba-border-strong: #F4F2F8;
    --ba-accent-text: #FF8FA3;
    --ba-accent-tint: #3B1830;
    --ba-focus: #F4F2F8;
    --ba-info: #8CCFFF;
    --ba-hit-text: #5BE0A6;
    --ba-reward-text: #FFC53A;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--top-h) + 16px); }
body {
  margin: 0;
  background: var(--ba-bg);
  color: var(--ba-text);
  font-family: var(--ba-font-text);
  font-size: 1rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; }
:focus-visible {
  outline: 3px solid var(--ba-focus);
  outline-offset: 3px;
  box-shadow: 0 0 0 7px color-mix(in srgb, var(--ba-focus-halo) 35%, transparent);
  border-radius: var(--ba-radius-sm);
}
.skip { position: absolute; left: 12px; top: -80px; z-index: 100; padding: 12px 18px; border-radius: var(--ba-radius-md); background: var(--ba-text); color: var(--ba-bg); font-weight: 700; text-decoration: none; }
.skip:focus { top: 12px; }

/* ---------- Top bar ---------- */
.top {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--ba-bg) 92%, transparent);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  box-shadow: 0 1px 0 var(--ba-border);
}
.top-in {
  max-width: calc(1240px + 2 * var(--ba-gutter)); margin: 0 auto; padding: 8px var(--ba-gutter);
  display: flex; flex-wrap: wrap; align-items: center; gap: 2px 20px;
}
.brand { display: inline-flex; align-items: center; min-height: 44px; border-radius: var(--ba-radius-sm); text-decoration: none; }
.brand img { height: 28px; width: auto; }
.logo-dark { display: none; }
@media (prefers-color-scheme: dark) { .logo-light { display: none; } .logo-dark { display: block; } }
.nav { order: 3; flex: 1 0 100%; display: flex; gap: 2px; margin: 0 -10px; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a, .lang {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 12px; border-radius: 12px;
  font-weight: 700; font-size: 0.9375rem; color: var(--ba-text-muted); text-decoration: none; white-space: nowrap;
}
.nav a:hover, .lang:hover { color: var(--ba-text); background: var(--ba-surface); box-shadow: inset 0 0 0 1.5px var(--ba-border); }
.nav a[aria-current="page"] { color: var(--ba-text); background: var(--ba-surface); box-shadow: inset 0 0 0 1.5px var(--ba-border); }
.lang { margin-left: auto; }
.top .play { display: none; }
@media (min-width: 760px) {
  .top-in { flex-wrap: nowrap; padding-top: 0; padding-bottom: 0; min-height: var(--top-h); gap: 8px 28px; }
  .nav { order: 0; flex: 0 1 auto; margin: 0; overflow: visible; }
  .lang { margin-left: auto; }
  .top .play { display: inline-flex; }
}

/* ---------- Buttons: press like an arcade button (solid edge, no blur) ---------- */
.btn {
  --edge: var(--ba-accent-edge);
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 52px; padding: 0 22px; border: 0; border-radius: var(--ba-radius-md);
  background: var(--ba-accent); color: var(--ba-on-accent); box-shadow: 0 4px 0 0 var(--edge);
  font: 700 1.0625rem/1 var(--ba-font-text); text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: transform 90ms cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 90ms cubic-bezier(0.2, 0.8, 0.2, 1), background-color 160ms;
}
.btn:hover { background: var(--ba-accent-pressed); }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 0 var(--edge); }
.btn--sm { min-height: 44px; padding: 0 18px; font-size: 0.9375rem; border-radius: 12px; }
@media (prefers-reduced-motion: reduce) { .btn { transition: none; } }

/* ---------- Page ---------- */
.page { width: 100%; max-width: calc(1240px + 2 * var(--ba-gutter)); margin: 0 auto; padding: clamp(28px, 5vw, 64px) var(--ba-gutter) clamp(48px, 7vw, 96px); }
.crumbs { margin: 0 0 20px; font-size: 0.9375rem; color: var(--ba-text-muted); }
.crumbs ol { display: flex; flex-wrap: wrap; gap: 4px 10px; margin: 0; padding: 0; list-style: none; }
.crumbs li + li::before { content: "/"; margin-right: 10px; color: var(--ba-border-strong); opacity: 0.45; }
.crumbs a { color: inherit; }
.head { max-width: 46rem; }
.head .lead { max-width: 36rem; }
h1 {
  margin: 0; font-family: var(--ba-font-display); font-weight: 800; font-size: clamp(2rem, 1.4rem + 2.6vw, 3.4rem);
  line-height: 1.08; text-wrap: balance;
}
.when { margin: 14px 0 0; color: var(--ba-text-muted); font-size: 0.9375rem; }
.lead { margin: 18px 0 0; font-size: 1.1875rem; line-height: 1.5; color: var(--ba-text); max-width: 38rem; }

/* The summary: what matters most, before the detail. */
.brief {
  margin: 32px 0 0; max-width: 46rem; padding: 20px 22px 18px; border-radius: var(--ba-radius-lg); background: var(--ba-surface);
  box-shadow: inset 4px 0 0 var(--ba-accent), inset 0 0 0 1.5px var(--ba-border);
}
.brief h2 { margin: 0 0 8px; font-size: 1.1875rem; line-height: 1.2; }
.brief ul { margin: 0; padding-left: 1.15em; display: grid; gap: 8px; }
.brief li { padding-left: 2px; }

/* Body and table of contents. On a wide screen the table of contents is a sticky rail on the left, beside the title and the text. */
.toc-top { margin: 28px 0 0; max-width: 46rem; border-radius: var(--ba-radius-md); background: var(--ba-surface); box-shadow: inset 0 0 0 1.5px var(--ba-border); }
.toc-top summary { display: flex; align-items: center; justify-content: space-between; min-height: 52px; padding: 0 16px; font-weight: 700; cursor: pointer; list-style: none; }
.toc-top summary::-webkit-details-marker { display: none; }
.toc-top summary::after { content: "+"; font-size: 1.4rem; line-height: 1; font-weight: 600; }
.toc-top[open] summary::after { content: "\2212"; }
.toc-top ol { margin: 0; padding: 0 16px 12px; list-style: none; display: grid; }
.toc-top a { display: block; padding: 10px 0; text-decoration: none; border-top: 1px solid var(--ba-border); }
.toc-side { display: none; }
.page--solo { max-width: calc(46rem + 2 * var(--ba-gutter)); }
@media (min-width: 1040px) {
  .page--rail { display: grid; grid-template-columns: 15rem minmax(0, 46rem); column-gap: clamp(40px, 6vw, 96px); align-content: start; }
  .page--rail > * { grid-column: 2; }
  .page--rail > .toc-side { display: block; grid-column: 1; grid-row: 1 / span 4; position: sticky; top: calc(var(--top-h) + 24px); align-self: start; max-height: calc(100vh - var(--top-h) - 48px); overflow: auto; padding-top: 4px; }
  .toc-top { display: none; }
  .toc-side h2 { margin: 0 0 8px; font-size: 0.9375rem; color: var(--ba-text-muted); font-weight: 700; }
  .toc-side ol { margin: 0; padding: 0; list-style: none; border-left: 1.5px solid var(--ba-border); }
  .toc-side a { display: block; padding: 6px 0 6px 14px; margin-left: -1.5px; border-left: 3px solid transparent; font-size: 0.9375rem; line-height: 1.35; color: var(--ba-text-muted); text-decoration: none; }
  .toc-side a:hover { color: var(--ba-text); border-left-color: var(--ba-accent); }
}
.body { min-width: 0; margin-top: clamp(24px, 3.5vw, 40px); }
.body > section { margin-top: clamp(32px, 4.5vw, 52px); }
.body > section:first-child { margin-top: 0; }
.body h2 { margin: 0 0 12px; font-family: var(--ba-font-display); font-weight: 800; font-size: clamp(1.3rem, 1.1rem + 0.8vw, 1.75rem); line-height: 1.15; text-wrap: balance; }
.body h3 { margin: 24px 0 6px; font-family: var(--ba-font-display); font-weight: 800; font-size: 1.125rem; line-height: 1.25; }
.body p, .body > section > ul, .body > section > ol { max-width: 40rem; }
.body p { margin: 0 0 14px; }
.body ul, .body ol { margin: 0 0 14px; padding-left: 1.3em; display: grid; gap: 6px; }
.body li::marker { color: var(--ba-accent-text); }
.body strong { font-weight: 700; }
.nw { white-space: nowrap; }
.body a, .foot a, .crumbs a { text-decoration: underline; text-decoration-color: var(--ba-accent); text-decoration-thickness: 2px; text-underline-offset: 4px; }
.body a:hover, .foot a:hover { text-decoration-thickness: 3px; }
.body code, .tbl code { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 0.92em; padding: 1px 6px; border-radius: 6px; background: var(--ba-surface-sunken); }
.note { margin: 18px 0; padding: 14px 16px; border-radius: var(--ba-radius-md); background: var(--ba-surface); box-shadow: inset 4px 0 0 var(--ba-info), inset 0 0 0 1.5px var(--ba-border); }
.note p:last-child { margin-bottom: 0; }
.note strong:first-child { display: block; margin-bottom: 2px; }
/* A screen of the game itself, with what it shows underneath. */
.fig { margin: 22px 0; max-width: 46rem; }
.fig img { width: 100%; height: auto; border-radius: var(--ba-radius-md); box-shadow: inset 0 0 0 1.5px var(--ba-border); border: 1.5px solid var(--ba-border); background: var(--ba-surface-sunken); }
.fig figcaption { margin-top: 8px; font-size: 0.875rem; line-height: 1.45; color: var(--ba-text-muted); max-width: 40rem; }
.cta { margin: 28px 0 0; padding: 20px 22px; border-radius: var(--ba-radius-lg); background: var(--ba-surface); box-shadow: inset 0 0 0 1.5px var(--ba-border); display: flex; flex-wrap: wrap; align-items: center; gap: 14px 24px; }
.cta p { margin: 0; flex: 1 1 18em; }

/* Tables. On a phone every row becomes a small block with its labels. */
.tbl { width: 100%; margin: 6px 0 18px; border-collapse: separate; border-spacing: 0; font-size: 0.9375rem; font-variant-numeric: tabular-nums; border-radius: var(--ba-radius-md); box-shadow: inset 0 0 0 1.5px var(--ba-border); background: var(--ba-surface); overflow: hidden; }
.body h3.tbl-title { margin: 22px 0 8px; }
.tbl th, .tbl td { text-align: left; vertical-align: top; padding: 12px 14px; }
.tbl thead th { background: var(--ba-surface-sunken); font-weight: 700; font-size: 0.875rem; }
.tbl tbody tr + tr > * { border-top: 1px solid var(--ba-border); }
.tbl tbody th { font-weight: 700; width: 9.5rem; }
/* The link in a row heading (a game, an area) stands alone in its cell: a touch target of at least 24 px. */
.tbl tbody th a { display: inline-block; padding: 2px 0; }
@media (max-width: 679px) {
  .tbl, .tbl tbody, .tbl tr, .tbl th, .tbl td { display: block; }
  .tbl thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .tbl tbody tr { padding: 10px 14px 12px; }
  .tbl tbody tr + tr { border-top: 1px solid var(--ba-border); }
  .tbl tbody tr + tr > * { border-top: 0; }
  .tbl tbody th { width: auto; }
  .tbl th, .tbl td { padding: 2px 0; }
  .tbl td[data-label]::before { content: attr(data-label); display: block; margin-top: 6px; font-size: 0.8125rem; font-weight: 700; color: var(--ba-text-muted); }
}

/* Questions and answers. */
.qa { margin: 0 0 6px; border-radius: var(--ba-radius-md); background: var(--ba-surface); box-shadow: inset 0 0 0 1.5px var(--ba-border); }
.qa summary { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 56px; padding: 10px 16px; font-weight: 700; font-size: 1.0625rem; line-height: 1.3; cursor: pointer; list-style: none; }
.qa summary::-webkit-details-marker { display: none; }
.qa summary::after { content: "+"; flex: none; width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%; background: var(--ba-surface-sunken); font-weight: 600; line-height: 1; transition: transform 160ms, background-color 160ms; }
.qa[open] summary::after { transform: rotate(45deg); background: var(--ba-accent); color: var(--ba-on-accent); }
.qa > div { padding: 0 16px 8px; }
.qa p:last-child { margin-bottom: 8px; }
@media (prefers-reduced-motion: reduce) { .qa summary::after { transition: none; } }

/* Inside the Android app (twa.js puts .twa on the page): no word on how to pay on the web, and the web shop's links are plain
   text. Google Play is the only way to buy there (Google Play payments policy). */
.twa [data-web-pay] { display: none !important; }
.twa a[href*="gumroad.com"] { pointer-events: none; color: inherit; text-decoration: none; }

/* The blog index. */
.body .posts { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.body .posts li { padding: 18px 20px; border-radius: var(--ba-radius-lg); background: var(--ba-surface); box-shadow: inset 0 0 0 1.5px var(--ba-border); }
.body .posts h2 { margin: 0 0 6px; font-size: 1.25rem; line-height: 1.25; }
.body .posts p { margin: 0 0 6px; }
.body .posts .when { margin: 0; }

/* ---------- Footer ---------- */
.foot { border-top: 1px solid var(--ba-border); padding: 28px 0 40px; font-size: 0.9375rem; color: var(--ba-text-muted); }
.foot-in { max-width: calc(1240px + 2 * var(--ba-gutter)); margin: 0 auto; padding: 0 var(--ba-gutter); display: grid; gap: 14px; }
.foot p { margin: 0; max-width: 46em; }
.foot ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 20px; }
.foot a { color: var(--ba-text); }
.foot [aria-current="true"] { font-weight: 700; }

@media print {
  .top, .toc-top, .toc-side, .foot, .skip, .cta { display: none; }
  body { background: #fff; color: #000; }
  .page { max-width: none; padding: 0; }
  .doc { display: block; }
  .brief, .note, .qa, .tbl { box-shadow: none; border: 1px solid #999; }
}
