/* ==================== 1. 设计系统与基础变量 ==================== */
@font-face {
    font-family: DNMrHsV173Pd4pgy;
    font-display: swap;
    src:
        url("https://lf6-awef.bytetos.com/obj/awesome-font/c/dc027189e0ba4cd.woff2") format("woff2"),
        url("https://lf3-awef.bytetos.com/obj/awesome-font/c/dc027189e0ba4cd.woff2") format("woff2");
    font-weight: 400;
}

@font-face {
    font-family: DNMrHsV173Pd4pgy;
    font-display: swap;
    src:
        url("https://lf6-awef.bytetos.com/obj/awesome-font/c/dc027189e0ba4cd-500.woff2") format("woff2"),
        url("https://lf3-awef.bytetos.com/obj/awesome-font/c/dc027189e0ba4cd-500.woff2") format("woff2");
    font-weight: 500;
}

@font-face {
    font-family: DNMrHsV173Pd4pgy;
    font-display: swap;
    src:
        url("https://lf6-awef.bytetos.com/obj/awesome-font/c/dc027189e0ba4cd-700.woff2") format("woff2"),
        url("https://lf3-awef.bytetos.com/obj/awesome-font/c/dc027189e0ba4cd-700.woff2") format("woff2");
    font-weight: 700;
}

.font-DNMrHsV173Pd4pgy {
    font-family: DNMrHsV173Pd4pgy, var(--font-primary);
}

:root {
    /* 字体族 */
    --font-primary: 'Outfit', 'Inter', 'Noto Sans SC', sans-serif;
    
    /* 日间模式变量 */
    --bg-main: #f4f7f6;
    --bg-card: rgba(255, 255, 255, 0.75);
    --bg-card-solid: #ffffff;
    --bg-sidebar: #ffffff;
    --border-color: rgba(230, 235, 232, 0.8);
    --border-color-solid: #e0e6e3;
    --text-main: #2c3e2e;
    --text-muted: #708075;
    --logo-text-color: #5c3b1e;
    
    /* 核心调色板 (清新招财绿) */
    --primary-color: #2e7d32;
    --primary-light: #e8f5e9;
    --primary-hover: #1b5e20;
    --primary-glow: rgba(46, 125, 50, 0.25);
    
    --accent-color: #ff9100;
    --accent-light: #fff3e0;
    --accent-hover: #ff6d00;
    
    --danger-color: #d32f2f;
    --danger-light: #ffebee;
    
    --blue-color: #0288d1;
    --blue-light: #e1f5fe;
    
    --purple-color: #7b1fa2;
    --purple-light: #f3e5f5;
    
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 8px 24px rgba(46, 125, 50, 0.06);
    --shadow-lg: 0 16px 36px rgba(0, 0, 0, 0.08);
    
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 24px;
    
    --sidebar-width: 240px;
    --header-height: 70px;
    --editor-left-nav-width: 70px;
    --editor-sub-panel-width: 252px;
    --editor-right-ai-width: 520px;
    --editor-sub-panel-min-width: 180px;
    --editor-sub-panel-max-width: 420px;
    --editor-right-ai-min-width: 420px;
    --editor-right-ai-max-width: 600px;
}

/* 夜间模式变量 (应用于作家端 .dark-theme 或管理员后台) */
.dark-theme, body.dark-theme {
    --bg-main: #0d1117;
    --bg-card: rgba(22, 27, 34, 0.8);
    --bg-card-solid: #161b22;
    --bg-sidebar: #161b22;
    --border-color: rgba(48, 54, 61, 0.6);
    --border-color-solid: #30363d;
    --text-main: #c9d1d9;
    --text-muted: #8b949e;
    --logo-text-color: #f0f6fc;
    
    --primary-color: #4caf50;
    --primary-light: rgba(76, 175, 80, 0.15);
    --primary-hover: #66bb6a;
    --primary-glow: rgba(76, 175, 80, 0.4);
    
    --accent-color: #ffab40;
    --accent-light: rgba(255, 171, 64, 0.15);
    
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.4);
}

/* ==================== 2. 全局重置与排版 ==================== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-primary);
    background-color: var(--bg-main);
    color: var(--text-main);
    font-size: 15px;
    line-height: 1.6;
    overflow-x: hidden;
    scrollbar-gutter: stable;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* 低干扰滚动条 */
html {
    scrollbar-width: thin;
    scrollbar-color: rgba(113, 128, 117, 0.34) transparent;
}
body.dark-theme {
    scrollbar-color: rgba(139, 148, 158, 0.32) rgba(13, 17, 23, 0.12);
}
html::-webkit-scrollbar,
body::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
html::-webkit-scrollbar-track,
body::-webkit-scrollbar-track {
    background: transparent;
}
html::-webkit-scrollbar-thumb,
body::-webkit-scrollbar-thumb {
    background: rgba(113, 128, 117, 0.28);
    border: 2px solid transparent;
    border-radius: 999px;
    background-clip: padding-box;
}
body.dark-theme::-webkit-scrollbar-thumb {
    background: rgba(139, 148, 158, 0.26);
    border: 2px solid rgba(13, 17, 23, 0.78);
    background-clip: padding-box;
}
html::-webkit-scrollbar-thumb:hover,
body::-webkit-scrollbar-thumb:hover {
    background: rgba(76, 175, 80, 0.56);
    background-clip: padding-box;
}
.premium-scrollbar,
.subview,
.dashboard-left-col,
.pane-body-scroll,
.content-viewport,
.editor-left-nav,
.editor-sub-panel,
.editor-textarea,
.editor-right-ai-panel,
.ai-pane-content,
.preview-body,
.chat-messages-container,
.chat-input-textarea,
.ai-requirement-textarea,
.relation-detail-list,
.modal-body,
.book-info-modal-body,
.form-textarea,
.admin-textarea {
    scrollbar-width: thin;
    scrollbar-color: rgba(113, 128, 117, 0.28) transparent;
    scrollbar-gutter: stable;
}
body.dark-theme .premium-scrollbar,
body.dark-theme .subview,
body.dark-theme .dashboard-left-col,
body.dark-theme .pane-body-scroll,
body.dark-theme .content-viewport,
body.dark-theme .editor-left-nav,
body.dark-theme .editor-sub-panel,
body.dark-theme .editor-textarea,
body.dark-theme .editor-right-ai-panel,
body.dark-theme .ai-pane-content,
body.dark-theme .preview-body,
body.dark-theme .chat-messages-container,
body.dark-theme .chat-input-textarea,
body.dark-theme .ai-requirement-textarea,
body.dark-theme .relation-detail-list,
body.dark-theme .modal-body,
body.dark-theme .book-info-modal-body,
body.dark-theme .form-textarea,
body.dark-theme .admin-textarea {
    scrollbar-color: rgba(139, 148, 158, 0.26) transparent;
}
.premium-scrollbar::-webkit-scrollbar,
.subview::-webkit-scrollbar,
.dashboard-left-col::-webkit-scrollbar,
.pane-body-scroll::-webkit-scrollbar,
.content-viewport::-webkit-scrollbar,
.editor-left-nav::-webkit-scrollbar,
.editor-sub-panel::-webkit-scrollbar,
.editor-textarea::-webkit-scrollbar,
.editor-right-ai-panel::-webkit-scrollbar,
.ai-pane-content::-webkit-scrollbar,
.preview-body::-webkit-scrollbar,
.chat-messages-container::-webkit-scrollbar,
.chat-input-textarea::-webkit-scrollbar,
.ai-requirement-textarea::-webkit-scrollbar,
.relation-detail-list::-webkit-scrollbar,
.modal-body::-webkit-scrollbar,
.book-info-modal-body::-webkit-scrollbar,
.form-textarea::-webkit-scrollbar,
.admin-textarea::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
.premium-scrollbar::-webkit-scrollbar-track,
.subview::-webkit-scrollbar-track,
.dashboard-left-col::-webkit-scrollbar-track,
.pane-body-scroll::-webkit-scrollbar-track,
.content-viewport::-webkit-scrollbar-track,
.editor-left-nav::-webkit-scrollbar-track,
.editor-sub-panel::-webkit-scrollbar-track,
.editor-textarea::-webkit-scrollbar-track,
.editor-right-ai-panel::-webkit-scrollbar-track,
.ai-pane-content::-webkit-scrollbar-track,
.preview-body::-webkit-scrollbar-track,
.chat-messages-container::-webkit-scrollbar-track,
.chat-input-textarea::-webkit-scrollbar-track,
.ai-requirement-textarea::-webkit-scrollbar-track,
.relation-detail-list::-webkit-scrollbar-track,
.modal-body::-webkit-scrollbar-track,
.book-info-modal-body::-webkit-scrollbar-track,
.form-textarea::-webkit-scrollbar-track,
.admin-textarea::-webkit-scrollbar-track {
    background: transparent;
}
.premium-scrollbar::-webkit-scrollbar-thumb,
.subview::-webkit-scrollbar-thumb,
.dashboard-left-col::-webkit-scrollbar-thumb,
.pane-body-scroll::-webkit-scrollbar-thumb,
.content-viewport::-webkit-scrollbar-thumb,
.editor-left-nav::-webkit-scrollbar-thumb,
.editor-sub-panel::-webkit-scrollbar-thumb,
.editor-textarea::-webkit-scrollbar-thumb,
.editor-right-ai-panel::-webkit-scrollbar-thumb,
.ai-pane-content::-webkit-scrollbar-thumb,
.preview-body::-webkit-scrollbar-thumb,
.chat-messages-container::-webkit-scrollbar-thumb,
.chat-input-textarea::-webkit-scrollbar-thumb,
.ai-requirement-textarea::-webkit-scrollbar-thumb,
.relation-detail-list::-webkit-scrollbar-thumb,
.modal-body::-webkit-scrollbar-thumb,
.book-info-modal-body::-webkit-scrollbar-thumb,
.form-textarea::-webkit-scrollbar-thumb,
.admin-textarea::-webkit-scrollbar-thumb {
    background: rgba(113, 128, 117, 0.22);
    border: 2px solid transparent;
    border-radius: 999px;
    background-clip: padding-box;
}
.premium-scrollbar::-webkit-scrollbar-thumb:hover,
.subview::-webkit-scrollbar-thumb:hover,
.dashboard-left-col::-webkit-scrollbar-thumb:hover,
.pane-body-scroll::-webkit-scrollbar-thumb:hover,
.content-viewport::-webkit-scrollbar-thumb:hover,
.editor-left-nav::-webkit-scrollbar-thumb:hover,
.editor-sub-panel::-webkit-scrollbar-thumb:hover,
.editor-textarea::-webkit-scrollbar-thumb:hover,
.editor-right-ai-panel::-webkit-scrollbar-thumb:hover,
.ai-pane-content::-webkit-scrollbar-thumb:hover,
.preview-body::-webkit-scrollbar-thumb:hover,
.chat-messages-container::-webkit-scrollbar-thumb:hover,
.chat-input-textarea::-webkit-scrollbar-thumb:hover,
.ai-requirement-textarea::-webkit-scrollbar-thumb:hover,
.relation-detail-list::-webkit-scrollbar-thumb:hover,
.modal-body::-webkit-scrollbar-thumb:hover,
.book-info-modal-body::-webkit-scrollbar-thumb:hover,
.form-textarea::-webkit-scrollbar-thumb:hover,
.admin-textarea::-webkit-scrollbar-thumb:hover {
    background: rgba(76, 175, 80, 0.52);
    background-clip: padding-box;
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.2s;
}
a:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

input, select, textarea, button {
    font-family: inherit;
    font-size: inherit;
    color: inherit;
}

button {
    cursor: pointer;
    border: none;
    background: none;
    outline: none;
}

/* ==================== 3. 通用组件样式 ==================== */
/* 磨砂玻璃质感 */
.glassmorphism {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
    border-radius: var(--radius-md);
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.glassmorphism:hover {
    box-shadow: var(--shadow-lg);
    border-color: rgba(46, 125, 50, 0.15);
}

/* 按钮系统 */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-weight: 500;
    gap: 8px;
    transition: all 0.2s ease;
}
.btn-lg {
    padding: 12px 24px;
    font-size: 16px;
    border-radius: var(--radius-md);
}
.btn-sm {
    padding: 5px 10px;
    font-size: 13px;
    border-radius: var(--radius-sm);
}
.btn-xs {
    padding: 3px 6px;
    font-size: 12px;
    border-radius: 4px;
}
.btn-block {
    display: flex;
    width: 100%;
}
.btn-primary {
    background-color: var(--primary-color);
    color: white !important;
}
.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px var(--primary-glow);
}
.btn-accent {
    background-color: var(--accent-color);
    color: white !important;
}
.btn-accent:hover {
    background-color: var(--accent-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 145, 0, 0.3);
}
.btn-outline-primary {
    border: 1px solid var(--primary-color);
    color: var(--primary-color);
}
.btn-outline-primary:hover {
    background-color: var(--primary-light);
}
.btn-outline-secondary {
    border: 1px solid var(--border-color-solid);
    color: var(--text-main);
}
.btn-outline-secondary:hover {
    background-color: rgba(0, 0, 0, 0.03);
}
.dark-theme .btn-outline-secondary:hover {
    background-color: rgba(255, 255, 255, 0.05);
}
.btn-outline-danger {
    border: 1px solid var(--danger-color);
    color: var(--danger-color);
}
.btn-outline-danger:hover {
    background-color: var(--danger-light);
}
.btn-outline-purple {
    border: 1px solid var(--purple-color);
    color: var(--purple-color);
}
.btn-outline-purple:hover {
    background-color: var(--purple-light);
}
.btn-outline-blue {
    border: 1px solid var(--blue-color);
    color: var(--blue-color);
}
.btn-outline-blue:hover {
    background-color: var(--blue-light);
}
.btn-outline-orange {
    border: 1px solid var(--accent-color);
    color: var(--accent-color);
}
.btn-outline-orange:hover {
    background-color: var(--accent-light);
}
.btn-outline-accent {
    border: 1px solid var(--accent-color);
    color: var(--accent-color);
}
.btn-outline-accent:hover {
    background-color: var(--accent-color);
    color: white;
}

/* 标签系统 */
.badge {
    display: inline-block;
    padding: 2px 6px;
    font-size: 11px;
    border-radius: 4px;
    font-weight: 600;
}
.badge-accent {
    background-color: var(--accent-light);
    color: var(--accent-color);
}
.badge-hot {
    background-color: #ffebee;
    color: #f44336;
}
.dark-theme .badge-hot {
    background-color: rgba(244, 67, 54, 0.2);
    color: #ff8a80;
}

/* 动态点闪烁 */
.dot-blink {
    display: inline-block;
    width: 8px;
    height: 8px;
    background-color: #4caf50;
    border-radius: 50%;
    margin-right: 6px;
    animation: blink-anim 1.5s infinite;
}
@keyframes blink-anim {
    0% { opacity: 0.3; }
    50% { opacity: 1; }
    100% { opacity: 0.3; }
}

/* ==================== 4. 路由系统 (SPA 展现) ==================== */
.view-container {
    display: none;
    opacity: 0;
    transition: opacity 0.4s ease;
    height: 100vh;
}
.view-container.active {
    display: flex;
    opacity: 1;
}

.subview {
    display: none;
    opacity: 0;
    animation: fade-in 0.3s forwards;
    height: calc(100vh - var(--header-height) - 30px);
    overflow-y: auto;
    padding-right: 5px;
}
.subview.active {
    display: block;
}

@keyframes fade-in {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ==================== 5. 登录页面样式 ==================== */
.login-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #fffaf2 0%, #ffdfb3 100%);
    position: relative;
    overflow: hidden;
}

