/* First load (18 November): the game's watermelon record (assets/loading-record.png, 256 px of hud/source-record-matte.png) spinning.
   A file of its own, linked from index.html so it shows before the game's CSS. Not inline: the Tauri build hashes inline styles into
   its CSP, and a hash there switches off 'unsafe-inline' for every style the game adds itself (the intro's captions vanished). */
html,body{margin:0;height:100%;background:#173d49}
#loading{position:fixed;inset:0;z-index:50;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:26px;overflow:hidden;background:#0b79ab;color:#fff1d1;font:14px/2 monospace;text-align:center;padding:30px;transition:opacity .8s ease}
#loading.done{opacity:0;pointer-events:none}
#loading > p{position:absolute;top:calc(50% + min(116px,30dvh));left:12px;right:12px;margin:0;letter-spacing:.06em}
.loading-deck{position:absolute;top:50%;left:50%;width:min(192px,54dvh);aspect-ratio:1;translate:-50% -50%;filter:drop-shadow(0 6px 0 #0f2c35)}
.loading-record{display:block;width:100%;height:100%;image-rendering:pixelated;translate:-.2% 1.56%;transform-origin:50.2% 48.44%;animation:loading-spin 1.8s linear infinite}
.loading-deck::after{
 content:'';position:absolute;inset:5.5%;border-radius:50%;pointer-events:none;overflow:hidden;
 background:linear-gradient(136deg,transparent 20%,#fff4ce00 40%,#fff4ce85 48%,#fffbeccc 49%,#fff4ce00 58%,transparent 75%);
 background-size:230% 230%;animation:record-glint 2.8s ease-in-out infinite;mix-blend-mode:screen
}
@keyframes loading-spin{to{transform:rotate(360deg)}}
@keyframes record-glint{0%,14%{background-position:100% 30%;opacity:0}30%{opacity:.8}56%,100%{background-position:0 70%;opacity:0}}
@media(prefers-reduced-motion:reduce){.loading-record,.loading-deck::after{animation:none}.loading-deck::after{opacity:.3}}
/* The start screen (23 November, ui/start-screen.ts): the record goes, the real sea shows through, and a quiet prompt waits. */
#loading{transition:opacity .8s ease,background-color 1.1s ease}
#loading.ready{background-color:transparent;cursor:pointer}
#loading .loading-deck{transition:opacity .5s ease,scale .5s ease}
#loading.ready .loading-deck{opacity:0;scale:.6}
#loading.ready > p{top:auto;bottom:max(14dvh,48px);font-size:16px;letter-spacing:.18em;text-shadow:0 2px 0 #0f2c35,0 0 14px #0f2c35aa;animation:start-pulse 2.4s ease-in-out infinite}
@keyframes start-pulse{0%,100%{opacity:.55}50%{opacity:1}}
@media(prefers-reduced-motion:reduce){#loading.ready > p{animation:none}}
/* 23 November, author: «начинается же с моря … прям с моря показать, что оно грузится». The painted sea while the game
   loads: two layers of streaks (SVG noise, tiled) drift against each other by transform only, so they keep moving on the
   compositor while the page is busy loading. The game's own sea replaces them under the start screen. */
#loading::before,#loading::after{content:'';position:absolute;top:-360px;left:-800px;right:-800px;bottom:-360px;pointer-events:none;transition:opacity 1.1s ease;will-change:transform}
#loading::before{background:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='800' height='420'%3E%3Cfilter id='f' x='0' y='0' width='1' height='1'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.0025 .028571' numOctaves='2' seed='11' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 .2 0 0 0 0 .36 -2.6 0 0 0 1.25'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23f)'/%3E%3C/svg%3E") 0 0/800px 420px;opacity:.32;animation:sea-dark 70s linear infinite}
#loading::after{background:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='640' height='360'%3E%3Cfilter id='f' x='0' y='0' width='1' height='1'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.003125 .044444' numOctaves='3' seed='4' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 .98 0 0 0 0 .9 3.4 0 0 0 -1.95'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23f)'/%3E%3C/svg%3E") 0 0/640px 360px;opacity:.6;animation:sea-light 38s linear infinite}
#loading.ready::before,#loading.ready::after{opacity:0}
@keyframes sea-dark{from{transform:translate(0,0)}to{transform:translate(-800px,0)}}
@keyframes sea-light{from{transform:translate(0,0)}to{transform:translate(640px,360px)}}
@media(prefers-reduced-motion:reduce){#loading::before,#loading::after{animation:none}}
#loading>*{z-index:1}
/* Clouds (23 November, author: «при начале заставки сделать облака, а потом камера вниз и главное меню»). While the game
   loads they cover the sea; on the start screen they open a little over the real sea; at the first key the camera falls through them while
   the camera comes down. Pictures from tools/art/scripts/paint-loading-clouds.py. Positions are shares of the screen; each
   moves by `translate` and drifts by `transform`, both on the compositor. */
.loading-clouds{position:absolute;inset:0;pointer-events:none}
.loading-clouds .cloud{position:absolute;left:var(--x);top:var(--y);width:var(--w);aspect-ratio:900/640;background:url(/assets/loading-cloud-1.webp) center/100% 100% no-repeat;
 transition:translate 1.6s cubic-bezier(.45,0,.2,1),scale 1.6s cubic-bezier(.45,0,.2,1),opacity 1.3s ease;animation:cloud-drift var(--t,26s) ease-in-out infinite alternate;will-change:transform,translate}
.loading-clouds .c2,.loading-clouds .c5{background-image:url(/assets/loading-cloud-2.webp)}
.loading-clouds .c3,.loading-clouds .c6{background-image:url(/assets/loading-cloud-3.webp)}
.loading-clouds .c1{--x:-22%;--y:-26%;--w:62%;--rx:-10%;--ry:-6%;--fx:-70%;--fy:-55%;--t:24s}
.loading-clouds .c2{--x:38%;--y:-30%;--w:66%;--rx:9%;--ry:-10%;--fx:65%;--fy:-60%;--t:31s}
.loading-clouds .c3{--x:-30%;--y:28%;--w:58%;--rx:-14%;--ry:0%;--fx:-80%;--fy:8%;--t:27s}
.loading-clouds .c4{--x:70%;--y:18%;--w:56%;--rx:10%;--ry:0%;--fx:75%;--fy:4%;--t:22s}
.loading-clouds .c5{--x:-6%;--y:62%;--w:64%;--rx:-8%;--ry:12%;--fx:-40%;--fy:70%;--t:29s}
.loading-clouds .c6{--x:46%;--y:60%;--w:60%;--rx:8%;--ry:14%;--fx:40%;--fy:70%;--t:25s}
.loading-clouds .c7{--x:20%;--y:8%;--w:52%;--rx:0%;--ry:-38%;--fx:0%;--fy:-95%;--t:33s}
@keyframes cloud-drift{from{transform:translate(-2.5%,-1%)}to{transform:translate(2.5%,1%)}}
/* The start screen: the clouds open a little and thin out, the sea shows through the gap, and they keep drifting. */
#loading.ready .cloud{translate:var(--rx) var(--ry);opacity:.88}
/* The first key: the camera falls through the clouds. Each grows and leaves the screen outwards, faster and faster,
   for 2.2 s, about as long as the camera's descent (World.reveal, 2.4 s). The prompt goes at once. */
#loading.done .cloud{translate:var(--fx) var(--fy);scale:2.6;opacity:0;
 transition:translate 2.2s cubic-bezier(.55,0,.75,.4),scale 2.2s cubic-bezier(.55,0,.75,.4),opacity 1.2s ease 1s}
#loading.done{transition:opacity .4s ease 1.9s}
#loading.done > p{opacity:0;transition:opacity .3s ease;animation:none}
@media(prefers-reduced-motion:reduce){.loading-clouds .cloud{animation:none;transition:opacity .8s ease}#loading.ready .cloud,#loading.done .cloud{translate:none;scale:none;opacity:0}}
/* The game's logo on the start screen (23 November, author: «коли натисніть будь-яку клавішу, можна вставити логотип
   гри»): the menu's own picture, so it is already loaded when the menu shows it again. It rises in with the prompt and
   goes up into the clouds at the first key. Centred (23 November, author: «лого по центру на першому екрані»). */
.loading-logo{position:absolute;left:50%;top:50%;width:min(720px,86vw,145dvh);height:auto;translate:-50% -50%;opacity:0;scale:.9;
 filter:drop-shadow(0 5px 0 #0f2c3573) drop-shadow(0 6px 18px #0f2c3559);pointer-events:none;
 transition:opacity .7s ease .25s,scale .9s cubic-bezier(.2,.8,.3,1.15) .25s,translate .9s ease}
#loading.ready .loading-logo{opacity:1;scale:1}
#loading.done .loading-logo{opacity:0;scale:1.08;translate:-50% -80%;transition:opacity .45s ease,scale .6s ease,translate .6s ease-in}
@media(prefers-reduced-motion:reduce){.loading-logo{transition:opacity .4s ease}#loading.ready .loading-logo{scale:1}#loading.done .loading-logo{scale:1;translate:-50% -50%}}
