main { max-width: 1050px; }
.games {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr));
  gap: 16px;
  list-style: none;
  margin: 24px 0;
  padding: 0;
}
.tile {
  display: block;
  height: 100%;
  box-sizing: border-box;
  padding: 14px 16px 18px;
  background: #fff8ec;
  border: 1px solid #d5c4a8;
  border-radius: 16px;
  color: inherit;
  text-decoration: none;
}
.tile h2 { margin: 12px 0 0; font-size: 1.25rem; }
.tile:hover strong, .tile:focus-visible strong { text-decoration: underline; }
.preview {
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
  height: 120px;
  border-radius: 9px;
  color: #fff6df;
  background: #4e392e;
  font-size: 2.5rem;
}
.riddlex-preview { background: #4e392e; }
.riddlex-tile {padding:6px;border:2px solid #bd9360;border-radius:20px;background:linear-gradient(145deg,#4e392e,#201713);box-shadow:0 5px 0 #24160f,0 12px 24px #29150d55}
.note {
  position: absolute;
  right: 12%;
  bottom: 8px;
  padding-inline: 15px;
  color: #50341f;
  background: #fff3d1;
  font-family: cursive;
  transform: rotate(-8deg);
  animation: note 1.3s 2 both;
}
.ludo-preview { background: conic-gradient(#f28881 0 25%,#8fceec 0 50%,#f2d371 0 75%,#8bd2a0 0); }
.die { color: #302318; animation: die 1.25s 3; }
.pawn { position: absolute; left: 14%; bottom: 20%; width: 18px; height: 18px; border:1px solid #fff9; border-radius: 50%; background: radial-gradient(circle at 32% 25%,#fff,#ed4751 48%,#a91e35); box-shadow:0 2px 5px #39271977,inset 0 2px 3px #ffffff99; animation: pawn 1.25s 3; }
.pawn.blue { left:23%; bottom:37%; background:radial-gradient(circle at 32% 25%,#fff,#48a6f0 48%,#1b59b5); animation-delay:.14s; }
.pawn.green { left:42%; bottom:20%; background:radial-gradient(circle at 32% 25%,#fff,#43d178 48%,#168045); animation-delay:.28s; }
.pawn.yellow { left:50%; bottom:38%; background:radial-gradient(circle at 32% 25%,#fff,#ffd341 48%,#b9780d); animation-delay:.42s; }
.chess-tile {background:linear-gradient(145deg,#432015,#1d110e);border:2px solid #d9a63b;color:#fff0d0;box-shadow:0 8px 22px #29150d55}
.chess-tile h2 {color:#ffe17b;font-family:Georgia,serif}
.chess-preview {display:block;height:auto;aspect-ratio:1;padding:0;background:#2b1208;box-shadow:none}
.chess-preview img {display:block;width:100%;height:auto;object-fit:contain}
@keyframes note { from { opacity: 0; transform: translateY(20px) rotate(-12deg); } 55%, to { opacity: 1; transform: rotate(-8deg); } }
@keyframes die { 50% { transform: rotate(90deg) translateX(-5px); } }
@keyframes pawn { 55% { transform: translateX(34px); } }
@keyframes kick { 75% { transform: translate(31px, -48px) rotate(120deg) scale(.65); } }
@keyframes mark { from { opacity: .1; transform: scale(.75); } 75%, to { opacity: 1; transform: scale(1); } }
@keyframes snake { 75% { transform: translateX(48px); } }
@keyframes tile-merge { 50% { transform: translate(-17px,-17px) scale(1.14); box-shadow:0 2px 5px #59483c66; } }
.preview:not(.in-view) span { animation: none; }
@media (prefers-reduced-motion: reduce) { .preview span, .preview .mini2048-board i:nth-child(4) { animation: none; } }
/* Ludu Mahir card uses the supplied square preview artwork. */
.games li:nth-child(2) .tile {background:linear-gradient(145deg,#432015,#1d110e);border:2px solid #d9a63b;border-radius:20px;color:#fff0d0;box-shadow:0 5px 0 #22100a,0 12px 24px #29150d55}
.games li:nth-child(2) .tile h2 {color:#ffe17b;font:700 1.45rem Georgia,serif;text-shadow:0 2px #49200b}
.games li:nth-child(2) .tile p {color:#f4dfc3}
.ludo-preview {height:auto;aspect-ratio:1/1;padding:0;display:block;overflow:hidden;border:0;border-radius:15px;background:#2b1208;box-shadow:none;isolation:auto}
.ludo-preview::before {display:none}
.ludo-preview-image {display:block;width:100%;height:100%;object-fit:fill;border-radius:inherit}

/* Artwork already contains the title, description and Play Now control. */
.artwork-tile {height:auto;padding:6px;overflow:hidden}
.artwork-tile .preview {margin:0;border-radius:12px}

/* Each complete premium card is one accessible link; artwork includes Play Now. */
.premium-game-tile {padding:0;border:0;border-radius:16px;background:#241207;box-shadow:0 5px 14px #29150d44}
.artwork-tile .premium-game-preview {display:block;height:auto;aspect-ratio:3/2;border-radius:inherit;background:#241207}
.premium-game-preview img {display:block;width:100%;height:auto;aspect-ratio:3/2;object-fit:contain}
.premium-game-tile:focus-visible {outline:3px solid #8b42d4;outline-offset:4px}

/* Tic Tac Toe alone matches the existing Ludu/Chess square artwork cards. */
.artwork-tile.tic-tac-toe-tile {padding:6px;border:2px solid #d9a63b;border-radius:20px;background:linear-gradient(145deg,#432015,#1d110e);box-shadow:0 5px 0 #22100a,0 12px 24px #29150d55}
.tic-tac-toe-tile .premium-game-preview {aspect-ratio:1;border-radius:12px}
.tic-tac-toe-tile .premium-game-preview img {display:block;width:100%;height:100%;aspect-ratio:1;object-fit:contain}

/* 2048 uses the same square shell and proportions as Ludu/Tic Tac Toe. */
.artwork-tile.twenty48-tile {padding:6px;border:2px solid #d9a63b;border-radius:20px;background:linear-gradient(145deg,#432015,#1d110e);box-shadow:0 5px 0 #22100a,0 12px 24px #29150d55}
.twenty48-tile .premium-game-preview {aspect-ratio:1;border-radius:12px}
.twenty48-tile .premium-game-preview img {display:block;width:100%;height:100%;aspect-ratio:1;object-fit:contain}

/* Snakes & Ladders shares the square Ludu/Chess/Tic Tac Toe card format. */
.artwork-tile.serpent-tile {padding:6px;border:2px solid #d9a63b;border-radius:20px;background:linear-gradient(145deg,#153c27,#17140d);box-shadow:0 5px 0 #22100a,0 12px 24px #29150d55}
.serpent-tile .premium-game-preview {aspect-ratio:1;border-radius:12px}
.serpent-tile .premium-game-preview img {display:block;width:100%;height:100%;aspect-ratio:1;object-fit:contain}

.serpent-tile .card-footer-art {position:absolute;inset:0;width:100%;height:100%;pointer-events:none}

.serpent-tile .preview-play-region {overflow:hidden}

/* Riddlex uses the same square premium-card footprint as the other board games. */
.artwork-tile.riddlex-tile {padding:6px;border:2px solid #bd9360;border-radius:20px;background:linear-gradient(145deg,#4e392e,#201713);box-shadow:0 5px 0 #24160f,0 12px 24px #29150d55}
.artwork-tile.riddlex-tile .premium-game-preview {display:block;width:100%;height:auto;aspect-ratio:1 / 1;border-radius:12px;position:relative;overflow:hidden;background:#4e392e}
.artwork-tile.riddlex-tile .premium-game-preview img {display:block;width:100%;height:100%;min-width:0;min-height:0;aspect-ratio:1 / 1;object-fit:cover;background:#201713}
.riddlex-card-title {position:absolute;left:8%;right:8%;top:5%;padding:3px 10px;color:#ffd86b;font:700 clamp(1.1rem,4.5vw,1.65rem) Georgia,serif;letter-spacing:.04em;text-align:center;text-shadow:0 2px 3px #1b0902,0 0 8px #7b3d0e}
.riddlex-card-subtitle {position:absolute;left:10%;right:10%;top:63%;padding:5px 8px;color:#fff0d0;font:600 clamp(.72rem,2.7vw,1rem) Georgia,serif;line-height:1.2;text-align:center;text-shadow:0 2px 3px #1d0b04;background:#24100799}
.riddlex-card-cta {position:absolute;left:21.5%;right:21.5%;bottom:6%;padding:7px 12px;border:2px solid #f0c35c;border-radius:999px;background:linear-gradient(180deg,#b87324,#71300f);box-shadow:inset 0 1px #ffe7a0,0 3px 8px #0009;color:#fff0c2;font:700 clamp(.85rem,3.2vw,1.15rem) Georgia,serif;text-align:center;text-shadow:0 2px 2px #351000}

/* Keep the games-page heading and requested subheading centered above the artwork cards. */
.games > li { min-width: 0; }
.games-heading,
.games-subheading { text-align: center; }
.games-heading { margin: 0.35em 0 0; }
.games-subheading { margin: 0.35em 0 1.2em; }

/* Phones: show two artwork cards per row without changing the desktop layout.
   The artwork already includes each game's title and Play Now action. */
@media (max-width: 600px) {
  .games {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-block: 18px 24px;
  }
  .games .artwork-tile {
    padding: 4px;
    border-radius: 14px;
  }
  .games .artwork-tile .preview {
    border-radius: 10px;
  }
}
