@font-face {
    font-family: 'SF Pro Text';
    font-weight: 400;
    src: local('.SFNSText-Regular'), local('.HelveticaNeueDeskInterface-Regular'), local('-apple-system'), local('sans-serif');
}
@font-face {
    font-family: 'SF Pro Text';
    font-weight: 500;
    src: local('.SFNSText-Medium'), local('.HelveticaNeueDeskInterface-Medium'), local('-apple-system'), local('sans-serif');
}
@font-face {
    font-family: 'SF Pro Text';
    font-weight: 600;
    src: local('.SFNSText-Semibold'), local('.HelveticaNeueDeskInterface-Bold'), local('-apple-system'), local('sans-serif');
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

/* Адаптивная центровка на ПК с премиальным фоном */
body {
    background-color: #0F0F10;
    color: #FFFFFF;
    font-family: 'SF Pro Text', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    overflow: hidden; 
    width: 100vw;
    height: 100vh;
    user-select: none;
    -webkit-user-select: none;
    overscroll-behavior: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Премиальный мобильный фрейм на десктопе, растягивающийся до fullsize на смартфонах */
.app-window {
    width: 100%;
    height: 100%;
    position: relative;
    background-color: #1C1C1E;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

@media (min-width: 481px) {
    .app-window {
        max-width: 460px;
        height: 95vh;
        max-height: 900px;
        border-radius: 32px;
        border: 8px solid #2C2C2E;
        box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
    }
}

#loader {
    position: fixed; 
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #1C1C1E;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 99999; 
    opacity: 1;
    transition: opacity 0.5s cubic-bezier(0.25, 1, 0.5, 1), visibility 0.5s;
}

#loader.fade-out {
    opacity: 0;
    visibility: hidden;
}

#lottie-loader {
    width: 150px;
    height: 150px;
}

.fallback-loader {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-top: 4px solid #FFFFFF;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    display: none;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

#app-content {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-left: 17px;
    padding-right: 17px;
    padding-top: calc(var(--tg-safe-area-inset-top, 0px) + 110px); 
    padding-bottom: 120px; 
    box-sizing: border-box;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: none;
    -ms-overflow-style: none;
    position: relative;
    opacity: 0;
    transition: opacity 0.5s cubic-bezier(0.16, 1, 0.3, 1), padding-bottom 0.3s ease;
}

#app-content.visible {
    opacity: 1;
}

#app-content::-webkit-scrollbar {
    display: none;
}

/* Хедер */
.header {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: calc(var(--tg-safe-area-inset-top, 0px) + 48px) 17px 10px 17px;
    height: calc(var(--tg-safe-area-inset-top, 0px) + 98px);
    z-index: 1000;
    background: transparent !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    box-shadow: none !important;
    opacity: 0;
    transition: opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    pointer-events: auto;
}

#app-content.visible ~ #app-header {
    opacity: 1;
}

/* Скрываем хедер при активации кошелька */
.header.wallet-active {
    opacity: 0 !important;
    pointer-events: none !important;
}

/* Премиальные стеклянные пилюли */
.top-pill {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 38px;
    min-width: 100px;
    padding: 0 14px;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 19px;
    box-sizing: border-box;
    pointer-events: auto;
    z-index: 10;
    background-color: rgba(255, 255, 255, 0.1);
    box-shadow: inset 8px 6px 1px -8px rgba(255, 255, 255, 0.1),
                inset -8px -6px 1px -8px rgba(255, 255, 255, 0.1),
                inset 8px 8px 28px rgba(0, 0, 0, 0.08),
                inset -8px -8px 28px rgba(0, 0, 0, 0.08);
}

.top-pill::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 19px;
    padding: 0.9px;
    background: linear-gradient(165deg, 
        rgba(255, 255, 255, 0.35) 0%, 
        rgba(255, 255, 255, 0.0) 40%, 
        rgba(255, 255, 255, 0.0) 60%, 
        rgba(255, 255, 255, 0.35) 100%
    );
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
    z-index: 3;
}

.avatar {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    margin-right: 8px;
    object-fit: cover;
    flex-shrink: 0;
    background-color: #3A3A3C;
}

.profile-label {
    font-size: 16px;
    font-weight: 600;
    color: #FFFFFF;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#profile-pill {
    max-width: 150px;
    overflow: hidden;
    cursor: default;
}

#balance-pill {
    background-color: rgba(255, 195, 0, 0.12);
    cursor: pointer;
    transition: transform 0.15s ease, background-color 0.15s ease;
}

#balance-pill:active {
    transform: scale(0.96);
    background-color: rgba(255, 195, 0, 0.2);
}

