/* index.html — シーズン情報（順位表 + ミニランキング） */
.index-season-info-head {
  display: flex;
  flex-wrap: wrap;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 0.5rem 1rem;
  margin-bottom: 0.25rem;
}

.index-season-info-head .card-block__title {
  margin-bottom: 0;
}

/* index: シーズン情報／閲覧履歴／J1チーム一覧の見出し（大きめ・中央・フォントは ja-font-weights で lang=ja のみ M PLUS 1） */
body[data-page="index"] .index-main-section-title {
  text-align: center;
  width: 100%;
  font-size: clamp(1.35rem, 3.8vw, 1.75rem);
  font-weight: 800;
  letter-spacing: 0.02em;
}

body[data-page="index"] .index-season-info-head #index-season-info-select {
  margin-top: 0.15rem;
}

#index-season-info-select {
  min-width: 7rem;
  padding: 0.45rem 0.6rem;
  font-size: 0.95rem;
}

.index-season-info-body {
  margin-top: 0.75rem;
}

.index-season-info-grid {
  display: grid;
  /* minmax(0,1fr): 子（ランキング track の max-content 等）で列がビューポート外へ膨らまない */
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 1.25rem 1.5rem;
  align-items: start;
}

@media (max-width: 900px) {
  .index-season-info-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

.index-season-standings-col,
.index-season-rankings-col {
  min-width: 0;
  max-width: 100%;
}

/* 順位表カード内の見出し（.index-card-inner と同系） */
.index-season-standings-card__title {
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 var(--space-md);
  color: var(--color-text, #0a1a3a);
}

/* 順位表ホスト */
.index-season-standings-host {
  min-width: 0;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* index 順位表: ネガティブマージン拡幅を確実に打ち消し（モバイル横はみ出し防止） */
body[data-page="index"] #standings-container {
  margin-inline: 0 !important;
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box;
}

body[data-page="index"] .index-season-standings-card #standings-container .ts-standings-shell {
  margin-inline: 0;
  width: 100%;
  max-width: 100%;
}

.index-mini-rankings {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
  min-width: 0;
  width: 100%;
  max-width: 100%;
}

/* PC: チーム／個人ランキングブロック間の余白を抑える */
@media (min-width: 769px) {
  body[data-page="index"] .index-mini-rankings {
    gap: var(--space-sm);
  }
}

.index-rankings-section-heading {
  font-size: 0.9375rem;
  font-weight: 700;
  margin: 0;
  color: var(--color-primary, #0a1a3a);
  line-height: 1.35;
}

.index-mini-rank-link {
  color: inherit;
  text-decoration: none;
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.index-mini-rank-link:hover {
  text-decoration: underline;
}

/* ミニランキングカルーセル: PC はグリッド（非スライド）、SP のみ横スライド */
@media (min-width: 769px) {
  .index-season-rank-carousel .overview-scroll {
    overflow-x: visible !important;
    overscroll-behavior-x: auto;
    scroll-snap-type: none !important;
    /* グリッド表示: .overview-scroll 既定の横パディングはモバイル横スクロール用。PC では先頭ズレの原因になる */
    padding-inline: 0;
    scroll-padding-inline: 0;
  }

  .index-season-rank-carousel .overview-track {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    width: 100% !important;
    min-width: 0 !important;
    flex-wrap: wrap !important;
    gap: var(--space-md);
    padding: 0;
  }

  .index-season-rank-carousel .index-mini-rank-card {
    flex: none !important;
    min-width: 0 !important;
    max-width: none !important;
    width: auto !important;
    scroll-snap-align: none;
  }

  .index-season-rank-carousel .overview-nav {
    display: none !important;
  }
}

/* SP: ‹ › 表示 + 横スライド（overviewCarousel.ts の整数幅調整の対象） */
@media (max-width: 768px) {
  .index-season-rank-carousel.overview-carousel {
    padding-bottom: 46px;
  }

  .index-season-rank-carousel .overview-nav {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    z-index: 4;
    visibility: visible !important;
    background-color: rgba(0, 47, 108, 0.88) !important;
    color: #fff !important;
  }

  .index-season-rank-carousel .overview-nav:hover:not(:disabled) {
    background-color: rgba(0, 47, 108, 0.95) !important;
  }

  .index-season-rank-carousel .overview-scroll {
    overflow-x: auto;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x mandatory;
  }

  .index-season-rank-carousel .overview-track {
    display: flex;
    flex-wrap: nowrap;
    width: max-content;
    min-width: 100%;
    gap: var(--space-md);
    padding: 6px 0;
  }

  .index-season-rank-carousel .index-mini-rank-card {
    flex: 0 0 280px;
    min-width: 280px;
    max-width: 280px;
    scroll-snap-align: start;
    scroll-snap-stop: always;
  }
}

/* index 埋め込み順位表: SP で 10 行まで＋もっと見る */
.index-standings-more-btn {
  display: block;
  width: 100%;
  margin-top: var(--space-sm);
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-primary, #0a1a3a);
  background: linear-gradient(
    rgba(255, 255, 255, 0.78),
    rgba(255, 255, 255, 0.64)
  );
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  cursor: pointer;
}

.index-standings-more-btn:hover {
  filter: brightness(1.03);
}

/*
 * 行の折りたたみ: iOS Safari では visibility:collapse が行高を残すことがあるため、
 * sticky を外してから display:none で非表示にする（WebKit 不具合回避）。
 */
@media (max-width: 768px) {
  body[data-page="index"]
    #standings-container
    .match-table
    tbody
    tr.index-standings-row--sp-collapsed
    :is(th, td) {
    position: static !important;
  }

  body[data-page="index"] #standings-container .match-table tbody tr.index-standings-row--sp-collapsed {
    display: none !important;
  }
}

/* ミニランキング: layout.css の .index-card-inner と同じリキッドグラス */
.index-mini-rank-card {
  padding: var(--space-lg);
  border-radius: 10px;
  background: linear-gradient(
    rgba(255, 255, 255, 0.78),
    rgba(255, 255, 255, 0.64)
  );
  border: 1px solid var(--glass-border);
  outline: 1px solid rgba(255, 255, 255, 0.14);
  outline-offset: -1px;
  box-shadow: var(--glass-shadow);
  backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-sat));
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-sat));
  isolation: isolate;
  contain: layout;
  min-width: 0;
}

