* {
    box-sizing: border-box;
}

/* ------------------------------------
   全局
------------------------------------ */
body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
                 "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    background-color: #f7f4ef;
    color: #333;
}

.page-wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ------------------------------------
   顶部导航
------------------------------------ */
.site-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 40px;
    border-bottom: 1px solid #e0ddd5;
    background-color: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(6px);
    position: sticky;
    top: 0;
    z-index: 10;
}

.logo {
    font-size: 20px;
    letter-spacing: 3px;
    font-weight: 600;
}

.main-nav .nav-link {
    margin-left: 16px;
    text-decoration: none;
    color: #555;
    font-size: 14px;
}

.main-nav .nav-link:hover {
    color: #000;
}

.user-nav {
    margin-left: 20px;
}

.user-nav a {
    margin-left: 10px;
    color: #444;
    text-decoration: none;
}
.user-nav a:hover {
    color: #000;
}

.site-content {
    flex: 1;
}

.site-footer {
    text-align: center;
    padding: 16px;
    font-size: 12px;
    color: #888;
}

/* ------------------------------------
   首页
------------------------------------ */
.home-hero {
    min-height: calc(100vh - 120px);
    background-size: cover;
    background-position: center;
    position: relative;
}

.home-overlay {
    background: rgba(247, 244, 239, 0.9);
    width: 100%;
    height: 100%;
    padding: 40px;
    display: flex;
    flex-direction: column;
    gap: 32px;
}

.home-greeting h1 {
    margin: 0 0 12px;
    font-size: 24px;
}

.greeting-text {
    white-space: pre-wrap;
    line-height: 1.7;
    font-size: 14px;
    color: #555;
    padding: 12px 16px;
    border-left: 3px solid #d1c5ae;
    background-color: rgba(255, 255, 255, 0.8);
}

.category-links {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.category-card {
    padding: 10px 18px;
    border-radius: 999px;
    border: 1px solid #d5cec0;
    background-color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    color: #444;
    font-size: 14px;
    transition: all 0.2s ease;
}

.category-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.04);
}

/* ------------------------------------
   阅读布局
------------------------------------ */
.reader-layout {
    display: flex;
    min-height: calc(100vh - 140px);
}

/* ----- 左侧栏 ----- */
.reader-sidebar {
    width: 260px;
    border-right: 1px solid #e0ddd5;
    padding: 20px;
    background-color: #f9f6f1;
    transition: width 0.3s ease, opacity 0.3s ease;
}

.reader-sidebar.hidden {
    width: 0 !important;
    opacity: 0;
    overflow: hidden;
}

.reader-sidebar h2 {
    margin-top: 0;
    font-size: 18px;
    margin-bottom: 12px;
}

.work-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.work-list li {
    margin-bottom: 8px;
}

.work-list a {
    text-decoration: none;
    color: #555;
    font-size: 14px;
}
.work-list a:hover {
    color: #000;
}

/* ----- 右侧内容区域 ----- */
.reader-content {
    flex: 1;
    padding: 24px 40px;
    position: relative;
}

.reader-content.expand {
    margin-left: 0 !important;
}

/* 背景图模式 */
.reader-content.reader-has-bg {
    background-size: cover;
    background-position: center;
}

.reader-content.reader-has-bg::before {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(247, 244, 239, 0.85);
    pointer-events: none;
}

.reader-content .work-title,
.reader-content .work-meta,
.reader-content .work-body,
.reader-content .like-section,
.reader-content h3,
.reader-content #comment-list {
    position: relative;
}

/* ------------------------------------
   文字与正文
------------------------------------ */
.work-title {
    margin-top: 0;
    font-size: 22px;
    margin-bottom: 8px;
}

.work-meta {
    font-size: 13px;
    color: #999;
    margin-bottom: 18px;
}

.work-body {
    line-height: 1.8;
    font-size: 15px;
}

.work-body img {
    max-width: 80%;   /* 宽度限制为阅读区域的 80%，你可以改 */
    height: auto;     /* 自动按比例缩放 */
    display: block;
    margin: 20px auto;  /* 居中并留点空隙 */
    border-radius: 6px; /* 可选：圆角更好看 */
}


