:root {
    --bg-light: #F0F0F0;
    --accent-yellow: #EBFF00; /* 终末地标志性荧光黄 */
    --black: #000000; /* 纯黑 */
    --gray-dim: #888888;
    --card-min-width: 350px;
}

* {
    margin: 0; padding: 0; box-sizing: border-box;
    font-family: 'Arial Black', 'Impact', sans-serif;
}

body {
    background-color: var(--bg-light); color: var(--black);
    min-height: 100vh; overflow-x: hidden; padding-bottom: 60px;
}

body::before {
    content: ""; position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: url('https://grainy-gradients.vercel.app/noise.svg');
    opacity: 0.04; pointer-events: none; z-index: 9999;
}

.bg-dots {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background-image: radial-gradient(rgba(0,0,0,0.1) 1px, transparent 1px);
    background-size: 30px 30px; z-index: -2; pointer-events: none;
}

/* 空状态样式 */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 100px 0;
    color: rgba(0,0,0,0.2);
    border: 2px dashed rgba(0,0,0,0.1);
    margin: 40px 0;
    clip-path: polygon(0 0, 95% 0, 100% 15%, 100% 100%, 5% 100%, 0 85%);
}

.empty-icon {
    font-size: 48px;
    font-weight: 900;
    margin-bottom: 20px;
}

.empty-text {
    font-size: 24px;
    letter-spacing: 2px;
    font-weight: 900;
}

.empty-sub {
    font-size: 12px;
    margin-top: 10px;
    font-family: monospace;
}

.perspective-bg {
    position: fixed; top: 0; left: 0; width: 150%; height: 150%;
    z-index: -1; transform: rotate(-15deg) translate(-10%, -10%);
}

.ruler-line { position: absolute; width: 100%; height: 1px; background: rgba(0,0,0,0.1); }
.ruler-line span { font-size: 80px; color: rgba(0,0,0,0.05); padding-left: 10%; font-weight: 900; }
.line-30 { top: 10%; } .line-50 { top: 30%; } .line-80 { top: 60%; } .line-110 { top: 85%; }

.top-nav {
    display: flex; justify-content: space-between; align-items: center;
    padding: 20px 60px; position: sticky; top: 0;
    background: rgba(244, 244, 244, 0.9); backdrop-filter: blur(15px);
    z-index: 1000; border-bottom: 2px solid var(--black);
}

.hero-section {
    padding: 40px 60px 80px; /* 增加底部间距，防止与日期重合 */
}

.gallery-container {
    padding: 0 60px 100px;
}

.timeline-header {
    margin-bottom: 40px;
    display: flex;
    align-items: center;
    gap: 20px;
}

.header-line {
    flex: 1;
    height: 1px;
    background: rgba(0,0,0,0.1);
}

.logo-box {
    display: flex;
    flex-direction: column;
    min-width: max-content; /* 确保容器随内容伸缩 */
}

.logo-text { font-size: 20px; letter-spacing: -1px; line-height: 1.2; }

.logo-sub {
    font-size: 9px;
    white-space: nowrap !important; /* 核心：绝对禁止换行 */
    opacity: 0.8;
    letter-spacing: 0px;
}

.top-status {
    display: flex;
    align-items: center;
    gap: 6px; /* 进一步缩小间距 */
    flex-shrink: 1; /* 允许右侧在必要时微调 */
}

/* 搜索框样式 */
.search-box {
    background: rgba(0,0,0,0.05);
    border: 1px solid var(--black);
    padding: 5px 15px;
    clip-path: polygon(5px 0, 100% 0, 100% 70%, calc(100% - 5px) 100%, 0 100%, 0 30%);
}

.search-box input {
    background: transparent;
    border: none;
    outline: none;
    font-family: monospace;
    font-size: 12px;
    width: 150px;
    color: var(--black);
}

/* 批量操作条 */
.batch-bar {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--black);
    color: var(--accent-yellow);
    padding: 15px 40px;
    display: none;
    align-items: center;
    gap: 40px;
    z-index: 2000;
    clip-path: polygon(0 20%, 5% 0, 95% 0, 100% 20%, 100% 100%, 0 100%);
    box-shadow: 0 -10px 30px rgba(0,0,0,0.3);
}