/* Кнопка Админ Панели */
.admin-pill {
    display: none; /* Отобразится только для 6072119726 */
    align-items: center;
    justify-content: center;
    height: 38px;
    width: 38px;
    border-radius: 50%;
    background-color: rgba(255, 69, 58, 0.15);
    border: 1px solid rgba(255, 69, 58, 0.3);
    color: #FF453A;
    font-size: 16px;
    cursor: pointer;
    z-index: 15;
    transition: transform 0.2s, background-color 0.2s;
    box-shadow: 0 0 10px rgba(255, 69, 58, 0.2);
}

.admin-pill:active {
    transform: scale(0.9);
    background-color: rgba(255, 69, 58, 0.3);
}

/* Кастомный тост */
.toast-notification {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translate(-50%, 100px);
    background-color: #3A3A3C;
    color: #FFFFFF;
    font-size: 13px;
    font-weight: 600;
    padding: 10px 20px;
    border-radius: 20px;
    opacity: 0;
    z-index: 9999;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.3s ease;
    pointer-events: none;
    white-space: nowrap;
}

.toast-notification.active {
    transform: translate(-50%, 0);
    opacity: 1;
}

/* Навигационная панель */
.bottom-nav {
    position: absolute;
    bottom: calc(20px + var(--tg-safe-area-inset-bottom, 0px));
    left: 50%;
    width: calc(100- 34px);
    width: calc(100% - 34px);
    max-width: 402px;
    height: 62px;
    background-color: rgba(58, 58, 60, 0.35);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-radius: 31px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 6px;
    z-index: 100;
    box-shadow: inset 8px 6px 1px -8px rgba(255, 255, 255, 0.1),
                inset -8px -6px 1px -8px rgba(255, 255, 255, 0.1),
                inset 8px 8px 28px rgba(0, 0, 0, 0.08),
                inset -8px -8px 28px rgba(0, 0, 0, 0.08);
    transform: translate(-50%, 0);
    opacity: 0;
    transition: opacity 0.5s cubic-bezier(0.16, 1, 0.3, 1), transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    will-change: transform, opacity;
}

.bottom-nav::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 31px;
    padding: 0.9px;
    background: linear-gradient(170deg, 
        rgba(255, 255, 255, 0.35) 0%, 
        rgba(255, 255, 255, 0.0) 40%, 
        rgba(255, 255, 255, 0.0) 60%, 
        rgba(255, 255, 255, 0.35) 100%
    );
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
    z-index: 3;
}

#app-content.visible ~ .bottom-nav {
    opacity: 1;
}

/* Класс скрытия нижней пилюли в разделе кошелька */
.bottom-nav.wallet-hidden {
    opacity: 0 !important;
    pointer-events: none !important;
    transform: translate(-50%, 100px) !important;
}

/* Индикатор меню */
.nav-indicator {
    position: absolute;
    height: 48px;
    width: calc((100% - 12px) / 5);
    background-color: rgba(255, 255, 255, 0.12);
    border-radius: 24px;
    top: 6px;
    left: 6px;
    z-index: 1;
    pointer-events: none;
    box-shadow: inset 8px 6px 1px -8px rgba(255, 255, 255, 0.1),
                inset -8px -6px 1px -8px rgba(255, 255, 255, 0.1),
                inset 8px 8px 28px rgba(0, 0, 0, 0.01),
                inset -8px -8px 28px rgba(0, 0, 0, 0.01);
    transition: transform 0.45s cubic-bezier(0.25, 1, 0.5, 1);
    transform-origin: center;
}

.nav-indicator::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 24px;
    padding: 0.9px;
    background: linear-gradient(135deg, 
        rgba(255, 255, 255, 0.35) 0%, 
        rgba(255, 255, 255, 0.0) 40%, 
        rgba(255, 255, 255, 0.0) 60%, 
        rgba(255, 255, 255, 0.35) 100%
    );
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
    z-index: 3;
}

.nav-item {
    flex: 1;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 2;
    cursor: pointer;
    color: #C3C3C3;
    transition: color 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.nav-item.active {
    color: #007AFF; 
}

.nav-item img {
    width: 17px;
    height: 17px;
    margin-bottom: 2px;
    object-fit: contain;
    transition: transform 0.2s ease;
}

.nav-item img.large-icon {
    width: 21px;
    height: 21px;
}

.nav-item.active img {
    filter: brightness(0) saturate(100%) invert(36%) sepia(84%) saturate(2311%) hue-rotate(202deg) brightness(101%) contrast(106%);
}

.nav-item:active img {
    transform: scale(0.9);
}

.nav-label {
    font-size: 9px;
    font-weight: 500;
    letter-spacing: -0.1px;
    transition: font-weight 0.3s ease;
}

.nav-item.active .nav-label {
    font-weight: 600;
}

/* Табы */
.tab-view {
    display: none;
    width: 100%;
    flex-direction: column;
    align-items: center;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.22s cubic-bezier(0.25, 1, 0.5, 1), transform 0.22s cubic-bezier(0.25, 1, 0.5, 1);
    will-change: transform, opacity;
}

.tab-view.active {
    display: flex;
    opacity: 1;
    transform: translateY(0);
}