.species-legend {
  display: flex;
  align-items: center;
  gap: 9px 18px;
  flex-wrap: wrap;
  padding: 15px 2px 0;
  color: var(--muted);
  font-size: 13px;
}

/* Keep the locked competition filters compact on mobile and tablet. */
.competition-shortcuts > .filter {
  display: inline-flex;
  flex: 0 0 auto !important;
  width: auto !important;
  min-width: max-content;
  justify-content: center;
  padding: 8px 15px;
  white-space: nowrap;
}
.species-legend > span { display: inline-flex; align-items: center; gap: 7px; }
.species-legend .legend-title { color: var(--ink); font-weight: 700; }
.legend-dot { width: 11px; height: 11px; border-radius: 3px; display: inline-block; }
.legend-dot.pike { background: #168264; }
.legend-dot.trout { background: #9a6240; }
.legend-dot.perch { background: #e27b32; }
.legend-dot.coarse { background: #347eae; }
.legend-dot.sea { background: #315a7c; }
.legend-dot.predator { background: #7653a5; }
.legend-dot.junior { background: #c59112; }

.event-card { --species: #74807d; --species-soft: #edf0ef; border-left: 5px solid var(--species); }
.event-card .datebox { background: var(--species-soft); color: var(--species); }
.event-card .datebox span, .event-card .tag { color: var(--species); }
.event-card.species-pike { --species: #16765c; --species-soft: #dff1e9; }
.event-card.species-trout { --species: #8a5739; --species-soft: #f2e3d7; }
.event-card.species-perch { --species: #d86a2c; --species-soft: #fff0df; }
.event-card.species-coarse { --species: #2e719f; --species-soft: #e2f0f8; }
.event-card.species-sea { --species: #315a7c; --species-soft: #e2eaf1; }
.event-card.species-predator { --species: #7653a5; --species-soft: #ece5f5; }
.event-card.species-junior { --species: #9b7000; --species-soft: #fff2c9; }
.event-card.species-salmon { --species: #b45062; --species-soft: #f8e3e7; }
.event-card.featured { border-left-color: var(--species); }
.event-card.featured .datebox { background: var(--species); color: #fff; }
.event-card.featured .datebox span { color: #fff; }
.event-card.featured .tag { color: var(--species-soft); }
.feature-countdown { display: flex; align-items: center; gap: 9px; margin: 0 0 9px; color: #fff; font-size: 14px; font-weight: 700; }
.feature-countdown span { display: inline-flex; flex: 0 0 auto; align-items: center; min-height: 24px; padding: 3px 8px; border-radius: 20px; background: var(--lime); color: var(--deep); font-size: 11px; letter-spacing: .7px; line-height: 1; white-space: nowrap; text-transform: uppercase; }
.event-card.cancelled { border-left-color: #b9332b; }

.filter[data-filter="Pike"] { border-color: #4e8d7b; }
.filter[data-filter="Perch"] { border-color: #d98248; }
.filter[data-filter="Predator"] { border-color: #8469a8; }
.filter[data-filter="Coarse"] { border-color: #648fae; }
.filter[data-filter="Sea"] { border-color: #718da5; }
.filter[data-filter="Trout"] { border-color: #9f806a; }
.filter[data-filter="Junior"] { border-color: #a88936; }
.filter-hint { margin: 10px 2px 0; color: #b9cec9; font-size: 13px; }

.view-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 22px 0 0; }
.view-switch { display: inline-flex; flex-wrap: wrap; gap: 6px; padding: 5px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.view-button, .calendar-nav button { border: 0; border-radius: 5px; background: transparent; color: var(--ink); padding: 9px 14px; font: 700 14px "DM Sans"; cursor: pointer; }
.view-button.active { background: var(--deep); color: #fff; }
.calendar-nav { display: flex; align-items: center; justify-content: space-between; gap: 9px; min-width: 265px; }
.calendar-nav button { min-width: 42px; border: 1px solid var(--line); background: #fff; font-size: 18px; }
.calendar-nav strong { flex: 1; text-align: center; font-size: 14px; }
.calendar-view { display: grid; gap: 18px; margin-bottom: 54px; }
.calendar-view.view-six { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.calendar-view.view-year { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.calendar-month { min-width: 0; border: 1px solid var(--line); border-radius: 8px; background: #fff; padding: 18px; }
.calendar-month h2 { margin: 0 0 15px; font: 400 25px/1.1 "DM Serif Display", serif; }
.calendar-tbc { display: grid; gap: 7px; margin: -3px 0 14px; padding: 10px; border: 1px dashed #87a19a; border-radius: 6px; background: #f1f7f3; }
.calendar-tbc > strong { color: var(--green); font-size: 11px; letter-spacing: 1.3px; text-transform: uppercase; }
.calendar-tbc-event { --species: #74807d; display: grid; grid-template-columns: 8px 1fr; align-items: center; gap: 3px 7px; width: 100%; border: 0; background: transparent; color: var(--ink); padding: 3px 0; text-align: left; cursor: pointer; }
.calendar-tbc-event i { width: 8px; height: 8px; border-radius: 50%; background: var(--species); }
.calendar-tbc-event span { min-width: 0; overflow: hidden; font-size: 12px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.calendar-tbc-event small { grid-column: 2; color: var(--green); font-size: 11px; font-weight: 700; }
.calendar-tbc-event.species-pike { --species: #16765c; }.calendar-tbc-event.species-trout { --species: #8a5739; }.calendar-tbc-event.species-perch { --species: #d86a2c; }.calendar-tbc-event.species-coarse { --species: #2e719f; }.calendar-tbc-event.species-sea { --species: #315a7c; }.calendar-tbc-event.species-predator { --species: #7653a5; }.calendar-tbc-event.species-junior { --species: #9b7000; }.calendar-tbc-event.species-salmon { --species: #b45062; }
.weekday-row, .month-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.weekday-row span { padding: 0 3px 7px; color: var(--muted); font-size: 11px; font-weight: 700; text-align: center; text-transform: uppercase; }
.calendar-day, .calendar-spacer { min-width: 0; min-height: 73px; border-top: 1px solid #e8ebe7; border-right: 1px solid #e8ebe7; padding: 5px; }
.calendar-day:nth-child(7n), .calendar-spacer:nth-child(7n) { border-right: 0; }
.day-number { display: inline-grid; width: 25px; height: 25px; place-items: center; border-radius: 50%; font-size: 12px; font-weight: 700; }
.calendar-day.today .day-number { background: var(--deep); color: #fff; }
.day-events { display: grid; gap: 3px; margin-top: 3px; }
.calendar-event { --species: #74807d; display: flex; align-items: center; gap: 5px; width: 100%; min-width: 0; border: 0; border-radius: 4px; background: color-mix(in srgb, var(--species) 13%, white); color: var(--ink); padding: 4px 5px; text-align: left; cursor: pointer; }
.calendar-event i { width: 7px; height: 7px; flex: 0 0 auto; border-radius: 50%; background: var(--species); }
.calendar-event span { overflow: hidden; font-size: 11px; font-weight: 700; line-height: 1.2; text-overflow: ellipsis; white-space: nowrap; }
.calendar-event.cancelled { background: #fbe4e1; text-decoration: line-through; }
.calendar-continuation { --species: #74807d; width: 100%; height: 5px; border: 0; border-radius: 3px; background: var(--species); cursor: pointer; }
.calendar-event.species-pike, .calendar-continuation.species-pike { --species: #16765c; }
.calendar-event.species-trout, .calendar-continuation.species-trout { --species: #8a5739; }
.calendar-event.species-perch, .calendar-continuation.species-perch { --species: #d86a2c; }
.calendar-event.species-coarse, .calendar-continuation.species-coarse { --species: #2e719f; }
.calendar-event.species-sea, .calendar-continuation.species-sea { --species: #315a7c; }
.calendar-event.species-predator, .calendar-continuation.species-predator { --species: #7653a5; }
.calendar-event.species-junior, .calendar-continuation.species-junior { --species: #9b7000; }
.calendar-event.species-salmon, .calendar-continuation.species-salmon { --species: #b45062; }
.view-year .calendar-day, .view-year .calendar-spacer { min-height: 54px; padding: 3px; }
.view-year .calendar-event { padding: 3px; }
.view-year .calendar-event span { display: none; }

/* Keep every competition category visible without horizontal scrolling. */
.filters { flex-wrap: wrap; overflow-x: visible; }
.quick-nav { flex-wrap: wrap; overflow-x: visible; }

/* Keep the page fluid if a mobile browser reports an unusual viewport width. */
html { width: 100%; max-width: 100%; overflow-x: clip; }
body { width: 100%; max-width: 100%; overflow-x: clip; position: relative; }
.topbar, .quick-nav, main, footer { width: 100%; max-width: 100%; min-width: 0; }
.topbar > *, .quick-nav > *, main > *, footer > * { min-width: 0; }
.event-grid, .record-grid, .directory-grid, .archive-grid, .guide-grid { min-width: 0; }
.event-card, .record-card, .directory-card, .archive-card, .guide-card { min-width: 0; max-width: 100%; overflow-wrap: anywhere; }
.event-card > *, .card-top > *, .meta > * { min-width: 0; }

@media (max-width: 800px) {
  .species-legend { gap: 8px 13px; padding-top: 13px; }
  .species-legend .legend-title { flex-basis: 100%; }
  .filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(92px, 1fr)); }
  .filter { width: 100%; padding: 10px 7px; text-align: center; }
  .quick-nav { position: static; display: grid; grid-template-columns: repeat(auto-fit, minmax(145px, 1fr)); padding: 9px 16px; }
  .quick-nav a { white-space: normal; display: grid; place-items: center; min-height: 40px; padding: 7px 8px; text-align: center; line-height: 1.2; }
  main { padding-inline: clamp(14px, 4vw, 22px); }
  .event-grid, .record-grid, .directory-grid, .archive-grid, .guide-grid { grid-template-columns: minmax(0, 1fr); }
  .finder, .searchbox, .event-card { width: 100%; max-width: 100%; min-width: 0; }
  .searchbox input { min-width: 0; }
  .records-section, .directory-section, .archive-section, .intro { scroll-margin-top: 82px; }
  .view-toolbar { align-items: stretch; flex-direction: column; }
  .view-switch { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); width: 100%; }
  .view-button { padding-inline: 5px; }
  .calendar-nav { width: 100%; min-width: 0; }
  .calendar-view.view-six, .calendar-view.view-year { grid-template-columns: minmax(0, 1fr); }
  .calendar-month { padding: 12px 8px; }
  .calendar-day, .calendar-spacer, .view-year .calendar-day, .view-year .calendar-spacer { min-height: 58px; padding: 3px 2px; }
  .calendar-event { padding: 3px; }
  .calendar-event span { display: none; }
}
