/* Checkers — Cozy Alpaca Studio (pieces + shell UI; board chrome from Board Template) */
:root {
  --cream: #f7f1e8;
  --ink: #3d3429;
  --soft: #8b7355;
  --piece-dark: #4a3728;
  --piece-dark-rim: #2c2118;
  --piece-light: #f5e6c8;
  --piece-light-rim: #c4a574;
  --accent: #c4785a;
  --panel: #fffaf3;
  --shadow: rgba(61, 52, 41, 0.15);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  flex-direction: column;
  font-family: "Segoe UI", system-ui, sans-serif;
  background: linear-gradient(160deg, #f0e6d6 0%, #e4d5c0 50%, #d9cbb8 100%);
  color: var(--ink);
  min-height: 100vh;
  display: flex;
  justify-content: flex-start;
  align-items: stretch;
  padding: 0 0 2rem;
}

.app { width: 100%; max-width: 480px; align-self: center; margin-top: 1.25rem; padding: 0 1rem; }

.header { text-align: center; margin-bottom: 0.75rem; position: relative; }
.header h1 {
  font-weight: 600;
  font-size: 1.75rem;
  letter-spacing: 0.02em;
}
.tagline { font-size: 0.85rem; color: var(--soft); margin-top: 0.15rem; }

.mute-btn {
  position: absolute;
  top: 0;
  right: 0;
  appearance: none;
  border: none;
  background: var(--panel);
  color: var(--ink);
  font: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.35rem 0.65rem;
  border-radius: 8px;
  cursor: pointer;
  box-shadow: 0 2px 6px var(--shadow);
  z-index: 2;
  min-width: 3.6rem;
}
.mute-btn:hover { filter: brightness(1.03); }
.mute-btn.is-muted {
  background: #e8dcc8;
  color: var(--soft);
  box-shadow: inset 0 0 0 1px rgba(61, 52, 41, 0.12);
}



.stats-btn {
  position: absolute;
  top: 0;
  left: 0;
  appearance: none;
  border: none;
  background: var(--panel);
  color: var(--ink);
  font: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.35rem 0.65rem;
  border-radius: 8px;
  cursor: pointer;
  box-shadow: 0 2px 6px var(--shadow);
  z-index: 2;
  min-width: 3.6rem;
}
.stats-btn:hover { filter: brightness(1.03); }
.stats-btn.is-open {
  background: #e8dcc8;
  box-shadow: inset 0 0 0 1px rgba(61, 52, 41, 0.12);
}

.btn-secondary {
  background: #8b7355;
}

/* —— Stats panel (mirror Sudoku 6.1; columns Totals + Easy/Medium/Hard) —— */
.stats-panel {
  background: var(--panel);
  border-radius: 12px;
  padding: 0.85rem 0.95rem 0.95rem;
  margin-bottom: 0.85rem;
  box-shadow: 0 2px 8px var(--shadow);
}
.stats-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}
.stats-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: 0.02em;
}
.stats-close {
  padding: 0.28rem 0.7rem;
  font-size: 0.78rem;
}
.stats-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 0.55rem;
}
.stats-chip {
  display: inline-flex;
  align-items: baseline;
  gap: 0.35rem;
  background: #f0e6d6;
  border-radius: 8px;
  padding: 0.28rem 0.55rem;
  font-size: 0.8rem;
  box-shadow: inset 0 0 0 1px rgba(61, 52, 41, 0.06);
}
.stats-k {
  color: var(--soft);
  font-weight: 600;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.stats-v {
  font-weight: 700;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.stats-table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 0.35rem;
}
.stats-table {
  width: 100%;
  min-width: 18rem;
  border-collapse: collapse;
  font-size: 0.8rem;
}
.stats-table th,
.stats-table td {
  text-align: right;
  padding: 0.32rem 0.4rem;
  border-bottom: 1px solid rgba(61, 52, 41, 0.08);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.stats-table thead th {
  color: var(--soft);
  font-weight: 600;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.stats-table tbody th {
  text-align: left;
  color: var(--ink);
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: none;
  letter-spacing: 0;
}
.stats-table thead th:first-child {
  text-align: left;
}
.stats-note {
  font-size: 0.72rem;
  color: var(--soft);
  line-height: 1.35;
  margin-top: 0.25rem;
}

.match-meta-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  background: var(--panel);
  border-radius: 12px;
  padding: 0.4rem 0.9rem;
  margin: 0 0 0.85rem;
  box-shadow: 0 2px 8px var(--shadow);
}
.diff-locked {
  text-align: center;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--soft);
  margin: 0;
  padding: 0;
}
.match-timer {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  min-width: 2.6rem;
  text-align: center;
  opacity: 0.85;
}

.is-hidden { display: none !important; }

.side-select {
  background: var(--panel);
  border-radius: 12px;
  padding: 1.25rem 1rem 1.35rem;
  margin-bottom: 0.85rem;
  box-shadow: 0 2px 8px var(--shadow);
  text-align: center;
}
.side-select-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
}
.side-select-title-gap {
  margin-top: 1.15rem;
}
.side-select-note {
  font-size: 0.8rem;
  color: var(--soft);
  line-height: 1.4;
  margin-bottom: 1rem;
}
.diff-buttons,
.side-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  justify-content: center;
}
.diff-btn {
  min-width: 5.5rem;
  background: #e8dcc8;
  color: var(--ink);
}
.diff-btn.is-selected {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 0 0 2px rgba(196, 120, 90, 0.35), 0 2px 4px var(--shadow);
}
.side-btn { min-width: 5.5rem; }
.side-btn[data-side="dark"] {
  background: var(--piece-dark);
  color: #f5e6c8;
}
.side-btn[data-side="light"] {
  background: var(--piece-light);
  color: var(--ink);
  border: 1px solid var(--piece-light-rim);
}
.side-btn[data-side="random"] {
  background: var(--accent);
  color: #fff;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  background: var(--panel);
  border-radius: 12px;
  padding: 0.65rem 0.9rem;
  margin-bottom: 0.85rem;
  box-shadow: 0 2px 8px var(--shadow);
}

