/* Self-hosted rather than a Google Fonts <link>: the game already renders text before any
 * network round-trip could resolve, and self-hosting means it still works offline/on a flaky
 * phone connection during a test session. Variable font -- one file covers every weight. */
@font-face {
    font-family: "Pixelify Sans";
    src: url("./assets/fonts/PixelifySans.woff2") format("woff2-variations");
    font-weight: 400 700;
    font-display: block;
}

/* Body/dialogue text: Pixelify Sans's blocky pixel-style glyphs read fine as a short display
 * font (logo, name tags, CTAs) but get genuinely hard to parse as paragraphs of dialogue at
 * small sizes. Nunito is a rounded, high-x-height sans that stays legible small and still reads
 * warm/casual rather than corporate -- self-hosted for the same offline/no-round-trip reason as
 * Pixelify Sans above. */
@font-face {
    font-family: "Nunito";
    src: url("./assets/fonts/Nunito.woff2") format("woff2-variations");
    font-weight: 400 800;
    font-display: block;
}

body {
    margin: 0;
    padding: 0;
    color: rgba(255, 255, 255, 0.87);
    background-color: #000000;
}

#app {
    width: 100%;
    max-width: 100%;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: env(safe-area-inset-top) env(safe-area-inset-right)
             env(safe-area-inset-bottom) env(safe-area-inset-left);
    box-sizing: border-box;
    background: #2a1a10;
}

/*
 * Keep the pixels crisp when the canvas is stretched to the window.
 *
 * `pixelArt: true` in the game config only governs the WebGL textures (NEAREST sampling). It does
 * not govern how the finished canvas is scaled to the page. Scale.FIT resizes the canvas element
 * with CSS by a non-integer factor, and the browser default for that is bilinear -- which is the
 * blur. `image-rendering: pixelated` forces the CSS upscale to nearest-neighbour too, so the art
 * stays sharp. The first two values are fallbacks for browsers that do not know `pixelated`.
 */
#game-container canvas {
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
    image-rendering: pixelated;
}

#game-container {
    width: 100%;
    height: 100%;
    min-width: 0;
    min-height: 0;
}

/* Tap-to-move sends many quick taps; without this, mobile browsers wait ~300ms to rule out a
 * double-tap zoom and iOS can zoom the page on a fast double tap. */
#game-container canvas {
    touch-action: none;
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
}

/* The crash card (src/main.ts showCrashOverlay): plain DOM so it works when the renderer died. */
#crash-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(42, 26, 16, 0.92);
    z-index: 1000;
    font-family: "Nunito", sans-serif;
}
#crash-overlay .crash-card {
    background: #f6ead6;
    color: #2a1a10;
    border: 2px solid #b98a5a;
    border-radius: 10px;
    padding: 20px 24px;
    max-width: 320px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    text-align: center;
}
#crash-overlay .crash-card span {
    font-size: 12px;
    opacity: 0.7;
    word-break: break-word;
}
#crash-overlay button {
    font-family: "Pixelify Sans", monospace;
    font-size: 16px;
    padding: 10px 16px;
    border: 2px solid #b98a5a;
    border-radius: 8px;
    background: #e8a35a;
    color: #2a1a10;
}
