.faceoff-relay-scoreboard .relay-scoreboard-filters {
  display: flex;
  gap: 20px;
  margin-bottom: 2rem;
}

@media (max-width: 768px) {
  .faceoff-relay-scoreboard .relay-scoreboard-filters {
    flex-direction: column;
  }
}

/* Discipline header */

.relay-discipline-header {
  margin-bottom: 2rem;
}

.relay-discipline-header h2 {
  margin: 0 0 0.5rem;
}

.relay-discipline-meta {
  display: flex;
  gap: 1rem;
  align-items: center;
  font-size: 0.9rem;
}

.relay-round-info {
  font-weight: bold;
}

.relay-status {
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.relay-status-in_progress {
  background: #e8f5e9;
  color: #2e7d32;
}

.relay-status-completed {
  background: #e3f2fd;
  color: #1565c0;
}

.relay-status-not_started {
  background: #f5f5f5;
  color: #757575;
}

/* Team totals cards */

.relay-team-totals {
  margin-bottom: 2rem;
}

.relay-team-totals h3 {
  margin: 0 0 1rem;
  font-size: 1.1rem;
}

.relay-team-totals-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.relay-team-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 1rem;
  background: #f8f8f8;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  flex: 1 1 auto;
  min-width: 160px;
}

.relay-team-rank-1 {
  border-color: #f1cb00;
  background: #fffde7;
}

.relay-team-rank-2 {
  border-color: #c4c4c4;
  background: #fafafa;
}

.relay-team-rank-3 {
  border-color: #d58e27;
  background: #fff8e1;
}

.relay-team-rank {
  font-size: 1.4rem;
  font-weight: bold;
  min-width: 1.5rem;
  text-align: center;
}

.relay-team-name {
  flex: 1;
  font-weight: 600;
}

.relay-team-score {
  font-size: 1.2rem;
  font-weight: bold;
}

/* Individual standings table */

.relay-standings {
  margin-bottom: 2rem;
}

.relay-standings h3 {
  margin: 0 0 1rem;
  font-size: 1.1rem;
}

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

.relay-standings-table th,
.relay-standings-table td {
  padding: 0.5rem 0.6rem;
  text-align: center;
  border-bottom: 1px solid #e8e8e8;
}

.relay-standings-table th {
  background: #f5f5f5;
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  position: sticky;
  top: 0;
  z-index: 1;
}

.relay-standings-table .col-name,
.relay-standings-table .col-team {
  text-align: left;
}

.relay-standings-table .col-name {
  font-weight: 600;
}

.relay-standings-table .col-rank {
  width: 50px;
}

.relay-standings-table .col-bib {
  width: 40px;
  color: #888;
}

.relay-standings-table .col-round {
  width: 50px;
}

.relay-standings-table .col-active-round {
  background: #e3f2fd;
}

.relay-standings-table th.col-active-round {
  background: #bbdefb;
}

.relay-standings-table .col-total {
  width: 60px;
  font-weight: bold;
}

.relay-standings-table .col-turn {
  width: 50px;
  color: #888;
  font-size: 0.8rem;
}

/* Rank badges */

.relay-standings-table .rank-number {
  display: inline-block;
  min-width: 1.6rem;
  height: 1.6rem;
  line-height: 1.6rem;
  border-radius: 50%;
  font-weight: bold;
  font-size: 0.85rem;
}

.relay-standings-table .rank-1 {
  background: #f1cb00;
  color: #000;
}

.relay-standings-table .rank-2 {
  background: #c4c4c4;
  color: #000;
}

.relay-standings-table .rank-3 {
  background: #d58e27;
  color: #fff;
}

/* Round cells */

.relay-standings-table .round-empty {
  color: #ccc;
}

.relay-standings-table .round-score {
  font-weight: 600;
}

.relay-standings-table .round-dangerous {
  background: #fff3e0;
}

.relay-standings-table .round-dangerous .flag-dangerous {
  color: #e65100;
  font-weight: bold;
  margin-left: 2px;
}

.relay-standings-table .round-failed {
  background: #fce4ec;
}

.relay-standings-table .round-failed .flag-failed {
  color: #c62828;
  font-weight: bold;
  margin-left: 2px;
}

.relay-standings-table .round-invalid .round-score {
  text-decoration: line-through;
  opacity: 0.5;
}

/* Next-up highlight */

.relay-standings-table .relay-next-up {
  background: #e8f5e9;
}

.relay-standings-table .relay-next-up td {
  border-bottom-color: #c8e6c9;
}

/* Zebra striping */

.relay-standings-table tbody tr:nth-child(even):not(.relay-next-up) {
  background: #fafafa;
}

.relay-standings-table tbody tr:hover {
  background: #f0f0f0;
}

/* Loading / error / empty states */

.relay-loading,
.relay-error,
.relay-empty {
  padding: 2rem;
  text-align: center;
  color: #666;
}

.relay-error {
  color: #c62828;
}

@media (max-width: 768px) {
  .relay-standings-table {
    font-size: 0.78rem;
  }

  .relay-standings-table th,
  .relay-standings-table td {
    padding: 0.4rem 0.3rem;
  }

  .relay-standings-table .col-turn {
    display: none;
  }
}