.login-left {
    display: flex;
    flex-direction: column;
    padding: 30px 35px;
    background: rgba(255, 255, 255, 0.72);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 24px;
    border: 1px solid rgba(255, 255, 255, 0.45);
    box-shadow: 0 20px 50px rgba(92, 59, 30, 0.08);
    width: 100%;
    max-width: 420px;
    z-index: 10;
    margin: 0 auto;
    transition: background-color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

.login-header-logo {
    display: flex;
    align-items: center;
    gap: 12px;
}
.logo-text h2 {
    font-size: 20px;
    font-weight: 700;
    color: var(--logo-text-color);
}
.logo-text span {
    font-size: 12px;
    color: var(--text-muted);
}
.green-glow {
    filter: drop-shadow(0 4px 8px rgba(46, 125, 50, 0.15));
}

.login-card-container {
    max-width: 420px;
    width: 100%;
    margin: 40px auto;
}

.login-tabs {
    display: flex;
    border-bottom: 2px solid var(--border-color-solid);
    margin-bottom: 30px;
}
.login-tab {
    flex: 1;
    text-align: center;
    padding: 12px;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-muted);
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s;
}
.login-tab:hover {
    color: var(--primary-color);
}
.login-tab.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.login-form-pane {
    display: none;
    animation: fade-in 0.25s forwards;
}
.login-form-pane.active {
    display: block;
}

.form-title {
    font-size: 26px;
    font-weight: 800;
    color: var(--text-main);
    margin-bottom: 24px;
}
.sub-slogan {
    font-size: 14px;
    font-weight: 400;
    color: var(--text-muted);
    display: block;
    margin-top: 4px;
}

.form-group {
    margin-bottom: 18px;
}
.input-wrapper {
    display: flex;
    align-items: center;
    background-color: var(--bg-main);
    border: 1px solid var(--border-color-solid);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.input-wrapper:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-glow);
}
.input-icon {
    margin-right: 12px;
    font-size: 18px;
}
.input-wrapper input {
    border: none;
    background: transparent;
    outline: none;
    width: 100%;
    font-size: 15px;
    color: var(--text-main);
}
.input-wrapper input::placeholder {
    color: var(--text-muted);
}
.password-toggle {
    cursor: pointer;
    user-select: none;
}

.form-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    font-size: 14px;
}
.checkbox-container {
    display: flex;
    align-items: center;
    position: relative;
    padding-left: 26px;
    cursor: pointer;
    user-select: none;
}
.checkbox-container input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}
.checkmark {
    position: absolute;
    left: 0;
    height: 18px;
    width: 18px;
    background-color: var(--bg-card-solid);
    border: 2px solid var(--border-color-solid);
    border-radius: 4px;
    transition: all 0.2s;
}
.checkbox-container:hover input ~ .checkmark {
    border-color: var(--primary-color);
}
.checkbox-container input:checked ~ .checkmark {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}
.checkmark:after {
    content: "";
    position: absolute;
    display: none;
}
.checkbox-container input:checked ~ .checkmark:after {
    display: block;
}
.checkbox-container .checkmark:after {
    left: 5px;
    top: 1px;
    width: 4px;
    height: 9px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.register-tip {
    text-align: center;
    margin-top: 20px;
    font-size: 14px;
    color: var(--text-muted);
}

/* 登录页暗黑模式专项适配 */
.dark-theme .login-wrapper {
    background: linear-gradient(135deg, #090d13 0%, #161b22 100%);
}
.dark-theme .login-left {
    background: rgba(22, 27, 34, 0.72);
    border: 1px solid rgba(48, 54, 61, 0.45);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
}
.dark-theme .preview-cat-container {
    opacity: 0.07;
    filter: drop-shadow(0 15px 30px rgba(0, 0, 0, 0.4));
}

/* 登录页右边预览 - 升级为温馨高端的招财猫动画插图插画墙 (作为背景悬浮水印) */
.login-right-preview {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: block;
    pointer-events: none;
    z-index: 1; /* 在卡片下方 */
    background: transparent;
    padding: 0;
    overflow: hidden;
}
.login-right-preview::before {
    content: "";
    position: absolute;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(255, 179, 0, 0.22) 0%, transparent 70%);
    bottom: -150px;
    right: -150px;
}

/* 漂浮动画背景元素 */
.bg-sparkles {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}
.sparkle {
    position: absolute;
    font-size: 24px;
    opacity: 0;
    animation: sparkles-float 6s ease-in-out infinite;
}
.sparkle.s1 { left: 8%; top: 25%; animation-delay: 0s; font-size: 28px; }
.sparkle.s2 { left: 22%; top: 78%; animation-delay: 2s; font-size: 24px; }
.sparkle.s3 { left: 78%; top: 12%; animation-delay: 1s; font-size: 26px; }
.sparkle.s4 { left: 70%; top: 62%; animation-delay: 3s; font-size: 22px; }
.sparkle.s5 { left: 12%; top: 48%; animation-delay: 4s; font-size: 20px; }
.sparkle.s6 { left: 82%; top: 40%; animation-delay: 1.5s; font-size: 25px; }

@keyframes sparkles-float {
    0% {
        transform: translateY(30px) scale(0.6);
        opacity: 0;
    }
    30% {
        opacity: 0.6;
    }
    70% {
        opacity: 0.6;
    }
    100% {
        transform: translateY(-80px) scale(1.1);
        opacity: 0;
    }
}

.landing-illustration-container {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
}

.preview-cat-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 520px; /* Bounding box slightly wider than login box (420px) to peek out */
    height: auto;
    opacity: 0.12; /* 若隐若现 */
    filter: drop-shadow(0 15px 30px rgba(184, 115, 51, 0.1));
    animation: login-cat-bob 5s ease-in-out infinite;
    pointer-events: none;
    z-index: 2;
}

.landing-mascot-img {
    width: 100%;
    height: auto;
    display: block;
}

/* 身体轻微呼吸起伏 - 仪表盘横幅使用（标准定位） */
@keyframes cat-bob {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

/* 身体轻微呼吸起伏 - 登录页使用（绝对居中定位） */
@keyframes login-cat-bob {
    0%, 100% { transform: translate(-50%, -50%); }
    50% { transform: translate(-50%, calc(-50% - 12px)); }
}

/* 左耳转动 */
.cat-left-ear {
    transform-origin: 44px 32px;
    animation: ear-twitch-left 6s ease-in-out infinite;
}
@keyframes ear-twitch-left {
    0%, 80%, 100% { transform: rotate(0deg); }
    82%, 86% { transform: rotate(-5deg); }
    84% { transform: rotate(1deg); }
}

/* 右耳转动 */
.cat-right-ear {
    transform-origin: 116px 32px;
    animation: ear-twitch-right 6.5s ease-in-out infinite;
}
@keyframes ear-twitch-right {
    0%, 75%, 100% { transform: rotate(0deg); }
    77%, 81% { transform: rotate(5deg); }
    79% { transform: rotate(-1deg); }
}

/* 眼睛眨眼 */
.cat-eye {
    animation: cat-blink 5s linear infinite;
}
.cat-eye-left { transform-origin: 58px 48px; }
.cat-eye-right { transform-origin: 102px 48px; }

@keyframes cat-blink {
    0%, 95%, 100% { transform: scaleY(1); }
    97.5% { transform: scaleY(0.1); }
}

/* 左手轻微摇晃（红包） */
.cat-paw-left-wrapper {
    transform-origin: 48px 72px;
    animation: paw-sway-left 4s ease-in-out infinite;
}
@keyframes paw-sway-left {
    0%, 100% { transform: rotate(0deg); }
    50% { transform: rotate(-3deg) translateY(-1px); }
}

/* 右手轻微摇晃（招财金牌） */
.cat-paw-right-wrapper {
    transform-origin: 90px 72px;
    animation: paw-sway-right 4.2s ease-in-out infinite;
}
@keyframes paw-sway-right {
    0%, 100% { transform: rotate(0deg); }
    50% { transform: rotate(3deg) translateY(-1px); }
}

/* 铃铛晃动 */
.cat-bell-group {
    transform-origin: 80px 81px;
    animation: bell-sway 3.5s ease-in-out infinite;
}
@keyframes bell-sway {
    0%, 85%, 100% { transform: rotate(0deg); }
    88%, 94% { transform: rotate(-12deg); }
    91%, 97% { transform: rotate(12deg); }
}

/* 猫尾巴摇摆 */
.cat-tail {
    transform-origin: 112px 73px;
    animation: tail-wag-anim 3s ease-in-out infinite;
}
@keyframes tail-wag-anim {
    0%, 100% { transform: rotate(0deg); }
    50% { transform: rotate(10deg); }
}

/* 引导页口号文字 - 已隐藏以保持背景纯净 */
.landing-text-row {
    display: none;
}

/* ==================== 6. 面板主布局 (侧边栏 + 主区) ==================== */
.panel-sidebar {
    width: var(--sidebar-width);
    height: 100%;
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 24px 16px;
    flex-shrink: 0;
    z-index: 10;
}
.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 30px;
    padding-left: 8px;
}

.sidebar-menu {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.menu-group-label {
    font-size: 11px;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 700;
    margin: 12px 0 6px 10px;
    letter-spacing: 0.5px;
}
.menu-item {
    display: flex;
    align-items: center;
    padding: 12px 14px;
    border-radius: var(--radius-md);
    font-weight: 600;
    color: var(--text-muted);
    gap: 12px;
    transition: all 0.2s;
    text-align: left;
}
.menu-item:hover {
    background-color: var(--bg-main);
    color: var(--text-main);
}
.menu-item.active {
    background-color: var(--primary-light);
    color: var(--primary-color);
}
.dark-theme .menu-item.active {
    background-color: var(--primary-light);
    color: var(--primary-color);
}

.sidebar-user-card {
    background: linear-gradient(135deg, var(--primary-light), rgba(46, 125, 50, 0.05));
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 20px;
}
.avatar-circle {
    width: 36px;
    height: 36px;
    background-color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    box-shadow: var(--shadow-sm);
    flex-shrink: 0;
}
.sidebar-companion-logo {
    overflow: hidden;
}
.sidebar-companion-logo img {
    width: 42px;
    height: auto;
    transform: translateY(2px);
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.12));
}
.user-info h4 {
    font-size: 13px;
    font-weight: 700;
}
.user-info p {
    font-size: 10px;
    color: var(--text-muted);
}

.panel-main {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

/* 头部样式 */
.panel-header {
    height: var(--header-height);
    background-color: var(--bg-sidebar);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 30px;
    flex-shrink: 0;
}
.header-search {
    display: flex;
    align-items: center;
    background-color: var(--bg-main);
    padding: 8px 16px;
    border-radius: 20px;
    width: 320px;
    border: 1px solid transparent;
    transition: all 0.2s;
}
.header-search:focus-within {
    border-color: var(--border-color-solid);
    background-color: var(--bg-card-solid);
}
.header-search input {
    border: none;
    background: transparent;
    outline: none;
    width: 100%;
    font-size: 13px;
    margin-left: 8px;
}
.header-actions {
    display: flex;
    align-items: center;
    gap: 20px;
}
#writer-panel.hide-header-search .panel-header {
    justify-content: flex-end;
}
#writer-panel.hide-header-search .header-search {
    display: none;
}

/* 日夜模式切换按钮 */
.theme-toggle-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background-color: var(--bg-main);
    border: 1px solid var(--border-color-solid);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s;
}
.theme-toggle-btn:hover {
    background-color: var(--border-color-solid);
}

.notification-badge {
    position: relative;
}
.notification-badge::after {
    content: attr(data-count);
    position: absolute;
    top: -4px;
    right: -4px;
    background-color: var(--danger-color);
    color: white;
    font-size: 9px;
    font-weight: 700;
    width: 15px;
    height: 15px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}
.icon-btn {
    font-size: 20px;
}
.notification-popover {
    position: absolute;
    top: calc(100% + 14px);
    right: -8px;
    z-index: 120;
    display: none;
    width: 300px;
    padding: 12px;
    border: 1px solid var(--border-color-solid);
    border-radius: 12px;
    background: var(--bg-card-solid);
    box-shadow: 0 18px 44px rgba(20, 32, 24, 0.16);
}
.notification-badge.open .notification-popover {
    display: block;
}
.notification-popover::before {
    content: "";
    position: absolute;
    top: -7px;
    right: 18px;
    width: 12px;
    height: 12px;
    transform: rotate(45deg);
    background: var(--bg-card-solid);
    border-left: 1px solid var(--border-color-solid);
    border-top: 1px solid var(--border-color-solid);
}
.notification-popover-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}
.notification-popover-head strong {
    font-size: 14px;
}
.notification-popover-head span {
    color: var(--text-muted);
    font-size: 11px;
}
.notification-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.notification-item {
    display: grid;
    gap: 3px;
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: var(--bg-main);
    text-align: left;
}
.notification-item.unread {
    border-color: rgba(46, 125, 50, 0.24);
    background: var(--primary-light);
}
.notification-item strong {
    font-size: 12px;
}
.notification-item span {
    color: var(--text-muted);
    font-size: 11px;
    line-height: 1.45;
}
.notification-item em {
    color: var(--text-muted);
    font-size: 10px;
    font-style: normal;
}

.user-profile-menu {
    display: flex;
    align-items: center;
    gap: 10px;
    position: relative;
    cursor: pointer;
}
.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: var(--primary-light);
    border: 2px solid var(--border-color-solid);
}
.username-display {
    font-weight: 600;
    font-size: 14px;
}
.profile-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background-color: var(--bg-card-solid);
    border: 1px solid var(--border-color-solid);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
    padding: 8px;
    min-width: 120px;
    display: none;
    z-index: 100;
    margin-top: 8px;
}
.user-profile-menu:hover .profile-dropdown {
    display: block;
}
.profile-dropdown button {
    display: block;
    width: 100%;
    text-align: left;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 13px;
}
.profile-dropdown button:hover {
    background-color: var(--bg-main);
}

.content-viewport {
    flex-grow: 1;
    padding: 24px 30px;
    overflow: hidden;
    min-width: 0;
}

/* ==================== 7. 作家端首页 (Dashboard) ==================== */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 24px;
    height: 100%;
}
.dashboard-left-col {
    display: flex;
    flex-direction: column;
    gap: 24px;
    overflow-y: auto;
    padding-right: 5px;
}

.inspiration-banner {
    background: linear-gradient(135deg, #2e7d32, #558b2f);
    border-radius: var(--radius-md);
    padding: 24px 30px;
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    overflow: hidden;
    box-shadow: 0 10px 25px rgba(46, 125, 50, 0.15);
}
.inspiration-banner::before {
    content: "";
    position: absolute;
    left: -20px;
    bottom: -20px;
    width: 120px;
    height: 120px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 50%;
}
.banner-text h1 {
    font-size: 24px;
    font-weight: 800;
    margin-bottom: 6px;
    font-family: 'Noto Sans SC', sans-serif;
}
.banner-text p {
    font-size: 14px;
    opacity: 0.9;
}
.banner-illustration {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}
.banner-illustration img {
    filter:
        drop-shadow(0 0 1px rgba(255, 255, 255, 0.98))
        drop-shadow(0 0 3px rgba(255, 255, 255, 0.92))
        drop-shadow(0 10px 18px rgba(27, 94, 32, 0.18));
}

/* 统计卡片行 */
.stats-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}
.metric-card {
    display: flex;
    align-items: center;
    padding: 16px;
    gap: 16px;
}
.metric-icon {
    width: 44px;
    height: 44px;
    background-color: var(--primary-light);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
}
.dark-theme .metric-icon {
    background-color: rgba(76,175,80,0.1);
}
.metric-info {
    display: flex;
    flex-direction: column;
}
.metric-label {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 600;
}
.metric-value {
    font-size: 20px;
    font-weight: 800;
    line-height: 1.1;
    margin: 2px 0;
}
.metric-unit {
    font-size: 11px;
    color: var(--text-muted);
}
.font-orange .metric-icon {
    background-color: var(--accent-light);
    color: var(--accent-color);
}
.font-orange .metric-value {
    color: var(--accent-color);
}

