/* ============ 基础与主题 ============ */
:root {
  --bg: #f4f6f9;
  --card: #ffffff;
  --ink: #1c2430;
  --ink-2: #5c6b7f;
  --line: #e3e8ef;
  --brand: #0a7d43;
  --brand-2: #0fa25a;
  --live: #e5484d;
  --accent: #2563eb;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(16, 24, 40, .08), 0 1px 2px rgba(16, 24, 40, .04);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f141b; --card: #171e28; --ink: #e7ecf3; --ink-2: #93a1b5;
    --line: #263140; --shadow: 0 1px 3px rgba(0,0,0,.4);
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.55 -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; }
button { font: inherit; cursor: pointer; }
.container { max-width: 1080px; margin: 0 auto; padding: 0 16px; }

/* ============ 顶栏 ============ */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: linear-gradient(135deg, #0b3d24, #0a7d43);
  color: #fff; box-shadow: var(--shadow);
}
.topbar-inner {
  max-width: 1080px; margin: 0 auto; padding: 0 16px;
  display: flex; align-items: center; gap: 18px; height: 54px;
}
.brand { font-size: 18px; font-weight: 700; letter-spacing: .5px; white-space: nowrap; }
.nav { display: flex; gap: 4px; flex: 1; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a {
  padding: 6px 12px; border-radius: 8px; color: #d6e8de;
  font-size: 14px; white-space: nowrap; transition: background .15s, color .15s;
}
.nav a.active { background: rgba(255,255,255,.16); color: #fff; font-weight: 600; }
.live-dot {
  display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  background: #ff5c5c; margin-left: 2px; vertical-align: 2px;
  animation: pulse 1.4s infinite;
}
@keyframes pulse { 50% { opacity: .3; } }

/* ============ 通用组件 ============ */
.page-loading { text-align: center; padding: 60px 0; color: var(--ink-2); }
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); }
.section-title { font-size: 16px; font-weight: 700; margin: 22px 0 12px; display: flex; align-items: center; gap: 8px; }
.empty { text-align: center; color: var(--ink-2); padding: 40px 0; }
.error-tip { text-align: center; color: var(--live); padding: 30px 0; }
.skeleton { position: relative; overflow: hidden; background: var(--line); border-radius: 8px; min-height: 64px; }
.skeleton::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.25), transparent);
  animation: shimmer 1.2s infinite;
}
@keyframes shimmer { from { transform: translateX(-100%);} to { transform: translateX(100%);} }

