html {
    margin: 0;
    padding: 0;
    height: 100%;
}

body {
    padding: 0;
    margin: 0;
    height: 100%;
    font-family: Arial, sans-serif;
    background-color: black;
    background-image: url('LoadingBG.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;
    color: white;
    -webkit-text-size-adjust: 100%;
}

.page-wrapper {
    min-height: 101vh;
}

/* iOS in-browser: scroll-friendly layout for Safari minimal-UI on load */
html.zg-ios-browser {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    height: auto;
}

html.zg-ios-browser body {
    height: auto;
    min-height: calc(100vh + 8px);
    min-height: calc(100dvh + 8px);
    background-attachment: scroll;
}

html.zg-ios-browser .page-wrapper {
    min-height: calc(100vh + 8px);
    min-height: calc(100dvh + 8px);
}

html.zg-ios-browser #unity-container.unity-mobile {
    position: sticky;
    top: 0;
    height: 100vh;
    height: 100dvh;
    min-height: -webkit-fill-available;
}

.zg-ios-scroll-spacer {
    height: 8px;
    width: 100%;
    flex-shrink: 0;
    pointer-events: none;
}

/* Safari iOS + home-screen app: hide button (real fullscreen interferes with minimal UI) */
html.zg-ios-safari #unity-fullscreen-button,
html.zg-ios-standalone #unity-fullscreen-button {
    display: none !important;
    pointer-events: none !important;
}

/* Firefox / Chrome / Edge on iOS: fake button scrolls 1px to collapse browser toolbars */
html.zg-ios-scroll-btn #unity-fullscreen-button {
    display: block !important;
    pointer-events: auto !important;
}

html.zg-fullscreen,
body.zg-fullscreen {
    overflow: hidden;
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    height: 100dvh;
    min-height: -webkit-fill-available;
    background-attachment: scroll;
}

.zg-fullscreen #unity-container {
    position: fixed !important;
    left: 0 !important;
    top: 0 !important;
    transform: none !important;
    width: 100% !important;
    height: 100% !important;
    height: 100dvh !important;
    min-height: -webkit-fill-available !important;
    max-width: none !important;
}

.zg-fullscreen #unity-canvas-wrap,
.zg-fullscreen #unity-canvas {
    width: 100% !important;
    height: 100% !important;
    height: 100dvh !important;
    min-height: -webkit-fill-available !important;
}

#unity-container {
    position: absolute
}

#unity-container.unity-desktop {
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%)
}

#unity-container.unity-mobile {
    position: fixed;
    width: 100%;
    height: 100%
}

#unity-canvas-wrap {
    position: relative;
    display: inline-block;
    line-height: 0
}

#unity-canvas {
    display: block;
    background: #231F20
}

.unity-mobile #unity-canvas-wrap {
    width: 100%;
    height: 100%
}

.unity-mobile #unity-canvas {
    width: 100%;
    height: 100%
}

#unity-loading-bar {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    display: none
}

#unity-logo {
    width: 154px;
    height: 130px;
    background: url('unity-logo-dark.png') no-repeat center
}

#unity-progress-bar-empty {
    width: 141px;
    height: 18px;
    margin-top: 10px;
    margin-left: 6.5px;
    background: url('progress-bar-empty-dark.png') no-repeat center
}

#unity-progress-bar-full {
    width: 0%;
    height: 18px;
    margin-top: 10px;
    background: url('progress-bar-full-dark.png') no-repeat center
}

#unity-fullscreen-button {
    cursor: pointer;
    position: absolute;
    right: max(10px, env(safe-area-inset-right, 0px));
    bottom: max(10px, env(safe-area-inset-bottom, 0px));
    width: 38px;
    height: 38px;
    z-index: 20;
    background: url('fullscreen-button.png') no-repeat center;
    background-size: contain;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.unity-mobile #unity-fullscreen-button {
    width: 44px;
    height: 44px;
    display: block;
}

#unity-fullscreen-button.zg-fullscreen-active {
    opacity: 0.85;
    filter: brightness(1.15);
}

#unity-warning {
    position: absolute;
    left: 50%;
    top: 5%;
    transform: translate(-50%);
    background: white;
    padding: 10px;
    display: none
}

/* Portrait block overlay for mobile browsers */
#zg-rotate-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 20000;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    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(6, 10, 20, 0.96);
    color: #e8f0ff;
    text-align: center;
    pointer-events: auto;
}

#zg-rotate-overlay .zg-rotate-icon {
    width: 56px;
    height: 96px;
    border: 3px solid rgba(120, 180, 255, 0.85);
    border-radius: 12px;
    margin-bottom: 8px;
    animation: zg-rotate-hint 2s ease-in-out infinite;
}

#zg-rotate-overlay .zg-rotate-title {
    margin: 0;
    font-size: 22px;
    font-weight: 700;
    letter-spacing: 0.02em;
}

#zg-rotate-overlay .zg-rotate-sub {
    margin: 0;
    max-width: 280px;
    font-size: 15px;
    line-height: 1.4;
    color: rgba(200, 220, 255, 0.88);
}

@keyframes zg-rotate-hint {
    0%, 100% { transform: rotate(0deg); }
    50% { transform: rotate(90deg); }
}

html.zg-portrait-blocked .page-wrapper {
    visibility: hidden;
}

/* In-app browser / low-memory guidance overlay */
html.zg-browser-compat-blocking .page-wrapper,
html.zg-browser-compat-blocking #zg-rotate-overlay {
    visibility: hidden;
}

#zg-browser-compat-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 30000;
    align-items: center;
    justify-content: center;
    padding: max(20px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) max(20px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
    background: rgba(4, 8, 18, 0.97);
    color: #e8f0ff;
}

.zg-browser-compat-card {
    width: min(420px, 100%);
    padding: 28px 24px;
    border: 1px solid rgba(120, 180, 255, 0.35);
    border-radius: 16px;
    background: rgba(10, 18, 36, 0.92);
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.45);
    text-align: center;
}

.zg-browser-compat-kicker {
    margin: 0 0 8px;
    font-size: 12px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(120, 180, 255, 0.85);
}

.zg-browser-compat-title {
    margin: 0 0 12px;
    font-size: 24px;
    line-height: 1.2;
}

.zg-browser-compat-body,
.zg-browser-compat-hint {
    margin: 0 0 16px;
    font-size: 15px;
    line-height: 1.45;
    color: rgba(210, 225, 255, 0.9);
}

.zg-browser-compat-hint {
    font-size: 13px;
    color: rgba(180, 200, 235, 0.82);
}

.zg-browser-compat-primary,
.zg-browser-compat-secondary {
    display: block;
    width: 100%;
    margin: 0 0 12px;
    padding: 14px 16px;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.zg-browser-compat-primary {
    border: none;
    background: linear-gradient(180deg, #4ea8ff 0%, #2b7fd4 100%);
    color: #04101f;
}

.zg-browser-compat-secondary {
    border: 1px solid rgba(140, 170, 220, 0.35);
    background: transparent;
    color: rgba(210, 225, 255, 0.88);
    margin-bottom: 0;
    font-size: 14px;
    font-weight: 600;
}
