/* PITHU — Seven Stones · page shell + the 5-second loading page. The game itself is one canvas. */
@font-face {
    font-family: "Lilita One";
    src: url("../assets/fonts/LilitaOne-Regular.ttf") format("truetype");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}
:root {
    --sat: env(safe-area-inset-top, 0px);
    --sab: env(safe-area-inset-bottom, 0px);
    --sal: env(safe-area-inset-left, 0px);
    --sar: env(safe-area-inset-right, 0px);
}
* {
    box-sizing: border-box;
}
html,
body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #38b8d8;
    font-family:
        "Trebuchet MS",
        "Segoe UI",
        system-ui,
        -apple-system,
        Roboto,
        Helvetica,
        Arial,
        sans-serif;
    -webkit-tap-highlight-color: transparent;
    overscroll-behavior: none;
}
body {
    position: fixed;
    inset: 0;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
}
canvas#game {
    position: absolute;
    inset: 0;
    display: block;
    touch-action: none;
}

/* ---------- loading page: the street picture, the logo, seven stones stacking, a bouncing ball ---------- */
#loading {
    position: absolute;
    inset: 0;
    z-index: 10;
    overflow: hidden;
    color: #fff;
    background: #38b8d8 url("../assets/img/bg_gali.jpg") center 70% / cover no-repeat;
    transition: opacity 0.35s ease;
}
#loading::before {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at 50% 40%, rgba(0, 0, 0, 0) 30%, rgba(20, 10, 30, 0.45) 100%);
}
#loading.out {
    opacity: 0;
    pointer-events: none;
}
#loading .box {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -52%);
    width: min(460px, 92vw);
    text-align: center;
}
#loading .logo {
    display: block;
    width: min(380px, 80vw);
    margin: 0 auto;
    filter: drop-shadow(0 10px 14px rgba(0, 0, 0, 0.35));
    animation: bob 2.4s ease-in-out infinite;
}
#loading .scene {
    position: relative;
    height: 96px;
    width: 300px;
    margin: 10px auto 0;
}
#loading .pile {
    position: absolute;
    left: 50%;
    bottom: 8px;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column-reverse;
    align-items: center;
}
#loading .pile i {
    display: block;
    height: 11px;
    border-radius: 4px;
    background: linear-gradient(#c2c9d0, #8a939c 50%, #55606b);
    border: 1px solid rgba(0, 0, 0, 0.4);
    box-shadow:
        0 2px 2px rgba(0, 0, 0, 0.25),
        inset 0 1px 0 rgba(255, 255, 255, 0.5);
    margin-top: 1px;
    opacity: 0;
    transform: translateY(-40px) scale(0.6);
}
#loading .pile i.on {
    opacity: 1;
    transform: none;
    transition:
        transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
        opacity 0.15s;
}
#loading .pile i:nth-child(1) {
    width: 78px;
}
#loading .pile i:nth-child(2) {
    width: 72px;
}
#loading .pile i:nth-child(3) {
    width: 66px;
}
#loading .pile i:nth-child(4) {
    width: 60px;
}
#loading .pile i:nth-child(5) {
    width: 54px;
}
#loading .pile i:nth-child(6) {
    width: 48px;
}
#loading .pile i:nth-child(7) {
    width: 42px;
}
#loading .ball {
    position: absolute;
    left: 10px;
    bottom: 8px;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 32%, #ffb3ad 0, #ff5a52 22%, #e8322f 60%, #9e1414 100%);
    box-shadow: 0 4px 5px rgba(0, 0, 0, 0.35);
}
#loading .ball::after {
    content: "";
    position: absolute;
    left: 5px;
    top: 4px;
    width: 9px;
    height: 5px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.85);
    transform: rotate(-30deg);
}
#loading .track {
    position: relative;
    height: 12px;
    margin: 12px 30px 0;
    background: rgba(0, 0, 0, 0.35);
    border-radius: 6px;
    overflow: hidden;
    box-shadow:
        inset 0 1px 2px rgba(0, 0, 0, 0.4),
        0 1px 0 rgba(255, 255, 255, 0.25);
}
#loading .track .line {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 0;
    background: linear-gradient(#ffd54a, #ffb830 55%, #e08a00);
    border-radius: 6px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
}
#loading .tip {
    margin: 14px 0 0;
    font-family: "Lilita One", "Trebuchet MS", sans-serif;
    font-size: 16px;
    letter-spacing: 0.5px;
    color: #fff;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.45);
    min-height: 20px;
}
#loading .ready {
    margin: 4px 0 0;
    font-size: 11px;
    letter-spacing: 4px;
    text-indent: 4px;
    color: #fff;
    font-weight: 800;
    opacity: 0.8;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}
@keyframes bob {
    0%,
    100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-6px);
    }
}

/* ---------- loading page: other screen sizes ---------- */
@media (max-height: 520px) {
    /* phones held sideways: tighter column, smaller logo */
    #loading .logo {
        width: min(230px, 40vw);
    }
    #loading .scene {
        height: 64px;
        margin-top: 4px;
    }
    #loading .pile i {
        height: 8px;
    }
    #loading .ball {
        width: 20px;
        height: 20px;
    }
    #loading .ball::after {
        left: 4px;
        top: 3px;
        width: 7px;
        height: 4px;
    }
    #loading .tip {
        margin-top: 8px;
        font-size: 13px;
    }
    #loading .ready {
        margin-top: 2px;
    }
}
@media (orientation: portrait) {
    #loading {
        background-image: url("../assets/img/bg_gali_p.jpg");
        background-position: center 62%;
    }
}
@media (max-width: 360px) {
    /* small phones */
    #loading .scene {
        width: 240px;
    }
    #loading .tip {
        font-size: 14px;
    }
}
@media (min-width: 1800px) and (min-height: 1000px) {
    /* large monitors / TV */
    #loading .box {
        width: min(760px, 92vw);
    }
    #loading .logo {
        width: min(600px, 60vw);
    }
    #loading .scene {
        height: 150px;
        width: 460px;
        margin-top: 20px;
    }
    #loading .pile i {
        height: 17px;
    }
    #loading .pile i:nth-child(1) {
        width: 120px;
    }
    #loading .pile i:nth-child(2) {
        width: 110px;
    }
    #loading .pile i:nth-child(3) {
        width: 100px;
    }
    #loading .pile i:nth-child(4) {
        width: 90px;
    }
    #loading .pile i:nth-child(5) {
        width: 80px;
    }
    #loading .pile i:nth-child(6) {
        width: 70px;
    }
    #loading .pile i:nth-child(7) {
        width: 60px;
    }
    #loading .ball {
        width: 40px;
        height: 40px;
    }
    #loading .ball::after {
        left: 8px;
        top: 6px;
        width: 14px;
        height: 8px;
    }
    #loading .track {
        height: 16px;
        margin-top: 20px;
    }
    #loading .tip {
        font-size: 24px;
        margin-top: 24px;
    }
    #loading .ready {
        font-size: 16px;
        letter-spacing: 6px;
    }
}