.dashboard-section {
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.section-title {
    font-size: 16px;
    font-weight: 700;
}
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.text-link-btn {
    font-size: 13px;
    color: var(--primary-color);
    font-weight: 600;
}
.text-link-btn:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

/* 快捷入口网格 */
.shortcut-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}
.shortcut-card {
    background-color: var(--bg-card-solid);
    border: 1px solid var(--border-color-solid);
    border-radius: var(--radius-md);
    padding: 20px;
    text-align: center;
    transition: all 0.2s;
    cursor: pointer;
}
.shortcut-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-color);
}
.shortcut-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 12px auto;
    font-size: 20px;
    font-weight: 700;
}
.icon-bg-green {
    background-color: var(--primary-light);
    color: var(--primary-color);
}
.icon-bg-blue {
    background-color: var(--blue-light);
    color: var(--blue-color);
}
.icon-bg-purple {
    background-color: var(--purple-light);
    color: var(--purple-color);
}
.icon-bg-yellow {
    background-color: var(--accent-light);
    color: var(--accent-color);
}
.shortcut-card h4 {
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 4px;
}
.shortcut-card p {
    font-size: 11px;
    color: var(--text-muted);
}

/* 最近作品列表 */
.recent-works-list {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 16px;
}

/* 3D 拟真图书封面 */
.book-card {
    background-color: var(--bg-card-solid);
    border: 1px solid var(--border-color-solid);
    border-radius: var(--radius-md);
    padding: 12px;
    cursor: pointer;
    transition: all 0.25s ease;
    display: flex;
    flex-direction: column;
}
.book-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-color);
}
.book-cover-container {
    width: 100%;
    aspect-ratio: 3/4;
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 10px;
    box-shadow: 2px 4px 8px rgba(0, 0, 0, 0.08);
}
.book-cover-placeholder {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
    color: white;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 12px;
    position: relative;
}
.book-cover-placeholder::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 6px;
    height: 100%;
    background: rgba(255, 255, 255, 0.15);
    box-shadow: 1px 0 3px rgba(0,0,0,0.1);
}
.book-cover-title {
    font-size: 13px;
    font-weight: 800;
    line-height: 1.3;
}
.book-cover-author {
    font-size: 9px;
    opacity: 0.8;
    text-align: right;
}
.book-info h4 {
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.book-meta {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
    display: flex;
    justify-content: space-between;
}

/* 首页右侧栏卡片 */
.dashboard-right-col {
    display: flex;
    flex-direction: column;
    gap: 20px;
}
.dashboard-card {
    padding: 20px;
}
.dashboard-card h3 {
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 14px;
}
.dashboard-card .card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
}
.dashboard-card .card-header h3 {
    margin-bottom: 0;
}

/* 创作日历样式 */
.calendar-wrapper {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 700;
}
.calendar-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}
.cal-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    border-radius: 6px;
    font-weight: 500;
}
.cal-day.muted {
    color: rgba(0, 0, 0, 0.15);
}
.dark-theme .cal-day.muted {
    color: rgba(255, 255, 255, 0.15);
}
.cal-day.has-creation {
    background-color: var(--primary-light);
    color: var(--primary-color);
    font-weight: 700;
}
.cal-day.active {
    background-color: var(--primary-color);
    color: white;
    font-weight: 700;
}

/* 环形图表 */
.doughnut-chart-container {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}
.chart-legend {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 14px;
    font-size: 12px;
}
.legend-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.legend-left {
    display: flex;
    align-items: center;
    gap: 8px;
}
.legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}
.legend-val {
    font-weight: 700;
}

/* 动态项 */
.feed-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.feed-item {
    display: flex;
    gap: 12px;
    font-size: 12px;
}
.feed-bullet {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: var(--border-color-solid);
    margin-top: 6px;
    flex-shrink: 0;
}
.bullet-orange { background-color: var(--accent-color); }
.bullet-blue { background-color: var(--blue-color); }
.bullet-green { background-color: var(--primary-color); }
.feed-body {
    display: flex;
    flex-direction: column;
}
.feed-body p {
    font-weight: 500;
}
.feed-time {
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 2px;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ==================== 8. 我的作品视图样式 ==================== */
.works-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}
.works-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 20px;
}

/* ==================== 9. 大气高级编辑器样式 ==================== */
.editor-main-container {
    display: flex;
    height: 100%;
    background-color: var(--bg-card-solid);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    position: relative;
}
.editor-main-container.is-resizing,
.editor-main-container.is-resizing * {
    cursor: col-resize !important;
    user-select: none;
}

/* 编辑器左辅助侧边栏 */
.editor-left-nav {
    display: none;
    width: var(--editor-left-nav-width);
    background-color: var(--bg-main);
    border-right: 1px solid var(--border-color);
    flex-direction: column;
    align-items: center;
    padding: 16px 0;
    gap: 14px;
}
.editor-nav-item {
    width: 50px;
    height: 50px;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    transition: all 0.2s;
}
.editor-nav-item:hover {
    background-color: var(--border-color-solid);
    color: var(--text-main);
}
.editor-nav-item.active {
    background-color: var(--primary-light);
    color: var(--primary-color);
}
.nav-icon {
    font-size: 18px;
}
.nav-label {
    font-size: 10px;
    font-weight: 700;
    margin-top: 2px;
}
.editor-nav-divider {
    width: 30px;
    height: 1px;
    background-color: var(--border-color-solid);
    margin: 4px 0;
}

/* 编辑器子展开面板 */
.editor-sub-panel {
    width: var(--editor-sub-panel-width);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    min-width: var(--editor-sub-panel-min-width);
    max-width: var(--editor-sub-panel-max-width);
    padding-left: 12px;
    background: var(--bg-card-solid);
}
.editor-resize-handle {
    width: 8px;
    flex: 0 0 8px;
    position: relative;
    cursor: col-resize;
    background: transparent;
    z-index: 8;
}
.editor-resize-handle-left {
    display: block;
}
.editor-resize-handle::before {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: 3px;
    width: 1px;
    background: rgba(46, 125, 50, 0.26);
    transition: background-color 0.15s, width 0.15s, left 0.15s;
}
.editor-resize-handle-left::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 2px;
    width: 4px;
    height: 44px;
    border-radius: 999px;
    background: rgba(46, 125, 50, 0.18);
    transform: translateY(-50%);
    transition: background-color 0.15s;
}
.editor-resize-handle:hover::before,
.editor-resize-handle.active::before {
    left: 2px;
    width: 3px;
    background: var(--primary-color);
}
.editor-resize-handle-left:hover::after,
.editor-resize-handle-left.active::after {
    background: rgba(46, 125, 50, 0.5);
}
.editor-pane-content {
    display: none;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    animation: fade-in 0.2s forwards;
}
.editor-pane-content.active {
    display: flex;
}
.pane-header {
    padding: 16px 14px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.pane-header h3 {
    font-size: 14px;
    font-weight: 700;
}
.pane-body-scroll {
    flex-grow: 1;
    overflow-y: auto;
}
.panel-sub-desc {
    font-size: 12px;
    color: var(--text-muted);
    padding: 10px 16px 0 16px;
}
.padding-md {
    padding: 16px;
}

/* 章节排序行 */
.chapter-list-sort-row {
    display: flex;
    justify-content: space-between;
    padding: 10px 14px;
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 600;
    border-bottom: 1px solid var(--border-color);
}
.icon-text-btn {
    cursor: pointer;
}

/* 章节树 */
.editor-chapter-list {
    list-style: none;
}
.chapter-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: background-color 0.2s;
}
.chapter-item:hover {
    background-color: var(--bg-main);
}
.chapter-item.active {
    background-color: var(--primary-light);
    border-left: 3px solid var(--primary-color);
}
.chap-info {
    display: flex;
    flex-direction: column;
    width: 80%;
}
.chap-title {
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.chap-sub {
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 2px;
}
.btn-delete-chap {
    font-size: 12px;
    opacity: 0;
    transition: opacity 0.2s;
    padding: 4px;
}
.chapter-item:hover .btn-delete-chap {
    opacity: 0.6;
}
.btn-delete-chap:hover {
    opacity: 1 !important;
    color: var(--danger-color);
}

/* 备忘录便签样式 */
.memo-container {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.memo-card {
    background-color: #fffde7;
    border: 1px solid #fff59d;
    border-radius: 8px;
    padding: 12px;
    color: #5d4037;
    box-shadow: var(--shadow-sm);
    transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
    cursor: pointer;
    position: relative;
}
.dark-theme .memo-card {
    background-color: #2e301f;
    border-color: #555734;
    color: #e5e9b8;
}
.memo-card:hover {
    transform: translateY(-2px);
}
.memo-card:focus-visible {
    outline: 2px solid rgba(46, 125, 50, 0.45);
    outline-offset: 2px;
}
.memo-card.is-expanded {
    border-color: #f6c744;
    box-shadow: 0 12px 28px rgba(109, 76, 65, 0.14);
}
.memo-card h4 {
    font-size: 13px;
    font-weight: 700;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: space-between;
}
.memo-title {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.memo-title-meta {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}
.memo-expand-hint {
    color: #8d6e63;
    font-size: 10px;
    font-weight: 700;
}
.memo-card .memo-content {
    font-size: 11px;
    line-height: 1.4;
    white-space: pre-wrap;
    overflow: hidden;
    transition: max-height 0.2s ease;
}
.memo-card:not(.is-expanded) .memo-content {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    max-height: 4.2em;
}
.memo-card.is-expanded .memo-content {
    display: block;
    max-height: none;
}
.memo-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 10px;
    font-size: 10px;
}
.memo-btn {
    color: var(--primary-color);
    font-weight: 600;
}
.memo-btn-danger {
    color: var(--danger-color);
}

/* 角色与词条卡片 */
.character-entry, .worldview-entry {
    border-bottom: 1px solid var(--border-color);
    padding: 14px 16px;
}
.character-entry h4, .worldview-entry h4 {
    font-size: 13px;
    font-weight: 700;
    margin-bottom: 4px;
}
.character-entry p, .worldview-entry p {
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.4;
}

/* 回收站列表 */
.trash-chapter-list {
    list-style: none;
    padding: 10px 0;
}
.trash-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    font-size: 12px;
    border-bottom: 1px dashed var(--border-color);
}
.trash-actions {
    display: flex;
    gap: 6px;
}
.btn-restore {
    color: var(--primary-color);
}
.btn-wipe {
    color: var(--danger-color);
}

/* 中部写作画布 (编辑器核心) */
.editor-center-canvas {
    flex-grow: 1;
    min-width: 320px;
    display: flex;
    flex-direction: column;
    height: 100%;
}
.canvas-header-nav {
    height: 50px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    background-color: var(--bg-main);
}
.breadcrumbs {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
}
.breadcrumb-separator {
    color: var(--text-muted);
}
.canvas-save-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: var(--text-muted);
}
.save-status-icon {
    color: #4caf50;
    font-weight: 700;
}
.canvas-top-actions {
    display: flex;
    gap: 8px;
}
.editor-more-actions {
    position: relative;
    display: inline-flex;
}
.editor-more-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    z-index: 40;
    display: none;
    width: 190px;
    padding: 8px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: var(--bg-card-solid);
    box-shadow: 0 14px 34px rgba(20, 32, 24, 0.14);
}
.editor-more-actions.open .editor-more-menu {
    display: block;
}
.editor-more-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    height: 34px;
    padding: 0 10px;
    border-radius: 8px;
    color: var(--text-main);
    font-size: 12px;
    font-weight: 700;
    text-align: left;
    transition: background-color 0.16s ease, color 0.16s ease;
}
.editor-more-menu-item:hover {
    background: var(--bg-main);
    color: var(--primary-color);
}
.editor-more-menu-item.active {
    background: var(--primary-light);
    color: var(--primary-color);
}
.editor-more-menu-item .menu-icon {
    width: 18px;
    text-align: center;
    font-size: 15px;
}
.editor-more-menu-divider {
    height: 1px;
    margin: 6px 4px;
    background: var(--border-color);
}
.editor-floating-card {
    position: fixed;
    left: 330px;
    top: 86px;
    z-index: 70;
    display: none;
    width: 360px;
    height: 430px;
    min-width: 280px;
    min-height: 220px;
    max-width: calc(100vw - 24px);
    max-height: calc(100dvh - 24px);
    border: 1px solid rgba(46, 125, 50, 0.2);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 18px 46px rgba(20, 32, 24, 0.16);
    overflow: hidden;
}
.editor-floating-card.open {
    display: flex;
    flex-direction: column;
}
.editor-floating-card.is-dragging,
.editor-floating-card.is-resizing {
    user-select: none;
}
.editor-floating-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-main);
    cursor: grab;
}
.editor-floating-card.is-dragging .editor-floating-card-header {
    cursor: grabbing;
}
.editor-floating-card-header strong {
    display: block;
    font-size: 14px;
    color: var(--text-main);
}
.editor-floating-card-header span {
    display: block;
    margin-top: 2px;
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 500;
}
.editor-floating-card-body {
    flex: 1;
    min-height: 0;
    overflow: auto;
    padding: 0;
}
.editor-floating-card-body .editor-pane-content {
    display: flex !important;
    height: 100%;
    animation: none;
}
.editor-floating-card-body .pane-header {
    padding: 12px 14px;
}
.float-resize-edge,
.float-resize-corner {
    position: absolute;
    z-index: 3;
    border: 0;
    background: transparent;
}
.float-resize-n,
.float-resize-s {
    left: 12px;
    right: 12px;
    height: 8px;
    cursor: ns-resize;
}
.float-resize-n { top: 0; }
.float-resize-s { bottom: 0; }
.float-resize-e,
.float-resize-w {
    top: 12px;
    bottom: 12px;
    width: 8px;
    cursor: ew-resize;
}
.float-resize-e { right: 0; }
.float-resize-w { left: 0; }
.float-resize-corner {
    width: 16px;
    height: 16px;
}
.float-resize-ne {
    top: 0;
    right: 0;
    cursor: nesw-resize;
}
.float-resize-se {
    right: 0;
    bottom: 0;
    cursor: nwse-resize;
}
.float-resize-sw {
    left: 0;
    bottom: 0;
    cursor: nesw-resize;
}
.float-resize-nw {
    left: 0;
    top: 0;
    cursor: nwse-resize;
}
.float-resize-se::after {
    content: "";
    position: absolute;
    right: 4px;
    bottom: 4px;
    width: 10px;
    height: 10px;
    border-right: 2px solid rgba(46, 125, 50, 0.42);
    border-bottom: 2px solid rgba(46, 125, 50, 0.42);
    border-radius: 1px;
}

/* 富文本工具栏 */
.editor-rich-toolbar {
    height: 40px;
    border-bottom: 1px solid var(--border-color);
    background-color: var(--bg-card-solid);
    display: flex;
    align-items: center;
    padding: 0 16px;
    gap: 4px;
}
.toolbar-btn {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    font-size: 13px;
    transition: background-color 0.2s;
}
.toolbar-btn:hover {
    background-color: var(--bg-main);
}
.toolbar-divider {
    width: 1px;
    height: 18px;
    background-color: var(--border-color-solid);
    margin: 0 6px;
}

/* 文本编辑画布 */
.editor-text-area-container {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    padding: 30px 60px;
    overflow: hidden;
}
.editor-title-input {
    border: none;
    outline: none;
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 20px;
    width: 100%;
    background: transparent;
}
.editor-textarea {
    flex-grow: 1;
    border: none;
    outline: none;
    resize: none;
    font-size: 16px;
    line-height: 1.8;
    width: 100%;
    background: transparent;
}

.editor-canvas-footer {
    height: 36px;
    border-top: 1px solid var(--border-color);
    background-color: var(--bg-main);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    font-size: 11px;
    color: var(--text-muted);
}
.footer-stat {
    display: flex;
    align-items: center;
    gap: 8px;
}
.footer-divider {
    opacity: 0.5;
}

