<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>New Year Card</title>
    <style>
        /* Page layout */
        body {
            margin: 0;
            min-height: 100vh;
            display: flex;
            justify-content: center;
            align-items: center;
            background: radial-gradient(circle at top, #1b1b3a, #02010a);
            font-family: system-ui, sans-serif;
            color: white;
        }

        /* Main card */
        .card {
            width: 320px;
            padding: 30px 20px 40px;
            background: rgba(0, 0, 0, 0.45);
            border-radius: 18px;
            box-shadow: 0 0 25px #0008;
            text-align: center;
            position: relative;
            overflow: hidden;
        }

        .title {
            margin: 0 0 10px;
            font-size: 22px;
            letter-spacing: 2px;
            text-transform: uppercase;
            opacity: 0.8;
        }

        #countdown {
            font-size: 60px;
            font-weight: 700;
            margin: 20px 0 10px;
            min-height: 70px;
        }

        .subtitle {
            font-size: 14px;
            opacity: 0.8;
            min-height: 20px;
        }

        #startBtn {
            margin-top: 15px;
            padding: 10px 20px;
            font-size: 16px;
            border-radius: 999px;
            border: none;
            cursor: pointer;
            background: linear-gradient(135deg, #ff7b00, #ff006e);
            color: white;
            font-weight: 600;
            transition: transform 0.2s, box-shadow 0.2s;
            box-shadow: 0 0 10px #ff006e88;
        }

        #startBtn:hover {
            transform: translateY(-2px) scale(1.03);
            box-shadow: 0 0 16px #ff006eaa;
        }

        #startBtn:active {
            transform: translateY(0) scale(0.97);
            box-shadow: 0 0 6px #ff006e77;
        }

        /* Fireworks container */
        .sky {
            position: absolute;
            inset: 0;
            pointer-events: none;
            opacity: 0;
            transition: opacity 0.5s;
        }

        .sky.show {
            opacity: 1;
        }

        .firework {
            position: absolute;
            width: 6px;
            height: 6px;
            border-radius: 50%;
            background: transparent;
            animation: explode 1.2s ease-out infinite;
        }

        /* Different positions + colors */
        .f1 {
            top: 20%;
            left: 25%;
            box-shadow:
                0 -18px 0 2px #ffcc00,
                16px -10px 0 2px #ff006e,
                18px 8px 0 2px #00f5ff,
                0 18px 0 2px #9dff00,
                -18px 8px 0 2px #ff9a00,
                -16px -10px 0 2px #b967ff;
            animation-delay: 0s;
        }

        .f2 {
            top: 35%;
            right: 18%;
            box-shadow:
                0 -18px 0 2px #00f5ff,
                16px -10px 0 2px #ffcc00,
                18px 8px 0 2px #ff006e,
                0 18px 0 2px #ffffff,
                -18px 8px 0 2px #ff9a00,
                -16px -10px 0 2px #9dff00;
            animation-delay: 0.3s;
        }

        .f3 {
            bottom: 18%;
            left: 20%;
            box-shadow:
                0 -18px 0 2px #ff9a00,
                16px -10px 0 2px #ffffff,
                18px 8px 0 2px #00f5ff,
                0 18px 0 2px #ff006e,
                -18px 8px 0 2px #ffcc00,
                -16px -10px 0 2px #b967ff;
            animation-delay: 0.6s;
        }

        .f4 {
            bottom: 15%;
            right: 22%;
            box-shadow:
                0 -18px 0 2px #ffffff,
                16px -10px 0 2px #ff006e,
                18px 8px 0 2px #ffcc00,
                0 18px 0 2px #00f5ff,
                -18px 8px 0 2px #9dff00,
                -16px -10px 0 2px #ff9a00;
            animation-delay: 0.9s;
        }

        @keyframes explode {
            0% {
                transform: scale(0.2);
                opacity: 1;
            }
            70% {
                transform: scale(1.3);
                opacity: 1;
            }
            100% {
                transform: scale(1.8);
                opacity: 0;
            }
        }
    </style>
</head>
<body>

<div class="card">
    <h1 class="title">New Year Countdown</h1>

    <div id="countdown">Click start</div>
    <div class="subtitle">It will count 5 → 1 and then launch fireworks.</div>

    <button id="startBtn">Start 🎉</button>

    <!-- Fireworks -->
    <div class="sky" id="sky">
        <div class="firework f1"></div>
        <div class="firework f2"></div>
        <div class="firework f3"></div>
        <div class="firework f4"></div>
    </div>
</div>

<script>
    const countdownEl = document.getElementById("countdown");
    const startBtn = document.getElementById("startBtn");
    const sky = document.getElementById("sky");

    let running = false;

    startBtn.addEventListener("click", () => {
        if (running) return; // avoid double click issues
        running = true;
        sky.classList.remove("show");
        startBtn.disabled = true;

        const numbers = [5, 4, 3, 2, 1];
        let index = 0;

        countdownEl.textContent = numbers[index];

        const interval = setInterval(() => {
            index++;
            if (index < numbers.length) {
                countdownEl.textContent = numbers[index];
            } else {
                clearInterval(interval);
                countdownEl.textContent = "🎆 Happy New Year! 🎆";
                sky.classList.add("show");
                startBtn.disabled = false;
                running = false;
            }
        }, 1000);
    });
</script>

</body>
</html>