/* Shared mobile presentation patch. No data, routes or desktop rules are changed.
 * Explicit root specificity keeps this stylesheet effective with lazy scoped Vue CSS.
 * Compatible with the repository views and the newer deployed match-history views.
 */
@media (max-width: 767px) {
  html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
  html:root body .detail-match-card,
  html:root body .detail-tabs-card { min-width: 0; padding: 12px; }
  html:root body .analysis-card,
  html:root body .rail-card { min-width: 0; padding: 12px; }
  html:root body .detail-tabs { gap: 0; flex-wrap: wrap; overflow: visible; }
  html:root body .detail-tab { flex: 1 0 30%; min-height: 42px; padding: 10px 4px; font-size: 13px; }

  /* Statistics: values sit above their bars, leaving a readable label column. */
  html:root body .sc { min-width: 0; gap: 12px; }
  html:root body .sc-row { grid-template-columns: minmax(0,1fr) 78px minmax(0,1fr); gap: 8px; min-height: 40px; }
  html:root body .sc-row__side,
  html:root body .sc-row__side--away { grid-template-columns: minmax(0,1fr); gap: 5px; }
  html:root body .sc-row__val { grid-row: 1; justify-self: stretch; font-size: 16px; line-height: 1.25; text-align: center; overflow-wrap: anywhere; }
  html:root body .sc-row__side--away .sc-row__val { text-align: center; }
  html:root body .sc-row__track { grid-row: 2; width: 100%; height: 6px; }
  html:root body .sc-row__name { font-size: 12px; line-height: 1.4; white-space: normal; overflow-wrap: anywhere; }
  html:root body .sc__team { flex: 1; max-width: 48%; font-size: 13px; }
  html:root body .sc__team--away { justify-content: flex-end; text-align: right; }
  html:root body .sc__team-name { white-space: normal; overflow: visible; overflow-wrap: anywhere; }
  html:root body .sc-note { font-size: 11px; line-height: 1.6; overflow-wrap: anywhere; }

  /* Match list: a compact, fixed mobile information map. */
  html:root body .fixture-row__time {
    align-self: end;
    justify-self: center;
    min-height: 12px;
    font-size: 10px;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
  }
  html:root body .fixture-row {
    grid-template-columns: 28px minmax(0,1fr) 64px minmax(0,1fr) !important;
    grid-template-areas: '. time status .' 'fav home score away' !important;
    gap: 6px;
    min-height: 96px;
    padding: 10px 10px 12px;
  }
  html:root body .fixture-row__team {
    display: flex;
    align-items: center;
    align-self: center;
    align-content: center;
    justify-content: center;
    min-width: 0;
    min-height: 20px;
    gap: 4px;
    flex-wrap: nowrap;
  }
  html:root body .fixture-row__team--home,
  html:root body .fixture-row__team--away { justify-content: center; }
  html:root body .favourite-button { align-self: center; justify-self: center; width: 28px; height: 20px; }
  html:root body .fixture-row__chevron { display: none; }
  html:root body .fixture-row__team .team-crest { display: none; }
  html:root body .fixture-row__team .tmb-row { flex: 0 1 auto; max-width: 58%; gap: 1px; flex-wrap: nowrap; }
  html:root body .fixture-row__team .tmb { min-width: 14px; height: 16px; padding: 0 2px; font-size: 9px; }
  html:root body .fixture-row__team .team-name {
    flex: 0 1 auto;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 12px;
    line-height: 1.25;
  }
  html:root body .fixture-row__score {
    display: grid;
    align-self: center;
    grid-template-columns: auto auto;
    justify-content: center;
    justify-items: center;
    gap: 5px 7px;
    /* Reserve equal space above/below the full score, even without metadata. */
    grid-template-rows: 20px 12px;
    padding-top: 17px;
  }
  html:root body .fixture-row__score .score-num,
  html:root body .fixture-row__score .score-empty { grid-column: 1 / -1; grid-row: 1; }
  html:root body .fixture-row__score .score-ht,
  html:root body .fixture-row__score .score-sub:not(.score-sub--corner) { grid-column: 1; grid-row: 2; }
  html:root body .fixture-row__score .score-cr,
  html:root body .fixture-row__score .score-sub--corner { grid-column: 2; grid-row: 2; }
  html:root body .fixture-row__score .score-ht::before,
  html:root body .fixture-row__score .score-sub:not(.score-sub--corner)::before { content: '半:'; }
  html:root body .fixture-row__score .score-cr::before,
  html:root body .fixture-row__score .score-sub--corner::before { content: '角:'; }
  html:root body .fixture-row__score .score-ht,
  html:root body .fixture-row__score .score-cr,
  html:root body .fixture-row__score .score-sub { font-size: 10px; line-height: 1.2; }

  /* Line-up pitch: preserve readable player spacing and expose both halves by swipe. */
  html:root body .lp,
  html:root body .lp .pitch,
  html:root body .pitch { min-width: 0; max-width: 100%; width: 100%; }
  html:root body .lp .pitch,
  html:root body .pitch { overflow-x: auto; overscroll-behavior-inline: contain; scrollbar-width: thin; }
  html:root body .lp .pitch__field,
  html:root body .pitch__field {
    box-sizing: border-box;
    width: 680px;
    min-width: 680px;
    min-height: 0;
    aspect-ratio: 105 / 68;
  }
  html:root body .lp__meta { grid-template-columns: minmax(0,1fr); gap: 10px; }
  html:root body .lp__side { justify-content: flex-start; min-width: 0; text-align: left; }
  html:root body .lp__side--away { justify-content: flex-start; text-align: left; }
  html:root body .lp__side .team-crest { display: none; }
  html:root body .lp__side > div { min-width: 0; }
  html:root body .lp__side strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  html:root body .lp__side small { display: block; white-space: normal; overflow-wrap: anywhere; }

  /* H2H summary: both teams retain their width; results occupy a separate row. */
  html:root body .analysis .h2h-summary { grid-template-columns: repeat(2,minmax(0,1fr)); padding: 10px; gap: 12px 8px; }
  html:root body .h2h-summary__team { grid-row: 1; min-width: 0; }
  html:root body .h2h-summary__team--away { grid-column: 2; }
  html:root body .h2h-summary__who { flex-wrap: wrap; gap: 5px; }
  html:root body .h2h-summary__who strong { white-space: normal; overflow: visible; overflow-wrap: anywhere; font-size: 12px; }
  html:root body .h2h-summary__form { grid-row: 2; grid-column: 1/-1; max-width: none; gap: 5px; }
  html:root body .h2h-summary__wdl { gap: 5px; font-size: 11px; }
  html:root body .h2h-record__item em { font-size: 15px; }
  html:root body .h2h-summary__goals { font-size: 11px; overflow-wrap: anywhere; }

  /* Deployed H2H rows: metadata, then badge/name/crest teams around the score. */
  html:root body .h2h-cols { display: none; }
  html:root body .h2h-row {
    grid-template-columns: minmax(0,1fr) 64px minmax(0,1fr);
    grid-template-areas: 'league date date' 'home score away';
    align-items: center; gap: 10px 6px; padding: 12px 8px;
  }
  html:root body .h2h-row__league { grid-area: league; text-align: left; white-space: normal; overflow: visible; overflow-wrap: anywhere; }
  html:root body .h2h-row__date { grid-area: date; text-align: right; font-size: 11px; }
  html:root body .h2h-row__team--home { grid-area: home; }
  html:root body .h2h-row__team--away { grid-area: away; }
  html:root body .h2h-row__score { grid-area: score; grid-template-rows: 14px 20px 14px; align-items: center; row-gap: 2px; }
  html:root body .h2h-row__team {
    display: flex; align-items: center; justify-content: center; gap: 4px; min-width: 0;
  }
  html:root body .h2h-row__team .tmb-row { flex: 0 0 auto; }
  html:root body .h2h-row__name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: center; font-size: 12px; line-height: 1.4; }
  html:root body .h2h-row__team .team-crest { display: none; }
  html:root body .h2h-row__ft { font-size: 16px; }
  html:root body .h2h-row__sub { position: static; height: auto; flex-wrap: wrap; line-height: 1.4; }
  html:root body .h2h-row__label { position: static; font-size: 10px; }

  html:root body .h2h-row .tmb-row { min-width: 0; max-width: 54%; flex-wrap: nowrap; justify-content: center; gap: 2px; }
  html:root body .h2h-row .tmb { min-width: 17px; height: 18px; padding: 0 3px; font-size: 10px; }

  /* Repository H2H table: readable cards instead of clipped fixed-width columns. */
  html:root body .analysis .h2h table { min-width: 0; display: block; }
  html:root body .analysis .h2h thead { display: none; }
  html:root body .analysis .h2h tbody { display: block; }
  html:root body .analysis .h2h tr { display: grid; grid-template-columns: minmax(0,1fr) 60px minmax(0,1fr); gap: 8px 4px; padding: 10px 0; border-top: 1px solid var(--color-border); }
  html:root body .analysis .h2h td { padding: 0; border: 0; white-space: normal; overflow: visible; overflow-wrap: anywhere; }
  html:root body .analysis .h2h td:nth-child(1) { grid-column: 2/4; grid-row: 1; text-align: right; }
  html:root body .analysis .h2h td:nth-child(2) { grid-column: 1; grid-row: 1; }
  html:root body .analysis .h2h td:nth-child(3) { grid-column: 1; grid-row: 2; }
  html:root body .analysis .h2h td:nth-child(4) { grid-column: 2; grid-row: 2; }
  html:root body .analysis .h2h td:nth-child(5) { grid-column: 3; grid-row: 2; }
  html:root body .analysis .h2h td:nth-child(6) { grid-column: 1/-1; font-size: 11px; }

  /* Other populated data views: contain tables locally, wrap names and totals. */
  html:root body .table-wrap,
  html:root body .standings__scroll { min-width: 0; max-width: 100%; overflow-x: auto; overscroll-behavior-inline: contain; }
  html:root body .standings__scroll .standings { min-width: 520px; }
  html:root body .standings__legend { flex-wrap: wrap; }
  html:root body .form-team header strong,
  html:root body .support-option__label { white-space: normal; overflow: visible; overflow-wrap: anywhere; }
  html:root body .form-team__results,
  html:root body .form-team dl,
  html:root body .form-team > p { flex-wrap: wrap; }
  html:root body .odds-trend__events li { grid-template-columns: minmax(0,1fr); gap: 3px; }
  html:root body .odds-trend__pane { overflow-x: auto; }
  html:root body .asian-odds-card__values { grid-template-columns: minmax(0,1fr) minmax(0,1.5fr) minmax(0,1fr); }
  html:root body .asian-odds-card__values strong { white-space: normal; overflow-wrap: anywhere; }
  html:root body .mh__card { grid-template-columns: minmax(0,1fr) 78px minmax(0,1fr); gap: 6px; }
  html:root body .mh__team-name { font-size: 13px; white-space: normal; overflow-wrap: anywhere; }
  html:root body .mh__score-num { font-size: 23px; }
  html:root body .mh__badges { max-width: 100%; flex-wrap: wrap; }
  html:root body .schedule-row { grid-template-columns: minmax(0,1fr) auto; grid-template-areas: 'date phase' 'league league' 'teams teams'; gap: 6px; }
  html:root body .schedule-row__date { grid-area: date; display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px; }
  html:root body .schedule-row__phase { grid-area: phase; }
  html:root body .schedule-row__league { grid-area: league; display: block; white-space: normal; overflow-wrap: anywhere; }
  html:root body .schedule-row__teams { grid-area: teams; grid-template-columns: minmax(0,1fr) 56px minmax(0,1fr); }
  html:root body .schedule-row__teams .team-crest { display: none; }
  html:root body .team-hero__copy { min-width: 0; overflow-wrap: anywhere; }
  html:root body .squad-info strong,
  html:root body .injury-list li strong { white-space: normal; overflow: visible; overflow-wrap: anywhere; }
  html:root body .squad-row { grid-template-columns: 32px minmax(0,1fr); gap: 8px; }
  html:root body .squad-market { grid-column: 2; text-align: left; white-space: normal; }
  html:root body .injury-list li { flex-wrap: wrap; }
  html:root body .tl__scroll { max-width: 100%; overscroll-behavior-inline: contain; }
  html:root body .tl::after { content: '左右滑动查看完整时间线'; display: block; margin-top: 8px; color: var(--color-text-muted); font-size: 11px; text-align: center; }
  html:root body .tl__tip { min-width: 0; max-width: min(240px,calc(100vw - 24px)); }
  html:root body .tl__tip-line { flex-wrap: wrap; white-space: normal; overflow-wrap: anywhere; }
  html:root body .tlive-item { display: grid; grid-template-columns: 48px 28px 18px minmax(0,1fr); gap: 5px; }
  html:root body .tlive-item__ts,
  html:root body .tlive-item__min { width: auto; font-size: 10px; }
  html:root body .tlive-item__body { overflow-wrap: anywhere; font-size: 12px; }

  /* Compact evidence rows keep team, coach and formation on one centered line. */
  html:root body .coach-list { overflow-x: auto; overscroll-behavior-inline: contain; }
  html:root body .coach-list li { grid-template-columns: max-content minmax(0,1fr) max-content; min-width: 300px; align-items: center; text-align: center; white-space: nowrap; }
  html:root body .coach-list li > * { min-width: 0; overflow: hidden; text-overflow: ellipsis; }

  /* The phone header gets a dedicated four-route row; no route is hidden. */
  html:root body .product-header { height: auto; min-height: 104px; }
  html:root body .product-header__bar,
  html:root body .product-header__inner { display: grid; grid-template-columns: minmax(0,1fr) auto; grid-template-rows: 56px 44px; height: auto; min-height: 100px; padding-inline: max(10px,env(safe-area-inset-left)); }
  html:root body .product-brand { grid-column: 1; grid-row: 1; }
  html:root body .product-header__actions { grid-column: 2; grid-row: 1; }
  html:root body .product-header__nav { grid-column: 1/-1; grid-row: 2; display: flex; width: 100%; min-width: 0; overflow: visible; gap: 0; }
  html:root body .product-header__nav-link,
  html:root body .product-header__nav-link:nth-child(2) { display: inline-flex; flex: 1 1 0; min-width: 0; width: auto; justify-content: center; padding-inline: 2px; font-size: 12px; letter-spacing: 0; }
}
