/* Backgammon Index Page Styles */

:root {
  --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --secondary-gradient: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  --dark-bg: #0f0f23;
  --card-bg: rgba(255, 255, 255, 0.05);
  --text-primary: #ffffff;
  --text-secondary: rgba(255, 255, 255, 0.7);
  --border-color: rgba(255, 255, 255, 0.1);
}

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

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: var(--dark-bg);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.bg-container {
  width: 100%;
  max-width: 800px;
  padding: 20px;
}

/* Header */
.bg-header {
  text-align: center;
  margin-bottom: 40px;
  position: relative;
}

.back-button {
  position: absolute;
  top: 0;
  left: 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
  text-decoration: none;
  border-radius: 25px;
  font-weight: 600;
  font-size: 14px;
  transition: all 0.3s ease;
  border: 1px solid var(--border-color);
}

.back-button:hover {
  background: rgba(255, 255, 255, 0.15);
  transform: translateX(-5px);
}

.game-icon {
  width: 80px;
  height: 80px;
  margin: 0 auto 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--primary-gradient);
  border-radius: 20px;
  font-size: 2.5rem;
  color: white;
}

.game-icon svg {
  width: 50px;
  height: 50px;
  color: white;
}

.bg-header h1 {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 10px;
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.2;
}

.subtitle {
  font-size: 1.1rem;
  color: var(--text-secondary);
  font-weight: 300;
}

/* Main Content */
.bg-main {
  background: var(--card-bg);
  border-radius: 20px;
  border: 1px solid var(--border-color);
  padding: 40px;
  backdrop-filter: blur(10px);
}

.primary-button {
  width: 100%;
  padding: 14px 28px;
  font-size: 1.1rem;
  font-weight: 600;
  background: var(--primary-gradient);
  color: white;
  border: none;
  border-radius: 50px;
  cursor: pointer;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow: 0 10px 30px rgba(102, 126, 234, 0.3);
}

.primary-button:hover {
  transform: translateY(-3px);
  box-shadow: 0 15px 40px rgba(102, 126, 234, 0.5);
}

/* Game Rules */
.game-rules {
  margin-top: 30px;
  padding-top: 30px;
  border-top: 1px solid var(--border-color);
}

.game-rules h3 {
  font-size: 1.3rem;
  margin-bottom: 15px;
  color: var(--text-primary);
}

.game-rules ul {
  list-style: none;
  padding: 0;
}

.game-rules li {
  padding: 10px 0;
  padding-left: 30px;
  position: relative;
  color: var(--text-secondary);
  line-height: 1.6;
}

.game-rules li:before {
  content: '✓';
  position: absolute;
  left: 0;
  color: #4facfe;
  font-weight: bold;
  font-size: 1.2rem;
}

/* Utility Classes */
.not-visible {
  display: none !important;
}


/* Mode Selection */
.mode-selection {
  margin-bottom: 30px;
}

.mode-selection h2 {
  text-align: center;
  font-size: 1.8rem;
  margin-bottom: 30px;
  color: var(--text-primary);
}

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

.game-card {
  background: rgba(255, 255, 255, 0.03);
  border-radius: 15px;
  border: 2px solid var(--border-color);
  padding: 30px;
  text-align: center;
  transition: all 0.3s ease;
}

.game-card:hover {
  border-color: rgba(102, 126, 234, 0.5);
  transform: translateY(-5px);
  box-shadow: 0 10px 30px rgba(102, 126, 234, 0.2);
}

.game-card .card-icon {
  font-size: 3rem;
  margin-bottom: 15px;
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.game-card h3 {
  font-size: 1.4rem;
  margin-bottom: 10px;
  color: var(--text-primary);
}

.card-description {
  font-size: 0.95rem;
  color: var(--text-secondary);
  margin-bottom: 20px;
}

/* Difficulty Selector */
.difficulty-selector {
  margin: 15px 0;
  text-align: left;
}

.difficulty-selector label {
  display: block;
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 8px;
  font-weight: 600;
}

.difficulty-select {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 2px solid var(--border-color);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.3s ease;
}

.difficulty-select option {
  background: #1a1a2e;
  color: var(--text-primary);
  padding: 10px;
}

.difficulty-select:hover {
  border-color: rgba(102, 126, 234, 0.5);
}

.difficulty-select:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
}

/* Color Selector */
.color-selector {
  margin: 15px 0;
  text-align: left;
}

.color-selector label {
  display: block;
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 8px;
  font-weight: 600;
}

.color-buttons {
  display: flex;
  gap: 10px;
}

.color-button {
  flex: 1;
  padding: 10px 15px;
  border-radius: 8px;
  border: 2px solid var(--border-color);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-secondary);
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.color-button:hover {
  border-color: rgba(102, 126, 234, 0.5);
  background: rgba(255, 255, 255, 0.08);
}

.color-button.active {
  border-color: #667eea;
  background: rgba(102, 126, 234, 0.2);
  color: var(--text-primary);
  font-weight: 600;
}

.color-button[data-color="white"] i {
  color: #ffffff;
}

.color-button[data-color="black"] i {
  color: #888888;
}

/* Responsive */
@media (max-width: 768px) {
  .bg-container {
    padding: 15px;
  }

  .bg-header h1 {
    font-size: 2rem;
  }

  .bg-main {
    padding: 25px;
  }

  .back-button {
    position: static;
    margin-bottom: 20px;
  }

  .game-icon {
    width: 60px;
    height: 60px;
    font-size: 2rem;
  }

  .primary-button {
    font-size: 1rem;
    padding: 12px 24px;
  }

  /* Modified min width for grid to prevent overflow on mobile */
  .mode-cards {
    grid-template-columns: 1fr;
  }

  .mode-selection h2 {
    font-size: 1.5rem;
  }

  .color-buttons {
    flex-direction: column;
  }
}

@media (max-width: 480px) {
  .bg-container {
    padding: 10px;
  }

  .bg-main {
    padding: 15px;
    border-radius: 12px;
  }

  .bg-header {
    margin-bottom: 20px;
  }

  .bg-header h1 {
    font-size: 1.6rem;
    word-break: break-word;
    /* Ensure valid wrap for very long words if any */
    padding: 0 10px;
  }

  .game-card {
    padding: 15px;
  }

  /* Critical fix for 320px screens */
  .mode-cards {
    grid-template-columns: 1fr;
    min-width: 0;
  }

  /* Fix header absolute positioning on small screens */
  .back-button {
    position: static;
    display: inline-flex;
    margin-bottom: 10px;
    width: auto;
  }

  /* Adjust lang switcher */
  .header-lang-switcher {
    position: static !important;
    display: flex;
    justify-content: center;
    margin-bottom: 10px;
  }

  /* Additional shrinking for very small screens */
  .game-icon {
    width: 50px;
    height: 50px;
    margin-bottom: 10px;
  }

  .difficulty-selector,
  .color-selector {
    margin: 10px 0;
  }
}