/* 妖精漫画 - 奇幻魔法风格样式 */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@300;400;500;600;700;800;900&family=Cinzel:wght@400;500;600;700;800&display=swap');

/* 基础样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Noto Sans SC', sans-serif;
    line-height: 1.5;
    color: #ffffff;
    overflow-x: hidden;
    font-size: 14px;
}

/* 魔法粒子效果 */
.magic-particles {
    position: absolute;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.magic-particles::before,
.magic-particles::after {
    content: '';
    position: absolute;
    width: 6px;
    height: 6px;
    background: radial-gradient(circle, #d946ef, #38bdf8);
    border-radius: 50%;
    animation: magicFloat 20s infinite linear;
    box-shadow: 0 0 20px rgba(217, 70, 239, 0.8);
}

.magic-particles::before {
    top: 10%;
    left: 20%;
    animation-delay: 0s;
}

.magic-particles::after {
    top: 70%;
    right: 30%;
    animation-delay: 10s;
}

@keyframes magicFloat {
    0% {
        transform: translateY(0px) rotate(0deg) scale(1);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        transform: translateY(-100vh) rotate(360deg) scale(0.5);
        opacity: 0;
    }
}

/* 妖精之光效果 */
.fairy-lights {
    position: absolute;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.fairy-lights::before,
.fairy-lights::after {
    content: '';
    position: absolute;
    width: 3px;
    height: 3px;
    background: linear-gradient(45deg, #facc15, #4ade80);
    border-radius: 50%;
    animation: fairyTwinkle 8s infinite ease-in-out;
    box-shadow: 0 0 15px rgba(250, 204, 21, 0.9);
}

.fairy-lights::before {
    top: 30%;
    left: 80%;
    animation-delay: 2s;
}

.fairy-lights::after {
    top: 80%;
    left: 15%;
    animation-delay: 6s;
}

@keyframes fairyTwinkle {
    0%, 100% {
        opacity: 0;
        transform: scale(0.5);
    }
    50% {
        opacity: 1;
        transform: scale(1.5);
    }
}

/* 魔法迷雾效果 */
.enchanted-mist {
    position: absolute;
    width: 100%;
    height: 100%;
    background: radial-gradient(ellipse at center, rgba(217, 70, 239, 0.1) 0%, transparent 70%);
    animation: mistFlow 30s infinite ease-in-out;
}

@keyframes mistFlow {
    0%, 100% {
        transform: translateX(0) scale(1);
        opacity: 0.3;
    }
    50% {
        transform: translateX(50px) scale(1.1);
        opacity: 0.1;
    }
}

/* 浮动妖精元素 */
.floating-fairy {
    position: absolute;
    animation: fairyFloat 15s infinite ease-in-out;
    opacity: 0.6;
}

.floating-fairy-1 {
    top: 20%;
    left: 15%;
    animation-delay: 0s;
}

.floating-fairy-2 {
    top: 60%;
    right: 25%;
    animation-delay: 5s;
}

.floating-fairy-3 {
    bottom: 30%;
    left: 40%;
    animation-delay: 10s;
}

@keyframes fairyFloat {
    0%, 100% {
        transform: translateY(0px) rotate(0deg);
    }
    25% {
        transform: translateY(-20px) rotate(5deg);
    }
    50% {
        transform: translateY(-10px) rotate(-3deg);
    }
    75% {
        transform: translateY(-25px) rotate(7deg);
    }
}

/* 发光动画 */
.animate-glow {
    animation: magicGlow 3s ease-in-out infinite alternate;
}

@keyframes magicGlow {
    from {
        box-shadow: 0 0 20px rgba(217, 70, 239, 0.5);
    }
    to {
        box-shadow: 0 0 30px rgba(217, 70, 239, 0.8), 0 0 40px rgba(56, 189, 248, 0.3);
    }
}

/* 脉冲动画 */
.animate-pulse {
    animation: magicPulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes magicPulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.8;
        transform: scale(1.05);
    }
}

/* 排行榜选项卡样式 */
.ranking-tab {
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.ranking-tab::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

.ranking-tab:hover::before {
    left: 100%;
}

.ranking-tab.active {
    transform: scale(1.05);
    box-shadow: 0 0 20px rgba(250, 204, 21, 0.5);
}

/* 排行榜项目动画 */
.ranking-item {
    transition: all 0.3s ease;
    position: relative;
}

.ranking-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(217, 70, 239, 0.1), transparent);
    opacity: 0;
    transition: opacity 0.3s ease;
    border-radius: 16px;
}

.ranking-item:hover::before {
    opacity: 1;
}

/* 计数器动画 */
.counter {
    display: inline-block;
}

/* 返回顶部按钮 */
#back-to-top {
    transition: all 0.3s ease;
}

#back-to-top.show {
    transform: translateY(0);
    opacity: 1;
}