/* Changes feed */

.relay-changes-feed {
  margin-bottom: 1.5rem;
  max-height: 240px;
  overflow-y: auto;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  background: #fafafa;
}

.relay-changes-feed:empty {
  display: none;
}

.relay-change-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.8rem;
  border-bottom: 1px solid #eee;
  font-size: 0.85rem;
  animation: relay-change-flash 0.6s ease-out;
}

.relay-change-item:last-child {
  border-bottom: none;
}

@keyframes relay-change-flash {
  0% { background: #fff9c4; }
  100% { background: transparent; }
}

.relay-change-time {
  font-family: monospace;
  font-size: 0.8rem;
  color: #888;
  white-space: nowrap;
}

.relay-change-type {
  background: #e3f2fd;
  color: #1565c0;
  padding: 0.1rem 0.4rem;
  border-radius: 3px;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}

.relay-change-action {
  font-weight: 600;
  text-transform: capitalize;
  white-space: nowrap;
}

.relay-change-updated .relay-change-action {
  color: #e65100;
}

.relay-change-created .relay-change-action {
  color: #2e7d32;
}

.relay-change-activated .relay-change-action {
  color: #1565c0;
}

.relay-change-deactivated .relay-change-action,
.relay-change-deleted .relay-change-action {
  color: #c62828;
}

.relay-change-clickable {
  cursor: pointer;
}

.relay-change-clickable:hover {
  background: #e3f2fd;
}

.relay-change-summary {
  color: #555;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 768px) {
  .relay-change-item {
    flex-wrap: wrap;
    font-size: 0.78rem;
  }

  .relay-change-summary {
    width: 100%;
    flex: none;
  }
}

/* Team scoreboard */

.relay-team-scoreboard {
  margin-top: 2rem;
  margin-bottom: 2rem;
}

.relay-team-scoreboard-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.relay-team-scoreboard-header h3 {
  margin: 0;
  font-size: 1.1rem;
}

.relay-team-scoreboard-discipline {
  font-weight: 600;
  font-size: 0.95rem;
  color: #333;
}

.relay-team-scoreboard-table .col-athletes {
  text-align: left;
  padding: 0;
}

.relay-team-scoreboard-table .col-name {
  white-space: nowrap;
  font-weight: 700;
}

.relay-team-scoreboard-row > .col-total {
  font-size: 1.1rem;
  font-weight: 800;
  vertical-align: middle;
}

.relay-team-scoreboard-row > .col-rank {
  vertical-align: middle;
}

.relay-team-scoreboard-row > .col-name {
  vertical-align: middle;
}

.relay-team-athletes-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.relay-team-athlete-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.25rem 0.6rem;
  border-bottom: 1px solid #f0f0f0;
  font-size: 0.82rem;
}

.relay-team-athlete-row:last-child {
  border-bottom: none;
}

.relay-team-athlete-rank {
  color: #999;
  font-size: 0.75rem;
  min-width: 2rem;
}

.relay-team-athlete-name {
  flex: 1;
  min-width: 100px;
}

.relay-team-athlete-rounds {
  display: flex;
  gap: 0.25rem;
}

.relay-team-athlete-round {
  display: inline-block;
  min-width: 2rem;
  text-align: center;
  font-size: 0.75rem;
  padding: 0.1rem 0.2rem;
  border-radius: 3px;
  background: #f5f5f5;
}

.relay-team-athlete-round.col-active-round {
  background: #e3f2fd;
  font-weight: 600;
}

.relay-team-athlete-round.round-failed {
  background: #fce4ec;
}

.relay-team-athlete-round.round-dangerous {
  background: #fff3e0;
}

.relay-team-athlete-score {
  min-width: 3rem;
  text-align: right;
  font-weight: 600;
}

@media (max-width: 768px) {
  .relay-team-scoreboard-table .col-athletes {
    display: block;
  }

  .relay-team-athlete-rounds {
    display: none;
  }

  .relay-team-athlete-row {
    font-size: 0.75rem;
    padding: 0.2rem 0.4rem;
  }
}

/* Raw data display */

.relay-raw-data-section {
  margin-top: 2rem;
  margin-bottom: 2rem;
}

.relay-raw-data-toggle {
  background: #f5f5f5;
  border: 1px solid #ddd;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.85rem;
  color: #555;
  transition: background 0.2s;
}

.relay-raw-data-toggle:hover {
  background: #eee;
}

.relay-raw-data-wrap {
  margin-top: 0.75rem;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  overflow: auto;
  max-height: 500px;
  background: #1e1e1e;
}

.relay-raw-data-pre {
  margin: 0;
  padding: 1rem;
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.78rem;
  line-height: 1.4;
  color: #d4d4d4;
  white-space: pre;
  overflow-x: auto;
}

/* Team stats */

.relay-team-stats {
  margin-top: 2rem;
  margin-bottom: 2rem;
}

.relay-team-stats h3 {
  margin: 0 0 1rem;
  font-size: 1.1rem;
}
