/* 比赛详情弹窗布局 v1 · 只作用于 #matchDialog。放在现有样式之后。 */
#matchDialog {
  --md-bg: #061521;
  --md-card: #0a1e2c;
  --md-line: #213f53;
  --md-text: #eaf3fb;
  --md-muted: #94b2c8;
  --md-home: #62c9ef;
  --md-away: #c4f436;
  --md-track: #183447;
  box-sizing: border-box;
  width: min(960px, calc(100vw - 32px));
  max-width: 960px;
  max-height: calc(100vh - 40px);
  max-height: calc(100dvh - 40px);
  margin: auto;
  padding: 0;
  overflow: hidden;
  color: var(--md-text);
  background: var(--md-bg);
  border: 1px solid var(--md-line);
  border-radius: 16px;
  box-shadow: 0 24px 90px #0008;
}
#matchDialog[open] { display: flex; flex-direction: column; }
#matchDialog::backdrop { background: #020810c9; backdrop-filter: blur(7px); }
#matchDialog .dialoghead {
  flex: 0 0 auto;
  padding: 16px 22px;
  background: var(--md-bg);
  border-bottom: 1px solid var(--md-line);
}
#matchDialog .dialoghead h2 {
  margin: 0;
  padding-left: 12px;
  border-left: 3px solid var(--md-away);
  color: var(--md-text);
  font-size: 17px;
  line-height: 1.5;
}
#matchDialog .dialoghead button {
  width: 36px;
  height: 36px;
  color: var(--md-muted);
  background: var(--md-card);
  border-color: var(--md-line);
}
#matchDialog :is(button, a):focus-visible {
  outline: 2px solid var(--md-home);
  outline-offset: 4px;
}
#matchDialog #matchDetail {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  padding: 20px 24px 24px;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--md-line) transparent;
}
#matchDialog #matchDetail > p.small:first-child {
  margin: 0 0 14px;
  color: var(--md-muted);
  font-size: 12px;
  line-height: 1.8;
  overflow-wrap: anywhere;
}

/* 主队 / 比分 / 客队：使用真实 DOM 内容，不通过伪元素写死名称或比分。 */
#matchDialog .detailteams {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(116px, .72fr) minmax(0, 1fr);
  align-items: center;
  gap: 20px;
  padding: 26px 18px;
  border: 1px solid var(--md-line);
  border-radius: 12px;
  background:
    radial-gradient(ellipse at 0 100%, #62c9ef12, transparent 60%),
    radial-gradient(ellipse at 100% 100%, #c4f4360c, transparent 60%),
    var(--md-card);
}
#matchDialog .detailteams > div {
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 9px;
  min-width: 0;
  text-align: center;
}
#matchDialog .detailteams .badge {
  display: block;
  width: 64px;
  height: 64px;
  margin: 0;
  object-fit: contain;
}
#matchDialog .detailteams b,
#matchDialog .detailteams .tlink {
  max-width: 100%;
  margin: 0;
  padding: 0;
  color: var(--md-text);
  font-size: 20px;
  font-weight: 700;
  line-height: 1.45;
  white-space: normal;
  overflow-wrap: anywhere;
}
#matchDialog .detailteams small {
  color: var(--md-muted);
  font-size: 11px;
  letter-spacing: .12em;
}
#matchDialog .detailteams > div:nth-child(2) strong {
  color: var(--md-text);
  font: 800 clamp(32px, 5vw, 54px)/1.15 Consolas, monospace;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  letter-spacing: -2px;
}
#matchDialog .detailteams > div:nth-child(2) .small {
  max-width: 100%;
  margin: 3px 0 0;
  padding: 5px 12px;
  border: 1px solid var(--md-line);
  border-radius: 20px;
  background: var(--md-bg);
  color: var(--md-muted);
  font-size: 11px;
  line-height: 1.5;
}
#matchDialog .notice {
  margin: 14px 0 0;
  padding: 10px 13px;
  color: var(--md-muted);
  background: var(--md-card);
  border: 1px solid var(--md-line);
  border-radius: 9px;
  font-size: 11px;
  line-height: 1.8;
}
#matchDialog #matchDetail > h3 {
  margin: 24px 0 8px !important;
  color: var(--md-text);
  font-size: 16px;
  font-weight: 700;
}

