body { font-family: system-ui, Arial, sans-serif; margin: 8px 12px; background: #f9fafb; }
.header { margin-bottom: 8px; }
h1 { margin: 0 0 4px 0; color: #1f2937; font-size: 1.3rem; }
h2 { margin: 10px 0 6px; color: #374151; font-size: 1rem; }
.elim-summary { padding: 6px 10px; background: #fef3c7; border-left: 3px solid #f59e0b; margin-bottom: 8px; border-radius: 4px; font-size: 0.9em; }
table { border-collapse: collapse; width: 100%; background: white; box-shadow: 0 1px 2px rgba(0,0,0,0.08); margin-bottom: 8px; }
th, td { border-bottom: 1px solid #e5e7eb; padding: 4px 8px; text-align: left; font-size: 0.9em; }
th { background: #f3f4f6; font-weight: 600; color: #374151; font-size: 0.85em; }
tr.live-row:hover { background: #fafafa; }
tr.elim-row { opacity: 0.6; text-decoration: line-through; }
tr.elim-row:hover { background: #fee; }
.muted { color: #6b7280; font-size: 0.85em; }
details { margin: 2px 0 4px 0; }
summary { cursor: pointer; padding: 4px 6px; background: #f0f7ff; font-weight: 500; color: #2563eb; font-size: 0.8em; border-radius: 3px; }
summary:hover { background: #dbeafe; }
.lap-table { width: 100%; border-collapse: collapse; margin-top: 4px; }
.lap-table th, .lap-table td { border-bottom: 1px dashed #e5e7eb; padding: 2px 6px; font-size: 0.8em; }
.lap-table th { background: #fafafa; }
.pill { display: inline-block; padding: 1px 6px; border-radius: 999px; background: #dbeafe; color: #1e40af; font-size: 0.8em; font-weight: 600; }
.pill-in { background: #d1fae5; color: #065f46; }
.pill-elim { background: #fee2e2; color: #991b1b; }
.status-ok { color: #059669; }
.status-dnf { color: #dc2626; }
.back-link { display: inline-block; margin-bottom: 6px; color: #2563eb; text-decoration: none; font-size: 0.85em; }
.back-link:hover { text-decoration: underline; }
.action-btn { padding: 2px 8px; margin: 0 2px; border: 1px solid #ddd; background: white; border-radius: 4px; cursor: pointer; font-size: 0.75em; }
.action-btn:hover { background: #f3f4f6; }
.btn-danger { background: #fee; border-color: #f87171; color: #991b1b; }
.btn-danger:hover { background: #fca5a5; }
.btn-success { background: #d1fae5; border-color: #10b981; color: #065f46; }
.btn-success:hover { background: #6ee7b7; }
.flagged-row { background: #fffbeb; border-bottom: 1px solid #fde68a; color: #92400e; font-size: 0.95rem; }
.flagged-row:hover { background: #fef3c7; }

/* Toast notification system */
#toast-container { position: fixed; bottom: 20px; right: 20px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; }
.toast { padding: 12px 20px; border-radius: 8px; box-shadow: 0 4px 12px rgba(0,0,0,0.15); font-size: 0.9rem; display: flex; align-items: center; gap: 10px; animation: slideIn 0.3s ease-out; max-width: 350px; }
.toast-success { background: #10b981; color: white; }
.toast-error { background: #ef4444; color: white; }
.toast-warning { background: #f59e0b; color: white; }
.toast-info { background: #3b82f6; color: white; }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes slideOut { from { transform: translateX(0); opacity: 1; } to { transform: translateX(100%); opacity: 0; } }

/* Custom modal styling */
.modal-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.5); z-index: 10000; display: flex; align-items: center; justify-content: center; animation: fadeIn 0.2s ease-out; }
.modal-content { background: white; border-radius: 12px; padding: 24px; max-width: 400px; width: 90%; box-shadow: 0 20px 40px rgba(0,0,0,0.2); animation: scaleIn 0.2s ease-out; }
.modal-title { margin: 0 0 12px 0; font-size: 1.2rem; font-weight: 700; color: #1f2937; }
.modal-message { margin: 0 0 20px 0; font-size: 0.95rem; color: #4b5563; line-height: 1.5; }
.modal-buttons { display: flex; justify-content: flex-end; gap: 10px; }
.modal-btn { padding: 10px 20px; border-radius: 6px; border: none; cursor: pointer; font-weight: 600; font-size: 0.9rem; transition: all 0.15s; }
.modal-btn-cancel { background: #f3f4f6; color: #374151; }
.modal-btn-cancel:hover { background: #e5e7eb; }
.modal-btn-confirm { background: #dc2626; color: white; }
.modal-btn-confirm:hover { background: #b91c1c; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes scaleIn { from { transform: scale(0.95); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* Large elimination popup */
.elim-popup { position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); background: linear-gradient(135deg, #dc2626, #ef4444); color: white; padding: 30px 50px; border-radius: 16px; z-index: 9000; text-align: center; box-shadow: 0 20px 60px rgba(220, 38, 38, 0.4); animation: elimPulse 0.5s ease-out, elimGlow 2s ease-in-out infinite; max-width: 90vw; }
.elim-popup h2 { margin: 0 0 15px 0; font-size: 1.8rem; font-weight: 800; text-transform: uppercase; letter-spacing: 2px; text-shadow: 0 2px 4px rgba(0,0,0,0.2); }
.elim-popup .bib-number { display: inline-block; background: white; color: #dc2626; padding: 10px 30px; border-radius: 8px; font-size: 2.5rem; font-weight: 900; margin-right: 15px; box-shadow: 0 4px 8px rgba(0,0,0,0.15); }
.elim-popup .rider-name { font-size: 2rem; font-weight: 700; }
.elim-popup .elim-lap { font-size: 1rem; color: rgba(255,255,255,0.85); margin-top: 12px; }
@keyframes elimPulse { 0% { transform: translate(-50%, -50%) scale(0.5); opacity: 0; } 50% { transform: translate(-50%, -50%) scale(1.05); } 100% { transform: translate(-50%, -50%) scale(1); opacity: 1; } }
@keyframes elimGlow { 0%, 100% { box-shadow: 0 20px 60px rgba(220, 38, 38, 0.4); } 50% { box-shadow: 0 20px 80px rgba(220, 38, 38, 0.6); } }

/* Late crossing warning badge */
.late-crossing-badge { display: inline-block; background: #fef3c7; color: #92400e; padding: 2px 6px; border-radius: 4px; font-size: 0.7em; font-weight: 600; animation: latePulse 1s ease-in-out infinite; margin-left: 4px; }
@keyframes latePulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.6; } }

/* Sprint points popup - shows all positions together */
.sprint-popup { position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); background: linear-gradient(135deg, #f59e0b, #fbbf24); color: white; padding: 25px 40px; border-radius: 16px; z-index: 9000; text-align: center; box-shadow: 0 20px 60px rgba(245, 158, 11, 0.4); animation: sprintPulse 0.5s ease-out, sprintGlow 2s ease-in-out infinite; max-width: 95vw; min-width: 350px; }
.sprint-popup h2 { margin: 0 0 8px 0; font-size: 1.6rem; font-weight: 800; text-transform: uppercase; letter-spacing: 2px; text-shadow: 0 2px 4px rgba(0,0,0,0.2); }
.sprint-popup .sprint-lap-title { font-size: 1.1rem; color: rgba(255,255,255,0.9); margin-bottom: 15px; }
.sprint-popup .sprint-results { display: flex; flex-direction: column; gap: 8px; }
.sprint-popup .sprint-result-row { display: flex; align-items: center; justify-content: center; gap: 12px; background: rgba(255,255,255,0.15); padding: 8px 15px; border-radius: 8px; }
.sprint-popup .sprint-place { font-size: 1.1rem; font-weight: 700; min-width: 40px; text-align: right; }
.sprint-popup .sprint-place.gold { color: #ffd700; }
.sprint-popup .sprint-place.silver { color: #e5e7eb; }
.sprint-popup .sprint-place.bronze { color: #cd7f32; }
.sprint-popup .bib-number { display: inline-block; background: white; color: #f59e0b; padding: 4px 12px; border-radius: 6px; font-size: 1.2rem; font-weight: 900; min-width: 40px; box-shadow: 0 2px 4px rgba(0,0,0,0.15); }
.sprint-popup .rider-name { font-size: 1.1rem; font-weight: 600; flex: 1; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 180px; }
.sprint-popup .points-award { display: inline-block; background: white; color: #f59e0b; padding: 4px 12px; border-radius: 999px; font-size: 1rem; font-weight: 900; min-width: 50px; }
@keyframes sprintPulse { 0% { transform: translate(-50%, -50%) scale(0.5); opacity: 0; } 50% { transform: translate(-50%, -50%) scale(1.05); } 100% { transform: translate(-50%, -50%) scale(1); opacity: 1; } }
@keyframes sprintGlow { 0%, 100% { box-shadow: 0 20px 60px rgba(245, 158, 11, 0.4); } 50% { box-shadow: 0 20px 80px rgba(245, 158, 11, 0.6); } }

/* Sprint points badge in table */
.sprint-pts-badge { display: inline-block; background: #fef3c7; color: #92400e; padding: 2px 8px; border-radius: 4px; font-weight: 700; font-size: 0.85em; }
.sprint-pts-badge.has-points { background: #f59e0b; color: white; }

/* Next sprint coming popup */
.next-sprint-popup { position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); background: linear-gradient(135deg, #3b82f6, #60a5fa); color: white; padding: 30px 50px; border-radius: 16px; z-index: 9000; text-align: center; box-shadow: 0 20px 60px rgba(59, 130, 246, 0.4); animation: nextSprintPulse 0.5s ease-out, nextSprintGlow 1s ease-in-out infinite; max-width: 90vw; }
.next-sprint-popup h2 { margin: 0 0 15px 0; font-size: 2rem; font-weight: 800; text-transform: uppercase; letter-spacing: 2px; text-shadow: 0 2px 4px rgba(0,0,0,0.2); }
.next-sprint-popup .sprint-lap-number { display: inline-block; background: white; color: #3b82f6; padding: 10px 30px; border-radius: 8px; font-size: 2.5rem; font-weight: 900; box-shadow: 0 4px 8px rgba(0,0,0,0.15); }
.next-sprint-popup .sprint-message { font-size: 1.2rem; color: rgba(255,255,255,0.95); margin-top: 12px; }
@keyframes nextSprintPulse { 0% { transform: translate(-50%, -50%) scale(0.5); opacity: 0; } 50% { transform: translate(-50%, -50%) scale(1.05); } 100% { transform: translate(-50%, -50%) scale(1); opacity: 1; } }
@keyframes nextSprintGlow { 0%, 100% { box-shadow: 0 20px 60px rgba(59, 130, 246, 0.4); } 50% { box-shadow: 0 20px 80px rgba(59, 130, 246, 0.7); } }

/* ========== Multi-Race Split Panels ========== */
#multi-race-container {
  display: none;
  flex-wrap: wrap;
  gap: 16px;
  padding: 16px;
  width: 100%;
  box-sizing: border-box;
}

.race-panel {
  flex: 1;
  min-width: 300px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  display: flex;
  flex-direction: column;
}

.race-panel-header {
  background: #1f2937;
  color: #fff;
  padding: 14px 16px 10px;
}

.race-panel-title {
  margin: 0 0 2px;
  font-size: 1.15rem;
  font-weight: 700;
}

.race-panel-cat {
  font-size: 0.8rem;
  color: #9ca3af;
  display: block;
  margin-bottom: 6px;
}

.race-panel-clock {
  font-size: 1.6rem;
  font-weight: 900;
  color: #4ade80;
  font-family: monospace;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}

.race-panel-links {
  display: flex;
  gap: 8px;
}

.race-panel-bigscreen-btn {
  display: inline-block;
  padding: 5px 12px;
  background: #374151;
  color: #d1d5db;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  text-decoration: none;
}

.race-panel-bigscreen-btn:hover {
  background: #4b5563;
  color: #fff;
}

.race-panel-body {
  flex: 1;
  overflow-y: auto;
}

.race-panel-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.race-panel-table thead th {
  background: #f9fafb;
  padding: 8px 10px;
  text-align: left;
  font-weight: 600;
  color: #374151;
  border-bottom: 1px solid #e5e7eb;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.race-panel-table tbody td {
  padding: 8px 10px;
  border-bottom: 1px solid #f3f4f6;
  color: #1f2937;
}

.race-panel-table tbody tr:hover { background: #f9fafb; }

.race-panel-table tbody tr.pos-1 td { background: #fef3c7; font-weight: 700; }
.race-panel-table tbody tr.pos-2 td { background: #f3f4f6; font-weight: 600; }
.race-panel-table tbody tr.pos-3 td { background: #fef9ee; font-weight: 600; }
.race-panel-table tbody tr.elim-row td { background: #fef2f2; color: #b91c1c; text-decoration: line-through; opacity: 0.7; }
.race-panel-table tbody tr.dnf-row td { background: #f9fafb; color: #9ca3af; font-style: italic; }

@media (max-width: 768px) {
  #multi-race-container { flex-direction: column; }
  .race-panel { min-width: unset; }
}
