/* Jogatina — páginas de jogos (mobile first) */

.page-games-list .games-main {
  padding: 2rem 0 4rem;
  min-height: 60vh;
}

.games-title {
  margin: 0 0 0.5rem;
  font-size: clamp(1.5rem, 4vw, 2rem);
  font-weight: 700;
  color: var(--gray-900, #111827);
  text-align: center;
}

.games-subtitle {
  margin: 0 0 2rem;
  text-align: center;
  color: var(--gray-800, #1f2937);
  font-size: 1.05rem;
}

.games-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
  max-width: 400px;
  margin: 0 auto;
}

.game-card-link-page {
  text-decoration: none;
  color: inherit;
  display: block;
}

.game-card-link-page.game-card-coming {
  opacity: 0.85;
  pointer-events: none;
  cursor: default;
}

.game-card-large {
  padding: 1.75rem;
  text-align: center;
}

.game-card-large h2 {
  margin: 0 0 0.5rem;
  font-size: 1.25rem;
}

.game-card-large p {
  margin: 0 0 1rem;
  font-size: 0.9rem;
  color: var(--gray-800, #1f2937);
}

.game-card-cta {
  display: inline-block;
  padding: 0.5rem 1.25rem;
  background: var(--green, #22c55e);
  color: white;
  font-weight: 600;
  font-size: 0.9rem;
  border-radius: 8px;
}

.game-card-coming .game-card-cta {
  background: var(--gray-100, #f3f4f6);
  color: var(--gray-600, #4b5563);
}

@media (min-width: 640px) {
  .games-grid {
    grid-template-columns: repeat(2, 1fr);
    max-width: 700px;
  }
}

@media (min-width: 768px) {
  .games-grid {
    grid-template-columns: repeat(2, 1fr);
    max-width: 800px;
    gap: 1.5rem;
  }
}

/* ——— Página do jogo (fullscreen) ——— */

.page-game {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--gray-50, #f9fafb);
}

.game-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  background: white;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  flex-shrink: 0;
}

.game-header-back {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.5rem 0.75rem;
  background: var(--gray-100, #f3f4f6);
  color: var(--gray-800, #1f2937);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  border-radius: 8px;
}

.game-header-back:hover {
  background: var(--gray-200, #e5e7eb);
}

.game-header-title {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--gray-900, #111827);
}

.game-header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.game-btn {
  padding: 0.5rem 1rem;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  background: var(--green, #22c55e);
  color: white;
}

.game-btn:hover {
  filter: brightness(1.05);
}

.game-btn-secondary {
  background: var(--gray-200, #e5e7eb);
  color: var(--gray-800, #1f2937);
}

.game-btn-secondary:hover {
  background: var(--gray-300, #d1d5db);
}

.game-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.game-turn {
  margin-bottom: 1rem;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--gray-800, #1f2937);
}

.game-turn .turn-x { color: var(--blue, #2563eb); }
.game-turn .turn-o { color: var(--green, #22c55e); }

/* Jogo da velha — tabuleiro */

.velha-board {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 4px;
  width: min(280px, 85vw);
  aspect-ratio: 1;
  background: var(--gray-800, #1f2937);
  padding: 4px;
  border-radius: 12px;
  box-shadow: 0 4px 14px rgba(0,0,0,0.15);
}

.velha-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  background: white;
  border: none;
  border-radius: 8px;
  font-size: 2.5rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.1s, background 0.15s;
}

.velha-cell:hover:not(.velha-cell-filled) {
  background: var(--gray-50, #f9fafb);
  transform: scale(1.02);
}

.velha-cell-filled {
  cursor: default;
}

.velha-cell-x { color: var(--blue, #2563eb); }
.velha-cell-o { color: var(--green, #22c55e); }

.velha-cell.winner {
  background: var(--yellow, #facc15);
  color: var(--gray-900, #111827);
}

.game-result {
  margin-top: 1.25rem;
  padding: 1rem 1.5rem;
  font-size: 1.15rem;
  font-weight: 700;
  text-align: center;
  border-radius: 10px;
  display: none;
}

.game-result.visible {
  display: block;
}

.game-result.win-x { background: rgba(37, 99, 235, 0.2); color: var(--blue); }
.game-result.win-o { background: rgba(34, 197, 94, 0.2); color: var(--green); }
.game-result.draw { background: var(--gray-200, #e5e7eb); color: var(--gray-700, #374151); }

.game-mode-toggle {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
  justify-content: center;
}

.game-mode-toggle button {
  padding: 0.4rem 0.9rem;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: 8px;
  border: 2px solid var(--gray-200, #e5e7eb);
  background: white;
  color: var(--gray-700, #374151);
  cursor: pointer;
}

.game-mode-toggle button.active {
  border-color: var(--green, #22c55e);
  background: var(--green, #22c55e);
  color: white;
}

.game-mode-toggle button:not(.active):hover {
  border-color: var(--gray-300, #d1d5db);
  background: var(--gray-50, #f9fafb);
}

.velha-diff-wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.velha-diff-label {
  font-size: 0.9rem;
  color: var(--gray-700, #374151);
  margin-right: 0.25rem;
}

.velha-diff-btn {
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 600;
  border-radius: 8px;
  border: 2px solid var(--gray-200, #e5e7eb);
  background: white;
  color: var(--gray-700, #374151);
  cursor: pointer;
}

.velha-diff-btn.active {
  border-color: var(--blue, #2563eb);
  background: var(--blue, #2563eb);
  color: white;
}

.velha-diff-btn:not(.active):hover {
  border-color: var(--gray-300, #d1d5db);
  background: var(--gray-50, #f9fafb);
}

.velha-diff-hint {
  font-size: 0.8rem;
  color: var(--gray-600, #4b5563);
  font-style: italic;
  margin-left: 0.25rem;
}

.velha-cell.velha-last-ia {
  animation: velha-pulse 0.6s ease-out;
}

.velha-cell.velha-cell-drop {
  background: rgba(34, 197, 94, 0.35);
}

.velha-cell.velha-cell-drop:hover {
  background: rgba(34, 197, 94, 0.55);
}

.velha-drag-hint {
  font-size: 0.85rem;
  color: var(--gray-600, #4b5563);
  margin: -0.5rem 0 0.75rem;
  text-align: center;
}

.velha-drag-token {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  margin: 0 auto 1rem;
  font-size: 2rem;
  font-weight: 700;
  border-radius: 12px;
  cursor: grab;
  user-select: none;
  touch-action: none;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  transition: transform 0.1s;
}

.velha-drag-token:active {
  cursor: grabbing;
}

.velha-token-x {
  background: var(--blue, #2563eb);
  color: #fff;
}

.velha-token-o {
  background: var(--green, #22c55e);
  color: #fff;
}

.velha-ghost {
  pointer-events: none;
}

@keyframes velha-pulse {
  0% { transform: scale(1.1); box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.4); }
  100% { transform: scale(1); box-shadow: none; }
}

/* ——— Damas ——— */

.damas-board {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr);
  width: min(360px, 90vw);
  aspect-ratio: 1;
  background: var(--gray-800, #1f2937);
  padding: 2px;
  border-radius: 8px;
  box-shadow: 0 4px 14px rgba(0,0,0,0.15);
}

.damas-cell {
  border: none;
  padding: 0;
  min-height: 0;
  cursor: default;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}

.damas-cell-light {
  background: #f5e6d3;
  cursor: default;
}

.damas-cell-dark {
  background: #8b4513;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
}

.damas-cell-dark[draggable="true"] {
  cursor: grab;
}

.damas-cell-dark[draggable="true"]:active {
  cursor: grabbing;
}

.damas-cell-dark:hover {
  filter: brightness(1.1);
}

.damas-cell.damas-valid {
  background: rgba(34, 197, 94, 0.5);
  cursor: pointer;
}

.damas-cell.damas-valid:hover {
  background: rgba(34, 197, 94, 0.8);
}

.damas-cell.damas-selected {
  box-shadow: inset 0 0 0 3px var(--yellow, #facc15);
}

.damas-cell.damas-dragging {
  opacity: 0.6;
}

.damas-ghost {
  touch-action: none;
  pointer-events: none;
}

.damas-piece {
  width: 75%;
  height: 75%;
  border-radius: 50%;
  pointer-events: none;
}

.damas-piece-white {
  background: radial-gradient(circle at 30% 30%, #fff, #e5e5e5);
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.damas-piece-black {
  background: radial-gradient(circle at 30% 30%, #4b5563, #1f2937);
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.damas-piece.damas-king {
  box-shadow: 0 0 0 2px var(--yellow, #facc15), 0 1px 3px rgba(0,0,0,0.3);
}

.damas-cell {
  position: relative;
}

.turn-black { color: #1f2937; font-weight: 700; }
.turn-white { color: #e5e7eb; font-weight: 700; }

/* ——— Xadrez ——— */

.xadrez-board {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr);
  width: min(400px, 92vw);
  aspect-ratio: 1;
  background: var(--gray-800, #1f2937);
  padding: 2px;
  border-radius: 6px;
  box-shadow: 0 4px 14px rgba(0,0,0,0.15);
}

.xadrez-cell {
  border: none;
  padding: 0;
  min-height: 0;
  cursor: pointer;
  border-radius: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(1.5rem, 4vw, 2.2rem);
  line-height: 1;
  transition: background 0.15s;
}

.xadrez-cell-light {
  background: #f0d9b5;
}

.xadrez-cell-dark {
  background: #b58863;
}

.xadrez-cell:hover {
  filter: brightness(1.08);
}

.xadrez-cell.xadrez-valid {
  background: rgba(34, 197, 94, 0.4);
}

.xadrez-cell.xadrez-valid:hover {
  background: rgba(34, 197, 94, 0.7);
}

.xadrez-cell.xadrez-selected {
  box-shadow: inset 0 0 0 3px var(--yellow, #facc15);
}

.xadrez-piece {
  pointer-events: none;
}

.xadrez-w { color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,0.3); }
.xadrez-b { color: #1f2937; text-shadow: 0 1px 1px rgba(255,255,255,0.2); }

.xadrez-status {
  margin-top: 0.75rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--gray-700, #374151);
  text-align: center;
  min-height: 1.5em;
}

.xadrez-ghost {
  touch-action: none;
  pointer-events: none;
}
