/* MatchPulse workbench UI.
 *
 * One authoritative stylesheet for the shell and every page in pages.js.
 * It replaces the three overlapping legacy sheets (styles.css for the retired
 * app.js, product-ui.css, reference-workbench.css) whose cascade order made
 * the layout unpredictable.
 *
 * Design rules: white / light grey / blue, information-dense, aligned tables,
 * radius <= 8px, no gradients, no glow, no decorative cards.
 *
 * Mobile rule: a club name wraps, it is never truncated to "Ipswich…".  Labels
 * are printed in the cell instead of being hidden behind a hover state.
 */

:root {
  color-scheme: light;
  --mp-canvas: #f5f7fa;
  --mp-panel: #ffffff;
  --mp-ink: #16202e;
  --mp-ink-soft: #3b4757;
  --mp-muted: #6b7a90;
  --mp-line: #e3e8f0;
  --mp-line-strong: #cfd8e6;
  --mp-blue: #1465d8;
  --mp-blue-soft: #eef4ff;
  --mp-green: #15803d;
  --mp-green-soft: #eefaf2;
  --mp-amber: #b45309;
  --mp-radius: 8px;
  --mp-radius-sm: 6px;
  --mp-sidebar-w: 216px;
  --mp-topbar-h: 58px;
  --mp-font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--mp-canvas);
  color: var(--mp-ink);
  font-family: var(--mp-font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

body { min-height: 100vh; display: flex; flex-direction: column; overflow-x: hidden; }

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
h1, h2, h3, h4, p, dl, dd, dt, ol, ul { margin: 0; }
ol, ul { list-style: none; padding: 0; }

.app-shell { flex: 1 1 auto; display: block; width: 100%; min-width: 0; }
.workspace { display: block; width: 100%; min-width: 0; }

/* ---------------------------------------------------------------- shell */

.mp-shell {
  display: grid;
  grid-template-columns: var(--mp-sidebar-w) minmax(0, 1fr);
  min-height: calc(100vh - 46px);
  overflow-x: clip;
}

/* Pages that opt out of the sidebar still get one full-width column. */
.mp-shell-plain { grid-template-columns: minmax(0, 1fr); }

.mp-sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px 12px;
  background: var(--mp-panel);
  border-right: 1px solid var(--mp-line);
  overflow-y: auto;
}

.mp-sidebar-brand { display: block; padding: 4px 8px 14px; }
.mp-sidebar-brand img { display: block; width: 100%; max-width: 148px; height: auto; }

.mp-sidebar-nav { display: flex; flex-direction: column; gap: 2px; }
.mp-sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--mp-radius-sm);
  color: var(--mp-ink-soft);
  font-size: 13.5px;
  white-space: nowrap;
}
.mp-sidebar-nav a:hover { background: #f2f5f9; }
.mp-sidebar-nav a.is-active { background: var(--mp-blue-soft); color: var(--mp-blue); font-weight: 600; }
.mp-sidebar-nav svg { width: 16px; height: 16px; flex: 0 0 16px; stroke: currentColor; fill: none; }

.mp-sidebar-foot {
  margin-top: auto;
  padding: 12px 10px 4px;
  border-top: 1px solid var(--mp-line);
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 11.5px;
  color: var(--mp-muted);
}
.mp-sidebar-foot b { color: var(--mp-ink-soft); font-weight: 600; }

.mp-main { min-width: 0; display: flex; flex-direction: column; }

.mp-topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 20px;
  height: var(--mp-topbar-h);
  padding: 0 24px;
  background: var(--mp-panel);
  border-bottom: 1px solid var(--mp-line);
}
.mp-brand { display: flex; align-items: center; }
.mp-brand img { display: block; height: 20px; width: auto; }
.mp-nav { display: flex; align-items: center; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.mp-nav::-webkit-scrollbar { display: none; }
.mp-nav a {
  padding: 6px 10px;
  border-radius: var(--mp-radius-sm);
  font-size: 13.5px;
  color: var(--mp-muted);
  white-space: nowrap;
}
.mp-nav a:hover { color: var(--mp-ink); background: #f2f5f9; }
.mp-nav a.is-active { color: var(--mp-blue); background: var(--mp-blue-soft); font-weight: 600; }
.mp-topbar-title { margin-left: auto; font-size: 13px; color: var(--mp-muted); white-space: nowrap; }

/* ---------------------------------------------------------------- page */

.mp-page {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 22px 24px 40px;
  min-width: 0;
}

.mp-heading { display: flex; flex-direction: column; gap: 4px; }
.mp-heading span { font-size: 11px; letter-spacing: 0.09em; text-transform: uppercase; color: var(--mp-blue); font-weight: 600; }
.mp-heading h1 { font-size: 21px; font-weight: 650; letter-spacing: -0.01em; }
.mp-heading p { font-size: 13px; color: var(--mp-muted); max-width: 90ch; }

.mp-panel { background: var(--mp-panel); border: 1px solid var(--mp-line); border-radius: var(--mp-radius); overflow: clip; }
.mp-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--mp-line);
  flex-wrap: wrap;
}
.mp-panel-head h2 { font-size: 14.5px; font-weight: 620; }
.mp-panel-head > span, .mp-panel-head > a { font-size: 12.5px; color: var(--mp-muted); }
.mp-panel-head > a:hover { color: var(--mp-blue); }