.batch-info { font-weight: 900; font-size: 14px; border-right: 1px solid rgba(235,255,0,0.3); padding-right: 30px; }
.batch-btns { display: flex; gap: 15px; }

/* 选中状态 */
.photo-item.selected {
    border: 3px solid var(--black);
    background: var(--accent-yellow) !important;
    transform: translateY(-5px);
}

.select-indicator {
    position: absolute;
    top: 10px;
    left: 10px;
    font-size: 20px;
    color: var(--black);
    z-index: 10;
}

.size-control {
    background: var(--accent-yellow); padding: 12px 30px;
    clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px);
    border: 1px solid var(--black);
}

.sync-btn, .logout-btn {
    background: var(--black); color: var(--accent-yellow); border: none;
    padding: 10px 25px; font-weight: 900; cursor: pointer;
    clip-path: polygon(15% 0, 100% 0, 100% 70%, 85% 100%, 0 100%, 0 30%);
    transition: all 0.2s;
}

.logout-btn {
    background: transparent;
    border: 1px solid var(--black);
    color: var(--black);
}

.logout-btn:hover {
    background: var(--black);
    color: var(--accent-yellow);
}

.photo-grid {
    display: block; column-count: var(--grid-columns, 3); column-gap: 30px; width: 100%;
}

.photo-item {
    display: inline-block; width: 100%; break-inside: avoid; margin-bottom: 35px;
    background: #fff; padding: 10px; border: 1px solid #ddd; cursor: pointer;
    clip-path: polygon(0 20px, 20px 0, 100% 0, 100% calc(100% - 20px), calc(100% - 20px) 100%, 0 100%);
    position: relative;
}

.delete-btn {
    position: absolute; top: 15px; right: 15px;
    background: var(--black); color: var(--accent-yellow);
    padding: 2px 10px; font-size: 11px; font-weight: 900;
    z-index: 10; cursor: pointer; opacity: 0; transition: all 0.2s;
    clip-path: polygon(0 0, 100% 0, 100% 70%, 80% 100%, 0 100%);
}

.photo-item:hover .delete-btn { opacity: 0.8; }
.delete-btn:hover { opacity: 1 !important; transform: scale(1.1); background: #ff4444; color: #fff; }

.photo-item:hover { transform: scale(1.015); border-color: var(--black); background: var(--accent-yellow); }
.img-frame { background: #eee; overflow: hidden; }
.img-frame img { display: block; width: 100%; height: auto; }

.timeline-wrapper { padding-left: 20px; border-left: 1px dashed rgba(0, 0, 0, 0.2); }
.date-marker {
    background: var(--black); color: var(--accent-yellow); padding: 5px 15px; font-size: 22px; font-weight: 900;
    clip-path: polygon(0 0, 90% 0, 100% 30%, 100% 100%, 0 100%);
}

.footer-bar {
    position: fixed; bottom: 0; left: 0; width: 100%; background: var(--black);
    color: #fff; padding: 12px 40px; display: flex; justify-content: space-between;
    font-size: 10px; z-index: 1000; border-top: 1px solid rgba(255,255,255,0.1);
}

/* 灯箱预览 */
.viewer-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.98); backdrop-filter: blur(25px);
    z-index: 10000; display: none; justify-content: center; align-items: center; padding: 40px;
}

.viewer-content {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    width: 100%; height: 100%; position: relative;
}

.viewer-content img {
    max-height: 80vh; max-width: 90vw; border: 2px solid var(--accent-yellow);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: zoom-in; z-index: 1; object-fit: contain;
    will-change: transform; transform-origin: center center;
}

.viewer-metadata {
    position: absolute; bottom: 40px; left: 50%; transform: translateX(-50%);
    z-index: 100010; min-width: 600px;
    background: var(--accent-yellow); color: var(--black);
    padding: 15px 40px; border: 3px solid var(--black);
    box-shadow: 10px 10px 0 var(--black);
    clip-path: polygon(0 0, 98% 0, 100% 15%, 100% 100%, 2% 100%, 0 85%);
}

