/* Font import */
@font-face {
    font-display: swap;
    font-family: 'Inter';
    font-style: normal;
    font-weight: 400;
    src: url('inter.ttf') format('truetype');
}

/* Reset and base setup */
html, body {
    margin: 0 !important;
    padding: 0 !important;
    width: 100vw !important;
    height: 100dvh !important;
    overflow: hidden !important;
    background: linear-gradient(45deg, #3f1667 30%, #000 71%, #18264d 90%) !important;
}

/* Unity container base styling */
#unity-container {position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100dvh !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    overflow: hidden !important;
    transform: none !important;
    box-sizing: border-box !important;
    background: black;
}


#unity-canvas {width:100%! important;height:100% ! important; max-width: 100vw ! important;max-height: 100dvh ! important;object-fit: contain; ! important}

/* Fullscreen forcing for devices above 900px */
@media screen and (min-width: 901px) {
    #unity-canvas {
        width: 100vw !important;
        height: 100dvh !important;
    }
}

/* Mobile-specific styling (devices 900px and below) */
@media screen and (max-width: 900px) {
#unity-canvas {
    position: relative !important;
    width: 100vw !important;
    height: 100dvh !important;
    display: block !important;
    transform: none !important;
    margin: 0 !important;
    padding: 0 !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
}
}


/* Handle safe areas (notches, status bar, and browser UI) */
@supports (padding: env(safe-area-inset-top)) {
    .unity-mobile #unity-container {
        padding-top: env(safe-area-inset-top) !important;
        padding-bottom: env(safe-area-inset-bottom) !important;
        padding-left: env(safe-area-inset-left) !important;
        padding-right: env(safe-area-inset-right) !important;
        height: 100dvh !important;
        min-height: -webkit-fill-available !important;
    }
}

/* Loading bar styling */
#unity-loading-bar {
    position: absolute;
    left: 50%;
    top: 60%;
    transform: translate(-50%, -50%);
    display: none;
    text-align: center;
    width: 200px;
	background:rgba(0,0,0,0.2);
	padding:10px;
	border-radius:2px;
}

#unity-loading-bar h2, #unity-loading-bar h1 {
    text-shadow: -1px 1px black;
    font-weight: bold;
    font-size: 16pt;
    margin-bottom: 5px;
	margin-top:10px;
	color:#fff;
	font-family:inter;
	line-height:16pt;
}

#unity-loading-bar h1 {font-size:10pt;font-family:inter;text-transform:uppercase;color:#fff;text-shadow: -1px 1px black;margin:0;line-height:10pt;margin-bottom:2px;}
#unity-loading-bar h2 {margin-top:5px;}
.loadingheader::after {
      content: '...';
      display: inline-block;
      width: 1.5em;
      text-align: left;
      animation: dots 1.5s steps(4, end) infinite;
}
@keyframes dots {
      0%, 20% {
        content: '';
      }
      40% {
        content: '.';
      }
      60% {
        content: '..';
      }
      80%, 100% {
        content: '...';
      }
}

/* Logo styling */
#unity-logo {
    width: 300px;
    height: 200px;
    background: url('meme-fighter-match-logo.png') no-repeat center;
    background-size: contain;
    margin-bottom: 30px;
}

/* Progress bar empty state */
#unity-progress-bar-empty {
    overflow: hidden;
    height: 40px;
    position: relative;
    max-width: 180px;
    margin: 0 auto;
}

#unity-progress-bar-empty::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border: 3px solid white;
    background: linear-gradient(to right, #00036a, #660087, #50036d) border-box;
    -webkit-mask: 
        linear-gradient(#fff 0 0) padding-box, 
        linear-gradient(#fff 0 0);
    -webkit-mask-composite: exclude;
    mask-composite: exclude;
}

/* Progress bar full state */
#unity-progress-bar-full {
    width: 8%;
    height: 100%;
    border-radius: 0;
    background: linear-gradient(to right, #00036a, #660087, #50036d);
}

/* Footer styling */
#unity-footer {
    position: relative;
}

.unity-mobile #unity-footer {
    display: none; /* Hide footer on mobile */
}

/* Build title */
#unity-build-title {
    float: right;
    margin-right: 10px;
    line-height: 38px;
    font-family: arial;
    font-size: 18px;
}

/* Fullscreen button */
#unity-fullscreen-button {
    cursor: pointer;
    float: right;
    width: 38px;
    height: 38px;
    background: url('fullscreen-button.png') no-repeat center;
}

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

/* Meme Fighter AI logo */
.mfm-logo {
    width: 120px;
    height: 89px;
    background: url('meme-fighter-ai-logo.png') no-repeat center;
    background-size: contain;
    position: absolute;
    top: 20px;
    right: 20px;
}

/* Mobile responsive adjustments */
@media screen and (max-width: 500px) {
    #unity-logo {
        width: 200px;
        height: 200px; /* Match width to maintain aspect ratio */
    }
    .mfm-logo {
        width: 80px;
        height: 60px;
    }
    #unity-progress-bar-empty {
        width: 180px;
        height: 40px;
    }
    .ape-play-button {
        padding: 12px 50px;
    }
}

body.has-error .error-overlay {
    display: flex !important;
}

.error-overlay {
    font-family: Inter, sans-serif;
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100dvh;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    color: white;
    background-color: black;
    text-align: center;
}

.error-overlay #unity-logo {
    filter: grayscale(1);
}

.error-overlay .error-title {
    margin: 0 auto;
}

.error-overlay .error-message {
    margin-bottom: 0;
    color: #a3a3a3;
    font-weight: 500;
    padding-right: 5vw;
    padding-left: 5vw;
    margin-top: 0.5rem;
}

#unity-preloader-background {
    z-index: 0;
    position: absolute;
    width: 100%;
    text-align: center;
    height: 100dvh;
    background: url(https://www.memefighter.ai/games/mfm-smofo/assets-2/meme-fighter-match-preloader-screen.jpg) no-repeat top;
    background-size: contain;
}

@media screen and (max-width: 400px) {
#unity-preloader-background {
    background: url(https://www.memefighter.ai/games/mfm-smofo/assets-2/meme-fighter-match-preloader-screen.jpg) no-repeat top;
    background-size: cover;
}
}


h2.loadingheader img {
    height: 25px;
    display: inline-block;
}

h2.loadingheader {
    text-align: center;
}

/* PWA prompt */
#pwa-prompt {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: #fff;
    padding: 10px 20px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.5);
    z-index: 12;
    display: none;
    text-align: center;
    font-family: Arial, sans-serif;
}

#pwa-prompt button {
    margin-top: 10px;
    padding: 8px 16px;
    background: #007bff;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

#pwa-prompt button:hover {
    background: #0056b3;
}
