/* Sign-in pages (/login, /dl) and the "Downloading…" page. */
:root {
    --bg: #f4f6fa;
    --card: #ffffff;
    --border: rgba(15, 23, 42, 0.06);
    --text: #0f172a;
    --muted: #64748b;
    --accent: #2563eb;
    --accent-soft: #e8efff;
    --track: #e7ecf3;
    --shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 16px 40px rgba(15, 23, 42, 0.08);
    --on-accent: #ffffff;
    --input-bg: #ffffff;
    --input-border: #d5dce6;
    --error: #b91c1c;
    --error-soft: #fdecec;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0b1120;
        --card: #131c2e;
        --border: rgba(148, 163, 184, 0.12);
        --text: #e2e8f0;
        --muted: #94a3b8;
        --accent: #60a5fa;
        --accent-soft: rgba(96, 165, 250, 0.12);
        --track: #1e293b;
        --shadow: 0 16px 40px rgba(0, 0, 0, 0.4);
        --on-accent: #0b1120;
        --input-bg: #0f172a;
        --input-border: #2a3650;
        --error: #fca5a5;
        --error-soft: rgba(248, 113, 113, 0.12);
    }
}

* { box-sizing: border-box; }

body {
    margin: 0;
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 16px;
    background: var(--bg);
    color: var(--text);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
}

.dl-card {
    width: 100%;
    max-width: 360px;
    padding: 40px 32px 32px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 20px;
    box-shadow: var(--shadow);
    text-align: center;
    animation: dl-enter 0.35s ease-out both;
}

.dl-icon {
    position: relative;
    width: 72px;
    height: 72px;
    margin: 0 auto 20px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: var(--accent-soft);
}

.dl-ring {
    position: absolute;
    inset: 0;
    animation: dl-spin 1.1s linear infinite;
}

.dl-ring circle {
    fill: none;
    stroke-width: 3;
}

.dl-ring-track { stroke: transparent; }

.dl-ring-arc {
    stroke: var(--accent);
    stroke-linecap: round;
    stroke-dasharray: 52 208;
}

.dl-arrow path {
    fill: none;
    stroke: var(--accent);
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.dl-title {
    margin: 0;
    font-size: 21px;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.dl-file {
    margin: 6px 0 24px;
    color: var(--muted);
    font-size: 14px;
    overflow-wrap: anywhere;
}

.dl-bar {
    position: relative;
    height: 4px;
    border-radius: 999px;
    background: var(--track);
    overflow: hidden;
}

.dl-bar span {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 40%;
    border-radius: inherit;
    background: var(--accent);
    animation: dl-slide 1.4s ease-in-out infinite;
}

.dl-help {
    margin: 20px 0 0;
    color: var(--muted);
    font-size: 13px;
}

.dl-help a {
    color: var(--accent);
    font-weight: 500;
    text-decoration: none;
}

.dl-help a:hover { text-decoration: underline; }

.dl-help a:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 4px;
}

/* Download sign-in form (/dl). */
.dl-login .dl-file { margin-bottom: 28px; }

.dl-error {
    margin: -12px 0 20px;
    padding: 10px 12px;
    border-radius: 10px;
    background: var(--error-soft);
    color: var(--error);
    font-size: 14px;
    text-align: left;
}

.dl-field {
    display: block;
    margin-bottom: 16px;
    text-align: left;
}

.dl-field span {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 500;
}

.dl-field input {
    width: 100%;
    height: 44px;
    padding: 0 14px;
    border: 1px solid var(--input-border);
    border-radius: 10px;
    background: var(--input-bg);
    color: var(--text);
    font: inherit;
    font-size: 15px;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.dl-field input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.dl-button {
    width: 100%;
    height: 46px;
    margin-top: 8px;
    border: 0;
    border-radius: 10px;
    background: var(--accent);
    color: var(--on-accent);
    font: inherit;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: filter 0.15s, transform 0.05s;
}

.dl-button:hover { filter: brightness(1.08); }
.dl-button:active { transform: translateY(1px); }

.dl-button:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.dl-button:disabled {
    cursor: progress;
    opacity: 0.7;
}

/* Download handed to the browser: stop the spinner and show a checkmark. */
.dl-check { display: none; }

.is-done .dl-arrow-down { display: none; }
.is-done .dl-check { display: inline; }

.is-done .dl-ring { animation: none; }

.is-done .dl-ring-arc {
    stroke-dasharray: none;
    transition: stroke-dasharray 0.3s;
}

.is-done .dl-bar span {
    left: 0;
    width: 100%;
    opacity: 1;
    animation: none;
}

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

@keyframes dl-slide {
    0% { left: -40%; }
    100% { left: 100%; }
}

@keyframes dl-enter {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
    .dl-card, .dl-ring, .dl-bar span { animation: none; }
    .dl-bar span { left: 0; width: 100%; opacity: 0.35; }
}
