/* 此间居 · 样式 */
@font-face {
  font-family: "MSZ";
  src: url("/fonts/MaShanZheng-Regular.ttf") format("truetype");
  font-display: swap;
}
@font-face {
  font-family: "ZXW";
  src: url("/fonts/ZCOOLXiaoWei-Regular.ttf") format("truetype");
  font-display: swap;
}
@font-face {
  font-family: "DLT";
  src: url("/fonts/AlimamaDaoLiTi/AlimamaDaoLiTi-Regular.ttf") format("truetype");
  font-display: swap;
}
@font-face {
  font-family: "LHC";
  src: url("/fonts/LongCang/LongCang-Regular.ttf") format("truetype");
  font-display: swap;
}
@font-face {
  font-family: "ZMX";
  src: url("/fonts/ZhiMangXing/ZhiMangXing-Regular.ttf") format("truetype");
  font-display: swap;
}
@font-face {
  font-family: "LJMC";
  src: url("/fonts/LiuJianMaoCao/LiuJianMaoCao-Regular.ttf") format("truetype");
  font-display: swap;
}
/* 霞鹜文楷（LXGW WenKai）的分块 woff2 由 /fonts/LXGWWenKai/lxgwwenkai-regular.css 注册（index.html 引入） */
:root {
  --paper: #f6f1e5;
  --panel: #fffdf6;
  --ink: #2c2620;
  --sub: #6f6355;
  --faint: #a3957f;
  --red: #a63a2b;
  --red-soft: rgba(166, 58, 43, 0.12);
  --green: #2e6e54;
  --green-soft: rgba(46, 110, 84, 0.14);
  --blue: #2e5f8f;
  --blue-soft: rgba(46, 95, 143, 0.12);
  --gold: #b98a3e;
  --gold-soft: rgba(185, 138, 62, 0.16);
  --line: #e4d9c4;
  --kai: "Kaiti SC", "KaiTi", "楷体", "STKaiti", serif;
  --disp: "MSZ", "KaiTi", serif;
  --ui: "ZXW", "Microsoft YaHei", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--kai);
  font-size: 17px;
  line-height: 1.75;
}
a { color: var(--red); text-decoration: none; }
a:hover { text-decoration: underline; }

