main {
  display: grid;
  grid-template-areas:
    "nav     nav  nav"
    "content content info";
  gap: 2rem;
  grid-template-columns: 1fr 1fr auto;
  position: relative;
  flex: 1;
  align-items: start;
  grid-template-rows: auto 1fr;
}

main:has(#daySelect[data-selected="0"]) .fixData:not([data-day="0"]),
main:has(#daySelect[data-selected="1"]) .fixData:not([data-day="1"]),
main:has(#daySelect[data-selected="2"]) .fixData:not([data-day="2"]),
main:has(#daySelect[data-selected="3"]) .fixData:not([data-day="3"]),
main:has(#daySelect[data-selected="4"]) .fixData:not([data-day="4"]),
main:has(#daySelect[data-selected="5"]) .fixData:not([data-day="5"]),
main:has(#daySelect[data-selected="6"]) .fixData:not([data-day="6"]) {
  display: none;
}

.weeksBar {
  grid-area: nav;
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 2;
  display: flex;
  align-items: stretch;
  /* gap: 0.5rem; */
  min-width: 0;
}

#weeks {
  flex-wrap: nowrap;
  display: flex;
  overflow: auto;
  /* Size to the tabs (shrink + scroll on overflow) rather than growing to fill the bar, so the
     Filter button sits directly after the last tab instead of across an empty gap. */
  flex: 0 1 auto;
  min-width: 0;
}

.filterMenu {
  position: relative;
  flex-shrink: 0;
  display: inline-flex;
  align-items: stretch;
  gap: 0.5rem;
}

.weeksBar>.filterMenu {
  border-left: 1px solid var(--border);
  /* padding-left: 0.5rem; */
}

.filterBtn {
  /* Funnel glyph shown when the button collapses to an icon on mobile. */
  --funnel: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%3E%3Cpath%20d='M3%204h18l-7%208v6l-4%202v-8z'/%3E%3C/svg%3E");
  background: #2e2926;
  color: white;
  /* border: 1px solid var(--border); */
  border: none;
  padding: 0 0.75rem;
  font-size: 0.95rem;
  cursor: pointer;
  white-space: nowrap;
}

.filterBtn:hover {
  background: #3a3531;
}

.filterInline {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: white;
  font-size: 0.95rem;
  white-space: nowrap;
}

.filterInline select {
  background: #2e2926;
  color: white;
  border: 1px solid var(--border);
  padding: 0.3rem 0.5rem;
  font-size: 0.95rem;
}

.filterPanel {
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 0.25rem;
  background: #2e2926;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  z-index: 5;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  min-width: 200px;
  max-width: calc(100vw - 1rem);
}

.weeksBar>.filterMenu .filterPanel {
  left: auto;
  right: 0;
}

.filterPanel label {
  display: grid;
  grid-template-columns: 5rem 1fr;
  align-items: center;
  gap: 0.5rem;
  color: white;
  font-size: 0.9rem;
  white-space: nowrap;
}

.filterPanel select {
  background: #2e2926;
  color: white;
  border: 1px solid var(--border);
  padding: 0.3rem 0.5rem;
  font-size: 0.9rem;
  width: 100%;
}

#fixtureListContainer {
  grid-area: content;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  padding-left: 1rem;
}

.fixtureList {
  display: grid;
  grid-template-areas: "img  text" "list list";
  flex: 1;
  min-width: 450px;

  align-items: baseline;
  grid-template-rows: auto 1fr;

  & .fixImg {
    height: 2rem;
    grid-area: img;
  }
}

.fixList {
  grid-area: list;
  display: flex;
  flex-direction: column;
  container: fixList / inline-size;
}

.testEventDialog {
  width: min(90vw, 550px);
}

.testEventForm {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin-block: 0.5rem;
}

.testEventForm label {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  font-size: 0.9rem;
}

@media (max-width: 500px) {
  .testEventForm {
    grid-template-columns: 1fr;
  }
}

.testEventBtn {
  border: none;
  border-radius: 5px;
  padding: 0.5rem 1rem;
  font-family: Centra No2;
  cursor: pointer;
  color: white;
  background: #92452b;
  width: 100%;
  margin-top: 0.5rem;
  font-size: 1rem;
}

.testEventBtn:hover {
  background: #a8563a;
}

.fixData {
  grid-template-areas: "teamA team watch match " "teamB info watch tier";
  grid-template-columns: auto 1fr auto 7rem;
}

.text {
  white-space: break-spaces;
}

.fixPerson1,
.fixPerson2 {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  flex-wrap: wrap;
  display: contents;
}

.fixPerson1 {
  grid-area: person1 / person1 / person2 / person2;
  flex-direction: row;
}

.fixPerson2 {
  grid-area: person2;
  display: none;
}

.fixTM {
  grid-area: person1;
}

.fixTMNum {
  grid-area: person2;
}


.info {
  grid-area: info;
  padding-right: 1rem;
}

.infoSubHeader {
  font-weight: bold;
}

.dayTitle {
  color: white;
  display: none;
}

.fixData[data-day="0"]~.dayTitle[data-day="0"] {
  display: block;
}

.fixData[data-day="1"]~.dayTitle[data-day="1"] {
  display: block;
}

.fixData[data-day="2"]~.dayTitle[data-day="2"] {
  display: block;
}

.fixData[data-day="3"]~.dayTitle[data-day="3"] {
  display: block;
}

.fixData[data-day="4"]~.dayTitle[data-day="4"] {
  display: block;
}

.fixData[data-day="5"]~.dayTitle[data-day="5"] {
  display: block;
}

.fixData[data-day="6"]~.dayTitle[data-day="6"] {
  display: block;
}

html:has(.vivid) {
  font-size: 18px;
}

.imgFilters,
.evsFilters,
.lineupFilters {
  display: flex;
  gap: 1rem;
  padding: 0.75rem 1rem;
  background: var(--bg);
  align-items: center;
  flex-wrap: wrap;
  position: sticky;
  top: 0;
  z-index: 1;
}

.imgFilters label,
.evsFilters label,
.lineupFilters label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: white;
  font-size: 0.95rem;
}

.imgFilters select,
.evsFilters select,
.lineupFilters select {
  padding: 0.3rem 0.5rem;
  font-size: 0.95rem;
  background: #3a3a3a;
}

.lineupDone {
  cursor: pointer;
}

.lineupDone:hover {
  background-color: orange;
}

td:has(.lineupHasTime) {
  background: #5fb95f;
}

.evsDone[data-done="true"] {
  background: #5fb95f;
}

.audioMain {
  display: grid;
  grid-template-areas:
    "tl tr"
    "bl br";
  position: absolute;
  height: 100%;
  width: 100%;
  gap: 0;
  margin: 0;
  padding: 0;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
}

.audioPanel {
  max-height: 50vh;
  position: relative;
}

.audioSrc {
  width: 200%;
  scale: 0.5;
  transform-origin: 0 0;
  height: 100vh;
}

.audioTitle {
  position: absolute;
  z-index: 1;
  color: white;
  background: black;
  padding: 0.1rem;
  padding-left: 0.4rem;
  border-radius: 5px;
  translate: -50%;
  left: 50%;
  top: 46.7vh
}

.audioMon,
.audioCont {
  display: none;
}

.audioSwitch {
  &::before {
    content: attr(data-type);
  }
}

[data-type="Monitor"] .audioMon {
  display: block;
}

[data-type="Control"] .audioCont {
  display: block;
}

.audioSwitch {
  border: none;
  border-radius: 5px;
  background: white;
  color: black;
}

.audioMon {
  width: 125%;
  scale: 0.8;
  height: 62.5vh;
}

.vivid {
  main {
    grid-template-columns: 1fr !important;
    grid-template-areas:
      "nav"
      "content" !important;
    padding-inline: 0.5rem !important;
  }

  .dayTitle {
    display: block;
  }

  main:has(#daySelect[data-selected="0"]) .fixData:not([data-day="0"]),
  main:has(#daySelect[data-selected="1"]) .fixData:not([data-day="1"]),
  main:has(#daySelect[data-selected="2"]) .fixData:not([data-day="2"]),
  main:has(#daySelect[data-selected="3"]) .fixData:not([data-day="3"]),
  main:has(#daySelect[data-selected="4"]) .fixData:not([data-day="4"]),
  main:has(#daySelect[data-selected="5"]) .fixData:not([data-day="5"]),
  main:has(#daySelect[data-selected="6"]) .fixData:not([data-day="6"]) {
    display: block;
  }

  .fixTM,
  .fixTMNum,
  .fixMM,
  .fixMMNum,
  .fixTier,
  .fixAssign,
  .fixNotes,
  .fixNotes2,
  .info,
  .weeksBar,
  #weeks,
  aside {
    display: none;
  }

  a {
    text-decoration: none;
    color: black;

    &::after {
      display: none;
    }
  }

  .fixData {
    grid-template-areas: "teamA team  watch pcr" "teamB info  watch   truck" !important;
    grid-template-columns: auto 1fr auto 7rem !important;
  }
}

.dashboard {

  background: rgb(17, 18, 23) !important;

  .weeksBar {
    background: rgb(17, 18, 23);
  }

  .fixA,
  .fixB,
  .fixImg,
  .fixTitle,
  .techDocs,
  aside {
    display: none;
  }

  .fixtureList {
    column-count: 2;
    display: block;
  }

  /* .fixNotes,
  .fixNotes2 {
    min-height: 6rem;
  } */

  main[data-info="true"] {
    .fixData {
      grid-template-areas: "teamA team  watch match tier " "teamB info  watch pcr   truck" "notes notes notes person1   person1  " "notes notes notes person2    person2   ";
    }

    @container fixList (width < 800px) {
      .fixData {
        grid-template-areas: "teamA team  team  watch" "teamB info  info  watch" "match pcr   truck tier " "person1   person1   person2 person2" "notes notes notes notes";
      }
    }

    @container fixList (width < 500px) {
      .fixData {
        grid-template-areas: "team  team team  team" "info  info info  info" "match pcr  truck tier" "person1   person1  person2    person2  " "notes notes notes notes";
        grid-template-columns: 1fr 1fr 1fr 1fr;
      }
    }
  }

  .fixTeams a {
    display: none;
  }

  main a {
    position: relative;
    text-decoration: none;
    color: black;

    &::after {
      display: none;
    }
  }

  .fixLocation,
  .fixTime {
    font-size: 1.5rem !important;
  }

  .fixTimeSmall {
    font-size: 1.5rem;
    text-align: left;
    width: 100%;
  }

  .fixTeams {
    font-size: 1.5rem;
    font-weight: bold;
    text-align: left;
  }

  a {
    color: white !important;
  }

  .infoBlock::after,
  .fixData::after {
    background: rgb(24, 27, 31);
  }

  .infoBlock,
  .fixData {
    border: 1px solid rgba(204, 204, 220, 0.12);
    color: white;
    border-radius: 0;
  }

  .fixData {
    grid-template-areas:
      "team team  team  team"
      "info info  info  watch"
      "match pcr   truck tier "
      "person1   person1   person2 person2"
      "notes notes notes notes" !important;
    /*! background: #412e27; */
    color: white;
    margin-bottom: 1rem !important;
  }
}



main[data-info="true"] {
  .fixData {
    grid-template-areas: "teamA team  watch match tier " "teamB info  watch pcr   truck" "notes notes notes person1   person1  " "notes notes notes person2    person2   ";
    grid-template-columns: auto 1fr auto 7rem 7rem;
  }

  @container fixList (width < 800px) {
    .fixData {
      grid-template-areas: "teamA team team  watch" "teamB info info  watch" "match pcr  truck tier " "person1   person1  person2    person2   " "notes notes notes notes";
      /* minmax(0,1fr): equal columns despite the 8rem broadcaster logo in the watch track. */
      grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .fixTeams {
      font-size: 1.5rem;
    }

    .fixTime,
    .fixLocation {
      font-size: 1rem;
    }

    .fixData {
      /*! margin-inline: 0.5rem; */
      margin-block: 0.25rem;
    }
  }

  @container fixList (width < 500px) {
    .fixData {
      grid-template-areas: "team  team team  team" "info  info info  info" "match pcr  truck tier" "person1   person1  person2    person2  " "notes notes notes notes";
      grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .fixA,
    .fixB {
      position: absolute;
      top: 0.5rem;
      left: 0.5rem;
      height: 2rem;
    }

    .fixB {
      left: unset;
      right: 0.5rem;
    }

    .fixHost {
      display: none;
    }

    .fixPCR,
    .fixTruck,
    .fixAssign,
    .fixTier {
      font-size: 1.2rem;
    }
  }
}

main[data-info="false"] {
  .fixData {
    /* This mode hides notes + person, so don't declare those rows — leaving them
       in left empty tracks (and row-gaps) padding the bottom of every card. */
    grid-template-areas: "teamA team  watch match" "teamB info  watch tier";
    grid-template-columns: auto 1fr auto 7rem;
  }

  .fixTeams {
    pointer-events: none;
    cursor: default;

    a {
      color: black;
      text-decoration: none;
      display: none;

      &::after {
        display: none;
      }
    }
  }

  & .fixTM,
  & .fixTMNum,
  & .fixMM,
  & .fixMMNum,
  & .fixPCR,
  & .fixTruck {
    display: none;
  }

  .fixNotes,
  .fixNotes2 {
    display: none;
  }

  /* Hide the notes container too — not just the textareas inside it. Otherwise its
     grid-area:notes (absent from the <800 / <500 templates) makes the empty box
     auto-place into a phantom implicit row at the bottom of the card. */
  .notesCont {
    display: none;
  }

  @container fixList (width < 800px) {
    .fixData {
      grid-template-areas: "teamA team team  watch" "teamB info info  watch" "match match tier tier ";
      /* minmax(0,1fr) keeps the 4 columns truly equal — plain 1fr is minmax(auto,1fr),
         which lets the 8rem broadcaster logo in the watch column blow out its track and
         shove the centred team name / the A|Tier split off-centre. */
      grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .fixTeams {
      font-size: 1.5rem;
    }

    .fixTime,
    .fixLocation {
      font-size: 1rem;
    }

    .fixData {
      margin-inline: 0.5rem;
      margin-block: 0.25rem;
    }
  }

  @container fixList (width < 500px) {
    .fixData {
      grid-template-areas: "team  team team  team" "info  info info  info" "match match tier tier ";
      grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .fixA,
    .fixB {
      position: absolute;
      top: 0.5rem;
      left: 0.5rem;
      height: 2rem;
    }

    .fixB {
      left: unset;
      right: 0.5rem;
    }

    .fixHost {
      display: none;
    }

    .fixPCR,
    .fixTruck,
    .fixAssign,
    .fixTier {
      font-size: 1.2rem;
    }
  }
}

.fixtureList:has(.fixList:empty) {
  display: none;
}

.teamBtn {
  background: rgb(43, 42, 51);
  padding-inline: 0.4rem;
  color: white;
  font-size: 1.5rem;
  border-radius: 5px;
  border: none;
  text-wrap: none;
  white-space: nowrap;
}

.teamsButtons {
  display: flex;
  gap: 1rem;
  margin: 1rem;
  flex-wrap: wrap;
}

.teamsCont {
  display: block;
}

.fixList:not(:has(.fixData))::before {
  content: "No fixtures";
  margin-top: 0;
  margin-bottom: .5rem;
  font-weight: 500;
  line-height: 1.2;
  color: white;
  font-size: 2.5rem;
}

@media only screen and (max-width: 1000px) {
  main {
    grid-template-areas: "nav" "content" "info";
    grid-template-columns: 1fr;
    padding-inline: 0.5rem;
    gap: 0.5rem;
  }

  #fixtureListContainer {
    flex-direction: column;
    flex-wrap: nowrap;
    padding-inline: 0.25rem;
  }

  .fixtureList {
    min-width: unset;
    /* In this column layout the inherited flex:1 (needed for the desktop row) would
       grow each group to fill the tall content area, inflating its auto/1fr list row
       and leaving a big empty gap after each set of cards. Size to content instead. */
    flex: 0 0 auto;
    grid-template-areas: "text  text" "list list";
  }

  .fixImg {
    display: none;
  }

  .fixTitle {
    text-align: center;
    grid-area: text;
  }

  .info {
    padding-inline: 0.25rem;
  }
}

@media only screen and (max-width: 600px) {
  main {
    padding-inline: 0;
  }

  /* Compact, honest week tabs — the old height:3rem was content-box and the
     0.5rem/1rem padding pushed the rendered tab to ~64px. */
  .weekBtn {
    box-sizing: border-box;
    height: 2.5rem;
    padding: 0 0.85rem;
    display: flex;
    align-items: center;
  }

  /* Hide the scrollbar chrome on the round strip (the active week is already
     scrolled into view by buildWeekPicker). */
  #weeks {
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  #weeks::-webkit-scrollbar {
    display: none;
  }

  /* Collapse "Filter ▾" to a funnel icon. Explicit height keeps it a 40px tap
     target everywhere — on lineup/evs/img the filter sits in an align-items:center
     bar (not the stretch weeksBar), so without it the button would be ~22px tall. */
  .filterBtn {
    font-size: 0;
    padding: 0;
    width: 2.6rem;
    height: 2.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .filterBtn::before {
    content: "";
    width: 1.25rem;
    height: 1.25rem;
    background-color: currentColor;
    -webkit-mask: var(--funnel) center / contain no-repeat;
    mask: var(--funnel) center / contain no-repeat;
  }

  .filterPanel {
    min-width: min(280px, calc(100vw - 1rem));
  }

  /* The external-link icon sits 1.5rem right of each link and would paint
     past the viewport edge (and can force horizontal scroll) on a phone. */
  main a::after {
    display: none;
  }

  /* Tame the oversized headings once the info section stacks below content. */
  .info .fixTitle {
    font-size: 1.8rem;
  }

  .info .infoBlock h2 {
    font-size: 1.25rem;
  }
}