* { box-sizing: border-box; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #f6f7fb;
  margin: 0;
  padding: 16px;
  color: #1f2330;
}
.wrap { max-width: 480px; margin: 0 auto; text-align: center; }
.status {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  font-size: 16px;
  font-weight: 600;
}
#newbtn {
  background: #4f46e5; color: white; border: 0; padding: 8px 14px;
  border-radius: 6px; cursor: pointer;
}
#newbtn:hover { background: #4338ca; }
.board {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  border: 4px solid #1f2937;
  border-radius: 6px;
  aspect-ratio: 1;
  user-select: none;
  background: #1f2937;
}
.cell {
  position: relative;
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: default;
}
.cell.light { background: #f1d9b5; }
.cell.dark { background: #b07a4a; cursor: pointer; }
.cell.selected { outline: 3px solid #10b981; outline-offset: -3px; z-index: 1; }
.cell.target { background: #fde68a; cursor: pointer; }
.piece {
  width: 76%;
  height: 76%;
  border-radius: 50%;
  border: 3px solid rgba(0,0,0,0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 700;
  color: rgba(255,255,255,0.85);
}
.piece.red { background: #ef4444; }
.piece.black { background: #1f2937; }
.piece.king::after { content: '\2655'; }
.result {
  margin-top: 16px;
  padding: 12px;
  border-radius: 6px;
  font-size: 18px;
  font-weight: 600;
}
.result.win { background: #d1fae5; color: #065f46; }
.result.lose { background: #fee2e2; color: #991b1b; }
.result.hidden { display: none; }
.difficulty { display: flex; gap: 4px; padding: 8px 0; justify-content: center; margin-bottom: 4px; }
.difficulty button {
  padding: 6px 14px; border-radius: 8px; border: 0;
  background: rgba(0,0,0,0.08); cursor: pointer; font-weight: 600;
  font-family: inherit; font-size: 14px; touch-action: manipulation;
}
.difficulty button.active { background: #6a4c93; color: white; }
.ai-thinking {
  text-align: center;
  padding: 6px 8px;
  margin-bottom: 8px;
  color: #6a4c93;
  font-weight: 600;
  font-size: 14px;
  animation: ai-pulse 1.2s ease-in-out infinite;
}
.ai-thinking[hidden] { display: none; }
@keyframes ai-pulse {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}