/* 比赛卡片 */
.fixture-card {
  display: grid; grid-template-columns: 1fr 92px 1fr; align-items: center;
  gap: 8px; padding: 14px 16px; cursor: pointer;
  transition: transform .12s, box-shadow .12s;
}
.fixture-card:hover { transform: translateY(-1px); box-shadow: 0 4px 14px rgba(16,24,40,.12); }
.fixture-meta {
  grid-column: 1 / -1; display: flex; align-items: center; gap: 8px;
  font-size: 12px; color: var(--ink-2); margin-bottom: 8px;
}
.fixture-meta .lg-name { font-weight: 600; color: var(--ink); }
.badge {
  font-size: 11px; padding: 2px 8px; border-radius: 20px; font-weight: 600;
  background: var(--line); color: var(--ink-2); white-space: nowrap;
}
.badge.inplay { background: #fdecec; color: var(--live); }
.badge.finished { background: #eef1f5; color: var(--ink-2); }
.badge.pre { background: #e8f3ee; color: var(--brand); }
.team { display: flex; align-items: center; gap: 10px; min-width: 0; }
.team.right { justify-content: flex-end; text-align: right; }
.team .t-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.team img, .t-logo {
  width: 26px; height: 26px; border-radius: 50%; flex: none;
  object-fit: contain; background: var(--line);
}
.score-box {
  text-align: center; font-weight: 800; font-size: 19px; font-variant-numeric: tabular-nums;
  min-width: 72px;
}
.score-box .sched-time { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.score-box .state-name { display: block; font-size: 11px; font-weight: 600; }
.score-box .state-name.inplay { color: var(--live); }

/* 日期选择条 */
.date-bar {
  display: flex; gap: 8px; overflow-x: auto; padding: 14px 0 10px; scrollbar-width: none;
}
.date-bar::-webkit-scrollbar { display: none; }
.date-chip {
  flex: none; padding: 7px 14px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--card); color: var(--ink-2); font-size: 13px;
}
.date-chip.active { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }
.date-chip b { display: block; font-size: 14px; color: inherit; }

/* 筛选工具条 */
.tool-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 14px 0; }
.tool-row input, .tool-row select {
  padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--card); color: var(--ink); font-size: 14px;
}
.tool-row input[type="date"] { color-scheme: light dark; }

/* 联赛分组头 */
.lg-group-head {
  display: flex; align-items: center; gap: 8px; margin: 18px 0 8px;
  font-size: 13px; color: var(--ink-2); font-weight: 600;
}
.lg-group-head::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* ============ 详情页 ============ */
.detail-hero { padding: 24px 16px; text-align: center; }
.detail-hero .lg-line { font-size: 13px; color: var(--ink-2); margin-bottom: 14px; }
.detail-hero .teams {
  display: grid; grid-template-columns: 1fr auto 1fr; gap: 12px; align-items: center;
}
.detail-hero .big-team { font-size: 18px; font-weight: 700; }
.detail-hero .big-team img { width: 44px; height: 44px; display: block; margin: 0 auto 8px; }
.detail-hero .big-score { font-size: 34px; font-weight: 800; font-variant-numeric: tabular-nums; }
.detail-hero .big-time { font-size: 15px; font-weight: 700; color: var(--ink-2); }
.detail-hero .sub { margin-top: 10px; font-size: 12px; color: var(--ink-2); }

.tabs { display: flex; gap: 4px; margin: 18px 0; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tabs button {
  flex: none; padding: 10px 16px; border: 0; background: none; color: var(--ink-2);
  border-bottom: 2px solid transparent; font-weight: 600;
}
.tabs button.active { color: var(--brand); border-bottom-color: var(--brand); }

.event-row { display: flex; align-items: center; gap: 10px; padding: 9px 16px; font-size: 14px; }
.event-row .min { width: 40px; text-align: center; font-weight: 700; color: var(--ink-2); flex: none; }
.event-row .ev-name { font-weight: 600; }
.event-row .ev-type { font-size: 12px; color: var(--ink-2); }
.event-row.home-side { flex-direction: row; }
.event-row.away-side { flex-direction: row-reverse; text-align: right; }
.event-row .ev-body { flex: 1; min-width: 0; }

.lineup-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 24px; padding: 8px 16px; }
.lineup-grid h4 { margin: 8px 0; }
.player-li { display: flex; gap: 8px; padding: 5px 0; border-bottom: 1px dashed var(--line); font-size: 13px; }
.player-li .no { width: 26px; color: var(--ink-2); font-weight: 700; flex: none; }
.player-li a { font-weight: 600; }
.player-li .cap { font-size: 11px; color: #b8860b; }

.stat-row { display: grid; grid-template-columns: 52px 1fr 52px; gap: 10px; align-items: center; padding: 8px 16px; font-size: 14px; }
.stat-row .s-name { grid-column: 1 / -1; text-align: center; font-size: 12px; color: var(--ink-2); margin-bottom: -2px; }
.stat-bar { height: 8px; border-radius: 5px; background: var(--line); overflow: hidden; display: flex; }
.stat-bar .h { background: var(--accent); }
.stat-bar .a { background: var(--brand-2); justify-content: flex-end; }

/* 球队 / 球员 */
.team-hero { display: flex; align-items: center; gap: 16px; padding: 22px 20px; }
.team-hero img { width: 64px; height: 64px; object-fit: contain; border-radius: 12px; background: var(--line); }
.team-hero h2 { margin: 0 0 4px; font-size: 22px; }
.team-hero .meta { font-size: 13px; color: var(--ink-2); display: flex; gap: 14px; flex-wrap: wrap; }
.info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; padding: 16px; }
.info-grid .cell { background: var(--bg); border-radius: 10px; padding: 12px 14px; }
.info-grid .cell .k { font-size: 12px; color: var(--ink-2); }
.info-grid .cell .v { font-weight: 700; margin-top: 2px; }

/* 积分榜 */
.table-wrap { overflow-x: auto; }
table.standings { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 560px; }
table.standings th, table.standings td { padding: 10px 12px; text-align: center; border-bottom: 1px solid var(--line); }
table.standings th { color: var(--ink-2); font-weight: 600; font-size: 12px; }
table.standings td.team-cell { text-align: left; font-weight: 600; white-space: nowrap; }
table.standings tr:hover td { background: rgba(10,125,67,.05); }
table.standings .pos { font-weight: 800; }
.form-pill { display: inline-block; width: 18px; height: 18px; line-height: 18px; border-radius: 5px; font-size: 11px; color: #fff; margin-left: 2px; font-weight: 700; }
.form-pill.W { background: var(--brand); } .form-pill.D { background: #8a94a6; } .form-pill.L { background: var(--live); }

/* 虚拟列表 */
.vlist { position: relative; overflow-y: auto; will-change: transform; }
.vlist-inner { position: relative; }
.vlist .fixture-card { height: 100%; display: grid; }

/* 页脚 */
.footer { margin: 40px 0 0; padding: 18px 0 26px; color: var(--ink-2); font-size: 12px; border-top: 1px solid var(--line); }

/* ============ 响应式（移动端） ============ */
@media (max-width: 640px) {
  .topbar-inner { gap: 10px; }
  .brand { font-size: 16px; }
  .fixture-card { grid-template-columns: 1fr 64px 1fr; padding: 12px 10px; }
  .score-box { font-size: 16px; min-width: 58px; }
  .detail-hero { padding: 18px 10px; }
  .detail-hero .big-score { font-size: 26px; }
  .detail-hero .big-team { font-size: 15px; }
  .lineup-grid { grid-template-columns: 1fr; gap: 0; }
  .event-row.away-side .ev-body { text-align: right; }
  .stat-row { grid-template-columns: 44px 1fr 44px; padding: 8px 10px; }
}
@media (min-width: 900px) {
  .two-col { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; align-items: start; }
}

/* ============ 筛选条 / 历史赛果 / 积分榜 ============ */
.filter-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 12px 16px; margin: 0 0 16px; }
.filter-bar label { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-2); }
.filter-bar input, .filter-bar select {
  border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px;
  font-size: 13px; color: var(--ink); background: var(--card); outline: none;
}
.filter-bar input:focus, .filter-bar select:focus { border-color: var(--brand); }
.filter-result { font-size: 13px; color: var(--ink-2); }
.btn-primary {
  border: 0; border-radius: 8px; padding: 8px 18px; cursor: pointer;
  background: var(--brand); color: #fff; font-size: 13px; font-weight: 600;
}
.btn-primary:hover { background: var(--brand-2); }
.hint { font-size: 12px; color: var(--ink-2); margin: 10px 2px 0; }

.hist-list { height: 70vh; min-height: 320px; overflow: auto; position: relative; border-radius: var(--radius); }
.vlist-inner { position: relative; width: 100%; }
.hist-row { display: flex; align-items: center; gap: 10px; padding: 3px 0; }
.hist-when { display: flex; flex-direction: column; align-items: center; width: 52px; flex: none; font-size: 12px; color: var(--ink-2); }
.hist-when b { color: var(--ink); font-size: 13px; }
.hist-row .fixture-card { flex: 1; min-width: 0; height: 100%; display: grid; align-content: center; }

.empty-state {
  padding: 48px 16px; text-align: center; color: var(--ink-2); font-size: 14px;
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
}

.table-wrap { padding: 6px 10px; overflow-x: auto; }
.st-team { display: inline-flex; align-items: center; gap: 8px; color: var(--ink); font-weight: 600; text-decoration: none; }
.st-team:hover { color: var(--brand); }
.st-team .t-logo { width: 22px; height: 22px; font-size: 10px; }

@media (max-width: 640px) {
  .filter-bar { gap: 8px; }
  .filter-bar label { flex-direction: column; align-items: flex-start; gap: 3px; }
  .hist-list { height: 65vh; }
  .hist-when { width: 44px; }
}

/* ============ 顶部全局搜索 ============ */
.search-box { position: relative; flex-shrink: 0; }
.search-box input {
  width: 200px; height: 32px; padding: 0 12px; border: none; border-radius: 8px;
  background: rgba(255,255,255,.14); color: #fff; font-size: 13px; outline: none;
  transition: background .15s, width .2s;
}
.search-box input::placeholder { color: rgba(255,255,255,.6); }
.search-box input:focus { background: rgba(255,255,255,.24); width: 240px; }
.search-panel {
  position: absolute; top: 40px; right: 0; width: 320px; max-height: 60vh; overflow-y: auto;
  background: var(--card); color: var(--ink); border-radius: var(--radius);
  box-shadow: 0 8px 28px rgba(0,0,0,.22); padding: 6px; z-index: 60;
}
.search-sec-title { font-size: 12px; color: var(--ink-2); padding: 8px 10px 4px; }
.search-item {
  display: flex; align-items: center; gap: 8px; padding: 8px 10px;
  border-radius: 8px; color: var(--ink); text-decoration: none; font-size: 14px;
}
.search-item:hover { background: var(--bg); }
.search-item .t-logo { width: 20px; height: 20px; font-size: 9px; }
.si-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.si-sub { font-size: 12px; color: var(--ink-2); white-space: nowrap; }
.search-empty { padding: 14px 10px; font-size: 13px; color: var(--ink-2); text-align: center; }

@media (max-width: 760px) {
  .search-box { flex: 1; }
  .search-box input, .search-box input:focus { width: 100%; }
  .search-panel { left: 0; right: 0; width: auto; }
}

/* ============ 射手榜 / 积分榜扩展 ============ */
.tc-tabs { display: flex; gap: 6px; margin-left: auto; }
.tc-tabs .date-chip { padding: 5px 12px; }
.st-live-toggle { cursor: pointer; user-select: none; }
.st-live-toggle input { accent-color: var(--brand); }
.form-pill.y { background: #e3b341; }
.form-pill.r { background: var(--live); }