.index-mini-rank-card__title {
  font-size: 0.8125rem;
  font-weight: 700;
  margin: 0 0 var(--space-sm);
  color: var(--color-primary, #0a1a3a);
  line-height: 1.3;
  opacity: 0.9;
}

/* 1 グリッドで「順位 | チーム | 値」×5行 */
.index-mini-rank-grid {
  display: grid;
  grid-template-columns: minmax(1.25rem, auto) minmax(0, 1fr) max-content;
  column-gap: 0.5rem;
  row-gap: 0.35rem;
  font-size: 0.8125rem;
  line-height: 1.35;
  align-items: baseline;
}

.index-mini-rank-grid__rank {
  font-weight: 600;
  color: #3d4f6f;
  text-align: end;
}

.index-mini-rank-grid__team {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-normal, #242424);
}

.index-mini-rank-grid__val {
  font-variant-numeric: tabular-nums;
  color: var(--color-text, #0a1a3a);
  font-weight: 600;
}

/* ---- index 埋め込み順位表: PC でも data-standings-view="short" をモバイル同等で表示 ---- */
body[data-page="index"] #standings-container .match-table[data-standings-view="short"] {
  min-width: 0 !important;
  width: 100% !important;
  table-layout: fixed !important;
  font-variant-numeric: tabular-nums;
  --ts-sticky-left-col1: 36px;
}

body[data-page="index"] #standings-container .match-table[data-standings-view="short"] thead th,
body[data-page="index"] #standings-container .match-table[data-standings-view="short"] tbody td {
  padding-top: 0.95rem !important;
  padding-bottom: 0.95rem !important;
}

body[data-page="index"] #standings-container .match-table[data-standings-view="short"] .col-rank {
  width: 36px !important;
  min-width: 36px !important;
  max-width: 36px !important;
  padding: 0.95rem 4px !important;
  box-sizing: border-box !important;
  font-variant-numeric: tabular-nums;
  overflow: hidden;
  text-overflow: ellipsis;
}

body[data-page="index"] #standings-container .match-table[data-standings-view="short"] .col-points {
  width: 34px !important;
  min-width: 34px !important;
  max-width: 40px !important;
  padding: 0.95rem 4px !important;
  box-sizing: border-box !important;
  font-variant-numeric: tabular-nums;
}

