/* Scale one complete standings canvas on phones so every column stays together. */
.mobile-standings-canvas {
  min-width: 0;
  transform-origin: left top;
}

@media screen and (max-width: 780px) {
  body[data-page="results"] main.inner-section > .table-wrap,
  body[data-page="standings"] .standings-score-wrap {
    box-sizing: border-box;
    max-width: 100%;
    overflow: hidden !important;
    width: 100%;
  }

  body[data-page="results"] .mobile-standings-canvas,
  body[data-page="standings"] .mobile-standings-canvas {
    transform-origin: left top;
    will-change: transform;
  }

  body[data-page="results"] .results-score-table,
  body[data-page="standings"] .standings-score-table {
    border-collapse: collapse;
    display: table !important;
    font-size: 0.95rem !important;
    min-width: 100% !important;
    table-layout: fixed !important;
    transform: none !important;
    width: 100% !important;
    zoom: 1 !important;
  }

  body[data-page="results"] .results-score-table > thead,
  body[data-page="standings"] .standings-score-table > thead {
    display: table-header-group !important;
  }

  body[data-page="results"] .results-score-table > tbody,
  body[data-page="standings"] .standings-score-table > tbody {
    display: table-row-group !important;
  }

  body[data-page="results"] .results-score-table > tbody > tr,
  body[data-page="standings"] .standings-score-table > tbody > tr {
    background: transparent !important;
    border: 0 !important;
    border-radius: 0 !important;
    display: table-row !important;
    padding: 0 !important;
  }

  body[data-page="results"] .results-score-table th,
  body[data-page="results"] .results-score-table td,
  body[data-page="standings"] .standings-score-table th,
  body[data-page="standings"] .standings-score-table td {
    box-sizing: border-box;
    display: table-cell !important;
    font-size: inherit !important;
    line-height: 1.1 !important;
    min-height: 0 !important;
    overflow: hidden !important;
    overflow-wrap: normal !important;
    padding: 0.48rem 0.3rem !important;
    text-align: center !important;
    text-overflow: clip !important;
    vertical-align: middle;
    white-space: nowrap !important;
    word-break: normal !important;
  }

  body[data-page="results"] .results-score-table th,
  body[data-page="standings"] .standings-score-table th {
    font-size: 0 !important;
  }

  body[data-page="results"] .results-score-table th::after,
  body[data-page="standings"] .standings-score-table th::after {
    content: attr(data-mobile-label);
    font-size: 0.68rem;
    font-weight: 950;
    line-height: 1;
  }

  body[data-page="results"] .results-score-table td::before,
  body[data-page="standings"] .standings-score-table td::before {
    content: none !important;
    display: none !important;
  }

  body[data-page="results"] .results-score-table th:first-child,
  body[data-page="results"] .results-score-table td:first-child,
  body[data-page="standings"] .standings-score-table th:first-child,
  body[data-page="standings"] .standings-score-table td:first-child {
    width: 2.5rem !important;
  }

  body[data-page="results"] .results-score-table .results-photo-head,
  body[data-page="results"] .results-score-table .results-photo-cell,
  body[data-page="standings"] .standings-score-table .standings-photo-head,
  body[data-page="standings"] .standings-score-table .standings-photo-cell {
    display: none !important;
  }

  body[data-page="results"] .results-score-table th:nth-child(3),
  body[data-page="results"] .results-score-table td:nth-child(3),
  body[data-page="standings"] .standings-score-table th:nth-child(3),
  body[data-page="standings"] .standings-score-table td:nth-child(3) {
    padding-left: 0.28rem !important;
    text-align: left !important;
    width: 13rem !important;
  }

  body[data-page="results"] .results-score-table th:nth-child(n + 4),
  body[data-page="results"] .results-score-table td:nth-child(n + 4),
  body[data-page="standings"] .standings-score-table th:nth-child(n + 4),
  body[data-page="standings"] .standings-score-table td:nth-child(n + 4) {
    width: 3rem !important;
  }

  body[data-page="results"] .results-score-table .results-bowler-label,
  body[data-page="results"] .results-score-table .results-bowler-label.has-member {
    align-items: center;
    display: grid !important;
    gap: 0.35rem;
    grid-template-columns: minmax(0, 1fr) auto;
    max-width: 100%;
    min-width: 0;
    overflow: hidden;
    width: 100%;
  }

  body[data-page="results"] .results-score-table .results-bowler-name-text {
    display: block;
    min-width: 0;
    overflow: hidden !important;
    overflow-wrap: normal !important;
    text-overflow: clip !important;
    white-space: nowrap !important;
    word-break: normal !important;
  }

  body[data-page="results"] .results-score-table .member-badge,
  body[data-page="standings"] .standings-score-table .member-badge {
    align-items: center;
    border-radius: 50%;
    display: inline-flex;
    flex: 0 0 1.15rem;
    font-size: 0 !important;
    height: 1.15rem;
    justify-content: center;
    margin: 0;
    overflow: hidden;
    padding: 0 !important;
    vertical-align: middle;
    width: 1.15rem !important;
  }

  body[data-page="results"] .results-score-table .member-badge::after,
  body[data-page="standings"] .standings-score-table .member-badge::after {
    content: "M";
    font-size: 0.58rem;
    font-weight: 950;
    line-height: 1;
  }

  body[data-page="results"] .results-score-table .pins-from-cut-cell,
  body[data-page="standings"] .standings-score-table .pins-from-cut-cell {
    line-height: 1 !important;
    white-space: normal !important;
  }

  body[data-page="results"] .results-score-table .pins-from-cut-cell span,
  body[data-page="results"] .results-score-table .pins-from-cut-cell small,
  body[data-page="standings"] .standings-score-table .pins-from-cut-cell span,
  body[data-page="standings"] .standings-score-table .pins-from-cut-cell small {
    display: block;
    line-height: 1 !important;
    margin: 0;
    white-space: nowrap;
  }

  body[data-page="results"] .results-score-table > tbody > .team-result-detail[hidden] {
    display: none !important;
  }

  body[data-page="results"] .results-score-table > tbody > .team-result-detail:not([hidden]) {
    display: table-row !important;
  }

  body[data-page="results"] .results-score-table > tbody > .team-result-detail > td {
    display: table-cell !important;
    padding: 0.65rem !important;
  }

  body[data-page="results"] .results-score-table .team-result-members,
  body[data-page="results"] .results-score-table .swiss-points-summary {
    overflow: hidden;
  }

  body[data-page="results"] .swiss-results-table th:first-child,
  body[data-page="results"] .swiss-results-table td:first-child {
    width: 2.5rem !important;
  }

  body[data-page="results"] .swiss-results-table th:nth-child(2),
  body[data-page="results"] .swiss-results-table td:nth-child(2) {
    padding-left: 0.28rem !important;
    text-align: left !important;
    width: 13rem !important;
  }

  body[data-page="results"] .swiss-results-table th:nth-child(n + 3),
  body[data-page="results"] .swiss-results-table td:nth-child(n + 3) {
    text-align: center !important;
    width: 3rem !important;
  }

  body[data-page="results"] .swiss-results-table .team-result-toggle {
    font-size: inherit;
    max-width: 100%;
    overflow: hidden;
  }

  body[data-page="results"] .swiss-results-table .swiss-team-expanded-table-wrap {
    overflow: hidden;
  }

  body[data-page="results"] .swiss-results-table .swiss-team-expanded-table {
    display: table !important;
    font-size: 0.82rem !important;
    min-width: 0 !important;
    table-layout: fixed !important;
    width: 100% !important;
  }
}

