body {
    font-family: 'Poppins', sans-serif;
    /* 字体渲染优化以减少布局漂移 */
    font-display: swap;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    /* Light mode default styles */
    background-color: #f3f4f6; /* Tailwind gray-100 */
    color: #1f2937; /* Tailwind gray-800 */
    /* Light mode background pattern similar to dark mode but with lighter colors */
    background-image: radial-gradient(circle at 50% 50%, #e7ebf3 0%, #d1d5db 100%);
    background-size: 10px 10px; /* Common background size */
    transition: background-color 0.3s ease, color 0.3s ease, background-image 0.3s ease;
}

html.dark body {
    background-color: #121826;
    background-image: radial-gradient(circle at 50% 50%, #1a2235 0%, #121826 100%);
    color: #e5e7eb; /* Tailwind gray-200 for dark mode text */
}

/* 
html.dark body a {
    color: #93c5fd; 
}
*/

.emoji-card {
    transition: all 0.3s ease;
}

.emoji-card:hover {
    transform: scale(1.05);
    /* background-color: #2a3349; */
    cursor: pointer;
}

.category-btn {
    transition: all 0.2s ease;
}

.category-btn:hover, .category-btn.active {
    transform: translateY(-2px);
}

.tooltip {
    --x-offset: 0;
    --y-offset: 0;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s ease;
    transform: translate(var(--x-offset), calc(var(--y-offset) - 5px));
    pointer-events: none;
    position: fixed;
    z-index: 9999;
}

.tooltip.show {
    opacity: 1;
    visibility: visible;
    transform: translate(var(--x-offset), var(--y-offset));
}

#copyTooltip {
    pointer-events: none;
} 

.skin-tone-dot {
    border-radius: 50%;
    display: inline-block;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.skin-tone-dot:hover {
    transform: scale(1.2);
}

.skin-tone-selector {
    transition: all 0.3s ease;
}

/* 回到顶部按钮样式 */
#backToTop {
    transform: scale(0.95);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    right: 2.5rem;
    bottom: 2.5rem;
    width: 3.5rem;
    height: 3.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #2563eb; /* 亮色模式的蓝色 */
}

html.dark #backToTop {
    background-color: #4f46e5; /* 暗黑模式下的靛青色 */
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3), 0 0 5px rgba(79, 70, 229, 0.5);
}

#backToTop.opacity-0 {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

#backToTop.opacity-100 {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

#backToTop:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.25);
}

html.dark #backToTop:hover {
    box-shadow: 0 6px 20px rgba(79, 70, 229, 0.4); /* 靛青色的阴影效果 */
}

#backToTop:active {
    transform: scale(0.9);
}

/* 响应式调整 */
@media (max-width: 640px) {
    #backToTop {
        right: 1.5rem;
        bottom: 1.5rem;
        width: 3rem;
        height: 3rem;
        padding: 0.75rem;
    }
    
    #backToTop svg {
        width: 1.5rem;
        height: 1.5rem;
    }
}

/* 布局稳定性优化 */
.emoji-card {
    /* 确保表情卡片有固定的尺寸，防止被拉伸 */
    min-height: 120px;
    max-height: 120px;
    min-width: 100px;
    height: 120px; /* 固定高度，防止Grid拉伸 */
}

/* 分类按钮稳定性 */
.category-btn {
    /* 确保按钮有稳定的尺寸 */
    min-height: 3.5rem;
    min-width: 3.5rem;
}

@media (min-width: 768px) {
    .category-btn {
        min-height: 2rem;
        min-width: 4rem;
    }
}

/* 骨架屏动画优化 */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.animate-pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* 防止字体加载时的布局漂移 */
* {
    font-feature-settings: "kern" 1;
    font-kerning: normal;
}

/* 确保容器有稳定的尺寸 */
#categories {
    contain: layout style;
}

#emoji-container {
    contain: layout style;
    /* 防止Grid自动拉伸行高 */
    grid-auto-rows: max-content;
    align-content: start;
}

/* 数字序号样式 */
.step-number {
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: bold;
    color: white;
    margin-right: 0.75rem;
    margin-top: 0.125rem;
    flex-shrink: 0;
}

.step-number.chrome {
    background-color: #3b82f6; /* blue-500 */
}

.step-number.firefox {
    background-color: #f97316; /* orange-500 */
}

.step-number.edge {
    background-color: #3b82f6; /* blue-500 */
}