/**
 * 驭鬼者论坛 · 深色液态玻璃主题 · 完整版
 */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: #0b0b0b;
    color: #e0e0e0;
    line-height: 1.5;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    opacity: 0;
    animation: pageFade 0.4s ease-out forwards;
}

body.page-exit {
    opacity: 0;
}

@keyframes pageFade {
    to { opacity: 1; }
}

/* ---------- 页面加载进度条 ---------- */
.page-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: transparent;
    z-index: 9999;
    pointer-events: none;
}

.page-loader::after {
    content: '';
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    width: 0%;
    height: 100%;
    background: #aaa;
    transition: width 0.3s ease;
}

.page-loader.loading::after { width: 80%; }
.page-loader.finish::after { width: 100%; opacity: 0; transition: width 0.2s, opacity 0.3s; }

/* ---------- 顶部栏 ---------- */
.top-bar {
    background: rgba(20, 20, 20, 0.2);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    padding: 0 20px;
    position: sticky;
    top: 0;
    z-index: 90;
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    transition: background 0.3s;
    box-shadow: none;
}

.top-bar.scrolled { background: rgba(20, 20, 20, 0.35); }

.top-bar-container {
    max-width: 1280px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 60px;
}

.top-bar-left { display: flex; align-items: center; gap: 16px; }

.menu-toggle {
    background: none;
    border: none;
    font-size: 1.7rem;
    cursor: pointer;
    color: #f0f0f0;
    padding: 0 4px;
    line-height: 1;
    transition: transform 0.3s, opacity 0.3s;
}

.menu-toggle:hover { transform: scale(1.08); opacity: 0.8; }

.site-title {
    font-size: 1.25rem;
    font-weight: 500;
    color: #ffffff;
    text-decoration: none;
    letter-spacing: -0.01em;
    transition: opacity 0.3s;
}

.site-title:hover { opacity: 0.7; }

.top-bar-right { display: flex; gap: 16px; align-items: center; }

.auth-link {
    color: #ddd;
    text-decoration: none;
    font-size: 0.9rem;
    padding: 6px 14px;
    border-radius: 40px;
    transition: background 0.3s, color 0.3s;
    font-weight: 450;
    background: rgba(255,255,255,0.05);
    backdrop-filter: blur(4px);
}

.auth-link:hover { background: rgba(255,255,255,0.15); color: #fff; }

/* 头像菜单 */
.avatar-menu-wrapper { position: relative; }
.top-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    object-fit: cover;
    cursor: pointer;
    transition: transform 0.2s;
    border: 1.5px solid #555;
}
.top-avatar:hover { transform: scale(1.05); }

.avatar-dropdown {
    position: absolute;
    top: 50px;
    right: 0;
    background: rgba(30, 30, 30, 0.7);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 16px;
    padding: 8px 0;
    min-width: 140px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: 0.25s;
    z-index: 200;
}
.avatar-dropdown.active { opacity: 1; visibility: visible; transform: translateY(0); }
.avatar-dropdown a {
    display: block;
    padding: 10px 20px;
    color: #eee;
    text-decoration: none;
    font-size: 0.9rem;
    transition: background 0.15s;
}
.avatar-dropdown a:hover { background: rgba(255,255,255,0.1); }

