/* pages.css — the reading pages: /rules/*, /tools/scoring-calculator, /faq
   (generated by tools/genrules.mjs) and /privacy, /conduct, /delete-account
   (hand-written).

   Why this file exists (25 Nov 2026). Until then every one of those pages
   carried its own inline copy of one stylesheet: cream or near-black ground,
   system sans, a quote box with a gold left rule, thin grey dividers. That is
   the default look of a generated docs page, and it made the pages Google
   sends people to look like a different, machine-made site from the game.
   Nathan: "how do i make pixelpung not look like an AI-generated website".

   So these pages now wear the game's own furniture, copied from mahjong.css
   on purpose rather than loading it (mahjong.css carries the board's
   body-level layout and the whole menu skin):
     - the colours are mahjong.css :root, one for one
     - the card is the home card: --panel fill, a wood frame, gold corner
       studs, a hard 8px shadow (no blur: the game has none)
     - headings are the display serif in the ENGLISH stack (mahjong.css
       html[lang=en]), body copy the UI sans
     - tables rule with dashed wood lines, the way Score Keeper's standings do
     - real tile and Bak sprites (img/tiles, img/bak), shown at a whole
       fraction of their 4x export with image-rendering: pixelated, so they
       stay pixel art and never get smoothed

   Dark only. The game has no light theme, and a cream version of these pages
   was the most generic-looking thing about them.

   If a token changes in mahjong.css :root, change it here too. */

