/* W257 route-owned overflow containment. Shared styles remain unchanged. */

/* Grid children must shrink to the dialog before their table can overflow.
   Otherwise the viewport clips a wide child with no scrollable overflow. */
.race-detail-modal .modal-panel > *,
.race-detail-modal .summary-box,
.race-detail-modal .result-rows {
  min-width: 0;
  max-width: 100%;
}
.race-detail-modal .table-wrap {
  width: 100%;
  max-width: 100%;
  overflow: auto;
  touch-action: pan-x pan-y;
}
.race-detail-modal .result-rows table {
  min-width: 860px;
}

.route-leagues .main-feature-row--leagues,
.route-leagues .main-feature-row--leagues > *,
.route-leagues .leagues-main,
.route-leagues .leagues-main > *,
.route-leagues .leagues-main .card,
.route-leagues .race-detail-scroll,
.route-leagues .result-rows {
  min-width: 0;
  max-width: 100%;
}

.route-leagues .leagues-main {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.route-leagues .race-detail-scroll {
  overflow-x: hidden;
}

.route-leagues .result-rows .table-wrap {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  overflow-x: auto;
}

.route-leagues .leagues-annotated-upper-layout {
  display: grid;
  grid-template-columns: minmax(0, var(--non-home-feature-width)) minmax(var(--non-home-support-min), 1fr);
  gap: clamp(16px, 2.4vw, 28px);
  align-items: stretch;
  width: 100%;
  min-width: 0;
  margin: 0 0 18px;
}

.route-leagues .leagues-annotated-column {
  display: grid;
  grid-template-rows: auto minmax(176px, 1fr);
  gap: 18px;
  align-content: stretch;
  min-width: 0;
  min-height: 0;
}

.route-leagues .leagues-annotated-column > .page-feature-hero,
.route-leagues .leagues-annotated-column > .leagues-control-panel {
  min-width: 0;
  min-height: 0;
  margin-bottom: 0;
}

@media (min-width: 981px) {
  .route-leagues .leagues-annotated-column > .page-feature-hero {
    height: var(--non-home-feature-height);
    min-height: var(--non-home-feature-height);
  }

  .route-leagues .leagues-annotated-column > .leagues-control-panel {
    min-height: var(--non-home-feature-height);
  }
}

.route-leagues .leagues-ad-navigation-band {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: stretch;
  gap: 14px;
  width: 100%;
  min-width: 0;
  min-height: 176px;
}

.route-leagues .leagues-ad-navigation-band > .league-actions {
  align-self: center;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  justify-content: stretch;
  min-width: 0;
  margin: 0;
}

.route-leagues .league-actions .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-width: 0;
  height: 58px;
  min-height: 58px;
  max-height: 58px;
  padding: 11px 10px;
  text-align: center;
  line-height: 1.2;
  white-space: normal;
  overflow-wrap: anywhere;
}

@media (max-width: 1600px) {
  .route-leagues .leagues-ad-navigation-band > .league-actions {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.route-leagues .leagues-annotated-column--controls > .leagues-ad-slot--upper-right {
  width: 100%;
  height: 100%;
  min-height: 176px;
}

.route-leagues .leagues-ad-slot {
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-width: 0;
  min-height: 108px;
  margin: 0;
  padding: 10px 12px;
  border: 1px solid rgba(244, 189, 89, .34);
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(26, 37, 40, .92), rgba(18, 48, 54, .82));
  box-shadow: 0 10px 24px rgba(0, 0, 0, .18);
  overflow: hidden;
}

.route-leagues .leagues-ad-slot[hidden] {
  display: none !important;
  width: 0 !important;
  min-width: 0 !important;
  height: 0 !important;
  min-height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden !important;
  border: 0 !important;
}

.route-leagues .leagues-ad-slot[data-ad-state="placeholder"] {
  contain: layout paint;
}

.route-leagues .leagues-ad-slot__label {
  display: block;
  margin-bottom: 6px;
  color: rgba(212, 221, 221, .78);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .12em;
  line-height: 1.2;
  text-transform: uppercase;
}

.route-leagues .leagues-ad-slot__container {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 970px;
  min-width: 0;
  min-height: 90px;
  overflow: hidden;
}

.route-leagues .leagues-ad-slot__container > * {
  max-width: 100%;
}

.route-leagues .leagues-ad-slot__note {
  display: block;
  width: 100%;
  color: rgba(212, 221, 221, .78);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .03em;
  line-height: 1.35;
  text-align: center;
}

.route-leagues .leagues-route-content-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  align-items: start;
  width: 100%;
  min-width: 0;
  margin: 0 0 16px;
}