/* ---------- 侧边栏 ---------- */
.sidebar {
    position: fixed;
    top: 0;
    left: -220px;
    width: 220px;
    height: 100vh;
    background: #111;
    border-right: 1px solid #2a2a2a;
    z-index: 100;
    transition: left 0.35s cubic-bezier(0.2,0.9,0.4,1);
    box-shadow: 4px 0 20px rgba(0,0,0,0.3);
    padding: 0;
    overflow-y: auto;
}
.sidebar.open { left: 0; }
.sidebar-title {
    padding: 20px 16px 12px;
    font-size: 1.1rem;
    font-weight: 500;
    color: #fff;
    text-align: left;
    border-bottom: 1px solid #2a2a2a;
    margin-bottom: 8px;
}
.sidebar-nav { display: flex; flex-direction: column; padding: 0 12px; }
.sidebar-nav a {
    padding: 14px 14px;
    color: #ccc;
    text-decoration: none;
    font-size: 1rem;
    font-weight: 450;
    transition: 0.3s;
    border-radius: 12px;
    margin-bottom: 4px;
    position: relative;
}
.sidebar-nav a:hover { background: #222; padding-left: 20px; color: #fff; }
.sidebar-nav a::before {
    content: '';
    position: absolute;
    left: 6px;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 0;
    background: #fff;
    border-radius: 4px;
    transition: height 0.3s;
}
.sidebar-nav a:hover::before { height: 50%; }

.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.4);
    backdrop-filter: blur(4px);
    z-index: 95;
    opacity: 0;
    visibility: hidden;
    transition: 0.3s;
}
.sidebar-overlay.active { opacity: 1; visibility: visible; }

/* ---------- 主内容区域 ---------- */
.main-wrapper {
    flex: 1;
    max-width: 1280px;
    margin: 0 auto;
    padding: 20px 16px 40px;
    width: 100%;
}

/* ---------- 通用卡片 ---------- */
.card {
    background: rgba(25, 25, 25, 0.7);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 28px;
    padding: 28px 26px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
    margin-bottom: 24px;
    transition: transform 0.2s, box-shadow 0.2s;
}
.card:hover { box-shadow: 0 12px 28px rgba(0,0,0,0.5); border-color: rgba(255,255,255,0.12); }

