{% extends "base.html" %}

{% block title %}About - Pickleball ELO Tracker{% endblock %}

{% block content %}
<h1>❓ About Pickleball ELO</h1>
{% include "components/nav.html" %}

<div class="card">
    <h2>📊 What is ELO?</h2>
    <p>
        The ELO rating system is a method for calculating the relative skill levels of players. 
        It was invented for chess but works great for any competitive sport.
    </p>
    <p>
        In pickleball, your ELO rating represents your skill level. Everyone starts at 1500. 
        When you play a match, your rating goes up or down based on:
    </p>
    <ul>
        <li><strong>Your performance:</strong> Points won ÷ total points (not just win/loss)</li>
        <li><strong>Your opponent's skill:</strong> Playing a higher-rated opponent is worth more</li>
        <li><strong>The upset factor:</strong> Beating someone stronger gains more points</li>
    </ul>
</div>

<div class="card">
    <h2>🎾 Unified Rating (v3.0)</h2>
    <p>
        In version 3, we switched from separate singles/doubles ratings to a <strong>unified rating</strong>.
        Both singles and doubles matches contribute to the same ELO rating, because:
    </p>
    <ul>
        <li>One rating is simpler to understand</li>
        <li>Players who excel in both formats get fairly rewarded</li>
        <li>Pure ELO is transparent and bias-free</li>
    </ul>
</div>

<div class="card">
    <h2>⚖️ Smart Doubles Scoring</h2>
    <p>
        In doubles matches, we calculate your "effective opponent" to make scoring fair:
    </p>
    <p style="background: #f5f5f5; padding: 15px; border-radius: 6px; font-family: monospace;">
        <strong>Effective Opponent = Opp1 + Opp2 - Teammate</strong>
    </p>
    <p>
        This means:
    </p>
    <ul>
        <li><strong>Playing with a strong teammate</strong> → harder opponents count as weaker → less credit for winning</li>
        <li><strong>Playing with a weak teammate</strong> → harder opponents count as stronger → more credit for winning</li>
    </ul>
    <p>
        This approach is <strong>fair, symmetric, and makes strategic sense</strong>.
    </p>
</div>

<div class="card">
    <h2>🧮 The Formula</h2>
    <p style="background: #f5f5f5; padding: 15px; border-radius: 6px; font-family: monospace;">
        <strong>Rating Change = K × (Actual Performance − Expected Performance)</strong>
    </p>
    <p>Where:</p>
    <ul>
        <li><strong>K = 32</strong> (standard, adjustable for casual/competitive play)</li>
        <li><strong>Actual Performance</strong> = Your points ÷ Total points</li>
        <li><strong>Expected Performance</strong> = Based on the ELO formula (derived from rating difference)</li>
    </ul>
    <p style="color: #666; font-size: 13px;">
        The expected performance formula: <code>E = 1 / (1 + 10^((Opp_Rating - Your_Rating) / 400))</code>
    </p>
</div>

<div class="card">
    <h2>📈 Why This System Works</h2>
    <ul>
        <li><strong>Transparent:</strong> No hidden formulas or magic numbers. You can verify your rating changes.</li>
        <li><strong>Fair:</strong> You're rewarded for actual performance, not just wins.</li>
        <li><strong>Balanced:</strong> Winning 11-2 and 11-9 are different and rated differently.</li>
        <li><strong>Skill-based:</strong> Beating stronger players earns more; losing to them costs less.</li>
        <li><strong>Predictable:</strong> Ratings converge to true skill over time.</li>
    </ul>
</div>

<div class="card">
    <h2>📝 Version History</h2>
    <ul>
        <li><strong>v3.0.0</strong> - Unified ELO rating, modular architecture, pure ELO calculator</li>
        <li><strong>v2.0.0</strong> - Glicko-2 system with separate singles/doubles ratings</li>
        <li><strong>v1.0.0</strong> - Initial release with basic ELO</li>
    </ul>
</div>
{% endblock %}
