<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>项目健康度报告 — {{OWNER}}/{{REPO}}</title>
<style>
  :root {
    --bg: #f0f2f5;
    --card-bg: #ffffff;
    --text: #1a1a2e;
    --text-secondary: #6b7280;
    --border: #e5e7eb;
    --green: #10b981;
    --blue: #3b82f6;
    --yellow: #f59e0b;
    --orange: #e17055;
    --red: #ef4444;
    --header-bg: #0f172a;
    --accent: #8b5cf6;
  }

  * { margin: 0; padding: 0; box-sizing: border-box; }

  body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
  }

  .header {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    color: #fff;
    padding: 52px 48px;
    display: flex;
    align-items: center;
    gap: 56px;
    flex-wrap: wrap;
    position: relative;
    overflow: hidden;
  }
  .header::before {
    content: ''; position: absolute; top: -80px; right: -60px;
    width: 300px; height: 300px; border-radius: 50%;
    background: radial-gradient(circle, rgba(225,112,85,0.12) 0%, transparent 70%);
  }
  .header-left { flex: 1; min-width: 280px; position: relative; z-index: 1; }
  .header-left .project-icon { font-size: 40px; margin-bottom: 8px; }
  .header-left h1 { font-size: 30px; font-weight: 800; margin-bottom: 4px; letter-spacing: -0.5px; }
  .header-left .subtitle { font-size: 15px; color: #94a3b8; font-weight: 500; }
  .header-left .meta { font-size: 13px; color: #64748b; margin-top: 10px; display: flex; gap: 16px; flex-wrap: wrap; }
  .header-left .alert-tags { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
  .header-left .alert-tags span {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 5px 12px; border-radius: 6px;
    font-size: 12px; font-weight: 600;
  }
  .alert-red { background: rgba(239,68,68,0.18); color: #ef4444; }
  .alert-orange { background: rgba(225,112,85,0.18); color: #e17055; }

  .score-ring-wrap { flex-shrink: 0; position: relative; z-index: 1; text-align: center; }
  .score-ring { width: 150px; height: 150px; position: relative; display: inline-block; }
  .score-ring svg { transform: rotate(-90deg); }
  .score-ring .bg-circle { fill: none; stroke: #1e293b; stroke-width: 12; }
  .score-ring .fg-circle {
    fill: none; stroke-width: 12; stroke-linecap: round;
    filter: drop-shadow(0 0 8px var(--glow-color));
  }
  .score-ring .score-text {
    position: absolute; inset: 0;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
  }
  .score-ring .score-text .num { font-size: 44px; font-weight: 800; line-height: 1; }
  .score-ring .score-text .label { font-size: 13px; color: #94a3b8; margin-top: 2px; }
  .grade-badge {
    display: inline-block; padding: 5px 16px; border-radius: 20px;
    font-size: 13px; font-weight: 700; margin-top: 8px; letter-spacing: 1px;
  }

  .main { max-width: 1200px; margin: 0 auto; padding: 36px 24px; }
  .section { margin-bottom: 36px; }
  .section-title {
    font-size: 20px; font-weight: 700; margin-bottom: 18px;
    padding-bottom: 10px; border-bottom: 2px solid var(--border);
    display: flex; align-items: center; gap: 10px;
  }
  .section-title .icon { font-size: 24px; }

  .deduction-table { width: 100%; border-collapse: collapse; background: var(--card-bg); border-radius: 14px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.05); }
  .deduction-table th, .deduction-table td { padding: 14px 22px; text-align: left; font-size: 14px; }
  .deduction-table th { background: #f8fafc; font-weight: 700; color: var(--text-secondary); font-size: 12px; text-transform: uppercase; letter-spacing: 0.8px; }
  .deduction-table td { border-top: 1px solid var(--border); }
  .deduction-table .status-icon { margin-right: 6px; font-size: 16px; }
  .deduct-badge { display: inline-block; padding: 2px 10px; border-radius: 12px; font-weight: 700; font-size: 13px; }
  .deduct-ok { background: #d1fae5; color: #065f46; }
  .deduct-warn { background: #fef3c7; color: #92400e; }
  .deduct-bad { background: #fee2e2; color: #991b1b; }
  .deduction-table tr.row-warn { background: #fffbeb; }
  .deduction-table tr.row-bad { background: #fef2f2; }

  .kpi-banner {
    background: linear-gradient(135deg, #fee2e2 0%, #fff5f5 100%);
    border: 1px solid #fecaca; border-radius: 10px;
    padding: 14px 20px; margin-bottom: 20px;
    font-size: 14px; font-weight: 600; color: #991b1b;
    display: flex; align-items: center; gap: 10px;
  }
  .kpi-banner .kpi-icon { font-size: 22px; }

  .cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(350px, 1fr)); gap: 22px; }
  .card {
    background: var(--card-bg); border-radius: 14px;
    padding: 26px; box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    transition: transform 0.15s;
  }
  .card:hover { transform: translateY(-2px); box-shadow: 0 4px 16px rgba(0,0,0,0.08); }
  .card h3 { font-size: 17px; font-weight: 700; margin-bottom: 18px; display: flex; align-items: center; gap: 8px; }
  .card h3 .card-icon { font-size: 22px; }
  .card table { width: 100%; border-collapse: collapse; }
  .card table td { padding: 9px 0; font-size: 14px; border-bottom: 1px solid var(--border); }
  .card table td:last-child { text-align: right; font-weight: 700; }
  .card table tr:last-child td { border-bottom: none; }
  .metric-highlight { display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: 12px; margin-left: 4px; font-weight: 700; }
  .hl-good { background: #d1fae5; color: #065f46; }
  .hl-warn { background: #fef3c7; color: #92400e; }
  .hl-bad  { background: #fee2e2; color: #991b1b; }

  .priority-bar { display: flex; height: 10px; border-radius: 5px; overflow: hidden; margin: 14px 0 10px; }
  .priority-bar span { display: block; height: 100%; }
  .pg-urgent { background: var(--red); }
  .pg-high { background: var(--orange); }
  .pg-normal { background: var(--blue); }
  .pg-low { background: var(--green); }
  .priority-legend { display: flex; gap: 18px; flex-wrap: wrap; font-size: 13px; color: var(--text-secondary); }
  .priority-legend span { display: flex; align-items: center; gap: 5px; }
  .priority-legend .dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }

  /* Podium */
  .podium-section { background: var(--card-bg); border-radius: 14px; padding: 30px 24px 20px; box-shadow: 0 2px 8px rgba(0,0,0,0.05); }
  .podium-container { display: flex; align-items: flex-end; justify-content: center; gap: 20px; margin: 20px 0 32px; }
  .podium-spot { display: flex; flex-direction: column; align-items: center; min-width: 110px; }
  .podium-spot .avatar-area { position: relative; margin-bottom: 8px; }
  .podium-spot .crown { font-size: 26px; position: absolute; top: -30px; left: 50%; transform: translateX(-50%); animation: float 2s ease-in-out infinite; }
  .podium-spot .avatar { width: 64px; height: 64px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 28px; font-weight: 800; color: #fff; }
  .podium-spot .name { font-weight: 700; font-size: 14px; margin: 6px 0 2px; text-align: center; }
  .podium-spot .stat { font-size: 12px; color: var(--text-secondary); text-align: center; }
  .podium-block { width: 100%; border-radius: 8px 8px 0 0; display: flex; flex-direction: column; align-items: center; justify-content: center; color: #fff; font-weight: 800; }
  .podium-block .rank { font-size: 28px; line-height: 1.2; }

  .podium-champion { order: 2; }
  .podium-champion .podium-block { background: linear-gradient(180deg, #fbbf24 0%, #f59e0b 100%); height: 120px; box-shadow: 0 4px 20px rgba(245,158,11,0.4); }
  .podium-champion .avatar { background: linear-gradient(135deg, #fbbf24, #f59e0b); width: 76px; height: 76px; font-size: 32px; box-shadow: 0 0 0 4px rgba(245,158,11,0.3); }
  .podium-champion .crown { color: #f59e0b; font-size: 30px; top: -34px; animation-delay: 0s; }

  .podium-runner { order: 1; }
  .podium-runner .podium-block { background: linear-gradient(180deg, #cbd5e1 0%, #94a3b8 100%); height: 90px; box-shadow: 0 4px 16px rgba(148,163,184,0.3); }
  .podium-runner .avatar { background: linear-gradient(135deg, #cbd5e1, #94a3b8); box-shadow: 0 0 0 4px rgba(148,163,184,0.3); }
  .podium-runner .crown { color: #94a3b8; animation-delay: 0.3s; }

  .podium-third { order: 3; }
  .podium-third .podium-block { background: linear-gradient(180deg, #e8a87c 0%, #cd7f32 100%); height: 64px; box-shadow: 0 4px 12px rgba(205,127,50,0.35); }
  .podium-third .avatar { background: linear-gradient(135deg, #e8a87c, #cd7f32); box-shadow: 0 0 0 4px rgba(205,127,50,0.3); }
  .podium-third .crown { color: #cd7f32; animation-delay: 0.6s; }

  @keyframes float {
    0%, 100% { transform: translateX(-50%) translateY(0); }
    50% { transform: translateX(-50%) translateY(-4px); }
  }

  .other-contributors { border-top: 1px solid var(--border); padding-top: 16px; }
  .other-contributors .list-header { font-size: 13px; font-weight: 600; color: var(--text-secondary); margin-bottom: 10px; }
  .contributor-row { display: flex; align-items: center; gap: 12px; padding: 8px 12px; border-radius: 8px; transition: background 0.1s; }
  .contributor-row:hover { background: #f8fafc; }
  .contributor-row .rank-num { width: 28px; text-align: center; font-weight: 700; font-size: 14px; color: var(--text-secondary); }
  .contributor-row .avatar-small { width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 16px; font-weight: 700; color: #fff; flex-shrink: 0; }
  .contributor-row .info { flex: 1; min-width: 0; }
  .contributor-row .info .name { font-weight: 600; font-size: 14px; }
  .contributor-row .info .detail { font-size: 12px; color: var(--text-secondary); }

  .suggestions { list-style: none; display: grid; gap: 12px; }
  .suggestions li {
    background: var(--card-bg); border-radius: 10px; padding: 16px 20px 16px 48px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.04); font-size: 14px;
    position: relative; border-left: 4px solid var(--accent);
  }
  .suggestions li .sug-icon { position: absolute; left: 14px; top: 15px; font-size: 18px; }

  .data-note {
    background: #f0fdf4; border: 1px solid #bbf7d0; border-radius: 8px;
    padding: 12px 18px; margin-top: 20px; font-size: 12px; color: #166534;
  }

  .footer { text-align: center; padding: 28px; font-size: 12px; color: #b2bec3; }
  .footer a { color: var(--accent); text-decoration: none; }

  @media (max-width: 768px) {
    .header { padding: 32px 24px; flex-direction: column; text-align: center; }
    .podium-container { gap: 12px; }
    .podium-spot { min-width: 80px; }
    .podium-champion .podium-block { height: 90px; }
    .podium-runner .podium-block { height: 68px; }
    .podium-third .podium-block { height: 50px; }
  }
</style>
</head>
<body>

<div class="header">
  <div class="header-left">
    <div class="project-icon">&#x1f3e0;</div>
    <h1>{{OWNER}} / {{REPO}}</h1>
    <div class="subtitle">&#x1f4ca; 项目健康度报告</div>
    <div class="meta">
      <span>&#x1f4c5; {{DATE}}</span>
      <span>&#x23f3; 统计周期：{{PERIOD_DAYS}} 天</span>
      {{META_EXTRAS}}
    </div>
    <div class="alert-tags">
      {{ALERT_TAGS}}
    </div>
  </div>
  <div class="score-ring-wrap">
    <div class="score-ring">
      <svg width="150" height="150" viewBox="0 0 150 150">
        <circle class="bg-circle" cx="75" cy="75" r="64"/>
        <circle class="fg-circle" cx="75" cy="75" r="64" stroke="{{SCORE_COLOR}}" style="--glow-color:{{SCORE_COLOR}}" stroke-dasharray="{{SCORE_DASH}}" stroke-dashoffset="0"/>
      </svg>
      <div class="score-text">
        <span class="num" style="color:{{SCORE_COLOR}}">{{SCORE}}</span>
        <span class="label">/ 100</span>
        <span class="grade-badge" style="background:{{SCORE_COLOR}}22;color:{{SCORE_COLOR}}">{{GRADE}}</span>
      </div>
    </div>
  </div>
</div>

<div class="main">

  <!-- Deduction Detail -->
  <div class="section">
    <div class="section-title">
      <span class="icon">&#x1f4cb;</span> 扣分明细
    </div>
    <table class="deduction-table">
      <thead>
        <tr><th>指标</th><th>实际值</th><th>扣分</th><th>评定</th></tr>
      </thead>
      <tbody>
        {{DEDUCTION_ROWS}}
      </tbody>
    </table>
  </div>

  <!-- Metric Cards -->
  <div class="section">
    <div class="section-title">
      <span class="icon">&#x1f4ca;</span> 关键指标
    </div>

    {{KPI_BANNER}}

    <div class="cards">
      {{ISSUE_CARD}}
      {{PR_CARD}}
    </div>

    {{DATA_NOTE}}
  </div>

  <!-- Podium -->
  <div class="section">
    <div class="section-title">
      <span class="icon">&#x1f3c6;</span> 贡献者活跃度{{PODIUM_SUBTITLE}}
    </div>
    <div class="podium-section">
      <div class="podium-container">
        {{PODIUM}}
        <!-- 每位 podium-spot 格式：
        <div class="podium-spot podium-champion">
          <div class="avatar-area">
            <div class="crown">♛</div>
            <div class="avatar">W</div>
          </div>
          <div class="name">用户名</div>
          <div class="stat">N PRs · M Issues · 🔥 高频</div>
        <!-- 注意：仅 podium 前三名标注活跃度（🔥高频/🟢正常/🟡低频），其他贡献者不标注 -->
          <div class="podium-block"><span class="rank">🥇</span></div>
        </div>
        -->
      </div>

      <div class="other-contributors">
        <div class="list-header">&#x1f4cb; 其他贡献者{{OTHER_CONTRIBUTORS_HEADER}}</div>
        {{OTHER_CONTRIBUTORS}}
        <!-- 每条 contributor-row 格式：
        <div class="contributor-row">
          <span class="rank-num">#4</span>
          <div class="avatar-small" style="background:...;">X</div>
          <div class="info">
            <span class="name">用户名</span>
            <span class="detail">N PRs · M Issues</span>
          </div>
        </div>
        -->
        {{MORE_CONTRIBUTORS_HINT}}
      </div>

      <div style="margin-top:18px;padding-top:14px;border-top:1px solid var(--border);font-size:13px;color:var(--text-secondary);text-align:center;">
        {{CONTRIBUTOR_SUMMARY}}
      </div>
    </div>
  </div>

  <!-- Suggestions -->
  <div class="section">
    <div class="section-title">
      <span class="icon">&#x1f4a1;</span> 改进建议
    </div>
    <ul class="suggestions">
      {{SUGGESTIONS}}
    </ul>
  </div>

</div>

<div class="footer">
  {{FOOTER}}
</div>

</body>
</html>