/* 右侧 AI 助手面板 */
.editor-right-ai-panel {
    width: var(--editor-right-ai-width);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    min-width: var(--editor-right-ai-min-width);
    max-width: var(--editor-right-ai-max-width);
    background-color: var(--bg-main);
    overflow-x: hidden;
    margin-right: -1px;
}
.ai-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    background-color: var(--bg-card-solid);
}
.ai-tab {
    flex: 1;
    text-align: center;
    padding: 14px;
    font-size: 13px;
    font-weight: 700;
    color: var(--text-muted);
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}
.ai-tab:hover {
    color: var(--primary-color);
}
.ai-tab.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
    background-color: var(--bg-main);
}
.ai-pane-content {
    display: none;
    flex-direction: column;
    height: calc(100% - 47px);
    overflow-y: auto;
    overflow-x: hidden;
    padding: 10px 12px;
    gap: 10px;
}
.ai-pane-content.active {
    display: flex;
}

.ai-write-section {
    background-color: var(--bg-card-solid);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px 12px;
}
.section-title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}
.ai-write-section h4 {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 8px;
}
.ai-section-prompt,
.ai-section-select {
    margin-top: 0 !important;
}

/* 关联卡片网格 */
.ai-relation-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
}
.relation-card {
    background-color: var(--bg-main);
    border: 1px solid var(--border-color-solid);
    border-radius: 7px;
    min-height: 66px;
    padding: 7px 6px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    cursor: pointer;
    transition: all 0.2s;
    overflow: hidden;
}
.relation-card:hover {
    border-color: var(--primary-color);
    background-color: var(--primary-light);
}
.rel-icon {
    width: 22px;
    height: 22px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    margin-bottom: 5px;
}
.char-theme { background-color: var(--accent-light); color: var(--accent-color); }
.word-theme { background-color: var(--blue-light); color: var(--blue-color); }
.chap-theme { background-color: var(--primary-light); color: var(--primary-color); }
.note-theme { background-color: var(--purple-light); color: var(--purple-color); }
.rel-title {
    font-size: 11px;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
}
.rel-badge {
    font-size: 9px;
    color: var(--text-muted);
    margin-top: 2px;
    line-height: 1.2;
    white-space: nowrap;
}

.ai-requirement-textarea {
    width: 100%;
    height: 150px;
    border: 1px solid var(--border-color-solid);
    border-radius: var(--radius-sm);
    padding: 9px 10px;
    font-size: 12px;
    line-height: 1.45;
    resize: none;
    outline: none;
    background-color: var(--bg-main);
}
.ai-requirement-textarea:focus {
    border-color: var(--primary-color);
}
.ai-prompt-actions {
    display: flex;
    justify-content: space-between;
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 3px;
}
.btn-clear-prompt {
    cursor: pointer;
}

.form-group-ui {
    display: flex;
    flex-direction: column;
    gap: 5px;
}
.form-group-ui label {
    font-size: 12px;
    font-weight: 700;
}
.form-select {
    width: 100%;
    padding: 7px 10px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color-solid);
    outline: none;
    background-color: var(--bg-card-solid);
    font-size: 12px;
}
.form-select:focus {
    border-color: var(--primary-color);
}
.ai-section-select .form-select {
    min-height: 34px;
}
.ai-section-prompt + .ai-section-select {
    margin-top: auto !important;
}
.ai-section-select + .ai-section-select {
    margin-top: -2px !important;
}
.ai-section-select .editor-prompt-preview-card {
    margin-top: 6px !important;
    padding: 8px !important;
}
.ai-generate-button-wrapper {
    margin-top: 0 !important;
    padding-top: 8px;
    position: sticky;
    bottom: 0;
    background: var(--bg-main);
}
.ai-generate-button-wrapper .btn {
    min-height: 58px;
}
@media (max-width: 1500px) {
    .editor-right-ai-panel {
        --editor-right-ai-width: 430px;
        --editor-right-ai-min-width: 380px;
        --editor-right-ai-max-width: 520px;
    }
    .ai-relation-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.style-tags-container {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.style-tag {
    font-size: 11px;
    padding: 4px 10px;
    background-color: var(--bg-main);
    border: 1px solid var(--border-color-solid);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
}
.style-tag:hover {
    border-color: var(--primary-color);
}
.style-tag.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* AI生成结果预览面板 */
.ai-result-preview-card {
    display: none;
    flex-direction: column;
    background-color: var(--bg-card-solid);
    border: 2px solid var(--primary-color);
    border-radius: var(--radius-md);
    padding: 12px;
    margin-top: 15px;
    box-shadow: var(--shadow-lg);
    animation: fade-in 0.25s forwards;
}
.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color-solid);
    padding-bottom: 6px;
    margin-bottom: 8px;
}
.preview-header h5 {
    color: var(--primary-color);
    font-size: 12px;
    font-weight: 700;
}
.btn-close-preview {
    font-size: 16px;
    font-weight: 700;
}
.preview-body {
    font-size: 13px;
    line-height: 1.6;
    max-height: 200px;
    overflow-y: auto;
    background-color: var(--bg-main);
    padding: 10px;
    border-radius: 6px;
    margin-bottom: 10px;
    white-space: pre-wrap;
}
.preview-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
}
.ai-export-modal-card {
    max-width: 380px;
    padding: 20px;
}
.editor-export-modal-overlay {
    z-index: 900;
}
.ai-export-options {
    display: grid;
    gap: 10px;
}
.ai-export-option {
    width: 100%;
    display: grid;
    gap: 4px;
    padding: 14px 16px;
    border: 1px solid var(--border-color-solid);
    border-radius: var(--radius-sm);
    background-color: var(--bg-main);
    color: var(--text-main);
    text-align: left;
    transition: border-color 0.2s ease, background-color 0.2s ease, transform 0.2s ease;
}
.ai-export-option:hover {
    border-color: var(--primary-color);
    background-color: var(--primary-light);
    transform: translateY(-1px);
}
.ai-export-option strong {
    font-size: 14px;
    font-weight: 800;
}
.ai-export-option span {
    color: var(--text-muted);
    font-size: 12px;
}

/* AI 对话面板样式 */
#ai-pane-chat {
    justify-content: space-between;
    height: calc(100% - 47px);
}
.chat-messages-container {
    flex-grow: 1;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-bottom: 14px;
}
.chat-msg {
    display: flex;
    flex-direction: column;
    max-width: 85%;
}
.chat-msg.system {
    align-self: flex-start;
}
.chat-msg.user {
    align-self: flex-end;
}
.chat-bubble {
    position: relative;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 12.5px;
    line-height: 1.5;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    word-break: break-word;
}
.chat-bubble.has-chat-actions {
    padding-bottom: 34px;
}
.chat-message-actions {
    position: absolute;
    right: 10px;
    bottom: 8px;
    display: flex;
    justify-content: flex-end;
    gap: 6px;
    opacity: 0;
    pointer-events: none;
    transform: translateY(3px);
    transition: opacity 0.16s ease, transform 0.16s ease;
}
.chat-bubble.has-chat-actions:hover .chat-message-actions,
.chat-bubble.has-chat-actions:focus-within .chat-message-actions {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}
.chat-action-btn {
    padding: 3px 8px;
    border: 1px solid var(--border-color-solid);
    border-radius: 999px;
    background-color: rgba(255, 255, 255, 0.92);
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 700;
    line-height: 1.4;
    transition: color 0.2s ease, border-color 0.2s ease, background-color 0.2s ease;
}
.chat-action-btn:hover {
    border-color: var(--primary-color);
    background-color: var(--primary-light);
    color: var(--primary-color);
}
.chat-msg.system .chat-bubble {
    background-color: var(--bg-card-solid);
    border: 1px solid var(--border-color-solid);
    border-bottom-left-radius: 2px;
}
.chat-msg.user .chat-bubble {
    background-color: var(--primary-color);
    color: white;
    border-bottom-right-radius: 2px;
}
.chat-quick-templates {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 12px;
}
.chat-template-btn {
    font-size: 11px;
    text-align: left;
    background-color: var(--bg-card-solid);
    border: 1px solid var(--border-color-solid);
    padding: 6px 12px;
    border-radius: 8px;
    font-weight: 500;
}
.chat-template-btn:hover {
    border-color: var(--primary-color);
    background-color: var(--primary-light);
}
.chat-input-wrapper {
    display: flex;
    align-items: flex-end;
    background-color: var(--bg-card-solid);
    border: 1px solid var(--border-color-solid);
    border-radius: var(--radius-md);
    padding: 8px;
    min-width: 0;
    overflow: hidden;
}
.chat-input-wrapper:focus-within {
    border-color: var(--primary-color);
}
.chat-input-textarea {
    flex-grow: 1;
    min-width: 0;
    border: none;
    outline: none;
    resize: none;
    min-height: 40px;
    max-height: 150px;
    font-size: 12.5px;
    line-height: 1.5;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    word-break: break-word;
    overflow-x: hidden;
    overflow-y: hidden;
    background: transparent;
}
.btn-chat-send {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* ==================== 10. AI 工具箱与广场 ==================== */
.view-header-description {
    margin-bottom: 24px;
}
.view-header-description p {
    font-size: 14px;
    color: var(--text-muted);
    margin-top: 4px;
}
.aitools-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}
.aitool-card {
    background-color: var(--bg-card-solid);
    border: 1px solid var(--border-color-solid);
    border-radius: var(--radius-md);
    padding: 20px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: all 0.2s;
    height: 200px;
}
.aitool-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}
.tool-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}
.tool-icon {
    font-size: 24px;
}
.tool-head h3 {
    font-size: 15px;
    font-weight: 700;
}
.tool-desc {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.5;
    flex-grow: 1;
}
.tool-use-btn {
    align-self: flex-start;
    margin-top: 14px;
}

.color-green .tool-icon { color: var(--primary-color); }
.color-purple .tool-icon { color: var(--purple-color); }
.color-blue .tool-icon { color: var(--blue-color); }
.color-orange .tool-icon { color: var(--accent-color); }
.color-teal .tool-icon { color: #008080; }
.color-pink .tool-icon { color: #e91e63; }
.color-violet .tool-icon { color: #9c27b0; }
.color-indigo .tool-icon { color: #3f51b5; }

.recent-tools-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.recent-tool-item {
    display: flex;
    align-items: center;
    background-color: var(--bg-card-solid);
    border: 1px solid var(--border-color-solid);
    padding: 12px 20px;
    border-radius: var(--radius-md);
    font-size: 13px;
    gap: 12px;
}
.rtool-badge {
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    color: white;
}
.color-bg-green { background-color: var(--primary-color); }
.color-bg-purple { background-color: var(--purple-color); }
.color-bg-orange { background-color: var(--accent-color); }
.rtool-target {
    flex-grow: 1;
    font-weight: 600;
}
.rtool-time {
    color: var(--text-muted);
}

/* 提示词广场样式 */
.prompts-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}
.prompt-tabs-row {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}
.prompt-tab-btn {
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    border: 1px solid var(--border-color-solid);
    background-color: var(--bg-card-solid);
    transition: all 0.2s;
}
.prompt-tab-btn:hover {
    border-color: var(--primary-color);
}
.prompt-tab-btn.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.prompts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}
.prompt-card {
    background-color: var(--bg-card-solid);
    border: 1px solid var(--border-color-solid);
    border-radius: var(--radius-md);
    padding: 16px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 180px;
    transition: all 0.2s;
}
.prompt-card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--primary-color);
}
.prompt-card-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.prompt-card-head h3 {
    font-size: 14px;
    font-weight: 700;
}
.p-tag {
    font-size: 10px;
    background-color: var(--bg-main);
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 600;
}
.prompt-card-body {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.5;
    margin: 10px 0;
    flex-grow: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.prompt-card-foot {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11px;
    color: var(--text-muted);
}
.p-use-btn {
    color: var(--primary-color);
    font-weight: 700;
}

/* ==================== 11. 榜单中心样式 ==================== */
.ranking-horizontal-tabs {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
    overflow-x: auto;
}
.ranking-horizontal-tabs .rank-tab {
    padding: 8px 18px;
    text-align: center;
    border-radius: 20px;
    font-weight: 700;
    font-size: 12px;
    transition: all 0.2s;
    background-color: var(--border-color-solid);
    color: var(--text-main);
    white-space: nowrap;
    border: 1px solid var(--border-color);
    cursor: pointer;
}
.ranking-horizontal-tabs .rank-tab:hover {
    background-color: var(--primary-light);
    color: var(--primary-color);
    border-color: var(--primary-color);
}
.ranking-horizontal-tabs .rank-tab.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}
.ranking-content-area {
    width: 100%;
}
.ranking-list-panel {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.rank-category-scroller {
    display: none;
    gap: 8px;
    margin: 0 0 18px;
    padding: 2px 0 8px;
    overflow-x: auto;
    scrollbar-width: thin;
}
.rank-category-scroller.active {
    display: flex;
}
.rank-category-chip {
    flex: 0 0 auto;
    min-height: 32px;
    padding: 0 13px;
    border: 1px solid var(--border-color);
    border-radius: 999px;
    background: var(--bg-card-solid);
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
}
.rank-category-chip:hover,
.rank-category-chip.active {
    color: #fff;
    background: var(--primary-color);
    border-color: var(--primary-color);
}

/* 热点事件卡片样式 */
.rank-event-item {
    background-color: var(--bg-card-solid);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 18px;
    margin-bottom: 16px;
    transition: all 0.3s;
    box-shadow: var(--shadow-sm);
    text-align: left;
}
.rank-event-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-color);
}
.event-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}
.event-tag {
    background-color: var(--primary-light);
    color: var(--primary-color);
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 4px;
}
.event-hot {
    font-size: 12px;
    font-weight: 700;
    color: var(--accent-color, #ff5722);
}
.event-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 8px;
}
.event-desc {
    font-size: 13px;
    line-height: 1.6;
    color: var(--text-muted);
    margin-bottom: 12px;
}
.event-advice {
    background-color: var(--bg-main);
    border-left: 3px solid var(--primary-color);
    padding: 10px 14px;
    border-radius: 4px;
    font-size: 12px;
    line-height: 1.5;
    color: var(--text-main);
    margin-bottom: 8px;
}
.event-footer {
    font-size: 11px;
    color: var(--text-muted);
    display: flex;
    justify-content: flex-end;
}

