:root {
    color-scheme: light dark;
    --fg: #1f2933;
    --muted: #6b7280;
    --accent: #2563eb;
    --ok: #16a34a;
    --fail: #dc2626;
    --bg: #f8fafc;
}

@media (prefers-color-scheme: dark) {
    :root {
        --fg: #e5e7eb;
        --muted: #9ca3af;
        --bg: #0f172a;
    }
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    height: 100%;
    background: var(--bg);
    color: var(--fg);
    font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

.container {
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 24px;
}

.content {
    text-align: center;
    max-width: 560px;
}

h1 {
    font-weight: 600;
    margin: 0 0 24px;
}

.check-loader {
    height: 64px;
    margin-bottom: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(37, 99, 235, 0.2);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.9s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.mark {
    display: none;
    width: 56px;
    height: 56px;
    line-height: 56px;
    border-radius: 50%;
    color: #fff;
    font-size: 30px;
    font-weight: 700;
}

.mark-ok { background: var(--ok); }
.mark-fail { background: var(--fail); }

.state { display: none; }
.lead { font-weight: 600; font-size: 1.1em; margin-bottom: 4px; }
.hint { color: var(--muted); font-size: 0.9em; }
p { margin: 6px 0; }

/* State switching is driven by data-state on .check-container */
[data-state="checking"] .state-checking { display: block; }
[data-state="ok"] .state-ok { display: block; }
[data-state="denied"] .state-denied { display: block; }
[data-state="error"] .state-error { display: block; }

[data-state="ok"] .spinner,
[data-state="denied"] .spinner,
[data-state="error"] .spinner { display: none; }
[data-state="ok"] .mark-ok { display: block; }
[data-state="denied"] .mark-fail,
[data-state="error"] .mark-fail { display: block; }

.button {
    margin-top: 8px;
    padding: 10px 22px;
    font: inherit;
    color: #fff;
    background: var(--accent);
    border: 0;
    border-radius: 6px;
    cursor: pointer;
}

.button:hover { filter: brightness(1.1); }

.download {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 16px;
    padding: 14px 32px;
    border: 0;
    font-family: inherit;
    font-size: 1.1em;
    font-weight: 600;
    line-height: inherit;
    color: #fff;
    background: var(--accent);
    border-radius: 8px;
    text-decoration: none;
}

.download[hidden] { display: none; }
.download:not(:disabled):hover { filter: brightness(1.1); }
.download:disabled { cursor: default; opacity: 0.8; }

.download-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.9s linear infinite;
}

@media (prefers-reduced-motion: reduce) {
    .download-spinner { animation: none; }
}
