:root {
  color-scheme: light;
  font-family: "Noto Sans SC", "Microsoft YaHei", system-ui, sans-serif;
  color: #24231f;
  background: #f4efe2;
  font-synthesis: none;
  --paper: #fffdf7;
  --ink: #24231f;
  --muted: #746e61;
  --line: #d2c8b5;
  --line-strong: #aaa08f;
  --red: #d94a43;
  --red-dark: #a93631;
  --blue: #3978e8;
  --blue-dark: #255cb8;
  --green: #4f7d4a;
  --shadow: 0 22px 54px rgba(70, 57, 35, 0.14);
}

* {
  box-sizing: border-box;
}

[hidden] { display: none !important; }
html[lang="en"] { font-family: system-ui, "Segoe UI", sans-serif; }
html[lang="en"] h1, html[lang="en"] h2, html[lang="en"] h3 { font-family: Georgia, "Times New Roman", serif; line-height: 1.15; }
html[lang="en"] .brand-copy strong { letter-spacing: 0; }
html[lang="en"] .piece { font: 700 12px/1.2 system-ui, sans-serif; }
html[lang="en"] .placeholder-mark { font-family: system-ui, sans-serif; }

html {
  min-width: 320px;
  background: #f4efe2;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 8% -5%, rgba(217, 74, 67, 0.1), transparent 30rem),
    radial-gradient(circle at 100% 8%, rgba(57, 120, 232, 0.11), transparent 35rem),
    #f4efe2;
}

a {
  color: inherit;
  text-decoration: none;
}

.site-shell {
  width: min(1160px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: max(16px, env(safe-area-inset-top)) clamp(16px, 4vw, 44px) max(24px, env(safe-area-inset-bottom));
}

.topbar {
  display: flex;
  min-height: 60px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: clamp(32px, 5vw, 58px);
  gap: 16px;
}

.topbar-actions { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 8px; }
.brand { flex-shrink: 0; }
.library-count { white-space: nowrap; }
.language-button { min-height: 42px; padding: 0 13px; color: var(--muted); font: inherit; background: var(--paper); border: 1px solid var(--line); border-radius: 12px; cursor: pointer; white-space: nowrap; }
.language-button:hover { color: var(--ink); border-color: var(--line-strong); }
.language-button:focus-visible { outline: 3px solid rgba(57, 120, 232, .45); outline-offset: 3px; }

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  border-radius: 14px;
  outline: none;
}

.brand:focus-visible,
.game-card:focus-visible {
  outline: 3px solid rgba(57, 120, 232, 0.35);
  outline-offset: 5px;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  color: #fff;
  font-family: "STSong", "SimSun", serif;
  font-size: 23px;
  font-weight: 700;
  background: var(--ink);
  border-radius: 13px;
}

.brand-copy strong,
.brand-copy small {
  display: block;
}

.brand-copy strong {
  font-size: 18px;
  letter-spacing: 0.12em;
}

.brand-copy small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.08em;
}

.library-count {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 13px;
  color: var(--green);
  font-size: 13px;
  font-weight: 700;
  background: rgba(255, 253, 247, 0.72);
  border: 1px solid var(--line);
  border-radius: 999px;
}

.library-count i {
  width: 7px;
  height: 7px;
  background: var(--green);
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(79, 125, 74, 0.12);
}

.intro {
  max-width: 760px;
  margin-bottom: clamp(42px, 7vw, 76px);
}

