/* Page-specific layout adjustments for tablets and phones. */
.standings-scroll-hint { display: none; }
.season-picker { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.season-picker select { min-height: 32px; padding: 5px 28px 5px 9px; border: 1px solid #d5e2db; border-radius: 8px; background: #fff; color: #263e34; font: 700 11px Manrope, sans-serif; cursor: pointer; }
.season-picker select:disabled { opacity: .65; cursor: wait; }
.standings-layout.is-history { grid-template-columns: 200px minmax(0, 1fr) 300px !important; }
.standings-layout.is-history .standing-content { grid-column: 2 !important; }
.standings-layout.is-history .fixtures-panel { display: none !important; }
.standings-layout.is-history .scorers-panel { display: block !important; grid-column: 3 !important; grid-row: 1 !important; }
#stats-season-source { margin: 9px 15px 13px; color: #667988; font: 700 10px Manrope,sans-serif; }
@media (max-width: 1100px) {
  .standings-layout.is-history { grid-template-columns: minmax(0, 1fr) !important; }
  .standings-layout.is-history .standing-content { grid-column: 1 !important; }
  .standings-layout.is-history .scorers-panel { grid-column: 1 !important; grid-row: auto !important; }
}

@media (max-width: 1100px) {
  .standings-page {
    width: calc(100% - 32px) !important;
    max-width: 100% !important;
    min-width: 0;
    padding-left: 0 !important;
    padding-right: 0 !important;
  }

  .standings-layout {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 16px;
  }

  .standings-layout > * { min-width: 0; }
  .league-menu, .standing-content { grid-column: 1 / -1 !important; }
  .league-menu { position: static; top: auto; }
  .fixtures-panel, .scorers-panel {
    grid-column: auto !important;
    grid-row: auto !important;
    width: 100%;
  }
}

@media (max-width: 700px) {
  .standings-page {
    width: calc(100% - 24px) !important;
    padding-top: 16px;
    padding-bottom: 36px;
  }

  .standings-layout {
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 14px;
    margin-top: 0;
  }

  .standings-layout > * { grid-column: 1 !important; }
  .league-menu, .standing-content, .fixtures-panel, .scorers-panel {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
    border-radius: 12px;
  }

  .league-menu {
    max-height: min(38vh, 300px);
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    white-space: normal;
    padding: 12px 8px;
  }
  .league-menu > p { display: block; margin: 2px 10px 10px; }
  .league-search { position: sticky; top: 0; z-index: 3; margin-bottom: 8px; background: #f8faf9; }
  .league-menu #league-list {
    display: block !important;
    grid-template-columns: none !important;
    min-width: 0;
    overflow-x: hidden !important;
  }
  .league-menu .continent { width: 100%; min-width: 0 !important; }
  .continent > summary, .country > summary { min-height: 40px; box-sizing: border-box; }
  .league-button { min-height: 40px; width: 100%; box-sizing: border-box; }

  .standing-heading { gap: 10px; padding: 16px 14px; }
  .league-brand, .league-brand > div { min-width: 0; }
  .league-brand { gap: 9px; }
  .league-brand img { width: 36px; height: 36px; flex: 0 0 36px; }
  .league-brand h2 { font-size: 16px; line-height: 1.25; overflow-wrap: anywhere; }
  #refresh { flex: 0 0 auto; min-height: 38px; padding: 7px 9px; }
  .standing-meta { gap: 6px 12px; flex-wrap: wrap; padding: 10px 14px; line-height: 1.4; }
  .standing-meta span { min-width: 0; }

  .standings-scroll-hint {
    display: block;
    margin: 0;
    padding: 8px 14px;
    color: #607586;
    background: #f7faf8;
    font-size: 10px;
    font-weight: 700;
  }
  .standings-table-wrap {
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
  }
  .full-standings { min-width: 760px; }
  .full-standings th, .full-standings td { white-space: nowrap; }
  .full-standings th:first-child, .full-standings td:first-child {
    position: sticky;
    left: 0;
    width: 36px;
    min-width: 36px;
    background: #fff;
    z-index: 2;
  }
  .full-standings th:nth-child(2), .full-standings td:nth-child(2) {
    position: sticky;
    left: 36px;
    width: 158px;
    min-width: 158px;
    max-width: 158px;
    background: #fff;
    z-index: 2;
    box-shadow: 7px 0 10px -10px #38536a;
  }
  .full-standings th:first-child, .full-standings th:nth-child(2) {
    background: #fbfcfd;
    z-index: 3;
  }
  .full-standings .team { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
  .full-standings .team img, .full-standings .team-fallback { flex: 0 0 23px; width: 23px; height: 23px; }
  .table-legend { padding: 12px 14px; gap: 8px 14px; }

  .fixtures-head { padding: 15px 12px 12px; }
  .fixtures-head h2 { max-width: 100%; overflow-wrap: anywhere; }
  .fixtures-nav { max-width: 100%; }
  .fixtures-nav button { min-height: 38px; }
  .fixtures-list { max-height: none; overflow: visible; }
  .fixture { padding: 12px 14px; }
  .fixture-team { min-width: 0; }

  .scorers-head { padding: 15px 14px; }
  .scorers-head > div:first-child { min-width: 0; }
  .scorers-head h2 { font-size: 15px; overflow-wrap: anywhere; }
  .stats-mode-nav button { width: 38px; height: 38px; }
  .team-stat-picker { padding: 12px 14px; }
  .team-stat-picker select { min-height: 42px; max-width: 100%; }
  .scorer-row { min-width: 0; padding: 11px 14px; }
  .scorer-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
  .scorer-row b { flex: 0 0 auto; }

  body.dark .standings-page .full-standings td:first-child,
  body.dark .standings-page .full-standings td:nth-child(2) { background: var(--vk-surface, #1b252b); }
  body.dark .standings-page .full-standings th:first-child,
  body.dark .standings-page .full-standings th:nth-child(2) { background: var(--vk-hover, #222e35); }
  body.dark .standings-scroll-hint { background: var(--vk-hover, #222e35); color: var(--vk-muted, #96a5b0); }
}

@media (max-width: 390px) {
  .standings-page { width: calc(100% - 18px) !important; }
  .full-standings th:nth-child(2), .full-standings td:nth-child(2) { width: 144px; min-width: 144px; max-width: 144px; }
  .standing-heading { padding-inline: 11px; }
  .standing-meta { padding-inline: 11px; }
}

/* Keep the league title and page controls usable on narrow phones. */
@media (max-width: 700px) {
  .standing-heading {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
  }
  .standing-heading .league-brand {
    grid-column: 1 / -1;
  }
  .standing-heading #show-playoff {
    grid-column: 1 / 3;
    justify-self: start;
    max-width: 100%;
    margin: 0;
    white-space: nowrap;
  }
  .standing-heading #refresh {
    grid-column: 3;
    justify-self: end;
  }
}
@media (max-width: 360px) {
  .standing-heading { grid-template-columns: minmax(0, 1fr) auto; }
  .standing-heading #show-playoff { grid-column: 1; }
  .standing-heading #refresh { grid-column: 2; }
  .standing-heading #refresh span { display: none; }
}
