// Full rules block — pinned at the bottom so there's a single source of truth
// and nobody's confused about scoring / eligibility.
function RuleGroup({ icon, title, pill, items }) {
  return (
    <div className="rule-group">
      <div className="rule-head">
        <span className="rule-title"><Icon name={icon} size={14} color="var(--ll-neon)" /> {title}</span>
        {pill ? <span className="rule-pill num">{pill}</span> : null}
      </div>
      <ul className="rule-list">
        {items.map((it, i) => <li key={i}>{it}</li>)}
      </ul>
    </div>
  );
}

function Rules() {
  const m = window.DASH.meta;
  const days = Math.round((new Date(m.end) - new Date(m.start)) / 86400000);
  return (
    <section className="card panel">
      <div className="panel-head">
        <div className="panel-titles">
          <div className="panel-eyebrow"><Icon name="flag" size={14} color="var(--ll-neon)" /> The Rules</div>
          <h2 className="panel-title">How It Works</h2>
          <p className="panel-desc">
            <b className="num">${money(m.prizePool, { dp: 0 })} {m.currency}</b> prize pool · {days}-day sprint · trade through Ted&rsquo;s link to take part.
          </p>
        </div>
      </div>

      <div className="rules-grid">
        <RuleGroup icon="trophy" title="Leaderboard" pill="$1,000" items={[
          "Referred traders ranked by total trading volume.",
          "Prizes: 1st $500 · 2nd $300 · 3rd $200.",
          "Tail trades (executed above 97% implied probability) don't count toward leaderboard volume.",
        ]} />
        <RuleGroup icon="ticket" title="FTT Raffle" pill="$1,000" items={[
          "5 winners × $200, drawn at close.",
          "Eligible: join via the link and trade ≥ $50 volume.",
          "Top 3 leaderboard finishers are excluded — they take the cash prize.",
          "Trades in the final 12 hours don't count toward raffle entry.",
        ]} />
        <RuleGroup icon="flag" title="How to enter" items={[
          "Sign up and trade through Ted's referral link.",
          "Your volume is tracked automatically — no registration needed.",
          "Standings update live and are final at close.",
        ]} />
      </div>
    </section>
  );
}

window.Rules = Rules;
