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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #1a1a1a;
  color: #f5f5f5;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.container {
  width: 100%;
  max-width: 1200px;
  padding: 40px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}

.search-wrapper {
  text-align: center;
  transition: all 0.3s ease;
}

.container.has-results .search-wrapper {
  margin-bottom: 40px;
}

.title {
  font-size: 36px;
  font-weight: 900;
  color: #ff5722;
  margin-bottom: 24px;
  letter-spacing: -1px;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.search-box {
  display: flex;
  gap: 8px;
  justify-content: center;
}

.search-box input {
  width: 400px;
  padding: 14px 18px;
  background: #2a2a2a;
  border: 2px solid #ff5722;
  color: #f5f5f5;
  font-size: 14px;
  outline: none;
  border-radius: 4px;
}

.search-box input:focus {
  border-color: #ff7043;
  box-shadow: 0 0 0 3px rgba(255, 87, 34, 0.2);
}

.search-box button {
  padding: 14px 28px;
  background: #ff5722;
  border: 2px solid #ff5722;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.search-box button:hover {
  background: #ff7043;
  border-color: #ff7043;
}

.search-box button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.input-hint {
  margin-top: 4px;
  font-size: 12px;
  color: #888;
  min-height: 16px;
}

.input-hint.error {
  color: #ff5722;
}

.loading, .error-box {
  text-align: center;
  padding: 20px;
}

.error-box {
  color: #ff5722;
}

.grid-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  animation: fadeIn 0.3s ease;
  width: 100%;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.stats-bar {
  margin-bottom: 20px;
  font-size: 14px;
  color: #888;
  font-weight: 600;
}

.stats-bar span {
  color: #ff5722;
}

/* Desktop: 5 columns */
.race-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  width: 100%;
  max-width: 500px;
  justify-content: center;
}

.race-card {
  width: 80px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #2a2a2a;
  border: 2px solid #444;
  border-radius: 8px;
  font-size: 10px;
  font-weight: 700;
  color: #888;
  text-align: center;
  padding: 6px;
  line-height: 1.2;
  word-break: break-word;
  hyphens: auto;
  position: relative;
  overflow: hidden;
  transition: all 0.3s ease;
}

/* Ensure children have proper z-indexing */
.race-card > * {
  position: relative;
}

.race-card.unowned {
  background: #2a2a2a;
  color: #666;
  border-color: #333;
}

.race-card.unowned::before {
  opacity: 0.12;
}

.race-card.owned {
  color: #fff;
  border-width: 2px;
}

/* Soft glow effects for owned cards */
.race-card.owned.color-0 { 
  background: rgba(255, 87, 34, 0.15); 
  border-color: #ff5722;
  box-shadow: 0 8px 32px rgba(255, 87, 34, 0.4);
}

.race-card.owned.color-1 { 
  background: rgba(255, 152, 0, 0.15); 
  border-color: #ff9800;
  box-shadow: 0 8px 32px rgba(255, 152, 0, 0.4);
}

.race-card.owned.color-2 { 
  background: rgba(255, 193, 7, 0.15); 
  border-color: #ffc107;
  box-shadow: 0 8px 32px rgba(255, 193, 7, 0.4);
  color: #ffc107;
}

.race-card.owned.color-3 { 
  background: rgba(255, 112, 67, 0.15); 
  border-color: #ff7043;
  box-shadow: 0 8px 32px rgba(255, 112, 67, 0.4);
}

.race-card.owned.color-4 { 
  background: rgba(244, 67, 54, 0.15); 
  border-color: #f44336;
  box-shadow: 0 8px 32px rgba(244, 67, 54, 0.4);
}

.race-card.owned.color-5 { 
  background: rgba(233, 30, 99, 0.15); 
  border-color: #e91e63;
  box-shadow: 0 8px 32px rgba(233, 30, 99, 0.4);
}

.race-card.owned.color-6 { 
  background: rgba(156, 39, 176, 0.15); 
  border-color: #9c27b0;
  box-shadow: 0 8px 32px rgba(156, 39, 176, 0.4);
}

.race-card.owned.color-7 { 
  background: rgba(63, 81, 181, 0.15); 
  border-color: #3f51b5;
  box-shadow: 0 8px 32px rgba(63, 81, 181, 0.4);
}

/* Lift effect on owned cards */
.race-card.owned:hover {
  transform: translateY(-4px);
}

/* Tablet: 4 columns */
@media (max-width: 768px) {
  .race-grid {
    grid-template-columns: repeat(4, 1fr);
    max-width: 400px;
  }
}

/* Mobile: 3 columns */
@media (max-width: 480px) {
  .title {
    font-size: 28px;
  }
  
  .search-box {
    flex-direction: column;
    align-items: center;
  }
  
  .search-box input {
    width: 280px;
  }
  
  .search-box button {
    width: 280px;
  }
  
  .race-grid {
    grid-template-columns: repeat(3, 1fr);
    max-width: 300px;
    gap: 10px;
  }
  
  .race-card {
    width: 80px;
    height: 80px;
    font-size: 9px;
  }
}

/* Small mobile: still 3 columns, smaller gaps */
@media (max-width: 360px) {
  .race-grid {
    gap: 8px;
    max-width: 280px;
  }
  
  .race-card {
    width: 80px;
    height: 80px;
  }
}
