:root {
  --bg: #f4f6f8;
  --panel: #ffffff;
  --text: #25303b;
  --muted: #71808f;
  --border: #dfe5ea;
  --light-square: #edf1f4;
  --dark-square: #9aa8b4;
  --dark-piece: #2e3943;
  --light-piece: #fbfcfd;
  --accent: #7e9bb5;
  --accent-soft: rgba(126, 155, 181, 0.34);
  --danger: #b55f5f;
  --shadow: 0 18px 50px rgba(55, 69, 80, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: linear-gradient(145deg, #f9fafb 0%, #eef2f5 100%);
  color: var(--text);
}

button {
  font: inherit;
}

.page-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 18px;
}

.game-card {
  width: min(920px, 100%);
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--border);
  border-radius: 28px;
  box-shadow: var(--shadow);
  padding: 28px;
}

.game-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  margin-bottom: 22px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.14em;
}

h1 {
  margin: 0;
  font-size: clamp(28px, 5vw, 48px);
  line-height: 1;
  letter-spacing: -0.04em;
}

h1 span {
  color: #7d8b97;
  font-weight: 500;
}

.subtitle {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 15px;
}

.restart-btn {
  border: 1px solid var(--border);
  background: #f8fafb;
  color: var(--text);
  border-radius: 14px;
  padding: 11px 16px;
  cursor: pointer;
  transition: 0.2s ease;
  white-space: nowrap;
}

.restart-btn:hover {
  background: #eef3f6;
  transform: translateY(-1px);
}

.status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  margin-bottom: 20px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: #f9fbfc;
}

.turn-indicator,
.score {
  display: flex;
  align-items: center;
  gap: 10px;
}

.score {
  color: var(--muted);
  font-size: 14px;
  gap: 16px;
}

.mini-piece {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  box-shadow: inset 0 0 0 2px rgba(255,255,255,.45), 0 1px 4px rgba(0,0,0,.12);
}

.board-wrap {
  width: min(100%, 680px);
  margin: 0 auto;
}

.board {
  width: 100%;
  aspect-ratio: 1;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  overflow: hidden;
  border-radius: 18px;
  border: 1px solid #cfd7de;
  box-shadow: 0 10px 30px rgba(41, 54, 66, 0.10);
}

.square {
  position: relative;
  display: grid;
  place-items: center;
  border: 0;
  padding: 0;
}

.square.light {
  background: var(--light-square);
}

.square.dark {
  background: var(--dark-square);
  cursor: pointer;
}

.square.selected::after {
  content: "";
  position: absolute;
  inset: 7px;
  border: 3px solid rgba(255,255,255,.9);
  border-radius: 14px;
  pointer-events: none;
}

.square.valid::before {
  content: "";
  width: 20%;
  height: 20%;
  min-width: 10px;
  min-height: 10px;
  border-radius: 50%;
  background: rgba(255,255,255,.78);
  box-shadow: 0 0 0 5px rgba(63, 79, 92, 0.16);
  position: absolute;
}

.piece {
  width: 68%;
  height: 68%;
  border-radius: 50%;
  position: relative;
  z-index: 2;
  display: grid;
  place-items: center;
  transition: transform .15s ease, box-shadow .15s ease;
}

.dark-piece {
  background: radial-gradient(circle at 35% 30%, #53606b 0%, #303b45 50%, #232b32 100%);
  border: 2px solid #20272d;
}

.light-piece {
  background: radial-gradient(circle at 35% 30%, #ffffff 0%, #f1f4f6 60%, #d7dde2 100%);
  border: 2px solid #c5cdd4;
}

.square.dark:hover .piece {
  transform: translateY(-2px);
  box-shadow: 0 7px 12px rgba(0,0,0,.16);
}

.piece.king::after {
  content: "♛";
  font-size: clamp(15px, 3vw, 30px);
  line-height: 1;
  color: #d9b45f;
  text-shadow: 0 1px 0 rgba(255,255,255,.35);
}

.hint {
  margin-top: 18px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

@media (max-width: 650px) {
  .page-shell {
    padding: 14px;
  }

  .game-card {
    padding: 18px;
    border-radius: 20px;
  }

  .game-header {
    flex-direction: column;
    gap: 16px;
  }

  .restart-btn {
    width: 100%;
  }

  .status-bar {
    align-items: flex-start;
    flex-direction: column;
  }
}
