:root {
    --pb-x: 0px;
    --pb-y: 0px;
    --pb-w: 0px;
    --pb-h: 0px;
}

body {
    margin: 0px;
    padding: 0px;
    width: 100%;
    height: 100%;
    background-color: #004c3d;
    font-family: "Myriad Pro", Myriad, "Helvetica Neue", Helvetica, Arial, sans-serif;
    overflow: hidden;
    overscroll-behavior: none;
}

#unity-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
}

#unity-canvas {
    width: 100%;
    height: 100%;
}

#unity-loading-bar {
    position: fixed;
    inset: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    background-image: url("load_screen_bg.jpg");
    background-size: cover;
    background-position: center;
    z-index: 100;
}

#splash {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

#progress-wrapper {
    position: relative;
    /* Адаптивная ширина */
    width: min(80vw, 55vh, 600px);
    display: flex;
    flex-direction: column; /* Включаем колонку, чтобы высота считалась с учетом Спайна */
    justify-content: center;
    align-items: center;
    z-index: 105;
    margin-top: -25vh; /* Поднимаем весь блок (Спайн + Полоска) выше центра экрана */
}

#spine-container {
    position: relative; /* Возвращаем в поток, чтобы родитель учитывал его высоту */
    width: 150%; 
    aspect-ratio: 1 / 1; 
    z-index: 1; /* Под полоской */
    pointer-events: none;
    margin-bottom: -5%; /* Анкорим низ холста к полоске загрузки (тянем полоску вверх) */
    flex-shrink: 0;
    min-height: 0;
    min-width: 0;
}

#spine-canvas {
    width: 100%;
    height: 100%;
    display: block;
}

#progress-container {
    position: relative;
    width: 100%;
    aspect-ratio: 976 / 164;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2; /* Полоска ПОВЕРХ рыбака */
}

#load-bar-frame {
    position: absolute;
    width: 100%;
    height: 100%;
    background-image: url("load_bar.png");
    background-size: 100% 100%;
    z-index: 1; 
    pointer-events: none;
}

#progress-fill-wrapper {
    position: absolute;
    left: 3%;
    width: 94%;
    height: 60%;
    z-index: 2; 
    overflow: hidden;
    border-radius: 40px;
}

#progress-fill {
    height: 100%;
    width: 0%;
    min-width: fit-content; /* Позволяет контейнеру не сжиматься меньше суммы ширин капсул */
    position: relative;
    display: flex;
    flex-direction: row;
    gap: 0;
    transition: width 0.1s linear;
}

.bar-cap {
    width: auto;
    height: 100%;
    aspect-ratio: 58 / 101;
    background-size: 100% 100%;
    background-repeat: no-repeat;
    flex-shrink: 0;
}

/* Начало полоски (слева) */
.bar-cap.start {
    background-image: url("load_line_end.png");
}

/* Конец полоски (справа) */
.bar-cap.end {
    background-image: url("load_line_end.png");
    transform: scaleX(-1);
}

.bar-body {
    flex-grow: 1;
    height: 100%;
    background-image: url("load_line_body.png");
    background-size: auto 100%;
    background-repeat: repeat-x;
}

#unity-fullscreen-button {
    height: 32px;
    width: 32px;
    position: absolute;
    z-index: 1;
    bottom: 10px;
    left: 10px;
    background-color: transparent;
    background-image: url("fullscreen-button-out.png");
    background-repeat: no-repeat;
    background-position: center;
    border: none;
    cursor: pointer;
    opacity: 0.333;
}

#unity-fullscreen-button:hover {
    opacity: 1.0;
}

#unity-warning {
    position: absolute;
    left: 50%;
    top: 5%;
    transform: translate(-50%);
    background: white;
    padding: 10px;
    display: none;
    z-index: 200;
}

/* --- Splash Screen --- */
#custom-splash {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: #000000;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.splash-logo {
    display: flex;
    align-items: center;
    gap: 18px;
}

.splash-logo-four {
    height: min(16vw, 110px);
    width: auto;
    opacity: 0;
    filter: brightness(.9);
    animation: fourFlicker 1.9s ease forwards;
}

.splash-logo-friends {
    height: min(7vw, 56px);
    width: auto;
    opacity: 0;
    transform: translateX(-8px);
    animation: friendsReveal .9s ease forwards;
    animation-delay: 1.7s;
}

#custom-splash.fade-out {
    pointer-events: none;
    animation: splashFadeOut 0.8s ease-in-out forwards;
}

@keyframes fourFlicker {
    0%   { opacity: 0;   filter: brightness(.1)  drop-shadow(0 0 0   rgba(200,242,90,0)) }
    8%   { opacity: .18 }
    14%  { opacity: .04 }
    22%  { opacity: .45 }
    28%  { opacity: .16 }
    40%  { opacity: .72; filter: brightness(1.05) drop-shadow(0 0 8px  rgba(200,242,90,.25)) }
    52%  { opacity: .28 }
    66%  { opacity: .92; filter: brightness(1.15) drop-shadow(0 0 22px rgba(200,242,90,.45)) }
    78%  { opacity: .76 }
    100% { opacity: 1;   filter: brightness(1.2)  drop-shadow(0 0 26px rgba(200,242,90,.55)) }
}

@keyframes friendsReveal {
    from { opacity: 0; transform: translateX(-10px) }
    to   { opacity: 1; transform: none }
}

@keyframes splashFadeOut {
    0%   { opacity: 1; }
    100% { opacity: 0; }
}
