:root {
  --bg: #f4f6fb;
  --panel: #ffffff;
  --ink: #172033;
  --muted: #667085;
  --line: #d9e1ec;
  --accent: #111827;
  --accent-soft: #eef2ff;
  --gold: #d99a1b;
  --red: #c2410c;
  --green: #166534;
  --blue: #1d4ed8;
  --shadow: 0 16px 40px rgba(23, 32, 51, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--bg);
}

body {
  margin: 0;
  color: var(--ink);
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", Arial,
    sans-serif;
  line-height: 1.6;
  letter-spacing: 0;
}

a {
  color: inherit;
}

button {
  font: inherit;
}

.site-header {
  height: 60px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  padding: 0 28px;
  background: #172033;
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 80;
}

.brand {
  font-size: 20px;
  font-weight: 900;
  text-decoration: none;
  white-space: nowrap;
}

.desktop-nav {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 6px;
}

.desktop-nav a {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
  border-radius: 6px;
  color: rgba(255, 255, 255, 0.84);
  text-decoration: none;
}

.desktop-nav a:hover,
.desktop-nav a:focus-visible {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
  outline: none;
}

.header-download,
.mobile-menu {
  display: none;
}

main {
  padding: 28px 18px 0;
}

.home-shell {
  width: min(1120px, 100%);
  margin: 0 auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.home-top {
  padding: 22px 24px;
  background:
    linear-gradient(90deg, rgba(17, 24, 39, 0.05) 1px, transparent 1px),
    linear-gradient(rgba(17, 24, 39, 0.05) 1px, transparent 1px), #fbfcff;
  background-size: 18px 18px;
  border-bottom: 1px solid var(--line);
}

.home-top h1 {
  margin: 0 0 4px;
  font-size: 34px;
  line-height: 1.15;
}

.home-top p {
  margin: 0;
  color: var(--muted);
  font-weight: 700;
}

.client-notice {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  background: #fff7e6;
  border-bottom: 1px solid #f1d39b;
  color: #68430d;
}

.client-notice.hidden {
  display: none;
}

.client-notice-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: #f4d792;
  color: #6b4405;
  font-size: 18px;
  font-weight: 900;
}

.client-notice p {
  margin: 0;
  min-width: 0;
}

.client-notice a {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
  border-radius: 6px;
  background: var(--gold);
  color: #fff;
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
}

.client-notice-close {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 6px;
  background: rgba(104, 67, 13, 0.1);
  color: #68430d;
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
}

.chess-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 18px;
}

.chess-card {
  min-height: 132px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  text-decoration: none;
  transition:
    border-color 0.18s,
    transform 0.18s,
    box-shadow 0.18s;
}

.chess-card:hover,
.chess-card:focus-visible {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 10px 22px rgba(23, 32, 51, 0.1);
  outline: none;
}

.card-icon {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: #fff;
  font-size: 24px;
  font-weight: 900;
}

.card-icon.gomoku {
  background: #111827;
}

.card-icon.xiangqi {
  background: var(--red);
}

.card-icon.weiqi {
  background: var(--green);
}

.card-icon.chess {
  background: var(--blue);
}

.card-icon.reversi {
  background: #0f766e;
}

.card-icon.checkers {
  background: #9f1239;
}

.card-icon.tic {
  background: #7c2d12;
}

.chess-card strong {
  display: block;
  font-size: 22px;
  line-height: 1.2;
}

.chess-card b {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 14px;
}

.content-page {
  width: min(980px, 100%);
  margin: 28px auto 0;
  padding: 0 18px;
}

.content-page article {
  margin-bottom: 18px;
  padding: 28px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.content-page h1,
.content-page h2 {
  margin: 0 0 10px;
  line-height: 1.25;
}

.content-page h1 {
  font-size: 32px;
}

.content-page h2 {
  margin-top: 24px;
  font-size: 23px;
}

.content-page p,
.content-page li {
  color: var(--muted);
}

.content-page a {
  color: var(--accent);
  font-weight: 800;
}

.play-shell {
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: 18px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.board-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  margin-bottom: 14px;
}

.board-head h1 {
  margin: 0 0 4px;
  font-size: 30px;
  line-height: 1.2;
}

.board-head p {
  margin: 0;
  color: var(--muted);
  font-weight: 800;
}

.play-download {
  min-height: 42px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  margin: -2px 0 14px;
  padding: 7px 10px;
  border: 1px solid #f1d39b;
  border-radius: 7px;
  background: #fff7e6;
  color: #68430d;
}

.play-download span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 14px;
  font-weight: 800;
  white-space: nowrap;
}

