/* Shared by every page of the main domain (apps/home). Same origin, no web fonts, no external requests. */
:root {
  --bg: #f6f2ea;
  --ink: #26231f;
  --muted: #7a7266;
  --line: #ddd5c6;
  --card: #fffdf8;
  --accent: #b4532a;
  --on-accent: #fffdf8;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1d1b18;
    --ink: #ece6da;
    --muted: #9a9283;
    --line: #38342d;
    --card: #25221e;
    --accent: #e08a5e;
    --on-accent: #1d1b18;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.7 -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Noto Sans CJK SC", system-ui, sans-serif;
}
main {
  flex: 1;
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  padding: 28px 24px 40px;
}
main.home { padding-top: 14vh; }
main.wide { max-width: 940px; }
main.prose { max-width: 640px; }
h1 {
  margin: 0;
  font-size: 34px;
  font-weight: 600;
  letter-spacing: 0.02em;
}
h2 {
  margin: 48px 0 14px;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.12em;
  color: var(--muted);
}
p { margin: 14px 0 0; text-wrap: pretty; }
ul { margin: 14px 0 0; padding-left: 1.3em; }
li { margin-top: 6px; }
a { color: var(--accent); }
.tag { margin: 8px 0 0; color: var(--muted); text-wrap: pretty; }
.soon { margin: 14px 2px 0; color: var(--muted); font-size: 14px; }
.note { color: var(--muted); font-size: 14px; }

/* "buliaoart / 游戏 / 页面" trail with the language switch on the right */
.crumbs {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 4px 16px;
  margin: 0 0 36px;
  font-size: 14px;
  color: var(--muted);
}
.crumbs a { color: inherit; text-decoration: none; }
.crumbs a:hover, .crumbs a:focus-visible { text-decoration: underline; }
.crumbs .sep { margin: 0 0.45em; }

/* cards: a work on the home page, a related page on a game page */
.work {
  display: block;
  padding: 18px 20px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  color: inherit;
  text-decoration: none;
  transition: border-color 0.15s, transform 0.15s;
}
.work + .work { margin-top: 10px; }
.work:hover, .work:focus-visible {
  border-color: var(--accent);
  transform: translateY(-1px);
  outline: none;
}
.work b { display: block; font-size: 18px; font-weight: 600; }
.work span { display: block; margin-top: 2px; color: var(--muted); font-size: 14px; }
.work i {
  display: inline-block;
  margin-top: 10px;
  font-style: normal;
  font-size: 14px;
  color: var(--accent);
}

.btn {
  display: inline-block;
  margin-top: 22px;
  padding: 11px 24px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 600;
  text-decoration: none;
}
.btn:hover, .btn:focus-visible { opacity: 0.88; outline: none; }
.btn.ghost { background: transparent; color: var(--accent); box-shadow: inset 0 0 0 2px var(--accent); }
mark { background: var(--mark, #f3dcb9); color: inherit; padding: 0 0.2em; border-radius: 3px; }

/* the address people can copy even when no mail app opens */
.mail {
  display: block;
  margin-top: 18px;
  padding: 16px 20px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  font-size: 18px;
  word-break: break-all;
  user-select: all;
}

footer {
  padding: 20px 24px 28px;
  text-align: center;
  font-size: 13px;
  color: var(--muted);
}
footer a { color: inherit; text-decoration: none; }
footer a:hover { text-decoration: underline; }

/* ---- game pages (body.game): the game's own paper / chalk palettes (packages/art themes), on graph paper ---- */
body.game {
  --bg: #f4efe6;
  --ink: #26241f;
  --muted: #5f584c;
  --line: #d9cfbc;
  --card: #fffdf8;
  --accent: #1c4fa0;
  --on-accent: #ffffff;
  --mark: #fbe3a1;
  --grid: #e6dfd0;
  --face: #fffdf8;
  --face-given: #ece5d6;
  --edge: #8c826f;
  --given: #26241f;
  --player: #1c4fa0;
  --rule: #4a463d;
  background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 28px 28px;
}
@media (prefers-color-scheme: dark) {
  body.game {
    --bg: #161e1b;
    --ink: #eef0ea;
    --muted: #a8b4ae;
    --line: #2e3e37;
    --card: #22302b;
    --accent: #8dc8f0;
    --on-accent: #10202c;
    --mark: #3e4a33;
    --grid: #1c2723;
    --face: #2c3b35;
    --face-given: #25332d;
    --edge: #7a8e85;
    --given: #f1efe7;
    --player: #8dc8f0;
    --rule: #cfd3c9;
  }
}

.hero { display: grid; gap: 28px; align-items: center; }
.hero h1 { margin-top: 14px; font-size: 40px; line-height: 1.15; }
.app-icon { display: block; width: 72px; height: 72px; border-radius: 18px; border: 1px solid var(--line); }
.lead { font-size: 18px; }
.cta { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-top: 24px; }
.cta .btn { margin-top: 0; }
.cta.end { margin-top: 48px; }
.hero .note { margin-top: 14px; }
.demo { margin: 0; justify-self: center; text-align: center; }
.demo video {
  display: block;
  width: 100%;
  max-width: 260px;
  height: auto;
  aspect-ratio: 9 / 16;
  margin: 0 auto;
  border-radius: 22px;
  border: 1px solid var(--line);
  background: var(--card);
  box-shadow: 0 10px 30px rgba(38, 36, 31, 0.14);
}
.demo figcaption { margin-top: 10px; font-size: 13px; color: var(--muted); }
@media (min-width: 760px) {
  .hero { grid-template-columns: 1fr 280px; gap: 56px; }
  .hero h1 { font-size: 46px; }
  .demo video { max-width: 280px; }
}

.points { display: grid; gap: 14px; margin-top: 14px; }
.point { padding: 18px 20px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; }
.point h3 { margin: 0; font-size: 17px; }
.point p { margin: 8px 0 0; font-size: 15px; color: var(--muted); }
@media (min-width: 760px) { .points { grid-template-columns: repeat(3, 1fr); } }

.shots { display: flex; gap: 16px; margin: 14px -24px 0; padding: 4px 24px 12px; overflow-x: auto; scroll-snap-type: x mandatory; }
.shots figure { flex: 0 0 200px; margin: 0; scroll-snap-align: start; }
.shots img { display: block; width: 100%; height: auto; aspect-ratio: 9 / 16; border-radius: 18px; border: 1px solid var(--line); background: var(--card); }
.shots figcaption { margin-top: 8px; font-size: 13px; text-align: center; color: var(--muted); }
@media (min-width: 940px) {
  .shots { margin-inline: 0; padding-inline: 0; overflow: visible; justify-content: space-between; }
}

.steps { counter-reset: step; list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 12px; }
.steps li { counter-increment: step; position: relative; margin: 0; padding-left: 44px; }
.steps li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 1px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--on-accent);
  text-align: center;
  line-height: 30px;
  font-size: 15px;
  font-weight: 600;
}

