:root {
  --ink: #1b1a2e;
  --paper: #f7f3ea;
  --card: #fffdf8;
  --text: #24222f;
  --muted: #6b6577;
  --line: #e3dccd;
  --red: #b3261e;
  --red-soft: #f3dcd6;
  --link: #9c2018;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, "Noto Serif SC", "Songti SC", serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #15141f;
    --card: #1e1d2b;
    --text: #e9e5f0;
    --muted: #a39db0;
    --line: #34314a;
    --red-soft: #3a1f22;
    --link: #f0806f;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--text); font: 17px/1.65 var(--sans); }
a { color: var(--link); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
img, svg { max-width: 100%; }
.skip { position: absolute; left: -999px; top: 0; background: var(--red); color: #fff; padding: 8px 12px; z-index: 10; }
.skip:focus { left: 8px; }

/* header */
.top { background: var(--ink); color: #f6efe2; position: sticky; top: 0; z-index: 5; }
.top-in { max-width: 1180px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 16px; }
.brand { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; margin-right: auto; }
.brand .mark { width: 40px; height: 40px; flex: none; }
.brand-txt { display: flex; flex-direction: column; line-height: 1.1; }
.brand-txt b { font: 600 22px/1 var(--serif); letter-spacing: .01em; }
.brand-txt small { font-size: 12px; color: #b9b3c9; margin-top: 3px; }
#nav { display: flex; gap: 2px; flex-wrap: wrap; justify-content: flex-end; }
#nav a { color: #e9e3f2; text-decoration: none; padding: 7px 10px; border-radius: 6px; font-size: 15px; }
#nav a:hover { background: rgba(255,255,255,.08); }
#nav a[aria-current="page"] { background: var(--red); color: #fff; }
#nav a.lang { border: 1px solid rgba(255,255,255,.25); margin-left: 6px; }
.menu-btn { display: none; background: transparent; color: inherit; border: 1px solid rgba(255,255,255,.3); border-radius: 6px; padding: 7px 12px; font: inherit; font-size: 15px; }
@media (max-width: 860px) {
  .menu-btn { display: block; }
  #nav { display: none; position: absolute; left: 0; right: 0; top: 100%; background: var(--ink); flex-direction: column; padding: 8px 16px 16px; border-top: 1px solid rgba(255,255,255,.1); }
  #nav.open { display: flex; }
  #nav a { padding: 10px 12px; font-size: 17px; }
  #nav a.lang { margin: 8px 0 0; text-align: center; }
}

/* page */
main { min-height: 60vh; }
.page-head { max-width: 1180px; margin: 0 auto; padding: 40px 16px 8px; }
.page-head h1 { font: 600 clamp(32px, 5vw, 50px)/1.1 var(--serif); margin: 0; letter-spacing: -.01em; }
.page-head .lead { font-size: 19px; color: var(--muted); max-width: 720px; margin: 12px 0 0; }
.page-head .upd { font-size: 14px; color: var(--muted); margin: 10px 0 0; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 16px 16px 64px; }
.wrap.with-toc { display: grid; grid-template-columns: 230px minmax(0, 760px); gap: 48px; }
.wrap:not(.with-toc) .prose { max-width: 820px; }
.toc { position: sticky; top: 84px; align-self: start; font-size: 14px; border-left: 3px solid var(--red); padding-left: 14px; max-height: calc(100vh - 100px); overflow: auto; }
.toc p { font-weight: 700; text-transform: uppercase; letter-spacing: .06em; font-size: 12px; color: var(--muted); margin: 0 0 8px; }
.toc ol { list-style: none; margin: 0; padding: 0; }
.toc li { margin: 0 0 6px; }
.toc a { color: var(--text); text-decoration: none; }
.toc a:hover { color: var(--link); }
@media (max-width: 960px) {
  .wrap.with-toc { display: block; }
  .toc { position: static; max-height: none; margin: 0 0 24px; }
}

/* prose */
.prose h2 { font: 600 30px/1.2 var(--serif); margin: 48px 0 12px; scroll-margin-top: 80px; }
.prose h3 { font: 600 22px/1.3 var(--serif); margin: 32px 0 8px; scroll-margin-top: 80px; }
.prose h2:first-child { margin-top: 8px; }
.prose p, .prose ul, .prose ol { margin: 0 0 16px; }
.prose li { margin: 0 0 6px; }
.prose blockquote { margin: 20px 0; padding: 4px 18px; border-left: 4px solid var(--red); background: var(--card); color: var(--muted); }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 32px 0; }
.prose code { font-size: .9em; background: var(--card); padding: 1px 5px; border-radius: 4px; }
.table { overflow-x: auto; margin: 0 0 20px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); }
.prose table { border-collapse: collapse; width: 100%; font-size: 15px; line-height: 1.45; }
.prose th, .prose td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.prose th { background: var(--red-soft); font-weight: 650; white-space: nowrap; }
.prose tr:last-child td { border-bottom: 0; }
sup.ref { font-size: 11px; line-height: 0; margin-left: 1px; }
sup.ref a { text-decoration: none; padding: 0 2px; border-radius: 3px; background: var(--red-soft); color: var(--link); font-weight: 700; }
.sources { margin-top: 48px; padding-top: 8px; border-top: 2px solid var(--line); font-size: 14.5px; }
.sources h2 { font-size: 22px; }
.sources li { word-break: break-word; scroll-margin-top: 90px; }
.sources li:target { background: var(--red-soft); border-radius: 4px; }

/* home */
.home .hero { background: var(--ink); color: #f6efe2; }
.hero-in { max-width: 1180px; margin: 0 auto; padding: 56px 16px 64px; display: grid; grid-template-columns: 1.3fr 1fr; gap: 40px; align-items: center; }
.hero h1 { font: 600 clamp(38px, 6vw, 64px)/1.05 var(--serif); margin: 0 0 16px; }
.hero h1 span { display: block; color: #e0533f; font-size: .55em; margin-top: 8px; font-family: var(--sans); font-weight: 500; }
.hero p { font-size: 19px; color: #d6d0e2; margin: 0 0 24px; max-width: 600px; }
.hero .mark { width: min(320px, 70vw); height: auto; justify-self: center; }
.btn { display: inline-block; background: var(--red); color: #fff; text-decoration: none; padding: 12px 22px; border-radius: 8px; font-weight: 650; margin: 0 10px 10px 0; }
.btn.ghost { background: transparent; border: 1px solid rgba(255,255,255,.35); }
.btn:hover { filter: brightness(1.1); }
@media (max-width: 760px) { .hero-in { grid-template-columns: 1fr; padding: 36px 16px 44px; } .hero .mark { width: 160px; grid-row: 1; justify-self: start; } }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; margin: 8px 0 32px; padding: 0; list-style: none; }
.cards li { margin: 0; }
.cards a { display: block; height: 100%; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 18px 18px 16px; color: var(--text); text-decoration: none; transition: border-color .15s, transform .15s; }
.cards a:hover { border-color: var(--red); transform: translateY(-2px); }
.cards b { display: block; font: 600 21px/1.25 var(--serif); margin-bottom: 6px; }
.cards i { display: block; font-style: normal; color: var(--red); font-size: 14px; letter-spacing: .15em; margin-bottom: 4px; }
.cards span { color: var(--muted); font-size: 15px; line-height: 1.5; }
.home .wrap .prose { max-width: none; }

/* game */
.game-wrap { max-width: 1000px; margin: 8px auto 0; padding: 0 16px; }
.game { position: relative; background: #0f0e1a; border-radius: 10px; overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none; aspect-ratio: var(--ar, 16 / 9); max-height: calc(100vh - 140px); margin: 0 auto; }
.game canvas { display: block; width: 100%; height: 100%; }
.fs-btn { display: block; margin: 10px auto 0; background: var(--card); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 8px 16px; font: inherit; font-size: 15px; cursor: pointer; }
.game-wrap.pseudo-fs { position: fixed; inset: 0; z-index: 50; background: #000; max-width: none; margin: 0; padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); display: flex; flex-direction: column; justify-content: center; }
.game-wrap:fullscreen { background: #000; max-width: none; padding: 0; display: flex; flex-direction: column; justify-content: center; }
.game-wrap:fullscreen .game, .game-wrap.pseudo-fs .game { max-height: calc(100dvh - 56px); max-width: calc((100dvh - 56px) * var(--arn, 1.7778)); width: 100%; border-radius: 0; }
.game-wrap:fullscreen .fs-btn, .game-wrap.pseudo-fs .fs-btn { background: #222; color: #fff; border-color: #444; }
body.no-scroll { overflow: hidden; }

/* footer */
.foot { background: var(--ink); color: #c9c3d8; font-size: 14px; }
.foot-in { max-width: 1180px; margin: 0 auto; padding: 28px 16px 36px; }
.foot p { margin: 0 0 10px; max-width: 760px; }
.foot a { color: #f0c9c2; }
