:root {
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: #272420;
  background: #faf9f6;
  -webkit-font-smoothing: antialiased;
  --muted: #68625b;
  --border: #ded9d1;
  --rust: #975540;
  --blue: #486d86;
  --red: #a35a4f;
}

* { box-sizing: border-box; }

body {
  max-width: 860px;
  margin: 48px auto 72px;
  padding: 0 32px;
}

a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--rust); }

a:focus-visible,
button:focus-visible,
select:focus-visible,
summary:focus-visible { outline: 2px solid var(--rust); outline-offset: 4px; }

.skip-link {
  position: fixed;
  z-index: 2;
  top: 8px;
  left: 8px;
  padding: 8px 12px;
  color: #faf9f6;
  background: #272420;
  transform: translateY(-150%);
}

.skip-link:focus { transform: translateY(0); }
p { margin: 0; }

.page-header nav { display: flex; justify-content: space-between; gap: 24px; color: var(--muted); font-size: 13px; }
.page-header nav a { text-decoration: none; }
.page-header nav a:hover { text-decoration: underline; }

h1 {
  margin: 28px 0 8px;
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  font-size: 40px;
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: -0.8px;
}

.page-header > p { color: var(--muted); font-size: 15px; }

.game-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  align-items: start;
  gap: 44px;
  margin-top: 32px;
}

.board-area { min-width: 0; grid-column: 1; grid-row: 1; }

.board {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  grid-template-rows: repeat(5, minmax(0, 1fr));
  aspect-ratio: 1;
  border: 1px solid #c9c0b2;
  background: #cfc6b8;
  gap: 1px;
  padding: 1px;
}

.cell {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  min-width: 0;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  appearance: none;
  background: #eee9df;
  color: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.cell[aria-disabled="true"] { cursor: default; }
.cell[aria-disabled="false"]:hover { background: #e4ddcf; }
.cell:focus-visible { z-index: 1; outline-offset: -4px; }

.piece {
  display: block;
  width: 61%;
  aspect-ratio: 1;
  border: 1px solid rgb(39 36 32 / 22%);
  border-radius: 50%;
  box-shadow: inset 0 0 0 3px rgb(250 249 246 / 12%), 0 2px 1px rgb(39 36 32 / 10%);
  pointer-events: none;
}

.player1-piece { background: var(--blue); }
.player2-piece { background: var(--red); }
.selected-piece { background: #ded3c1; }
.selected-piece .piece { outline: 2px solid #272420; outline-offset: 4px; }

.valid-move::after {
  content: "";
  width: 12%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: #975540;
}

.capture-target .piece { outline: 2px dashed #272420; outline-offset: 4px; }
.board-hint { margin-top: 12px; color: var(--muted); font-size: 12px; line-height: 1.6; }
.controls-panel { min-width: 0; grid-column: 2; grid-row: 1; }
.status-block { min-height: 96px; padding-bottom: 20px; border-bottom: 1px solid var(--border); }
.game-status { font-size: 18px; font-weight: 600; line-height: 1.4; }
.player1-turn { color: var(--blue); }
.player2-turn { color: var(--red); }
.turn-hint { margin-top: 6px; color: var(--muted); font-size: 13px; }
.player-setup { display: grid; gap: 12px; margin-top: 22px; }
.player-config { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.player-config label { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.color-dot { width: 9px; height: 9px; flex-shrink: 0; border-radius: 50%; }
.blue { background: var(--blue); }
.red { background: var(--red); }

select {
  width: 158px;
  max-width: 65%;
  padding: 8px 10px;
  border: 1px solid #cdc7be;
  border-radius: 3px;
  font: inherit;
  font-size: 13px;
  color: inherit;
  background: #fffefb;
}

select:disabled { opacity: 0.7; }
.piece-count { width: 100%; margin: 24px 0; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
.piece-count th, .piece-count td { padding: 5px 0; font-weight: 400; text-align: right; }
.piece-count th:first-child { text-align: left; }
.piece-count thead th { padding-bottom: 7px; color: var(--muted); font-size: 12px; }
.piece-count tbody tr:first-child { border-top: 1px solid var(--border); }
.piece-count tbody tr:first-child > * { padding-top: 10px; }
.game-buttons { display: flex; gap: 10px; }

.btn {
  min-height: 42px;
  padding: 9px 16px;
  border: 1px solid var(--border);
  border-radius: 3px;
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}

.btn-start { flex: 1; color: #fffefb; background: #272420; border-color: #272420; }
.btn-start:hover { background: #45403a; }
.btn-reset { color: #272420; background: transparent; }
.btn-reset:hover { background: #eeeae3; }
.btn:disabled { opacity: 0.4; cursor: default; }
.rules { margin-top: 32px; border-top: 1px solid var(--border); padding-top: 18px; }
.rules > summary { width: fit-content; color: var(--muted); font-size: 14px; cursor: pointer; }
.rules > summary:hover { color: var(--rust); }
.rules-content { max-width: 680px; margin-top: 18px; color: var(--muted); font-size: 14px; }
.rules-content > p + p { margin-top: 12px; }
.rules-content strong { color: #272420; font-weight: 500; }
.keyboard-help { font-size: 12px; }

@media (max-width: 720px) {
  body { max-width: 560px; margin: 28px auto 48px; padding: 0 24px; }
  h1 { margin-top: 24px; font-size: 34px; }
  .game-layout { grid-template-columns: minmax(0, 1fr); gap: 26px; margin-top: 26px; }
  .board-area { grid-column: 1; grid-row: 2; }
  .controls-panel { grid-column: 1; grid-row: 1; display: grid; grid-template-columns: 1fr 1fr; gap: 0 24px; }
  .status-block { grid-column: 1 / -1; min-height: 0; padding-bottom: 16px; }
  .player-setup { margin-top: 18px; }
  .player-config { flex-direction: column; align-items: stretch; gap: 6px; }
  select { width: 100%; max-width: none; }
  .piece-count { margin: 18px 0 0; align-self: start; }
  .piece-count th, .piece-count td { padding: 8px 0; }
  .piece-count thead th { font-size: 11px; }
  .game-buttons { grid-column: 1 / -1; margin-top: 20px; }
  .rules { margin-top: 28px; }
}
