#events-app {
  max-width: 900px;
  margin: 0 auto;
  font-family: inherit; /* inherit from theme */
  color: var(--wp--preset--color--foreground, #222);
}

#events-app select {
  padding: 0.5rem;
  font-size: 1rem;
  margin-bottom: 1rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  background: white;
}

.event-item {
  background: var(--wp--preset--color--background, #f9f9f9);
  border: 1px solid #ddd;
  padding: 1rem 1.5rem;
  margin-bottom: 1rem;
  border-radius: 6px;
  box-shadow: 0 1px 3px rgb(0 0 0 / 0.1);
}

.event-item h3 {
  margin: 0 0 0.5rem 0;
  font-weight: 600;
  font-size: 1.3rem;
  color: var(--wp--preset--color--primary, #0073aa);
}

.event-item p {
  margin: 0.3rem 0;
  line-height: 1.4;
  color: var(--wp--preset--color--secondary, #555);
}

.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-top: 1rem;
  gap: 1rem;
}

.pagination button {
  background-color: var(--wp--preset--color--primary, #0073aa);
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  color: white;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.pagination button:disabled {
  background-color: #ccc;
  cursor: default;
}

.pagination span {
  font-weight: 600;
}

@media (max-width: 600px) {
  #events-app {
    padding: 0 1rem;
  }
}

.year-selector-wrapper {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.year-label {
  font-weight: 600;
}

.event-item p span {
  margin-left: 1rem;
  color: #555;
  font-style: italic;
}

.spinner {
  margin: 2rem auto;
  border: 4px solid #f3f3f3; /* Light gray */
  border-top: 4px solid var(--wp--preset--color--primary, #0073aa); /* Theme primary color */
  border-radius: 50%;
  width: 36px;
  height: 36px;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.event-item h3 button {
  background: none;
  border: none;
  padding: 0;
  color: var(--wp--preset--color--primary, #0073aa);
  cursor: pointer;
  font-size: inherit;
  font-weight: 600;
  text-align: left;
}

.event-item h3 button:hover {
  text-decoration: underline;
}

.back-btn {
  margin-bottom: 2rem;
  background-color: #666;
  padding: 0.5rem 2rem;
}

.event-details {
  max-width: 800px;
}

.event-title {
  margin-bottom: 1rem;
}

.event-meta {
  display: grid;
  row-gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.meta-row {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 1rem;
}

.meta-label {
  font-weight: 600;
  color: #555;
}

.meta-value {
  color: #111;
}

.event-description {
  margin-top: 1.5rem;
  line-height: 1.6;
  white-space: normal;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.event-description p {
  margin: 0 0 0.75rem 0;
}

.scores-label-container {
  text-align: center;
  border-bottom: 2px solid #ccc; /* line under label */
  margin-bottom: 0.5rem;         /* spacing below the line */
  padding-bottom: 0.25rem;       /* space between text and line */
}

.scores-label {
  display: inline-block;
  margin: 0;
  font-weight: 700;
  font-size: 1.2rem;
  /* optionally, add some padding if you want spacing around text */
}

.class-scores {
  margin-bottom: 2rem;
  max-width: var(--wp--style--global--content-size, 960px);
}

.scores-row {
  display: flex;
  border-bottom: 1px solid #ccc;
  padding: 0.15rem 0;      /* half padding vertically */
  align-items: center;
  font-size: 0.9rem;      /* slightly smaller font */
  line-height: 1.2;       /* tighter line height */
}

.scores-header {
  font-weight: 700;
  background-color: #f0f0f0;
  border-top: 2px solid #ccc;
  font-size: 0.95rem;
}

.scores-cell {
  flex: 1;
  text-align: center;
  padding: 0 0.25rem;     /* less horizontal padding */
  white-space: nowrap;    /* prevent wrapping in score cells */
}

.pilot-header,
.pilot-name {
  flex: 2;
  text-align: left;
  padding-left: 0.5rem;  /* reduce padding-left */
  white-space: nowrap;   /* prevent pilot name wrap */
}

.total-header,
.total-score {
  flex: 0 0 3rem;
  font-weight: 700;
} 

.qual-header,
.qual-score {
  flex: 2;
  font-weight: 700;
} 

.pilot-link {
  background: none;
  border: none;
  cursor: pointer;
  font-weight: 600;
  padding: 0;
  font-size: inherit;
  color: var(--wp--preset--color--primary, #016695);
  /* white-space: nowrap;   prevent link wrap */
}

.pilot-link:focus,
.pilot-link:hover {
  text-decoration: underline;
  background: none;
  background-color: transparent !important;
}

.modal-backdrop {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 2rem;
  overflow-y: auto;
  z-index: 1000;
}

.modal-content {
  background: white;
  border-radius: 8px;
  max-width: 900px;
  width: 100%;
  padding: 1.5rem;
  box-shadow: 0 0 15px rgba(0,0,0,0.3);
  position: relative;
  overflow-x: auto;
}

.modal-close {
  position: absolute;
  top: 10px;
  right: 15px;
  font-size: 1.2rem; /* Smaller size */
  line-height: 1;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: #eee;
  cursor: pointer;
  text-align: center;
  padding: 0;
  color: #333;
  transition: background-color 0.2s ease;
}

.modal-close:hover {
  background: #ccc;
}

.scoresheet-cell {
  flex-grow: 1;      /* grow to fill */
  flex-shrink: 0;    /* Don't shrink below content */
  padding: 0 0.4rem;
  text-align: center;
  font-size: 0.9rem;
  min-width: 40px;   /* Minimum width for visibility */
  white-space: nowrap; /* Prevent wrapping inside cells */
  overflow: hidden;
}

/* For header cells only */
.scoresheet-header .scoresheet-cell {
  white-space: normal; /* allow wrapping */
  word-break: break-word; /* break long words if needed */
}

.scoresheet-cell:first-child {
  flex-basis: 50px;  /* Round number smaller */
}

.scoresheet-cell:nth-child(2), /* LaunchOnTime */
.scoresheet-cell:nth-child(3), /* EntireRound */
.scoresheet-cell:nth-child(4), /* Kills */
.scoresheet-cell:nth-child(5), /* CrossCEL */
.scoresheet-cell:nth-child(6), /* CrossSL */
.scoresheet-cell:nth-child(7), /* CrossPL */
.scoresheet-cell:nth-child(8), /* NonEngage */
.scoresheet-cell:nth-child(9)  /* StreamerLeft */
{
  flex-basis: 80px;  /* Medium sized columns */
}

.scoresheet-cell:last-child {
  flex-basis: 70px;  /* TotalScore column */
  font-weight: 700;
}

.scoresheet-total .scoresheet-cell:last-child {
  text-align: right;
  padding-right: 1rem;
  flex-grow: 9;
}

.scoresheet-container {
  border: 1px solid #ccc;
  border-radius: 4px;
  overflow: hidden;
}

/* Each row has bottom border except the last one */
.scoresheet-row {
  border-bottom: 1px solid #ccc;
  display: flex;
  align-items: center;
  padding: 0.3rem 0.5rem;
}

/* Remove bottom border on last row */
.scoresheet-row:last-child {
  border-bottom: none;
}

/* Header row styling */
.scoresheet-header {
  background-color: #f0f0f0;
  font-weight: 700;
}

/* Cells: add left/right border for visual separation */
.scoresheet-cell {
  border-left: 1px solid #ccc;
  padding: 0.4rem 0.6rem;
  text-align: center;
  flex-grow: 1;
  /* add word-break and wrapping if needed */
  word-break: break-word;
  white-space: normal;
}

/* Remove left border on first cell in each row */
.scoresheet-cell:first-child {
  border-left: none;
  text-align: left; /* for pilot name or labels */
}

#pilots-app {
  max-width: 900px;
  margin: 2rem auto;
  font-family: inherit; /* inherit from theme */
  color: var(--wp--preset--color--foreground, #222);
}

#pilots-app select {
  padding: 0.5rem;
  font-size: 1rem;
  margin-bottom: 1rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  background: white;
}

.filters-bar {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.rank {
  flex: 0 0 3rem;  /* Fixed width, no grow/shrink */
  text-align: right;
  padding: 0 0.25rem;
  white-space: nowrap;
}

.leaderboard .scores-header {
  border-top: 2px solid #ccc;
}

.leaderboard {
  margin-top: 1rem;
}

.empty-state {
  padding: 1rem;
  text-align: center;
  color: #666;
}

.top-1 {
  background-color: rgba(255, 215, 0, 0.3); /* Gold, 30% opacity */
  font-weight: 700;
}

.top-2 {
  background-color: rgba(192, 192, 192, 0.3); /* Silver, 30% opacity */
  font-weight: 700;
}

.top-3 {
  background-color: rgba(205, 127, 50, 0.3); /* Bronze, 30% opacity */
  font-weight: 700;
}

.event-col {
  flex: 3;
  text-align: left;
}

.class-col {
  flex: 2;
}

.expand-col {
  flex: 0 0 2rem;
  text-align: center;
  cursor: pointer;
}

.clickable {
  cursor: pointer;
}

.round-details {
  background: #fafafa;
  border-left: 3px solid #ccc;
  margin-bottom: 0.25rem;
  padding: 0.5rem 0.75rem;
  transition: all 0.2s ease;
}

.details-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.5rem 1rem;
  font-size: 0.85rem;
}

.details-grid div {
  display: flex;
  justify-content: space-between;
  border-bottom: 1px dotted #ddd;
}

.details-grid strong {
  font-weight: 600;
  color: #555;
}

.bool-yes {
  color: rgba(0, 128, 0, 0.75);
}

.bool-no {
  color: rgba(180, 0, 0, 0.65);
}

.penalty {
  color: rgba(180, 0, 0, 0.75);   /* muted red */
  font-weight: 700;
}

.penalty-none {
  color: rgba(0, 0, 0, 0.35);     /* light neutral */
}

.event-link {
  background: none;
  border: none;
  cursor: pointer;
  font-weight: 600;
  padding: 0;
  font-size: inherit;
  color: var(--wp--preset--color--primary, #016695);
  /* white-space: nowrap;   prevent link wrap */
}

.event-link:focus,
.event-link:hover {
  text-decoration: underline;
  background: none;
  background-color: transparent !important;
}