.mp-note { padding: 12px 16px; font-size: 12.5px; color: var(--mp-muted); line-height: 1.6; }
.mp-empty { padding: 28px 16px; text-align: center; font-size: 13px; color: var(--mp-muted); }
.mp-loading { padding: 16px; font-size: 13px; color: var(--mp-muted); }
.mp-muted { color: var(--mp-muted); font-size: 12.5px; }
.mp-more { display: block; padding: 12px; text-align: center; font-size: 13px; color: var(--mp-blue); border-top: 1px solid var(--mp-line); }
.mp-more:hover { background: var(--mp-blue-soft); }

.mp-tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--mp-line); overflow-x: auto; scrollbar-width: none; }
.mp-tabs::-webkit-scrollbar { display: none; }
.mp-tabs a { padding: 8px 14px; font-size: 13.5px; color: var(--mp-muted); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.mp-tabs a.is-active { color: var(--mp-blue); border-bottom-color: var(--mp-blue); font-weight: 600; }

.mp-chips { display: flex; gap: 6px; flex-wrap: wrap; padding: 12px 16px 0; }
.mp-chips:first-child { padding-top: 12px; }
.mp-chips a {
  padding: 4px 11px;
  border: 1px solid var(--mp-line);
  border-radius: 999px;
  font-size: 12.5px;
  color: var(--mp-ink-soft);
  background: var(--mp-panel);
  white-space: nowrap;
}
.mp-chips a:hover { border-color: var(--mp-line-strong); }
.mp-chips a.is-active { background: var(--mp-blue); border-color: var(--mp-blue); color: #fff; font-weight: 500; }

.mp-quick { display: flex; flex-wrap: wrap; gap: 6px; padding: 12px 16px; border-top: 1px solid var(--mp-line); }
.mp-quick a {
  padding: 4px 11px;
  border: 1px solid var(--mp-line);
  border-radius: 999px;
  font-size: 12.5px;
  color: var(--mp-ink-soft);
}
.mp-quick a:hover { border-color: var(--mp-blue); color: var(--mp-blue); }

.mp-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 1px; background: var(--mp-line); }
.mp-facts > div { background: var(--mp-panel); padding: 11px 16px; min-width: 0; }
.mp-facts dt { font-size: 11.5px; color: var(--mp-muted); }
.mp-facts dd { font-size: 13px; color: var(--mp-ink); word-break: break-word; overflow-wrap: anywhere; }
.mp-facts-wide dd { line-height: 1.55; }

.mp-building { display: flex; flex-direction: column; }
.mp-building-head { display: flex; gap: 14px; padding: 18px 16px; align-items: flex-start; }
.mp-building-icon { display: inline-flex; width: 34px; height: 34px; align-items: center; justify-content: center; border-radius: var(--mp-radius-sm); background: var(--mp-blue-soft); color: var(--mp-blue); flex: 0 0 34px; }
.mp-building-icon svg { width: 17px; height: 17px; stroke: currentColor; fill: none; }
.mp-building-head h2 { font-size: 15px; font-weight: 620; margin-bottom: 4px; }
.mp-building-head p { font-size: 13px; color: var(--mp-muted); line-height: 1.65; max-width: 80ch; }

/* ---------------------------------------------------------------- crest */

/* No plate, no border, no shadow: the crest sits directly on the row. */
.mp-crest {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  background: none;
  border: 0;
  box-shadow: none;
  overflow: visible;
}
.mp-crest img { max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; background: none; border: 0; display: block; }
.mp-crest.is-large { width: 44px; height: 44px; }

.mp-crest.is-broken {
  border-radius: var(--mp-radius-sm);
  background: #eef1f6;
  color: #8b98ab;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.mp-crest.is-large.is-broken { font-size: 17px; }

/* ---------------------------------------------------------------- tables */

.mp-table { display: block; width: 100%; min-width: 0; }
.mp-tbody { display: block; min-width: 0; }
.mp-tr {
  display: grid;
  align-items: center;
  gap: 10px;
  padding: 9px 16px;
  border-top: 1px solid var(--mp-line);
  min-width: 0;
}
.mp-tr:first-child { border-top: 0; }
/* Grid items default to min-width:auto, which lets a long club name push the
   whole table wider than its container.  Opt every cell out of that. */
.mp-tr > * { min-width: 0; }
a.mp-tr:hover { background: #f8fafc; }

.mp-thead {
  display: grid;
  gap: 10px;
  padding: 8px 16px;
  background: #fafbfd;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: var(--mp-muted);
  border-bottom: 1px solid var(--mp-line);
  position: sticky;
  top: var(--mp-topbar-h);
  z-index: 5;
}
.mp-thead > span { min-width: 0; }

.mp-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 16px;
  background: #fafbfd;
  border-top: 1px solid var(--mp-line);
  border-bottom: 1px solid var(--mp-line);
  font-size: 11.5px;
  color: var(--mp-muted);
}
.mp-group-head b { font-size: 12px; color: var(--mp-ink-soft); font-weight: 600; }

.mp-tr > time { font-size: 12.5px; color: var(--mp-muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.mp-league { font-size: 12.5px; color: var(--mp-ink-soft); min-width: 0; }

.mp-teams { display: flex; align-items: center; gap: 8px; min-width: 0; }
.mp-teams b {
  font-size: 13.5px;
  font-weight: 550;
  min-width: 0;
  overflow-wrap: anywhere;
}
.mp-teams i { font-style: normal; font-size: 11px; color: var(--mp-muted); flex: 0 0 auto; }

.mp-seq { font-size: 12.5px; color: var(--mp-muted); font-variant-numeric: tabular-nums; }

.mp-state { font-size: 12px; color: var(--mp-muted); text-align: right; min-width: 0; }
.mp-state.is-ready { color: var(--mp-green); }

.mp-score {
  font-size: 14.5px;
  font-weight: 660;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  text-align: center;
  min-width: 0;
  overflow-wrap: anywhere;
}
.mp-score.is-pending {
  font-size: 12px;
  font-weight: 500;
  color: var(--mp-amber);
  letter-spacing: 0;
}

/* Desktop hides the in-cell label: the column header already says it. */
.mp-cell-label { display: none; font-style: normal; }

/* 首页 / 比赛中心 / 报告中心 */
.mp-table-home .mp-tr, .mp-table-home .mp-thead,
.mp-table-centre .mp-tr, .mp-table-centre .mp-thead,
.mp-table-reports .mp-tr, .mp-table-reports .mp-thead {
  grid-template-columns: 104px 92px minmax(0, 1fr) 104px;
}
.mp-table-centre .mp-tr, .mp-table-centre .mp-thead,
.mp-table-reports .mp-tr, .mp-table-reports .mp-thead {
  grid-template-columns: 104px 92px minmax(0, 1fr) 132px 104px;
}

.mp-stage-list { display: flex; flex-wrap: wrap; gap: 4px; min-width: 0; }
.mp-stage-list em {
  font-style: normal;
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--mp-blue-soft);
  color: var(--mp-blue);
  white-space: nowrap;
}

/* 十四场 */
.mp-table-fourteen .mp-tr, .mp-table-fourteen .mp-thead {
  grid-template-columns: 40px 84px minmax(0, 1.2fr) 150px 110px 104px;
}
.mp-model { display: flex; flex-direction: column; gap: 1px; min-width: 0; font-size: 12.5px; }
.mp-model em { font-style: normal; min-width: 0; }
.mp-model .is-loading { color: var(--mp-muted); }
.mp-model .is-pending { color: var(--mp-amber); }
.mp-model .is-outcome { font-weight: 600; color: var(--mp-ink); }
.mp-stage-tag { font-style: normal; font-size: 10.5px; color: var(--mp-muted); }
.mp-fourteen-row.is-unresolved { background: #fffdf7; }

/* 赛程赛果 */
.mp-table-result .mp-tr, .mp-table-result .mp-thead {
  grid-template-columns: 104px 92px minmax(0, 1fr) 96px minmax(0, 1fr) 104px;
}

/* ---------------------------------------------------------------- match detail */

.mp-detail-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 16px;
  padding: 18px 16px;
  border-bottom: 1px solid var(--mp-line);
}
.mp-detail-team { display: flex; align-items: center; gap: 10px; min-width: 0; }
.mp-detail-team b { font-size: 15.5px; font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.mp-detail-score { text-align: center; min-width: 0; }
.mp-detail-score b { display: block; font-size: 26px; font-weight: 680; font-variant-numeric: tabular-nums; letter-spacing: 0.02em; }
.mp-detail-score span { font-size: 11.5px; color: var(--mp-muted); }
.mp-detail-score.is-upcoming b { font-size: 17px; color: var(--mp-muted); }
/* Finished/pending state chip: the match is over, the score may not be known. */
.mp-detail-score em {
  display: inline-block;
  margin-top: 5px;
  padding: 1px 8px;
  border: 1px solid var(--mp-line);
  border-radius: 999px;
  font-size: 10.5px;
  font-style: normal;
  letter-spacing: 0.04em;
  color: var(--mp-green);
}
.mp-detail-score.is-pending em { color: var(--mp-muted); }

/* Stage strip: every published stage is a real link, unpublished ones say so. */
.mp-stagebar {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 1px;
  background: var(--mp-line);
  border-bottom: 1px solid var(--mp-line);
}
.mp-stage {
  background: var(--mp-panel);
  padding: 10px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  font-size: 12px;
  font-weight: 600;
  min-width: 0;
  text-align: center;
}
.mp-stage i { font-style: normal; font-size: 10.5px; color: var(--mp-muted); }
a.mp-stage:hover { background: #f8fafc; }
a.mp-stage.is-active { background: var(--mp-blue-soft); color: var(--mp-blue); }
a.mp-stage.is-active i { color: var(--mp-blue); }
.mp-stage.is-unpublished { background: #fafbfd; color: var(--mp-muted); font-weight: 500; }

.mp-panels { display: block; }
.mp-panel-body { display: none; min-width: 0; }
.mp-panel-body.is-active { display: block; }

.mp-stage-caption { padding: 14px 16px 0; font-size: 12.5px; color: var(--mp-muted); }
.mp-stage-caption b { color: var(--mp-blue); }

.mp-source { padding: 10px 16px 16px; font-size: 11.5px; color: var(--mp-muted); word-break: break-all; }
.mp-source a { color: var(--mp-blue); text-decoration: underline; }

.mp-report { padding: 14px 20px 20px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.mp-report h2, .mp-report h3, .mp-report h4 { font-size: 14px; font-weight: 640; padding-top: 8px; border-top: 1px solid var(--mp-line); }
.mp-report h2:first-child, .mp-report h3:first-child, .mp-report h4:first-child { border-top: 0; padding-top: 0; }
.mp-report p { font-size: 13.5px; line-height: 1.85; color: var(--mp-ink-soft); overflow-wrap: anywhere; }
.mp-report ul, .mp-report ol { display: flex; flex-direction: column; gap: 6px; padding-left: 20px; }
.mp-report ul { list-style: disc; }
.mp-report ol { list-style: decimal; }
.mp-report li { font-size: 13.5px; line-height: 1.8; color: var(--mp-ink-soft); overflow-wrap: anywhere; }
.mp-report blockquote {
  margin: 0;
  padding: 10px 14px;
  border-left: 3px solid var(--mp-line-strong);
  background: #fafbfd;
  font-size: 13px;
  color: var(--mp-ink-soft);
  line-height: 1.75;
  overflow-wrap: anywhere;
}
.mp-report a { color: var(--mp-blue); text-decoration: underline; overflow-wrap: anywhere; }

.mp-report-table { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.mp-report-table table { width: 100%; border-collapse: collapse; font-size: 13px; }
.mp-report-table th, .mp-report-table td {
  border: 1px solid var(--mp-line);
  padding: 8px 12px;
  text-align: left;
  vertical-align: top;
  overflow-wrap: anywhere;
}
.mp-report-table th { background: #fafbfd; font-weight: 600; color: var(--mp-ink-soft); white-space: nowrap; }

/* ---------------------------------------------------------------- team library */

.mp-search {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--mp-panel);
  border: 1px solid var(--mp-line);
  border-radius: var(--mp-radius);
  padding: 6px 10px;
  max-width: 420px;
  margin: 14px 16px 0;
}
.mp-search input { flex: 1 1 auto; min-width: 0; border: 0; outline: none; font: inherit; background: none; }
.mp-search button { border: 0; background: var(--mp-blue); color: #fff; border-radius: var(--mp-radius-sm); padding: 5px 14px; font-size: 13px; cursor: pointer; }

.mp-club-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 1px; background: var(--mp-line); }
.mp-club {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding: 11px 16px;
  background: var(--mp-panel);
  min-width: 0;
}
.mp-club:hover { background: #f8fafc; }
.mp-club b { font-size: 13.5px; font-weight: 550; min-width: 0; overflow-wrap: anywhere; }
.mp-club span { font-size: 11.5px; color: var(--mp-muted); }
.mp-club i { font-style: normal; font-size: 11px; color: var(--mp-muted); overflow-wrap: anywhere; }
.mp-club > *:nth-child(n + 3) { grid-column: 2; }

/* ---------------------------------------------------------------- footer */

.site-footer {
  border-top: 1px solid var(--mp-line);
  background: var(--mp-panel);
  padding: 16px 24px 22px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.site-footer-main { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px; font-size: 12px; color: var(--mp-muted); }
.site-footer-main a { color: var(--mp-muted); }
.site-footer-main a:hover { color: var(--mp-blue); }
.mps-beian-link { display: inline-flex; align-items: center; gap: 5px; }
.mps-beian-link img { display: block; }
.site-footer p { font-size: 11.5px; color: var(--mp-muted); }

/* ---------------------------------------------------------------- responsive */

@media (max-width: 1240px) {
  .mp-table-fourteen .mp-tr, .mp-table-fourteen .mp-thead {
    grid-template-columns: 36px 76px minmax(0, 1.1fr) 140px 100px 92px;
  }
}

@media (max-width: 960px) {
  :root { --mp-sidebar-w: 64px; }
  .mp-sidebar { padding: 12px 8px; }
  .mp-sidebar-brand img { max-width: 44px; }
  .mp-sidebar-nav a { justify-content: center; padding: 9px 0; }
  .mp-sidebar-nav a span { display: none; }
  .mp-sidebar-foot { font-size: 0; padding: 10px 0 0; }
  .mp-sidebar-foot b { display: none; }
  .mp-page { padding: 16px 14px 32px; }
  .mp-topbar { padding: 0 14px; gap: 12px; }
  .mp-topbar-title { display: none; }
  .mp-thead { position: static; }

  /* Labels replace the hidden column headers. */
  .mp-cell-label {
    display: block;
    font-size: 10.5px;
    letter-spacing: 0.04em;
    color: var(--mp-muted);
    font-weight: 500;
    margin-bottom: 1px;
  }

  /* 十四场: every field on its own line, full club names, crests intact. */
  .mp-table-fourteen .mp-thead { display: none; }
  .mp-table-fourteen .mp-tr {
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-areas:
      "seq    league"
      "teams  teams"
      "model  score"
      "time   time";
    row-gap: 8px;
    column-gap: 12px;
    padding: 12px;
    align-items: start;
  }
  .mp-table-fourteen .mp-seq { grid-area: seq; }
  .mp-table-fourteen .mp-league { grid-area: league; text-align: right; }
  .mp-table-fourteen .mp-teams { grid-area: teams; flex-wrap: wrap; row-gap: 4px; }
  .mp-table-fourteen .mp-model { grid-area: model; }
  .mp-table-fourteen .mp-score { grid-area: score; text-align: right; }
  .mp-table-fourteen .mp-tr > time { grid-area: time; }

  /* 赛程赛果 */
  .mp-table-result .mp-thead { display: none; }
  .mp-table-result .mp-tr {
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-areas:
      "league league league"
      "home   score  away"
      "state  state  state";
    row-gap: 6px;
    column-gap: 10px;
    padding: 12px;
    align-items: center;
  }
  .mp-table-result .mp-league { grid-area: league; }
  .mp-table-result .mp-teams:first-of-type { grid-area: home; justify-content: flex-end; text-align: right; }
  .mp-table-result .mp-score { grid-area: score; }
  .mp-table-result .mp-teams + .mp-score + .mp-teams { grid-area: away; }
  .mp-table-result .mp-tr > .mp-state { grid-area: state; text-align: left; }

  /* 首页 / 比赛中心 / 报告中心 */
  .mp-table-home .mp-thead, .mp-table-centre .mp-thead, .mp-table-reports .mp-thead { display: none; }
  .mp-table-home .mp-tr, .mp-table-centre .mp-tr, .mp-table-reports .mp-tr {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "teams state"
      "when  league"
      "stages stages";
    row-gap: 6px;
    padding: 12px;
    align-items: start;
  }
  .mp-table-home .mp-teams, .mp-table-centre .mp-teams, .mp-table-reports .mp-teams {
    grid-area: teams;
    flex-wrap: wrap;
    row-gap: 4px;
  }
  .mp-table-home .mp-state, .mp-table-centre .mp-state, .mp-table-reports .mp-state { grid-area: state; text-align: right; }
  .mp-table-home .mp-tr > time, .mp-table-centre .mp-tr > time, .mp-table-reports .mp-tr > time { grid-area: when; }
  .mp-table-home .mp-league, .mp-table-centre .mp-league, .mp-table-reports .mp-league {
    grid-area: league;
    justify-self: end;
    text-align: right;
  }
  .mp-table-centre .mp-stage-list, .mp-table-reports .mp-stage-list { grid-area: stages; }
  /* 首页行没有阶段标签：不给 stages 行留高度。 */
  .mp-table-home .mp-tr { grid-template-areas:
      "teams state"
      "when  league";
  }

  .mp-detail-head { grid-template-columns: minmax(0, 1fr); gap: 10px; text-align: left; }
  .mp-detail-score { text-align: left; }
  .mp-detail-score b { font-size: 22px; }
  .mp-stagebar { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .mp-report { padding: 12px 14px 16px; }
  .mp-facts { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .mp-sidebar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    top: auto;
    z-index: 40;
    height: auto;
    flex-direction: row;
    border-right: 0;
    border-top: 1px solid var(--mp-line);
    padding: 4px;
    overflow-x: auto;
  }
  /* Keep the last row of content clear of the fixed bottom navigation. */
  body { padding-bottom: 58px; }
  .mp-shell { grid-template-columns: minmax(0, 1fr); padding-bottom: 0; }
  .mp-sidebar-brand, .mp-sidebar-foot { display: none; }
  .mp-sidebar-nav { flex-direction: row; gap: 2px; width: 100%; }
  .mp-sidebar-nav a { flex: 0 0 auto; padding: 8px 12px; }
  .mp-sidebar-nav a span { display: inline; font-size: 12.5px; }
  .mp-page { padding: 14px 12px 28px; }
  .mp-heading h1 { font-size: 19px; }
  .mp-panel-head { padding: 11px 12px; }
  .mp-tr { padding: 12px; }
  .mp-search { margin: 12px 12px 0; max-width: none; }
  .mp-club-grid { grid-template-columns: minmax(0, 1fr); }
  .mp-stagebar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mp-report-table th { white-space: normal; }
  .site-footer { padding: 14px 16px 18px; }
}

/* Legal pages (terms / privacy) */
.mp-legal { padding: 8px 0 16px; }
.mp-legal h2 { padding: 12px 16px 4px; font-size: 15px; }
.mp-legal p { padding: 2px 16px 6px; font-size: 13.5px; line-height: 1.75; color: var(--mp-text, #1c2330); }
.mp-legal p.mp-legal-pending { color: var(--mp-muted, #6b7280); background: rgba(0,0,0,0.035); border-left: 3px solid var(--mp-muted, #6b7280); margin: 4px 16px; padding: 8px 12px; border-radius: 4px; }
.mp-legal .mp-note { padding-top: 16px; }

/* Jingcai card (match centre) */
.mp-jingcai-card { margin-bottom: 16px; }
.mp-jingcai-card .mp-jc-count { font-size: 12.5px; color: var(--mp-muted, #6b7a90); }
.mp-jc-list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0; }
.mp-jc-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--mp-line, #e3e8f0);
  text-decoration: none;
  color: var(--mp-ink, #16202e);
  min-width: 0;
}
.mp-jc-row:last-child { border-bottom: 0; }
.mp-jc-row:hover { background: var(--mp-blue-soft, #eef4ff); }
.mp-jc-no {
  flex: 0 0 auto;
  min-width: 34px;
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--mp-blue, #1465d8);
  background: var(--mp-blue-soft, #eef4ff);
  border: 1px solid var(--mp-line, #e3e8f0);
  border-radius: 4px;
  padding: 2px 4px;
  font-variant-numeric: tabular-nums;
}
.mp-jc-row time { flex: 0 0 44px; font-size: 12.5px; color: var(--mp-muted, #6b7a90); font-variant-numeric: tabular-nums; }
.mp-jc-row .mp-league { flex: 0 0 150px; font-size: 12px; color: var(--mp-muted, #6b7a90); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mp-jc-row .mp-teams { flex: 1 1 auto; display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; min-width: 0; overflow: hidden; white-space: nowrap; }
.mp-jc-row .mp-teams b { overflow: hidden; text-overflow: ellipsis; }
.mp-jc-row .mp-teams i { font-style: normal; font-size: 11px; color: var(--mp-muted, #6b7a90); }
.mp-jc-row .mp-state { flex: 0 0 auto; font-size: 11.5px; color: var(--mp-muted, #6b7a90); white-space: nowrap; }
.mp-jc-row .mp-state.is-ready { color: var(--mp-green, #15803d); }

/* Jingcai number badge inside match-centre / home table league cell */
.mp-league .mp-jc-no { margin-right: 6px; vertical-align: 1px; }

@media (max-width: 860px) {
  .mp-jc-row .mp-league { display: none; }
  .mp-jc-row .mp-state { display: none; }
  .mp-jc-row time { flex: 0 0 40px; }
  .mp-jc-row .mp-teams { font-size: 12.5px; }
}
