/* Common Game Styles */
:root {
  --primary-bg: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --secondary-bg: #ffffff;
  --cat-color: #9b59b6;
  --dog-color: #e67e22;
  --win-color: #27ae60;
  --text-dark: #2c3e50;
  --text-light: #ffffff;
  --primary-color: #7c5cff;
  --border-radius: 20px;
  --shadow: 0 10px 30px rgba(0,0,0,0.2);
  --soft-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Comic Sans MS', cursive, sans-serif;
  background: var(--primary-bg);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
}

.game-container {
  background: var(--secondary-bg);
  padding: 30px;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
  max-width: 600px;
  width: 100%;
  text-align: center;
}

.game-title {
  margin-bottom: 20px;
  text-shadow: 2px 2px 4px rgba(0,0,0,0.1);
}

.title-line-1 {
  font-size: 2.5rem;
  color: var(--text-dark);
  font-weight: bold;
  margin-bottom: 5px;
}

.title-line-2 {
  font-size: 1.8rem;
  color: var(--text-dark);
  font-weight: normal;
  opacity: 0.8;
}

.game-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
  flex-wrap: wrap;
  gap: 15px;
}

.current-player {
  font-size: 1.3rem;
  font-weight: bold;
  color: var(--text-dark);
  padding: 10px 20px;
  border-radius: 25px;
  box-shadow: var(--soft-shadow);
  transition: all 0.3s ease;
}