.route-leagues .leagues-route-functional-content,
.route-leagues .leagues-driver-directory-layout {
  min-width: 0;
  max-width: 100%;
}

.route-leagues .leagues-driver-directory-layout > .driver-layout {
  min-width: 0;
  max-width: 100%;
}

.route-leagues .leagues-driver-directory-layout > .driver-layout > .card {
  min-width: 0;
  max-width: 100%;
  margin: 0;
}

.route-leagues .leagues-driver-directory-layout .driver-list {
  min-width: 0;
  max-width: 100%;
}

.route-leagues .leagues-route-right-rail {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  align-content: start;
  align-self: start;
  min-width: 0;
  max-width: 100%;
}

.route-leagues .leagues-route-right-rail .leagues-ad-slot {
  width: 100%;
  min-width: 0;
  height: 250px;
  min-height: 250px;
  max-height: 250px;
  margin: 0;
}

.route-leagues .leagues-route-right-rail .leagues-ad-slot__container {
  min-height: 180px;
}

.route-leagues .leagues-route-right-rail[hidden] {
  display: none !important;
}

.route-leagues .leagues-ad-inline-anchor {
  display: none;
}

.route-leagues .leagues-analysis-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  width: 100%;
  min-width: 0;
  max-width: none;
  align-items: start;
}

.route-leagues .leagues-analysis-layout > .card {
  width: 100%;
  min-width: 0;
  max-width: none;
  margin: 0;
}

.route-leagues .leagues-analysis-table,
.route-leagues .leagues-analysis-table .table-wrap {
  width: 100%;
  min-width: 0;
  max-width: 100%;
}

.route-leagues .leagues-table-navigation {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin: 0 0 8px;
}

.route-leagues .leagues-table-navigation > span {
  margin-right: auto;
  color: var(--muted);
  font-size: 12px;
}

.route-leagues .leagues-table-navigation .btn {
  min-height: 38px;
  white-space: nowrap;
}

.route-leagues .leagues-ad-presentation-row,
.route-leagues .leagues-ad-presentation-row:hover {
  background: transparent;
}

.route-leagues .leagues-ad-presentation-row > td {
  padding: 10px 0;
  border: 0;
}

/* Match the accepted Hub side-bank geometry while keeping the Leagues rail in
   normal document flow until the complete bank can safely remain sticky. */
@media (min-width: 1840px) and (max-width: 1999px) {
  .route-leagues .leagues-route-content-layout {
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 16px;
  }

  .route-leagues .leagues-route-functional-content {
    margin-right: -66px;
  }

  .route-leagues .leagues-route-right-rail {
    width: 300px;
    gap: 20px;
    transform: translateX(32px);
  }
}

@media (min-width: 1840px) and (max-width: 1999px) and (min-height: 982px) {
  .route-leagues .leagues-route-right-rail {
    position: sticky;
    top: 160px;
  }
}

@media (min-width: 2000px) and (max-width: 2199px) {
  .route-leagues .leagues-route-content-layout {
    grid-template-columns: minmax(0, 1fr) clamp(300px, calc(50vw - 652px), 520px);
    gap: 16px;
  }

  .route-leagues .leagues-route-functional-content {
    margin-right: -60px;
  }

  .route-leagues .leagues-route-right-rail {
    width: clamp(300px, calc(50vw - 652px), 520px);
    gap: 20px;
    transform: translateX(30px);
  }
}