/* 顶栏 */
.top {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 14px;
  padding: 10px 22px;
  background: rgba(246, 241, 229, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(4px);
  flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 10px; }
.seal {
  width: 38px; height: 38px; border-radius: 0;
  background: var(--red); color: #fffdf6;
  font-family: var(--disp); font-size: 17px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 1px 4px rgba(90, 30, 20, 0.25);
}
.brand-name { font-family: var(--disp); font-size: 26px; color: var(--ink); letter-spacing: 4px; }
.brand:hover { text-decoration: none; }
.qbox { flex: 1 1 280px; max-width: 560px; }
.qbox input {
  width: 100%; padding: 8px 14px;
  border: 1px solid var(--line); border-radius: 0;
  background: var(--panel); font-family: var(--kai); font-size: 15px; color: var(--ink);
  outline: none;
}
.qbox input:focus { border-color: var(--gold); }
.nav { display: flex; gap: 4px; flex-wrap: wrap; }
.nav a {
  font-family: var(--ui); font-size: 15px; color: var(--sub);
  padding: 4px 10px; border-radius: 0;
}
.nav a:hover, .nav a.on { color: var(--red); background: var(--red-soft); text-decoration: none; }

/* 主体 */
#app { max-width: 1020px; margin: 0 auto; padding: 22px 18px 60px; min-height: 70vh; }
.loading { color: var(--faint); text-align: center; padding: 60px 0; font-family: var(--ui); }
.foot {
  text-align: center; color: var(--faint); font-family: var(--ui);
  font-size: 13px; padding: 18px 0 26px; border-top: 1px solid var(--line);
}
.foot-sep { margin: 0 8px; }

/* 通用组件 */
.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 0; padding: 18px 20px; margin-bottom: 18px;
}
.card h2, .card h3 { font-family: var(--disp); font-weight: normal; margin: 0 0 10px; color: var(--ink); }
.card h3 { font-size: 20px; }
.chip {
  display: inline-block; font-family: var(--ui); font-size: 13px;
  color: var(--sub); background: rgba(0,0,0,0.045);
  border-radius: 0; padding: 1px 10px; margin: 0 6px 6px 0;
}
.chip.red { color: var(--red); background: var(--red-soft); }
.chip.gold { color: var(--gold); background: var(--gold-soft); }
.chip a { color: inherit; }
.btn {
  display: inline-block; font-family: var(--ui); font-size: 15px;
  color: #fffdf6; background: var(--red); border: none; cursor: pointer;
  border-radius: 0; padding: 7px 18px; letter-spacing: 1px;
}
.btn:hover { filter: brightness(1.06); }
.btn.ghost { background: transparent; color: var(--red); border: 1px solid var(--red); }
.btn.mini { font-size: 13px; padding: 3px 10px; border-radius: 0; }
.muted { color: var(--faint); font-family: var(--ui); font-size: 13px; }
.sub { color: var(--sub); }
.hr { border: none; border-top: 1px dashed var(--line); margin: 16px 0; }
.grid { display: grid; gap: 14px; }
.grid.c3 { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
input[type="text"], input[type="search"], textarea, select {
  font-family: var(--kai); font-size: 16px; color: var(--ink);
  background: var(--panel); border: 1px solid var(--line); border-radius: 0;
  padding: 8px 12px; outline: none;
}
input:focus, textarea:focus, select:focus { border-color: var(--gold); }
textarea { width: 100%; min-height: 110px; resize: vertical; }
label.f { display: block; font-family: var(--ui); font-size: 14px; color: var(--sub); margin: 12px 0 4px; }

/* 列表 */
.workrow { padding: 12px 4px; border-bottom: 1px dashed var(--line); }
.workrow:last-child { border-bottom: none; }
.workrow .t { font-size: 18px; }
.workrow .t a { color: var(--ink); }
.workrow .t a:hover { color: var(--red); }
.workrow .m { font-family: var(--ui); font-size: 13px; color: var(--faint); margin-top: 2px; }
.workrow .sn { color: var(--sub); font-size: 15px; margin-top: 4px; }
.workrow .sn em { font-style: normal; color: var(--red); }
.pager { display: flex; gap: 12px; justify-content: center; margin: 18px 0; font-family: var(--ui); }
/* 作品页上下篇导航：三部分居中成一排，垂直中线对齐 */
#worknav { display: flex; justify-content: center; align-items: center; gap: 12px; flex-wrap: wrap; }
#worknav > :first-child, #worknav > :last-child { white-space: nowrap; }
#worknav .muted { text-align: center; }

/* 作品页工具条：分组竖排（组内上下两行/三行，全钮等宽等高，窄屏自动换组） */
.work-tools { gap: 10px; align-items: stretch; }
.work-tools .seg-col { display: flex; flex-direction: column; gap: 4px; }
.work-tools .seg-col .btn.mini, .work-tools .seg-col select {
  width: 92px; height: 26px; padding: 0 6px; line-height: 24px;
  box-sizing: border-box; text-align: center; margin: 0;
}
#layer-hint { display: block; text-align: center; font-size: 12px; margin-top: 6px; min-height: 1.2em; }

/* 首页 */
.hero { text-align: center; padding: 26px 0 8px; }
.hero .logo { font-family: var(--disp); font-size: 62px; letter-spacing: 12px; color: var(--ink); }
.hero .tag { color: var(--sub); font-family: var(--ui); margin-top: 2px; }
.hero .bigq { margin-top: 18px; display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.hero .bigq input { width: min(520px, 88vw); padding: 11px 18px; border-radius: 0; }
.statline { display: flex; gap: 20px; justify-content: center; flex-wrap: wrap; margin: 16px 0; }
.statline .st { font-family: var(--ui); font-size: 13px; color: var(--sub); }
.statline .st b { color: var(--red); font-size: 17px; margin-right: 4px; }
.daily .lines { font-size: 17px; }
.daily .lines .ln { margin: 2px 0; }
.today-title { font-family: var(--disp); font-size: 24px; }

/* 诗词详情 */
.phead { text-align: center; margin-bottom: 10px; }
.phead h1 { font-family: var(--disp); font-weight: normal; font-size: 38px; margin: 6px 0; letter-spacing: 2px; }
.phead .meta { font-family: var(--ui); color: var(--sub); font-size: 14px; }
.phead .meta a { color: var(--sub); text-decoration: underline dotted; }
.poem { font-size: 21px; text-align: center; padding: 10px 0 6px; line-height: 2.05; }
.poem .ln { margin: 14px 0; letter-spacing: 1px; }
.poem.rtpy .ln { margin: 18px 0; }
.poem .gap { height: 30px; }
.poem.vertical .gap { height: auto; width: 30px; }  /* 竖排下过片空行占一列位（writing-mode 下块向=横向） */
.poem.vertical {
  writing-mode: vertical-rl; text-orientation: upright;
  max-height: 66vh; overflow: auto; margin: 0 auto; padding: 12px 8px;
}
.poem.vertical .ln { margin: 0 6px; }
.poem.vertical.rtpy .ln { margin: 0 12px; }
.poem.vertical rt { transform: translateX(4px); }
.poem ruby { ruby-align: center; }
/* 朗读：当前句高亮（底色微染+左缘细标）；竖排列改顶缘细标；hidden 属性不被 .seg-col/.btn 的 display 覆盖 */
.work-tools .seg-col[hidden], .btn[hidden] { display: none; }
.poem .ln.on { background: var(--red-soft); box-shadow: inset 2px 0 0 var(--red); }
.poem.vertical .ln.on { box-shadow: inset 0 2px 0 var(--red); }
rt { font-family: var(--ui); font-size: 12.5px; color: var(--faint); }
rt.rt-py { color: #77685a; }
/* 横排多层注音：固定行高三段式字列（上注音/字/下韵部），行高锁死不塌陷；
   列宽统一 1.55em（长拼音由 JS 缩字号），保证每字间距一致 */
.poem.hz .ccol { display: inline-flex; flex-direction: column; align-items: center; vertical-align: bottom; margin: 0 2px; width: 1.55em; }
.poem.hz .ccol .aover { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 18px; padding-bottom: 3px; box-sizing: border-box; }
.poem.hz2 .ccol .aover { height: 34px; }
.poem.hz .ccol .cch { line-height: 1.35; }
.poem.hz.hasunder .ccol .aunder { height: 15px; display: flex; align-items: flex-start; justify-content: center; }
.poem.hz .ccol i { font-style: normal; font-family: var(--ui); font-size: 11.5px; line-height: 15px; color: var(--faint); white-space: nowrap; }
.poem.hz .ccol i.rt-py { color: #77685a; }
.poem.hz .ccol i.rt-py.fixed { color: var(--gold); font-weight: 600; }
.poem.hz .ccol[data-multi] { cursor: pointer; }
.poem.hz .ccol[data-multi] .rt-py { border-bottom: 1px dotted var(--faint); }
#poem-font { padding: 4px 8px; border: 1px solid var(--line); background: #fffdf6; color: var(--ink); font-size: 13px; font-family: var(--ui); align-self: center; }
.t-p { background: var(--green-soft); color: var(--green); border-radius: 0; }
.t-z { background: var(--red-soft); color: var(--red); border-radius: 0; }
.t-m { background: rgba(0,0,0,0.055); color: var(--sub); border-radius: 0; }
.t-yun { box-shadow: 0 2px 0 0 var(--gold); }
.seg-toggle { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin: 8px 0 4px; }
.seg-toggle.left { justify-content: flex-start; align-items: center; }
.seg-toggle .btn.on { background: var(--blue); color: #fffdf6; border-color: var(--blue); }
.seg-toggle .btn.on:hover { filter: none; }

/* 平仄报告：逐字等宽网格（字/谱位/注音同列，严格水平对齐） */
.pztable { width: 100%; border-collapse: collapse; margin-top: 8px; }
.pztable td { padding: 6px 8px; border-bottom: 1px dashed var(--line); vertical-align: top; }
.pztable .unit { font-size: 19px; white-space: nowrap; }
.pztable .pzline { display: inline-flex; align-items: flex-start; }
.pztable .pzcol { display: inline-flex; flex-direction: column; align-items: center; width: 1.7em; margin: 0 1px; position: relative; }
.pztable .pzcol .u-ch { padding: 2px 3px; border-radius: 0; line-height: 1.35; }
.pztable .pzcol .u-py { font-family: var(--ui); font-style: normal; font-size: 10.5px; line-height: 14px; height: 14px; color: #77685a; white-space: nowrap; }
.pztable .pzcol .u-mk { font-family: var(--ui); font-style: normal; font-size: 12px; line-height: 16px; height: 16px; color: var(--faint); }
.pztable .pzcol .u-mk.mk-p { color: var(--green); }
.pztable .pzcol .u-mk.mk-z { color: var(--red); }
.pztable .pzcol.cand { cursor: pointer; }
.pztable .pzcol.cand .u-ch { border-bottom: 1px dashed var(--faint); }
.pztable .pzcol.cand:hover .u-ch { box-shadow: inset 0 0 0 1.5px var(--gold-soft), 0 0 0 1px var(--gold); }
.pztable .pzcol.ov .u-py { color: var(--gold); font-weight: 600; }
.pztable .pzcol.bad .u-ch { box-shadow: inset 0 0 0 1.5px rgba(166, 58, 43, 0.55); }
.pztable .pzcol.t-yun .u-ch { box-shadow: 0 2px 0 0 var(--gold); }
.pztable .liss { font-family: var(--ui); font-size: 12.5px; color: var(--red); }
/* 读音选择弹层 */
.py-picker { position: fixed; z-index: 90; min-width: 170px; background: #fffdf6; border: 1px solid var(--line); box-shadow: 0 6px 24px rgba(60, 40, 20, 0.18); padding: 6px; }
.py-picker .pt { font-family: var(--ui); font-size: 12.5px; color: var(--sub); padding: 2px 6px 6px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.py-picker .pi { display: block; width: 100%; text-align: left; padding: 6px 10px; margin: 2px 0; border: 1px solid transparent; background: none; cursor: pointer; font-size: 15px; color: var(--ink); }
.py-picker .pi em { font-style: normal; font-family: var(--ui); font-size: 12px; color: var(--sub); margin-left: 8px; }
.py-picker .pi:hover { background: var(--gold-soft); }
.py-picker .pi.cur { border-color: var(--gold); background: var(--gold-soft); }
.pztable .liss .warn { color: var(--gold); }
.pztable .liss .info { color: var(--sub); }
.legend { font-family: var(--ui); font-size: 13px; color: var(--sub); margin-top: 10px; }
.legend .sw { padding: 1px 8px; margin: 0 2px; border-radius: 0; }
.issuelist { margin: 10px 0 0; padding: 0; list-style: none; }
.issuelist li { font-family: var(--ui); font-size: 14px; margin: 3px 0; }
.issuelist .tag { display: inline-block; min-width: 44px; text-align: center; border-radius: 0; margin-right: 8px; font-size: 12.5px; padding: 0 6px; }
.issuelist .出律 .tag, .issuelist .出韵 .tag, .issuelist .失对 .tag, .issuelist .失粘 .tag { background: var(--red-soft); color: var(--red); }
.issuelist .提示 .tag, .issuelist .info2 .tag { background: var(--gold-soft); color: var(--gold); }
.issuelist .合谱 .tag { background: var(--green-soft); color: var(--green); }

/* 批注 / 笔记 */
.anno { border-left: 3px solid var(--gold-soft); padding: 4px 12px; margin: 12px 0; }
.anno .ah { font-family: var(--ui); font-size: 12.5px; color: var(--faint); }
.note { background: var(--gold-soft); border-radius: 0; padding: 10px 14px; margin: 10px 0; }
.note .nh { font-family: var(--ui); font-size: 12.5px; color: var(--gold); display: flex; justify-content: space-between; }
.links li { margin: 4px 0; font-family: var(--ui); font-size: 14px; }
.editbar { display: flex; gap: 8px; margin-top: 6px; }

/* 工具页 */
.formgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.formgrid .full { grid-column: 1 / -1; }
.tonecard { display: flex; gap: 14px; flex-wrap: wrap; }
.tonecard .tc { border: 1px solid var(--line); border-radius: 0; padding: 10px 14px; min-width: 210px; background: var(--panel); }
.tonecard .tc .big { font-size: 34px; font-family: var(--disp); }
.tonecard .tc .row { font-family: var(--ui); font-size: 13.5px; color: var(--sub); }
.toast {
  position: fixed; left: 50%; bottom: 40px; transform: translateX(-50%);
  background: var(--ink); color: var(--paper); font-family: var(--ui);
  padding: 10px 22px; border-radius: 0; z-index: 50; opacity: 0.94;
}
@media (max-width: 640px) {
  .hero .logo { font-size: 44px; letter-spacing: 8px; }
  .poem { font-size: 18px; }
  .pztable .liss { font-size: 11.5px; }
  .formgrid { grid-template-columns: 1fr; }
  #app { padding: 14px 12px 40px; }
}
