/* Mobile navigation refinements; desktop keeps its existing grid and sidebar. */
@media (max-width: 900px) {
  .app-shell { display: flex; flex-direction: column; }
  .app-shell > * { min-width: 0; }
  .topbar { order: 0; }
  .code-panel { order: 1; }
  .status { order: 2; }
  .selection-panel { order: 3; }
  .message-ticker { order: 4; }
  .event-facts { order: 5; }
  .live-dashboard:not(.hidden) { display: contents; }
  .live-dashboard > .live-flow {
    order: 6;
    position: sticky;
    top: 0;
    z-index: 10;
    max-height: 60dvh;
    overflow-y: auto;
    padding: 4px;
    border-radius: 15px 15px 0 0;
  }
  .live-dashboard > .sponsor-panel {
    order: 7;
    padding-inline: 4px;
    background: var(--panel-blue);
  }
  .code-panel { width: 100%; }
  .content { order: 8; }
  .selection-panel {
    padding: 8px;
    margin-bottom: 10px;
    border: 0;
    border-radius: 10px;
    background: #fff;
  }
  .main-result-tabs { margin: 0; padding: 0; border: 0; }
  .main-result-tab-buttons { gap: 6px; padding: 4px; border-radius: 9px; background: #edf3f9; }
  .main-result-tab { min-height: 42px; border: 0; border-radius: 7px; background: transparent; color: #173454; }
  .main-result-tab.selected { background: #168ff4; color: #fff; }
  .live-tab-context { display: none; }
  .mobile-category-filter[hidden] { display: grid; gap: 6px; padding: 12px 4px 4px; }
  .mobile-category-filter > span { color: #48617f; font-size: 12px; font-weight: 700; }
  .mobile-category-filter select { width: 100%; min-width: 0; min-height: 44px; border-color: #cbd9e8; color: #173454; background: #f7faff; }
  .topbar-title .muted { font-size: 11px; }
  .event-meta-desktop { display: none; }
  .event-meta-mobile[hidden] { display: inline; }
  .topbar-title .muted[data-mobile-meta=""] { display: none; }
  .flow-mobile-header > span { font-size: 11px; }
  .live-panel-title .run-title { display: none; }
  .result-table.has-run-columns td:nth-child(8) .result-time strong,
  .result-table.single-result-column td:nth-child(6) .result-time strong { color: #102343; }

  .result-table:is(.single-result-column, .has-run-columns) tbody tr:not(.is-expanded),
  .result-table:is(.single-result-column, .has-run-columns) tbody tr.is-expanded {
    grid-template-columns: 36px 26px minmax(0, 1fr) minmax(0, .7fr) auto;
    grid-template-areas: "rank bib competitor club total";
    align-items: center;
    gap: 8px 6px;
    padding: 12px 30px 12px 10px;
  }

  .result-table:is(.single-result-column, .has-run-columns) tbody tr.is-expanded {
    grid-template-areas:
      "rank bib competitor club total"
      "category category category category category"
      "run-one run-one run-two run-two .";
  }

  .result-table.single-result-column tbody tr.is-expanded {
    grid-template-areas:
      "rank bib competitor club total"
      "category category category category category";
  }

  .result-table:is(.single-result-column, .has-run-columns) tbody tr td {
    min-width: 0;
    align-content: center;
  }

  .result-table:is(.single-result-column, .has-run-columns) tbody tr:not(.is-expanded) td:nth-child(2),
  .result-table:is(.single-result-column, .has-run-columns) tbody tr:not(.is-expanded) td:nth-child(4),
  .result-table:is(.single-result-column, .has-run-columns) tbody tr.is-expanded td:nth-child(2),
  .result-table:is(.single-result-column, .has-run-columns) tbody tr.is-expanded td:nth-child(4) {
    display: grid;
  }

  .result-table tbody tr td:nth-child(1)::before,
  .result-table tbody tr td:nth-child(2)::before,
  .result-table tbody tr td:nth-child(4)::before,
  .result-table tbody tr td:nth-last-child(2)::before {
    display: none;
  }

  .result-table .result-last-name,
  .result-table .result-first-name {
    display: block;
    overflow-wrap: anywhere;
  }

  .result-table tbody tr td:nth-child(3) {
    font-size: 13px;
    line-height: 1.25;
  }

  .result-table tbody tr td:nth-child(4) {
    grid-area: auto;
    position: absolute;
    left: 50%;
    top: 30px;
    transform: translate(-50%, -50%);
    width: 22%;
    text-align: center;
    justify-items: center;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.3;
    overflow-wrap: normal;
    word-break: normal;
  }

  .result-table .rank-value {
    width: 36px;
    min-width: 36px;
    height: 36px;
    font-size: 19px;
  }

  .result-table .bib {
    width: 26px;
    min-width: 26px;
    height: 26px;
    padding: 0;
    font-size: 11px;
  }

  .result-table:is(.single-result-column, .has-run-columns) tbody tr td:nth-last-child(2) {
    display: grid;
    grid-area: total;
    padding: 0;
    border: 0;
    text-align: right;
    white-space: nowrap;
  }

  .result-table .result-time strong {
    font-size: 15px;
    white-space: nowrap;
  }

  .result-table tbody tr.is-expanded td:nth-child(5) {
    padding-top: 10px;
    border-top: 1px solid var(--line);
  }
}

.flow-mobile-numbers {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.flow-mobile-identity {
  display: contents;
}

.flow-mobile-row.is-highlighted {
  grid-template-columns: minmax(0, 1fr) 28px minmax(0, 1fr);
}

.flow-mobile-row.is-highlighted .flow-mobile-identity {
  display: grid;
  grid-template-columns: 34px auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.flow-mobile-row.is-highlighted .flow-mobile-category-rank {
  margin-top: 3px;
  padding: 5px 6px;
  border-radius: 6px;
  background: #ffd84d;
  color: #071323;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
  text-align: center;
  justify-self: center;
}

.flow-mobile-finish-details {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
}

.flow-mobile-club {
  flex: 1;
  min-width: 0;
  text-align: center;
  overflow-wrap: anywhere;
  font-size: 12px;
  font-weight: 600;
  color: #0758a6;
}

.flow-mobile-finish-details .flow-mobile-time {
  flex-shrink: 0;
}

.flow-mobile-row.is-highlighted .flow-mobile-time {
  justify-self: end;
}
