<!doctype html>
<html lang="en">
    <head>
        <meta charset="utf-8" />
        <meta name="viewport" content="width=device-width,initial-scale=1" />
        <meta name="robots" content="noindex" />
        <title>Verify</title>
        <style>
            :root {
                --bg: #f5f5f5;
                --text: #111;
                --surface: #e2e2e2;
                --border: #bbb;
                --muted: #777;
                --link: #555;
                --error: #c00;
                --accent: {{ACCENT_COLOR}};
            }
            @media (prefers-color-scheme: dark) {
                :root {
                    --bg: #0a0a0a;
                    --text: #e0e0e0;
                    --surface: #1a1a1a;
                    --border: #333;
                    --muted: #555;
                    --link: #777;
                    --error: #f55;
                }
            }
            * {
                margin: 0;
                padding: 0;
                box-sizing: border-box;
            }
            body {
                font-family: system-ui, sans-serif;
                display: flex;
                justify-content: center;
                align-items: center;
                height: 100vh;
                background: var(--bg);
                color: var(--text);
            }
            .box {
                text-align: center;
                max-width: 480px;
                width: 100%;
                padding: 2rem;
            }
            h2 {
                margin-bottom: 1.2rem;
                font-weight: 500;
            }
            .captcha-wrap {
                position: relative;
                display: inline-block;
                margin: 0 auto 1.2rem;
            }
            img {
                display: block;
                border-radius: 6px;
                max-width: 100%;
            }
            .reload-btn {
                position: absolute;
                bottom: 6px;
                right: 6px;
                width: 32px;
                height: 32px;
                background: rgba(0,0,0,0.45);
                border: none;
                border-radius: 4px;
                cursor: pointer;
                display: flex;
                align-items: center;
                justify-content: center;
                padding: 0;
                transition: background 0.15s;
            }
            .reload-btn:hover {
                background: rgba(0,0,0,0.7);
            }
            .reload-btn svg {
                width: 18px;
                height: 18px;
                fill: none;
                stroke: #fff;
                stroke-width: 2;
                stroke-linecap: round;
                stroke-linejoin: round;
            }
            input[type='text'] {
                width: 100%;
                padding: 0.6rem 0.8rem;
                font-size: 1.1rem;
                letter-spacing: 0.15em;
                text-transform: uppercase;
                background: var(--surface);
                color: var(--text);
                border: 1px solid var(--border);
                border-radius: 4px;
                outline: none;
                margin-bottom: 0.8rem;
            }
            input[type='text']:focus {
                border-color: var(--accent);
            }
            button {
                width: 100%;
                padding: 0.6rem;
                background: var(--accent);
                color: #111;
                border: none;
                border-radius: 4px;
                font-size: 1rem;
                font-weight: 600;
                cursor: pointer;
            }
            button:hover {
                filter: brightness(0.85);
            }
            .branding {
                margin-top: 1.5rem;
                font-size: 0.7rem;
                color: var(--muted);
            }
            .branding a {
                color: var(--link);
                text-decoration: none;
            }
            .branding a:hover {
                text-decoration: underline;
            }
            .error {
                color: var(--error);
                font-size: 0.85rem;
                margin-bottom: 0.8rem;
            }
        </style>
    </head>
    <body>
        <div class="box">
            <h2>Type the characters shown</h2>
            <div class="captcha-wrap">
                <img src="data:image/png;base64,{{image}}" alt="CAPTCHA" />
                <button
                    type="button"
                    class="reload-btn"
                    title="New challenge"
                    onclick="location.href='{{redirect}}'"
                >
                    <svg viewBox="0 0 24 24">
                        <path d="M1 4v6h6" />
                        <path d="M23 20v-6h-6" />
                        <path
                            d="M20.49 9A9 9 0 0 0 5.64 5.64L1 10m22 4-4.64 4.36A9 9 0 0 1 3.51 15"
                        />
                    </svg>
                </button>
            </div>
            {{ERROR}}
            <form method="POST" action="{{verifyPath}}">
                <input type="hidden" name="id" value="{{id}}" />
                <input type="hidden" name="redirect" value="{{redirect}}" />
                <input
                    type="text"
                    name="nonce"
                    autocomplete="off"
                    autocorrect="off"
                    autocapitalize="characters"
                    spellcheck="false"
                    autofocus
                    placeholder="Enter characters above"
                />
                <button type="submit">Verify</button>
            </form>
            {{BRANDING}}
        </div>
    </body>
</html>
