/* ============================================================
   style.css  —  全新主题 v2（覆盖式重写）
   依赖：main.css 提供 Bootstrap 基础骨架
   ============================================================ */

/* ---------- 0. 变量 ---------- */
:root {
  --primary:      #6366f1;
  --primary-dark: #4f46e5;
  --primary-soft: #eef2ff;
  --accent:       #06b6d4;
  --accent-soft:  #ecfeff;
  --green:        #10b981;
  --orange:       #f97316;
  --bg:           #f8fafc;
  --bg-soft:      #f1f5f9;
  --text:         #0f172a;
  --muted:        #64748b;
  --border:       #e2e8f0;
  --radius-sm:    10px;
  --radius:       16px;
  --shadow:       0 4px 14px rgba(15,23,42,.06);
}

/* ---------- 1. 全局 ---------- */
html { overflow-y: scroll !important; }
body {
  background: var(--bg) !important;
  color: var(--text) !important;
  font-size: .95rem !important;
  font-family: 'Segoe UI','PingFang SC','Microsoft YaHei',sans-serif !important;
}
a { color: var(--text); text-decoration: none; }
.text-end { text-align: right !important; }
.vh-50 { height: 50vh; } .vh-80 { height: 80vh; }

/* ---------- 2. 导航栏 ---------- */
.navbar {
  background: linear-gradient(135deg, #1e1b4b 0%, #4338ca 60%, #6d28d9 100%) !important;
  box-shadow: 0 4px 24px rgba(67,56,202,.25);
  padding: .65rem 1rem !important;
}
.navbar-brand {
  font-weight: 800 !important;
  letter-spacing: 2px;
  background: linear-gradient(90deg, #a5b4fc, #67e8f9);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.navbar-nav { gap: 4px; }
.navbar-nav .nav-link {
  color: rgba(255,255,255,.85) !important;
  font-weight: 500;
  border-radius: 10px;
  padding: .4rem .9rem !important;
  transition: all .25s;
}
.navbar-nav .nav-link:hover,
.navbar-nav .nav-link.active {
  background: rgba(255,255,255,.14) !important;
  color: #fff !important;
  transform: translateY(-1px);
}

/* ---------- 3. 卡片 ---------- */
.card {
  background: #fff !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius) !important;
  box-shadow: var(--shadow) !important;
  overflow: hidden;
  margin-bottom: 15px !important;
  transition: box-shadow .25s;
}
.card:hover { box-shadow: 0 10px 24px rgba(15,23,42,.1) !important; }
.card-header {
  background: linear-gradient(135deg, var(--primary-soft), var(--accent-soft)) !important;
  color: var(--primary-dark) !important;
  border-bottom: 1px solid var(--border) !important;
  font-weight: 700;
  letter-spacing: .5px;
  padding: .9rem 1.15rem !important;
}
.card-header h2 { color: var(--primary-dark) !important; font-size: 1rem; margin: 0; }
.card-header i  { color: var(--primary) !important; margin-right: 6px; }
.card-header a  { color: var(--primary-dark) !important; }
.card-header a:hover { color: var(--primary) !important; }
.card-body { padding: 1.1rem 1.15rem !important; }

/* ---------- 4. Tab → 胶囊式 ---------- */
.nav-tabs {
  border: none !important;
  gap: 6px;
  padding: 4px;
  background: var(--bg-soft);
  border-radius: 999px;
  display: inline-flex !important;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}
.nav-tabs .nav-item { margin: 0 !important; }
.nav-tabs .nav-link {
  border: none !important;
  border-radius: 999px !important;
  color: var(--muted) !important;
  font-weight: 600;
  padding: .35rem .9rem !important;
  background: transparent !important;
  transition: all .25s;
}
.nav-tabs .nav-link:hover {
  background: rgba(99,102,241,.1) !important;
  color: var(--primary-dark) !important;
}
.nav-tabs .nav-link.active {
  background: linear-gradient(135deg, var(--primary), var(--accent)) !important;
  color: #fff !important;
  box-shadow: 0 4px 12px rgba(99,102,241,.35);
}

/* ---------- 5. H1 标题 ---------- */
h1 {
  font-size: 1.4rem !important;
  font-weight: 800 !important;
  background: linear-gradient(135deg, var(--primary-dark), var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: .5px;
  padding: .75rem 0 .5rem !important;
  margin: 0 !important;
}
p { color: var(--muted); }

/* ---------- 6. 比赛列表：两行卡片式 ---------- */
.match-list { padding: 4px !important; }

/* 日期分组标题条 */
.match-list > .text-center {
  background: linear-gradient(135deg, var(--primary-soft), var(--accent-soft)) !important;
  color: var(--primary-dark) !important;
  border-radius: var(--radius-sm);
  font-weight: 700;
  padding: .6rem 1rem !important;
  margin: .75rem 0 !important;
  letter-spacing: .5px;
}
.match-list > .text-center .text-success { color: var(--primary-dark) !important; }

/* 单个比赛：卡片式，两行 */
.match-item {
  display: block !important;
  padding: 12px 14px !important;
  margin-bottom: 10px !important;
  background: #fff;
  border: 1px solid var(--border) !important;
  border-left: 4px solid var(--primary) !important;
  border-radius: var(--radius-sm) !important;
  transition: all .25s;
}
.match-item:hover {
  transform: translateX(4px);
  border-left-color: var(--accent) !important;
  box-shadow: 0 6px 18px rgba(99,102,241,.14);
  background: linear-gradient(135deg, #fafaff, #f5fbff) !important;
}
.match-item:last-child { margin-bottom: 0 !important; }

/* 让 match-info 纵向排列，形成两行 */
.match-info {
  display: flex !important;
  flex-direction: column !important;
}

/* 第一行：联赛 + 时间 */
.league-info {
  display: flex !important;
  align-items: center !important;
  gap: 10px;
  width: 100% !important;
  margin-bottom: 8px;
  padding-bottom: 8px;
  border-bottom: 1px dashed var(--border);
}
.league-w { width: auto !important; }
.league-name {
  color: var(--primary) !important;
  font-weight: 700;
  background: var(--primary-soft);
  padding: 3px 12px;
  border-radius: 999px;
  font-size: .78rem;
}
.match-time {
  color: var(--muted) !important;
  font-size: .78rem !important;
  font-weight: 500;
  margin-left: auto;
  width: auto !important;
}

/* 第二行：主队 — VS — 客队 — 状态 */
.match-main {
  display: flex !important;
  align-items: center !important;
  width: 100% !important;
  margin-top: 0 !important;
}
.home-team {
  flex: 1 1 0 !important;
  width: auto !important;
  display: flex !important;
  align-items: center !important;
  justify-content: flex-end !important;
  gap: 8px;
}
.away-team {
  flex: 1 1 0 !important;
  width: auto !important;
  display: flex !important;
  align-items: center !important;
  justify-content: flex-start !important;
  gap: 8px;
}
.match-score {
  width: 70px !important;
  flex: 0 0 70px !important;
  text-align: center;
  margin: 0 !important;
}
.score-value {
  color: var(--primary) !important;
  font-size: .95rem;
  letter-spacing: 1px;
  font-weight: 800;
}
.team-name { font-weight: 600; color: var(--text); font-size: .9rem; }
.team-logo {
  width: 32px !important;
  height: 32px !important;
  border-radius: 50% !important;
  border: 2px solid var(--border) !important;
  background: #fff;
  object-fit: contain;
  padding: 2px;
  transition: transform .2s;
}
.match-item:hover .team-logo { transform: scale(1.08); }

/* 状态按钮 */
.match-action {
  width: 96px !important;
  flex: 0 0 96px !important;
  margin-left: auto !important;
  border-radius: 999px !important;
  font-size: .78rem !important;
  font-weight: 700;
  padding: 5px 12px !important;
  text-align: center;
  color: #fff !important;
}
.match-action.live {
  background: linear-gradient(135deg, var(--green), #059669) !important;
  border: none !important;
  animation: v2Pulse 2s infinite;
}
.match-action.live2 {
  background: linear-gradient(135deg, var(--orange), #ea580c) !important;
  border: none !important;
}
@keyframes v2Pulse {
  0%   { box-shadow: 0 0 0 0 rgba(16,185,129,.6); }
  70%  { box-shadow: 0 0 0 10px rgba(16,185,129,0); }
  100% { box-shadow: 0 0 0 0 rgba(16,185,129,0); }
}

/* ---------- 7. 右侧：热门联赛 ---------- */
.hot-league-logo { width: 38px !important; height: 38px !important; object-fit: contain; }
.card-body .col-4 > a > .border {
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-sm) !important;
  transition: all .25s;
  background: #fff;
}
.card-body .col-4 > a:hover > .border {
  border-color: var(--primary) !important;
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

/* ---------- 8. 右侧：文章列表 ---------- */
.hot-articles-list a {
  display: block;
  padding: .55rem .6rem;
  border-radius: var(--radius-sm);
  transition: all .2s;
  color: var(--text) !important;
  font-size: .88rem;
  line-height: 1.5;
}
.hot-articles-list a:hover {
  background: var(--primary-soft);
  color: var(--primary-dark) !important;
  transform: translateX(3px);
}
.hot-articles-list .border-bottom { border-bottom: 1px dashed var(--border) !important; }

/* ---------- 9. 新增模块：热门主播 ---------- */
.v2-anchor-list { display: grid; gap: 10px; }
.v2-anchor {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, #fafaff, #f5f7ff);
  border: 1px solid var(--border);
  transition: all .25s;
}
.v2-anchor:hover {
  transform: translateX(4px);
  border-color: var(--primary);
  box-shadow: var(--shadow);
}
.v2-anchor-avatar {
  width: 42px; height: 42px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 800; font-size: 1rem;
  flex-shrink: 0;
  box-shadow: 0 4px 10px rgba(99,102,241,.3);
}
.v2-anchor-info { flex: 1; min-width: 0; }
.v2-anchor-name { font-weight: 700; font-size: .9rem; color: var(--text); }
.v2-anchor-desc { font-size: .74rem; color: var(--muted); }
.v2-live-dot {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  background: var(--green); margin-right: 4px;
  animation: v2Pulse 2s infinite;
}

/* ---------- 10. 新增模块：FAQ 手风琴 ---------- */
.v2-faq { display: grid; gap: 8px; }
.v2-faq details {
  background: linear-gradient(135deg, #fafaff, #f5f7ff);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  transition: all .25s;
}
.v2-faq details[open] {
  border-color: var(--primary);
  box-shadow: var(--shadow);
  background: #fff;
}
.v2-faq summary {
  cursor: pointer;
  font-weight: 600;
  font-size: .88rem;
  list-style: none;
  display: flex; justify-content: space-between; align-items: center;
  color: var(--text);
}
.v2-faq summary::-webkit-details-marker { display: none; }
.v2-faq summary::after {
  content: '+'; color: var(--primary);
  font-size: 1.15rem; font-weight: 700;
  transition: transform .25s;
}
.v2-faq details[open] summary::after { content: '−'; }
.v2-faq details p {
  margin: 8px 0 0;
  font-size: .82rem;
  color: var(--muted);
  line-height: 1.65;
}

/* ---------- 11. 页脚 ---------- */
footer {
  background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 100%) !important;
  color: rgba(255,255,255,.7) !important;
  padding: 40px 10px !important;
  margin-top: 40px;
}
footer p { color: rgba(255,255,255,.55) !important; font-size: .85rem; }
footer a { color: rgba(255,255,255,.7); }
footer a:hover { color: #a5b4fc; }

/* ---------- 12. 返回顶部 ---------- */
#backToTop {
  position: fixed;
  bottom: 40px; right: 40px;
  width: 46px !important; height: 46px !important;
  z-index: 9999;
  background: linear-gradient(135deg, var(--primary), var(--accent)) !important;
  color: #fff !important;
  border: none !important;
  border-radius: 50% !important;
  box-shadow: 0 8px 20px rgba(99,102,241,.4);
  cursor: pointer;
  transition: transform .25s, opacity .4s;
}
#backToTop:hover { transform: translateY(-4px) scale(1.05); }

/* ---------- 13. 分页 ---------- */
ul.pagination { display: inline-block; padding: 0; margin: 0; clear: both; }
ul.pagination li { display: inline; }
ul.pagination li a {
  color: var(--text); float: left;
  padding: 4px 10px; margin: 4px 3px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 12px;
  transition: all .2s;
}
ul.pagination li a.active {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff; border-color: transparent;
}
ul.pagination li a:hover:not(.active) { background: var(--primary-soft); color: var(--primary-dark); }

/* ---------- 14. 其它工具类 ---------- */
#tab_mQjUhw9n { display: flex; flex-wrap: wrap; }
#tab_mQjUhw9n a {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff; border-radius: 6px;
  font-weight: 600; padding: 6px 12px;
  font-size: .875rem; line-height: 1.5;
  margin: .2rem !important;
}
.bg-img { background: url(../picture/0t5c06b247ca4ca07f.png) no-repeat center; background-size: 100% auto; }
.white-color { color: #fff; }
.fenye { display: flex; justify-content: center; padding: 20px 0; font-size: 14px; }
.fenye ul li { display: inline-block; margin: 0 3px; }
.fenye ul li a {
  font-size: 16px; color: var(--muted);
  display: block; padding: 2px 8px;
  background: #fff; border-radius: 6px;
}

/* ---------- 15. 响应式：移动端 ---------- */
@media (max-width: 767.98px) {
  /* 主内容全宽 */
  .col-lg-9, .col-lg-3 { width: 100%; }

  /* 比赛项：第一行不变，第二行改三列 */
  .match-main { flex-wrap: wrap; }

  .home-team, .away-team {
    flex: 1 1 0 !important;
    flex-direction: column !important;
    justify-content: center !important;
    align-items: center !important;
    gap: 4px;
  }
  .home-team img { order: -1; }  /* 主队头像在上 */
  .team-name { font-size: .82rem; text-align: center; }

  .match-score {
    flex: 0 0 50px !important;
    width: 50px !important;
    font-size: .85rem;
  }
  .match-action {
    flex: 0 0 100% !important;
    width: 100% !important;
    margin: 8px 0 0 !important;
    display: flex;
    justify-content: center;
  }

  /* 卡片 */
  .card { margin-bottom: 12px !important; }
  .card-body { padding: .9rem !important; }
  .card-header { padding: .75rem 1rem !important; }

  /* 主播头衔缩小 */
  .v2-anchor-avatar { width: 36px; height: 36px; font-size: .9rem; }

  /* 导航 */
  .navbar-brand { font-size: 1.1rem !important; }
  .navbar-nav .nav-link { color: var(--text) !important; }
  .navbar-nav .nav-link:hover { background: var(--primary-soft) !important; color: var(--primary-dark) !important; }
}
<?php
/* ============================================================
   积分榜 v3：远程读取 + 本地缓存（缓存 1 天）
   远程地址：https://img.aqswsw.cn/jf/
   缓存目录：/data/cache/
   缓存时间：24 小时
   ============================================================ */

$std_leagues_cfg = [
    // ===== 足球 =====
    'yingchao'  => ['name'=>'英超',    'type'=>'football',   'group'=>'football'],
    'xijia'     => ['name'=>'西甲',    'type'=>'football',   'group'=>'football'],
    'dejia'     => ['name'=>'德甲',    'type'=>'football',   'group'=>'football'],
    'yijia'     => ['name'=>'意甲',    'type'=>'football',   'group'=>'football'],
    'fajia'     => ['name'=>'法甲',    'type'=>'football',   'group'=>'football'],
    'ouguan'    => ['name'=>'欧冠',    'type'=>'football',   'group'=>'football'],
    'ouguolian' => ['name'=>'欧国联',  'type'=>'football',   'group'=>'football'],
    // ===== 篮球 =====
    'nba'       => ['name'=>'NBA',     'type'=>'basketball', 'group'=>'basketball'],
    'cba'       => ['name'=>'CBA',     'type'=>'basketball', 'group'=>'basketball'],
    'wnba'      => ['name'=>'WNBA',    'type'=>'basketball', 'group'=>'basketball'],
];

$std_remote_base = 'https://img.aqswsw.cn/jf/';
$std_cache_dir   = rtrim($_SERVER['DOCUMENT_ROOT'], '/') . '/data/cache/';
$std_cache_ttl   = 86400; // 24 小时（1 天）

// 确保缓存目录存在
if(!is_dir($std_cache_dir)){
    @mkdir($std_cache_dir, 0755, true);
}

/**
 * 读取远程 JSON，带本地缓存
 */
if(!function_exists('getRemoteJson')){
    function getRemoteJson($url, $cacheFile, $ttl){
        // 缓存有效 → 直接返回
        if(file_exists($cacheFile) && (time() - filemtime($cacheFile)) < $ttl){
            $raw = @file_get_contents($cacheFile);
            if($raw !== false) return $raw;
        }
        // 缓存过期或不存在 → 远程拉取
        $raw = false;
        if(function_exists('curl_init')){
            $ch = curl_init($url);
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
            curl_setopt($ch, CURLOPT_TIMEOUT, 10);
            curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
            curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
            curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 JRS-Standings/1.0');
            $raw = curl_exec($ch);
            curl_close($ch);
        } else {
            $ctx = stream_context_create(['http'=>['timeout'=>10]]);
            $raw = @file_get_contents($url, false, $ctx);
        }
        // 拉取成功 → 写缓存
        if($raw !== false && !empty($raw)){
            @file_put_contents($cacheFile, $raw);
            return $raw;
        }
        // 拉取失败 → 读旧缓存兜底
        if(file_exists($cacheFile)){
            return @file_get_contents($cacheFile);
        }
        return false;
    }
}

$std_groups = [
    'football'   => ['name'=>'足球', 'icon'=>'fa-futbol',         'leagues'=>[]],
    'basketball' => ['name'=>'篮球', 'icon'=>'fa-basketball-ball','leagues'=>[]],
];
$std_updated = '';

foreach($std_leagues_cfg as $key => $cfg){
    $url   = $std_remote_base . 'jf-' . $key . '.json';
    $cache = $std_cache_dir . 'jf-' . $key . '.json';

    $raw = getRemoteJson($url, $cache, $std_cache_ttl);
    if(empty($raw)) continue;

    $json = json_decode($raw, true);
    if(!is_array($json) || empty($json)) continue;

    /* ---- 统一识别 3 种格式 ---- */
    $format = 'single';
    $groups = [];

    if(isset($json[0]['list']) && is_array($json[0]['list'])){
        $format = 'grouped';
        foreach($json as $g){
            $groups[] = [
                'title' => $g['title'] ?? '',
                'list'  => $g['list']  ?? []
            ];
        }
    } else {
        $groups[] = ['title' => '', 'list' => $json];
    }

    $cfg['key']    = $key;
    $cfg['format'] = $format;
    $cfg['groups'] = $groups;

    // 更新日期：优先用缓存文件修改时间
    if(file_exists($cache)){
        $mt = filemtime($cache);
        if($mt > strtotime($std_updated ?: '1970-01-01')){
            $std_updated = date('Y-m-d H:i', $mt);
        }
    }

    $std_groups[$cfg['group']]['leagues'][$key] = $cfg;
}

$std_groups = array_filter($std_groups, function($g){
    return !empty($g['leagues']);
});
/* ============================================================ */
?>

/* ============================================================
   积分榜样式
   ============================================================ */
.std-mainnav { display: flex; gap: 8px; margin-bottom: 14px; padding-bottom: 12px; border-bottom: 1px solid #e2e8f0; }
.std-maintab {
  padding: 8px 20px; font-size: .92rem; font-weight: 700;
  color: #64748b; border-radius: 12px;
  text-decoration: none; cursor: pointer; transition: all .25s;
  display: inline-flex; align-items: center; gap: 6px;
}
.std-maintab:hover { color: #4f46e5; }
.std-maintab.active { color: #4f46e5; }
.std-mainpanel { display: none; }
.std-mainpanel.active { display: block; }

.std-nav { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; padding-bottom: 10px; border-bottom: 1px dashed #e2e8f0; }
.std-tab {
  padding: 5px 14px; font-size: .82rem; font-weight: 600;
  color: #64748b; border-radius: 999px;
  transition: all .2s; text-decoration: none; cursor: pointer;
}
.std-tab:hover { color: #4f46e5; }
.std-tab.active { color: #4f46e5; text-decoration: underline; }

.std-subnav { display: flex; gap: 6px; margin-bottom: 10px; overflow-x: auto; flex-wrap: nowrap; padding-bottom: 4px; }
.std-subnav::-webkit-scrollbar { height: 4px; }
.std-subnav::-webkit-scrollbar-thumb { background: #e2e8f0; border-radius: 4px; }
.std-subtab {
  flex: 0 0 auto; padding: 4px 12px; font-size: .76rem; font-weight: 600;
  color: #64748b; border: 1px solid #e2e8f0;
  border-radius: 999px; text-decoration: none; cursor: pointer;
  transition: all .2s; white-space: nowrap;
}
.std-subtab:hover { border-color: #6366f1; color: #4f46e5; }
.std-subtab.active { border-color: #6366f1; color: #4f46e5; }

.std-panel, .std-subpanel { display: none; }
.std-panel.active, .std-subpanel.active { display: block; }

.std-table-wrap { overflow-x: auto; border: 1px solid #e2e8f0; border-radius: 10px; }
.std-table { width: 100%; border-collapse: collapse; font-size: .85rem; background: #fff; }
.std-table thead th {
  color: #4f46e5; font-weight: 700; font-size: .78rem;
  padding: 10px 8px; text-align: center; white-space: nowrap;
  border-bottom: 1px solid #e2e8f0;
}
.std-table tbody td { padding: 9px 8px; text-align: center; border-top: 1px solid #e2e8f0; color: #0f172a; white-space: nowrap; }
.std-table tbody tr:hover { background: #fafaff; }

.std-rank { font-weight: 800; color: #64748b; width: 36px; }
.std-team { text-align: left !important; padding-left: 12px !important; min-width: 160px; }
.std-name { font-weight: 600; color: #0f172a; }
.std-tag { color: #64748b; font-size: .72rem; margin-left: 6px; }
.std-pts { color: #4f46e5; font-size: .92rem; }

@media (max-width: 767.98px) {
  .std-maintab { padding: 6px 14px; font-size: .82rem; }
  .std-table { font-size: .8rem; }
  .std-table thead th { padding: 8px 5px; font-size: .75rem; }
  .std-table tbody td { padding: 8px 5px; }
  .std-team { min-width: 130px; padding-left: 8px !important; }
  .std-name { font-size: .85rem; }
  .std-tag { font-size: .65rem; }
  .std-tab { padding: 4px 10px; font-size: .76rem; }
}