/* 写作热点分析面板 */
.hot-analysis-panel {
    display: flex;
    flex-direction: column;
    gap: 16px;
    text-align: left;
}
.analysis-section {
    background-color: var(--bg-card-solid);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 20px;
    box-shadow: var(--shadow-sm);
}
.analysis-section h4 {
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 16px;
    color: var(--text-main);
    border-left: 3px solid var(--primary-color);
    padding-left: 8px;
}
.trend-tags-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 12px;
}
.trend-tag-card {
    background: var(--bg-main);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s;
}
.trend-tag-card:hover {
    border-color: var(--primary-color);
    transform: scale(1.02);
}
.trend-tag-card .t-name {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-main);
}
.trend-tag-card .t-trend {
    font-size: 11px;
    font-weight: 800;
    color: #4caf50;
}
.trends-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.analysis-trend-row {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-bottom: 12px;
    border-bottom: 1px dashed var(--border-color);
}
.analysis-trend-row:last-child {
    border-bottom: none;
    padding-bottom: 0;
}
.analysis-trend-row .genre-info strong {
    font-size: 13px;
    color: var(--text-main);
}
.analysis-trend-row .genre-info p {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
    line-height: 1.4;
}
.genre-bar-container {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 4px;
}
.genre-bar {
    height: 8px;
    border-radius: 4px;
    background: linear-gradient(90deg, var(--primary-color), var(--primary-light));
    transition: width 1s ease-in-out;
}
.genre-val {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    white-space: nowrap;
}
.rank-book-item {
    background-color: var(--bg-card-solid);
    border: 1px solid var(--border-color-solid);
    border-radius: var(--radius-md);
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 20px;
}
.rank-number-box {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 800;
    flex-shrink: 0;
}
.rank-trophy-1 { color: #fbc02d; font-size: 24px; }
.rank-trophy-2 { color: #b0bec5; font-size: 24px; }
.rank-trophy-3 { color: #d7ccc8; font-size: 24px; }

.rank-book-cover {
    width: 60px;
    aspect-ratio: 3/4;
    border-radius: 4px;
    overflow: hidden;
    flex-shrink: 0;
}
.rank-book-info {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}
.rank-book-title {
    font-size: 15px;
    font-weight: 700;
}
.rank-book-meta {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}
.rank-book-score {
    font-size: 16px;
    font-weight: 800;
    color: var(--accent-color);
}

/* ==================== 12. 设置中心样式 ==================== */
.settings-card-ui {
    background-color: var(--bg-card-solid);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 30px;
    max-width: 800px;
    margin: 0 auto;
}
.settings-section {
    display: flex;
    flex-direction: column;
    gap: 20px;
}
.settings-section h3 {
    font-size: 16px;
    font-weight: 700;
}
.settings-avatar-row {
    display: flex;
    align-items: center;
    gap: 20px;
}
.settings-avatar-preview {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background-color: var(--primary-light);
    border: 3px solid var(--border-color-solid);
}
.avatar-upload-info p {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 6px;
}

.form-row-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
.form-input {
    width: 100%;
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color-solid);
    outline: none;
    background-color: var(--bg-main);
}
.form-input:focus {
    border-color: var(--primary-color);
    background-color: var(--bg-card-solid);
}
.form-input:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}
.checkbox-group-ui {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.divider {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 24px 0;
}
.text-right {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* ==================== 13. AI 工具模拟弹窗 ==================== */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.4);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.25s ease;
}
.modal-overlay.active {
    display: flex;
    opacity: 1;
}
.modal-card {
    background-color: var(--bg-card-solid);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    width: 90%;
    max-width: 500px;
    padding: 24px;
    animation: slide-up 0.25s ease-out;
}
@keyframes slide-up {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color-solid);
    padding-bottom: 12px;
    margin-bottom: 18px;
}
.modal-close {
    font-size: 22px;
    font-weight: 700;
}
.form-textarea {
    width: 100%;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color-solid);
    outline: none;
    background-color: var(--bg-main);
    resize: vertical;
}
.form-textarea:focus {
    border-color: var(--primary-color);
}
.modal-result-box {
    margin-top: 20px;
    background-color: var(--primary-light);
    border: 1px dashed var(--primary-color);
    padding: 16px;
    border-radius: 8px;
    animation: fade-in 0.2s forwards;
}
.dark-theme .modal-result-box {
    background-color: rgba(76,175,80,0.1);
}
.modal-result-box h4 {
    font-size: 12px;
    color: var(--primary-color);
    margin-bottom: 8px;
}
.result-content-pane {
    font-size: 13px;
    line-height: 1.6;
    white-space: pre-wrap;
}

/* ==================== 14. 管理员端专用样式 ==================== */
/* 数据总看板网格 */
.admin-welcome-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}
.welcome-text h2 {
    font-size: 22px;
    font-weight: 800;
}
.welcome-text p {
    font-size: 13px;
    color: var(--text-muted);
}
.welcome-actions {
    display: flex;
    gap: 8px;
}

/* 管理端指标面板 */
.admin-metrics-row {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}
.admin-metric-card {
    padding: 18px;
}
.am-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}
.am-label {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 700;
    text-transform: uppercase;
}
.am-icon {
    font-size: 18px;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.am-value {
    font-size: 22px;
    font-weight: 800;
    line-height: 1;
}
.am-trend {
    display: block;
    font-size: 11px;
    margin-top: 8px;
    font-weight: 600;
}
.green-trend {
    color: #4caf50;
}

.color-blue { background-color: rgba(2, 136, 209, 0.15); color: #0288d1; }
.color-purple { background-color: rgba(123, 31, 162, 0.15); color: #7b1fa2; }
.color-teal { background-color: rgba(0, 128, 128, 0.15); color: #008080; }
.color-green { background-color: rgba(46, 125, 50, 0.15); color: #2e7d32; }
.color-yellow { background-color: rgba(255, 145, 0, 0.15); color: #ff9100; }
.color-red { background-color: rgba(211, 47, 47, 0.15); color: #d32f2f; }

/* 图表网格布局 */
.admin-charts-grid {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr 1fr;
    gap: 20px;
    margin-bottom: 24px;
}
.admin-chart-card {
    padding: 20px;
}
.admin-chart-card h3 {
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 16px;
}
.chart-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}
.chart-card-header h3 {
    margin-bottom: 0;
}
.chart-filter-tabs {
    display: flex;
    gap: 6px;
}
.chart-tab {
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 4px;
    border: 1px solid var(--border-color-solid);
    cursor: pointer;
}
.chart-tab.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}
.flex-center {
    display: flex;
    justify-content: center;
    align-items: center;
}

/* 后台表格部分 */
.admin-data-tables-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 340px;
    gap: 20px;
}
.admin-table-card {
    padding: 20px;
}
.table-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
}
.table-card-header h3 {
    font-size: 14px;
    font-weight: 700;
}

.table-responsive {
    overflow-x: auto;
    width: 100%;
}
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    text-align: left;
}
th {
    padding: 10px 12px;
    border-bottom: 2px solid var(--border-color-solid);
    color: var(--text-muted);
    font-weight: 700;
}
td {
    padding: 12px;
    border-bottom: 1px solid var(--border-color);
}
tr:last-child td {
    border-bottom: none;
}
.status-pill {
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
}
.status-pill.success { background-color: rgba(76,175,80,0.15); color: #4caf50; }
.status-pill.warning { background-color: rgba(255,145,0,0.15); color: #ff9100; }
.status-pill.danger { background-color: rgba(211,47,47,0.15); color: #d32f2f; }

.admin-page-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}
.admin-page-head h2 {
    font-size: 22px;
    font-weight: 800;
}
.admin-tool-grid,
.admin-status-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 18px;
}
.admin-tool-card {
    padding: 20px;
}
.admin-tool-card h3 {
    font-size: 15px;
    font-weight: 800;
    margin-bottom: 16px;
}
.admin-textarea {
    min-height: 120px;
    resize: vertical;
}
.admin-mini-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.admin-mini-list div {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.03);
}
.admin-mini-list strong {
    color: var(--text-main);
}
.admin-mini-list span {
    color: var(--text-muted);
    font-size: 12px;
}
.admin-status-card {
    padding: 18px;
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 6px 12px;
    align-items: center;
}
.admin-status-card span {
    font-size: 18px;
    line-height: 1;
}
.admin-status-card strong {
    font-size: 14px;
}
.admin-status-card em {
    grid-column: 2;
    color: var(--text-muted);
    font-style: normal;
    font-size: 12px;
}
.admin-status-card.online span,
.status-badge.status-ok {
    color: #4caf50;
}
.admin-status-card.warning span,
.status-badge.status-warn {
    color: #ffb020;
}
.status-badge {
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
}
.admin-table-wrap {
    margin-top: 20px;
    padding: 15px;
    border-radius: 8px;
}
.system-prompt-injection-card {
    display: grid;
    gap: 16px;
    padding: 18px;
    border-radius: 10px;
}
.system-prompt-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
}
.system-prompt-head h3 {
    font-size: 16px;
    font-weight: 800;
    margin-bottom: 6px;
}
.system-prompt-head p {
    color: var(--text-muted);
    font-size: 12px;
    line-height: 1.6;
}
.system-prompt-switch {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}
.system-prompt-switch input {
    display: none;
}
.system-prompt-switch span {
    position: relative;
    width: 38px;
    height: 20px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid var(--border-color);
    transition: background-color 0.18s ease, border-color 0.18s ease;
}
.system-prompt-switch span::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--text-muted);
    transition: transform 0.18s ease, background-color 0.18s ease;
}
.system-prompt-switch input:checked + span {
    background: rgba(76, 175, 80, 0.18);
    border-color: rgba(76, 175, 80, 0.45);
}
.system-prompt-switch input:checked + span::after {
    transform: translateX(18px);
    background: var(--primary-color);
}
.system-prompt-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}
.system-prompt-textarea {
    min-height: 132px;
    resize: vertical;
    line-height: 1.7;
}
.system-prompt-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding-top: 2px;
}
.system-prompt-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    color: var(--text-muted);
    font-size: 11px;
}
.system-prompt-meta span {
    padding: 4px 8px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.05);
}
.system-prompt-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}
.admin-role-list,
.admin-feedback-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.admin-role-item,
.feedback-ticket {
    display: grid;
    gap: 4px;
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-main);
    text-align: left;
}
.admin-role-item.active,
.feedback-ticket.active {
    border-color: rgba(76, 175, 80, 0.45);
    background: rgba(76, 175, 80, 0.14);
}
.admin-role-item strong,
.feedback-ticket strong {
    font-size: 13px;
}
.admin-role-item span,
.feedback-ticket span {
    color: var(--text-muted);
    font-size: 11px;
}
.admin-role-detail-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 14px;
}
.admin-role-detail-grid div {
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.04);
}
.admin-role-detail-grid span {
    display: block;
    color: var(--text-muted);
    font-size: 11px;
}
.admin-role-detail-grid strong {
    display: block;
    margin-top: 4px;
    font-size: 16px;
}
.permission-chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.permission-chip-row span {
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(76, 175, 80, 0.14);
    color: var(--primary-color);
    font-size: 11px;
    font-weight: 700;
}
.permission-table td:not(:first-child),
.permission-table th:not(:first-child) {
    text-align: center;
}
.feedback-filter-row {
    display: flex;
    gap: 8px;
}
.admin-feedback-layout {
    display: grid;
    grid-template-columns: 320px minmax(0, 1fr);
    gap: 16px;
}
.admin-feedback-list,
.admin-feedback-detail {
    padding: 16px;
    border-radius: 10px;
}
.feedback-detail-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}
.feedback-detail-head h3 {
    font-size: 16px;
}
.admin-feedback-detail p {
    color: var(--text-muted);
    font-size: 13px;
    line-height: 1.7;
    margin-bottom: 14px;
}

/* 数据看板 */
.admin-page-subtitle {
    margin-top: 6px;
    color: var(--text-muted);
    font-size: 13px;
}
.stats-overview-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 18px;
}
.stats-overview-card {
    min-height: 132px;
    padding: 18px;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}
.stats-overview-card span {
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 700;
}
.stats-overview-card strong {
    color: var(--text-main);
    font-size: 30px;
    line-height: 1.1;
    font-weight: 900;
}
.stats-overview-card em {
    font-size: 12px;
    font-style: normal;
    font-weight: 700;
}
.stats-board-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.5fr) minmax(260px, 0.8fr) minmax(300px, 1fr);
    gap: 16px;
    margin-bottom: 18px;
}
.stats-panel {
    min-height: 252px;
    padding: 18px;
    border-radius: 10px;
}
.stats-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 18px;
}
.stats-panel-head h3 {
    font-size: 15px;
    font-weight: 800;
}
.stats-panel-head span {
    color: var(--text-muted);
    font-size: 12px;
}
.trend-bars {
    display: grid;
    grid-template-columns: repeat(6, minmax(42px, 1fr));
    align-items: end;
    gap: 12px;
    height: 176px;
    padding-top: 10px;
}
.trend-bars div {
    height: 100%;
    display: grid;
    grid-template-rows: 1fr auto;
    gap: 8px;
    align-items: end;
}
.trend-bars i {
    display: block;
    height: var(--bar);
    min-height: 32px;
    border-radius: 8px 8px 3px 3px;
    background: linear-gradient(180deg, rgba(76, 175, 80, 0.92), rgba(31, 111, 235, 0.42));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22);
}
.trend-bars span {
    color: var(--text-muted);
    font-size: 11px;
    text-align: center;
}
.stats-rank-list,
.stats-progress-list,
.stats-rank-table,
.funnel-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.stats-rank-list div {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 12px;
    padding: 11px 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.035);
}
.stats-rank-list strong,
.stats-rank-table strong {
    font-size: 13px;
    color: var(--text-main);
}
.stats-rank-list span {
    color: var(--primary-color);
    font-size: 12px;
    font-weight: 800;
}
.stats-progress-list div {
    display: grid;
    grid-template-columns: 74px minmax(90px, 1fr) 38px;
    align-items: center;
    gap: 10px;
}
.stats-progress-list span,
.stats-progress-list em {
    color: var(--text-muted);
    font-size: 12px;
    font-style: normal;
}
.stats-progress-list em {
    text-align: right;
}
.stats-progress-list i {
    height: 8px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
}
.stats-progress-list b {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, rgba(31, 111, 235, 0.9), rgba(76, 175, 80, 0.95));
}
.stats-rank-table div,
.funnel-list div {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.035);
}
.stats-rank-table span {
    width: 24px;
    height: 24px;
    display: grid;
    place-items: center;
    border-radius: 7px;
    background: rgba(76, 175, 80, 0.16);
    color: var(--primary-color);
    font-size: 12px;
    font-weight: 900;
}
.stats-rank-table em {
    color: var(--text-muted);
    font-size: 12px;
    font-style: normal;
}
.funnel-list div {
    grid-template-columns: minmax(0, 1fr) auto;
    position: relative;
    overflow: hidden;
}
.funnel-list div::before {
    content: "";
    position: absolute;
    inset: auto 0 0;
    height: 3px;
    background: linear-gradient(90deg, rgba(76, 175, 80, 0.78), rgba(31, 111, 235, 0.28));
}
.funnel-list span {
    color: var(--text-muted);
    font-size: 12px;
}
.funnel-list strong {
    color: var(--text-main);
    font-size: 14px;
}
.admin-textarea {
    line-height: 1.6;
}

/* 系统公告 */
.announcements-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.notice-item {
    border-bottom: 1px dashed var(--border-color);
    padding-bottom: 10px;
}
.notice-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}
.notice-item h4 {
    font-size: 12.5px;
    font-weight: 700;
}
.notice-time {
    font-size: 10px;
    color: var(--text-muted);
}

/* 操作日志 */
.admin-log-card {
    padding: 20px;
}
.log-filters {
    display: flex;
    align-items: center;
    gap: 10px;
}
.select-sm {
    padding: 4px 8px;
    font-size: 12px;
    border-radius: 4px;
}
.table-pagination-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 14px;
    font-size: 12px;
    color: var(--text-muted);
}
.pagination-buttons {
    display: flex;
    gap: 4px;
}

/* 按钮微型 */
.pager-dots {
    display: flex;
    align-items: center;
    font-size: 10px;
    padding: 0 4px;
}
.admin-badge-label {
    background-color: #1b5e20;
    color: #a5d6a7;
    font-size: 9px;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 700;
}
.server-status-pill {
    background-color: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    padding: 4px 12px;
    border-radius: 14px;
    font-size: 12px;
    display: flex;
    align-items: center;
}

.works-mgr-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.search-bar-ui {
    display: flex;
    gap: 8px;
}

