/* Checkers – only what's specific to this game.
   Header, difficulty, score and status come from /css/style.css. */

.ck-heading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  margin-bottom: -10px;
  text-align: center;
}

/* The holder sits in a centred column, so it needs its own width */
.ck-holder {
  width: min(100%, 460px);
}

.ck-board {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  grid-template-rows: repeat(8, minmax(0, 1fr));
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: var(--radius);
  border: 1px solid var(--border-strong);
  touch-action: manipulation;
}

.ck-sq {
  position: relative;
  min-width: 0;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
}

.ck-sq.is-light {
  background: var(--surface-2);
}

.ck-sq.is-dark {
  background: var(--inset);
}

.ck-sq:not(:disabled) {
  cursor: pointer;
}

.ck-sq:disabled {
  cursor: default;
}

.ck-sq:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
  z-index: 1;
}

/* Where the last move went (and came from) */
.ck-sq.is-last {
  background: color-mix(in srgb, var(--accent) 12%, var(--inset));
}

/* ---------- Pieces ---------- */

.ck-piece {
  position: absolute;
  inset: 13%;
  display: grid;
  place-items: center;
  border-radius: 50%;
  transition: transform 120ms ease;
}

.ck-piece.is-mine {
  background: var(--accent);
  color: var(--accent-text);
  box-shadow: inset 0 0 0 4px color-mix(in srgb, var(--accent-text) 18%, transparent), 0 2px 3px rgba(0, 0, 0, 0.35);
}

.ck-piece.is-theirs {
  background: var(--text);
  color: var(--bg);
  box-shadow: inset 0 0 0 4px color-mix(in srgb, var(--bg) 14%, transparent), 0 2px 3px rgba(0, 0, 0, 0.35);
}

.ck-piece svg {
  width: 52%;
  height: 52%;
}

/* A piece already jumped in the move you're tapping out */
.ck-piece.is-jumped {
  opacity: 0.3;
}

/* A piece captured by the last move: a faint outline where it was */
.ck-piece.is-ghost {
  inset: 22%;
  border: 2px dashed var(--text-faint);
  animation: ck-ghost 0.5s ease-out;
}

/* A captured piece shrinks away, leaving its outline */
@keyframes ck-ghost {
  from {
    inset: 8%;
    border-style: solid;
    background: var(--text-muted);
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ck-piece.is-ghost {
    animation: none;
  }
}

/* ---------- Choosing a move ---------- */

.ck-sq.is-selected .ck-piece {
  transform: scale(1.08);
  outline: 3px solid var(--text);
  outline-offset: 2px;
}

/* Squares you can move to: a dot */
.ck-sq.is-target::after {
  content: "";
  position: absolute;
  inset: 37%;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.75;
}

.ck-sq.is-target:hover::after {
  inset: 30%;
  opacity: 1;
}

/* "You must capture": the pieces that can jump get a ring */
.ck-sq.is-must .ck-piece {
  outline: 2px solid var(--warn);
  outline-offset: 3px;
}

.ck-sq:not(:disabled):hover .ck-piece.is-mine {
  transform: scale(1.05);
}

/* ---------- Score dots + rules ---------- */

.ck-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-left: 2px;
  border-radius: 50%;
  vertical-align: 0;
}

.ck-dot.is-mine {
  background: var(--accent);
}

.ck-dot.is-theirs {
  background: var(--text);
}

.ck-rules {
  max-width: 460px;
  color: var(--text-muted);
}

.ck-rules summary {
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  text-align: center;
}

.ck-rules p {
  margin-top: 8px;
}

@media (prefers-reduced-motion: reduce) {
  .ck-piece {
    transition: none;
  }
}

/* Phone held sideways: fit the screen height (see css/style.css) */
@media (orientation: landscape) and (max-height: 540px) {
  .ck-holder { width: min(460px, var(--play-w), var(--play-h)); }
}
