:root{
  --accent:#2f6bff;
  --ink:#1c2b4a;
  --ink2:#5a6b8c;
  --ink3:#93a3c0;
  --bg:#edf1f8;
  --card:#ffffff;
  --line:#e3e9f4;
  --navy:#0b1530;
  --navy2:#101f42;
  --gold:#f5a623;
  --green:#22b573;
  --rose:#f472b6;
  --danger:#ef4444;
  --shadow:0 6px 24px rgba(28,43,74,.08);
  --radius:16px;
}
*{box-sizing:border-box; margin:0; padding:0}
html{scroll-behavior:smooth}
body{
  font-family:"PingFang SC","Microsoft YaHei","Noto Sans SC",sans-serif;
  background:var(--bg); color:var(--ink); min-height:100vh;
}
a{color:inherit; text-decoration:none}
button{font-family:inherit; cursor:pointer}
img{display:block; max-width:100%}
::-webkit-scrollbar{width:9px; height:9px}
::-webkit-scrollbar-thumb{background:#c3cfe2; border-radius:99px}

/* ---------- layout ---------- */
.layout{display:flex; min-height:100vh}
.sidebar{
  width:234px; flex:none; position:fixed; inset:0 auto 0 0; z-index:40;
  background:linear-gradient(180deg, var(--navy) 0%, var(--navy2) 70%, #0a1430 100%);
  color:#dbe6ff; display:flex; flex-direction:column; overflow:hidden;
}
.main-col{flex:1; margin-left:234px; min-width:0; display:flex; flex-direction:column}
.app{flex:1; width:100%; max-width:1460px; margin:0 auto; padding:20px 26px 60px}

/* ---------- sidebar ---------- */
.brand{display:flex; gap:11px; align-items:center; padding:22px 20px 16px}
.brand-icon{
  width:42px; height:42px; border-radius:12px; display:flex; align-items:center; justify-content:center;
  background:linear-gradient(135deg,#3b82f6,#8b5cf6); font-size:21px; flex:none;
  box-shadow:0 6px 16px rgba(59,130,246,.45);
}
.brand-icon.small{width:34px; height:34px; font-size:17px; border-radius:10px}
.brand-name{font-size:19px; font-weight:700; letter-spacing:.06em}
.brand-sub{font-size:11.5px; color:#8fa8d8; margin-top:2px; letter-spacing:.08em}
.snav{padding:8px 14px; display:flex; flex-direction:column; gap:4px}
.snav a{
  display:flex; align-items:center; gap:12px; padding:11px 14px; border-radius:11px;
  color:#aebfdf; font-size:15px; transition:.2s;
}
.snav a .ic{font-size:16px; width:20px; text-align:center}
.snav a:hover{background:rgba(255,255,255,.07); color:#fff}
.snav a.on{background:var(--accent); color:#fff; font-weight:600; box-shadow:0 6px 16px rgba(47,107,255,.4)}
.side-art{
  margin-top:auto; height:300px; position:relative; flex:none;
  background-size:cover; background-position:center bottom;
}
.side-art::before{content:""; position:absolute; inset:0; background:linear-gradient(180deg, var(--navy2) 0%, transparent 34%)}
.side-quote{
  position:absolute; left:20px; bottom:22px; color:#eaf1ff; font-size:14.5px; line-height:1.9;
  font-family:"STKaiti","KaiTi",serif; letter-spacing:.06em; text-shadow:0 2px 10px rgba(0,0,0,.55); z-index:1;
}

/* ---------- topbar / tabbar (mobile) ---------- */
.topbar{
  display:none; position:sticky; top:0; z-index:35; padding:12px 16px;
  background:rgba(237,241,248,.92); backdrop-filter:blur(8px);
  align-items:center; justify-content:space-between;
}
.tb-brand{display:flex; gap:9px; align-items:center}
.tb-title{font-size:16.5px; font-weight:700}
.tb-sub{font-size:10.5px; color:var(--ink3)}
.tb-actions{display:flex; gap:8px}
.icon-btn{
  width:38px; height:38px; border-radius:50%; border:1px solid var(--line); background:#fff;
  font-size:17px; color:var(--ink); display:flex; align-items:center; justify-content:center; box-shadow:var(--shadow);
}
.tabbar{
  display:none; position:fixed; left:0; right:0; bottom:0; z-index:45;
  background:rgba(255,255,255,.97); border-top:1px solid var(--line);
  padding:6px 8px calc(6px + env(safe-area-inset-bottom));
  grid-template-columns:repeat(5,1fr);
}
.tabbar a{display:flex; flex-direction:column; align-items:center; gap:2px; font-size:11px; color:var(--ink2); padding:4px 0}
.tabbar a .tic{font-size:19px; line-height:1.2}
.tabbar a.on{color:var(--accent); font-weight:600}
.tabbar a.center{margin-top:-16px}
.tabbar a.center .center-dot{
  width:46px; height:46px; border-radius:50%; background:var(--accent); color:#fff; font-size:24px;
  display:flex; align-items:center; justify-content:center; box-shadow:0 8px 18px rgba(47,107,255,.45); border:3px solid #fff;
}

/* ---------- generic ---------- */
.card{background:var(--card); border-radius:var(--radius); box-shadow:var(--shadow); padding:20px}
.card h3.card-title{font-size:16.5px; display:flex; align-items:center; gap:8px; margin-bottom:14px}
.card h3.card-title .more{margin-left:auto; font-size:12.5px; color:var(--ink3); font-weight:400; cursor:pointer}
.btn{
  background:var(--accent); color:#fff; border:none; border-radius:10px; padding:9px 20px;
  font-size:14.5px; font-weight:600; transition:.2s; display:inline-flex; align-items:center; gap:6px;
}
.btn:hover{filter:brightness(1.08)}
.btn.ghost{background:#eef3fd; color:var(--accent)}
.btn.plain{background:#fff; color:var(--ink2); border:1px solid var(--line); font-weight:500}
.btn.danger{background:#fef2f2; color:var(--danger); border:1px solid #fecaca}
.btn.small{padding:6px 13px; font-size:13px; border-radius:8px}
.btn:disabled{opacity:.4}
input,select,textarea{
  width:100%; border:1px solid var(--line); border-radius:10px; background:#fbfcfe;
  padding:10px 13px; font-size:14.5px; color:var(--ink); font-family:inherit; outline:none;
}
input:focus,select:focus,textarea:focus{border-color:var(--accent); background:#fff; box-shadow:0 0 0 3px rgba(47,107,255,.12)}
textarea{line-height:1.8; resize:vertical}
label{display:block; font-size:12.5px; color:var(--ink2); margin:0 0 6px 2px; letter-spacing:.04em}
.tag{display:inline-block; padding:2.5px 10px; border-radius:99px; background:#eef3fd; color:var(--accent); font-size:12px}
.tag.gray{background:#f1f4f9; color:var(--ink2)}
.tag.green{background:#e7f8f0; color:var(--green)}
.tag.gold{background:#fdf3e0; color:#c47f10}
.tag.rose{background:#fdeef6; color:#d14d8e}
.row{display:flex; gap:10px; align-items:center; flex-wrap:wrap}
.grow{flex:1}
.muted{color:var(--ink2)} .small{font-size:12.5px} .tiny{font-size:11.5px}
.empty{color:var(--ink3); text-align:center; padding:38px 10px; font-size:14.5px}
.chips{display:flex; gap:8px; flex-wrap:wrap}
.chip{
  padding:7px 16px; border-radius:99px; border:1px solid var(--line); background:#fff;
  font-size:13.5px; color:var(--ink2); cursor:pointer;
}
.chip.on{background:var(--accent); color:#fff; border-color:var(--accent); font-weight:600}
.fade{animation:fade .4s ease both}
@keyframes fade{from{opacity:0; transform:translateY(7px)} to{opacity:1; transform:none}}
.toast{
  position:fixed; left:50%; bottom:96px; transform:translateX(-50%) translateY(20px); z-index:99;
  background:#16233f; color:#fff; padding:11px 22px; border-radius:99px; font-size:14px;
  opacity:0; pointer-events:none; transition:.3s; box-shadow:0 10px 30px rgba(0,0,0,.3);
}
.toast.show{opacity:1; transform:translateX(-50%)}

/* ---------- hero ---------- */
.hero{
  height:196px; border-radius:20px; overflow:hidden; position:relative; margin-bottom:20px;
  background-size:cover; background-position:center 62%; box-shadow:var(--shadow);
}
.hero::after{content:""; position:absolute; inset:0; background:linear-gradient(90deg, rgba(6,14,38,.45), rgba(6,14,38,.05) 55%)}
.hero-txt{position:absolute; z-index:1; left:34px; top:50%; transform:translateY(-50%); color:#fff}
.hero-txt .big{
  font-family:"STKaiti","KaiTi",serif; font-size:clamp(30px,4.2vw,46px); letter-spacing:.08em;
  text-shadow:0 3px 16px rgba(0,0,0,.45);
}
.hero-txt .small{margin-top:10px; font-size:14px; color:#e8efff; text-shadow:0 2px 8px rgba(0,0,0,.5); letter-spacing:.05em}

/* ---------- home grid ---------- */
.home-grid{display:grid; grid-template-columns:minmax(0,1fr) 348px; gap:20px; align-items:start}
.col-stack{display:flex; flex-direction:column; gap:20px; min-width:0}

.featured{display:flex; gap:22px}
.cover{
  width:148px; height:198px; border-radius:10px; flex:none; position:relative; overflow:hidden;
  color:#fff; box-shadow:0 12px 26px rgba(20,35,70,.35);
  display:flex; align-items:center; justify-content:center;
}
.cover::before{content:""; position:absolute; inset:0; background:
  radial-gradient(300px 160px at 80% 0%, rgba(255,255,255,.35), transparent 60%),
  radial-gradient(260px 200px at 10% 100%, rgba(0,0,0,.28), transparent 60%)}
.cover .cv-title{
  writing-mode:vertical-rl; font-family:"STKaiti","KaiTi",serif; font-size:24px; letter-spacing:.32em;
  text-shadow:0 2px 10px rgba(0,0,0,.4); z-index:1; max-height:86%;
}
.cover .cv-genre{position:absolute; bottom:10px; left:0; right:0; text-align:center; font-size:10.5px; letter-spacing:.3em; opacity:.85; z-index:1}
.cover.sm{width:64px; height:86px; border-radius:7px}
.cover.sm .cv-title{font-size:12.5px; letter-spacing:.2em}
.cover.sm .cv-genre{display:none}
.featured .f-info{min-width:0; flex:1}
.featured h2{font-size:24px; display:flex; align-items:center; gap:12px; flex-wrap:wrap}
.f-intro{color:var(--ink2); line-height:1.85; margin:12px 0; font-size:14.5px}
.f-lines{color:var(--ink2); font-size:13.5px; display:flex; flex-direction:column; gap:7px}
.progress{height:7px; background:#edf1f8; border-radius:99px; overflow:hidden; margin-top:6px}
.progress>i{display:block; height:100%; background:linear-gradient(90deg,var(--accent),#7aa5ff); border-radius:99px}

.stats4{display:grid; grid-template-columns:repeat(4,1fr); text-align:center; gap:6px}
.stats4 .num{font-size:23px; font-weight:700}
.stats4 .cap{font-size:12px; color:var(--ink3); margin-top:3px}
.mini-chapters{list-style:none}
.mini-chapters li{
  display:flex; align-items:center; gap:10px; padding:10px 4px; border-bottom:1px dashed var(--line); cursor:pointer;
}
.mini-chapters li:last-child{border-bottom:none}
.mini-chapters .t{font-size:14.5px; font-weight:500}
.mini-chapters .d{margin-left:auto; color:var(--ink3); font-size:12px; white-space:nowrap}
.dot-ok{color:var(--green)} .dot-draft{color:#cbd5e1}
.note-mini{padding:10px 4px; border-bottom:1px dashed var(--line); font-size:13.5px; display:flex; gap:9px; align-items:baseline}
.note-mini:last-child{border-bottom:none}
.note-mini .sq{width:8px; height:8px; border-radius:2.5px; flex:none; position:relative; top:-1px}
.note-mini .d{margin-left:auto; color:var(--ink3); font-size:12px; white-space:nowrap}
.quote-card{
  border-radius:var(--radius); padding:20px; color:#fff; position:relative; overflow:hidden;
  background-size:cover; background-position:center; min-height:104px; display:flex; align-items:flex-end;
  font-family:"STKaiti","KaiTi",serif; font-size:17px; letter-spacing:.1em; box-shadow:var(--shadow);
}
.quote-card::before{content:""; position:absolute; inset:0; background:linear-gradient(200deg, transparent 30%, rgba(5,10,30,.55))}
.quote-card span{position:relative; z-index:1}

/* ---------- works ---------- */
.work-row{
  display:flex; gap:16px; padding:16px; align-items:center; cursor:pointer; transition:.2s;
}
.work-row:hover{transform:translateY(-2px)}
.work-row .w-info{flex:1; min-width:0}
.work-row h4{font-size:17px; display:flex; gap:9px; align-items:center; flex-wrap:wrap}
.work-row .w-tags{display:flex; gap:6px; margin:8px 0}
.work-row .w-words{color:var(--ink2); font-size:13px}
.work-row .chev{color:var(--ink3); font-size:20px}

/* ---------- editor ---------- */
.toolbar{
  display:flex; gap:4px; flex-wrap:wrap; padding:9px 10px; border:1px solid var(--line);
  border-bottom:none; border-radius:12px 12px 0 0; background:#f7f9fd;
}
.toolbar button{
  min-width:34px; height:32px; padding:0 8px; border:none; background:transparent; border-radius:8px;
  font-size:14px; color:var(--ink2);
}
.toolbar button:hover{background:#e8effe; color:var(--accent)}
.editor-body{
  border:1px solid var(--line); border-radius:0 0 12px 12px; min-height:300px; background:#fff;
  font-size:16px; line-height:2; padding:18px 20px; border-top:none;
}
.editor-wrap{display:grid; grid-template-columns:262px minmax(0,1fr); gap:18px; align-items:start}
.side-list{list-style:none; max-height:640px; overflow:auto}
.side-list li{
  padding:10px 13px; border:1px solid var(--line); border-radius:11px; margin-bottom:8px; cursor:pointer;
  background:#fff; font-size:14px; display:flex; justify-content:space-between; gap:8px; align-items:center;
}
.side-list li.on{border-color:var(--accent); background:#f2f7ff}
.side-list li .x{color:var(--danger); flex:none; font-size:13px}
.side-list .vol-head{
  font-size:12.5px; color:var(--ink3); letter-spacing:.1em; margin:14px 2px 8px; cursor:default;
  background:none; border:none; padding:0; display:block;
}
table.tbl{width:100%; border-collapse:collapse; font-size:14px}
table.tbl th{text-align:left; color:var(--ink3); font-weight:500; font-size:12.5px; padding:9px 10px; border-bottom:1px solid var(--line)}
table.tbl td{padding:11px 10px; border-bottom:1px solid #eef2f8}
table.tbl tr:hover td{background:#f8faff}

/* ---------- outline / lore / chars ---------- */
.ol-node{border:1px solid var(--line); border-radius:12px; padding:13px 15px; margin-bottom:9px; background:#fff}
.ol-node .ol-t{font-weight:600; font-size:15px; display:flex; gap:8px; align-items:center}
.ol-node .ol-d{color:var(--ink2); font-size:13.5px; line-height:1.8; margin-top:6px; white-space:pre-wrap}
.ol-children{margin:10px 0 2px 18px; border-left:2px dashed #dbe4f3; padding-left:14px}
details.lore-it{border:1px solid var(--line); border-radius:12px; padding:14px 17px; margin-bottom:10px; background:#fff}
details.lore-it summary{cursor:pointer; font-size:15.5px; font-weight:600; list-style:none}
details.lore-it summary::-webkit-details-marker{display:none}
details.lore-it .body{margin-top:10px; color:var(--ink2); line-height:1.95; font-size:14.5px}
details.lore-it .body p{margin-bottom:.7em}
.char-grid{display:grid; grid-template-columns:repeat(auto-fill,minmax(300px,1fr)); gap:16px}
.char-card{border-top:4px solid var(--accent)}
.char-card h4{font-size:19px; display:flex; align-items:center; gap:10px}
.avatar{
  width:40px; height:40px; border-radius:50%; display:inline-flex; align-items:center; justify-content:center;
  color:#fff; font-weight:700; font-size:17px; flex:none;
}
.char-card dl{margin-top:10px; font-size:14px; line-height:1.75}
.char-card dt{color:var(--ink3); font-size:12px; letter-spacing:.12em; margin-top:9px}
.char-card dd{color:var(--ink2); white-space:pre-wrap}
.ptags{display:flex; gap:6px; flex-wrap:wrap}

/* ---------- materials / notes ---------- */
.mat-grid{display:grid; grid-template-columns:repeat(auto-fill,minmax(190px,1fr)); gap:15px}
.mat-card{border-radius:14px; overflow:hidden; background:#fff; box-shadow:var(--shadow)}
.mat-card img{width:100%; height:132px; object-fit:cover}
.mat-card .m-body{padding:11px 13px}
.mat-card .m-t{font-size:14px; font-weight:600; display:flex; justify-content:space-between; gap:8px}
.notes-grid{display:grid; grid-template-columns:repeat(auto-fill,minmax(250px,1fr)); gap:15px}
.note-card{border-left:4px solid var(--gold)}
.note-card h4{font-size:15.5px; margin-bottom:7px}
.note-card .n-body{color:var(--ink2); font-size:13.5px; line-height:1.8; white-space:pre-wrap;
  display:-webkit-box; -webkit-line-clamp:5; -webkit-box-orient:vertical; overflow:hidden}
.note-card .n-foot{margin-top:11px; display:flex; gap:8px; align-items:center}

/* ---------- stats ---------- */
.stat-big{display:grid; grid-template-columns:repeat(auto-fit,minmax(150px,1fr)); gap:15px}
.stat-big .num{font-size:27px; font-weight:700}
.bars{display:flex; align-items:flex-end; gap:9px; height:150px; padding-top:12px}
.bars .bar{flex:1; display:flex; flex-direction:column; align-items:center; gap:7px; min-width:0}
.bars .bar i{width:64%; max-width:30px; background:linear-gradient(180deg,#7aa5ff,var(--accent)); border-radius:6px 6px 3px 3px; display:block}
.bars .bar span{font-size:11px; color:var(--ink3); white-space:nowrap}
.dist-row{display:flex; align-items:center; gap:12px; margin-bottom:12px; font-size:14px}
.dist-row .nm{width:130px; flex:none; white-space:nowrap; overflow:hidden; text-overflow:ellipsis}
.dist-row .progress{flex:1; margin:0}
.calendar{display:grid; grid-template-columns:repeat(7,1fr); gap:6px; text-align:center; font-size:12.5px}
.calendar .cd{padding:7px 0; border-radius:8px; background:#f4f7fc; color:var(--ink2)}
.calendar .cd.hot{background:var(--accent); color:#fff; font-weight:700}
.calendar .cd.dim{background:transparent; color:#c4cee0}
.calendar .cd.today{outline:2px solid var(--gold)}

/* ---------- reader ---------- */
.reader{max-width:780px; margin:0 auto; background:#fff; border-radius:18px; box-shadow:var(--shadow); padding:38px 44px 30px}
.reader h2{text-align:center; font-size:24px; margin-bottom:6px}
.reader .rmeta{text-align:center; color:var(--ink3); font-size:12.5px; margin-bottom:28px}
.reader .rbody{line-height:2.05; letter-spacing:.02em; color:#26334f}
.reader .rbody p{margin-bottom:1.1em; text-indent:2em}
.reader .rbody blockquote{border-left:3px solid var(--accent); padding:4px 15px; margin:0 0 1.1em; color:var(--ink2); background:#f4f8ff; text-indent:0}
.reader .rbody h1,.reader .rbody h2,.reader .rbody h3{margin:1.1em 0 .55em; text-indent:0}
.reader .rbody hr{border:none; border-top:1px solid var(--line); margin:1.8em auto; width:44%}
.reader .rbody ul{margin:0 0 1.1em 1.3em}
.pager{display:flex; justify-content:space-between; margin-top:30px; gap:10px}

/* ---------- settings / profile ---------- */
.set-grid{display:grid; grid-template-columns:repeat(auto-fit,minmax(320px,1fr)); gap:18px; align-items:start}
.swatches{display:flex; gap:9px}
.swatch{width:34px; height:34px; border-radius:50%; border:3px solid transparent; cursor:pointer}
.swatch.on{border-color:#fff; outline:2px solid var(--ink2)}
.img-pick{display:grid; grid-template-columns:repeat(auto-fill,minmax(104px,1fr)); gap:9px}
.img-pick img{height:64px; width:100%; object-fit:cover; border-radius:9px; cursor:pointer; border:3px solid transparent}
.img-pick img.on{border-color:var(--accent)}
.profile-head{display:flex; gap:16px; align-items:center}
.profile-head .avatar{width:58px; height:58px; font-size:24px}

/* ---------- responsive ---------- */
@media (max-width:1180px){
  .home-grid{grid-template-columns:1fr}
}
@media (max-width:900px){
  .sidebar{display:none}
  .main-col{margin-left:0}
  .topbar{display:flex}
  .tabbar{display:grid}
  .app{padding:14px 14px 108px}
  .hero{height:168px; border-radius:16px}
  .hero-txt{left:20px}
  .featured{flex-direction:row; gap:15px}
  .cover{width:104px; height:140px}
  .cover .cv-title{font-size:18px}
  .editor-wrap{grid-template-columns:1fr}
  .reader{padding:26px 20px}
  .stats4 .num{font-size:19px}
  .toast{bottom:110px}
}
