/* Draughts — game-specific styles */

.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.page-head h1 {
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 700;
  font-size: clamp(28px, 4.4vw, 40px);
  letter-spacing: -0.02em;
  margin: 0;
  line-height: 1.05;
}
.page-head .sub {
  color: var(--ink-soft);
  margin: 6px 0 0;
  font-size: 14px;
  min-height: 1.4em;
}
.head-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

.play {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
}

/* ---------- Setup screen ---------- */
.setup { max-width: 520px; margin: 6px auto; }
.setup-title {
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 700;
  font-size: clamp(22px, 3.2vw, 28px);
  margin: 0 0 4px;
  letter-spacing: -0.01em;
}
.setup-sub { color: var(--ink-soft); margin: 0 0 22px; font-size: 14px; }

.setup-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 18px;
}
.setup-group[hidden] { display: none; }
.setup-label {
  font: 700 12px 'Inter', sans-serif;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}
.seg {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px;
  align-self: flex-start;
}
.seg-btn {
  appearance: none;
  background: transparent;
  border: 0;
  color: var(--ink-soft);
  font: 600 13px 'Inter', sans-serif;
  padding: 8px 14px;
  border-radius: 999px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: background 160ms ease, color 160ms ease;
}
.seg-btn:hover { color: var(--ink); }
.seg-btn.is-active {
  background: var(--accent);
  color: var(--paper);
}
.setup-actions { margin-top: 8px; }