/* 翻页导航 UI 修复 */
.viewer-nav {
    position: absolute;
    top: 100px; /* 避开顶部关闭按钮 */
    bottom: 100px; /* 避开底部信息栏 */
    width: 8vw; /* 缩小判定范围 */
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-yellow);
    font-size: 14px;
    font-weight: 900;
    cursor: pointer;
    z-index: 100020;
    background: rgba(0,0,0,0.05);
    transition: all 0.3s;
    user-select: none;
    opacity: 0.3;
}
.viewer-nav:hover { opacity: 1; background: rgba(0,0,0,0.2); text-shadow: 0 0 10px var(--accent-yellow); }
.v-prev { left: 0; border-right: 1px solid rgba(235, 255, 0, 0.1); }
.v-next { right: 0; border-left: 1px solid rgba(235, 255, 0, 0.1); }

.viewer-close {
    position: absolute; top: 40px; right: 40px; color: var(--accent-yellow);
    font-weight: 900; cursor: pointer; z-index: 10002;
    background: rgba(0,0,0,0.6); padding: 8px 20px;
    border: 1px solid var(--accent-yellow);
    clip-path: polygon(10% 0, 100% 0, 100% 70%, 90% 100%, 0 100%, 0 30%);
}

#system-loader {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: var(--black); color: var(--accent-yellow); z-index: 99999;
    display: flex; justify-content: center; align-items: center;
    transition: opacity 0.8s ease, visibility 0.8s;
}

/* 登录页面样式 - 终末地风格 */
.login-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: var(--black); color: var(--accent-yellow);
    z-index: 100000; display: flex; justify-content: center; align-items: center;
}

.login-card {
    width: 450px; background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(235, 255, 0, 0.2);
    padding: 40px; position: relative;
    clip-path: polygon(0 0, 95% 0, 100% 10%, 100% 100%, 5% 100%, 0 90%);
}

.login-card::before {
    content: "PROTOCOL: LOGIN"; position: absolute; top: -15px; left: 20px;
    background: var(--accent-yellow); color: var(--black);
    padding: 2px 10px; font-size: 10px; font-weight: 900;
}

.input-group { margin-bottom: 25px; }
.input-group label { display: block; font-size: 12px; margin-bottom: 8px; opacity: 0.7; }
.input-group input {
    width: 100%; background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(235, 255, 0, 0.3);
    padding: 12px; color: #fff; font-family: monospace; outline: none;
}
.input-group input:focus { border-color: var(--accent-yellow); box-shadow: 0 0 10px rgba(235, 255, 0, 0.2); }

