.page4 {
    background: linear-gradient(135deg, #2B4162 0%, #12343b 100%);
    color: white;
    font-family: 'Arial', sans-serif;
}

.habitat-container {
    max-width: 1200px;
    width: 95%;
    margin: 0 auto;
    padding: 2vh;
    height: auto;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    gap: 2vh;
}

.habitat-container h1 {
    text-align: center;
    font-size: clamp(1.5rem, 4vw, 3rem);
    margin: 1vh 0;  /* 减小标题margin */
    color: #fff;
    text-shadow: 0 0 1rem rgba(255,255,255,0.3);
}

.habitats {
    display: flex;
    gap: 2vw;  /* 减小卡片间距 */
  
    padding: 1vh 0;
  
}

.habitat {
    flex: 1;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 1rem;
    padding: 1.5vh;  /* 减小内边距 */
    backdrop-filter: blur(8px);
    transform: translateX(-100px);
    opacity: 0;
    transition: all 0.5s ease;
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.habitat.asia {
    transform: translateX(100px);
}

.page4.active .habitat {
    transform: translateX(0);
    opacity: 1;
}

.habitat h2 {
    display: flex;
    align-items: center;
    gap: 0.5em;
    font-size: clamp(1.2rem, 2.5vw, 2rem);
    color: #8FD6E1;
    margin-bottom: 2vh;
}

.habitat-content {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5vh;
    height: auto;
    min-height: 300px;
}

.habitat-image {
    height: 250px;
    min-height: 200px;
    max-height: 300px;
    border-radius: 0.8rem;
    background-size: cover;
    background-position: center;
    transition: transform 0.3s ease;
    position: relative;
    overflow: hidden;
    margin: 0;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.habitat-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.habitat-image:hover img {
    transform: scale(1.05);
}

.habitat-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 1vh;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 0.8rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.habitat-info h3 {
    font-size: clamp(1rem, 2vw, 1.5rem);
    color: #8FD6E1;
    margin-bottom: 0.5vh;
}

.habitat-info ul {
    list-style: none;
    padding: 0;
    flex: 1;
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.8vh;
    justify-content: space-around;  /* 均匀分布列表项 */
}

.habitat-info li {
    display: flex;
    align-items: center;
    gap: 0.5em;
    margin: 1vh 0;
    font-size: clamp(0.8rem, 1.8vw, 1rem);
    background: rgba(255, 255, 255, 0.05);
    padding: 1vh 1.5vh;
    border-radius: 0.5rem;
    transition: all 0.3s ease;
}

.habitat-info ul li:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateX(5px);
}

.habitat-info i {
    color: #8FD6E1;
    font-size: 1.2em;
}

.habitat-info ul li i {
    display: inline-block;
    width: 1.5em;
    text-align: center;
    margin-right: 0.5em;
}

#css {
    cursor: pointer;
    padding: 1vh;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
}

#css:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

@media (max-width: 768px) {
    .habitats {
        flex-direction: column;
        gap: 1vh;
    }

    .habitat {
        transform: translateY(50px);
        padding: 1vh;
    }

    .habitat.asia {
        transform: translateY(50px);
    }

    .habitat-content {
        grid-template-columns: 1fr;
    }
    
    .habitat-image {
        height: 30vh;
    }
    
    .habitat-info ul {
        gap: 0.5vh;
    }
    
    .habitat-info ul li {
        padding: 0.8vh 1.2vh;
    }
}