.current-player.cat {
  background: linear-gradient(135deg, #ddd6fe, #c7d2fe);
  color: var(--cat-color);
}

.current-player.dog {
  background: linear-gradient(135deg, #fed7aa, #fecaca);
  color: var(--dog-color);
}

.score-board {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.score-item {
  padding: 8px 12px;
  border-radius: 15px;
  font-weight: bold;
  font-size: 0.9rem;
  box-shadow: var(--soft-shadow);
}

.score-cats {
  background: linear-gradient(135deg, #ddd6fe, #c7d2fe);
  color: var(--cat-color);
}

.score-dogs {
  background: linear-gradient(135deg, #fed7aa, #fecaca);
  color: var(--dog-color);
}

.score-draws {
  background: linear-gradient(135deg, #d1fae5, #a7f3d0);
  color: var(--win-color);
}

.game-board {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 15px;
  margin: 30px auto;
  max-width: 350px;
  aspect-ratio: 1;
}

.cell {
  background: linear-gradient(135deg, #f8fafc, #e2e8f0);
  border: 3px solid #cbd5e1;
  border-radius: var(--border-radius);
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
  aspect-ratio: 1;
}

.cell:hover:not(.filled) {
  background: linear-gradient(135deg, #e2e8f0, #cbd5e1);
  transform: translateY(-5px);
  box-shadow: var(--shadow);
}

.cell.filled {
  cursor: not-allowed;
}

.piece-image {
  width: 80%;
  height: 80%;
  object-fit: cover;
  border-radius: 15px;
  animation: bounceIn 0.6s ease;
  aspect-ratio: 1;
}

.cell.winning {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  border-color: #92400e;
  position: relative;
  animation: winningPulse 1.5s ease-in-out infinite;
}

@keyframes winningPulse {
  0%, 100% { 
    box-shadow: 0 0 20px rgba(245, 158, 11, 0.6);
  }
  50% { 
    box-shadow: 0 0 30px rgba(245, 158, 11, 0.9);
  }
}

@keyframes bounceIn {
  0% {
    transform: scale(0) rotate(180deg);
    opacity: 0;
  }
  50% {
    transform: scale(1.2) rotate(90deg);
    opacity: 0.7;
  }
  100% {
    transform: scale(1) rotate(0deg);
    opacity: 1;
  }
}

.game-controls {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 20px;
}

.btn {
  padding: 10px 18px;
  border: none;
  border-radius: 25px;
  font-size: 0.9rem;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s ease;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.btn:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
}

.btn-primary {
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
}

.btn-secondary {
  background: linear-gradient(135deg, #ffecd2, #fcb69f);
  color: var(--text-dark);
}

.winner-announcement {
  font-size: 1.8rem;
  font-weight: bold;
  margin: 20px 0;
  padding: 20px;
  border-radius: var(--border-radius);
  animation: pulse 2s infinite;
}

.winner-announcement.cats {
  background: linear-gradient(135deg, #ddd6fe, #c7d2fe);
  color: var(--cat-color);
}

.winner-announcement.dogs {
  background: linear-gradient(135deg, #fed7aa, #fecaca);
  color: var(--dog-color);
}

.winner-announcement.draw {
  background: linear-gradient(135deg, #d1fae5, #a7f3d0);
  color: var(--win-color);
}

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

.confetti {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1000;
}

.confetti-piece {
  position: absolute;
  width: 10px;
  height: 10px;
  background: #f39c12;
  animation: confetti-fall 3s linear infinite;
}

@keyframes confetti-fall {
  to {
    transform: translateY(100vh) rotate(360deg);
  }
}

.image-selector {
  background: rgba(255, 255, 255, 0.95);
  border-radius: 12px;
  padding: 8px 12px;
  margin-bottom: 10px;
  box-shadow: var(--soft-shadow);
}

.image-selector h3 {
  font-size: 0.85rem;
  margin: 0 0 6px 0;
  color: var(--text-dark);
  text-align: center;
}

.image-grid {
  display: flex;
  gap: 4px;
  justify-content: center;
  flex-wrap: wrap;
}

.image-option {
  position: relative;
  width: 35px;
  height: 35px;
  border-radius: 6px;
  overflow: hidden;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.image-option:hover {
  transform: translateY(-1px);
  border-color: #ddd;
}

.image-option.selected {
  border-color: #4CAF50;
  box-shadow: 0 0 6px rgba(76, 175, 80, 0.4);
}

.image-option img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.image-selector-grid {
  display: flex;
  gap: 15px;
  justify-content: center;
}

.selector-section {
  text-align: center;
}

.selector-section h4 {
  font-size: 0.75rem;
  margin: 0 0 4px 0;
}

/* Mobile Responsive */
@media (max-width: 600px) {
  .title-line-1 {
    font-size: 2rem;
  }
  
  .title-line-2 {
    font-size: 1.4rem;
  }
  
  .game-info {
    flex-direction: column;
    text-align: center;
    gap: 10px;
  }
  
  .score-board {
    justify-content: center;
  }
  
  .game-board {
    max-width: 280px;
  }
  
  .btn {
    font-size: 0.8rem;
    padding: 8px 16px;
  }
  
  .image-option {
    width: 30px;
    height: 30px;
  }
  
  .language-selector {
    flex-direction: column;
    gap: 5px;
  }
}

/* Language Selector */
.language-selector {
  margin-top: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 0.9rem;
}

.language-selector label {
  color: var(--text-dark);
  font-weight: 500;
}

.language-selector select {
  padding: 5px 10px;
  border: 2px solid var(--border-color);
  border-radius: 8px;
  background: white;
  color: var(--text-dark);
  font-size: 0.9rem;
  cursor: pointer;
  transition: border-color 0.2s ease;
}

.language-selector select:hover {
  border-color: var(--primary-color);
}

.language-selector select:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px var(--primary-color-light);
}

/* Game Setup Container */
.game-setup {
  transition: all 0.3s ease;
  overflow: hidden;
}

.game-setup.compact {
  max-height: 60px;
}

.game-setup.compact .setup-content {
  opacity: 0;
  pointer-events: none;
}

.setup-toggle {
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  padding: 12px 16px !important;
  background: #7c5cff !important;
  color: #ffffff !important;
  border-radius: 8px !important;
  cursor: pointer !important;
  margin-bottom: 15px !important;
  font-weight: 600 !important;
  font-size: 0.95rem !important;
  transition: all 0.2s ease !important;
  box-shadow: 0 2px 8px rgba(124, 92, 255, 0.3) !important;
  border: none !important;
  outline: none !important;
}

.setup-toggle:hover {
  background: #6c51d6 !important;
  transform: translateY(-1px) !important;
  box-shadow: 0 4px 12px rgba(124, 92, 255, 0.4) !important;
}

.setup-toggle span {
  color: #ffffff !important;
  font-weight: 600 !important;
}

.setup-toggle .toggle-icon {
  color: #ffffff !important;
  font-weight: bold !important;
  font-size: 1.1rem !important;
}

.setup-toggle .toggle-icon {
  transition: transform 0.3s ease;
}

.game-setup.compact .setup-toggle .toggle-icon {
  transform: rotate(180deg);
}

.setup-content {
  transition: opacity 0.3s ease;
}

/* Game Mode Selection */
.game-mode-selector, .team-selector, .difficulty-selector {
  margin-bottom: 15px;
  padding: 15px;
  background: white;
  border-radius: 12px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.game-mode-selector h3, .team-selector h3, .difficulty-selector h3 {
  margin: 0 0 12px 0;
  font-size: 1.1rem;
  color: var(--text-dark);
  text-align: center;
}

.mode-buttons, .team-buttons, .difficulty-buttons {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}

.mode-btn, .team-btn, .difficulty-btn {
  padding: 8px 16px;
  border: 2px solid var(--border-color);
  background: white;
  color: var(--text-dark);
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.2s ease;
  min-width: 100px;
}

.mode-btn:hover, .team-btn:hover, .difficulty-btn:hover {
  border-color: var(--primary-color);
  transform: translateY(-1px);
}

.mode-btn.active, .team-btn.active, .difficulty-btn.active {
  border-color: var(--primary-color);
  background: var(--primary-color);
  color: white !important;
  font-weight: 600;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(124, 92, 255, 0.3);
}

/* Team-specific styling */
.team-btn.cat-team.active {
  background: var(--cat-color) !important;
  border-color: var(--cat-color);
  color: white !important;
  box-shadow: 0 2px 8px rgba(124, 92, 255, 0.3);
}

.team-btn.dog-team.active {
  background: var(--dog-color) !important;
  border-color: var(--dog-color);
  color: white !important;
  box-shadow: 0 2px 8px rgba(255, 122, 89, 0.3);
}

/* Difficulty-specific colors */
.difficulty-btn.easy.active {
  background: #22c55e !important;
  border-color: #22c55e;
  color: white !important;
  box-shadow: 0 2px 8px rgba(34, 197, 94, 0.3);
}

.difficulty-btn.moderate.active {
  background: #eab308 !important;
  border-color: #eab308;
  color: white !important;
  box-shadow: 0 2px 8px rgba(234, 179, 8, 0.3);
}

.difficulty-btn.hard.active {
  background: #f97316 !important;
  border-color: #f97316;
  color: white !important;
  box-shadow: 0 2px 8px rgba(249, 115, 22, 0.3);
}

.difficulty-btn.impossible.active {
  background: #ef4444 !important;
  border-color: #ef4444;
  color: white !important;
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
}

/* Difficulty description for mobile */
.difficulty-description {
  margin-top: 12px;
  padding: 8px 12px;
  background: #f8f9fa;
  border-radius: 8px;
  border-left: 3px solid var(--primary-color);
}

.difficulty-description p {
  font-size: 0.85rem;
  color: #555;
  margin: 0;
  line-height: 1.4;
  text-align: left;
}

/* Start Game Section */
.start-game-section {
  margin-top: 25px;
  margin-bottom: 20px;
  text-align: center;
  border-top: 1px solid #eee;
  padding-top: 18px;
}

.start-game-btn {
  font-size: 1.1rem !important;
  font-weight: 700 !important;
  padding: 12px 24px !important;
  background: linear-gradient(135deg, #4CAF50, #45a049) !important;
  border: none !important;
  color: white !important;
  border-radius: 25px !important;
  box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3) !important;
  transition: all 0.3s ease !important;
  cursor: pointer !important;
  min-width: 140px !important;
}

.start-game-btn:hover {
  background: linear-gradient(135deg, #45a049, #4CAF50) !important;
  transform: translateY(-2px) !important;
  box-shadow: 0 6px 16px rgba(76, 175, 80, 0.4) !important;
}

.start-game-btn:active {
  transform: translateY(0) !important;
  box-shadow: 0 2px 8px rgba(76, 175, 80, 0.3) !important;
}

/* Responsive adjustments for new components */
@media (max-width: 768px) {
  body {
    padding: 10px;
    min-height: 100vh;
    align-items: flex-start;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  }
  
  .game-container {
    padding: 15px;
    margin: 0 auto;
    max-height: 100vh;
    overflow-y: auto;
  }
  
  .game-title {
    margin-bottom: 15px;
  }
  
  .title-line-1 {
    font-size: 2rem;
  }
  
  .title-line-2 {
    font-size: 1.1rem;
  }
  
  .game-info {
    margin-bottom: 15px;
    font-size: 1rem;
  }
  
  .current-player {
    font-size: 1.1rem !important;
  }
  
  .score-board {
    font-size: 1rem !important;
  }
  
  .game-setup {
    margin-bottom: 15px;
  }
  
  .setup-content {
    padding: 0;
  }
  
  .game-mode-selector, .team-selector, .difficulty-selector {
    margin-bottom: 12px;
  }
  
  .game-mode-selector h3, .team-selector h3, .difficulty-selector h3 {
    font-size: 1rem;
    margin-bottom: 8px;
  }
  
  .mode-buttons, .team-buttons, .difficulty-buttons {
    flex-direction: column;
    align-items: center;
    gap: 6px;
  }
  
  .mode-btn, .team-btn, .difficulty-btn {
    width: 100%;
    max-width: 200px;
    margin-bottom: 0;
    padding: 10px 14px;
    font-size: 0.95rem;
  }
  
  .difficulty-buttons {
    display: flex;
    flex-direction: column;
    gap: 6px;
  }
  
  .difficulty-btn {
    font-size: 0.9rem;
    padding: 8px 14px;
    min-width: auto;
    width: 100%;
    max-width: 180px;
    margin: 0 auto;
  }
  
  .difficulty-description {
    margin-top: 8px;
    padding: 8px 12px;
  }
  
  .difficulty-description p {
    font-size: 0.85rem;
  }
  
  .start-game-section {
    margin-top: 15px;
    margin-bottom: 15px;
    padding-top: 12px;
  }
  
  .image-selector {
    margin-bottom: 10px;
  }
  
  .image-selector h3 {
    font-size: 0.95rem;
    margin-bottom: 8px;
  }
  
  .image-selector-grid {
    gap: 10px;
  }
  
  .selector-section h4 {
    font-size: 0.8rem;
    margin-bottom: 4px;
  }
  
  .image-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
  }
  
  .image-option {
    width: 40px;
    height: 40px;
  }
  
  .image-option img {
    width: 36px;
    height: 36px;
  }
  
  .game-board {
    max-width: 240px;
    margin: 15px auto;
    gap: 8px;
  }
  
  .cell {
    width: 70px;
    height: 70px;
  }
  
  .piece-image {
    width: 50px;
    height: 50px;
  }
  
  .game-controls {
    margin-top: 15px;
    gap: 8px;
  }
  
  .btn {
    font-size: 0.85rem;
    padding: 10px 14px;
  }
  
  .language-selector {
    margin-top: 15px;
    font-size: 0.9rem;
  }
  
  .language-selector select {
    font-size: 0.9rem;
    padding: 6px 10px;
  }
  
  .winner-announcement {
    font-size: 1.1rem !important;
  }
}

/* Waiting for computer state */
.waiting-for-computer {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
}

.btn-small {
  font-size: 0.8rem !important;
  padding: 4px 8px !important;
  min-width: auto !important;
  margin: 0 !important;
  background: var(--primary-color) !important;
  color: white !important;
  border: 1px solid var(--primary-color) !important;
}

.btn-small:hover {
  background: #6c51d6 !important;
  border-color: #6c51d6 !important;
  transform: translateY(-1px) !important;
}