/* assets/matches.css — 比赛档案页 v22（全屏详情 + 半星评分 + 评论重构） */

/* ==================== 工具栏 ==================== */
.match-toolbar {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 20px;
  padding: 16px 20px;
  background: var(--bg2);
  border: 1px solid var(--rule);
  border-radius: 14px;
}
.tool-search {
  position: relative;
  flex: 1;
  min-width: 220px;
  max-width: 360px;
}
.tool-search .tool-icon {
  position: absolute;
  left: 12px; top: 50%;
  transform: translateY(-50%);
  font-size: 14px;
  opacity: .6;
  pointer-events: none;
}
.tool-search input {
  width: 100%;
  height: 38px;
  padding: 0 34px 0 34px;
  background: var(--bg3);
  border: 1px solid var(--rule);
  border-radius: 10px;
  color: var(--ink);
  font-size: 13px;
  font-family: inherit;
  transition: border-color .15s;
}
.tool-search input:focus { outline: none; border-color: var(--accent); }
.tool-search input::placeholder { color: var(--muted); }
.tool-clear {
  position: absolute;
  right: 8px; top: 50%;
  transform: translateY(-50%);
  width: 22px; height: 22px;
  display: none;
  align-items: center; justify-content: center;
  background: none; border: none;
  color: var(--muted);
  font-size: 12px;
  border-radius: 50%;
  cursor: pointer;
  transition: color .15s, background .15s;
}
.tool-clear:hover { color: var(--ink); background: var(--rule); }
.tool-search.has-value .tool-clear { display: inline-flex; }

.tool-filters {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}
.chip-filter {
  padding: 7px 14px;
  background: transparent;
  border: 1px solid var(--rule);
  border-radius: 20px;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: color .15s, background .15s, border-color .15s;
  white-space: nowrap;
}
.chip-filter:hover { color: var(--ink); border-color: rgba(255,122,26,.4); }
.chip-filter.active {
  color: #160A02;
  background: var(--accent);
  border-color: var(--accent);
}

.tool-stats {
  display: flex;
  gap: 16px;
  margin-left: auto;
}
.stat-chip {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.1;
}
.stat-chip b {
  font-family: var(--disp);
  font-size: 22px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: .02em;
}
.stat-chip span {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}

/* ==================== 比赛卡片网格 ==================== */
.matches-list-wrap { padding: 0; }
.matches-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 16px;
}

.mcard {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 0;
  background: var(--bg2);
  border: 1px solid var(--rule);
  border-radius: 14px;
  cursor: pointer;
  transition: transform .2s, border-color .2s, box-shadow .2s;
}
.mcard:hover {
  transform: translateY(-2px);
  border-color: rgba(255,122,26,.4);
  box-shadow: 0 8px 24px rgba(0,0,0,.25);
}

.mcard-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-bottom: 1px solid var(--rule);
  background: var(--bg3);
}
.mcard-date-big {
  font-family: var(--disp);
  font-size: 14px;
  font-weight: 700;
  color: var(--accent2);
  letter-spacing: .04em;
}
.mcard-result {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 12px;
  letter-spacing: .03em;
}
.mcard-result.win { background: rgba(200,245,66,.15); color: var(--accent2); }
.mcard-result.lose { background: rgba(255,90,90,.15); color: var(--red); }
.mcard-result.draw { background: rgba(138,146,166,.15); color: var(--muted); }
.mcard-result.none { background: rgba(90,140,255,.15); color: var(--blue); }

.mcard-body { padding: 14px 16px; flex: 1; display: flex; flex-direction: column; }
.mcard-title-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 10px;
  min-height: 20px;
}
.mcard-title-text {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}
.mcard-loc { font-size: 11px; color: var(--muted); white-space: nowrap; flex-shrink: 0; }