.eyebrow,
.section-kicker {
  margin: 0 0 10px;
  color: var(--blue-dark);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.15em;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1,
h2,
h3 {
  font-family: "STSong", "SimSun", serif;
}

h1 {
  margin-bottom: 16px;
  font-size: clamp(38px, 7vw, 68px);
  line-height: 1.06;
  letter-spacing: -0.035em;
}

.intro > p:last-child {
  max-width: 620px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: clamp(15px, 2vw, 18px);
  line-height: 1.75;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 28px;
  margin-bottom: 22px;
}

.section-heading h2 {
  margin-bottom: 0;
  font-size: clamp(27px, 4vw, 38px);
}

.section-heading > p {
  max-width: 470px;
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.65;
}

.game-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.game-card {
  position: relative;
  display: flex;
  min-height: 268px;
  overflow: hidden;
  flex-direction: column;
  padding: 24px;
  background: rgba(255, 253, 247, 0.88);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: 0 8px 24px rgba(70, 57, 35, 0.05);
}

.featured-game {
  min-height: 354px;
  grid-column: span 2;
  justify-content: flex-end;
  color: #fff;
  background: #262a2e;
  border-color: #262a2e;
  box-shadow: 0 22px 52px rgba(36, 35, 31, 0.2);
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.featured-game:hover {
  transform: translateY(-4px);
  box-shadow: 0 28px 64px rgba(36, 35, 31, 0.25);
}

.featured-game::after {
  position: absolute;
  inset: 0;
  pointer-events: none;
  content: "";
  background: linear-gradient(90deg, rgba(22, 24, 26, 0.96) 0%, rgba(22, 24, 26, 0.76) 44%, rgba(22, 24, 26, 0.12) 100%);
}

.piece-field {
  position: absolute;
  inset: 0;
}

.piece {
  position: absolute;
  z-index: 1;
  display: grid;
  width: 82px;
  height: 82px;
  place-items: center;
  font-family: "STSong", "SimSun", serif;
  font-size: 31px;
  font-weight: 700;
  background: #efe2c3;
  border: 6px double currentColor;
  border-radius: 50%;
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.3), inset 0 0 0 2px rgba(255, 255, 255, 0.38);
}

.piece-red { color: var(--red-dark); }
.piece-blue { color: var(--blue-dark); }
.piece-dark { color: #34312c; }
.piece-one { top: 36px; right: 42px; transform: rotate(8deg); }
.piece-two { top: 104px; right: 139px; transform: rotate(-8deg); }
.piece-three { right: 30px; bottom: 38px; transform: rotate(-7deg); }
.piece-four { top: 28px; right: 232px; transform: rotate(5deg); }

.game-card-copy {
  position: relative;
  z-index: 2;
}

.featured-game .game-card-copy {
  max-width: 350px;
}

.card-meta {
  display: flex;
  min-height: 25px;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  color: rgba(255, 255, 255, 0.68);
  font-size: 12px;
}

.live-badge,
.soon-badge {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  padding: 0 9px;
  font-size: 11px;
  font-weight: 800;
  border-radius: 999px;
}

.live-badge {
  color: #dff1db;
  background: rgba(92, 150, 83, 0.28);
  border: 1px solid rgba(157, 210, 147, 0.25);
}

.soon-badge {
  color: var(--muted);
  background: #eee8dc;
}

.game-card h3 {
  margin-bottom: 9px;
  font-size: 28px;
}

.featured-game h3 {
  margin-bottom: 10px;
  font-size: clamp(32px, 5vw, 48px);
}

.game-card p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.65;
}

.featured-game p {
  color: rgba(255, 255, 255, 0.72);
}

.play-link {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin-top: 20px;
  font-size: 14px;
  font-weight: 800;
}

.play-link b {
  font-size: 19px;
  transition: transform 160ms ease;
}

.featured-game:hover .play-link b {
  transform: translateX(4px);
}

.upcoming-card {
  justify-content: space-between;
}

.playable-game { justify-content: space-between; gap: 28px; transition: transform 180ms ease, border-color 180ms ease; }
.playable-game:hover { transform: translateY(-4px); border-color: #807764; }
.playable-game .card-meta { color: var(--muted); flex-wrap: wrap; }
.playable-game .live-badge { color: #375d33; background: #e1eddc; border-color: #c4d5bd; }
.playable-game .play-link { color: var(--green); }
.mini-gomoku { position: relative; display: flex; align-items: center; gap: 5px; width: 158px; height: 70px; padding: 10px; background: repeating-linear-gradient(0deg, transparent 0 21px, #c8b994 21px 22px), repeating-linear-gradient(90deg, transparent 0 21px, #c8b994 21px 22px); border-radius: 9px; }
.mini-gomoku i { width: 23px; height: 23px; flex: 0 0 23px; border-radius: 50%; background: radial-gradient(circle at 35% 25%, #66645b, #24231f 65%); box-shadow: 0 3px 4px #30271533; }
.mini-gomoku i:nth-child(even) { background: radial-gradient(circle at 35% 25%, white, #e1d9ca 70%); border: 1px solid #b5ac9a; transform: translateY(21px); }
.mini-xiangqi, .mini-cycle { display: flex; gap: 12px; align-items: center; min-height: 70px; }
.mini-xiangqi span { display: grid; place-items: center; width: 59px; height: 59px; color: var(--red-dark); border: 4px double currentColor; border-radius: 50%; background: #f1e2bd; font: 700 27px "STSong", "SimSun", serif; box-shadow: 0 4px 0 #b6a279; }
.mini-xiangqi span:last-child { color: var(--ink); transform: rotate(9deg) translateY(5px); }
.mini-cycle { gap: 8px; }
.mini-cycle span { display: grid; place-items: center; width: 44px; height: 54px; border: 1px solid #c6b388; border-radius: 8px; background: #f4e5c4; color: var(--blue-dark); box-shadow: 0 3px 0 #ccb98f; font: 700 22px "STSong", "SimSun", serif; }
.mini-cycle b { color: #958b76; }

.placeholder-mark {
  display: grid;
  width: 54px;
  height: 54px;
  place-items: center;
  color: var(--paper);
  font-family: "STSong", "SimSun", serif;
  font-size: 22px;
  font-weight: 700;
  background: #5d5a53;
  border-radius: 17px;
}

.mark-cross { background: #3e7753; }
.mark-chess { background: #a8403b; }
.mark-grid { background: #3d69a9; }
.mark-memory { background: #765696; }
.mark-number { background: #a36f34; }

.upcoming-card .card-meta {
  margin-bottom: 8px;
}

.site-footer {
  display: grid;
  align-items: center;
  justify-items: center;
  gap: 12px;
  margin-top: clamp(52px, 8vw, 92px);
  padding: 24px 2px 4px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
  border-top: 1px solid var(--line);
}

.footer-copy {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
}

.icp-link {
  color: var(--muted);
  line-height: 1.7;
  text-decoration: none;
}

.icp-link:hover {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.icp-link:focus-visible {
  color: var(--ink);
  border-radius: 4px;
  outline: 3px solid rgba(57, 120, 232, 0.3);
  outline-offset: 4px;
}

@media (max-width: 820px) {
  .game-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .featured-game {
    grid-column: span 2;
  }

  .section-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }
}

@media (max-width: 560px) {
  .site-shell {
    padding-right: 14px;
    padding-left: 14px;
  }

  .topbar {
    margin-bottom: 34px;
  }

  .library-count {
    padding: 0 10px;
  }

  .intro {
    margin-bottom: 44px;
  }

  .game-grid {
    grid-template-columns: 1fr;
  }

  .featured-game {
    min-height: 430px;
    grid-column: auto;
  }

  .featured-game::after {
    background: linear-gradient(0deg, rgba(22, 24, 26, 0.98) 0%, rgba(22, 24, 26, 0.84) 52%, rgba(22, 24, 26, 0.1) 100%);
  }

  .piece-one { top: 28px; right: 22px; }
  .piece-two { top: 110px; right: 105px; }
  .piece-three { top: 40px; right: 190px; bottom: auto; }
  .piece-four { top: 132px; right: 16px; }

  .game-card {
    min-height: 244px;
    padding: 21px;
    border-radius: 21px;
  }

  .featured-game {
    min-height: 430px;
  }

  .footer-copy {
    flex-direction: column;
    gap: 6px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
