.mobile-filter-details,
.mobile-filter-details__fields {
  display: contents;
}

.mobile-filter-details__toggle,
.mobile-results-summary {
  display: none;
}

@media (min-width: 641px) {
  .filter-bar--mobile-collapse > .mobile-filter-details {
    display: block;
    flex: 1 1 42rem;
    min-width: 0;
  }

  .filter-bar--mobile-collapse .mobile-filter-details__fields {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.65rem 0.8rem;
  }
}

@media (max-width: 640px) {
  .filter-bar--mobile-collapse {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 0.82fr);
    align-items: end;
    gap: 0.62rem;
  }

  .filter-bar--mobile-collapse > .filter-group--mobile-primary {
    grid-column: 1;
    grid-row: 1;
    min-width: 0;
  }

  .mobile-filter-details {
    display: contents;
  }

  .mobile-filter-details__toggle {
    box-sizing: border-box;
    display: flex;
    grid-column: 2;
    grid-row: 1;
    width: 100%;
    min-height: var(--tdb-control-height-coarse);
    align-items: center;
    justify-content: space-between;
    gap: 0.45rem;
    padding: 0.4rem 0.58rem;
    border: 1px solid var(--border-strong);
    border-radius: var(--tdb-radius-control);
    background: var(--surface);
    color: var(--text-strong);
    cursor: pointer;
    font-size: 0.78rem;
    font-weight: 700;
    line-height: 1.2;
  }

  .mobile-filter-details__preview {
    display: none;
  }

  .mobile-filter-details__toggle:hover {
    background: var(--hover);
    color: var(--text-strong);
  }

  .mobile-filter-details__toggle::after {
    content: "+";
    flex: 0 0 auto;
    color: var(--text-muted);
    font-size: 1rem;
    line-height: 1;
  }

  .mobile-filter-details__toggle[aria-expanded="true"]::after {
    content: "−";
  }

  .mobile-filter-details__fields {
    display: grid;
    grid-column: 1 / -1;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.62rem;
    min-width: 0;
  }

  .mobile-filter-details__toggle[aria-expanded="false"] + .mobile-filter-details__fields {
    display: none;
  }

  .filter-bar--mobile-collapse .compare-player-search,
  .filter-bar--mobile-collapse input:not([type="checkbox"]):not([type="radio"]),
  .filter-bar--mobile-collapse select {
    min-width: 0;
    max-width: 100%;
    width: 100%;
  }

  .mobile-filter-details__fields > .filter-group--wide,
  .mobile-filter-details__fields > .filter-group--mobile-wide,
  .mobile-filter-details__fields > .filter-group--opponent,
  .mobile-filter-details__fields > fieldset {
    grid-column: 1 / -1;
  }

  .mobile-results-summary,
  .match-log-summary {
    display: block;
    margin: -0.2rem 0 0.7rem;
    color: var(--text-muted);
    font-size: 0.78rem;
    line-height: 1.35;
  }

  .match-list-shell,
  .match-list-shell .table-scroll-region {
    width: 100%;
    max-width: 100%;
    overflow: visible;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }

  .match-list-shell.is-horizontally-scrollable::before,
  .match-list-shell .table-scroll-region.is-horizontally-scrollable::before {
    content: none;
  }

  .match-list-shell > .table-tools {
    margin-bottom: 0.42rem;
    border: 1px solid var(--border);
    border-radius: var(--tdb-radius-control);
    background: var(--surface-subtle);
  }

  .match-list-table,
  .match-list-table tbody {
    display: block;
    width: 100%;
    min-width: 0;
  }

  .match-list-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }

  .match-list-table tbody + tbody {
    margin-top: 0.42rem;
  }

  .match-list-table .match-list-row {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 0.2rem 0.42rem;
    width: 100%;
    margin-bottom: 0.42rem;
    padding: 0.5rem 0.56rem;
    border: 1px solid var(--border);
    border-left: 3px solid var(--border-strong);
    border-radius: var(--tdb-radius-control);
    background: var(--surface);
  }

  .match-list-table .match-list-row:last-child {
    margin-bottom: 0;
  }

  .match-list-table .match-list-row:hover,
  .match-list-table .match-list-row:focus-within {
    background: var(--surface-selected);
  }

  .match-list-table .match-list-row.live-match-row,
  .match-list-table .match-list-row.player-live-match-row {
    border-left-color: var(--win);
  }

  .match-list-table .match-list-row.interrupted-match-row {
    border-left-color: var(--status-warning-text);
    background: var(--status-warning-bg);
  }

  .match-list-table .match-list-row.unconfirmed-match-row,
  .match-list-table .match-list-row.upset-row {
    border-left-color: var(--loss);
    background: color-mix(in srgb, var(--loss) 8%, var(--surface));
  }

  .match-list-table .match-cell {
    display: block;
    min-width: 0;
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    font-size: 0.74rem;
    line-height: 1.3;
    text-align: left;
    overflow-wrap: anywhere;
    white-space: normal !important;
  }

  .match-list-shell.table-wrap--sticky-first .match-cell:first-child {
    position: static;
    box-shadow: none;
  }

  .match-list-table .match-cell--player,
  .match-list-table .match-cell--opponent {
    overflow-wrap: anywhere;
    color: var(--text-strong);
    font-size: 0.86rem;
    line-height: 1.35;
  }

  .match-list-table .match-cell--score {
    align-self: center;
    color: var(--text-strong);
    font-size: 0.8rem;
    font-variant-numeric: tabular-nums;
    font-weight: 650;
    line-height: 1.35;
    text-align: right;
  }

  .match-list-table .match-cell--date,
  .match-list-table .match-cell--round,
  .match-list-table .match-cell--tournament,
  .match-list-table .match-cell--category,
  .match-list-table .match-cell--surface {
    align-self: center;
    overflow: hidden;
    color: var(--text-muted);
    text-overflow: ellipsis;
  }

  .match-list-table .match-cell--round,
  .match-list-table .match-cell--surface {
    text-align: right;
  }

  .match-list-table .match-cell--h2h,
  .match-list-table .match-cell--details {
    padding-top: 0.18rem;
    border-top: 1px solid var(--border-subtle);
    font-size: 0.72rem;
  }

  .match-list-table--pair .match-cell--player-a {
    grid-column: 1 / 9;
    grid-row: 1;
  }

  .match-list-table--pair .match-cell--player-b {
    grid-column: 1 / 9;
    grid-row: 2;
  }

  .match-list-table--pair .match-cell--score {
    grid-column: 9 / 13;
    grid-row: 1 / 3;
  }

  .match-list-table--pair .match-cell--tournament,
  .match-list-table--perspective .match-cell--tournament {
    grid-column: 1 / 9;
    grid-row: 3;
  }

  .match-list-table--pair .match-cell--round,
  .match-list-table--perspective .match-cell--round {
    grid-column: 9 / 13;
    grid-row: 3;
  }

  .match-list-table--pair .match-cell--date,
  .match-list-table--perspective .match-cell--date {
    grid-column: 1 / 5;
    grid-row: 4;
  }

  .match-list-table--pair .match-cell--category,
  .match-list-table--perspective .match-cell--category {
    grid-column: 5 / 9;
    grid-row: 4;
  }

  .match-list-table--pair .match-cell--surface,
  .match-list-table--perspective .match-cell--surface {
    grid-column: 9 / 13;
    grid-row: 4;
  }

  .match-list-table--pair .match-cell--h2h,
  .match-list-table--perspective .match-cell--h2h {
    grid-column: 1 / 4;
    grid-row: 5;
  }

  .match-list-table--pair .match-cell--details,
  .match-list-table--perspective .match-cell--details {
    grid-column: 4 / 8;
    grid-row: 5;
  }

  .match-list-table--perspective .match-cell--outcome {
    grid-column: 1 / 3;
    grid-row: 1 / 3;
    align-self: center;
  }

  .match-list-table--perspective .match-cell--opponent {
    grid-column: 3 / 13;
    grid-row: 1;
  }

  .match-list-table--perspective .match-cell--score {
    grid-column: 3 / 13;
    grid-row: 2;
    text-align: left;
  }

  .match-list-table .match-list-group-header,
  .match-list-table tbody > tr:not(.match-list-row):not(.live-probability-detail-row) {
    display: block;
    width: 100%;
    margin: 0.52rem 0 0.32rem;
  }

  .match-list-table .match-list-group-header > th,
  .match-list-table .match-list-group-header > td,
  .match-list-table tbody > tr:not(.match-list-row):not(.live-probability-detail-row) > td {
    display: block;
    width: 100%;
    padding: 0.34rem 0;
    border: 0;
    white-space: normal;
  }

  .match-list-table .live-probability-detail-row,
  .match-list-table .live-probability-detail-row > td {
    display: block;
    width: 100%;
  }

  .match-list-table .live-probability-detail-row > td {
    padding: 0 0 0.42rem;
    border: 0;
  }

  .match-list-table .live-probability-card {
    position: static;
    box-sizing: border-box;
    width: 100%;
    max-width: none;
  }

  .match-list-table--live .match-cell--date {
    grid-column: 1 / 7;
    grid-row: 3;
  }

  .match-list-table--live .match-cell--round {
    grid-column: 7 / 13;
    grid-row: 3;
  }

  .match-list-table--live .match-cell--h2h,
  .match-list-table--live .match-cell--details {
    grid-row: 4;
  }

  .match-list-table--event .match-cell--date {
    grid-column: 1 / 5;
    grid-row: 3;
  }

  .match-list-table--event .match-cell--round,
  .match-list-table--event .match-cell--category {
    grid-column: 5 / 9;
    grid-row: 3;
  }

  .match-list-table--event .match-cell--surface {
    grid-column: 9 / 13;
    grid-row: 3;
  }

  .match-list-table--event .match-cell--h2h,
  .match-list-table--event .match-cell--details {
    grid-row: 4;
  }

  .player-identity-card {
    min-height: 0;
    padding: 0.62rem 0.7rem;
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .player-avatar {
    width: 56px;
    height: 56px;
  }

  .player-avatar--placeholder {
    width: 38px;
    height: 38px;
  }

  .player-identity-name {
    font-size: 1.46rem;
  }

  .player-identity-info {
    width: 100%;
  }

  .player-identity-meta {
    justify-content: center;
    font-size: 0.8rem;
  }

  .player-fact-summary {
    text-align: left;
  }
}
