html, body {
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
    /* Same paper as the Compose page, so there is no white flash while it loads. */
    background: #F4F6F8;
    color: #0F2A47;
    font-family: ui-monospace, "SF Mono", Menlo, monospace;
}

/* The Compose viewport; it sizes its canvas to this element. */
#app {
    position: fixed;
    inset: 0;
}

/* ---- Loading sheet ------------------------------------------------------------------ */

.loader {
    --ink: #0F2A47;
    --red: #C4410F;
    position: fixed;
    inset: 0;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 18px;
    background-color: #F4F6F8;
    background-image:
        linear-gradient(rgba(15, 42, 71, 0.06) 1px, transparent 1px),
        linear-gradient(90deg, rgba(15, 42, 71, 0.06) 1px, transparent 1px);
    background-size: 24px 24px;
    transition: opacity 0.5s ease;
}

.loader.done {
    opacity: 0;
    pointer-events: none;
}

.loader p {
    margin: 0;
    font-size: 12px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #3D5A78;
}

/*
 * The drawing sheet, 240 × 170 drawing units. index.html fills it with strokes and animates
 * only their transform and opacity, which the browser can run off the main thread.
 */
.sheet {
    position: relative;
    width: min(240px, 70vw);
    aspect-ratio: 240 / 170;
}

.sheet i {
    position: absolute;
    display: block;
    background: var(--ink);
    will-change: transform, opacity;
}

.sheet i.red { background: var(--red); }

.sheet i.ring {
    box-sizing: border-box;
    aspect-ratio: 1;
    background: none;
    border: 1px solid var(--red);
    border-radius: 50%;
}

.sheet i.dash {
    box-sizing: border-box;
    background: none;
    border: 1px dashed var(--ink);
}

/* ---- Dark sheet: only once the visitor picks it with the switch ----------------------- */

:root[data-theme="dark"] body,
:root[data-theme="dark"] .loader { background-color: #1E1F21; color: #C9CACC; }
:root[data-theme="dark"] .loader {
    --ink: #C9CACC;
    --red: #D9BC4C;
    background-image:
        linear-gradient(rgba(201, 202, 204, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(201, 202, 204, 0.05) 1px, transparent 1px);
}
:root[data-theme="dark"] .loader p { color: #909296; }

/* Reduced motion: index.html leaves the strokes still, fully drawn; no fade either. */
@media (prefers-reduced-motion: reduce) {
    .loader { transition: none; }
}