h2 { font-size: 1.6rem; font-weight: 450; margin-bottom: 18px; color: #fff; }
h3 { font-size: 1.3rem; font-weight: 500; margin-bottom: 18px; color: #f0f0f0; }

/* 统计网格 */
.stat-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 20px; margin: 28px 0; }
.stat-item {
    text-align: center;
    padding: 26px 16px;
    background: rgba(30,30,30,0.6);
    backdrop-filter: blur(4px);
    border-radius: 24px;
    border: 1px solid rgba(255,255,255,0.05);
    transition: transform 0.3s, box-shadow 0.3s;
}
.stat-item:hover { transform: translateY(-4px); box-shadow: 0 10px 20px rgba(0,0,0,0.4); }
.stat-number { font-size: 2.5rem; font-weight: 450; color: #fff; line-height: 1.2; }
.stat-label { font-size: 0.85rem; color: #aaa; margin-top: 8px; }

/* 三大定律 */
.law-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 20px; margin-top: 16px; }
.law-card {
    padding: 24px 18px;
    background: rgba(30,30,30,0.6);
    backdrop-filter: blur(4px);
    border-radius: 24px;
    border: 1px solid rgba(255,255,255,0.05);
    transition: 0.3s;
}
.law-card:hover { transform: translateY(-4px); box-shadow: 0 10px 20px rgba(0,0,0,0.4); }
.law-title { font-size: 1.2rem; font-weight: 500; margin-bottom: 10px; color: #fff; }
.law-desc { color: #bbb; font-size: 0.9rem; line-height: 1.6; }

/* ---------- 帖子卡片 ---------- */
.post-card {
    display: block;
    background: rgba(25,25,25,0.7);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 24px;
    padding: 20px 18px;
    text-decoration: none;
    color: inherit;
    transition: 0.3s;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}
.post-card:hover { transform: translateY(-3px); box-shadow: 0 16px 32px rgba(0,0,0,0.5); border-color: rgba(255,255,255,0.15); }

.post-card-header { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.post-card-avatar { width: 42px; height: 42px; border-radius: 50%; object-fit: cover; border: 1.5px solid #444; }
.post-card-author { display: flex; flex-direction: column; }
.post-card-username { font-weight: 500; color: #f0f0f0; font-size: 0.95rem; }
.post-card-time { font-size: 0.7rem; color: #999; }
.post-card-title { font-size: 1.2rem; font-weight: 500; margin-bottom: 8px; color: #fff; }
.post-card-excerpt { color: #bbb; font-size: 0.9rem; line-height: 1.6; margin-bottom: 12px; }
.post-card-meta { font-size: 0.8rem; color: #aaa; }

/* 删除按钮 */
.delete-btn, .delete-reply-btn {
    background: none;
    border: 1px solid rgba(255,255,255,0.15);
    color: #ccc;
    font-size: 0.8rem;
    padding: 4px 12px;
    border-radius: 40px;
    text-decoration: none;
    transition: 0.2s;
}
.delete-btn:hover, .delete-reply-btn:hover { background: rgba(231,76,60,0.15); border-color: #e74c3c; color: #e74c3c; }

/* ---------- 帖子详情 ---------- */
.post-detail { margin-bottom: 32px; }
.post-detail-header { display: flex; align-items: center; gap: 16px; margin-bottom: 16px; }
.post-detail-avatar { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; border: 2px solid rgba(255,255,255,0.2); }
.post-detail-author { flex: 1; }
.post-detail-username { font-weight: 500; font-size: 1rem; color: #fff; }
.post-detail-time { font-size: 0.75rem; color: #aaa; display: block; }
.post-detail-title { font-size: 1.6rem; font-weight: 500; margin-bottom: 8px; color: #fff; }
.post-divider { border: none; border-top: 1px solid rgba(255,255,255,0.1); margin: 16px 0 20px; }
.post-detail-content { font-size: 1rem; line-height: 1.7; color: #ddd; white-space: pre-line; }

/* 回复区域 */
.reply-section { margin-top: 32px; }
.reply-section-title { font-size: 1.3rem; font-weight: 500; margin-bottom: 20px; color: #fff; }
.reply-item { display: flex; gap: 14px; padding: 16px 0; border-bottom: 1px solid rgba(255,255,255,0.06); }
.reply-item:last-of-type { border-bottom: none; }
.reply-avatar { width: 38px; height: 38px; border-radius: 50%; object-fit: cover; border: 1.5px solid rgba(255,255,255,0.2); flex-shrink: 0; }
.reply-main { flex: 1; }
.reply-header { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 6px; }
.reply-author { font-weight: 600; font-size: 0.95rem; color: #fff; }
.reply-time { font-size: 0.7rem; color: #888; }
.reply-content { color: #ccc; font-size: 0.95rem; line-height: 1.6; word-break: break-word; }
.reply-content.collapsed { max-height: 4.5em; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }
.reply-expand-btn { background: none; border: none; color: #aaa; font-size: 0.8rem; padding: 4px 0; cursor: pointer; margin-top: 4px; }
.reply-expand-btn:hover { color: #fff; }
.reply-form { margin-top: 28px; }
.reply-form .form-input { width: 100%; padding: 14px 18px; background: rgba(20,20,20,0.6); border: 1.5px solid rgba(255,255,255,0.1); border-radius: 20px; color: #fff; font-size: 0.95rem; resize: vertical; }
.reply-form .btn-primary { margin-top: 14px; padding: 12px 28px; background: #fff; color: #111; border: none; border-radius: 40px; font-weight: 600; cursor: pointer; }
.reply-login-hint { margin-top: 24px; text-align: center; color: #aaa; }

/* ---------- 表单 ---------- */
.form-input {
    width: 100%;
    padding: 14px 18px;
    background: rgba(15,15,15,0.6);
    border: 1.5px solid rgba(255,255,255,0.1);
    border-radius: 20px;
    color: #fff;
    font-size: 1rem;
    transition: border 0.2s, box-shadow 0.2s;
    backdrop-filter: blur(4px);
    outline: none;
}
.form-input:focus { border-color: rgba(255,255,255,0.4); box-shadow: 0 0 0 3px rgba(255,255,255,0.05); background: rgba(20,20,20,0.8); }
textarea.form-input { resize: vertical; min-height: 120px; }

.btn {
    padding: 12px 28px;
    background: #f0f0f0;
    color: #111;
    border: none;
    border-radius: 40px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: 0.2s;
}
.btn:hover { background: #fff; transform: translateY(-2px); box-shadow: 0 8px 18px rgba(0,0,0,0.4); }
.btn-sm { padding: 8px 18px; font-size: 0.9rem; }

/* 发帖按钮 */
.desktop-new-post { display: inline-block; }
.dynamic-island-post {
    position: fixed;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(240,240,240,0.9);
    backdrop-filter: blur(12px);
    color: #111;
    padding: 12px 36px;
    border-radius: 40px;
    font-size: 1rem;
    font-weight: 500;
    text-decoration: none;
    box-shadow: 0 12px 30px rgba(0,0,0,0.5);
    z-index: 80;
    transition: 0.3s;
    border: 1px solid rgba(255,255,255,0.2);
    display: none;
}
.dynamic-island-post:hover { background: #fff; transform: translateX(-50%) scale(1.02); }
@media (max-width: 768px) { .dynamic-island-post { display: flex; align-items: center; justify-content: center; } .desktop-new-post { display: none; } }

/* ---------- 模态框 ---------- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(8px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: 0.3s;
}
.modal-overlay.active { opacity: 1; visibility: visible; }
.modal-card {
    background: rgba(30,30,30,0.8);
    backdrop-filter: blur(30px);
    border-radius: 32px;
    width: 90%;
    max-width: 500px;
    padding: 32px 28px;
    box-shadow: 0 40px 80px rgba(0,0,0,0.7);
    transform: scale(0.9);
    opacity: 0;
    transition: transform 0.3s cubic-bezier(0.34,1.56,0.64,1), opacity 0.3s;
    border: 1px solid rgba(255,255,255,0.15);
}
.modal-overlay.active .modal-card { transform: scale(1); opacity: 1; }
.modal-card h2 { font-size: 1.8rem; margin-bottom: 24px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 14px; margin-top: 32px; }
.btn-cancel { padding: 12px 26px; background: transparent; border: 1.5px solid rgba(255,255,255,0.3); border-radius: 40px; color: #fff; cursor: pointer; }
.btn-cancel:hover { background: rgba(255,255,255,0.1); }
.btn-submit { padding: 12px 32px; background: #fff; border: none; border-radius: 40px; color: #111; font-weight: 600; cursor: pointer; }

/* 登录/注册卡片 */
.auth-container { display: flex; align-items: center; justify-content: center; min-height: calc(100vh - 140px); padding: 40px 20px; }
.auth-card {
    max-width: 440px;
    width: 100%;
    background: rgba(25,25,25,0.7);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 36px;
    padding: 40px 36px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.5);
}
.auth-card h2 { text-align: center; margin-bottom: 32px; font-size: 2rem; }
.auth-footer { text-align: center; margin-top: 28px; color: #ccc; }
.auth-footer a { color: #fff; text-decoration: underline; }

/* 排行榜表格 */
.table-wrapper { overflow-x: auto; }
.ranking-table { width: 100%; border-collapse: collapse; min-width: 680px; }
.ranking-table th { text-align: left; padding: 16px 12px; color: #bbb; border-bottom: 1.5px solid #333; }
.ranking-table td { padding: 18px 12px; border-bottom: 1px solid #2a2a2a; color: #ddd; }
.ranking-table tr:hover td { background: rgba(255,255,255,0.05); }
.level-badge { display: inline-block; padding: 4px 12px; border-radius: 40px; font-size: 0.75rem; font-weight: 600; background: #333; color: #f0f0f0; }
.level-Splus { background: #fff; color: #000; }
.level-S { background: #ccc; color: #000; }
.level-A { background: #999; color: #000; }
.level-B { background: #666; color: #fff; }

/* 页脚 */
.footer { border-top: 1px solid #2a2a2a; padding: 24px 16px; text-align: center; font-size: 0.8rem; color: #888; margin-top: auto; }

/* 响应式 */
@media (max-width: 768px) {
    .top-bar-container { height: 56px; }
    .site-title { font-size: 1.1rem; }
    .stat-grid, .law-grid { grid-template-columns: 1fr; }
    .card { padding: 22px 18px; }
    .post-card-title { font-size: 1.1rem; }
    .sidebar { width: 200px; }
}