/* 滚动条样式 */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.3);
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #d946ef, #38bdf8);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #c026d3, #0ea5e9);
}

/* 响应式设计 */
@media (max-width: 768px) {
    body {
        font-size: 13px;
    }
    
    h1 {
        font-size: 2rem !important;
    }
    
    h2 {
        font-size: 1.5rem !important;
    }
    
    h3 {
        font-size: 1.25rem !important;
    }
    
    .magic-particles::before,
    .magic-particles::after {
        width: 4px;
        height: 4px;
    }
    
    .floating-fairy {
        font-size: 0.8rem;
    }
    
    .ranking-item {
        flex-direction: column;
        text-align: center;
        padding: 1rem;
    }
    
    .ranking-item > * {
        margin-bottom: 0.5rem;
    }
}

/* 加载动画 */
.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(217, 70, 239, 0.3);
    border-top: 4px solid #d946ef;
    border-radius: 50%;
    animation: magicSpin 1s linear infinite;
}

@keyframes magicSpin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 文本渐变效果 */
.text-gradient {
    background: linear-gradient(135deg, #d946ef, #38bdf8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* 卡片悬停效果 */
.card-hover {
    transition: all 0.3s ease;
    position: relative;
}

.card-hover::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(217, 70, 239, 0.1), rgba(56, 189, 248, 0.1));
    opacity: 0;
    transition: opacity 0.3s ease;
    border-radius: inherit;
}

.card-hover:hover::after {
    opacity: 1;
}

.card-hover:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

/* 按钮特效 */
.btn-glow {
    position: relative;
    overflow: hidden;
}

.btn-glow::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    transition: left 0.6s;
}

.btn-glow:hover::before {
    left: 100%;
}

/* 输入框样式 */
.input-glow {
    transition: all 0.3s ease;
}

.input-glow:focus {
    box-shadow: 0 0 20px rgba(217, 70, 239, 0.3);
    border-color: #d946ef;
}

/* 导航栏特效 */
.nav-blur {
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

/* 页面过渡动画 */
.page-transition {
    animation: fadeInUp 0.8s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 魔法边框 */
.magic-border {
    position: relative;
    border: 1px solid transparent;
    background: linear-gradient(135deg, rgba(217, 70, 239, 0.1), rgba(56, 189, 248, 0.1));
    background-clip: padding-box;
}

.magic-border::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: -1;
    margin: -1px;
    border-radius: inherit;
    background: linear-gradient(135deg, #d946ef, #38bdf8);
}

/* 数据可视化效果 */
.data-bar {
    height: 4px;
    background: linear-gradient(90deg, #d946ef, #38bdf8);
    border-radius: 2px;
    animation: dataFlow 2s ease-in-out infinite;
}

@keyframes dataFlow {
    0%, 100% {
        transform: scaleX(0.8);
    }
    50% {
        transform: scaleX(1);
    }
}

/* 全屏加载遮罩 */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.loading-overlay.show {
    opacity: 1;
    visibility: visible;
}

/* 魔法特效增强 */
.enchanted-element {
    position: relative;
    overflow: hidden;
}

.enchanted-element::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: conic-gradient(from 0deg, transparent, rgba(217, 70, 239, 0.3), transparent);
    animation: rotate 4s linear infinite;
    z-index: -1;
}

@keyframes rotate {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 触摸设备优化 */
@media (hover: none) and (pointer: coarse) {
    .card-hover:hover::after {
        opacity: 0;
    }
    
    .ranking-item:hover::before {
        opacity: 0;
    }
    
    .btn-glow:hover::before {
        left: -100%;
    }
}

/* 高对比度模式支持 */
@media (prefers-contrast: high) {
    .magic-particles::before,
    .magic-particles::after {
        box-shadow: 0 0 10px rgba(255, 255, 255, 1);
    }
    
    .fairy-lights::before,
    .fairy-lights::after {
        box-shadow: 0 0 8px rgba(255, 255, 255, 1);
    }
}

/* 减少动画偏好支持 */
@media (prefers-reduced-motion: reduce) {
    .magic-particles::before,
    .magic-particles::after,
    .fairy-lights::before,
    .fairy-lights::after,
    .floating-fairy,
    .enchanted-mist {
        animation: none;
    }
    
    .animate-glow,
    .animate-pulse {
        animation: none;
    }
}