/* Animals Game Styles */

html, body {
  height: 100%;
  width: 100%;
  margin: 0;
  padding: 0;
  overflow-x: hidden;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  touch-action: manipulation;
}

.game {
  max-width: 800px;
  margin: 0 auto;
  padding: 20px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.game-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 2px solid #eee;
}

.game-header h2 {
  margin: 0;
  color: #333;
  font-size: 2rem;
}

.player-info {
  display: flex;
  align-items: center;
  gap: 15px;
  font-size: 0.9rem;
}

.admin-badge {
  background: #ffd700;
  color: #333;
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: bold;
}

.new-game-link {
  background: #2196f3;
  color: white;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: bold;
  text-decoration: none;
  transition: background 0.2s ease;
}

.new-game-link:hover {
  background: #1976d2;
  text-decoration: none;
  color: white;
}

.error-message {
  background: #ffebee;
  border: 1px solid #f44336;
  color: #c62828;
  padding: 10px;
  border-radius: 4px;
  margin-bottom: 20px;
}

.game-status {
  text-align: center;
  margin-bottom: 30px;
}

.game-status h3 {
  margin: 0 0 10px 0;
  font-size: 1.5rem;
}

.game-info {
  display: flex;
  justify-content: center;
  gap: 30px;
  margin-top: 10px;
  font-size: 0.9rem;
  color: #666;
}

.players-section {
  margin-bottom: 30px;
}

.players-section h4 {
  margin-bottom: 15px;
  color: #333;
}

.players-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 10px;
}

.player {
  background: #f8f9fa;
  border: 2px solid #e9ecef;
  border-radius: 8px;
  padding: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: all 0.2s ease;
}

.player.current-player {
  background: #e3f2fd;
  border-color: #2196f3;
}

.player.disconnected {
  opacity: 0.6;
  background: #f5f5f5;
}

.player-name {
  font-weight: 500;
  color: #333;
}

.player-score {
  font-size: 0.8rem;
  color: #666;
}

.disconnected-indicator {
  font-size: 0.8rem;
}

.waiting-section {
  text-align: center;
  padding: 30px;
  background: #f8f9fa;
  border-radius: 8px;
  margin-bottom: 20px;
}

.room-url-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 15px 0;
  background: #e9ecef;
  padding: 8px 12px;
  border-radius: 6px;
  max-width: 100%;
  overflow: hidden;
}