body[data-page="index"] #standings-container .match-table[data-standings-view="short"] thead th.col-team,
body[data-page="index"] #standings-container .match-table[data-standings-view="short"] tbody td.col-team {
  padding-left: 6px !important;
  padding-right: 5px !important;
}

body[data-page="index"] #standings-container .match-table[data-standings-view="short"] .col-team {
  width: auto !important;
  min-width: 0 !important;
  max-width: min(30vw, 92px) !important;
  box-sizing: border-box !important;
}

body[data-page="index"] #standings-container .col-team .standings-team-link,
body[data-page="index"] #standings-container .col-team a {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 下から浮かび上がる表示（IntersectionObserver で .index-reveal-section--visible を付与） */
@media (prefers-reduced-motion: no-preference) {
  html.index-reveal-enhanced body[data-page="index"] .index-reveal-section {
    opacity: 0;
    transform: translate3d(0, clamp(18px, 5vw, 40px), 0);
    transition:
      opacity 0.85s cubic-bezier(0.22, 1, 0.36, 1),
      transform 0.85s cubic-bezier(0.22, 1, 0.36, 1);
  }

  html.index-reveal-enhanced body[data-page="index"] .index-reveal-section[data-reveal-order="1"] {
    transition-delay: 0.08s;
  }

  html.index-reveal-enhanced body[data-page="index"] .index-reveal-section[data-reveal-order="2"] {
    transition-delay: 0.16s;
  }

  html.index-reveal-enhanced body[data-page="index"] .index-reveal-section.index-reveal-section--visible {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }

  /*
   * J1 シーズン別チーム一覧: カルーセルは margin calc(50% - 50vw) でビューポートまで広げる。
   * 祖先に transform があると % の包含ブロックが変わり、列内のまま見えることがあるため
   * このブロックだけ reveal は opacity のみ（translate しない）。
   */
  html.index-reveal-enhanced body[data-page="index"] #index-season-teams-wrapper.index-reveal-section {
    transform: none;
    transition: opacity 0.85s cubic-bezier(0.22, 1, 0.36, 1);
  }

  html.index-reveal-enhanced body[data-page="index"] #index-season-teams-wrapper.index-reveal-section[data-reveal-order="2"] {
    transition-delay: 0.16s;
  }

  html.index-reveal-enhanced body[data-page="index"] #index-season-teams-wrapper.index-reveal-section.index-reveal-section--visible {
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  html.index-reveal-enhanced body[data-page="index"] .index-reveal-section {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }
}

body[data-page="index"] #standings-container .match-table[data-standings-view="short"] .ts-table__th:not(.ts-mobile-col--short),
body[data-page="index"] #standings-container .match-table[data-standings-view="short"] .ts-table__td:not(.ts-mobile-col--short) {
  display: none !important;
}

/* 769px〜 の段階非表示（ts-col--pl-*）より優先して short 列のみ常に表示 */
body[data-page="index"] #standings-container .match-table[data-standings-view="short"] .ts-mobile-col--short.ts-col--pl-2,
body[data-page="index"] #standings-container .match-table[data-standings-view="short"] .ts-mobile-col--short.ts-col--pl-3,
body[data-page="index"] #standings-container .match-table[data-standings-view="short"] .ts-mobile-col--short.ts-col--pl-4 {
  display: table-cell !important;
}

