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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
  background-color: #f5f5f5;
  color: #333;
  line-height: 1.6;
}

/* Header */
.header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 2rem 1rem;
  text-align: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.header h1 {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
}

.header .subtitle {
  font-size: 1.1rem;
  opacity: 0.9;
}

/* Main content */
.main-content {
  max-width: 1200px;
  margin: 2rem auto;
  padding: 0 1rem;
}

/* Filters Section */
.filters {
  background: white;
  padding: 2rem;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  margin-bottom: 2rem;
}

.filters h2 {
  font-size: 1.5rem;
  margin-bottom: 1.5rem;
  color: #333;
}

.filter-group {
  margin-bottom: 1.5rem;
}

.filter-group h3 {
  font-size: 1rem;
  margin-bottom: 0.75rem;
  color: #555;
}

.filter-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.btn {
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.95rem;
  transition: all 0.3s ease;
}

.btn-filter {
  background-color: #e9ecef;
  color: #333;
  border: 1px solid #dee2e6;
}

.btn-filter:hover {
  background-color: #dee2e6;
  border-color: #adb5bd;
}

.btn-filter.active {
  background-color: #667eea;
  color: white;
  border-color: #667eea;
}

.btn-secondary {
  background-color: #6c757d;
  color: white;
}

.btn-secondary:hover {
  background-color: #5a6268;
}

.filter-actions {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid #dee2e6;
}

/* Characters Display */
.characters-display {
  background: white;
  padding: 2rem;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  margin-bottom: 2rem;
}

.characters-display h2 {
  font-size: 1.5rem;
  margin-bottom: 1.5rem;
  color: #333;
}

.characters-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 1rem;
}

.character-card {
  background: #f9f9f9;
  border: 2px solid #e9ecef;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
}

.character-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  border-color: #667eea;
}

.character-card img {
  width: 100%;
  height: 100px;
  object-fit: cover;
  display: block;
}

.character-card .rarity-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  background-color: rgba(0, 0, 0, 0.7);
  color: white;
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  border-radius: 3px;
}

/* Character Detail Section */
.character-detail {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.detail-content {
  background: white;
  padding: 2rem;
  border-radius: 8px;
  max-width: 600px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.detail-content h2 {
  font-size: 1.5rem;
  margin-bottom: 1rem;
  color: #333;
}

.detail-content .detail-section {
  margin-bottom: 1.5rem;
}

.detail-content .detail-section h3 {
  font-size: 1.1rem;
  color: #667eea;
  margin-bottom: 0.5rem;
}

.detail-content .detail-row {
  display: flex;
  justify-content: space-between;
  padding: 0.5rem 0;
  border-bottom: 1px solid #f0f0f0;
}

.detail-content .detail-row label {
  font-weight: bold;
  color: #555;
  flex: 0 0 120px;
}

.detail-content .detail-row span {
  color: #333;
}

.detail-content .skill-item {
  background: #f9f9f9;
  padding: 1rem;
  border-left: 3px solid #667eea;
  margin-bottom: 0.75rem;
  border-radius: 4px;
}

.detail-content .skill-item h4 {
  color: #333;
  margin-bottom: 0.25rem;
}

.detail-content .skill-item p {
  color: #666;
  font-size: 0.95rem;
}

.detail-content .tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.detail-content .tag {
  background-color: #e9ecef;
  color: #333;
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: 0.85rem;
}

.close-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  background: none;
  border: none;
  font-size: 2rem;
  cursor: pointer;
  color: #333;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.close-btn:hover {
  color: #667eea;
}

/* Footer */
.footer {
  background-color: #333;
  color: white;
  padding: 2rem;
  text-align: center;
  margin-top: 2rem;
}

.footer p {
  margin: 0.5rem 0;
}

.footer a {
  color: #667eea;
  text-decoration: none;
}

.footer a:hover {
  text-decoration: underline;
}

/* Responsive Design */
@media (max-width: 768px) {
  .header h1 {
    font-size: 2rem;
  }

  .main-content {
    margin: 1rem auto;
  }

  .filters,
  .characters-display {
    padding: 1.5rem;
  }

  .filter-group h3 {
    font-size: 0.95rem;
  }

  .btn {
    font-size: 0.85rem;
    padding: 0.4rem 0.8rem;
  }

  .characters-grid {
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 0.75rem;
  }

  .character-card img {
    height: 80px;
  }

  .detail-content {
    padding: 1.5rem;
  }

  .close-btn {
    top: 5px;
    right: 5px;
    font-size: 1.5rem;
    width: 30px;
    height: 30px;
  }
}

@media (max-width: 480px) {
  .header h1 {
    font-size: 1.5rem;
  }

  .header {
    padding: 1rem;
  }

  .main-content {
    padding: 0 0.5rem;
  }

  .filters,
  .characters-display {
    padding: 1rem;
  }

  .filter-buttons {
    gap: 0.25rem;
  }

  .btn {
    font-size: 0.8rem;
    padding: 0.35rem 0.6rem;
  }

  .characters-grid {
    grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
    gap: 0.5rem;
  }

  .character-card img {
    height: 70px;
  }

  .detail-content {
    width: 95%;
    max-height: 90vh;
    padding: 1rem;
  }

  .detail-row {
    flex-direction: column;
  }

  .detail-row label {
    flex: none;
    margin-bottom: 0.25rem;
  }

  .filter-group h3 {
    font-size: 0.9rem;
  }
}
