/**
 * Connections Game Component Styles
 * Matches NYT Athletic / Sports Edition visual style
 */

#connections-game {
  background: #fff;
  border-radius: 12px;
  padding: 28px 24px;
  margin-bottom: 24px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  border: 1px solid #e9ecef;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

.cg-subtitle {
  text-align: center;
  color: #555;
  font-size: 1.05rem;
  margin-bottom: 20px;
}

/* Solved groups */
.cg-solved-row {
  border-radius: 12px;
  padding: 16px 16px;
  margin-bottom: 8px;
  text-align: center;
  animation: cg-reveal 0.4s ease;
}

.cg-solved-title {
  font-weight: 800;
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.cg-solved-words {
  font-size: 0.88rem;
  font-weight: 500;
}

/* Word grid */
.cg-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 18px;
  max-width: 480px;
  margin-left: auto;
  margin-right: auto;
}

/* Default tile style — rounded rectangle (Regular Connections) */
.cg-tile {
  background: #efefe6;
  color: #333;
  border: none;
  border-radius: 10px;
  padding: 18px 6px;
  font-size: 0.9rem;
  font-weight: 700;
  font-family: 'Inter', -apple-system, sans-serif;
  text-transform: uppercase;
  cursor: pointer;
  user-select: none;
  transition: transform 0.12s, background 0.15s, color 0.15s;
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  word-break: break-word;
  line-height: 1.15;
}

.cg-tile:hover {
  background: #e2e2d8;
}

.cg-tile:active {
  transform: scale(0.95);
}

.cg-tile.cg-selected {
  background: #5a6173;
  color: #fff;
  transform: scale(0.97);
}

.cg-tile.cg-tile-long {
  font-size: 0.72rem;
}

/* ==========================================================================
   Sports Edition — dark circular tiles (NYT Athletic style)
   ========================================================================== */

.cg-sports .cg-grid {
  max-width: 440px;
}

.cg-sports .cg-tile {
  aspect-ratio: 1;
  min-height: unset;
  background: #5a6173;
  color: #fff;
  border-radius: 50%;
  padding: 8px 4px;
  font-size: 0.88rem;
}

.cg-sports .cg-tile:hover {
  background: #4a5163;
}

.cg-sports .cg-tile.cg-selected {
  background: #fff;
  color: #333;
  box-shadow: 0 0 0 3px #5a6173;
  transform: scale(1.03);
}

.cg-sports .cg-tile.cg-tile-long {
  font-size: 0.62rem;
}

/* Mistakes */
.cg-mistakes {
  text-align: center;
  font-size: 0.95rem;
  color: #555;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}

.cg-dot {
  display: inline-block;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #d3d6da;
}

.cg-dot-active {
  background: #5a6173;
}

/* Buttons */
.cg-buttons {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-bottom: 16px;
}

.cg-btn {
  padding: 12px 28px;
  border-radius: 24px;
  font-size: 0.95rem;
  font-weight: 600;
  font-family: 'Inter', -apple-system, sans-serif;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
  border: 1.5px solid #333;
}

.cg-btn-secondary {
  background: #fff;
  color: #333;
}

.cg-btn-secondary:hover {
  background: #f3f3f3;
}

.cg-btn-primary {
  background: #333;
  color: #fff;
  border-color: #333;
}

.cg-btn-primary:hover {
  background: #111;
}

.cg-btn-disabled {
  opacity: 0.35;
  cursor: default;
  pointer-events: none;
}

/* Game result */
.cg-result {
  text-align: center;
  padding: 18px 0;
}

.cg-result-text {
  font-size: 1.15rem;
  font-weight: 700;
  color: #333;
  margin-bottom: 4px;
}

.cg-result-sub {
  font-size: 0.9rem;
  color: #666;
}

/* Hints link */
.cg-hints-link {
  text-align: center;
  margin-top: 12px;
}

.cg-hints-link a {
  color: #667eea;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
}

.cg-hints-link a:hover {
  text-decoration: underline;
}

/* Animation */
@keyframes cg-reveal {
  from { opacity: 0; transform: scaleY(0.8); }
  to { opacity: 1; transform: scaleY(1); }
}

/* Responsive */
@media (max-width: 520px) {
  #connections-game {
    padding: 20px 14px;
  }

  .cg-grid {
    gap: 6px;
  }

  /* Regular: rounded rect */
  .cg-tile {
    font-size: 0.78rem;
    padding: 14px 4px;
    min-height: 52px;
  }

  .cg-tile.cg-tile-long {
    font-size: 0.6rem;
  }

  /* Sports: circular */
  .cg-sports .cg-tile {
    font-size: 0.75rem;
    padding: 6px 3px;
    min-height: unset;
  }

  .cg-sports .cg-tile.cg-tile-long {
    font-size: 0.52rem;
  }

  .cg-btn {
    padding: 10px 18px;
    font-size: 0.85rem;
  }

  .cg-solved-title {
    font-size: 0.88rem;
  }

  .cg-solved-words {
    font-size: 0.78rem;
  }
}

@media (max-width: 380px) {
  .cg-grid {
    gap: 4px;
  }

  .cg-tile {
    font-size: 0.7rem;
  }

  .cg-tile.cg-tile-long {
    font-size: 0.55rem;
  }
}
