<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Episode Card Update</title>
    <link rel="preconnect" href="https://fonts.googleapis.com">
    <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
    <link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700;800;900&family=Noto+Sans+SC:wght@400;700;900&display=swap"
          rel="stylesheet">

    <style>
        :root {
            --bg-dark: #09090b;
            --text-white: #ffffff;
            --accent-pink: #ec4899;
            --font-main: 'Inter', 'Noto Sans SC', system-ui, sans-serif;
        }

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

        body {
            font-family: var(--font-main);
            background-color: #000;
            display: flex;
            justify-content: center;
            align-items: center;
            min-height: 100vh;
            -webkit-font-smoothing: antialiased;
            padding: 0;
            margin: 0;
        }

        .card-container {
            width: 100%;
            max-width: 768px;
            background-color: #000;
            position: relative;
            overflow: hidden;
        }

        /* Image Section */
        .image-wrapper {
            position: relative;
            width: 100%;
            padding-top: 133.33%; /* 3:4 aspect ratio */
            overflow: hidden;
        }

        .bg-image {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            object-fit: cover;
        }

        /* Gradient Overlay */
        .gradient-overlay {
            position: absolute;
            bottom: 0;
            left: 0;
            right: 0;
            height: 60%;
            background: linear-gradient(to bottom,
            transparent 0%,
            rgba(0, 0, 0, 0.3) 30%,
            rgba(0, 0, 0, 0.7) 60%,
            rgba(0, 0, 0, 0.95) 100%);
            z-index: 1;
        }

        /* Content Section */
        .content-section {
            position: absolute;
            bottom: 0;
            left: 0;
            right: 0;
            padding: 32px 28px 28px;
            z-index: 2;
        }

        /* EP and Title */
        .episode-header {
            margin-bottom: 12px;
        }

        .ep-title-row {
            display: flex;
            align-items: baseline;
            gap: 12px;
            margin-bottom: 12px;
        }

        .ep-number {
            font-size: 56px;
            font-weight: 900;
            color: var(--accent-pink);
            letter-spacing: -1px;
            line-height: 1;
        }

        .episode-title {
            font-size: 48px;
            font-weight: 900;
            color: white;
            letter-spacing: -1px;
            line-height: 1.1;
            flex: 1;
        }

        /* Metadata Row */
        .metadata-row {
            display: flex;
            align-items: center;
            gap: 12px;
            font-size: 17px;
            font-weight: 600;
            color: rgba(255, 255, 255, 0.8);
            margin-bottom: 20px;
        }

        .metadata-row span {
            white-space: nowrap;
        }

        .separator {
            color: rgba(255, 255, 255, 0.4);
        }

        /* Description */
        .description-text {
            font-size: 17px;
            line-height: 1.7;
            color: rgba(255, 255, 255, 0.85);
            margin-bottom: 24px;
            display: -webkit-box;
            -webkit-line-clamp: 3;
            -webkit-box-orient: vertical;
            overflow: hidden;
        }

        /* Fallback */
        .fallback-container {
            width: 100%;
            padding-top: 133.33%;
            background: radial-gradient(circle at center, #2a2a35 0%, #09090b 100%);
            display: flex;
            align-items: center;
            justify-content: center;
            position: relative;
        }

        .fallback-icon {
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            font-size: 120px;
            opacity: 0.1;
        }

        /* Responsive */
        @media (max-width: 480px) {
            .ep-number {
                font-size: 44px;
            }

            .episode-title {
                font-size: 40px;
            }

            .content-section {
                padding: 24px 20px 20px;
            }

            .metadata-row {
                font-size: 15px;
            }

            .description-text {
                font-size: 15px;
            }
        }
    </style>
</head>
<body>

<div class="card-container" id="card-container">
    <!-- Image Section -->
    <div class="image-wrapper">
        {% if image_url %}
            <img src="{{ image_url }}" alt="Cover" class="bg-image" referrerpolicy="no-referrer">
        {% else %}
            <div class="fallback-container">
                <span class="fallback-icon">🎬</span>
            </div>
        {% endif %}

        <!-- Gradient Overlay -->
        <div class="gradient-overlay"></div>
    </div>

    <!-- Content Section -->
    <div class="content-section">
        <div class="episode-header">
            <div class="ep-title-row">
                <span class="ep-number">EP.{{ '%02d' % sort if sort else '01' }}</span>
                <h1 class="episode-title">{{ name_cn or name or "第 " + (sort|string) + " 话" }}</h1>
            </div>

            <div class="metadata-row">
                {% if airdate %}
                    <span>{{ airdate.split('-')[0] if '-' in airdate else '2026' }}</span>
                    <span class="separator">|</span>
                {% endif %}
                <span>24min</span>
                {% if comment > 0 %}
                    <span class="separator">|</span>
                    <span>{{ comment }} comments</span>
                {% endif %}
            </div>
        </div>

        {% if desc %}
            <p class="description-text">{{ desc }}</p>
        {% endif %}
    </div>
</div>

</body>
</html>