body {
  margin: 0;
  padding: clamp(14px, 4vw, 32px);
  background: #fff;
  color: #35291f;
  font: 16px/1.5 system-ui, sans-serif;
}
main { max-width: 850px; margin: auto; }
nav, .controls { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
a { color: #674328; }
:focus-visible { outline: 3px solid #a74421; outline-offset: 3px; z-index: 1; }
h1 { margin-bottom: 0; }
button, select {
  font: inherit;
  min-height: 44px;
  color: inherit;
  background: #fff;
  border: 1px solid #907a60;
  border-radius: 8px;
  padding: 4px 10px;
}
button:not(:disabled) { cursor: pointer; }
button:disabled { opacity: .65; }
#status { min-height: 1.5em; font-weight: 650; }
.board { display: grid; width: min(100%, 500px); margin-block: 16px; }
.square {
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 0;
  min-width: 0;
  min-height: 0;
  aspect-ratio: 1;
}
.square[data-selected="true"] { box-shadow: inset 0 0 0 4px #bc471a; }
.square[data-legal="true"] { box-shadow: inset 0 0 0 4px #26704e; }
.chess { grid-template-columns: repeat(8, minmax(0, 1fr)); border: 1px solid #4f4332; }
.chess .square { background: #fff3d9; color: #1a1815; font-size: clamp(19px, 6vw, 42px); line-height: 1; }
.chess .square[data-dark="true"] { background: #ad977b; }
.ttt { grid-template-columns: repeat(3, 1fr); gap: 5px; max-width: 340px; }
.ttt .square { border: 1px solid #907a60; border-radius: 8px; font-size: 2rem; }
.ludo {
  grid-template: repeat(15, 1fr) / repeat(15, 1fr);
  aspect-ratio: 1;
  background: #e2d0b6;
  border: 1px solid #907a60;
}
.ludo div {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  overflow: hidden;
  border: 1px solid #c6b396;
  background: #fffaf1;
}
.ludo .red { background: #912b2e; color: white; }
.ludo .blue { background: #215679; color: white; }
.ludo div.red { background: #f0c6bb; }
.ludo div.blue { background: #bad7e0; }
.ludo .safe { background: #f1dc98; }
.ludo span {
  display: grid;
  place-items: center;
  font-size: clamp(7px, 2vw, 12px);
  width: 48%;
  aspect-ratio: 1;
  line-height: 1;
  border-radius: 50%;
}
.pitch {
  position: relative;
  display: block;
  overflow: hidden;
  aspect-ratio: 2;
  background: repeating-linear-gradient(0deg, #366c47 0 30px, #3d754d 30px 60px);
  border-radius: 8px;
}
.goal {
  position: absolute;
  inset: 15% 20% 48%;
  border: 4px solid #fff;
  border-bottom: none;
  background: repeating-linear-gradient(90deg, transparent 0 12px, #ffffff55 12px 13px);
}
.pitch .keeper, .pitch .ball {
  position: absolute;
  left: calc(50% - .6em);
  font-size: clamp(22px, 6vw, 33px);
  line-height: 1;
}
.pitch .keeper { top: 28%; color: #ffdf7a; }
.pitch .ball { bottom: 8%; }
.pitch[data-phase="replay"] .keeper { animation: dive .34s ease-out both; }
.pitch[data-phase="replay"] .ball { animation: shoot .34s ease-out both; }
@keyframes dive { to { left: calc(50% - .6em + var(--lane) * 19%); } }
@keyframes shoot { to { left: calc(50% - .6em + var(--lane) * 19%); bottom: 55%; } }
@media (prefers-reduced-motion: reduce) {
  .pitch[data-phase="replay"] .keeper, .pitch[data-phase="replay"] .ball {
    animation-timing-function: steps(1, end);
    animation-duration: .001s;
  }
}
.snake {
  grid-template: repeat(16, 1fr) / repeat(16, 1fr);
  max-width: 400px;
  aspect-ratio: 1;
  gap: 1px;
  background: #476257;
}
.snake span { background: #243d38; }
.snake .segment { background: #b9df8b; }
.snake .food { background: #efb85d; border-radius: 50%; }
[hidden] { display: none !important; }
