/* ===== 阅读器外壳 ===== */
:root{--fs:17px;--bg:#f5f9fd;--fg:#1c1c1c;--bar:#1f3864;--barfg:#fff;--line:#d5dbe6;}
*{box-sizing:border-box;-webkit-tap-highlight-color:transparent;}
html,body{margin:0;padding:0;background:var(--bg);color:var(--fg);}
body{font-family:"Microsoft YaHei","PingFang SC","Noto Sans CJK SC",system-ui,sans-serif;}
#bar{position:fixed;top:0;left:0;right:0;height:52px;display:flex;align-items:center;
  gap:2px;padding:0 6px;background:var(--bar);color:var(--barfg);z-index:30;
  padding-top:env(safe-area-inset-top);}
#bar button{background:none;border:0;color:var(--barfg);font-size:20px;width:44px;height:44px;
  border-radius:10px;cursor:pointer;}
#bar button:active{background:rgba(255,255,255,.18);}
#crumb{flex:1;font-size:15px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;padding:0 4px;}
#reader{padding-top:calc(52px + env(safe-area-inset-top));padding-bottom:64px;}

/* ===== 抽屉 / 搜索 ===== */
#drawer{position:fixed;top:0;bottom:0;left:0;width:86vw;max-width:360px;background:#fff;
  z-index:40;transform:translateX(-102%);transition:transform .22s ease;display:flex;
  flex-direction:column;box-shadow:2px 0 14px rgba(0,0,0,.18);}
#drawer.open{transform:none;}
#mask{position:fixed;inset:0;background:rgba(0,0,0,.35);z-index:35;display:none;}
#mask.on{display:block;}
.dw-head{display:flex;gap:6px;padding:10px;border-bottom:1px solid var(--line);align-items:center;}
.dw-head input{flex:1;font-size:16px;padding:9px 10px;border:1px solid var(--line);
  border-radius:10px;background:#f7f9fc;}
.dw-head button{width:40px;height:40px;border:0;background:#eef2f8;border-radius:10px;font-size:20px;}
#toc{overflow:auto;flex:1;padding:6px 4px 12px;font-size:15px;}
#offlineBox{border-top:1px solid var(--line);padding:10px;display:flex;gap:8px;
  align-items:center;font-size:12.5px;color:#667;}
#offlineBox button{flex:1;padding:11px;border:1px solid var(--line);border-radius:10px;
  background:#eef3fa;color:#1f3864;font-size:14px;}
.toc-item{padding:9px 12px;border-radius:8px;display:flex;align-items:center;gap:6px;cursor:pointer;}
.toc-item:active{background:#eef3fa;}
.toc-item.grp{font-weight:600;color:#1f3864;}
.toc-item.cur{background:#e3ecfa;}
.toc-item .tw{flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
.toc-item .ar{width:18px;text-align:center;color:#8894a8;}

#searchPanel{position:fixed;inset:0;background:#fff;z-index:45;display:none;flex-direction:column;}
#searchPanel.open{display:flex;}
#results{overflow:auto;padding:6px 8px 40px;}
.res{padding:11px 12px;border-bottom:1px solid #eef1f6;cursor:pointer;}
.res b{color:#1f3864;}
.res p{margin:3px 0 0;font-size:12.5px;color:#667;line-height:1.5;
  display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;}

/* ===== 正文 ===== */
#content{padding:10px 12px 30px;max-width:920px;margin:0 auto;font-size:var(--fs);
  line-height:1.75;word-break:break-word;}
#content .loading{color:#8894a8;padding:20px 4px;}
#content *{max-width:100%;}
#content h1{font-size:1.5em;line-height:1.35;margin:.6em 0 .4em;color:#1f3864;}
#content h2{font-size:1.35em;line-height:1.4;margin:.6em 0 .4em;color:#1f3864;}
#content h3{font-size:1.2em;margin:.7em 0 .35em;color:#1f3864;}
#content h4{font-size:1.08em;margin:.6em 0 .3em;color:#2b4a7e;}
#content p,#content div,#content td,#content th,#content li,#content dt,#content dd,#content span,#content b,#content font{font-size:1em;line-height:1.75;}
#content img{max-width:100%;height:auto;border-radius:6px;}
#content table{border-collapse:collapse;width:100% !important;}
#content td,#content th{border:1px solid #c9d2df;padding:5px 7px;vertical-align:top;word-break:break-word;}
#content th{background:#eef2f8;white-space:nowrap;width:1%;min-width:3.4em;}
#content .twrap{overflow-x:auto;-webkit-overflow-scrolling:touch;margin:8px 0;
  border:1px solid var(--line);border-radius:8px;background:#fff;}
#content .twrap table{width:100%;min-width:var(--mw,0);}
#content .twrap td,#content .twrap th{white-space:normal;}
#content table.Details{background:#fff;}
#content .PowerCardBorder,#content #Powercard{width:auto !important;max-width:100% !important;}
#content .PowerName{font-weight:700;}
#content .PowerLvl{float:right;}
#content .KeyWord{color:#7a3e00;}
#content .Explains,#content .PowerExplains{color:#444;font-style:italic;}
#content hr{border:0;border-top:1px solid var(--line);margin:14px 0;}

#pager{display:flex;gap:10px;padding:16px 12px 40px;max-width:920px;margin:0 auto;}
#pager button{flex:1;padding:13px;border:1px solid var(--line);border-radius:12px;
  background:#fff;font-size:15px;color:#1f3864;}
#pager button:active{background:#eef3fa;}

/* ===== 夜间 ===== */
body.night{--bg:#14161a;--fg:#d9dee6;--line:#2b3038;}
body.night #reader{background:var(--bg);}
body.night #content{color:var(--fg);}
body.night #content h1,body.night #content h2,body.night #content h3,body.night #content h4{color:#9dc0ff !important;}
body.night #content td,body.night #content th{background:#1b1f25 !important;border-color:#39414d !important;color:#d9dee6 !important;}
body.night #content th{background:#232932 !important;}
body.night #content a{color:#7fb0ff !important;}
body.night #drawer,body.night #searchPanel{background:#1b1f25;color:#d9dee6;}
body.night #drawer .toc-item.grp{color:#9dc0ff;}
body.night #drawer .toc-item.cur{background:#252b33;}
body.night .dw-head input{background:#11141a;color:#d9dee6;border-color:#2b3038;}
body.night #pager button{background:#1b1f25;color:#cfe0ff;border-color:#2b3038;}