/* ==================== 15. 响应式布局 ==================== */
@media (max-width: 1200px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    .admin-metrics-row {
        grid-template-columns: repeat(3, 1fr);
    }
    .admin-charts-grid {
        grid-template-columns: 1fr;
    }
    .admin-data-tables-grid {
        grid-template-columns: 1fr;
    }
    .stats-overview-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .stats-board-grid {
        grid-template-columns: 1fr;
    }
    .admin-feedback-layout {
        grid-template-columns: 1fr;
    }
}
@media (max-width: 768px) {
    .login-wrapper {
        grid-template-columns: 1fr;
    }
    .login-right-preview {
        display: none;
    }
    .stats-row {
        grid-template-columns: 1fr 1fr;
    }
    .shortcut-grid {
        grid-template-columns: 1fr 1fr;
    }
    .recent-works-list {
        grid-template-columns: repeat(3, 1fr);
    }
    .panel-sidebar {
        width: 70px;
        padding: 20px 8px;
    }
    .panel-sidebar .logo-text,
    .panel-sidebar .sidebar-user-card {
        display: none;
    }
    .menu-item span {
        margin: 0 auto;
    }
    .menu-item {
        justify-content: center;
        padding: 10px;
    }
    .menu-item {
        font-size: 0; /* 仅展示图标 */
    }
    .menu-group-label {
        display: none;
    }
    .admin-page-head {
        align-items: flex-start;
        flex-direction: column;
        gap: 12px;
    }
    .stats-overview-grid {
        grid-template-columns: 1fr;
    }
    .stats-overview-card {
        min-height: 112px;
    }
    .trend-bars {
        grid-template-columns: repeat(6, minmax(32px, 1fr));
        gap: 8px;
    }
    .stats-progress-list div {
        grid-template-columns: 64px minmax(70px, 1fr) 34px;
    }
}

@media (max-width: 640px) {
    html,
    body {
        width: 100%;
        min-width: 0;
        overflow-x: hidden;
    }
    .view-container.active {
        width: 100vw;
        min-width: 0;
    }
    #writer-panel,
    #admin-panel {
        flex-direction: column;
        height: 100dvh;
        overflow: hidden;
    }
    #writer-panel .panel-sidebar {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100vw;
        height: 66px;
        padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
        border-right: none;
        border-top: 1px solid var(--border-color);
        flex-direction: row;
        align-items: center;
        justify-content: center;
        z-index: 300;
        box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.08);
    }
    #writer-panel .sidebar-logo,
    #writer-panel .sidebar-user-card,
    #writer-panel .menu-group-label {
        display: none !important;
    }
    #writer-panel .sidebar-menu {
        width: 100%;
        flex-grow: 0;
        flex-direction: row;
        justify-content: space-around;
        gap: 4px;
        overflow-x: auto;
        padding-bottom: 2px;
        scrollbar-width: none;
    }
    #writer-panel .sidebar-menu::-webkit-scrollbar {
        display: none;
    }
    #writer-panel .menu-item {
        min-width: 52px;
        height: 52px;
        padding: 6px 4px;
        border-radius: 14px;
        flex-direction: column;
        justify-content: center;
        gap: 2px;
        font-size: 10px;
        text-align: center;
        white-space: nowrap;
    }
    #writer-panel .menu-item .menu-icon {
        margin: 0;
        font-size: 20px;
        line-height: 1;
    }
    #writer-panel .panel-main {
        width: 100vw;
        min-width: 0;
        height: 100dvh;
        padding-bottom: calc(66px + env(safe-area-inset-bottom));
        overflow: hidden;
    }
    #writer-panel .panel-header {
        height: 56px;
        padding: 0 12px;
        gap: 10px;
    }
    #writer-panel .header-search {
        width: auto;
        flex: 1;
        min-width: 0;
        padding: 8px 10px;
        border-radius: 16px;
    }
    #writer-panel .header-search input {
        font-size: 12px;
    }
    #writer-panel .header-actions {
        gap: 8px;
        flex-shrink: 0;
    }
    #writer-panel .theme-toggle-btn {
        width: 38px;
        height: 38px;
        padding: 0;
        justify-content: center;
        border-radius: 14px;
    }
    #writer-panel .theme-toggle-btn .toggle-text,
    #writer-panel .username-display {
        display: none;
    }
    #writer-panel .notification-badge {
        display: none;
    }
    #writer-panel .user-avatar {
        width: 34px;
        height: 34px;
    }
    #writer-panel .content-viewport {
        width: 100%;
        min-width: 0;
        padding: 14px 14px 22px;
        overflow-y: auto;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
    }
    .subview.active {
        width: 100%;
        min-width: 0;
    }
    .subview-title {
        font-size: 22px;
        line-height: 1.25;
    }
    .view-header-description p {
        font-size: 13px;
        line-height: 1.5;
    }
    .prompts-header-row {
        align-items: flex-start;
        gap: 12px;
        margin-bottom: 14px;
    }
    .prompts-header-row .btn {
        flex-shrink: 0;
        padding: 8px 10px;
        font-size: 12px;
    }
    .prompt-tabs-row {
        gap: 8px;
        margin-bottom: 16px;
        flex-wrap: nowrap;
        overflow-x: auto;
        padding-bottom: 4px;
        scrollbar-width: none;
    }
    .prompt-tabs-row::-webkit-scrollbar {
        display: none;
    }
    .prompt-tab-btn {
        flex: 0 0 auto;
        padding: 7px 12px;
        font-size: 12px;
    }
    .prompts-grid {
        grid-template-columns: 1fr;
        gap: 12px;
        padding-bottom: 18px;
    }
    .prompt-card {
        width: 100%;
        min-width: 0;
        height: auto;
        min-height: 164px;
        padding: 16px;
    }
    .prompt-card-head {
        align-items: flex-start;
        gap: 10px;
    }
    .prompt-card-head h3 {
        min-width: 0;
        font-size: 16px;
        line-height: 1.35;
    }
    .p-tag {
        flex-shrink: 0;
    }
    .prompt-card-body {
        -webkit-line-clamp: unset;
        display: block;
        overflow: visible;
        font-size: 13px;
    }
    .prompt-card-foot {
        gap: 12px;
    }
    .works-grid,
    .dashboard-grid,
    .ranking-grid,
    .aitools-grid {
        grid-template-columns: 1fr !important;
    }
    .works-header-row {
        align-items: center;
        gap: 10px;
    }
    .works-header-actions {
        flex-shrink: 0;
    }
    .works-header-actions .btn {
        padding: 8px 10px;
        font-size: 12px;
    }
    .works-grid {
        gap: 12px;
    }
    .work-book-card,
    .works-grid .book-card {
        display: grid;
        grid-template-columns: 92px 1fr;
        gap: 12px;
        align-items: center;
        min-height: 132px;
        padding: 12px 14px;
        overflow: visible;
    }
    .work-book-card .book-cover-container,
    .works-grid .book-card .book-cover-container {
        width: 92px;
        height: 122px;
        aspect-ratio: auto;
        margin-bottom: 0;
    }
    .work-book-card .lucky-cat-book-cover img,
    .works-grid .book-card .lucky-cat-book-cover img {
        width: 78%;
        transform: translateY(-4px);
    }
    .work-book-card .lucky-cat-book-cover span,
    .works-grid .book-card .lucky-cat-book-cover span {
        font-size: 10px;
        left: 8px;
        right: 8px;
        bottom: 8px;
    }
    .work-book-card .book-info,
    .works-grid .book-card .book-info {
        min-width: 0;
        padding-right: 42px;
    }
    .work-book-card .book-info h4,
    .works-grid .book-card .book-info h4 {
        white-space: normal;
        line-height: 1.35;
        font-size: 15px;
    }
    .work-book-card .book-subline,
    .work-book-card .book-meta,
    .works-grid .book-card .book-meta {
        font-size: 12px;
        line-height: 1.45;
        flex-wrap: wrap;
        gap: 6px;
    }
    .book-card-actions {
        right: 12px;
        bottom: 12px;
    }
    .ranking-horizontal-tabs {
        gap: 8px;
        margin-bottom: 16px;
        padding-bottom: 8px;
        overflow-x: auto;
        scrollbar-width: none;
    }
    .ranking-horizontal-tabs::-webkit-scrollbar {
        display: none;
    }
    .ranking-horizontal-tabs .rank-tab {
        flex: 0 0 auto;
        padding: 9px 16px;
        min-width: 96px;
        font-size: 13px;
    }
    .ranking-content-area {
        overflow-x: hidden;
    }
    .ranking-list-panel.grid-mode {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 12px !important;
        width: 100%;
    }
    .rank-book-card-grid {
        min-width: 0;
        padding: 12px 8px;
    }
    .rank-cover-grid {
        width: 76px;
        height: 102px;
        margin-bottom: 8px;
    }
    .rank-title-grid {
        font-size: 12px;
        line-height: 1.3;
        -webkit-line-clamp: 2;
        min-height: 32px;
    }
    .rank-author-grid {
        font-size: 10px;
    }
    .rank-score-grid {
        font-size: 11px;
        padding: 2px 8px;
    }
    #writer-editor-view.active {
        height: calc(100dvh - 56px - 66px - env(safe-area-inset-bottom));
        overflow: hidden;
    }
    #writer-editor-view .editor-main-container {
        width: 100%;
        height: 100%;
        border-radius: 0;
        border-left: none;
        border-right: none;
        display: grid;
        grid-template-columns: minmax(0, 1fr);
        overflow: hidden;
    }
    #writer-editor-view .editor-left-nav {
        display: none !important;
        width: 56px;
        grid-row: 1;
        padding: 10px 4px;
        gap: 8px;
        overflow-y: auto;
    }
    #writer-editor-view .editor-nav-item {
        width: 44px;
        height: 46px;
        border-radius: 12px;
    }
    #writer-editor-view .editor-nav-item .nav-icon {
        font-size: 18px;
    }
    #writer-editor-view .editor-nav-item .nav-label {
        font-size: 9px;
    }
    #writer-editor-view .editor-sub-panel {
        display: none;
    }
    #writer-editor-view .editor-resize-handle {
        display: none !important;
    }
    #writer-editor-view .editor-center-canvas {
        min-width: 0;
        width: 100%;
        height: 100%;
    }
    #writer-editor-view .canvas-header-nav {
        height: 46px;
        padding: 0 10px;
        gap: 8px;
    }
    #writer-editor-view .breadcrumbs {
        min-width: 0;
        overflow: hidden;
    }
    #writer-editor-view .breadcrumb-item {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    #writer-editor-view .canvas-save-status,
    #writer-editor-view .canvas-top-actions {
        display: none;
    }
    #writer-editor-view .editor-rich-toolbar {
        height: 38px;
        padding: 0 8px;
        overflow-x: auto;
        scrollbar-width: none;
    }
    #writer-editor-view .editor-rich-toolbar::-webkit-scrollbar {
        display: none;
    }
    #writer-editor-view .editor-text-area-container {
        padding: 22px 18px;
    }
    #writer-editor-view .editor-title-input {
        font-size: 22px;
        line-height: 1.3;
    }
    #writer-editor-view .editor-textarea {
        font-size: 17px;
        line-height: 1.85;
    }
    #writer-editor-view .editor-canvas-footer {
        height: 34px;
        padding: 0 10px;
        overflow: hidden;
    }
    #writer-editor-view .footer-tips {
        display: none;
    }
}

/* ==================== 16. 全屏编辑器展开模式 ==================== */
html:has(#writer-panel.editor-fullscreen-mode),
body:has(#writer-panel.editor-fullscreen-mode),
body.editor-locked-scroll {
    width: 100%;
    height: 100dvh;
    overflow: hidden;
}
#writer-panel.editor-fullscreen-mode {
    overflow: hidden;
}
#writer-panel.editor-fullscreen-mode .panel-sidebar {
    display: none !important;
}
#writer-panel.editor-fullscreen-mode .panel-header {
    display: none !important;
}
#writer-panel.editor-fullscreen-mode .panel-main {
    width: 100vw;
    max-width: 100vw;
    height: 100vh;
    overflow: hidden;
}
#writer-panel.editor-fullscreen-mode .content-viewport {
    padding: 0;
    width: 100vw;
    max-width: 100vw;
    height: 100vh;
    overflow: hidden;
}
#writer-panel.editor-fullscreen-mode #writer-editor-view {
    height: 100vh;
    width: 100vw;
    max-width: 100vw;
    overflow: hidden;
}
#writer-panel.editor-fullscreen-mode .editor-main-container {
    border: none;
    border-radius: 0;
    height: 100vh;
    width: 100vw;
    max-width: 100vw;
    overflow: hidden;
}
#writer-panel.editor-fullscreen-mode .editor-sub-panel {
    padding-left: 18px;
}
#writer-panel.editor-fullscreen-mode .editor-right-ai-panel {
    margin-right: 0;
}
.btn-editor-back {
    background-color: var(--border-color-solid);
    border: 1px solid var(--border-color-solid);
    color: var(--text-main);
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    margin-right: 12px;
    transition: all 0.2s;
}
.btn-editor-back:hover {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: white !important;
}

/* ==================== 17. 对话面板单行配置工具栏样式 ==================== */
.chat-config-toolbar-single {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: var(--bg-card-solid);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 6px 10px;
    margin: 8px 0;
    box-shadow: var(--shadow-sm);
}
.toolbar-left, .toolbar-right {
    display: flex;
    align-items: center;
}
.chat-select-inline {
    border: 1px solid var(--border-color);
    background: var(--bg-card-solid);
    color: var(--text-main);
    border-radius: 6px;
    padding: 2px 6px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    outline: none;
    max-width: 95px;
    height: 24px;
    margin-right: 6px;
    transition: all 0.2s;
}
.chat-select-inline:hover {
    border-color: var(--primary-color);
}
.chat-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    background-color: var(--border-color-solid);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    border-radius: 6px;
    font-size: 13px;
    font-weight: bold;
    cursor: pointer;
    margin-left: 6px;
    transition: all 0.2s;
    position: relative;
    user-select: none;
}
.chat-icon-btn:hover {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: white !important;
}
.badge-count {
    position: absolute;
    top: -5px;
    right: -5px;
    background-color: var(--accent-color, #ff5722);
    color: white;
    font-size: 8px;
    min-width: 12px;
    height: 12px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    border: 1px solid white;
}
/* 关联上下文弹出框 */
.relations-popover {
    position: absolute;
    bottom: 32px;
    right: 0;
    background: var(--bg-card-solid);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px;
    z-index: 20;
    width: 190px;
    max-width: calc(100vw - 28px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.relations-popover .checkbox-container {
    font-size: 11px;
    padding-left: 20px;
    margin: 0;
    display: block;
}
.relations-popover .checkmark {
    top: 0;
    height: 14px;
    width: 14px;
}
.relation-primary-item {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    width: 100%;
    height: 32px;
    padding: 0 12px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: transparent;
    color: var(--text-primary);
    font-size: 11px;
    line-height: 1.2;
    text-align: left;
    cursor: pointer;
    white-space: nowrap;
}
.relation-primary-item:hover,
.relation-primary-item.active {
    border-color: rgba(196, 151, 92, 0.3);
    background: rgba(255, 248, 237, 0.9);
    color: var(--primary-color);
}
.relation-detail-modal {
    position: relative;
    width: min(640px, calc(100vw - 56px));
    max-width: calc(100vw - 36px);
    height: min(460px, calc(100dvh - 56px));
    max-height: calc(100dvh - 36px);
    min-width: 420px;
    min-height: 320px;
    padding: 0;
    overflow: hidden;
    resize: both;
    display: flex;
    flex-direction: column;
    border-radius: 16px;
    background: var(--bg-card-solid);
}
.relation-resize-handle {
    position: absolute;
    right: 4px;
    bottom: 4px;
    width: 30px;
    height: 30px;
    border: 0;
    border-radius: 0 0 14px 0;
    background:
        linear-gradient(135deg, transparent 58%, rgba(42, 67, 48, 0.42) 59% 64%, transparent 65%),
        linear-gradient(135deg, transparent 74%, rgba(42, 67, 48, 0.28) 75% 80%, transparent 81%);
    cursor: nwse-resize;
    touch-action: none;
    z-index: 3;
}
.relation-resize-handle:hover {
    background:
        linear-gradient(135deg, transparent 58%, var(--primary-color) 59% 64%, transparent 65%),
        linear-gradient(135deg, transparent 74%, rgba(42, 67, 48, 0.42) 75% 80%, transparent 81%);
}
.relation-detail-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 26px 30px 14px;
    cursor: grab;
}
.relation-detail-modal.is-dragging .relation-detail-header {
    cursor: grabbing;
}
.relation-detail-title-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
}
.relation-title-accent {
    width: 5px;
    height: 30px;
    border-radius: 999px;
    background: linear-gradient(180deg, #3284ff, #9a5cff);
}
.relation-detail-title-wrap h3 {
    margin: 0;
    font-size: 22px;
    font-weight: 800;
    color: var(--text-primary);
}
.relation-title-info {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border: 1px solid var(--border-color-solid);
    border-radius: 50%;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 700;
}
.relation-detail-search-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 8px;
    padding: 0 30px 14px;
}
.relation-detail-search,
.relation-detail-sort,
.relation-detail-clear,
.relation-detail-filter-row button {
    height: 38px;
    border: 1px solid var(--border-color-solid);
    border-radius: 7px;
    background: var(--bg-card-solid);
    color: var(--text-primary);
    font-size: 13px;
}
.relation-detail-search {
    min-width: 0;
    padding: 0 12px;
    outline: none;
}
.relation-detail-sort,
.relation-detail-clear,
.relation-detail-filter-row button {
    padding: 0 16px;
    cursor: pointer;
}
.relation-detail-filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 0 30px 16px;
}
.relation-detail-list {
    flex: 1;
    overflow: auto;
    padding: 0 30px;
    min-height: 0;
}
.relation-detail-row {
    display: grid;
    grid-template-columns: 24px minmax(0, 1fr) auto auto auto 42px;
    align-items: center;
    gap: 10px;
    min-width: 600px;
    min-height: 42px;
    padding: 4px 8px;
    border-radius: 3px;
    color: var(--text-primary);
    font-size: 16px;
}
.relation-detail-row:hover,
.relation-detail-row.is-focused {
    background: rgba(78, 87, 101, 0.12);
}
.relation-detail-row input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #2f7df4;
}
.relation-detail-name {
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    font-weight: 560;
}
.relation-detail-current {
    display: inline-flex;
    align-items: center;
    height: 22px;
    padding: 0 7px;
    border-radius: 6px;
    background: #fff0f0;
    color: #f05b5b;
    font-size: 12px;
    font-weight: 700;
}
.relation-detail-words {
    min-width: 62px;
    padding: 3px 8px;
    border-radius: 3px;
    background: var(--bg-main);
    color: var(--text-primary);
    font-size: 13px;
    text-align: right;
}
.relation-detail-mode {
    display: inline-flex;
    gap: 8px;
    color: var(--text-secondary);
    font-size: 13px;
    white-space: nowrap;
}
.relation-detail-mode input {
    margin-right: 3px;
    accent-color: #2f7df4;
}
.relation-detail-edit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 28px;
    border: 1px solid #ffd47c;
    border-radius: 6px;
    background: #fffaf0;
    color: #e58a18;
    font-size: 14px;
}
.relation-detail-summary {
    display: flex;
    align-items: center;
    gap: 18px;
    min-height: 50px;
    margin: 12px 30px 0;
    padding: 0 16px;
    border: 1px solid var(--border-color-solid);
    border-radius: 9px;
    background: var(--bg-main);
    color: var(--text-secondary);
    font-size: 13px;
}
.relation-detail-summary span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.relation-detail-summary .dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}
.relation-detail-summary .dot.blue {
    background: #2f7df4;
}
.relation-detail-summary .dot.green {
    background: #24b261;
}
.relation-detail-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 30px 22px;
}