.login-btn {
    width: 100%; background: var(--accent-yellow); color: var(--black);
    border: none; padding: 15px; font-weight: 900; cursor: pointer;
    clip-path: polygon(0 0, 100% 0, 100% 70%, 90% 100%, 0 100%);
    transition: transform 0.2s;
}
.login-btn:hover { transform: scale(1.02); background: #fff; }

.login-footer { margin-top: 20px; font-size: 10px; text-align: center; opacity: 0.5; }

/* 查看器操作栏 */
.viewer-actions {
    display: flex; gap: 15px; margin-top: 10px; justify-content: center;
}

.v-btn {
    background: rgba(0, 0, 0, 0.6); color: #00e5ff;
    border: 1px solid #00e5ff; padding: 8px 15px;
    font-size: 11px; font-weight: 900; cursor: pointer;
    text-decoration: none; transition: all 0.2s;
    clip-path: polygon(10% 0, 100% 0, 100% 70%, 90% 100%, 0 100%, 0 30%);
}
.v-btn:hover { background: #00e5ff; color: #000; box-shadow: 0 0 15px #00e5ff; }

/* 终端提示框 */
.terminal-toast {
    position: fixed; top: 30px; left: 50%; transform: translateX(-50%);
    background: var(--black); color: var(--accent-yellow);
    padding: 12px 30px; font-family: monospace; font-size: 13px;
    border-left: 5px solid var(--accent-yellow);
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    z-index: 110000; display: none;
    animation: toast-blink 0.5s infinite alternate;
}
@keyframes toast-blink { from { opacity: 1; } to { opacity: 0.8; } }

#viewer-img {
    max-height: 80vh; max-width: 90vw;
    transform-origin: center center;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: block; margin: auto;
}

/* --- 移动端响应式极致修复 --- */
@media (max-width: 768px) {
    .top-nav {
        flex-direction: column;
        padding: 15px 20px;
        gap: 15px;
        height: auto;
        position: relative;
    }

    .top-status {
        width: 100%;
        justify-content: center;
        gap: 10px;
        flex-wrap: wrap;
    }

    .size-control { display: none !important; }

    .sync-btn, .logout-btn {
        flex: 1;
        min-width: 140px;
        padding: 8px 10px;
        font-size: 11px;
        text-align: center;
    }

    .hero-section {
        padding: 30px 15px 40px;
    }

    .hero-section h1 {
        font-size: 28px;
    }

    .gallery-container {
        padding: 0 10px 100px;
    }

    .photo-grid {
        display: block !important;
        column-count: 2 !important;
        column-gap: 12px !important;
    }

    .photo-item {
        display: inline-block;
        width: 100%;
        margin-bottom: 15px;
        break-inside: avoid;
        padding: 8px;
    }

    .item-meta .meta-id {
        font-size: 9px;
        line-height: 1.2;
    }

    .item-meta .meta-tag {
        font-size: 11px;
        margin-top: 4px;
        word-break: break-all;
    }

    #system-loader.loaded {
        pointer-events: none;
        opacity: 0;
        visibility: hidden;
    }

    .loader-content {
        width: 95%;
    }

    .status-box {
        padding: 10px;
        font-size: 9px;
    }

    /* --- 移动端查看器深度重构 --- */
    .viewer-overlay {
        padding: 0 !important;
    }

    .viewer-content {
        height: 100vh;
        width: 100vw;
        display: flex;
        flex-direction: column;
        justify-content: flex-start; /* 从顶部开始排列，给底部留空间 */
        padding-top: 60px;
    }

    .viewer-content img {
        max-height: 55vh; /* 进一步压缩图片高度，为底部 UI 留出充足空间 */
        max-width: 92vw;
        object-fit: contain;
        margin: 0 auto;
    }

    .viewer-metadata {
        position: fixed;
        bottom: 0;
        left: 0;
        transform: none; /* 取消居中位移 */
        width: 100vw !important;
        min-width: unset !important;
        background: var(--accent-yellow);
        padding: 20px 20px calc(20px + env(safe-area-inset-bottom)) !important; /* 适配全面屏底部 */
        border: none;
        border-top: 3px solid var(--black);
        box-shadow: 0 -10px 30px rgba(0,0,0,0.2);
        clip-path: polygon(0 15px, 15px 0, 100% 0, 100% 100%, 0 100%);
        z-index: 100050;
    }

    .v-id {
        font-size: 11px;
        margin-bottom: 12px;
        color: var(--black);
        font-weight: 900;
        border-bottom: 1px solid rgba(0,0,0,0.1);
        padding-bottom: 8px;
    }

    .viewer-actions {
        display: grid;
        grid-template-columns: 1fr 1fr; /* 按钮并排显示 */
        gap: 10px;
    }

    .v-btn {
        width: 100%;
        padding: 10px 5px !important;
        font-size: 10px !important;
        justify-content: center;
        text-align: center;
    }

    /* 快捷操作：将分享按钮放在第二行全宽显示 */
    #viewer-share {
        grid-column: span 2;
        background: var(--black) !important;
        color: var(--accent-yellow) !important;
    }

    .viewer-close {
        top: 15px;
        right: 15px;
        padding: 6px 15px;
        font-size: 11px;
    }

    .viewer-nav {
        display: none !important; /* 手机端依靠滑动，隐藏生硬按钮 */
    }

    .viewer-close {
        top: 20px;
        right: 20px;
        padding: 5px 12px;
        font-size: 12px;
    }

    /* 隐藏手机端翻页按钮并确保居中 */
    .viewer-nav {
        display: none !important;
    }

    .viewer-content {
        padding: 0;
        height: 100vh;
    }

    .viewer-content img {
        max-height: 70vh;
        max-width: 95vw;
        margin: auto;
    }
}