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

body {
  background-color: #0a0a0f;
  color: var(--text-primary);
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.3s, text-shadow 0.3s;
}

a:hover {
  color: var(--text-primary);
  text-shadow: 0 0 8px var(--glow);
}

/* Navbar */
.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 2rem;
  background-color: rgba(10, 10, 15, 0.8);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-logo {
  font-size: 1.5rem;
  font-weight: bold;
  letter-spacing: 2px;
  color: var(--text-primary);
  text-transform: uppercase;
}

.nav-links {
  display: flex;
  gap: 1.5rem;
  align-items: center;
}

/* Layout */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem;
  flex: 1;
  width: 100%;
}

/* Cards */
.card {
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.5rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5), 0 0 15px var(--glow);
  transition: transform 0.3s, box-shadow 0.3s;
}

.card:hover {
  background-color: var(--bg-card-hover);
  box-shadow: 0 6px 25px rgba(0, 0, 0, 0.7), 0 0 25px var(--glow);
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 0.6rem 1.2rem;
  background-color: var(--accent);
  color: #0a0a0f;
  border: none;
  border-radius: 4px;
  font-weight: bold;
  cursor: pointer;
  transition: background-color 0.3s, box-shadow 0.3s;
  text-align: center;
}

.btn:hover {
  background-color: var(--text-primary);
  box-shadow: 0 0 15px var(--glow);
  color: #0a0a0f;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-outline {
  background-color: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
}

.btn-outline:hover {
  background-color: var(--glow);
  color: var(--text-primary);
}

/* Bars */
.bar-container {
  width: 100%;
  height: 12px;
  background-color: var(--accent-dark);
  border-radius: 6px;
  overflow: hidden;
  margin-top: 0.5rem;
  margin-bottom: 1rem;
}

.bar-fill {
  height: 100%;
  background-color: var(--accent);
  border-radius: 6px;
  transition: width 0.5s ease-out;
  box-shadow: 0 0 10px var(--accent);
}

/* Avatar */
.avatar-wrapper {
  width: 150px;
  height: 150px;
  border-radius: 50%;
  margin: 0 auto;
  position: relative;
}

.avatar-img {
  width: 150px;
  height: 150px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--accent);
  box-shadow: 0 0 20px var(--glow);
  background-color: var(--bg-card);
}

/* Initials fallback — shown when no photo is set */
.avatar-initials {
  width: 150px;
  height: 150px;
  border-radius: 50%;
  border: 3px solid var(--accent);
  box-shadow: 0 0 20px var(--glow);
  background-color: var(--accent-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3.5rem;
  font-weight: bold;
  color: var(--accent);
  text-transform: uppercase;
  user-select: none;
}

/* Badge */
.badge {
  display: inline-block;
  padding: 0.2rem 0.8rem;
  background-color: var(--accent-dark);
  color: var(--text-primary);
  border: 1px solid var(--accent);
  border-radius: 999px;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* Warning Banner */
.warning-banner {
  background-color: rgba(245, 158, 11, 0.1);
  border: 1px solid #f59e0b;
  color: #fcd34d;
  padding: 1rem;
  border-radius: 8px;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

/* Forms */
.form-group {
  margin-bottom: 1.5rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  color: var(--text-secondary);
}

.form-group input {
  width: 100%;
  padding: 0.8rem;
  background-color: #0a0a0f;
  border: 1px solid var(--accent-dark);
  color: var(--text-primary);
  border-radius: 4px;
  transition: border-color 0.3s, box-shadow 0.3s;
}

.form-group input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 8px var(--glow);
}

/* Profile Layout */
.profile-layout {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 2rem;
}

.profile-left {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 1rem;
}

.profile-name {
  font-size: 2rem;
  margin-top: 1rem;
  color: var(--accent);
  text-shadow: 0 0 10px var(--glow);
}

.stat-row {
  display: flex;
  justify-content: space-between;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
}

.stat-row:last-child {
  border-bottom: none;
}

/* Loading Spinner */
.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--accent-dark);
  border-top: 4px solid var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 2rem auto;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Particles */
.hero {
  position: relative;
  overflow: hidden;
  min-height: 70vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 2rem;
}

.hero h1 {
  font-size: 4rem;
  margin-bottom: 1rem;
  text-shadow: 0 0 20px var(--glow);
  z-index: 10;
}

.hero p {
  font-size: 1.5rem;
  color: var(--text-secondary);
  z-index: 10;
  max-width: 600px;
}

.particles {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  pointer-events: none;
}

.particle {
  position: absolute;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent);
  opacity: 0.5;
  animation: float 15s infinite linear;
}

.particle:nth-child(1) { width: 10px; height: 10px; left: 10%; animation-duration: 20s; animation-delay: 0s; }
.particle:nth-child(2) { width: 15px; height: 15px; left: 20%; animation-duration: 25s; animation-delay: -5s; }
.particle:nth-child(3) { width: 8px; height: 8px; left: 40%; animation-duration: 18s; animation-delay: -2s; }
.particle:nth-child(4) { width: 12px; height: 12px; left: 60%; animation-duration: 22s; animation-delay: -8s; }
.particle:nth-child(5) { width: 20px; height: 20px; left: 80%; animation-duration: 30s; animation-delay: -10s; }
.particle:nth-child(6) { width: 10px; height: 10px; left: 90%; animation-duration: 15s; animation-delay: -1s; }

@keyframes float {
  0% { transform: translateY(100vh) scale(0); opacity: 0; }
  50% { opacity: 0.8; }
  100% { transform: translateY(-20vh) scale(1.5); opacity: 0; }
}

/* Grid */
.race-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 2rem;
  margin-top: 4rem;
  z-index: 10;
}

.race-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

/* Footer */
footer {
  text-align: center;
  padding: 2rem;
  border-top: 1px solid var(--border);
  margin-top: auto;
  color: var(--text-secondary);
}

/* Rankings Table */
.table-container {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
}

th, td {
  padding: 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

th {
  color: var(--text-secondary);
  font-weight: normal;
  text-transform: uppercase;
  font-size: 0.9rem;
}

tr:hover {
  background-color: rgba(255, 255, 255, 0.02);
}

/* Tabs */
.tabs {
  display: flex;
  gap: 1rem;
  margin-bottom: 2rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 1rem;
  overflow-x: auto;
}

.tab {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0.5rem 1rem;
  font-size: 1rem;
  transition: color 0.3s, text-shadow 0.3s;
}

.tab:hover, .tab.active {
  color: var(--accent);
  text-shadow: 0 0 10px var(--glow);
}

/* Responsive */
@media (max-width: 768px) {
  .profile-layout {
    grid-template-columns: 1fr;
  }
  
  .hero h1 {
    font-size: 2.5rem;
  }
  
  .nav-links {
    gap: 1rem;
  }
}

/* Error message */
.error-msg {
  color: #ef4444;
  background-color: rgba(239, 68, 68, 0.1);
  border: 1px solid #ef4444;
  padding: 0.8rem;
  border-radius: 4px;
  margin-bottom: 1rem;
  display: none;
}
