.calendarMain {
  display: flex;
  flex-direction: column;
  padding: 0;
  flex: 1 1 auto;
  min-height: 0;
  color: white;
}

.calendarControls {
  display: flex;
  gap: 1rem;
  padding: 0.75rem 1rem;
  background: var(--bg);
  align-items: center;
  flex-wrap: wrap;
  position: sticky;
  top: 0;
  z-index: 5;
  justify-content: space-between;
  width: 100%;
}

.calendarNav {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.calTitle {
  font-family: Centra No2 Black, Centra No2, sans-serif;
  font-size: 1.5rem;
  margin: 0;
  min-width: 12rem;
  text-align: center;
}

.calNavBtn,
.calTodayBtn {
  background: #2e2926;
  color: white;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.35rem 0.75rem;
  cursor: pointer;
  font-size: 1rem;
}

.calNavBtn:hover,
.calTodayBtn:hover {
  background: var(--accent);
}

.calendarControls label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1rem;
}

.calendarControls select {
  font-size: 1rem;
  padding: 0.35rem 0.6rem;
  background: #2e2926;
  border: 1px solid var(--border);
}

.calendarWrapper {
  padding: 1rem;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
  margin-inline: auto;
}

.calendarWeekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  font-weight: bold;
  text-transform: uppercase;
  font-size: 0.8rem;
  opacity: 0.7;
  padding: 0.25rem 0;
}

.calendarWeekdays>div {
  text-align: center;
}

.calendarGrid {
  display: grid;
  grid-template-columns: repeat(7, minmax(7rem, 1fr));
  gap: 4px;
  flex: 1 1 auto;
}

.calDay {
  background: #2e292699;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.35rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  overflow: hidden;
  min-height: 6rem;
}

.calDayOther {
  opacity: 0.35;
}

.calDayToday {
  border-color: red;
  box-shadow: inset 0 0 3px 3px var(--accent);
}

.calDayHas {
  cursor: pointer;
}

.calDayHas:hover {
  background: #3a322e;
}

.calDayHeader {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  font-weight: bold;
}

.calDayNum {
  opacity: 0.9;
}

.calDayCount {
  background: var(--accent);
  color: white;
  font-size: 0.7rem;
  padding: 0.05rem 0.4rem;
  border-radius: 10px;
}

.calDayFixtures {
  display: flex;
  flex-direction: column;
  gap: 3px;
  overflow: hidden;
}

.calFixture {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.35rem;
  align-items: center;
  background: rgba(255, 255, 255, 0.06);
  border-left: 3px solid var(--accent);
  border-radius: 3px;
  padding: 0.15rem 0.35rem;
  font-size: 0.75rem;
  color: white;
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.calFixture[data-league="WSL"] {
  border-left-color: #e90052;
}

.calFixture[data-league="WS2"] {
  border-left-color: #38a9e4;
}

.calFixture[data-league="WLC"] {
  border-left-color: #f5a623;
}

.calFixture:hover {
  background: rgba(255, 255, 255, 0.15);
  color: white;
}

.calFixTime {
  font-weight: bold;
  opacity: 0.9;
}

.calFixTeams {
  overflow: hidden;
  text-overflow: ellipsis;
}

.calFixWeek {
  opacity: 0.6;
  font-size: 0.65rem;
}

.dayPopupDialog {
  max-width: min(90vw, 560px);
  width: 100%;
  max-height: 85vh;
  overflow: auto;
  border: 1px solid var(--border);
  background-color: #201b18 !important;
}

.dayPopupBody {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 0.5rem 1rem 1rem;
}

.dayPopupFix {
  background: #2e2926;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.dayPopupHead {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.dayPopupTime {
  font-size: 1.2rem;
  font-weight: bold;
}

.dayPopupLeague {
  font-size: 0.85rem;
  opacity: 0.75;
}

.dayPopupTeams {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.1rem;
  font-weight: bold;
  flex-wrap: wrap;
}

.dayPopupTeams img {
  height: 1.75rem;
  width: 1.75rem;
  object-fit: contain;
}

.dayPopupVs {
  opacity: 0.6;
  font-weight: normal;
}

.dayPopupVenue {
  opacity: 0.75;
  font-size: 0.9rem;
}

.dayPopupTech {
  align-self: flex-start;
  background: var(--accent);
  color: white;
  text-decoration: none;
  padding: 0.35rem 0.75rem;
  border-radius: 5px;
  font-weight: bold;
  font-size: 0.9rem;
}

.dayPopupTech:hover {
  color: white;
  filter: brightness(1.15);
}

@media (max-width: 800px) {
  .calendarGrid {
    /* Drop the 7rem-per-column minimum (7 × 7rem ≈ 49rem) that forced the grid
       wider than the viewport and overflowed the right; let the 7 columns shrink
       to fit instead. */
    grid-template-columns: repeat(7, minmax(0, 1fr));
    grid-auto-rows: minmax(5rem, 1fr);
  }

  .calFixTeams {
    font-size: 0.7rem;
  }

  .calFixWeek {
    display: none;
  }

  .calTitle {
    font-size: 1.2rem;
    min-width: 8rem;
  }
}

@media (max-width: 500px) {
  .calendarGrid {
    grid-auto-rows: minmax(4rem, auto);
    gap: 0px;
  }

  .calFixture {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .calFixTime {
    font-size: 0.7rem;
  }

  .calFixTeams {
    font-size: 0.65rem;
  }

  .calDay {
    border-radius: 0;
    border-width: 0.5px;
  }

  .calendarWrapper {
    padding: 0;
  }
}