:root {
    --bg-base: #f5f5f7;
    --text-main: #1d1d1f;
    --text-muted: #86868b;
    --accent-blue: #0066cc;
    --accent-green: #34c759;
    --accent-danger: #ff3b30;
    --surface-color: rgba(255, 255, 255, 0.75);
    --glass-blur: blur(30px);
    --luxury-shadow: 0 20px 40px rgba(0, 0, 0, 0.06);
    --card-shadow: 0 4px 14px rgba(0,0,0,0.03);
    --reader-line-height: 1.85;
    --reader-font-size: 19px;
}

@keyframes spin { 100% { transform: rotate(360deg); } }
::-webkit-scrollbar { display: none; }

html, body { 
    margin: 0; padding: 0; width: 100%; height: 100%; 
    background: var(--bg-base); color: var(--text-main); 
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif; 
    overflow: hidden; overscroll-behavior: none; -webkit-tap-highlight-color: transparent;
}

.app-shell { width: 100%; max-width: 1400px; height: 100vh; margin: 0 auto; background: #ffffff; display: flex; flex-direction: column; position: relative; overflow: hidden; }
@media (min-width: 768px) { .app-shell { height: 96vh; margin: 2vh auto; border-radius: 28px; box-shadow: var(--luxury-shadow); border: 1px solid rgba(0,0,0,0.03); } }

.nav-bar { padding: 18px 32px; display: flex; justify-content: space-between; align-items: center; background: var(--surface-color); backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur); border-bottom: 1px solid rgba(0,0,0,0.05); z-index: 100; position: sticky; top:0; }
.nav-bar .nav-title { font-size: 22px; font-weight: 900; color: #1d1d1f; letter-spacing: -0.5px; }
.nav-btn { background: #f5f5f7; border: none; color: #1d1d1f; padding: 10px 20px; border-radius: 100px; font-size: 14px; font-weight: 800; cursor: pointer; transition: all 0.3s cubic-bezier(0.2, 0.5, 0.5, 1); }
.nav-btn:hover { background: #e8e8ed; transform: translateY(-1px); }
.nav-btn:active { transform: scale(0.96); }

.content-body { flex: 1; overflow-y: auto; padding: 40px; box-sizing: border-box; display: flex; flex-direction: column; padding-bottom: 80px; scroll-behavior: smooth;}
@media (max-width: 768px) { .content-body { padding: 20px; } }

.history-quick-portal { background: linear-gradient(135deg, #001b3b, #0056b3); padding: 24px 30px; border-radius: 24px; margin: 0 auto 40px auto; width: 100%; max-width: 1200px; box-sizing: border-box; display: none; justify-content: space-between; align-items: center; cursor: pointer; box-shadow: 0 15px 30px rgba(0, 113, 227, 0.25); color: white; transition: transform 0.3s; border: 1px solid rgba(255,255,255,0.1); }
.history-quick-portal:hover { transform: translateY(-3px); box-shadow: 0 20px 40px rgba(0, 113, 227, 0.3); }
.hq-left-content { display: flex; align-items: center; gap: 20px; flex: 1; min-width: 0; }
.hq-icon { font-size: 32px; flex-shrink: 0; }
.hq-text-info { display: flex; flex-direction: column; flex: 1; min-width: 0; gap: 6px; }
.hq-subtitle { font-size: 13px; opacity: 0.8; font-weight: 700; text-transform: uppercase; letter-spacing: 1px;}
.hq-main-title { font-size: 20px; font-weight: 900; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.2; }
.hq-action-btn { background: rgba(255,255,255,0.15); backdrop-filter: blur(10px); padding: 12px 24px; border-radius: 100px; font-size: 14px; font-weight: 800; flex-shrink: 0; margin-left: 20px; transition: background 0.3s;}
.history-quick-portal:hover .hq-action-btn { background: rgba(255,255,255,0.25); }

.shelf-title-box { font-size: 26px; font-weight: 900; color: #1d1d1f; margin-bottom: 24px; display: flex; align-items: center; gap: 10px; letter-spacing: -0.5px; }
.bookshelf-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 25px; }
@media (min-width: 768px) { .bookshelf-grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 40px; } }
.book-wrapper { display: flex; flex-direction: column; align-items: flex-start; cursor: pointer; text-decoration: none; transition: transform 0.3s cubic-bezier(0.2, 0.5, 0.5, 1); }
.book-wrapper:hover { transform: translateY(-6px); }
.book-3d-cover { width: 100%; aspect-ratio: 3 / 4; position: relative; border-radius: 6px 16px 16px 6px; box-shadow: -2px 0 5px rgba(0,0,0,0.05), 8px 12px 25px rgba(0,0,0,0.12); display: flex; align-items: center; justify-content: center; box-sizing: border-box; background-size: cover; background-position: center; transition: all 0.3s; }
.book-wrapper:hover .book-3d-cover { box-shadow: -2px 0 5px rgba(0,0,0,0.05), 12px 18px 35px rgba(0,0,0,0.18); }
.book-3d-cover::before { content: ''; position: absolute; top: 0; left: 4px; width: 2px; height: 100%; background: linear-gradient(to right, rgba(255,255,255,0.4), rgba(0,0,0,0.05)); z-index: 10; }
.book-no-cover-inner { border: 1px solid rgba(255,255,255,0.3); width: 88%; height: 90%; border-radius: 4px; display: flex; align-items: center; justify-content: center; padding: 10px; box-sizing: border-box; background: rgba(255,255,255,0.1); }
.book-no-cover-inner .b-title { font-family: "STKaiti", serif; font-size: 16px; font-weight: bold; color: #fff; text-align: center; text-shadow: 0 2px 4px rgba(0,0,0,0.3); display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.book-label-text { font-size: 16px; font-weight: 900; margin-top: 16px; color: #1d1d1f; width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.book-update-status { font-size: 13px; color: var(--text-muted); margin-top: 4px; font-weight: 600; display:flex; gap: 8px; align-items:center; }
.word-count-badge { background: rgba(0, 113, 227, 0.1); color: #0071e3; padding: 2px 6px; border-radius: 4px; font-size: 11px; font-weight: 800;}

#luxury-reader-view { display: none; position: fixed; inset: 0; z-index: 1000; flex-direction: column; box-sizing: border-box; background: #fbf6ec; color: #3e2c1c; }
.reader-nav { position: absolute; top: 0; left: 0; width: 100%; display: flex; flex-direction: column; background: var(--surface-color); backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur); box-shadow: 0 4px 20px rgba(0,0,0,0.05); z-index: 1500; transform: translateY(-100%); transition: transform 0.3s cubic-bezier(0.2, 0.5, 0.5, 1); padding-top: env(safe-area-inset-top); }
.nav-top-row { display: flex; flex-wrap: nowrap; overflow-x: auto; padding: 12px 16px; gap: 10px; align-items: center; -webkit-overflow-scrolling: touch; }
.nav-top-row::-webkit-scrollbar { display: none; }
.reader-nav button { flex-shrink: 0; display: flex; align-items: center; gap: 6px; background: #ffffff; border: none; border-radius: 100px; padding: 10px 18px; cursor: pointer; font-weight: 700; font-size: 14px; color: #1d1d1f; box-shadow: 0 2px 8px rgba(0,0,0,0.04); transition: transform 0.1s; white-space: nowrap; }

.nav-color-row { display: flex; align-items: center; justify-content: flex-start; padding: 12px 16px 16px 16px; border-top: 1px solid rgba(0,0,0,0.05); flex-wrap: nowrap; overflow-x: auto; gap: 12px; -webkit-overflow-scrolling: touch; }
.nav-color-row::-webkit-scrollbar { display: none; }
.color-dot-pool { display: flex; gap: 12px; flex-shrink: 0; align-items: center; }
.color-dot { width: 32px; height: 32px; border-radius: 50%; border: 2px solid rgba(0,0,0,0.05); box-shadow: inset 0 2px 4px rgba(0,0,0,0.1); cursor: pointer; flex-shrink: 0;}

.reader-footer { position: absolute; bottom: 0; left: 0; width: 100%; text-align: center; font-size: 13px; font-weight: 700; color: #86868b; background: linear-gradient(to top, var(--surface-color), rgba(255,255,255,0)); backdrop-filter: blur(5px); z-index: 1500; transform: translateY(100%); transition: transform 0.3s; padding: 20px 0 calc(20px + env(safe-area-inset-bottom)); }
.show-menu { transform: translateY(0); }

.reader-body { flex: 1; width: 100%; position: relative; overflow: hidden; touch-action: none; }
#stage-wrapper { position: absolute; top: 30px; bottom: calc(30px + env(safe-area-inset-bottom)); left: 24px; right: 24px; overflow: hidden; }
@media (min-width: 768px) { #stage-wrapper { width: 700px; left: 50%; right: auto; margin-left: -350px; } }

#novel-stage { height: 100%; width: auto; -webkit-column-width: calc(100vw - 48px); -moz-column-width: calc(100vw - 48px); column-width: calc(100vw - 48px); -webkit-column-gap: 48px; -moz-column-gap: 48px; column-gap: 48px; column-fill: auto; transition: transform 0.3s cubic-bezier(0.2, 0.5, 0.5, 1), opacity 0.2s; }
@media (min-width: 768px) { #novel-stage { -webkit-column-width: 700px; -moz-column-width: 700px; column-width: 700px; -webkit-column-gap: 80px; -moz-column-gap: 80px; column-gap: 80px; } }

.ch-illus-box { text-align: center; width: 100%; margin: 15px auto; break-inside: avoid-column; -webkit-column-break-inside: avoid; }
.ch-illus-box img { max-width: 100%; max-height: 40vh; border-radius: 12px; box-shadow: 0 8px 20px rgba(0,0,0,0.1); object-fit: contain; }

/* 🌟 核心突破：强制粉碎内联样式！添加 !important 防止富文本粘贴带来的干扰 */
#novel-stage p, 
#novel-stage > div:not(.ch-illus-box):not(.interaction-panel) { 
    margin: 0 0 1.2em 0; text-indent: 2em; 
    line-height: var(--reader-line-height) !important; 
    font-size: var(--reader-font-size) !important; 
    word-break: break-all; padding-right: 4px; text-align: justify; 
    white-space: pre-wrap; transition: background 0.2s; orphans: 2; widows: 2; 
}
#novel-stage span, 
#novel-stage font, 
#novel-stage a {
    line-height: var(--reader-line-height) !important; 
    font-size: var(--reader-font-size) !important; 
}

#novel-stage h3 { font-size: 1.4em; font-weight: 900; margin-bottom: 1.5em; text-align: center; line-height: 1.4; break-inside: avoid-column; -webkit-column-break-inside: avoid; }
.tts-reading-active { background: rgba(52, 199, 89, 0.15) !important; color: #248a3d !important; border-radius: 8px; box-shadow: 0 0 0 4px rgba(52, 199, 89, 0.15); }

.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); backdrop-filter: blur(5px); z-index: 9000; display: flex; align-items: center; justify-content: center; }
.modal-card { background: #fff; padding: 35px 24px; border-radius: 24px; box-shadow: 0 10px 40px rgba(0,0,0,0.2); width: 85%; max-width: 340px; text-align: center; }

#reader-drawer { position: absolute; top: 0; left: 0; width: 340px; max-width: 85%; height: 100%; background: rgba(255,255,255,0.95); backdrop-filter: blur(20px); z-index: 2000; box-shadow: 20px 0 50px rgba(0,0,0,0.1); transform: translateX(-100%); transition: transform 0.3s cubic-bezier(0.2, 0.5, 0.5, 1); display: flex; flex-direction: column; }
.drawer-search-box { padding: 20px; background: #f9f9f9; border-bottom: 1px solid rgba(0,0,0,0.05); }
.drawer-search-box input { width: 100%; padding: 12px 16px; border-radius: 100px; border: none; background: #e8e8ed; box-sizing: border-box; outline: none; font-size: 15px; font-weight: 500; }
.drawer-list { flex: 1; overflow-y: auto; padding-bottom: calc(20px + env(safe-area-inset-bottom)); }
.drawer-item { padding: 16px 24px; font-size: 15px; border-bottom: 1px solid rgba(0,0,0,0.03); cursor: pointer; font-weight: 500; color: #1d1d1f; }
.drawer-item.active-ch { background: #f4f9ff; color: var(--accent-blue); font-weight: 800; }
#drawer-mask { display: none; position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.4); z-index: 1999; backdrop-filter: blur(2px); }
.drawer-volume { padding: 24px 24px 8px 24px; font-size: 13px; font-weight: 900; color: var(--accent-blue); letter-spacing: 1px; position: sticky; top: 0; background: rgba(255,255,255,0.95); backdrop-filter: blur(10px); z-index: 10; border-bottom: 1px solid rgba(0,0,0,0.03); text-transform: uppercase; }
.toast { position: fixed; top: 50px; left: 50%; transform: translateX(-50%); background: rgba(0,0,0,0.85); backdrop-filter: blur(10px); color: #fff; padding: 14px 28px; border-radius: 100px; font-size: 15px; font-weight: 600; z-index: 99999; opacity: 0; transition: opacity 0.3s; pointer-events: none; box-shadow: 0 10px 30px rgba(0,0,0,0.2); }

.auth-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.6); backdrop-filter: blur(10px); z-index: 9999; display: flex; align-items: center; justify-content: center; }
.auth-card { background: #fff; padding: 40px; border-radius: 24px; box-shadow: 0 20px 50px rgba(0,0,0,0.2); width: 100%; max-width: 380px; box-sizing: border-box; }
.auth-card input { width: 100%; padding: 16px; border-radius: 12px; border: 1px solid #e5e5ea; background: #f5f5f7; margin-bottom: 15px; box-sizing: border-box; outline: none; font-size: 16px; font-weight: bold;}
.auth-card input:focus { border-color: var(--accent-blue); background: #fff; box-shadow: 0 0 0 4px rgba(0,113,227,0.1); }
.auth-tabs { display: flex; gap: 10px; margin-bottom: 24px; }
.auth-tab { flex: 1; text-align: center; padding: 12px; font-size: 16px; font-weight: 800; color: var(--text-muted); cursor: pointer; border-bottom: 3px solid transparent; transition: all 0.2s; }
.auth-tab.active { color: var(--accent-blue); border-bottom-color: var(--accent-blue); }

.lock-container { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100vh; padding: 30px; box-sizing: border-box; background: var(--bg-base);}
.lock-card { background: #ffffff; padding: 50px; border-radius: 30px; box-shadow: var(--luxury-shadow); width: 100%; max-width: 420px; text-align: center; border: 1px solid rgba(0,0,0,0.03); }
.lock-card input { width: 100%; padding: 18px; border-radius: 14px; border: 2px solid #e5e5ea; background: #f5f5f7; color: #1d1d1f; text-align: center; font-size: 18px; font-weight: bold; outline: none; margin-bottom: 25px; box-sizing: border-box; transition: all 0.2s; }
.lock-card input:focus { border-color: var(--accent-blue); background: #ffffff; box-shadow: 0 0 0 4px rgba(0,113,227,0.1); }

.admin-layout { display: flex; height: 100vh; width: 100vw; overflow: hidden; background: #f4f6f9; font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", sans-serif; position:relative; }
.admin-sidebar { width: 280px; background: #111111; color: #fff; display: flex; flex-direction: column; flex-shrink: 0; z-index: 100; box-shadow: 4px 0 24px rgba(0,0,0,0.08); transition: transform 0.3s cubic-bezier(0.2, 0.5, 0.5, 1); }
@media (max-width: 850px) {
    .admin-sidebar { position: fixed; height: 100%; transform: translateX(-100%); z-index: 9999; }
    .admin-sidebar.show { transform: translateX(0); }
    .admin-mobile-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5); backdrop-filter: blur(5px); z-index: 9998; }
    .admin-mobile-overlay.show { display: block; }
}

.admin-sidebar-header { height: 75px; display: flex; align-items: center; padding: 0 24px; font-size: 20px; font-weight: 900; color: #fff; border-bottom: 1px solid rgba(255,255,255,0.05); background: #0a0a0a; letter-spacing: 1px; flex-shrink: 0; justify-content: space-between;}
.admin-menu { flex: 1; padding: 24px 16px; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; }
.admin-menu-label { font-size: 13px; color: #666; font-weight: 800; text-transform: uppercase; padding: 10px 12px 4px 12px; margin-top: 10px; letter-spacing: 1px; }
.admin-menu-item { display: flex; align-items: center; gap: 14px; padding: 14px 18px; color: #a1a1aa; text-decoration: none; font-size: 15px; font-weight: 600; border-radius: 12px; cursor: pointer; transition: all 0.2s cubic-bezier(0.2, 0.5, 0.5, 1); border: 1px solid transparent; }
.admin-menu-item:hover { background: rgba(255,255,255,0.06); color: #fff; transform: translateX(4px); }
.admin-menu-item.active { background: linear-gradient(135deg, #0066cc, #0056b3); color: #fff; font-weight: 800; box-shadow: 0 8px 20px rgba(0, 102, 204, 0.3); border-color: rgba(255,255,255,0.1); transform: translateX(4px); }
.admin-sidebar-footer { padding: 24px; background: #0a0a0a; border-top: 1px solid rgba(255,255,255,0.05); flex-shrink: 0; }

.admin-main { flex: 1; display: flex; flex-direction: column; overflow: hidden; background: #f4f6f9; position: relative; }
.admin-topbar { height: 75px; background: rgba(255,255,255,0.9); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); display: flex; align-items: center; justify-content: space-between; padding: 0 40px; box-shadow: 0 4px 20px rgba(0,0,0,0.03); z-index: 90; flex-shrink: 0; border-bottom: 1px solid rgba(0,0,0,0.04); }
@media (max-width: 850px) { .admin-topbar { padding: 0 20px; } }

.mobile-menu-btn { display: none; font-size: 24px; background: none; border: none; cursor: pointer; padding: 5px; margin-right: 15px; color:#1d1d1f; }
@media (max-width: 850px) { .mobile-menu-btn { display: block; } }

.admin-content-scroll { flex: 1; overflow-y: auto; padding: 40px; }
@media (max-width: 850px) { .admin-content-scroll { padding: 20px; } }

.admin-content-inner { max-width: 1600px; margin: 0 auto; width: 100%; display: flex; flex-direction: column; gap: 24px; }
.admin-content-inner.wide { max-width: 100%; }

.create-book-form, .author-card, .stat-box { background: #ffffff; padding: 30px; border-radius: 20px; box-shadow: var(--card-shadow); border: 1px solid rgba(0,0,0,0.04); }
.create-book-form input[type="text"], .create-book-form textarea { width: 100%; padding: 18px; border: 1px solid #e5e5ea; border-radius: 12px; margin-bottom: 20px; box-sizing: border-box; font-size: 16px; outline: none; background: #f5f5f7; transition: all 0.2s; font-family: inherit;}
.create-book-form input:focus, .create-book-form textarea:focus { background: #ffffff; border-color: var(--accent-blue); box-shadow: 0 0 0 4px rgba(0,113,227,0.1); }
.premium-btn { background: var(--accent-blue); color: white; border: none; padding: 16px 28px; border-radius: 100px; font-weight: 800; font-size: 16px; cursor: pointer; transition: all 0.2s; box-shadow: 0 4px 12px rgba(0, 102, 204, 0.2); box-sizing: border-box; white-space: nowrap; }
.premium-btn:hover { background: #0056b3; transform: translateY(-1px); }
.premium-btn:active { transform: scale(0.96); }
.danger-btn { background: #ffeeed; color: var(--accent-danger); border: none; padding: 12px 24px; border-radius: 100px; font-weight: 800; cursor: pointer; font-size: 15px; transition: all 0.2s; }
.danger-btn:hover { background: #ffdcd9; }

.drag-handle { font-size: 24px; color: #cbd5e1; cursor: grab; padding: 0 10px; user-select: none; -webkit-user-select: none; touch-action: none; }
.drag-handle:active { cursor: grabbing; color: #0071e3; }
.vol-card { background: #f8fafc; border-left: 4px solid var(--accent-blue); padding: 16px 20px; border-radius: 12px; margin-bottom: 12px; display: flex; justify-content: space-between; align-items: center; font-size: 16px; font-weight: 800; color: #1d1d1f; box-shadow: 0 2px 5px rgba(0,0,0,0.02); }

input[type="file"] { width: 100%; padding: 14px; background: #f5f5f7; border-radius: 12px; box-sizing: border-box; font-size: 15px; color: var(--text-muted); cursor: pointer; outline: none; }
input[type="file"]::file-selector-button { padding: 10px 20px; border-radius: 100px; background: #ffffff; border: 1px solid rgba(0,0,0,0.1); color: #1d1d1f; font-weight: 800; cursor: pointer; transition: background 0.2s; margin-right: 15px; box-shadow: 0 2px 5px rgba(0,0,0,0.02); }

.dashboard-header-stats { display: flex; gap: 24px; flex-wrap: wrap; }
.stat-box { flex: 1; min-width: 150px; text-align: center; padding: 24px; }
.stat-num { font-size: 42px; font-weight: 900; color: var(--accent-blue); margin-bottom: 6px; }

.write-stage { background: transparent; padding: 0; border: none; box-shadow: none; display: flex; flex-direction: column; gap: 20px; height: 100%; align-items: center;}
.rt-editor-wrapper { width: 100%; max-width: 1000px; border: 1px solid #e5e5ea; border-radius: 16px; overflow: hidden; background: #f5f5f7; display: flex; flex-direction: column; transition: border-color 0.2s; flex: 1; min-height: 75vh; box-shadow: var(--card-shadow); }
.rt-editor-wrapper:focus-within { border-color: var(--accent-blue); box-shadow: 0 0 0 4px rgba(0,102,204,0.1), var(--card-shadow); }
.rt-toolbar { background: #ffffff; border-bottom: 1px solid #e5e5ea; padding: 14px 20px; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; justify-content: center; position: sticky; top:0; z-index:10;}
.rt-toolbar button, .rt-toolbar input[type="color"] { background: #ffffff; border: 1px solid #d1d1d6; border-radius: 8px; padding: 8px 16px; font-size: 15px; cursor: pointer; color: #1d1d1f; font-weight: bold; box-shadow: 0 2px 4px rgba(0,0,0,0.02); display: flex; align-items: center; justify-content: center; height: 38px; box-sizing: border-box; transition: all 0.2s; }
.rt-toolbar input[type="color"] { padding: 0 4px; width: 44px; }
.rt-toolbar button:hover { background: #f0f0f0; transform: translateY(-1px); }

.rt-editor { flex: 1; max-width: 800px; margin: 20px auto; background: #fff; padding: 50px 60px; outline: none; font-size: 18px; line-height: 1.85; cursor: text; border-radius: 8px; box-shadow: 0 10px 30px rgba(0,0,0,0.05); }
@media (max-width: 850px) { .rt-editor { max-width: 100%; margin: 0; padding: 25px 20px; border-radius: 0; box-shadow: none;} }
.rt-editor p, .rt-editor div { margin: 0 0 1.2em 0; text-indent: 2em; }
.rt-editor img { max-width: 100%; border-radius: 12px; margin: 20px auto; display: block; box-shadow: 0 4px 20px rgba(0,0,0,0.1); }