/* =========================================================================
   i9tv.cn — 比赛卡片（首页 / 赛事页共用）
   整卡不可点击；仅队名/队标、中间首发判定区、右下 B站CS专区 可点。
   ========================================================================= */

/* 赛段标签专用色：浅色档更深、暗色档更亮（对比度高于 --text-tertiary） */
:root {
  --stage-label: #3f4a5a;
}
[data-theme="dark"] {
  --stage-label: #c9d1e0;
}

.match-card {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;   /* 队伍行落在卡片垂直中心 */
  gap: 8px;
  min-width: 0;
  min-height: 128px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card-bg);
  color: var(--text);
  cursor: default; /* 整卡不可点；只有内部明确的可点区域使用 pointer */
}

/* 首页（row）/ 赛事页（card）统一：状态·时间·B站行绝对贴底，不再把队伍行顶到上半部分 */
.match-card .mc-foot {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 6px;
}

/* 赛事页三个区块是普通堆叠容器；首页是 grid（gap 已负责间距），故只给 panel 加间隔 */
.match-card--card + .match-card--card {
  margin-top: 12px; /* 与首页 grid gap-3 的 12px 对齐 */
}

/* ---------- 主体：队伍 - 中间判定区 - 队伍 ---------- */
.mc-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.mc-side {
  display: flex;
  align-items: center;
  min-width: 0;
}
.mc-side--left { justify-content: flex-end; }
.mc-side--right { justify-content: flex-start; }

/* 队名/队标链接（唯一可点区域之一） */
.mc-team-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  max-width: 100%;
  margin: -2px -4px;
  padding: 2px 4px;
  border-radius: 8px;
  color: inherit;
  text-decoration: none;
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease-hig), color var(--dur-fast) var(--ease-hig);
}
.mc-team-link:hover { color: var(--primary); }
.mc-team-link:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 1px;
}
.mc-team-link--static {
  cursor: default;
  color: inherit;
}
.mc-team-link--static:hover { color: inherit; }

.mc-team-name {
  min-width: 0;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mc-team-logo {
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
  overflow: hidden;
  border-radius: 10px;
  background: var(--bg-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
}
.mc-team-logo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* ---------- 中间判定区：首发弹层入口（≥120×56，居中） ---------- */
.mc-center {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  min-width: 120px;
  height: 56px;
  padding: 2px 14px;
  margin: 0;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  transition: background var(--dur-fast) var(--ease-hig), border-color var(--dur-fast) var(--ease-hig);
}
.mc-center:hover {
  background: var(--bg-secondary);
  border-color: var(--border-strong);
}
.mc-center:active { transform: translateY(1px); }
.mc-center:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}
.mc-center--static {
  cursor: default;
}
.mc-center--static:hover {
  background: transparent;
  border-color: transparent;
}

.mc-center-score {
  font-size: 18px;
  font-weight: 800;
  line-height: 1.1;
  color: var(--primary);
  white-space: nowrap;
}
.mc-center--upcoming .mc-center-score {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-secondary);
  letter-spacing: 0.08em;
}
.mc-center-hint {
  font-size: 10px;
  line-height: 1.2;
  color: var(--text-tertiary);
  letter-spacing: 0.04em;
  white-space: nowrap;
}

/* ---------- 底部：状态 + 赛段胶囊 … 时间 + B站CS专区 ---------- */
.mc-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px 12px;
  min-width: 0;
}
.mc-foot-start {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
}
.mc-foot-end {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 10px;
  margin-left: auto;
}

/* 进行中/已结束/即将开始：14px（与右下 B站CS专区 同档），整行高度一致 */
.mc-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  white-space: nowrap;
  color: var(--text-secondary);
}
.mc-status--live { color: var(--danger); }
.mc-status--past { color: var(--text-tertiary); font-weight: 500; }
.mc-status--upcoming { color: var(--text-secondary); font-weight: 500; }

.mc-cast { font-size: 10px; }

/* 赛段详细化：league · serie · tournament，各自翻译后以胶囊呈现 */
.mc-stage {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  min-width: 0;
}
.mc-stage-part {
  padding: 1px 6px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: var(--bg-secondary);
  color: var(--stage-label);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.6;
  white-space: nowrap;
}
.mc-stage-sep {
  color: var(--text-tertiary);
  font-size: 11px;
  line-height: 1;
}
[data-theme="dark"] .mc-stage-part {
  border-color: var(--hairline);
}

.mc-time {
  font-size: 15px;
  line-height: 1.4;
  color: var(--text-tertiary);
  white-space: nowrap;
}
.mc-winner {
  padding: 1px 6px;
  border-radius: 8px;
  background: var(--success-soft-bg);
  color: var(--success-fg);
  font-size: 10px;
  white-space: nowrap;
}
.mc-bili {
  /* 与卡底左侧「进行中」同字号（.mc-status 14px），保持一行内文字层级一致 */
  font-size: 14px;
  font-weight: 600;
  color: var(--primary);
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}
.mc-bili:hover { text-decoration: underline; }
.mc-bili:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
  border-radius: 4px;
}

.mc-extra {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* ---------- 卡片内文字配色统一：只有一种白 + 一种红 ----------
   队名/赛段/时间/首发提示/状态文字 → 同一种白（--text）
   进行中/比分/B站CS专区/老九解说 → 同一种红（老九红 #E24B4A）
   背景、边框、按钮底色不在此列，保持原样 */
.match-card {
  --mc-ink: var(--text);
  /* 文字红统一走 --brand-text（浅 #C62F2E / 深 #ED6161），
     对卡片底色 5.46 / 4.92:1，符合 color-contract-v4 §4.4；
     --brand-identity #E24B4A 仅对卡底 4.05:1，小字不达 4.5，故不用于文字 */
  --mc-red: var(--brand-text);
}
.match-card .mc-team-name,
.match-card .mc-stage,
.match-card .mc-time,
.match-card .mc-center-hint,
.match-card .mc-status,
.match-card .mc-status--past,
.match-card .mc-status--upcoming,
.match-card .mc-center--upcoming .mc-center-score {
  color: var(--mc-ink);
}
.match-card .mc-status--live,
.match-card .mc-center-score,
.match-card .mc-bili {
  color: var(--mc-red);
}
.match-card .mc-team-logo { color: var(--mc-ink); }
.match-card .mc-team-link:hover { color: var(--mc-red); }
.match-card .dot-live { background: var(--mc-red); }

/* ---------- 响应式 ---------- */
@media (max-width: 640px) {
  .match-card { padding: 10px 12px; }
  .mc-main { gap: 6px; }
  /* 窄屏底部行可能折行，回到常规文档流，避免绝对定位压住队伍行 */
  .match-card { min-height: 0; justify-content: flex-start; }
  .match-card .mc-foot {
    position: static;
    left: auto;
    right: auto;
    bottom: auto;
  }
  .mc-team-logo { flex-basis: 28px; width: 28px; height: 28px; border-radius: 6px; }
  .mc-team-name { font-size: 13px; }
  .mc-center { min-width: 120px; height: 56px; padding: 2px 8px; }
  .mc-foot-end { gap: 6px 8px; }
}

@media (prefers-reduced-motion: reduce) {
  .match-card,
  .mc-team-link,
  .mc-center {
    transition: none;
  }
}