/* 原页面已经计算好每项宽度；只呈现对比条，不重新计算比赛数据。 */
#matchDialog .statline { padding: 11px 0; }
#matchDialog .statline + .statline { border-top: 1px solid var(--md-line); }
#matchDialog .statline .row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 14px;
  margin-bottom: 8px;
  line-height: 1.4;
}
#matchDialog .statline .row > span:first-child,
#matchDialog .statline .row > span:last-child {
  font: 700 17px/1.4 Consolas, monospace;
  font-variant-numeric: tabular-nums;
}
#matchDialog .statline .row > span:first-child { color: var(--md-home); text-align: left; }
#matchDialog .statline .row > span:last-child { color: var(--md-away); text-align: right; }
#matchDialog .statline .row > .muted { color: var(--md-muted); font-size: 12px; text-align: center; }
#matchDialog .statbars { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
#matchDialog .statbars > div {
  display: flex;
  height: 6px;
  min-width: 0;
  overflow: hidden;
  border-radius: 8px;
  background: var(--md-track);
}
#matchDialog .statbars > div:first-child { justify-content: flex-end; }
#matchDialog .statbars i {
  display: block;
  height: 100%;
  max-width: 100%;
  border-radius: inherit;
  background: var(--md-away);
}
#matchDialog .statbars > div:first-child i { background: var(--md-home); }

/* 近期状态与操作区。 */
#matchDialog #matchDetail > .row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--md-line);
  border-radius: 9px;
  background: var(--md-card);
}
#matchDialog #matchDetail > .row > :first-child { justify-self: start; }
#matchDialog #matchDetail > .row > :last-child { justify-self: end; }
#matchDialog #matchDetail > .row > small { color: var(--md-muted); font-size: 10px; text-align: center; }
#matchDialog .form { display: flex; flex-wrap: wrap; gap: 5px; }
#matchDialog .form span { width: 20px; height: 20px; font-size: 11px; }
#matchDialog #matchDetail > .flex:last-child {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 18px !important;
  padding-top: 18px;
  border-top: 1px solid var(--md-line);
}
#matchDialog #matchDetail > .flex:last-child button {
  min-height: 40px;
  padding: 9px 18px;
  color: var(--md-away);
  background: var(--md-card);
  border: 1px solid var(--md-line);
  border-radius: 8px;
  font-size: 12px;
}
#matchDialog #matchDetail > .flex:last-child a { color: var(--md-muted); font-size: 12px; line-height: 1.8; }
#matchDialog #matchDetail > .muted { color: var(--md-muted); font-size: 13px; line-height: 1.8; }

html[data-theme="light"] #matchDialog {
  --md-bg: #f8fbfe;
  --md-card: #edf4f9;
  --md-line: #cedde8;
  --md-text: #193446;
  --md-muted: #526e81;
  --md-home: #087eac;
  --md-away: #527800;
  --md-track: #d4e3ed;
}
@media (max-width: 540px) {
  #matchDialog {
    width: calc(100vw - 16px);
    max-height: calc(100vh - 24px);
    max-height: calc(100dvh - 24px);
    border-radius: 12px;
  }
  #matchDialog .dialoghead { padding: 12px 14px; }
  #matchDialog .dialoghead h2 { font-size: 16px; }
  #matchDialog #matchDetail { padding: 14px; }
  #matchDialog #matchDetail > p.small:first-child { font-size: 10px; margin-bottom: 10px; }
  #matchDialog .detailteams {
    grid-template-columns: minmax(0, 1fr) 84px minmax(0, 1fr);
    gap: 7px;
    padding: 20px 9px;
  }
  #matchDialog .detailteams > div { gap: 7px; }
  #matchDialog .detailteams .badge { width: 46px; height: 46px; }
  #matchDialog .detailteams b,
  #matchDialog .detailteams .tlink { font-size: 14px; }
  #matchDialog .detailteams > div:nth-child(2) strong { font-size: 32px; letter-spacing: -1px; }
  #matchDialog .detailteams > div:nth-child(2) .small { font-size: 10px; padding: 4px 8px; }
  #matchDialog .notice { padding: 9px 11px; font-size: 10px; }
  #matchDialog #matchDetail > .row { grid-template-columns: 1fr 1fr; padding: 12px; gap: 10px; }
  #matchDialog #matchDetail > .row > small { grid-column: 1 / -1; grid-row: 2; }
  #matchDialog #matchDetail > .row > :last-child { grid-column: 2; grid-row: 1; }
  #matchDialog #matchDetail > .flex:last-child { gap: 10px; }
  #matchDialog #matchDetail > .flex:last-child a { font-size: 11px; }
}
