/* ============================================
   Tablo — Checkers Styles
   ============================================ */

:root {
  --bg-dark: var(--bg-primary, #0f1923);
  --bg-panel: var(--bg-surface, #1a2332);
  --accent-light: #5eead4;
  --piece-red: #f87171;
  --piece-black: #1e293b;
  --board-light: #d4b896;
  --board-dark: #6b4423;
  --highlight-move: rgba(45, 212, 211, 0.5);
  --highlight-capture: rgba(248, 113, 113, 0.5);
  --font-primary: 'Nunito', sans-serif;
}

.game-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 20px 20px;
  gap: 24px;
}

.game-wrapper::before {
  content: '';
  display: block;
  height: 12px;
  flex-shrink: 0;
}

.game-stats {
  flex-shrink: 0;
  display: flex;
  gap: 24px;
  padding: 16px 24px;
  background: var(--bg-surface, #1a2332);
  border: 1px solid var(--border-color, #2a3441);
  border-radius: var(--radius-lg, 12px);
  flex-wrap: wrap;
  justify-content: center;
  width: 100%;
  max-width: 500px;
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 80px;
}

.stat-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary, #8892a0);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--accent, #2dd4bf);
  font-family: 'Nunito', monospace;
}

.board-container {
  flex-shrink: 0;
  position: relative;
  width: 400px;
  height: 400px;
  border-radius: var(--radius-lg, 12px);
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  user-select: none;
  z-index: 10;
}

.checkerboard {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr);
  width: 100%;
  height: 100%;
  background: var(--board-light);
}

.cell {
  position: relative;
  width: 100%;
  height: 100%;
}

.cell.dark {
  background: var(--board-dark);
}

.cell.light {
  background: var(--board-light);
}

.cell.highlight-move {
  background: var(--highlight-move) !important;
}

.cell.highlight-capture {
  background: var(--highlight-capture) !important;
}

.pieces-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
}

.piece {
  position: absolute;
  width: 12.5%;
  height: 12.5%;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
  cursor: pointer;
  transition: transform 0.15s ease;
}

.piece-inner {
  width: 70%;
  height: 70%;
  border-radius: 50%;
  border: 3px solid rgba(0, 0, 0, 0.3);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4), inset 0 -4px 4px rgba(0, 0, 0, 0.3);
  position: relative;
}

.piece.red .piece-inner {
  background: radial-gradient(circle at 30% 30%, #ff8787, #dc2626);
}

.piece.black .piece-inner {
  background: radial-gradient(circle at 30% 30%, #4b5563, #1f2937);
}

.piece.king .piece-inner::after {
  content: '♕';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 1.5em;
  color: gold;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
}

.piece.selected .piece-inner {
  box-shadow: 0 0 0 4px var(--accent, #2dd4bf), 0 4px 8px rgba(0, 0, 0, 0.4);
  animation: pulse 1s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

.piece:hover .piece-inner {
  transform: scale(1.05);
}

.game-controls {
  flex-shrink: 0;
  display: flex;
  gap: 12px;
  justify-content: center;
}

.game-btn {
  background: var(--bg-surface, #1a2332);
  border: 1px solid var(--border-color, #2a3441);
  color: var(--text-primary, #e4e7eb);
  padding: 10px 20px;
  border-radius: var(--radius-md, 8px);
  font-family: var(--font-primary);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.game-btn:hover:not(:disabled) {
  background: var(--bg-hover, #243044);
  border-color: var(--accent, #2dd4bf);
  color: var(--accent, #2dd4bf);
}

.game-btn:active:not(:disabled) {
  transform: translateY(-1px);
}

.game-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.game-btn.primary {
  background: var(--accent, #2dd4bf);
  border-color: var(--accent, #2dd4bf);
  color: #0f1923;
}

.game-btn.primary:hover:not(:disabled) {
  background: var(--accent-light, #5eead4);
  border-color: var(--accent-light, #5eead4);
}

.game-hint {
  flex-shrink: 0;
  font-size: 13px;
  color: var(--text-muted, #5a6e7c);
  text-align: center;
  margin-top: 8px;
}

.desktop-only {
  display: block;
}

.mobile-only {
  display: none;
}

.winner-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
}

.winner-modal.visible {
  display: flex;
}

.winner-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
}

.winner-content {
  position: relative;
  z-index: 1;
  background: var(--bg-panel, #1a2332);
  border: 2px solid var(--accent, #2dd4bf);
  border-radius: var(--radius-lg, 12px);
  padding: 32px 24px;
  text-align: center;
  max-width: 400px;
  width: 90%;
  box-shadow: 0 16px 64px rgba(0, 0, 0, 0.5);
}

.winner-icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.winner-title {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--text-primary, #e4e7eb);
}

.winner-message {
  font-size: 14px;
  color: var(--text-secondary, #8892ba);
  margin-bottom: 24px;
}

.winner-buttons {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.tablo-toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--bg-panel, #1a2332);
  border: 1px solid var(--border-color, #2a3441);
  color: var(--text-primary, #e4e7eb);
  padding: 12px 24px;
  border-radius: var(--radius-md, 8px);
  font-size: 13px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  z-index: 10001;
  opacity: 0;
  transition: opacity 0.3s ease, transform 0.3s ease;
  pointer-events: none;
}

.tablo-toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@media (max-width: 768px) {
  .board-container {
    width: 340px;
    height: 340px;
  }

  .piece.king .piece-inner::after {
    font-size: 1.2em;
  }

  .desktop-only {
    display: none;
  }

  .mobile-only {
    display: block;
  }

  .game-stats {
    gap: 16px;
    padding: 12px 16px;
  }

  .stat-value {
    font-size: 18px;
  }
}

@media (max-width: 480px) {
  .game-wrapper {
    padding: 0 12px 12px;
  }

  .board-container {
    width: 300px;
    height: 300px;
  }

  .game-btn {
    padding: 8px 16px;
    font-size: 13px;
  }
}