:root {
  --gold: #E8B800;
  --gold-dim: #b38e00;
  --bg: #0d0d0d;
  --card: #161616;
  --card-border: #2a2a2a;
  --text: #e8e8e8;
  --muted: #666;
}

* { box-sizing: border-box; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  min-height: 100vh;
}

/* Nav */
.nwr-nav {
  background: #0a0a0a;
  border-bottom: 2px solid var(--gold);
  padding: 0.5rem 0;
  position: sticky;
  top: 0;
  z-index: 100;
}
.nwr-logo {
  font-size: 1.2rem;
  font-weight: 900;
  color: var(--gold);
  letter-spacing: 2px;
}
.nwr-nav .nav-link {
  color: #888 !important;
  padding: 0.4rem 0.6rem;
  border-radius: 6px;
  font-size: 0.9rem;
  transition: color 0.15s, background 0.15s;
}
.nwr-nav .nav-link:hover,
.nwr-nav .nav-link.active {
  color: var(--gold) !important;
  background: rgba(232,184,0,0.1);
}

/* Cards */
.nwr-card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 1.25rem;
}
.nwr-card-title {
  color: var(--gold);
  font-weight: 700;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-bottom: 1rem;
}

/* Standings table */
.standings-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.75rem;
  border-radius: 8px;
  transition: background 0.1s;
}
.standings-row:hover { background: rgba(255,255,255,0.04); }
.standings-pos {
  width: 2rem;
  text-align: center;
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--muted);
  flex-shrink: 0;
}
.standings-pos.p1 { color: #FFD700; }
.standings-pos.p2 { color: #C0C0C0; }
.standings-pos.p3 { color: #CD7F32; }
.standings-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid var(--card-border);
  flex-shrink: 0;
  object-fit: cover;
}
.standings-name {
  flex: 1;
  font-weight: 600;
  font-size: 0.95rem;
}
.standings-pts {
  font-weight: 700;
  color: var(--gold);
  font-size: 1rem;
  white-space: nowrap;
}
.standings-gap {
  color: var(--muted);
  font-size: 0.8rem;
  white-space: nowrap;
  min-width: 3.5rem;
  text-align: right;
}
.standings-wins {
  background: rgba(232,184,0,0.15);
  color: var(--gold);
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 0.75rem;
  font-weight: 700;
  white-space: nowrap;
}

/* Position rows for race entry */
.pos-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--card-border);
}
.pos-row:last-child { border-bottom: none; }
.pos-label {
  width: 2.5rem;
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--gold);
  flex-shrink: 0;
}
.pos-row .ts-wrapper { flex: 1; }

/* Tom Select dark theme */
.ts-control {
  background: #1f1f1f !important;
  border-color: var(--card-border) !important;
  color: var(--text) !important;
  border-radius: 8px !important;
}
.ts-dropdown {
  background: #1f1f1f !important;
  border-color: #333 !important;
  color: var(--text) !important;
}
.ts-dropdown .option:hover,
.ts-dropdown .option.active {
  background: rgba(232,184,0,0.15) !important;
  color: var(--text) !important;
}
.ts-dropdown .option.selected {
  background: rgba(232,184,0,0.2) !important;
}
.driver-option {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 2px 0;
}
.driver-option img {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}
.driver-option .name { font-weight: 600; font-size: 0.9rem; }
.driver-option .tag  { color: var(--muted); font-size: 0.75rem; }

/* Forms */
.form-control, .form-select {
  background: #1f1f1f !important;
  border-color: var(--card-border) !important;
  color: var(--text) !important;
  border-radius: 8px;
}
.form-control:focus, .form-select:focus {
  border-color: var(--gold) !important;
  box-shadow: 0 0 0 0.2rem rgba(232,184,0,0.2) !important;
}
.form-label {
  color: #aaa;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
}
.form-control::placeholder { color: var(--muted) !important; }
.text-muted { color: #888 !important; }

/* Buttons */
.btn-gold {
  background: var(--gold);
  color: #000;
  font-weight: 700;
  border: none;
  border-radius: 8px;
  padding: 0.6rem 1.5rem;
  transition: background 0.15s;
}
.btn-gold:hover { background: var(--gold-dim); color: #000; }
.btn-outline-gold {
  border: 1px solid var(--gold);
  color: var(--gold);
  background: transparent;
  border-radius: 8px;
  transition: all 0.15s;
}
.btn-outline-gold:hover {
  background: var(--gold);
  color: #000;
}

/* Race history table */
.race-table { width: 100%; border-collapse: collapse; }
.race-table th {
  color: var(--muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--card-border);
}
.race-table td {
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  font-size: 0.9rem;
  vertical-align: middle;
}
.race-table tr:hover td { background: rgba(255,255,255,0.03); }
.race-table .track-name { font-weight: 600; }

/* Badges */
.badge-pos { display: inline-block; width: 24px; height: 24px; border-radius: 50%; text-align: center; line-height: 24px; font-size: 0.75rem; font-weight: 700; }
.badge-pos.p1 { background: #FFD700; color: #000; }
.badge-pos.p2 { background: #C0C0C0; color: #000; }
.badge-pos.p3 { background: #CD7F32; color: #000; }
.badge-pos.other { background: #2a2a2a; color: #888; }

/* Section headers */
.section-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.section-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--card-border);
  margin-left: 0.5rem;
}

/* Login page */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}
.login-card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  padding: 2.5rem;
  max-width: 380px;
  width: 100%;
  text-align: center;
}
.login-logo {
  font-size: 3rem;
  font-weight: 900;
  color: var(--gold);
  letter-spacing: 4px;
  margin-bottom: 0.5rem;
}
.btn-discord {
  background: #5865F2;
  color: #fff;
  font-weight: 700;
  border: none;
  border-radius: 8px;
  padding: 0.75rem 2rem;
  font-size: 1rem;
  width: 100%;
  transition: background 0.15s;
  text-decoration: none;
  display: block;
}
.btn-discord:hover { background: #4752C4; color: #fff; }

/* Checkbox/DNP toggle */
.dnp-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--muted);
  cursor: pointer;
}
.dnp-toggle input { cursor: pointer; }

/* Modals - dark theme */
.modal-content {
  background: var(--card) !important;
  border-color: var(--card-border) !important;
  color: var(--text) !important;
}
.modal-header, .modal-footer {
  border-color: var(--card-border) !important;
}
.modal-header .modal-title { color: var(--text); }

/* Alert */
.alert-nwr {
  background: rgba(232,184,0,0.1);
  border: 1px solid rgba(232,184,0,0.3);
  color: var(--gold);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  font-size: 0.9rem;
}

/* Footer */
.nwr-footer {
  margin-top: 3rem;
  padding: 1.25rem 1rem;
  border-top: 1px solid var(--card-border);
  background: #0a0a0a;
  text-align: center;
}
.nwr-footer-link {
  color: var(--muted);
  text-decoration: none;
  transition: color 0.15s;
}
.nwr-footer-link:hover { color: var(--gold); }

/* Responsive tweaks */
@media (max-width: 576px) {
  .nwr-card { padding: 1rem; }
  .standings-avatar { width: 30px; height: 30px; }
  .standings-pts { font-size: 0.9rem; }
}
