* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { width: 100%; height: 100%; overflow: hidden; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif; background: #000; color: #fff; -webkit-tap-highlight-color: transparent; user-select: none; }
#app { width: 100%; height: 100%; display: flex; flex-direction: column; background: #000; position: relative; }

/* ===== 顶部导航 ===== */
.header {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 100;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    background: linear-gradient(180deg, rgba(0,0,0,0.7) 0%, transparent 100%);
    pointer-events: none;
    height: 56px;
}
.header > * { pointer-events: auto; }
.logo { font-size: 20px; font-weight: 700; color: #fff; text-shadow: 0 2px 8px rgba(0,0,0,0.5); }
.header-center { display: flex; gap: 16px; }
.sort-btn {
    padding: 4px 12px;
    background: transparent;
    border: none;
    color: rgba(255,255,255,0.6);
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    border-radius: 16px;
}
.sort-btn.active { color: #fff; background: rgba(255,255,255,0.15); }
.sort-btn:active { transform: scale(0.95); }
.btn-tags {
    padding: 6px 14px;
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 20px;
    color: #fff;
    font-size: 13px;
    cursor: pointer;
    backdrop-filter: blur(10px);
    transition: all 0.3s;
}
.btn-tags:hover { background: rgba(255,255,255,0.25); }
.btn-tags:active { transform: scale(0.95); }

/* ===== 标签浮层 ===== */
.tags-menu {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 200;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(8px);
    display: none;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.3s ease;
}
.tags-menu.show { display: flex; }
.tags-menu-inner {
    width: 90%;
    max-width: 400px;
    max-height: 70vh;
    background: #1a1a2e;
    border-radius: 16px;
    padding: 20px;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.8);
}
.tags-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    font-size: 18px;
    font-weight: 600;
}
.btn-close-tags { background: none; border: none; color: #888; font-size: 24px; cursor: pointer; padding: 0 8px; }
.btn-close-tags:hover { color: #fff; }
.tags-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding-top: 15px;
}
.tag-item {
    padding: 8px 18px;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 20px;
    color: #ccc;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s;
}
.tag-item:hover { background: rgba(255,255,255,0.15); color: #fff; }
.tag-item.active { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: #fff; border-color: transparent; }
.no-tags { color: #666; padding: 20px; text-align: center; }

/* ===== 图片列表 ===== */
.feed-container {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    scroll-snap-type: y mandatory;
    -webkit-overflow-scrolling: touch;
    padding-top: 56px;
    padding-bottom: 60px;
}
.feed-container::-webkit-scrollbar { width: 4px; }
.feed-container::-webkit-scrollbar-track { background: transparent; }
.feed-container::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 2px; }
.feed-wrapper { display: flex; flex-direction: column; }

/* ===== 单张图片 ===== */
.feed-item {
    position: relative;
    width: 100%;
    height: calc(100vh - 56px - 60px);
    scroll-snap-align: start;
    background: #111;
    overflow: hidden;
}
.feed-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    cursor: pointer;
    transition: transform 0.3s;
}
.feed-image:active { transform: scale(1.02); }

/* ===== 右侧操作按钮 ===== */
.feed-actions {
    position: absolute;
    right: 16px;
    bottom: 100px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    z-index: 10;
}
.feed-actions button {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: none;
    border: none;
    color: rgba(255,255,255,0.85);
    font-size: 12px;
    cursor: pointer;
    transition: all 0.3s;
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
    gap: 4px;
}
.feed-actions button .icon { font-size: 28px; line-height: 1; filter: drop-shadow(0 2px 4px rgba(0,0,0,0.4)); }
.feed-actions button .count { font-weight: 600; font-size: 13px; }
.feed-actions button:active { transform: scale(0.9); }
.feed-actions .btn-like .icon { color: #ff6b6b; }

/* ===== 底部标题 ===== */
.feed-title {
    position: absolute;
    bottom: 60px;
    left: 16px;
    right: 80px;
    font-size: 16px;
    font-weight: 600;
    color: #fff;
    text-shadow: 0 2px 8px rgba(0,0,0,0.8);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    z-index: 5;
    pointer-events: none;
}

/* ===== 底部导航 ===== */
.bottom-nav {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    z-index: 50;
    height: 60px;
    background: linear-gradient(0deg, rgba(0,0,0,0.85) 0%, transparent 100%);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 0 10px 8px;
    overflow-x: auto;
}
.nav-list {
    display: flex;
    gap: 16px;
    white-space: nowrap;
    padding: 0 10px;
}
.nav-item {
    padding: 6px 14px;
    background: transparent;
    border: none;
    color: rgba(255,255,255,0.6);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    border-radius: 20px;
    flex-shrink: 0;
}
.nav-item.active { color: #fff; background: rgba(255,255,255,0.15); }
.nav-item:active { transform: scale(0.95); }
.nav-list::-webkit-scrollbar { display: none; }

/* ===== 加载状态 ===== */
.loading-spinner {
    display: none;
    justify-content: center;
    align-items: center;
    gap: 12px;
    padding: 20px;
    color: #666;
    font-size: 14px;
}
.loading-spinner .spinner {
    width: 24px;
    height: 24px;
    border: 3px solid rgba(255,255,255,0.1);
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.no-more { display: none; text-align: center; padding: 20px; color: #444; font-size: 13px; }
.empty-state { display: flex; justify-content: center; align-items: center; height: 60vh; font-size: 24px; color: #444; }

/* ===== 详情弹窗 ===== */
.detail-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 300;
    background: rgba(0,0,0,0.92);
    backdrop-filter: blur(8px);
    display: none;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.3s ease;
}
.detail-overlay.show { display: flex; }
.detail-container {
    width: 95%;
    max-width: 500px;
    max-height: 90vh;
    background: #1a1a2e;
    border-radius: 16px;
    overflow: hidden;
    position: relative;
    box-shadow: 0 20px 80px rgba(0,0,0,0.9);
}
.detail-close {
    position: absolute;
    top: 12px; right: 12px;
    z-index: 10;
    width: 40px; height: 40px;
    border-radius: 50%;
    border: none;
    background: rgba(0,0,0,0.6);
    color: #fff;
    font-size: 20px;
    cursor: pointer;
    backdrop-filter: blur(4px);
    transition: all 0.3s;
}
.detail-close:hover { background: rgba(255,255,255,0.2); }
.detail-content { max-height: 90vh; overflow-y: auto; }
.detail-content::-webkit-scrollbar { width: 4px; }
.detail-content::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 2px; }
.detail-image-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 9/16;
    background: #111;
    overflow: hidden;
}
.detail-image-wrapper img { width: 100%; height: 100%; object-fit: contain; }
.detail-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px; height: 40px;
    border-radius: 50%;
    border: none;
    background: rgba(0,0,0,0.5);
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    backdrop-filter: blur(4px);
    transition: all 0.3s;
    display: none;
    justify-content: center;
    align-items: center;
}
.detail-nav:hover { background: rgba(255,255,255,0.2); }
.detail-nav.prev { left: 8px; }
.detail-nav.next { right: 8px; }
.detail-info { padding: 20px; }
.detail-title { font-size: 20px; font-weight: 700; margin-bottom: 8px; color: #fff; }
.detail-desc { font-size: 15px; color: #aaa; margin-bottom: 12px; line-height: 1.6; }
.detail-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.detail-tags .tag { padding: 4px 12px; background: rgba(102,126,234,0.2); border: 1px solid rgba(102,126,234,0.3); border-radius: 16px; font-size: 12px; color: #a8b4ff; }
.detail-stats { display: flex; gap: 24px; padding: 12px 0; border-top: 1px solid rgba(255,255,255,0.06); border-bottom: 1px solid rgba(255,255,255,0.06); margin-bottom: 16px; color: #888; font-size: 14px; }
.detail-stats span { display: flex; align-items: center; gap: 4px; }
.detail-comment { min-height: 60px; }
.comment-placeholder { display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 20px; color: #666; font-size: 14px; text-align: center; border: 2px dashed rgba(255,255,255,0.06); border-radius: 12px; background: rgba(255,255,255,0.02); }

/* ===== Toast ===== */
.toast {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 999;
    padding: 10px 24px;
    background: rgba(0,0,0,0.8);
    color: #fff;
    border-radius: 24px;
    font-size: 14px;
    backdrop-filter: blur(8px);
    opacity: 0;
    transition: all 0.4s ease;
    pointer-events: none;
    white-space: nowrap;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@keyframes fadeIn { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }

/* ===== 响应式 ===== */
@media (max-width: 480px) {
    .logo { font-size: 17px; }
    .sort-btn { font-size: 13px; padding: 2px 10px; }
    .btn-tags { font-size: 12px; padding: 4px 12px; }
    .feed-item { height: calc(100vh - 50px - 56px); }
    .feed-title { font-size: 14px; bottom: 50px; right: 70px; }
    .feed-actions { right: 12px; bottom: 80px; gap: 16px; }
    .feed-actions button .icon { font-size: 24px; }
    .feed-actions button .count { font-size: 11px; }
    .bottom-nav { height: 56px; }
    .nav-item { font-size: 12px; padding: 4px 12px; }
}