@font-face { font-family: 'MZTitle'; src: url('../fonts/title.woff2') format('woff2'); font-display: swap; }
@font-face { font-family: 'MZBody'; src: url('../fonts/body.woff2') format('woff2'); font-display: swap; }
:root { --ink: #12141a; --paper: #efe6d2; --paper2: #b9ad94; --cin: #b8392c; --gold: #d8b25a; --jade: #6f9a8a;
  --st: env(safe-area-inset-top, 0px); --sb: env(safe-area-inset-bottom, 0px); }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: #0c1016; overflow: hidden; color: var(--paper);
  font-family: 'MZBody', 'Noto Serif SC', 'Songti SC', serif; }
canvas#gl { position: fixed; inset: 0; display: block; touch-action: none; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }

.cx-top { position: fixed; top: 0; left: 0; right: 0; z-index: 5; display: flex; align-items: center; gap: 10px;
  padding: calc(var(--st) + 10px) 14px 8px; background: linear-gradient(#0c1016ee, #0c101600); pointer-events: none; }
.cx-top > * { pointer-events: auto; }
.cx-back { font-size: 13px; color: var(--paper2); padding: 6px 4px; }
.cx-brand { flex: 1; text-align: center; }
.cx-brand b { font-family: 'MZTitle', serif; font-weight: 400; font-size: 22px; letter-spacing: .12em; }
.cx-brand span { display: block; font-size: 11px; letter-spacing: .4em; color: var(--paper2); margin-top: -2px; }
.cx-play { font-size: 13px; padding: 6px 12px; border: 1px solid #d8b25a88; border-radius: 2px; color: var(--gold); background: #0c101688; }

.cx-tabs { position: fixed; z-index: 5; top: calc(var(--st) + 64px); left: 0; right: 0; display: flex; justify-content: center; gap: 2px; padding: 0 6px; overflow-x: auto; scrollbar-width: none; }
.cx-tabs::-webkit-scrollbar { display: none; }
.cx-tabs button { flex: none; white-space: nowrap; padding: 6px 12px; font-size: 14px; color: var(--paper2); border-bottom: 2px solid transparent; letter-spacing: .1em; }
.cx-tabs button.on { color: var(--paper); border-color: var(--cin); }

.cx-list { position: fixed; z-index: 4; top: calc(var(--st) + 104px); left: 0; right: 0; display: flex; gap: 8px; overflow-x: auto; padding: 4px 12px 8px; scrollbar-width: none; }
.cx-list::-webkit-scrollbar { display: none; }
.cx-chip { flex: none; padding: 7px 12px; font-size: 13px; border: 1px solid #efe6d22a; background: #12141acc; border-radius: 2px; white-space: nowrap; }
.cx-chip small { color: var(--paper2); margin-left: 6px; font-size: 11px; }
.cx-chip.on { border-color: var(--gold); color: var(--gold); background: #1d1a12dd; }

.cx-sheet { position: fixed; z-index: 6; left: 0; right: 0; bottom: 0; max-height: 46vh; display: flex; flex-direction: column;
  background: linear-gradient(#141821f2, #0e1117fa); border-top: 1px solid #d8b25a44; padding-bottom: var(--sb);
  transition: transform .35s ease; box-shadow: 0 -10px 30px #0008; }
.cx-sheet.min { transform: translateY(calc(100% - 92px - var(--sb))); }
.cx-grip { height: 20px; flex: none; cursor: pointer; position: relative; }
.cx-grip::after { content: ''; position: absolute; left: 50%; top: 8px; width: 40px; height: 4px; margin-left: -20px; border-radius: 2px; background: #efe6d240; }
.cx-sheet-body { overflow-y: auto; padding: 0 16px 16px; -webkit-overflow-scrolling: touch; }
.cx-h { display: flex; align-items: baseline; gap: 10px; margin: 0 0 4px; }
.cx-h h2 { font-family: 'MZTitle', serif; font-weight: 400; font-size: 26px; margin: 0; letter-spacing: .08em; }
.cx-h em { font-style: normal; color: var(--gold); font-size: 13px; }
.cx-desc { font-size: 14px; line-height: 1.75; color: #ddd3bf; margin: 6px 0 10px; }
.cx-stats { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; color: var(--paper2); margin-bottom: 10px; }
.cx-stats b { color: var(--paper); font-weight: 400; margin-left: 4px; }
.cx-sub { font-size: 12px; letter-spacing: .3em; color: var(--paper2); margin: 12px 0 6px; }
.cx-acts { display: flex; flex-wrap: wrap; gap: 6px; }
.cx-acts button { padding: 6px 10px; font-size: 13px; border: 1px solid #efe6d230; border-radius: 2px; background: #0c101699; }
.cx-acts button.on { border-color: var(--cin); color: #fff; background: #b8392c55; }
.cx-skill { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; padding: 10px 0; border-top: 1px solid #efe6d214; }
.cx-skill:first-child { border-top: 0; }
.cx-skill b { font-size: 15px; font-weight: 500; }
.cx-skill i { font-style: normal; font-size: 12px; color: var(--gold); text-align: right; }
.cx-skill p { grid-column: 1 / -1; margin: 2px 0 0; font-size: 13px; line-height: 1.6; color: #cfc5b0; }
.cx-line { font-size: 14px; line-height: 1.7; margin: 4px 0; }
.cx-line b { font-weight: 500; margin-right: 6px; }
.cx-line.n { color: var(--paper2); font-style: italic; }
.cx-scene-h { font-size: 13px; letter-spacing: .25em; color: var(--gold); margin: 16px 0 6px; }
.k-q { color: #8fc3d6; } .k-m { color: #e0b878; } .k-f { color: #f2eee6; } .k-b { color: #c48ad8; } .k-s { color: #d88a8a; }

#labels { position: fixed; inset: 0; pointer-events: none; z-index: 3; }
.cx-lbl { position: absolute; transform: translate(-50%, -100%); font-size: 12px; padding: 2px 8px; border: 1px solid #d8b25a99;
  background: #0c1016cc; color: var(--gold); white-space: nowrap; border-radius: 2px; }
.cx-lbl::after { content: ''; position: absolute; left: 50%; bottom: -7px; width: 1px; height: 6px; background: #d8b25a99; }

.cx-loading { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; background: #0c1016; font-family: 'MZTitle', serif; font-size: 28px; letter-spacing: .4em; transition: opacity .6s; }
.cx-loading.hide { opacity: 0; pointer-events: none; }

@media (min-width: 900px) {
  .cx-list { top: calc(var(--st) + 110px); left: 16px; right: auto; bottom: 16px; width: 200px; flex-direction: column; overflow-y: auto; overflow-x: hidden; }
  .cx-chip { white-space: normal; }
  .cx-sheet { left: auto; right: 16px; top: calc(var(--st) + 110px); bottom: 16px; width: 360px; max-height: none; border: 1px solid #d8b25a33; }
  .cx-sheet.min { transform: none; }
  .cx-grip { display: none; }
  .cx-sheet-body { padding-top: 16px; }
}

@media (max-width: 480px) { .cx-tabs { justify-content: flex-start; } .cx-tabs button { padding: 6px 9px; letter-spacing: .04em; } }

/* 角色 / 敌人分栏 */
.cx-seg { flex: none; display: flex; border: 1px solid #d8b25a66; border-radius: 3px; overflow: hidden; margin-right: 6px; }
.cx-seg button { padding: 7px 14px; font-size: 13px; background: #12141acc; color: var(--paper2); }
.cx-seg button.on { background: var(--gold); color: #1a1408; }
.cx-skill.on b { color: var(--gold); }
/* 光线 */
.cx-light { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 4px 0 10px; font-size: 13px; color: var(--paper2); }
.cx-light input { flex: 1; min-width: 120px; accent-color: #d8b25a; }
.cx-light button { padding: 4px 10px; border: 1px solid #efe6d22a; background: #12141acc; border-radius: 2px; font-size: 12px; }
/* 伤害数字 */
#dmgLayer { position: fixed; inset: 0; pointer-events: none; z-index: 4; overflow: hidden; }
#dmgLayer .dmg { position: absolute; left: 0; top: 0; font: 700 18px 'MZBody', serif; color: #fff; text-shadow: 0 2px 0 #0008, 0 0 6px #000a; white-space: nowrap; }