.mcard-score {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 0 14px;
  min-height: 56px;
  font-family: var(--disp);
}
.mcard-team { display: flex; flex-direction: column; align-items: center; gap: 4px; flex: 1; min-width: 0; }
.mcard-team .mcard-team-name {
  font-family: var(--body); font-size: 12px; font-weight: 600; color: var(--ink);
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.mcard-team.team-a .mcard-team-name { color: var(--red); }
.mcard-team.team-b .mcard-team-name { color: var(--blue); }
.mcard-team .mcard-team-score {
  font-family: var(--disp); font-size: 30px; font-weight: 700; line-height: 1; letter-spacing: .03em; color: var(--ink);
}
.mcard-vs { font-size: 16px; font-weight: 700; color: var(--muted); padding: 0 4px; align-self: center; }

.mcard-footer {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding-top: 10px; border-top: 1px dashed var(--rule); margin-top: auto;
}
.chip-sm {
  display: inline-flex; align-items: center; gap: 2px;
  padding: 4px 10px; background: var(--bg3); border: 1px solid var(--rule);
  border-radius: 12px; font-size: 11px; color: var(--muted); white-space: nowrap; line-height: 1;
}
.chip-sm b { color: var(--ink); font-weight: 700; }
.chip-sm .val { color: var(--accent); font-weight: 700; font-family: var(--disp); }

/* ==================== 分页 ==================== */
.matches-pager { display: flex; justify-content: center; gap: 7px; padding: 24px 0 0; flex-wrap: wrap; }
.pg-btn {
  min-width: 38px; min-height: 38px; padding: 7px 12px;
  background: var(--bg2); border: 1px solid var(--rule); color: var(--muted);
  border-radius: 9px; font-size: 13px; cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}
.pg-btn:hover:not(:disabled):not(.active) { background: var(--bg3); border-color: rgba(255,122,26,.35); color: var(--ink); }
.pg-btn.active { background: var(--accent); color: #160A02; border-color: var(--accent); font-weight: 700; }
.pg-btn:disabled { opacity: .3; cursor: not-allowed; }
.pg-dots { color: var(--muted); padding: 7px 4px; }

/* ==================== 全屏详情页（独立界面） ==================== */
.match-detail-page {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 20px 32px 40px;
}
.detail-page-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 20px;
}
.detail-back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 7px 14px;
  background: var(--bg2);
  border: 1px solid var(--rule);
  border-radius: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: color .15s, border-color .15s, background .15s;
  white-space: nowrap;
}
.detail-back:hover { color: var(--ink); border-color: var(--accent); background: var(--bg3); }
.detail-page-title {
  flex: 1;
  min-width: 0;
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.detail-page-title small {
  display: block;
  font-size: 12px;
  font-weight: 400;
  color: var(--muted);
  margin-top: 4px;
  white-space: normal;
}
.detail-page-spacer { width: 100px; flex-shrink: 0; }

.detail-page-body {
  display: flex;
  flex-direction: column;
  gap: 18px;
  max-width: 1100px;
  margin: 0 auto;
  width: 100%;
}

/* —— Hero 比分卡 —— */
.detail-hero {
  display: flex;
  align-items: stretch;
  gap: 16px;
  padding: 22px 24px;
  background: linear-gradient(120deg, var(--bg2) 0%, rgba(255,122,26,.05) 100%);
  border: 1px solid var(--rule);
  border-radius: 14px;
}
.detail-score-block {
  flex: 1.4;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 8px 0;
  font-family: var(--disp);
}
.detail-team { display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 100px; }
.detail-team-name { font-family: var(--body); font-size: 15px; font-weight: 600; color: var(--ink); text-align: center; }
.detail-team.team-a .detail-team-name { color: var(--red); }
.detail-team.team-b .detail-team-name { color: var(--blue); }
.detail-team-score { font-family: var(--disp); font-size: 56px; font-weight: 700; line-height: 1; letter-spacing: .03em; color: var(--ink); }
.detail-team-score.winning { color: var(--accent2); }
.detail-vs-big { font-size: 22px; font-weight: 700; color: var(--muted); align-self: center; }

.detail-info-block {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
  padding: 8px 0 8px 20px;
  border-left: 1px solid var(--rule);
}
.detail-info-row { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.detail-info-row .info-label { color: var(--muted); min-width: 52px; flex-shrink: 0; }
.detail-info-row .info-value { color: var(--ink); font-weight: 500; }

/* —— 管理操作栏 —— */
.detail-manage { display: flex; gap: 8px; flex-wrap: wrap; }
.detail-manage .btn { padding: 7px 14px; font-size: 12.5px; }

/* —— MVP 荣誉卡 —— */
.mvp-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px 20px;
  background: linear-gradient(135deg, rgba(255,122,26,.1), rgba(200,245,66,.05));
  border: 1px solid rgba(255,122,26,.35);
  border-radius: 14px;
}
.mvp-provisional { display: inline-block; align-self: flex-start; font-size: 11px; padding: 3px 10px; border-radius: 20px; background: rgba(200,245,66,.15); color: var(--accent2); font-weight: 600; letter-spacing: .03em; }
.mvp-final { display: inline-block; align-self: flex-start; font-size: 11px; padding: 3px 10px; border-radius: 20px; background: rgba(255,122,26,.15); color: var(--accent); font-weight: 600; letter-spacing: .03em; }
.mvp-head { display: flex; align-items: center; gap: 14px; }
.mvp-icon { font-size: 40px; line-height: 1; }
.mvp-info { flex: 1; min-width: 0; }
.mvp-titles { font-size: 20px; font-weight: 700; color: var(--ink); margin-bottom: 4px; }
.mvp-name { color: var(--accent); }
.mvp-sub { font-size: 12px; color: var(--muted); }

.mvp-bars { display: flex; flex-direction: column; gap: 8px; }
.bar-row { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.bar-label { width: 76px; color: var(--muted); flex-shrink: 0; font-size: 12px; }
.bar-bg { flex: 1; height: 6px; background: var(--bg3); border-radius: 3px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 3px; transition: width .4s cubic-bezier(.4,0,.2,1); }
.bar-fill.data { background: linear-gradient(90deg, #5A8CFF, #3498db); }
.bar-fill.pop { background: linear-gradient(90deg, #FF7A1A, #e74c3c); }
.bar-fill.total { background: linear-gradient(90deg, #C8F542, #FF7A1A); }
.bar-val { width: 38px; text-align: right; font-family: var(--disp); font-size: 12px; color: var(--ink); letter-spacing: .02em; }
.bar-row.total { margin-top: 2px; font-weight: 600; }
.bar-row.total .bar-label { color: var(--accent); font-weight: 700; }
.bar-row.total .bar-val { color: var(--accent); font-weight: 700; }
.mvp-note { font-size: 11.5px; color: var(--muted); line-height: 1.55; margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--rule); }

/* —— 球队技术统计卡 —— */
.team-section { padding: 16px 18px; background: var(--bg2); border: 1px solid var(--rule); border-radius: 12px; }
.team-title {
  font-size: 14px; font-weight: 700; margin-bottom: 12px; padding-bottom: 10px;
  border-bottom: 1px solid var(--rule); display: flex; align-items: center; gap: 8px; color: var(--ink);
}
.team-title .team-badge {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 50%;
  font-family: var(--disp); font-size: 12px; font-weight: 700; color: #fff;
}
.team-section:nth-of-type(odd) .team-title .team-badge { background: var(--red); }
.team-section:nth-of-type(even) .team-title .team-badge { background: var(--blue); }
.team-name { font-size: 16px; }
.team-count { font-size: 11px; color: var(--muted); font-weight: 400; margin-left: auto; }

.stat-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.stat-table th {
  text-align: right; padding: 8px 6px; color: var(--muted); font-weight: 600;
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em;
  border-bottom: 1px solid var(--rule); white-space: nowrap;
}
.stat-table th:first-child { text-align: left; }
.stat-table td { padding: 9px 6px; border-bottom: 1px solid rgba(255,255,255,.04); color: var(--ink); text-align: right; font-variant-numeric: tabular-nums; }
.stat-table td:first-child { text-align: left; }
.stat-table tbody tr:hover td { background: rgba(255,255,255,.03); }
.stat-table .pname { font-weight: 600; color: var(--ink); white-space: nowrap; }
.stat-table .pname em { font-style: normal; color: var(--muted); font-size: 11px; margin-left: 4px; }
.stat-table .cc { color: var(--accent); font-weight: 700; font-family: var(--disp); }

/* ==================== 半星评分组件 ==================== */
.star-cell { text-align: center; white-space: nowrap; }
.half-stars {
  position: relative;
  display: inline-block;
  cursor: pointer;
  height: 18px;
  user-select: none;
  -webkit-user-select: none;
}
.half-stars .stars-track {
  display: flex;
  gap: 1px;
  font-size: 16px;
  line-height: 18px;
  color: rgba(255,255,255,.12);
}
.half-stars .stars-track span { width: 16px; text-align: center; }
.half-stars .stars-fill {
  position: absolute;
  top: 0; left: 0;
  overflow: hidden;
  pointer-events: none;
  font-size: 16px;
  line-height: 18px;
  color: var(--accent);
  white-space: nowrap;
  transition: width .18s cubic-bezier(.4,0,.2,1);
}
.half-stars .stars-fill span { width: 16px; text-align: center; display: inline-block; }
.half-stars.is-hover .stars-fill { transition: none; }

/* MVP 投票按钮 */
.vote-cell { text-align: center; }
.mvp-vote {
  background: rgba(90,140,255,.12); border: 1px solid rgba(90,140,255,.35); color: var(--blue);
  border-radius: 14px; padding: 4px 12px; font-size: 11.5px; font-weight: 600;
  cursor: pointer; transition: all .15s; white-space: nowrap; font-family: inherit;
}
.mvp-vote:hover { background: rgba(90,140,255,.22); }
.mvp-vote.voted { background: rgba(200,245,66,.15); border-color: rgba(200,245,66,.4); color: var(--accent2); }

/* ==================== 编辑器（仍用 modal） ==================== */
.match-editor { max-width: 1100px; width: 94%; max-height: 92vh; }
.editor-tabs { display: flex; gap: 4px; padding: 12px 20px; border-bottom: 1px solid var(--rule); }
.tab-btn {
  background: var(--bg3); border: 1px solid var(--rule); color: var(--muted);
  border-radius: 8px; padding: 8px 16px; font-size: 13px; font-weight: 600;
  font-family: inherit; cursor: pointer; transition: all .15s;
}
.tab-btn:hover:not(.active) { color: var(--ink); border-color: var(--accent); }
.tab-btn.active { background: var(--accent); color: #160A02; border-color: var(--accent); }
.editor-panel { display: none; padding: 16px 20px; }
.editor-panel.active { display: block; }
.editor-panel label { display: flex; flex-direction: column; margin-bottom: 14px; font-size: 12px; color: var(--muted); font-weight: 500; }
.editor-panel input[type="text"],
.editor-panel input[type="number"],
.editor-panel input[type="date"],
.editor-panel textarea {
  margin-top: 6px; background: var(--bg3); border: 1px solid var(--rule); border-radius: 8px;
  padding: 9px 12px; color: var(--ink); font-size: 14px; font-family: inherit; transition: border-color .15s;
}
.editor-panel textarea { resize: vertical; min-height: 70px; }
.editor-panel input:focus, .editor-panel textarea:focus { outline: none; border-color: var(--accent); }
.team-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.roster-controls { display: flex; gap: 10px; align-items: center; padding: 12px; background: var(--bg3); border-radius: 10px; margin-bottom: 16px; flex-wrap: wrap; border: 1px solid var(--rule); }
.roster-controls select { flex: 1; min-width: 200px; background: var(--bg3); border: 1px solid var(--rule); border-radius: 8px; padding: 8px 10px; color: var(--ink); font-size: 13px; }
.roster-controls option { background: var(--bg2); }
.roster-empty { text-align: center; padding: 20px; color: var(--muted); font-size: 13px; }
.roster-team { margin-bottom: 20px; }
.roster-team-title { font-size: 14px; font-weight: 700; margin-bottom: 8px; color: var(--ink); }
.roster-input input[type="number"] { width: 52px; background: var(--bg3); border: 1px solid var(--rule); border-radius: 6px; padding: 5px 6px; color: var(--ink); font-size: 13px; text-align: center; font-family: var(--body); }
.roster-input input[type="number"]:focus { outline: none; border-color: var(--accent); }
.remove-btn { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 14px; padding: 4px 8px; border-radius: 4px; transition: color .15s, background .15s; }
.remove-btn:hover { color: var(--red); background: rgba(255,90,90,.1); }

.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 12px 20px; border-top: 1px solid var(--rule); }

/* ==================== Toast ==================== */
.toast {
  position: fixed; top: 20px; left: 50%; transform: translateX(-50%);
  background: rgba(200,245,66,.95); color: #0A0C12; padding: 10px 22px; border-radius: 24px;
  font-size: 13px; font-weight: 600; z-index: 9999;
  box-shadow: 0 4px 16px rgba(0,0,0,.3); transition: opacity .3s;
}
.toast.fade { opacity: 0; }

/* ==================== 响应式 ==================== */
@media (min-width: 1200px) {
  .matches-list { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
}
@media (min-width: 768px) and (max-width: 1199px) {
  .matches-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tool-stats { margin-left: 0; }
  .detail-team-score { font-size: 46px; }
}
@media (max-width: 767px) {
  .match-detail-page { padding: 14px 16px 30px; }
  .detail-page-header { gap: 10px; padding-bottom: 12px; margin-bottom: 16px; }
  .detail-back { padding: 6px 10px; font-size: 12px; }
  .detail-page-title { font-size: 15px; }
  .detail-page-spacer { width: 60px; }

  .match-toolbar { padding: 14px; gap: 12px; }
  .tool-search { max-width: 100%; min-width: 0; }
  .tool-filters { order: 3; width: 100%; justify-content: flex-start; }
  .chip-filter { padding: 6px 12px; font-size: 12px; }
  .tool-stats { width: 100%; justify-content: flex-start; margin-left: 0; }
  .stat-chip b { font-size: 19px; }

  .matches-list-wrap { padding: 0; }
  .matches-list { grid-template-columns: 1fr; gap: 12px; }
  .mcard { contain: layout style; transition: border-color .2s; }
  .mcard:hover { transform: none; box-shadow: none; border-color: var(--rule); }
  .mcard-team .mcard-team-score { font-size: 26px; }

  .pg-btn { min-width: 44px; min-height: 44px; }

  .match-editor { width: 98%; max-height: 98vh; }
  .match-editor .modal-body { padding: 12px; }

  .detail-hero { flex-direction: column; padding: 16px; gap: 14px; }
  .detail-info-block { border-left: none; border-top: 1px solid var(--rule); padding-left: 0; padding-top: 12px; flex-direction: row; flex-wrap: wrap; gap: 6px 16px; }
  .detail-team-score { font-size: 42px; }
  .detail-score-block { gap: 10px; padding: 4px 0; }

  .team-section { padding: 14px; }
  .stat-table { font-size: 12px; display: block; overflow-x: auto; }
  .stat-table th, .stat-table td { padding: 6px 4px; }
  .roster-input input[type="number"] { width: 44px; }

  .mvp-head { gap: 10px; }
  .mvp-icon { font-size: 32px; }
  .mvp-titles { font-size: 17px; }
  .bar-label { width: 60px; font-size: 11.5px; }
  .bar-val { width: 32px; font-size: 11px; }
}
@media (max-width: 420px) {
  .mcard-top { padding: 8px 14px; }
  .mcard-body { padding: 12px 14px; }
  .chip-filter { padding: 6px 10px; font-size: 11.5px; }
  .detail-team-score { font-size: 36px; }
  .mvp-titles { font-size: 15px; }
  .detail-info-row { font-size: 11.5px; }
  .tool-stats { gap: 12px; }
  .stat-chip b { font-size: 17px; }
}
