:root {
  color-scheme: dark;
  --ink: #101d19;
  --ivory: #fff4db;
  --muted: #cec6af;
  --brass: #dcb97d;
  --serif: Georgia, "Songti SC", serif;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  min-height: 100vh;
  margin: 0;
  display: flex;
  flex-direction: column;
  color: var(--ivory);
  background:
    radial-gradient(ellipse at 13% 38%, #244039 0%, transparent 53%),
    radial-gradient(ellipse at 95% 58%, #493024 0%, transparent 53%),
    var(--ink);
}

.masthead,
main,
footer {
  width: min(1160px, calc(100% - 64px));
  margin-inline: auto;
}

.masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 4px 16px;
  padding-block: 24px 8px;
}

.site-nav { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.site-nav a, .text-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--ivory);
  font-size: .9375rem;
  font-weight: 650;
  text-decoration-color: #dcb97d88;
  text-underline-offset: 4px;
}
.site-nav a:hover, .text-link:hover { text-decoration-color: currentColor; }

.skip-link {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 10;
  padding: 10px 16px;
  border-radius: 6px;
  color: var(--ink);
  background: var(--ivory);
  translate: 0 -160%;
}
.skip-link:focus { translate: none; }

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--ivory);
  text-decoration: none;
  font: 700 1rem/1.2 var(--serif);
}

.brand-seal,
.game-seal {
  display: grid;
  place-items: center;
  font: 700 1.375rem/1 "Jade Lettering", "Songti SC", serif;
}