/* Keep a doubles pair together; the table fitter measures its full name width. */
.doubles-standings-table .doubles-team-name {
  align-items: center;
  display: inline-flex;
  flex-wrap: nowrap;
  gap: 0.25em;
  max-width: none;
  white-space: nowrap;
  width: max-content;
}

body[data-page="results"] .doubles-standings-table .doubles-team-name .results-bowler-label,
body[data-page="results"] .doubles-standings-table .doubles-team-name .results-bowler-name-text {
  display: inline-flex !important;
  flex: none;
  max-width: none;
  overflow: visible !important;
  overflow-wrap: normal !important;
  white-space: nowrap !important;
  width: auto;
}

body[data-page="results"] .results-score-table.doubles-standings-table > thead > tr > th:nth-child(3),
body[data-page="results"] .results-score-table.doubles-standings-table > tbody > tr > td:nth-child(3),
body[data-page="standings"] .standings-score-table.doubles-standings-table > thead > tr > th:nth-child(3),
body[data-page="standings"] .standings-score-table.doubles-standings-table > tbody > tr > td:nth-child(3) {
  min-width: var(--doubles-name-width, 26rem) !important;
  overflow-wrap: normal !important;
  white-space: nowrap !important;
  width: var(--doubles-name-width, 26rem) !important;
}


