/* 全局主体样式 */
body {
    font-family: sans-serif;
    margin: 0;
    background-color: #1a1a1a; /* 深色背景以增强对比度 */
    color: #f0f0f0;
    overflow-x: hidden;
}

/* 背景轮播 */
.background-carousel {
    position: fixed;
    top: 0;
    left: 0;
    width: 200%; /* 加宽以实现无缝滚动 */
    height: 100%;
    z-index: -1;
    display: flex;
    animation: scroll-background 120s linear infinite;
}

.background-carousel img {
    width: auto;
    height: 100%;
    object-fit: cover;
    opacity: 0.3;
}

@keyframes scroll-background {
    0% {
        transform: translateX(0);
    }
    100% {
        transform: translateX(-50%);
    }
}

/* 主要内容与玻璃效果 */
.content-wrapper {
    position: relative;
    z-index: 1;
}

.container {
    max-width: 1200px;
    margin: 20px auto;
    padding: 20px;
    border-radius: 15px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);

    /* 磨砂玻璃效果 */
    background-color: rgba(20, 20, 20, 0.65);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px); /* 兼容 Safari */
    border: 1px solid rgba(255, 255, 255, 0.18);

    /* --- 新增：为绝对定位的子元素提供参考 --- */
    position: relative;
}

/* --- 新增：圆形返回按钮样式 --- */
.header-controls {
    position: absolute;
    top: 25px; /* 微调垂直位置 */
    left: 25px; /* 微调水平位置 */
}

.btn-round {
    display: flex; /* 使用flex轻松实现内容居中 */
    justify-content: center;
    align-items: center;
    width: 40px;
    height: 40px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    background-color: rgba(255, 255, 255, 0.1);
    color: #f0f0f0;
    text-decoration: none;
    border-radius: 50%; /* 圆形的关键 */
    cursor: pointer;
    transition: background-color 0.3s, transform 0.3s;
    font-size: 22px; /* 调整箭头大小 */
    line-height: 1;
}

.btn-round:hover {
    background-color: rgba(255, 255, 255, 0.25);
    transform: scale(1.1); /* 增加悬浮交互效果 */
}

/* 画廊样式 */
h1 {
    text-align: center;
    margin-bottom: 30px;
    /* --- 修改：增加上边距，为按钮留出空间，确保标题完美居中 --- */
    margin-top: 15px;
    color: #fff;
}

/* 瀑布流布局容器 */
.gallery-grid {
    position: relative; /* 子元素绝对定位的关键 */
    width: 100%;
}

.grid-item {
    position: absolute;
    overflow: hidden;
    border-radius: 10px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.grid-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    cursor: pointer;
}

.grid-item:hover {
    transform: scale(1.05) rotate(1deg);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.7);
    z-index: 10;
}

/* 工具提示样式 */
.grid-item .tooltip {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.75);
    color: #fff;
    padding: 8px;
    font-size: 12px;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    opacity: 0;
    transform: translateY(100%);
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: none; /* 允许点击穿透到图片 */
}

.grid-item:hover .tooltip {
    opacity: 1;
    transform: translateY(0);
}


/* 加载动画 */
.loader {
    text-align: center;
    padding: 20px;
    font-size: 1.2em;
    color: #ccc;
}


/* 模态框样式 */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    padding-top: 60px;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.95);
}

.modal-content {
    margin: auto;
    display: block;
    max-width: 85%;
    max-height: 85%;
}

#caption {
    margin: auto;
    display: block;
    width: 80%;
    max-width: 700px;
    text-align: center;
    color: #ccc;
    padding: 10px 0;
    height: 150px;
}

#caption a {
    color: #00aaff;
    text-decoration: none;
}
#caption a:hover {
    text-decoration: underline;
}

.close {
    position: absolute;
    top: 15px;
    right: 35px;
    color: #f1f1f1;
    font-size: 40px;
    font-weight: bold;
    transition: 0.3s;
}

.close:hover,
.close:focus {
    color: #bbb;
    text-decoration: none;
    cursor: pointer;
}