:root {
    /* The website's background, so any space around the phone screen reads as part of the page. */
    --bg: #0c0c0f;
    --muted: #aaa79f;
    --accent: #ffe26a;
    --line: rgba(255, 255, 255, 0.16);
}

* {
    box-sizing: border-box;
}

html,
body {
    height: 100%;
    margin: 0;
    overflow: hidden;
    background: var(--bg);
    color: var(--muted);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

body {
    display: grid;
    place-items: center;
}

/* Tablets and desktops: the largest box of the game's own phone shape (1170 x 2532) that fits the frame; the
   website decides how big the frame is. */
#frame {
    position: relative;
    width: min(100vw, calc(100dvh * 390 / 844));
    height: min(100dvh, calc(100vw * 844 / 390));
    container-type: size;
}

/* Phones: the whole screen, as the app plays. The game's own scaling and safe area fit any phone shape. */
@media (pointer: coarse) and (max-width: 600px), (max-width: 480px) {
    #frame {
        width: 100vw;
        height: 100dvh;
    }
}

#unity-canvas {
    display: block;
    width: 100%;
    height: 100%;
    outline: none;
}

/* Loading: the game's own splash (the same 1170 x 2532 shape as the frame) with the bar drawn where the game
   draws its own, so the game's splash takes over without a jump. */
#loading {
    position: absolute;
    inset: 0;
    background: #0f2041 url("splash.jpg") center / cover no-repeat;
}

#loading[hidden],
#error[hidden],
#fullscreen[hidden] {
    display: none;
}

/* The splash bar: 512 x 32 on the 1170 x 2532 canvas, its middle 350 above the bottom edge. */
#loading .track {
    position: absolute;
    left: 28.12%;
    width: 43.76%;
    top: 85.55%;
    height: 1.26%;
    border-radius: 999px;
    background: #1e2346;
    box-shadow: inset 0 0 0 max(1px, 0.08cqh) #2c3263;
    overflow: hidden;
}

#progress {
    width: 0;
    height: 100%;
    border-radius: 999px;
    background: #3b8bf5;
    transition: width 0.2s ease-out;
}

#error {
    position: absolute;
    inset: auto 16px 16px;
    padding: 16px;
    border-radius: 8px;
    background: rgba(180, 30, 30, 0.9);
    color: #fff;
    font-size: 14px;
}

#fullscreen {
    position: fixed;
    right: 16px;
    bottom: 16px;
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 32px;
    background: rgba(12, 12, 15, 0.6);
    color: #fff;
    cursor: pointer;
}

#fullscreen:hover {
    border-color: var(--accent);
}