@media (min-width: 2000px) and (max-width: 2199px) and (min-height: 982px) {
  .route-leagues .leagues-route-right-rail {
    position: sticky;
    top: 160px;
  }
}

@media (min-width: 2200px) {
  .route-leagues .leagues-route-content-layout {
    grid-template-columns: minmax(0, 1fr) clamp(300px, calc(50vw - 652px), 520px);
    gap: 94px;
  }

  .route-leagues .leagues-route-right-rail {
    width: clamp(300px, calc(50vw - 652px), 520px);
    gap: 20px;
    transform: translateX(clamp(-24px, calc(146.667px - 6.6667vw), 0px));
  }

  .route-leagues .leagues-route-right-rail .leagues-ad-slot {
    height: 280px;
    min-height: 280px;
    max-height: 280px;
  }
}

@media (min-width: 2200px) and (min-height: 1072px) {
  .route-leagues .leagues-route-right-rail {
    position: sticky;
    top: 160px;
  }
}

@media (min-width: 1840px) and (min-height: 982px) {
  .route-leagues .leagues-route-right-rail {
    align-self: start;
    max-height: calc(100vh - 176px);
  }
}

@media (max-width: 980px) {
  .route-leagues .leagues-main {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 1200px) {
  .route-leagues .leagues-annotated-upper-layout {
    grid-template-columns: minmax(0, 1fr) minmax(360px, 600px);
  }

  .route-leagues .leagues-ad-navigation-band {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
  }

  .route-leagues .leagues-ad-navigation-band > .leagues-ad-slot,
  .route-leagues .leagues-ad-navigation-band > .league-actions {
    width: 100%;
  }

  .route-leagues .leagues-ad-navigation-band > .league-actions {
    align-self: stretch;
  }
}

@media (max-width: 980px) {
  .route-leagues .leagues-annotated-upper-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .route-leagues .leagues-annotated-column {
    grid-template-rows: auto auto;
    gap: 14px;
  }

  .route-leagues .leagues-ad-navigation-band {
    grid-template-columns: minmax(0, 1fr);
    min-height: 0;
  }

  .route-leagues .leagues-ad-navigation-band > .leagues-ad-slot {
    min-height: 136px;
    max-width: 100%;
  }

  .route-leagues .leagues-annotated-column--controls > .leagues-ad-slot--upper-right {
    min-height: 176px;
  }

  .route-leagues .leagues-route-content-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .route-leagues .leagues-route-right-rail {
    position: static;
    top: auto;
    max-height: none;
    grid-template-columns: minmax(0, 1fr);
    align-self: auto;
  }
}

@media (max-width: 767px) {
  .route-leagues .leagues-ad-slot {
    min-height: 108px;
    margin-bottom: 0;
    padding: 8px;
  }

  .route-leagues .leagues-ad-navigation-band {
    gap: 10px;
    margin-bottom: 14px;
  }

  .route-leagues .leagues-ad-slot__container {
    min-height: 100px;
  }

  .route-leagues .leagues-route-right-rail {
    gap: 12px;
  }

  .route-leagues .leagues-route-right-rail .leagues-ad-slot {
    height: 250px;
    min-height: 250px;
    max-height: 250px;
  }

  .route-leagues .leagues-table-navigation {
    position: sticky;
    top: 4px;
    z-index: 8;
    justify-content: flex-start;
    padding: 6px;
    border: 1px solid rgba(100, 115, 122, .7);
    border-radius: 7px;
    background: rgba(17, 25, 27, .96);
  }

  .route-leagues .leagues-table-navigation > span {
    max-width: 42%;
    font-size: 11px;
  }

  .route-leagues .leagues-table-navigation .btn {
    flex: 0 0 auto;
    min-height: 42px;
    padding: 8px 9px;
  }

  .route-leagues .leagues-analysis-table .table-wrap {
    overflow-x: visible;
    border: 0;
  }

  .route-leagues .leagues-analysis-table table {
    width: 100%;
    min-width: 0;
    table-layout: fixed;
  }

  .route-leagues .leagues-analysis-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;
  }

  .route-leagues .leagues-analysis-table tbody {
    display: grid;
    gap: 10px;
  }

  .route-leagues .leagues-analysis-table tbody > tr:not(.leagues-ad-presentation-row) {
    display: grid;
    gap: 0;
    padding: 8px 12px;
    border: 1px solid rgba(100, 115, 122, .8);
    border-radius: 8px;
    background: rgba(36, 49, 55, .8);
  }

  .route-leagues .leagues-analysis-table tbody > tr:not(.leagues-ad-presentation-row) > td {
    display: grid;
    grid-template-columns: minmax(96px, 34%) minmax(0, 1fr);
    gap: 10px;
    min-width: 0;
    padding: 7px 0;
    border: 0;
    overflow-wrap: anywhere;
    font-size: 14px;
    line-height: 1.4;
  }

  .route-leagues .leagues-analysis-table tbody > tr:not(.leagues-ad-presentation-row) > td::before {
    content: attr(data-label);
    color: var(--muted);
    font-weight: 850;
  }

  .route-leagues .leagues-analysis-table tbody > .leagues-ad-presentation-row {
    display: block;
  }

  .route-leagues .leagues-analysis-table tbody > .leagues-ad-presentation-row > td {
    display: block;
    width: 100%;
    padding: 0;
  }

  .route-leagues .leagues-analysis-table .leagues-ad-slot {
    height: 250px;
    min-height: 250px;
    max-height: 250px;
  }

  .route-leagues .leagues-route-functional-content > .card,
  .route-leagues .leagues-analysis-layout > .card {
    width: 100%;
    min-width: 0;
  }
}

