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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
    Ubuntu, Cantarell, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #333;
  min-height: 100vh;
  padding: 20px;
}

.container {
  max-width: 1400px;
  margin: 0 auto;
}

header {
  text-align: center;
  color: white;
  margin-bottom: 30px;
}

h1 {
  font-size: 2.5rem;
  margin-bottom: 10px;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.tagline {
  font-size: 1.1rem;
  opacity: 0.95;
  max-width: 800px;
  margin: 0 auto 20px;
  line-height: 1.6;
}

.info-box {
  background: rgba(255, 255, 255, 0.95);
  border-radius: 15px;
  padding: 25px;
  margin-bottom: 20px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.info-box h3 {
  color: #667eea;
  margin-bottom: 15px;
  font-size: 1.3rem;
}

.info-box p {
  line-height: 1.6;
  margin-bottom: 10px;
  color: #444;
}

.info-box ul {
  margin-left: 20px;
  line-height: 1.8;
  color: #444;
}

.info-box strong {
  color: #667eea;
}

.controls {
  background: white;
  border-radius: 15px;
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  margin-top: 15px;
}

.category-btn {
  padding: 12px 16px;
  border: 2px solid #e0e0e0;
  background: white;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.category-btn.active {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border-color: #667eea;
}

.category-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.count-badge {
  background: rgba(0, 0, 0, 0.1);
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.85rem;
}

.active .count-badge {
  background: rgba(255, 255, 255, 0.3);
}

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

.card {
  background: white;
  border-radius: 15px;
  padding: 25px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.card h2 {
  margin-bottom: 15px;
  color: #667eea;
  font-size: 1.5rem;
}

.card p {
  color: #666;
  line-height: 1.6;
  margin-bottom: 15px;
}

.strategic-zone {
  background: linear-gradient(135deg, #ff6b6b 0%, #ee5a6f 100%);
  color: white;
}

.strategic-zone h2,
.strategic-zone p {
  color: white;
}

.defensive-zone {
  background: linear-gradient(135deg, #51cf66 0%, #37b24d 100%);
  color: white;
}

.defensive-zone h2,
.defensive-zone p {
  color: white;
}

.letter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(50px, 1fr));
  gap: 8px;
  margin-top: 15px;
}

.letter-box {
  height: 70px; /* Fixed height for alignment */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #f8f9fa;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  padding: 5px;
}

.letter-box:hover {
  transform: scale(1.1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.letter-box.strategic {
  background: linear-gradient(135deg, #ff6b6b 0%, #ee5a6f 100%);
  color: white;
}

.letter-box.defensive {
  background: linear-gradient(135deg, #51cf66 0%, #37b24d 100%);
  color: white;
}

.letter-box.neutral {
  background: linear-gradient(135deg, #ffd93d 0%, #ffc107 100%);
  color: #333;
}

.letter-char {
  font-size: 1.5rem;
  font-weight: bold;
  line-height: 1;
}

.letter-count {
  font-size: 0.75rem;
  opacity: 0.9;
  margin-top: 4px;
  line-height: 1.2;
}

.simulator {
  background: white;
  border-radius: 15px;
  padding: 25px;
  margin-bottom: 20px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.chain-display {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 20px 0;
  min-height: 60px;
  align-items: center;
}

.chain-word {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 10px 20px;
  border-radius: 25px;
  font-size: 1.1rem;
  animation: slideIn 0.3s ease-out;
  position: relative;
}

.chain-word.used {
  opacity: 0.5;
  text-decoration: line-through;
}

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

.search-box {
  width: 100%;
  padding: 15px;
  border: 2px solid #e0e0e0;
  border-radius: 10px;
  font-size: 1rem;
  margin-bottom: 15px;
}

.search-box:focus {
  outline: none;
  border-color: #667eea;
}

.word-results {
  max-height: 300px;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 8px;
}

.word-tag {
  background: #f8f9fa;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 0.9rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
}

.word-tag.used {
  opacity: 0.3;
  cursor: not-allowed;
  text-decoration: line-through;
}

.word-tag:not(.used):hover {
  background: #667eea;
  color: white;
  transform: translateY(-2px);
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 15px;
  margin-top: 15px;
}

.stat-box {
  background: #f8f9fa;
  padding: 15px;
  border-radius: 10px;
  text-align: center;
}

.stat-value {
  font-size: 2rem;
  font-weight: bold;
  color: #667eea;
}

.stat-label {
  font-size: 0.85rem;
  color: #666;
  margin-top: 5px;
}

.legend {
  display: flex;
  gap: 20px;
  justify-content: center;
  flex-wrap: wrap;
  margin: 15px 0;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.legend-box {
  width: 30px;
  height: 30px;
  border-radius: 6px;
}

.matrix-container {
  overflow-x: auto;
  margin-top: 15px;
}

.matrix-table {
  border-collapse: collapse;
  font-size: 0.85rem;
  margin: 0 auto;
}

.matrix-table th,
.matrix-table td {
  border: 1px solid #e0e0e0;
  padding: 8px;
  text-align: center;
  min-width: 35px;
}

.matrix-table th {
  background: #667eea;
  color: white;
  font-weight: 600;
}

.matrix-table td {
  cursor: pointer;
  transition: all 0.2s;
}

.matrix-table td:hover {
  background: #f0f0f0;
  transform: scale(1.05);
}

.matrix-table td.high {
  background: linear-gradient(135deg, #51cf66 0%, #37b24d 100%);
  color: white;
  font-weight: bold;
}

.matrix-table td.medium {
  background: linear-gradient(135deg, #ffd93d 0%, #ffc107 100%);
  font-weight: bold;
}

.matrix-table td.low {
  background: linear-gradient(135deg, #ff6b6b 0%, #ee5a6f 100%);
  color: white;
}

footer {
  text-align: center;
  color: white;
  margin-top: 40px;
  padding: 20px;
  opacity: 0.9;
}

footer a {
  color: white;
  text-decoration: underline;
}

@media (max-width: 768px) {
  h1 {
    font-size: 2rem;
  }

  .letter-grid {
    grid-template-columns: repeat(auto-fill, minmax(45px, 1fr));
  }

  .category-grid {
    grid-template-columns: 1fr;
  }

  .matrix-table {
    font-size: 0.7rem;
  }

  .matrix-table th,
  .matrix-table td {
    padding: 5px;
    min-width: 28px;
  }
}
