/* Game fonts. Chinese UI text uses the device's native CJK font (PingFang SC /
 * Microsoft YaHei / Noto Sans CJK) via the font stack in Style.ts — we no longer
 * ship the 8MB NotoSansSC webfont. Only the small 'Anybody' face is bundled. */
html,
body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    color: rgba(255, 255, 255, 0.87);
    /* Black fallback behind the canvas (brief pre-boot flash; RESIZE fills the screen). */
    background-color: #000;
    -webkit-user-select: none;
    user-select: none;
}

#startup-page {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
}

#startup-logo {
    display: block;
    width: 58vw;
    height: 34vh;
    object-fit: contain;
    opacity: 0;
    transform: scale(1.1);
    animation:
        startup-logo-enter 600ms ease-out 80ms forwards,
        startup-logo-blink 1200ms ease-in-out 600ms infinite;
}

@keyframes startup-logo-enter {
    from {
        opacity: 0;
        transform: scale(1.1);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes startup-logo-blink {
    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.45;
    }
}

#startup-error {
    position: absolute;
    left: 24px;
    right: 24px;
    bottom: max(32px, env(safe-area-inset-bottom));
    min-height: 24px;
    color: #ffd6d6;
    font: 500 16px/1.5 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    text-align: center;
    opacity: 0;
    transition: opacity 160ms ease;
}

#startup-error:not(:empty) {
    opacity: 1;
}

body.startup-ready #startup-page {
    display: none;
}

#app {
    width: 100%;
    height: 100vh;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #000;
}

#game-container {
    width: 100vw;
    height: 100vh;
    overflow: hidden;
}

#rotate-device-notice {
    position: fixed;
    inset: 0;
    z-index: 10001;
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 24px;
    box-sizing: border-box;
    padding: max(24px, env(safe-area-inset-top)) max(24px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(24px, env(safe-area-inset-left));
    background: rgba(0, 0, 0, 0.5);
    color: #fff7dc;
    text-align: center;
    pointer-events: auto;
    touch-action: none;
    -webkit-user-select: none;
    user-select: none;
}

#rotate-device-notice.is-visible {
    display: flex;
}

body.orientation-ready #rotate-device-notice {
    display: none;
}

.rotate-phone {
    width: 56px;
    height: 96px;
    border: 4px solid #fff7dc;
    border-radius: 12px;
    box-sizing: border-box;
    animation: rotate-device-phone 1400ms ease-in-out infinite;
}

.rotate-message {
    max-width: min(78vw, 520px);
    font: 700 22px/1.4 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    overflow-wrap: anywhere;
}

@keyframes rotate-device-phone {
    0%,
    20% {
        transform: rotate(0deg);
    }

    60%,
    100% {
        transform: rotate(90deg);
    }
}

/* Native Capacitor WebView only (html.native is set in main.ts). Lock the
 * document so the WebView never rubber-band overscrolls. A plain mobile browser
 * is intentionally left scrollable: locking it (overflow/height/touch-action)
 * stops iOS Safari from auto-collapsing its toolbar to fullscreen on rotation. */
html.native,
html.native body {
    height: 100%;
    overflow: hidden;
    touch-action: none;
    overscroll-behavior: none;
}

html.native #app {
    height: 100%;
}

html.native #game-container {
    touch-action: none;
}
