/* The r2project.ru page (docs/MINI-ONLINE.md §8; the VK page of the main game, P6-02): the game's own palette (UI/Styles/Theme.uss) - the void behind everything, parchment type, a bronze
   trough with a gold bar - so the page's indicator and the game's curtain read as one screen. System fonts only: a web font
   would cost the first load more than the whole page. */

html,
body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #0c0c0b;
}

/* A phone (docs/MINI.md, «Телефон и планшет»): the page is the game and nothing of the browser's own answers a finger on
   it - no pull to refresh and no rubber band at its edges, no zoom by two fingers or a double tap, no menu or selection
   on a long press, no text made larger by a phone held sideways. The body is nailed to the frame: a page that cannot
   scroll cannot be dragged off the canvas either. */
html,
body {
    overscroll-behavior: none;
    touch-action: none;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

body {
    position: fixed;
    left: 0;
    top: 0;
}

/* But the line Unity's web player puts at the bottom of the page for a phone's keyboard (the character's name): what is
   typed into it is selected and edited as in any field - Safari types nothing into a field that may not be selected. */
input,
textarea {
    -webkit-user-select: text;
    user-select: text;
    touch-action: manipulation;
}

/* R2's own arrow (normal.cur, a copy of Art/Cursors/R2_Normal.png) from the first frame of the page: the game puts the same
   one on the canvas once it runs (CursorLibrary), so the pointer does not change look between the page and the game. */
html,
body,
#unity-canvas {
    cursor: url("cursor.png") 0 0, auto;
}

/* The whole frame, and every touch the game's: no browser scroll, zoom or tap flash over it. */
#unity-canvas {
    position: fixed;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    display: block;
    background: #0c0c0b;
    outline: none;
    touch-action: none;
    -webkit-tap-highlight-color: transparent;
    -webkit-user-select: none;
    user-select: none;
}

#loading {
    position: fixed;
    left: 50%;
    top: 50%;
    width: 70%;
    max-width: 420px;
    transform: translate(-50%, -50%);
    text-align: center;
    font: 600 14px/1.4 Georgia, "Times New Roman", serif;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: #d4c6a8;
    pointer-events: none;
}

#loading-caption {
    margin-bottom: 14px;
}

#loading-track {
    height: 10px;
    padding: 2px;
    border: 1px solid #7a7460;
    background: #060605;
}

#loading-fill {
    width: 0;
    height: 100%;
    background: linear-gradient(#ffe496, #966c24);
    transition: width 0.2s;
}

#loading.failed #loading-caption {
    color: #e0a080;
    letter-spacing: 0.1em;
}

#loading.failed #loading-track {
    display: none;
}

/* A start that failed (index.html, fail()): what the page does next - «Повтор через 5 с» - and the player's own button.
   Under a finger: the button is 44 px high, the note's type is not below 12 px (docs/MINI.md, «Телефон и планшет»). */
#loading-note,
#loading-retry {
    display: none;
}

#loading.failed #loading-note {
    display: block;
    min-height: 1.4em;
    font-size: 12px;
    letter-spacing: 0.08em;
    text-transform: none;
    color: #a89c80;
}

#loading.failed #loading-retry {
    display: inline-block;
    margin-top: 16px;
    min-width: 200px;
    min-height: 44px;
    padding: 0 24px;
    font: inherit;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: #f0e2c0;
    background: linear-gradient(#7c3a24, #4a2114);
    border: 1px solid #b08a4a;
    border-radius: 0;
    cursor: inherit;
    pointer-events: auto;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

#loading.failed #loading-retry:disabled {
    opacity: 0.5;
}

/* A browser the game cannot run in: nothing to retry. */
#loading.unsupported #loading-retry {
    display: none;
}

/* The studio's splash (index.html): over everything from the page's first frame, on the dark of the store art's Trolll™
   corner (tools/trolll_mark.swift). The mark is a quarter of the height, the name under it - the proportions of the game's
   1920x1080 panel (300 and 56 px). The mark comes up once the platform's loader is off the frame (.shown), the whole
   splash goes after (.gone). The name in the system's sans: a web font would cost the first load. */
#splash {
    position: fixed;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #0b0e0c;
    transition: opacity 0.45s ease-in;
}

#splash.gone {
    opacity: 0;
    pointer-events: none;
}

#splash-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    opacity: 0;
    transition: opacity 0.5s ease-out;
}

#splash.shown #splash-brand {
    opacity: 1;
}

/* A quarter of the height on a screen wider than high; on a phone held upright the width is the short side, and the mark
   is cut to two fifths of it, its name with it. */
#splash-mark {
    height: min(26vh, 40vw);
    width: calc(min(26vh, 40vw) * 695 / 644);
}

#splash-word {
    margin-top: min(2.6vh, 4vw);
    font: 600 min(5.2vh, 8vw)/1 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    letter-spacing: 0.06em;
    color: rgb(214, 232, 211);
}
