:root {
    --owla-violet: #3B2A5E;
    --owla-gold: #D9A441;
    --owla-bg: #16112B;
}

/* iPad Safari: the browser's own toolbar shrinks the VISIBLE viewport, but `100vh` keeps
   reporting the LARGE (toolbar-hidden) height. The app then lays out taller than what's on
   screen, Safari scrolls the document to compensate, and the app's own top bar is pushed out
   of view — it only reappears once Safari's toolbar hides and 100vh finally matches reality.
   Pinning the shell to the dynamic viewport (100dvh, with a 100vh fallback for old engines)
   and locking the document against scrolling keeps the top bar on screen in every toolbar
   state. */
html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    overscroll-behavior: none;
}

/* Assumes Safari 15.4+ (Mar 2022) for dvh/dvw. On older engines the declaration is dropped and
   the vh/vw fallback applies — which is the buggy value this exists to avoid, and locking the
   document scroll above also removes the scroll-to-reveal escape those users had before. That's
   an accepted regression for a shrinking pre-15.4 population, not an oversight. */
#out {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    width: 100dvw;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
}

/* Touch: a long press with a finger otherwise triggers Safari/Chrome's native text-selection
   and callout ("Copy / Look Up") over the app chrome, which selects the whole page. The app
   surface is a canvas — nothing here is meant to be selectable. The hidden IME input Avalonia
   creates (.avalonia-input-element) is exempted below so typing/IME still works. */
/* (.avalonia-container is omitted deliberately: Avalonia adds that class to #out itself.) */
html, body, #out, .avalonia-canvas, .avalonia-native-host, .owla-splash {
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
}

/* Hand all gesture handling to the app. Without this, Safari holds each contact in its
   double-tap-to-zoom / pan disambiguation window before committing pointer events, which on an
   iPad means a stroke started shortly after the previous one lifts is delayed by a few hundred
   ms — or swallowed entirely, because Safari decided the two contacts were a double-tap gesture
   and never delivered the second pointerdown. That is the "I have to wait half a second between
   Apple Pencil strokes or the stroke doesn't register" bug. The app is a full-screen canvas that
   implements its own pan and zoom, so there is no native gesture here worth preserving.
   Kept as its own rule (not folded into the user-select block above) because it must NOT apply
   to .avalonia-input-element — see below.

   Widened to "#out *": naming the canvas/native-host classes explicitly missed whatever element
   Avalonia 12 actually delivers the iPad's pointer events on, so Safari kept running its gesture
   window on that uncovered wrapper and the half-second stroke delay survived the earlier fix.
   Every gesture surface lives under #out, so covering the whole subtree is the reliable net. */
html, body, #out, #out * {
    touch-action: none;
}

.avalonia-input-element {
    -webkit-user-select: text;
    user-select: text;
    /* The hidden IME input needs native touch behavior for caret placement and selection.
       !important so it still wins over the broadened "#out *" rule above (which, via #out's id,
       otherwise outranks this class selector). */
    touch-action: auto !important;
}

.owla-splash {
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    background: var(--owla-bg);
    color: var(--owla-gold);
    font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
}

/* Boot indicator: the first load pulls several MB of WASM and the API can be cold-starting,
   so a static "waking up" line reads as a frozen page. The ring spins for as long as the boot
   takes, and the status line below it advances through the real stages (see main.js). */
.owla-spinner {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 3px solid rgba(217, 164, 65, 0.22);
    border-top-color: var(--owla-gold);
    animation: owla-spin 0.9s linear infinite;
}

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

.owla-splash .owla-status {
    font-size: 13px;
    opacity: 0.62;
    min-height: 1.2em;
    margin: -6px 0 0;
}

@media (prefers-reduced-motion: reduce) {
    .owla-spinner { animation-duration: 2.4s; }
}