/* ---- index 埋め込み順位表: 狭いビューは team.html ショート（モバイル相当）に寄せる ---- */
@media (max-width: 1024px) {
  body[data-page="index"] #standings-container .ts-standings-shell--embed .match-table[data-standings-view="short"] {
    min-width: 0 !important;
    width: 100% !important;
    table-layout: fixed !important;
    font-variant-numeric: tabular-nums;
    --ts-sticky-left-col1: 36px;
  }

  body[data-page="index"]
    #standings-container
    .ts-standings-shell--embed
    .match-table[data-standings-view="short"]
    thead
    th,
  body[data-page="index"]
    #standings-container
    .ts-standings-shell--embed
    .match-table[data-standings-view="short"]
    tbody
    td {
    padding-top: 0.85rem !important;
    padding-bottom: 0.85rem !important;
    font-size: 0.8125rem !important;
  }

  body[data-page="index"]
    #standings-container
    .ts-standings-shell--embed
    .match-table[data-standings-view="short"]
    .col-rank {
    width: 36px !important;
    min-width: 36px !important;
    max-width: 36px !important;
    padding: 0.85rem 4px !important;
    box-sizing: border-box !important;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  body[data-page="index"]
    #standings-container
    .ts-standings-shell--embed
    .match-table[data-standings-view="short"]
    .col-points {
    width: 34px !important;
    min-width: 34px !important;
    max-width: 40px !important;
    padding: 0.85rem 4px !important;
    box-sizing: border-box !important;
  }

  body[data-page="index"]
    #standings-container
    .ts-standings-shell--embed
    .match-table[data-standings-view="short"]
    thead
    th.col-team,
  body[data-page="index"]
    #standings-container
    .ts-standings-shell--embed
    .match-table[data-standings-view="short"]
    tbody
    td.col-team {
    padding-left: 6px !important;
    padding-right: 5px !important;
  }

  body[data-page="index"]
    #standings-container
    .ts-standings-shell--embed
    .match-table[data-standings-view="short"]
    .col-team {
    width: auto !important;
    min-width: 0 !important;
    max-width: min(38vw, 110px) !important;
    box-sizing: border-box !important;
  }

  /* standings-pl の 769px+ 固定列を埋め込みでは上書き */
  body[data-page="index"] #standings-container .ts-standings-shell--embed .match-table .col-compact:not(.ts-col-gd) {
    width: auto !important;
    min-width: 0 !important;
    max-width: 2.75rem !important;
    box-sizing: border-box !important;
    padding-left: 2px !important;
    padding-right: 2px !important;
  }

  body[data-page="index"] #standings-container .ts-standings-shell--embed .match-table .ts-col-gd {
    width: 2.75rem !important;
    min-width: 2.75rem !important;
    max-width: 2.75rem !important;
    box-sizing: border-box !important;
  }

  body[data-page="index"] #standings-container .ts-standings-shell--embed .table-scroll-wrapper.ts-table--standings {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

@media (max-width: 768px) {
  body[data-page="index"] #standings-container .ts-standings-shell--embed .is-sticky-left-1,
  body[data-page="index"] #standings-container .ts-standings-shell--embed .is-sticky-left-2 {
    position: static !important;
    left: auto !important;
    box-shadow: none !important;
  }
}

/* --- index: 次節対戦カード（j1_next） --- */
body[data-page="index"] .index-match-predictions-track {
  display: flex;
  gap: 14px;
  justify-content: flex-start;
}

/* 他セクションの .index-card-inner と同系のリキッドグラス（幅は約20%縮小） */
body[data-page="index"] .index-match-prediction-card.index-card-inner {
  flex: 0 0 240px;
  max-width: 240px;
  padding: 0;
  overflow: hidden;
  scroll-snap-align: start;
  scroll-snap-stop: always;
}

body[data-page="index"] .index-match-prediction-card__link {
  display: block;
  height: 100%;
  padding: var(--space-md) var(--space-lg);
  border-radius: inherit;
  background: transparent;
  text-decoration: none;
  color: inherit;
  border: none;
  outline: none;
  box-shadow: none;
  transition: background-color 0.15s ease;
}

body[data-page="index"] .index-match-prediction-card__link:hover {
  background: rgba(255, 255, 255, 0.42);
}

body[data-page="index"] .index-match-prediction-card__link:focus-visible {
  background: rgba(255, 255, 255, 0.42);
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

body[data-page="index"] .index-match-prediction-card__meta {
  margin: 0 0 0.3rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

body[data-page="index"] .index-match-prediction-card__round {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--color-text, #1a1f2a);
  margin: 0;
  line-height: 1.25;
}

body[data-page="index"] .index-match-prediction-card__kickoff {
  font-size: 0.82rem;
  color: #5a6578;
  margin: 0;
  line-height: 1.3;
}

body[data-page="index"] .index-match-prediction-card__teams {
  font-size: 1.05rem;
  font-weight: 600;
  margin: 0;
  line-height: 1.3;
}

@media (max-width: 480px) {
  body[data-page="index"] .index-match-prediction-card.index-card-inner {
    flex-basis: 208px;
    max-width: 208px;
  }
}
