/* ---- Mobile / touch ----
   Suppress browser gesture handling so touches belong to the game:
   no pan/pinch/double-tap zoom, no pull-to-refresh, no long-press selection.
   Text inputs opt back in below. */
html,
body {
    touch-action: none;
    overscroll-behavior: none;
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
}

input,
textarea {
    -webkit-user-select: text;
    user-select: text;
    touch-action: manipulation;
}

/* Rotate hint — only shown on portrait touch devices in-game */
#rotateHint {
    display: none;
}

@media (orientation: portrait) and (pointer: coarse) {
    #rotateHint {
        display: block;
        position: fixed;
        /* Android 16+ edge-to-edge: stay clear of the transparent status bar */
        top: calc(12px + env(safe-area-inset-top, 0px));
        left: 50%;
        transform: translateX(-50%);
        background: rgba(0, 0, 0, 0.8);
        color: #ffd82c;
        font-family: 'Press Start 2P', monospace;
        font-size: 9px;
        line-height: 1.7;
        padding: 10px 14px;
        border-radius: 6px;
        text-align: center;
        z-index: 50000;
        pointer-events: none;
    }
}

/* ---- Login Screen ---- */

/* Outer wrapper — centers everything vertically and horizontally */
#loginContainer {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    min-height: 100dvh; /* mobile: exclude browser chrome */
    /* Edge-to-edge devices (notch / punch-hole / Android 16 transparent bars):
       keep the centered login content out from under system UI */
    padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px)
             env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px);
    box-sizing: border-box;
}

/* Landscape phones: the full-size banner is taller than the viewport and the
   page can't scroll — go side-by-side (banner left, form right) so the login
   form is always reachable. */
@media (pointer: coarse) and (max-height: 520px) {
    #loginContainer {
        flex-direction: row;
        gap: 12px;
        padding: 8px;
        box-sizing: border-box;
    }

    #loginBannerArea {
        width: min(52vw, calc(85dvh * 800 / 350));
        flex-shrink: 0;
        border-radius: 8px;
    }

    #loginPanel {
        width: auto;
        min-width: 260px;
        max-width: 42vw;
        border-radius: 8px;
        padding: 14px 18px;
    }

    /* Devnote is a third flex child in row mode — pin it to the bottom instead */
    .devNoteEl {
        position: fixed !important;
        bottom: 0;
        left: 50%;
        transform: translateX(-50%);
        width: 100vw;
        padding: 4px 8px !important;
        margin: 0 !important;
    }
}

/* Banner area: 800x350 desktop, shrinks proportionally on narrow screens */
#loginBannerArea {
    position: relative;
    width: min(800px, 100vw);
    aspect-ratio: 800 / 350;
    overflow: hidden;
}

/* Both backdrop images — current sits at left:0, next starts off-screen right */
#backdropImg,
#backdropImgNext {
    position: absolute;
    top: 0;
    width: 100%;
    height: 100%;
    display: block;
    transition: left 0.7s ease-in-out;
}

#backdropImg    { left: 0; }
#backdropImgNext { left: 100%; }

/* 30% black overlay between backdrop and banner */
#loginBannerOverlay {
    position: absolute;
    top: 0; left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.673);
    pointer-events: none;
}

/* Banner PNG sits on top of the backdrop, same size */
#bannerImg {
    position: absolute;
    top: 0; left: 0;
    width: 100%;
    height: 100%;
    display: block;
    pointer-events: none;
}

/* Dark translucent form panel */
#loginPanel {
    width: min(800px, 100vw);
    box-sizing: border-box;
    background: rgba(0, 0, 0, 0.65);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 0 0 8px 8px;
    padding: 24px 40px;
    text-align: center;
    color: #e0e0e0;
    font-family: 'Bebas Neue', sans-serif;
    font-size: 18px;
    letter-spacing: 1px;
}

.loginUI input {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    color: #fff;
    padding: 6px 10px;
    max-width: 160px;
    width: 100%;
    font-family: inherit;
    font-size: 16px;
    margin: 4px 0 12px 0;
    box-sizing: border-box;
}

#loginButton button {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 4px;
    color: #fff;
    font-family: 'Bebas Neue', sans-serif;
    font-size: 20px;
    letter-spacing: 2px;
    padding: 8px 30px;
    cursor: pointer;
    margin-top: 4px;
    transition: background 0.2s;
}
#loginButton button:hover {
    background: rgba(255, 255, 255, 0.28);
}

.gameserverWait {
    background-color: rgba(255, 216, 44, 0.85);
    display: inline-flex;
    align-items: center;
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 14px;
    color: #111;
}

.gameserverFail {
    background-color: rgba(255, 74, 74, 0.85);
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 14px;
    color: #fff;
}

.gameserverSuccess {
    background-color: rgba(110, 255, 74, 0.85);
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 14px;
    color: #111;
    display: inline-flex;
    align-items: center;
}

#serverConnectStatus {
    font-family: 'Bebas Neue', sans-serif;
    margin-top: 12px;
    text-align: center;
}

body {
    background-image: url('./websiteassets/tilewp.png');
    background-repeat: repeat;
    background-size: auto;
    background-position: top left;
}


#inGameRoot {
    background-color: rgb(16, 1, 1);
    color: brown;
    font-size: xx-large;
    font-family: 'Franklin Gothic Medium', 'Arial Narrow', Arial, sans-serif;
}


/* HTML: <div class="tinyloader"></div> */
.tinyloader {
    width: 10px;
    aspect-ratio: 1;
    outline: 2px solid #fff;
    background:
        radial-gradient(farthest-side, #33ff00 90%, #ff000000) 0 0/2px 2px no-repeat,
        conic-gradient(from 90deg at 2.5px 2.5px, #ff000000 90deg, #fff 0),
        conic-gradient(from -90deg at 7.5px 7.5px, #ffae0000 90deg, #fff 0);
    animation: l1 1.5s infinite;
    margin-left: 6px;
}

@keyframes l1 {
    0% {
        background-position: 0 0
    }

    25% {
        background-position: 100% 0
    }

    50% {
        background-position: 100% 100%
    }

    75% {
        background-position: 0 100%
    }

    100% {
        background-position: 0 0
    }
}

html,
body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    background: black;
    overflow: hidden;
}

#inGameRoot {
    position: relative;
    width: 100vw;
    width: 100dvw;
    height: 100vh;
    height: 100dvh; /* mobile: track collapsing browser chrome */
    background-color: black;
    overflow: hidden;
}

#canvasContainer {
    width: 1920px;
    height: 1080px;
    position: absolute;
    top: 0;
    left: 0;
    transform-origin: top left;
    background-color: black;
    /* to clearly show letterboxing */
}

#gameCanvas {
    width: 100%;
    height: 100%;
    background-color: rgb(180, 180, 156);
    display: block;
    touch-action: none;
}

.gameoverlayimg {
    position: absolute;
    margin-left: -2px;
    touch-action: none;
    pointer-events: none;
}

/* Chat input styling - positioning is handled dynamically in startup.js resize() */
#chatInput {
    position: absolute;
    background-color: #b8a895;
    border: 2px solid #4a4a4a;
    border-radius: 4px;
    color: #1a1a1a;
    font-family: 'Press Start 2P', monospace;
    outline: none;
    z-index: 10000;
    pointer-events: auto;
}

#chatInput::placeholder {
    color: #4a4a4a;
    opacity: 0.7;
}

#chatInput:focus {
    border-color: #8b7a68;
    background-color: #c4b5a3;
}