/* ============================================================
   写作辅助：专注/禅模式 + 灵感速记便签
   样式独立于 style.css，挂在主样式之后，便于覆盖 .le-body 等规则。
   ============================================================ */

/* ---------- 禅模式：纯沉浸写作（只剩正文编辑区，占满整屏） ---------- */
body.zen { overflow: hidden; }

/* 隐藏一切与正文无关的外围：页头/页脚/侧栏/作品信息表单/侧栏/操作栏 */
body.zen .site-header,
body.zen .site-footer,
body.zen .member-nav,
body.zen .member-page-title,
body.zen .draft-banner,
body.zen .pf-side,
body.zen .pf-actions,
body.zen .autosave-hint,
body.zen .pf-section,
body.zen #f-genre,
body.zen #f-novel-only,
body.zen #f-long-only,
body.zen .pf-details,
body.zen .pf-main > label:not(#f-body-box),
body.zen #f-body-box > span { display: none !important; }

/* 布局归零，正文占满整个视口宽高 */
body.zen .member-layout { display: block; }
body.zen .member-main {
    width: 100%; height: 100vh; max-width: none; margin: 0; padding: 0;
    display: flex;
}
body.zen .post-form-grid { display: block; width: 100%; height: 100%; max-width: none; }
body.zen .pf-main {
    width: 100%; height: 100%; gap: 0; padding: 0; margin: 0;
    display: flex; flex-direction: column;
}

/* 正文框占满整屏 */
body.zen #f-body-box {
    display: flex !important; flex-direction: column;
    width: 100%; height: 100%; margin: 0; padding: 0; border: 0;
}
body.zen .rich-editor {
    display: flex; flex-direction: column; flex: 1 1 auto;
    width: 100%; height: 100%; max-height: none;
    border: 0; border-radius: 0; background: transparent; box-shadow: none; overflow: hidden;
}
body.zen .le-wrap {
    display: flex; flex-direction: column; flex: 1 1 auto;
    width: 100%; height: 100%; max-height: none;
    border: 0; border-radius: 0; background: transparent; box-shadow: none; overflow: hidden;
}
/* 纯沉浸：隐藏工具栏与排版条 */
body.zen .le-toolbar,
body.zen .le-typeset { display: none !important; }
/* 当前行居中依赖 .le-body 自身滚动；衬线 + 舒适行距 */
body.zen .le-body {
    flex: 1 1 auto; width: 100%; min-height: 0;
    max-height: none; height: auto; overflow-y: auto; outline: none;
    font-family: Georgia, "Times New Roman", "Songti SC", "Noto Serif SC", "Source Han Serif SC", serif;
    font-size: 19px; line-height: 2.05;
    padding: 40px clamp(24px, 8vw, 120px) 140px;
}
body.zen .le-body p { margin: 0 0 1.1em; text-align: justify; }

/* 禅模式开关 */
#zen-enter {
    position: fixed; right: 16px; bottom: 78px; z-index: 40;
    border: 1px solid var(--c-border); background: var(--c-bg); color: var(--c-fg);
    border-radius: 999px; padding: 8px 14px; font-size: 13px; cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .08);
}
#zen-enter:hover { border-color: var(--c-primary); color: var(--c-primary); }
#zen-exit {
    position: fixed; top: 14px; right: 14px; z-index: 60; display: none;
    border: 1px solid var(--c-border); background: var(--c-bg); color: var(--c-fg);
    border-radius: 999px; padding: 8px 14px; font-size: 13px; cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .08);
}
body.zen #zen-enter { display: none; }
body.zen #zen-exit { display: block; }

/* ---------- 灵感速记便签 ---------- */
#notepad-root { position: fixed; right: 16px; bottom: 16px; z-index: 55; }
.np-fab {
    width: 50px; height: 50px; border-radius: 50%;
    border: 1px solid var(--c-border);
    background: var(--c-primary); color: #fff; font-size: 20px; cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, .18);
}
.np-fab:hover { filter: brightness(1.05); }
.np-panel {
    position: absolute; bottom: 62px; right: 0; width: 320px; max-width: 88vw;
    background: var(--c-bg); border: 1px solid var(--c-border); border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, .18); padding: 12px;
    display: flex; flex-direction: column; gap: 8px;
}
/* 确保 hidden 属性能真正收起面板（作者样式优先级高于 UA 的 [hidden]{display:none}） */
.np-panel[hidden] { display: none !important; }
.np-head { display: flex; justify-content: space-between; align-items: center; font-weight: 600; }
.np-close {
    border: 0; background: transparent; font-size: 20px; line-height: 1;
    cursor: pointer; color: var(--c-muted); padding: 0 4px;
}
.np-cur {
    width: 100%; min-height: 84px; resize: vertical;
    border: 1px solid var(--c-border); border-radius: 8px; padding: 8px;
    font-size: 14px; font-family: inherit; background: var(--c-bg-soft); color: var(--c-fg);
}
.np-actions { display: flex; align-items: center; gap: 8px; }
.np-save {
    border: 1px solid var(--c-border); background: var(--c-bg-soft); color: var(--c-fg);
    border-radius: 6px; padding: 5px 12px; font-size: 13px; cursor: pointer;
}
.np-save:hover { border-color: var(--c-primary); color: var(--c-primary); }
.np-hint { font-size: 12px; color: var(--c-muted); }
.np-list { display: flex; flex-direction: column; gap: 6px; max-height: 210px; overflow-y: auto; }
.np-list .muted { font-size: 12px; margin: 2px 0; }
.np-item { border: 1px solid var(--c-border); border-radius: 8px; padding: 8px; background: var(--c-bg-soft); }
.np-item .np-text {
    font-size: 13px; line-height: 1.5; color: var(--c-fg);
    white-space: pre-wrap; word-break: break-word; max-height: 60px; overflow: hidden;
}
.np-item .np-meta { display: flex; gap: 10px; margin-top: 6px; }
.np-item button {
    border: 0; background: transparent; color: var(--c-primary);
    font-size: 12px; cursor: pointer; padding: 0;
}
.np-item .np-del { color: var(--c-muted); }
.np-item .np-del:hover { color: #d33; }
/* 尚未同步到云端的便签（离线保存 / 联网失败）以虚线边框提示 */
.np-item.np-unsynced { border-style: dashed; opacity: .82; }

.np-toast {
    position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%); z-index: 70;
    background: rgba(0, 0, 0, .82); color: #fff; padding: 8px 16px; border-radius: 999px;
    font-size: 13px; opacity: 0; transition: opacity .25s; pointer-events: none; white-space: nowrap;
}
.np-toast.show { opacity: 1; }

@media (max-width: 760px) {
    .np-panel { width: 300px; }
    #zen-enter { bottom: 74px; }
}