/* Override the older KSBO mobile cards only inside the fitted standings canvas. */
@media screen and (max-width:780px) {
  .mobile-standings-canvas table { min-width:0 !important; }
  :is(#eventResultsTable,#eventStandingsTable) > :is(thead,tbody) > tr > :is(th,td):last-child { width:5.5rem !important; }
  body[data-page="results"] .mobile-standings-canvas #resultsHead { display:table-header-group !important; }
  body[data-page="results"] .mobile-standings-canvas #resultsBody { display:table-row-group !important; }
  #eventResultsTable #resultsBody > tr:not([hidden]) { display:table-row !important; }
  #eventResultsTable #resultsBody > tr[hidden] { display:none !important; }
  #eventResultsTable #resultsBody > tr > td {
    display:table-cell !important; min-height:0 !important; padding:.48rem .3rem !important;
    font-size:inherit !important; line-height:1.1 !important; background:transparent !important;
    border-radius:0 !important; text-align:center !important; white-space:nowrap !important;
  }
  #eventResultsTable #resultsBody > tr > td::before { content:none !important; }
  /* Hide the photo cells as well as their heading so every score stays under its column. */
  #eventResultsTable #resultsHead > tr > .results-photo-head,
  #eventResultsTable #resultsBody > tr > .results-photo-cell,
  #eventStandingsTable #standingsHead > tr > .standings-photo-head,
  #eventStandingsTable #standingsBody > tr > .standings-photo-cell { display:none !important; }
  #eventResultsTable #resultsBody > tr > td.swiss-team-name { text-align:left !important; }
  #eventResultsTable #resultsBody .swiss-round-cell strong,
  #eventResultsTable #resultsBody .swiss-round-cell small { font-size:inherit; line-height:1.1; }
  #eventResultsTable #resultsBody .swiss-round-cell strong::after,
  #eventResultsTable #resultsBody .swiss-round-cell small::after { content:none; }
  #eventResultsTable #resultsBody .swiss-team-name .team-result-toggle { min-height:0; gap:.2rem; font-size:inherit; }
  #eventResultsTable #resultsBody .swiss-team-name .team-result-toggle span { font-size:.7rem; line-height:1.1; }
  body[data-page="results"] .mobile-standings-canvas .swiss-member-results { display:table !important; width:100% !important; }
  body[data-page="results"] .mobile-standings-canvas .swiss-member-results > thead { display:table-header-group !important; }
  body[data-page="results"] .mobile-standings-canvas .swiss-member-results > tbody { display:table-row-group !important; }
  body[data-page="results"] .mobile-standings-canvas .swiss-member-results > tbody > tr { display:table-row !important; }
  body[data-page="results"] .mobile-standings-canvas .swiss-member-results > tbody > tr > td { display:table-cell !important; }
  body[data-page="results"] .mobile-standings-canvas .swiss-member-results td::before { content:none !important; }
  .mobile-standings-canvas .results-bowler-name-text { max-width:100%; }
}
@media print {
  .mobile-standings-view { display:none !important; }
  .mobile-standings-canvas { transform:none !important; width:auto !important; }
  .table-wrap:has(.mobile-standings-canvas) { height:auto !important; overflow:visible !important; }
}