* { box-sizing: border-box; scrollbar-width: thin; scrollbar-color: #6b5636 rgba(10,8,6,.55); }
::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-track { background-color: rgba(10,8,6,.55); }
::-webkit-scrollbar-thumb {
  background-color: #6b5636;
  border-top: 2px solid #d8a544; border-bottom: 2px solid #d8a544;
}
::-webkit-scrollbar-thumb:hover { background-color: #8a7047; }
::-webkit-scrollbar-button { display: none; height: 0; width: 0; }

:root {
  --bg: #14100c; --panel: #241c14; --panel-hi: #3a2d20;
  --ink: #f3e7cd; --ink-dim: #b8a684; --dim: #94856b;
  --gold: #d8a544; --wood: #5a3f26; --wood-hi: #6b5636; --shadow: #0b0805;
  --felt: #1d5c3f; --green-fill: #26743f; --green-fill-hi: #216537;
  --red: #e08b7a;
  --font-display: Georgia, "Times New Roman", "Songti SC", "SimSun", serif;
  --font-ui: system-ui, "Segoe UI", "Noto Sans", "Microsoft YaHei", sans-serif;
  /* old names, still used by markup in the hand-written pages */
  --fg: var(--ink); --accent: var(--gold); --rule: var(--wood);
  color-scheme: dark;
}

body {
  margin: 0; padding: 1.25rem .75rem 4rem;
  background-color: var(--bg);
  /* the lamp over the table: one warm pool, no texture */
  background-image: radial-gradient(ellipse 70% 45% at 50% 0%, rgba(216,165,68,.10), transparent 70%);
  background-repeat: no-repeat;
  color: var(--ink);
  font: 16px/1.65 var(--font-ui);
  -webkit-text-size-adjust: 100%;
}
[lang|="zh"], .zh { font-family: "Songti SC", "STSong", "SimSun", "Noto Serif CJK SC", "MingLiU", serif; }

/* ── The card ──────────────────────────────────────────────────────────── */
main {
  position: relative; max-width: 46rem; margin: 0 auto;
  background: var(--panel);
  border: 6px solid var(--wood);
  box-shadow: 8px 8px 0 var(--shadow);
  padding: 1.6rem 1.4rem 2rem;
}
/* gold studs in the corners, as on the game's cards */
main::before, main::after {
  content: ""; position: absolute; width: 6px; height: 6px; background: var(--gold);
  top: 8px; left: 8px;
  box-shadow: calc(100% + 0px) 0 0 transparent;
}
main::after { left: auto; right: 8px; }
.studs::before, .studs::after {
  content: ""; position: absolute; width: 6px; height: 6px; background: var(--gold); bottom: 8px;
}
.studs::before { left: 8px; } .studs::after { right: 8px; }
@media (min-width: 640px) { body { padding: 2rem 1.25rem 5rem; } main { padding: 2.2rem 2.4rem 2.6rem; } }

/* ── Type ─────────────────────────────────────────────────────────────── */
h1, h2, h3 { font-family: var(--font-display); font-weight: 700; color: var(--ink); }
h1 { font-size: 1.85rem; line-height: 1.2; margin: 0 0 .35rem; letter-spacing: .01em; }
h2 {
  font-size: 1.2rem; color: var(--gold); letter-spacing: .06em;
  margin: 2.4rem 0 .7rem; padding-top: 1.1rem; border-top: 2px dashed var(--wood);
}
h3 { font-size: 1rem; margin: 1.5rem 0 .4rem; color: var(--gold); }
.sub { color: var(--ink-dim); margin: 0 0 1.8rem; font-size: 1rem; }
p, li { margin: 0 0 .8rem; }
ul, ol { padding-left: 1.2rem; }
li::marker { color: var(--gold); }
b, strong { color: var(--ink); }
i, em { color: var(--ink); }
a { color: var(--gold); text-underline-offset: .18em; }
a:hover { color: #f0c46a; }
code {
  font: .88em ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  background: var(--bg); border: 1px solid var(--wood); padding: .05em .35em;
}
.desc { color: var(--ink-dim); }
.note { font-size: .92rem; color: var(--ink-dim); }

/* the opening paragraph: a darker inset panel, not a quote rule */
.lede {
  background: var(--bg); border: 2px solid var(--wood);
  padding: .9rem 1.1rem .2rem; margin: 0 0 1.8rem; color: var(--ink);
}
.todo { border: 1px dashed var(--gold); padding: .1em .45em; font-size: .9em; }

/* ── The top bar: a game button back to the table ─────────────────────── */
nav.crumbs { margin: 0 0 1.4rem; font-size: .9rem; color: var(--dim); }
nav.crumbs a {
  display: inline-block; padding: .35rem .8rem; margin-right: .5rem;
  background: var(--panel-hi); border: 2px solid var(--wood); color: var(--ink);
  font-family: var(--font-display); letter-spacing: .08em; text-decoration: none;
  box-shadow: 3px 3px 0 var(--shadow);
}
nav.crumbs a:hover { border-color: var(--gold); }

/* ── Tables ───────────────────────────────────────────────────────────── */
.tw { overflow-x: auto; margin: 0 0 1.2rem; }   /* scrolls inside its box on a phone */
table { border-collapse: collapse; width: 100%; font-size: .95rem; }
th, td { text-align: left; padding: .5rem .6rem; border-bottom: 2px dashed var(--wood); vertical-align: top; }
th { color: var(--gold); font-family: var(--font-display); font-weight: 700; letter-spacing: .05em; white-space: nowrap; }
td.v { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; color: var(--gold); font-weight: 700; }
td .desc, td.desc { color: var(--ink-dim); }

/* ── Buttons: the game's green and gold ───────────────────────────────── */
.cta, button.cta {
  display: inline-block; margin: .4rem 0 0; padding: .65rem 1.2rem;
  background: var(--green-fill); border: 2px solid #1a4f2b; color: #fff;
  font: 700 1rem/1.2 var(--font-display); letter-spacing: .08em; text-decoration: none;
  box-shadow: 4px 4px 0 var(--shadow); cursor: pointer;
}
.cta:hover { background: var(--green-fill-hi); color: #fff; }
.cta.ghost { background: var(--panel-hi); border-color: var(--wood); color: var(--ink); }
.cta.gold { background: var(--gold); border-color: #8a6520; color: #1b1206; }

/* ── Tiles and Bak ────────────────────────────────────────────────────── */
.tl {
  display: inline-block; width: 28px; height: 42px; vertical-align: middle;
  image-rendering: pixelated; image-rendering: crisp-edges; margin: 0 1px;
}
.tl.big { width: 56px; height: 84px; }
.tiles { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 2px; margin: .4rem 0 1rem; }
.tiles .gap { width: 14px; }
.tilerow { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1.2rem; margin: .2rem 0 1rem; }
.tilerow > span { display: inline-flex; align-items: center; gap: 2px; }
.tilerow small { color: var(--ink-dim); margin-left: .4rem; font-size: .85rem; }

.bak { display: flex; gap: .9rem; align-items: flex-end; margin: 1rem 0 1.4rem; }
.bak img { width: 56px; height: 64px; image-rendering: pixelated; flex: none; }
.bak .say {
  position: relative; background: var(--ink); color: #1b1206; padding: .7rem .9rem;
  box-shadow: 4px 4px 0 var(--shadow); font-size: .97rem; line-height: 1.5;
}
.bak .say::before {
  content: ""; position: absolute; left: -10px; bottom: 14px;
  border: 5px solid transparent; border-right-color: var(--ink); border-bottom-color: var(--ink);
}
.bak .say b { color: #1b1206; }

figure.photo { margin: .6rem 0 1.4rem; }
figure.photo > img {
  display: block; max-width: 100%; height: auto;
  border: 6px solid var(--wood); box-shadow: 6px 6px 0 var(--shadow);
}
figure.photo figcaption { color: var(--ink-dim); font-size: .9rem; margin-top: .6rem; }

/* ── The calculator form ──────────────────────────────────────────────
   16px minimum on every text input: mobile Safari zooms the page when a
   focused field is under 16px, and does not zoom back. */
.field { margin: 0 0 1rem; }
.field label, .grid label { display: block; font-size: .9rem; color: var(--ink-dim); margin-bottom: .25rem; }
input[type="text"], input[type="number"], select {
  width: 100%; font: 16px/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  padding: .55rem .6rem; border: 2px solid var(--wood); background: var(--bg); color: var(--ink);
}
input:focus, select:focus { outline: 2px solid var(--gold); outline-offset: 1px; }
select { font-family: inherit; }
.hint { display: block; font-size: .85rem; color: var(--ink-dim); margin-top: .3rem; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: .8rem; margin: 0 0 1rem; }
.checks { display: grid; gap: .35rem; margin: 0 0 1.2rem; font-size: .95rem; }
.checks label { display: flex; gap: .5rem; align-items: baseline; }
.checks input { flex: none; accent-color: var(--gold); }
.palette { margin: 0 0 1.2rem; }
.palrow { display: flex; flex-wrap: wrap; gap: .3rem; align-items: center; margin-bottom: .4rem; }
.pallabel { font-size: .82rem; color: var(--ink-dim); width: 7.5rem; flex: none; }
/* 44px is the tap-target floor; these are hit with a thumb. */
.paltile {
  min-width: 2.6rem; min-height: 2.75rem; padding: .3rem .45rem;
  font: .95rem/1 var(--font-display);
  background: #f3e7cd; color: #1b1206; border: 2px solid #c9b48a; border-bottom-width: 4px;
  cursor: pointer;
}
.paltile:hover, .paltile:focus-visible { border-color: var(--gold); }
.rescore { border-top: none; padding-top: 0; font-size: 1.5rem; margin: 1.4rem 0 .6rem; }
.err { color: var(--red); }
.yes { color: var(--gold); }
.no { color: var(--dim); }
#out:empty { display: none; }

footer {
  margin-top: 3rem; padding-top: 1rem; border-top: 2px dashed var(--wood);
  color: var(--ink-dim); font-size: .92rem;
}