footer nav { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 18px; margin-bottom: 10px; }

/* the long-division diagram: cells are placed on a 5 x 8 grid with the r<row> / c<col+1> classes */
.pair { display: flex; flex-wrap: wrap; justify-content: center; gap: 24px 36px; margin-top: 18px; }
.pair figure { margin: 0; text-align: center; }
.pair figcaption { margin-top: 8px; font-size: 13px; color: var(--muted); }
.long {
  --c: 36px;
  display: grid;
  grid-template-columns: repeat(5, var(--c));
  grid-template-rows: repeat(8, var(--c));
  width: max-content;
  margin: 0 auto;
  font-size: calc(var(--c) * 0.55);
  font-variant-numeric: tabular-nums;
}
.long .d {
  display: block;
  margin: 2px;
  border: 1px solid var(--edge);
  border-radius: 6px;
  background: var(--face);
  color: var(--given);
  text-align: center;
  line-height: calc(var(--c) - 6px);
  font-weight: 600;
}
.long .d.g { background: var(--face-given); }
.long .d.p { color: var(--player); }
.long .ln { margin: 0 2px; border-bottom: 2px solid var(--rule); }
.long .br { margin-left: 2px; border-top: 2px solid var(--rule); border-left: 2px solid var(--rule); border-top-left-radius: 8px; }
.long .r0 { grid-row: 1; } .long .r1 { grid-row: 2; } .long .r2 { grid-row: 3; } .long .r3 { grid-row: 4; }
.long .r4 { grid-row: 5; } .long .r5 { grid-row: 6; } .long .r6 { grid-row: 7; } .long .r7 { grid-row: 8; }
.long .c0 { grid-column: 1; } .long .c1 { grid-column: 2; } .long .c2 { grid-column: 3; }
.long .c3 { grid-column: 4; } .long .c4 { grid-column: 5; }

.faq { margin-top: 14px; }
.faq details { padding: 12px 0; border-top: 1px solid var(--line); }
.faq details:last-child { border-bottom: 1px solid var(--line); }
.faq summary { cursor: pointer; font-weight: 600; }
.faq p { margin: 8px 0 0; font-size: 15px; color: var(--muted); }

/* community entry (an invite link plus the age note) and the small icon in buttons and the footer */
.btn svg { display: inline-block; width: 20px; height: 20px; margin: -3px 8px -3px 0; vertical-align: middle; fill: currentColor; }
.community { margin-top: 14px; padding: 18px 20px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; }
.community p:first-child { margin-top: 0; }
.community .btn { margin-top: 14px; }
.community .note { margin-bottom: 0; }
footer nav a svg { display: inline-block; width: 14px; height: 14px; margin: -2px 5px 0 0; vertical-align: middle; fill: currentColor; }