.play-download a {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  border-radius: 6px;
  background: var(--gold);
  color: #fff;
  font-size: 13px;
  font-weight: 900;
  text-decoration: none;
  white-space: nowrap;
}

.action-row,
.mode-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.action-row button,
.action-row a,
.mode-tabs button {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  font-weight: 900;
  text-decoration: none;
}

.action-row button:first-child,
.mode-tabs button.active {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}

.action-row button:disabled {
  cursor: not-allowed;
  color: #98a2b3;
  background: #eef2f7;
}

.game-layout {
  display: grid;
  grid-template-columns: minmax(320px, 1fr) 220px;
  gap: 16px;
  align-items: start;
}

.board-wrap {
  display: grid;
  place-items: center;
  overflow: auto;
  padding: 12px;
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(17, 24, 39, 0.05) 1px, transparent 1px),
    linear-gradient(rgba(17, 24, 39, 0.05) 1px, transparent 1px), #f8fafc;
  background-size: 18px 18px;
}

.info-panel {
  display: grid;
  gap: 10px;
}

.info-panel div {
  min-height: 72px;
  display: grid;
  align-content: center;
  gap: 4px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.info-panel span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.info-panel strong {
  font-size: 20px;
  line-height: 1.2;
}

.gomoku-board,
.xiangqi-board,
.western-board,
.reversi-board,
.checkers-board,
.tic-board {
  width: min(680px, 100%);
  aspect-ratio: 1;
  display: grid;
  touch-action: manipulation;
  user-select: none;
}

.gomoku-board {
  grid-template-columns: repeat(15, 1fr);
  grid-template-rows: repeat(15, 1fr);
  padding: 8px;
  border-radius: 8px;
  background: #d8a657;
}

.gomoku-cell {
  position: relative;
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 0;
  padding: 0;
  border: 0;
  background:
    linear-gradient(#5f3a16, #5f3a16) center / 100% 1px no-repeat,
    linear-gradient(90deg, #5f3a16, #5f3a16) center / 1px 100% no-repeat;
  cursor: pointer;
}

.stone {
  display: block;
  aspect-ratio: 1;
  width: 74%;
  height: auto;
  border-radius: 50%;
  box-shadow: 0 2px 5px rgba(2, 6, 23, 0.35);
}

.stone.black {
  background: #111827;
}

.stone.white {
  background: #f8fafc;
  border: 1px solid #cbd5e1;
}

.xiangqi-board {
  grid-template-columns: repeat(9, 1fr);
  grid-template-rows: repeat(10, 1fr);
  aspect-ratio: 9 / 10;
  padding: 8px;
  border-radius: 8px;
  background: #d9a85f;
}

.xiangqi-cell,
.western-cell,
.go-cell {
  position: relative;
  display: grid;
  place-items: center;
  border: 1px solid rgba(17, 24, 39, 0.24);
  cursor: pointer;
}

.xiangqi-cell {
  background: #e7bd78;
}

.xiangqi-cell.shade {
  background: #e0b46c;
}

.xiangqi-cell.selected,
.western-cell.selected {
  outline: 3px solid #facc15;
  z-index: 2;
}

.xiangqi-piece {
  width: 82%;
  height: 82%;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #fff7ed;
  border: 2px solid currentColor;
  font-size: clamp(16px, 4vw, 30px);
  font-weight: 900;
  box-shadow: 0 2px 5px rgba(2, 6, 23, 0.24);
}

.xiangqi-piece.red {
  color: #b91c1c;
}

.xiangqi-piece.black {
  color: #111827;
}

.go-board {
  --size: 9;
  --go-min: 270px;
  width: min(680px, 100%);
  min-width: min(680px, var(--go-min));
  aspect-ratio: 1;
  display: grid;
  grid-template-columns: repeat(var(--size), 1fr);
  grid-template-rows: repeat(var(--size), 1fr);
  padding: 8px;
  border-radius: 8px;
  background: #d8a657;
  touch-action: manipulation;
  user-select: none;
}

.go-cell {
  border: 0;
  background:
    linear-gradient(#5f3a16, #5f3a16) center / 100% 1px no-repeat,
    linear-gradient(90deg, #5f3a16, #5f3a16) center / 1px 100% no-repeat;
}

.western-board {
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr);
  border: 1px solid #111827;
  border-radius: 8px;
  overflow: hidden;
}

.western-cell {
  border: 0;
  font-size: clamp(26px, 7vw, 52px);
  line-height: 1;
}

.western-cell.light {
  background: #f1d9b5;
}

.western-cell.dark {
  background: #7b4f2c;
}

.white-piece {
  color: #fff;
  text-shadow: 0 2px 4px rgba(2, 6, 23, 0.75);
}

.black-piece {
  color: #111827;
  text-shadow: 0 1px 2px rgba(255, 255, 255, 0.42);
}

.reversi-board,
.checkers-board {
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr);
  border: 1px solid #123524;
  border-radius: 8px;
  overflow: hidden;
}

.reversi-cell,
.checkers-cell,
.tic-cell {
  position: relative;
  display: grid;
  place-items: center;
  border: 0;
  cursor: pointer;
  touch-action: manipulation;
}

.reversi-cell {
  background: #15803d;
  border: 1px solid rgba(255, 255, 255, 0.16);
}

.reversi-cell.hint::after,
.checkers-cell.hint::after {
  content: "";
  width: 28%;
  height: 28%;
  border-radius: 50%;
  background: rgba(250, 204, 21, 0.82);
  box-shadow: 0 0 0 3px rgba(250, 204, 21, 0.22);
}

.disc,
.checker-piece {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  width: 76%;
  height: auto;
  border-radius: 50%;
  box-shadow: 0 4px 10px rgba(2, 6, 23, 0.35);
}

.disc.black {
  background: #111827;
}

.disc.white {
  background: #f8fafc;
  border: 1px solid #cbd5e1;
}

.checkers-board {
  border-color: #111827;
}

.checkers-cell.light {
  background: #f1d9b5;
}

.checkers-cell.dark {
  background: #7b4f2c;
}

.checkers-cell.selected {
  outline: 3px solid #facc15;
  z-index: 2;
}

.checker-piece.red {
  background: #dc2626;
  border: 3px solid #fecaca;
}

.checker-piece.black {
  background: #111827;
  border: 3px solid #9ca3af;
}

.checker-piece.king::after {
  content: "";
  width: 44%;
  height: 44%;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.72);
}

.tic-board {
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  width: min(520px, 100%);
  max-width: 520px;
  gap: 8px;
  padding: 8px;
  border-radius: 8px;
  background: #172033;
}

.tic-cell {
  min-height: 120px;
  border-radius: 7px;
  background: #f8fafc;
  color: #172033;
  font-size: clamp(54px, 10vw, 92px);
  font-weight: 900;
  line-height: 1;
}

.tic-cell.x {
  color: #1d4ed8;
}

.tic-cell.o {
  color: #c2410c;
}

.tic-cell.win {
  background: #fef3c7;
}

.game-card-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.game-card {
  min-height: 56px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  color: var(--ink);
  text-decoration: none;
}

.game-card:hover,
.game-card:focus-visible {
  border-color: var(--accent);
  outline: none;
}

.game-card-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  color: #fff;
  font-size: 14px;
  font-weight: 900;
}

.game-card strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--ink);
  font-size: 16px;
  line-height: 1.2;
  white-space: nowrap;
}