.brand-seal {
  width: 40px;
  height: 40px;
  border-radius: 11px;
  color: #fff1dc;
  background: linear-gradient(145deg, #bd5b49, #832a2b);
  box-shadow: inset 0 0 0 1px #e99478, inset 0 0 0 4px #832a2b9c, 0 4px 10px #050c0a70;
  rotate: -6deg;
}

.introduction {
  position: relative;
  isolation: isolate;
  padding: 14px 0 28px;
  text-align: center;
}

.introduction::before,
.introduction::after {
  content: "";
  position: absolute;
  inset-block-start: 38%;
  z-index: -1;
  width: min(15vw, 180px);
  height: 55px;
  opacity: .72;
  background:
    radial-gradient(ellipse at 50% 100%, transparent 49%, #d4ad725c 50% 51%, transparent 52% 62%, #d4ad723d 63% 64%, transparent 65%) 0 100% / 64px 42px repeat-x,
    radial-gradient(ellipse at 50% 100%, transparent 49%, #d4ad7245 50% 51%, transparent 52% 62%, #d4ad722c 63% 64%, transparent 65%) 32px 13px / 64px 39px repeat-x;
  mask-image: radial-gradient(ellipse at center, black 20%, transparent 76%);
}

.introduction::before { left: -14px; }
.introduction::after { right: -14px; }

.introduction h1 {
  margin: 0;
  font: 600 clamp(2.35rem, 5.8vw, 4.6rem)/1.04 var(--serif);
  letter-spacing: -.055em;
  text-wrap: balance;
}

.introduction h1 span { color: var(--brass); font-style: italic; }
.introduction p {
  max-width: 32rem;
  margin: 14px auto 0;
  color: var(--muted);
  font-size: clamp(1rem, 1.6vw, 1.125rem);
  line-height: 1.5;
  text-wrap: balance;
}

.game-shelf {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(22px, 4.4vw, 58px);
}

.game {
  position: relative;
  display: grid;
  grid-template-rows: auto 1fr;
  isolation: isolate;
  overflow: hidden;
  border-radius: 48% 48% 27px 27px / 24% 24% 27px 27px;
  color: inherit;
  text-decoration: none;
  background-color: var(--card);
  box-shadow: 0 20px 38px #030a0796;
  scroll-margin-block-start: 16px;
  transition: translate .18s ease, box-shadow .18s ease;
}

.mahjong {
  --card: #173a31;
  --edge: #a49365;
  --seal: #246751;
  --detail: #d2e1d4;
  --pill: #cee6c8;
  --pill-ink: #1b382d;
}

.xiangqi {
  --card: #422d24;
  --edge: #b78e64;
  --seal: #8d3e33;
  --detail: #ecd9c8;
  --pill: #f4d7a8;
  --pill-ink: #4b291c;
}

.game::after {
  position: absolute;
  z-index: 2;
  content: "";
  inset: 7px;
  border-radius: inherit;
  border: 1px solid var(--edge);
  opacity: .55;
  pointer-events: none;
}

.game-art {
  display: block;
  overflow: hidden;
  aspect-ratio: 1.85;
  background-color: var(--card);
}

.game-art img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 48%;
}

.game-copy {
  display: grid;
  align-content: start;
  grid-template-rows: auto auto 1fr auto;
  gap: 7px;
  position: relative;
  padding: 17px clamp(20px, 2.6vw, 32px) 24px;
  background: var(--card);
}

.game-copy::before {
  content: "";
  position: absolute;
  background: var(--card);
  inset: -16px 0 auto;
  height: 17px;
  border-radius: 50% 50% 0 0 / 100% 100% 0 0;
}

.game-seal {
  position: absolute;
  z-index: 3;
  top: -33px;
  right: clamp(20px, 2.6vw, 32px);
  width: 46px;
  height: 46px;
  border-radius: 50%;
  color: #fff1d2;
  background: var(--seal);
  box-shadow: inset 0 0 0 1px #f6dbad, inset 0 0 0 4px #25120a36, 0 3px 10px #08070480;
}

.variant {
  margin: 0;
  color: #e4c994;
  font-size: .875rem;
  font-weight: 650;
  letter-spacing: .045em;
}

.game-copy h2 {
  margin: 0;
  font: 700 clamp(1.5rem, 3.15vw, 2.4rem)/1.08 var(--serif);
  letter-spacing: -.025em;
}

.game-detail {
  margin: 0;
  max-width: 37ch;
  color: var(--detail);
  font-size: 1rem;
  line-height: 1.4;
}

.game-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0 16px;
  margin-top: 7px;
}

.play {
  display: inline-grid;
  place-items: center;
  min-height: 44px;
  padding: 8px 16px;
  border-radius: 999px;
  color: var(--pill-ink);
  background: var(--pill);
  font-size: .875rem;
  font-weight: 750;
  text-decoration: none;
  white-space: nowrap;
}

a:focus-visible {
  outline: 3px solid #ffe3a8;
  outline-offset: 5px;
}

@media (hover: hover) {
  .game:hover {
    translate: 0 -3px;
    box-shadow: 0 24px 44px #030a07bc;
  }
  .play:hover { background: #fff0ca; }
}

.guide-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  align-items: center;
  gap: 24px;
  margin-block: 20px 32px;
  padding: clamp(20px, 4vw, 48px);
  border: 1px solid var(--edge);
  border-radius: 26px;
  background: var(--card);
}

.guide-hero h1 {
  max-width: 14ch;
  margin: 8px 0 12px;
  font: 600 clamp(2rem, 5.4vw, 4rem)/1.06 var(--serif);
  letter-spacing: -.045em;
  text-wrap: balance;
}

.guide-intro > p:not(.variant) {
  max-width: 44ch;
  margin: 0 0 16px;
  color: var(--detail);
  font-size: 1.0625rem;
  line-height: 1.55;
}

.guide-art {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 48% 48% 16px 16px / 25% 25% 16px 16px;
}

.guide-content {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(14rem, .85fr);
  align-items: start;
  gap: clamp(24px, 5vw, 64px);
  max-width: 62rem;
  margin-inline: auto;
}

.guide-text section + section { margin-top: 30px; }
.guide-content h2 {
  margin: 0 0 12px;
  font: 700 clamp(1.4rem, 3vw, 2rem)/1.16 var(--serif);
}
.guide-content p, .guide-content li, .guide-content dd { color: var(--muted); line-height: 1.65; }
.guide-content p, .guide-content ol, .guide-content dl { margin: 0; }
.guide-content ol { padding-inline-start: 1.35em; }
.guide-content li + li { margin-top: 8px; }
.guide-content dt { margin-top: 10px; font-weight: 700; }
.guide-content dd { margin-inline-start: 0; }
.guide-note {
  padding: 20px;
  border: 1px solid #ab987763;
  border-radius: 15px;
  background: #101d19c9;
}
.guide-note h2 { font-size: 1.35rem; }
.guide-note .text-link { margin-top: 8px; }

footer {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px 26px;
  margin-top: auto;
  padding-block: 28px 22px;
  color: #c4b9a4;
  font-size: .8125rem;
  line-height: 1.5;
  text-align: center;
}

@media (max-width: 43rem) {
  .masthead, main, footer { width: calc(100% - 36px); }
  .masthead { padding-block: 16px 8px; }
  .introduction { padding-block: 18px 20px; }
  .introduction::before, .introduction::after { display: none; }
  .introduction p { margin-top: 11px; }
  .game-shelf { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .game-art { aspect-ratio: 2.15; }
  .game { border-radius: 47% 47% 24px 24px / 22% 22% 24px 24px; }
  .game-copy { padding-top: 13px; padding-bottom: 17px; }
  .game-seal { width: 40px; height: 40px; top: -27px; }
  .game-copy h2 { font-size: clamp(1.5rem, 7vw, 2.15rem); }
  .guide-hero, .guide-content { grid-template-columns: minmax(0, 1fr); }
  .guide-hero { margin-block: 12px 24px; gap: 16px; }
  .guide-hero h1 { max-width: none; }
  .guide-art { aspect-ratio: 2.15; object-fit: cover; }
}

@media (max-width: 24rem) {
  .masthead, main, footer { width: calc(100% - 28px); }
  .game-copy { padding-inline: 16px; gap: 6px; }
  .game-actions { gap: 0 12px; }
  .site-nav { gap: 6px 12px; }
  .play { padding-inline: 11px; }
}

@media (prefers-reduced-motion: reduce) {
  .game { transition: none; }
  .game:hover { translate: none; }
}