.mobile-standings-view { display:none; }
.doubles-member-scores { display:grid; gap:.6rem; text-align:left; white-space:normal; }
.doubles-member-score { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:.5rem 1rem; padding:.8rem; border:1px solid #47414b; border-radius:6px; background:#201a22; }
.doubles-member-name { min-width:0; overflow-wrap:anywhere; font-size:1rem; }
.doubles-member-total { color:#c4c9d2; font-size:.85rem; }
.doubles-member-total b { color:#ffd056; margin-left:.4rem; }
.doubles-member-games { display:flex; flex-wrap:wrap; gap:.6rem 1.1rem; grid-column:1/-1; }
.doubles-member-games > span { display:flex; align-items:baseline; gap:.4rem; }
.doubles-member-games small { color:#c4c9d2; font-size:.75rem; }
.doubles-member-games b { color:#fff; font-size:1rem; }
.doubles-member-match-play { display:grid; gap:.5rem; grid-column:1/-1; border-top:1px solid #47414b; padding-top:.6rem; }
@media screen and (max-width:780px) {
  #eventStandingsTable #standingsBody > tr[hidden] { display:none !important; }
  .mobile-standings-view { display:flex; gap:.4rem; margin:.8rem 0; }
  .mobile-standings-view button { flex:1; min-height:44px; padding:.6rem; border:1px solid #555; border-radius:6px; background:#14151b; color:#fff; font-family:inherit; font-size:.9rem; line-height:1.2; font-weight:700; }
  .mobile-standings-view button[aria-pressed="true"] { border-color:#ff3340; background:#42151c; }
  body.mobile-standings-readable .mobile-standings-canvas { width:100% !important; transform:none !important; }
  body.mobile-standings-readable :is(#eventResultsTable,#eventStandingsTable) { display:block !important; width:100% !important; min-width:0 !important; font-size:1rem !important; }
  body.mobile-standings-readable :is(#eventResultsTable,#eventStandingsTable) > :is(colgroup,thead) { display:none !important; }
  body.mobile-standings-readable :is(#eventResultsTable,#eventStandingsTable) > :is(#resultsHead,#standingsHead) { display:none !important; }
  body.mobile-standings-readable :is(#eventResultsTable,#eventStandingsTable) :is(#resultsBody,#standingsBody) { display:block !important; width:100%; }
  body.mobile-standings-readable :is(#eventResultsTable,#eventStandingsTable) :is(#resultsBody,#standingsBody) > tr:not([hidden]) {
    position:relative; display:flex !important; flex-wrap:wrap;
    gap:.5rem 0 !important; margin:0 0 .6rem; padding:.8rem .5rem !important; width:100%; box-sizing:border-box;
    background:#171920 !important; border:1px solid #383b45 !important; border-radius:8px !important;
  }
  body.mobile-standings-readable :is(#eventResultsTable,#eventStandingsTable) :is(#resultsBody,#standingsBody) > tr > td {
    display:flex !important; flex:0 0 25%; box-sizing:border-box; flex-direction:column; align-items:center; justify-content:flex-start; grid-column:auto !important; order:3 !important;
    min-width:0 !important; width:auto !important; padding:0 !important; min-height:0 !important; border:0 !important;
    background:transparent !important; white-space:normal !important; overflow-wrap:anywhere !important; text-align:center !important; font-size:1rem !important; line-height:1.25 !important;
  }
  body.mobile-standings-readable :is(#eventResultsTable,#eventStandingsTable) :is(#resultsBody,#standingsBody) > tr::before,
  body.mobile-standings-readable :is(#eventResultsTable,#eventStandingsTable) :is(#resultsBody,#standingsBody) > tr::after { content:''; flex:0 0 100%; height:0; order:2; }
  body.mobile-standings-readable :is(#eventResultsTable,#eventStandingsTable) :is(#resultsBody,#standingsBody) > tr::after { order:2; }
  body.mobile-standings-readable :is(#eventResultsTable,#eventStandingsTable) :is(#resultsBody,#standingsBody) > tr > td::before {
    content:attr(data-mobile-label) !important; display:block !important; font:600 .65rem/1.3 "Segoe UI",Arial,sans-serif !important; color:#b9bec9; margin-bottom:.15rem; white-space:normal;
  }
  body.mobile-standings-readable :is(#eventResultsTable,#eventStandingsTable) :is(#resultsBody,#standingsBody) > tr > td[data-mobile-role="photo"] { display:none !important; }
  body.mobile-standings-readable :is(#eventResultsTable,#eventStandingsTable) :is(#resultsBody,#standingsBody) > tr > td[data-mobile-role="message"] { flex-basis:100%; }
  body.mobile-standings-readable :is(#eventResultsTable,#eventStandingsTable) :is(#resultsBody,#standingsBody) > tr > td[data-mobile-role="rank"] { position:absolute; top:.8rem; left:.55rem; color:#ffd056; font-weight:800; }
  body.mobile-standings-readable :is(#eventResultsTable,#eventStandingsTable) :is(#resultsBody,#standingsBody) > tr > td[data-mobile-role="name"] { flex-basis:100%; grid-column:1/-1 !important; order:0 !important; align-items:flex-start; padding-left:1.8rem !important; text-align:left !important; font-weight:750; }
  body.mobile-standings-readable :is(#eventResultsTable,#eventStandingsTable) :is(#resultsBody,#standingsBody) > tr > td:is([data-mobile-role="rank"],[data-mobile-role="name"])::before { display:none !important; }
  body.mobile-standings-readable :is(#eventResultsTable,#eventStandingsTable) :is(#resultsBody,#standingsBody) > tr > td[data-mobile-role="summary"] { flex-basis:33.333%; order:1 !important; font-size:.95rem !important; font-weight:750; color:#ffd056 !important; text-decoration:none !important; }
  body.mobile-standings-readable :is(#eventResultsTable,#eventStandingsTable) :is(#resultsBody,#standingsBody) > tr > td[data-mobile-role="summary"]::before { text-decoration:none !important; }
  body.mobile-standings-readable :is(#eventResultsTable,#eventStandingsTable) :is(#resultsBody,#standingsBody) > tr > td[data-mobile-role="game"] { flex-basis:var(--mobile-game-width,25%); order:2 !important; }
  body.mobile-standings-readable :is(#eventResultsTable,#eventStandingsTable) :is(#resultsBody,#standingsBody) > tr > td[data-mobile-new-line="true"] { grid-column:1 !important; }
  body.mobile-standings-readable :is(#eventResultsTable,#eventStandingsTable) :is(#resultsBody,#standingsBody) > tr > td[data-mobile-role="detail"] { font-size:.8rem !important; color:#c4c9d2; }
  body.mobile-standings-readable #eventResultsTable #resultsBody .team-result-toggle,
  body.mobile-standings-readable #eventResultsTable #resultsBody .results-bowler-name-text { white-space:normal !important; text-overflow:initial; overflow-wrap:anywhere; font-size:1rem; line-height:1.3; text-transform:none; }
  body.mobile-standings-readable #eventResultsTable #resultsBody .swiss-round-cell small { font-size:.7rem; color:#b9bec9; }
  body.mobile-standings-readable #eventResultsTable #resultsBody > tr.team-result-detail:not([hidden]) { display:block !important; }
  body.mobile-standings-readable #eventResultsTable #resultsBody > tr.team-result-detail > td { display:block !important; }
  body.mobile-standings-readable #eventResultsTable #resultsBody > tr.team-result-detail > td::before { display:none !important; }
  body.mobile-standings-readable #eventStandingsTable #standingsBody > tr.team-result-detail:not([hidden]),
  body.mobile-standings-readable #eventStandingsTable #standingsBody > tr.team-result-detail > td { display:block !important; }
  body.mobile-standings-readable #eventStandingsTable #standingsBody > tr.team-result-detail > td::before { display:none !important; }
  body.mobile-standings-readable .doubles-member-score { grid-template-columns:minmax(0,1fr); gap:.5rem; padding:.7rem; }
  body.mobile-standings-readable .doubles-member-games { gap:.5rem; }
  body.mobile-standings-readable .doubles-member-games > span { flex:0 0 calc(33.333% - .5rem); flex-direction:column; gap:.1rem; }
  body.mobile-standings-readable #eventStandingsTable .team-result-toggle { font-size:1rem; white-space:normal; overflow-wrap:anywhere; }
  body.mobile-standings-readable #eventResultsTable #resultsBody .swiss-member-results { display:block !important; }
  body.mobile-standings-readable #eventResultsTable #resultsBody .swiss-member-results > thead { display:none !important; }
  body.mobile-standings-readable #eventResultsTable #resultsBody .swiss-member-results > tbody { display:block !important; }
  body.mobile-standings-readable #eventResultsTable #resultsBody .swiss-member-results > tbody > tr { display:grid !important; grid-template-columns:repeat(4,minmax(0,1fr)) !important; }
  body.mobile-standings-readable #eventResultsTable #resultsBody .swiss-member-results > tbody > tr > td { display:flex !important; flex-direction:column; }
  body.mobile-standings-readable #eventResultsTable #resultsBody .swiss-member-results > tbody > tr > td::before { display:block !important; content:attr(data-label) !important; color:#b9bec9; font-size:.65rem; }
  body.mobile-standings-readable #eventResultsTable #resultsBody .swiss-member-results > tbody > tr > td:first-child::before { display:none !important; }
}