.room-url-container code {
  font-family: 'Monaco', 'Menlo', monospace;
  font-size: 0.9rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

.copy-button {
  background: #2196f3;
  color: white;
  border: none;
  min-width: 60px;
  height: 30px;
  border-radius: 4px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 500;
  transition: all 0.2s ease;
  flex-shrink: 0;
  padding: 0 8px;
  line-height: 1;
}

.copy-button:hover {
  background: #1976d2;
}

.copy-button:active {
  transform: scale(0.95);
}

.start-game-btn {
  background: #4caf50;
  color: white;
  border: none;
  padding: 0 24px;
  border-radius: 6px;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s ease;
  height: 40px;
  line-height: 1.2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.start-game-btn:hover {
  background: #45a049;
}

.playing-section {
  margin-bottom: 30px;
}

/* Admin Controls */
.admin-controls {
  background: #fff3cd;
  border: 1px solid #ffeaa7;
  border-radius: 8px;
  padding: 15px;
  margin-bottom: 20px;
}

.admin-controls h4 {
  margin: 0 0 10px 0;
  color: #856404;
}

.player-selector {
  display: flex;
  align-items: center;
  gap: 10px;
}

.player-selector label {
  font-weight: 500;
  color: #856404;
}

.player-selector select {
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  background: white;
  font-size: 0.9rem;
}

/* Counters Section */
.counters-section {
  margin-bottom: 20px;
}

.counters-section h4 {
  margin-bottom: 15px;
  color: #333;
  text-align: center;
}

.counters-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 15px;
  margin-bottom: 20px;
}

.counter-card {
  background: #f8f9fa;
  border: 2px solid #e9ecef;
  border-radius: 12px;
  padding: 20px;
  text-align: center;
  transition: all 0.2s ease;
  position: relative;
}

.counter-card:hover {
  border-color: #2196f3;
  box-shadow: 0 2px 8px rgba(33, 150, 243, 0.1);
}

.counter-card.final {
  background: #e8f5e8;
  border-color: #4caf50;
}

.animal-name {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 10px;
  font-size: 1.2rem;
  font-weight: 600;
  color: #333;
}

.animal-text {
  text-transform: capitalize;
}

.counter-value {
  font-size: 1.5rem;
  font-weight: bold;
  color: #2196f3;
  margin-bottom: 8px;
}

.counter-owner {
  font-size: 0.9rem;
  color: #666;
  margin-bottom: 15px;
  font-style: italic;
}

.increment-btn {
  background: #4caf50;
  color: white;
  border: none;
  padding: 8px 20px;
  border-radius: 6px;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s ease;
  width: 100%;
  line-height: 1.2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 40px;
}

.increment-btn:hover {
  background: #45a049;
}

.increment-btn:active {
  transform: scale(0.95);
}

/* Admin Actions */
.admin-actions {
  text-align: center;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid #eee;
}

.end-game-btn {
  background: #f44336;
  color: white;
  border: none;
  padding: 0 24px;
  border-radius: 6px;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s ease;
  height: 40px;
  line-height: 1.2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.end-game-btn:hover {
  background: #d32f2f;
}

.guesses-section {
  margin-bottom: 20px;
}

.guesses-section h4 {
  margin-bottom: 15px;
  color: #333;
}

.guesses-list {
  background: #f8f9fa;
  border-radius: 8px;
  padding: 15px;
  max-height: 200px;
  overflow-y: auto;
}

.guess {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid #e9ecef;
}

.guess:last-child {
  border-bottom: none;
}

.guess.correct {
  background: #e8f5e8;
  margin: 0 -15px;
  padding: 8px 15px;
  border-radius: 4px;
}

.guess.incorrect {
  color: #666;
}

.guess-player {
  font-weight: 500;
  min-width: 80px;
}

.guess-text {
  flex: 1;
  font-style: italic;
}

.correct-indicator {
  color: #4caf50;
  font-size: 1.2rem;
}

.guess-form {
  display: flex;
  gap: 10px;
  align-items: center;
}

.guess-input {
  flex: 1;
  padding: 12px;
  border: 2px solid #e9ecef;
  border-radius: 6px;
  font-size: 1rem;
  transition: border-color 0.2s ease;
}

.guess-input:focus {
  outline: none;
  border-color: #2196f3;
}

.guess-btn {
  background: #2196f3;
  color: white;
  border: none;
  padding: 12px 20px;
  border-radius: 6px;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s ease;
}

.guess-btn:hover {
  background: #1976d2;
}

.finished-section {
  text-align: center;
  padding: 30px;
  background: #f8f9fa;
  border-radius: 8px;
  margin-bottom: 20px;
}

.game-results h3 {
  color: #4caf50;
  margin-bottom: 15px;
}

.new-game-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #2196f3;
  color: white;
  text-decoration: none;
  padding: 0 24px;
  border-radius: 6px;
  font-size: 1rem;
  font-weight: 500;
  margin-top: 15px;
  transition: background 0.2s ease;
  height: 40px;
  line-height: 1.2;
}

.new-game-btn:hover {
  background: #1976d2;
  text-decoration: none;
  color: white;
}

.final-counters {
  margin-top: 30px;
}

.final-counters h4 {
  text-align: center;
  margin-bottom: 15px;
  color: #333;
}

.game-actions {
  text-align: center;
  padding-top: 20px;
  border-top: 1px solid #eee;
}

.leave-game-btn {
  background: #f44336;
  color: white;
  border: none;
  padding: 0 20px;
  border-radius: 6px;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.2s ease;
  height: 36px;
  line-height: 1.2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.leave-game-btn:hover {
  background: #d32f2f;
}

.loading {
  text-align: center;
  padding: 50px;
  color: #666;
}

/* Name Input Section */
.name-input-section {
  max-width: 500px;
  margin: 0 auto;
  padding: 50px 20px;
  text-align: center;
}

.name-input-section h2 {
  margin-bottom: 30px;
  color: #333;
  font-size: 2.5rem;
}

.name-form {
  background: #f8f9fa;
  border-radius: 12px;
  padding: 40px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.name-form h3 {
  margin: 0 0 25px 0;
  color: #333;
  font-size: 1.3rem;
}

.name-form-content {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.name-input {
  width: 100%;
  padding: 15px 20px;
  border: 2px solid #e9ecef;
  border-radius: 8px;
  font-size: 1.1rem;
  margin-bottom: 20px;
  transition: border-color 0.2s ease;
  text-align: center;
}

.name-input:focus {
  outline: none;
  border-color: #2196f3;
  box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.1);
}

.join-game-btn {
  background: #4caf50;
  color: white;
  border: none;
  padding: 0 30px;
  border-radius: 8px;
  font-size: 1.1rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  width: 100%;
  height: 50px;
  line-height: 1.2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.join-game-btn:hover:not(:disabled) {
  background: #45a049;
  transform: translateY(-1px);
}

.join-game-btn:disabled {
  background: #ccc;
  cursor: not-allowed;
  transform: none;
}

.room-info {
  margin-top: 20px;
  color: #666;
  font-size: 0.9rem;
}

/* Help Button and Modal */
.game-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.game-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.help-button {
  background-color: #2196f3;
  color: white;
  border: none;
  border-radius: 50%;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-weight: bold;
  font-size: 18px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
  transition: all 0.2s ease;
}

.help-button:hover {
  background-color: #1976d2;
  transform: scale(1.05);
}

.sound-button {
  background-color: #4caf50;
  color: white;
  border: none;
  border-radius: 50%;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-weight: bold;
  font-size: 16px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
  transition: all 0.2s ease;
}

.sound-button:hover {
  background-color: #45a049;
  transform: scale(1.05);
}

.sound-button.muted {
  background-color: #f44336;
}

.sound-button.muted:hover {
  background-color: #d32f2f;
}

.help-modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  overflow: auto;
}

.help-modal-content {
  background-color: white;
  margin: 15% auto;
  padding: 20px;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
  width: 80%;
  max-width: 600px;
  position: relative;
  animation: modalFadeIn 0.3s;
}

@keyframes modalFadeIn {
  from {opacity: 0; transform: translateY(-20px);}
  to {opacity: 1; transform: translateY(0);}
}

.close-modal {
  position: absolute;
  right: 15px;
  top: 10px;
  font-size: 28px;
  font-weight: bold;
  color: #aaa;
  cursor: pointer;
  transition: color 0.2s;
}

.close-modal:hover {
  color: #333;
}

.help-modal.show {
  display: block;
}

/* Mobile-specific styles */
.mobile-container {
  width: 100%;
  max-width: 100%;
  padding: 10px;
  margin: 0;
  height: 100%;
}

/* Improve touch targets for mobile */
button, 
.copy-button, 
.start-game-btn, 
.end-game-btn, 
.increment-btn, 
.guess-btn, 
.join-game-btn, 
.new-game-btn,
.leave-game-btn {
  min-height: 44px; /* Apple's recommended minimum touch target size */
  min-width: 44px;
}

.mobile-row {
  display: flex;
  flex-direction: column;
  height: auto;
  width: 100%;
}

.intro-section {
  width: 100%;
  padding: 10px 5px;
  margin-top: 10px;
}

.game-section {
  width: 100%;
  padding: 10px 5px;
}

/* Responsive design */
@media (max-width: 768px) {
  body {
    font-size: 16px;
  }

  .game {
    max-width: 100%;
    padding: 10px;
  }

  .game-header {
    flex-direction: column;
    gap: 10px;
    text-align: center;
    padding-bottom: 10px;
    margin-bottom: 15px;
  }
  
  .players-list {
    grid-template-columns: 1fr;
  }
  
  .counters-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  
  .player-selector {
    flex-direction: column;
    align-items: flex-start;
    gap: 5px;
  }
  
  .player-selector select {
    width: 100%;
  }
  
  .name-input-section {
    padding: 20px 10px;
  }
  
  .name-form {
    padding: 20px 15px;
  }
  
  .name-input-section h2 {
    font-size: 1.8rem;
    margin-bottom: 20px;
  }

  .name-input {
    padding: 12px 15px;
    font-size: 1rem;
  }

  .join-game-btn {
    height: 45px;
    font-size: 1rem;
  }
  
  .room-url-container {
    flex-direction: column;
    padding: 10px;
  }
  
  .room-url-container code {
    margin-bottom: 8px;
    text-align: center;
    font-size: 0.8rem;
  }

  .counter-card {
    padding: 15px;
  }

  .animal-name {
    font-size: 1.1rem;
  }

  .counter-value {
    font-size: 1.3rem;
  }

  .increment-btn {
    height: 36px;
    font-size: 0.9rem;
  }

  .guess-input {
    padding: 10px;
    font-size: 0.9rem;
  }

  .guess-btn {
    padding: 10px 15px;
    font-size: 0.9rem;
  }

  .guess-form {
    flex-direction: column;
    gap: 10px;
  }

  .game-status h3 {
    font-size: 1.3rem;
  }

  .game-info {
    flex-direction: column;
    gap: 5px;
    align-items: center;
  }

  .start-game-btn, .end-game-btn, .new-game-btn {
    width: 100%;
    margin-top: 10px;
  }
}

/* Small phone screens */
@media (max-width: 480px) {
  body {
    font-size: 14px;
  }

  .game {
    padding: 8px;
  }

  .game-header h2 {
    font-size: 1.5rem;
  }

  .counter-card {
    padding: 12px;
  }

  .animal-name {
    font-size: 1rem;
  }

  .name-input-section h2 {
    font-size: 1.5rem;
  }

  .name-form h3 {
    font-size: 1.1rem;
  }

  .admin-controls {
    padding: 10px;
  }

  .admin-controls h4 {
    font-size: 1rem;
  }
  
  /* Mobile help modal adjustments */
  .help-modal-content {
    margin: 10% auto;
    width: 90%;
    padding: 15px;
  }
  
  .help-button {
    width: 36px;
    height: 36px;
  }
}
