html {
    box-sizing: border-box;
}

*, *:before, *:after { box-sizing: inherit; }
html, body { height: 100%; touch-action: none; background: #21163d; }
canvas { display: block; }
body {
    margin: 0;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    isolation: isolate;
}

/* Desktop keeps the portrait game readable and uses its loading art as a soft side fill. */
body::before {
    content: "";
    position: fixed;
    inset: -40px;
    z-index: 0;
    background: #21163d url('TemplateData/background.jpg') center / cover no-repeat;
    filter: blur(26px) brightness(0.42) saturate(0.82);
    transform: scale(1.08);
}

#unity-container {
    width: min(100vw, calc(100vh * 9 / 16));
    height: min(100vh, calc(100vw * 16 / 9));
    position: relative;
    z-index: 1;
    flex: 0 0 auto;
    box-shadow: 0 0 48px rgba(10, 7, 29, 0.65);
}
#unity-canvas {
    width: 100%; height: 100%;
    background: #FFFFFF;
    touch-action: none;
}

#loading-cover {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    isolation: isolate;
    z-index: 2;
    background: #21163d url('TemplateData/background.jpg') center / cover no-repeat;
    --loading-art: url('TemplateData/background.jpg');
}

#loading-cover::before {
    content: "";
    position: absolute;
    inset: -32px;
    z-index: -2;
    background-image: var(--loading-art);
    background-position: center;
    background-size: cover;
    filter: blur(22px) brightness(0.42) saturate(0.85);
    transform: scale(1.08);
}

#loading-cover::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background: rgba(26, 15, 62, 0.3);
}

#loading-stage {
    position: relative;
    width: min(100vw, calc(100vh * 9 / 16));
    height: min(100vh, calc(100vw * 16 / 9));
    aspect-ratio: 9 / 16;
    overflow: hidden;
    background-image: var(--loading-art);
    background-position: center;
    background-size: cover;
    box-shadow: 0 0 48px rgba(10, 7, 29, 0.55);
}

#loading-stage::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(180deg, rgba(31, 19, 68, 0.08) 0%, rgba(31, 19, 68, 0.02) 48%, rgba(20, 13, 48, 0.58) 100%);
}

#unity-loading-bar {
    position: absolute;
    z-index: 3;
    left: 8%; right: 8%; bottom: 5%;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px;
    border: 3px solid #ffd45c;
    border-radius: 18px;
    background: rgba(29, 24, 69, 0.86);
    box-shadow: 0 8px 24px rgba(8, 6, 24, 0.4);
}

#unity-logo { display: none; }
#unity-progress-bar-empty {
    width: 100%; height: 16px; margin: 0;
    overflow: hidden; padding: 2px; border: 0;
    border-radius: 999px; background: #e6e4ff;
}
#unity-progress-bar-full {
    width: 0%; height: 100%; border-radius: 999px;
    background: linear-gradient(90deg, #77da43, #ffd13e);
    transition: width 0.35s ease;
}
#loading-label {
    margin-top: 7px;
    color: #ffffff;
    font: 900 clamp(12px, 1.8vh, 18px)/1 Arial, sans-serif;
    letter-spacing: 0.08em;
    text-shadow: 0 2px 5px rgba(7, 5, 22, 0.9);
}

.spinner, .spinner:after { border-radius: 50%; width: 36px; height: 36px; }
.spinner {
    margin: 0 0 6px;
    font-size: 10px;
    position: relative;
    text-indent: -9999em;
    border: 7px solid rgba(238, 238, 255, 0.3);
    border-left-color: #ffd13e;
    transform: translateZ(0);
    animation: spinner-spin 1.1s infinite linear;
}
@keyframes spinner-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
@media (max-aspect-ratio: 9/16) {
    #unity-container { width: 100vw; height: 100vh; }
    #loading-stage { width: 100vw; height: 100vh; aspect-ratio: auto; }
}



body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  margin: 0;
  overflow: hidden;
}

#unity-container {
  position: fixed;
  display: flex;
  aspect-ratio: 9/16;
  width: min(calc(100vh*(9/16)), 100vw);
  height: auto;
}

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


#unity-canvas {
    background: linear-gradient(140deg, rgba(255, 211, 37, 1) 0%, rgba(91, 22, 255, 1) 100%);
}



.spinner {
    border-top: 1.1em solid rgba(255, 211, 37, 0.2);
    border-right: 1.1em solid rgba(255, 211, 37, 0.2);
    border-bottom: 1.1em solid rgba(255, 211, 37, 0.2);
    border-left: 1.1em solid rgba(63, 162, 255, 1);
}

#unity-progress-bar-empty {
    border-color: rgba(255, 211, 37, 0.7);
    width: 30%;
}

#unity-progress-bar-full {
    background: rgba(63, 162, 255, 1);
}

.light #unity-progress-bar-empty {
    border-color: rgba(255, 211, 37, 0.7);
}

.light #unity-progress-bar-full {
    background: rgba(63, 162, 255, 1);
}



#unity-progress-bar-empty {
    height: 24px;
}


#unity-progress-bar-empty {
    border-radius: 12px;
}

#unity-progress-bar-full {
    border-radius: 10px;
    transition: width 0.5s ease;
}