/* 阅读器工具栏 */
.reader-toolbar button {
    margin-right: 6px;
    padding: 2px 8px;
    font-size: 12px;
}

/* BGM */
.audio-player {
    margin-bottom: 12px;
}

/* ------------------------------------
   评论区
------------------------------------ */
#comment-text {
    width: 100%;
    min-height: 70px;
    padding: 12px;
    font-size: 15px;
    border: 1px solid #bbb;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.85);
    color: #333;
    backdrop-filter: blur(4px);
}
#comment-text:focus {
    outline: none;
    border-color: #D2691E;
    background: rgba(255, 255, 255, 0.95);
}

#comment-btn {
    background: #D2691E;
    color: #fff;
    padding: 10px 20px;
    font-size: 15px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    margin-top: 6px;
    backdrop-filter: blur(3px);
    box-shadow: 0 2px 6px rgba(0,0,0,0.25);
}
#comment-btn:hover {
    background: #b85a1b;
}

.comment-item {
    padding: 8px 0;
    border-bottom: 1px solid #e3e3e3;
}

.c-time {
    font-size: 12px;
    color: #999;
}

.del-btn {
    font-size: 12px;
    background-color: #dd4444;
    color: #fff;
    border: none;
    padding: 2px 8px;
    margin-top: 4px;
    cursor: pointer;
}

.comment-reply {
    position: relative;
    z-index: 2;
    margin-left: 20px;
    padding-left: 10px;
    border-left: 2px solid #ddd;
}
/* 楼中楼缩进 */
.replies {
    margin-left: 22px;
    border-left: 2px solid #ddd;
    padding-left: 12px;
}

.comment-item {
    margin-bottom: 10px;
    position: relative;  
    z-index: 3;   /* 不要被背景遮罩覆盖 */
}

.comment-reply {
    position: relative;
    z-index: 3;
}



/* ------------------------------------
   点赞动画
------------------------------------ */
.like-animate {
    animation: likePop 0.35s ease-out;
}

@keyframes likePop {
    0%   { transform: scale(1); }
    30%  { transform: scale(1.4); }
    60%  { transform: scale(0.9); }
    100% { transform: scale(1); }
}

/* ------------------------------------
   首页按钮（返回首页）
------------------------------------ */
.back-home-btn {
    display: inline-block;
    padding: 6px 14px;
    margin-right: 10px;
    background: #D2691E;
    color: white;
    border-radius: 6px;
    text-decoration: none;
    font-size: 14px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.25);
    transition: background 0.2s ease;
}
.back-home-btn:hover {
    background: #b85a1b;
}

/* ------------------------------------
   左侧栏隐藏按钮
------------------------------------ */
#toggle-sidebar {
    position: absolute;
    left: 10px;
    top: 10px;
    padding: 6px 10px;
    background: rgba(210, 105, 30, 0.85);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    z-index: 50;
}
#toggle-sidebar:hover {
    background: rgba(180, 90, 20, 0.9);
}


/* ------------------------------------
   夜间模式（统一作用于 body）
------------------------------------ */
body.night-mode {
    background: #202124;
    color: #eee;
}

body.night-mode .reader-sidebar {
    background: rgba(30, 30, 30, 0.9) !important;
    color: #eee;
}

body.night-mode .reader-sidebar a {
    color: #ddd;
}
body.night-mode .reader-sidebar a:hover {
    color: #fff;
}

body.night-mode #toggle-sidebar {
    background: rgba(80, 80, 80, 0.85);
    color: #fff;
}

body.night-mode #comment-text {
    background: rgba(40, 40, 40, 0.85);
    color: #eee;
    border-color: #666;
}

body.night-mode #comment-btn {
    background: #A0522D;
}

body.night-mode .work-meta {
    color: #bbb;
}

body.night-mode .c-time {
    color: #888;
}

/* 夜间模式 + 背景图遮罩变暗 */
body.night-mode .reader-content.reader-has-bg::before {
    background: rgba(20, 20, 20, 0.8);
}

body.night-mode .comment-reply {
    border-left-color: #555;
}

body.night-mode .replies {
    border-left-color: #555;
}