/* Chip in setup + scoreboard */
.chip {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  vertical-align: middle;
  flex-shrink: 0;
}
.chip-red {
  background: radial-gradient(circle at 32% 28%, #d96560 0%, #b13230 60%, #7d1c1a 100%);
  box-shadow: inset 0 -2px 0 rgba(0,0,0,0.18);
}
.chip-cream {
  background: radial-gradient(circle at 32% 28%, #fbf5e3 0%, #f1e3bd 60%, #cdb98a 100%);
  border: 1px solid #c9bf9d;
  box-shadow: inset 0 -2px 0 rgba(0,0,0,0.06);
}

/* ---------- Game screen ---------- */
.scoreboard {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 12px;
  align-items: center;
  margin-bottom: 18px;
}
.score {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  background: var(--bg-2);
  border-radius: 12px;
  transition: border-color 200ms ease, background 200ms ease, box-shadow 200ms ease;
}
.score-cream { justify-self: end; }
.score.is-turn {
  border-color: var(--line-strong);
  background: var(--paper);
  box-shadow: var(--shadow);
}
.score .chip { width: 22px; height: 22px; }
.score-info { display: flex; flex-direction: column; line-height: 1.1; }
.score-label {
  font: 700 11px 'Inter', sans-serif;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
.score-val {
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 700;
  font-size: 22px;
  color: var(--ink);
  margin-top: 2px;
}

.turn-indicator {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font: 600 13px 'Inter', sans-serif;
  color: var(--ink-soft);
  background: transparent;
  padding: 0 6px;
  text-align: center;
}
.turn-dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: radial-gradient(circle at 32% 28%, #d96560 0%, #b13230 60%, #7d1c1a 100%);
  transition: background 200ms ease, border-color 200ms ease;
  border: 1px solid transparent;
}
.turn-dot.is-cream {
  background: radial-gradient(circle at 32% 28%, #fbf5e3 0%, #f1e3bd 60%, #cdb98a 100%);
  border-color: #c9bf9d;
}

/* ---------- Board ---------- */
.board-wrap {
  display: flex;
  justify-content: center;
}
.board {
  width: min(100%, 560px);
  aspect-ratio: 1 / 1;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr);
  background: #2b1c12;
  border: 1px solid #1a110a;
  border-radius: 10px;
  padding: 8px;
  gap: 0;
  box-shadow:
    inset 0 0 0 2px rgba(0,0,0,0.18),
    0 22px 44px -22px rgba(40, 25, 15, 0.5);
}

.cell {
  appearance: none;
  border: 0;
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: default;
  transition: background-color 180ms ease;
}
.cell.is-light { background: #e8d4ab; }
.cell.is-dark  { background: #7a4a2b; }

.cell.is-selectable { cursor: pointer; }
.cell.is-selected {
  outline: 3px solid rgba(244, 227, 178, 0.85);
  outline-offset: -3px;
  z-index: 2;
}
.cell.is-target { cursor: pointer; }
.cell.is-target::after {
  content: '';
  position: absolute;
  width: 30%;
  height: 30%;
  border-radius: 50%;
  background: rgba(244, 236, 212, 0.45);
  pointer-events: none;
}
.cell.is-capture-target::after {
  background: rgba(220, 120, 110, 0.6);
  width: 36%;
  height: 36%;
}
.cell.is-target:hover::after {
  background: rgba(244, 236, 212, 0.85);
}
.cell.is-capture-target:hover::after {
  background: rgba(220, 120, 110, 0.95);
}

.cell.is-last {
  box-shadow: inset 0 0 0 3px rgba(244, 227, 178, 0.45);
}

/* Pieces — solid CSS discs */
.piece {
  width: 76%;
  height: 76%;
  border-radius: 50%;
  position: relative;
  transition: transform 220ms ease;
  pointer-events: none;
}
.piece.red {
  background: radial-gradient(circle at 32% 28%, #e07772 0%, #b13230 55%, #7d1c1a 100%);
  box-shadow:
    inset 0 -4px 8px rgba(0, 0, 0, 0.35),
    inset 0 3px 6px rgba(255, 255, 255, 0.18),
    0 2px 4px rgba(0, 0, 0, 0.3);
}
.piece.cream {
  background: radial-gradient(circle at 32% 28%, #fbf5e3 0%, #f1e3bd 55%, #cdb98a 100%);
  box-shadow:
    inset 0 -4px 8px rgba(80, 60, 20, 0.22),
    inset 0 3px 6px rgba(255, 255, 255, 0.5),
    0 2px 4px rgba(0, 0, 0, 0.22);
}
.piece.king::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 38%;
  height: 38%;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  border: 2px solid rgba(244, 227, 178, 0.85);
  background: transparent;
}
.piece.king.cream::after {
  border-color: rgba(125, 28, 26, 0.7);
}

.piece.is-new { animation: pieceIn 180ms ease-out; }
@keyframes pieceIn {
  0%   { transform: scale(0.4); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

/* Capture — piece leaves with a small pop */
@keyframes dr-capture {
  0%   { transform: scale(1); opacity: 1; }
  40%  { transform: scale(1.15); opacity: 0.9; }
  100% { transform: scale(0.2); opacity: 0; }
}
.piece.is-captured { animation: dr-capture 260ms ease-in forwards; pointer-events: none; }

/* King crown — gentle golden glow */
.piece.king {
  box-shadow:
    inset 0 -4px 8px rgba(80, 60, 20, 0.22),
    inset 0 3px 6px rgba(255, 255, 255, 0.5),
    0 2px 4px rgba(0, 0, 0, 0.22),
    0 0 0 2px rgba(244, 227, 178, 0.55);
}
@keyframes dr-crowned {
  0%   { box-shadow: 0 0 0 0 rgba(244, 227, 178, 0.7); }
  100% { box-shadow: 0 0 0 12px rgba(244, 227, 178, 0); }
}
.piece.just-crowned::before {
  content: ''; position: absolute; inset: 0; border-radius: 50%;
  animation: dr-crowned 800ms ease-out;
  pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
  .piece.is-new, .piece.is-captured, .piece.just-crowned::before { animation: none; }
}

/* ---------- Win overlay ---------- */
.win-overlay {
  position: fixed; inset: 0; background: rgba(28, 42, 58, 0.55);
  display: flex; align-items: center; justify-content: center; z-index: 50; padding: 20px;
}
.win-overlay[hidden] { display: none; }
.win-card {
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 28px 30px; text-align: center; box-shadow: var(--shadow-lift); max-width: 360px;
  width: 100%;
}
.win-card h2 {
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 700;
  font-size: 26px;
  margin: 0 0 6px;
  letter-spacing: -0.01em;
}
.win-sub { color: var(--ink-soft); margin: 0 0 18px; }
.win-scores {
  display: flex;
  justify-content: center;
  gap: 24px;
  margin-bottom: 22px;
}
.win-score {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.win-score .chip { width: 28px; height: 28px; }
.win-score-label {
  font: 700 11px 'Inter', sans-serif;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
.win-score-val {
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 700;
  font-size: 28px;
  color: var(--ink);
}
.win-actions { display: flex; justify-content: center; gap: 10px; }

/* ---------- Aside / help ---------- */
.aside-info { margin-top: 22px; }
.aside-info details {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 16px;
  box-shadow: var(--shadow);
}
.aside-info summary {
  cursor: pointer;
  font: 700 14px 'Inter', sans-serif;
  color: var(--ink);
}
.aside-info .help-body {
  margin-top: 10px;
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.55;
}
.aside-info .help-body p { margin: 0 0 8px; }
.aside-info .help-body ul { margin: 0 0 8px; padding-left: 18px; }
.aside-info .help-body li { margin: 4px 0; }

/* ---------- Fullscreen ---------- */
body[data-fullscreen="true"] .board {
  width: min(100vw - 16px, 100vh - 120px, 720px);
}
body[data-fullscreen="true"] .scoreboard {
  max-width: 720px;
  width: 100%;
}
body[data-fullscreen="true"] #gameScreen {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 100%;
}

/* ---------- Responsive ---------- */
@media (max-width: 520px) {
  .play { padding: 14px; }
  .scoreboard { gap: 8px; }
  .score { padding: 8px 10px; gap: 8px; }
  .score .chip { width: 18px; height: 18px; }
  .score-val { font-size: 18px; }
  .turn-indicator { font-size: 12px; }
  .board { padding: 6px; }
}
@media (max-width: 380px) {
  .scoreboard {
    grid-template-columns: 1fr 1fr;
  }
  .turn-indicator { grid-column: 1 / -1; order: -1; justify-content: center; }
}