/* ==================== 18. 横向排版与分页卡片样式 ==================== */
.ranking-list-panel.grid-mode {
    display: grid !important;
    grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
    grid-auto-rows: minmax(0, auto);
    gap: 18px !important;
    flex-direction: row !important;
}
.rank-book-card-grid {
    background-color: var(--bg-card-solid);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px 14px;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    position: relative;
    transition: all 0.3s;
    box-shadow: var(--shadow-sm);
    cursor: pointer;
}
.rank-book-card-grid:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-color);
}
.rank-book-card-grid:focus-visible {
    outline: 3px solid rgba(76, 175, 80, 0.24);
    outline-offset: 3px;
    border-color: var(--primary-color);
}
.rank-badge-grid {
    position: absolute;
    top: 10px;
    left: 10px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background-color: var(--border-color-solid);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 800;
}
.rank-badge-grid.top-1 { background-color: #ffd54f; color: #5d4037; }
.rank-badge-grid.top-2 { background-color: #cfd8dc; color: #37474f; }
.rank-badge-grid.top-3 { background-color: #ffe0b2; color: #5d4037; }

.rank-cover-grid {
    width: 110px;
    height: 146px;
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 12px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}
.rank-cover-grid a,
.rank-cover-grid img {
    display: block;
    width: 100%;
    height: 100%;
}
.rank-cover-grid img {
    object-fit: cover;
}
.rank-title-grid {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 6px;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
    width: 100%;
}
.rank-author-grid {
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 8px;
    width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.rank-score-grid {
    font-size: 12px;
    font-weight: 800;
    color: var(--accent-color, #ff5722);
    background-color: var(--primary-light);
    padding: 3px 10px;
    border-radius: 12px;
    display: inline-block;
}
.rank-card-tags {
    width: 100%;
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 8px;
}
.rank-card-tags span {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    border: 1px solid var(--border-color);
    border-radius: 999px;
    padding: 2px 7px;
    color: var(--text-muted);
    background: var(--bg-main);
    font-size: 10px;
    font-weight: 700;
}
.rank-intro-grid {
    width: 100%;
    margin-top: 10px;
    color: var(--text-muted);
    font-size: 11px;
    line-height: 1.45;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 48px;
}
.rank-card-open-hint {
    margin-top: auto;
    padding-top: 10px;
    color: var(--primary-color);
    font-size: 11px;
    font-weight: 800;
}
.rank-status-card {
    grid-column: 1 / -1;
    width: 100%;
    padding: 24px;
    border-radius: var(--radius-md);
    background: var(--bg-card-solid);
    border: 1px solid var(--border-color);
    color: var(--text-main);
}
.rank-status-card strong {
    display: block;
    font-size: 16px;
    margin-bottom: 6px;
}
.rank-status-card p {
    margin: 0;
    color: var(--text-muted);
    font-size: 13px;
}
.rank-meta-row {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 12px;
}
.rank-source-chip {
    border: 1px solid var(--border-color);
    border-radius: 999px;
    padding: 5px 10px;
    color: var(--text-muted);
    background: var(--bg-main);
    font-size: 12px;
    font-weight: 700;
}

/* 社会民生热点排行榜 */
.ranking-list-panel.hot-rank-mode {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.hot-rank-header,
.hot-rank-row {
    display: grid;
    grid-template-columns: 64px minmax(0, 1fr) 110px 110px 96px;
    align-items: center;
    gap: 14px;
}
.hot-rank-header {
    padding: 0 18px 6px;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
}
.hot-rank-row {
    background-color: var(--bg-card-solid);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 14px 18px;
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    transition: all 0.2s ease;
}
.hot-rank-row:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-color);
}
.hot-rank-row:focus-visible {
    outline: 3px solid rgba(76, 175, 80, 0.22);
    outline-offset: 2px;
    border-color: var(--primary-color);
}
.hot-rank-no {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: var(--bg-main);
    color: var(--text-main);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 15px;
}
.hot-rank-no.top-1 { background: #ffd54f; color: #5d4037; }
.hot-rank-no.top-2 { background: #cfd8dc; color: #37474f; }
.hot-rank-no.top-3 { background: #ffe0b2; color: #5d4037; }
.hot-rank-main {
    min-width: 0;
}
.hot-rank-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-main);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.hot-rank-bar {
    height: 5px;
    margin-top: 8px;
    background: var(--bg-main);
    border-radius: 999px;
    overflow: hidden;
}
.hot-rank-bar span {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
    border-radius: inherit;
}
.hot-rank-date {
    font-size: 12px;
    color: var(--text-muted);
    text-align: right;
}
/* 热词分析 / 题材推荐 / 标签推荐 */
.hot-event-detail-popover {
    position: fixed;
    z-index: 1200;
    background: var(--bg-card-solid);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    padding: 18px;
    animation: hotEventPop 0.16s ease-out;
}
.btn-hot-event-close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 30px;
    height: 30px;
    border: 0;
    border-radius: 50%;
    background: var(--bg-main);
    color: var(--text-muted);
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
}
.btn-hot-event-close:hover {
    background: var(--primary-color);
    color: #fff;
}
.hot-event-detail-kicker {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding-right: 36px;
    margin-bottom: 12px;
}
.hot-event-detail-kicker span {
    border: 1px solid var(--border-color);
    border-radius: 999px;
    padding: 4px 9px;
    background: var(--bg-main);
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 700;
}
.hot-event-detail-popover h4 {
    margin: 0 0 10px;
    color: var(--text-main);
    font-size: 16px;
    line-height: 1.45;
}
.hot-event-detail-popover p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.7;
}
.hot-event-detail-meta {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-top: 14px;
    color: var(--text-muted);
    font-size: 12px;
}
.hot-event-detail-actions {
    margin-top: 14px;
    display: flex;
    justify-content: flex-end;
}
.hot-event-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 0 14px;
    border-radius: 999px;
    background: var(--primary-color);
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
}
.hot-event-link.disabled {
    background: var(--bg-main);
    color: var(--text-muted);
}
.rank-book-detail-overlay {
    position: fixed;
    inset: 0;
    z-index: 1300;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 28px;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(6px);
}
.rank-book-detail-overlay.active {
    display: flex;
}
.rank-book-detail-card {
    position: relative;
    width: min(960px, 100%);
    max-height: min(86vh, 860px);
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    background: var(--bg-card-solid);
    box-shadow: var(--shadow-lg);
    padding: 24px;
    color: var(--text-main);
}
.rank-book-detail-close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 50%;
    background: var(--bg-main);
    color: var(--text-muted);
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
}
.rank-book-detail-close:hover {
    background: var(--primary-color);
    color: #fff;
}
.rank-book-detail-main {
    display: grid;
    grid-template-columns: 170px minmax(0, 1fr);
    gap: 24px;
    padding-right: 28px;
}
.rank-book-detail-cover {
    width: 170px;
    aspect-ratio: 3 / 4;
    overflow: hidden;
    border-radius: 8px;
    background: var(--bg-main);
    box-shadow: var(--shadow-md);
}
.rank-book-detail-cover img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.rank-book-detail-info {
    min-width: 0;
}
.rank-book-detail-kicker,
.rank-book-detail-meta,
.rank-book-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.rank-book-detail-kicker span,
.rank-book-tag {
    border: 1px solid var(--border-color);
    border-radius: 999px;
    padding: 4px 9px;
    background: var(--bg-main);
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 700;
}
.rank-book-tag.muted {
    opacity: 0.72;
}
.rank-book-detail-info h3 {
    margin: 12px 0 8px;
    color: var(--text-main);
    font-size: 24px;
    line-height: 1.25;
    letter-spacing: 0;
}
.rank-book-detail-meta {
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 700;
    margin-bottom: 12px;
}
.rank-book-full-intro {
    margin: 14px 0 0;
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.8;
    white-space: pre-wrap;
}
.rank-book-detail-actions {
    display: flex;
    gap: 10px;
    margin-top: 16px;
}
.rank-book-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 0 14px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 800;
    text-decoration: none;
}
.rank-book-action.primary {
    color: #fff;
    background: var(--primary-color);
}
.rank-book-action.disabled {
    color: var(--text-muted);
    background: var(--bg-main);
}
.rank-book-analysis-section {
    margin-top: 24px;
    padding-top: 18px;
    border-top: 1px solid var(--border-color);
}
.rank-book-analysis-title {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    align-items: baseline;
    margin-bottom: 14px;
}
.rank-book-analysis-title span {
    color: var(--text-main);
    font-size: 16px;
    font-weight: 900;
}
.rank-book-analysis-title small {
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 700;
}
.book-analysis-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}
.book-analysis-block {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-main);
    padding: 14px;
}
.book-analysis-block.wide {
    grid-column: 1 / -1;
}
.book-analysis-block h5 {
    margin: 0 0 8px;
    color: var(--text-main);
    font-size: 13px;
    font-weight: 900;
}
.book-analysis-block p,
.book-analysis-block li {
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.65;
}
.book-analysis-block p {
    margin: 0;
}
.book-analysis-block ul {
    margin: 0;
    padding-left: 18px;
}
.book-analysis-empty {
    padding: 14px;
    border-radius: var(--radius-md);
    background: var(--bg-main);
    color: var(--text-muted);
    font-size: 13px;
}
.chapter-analysis-panel {
    display: grid;
    gap: 12px;
}
.chapter-analysis-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}
.chapter-analysis-card {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-main);
    padding: 14px;
    min-width: 0;
}
.chapter-analysis-head {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: baseline;
    margin-bottom: 8px;
}
.chapter-analysis-head span {
    color: var(--primary-color);
    font-size: 12px;
    font-weight: 900;
}
.chapter-analysis-head strong {
    color: var(--text-main);
    font-size: 14px;
    line-height: 1.35;
}
.chapter-excerpt {
    margin: 0 0 10px;
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.65;
}
.chapter-analysis-card ul {
    margin: 0;
    padding-left: 18px;
}
.chapter-analysis-card li {
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.6;
}
.chapter-signal-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}
.chapter-signal-row span {
    border: 1px solid var(--border-color);
    border-radius: 999px;
    padding: 3px 8px;
    background: var(--bg-card-solid);
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 800;
}
.chapter-pattern-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}
@keyframes hotEventPop {
    from {
        opacity: 0;
        transform: translateY(6px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}
.writing-analysis-panel {
    gap: 18px;
}
.keyword-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}
.keyword-card {
    background: var(--bg-main);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 14px;
}
.keyword-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}
.keyword-head strong {
    font-size: 14px;
    color: var(--text-main);
}
.keyword-head span {
    font-size: 12px;
    font-weight: 800;
    color: #43a047;
}
.keyword-meter {
    height: 6px;
    background: var(--bg-card-solid);
    border-radius: 999px;
    overflow: hidden;
    margin-bottom: 10px;
}
.keyword-meter i {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
}
.keyword-card p,
.topic-main p {
    color: var(--text-muted);
    font-size: 12px;
    line-height: 1.5;
}
.topic-reco-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}
.topic-reco-card {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 14px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-main);
}
.topic-rank {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    flex-shrink: 0;
}
.topic-main {
    min-width: 0;
    flex: 1;
}
.topic-main h5 {
    font-size: 14px;
    margin-bottom: 4px;
    color: var(--text-main);
}
.topic-fit {
    color: var(--accent-color);
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
}
.novel-label-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
.novel-label-chip {
    padding: 7px 12px;
    border-radius: 999px;
    background: var(--primary-light);
    color: var(--primary-color);
    font-size: 12px;
    font-weight: 700;
}
/* 作品管理菜单与招财猫默认封面 */
.work-book-card {
    position: relative;
}
.cat-cover-container {
    background: linear-gradient(180deg, #fffaf0, #f0f7ef);
}
.lucky-cat-book-cover {
    width: 100%;
    height: 100%;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.lucky-cat-book-cover::before {
    content: "";
    position: absolute;
    inset: 12px;
    border: 1px solid rgba(46, 125, 50, 0.18);
    border-radius: 8px;
}
.lucky-cat-book-cover img {
    width: 76%;
    height: auto;
    filter: drop-shadow(0 10px 16px rgba(46, 125, 50, 0.16));
    transform: translateY(-8px);
}
.lucky-cat-cover-title {
    position: absolute;
    left: 14px;
    right: 14px;
    bottom: 14px;
    color: var(--text-main);
    font-weight: 800;
    font-size: 13px;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.book-subline {
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 6px;
}
.book-card-actions {
    position: absolute;
    right: 10px;
    bottom: 10px;
    z-index: 5;
}
.book-manage-btn {
    padding: 4px 9px;
    border-radius: 6px;
    border: 1px solid rgba(46, 125, 50, 0.18);
    background: rgba(255, 255, 255, 0.78);
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 600;
    box-shadow: none;
}
.book-manage-btn:hover {
    border-color: rgba(46, 125, 50, 0.38);
    background: rgba(240, 247, 239, 0.92);
    color: var(--primary-color);
}
.book-manage-menu {
    position: absolute;
    right: 0;
    bottom: 34px;
    width: 112px;
    padding: 6px;
    border-radius: 8px;
    background: var(--bg-card-solid);
    border: 1px solid var(--border-color-solid);
    box-shadow: var(--shadow-lg);
    display: none;
}
.book-card-actions.open .book-manage-menu {
    display: block;
}
.book-manage-menu button {
    width: 100%;
    padding: 8px 10px;
    border-radius: 6px;
    text-align: left;
    font-size: 12px;
    color: var(--text-main);
}
.book-manage-menu button:hover {
    background: var(--bg-main);
}
.book-manage-menu button.danger {
    color: var(--danger-color);
}
.book-info-modal-card {
    max-width: 560px;
}
.book-info-modal-body {
    display: grid;
    grid-template-columns: 150px 1fr;
    gap: 18px;
    align-items: start;
}
.book-info-cover-preview {
    aspect-ratio: 3 / 4;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border-color-solid);
}
.book-info-detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
.book-info-detail-grid div {
    background: var(--bg-main);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px 12px;
}
.book-info-detail-grid span {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 4px;
}
.book-info-detail-grid strong {
    font-size: 13px;
    color: var(--text-main);
}

@media (max-width: 640px) {
    .rank-book-detail-overlay {
        align-items: stretch;
        padding: 12px;
    }
    .rank-book-detail-card {
        max-height: calc(100vh - 24px);
        padding: 18px;
        border-radius: var(--radius-md);
    }
    .rank-book-detail-main {
        grid-template-columns: 96px minmax(0, 1fr);
        gap: 14px;
        padding-right: 20px;
    }
    .rank-book-detail-cover {
        width: 96px;
    }
    .rank-book-detail-info h3 {
        font-size: 18px;
    }
    .rank-book-analysis-title {
        align-items: flex-start;
        flex-direction: column;
    }
    .book-analysis-grid {
        grid-template-columns: 1fr;
    }
    .chapter-analysis-grid,
    .chapter-pattern-grid {
        grid-template-columns: 1fr;
    }
    .topic-reco-list {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
    }
    .topic-reco-card {
        display: grid !important;
        grid-template-columns: 34px minmax(0, 1fr) auto !important;
        gap: 10px !important;
        align-items: start !important;
        padding: 14px !important;
    }
    .topic-main h5 {
        font-size: 16px !important;
        line-height: 1.35 !important;
        margin-bottom: 6px !important;
        word-break: normal !important;
        overflow-wrap: anywhere !important;
    }
    .topic-main p {
        font-size: 13px !important;
        line-height: 1.55 !important;
        word-break: normal !important;
        overflow-wrap: anywhere !important;
    }
    .topic-fit {
        font-size: 12px !important;
        white-space: nowrap !important;
        align-self: start !important;
    }
    .works-grid {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
    }
    .work-book-card,
    .works-grid .book-card {
        display: grid !important;
        grid-template-columns: 92px minmax(0, 1fr) !important;
        gap: 12px !important;
        align-items: center !important;
        min-height: 132px !important;
        padding: 12px 14px !important;
    }
    .work-book-card .book-cover-container,
    .works-grid .book-card .book-cover-container {
        width: 92px !important;
        height: 122px !important;
        aspect-ratio: auto !important;
        margin: 0 !important;
    }
    .work-book-card .book-info h4,
    .works-grid .book-card .book-info h4 {
        white-space: normal !important;
        font-size: 15px !important;
        line-height: 1.35 !important;
    }
    .ranking-list-panel.grid-mode {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 12px !important;
        overflow: visible !important;
    }
    .rank-book-card-grid {
        min-width: 0 !important;
        padding: 12px 8px !important;
    }
    .rank-cover-grid {
        width: 76px !important;
        height: 102px !important;
        margin-bottom: 8px !important;
    }
    .rank-title-grid {
        font-size: 12px !important;
        line-height: 1.3 !important;
        -webkit-line-clamp: 2 !important;
        min-height: 32px;
    }
    #writer-editor-view.active {
        height: auto !important;
        min-height: calc(100dvh - 56px - 66px - env(safe-area-inset-bottom)) !important;
        overflow: visible !important;
    }
    #writer-panel:has(#writer-editor-view.active) .content-viewport {
        overflow-y: auto !important;
        overflow-x: hidden !important;
        padding: 0 !important;
        -webkit-overflow-scrolling: touch !important;
    }
    #writer-panel.editor-fullscreen-mode .panel-main {
        height: 100dvh !important;
        width: 100vw !important;
        padding-bottom: 0 !important;
        overflow: hidden !important;
    }
    #writer-panel.editor-fullscreen-mode .content-viewport {
        height: 100dvh !important;
        width: 100vw !important;
        padding: 0 !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        -webkit-overflow-scrolling: touch !important;
    }
    #writer-panel.editor-fullscreen-mode #writer-editor-view {
        height: auto !important;
        min-height: 100dvh !important;
        width: 100vw !important;
        overflow: visible !important;
    }
    #writer-editor-view .editor-main-container {
        width: 100% !important;
        height: auto !important;
        min-height: calc(100dvh - 56px - 66px - env(safe-area-inset-bottom)) !important;
        display: grid !important;
        grid-template-columns: minmax(0, 1fr) !important;
        grid-template-rows: auto auto !important;
        border-radius: 0 !important;
        overflow-y: visible !important;
        overflow-x: hidden !important;
    }
    #writer-editor-view .editor-left-nav {
        display: none !important;
    }
    #writer-editor-view .editor-nav-item {
        width: 44px !important;
        height: 46px !important;
    }
    #writer-editor-view .editor-sub-panel,
    #writer-editor-view .editor-resize-handle {
        display: none !important;
    }
    #writer-editor-view .editor-center-canvas {
        min-width: 0 !important;
        width: 100% !important;
        height: 560px !important;
        min-height: 560px !important;
    }
    #writer-editor-view .canvas-header-nav {
        height: 46px !important;
        padding: 0 10px !important;
    }
    #writer-editor-view .canvas-save-status,
    #writer-editor-view .canvas-top-actions {
        display: none !important;
    }
    #writer-editor-view .editor-rich-toolbar {
        height: 38px !important;
        padding: 0 8px !important;
        overflow-x: auto !important;
    }
    #writer-editor-view .editor-text-area-container {
        padding: 22px 18px !important;
        min-height: 0 !important;
    }
    #writer-editor-view .editor-right-ai-panel {
        display: flex !important;
        grid-column: 1 / -1 !important;
        width: 100% !important;
        min-width: 0 !important;
        max-width: none !important;
        height: auto !important;
        min-height: 360px !important;
        flex-shrink: 0 !important;
        border-top: 1px solid var(--border-color) !important;
        background: var(--bg-main) !important;
        margin-bottom: calc(16px + env(safe-area-inset-bottom)) !important;
    }
    #writer-editor-view .ai-tabs {
        position: static !important;
        top: 0 !important;
        z-index: 4 !important;
    }
    #writer-editor-view .ai-pane-content {
        height: auto !important;
        min-height: 300px !important;
        max-height: 560px !important;
        overflow-y: auto !important;
        padding: 12px !important;
    }
    #writer-editor-view .ai-relation-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }
    #writer-editor-view .ai-requirement-textarea {
        height: 150px !important;
    }
    #writer-editor-view .ai-generate-button-wrapper {
        position: static !important;
        margin-top: 12px !important;
        background: transparent !important;
    }
    #chat-relations-popover.relations-popover {
        right: -48px !important;
        width: 190px !important;
        padding: 10px !important;
    }
    .relation-primary-item {
        height: 32px !important;
        padding: 0 12px !important;
        font-size: 11px !important;
    }
    .relation-detail-modal {
        width: calc(100vw - 24px) !important;
        max-width: calc(100vw - 16px) !important;
        height: min(560px, calc(100dvh - 34px)) !important;
        max-height: calc(100dvh - 24px) !important;
        min-width: 300px !important;
        min-height: 340px !important;
        resize: both !important;
        border-radius: 14px !important;
    }
    .relation-detail-header {
        padding: 18px 16px 12px !important;
    }
    .relation-detail-title-wrap h3 {
        font-size: 18px !important;
    }
    .relation-detail-search-row {
        grid-template-columns: 1fr !important;
        padding: 0 16px 12px !important;
    }
    .relation-detail-filter-row {
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        padding: 0 16px 12px !important;
    }
    .relation-detail-filter-row button {
        flex: 0 0 auto !important;
    }
    .relation-detail-list {
        padding: 0 16px !important;
    }
    .relation-detail-row {
        grid-template-columns: 22px minmax(0, 1fr) auto !important;
        gap: 8px !important;
        font-size: 14px !important;
        min-width: 0 !important;
    }
    .relation-detail-words,
    .relation-detail-mode {
        display: none !important;
    }
    .relation-detail-summary {
        margin: 10px 16px 0 !important;
        min-height: 46px !important;
        flex-wrap: wrap !important;
    }
    .relation-detail-actions {
        padding: 14px 16px 18px !important;
    }
}