.status { font-size: 0.95rem; font-weight: 500; flex: 1; }

.btn {
  appearance: none;
  border: none;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.45rem 0.9rem;
  border-radius: 8px;
  cursor: pointer;
  box-shadow: 0 2px 4px var(--shadow);
}
.btn:hover { filter: brightness(1.05); }
.btn:active { transform: translateY(1px); }

#board-host { width: 100%; }

.piece {
  width: 78%;
  height: 78%;
  border-radius: 0;
  border: 0;
  cursor: pointer;
  position: relative;
  background-color: transparent;
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.22);
  transition: transform 0.12s ease;
}
.piece:hover { transform: scale(1.05); }
.piece.light { background-image: url("../art/pieces/light.png"); }
.piece.dark { background-image: url("../art/pieces/dark.png"); }
.piece.light.king { background-image: url("../art/pieces/light-king.png"); }
.piece.dark.king { background-image: url("../art/pieces/dark-king.png"); }
.piece.king::before { content: none; }
.piece.dragging { opacity: 0.45; }

.hint {
  text-align: center;
  font-size: 0.8rem;
  color: var(--soft);
  margin-top: 0.85rem;
  line-height: 1.4;
}

@media (max-width: 400px) {
  .header h1 { font-size: 1.4rem; }
  .toolbar { flex-wrap: wrap; }
  .diff-buttons,
  .side-buttons { flex-direction: column; align-items: stretch; }
}

/* Mandatory-jump hint — Checkers-local (do not add shared Board Template highlight types) */
.cas-square.must-jump-hint {
  animation: must-jump-pulse 0.85s ease-in-out 1;
}
@keyframes must-jump-pulse {
  0%, 100% {
    box-shadow: inset 0 0 0 0 transparent;
    background-image: none;
  }
  16%, 50%, 84% {
    box-shadow: inset 0 0 0 3px rgba(255, 196, 90, 0.85);
    background-image: linear-gradient(rgba(255, 210, 120, 0.42), rgba(255, 210, 120, 0.42));
  }
  33%, 67% {
    box-shadow: inset 0 0 0 2px rgba(255, 196, 90, 0.25);
    background-image: linear-gradient(rgba(255, 210, 120, 0.12), rgba(255, 210, 120, 0.12));
  }
}

/* Studio bar — match First Fleece / Meadow Takeover */
#studio-bar {
  position: relative;
  z-index: 20;
  align-self: stretch;
  width: 100%;
  height: 40px;
  display: flex;
  align-items: center;
  padding: 0 16px;
  background: #1c2619;
  color: #c9d4b8;
  font-family: Nunito, system-ui, sans-serif;
  font-size: 0.92rem;
  box-sizing: border-box;
  margin: 0;
}
#studio-bar a {
  color: #f7efe3;
  font-weight: 700;
  text-decoration: none;
  margin-right: 0.45rem;
}
#studio-bar a:hover { text-decoration: underline; }