/* Task265: list-only centered width; dialogs, ads and analysis tables retain their own sizing. */
.route-leagues .leagues-route-functional-content .leagues-list-width,
.route-drivers .leagues-list-width { width: 100%; max-width: 960px; min-width: 0; margin-inline: auto; box-sizing: border-box; }
.leagues-list-width .driver-filters { width: 100%; }

/* TL-OD-05: current driver metadata stays with its name, including on phones. */
.driver-odds-team { display:block; white-space:normal; overflow-wrap:anywhere; }
.prediction-table-scroll details p { white-space:normal; overflow-wrap:anywhere; }

/* Expanded racing guidance stays readable. */
.prediction-table-scroll details { min-width:0; max-width:100%; }

/* TL-OD-14: keep the seven Driver Odds columns readable on phones.
   The bounded table scrolls horizontally without reducing number legibility. */
.route-leagues .leagues-analysis-table .prediction-table-scroll {
  overflow-x: auto;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
}
.route-leagues .leagues-analysis-table .prediction-table-scroll table {
  width: 100%;
  min-width: 820px;
  table-layout: fixed;
  font-size: 14px;
}
.route-leagues .prediction-table-scroll thead {
  display: table-header-group;
  position: static;
  width: auto;
  height: auto;
  margin: 0;
  overflow: visible;
  clip: auto;
  white-space: normal;
}
.route-leagues .prediction-table-scroll tbody { display: table-row-group; }
.route-leagues .leagues-analysis-table .prediction-table-scroll tbody > .leagues-ad-presentation-row { display: table-row; }
.route-leagues .leagues-analysis-table .prediction-table-scroll tbody > .leagues-ad-presentation-row > td { display: table-cell; }
.route-leagues .leagues-analysis-table .prediction-table-scroll tbody > tr:not(.leagues-ad-presentation-row) {
  display: table-row;
  padding: 0;
  border: 0;
  border-radius: 0;
}
.route-leagues .leagues-analysis-table .prediction-table-scroll tbody > tr:not(.leagues-ad-presentation-row) > td {
  display: table-cell;
  padding: 9px 7px;
  font-size: 14px;
  line-height: 1.4;
  vertical-align: top;
}
.route-leagues .leagues-analysis-table .prediction-table-scroll td::before { display: none; content: none; }
.route-leagues .prediction-table-scroll th { padding: 9px 7px; font-size: 13px; line-height: 1.3; }
.route-leagues .leagues-analysis-table .prediction-table-scroll table.data-table tbody > tr:not(.leagues-ad-presentation-row) > td:nth-child(n+3):nth-child(-n+6) { white-space: nowrap; }
.route-leagues .prediction-table-scroll summary { min-height: 44px; display: flex; align-items: center; }