/* 手机端修复：保留编辑器更多操作，并让管理员后台可操作 */
@media (max-width: 640px) {
    #writer-editor-view .canvas-header-nav {
        display: grid !important;
        grid-template-columns: minmax(0, 1fr) auto !important;
        height: auto !important;
        min-height: 48px !important;
        padding: 6px 10px !important;
        gap: 8px !important;
    }
    #writer-editor-view .breadcrumbs {
        min-width: 0 !important;
        overflow: hidden !important;
    }
    #writer-editor-view .canvas-save-status {
        display: none !important;
    }
    #writer-editor-view .canvas-top-actions {
        display: flex !important;
        flex-shrink: 0 !important;
        justify-content: flex-end !important;
        align-items: center !important;
        min-width: 92px !important;
    }
    #writer-editor-view #btn-editor-more {
        min-height: 34px !important;
        padding: 6px 10px !important;
        font-size: 12px !important;
        white-space: nowrap !important;
    }
    #writer-editor-view .editor-more-menu {
        position: fixed !important;
        top: 54px !important;
        right: 10px !important;
        z-index: 700 !important;
        width: min(220px, calc(100vw - 20px)) !important;
        max-height: calc(100dvh - 90px) !important;
        overflow-y: auto !important;
    }
    #writer-editor-view .btn-editor-back {
        margin-right: 4px !important;
        padding: 4px 8px !important;
        font-size: 11px !important;
    }

    #admin-panel {
        display: flex !important;
        flex-direction: column !important;
        height: 100dvh !important;
        min-height: 100dvh !important;
        width: 100vw !important;
        overflow: hidden !important;
        background: var(--bg-main) !important;
    }
    #admin-panel .panel-sidebar {
        order: 2 !important;
        position: fixed !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        width: 100vw !important;
        height: 72px !important;
        padding: 6px 8px calc(6px + env(safe-area-inset-bottom)) !important;
        border-right: none !important;
        border-top: 1px solid var(--border-color) !important;
        background: var(--bg-sidebar) !important;
        z-index: 500 !important;
        overflow: hidden !important;
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        justify-content: center !important;
    }
    #admin-panel .sidebar-logo,
    #admin-panel .sidebar-user-card,
    #admin-panel .menu-group-label {
        display: none !important;
    }
    #admin-panel .sidebar-menu {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        gap: 6px !important;
        width: 100% !important;
        height: 100% !important;
        overflow-x: auto !important;
        overflow-y: hidden !important;
        padding: 0 4px !important;
        scrollbar-width: none !important;
    }
    #admin-panel .sidebar-menu::-webkit-scrollbar {
        display: none !important;
    }
    #admin-panel .menu-item {
        flex: 0 0 auto !important;
        min-width: 72px !important;
        height: 54px !important;
        display: flex !important;
        flex-direction: column !important;
        justify-content: center !important;
        align-items: center !important;
        gap: 3px !important;
        padding: 6px 8px !important;
        border-radius: 14px !important;
        font-size: 11px !important;
        line-height: 1.15 !important;
        white-space: nowrap !important;
    }
    #admin-panel .menu-item .menu-icon {
        font-size: 18px !important;
        line-height: 1 !important;
    }
    #admin-panel .panel-main {
        order: 1 !important;
        width: 100vw !important;
        min-width: 0 !important;
        height: 100dvh !important;
        padding-bottom: calc(72px + env(safe-area-inset-bottom)) !important;
        overflow: hidden !important;
        background: var(--bg-main) !important;
    }
    #admin-panel .panel-header {
        height: 54px !important;
        padding: 0 12px !important;
        gap: 8px !important;
        flex-shrink: 0 !important;
    }
    #admin-panel .header-search {
        display: flex !important;
        width: auto !important;
        flex: 1 !important;
        min-width: 0 !important;
        padding: 7px 10px !important;
    }
    #admin-panel .header-actions {
        gap: 8px !important;
        flex-shrink: 0 !important;
    }
    #admin-panel .server-status-pill,
    #admin-panel .username-display {
        display: none !important;
    }
    #admin-panel .content-viewport {
        flex: 1 1 auto !important;
        width: 100% !important;
        min-width: 0 !important;
        height: auto !important;
        padding: 14px !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        -webkit-overflow-scrolling: touch !important;
        background: var(--bg-main) !important;
    }
    #admin-panel .subview.active {
        display: block !important;
        width: 100% !important;
        min-width: 0 !important;
    }
    #admin-panel .admin-welcome-row,
    #admin-panel .works-mgr-header,
    #admin-panel .table-card-header,
    #admin-panel .feedback-detail-head {
        align-items: flex-start !important;
        flex-direction: column !important;
        gap: 10px !important;
    }
    #admin-panel .welcome-actions,
    #admin-panel .search-bar-ui,
    #admin-panel .log-filters,
    #admin-panel .feedback-filter-row {
        width: 100% !important;
        flex-wrap: wrap !important;
    }
    #admin-panel .admin-metrics-row,
    #admin-panel .stats-overview-grid,
    #admin-panel .admin-tool-grid,
    #admin-panel .admin-status-grid,
    #admin-panel .form-row-grid,
    #admin-panel .admin-role-detail-grid,
    #admin-panel .system-prompt-grid {
        grid-template-columns: 1fr !important;
    }
    #admin-panel .system-prompt-head,
    #admin-panel .system-prompt-footer {
        align-items: flex-start !important;
        flex-direction: column !important;
        gap: 12px !important;
    }
    #admin-panel .system-prompt-injection-card {
        padding: 14px !important;
    }
    #admin-panel .system-prompt-actions {
        width: 100% !important;
        flex-wrap: wrap !important;
    }
    #admin-panel .system-prompt-actions .btn {
        flex: 1 1 120px !important;
    }
    #admin-panel .admin-chart-card,
    #admin-panel .admin-table-card,
    #admin-panel .admin-log-card,
    #admin-panel .admin-tool-card,
    #admin-panel .stats-panel {
        padding: 14px !important;
        border-radius: 10px !important;
    }
    #admin-panel .table-responsive,
    #admin-panel .admin-table-wrap {
        overflow-x: auto !important;
    }
}
/* Auth / AI backend bridge */
.admin-ai-bridge-card {
    margin-top: 18px;
    padding: 22px;
    border-radius: 8px;
}

.compact-head {
    margin-bottom: 16px;
}

.admin-ai-bridge-card .admin-textarea {
    min-height: 150px;
    resize: vertical;
}

.admin-ai-bridge-card .system-prompt-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 14px;
}

@media (max-width: 760px) {
    .admin-ai-bridge-card {
        padding: 16px;
    }

    .admin-ai-bridge-card .system-prompt-actions {
        justify-content: stretch;
    }

    .admin-ai-bridge-card .system-prompt-actions .btn {
        width: 100%;
    }
}
