/* Atelier by GallusTech - Checkers / International Draughts Styles */

.checkers-app {
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
  background: var(--window-bg, var(--bg-main, #0f172a));
  color: var(--text-main, #f1f5f9);
  font-family: inherit;
  overflow: hidden;
  user-select: none;
}

.checkers-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 14px;
  background: var(--header-bg, var(--bg-card, rgba(15, 23, 42, 0.55)));
  border-bottom: 1px solid var(--border-color, rgba(255, 255, 255, 0.1));
  flex-shrink: 0;
}

.checkers-toolbar-group {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.checkers-select,
.checkers-btn {
  padding: 5px 10px;
  border-radius: 8px;
  border: 1px solid var(--border-color, rgba(255, 255, 255, 0.14));
  background: var(--bg-card, rgba(255, 255, 255, 0.06));
  color: var(--text-main, inherit);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}

.checkers-select option {
  background: var(--bg-main, #1e293b);
  color: var(--text-main, #f8fafc);
}

.checkers-btn:hover:not(:disabled),
.checkers-select:hover {
  background: var(--sidebar-bg, rgba(128, 128, 128, 0.14));
  border-color: var(--border-color-hover, rgba(59, 130, 246, 0.45));
}

.checkers-btn:active:not(:disabled) {
  transform: scale(0.97);
}

.checkers-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.checkers-btn.primary {
  background: linear-gradient(135deg, #2563eb, #0284c7);
  border-color: transparent;
  color: #ffffff;
}

.checkers-btn.primary:hover:not(:disabled) {
  background: linear-gradient(135deg, #1d4ed8, #0369a1);
}

.checkers-btn.companion {
  background: linear-gradient(135deg, #7c3aed, #2563eb);
  border-color: rgba(124, 58, 237, 0.45);
  color: #ffffff;
}

.checkers-btn.companion:hover:not(:disabled) {
  filter: brightness(1.08);
}

.checkers-auto-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text-main, #e2e8f0);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 8px;
  background: rgba(124, 58, 237, 0.12);
  border: 1px solid rgba(124, 58, 237, 0.3);
}

.checkers-main {
  flex: 1;
  min-height: 0;
  display: flex;
  gap: 14px;
  padding: 14px;
  overflow: hidden;
  background: var(--bg-main, transparent);
}

.checkers-board-stage {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.checkers-board-frame {
  position: relative;
  width: min(100%, 540px, calc(100vh - 230px));
  aspect-ratio: 1 / 1;
  max-height: 100%;
  padding: 10px;
  border-radius: 14px;
  background: linear-gradient(145deg, #4b2e19, #2b190d);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(180, 125, 70, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
}

.checkers-grid {
  width: 100%;
  height: 100%;
  display: grid;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.45);
}

.checkers-cell {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.14s ease;
}

.checkers-cell.light {
  background: #ebd7b7;
}

.checkers-cell.dark {
  background: #7c4f2b;
  cursor: pointer;
}

.checkers-cell.dark.last-from {
  background: #9a6d33;
}

.checkers-cell.dark.last-to {
  background: #b58438;
}

.checkers-cell.dark.selected {
  background: #2563eb;
  box-shadow: inset 0 0 0 2px #93c5fd;
}

.checkers-cell.dark.hint-from {
  box-shadow: inset 0 0 0 3px #f59e0b;
}

.checkers-cell.dark.hint-to {
  box-shadow: inset 0 0 0 3px #22c55e;
}

.checkers-cell.dark.must-capture::before {
  content: '';
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  border: 2px dashed rgba(251, 191, 36, 0.85);
  pointer-events: none;
}

.checkers-cell.dark.legal-target::after {
  content: '';
  position: absolute;
  width: 30%;
  height: 30%;
  border-radius: 50%;
  background: rgba(56, 189, 248, 0.88);
  box-shadow: 0 0 0 4px rgba(56, 189, 248, 0.28);
  pointer-events: none;
}

.checkers-cell.dark.legal-capture::after {
  width: 38%;
  height: 38%;
  background: rgba(245, 158, 11, 0.92);
  box-shadow: 0 0 0 5px rgba(245, 158, 11, 0.3);
}

.checkers-sq-num {
  position: absolute;
  top: 2px;
  left: 3px;
  font-size: 0.56rem;
  font-weight: 700;
  color: rgba(255, 244, 224, 0.55);
  line-height: 1;
  pointer-events: none;
}

.checkers-piece {
  width: 78%;
  height: 78%;
  border-radius: 50%;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.16s ease, box-shadow 0.16s ease;
  pointer-events: none;
}

.checkers-piece.white {
  background: radial-gradient(circle at 32% 28%, #ffffff 0%, #f1e6d2 58%, #cbb896 100%);
  border: 2px solid #9f8964;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.42), inset 0 2px 3px rgba(255, 255, 255, 0.9), inset 0 -3px 5px rgba(120, 95, 60, 0.35);
}

.checkers-piece.black {
  background: radial-gradient(circle at 32% 28%, #475569 0%, #1e293b 55%, #090d16 100%);
  border: 2px solid #0f172a;
  box-shadow: 0 4px 9px rgba(0, 0, 0, 0.58), inset 0 2px 3px rgba(255, 255, 255, 0.22), inset 0 -3px 5px rgba(0, 0, 0, 0.65);
}

.checkers-piece.king::before {
  content: '👑';
  font-size: clamp(0.72rem, 1.8vw, 1.15rem);
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.55));
}

.checkers-cell.selected .checkers-piece {
  transform: scale(1.08) translateY(-2px);
}

.checkers-side {
  width: 262px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
}

.checkers-card {
  padding: 11px 12px;
  border-radius: 12px;
  background: var(--bg-card, rgba(255, 255, 255, 0.05));
  border: 1px solid var(--border-color, rgba(255, 255, 255, 0.1));
  color: var(--text-main, inherit);
}

.checkers-turn-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text-main, inherit);
}

.checkers-turn-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 2px solid var(--border-color-hover, rgba(100, 116, 139, 0.6));
}

.checkers-turn-dot.white {
  background: #f8fafc;
  border-color: #94a3b8;
}

.checkers-turn-dot.black {
  background: #0f172a;
  border-color: #475569;
}

.checkers-score-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  margin-top: 8px;
  gap: 6px;
}

.checkers-pill {
  flex: 1;
  padding: 5px 8px;
  border-radius: 8px;
  background: var(--sidebar-bg, rgba(128, 128, 128, 0.12));
  border: 1px solid var(--border-color, rgba(128, 128, 128, 0.16));
  color: var(--text-main, inherit);
  text-align: center;
  font-weight: 600;
}

.checkers-companion-box {
  background: linear-gradient(145deg, rgba(124, 58, 237, 0.12), rgba(37, 99, 235, 0.09));
  border: 1px solid rgba(124, 58, 237, 0.32);
}

.checkers-companion-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--accent, #7c3aed);
  margin-bottom: 6px;
}

.checkers-companion-msg {
  font-size: 0.8rem;
  line-height: 1.42;
  color: var(--text-main, inherit);
  word-break: break-word;
}

.checkers-autonomy-tip {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border-color, rgba(128, 128, 128, 0.2));
  font-size: 0.73rem;
  color: var(--text-muted, #64748b);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.checkers-history-card {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.checkers-history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.78rem;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--text-muted, #64748b);
}

.checkers-history-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.76rem;
  color: var(--text-main, inherit);
}

.checkers-history-row {
  display: grid;
  grid-template-columns: 28px 1fr 1fr;
  gap: 6px;
  padding: 3px 6px;
  border-radius: 6px;
  background: var(--sidebar-bg, rgba(128, 128, 128, 0.08));
}

.checkers-history-row:last-child {
  background: rgba(37, 99, 235, 0.16);
  font-weight: 700;
}

.checkers-mandatory-badge {
  margin-top: 6px;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  color: #b45309;
  background: rgba(245, 158, 11, 0.16);
  border: 1px solid rgba(245, 158, 11, 0.42);
}

body[data-theme="dark-glass"] .checkers-mandatory-badge,
body[data-theme="cyberpunk"] .checkers-mandatory-badge {
  color: #fbbf24;
}

.checkers-victory-banner {
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 700;
  color: #15803d;
  background: rgba(34, 197, 94, 0.15);
  border: 1px solid rgba(34, 197, 94, 0.42);
}

body[data-theme="dark-glass"] .checkers-victory-banner,
body[data-theme="cyberpunk"] .checkers-victory-banner {
  color: #86efac;
}

@media (max-width: 720px) {
  .checkers-main {
    flex-direction: column;
    overflow-y: auto;
  }
  .checkers-side {
    width: 100%;
  }
}