/* Driver Odds explanations wrap within their cell on narrow touch displays. */
.route-leagues .prediction-table-scroll details p { line-height:1.5; }
.route-leagues .prediction-table-scroll summary { white-space:normal; overflow-wrap:anywhere; cursor:pointer; }
/* RN-S: Full-season navigation and touch targets; existing race details remain the row action. */
body.route-leagues:not(.modal-scroll-lock) { overflow-x:clip; overflow-y:visible; }
.route-leagues .leagues-main[data-schedule-popup-only] { display:block; }
.route-leagues .leagues-main[data-schedule-popup-only] > .card { position:static; }
.race-shortcuts { position:sticky; top:calc(var(--race-header,128px) + 8px); z-index:4; padding:12px; margin:0 0 12px; border:1px solid var(--line, #344653); border-radius:12px; background:var(--panel, #14212b); min-width:0; }
.race-shortcuts .toolbar { display:flex; flex-wrap:wrap; gap:8px; }
.race-shortcuts button { min-height:44px; white-space:normal; }
.race-shortcuts p { margin:8px 0 0; font-size:.85rem; line-height:1.4; overflow-wrap:anywhere; }
.leagues-main .race-row { scroll-margin-top:150px; min-height:60px; text-align:left; min-width:0; width:100%; overflow-wrap:anywhere; }
.leagues-main .race-row[data-rn-target]:focus-visible { outline:3px solid var(--accent, #46dbc6); outline-offset:3px; }
.leagues-main .race-row span { white-space:normal; line-height:1.5; }
@media(max-width:650px) { .race-shortcuts { padding:10px; } .race-shortcuts .toolbar { gap:6px; } .race-shortcuts button { flex:1 1 100px; padding:10px 8px; } }

/* SECTION: Narrow-screen future calendar readability. */
.future-schedule-note{line-height:1.5;overflow-wrap:anywhere;margin:1rem 0 0}.race-row>span{white-space:normal;overflow-wrap:anywhere;line-height:1.5}.leagues-control-panel select{min-height:44px;max-width:100%}

/* SECTION: SB selected event and chronological controls, without automatic list scrolling. */
.selected-race-panel{position:static;max-width:100%;min-width:0}
.selected-race-panel>.toolbar{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px}
.selected-race-panel .toolbar button{min-width:0;min-height:44px;padding:10px 8px;white-space:normal;overflow-wrap:anywhere;text-align:center}
.selected-race-panel button[aria-disabled="true"]{opacity:.58;cursor:default}
.selected-race-panel button:focus-visible{outline:3px solid var(--accent,#46dbc6);outline-offset:3px}
.selected-race-panel h3{font-size:1.15rem;line-height:1.4;margin:8px 0;overflow-wrap:anywhere}
.selected-race-panel p{line-height:1.5;overflow-wrap:anywhere}
.selected-race-kicker{font-weight:700;letter-spacing:.04em;text-transform:uppercase}
.selected-race-panel #selected-race-content{min-width:0;padding-top:8px}
@media(max-width:650px){.selected-race-panel>.toolbar{gap:6px}.selected-race-panel .toolbar button{font-size:.85rem;padding:10px 5px}}
