/* ---- codex pages (campaigns / generals / skills) ---- */
body.codex { overflow: hidden; touch-action: auto; height: 100%; display: flex; flex-direction: column; background: radial-gradient(ellipse at 50% 0%, #4a3e30, #1a1612 80%); }
.cx-top { flex: none; padding: calc(env(safe-area-inset-top) + 6px) 8px 6px; display: flex; flex-direction: column; gap: 6px; border-bottom: 1px solid #5a4e3a; background: rgba(26,22,18,.6); }
.cx-head { display: flex; gap: 8px; align-items: center; }
.cx-head .title { font-family: "Noto Serif CJK SC", serif; font-weight: 900; font-size: 17px; letter-spacing: 3px; color: #f0e2b8; }
.cx-head .sub { color: #a99a78; font-size: 12px; margin-left: auto; }
.cx-head input { margin-left: auto; background: #2a241e; color: #f2e9cf; border: 1px solid #8a7a58; border-radius: 16px; padding: 5px 12px; font: inherit; font-size: 13px; width: 150px; }
.cx-body { flex: 1; display: flex; min-height: 0; }
.cx-list { flex: none; width: 300px; overflow-y: auto; border-right: 1px solid #5a4e3a; padding: 6px; }
.cx-detail { flex: 1; overflow-y: auto; padding: 14px 18px 40px; }
.cx-grp { font-size: 11px; color: #b8a986; margin: 10px 4px 4px; letter-spacing: 2px; display: flex; align-items: center; gap: 6px; }
.cx-grp::after { content: ''; flex: 1; height: 1px; background: #5a4e3a; }
.cx-item { padding: 7px 9px; border-radius: 7px; cursor: pointer; display: flex; gap: 8px; align-items: center; border: 1px solid transparent; margin-bottom: 2px; }
.cx-item:hover { background: rgba(255,240,200,.07); }
.cx-item.on { background: linear-gradient(#efe5c8, #cdbf98); color: #3a342e; }
.cx-item .nm { font-weight: 700; font-size: 14px; flex: 1; min-width: 0; }
.cx-item .nm small { display: block; font-weight: 400; font-size: 11px; color: #a99a78; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cx-item.on .nm small { color: #6a5d48; }
.cx-item .rt { font-size: 11px; color: #c9a24a; white-space: nowrap; }
.cx-item.on .rt { color: #8a5a10; }
.flag { width: 22px; height: 22px; border-radius: 50%; flex: none; border: 2px solid rgba(0,0,0,.4); display: flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 800; color: #fff; text-shadow: 0 1px 2px #000; }
.stars { color: #e3b23c; letter-spacing: -1px; }
.cx-detail h2 { font-family: "Noto Serif CJK SC", serif; margin: 0 0 4px; font-size: 24px; color: #f6e8bf; letter-spacing: 2px; }
.cx-detail h2 small { font-family: inherit; font-size: 13px; color: #a99a78; letter-spacing: 0; margin-left: 8px; font-weight: 400; }
.cx-detail h3 { margin: 18px 0 8px; font-size: 15px; color: #e8d39a; border-left: 3px solid #c9a24a; padding-left: 8px; }
.cx-detail p { margin: 6px 0; line-height: 1.7; color: #d9ccaa; font-size: 14px; }
.meta { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.tag { font-size: 12px; padding: 3px 9px; border-radius: 12px; background: rgba(255,240,200,.08); border: 1px solid #6a5d48; color: #e0d2ac; }
.tag.k { background: #c9a24a; color: #2a2016; border-color: #c9a24a; font-weight: 700; }
.tag.plan { background: #5a4e3a; color: #f0e2b8; }
.chap { background: linear-gradient(#3b3229, #2c251f); border: 1px solid #6a5d48; border-radius: 10px; padding: 10px 14px; margin: 10px 0; }
.chap .ct { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.chap .ct b { font-size: 16px; color: #f6e8bf; }
.chap .ct .n { font-family: "Noto Serif CJK SC", serif; color: #c9a24a; font-weight: 900; }
.chap .ct .d { font-size: 12px; color: #a99a78; }
.chap dl { display: grid; grid-template-columns: 64px 1fr; gap: 4px 10px; margin: 8px 0 0; font-size: 13.5px; line-height: 1.6; }
.chap dt { color: #b8a986; text-align: right; }
.chap dd { margin: 0; color: #e0d2ac; }
.chap dd .win { color: #9fd08a; } .chap dd .lose { color: #e08a7a; }
.gchip { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px 1px 2px; margin: 2px 4px 2px 0; border-radius: 12px; background: rgba(0,0,0,.25); border: 1px solid #6a5d48; cursor: pointer; font-size: 12.5px; color: #f0e2b8; text-decoration: none; }
.gchip .flag { width: 16px; height: 16px; font-size: 8px; border-width: 1px; }
.diff { color: #e3b23c; letter-spacing: 1px; }
.statgrid { display: grid; grid-template-columns: 52px 1fr 34px; gap: 6px 10px; align-items: center; max-width: 460px; margin: 8px 0; }
.statgrid .lb { color: #b8a986; font-size: 13px; text-align: right; }
.statgrid .bar { height: 10px; background: #2a241e; border-radius: 5px; overflow: hidden; border: 1px solid #4a4034; }
.statgrid .bar i { display: block; height: 100%; background: linear-gradient(90deg, #8a6a2a, #e3b23c); }
.statgrid .v { font-weight: 800; color: #f6e8bf; font-size: 14px; }
.apt { display: flex; gap: 6px; flex-wrap: wrap; margin: 6px 0; }
.apt span { width: 50px; text-align: center; padding: 4px 0; border-radius: 6px; background: #2a241e; border: 1px solid #4a4034; font-size: 12px; color: #b8a986; }
.apt span b { display: block; font-size: 18px; font-family: "Noto Serif CJK SC", serif; }
.apt .S b { color: #ff9a3c; } .apt .A b { color: #e3c23c; } .apt .B b { color: #9fd08a; } .apt .C b { color: #8ab0d0; } .apt .D b { color: #8a8070; }
.skill { background: linear-gradient(#3b3229, #2c251f); border: 1px solid #6a5d48; border-radius: 9px; padding: 8px 12px; margin: 8px 0; cursor: pointer; }
.skill .sh { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.skill .sh b { font-size: 15px; color: #f6e8bf; }
.skill p { font-size: 13px; margin: 4px 0 0; }
.ty { font-size: 11px; padding: 1px 7px; border-radius: 9px; font-weight: 700; }
.ty.passive { background: #4a5a3a; color: #d8f0c0; } .ty.aura { background: #3a4a6a; color: #c8dcff; } .ty.active { background: #7a3a2a; color: #ffd8c8; }
.filters { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.filters::-webkit-scrollbar { display: none; }
.filters .chip { font-size: 12.5px; padding: 5px 11px; }
.cx-table { border-collapse: collapse; width: 100%; font-size: 13px; margin: 6px 0; }
.cx-table td, .cx-table th { border-bottom: 1px solid #4a4034; padding: 6px 8px; text-align: left; vertical-align: top; line-height: 1.6; }
.cx-table th { color: #e8d39a; font-weight: 700; white-space: nowrap; }
.cx-table td:first-child { color: #f0e2b8; font-weight: 700; white-space: nowrap; }
.side-tabs { display: flex; gap: 6px; }
.side-tabs .chip { font-size: 14px; padding: 7px 16px; }
.empty { color: #8a7d62; padding: 30px; text-align: center; }
.back-mob { display: none; }
@media (max-width: 720px) {
  .cx-list { width: 100%; border-right: 0; }
  .cx-body.show-detail .cx-list { display: none; }
  .cx-body:not(.show-detail) .cx-detail { display: none; }
  .back-mob { display: inline-block; margin-bottom: 8px; }
  .cx-head input { width: 110px; }
  .chap dl { grid-template-columns: 52px 1fr; }
}