.game-card-icon.snake {
  background: #15803d;
}

.game-card-icon.mine {
  background: #0f8b8d;
}

.game-card-icon.block {
  background: #172033;
}

.game-card-icon.gomoku {
  background: #111827;
}

.game-card-icon.spider {
  background: #166534;
}

.game-card-icon.tile {
  background: #2563eb;
  font-size: 12px;
}

.game-card-icon.jump {
  background: #d93a2f;
}

.game-card-icon.sudoku {
  background: #2f6f9f;
}

.game-card-icon.match {
  background: #e11d48;
}

.game-card-icon.link {
  background: #0f8b8d;
}

.game-card-icon.word {
  background: #7c3aed;
}

.game-card-icon.box {
  background: #d99a1b;
}

.site-footer {
  margin-top: 34px;
  padding: 22px 18px;
  color: var(--muted);
  text-align: center;
  border-top: 1px solid var(--line);
}

.site-footer p {
  margin: 6px 0;
}

.site-footer a {
  color: var(--accent);
  font-weight: 800;
  text-decoration: none;
}

@media (max-width: 800px) {
  .chess-grid,
  .board-head,
  .game-layout {
    grid-template-columns: 1fr;
  }

  .info-panel {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .board-wrap {
    justify-content: flex-start;
  }
}

@media (max-width: 700px) {
  .site-header {
    height: 48px;
    grid-template-columns: minmax(0, 1fr) auto 40px;
    gap: 6px;
    padding: 0 8px;
  }

  .brand {
    font-size: 17px;
  }

  .desktop-nav {
    display: none;
  }

  .header-download {
    min-height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 10px;
    border-radius: 6px;
    background: #fff7e6;
    color: #68430d;
    border: 1px solid #e5c16b;
    font-size: 13px;
    font-weight: 800;
    line-height: 1;
    text-decoration: none;
    white-space: nowrap;
  }

  .mobile-menu {
    display: block;
    position: relative;
  }

  .mobile-menu summary {
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    gap: 4px;
    padding: 10px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.1);
    cursor: pointer;
    list-style: none;
  }

  .mobile-menu summary::-webkit-details-marker {
    display: none;
  }

  .mobile-menu span {
    width: 18px;
    height: 2px;
    display: block;
    border-radius: 2px;
    background: #fff;
  }

  .mobile-menu nav {
    position: fixed;
    top: 48px;
    right: 8px;
    z-index: 90;
    width: min(220px, calc(100vw - 16px));
    display: grid;
    gap: 4px;
    padding: 10px;
    border-radius: 8px;
    background: #172033;
    box-shadow: var(--shadow);
  }

  .mobile-menu:not([open]) nav {
    display: none;
  }

  .mobile-menu nav a {
    min-height: 42px;
    display: flex;
    align-items: center;
    padding: 0 12px;
    border-radius: 6px;
    color: #fff;
    text-decoration: none;
  }

  main {
    padding: 8px 8px 0;
  }

  .home-shell {
    overflow: visible;
  }

  .home-top {
    gap: 12px;
    padding: 16px 12px;
  }

  .home-top h1 {
    font-size: 28px;
  }

  .home-top p {
    font-size: 14px;
  }

  .client-notice {
    display: none;
  }

  .chess-grid {
    gap: 8px;
    padding: 10px;
  }

  .chess-card {
    position: relative;
    min-height: 94px;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 10px;
    padding: 12px 76px 12px 12px;
  }

  .card-icon {
    width: 46px;
    height: 46px;
    font-size: 20px;
  }

  .chess-card strong {
    font-size: 19px;
  }

  .chess-card b {
    position: absolute;
    top: 10px;
    right: 10px;
    min-height: 28px;
    padding: 0 10px;
    font-size: 12px;
  }

  .content-page {
    margin-top: 14px;
    padding: 0 10px;
  }

  .content-page article {
    padding: 20px;
  }

  .content-page h1 {
    font-size: 26px;
  }

  .play-shell {
    padding: 8px;
    border-radius: 8px;
  }

  .board-head {
    gap: 8px;
    margin-bottom: 8px;
  }

  .board-head h1 {
    font-size: 23px;
  }

  .board-head p {
    min-height: 22px;
    font-size: 13px;
    line-height: 1.45;
  }

  .play-download {
    min-height: 36px;
    gap: 6px;
    margin: 0 0 8px;
    padding: 5px 6px;
  }

  .play-download span {
    font-size: 12px;
  }

  .play-download a {
    min-height: 28px;
    padding: 0 9px;
    font-size: 12px;
  }

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

  .action-row button,
  .action-row a,
  .mode-tabs button {
    min-height: 34px;
    padding: 0 8px;
    font-size: 13px;
  }

  .mode-tabs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    margin-bottom: 8px;
  }

  .game-layout {
    gap: 8px;
  }

  .board-wrap {
    width: 100%;
    padding: 6px;
    place-items: start;
    border-radius: 7px;
    -webkit-overflow-scrolling: touch;
  }

  .gomoku-board,
  .xiangqi-board,
  .western-board,
  .reversi-board,
  .checkers-board,
  .tic-board {
    width: 100%;
    max-width: 680px;
  }

  .go-board {
    width: 100%;
    max-width: 680px;
    min-width: min(680px, var(--go-min));
  }

  .gomoku-board,
  .xiangqi-board,
  .go-board {
    padding: 5px;
  }

  .xiangqi-piece {
    font-size: clamp(14px, 5vw, 24px);
    border-width: 1px;
  }

  .western-cell {
    font-size: clamp(28px, 10vw, 44px);
  }

  .tic-board {
    max-width: 480px;
    gap: 5px;
    padding: 5px;
  }

  .tic-cell {
    min-height: 92px;
    font-size: clamp(48px, 18vw, 76px);
  }

  .stone {
    aspect-ratio: 1;
    width: 78%;
    height: auto;
  }

  .info-panel {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
  }

  .info-panel div {
    min-height: 48px;
    gap: 2px;
    padding: 7px;
    border-radius: 7px;
  }

  .info-panel span {
    font-size: 11px;
  }

  .info-panel strong {
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 16px;
    white-space: nowrap;
  }

  .game-card-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .game-card {
    min-height: 54px;
    padding: 8px;
  }

  .game-card-icon {
    width: 32px;
    height: 32px;
    font-size: 13px;
  }

  .game-card strong {
    font-size: 15px;
  }

  .site-footer {
    margin-top: 20px;
    padding: 18px 12px;
    font-size: 13px;
  }
}
