/* 山海卷 · 样式
 * VOICE   古卷志怪：沉静、肃穆，危险藏在墨色里
 * IDEA    一卷展开的《山海经》绢本：夜色山水为底，宣纸卡牌，朱砂印章
 * PICTURE 墨团中的篆意大字即妖兽，卡面以大字作画
 * COLOUR  夜墨为主，宣纸为辅，朱砂为唯一强调色；每章换一种夜色（青、蓝、赭）
 * TYPE    马善政毛笔字作标题与大字，思源宋体作正文 */
:root {
  --ink: #15110e; --ink2: #241d18; --ink3: #3a2f27;
  --paper: #f1e6cd; --paper2: #e2d1ad; --paper3: #c9b68e;
  --verm: #b5361f; --verm2: #e0603a; --gold: #c9a24c; --gold2: #e8c877;
  --jade: #4f9a82; --indigo: #3b5f8f; --blood: #c8402c; --blockc: #5b8fd0; --poison: #6ea84a;
  --txt: #efe6d2; --dim: #a89c86;
  --serif: 'Noto Serif SC', 'Source Han Serif SC', 'Songti SC', 'STSong', 'SimSun', serif;
  --brush: 'Ma Shan Zheng', 'STKaiti', 'KaiTi', 'Kaiti SC', 'Noto Serif SC', serif;
  --safe-t: env(safe-area-inset-top, 0px); --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px); --safe-r: env(safe-area-inset-right, 0px);
  --cw: 92px; --spd: 1;
  color-scheme: dark;
}
#app[data-act="1"] { --sky1: #1d2b27; --sky2: #0d1311; --m1: #22322d; --m2: #18241f; --m3: #0f1714; --moon: #e9dfc4; }
#app[data-act="2"] { --sky1: #1a2840; --sky2: #0b101b; --m1: #1f2d45; --m2: #162034; --m3: #0e1524; --moon: #cfe0f0; }
#app[data-act="3"] { --sky1: #3a1f1a; --sky2: #120a09; --m1: #3b211b; --m2: #2a1713; --m3: #1a0e0c; --moon: #f3c98b; }
* { box-sizing: border-box; min-width: 0; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: #0c0a08; overflow: hidden; overscroll-behavior: none; }
body { font: 15px/1.5 var(--serif); color: var(--txt); -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; touch-action: manipulation; }
button { font: inherit; color: inherit; cursor: pointer; }
button:focus-visible, [tabindex]:focus-visible { outline: 2px solid var(--gold2); outline-offset: 2px; }
#app { position: fixed; inset: 0; background: linear-gradient(var(--sky1), var(--sky2)); overflow: hidden; max-width: 1100px; margin: 0 auto; }
@media (min-width: 1101px) { #app { box-shadow: 0 0 0 1px #2c241d, 0 0 80px #000; } }
.bg { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
#screen { position: absolute; inset: 0; padding: var(--safe-t) var(--safe-r) var(--safe-b) var(--safe-l); display: flex; flex-direction: column; }
.scr { flex: 1; display: flex; flex-direction: column; min-height: 0; position: relative; }
#fx { position: absolute; inset: 0; pointer-events: none; z-index: 40; overflow: hidden; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ---------- 通用 ---------- */
.brush { font-family: var(--brush); font-weight: 400; }
.btn { min-height: 44px; padding: 8px 20px; border: 1px solid #6b5a45; border-radius: 6px; background: linear-gradient(#3a2f26, #251e18); color: var(--paper); font-size: 16px; letter-spacing: .08em; box-shadow: inset 0 1px 0 #5a4a3a, 0 2px 6px #0008; }
.btn:hover { border-color: var(--gold); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: linear-gradient(#c4442a, #8f2a17); border-color: #e0603a; color: #fff6e6; box-shadow: inset 0 1px 0 #ef8a68, 0 3px 10px #0009; }
.btn.plain { background: transparent; box-shadow: none; }
.btn[disabled] { opacity: .4; pointer-events: none; }
.btn.small { min-height: 36px; padding: 4px 12px; font-size: 14px; }
.panel { background: linear-gradient(#2a221c, #1b1612); border: 1px solid #4b3d30; border-radius: 10px; box-shadow: 0 10px 30px #000a; }
.paper { background: radial-gradient(circle at 30% 20%, #f7eedb, var(--paper) 50%, var(--paper2)); color: #2a1f16; }
.title-sm { font-family: var(--brush); font-size: 30px; line-height: 1.1; color: var(--paper); text-align: center; margin: 6px 0 2px; }
.sub { color: var(--dim); font-size: 14px; text-align: center; }
.scroll-y { overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.row { display: flex; gap: 10px; align-items: center; }
.center { display: flex; flex-direction: column; align-items: center; justify-content: center; }
.coin { display: inline-block; width: 1em; height: 1em; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #ffe7a0, #c99a2e 60%, #8a6618); vertical-align: -.12em; position: relative; box-shadow: 0 0 0 1px #6a4c10; }
.coin::after { content: ''; position: absolute; inset: 32%; background: #7a5a16; border-radius: 1px; }
.num-up { color: #5fd38a; } .num-down { color: #ff7a5c; }
.tag { font-size: 12px; padding: 1px 6px; border-radius: 3px; background: #ffffff14; color: var(--dim); }

/* ---------- 顶栏 HUD ---------- */
.hud { flex: none; display: flex; align-items: center; gap: 10px; height: 46px; padding: 0 10px; background: linear-gradient(#0d0b09ee, #0d0b0999); border-bottom: 1px solid #3a2f25; z-index: 5; }
.hud .who { font-family: var(--brush); font-size: 22px; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--verm); color: #fff2e0; flex: none; }
.hud .stat { display: flex; align-items: center; gap: 4px; font-size: 15px; white-space: nowrap; }
.hud .hp b { color: #ff8a70; }
.hud .gold b { color: var(--gold2); }
.hud .floor { color: var(--dim); font-size: 13px; white-space: nowrap; }
.hud .sp { flex: 1; }
.hud .ib { width: 38px; height: 38px; border: 0; background: transparent; display: grid; place-items: center; border-radius: 6px; position: relative; }
.hud .ib:hover { background: #ffffff10; }
.hud .ib svg { width: 24px; height: 24px; fill: none; stroke: var(--paper2); stroke-width: 1.8; }
.hud .ib .cnt { position: absolute; right: 0; bottom: 0; font-size: 11px; background: #000c; border-radius: 6px; padding: 0 4px; }
.pots { display: flex; gap: 4px; }
.pot { width: 30px; height: 30px; border-radius: 50%; border: 1px dashed #5b4b3b; background: transparent; padding: 0; display: grid; place-items: center; font-family: var(--brush); font-size: 17px; color: #fff; }
.pot.has { border: 1px solid #a07c3a; background: radial-gradient(circle at 35% 30%, #7d4fa0, #3a1f55 70%); box-shadow: 0 0 8px #a070d055; }
.pot.has.r-uncommon { background: radial-gradient(circle at 35% 30%, #4f8fb0, #1d3c55 70%); }
.pot.has.r-rare { background: radial-gradient(circle at 35% 30%, #d0a040, #6a4410 70%); }
.relics { flex: none; display: flex; gap: 6px; padding: 4px 10px; overflow-x: auto; scrollbar-width: none; min-height: 40px; align-items: center; }
.relics::-webkit-scrollbar { display: none; }
.relic { flex: none; width: 32px; height: 32px; border-radius: 6px; display: grid; place-items: center; font-family: var(--brush); font-size: 19px; color: #3a160c; background: radial-gradient(circle at 35% 30%, #f6e9c9, #d8bf8a); box-shadow: inset 0 0 0 2px #9a2c18, 0 2px 4px #0008; border: 0; padding: 0; position: relative; }
.relic.r-boss { box-shadow: inset 0 0 0 2px #6a3aa0, 0 2px 4px #0008; }
.relic.r-rare { box-shadow: inset 0 0 0 2px var(--gold), 0 2px 4px #0008; }
.relic.flash { animation: flash calc(.5s / var(--spd)); }
.relic .rc { position: absolute; right: -3px; bottom: -3px; font: 10px var(--serif); background: #000; color: #fff; border-radius: 4px; padding: 0 2px; }
.relic.used { filter: grayscale(1) brightness(.6); }
@keyframes flash { 50% { transform: scale(1.35); filter: brightness(1.4); } }

/* ---------- 卡牌 ---------- */
.card { --tc: #8a2a19; position: relative; width: var(--cw); height: calc(var(--cw) * 1.42); border-radius: calc(var(--cw) * .07); background: linear-gradient(#f6edd8, var(--paper) 40%, var(--paper2)); color: #2a1f16; box-shadow: inset 0 0 0 calc(var(--cw) * .035) var(--tc), inset 0 0 0 calc(var(--cw) * .05) #f6edd8aa, 0 4px 10px #0009; display: flex; flex-direction: column; align-items: center; padding: calc(var(--cw) * .07); font-size: calc(var(--cw) * .1); line-height: 1.3; overflow: hidden; flex: none; }
.card.t-skl { --tc: #2d4c74; } .card.t-pow { --tc: #9a7a22; } .card.t-sts { --tc: #5a5a5a; } .card.t-cur { --tc: #4a2244; }
.card .cost { position: absolute; left: calc(var(--cw) * .03); top: calc(var(--cw) * .03); width: calc(var(--cw) * .25); height: calc(var(--cw) * .25); border-radius: 50%; background: radial-gradient(circle at 35% 30%, #e86a48, #a12a14 70%); color: #fff6e8; display: grid; place-items: center; font-weight: 700; font-size: calc(var(--cw) * .15); box-shadow: 0 1px 3px #0008, inset 0 0 0 1px #ffb39a88; z-index: 2; }
.card .cost.dn { color: #b8ffcf; } .card .cost.upc { color: #ffd0c0; }
.card .cname { font-weight: 700; font-size: calc(var(--cw) * .125); margin-top: calc(var(--cw) * .005); white-space: nowrap; max-width: 78%; overflow: hidden; text-overflow: ellipsis; padding-left: calc(var(--cw) * .1); }
.card.up .cname { color: #2c7a45; }
.card .art { width: 100%; height: calc(var(--cw) * .5); margin-top: calc(var(--cw) * .03); border-radius: calc(var(--cw) * .04); background: radial-gradient(ellipse at 50% 60%, color-mix(in srgb, var(--tc) 35%, #e8dcc0), #d8c8a6 75%); display: grid; place-items: center; position: relative; overflow: hidden; box-shadow: inset 0 0 0 1px #0002; }
.card .art span { font-family: var(--brush); font-size: calc(var(--cw) * .44); color: var(--tc); opacity: .85; line-height: 1; text-shadow: 0 2px 0 #fff6; }
.card .art img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.card .ctype { font-size: calc(var(--cw) * .085); color: #fff6e6; background: var(--tc); padding: 0 calc(var(--cw) * .06); border-radius: 2px; margin-top: calc(var(--cw) * -.05); position: relative; z-index: 1; }
.card .cdesc { flex: 1; display: flex; align-items: center; justify-content: center; text-align: center; white-space: pre-line; font-size: calc(var(--cw) * .098); padding: calc(var(--cw) * .02) 0 0; }
.card .cdesc b { color: #1b130d; }
.card .cdesc b.num-up { color: #1f8a46; } .card .cdesc b.num-down { color: #c0391f; }
.card .kw { color: #8a5a10; }
.card.r-uncommon .cname { text-shadow: 0 0 6px #6fa8ff88; }
.card.r-rare { box-shadow: inset 0 0 0 calc(var(--cw) * .035) var(--tc), inset 0 0 0 calc(var(--cw) * .055) var(--gold2), 0 4px 14px #000a, 0 0 12px #e8c87755; }
.card .gem { position: absolute; right: calc(var(--cw) * .06); top: calc(var(--cw) * .08); width: calc(var(--cw) * .07); height: calc(var(--cw) * .07); transform: rotate(45deg); background: #9a8a70; }
.card.r-uncommon .gem { background: #4f86c6; } .card.r-rare .gem { background: var(--gold); box-shadow: 0 0 6px var(--gold2); }
.card.dim { filter: saturate(.5) brightness(.72); }
.card.unseen { filter: brightness(0) opacity(.35); }

/* ---------- 战斗 ---------- */
.combat { flex: 1; display: flex; flex-direction: column; position: relative; }
.field { flex: 1; position: relative; min-height: 0; }
.foes { position: absolute; left: 0; right: 0; top: 34px; height: calc(62% - 20px); display: flex; justify-content: center; align-items: center; gap: 8px; padding: 0 8px; }
.foe { --es: 96px; width: calc(var(--es) + 16px); display: flex; flex-direction: column; align-items: center; position: relative; transition: opacity .6s, transform .3s; }
.foe.boss { --es: 132px; }
.foe.elite { --es: 112px; }
.foe.dead { opacity: 0; transform: scale(.7) translateY(20px); pointer-events: none; }
.foe .intent { height: 30px; display: flex; align-items: center; gap: 3px; font-weight: 700; font-size: 17px; white-space: nowrap; text-shadow: 0 1px 3px #000; animation: bob 2.4s ease-in-out infinite; }
.foe .intent svg { width: 24px; height: 24px; }
.foe .intent .n { color: #ffd2c4; }
.disk { width: var(--es); height: var(--es); border-radius: 50%; display: grid; place-items: center; position: relative; background: radial-gradient(circle at 38% 32%, #4a3e34, #1a1410 62%, #0b0908); box-shadow: 0 0 0 2px #3a2f26, 0 0 0 4px #00000066, 0 10px 24px #000c, inset 0 0 18px #000; transition: transform .15s; }
.foe.elite .disk { box-shadow: 0 0 0 2px var(--gold), 0 0 0 5px #00000066, 0 10px 24px #000c, 0 0 20px #c9a24c44, inset 0 0 18px #000; }
.foe.boss .disk { box-shadow: 0 0 0 3px var(--verm), 0 0 0 6px #00000066, 0 12px 30px #000c, 0 0 34px #b5361f66, inset 0 0 22px #000; }
.disk .glyph { font-family: var(--brush); font-size: calc(var(--es) * .58); color: var(--paper); line-height: 1; text-shadow: 0 0 14px #fff3, 0 3px 0 #000; animation: breathe 4s ease-in-out infinite; }
.disk img { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.foe .fname { margin-top: 4px; font-size: 13px; color: var(--paper2); white-space: nowrap; }
.hpbar { width: 100%; height: 14px; margin-top: 3px; border-radius: 7px; background: #000a; border: 1px solid #4a3a2c; position: relative; overflow: hidden; }
.hpbar i { position: absolute; left: 0; top: 0; bottom: 0; background: linear-gradient(#d65a40, #8e2414); transition: width .3s; }
.hpbar i.poisoned { background: linear-gradient(#8fc85e, #3f7a22); }
.hpbar b { position: relative; display: block; text-align: center; font-size: 11px; line-height: 12px; color: #fff; text-shadow: 0 1px 2px #000; font-weight: 700; }
.hpwrap { position: relative; width: 100%; }
.blk { position: absolute; left: -12px; top: 0; width: 24px; height: 26px; display: grid; place-items: center; font-size: 12px; font-weight: 700; color: #fff; z-index: 2; }
.blk::before { content: ''; position: absolute; inset: 0; background: linear-gradient(#7fb0ea, #2f5f9e); clip-path: polygon(50% 0, 100% 15%, 100% 55%, 50% 100%, 0 55%, 0 15%); z-index: -1; }
.hpbar.has-blk { border-color: var(--blockc); box-shadow: 0 0 6px #5b8fd0aa; }
.pws { display: flex; flex-wrap: wrap; gap: 3px; justify-content: center; margin-top: 4px; min-height: 20px; max-width: 100%; }
.pw { min-width: 20px; height: 20px; padding: 0 3px; border-radius: 4px; display: inline-flex; align-items: center; gap: 1px; font-size: 11px; background: #2c4a2a; border: 1px solid #5c8a4a; color: #e6f5d6; }
.pw .c { font-family: var(--brush); font-size: 14px; line-height: 1; }
.pw.bad { background: #4a1f1a; border-color: #a0452f; color: #ffd8cc; }
.pw.k-poison { background: #2c4415; border-color: #7ab048; }
.pw.k-intent { background: #3a3014; border-color: var(--gold); color: #ffeec0; }
.foe.targetable .disk { box-shadow: 0 0 0 3px var(--gold2), 0 0 24px var(--gold2); cursor: pointer; }
.foe.hot .disk { transform: scale(1.08); box-shadow: 0 0 0 4px #fff, 0 0 30px var(--verm2); }
.foe.lunge .disk { animation: lunge calc(.35s / var(--spd)); }
.shake { animation: shake calc(.3s / var(--spd)); }
@keyframes lunge { 40% { transform: translateY(26px) scale(1.08); } }
@keyframes shake { 20% { transform: translateX(-6px); } 40% { transform: translateX(6px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(3px); } }
@keyframes bob { 50% { transform: translateY(-3px); } }
@keyframes breathe { 50% { opacity: .82; } }
.movename { position: absolute; top: -8px; left: 50%; transform: translateX(-50%); white-space: nowrap; background: #000c; border: 1px solid var(--verm); padding: 2px 10px; border-radius: 4px; font-size: 14px; animation: pop calc(.9s / var(--spd)) forwards; z-index: 5; }
@keyframes pop { 0% { opacity: 0; transform: translate(-50%, 6px); } 20%, 80% { opacity: 1; transform: translate(-50%, 0); } 100% { opacity: 0; } }

.me { position: absolute; left: 12px; bottom: 6px; display: flex; align-items: flex-end; gap: 10px; max-width: 60%; }
.me .disk { --es: 62px; background: radial-gradient(circle at 38% 32%, #c4442a, #6a1a0c 70%); box-shadow: 0 0 0 2px #e8c877, 0 8px 18px #000c; }
.me .disk .glyph { color: #fff3e0; font-size: 36px; }
.me .info { width: 150px; }
.me .hpbar { height: 16px; }
.me .hpbar b { font-size: 12px; line-height: 14px; }
.me .pws { justify-content: flex-start; }
.incoming { position: absolute; right: 12px; bottom: 10px; font-size: 13px; color: var(--dim); text-align: right; }
.incoming b { color: #ff8a70; font-size: 16px; }

.ctrl { flex: none; height: 58px; display: flex; align-items: center; justify-content: space-between; padding: 0 10px; gap: 8px; position: relative; z-index: 3; }
.energy { width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 20px; color: #fff; background: radial-gradient(circle at 35% 30%, #ffd36b, #d26a1a 55%, #7a2a08); box-shadow: 0 0 0 2px #3a1a08, 0 0 16px #ff9a3a88; flex: none; }
.energy.zero { filter: grayscale(.8) brightness(.6); box-shadow: 0 0 0 2px #3a1a08; }
.pile { min-width: 44px; height: 44px; border-radius: 8px; border: 1px solid #5b4b3b; background: #1c1612cc; display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 11px; line-height: 1.1; color: var(--dim); padding: 2px 6px; }
.pile b { font-size: 16px; color: var(--paper); }
.endturn { min-width: 92px; }
.hint { position: absolute; left: 50%; transform: translateX(-50%); top: 4px; z-index: 6; font-size: 13px; color: var(--paper); background: #000a; padding: 2px 10px; border-radius: 10px; white-space: nowrap; pointer-events: none; }
.hint:empty { display: none; }

.hand { flex: none; position: relative; height: calc(var(--cw) * 1.42 + 22px); margin-bottom: 2px; }
.hand .card { position: absolute; bottom: 14px; left: 0; transition: transform calc(.22s / var(--spd)), filter .2s; transform-origin: 50% 100%; touch-action: none; cursor: grab; will-change: transform; }
.hand .card.playable { box-shadow: inset 0 0 0 calc(var(--cw) * .035) var(--tc), inset 0 0 0 calc(var(--cw) * .05) #f6edd8aa, 0 4px 10px #0009, 0 0 0 2px #7fe0a0cc, 0 0 12px #7fe0a066; }
.hand .card.sel { z-index: 30 !important; }
.hand .card.drag { transition: none; z-index: 40 !important; pointer-events: none; }
.hand .card.drawn { animation: drawIn calc(.3s / var(--spd)); }
@keyframes drawIn { from { opacity: 0; translate: -140px 60px; scale: .5; } }
.ghost { position: absolute; z-index: 45; pointer-events: none; animation: ghostUp calc(.45s / var(--spd)) forwards; }
@keyframes ghostUp { to { opacity: 0; transform: translateY(-120px) scale(.8); } }

.float { position: absolute; font-weight: 700; font-size: 26px; color: #fff; text-shadow: 0 2px 4px #000, 0 0 8px #000; animation: floatUp calc(.9s / var(--spd)) ease-out forwards; white-space: nowrap; transform: translate(-50%, 0); }
.float.dmg { color: #ffb09a; } .float.blk { color: #9cc6ff; font-size: 20px; } .float.heal { color: #8ff0a6; font-size: 22px; } .float.pw { font-size: 15px; color: #ffe9b0; } .float.pw.bad { color: #ffb4a0; }
.float.big { font-size: 36px; color: #ff6a4a; }
@keyframes floatUp { 0% { opacity: 0; transform: translate(-50%, 10px) scale(.7); } 15% { opacity: 1; transform: translate(-50%, 0) scale(1.15); } 100% { opacity: 0; transform: translate(-50%, -50px) scale(1); } }
.slash { position: absolute; width: 110px; height: 110px; pointer-events: none; animation: slash calc(.3s / var(--spd)) forwards; transform: translate(-50%, -50%); }
@keyframes slash { from { opacity: 1; clip-path: inset(0 100% 0 0); } 60% { opacity: 1; clip-path: inset(0 0 0 0); } to { opacity: 0; } }
.banner { position: absolute; left: 0; right: 0; top: 38%; text-align: center; font-family: var(--brush); font-size: 46px; color: var(--paper); text-shadow: 0 0 20px #000, 0 3px 0 #000; animation: banner calc(1.1s / var(--spd)) forwards; background: linear-gradient(90deg, transparent, #000a 30%, #000a 70%, transparent); padding: 6px 0; }
@keyframes banner { 0% { opacity: 0; transform: scaleY(.4); } 20%, 75% { opacity: 1; transform: scaleY(1); } 100% { opacity: 0; } }
.screen-shake { animation: shake calc(.3s / var(--spd)); }

/* ---------- 地图 ---------- */
.mapwrap { flex: 1; position: relative; min-height: 0; }
.map { position: absolute; inset: 0; overflow-y: auto; overscroll-behavior: contain; }
.map svg { display: block; margin: 0 auto; }
.map .edge { stroke: #c9b68e66; stroke-width: 2; stroke-dasharray: 2 6; stroke-linecap: round; fill: none; }
.map .edge.done { stroke: var(--verm2); stroke-dasharray: none; stroke-width: 3; }
.map .node circle.bg2 { fill: #1b1511; stroke: #8a7660; stroke-width: 1.5; }
.map .node text { font-family: var(--brush); fill: var(--paper2); text-anchor: middle; dominant-baseline: central; pointer-events: none; }
.map .node.avail { cursor: pointer; }
.map .node.avail circle.bg2 { stroke: var(--gold2); stroke-width: 3; animation: nodePulse 1.4s ease-in-out infinite; }
.map .node.avail text { fill: #fff; }
.map .node.visited circle.bg2 { fill: #5a1a0e; stroke: var(--verm2); }
.map .node.past { opacity: .45; }
.map .node.t-elite circle.bg2 { stroke: #d65a40; }
.map .node.t-boss circle.bg2 { fill: #2a0f0a; stroke: var(--verm); stroke-width: 3; }
@keyframes nodePulse { 50% { stroke-width: 5; filter: drop-shadow(0 0 6px #e8c877); } }
.legend { flex: none; display: flex; justify-content: center; flex-wrap: wrap; gap: 4px 12px; padding: 6px 10px; font-size: 12px; color: var(--dim); background: #0d0b09cc; border-top: 1px solid #3a2f25; }
.legend span b { font-family: var(--brush); font-weight: 400; color: var(--paper2); font-size: 16px; margin-right: 2px; }
.acttitle { position: absolute; top: 0; left: 0; right: 0; padding: 8px 0 18px; background: linear-gradient(#0d0b09dd, transparent); text-align: center; pointer-events: none; font-family: var(--brush); font-size: 22px; color: var(--paper2); text-shadow: 0 2px 6px #000; z-index: 2; }

/* ---------- 模态 ---------- */
#modal:empty { display: none; }
#modal { position: absolute; inset: 0; z-index: 50; }
.veil { position: absolute; inset: 0; background: #000b; backdrop-filter: blur(2px); display: flex; flex-direction: column; padding: calc(var(--safe-t) + 12px) calc(var(--safe-r) + 12px) calc(var(--safe-b) + 12px) calc(var(--safe-l) + 12px); animation: fadeIn .18s; }
@keyframes fadeIn { from { opacity: 0; } }
.veil .mhead { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.veil .mhead h2 { margin: 0; font-family: var(--brush); font-weight: 400; font-size: 28px; color: var(--paper); }
.veil .mbody { flex: 1; min-height: 0; }
.veil .mfoot { flex: none; display: flex; justify-content: center; gap: 12px; padding-top: 10px; flex-wrap: wrap; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(var(--cw), 1fr)); gap: 12px; justify-items: center; padding: 6px 2px 20px; }
.grid .card { cursor: pointer; }
.grid .card.picked { outline: 3px solid var(--gold2); outline-offset: 3px; transform: translateY(-4px); }
.dialog { margin: auto; width: min(420px, 100%); padding: 20px; text-align: center; }
.dialog h3 { margin: 0 0 8px; font-family: var(--brush); font-weight: 400; font-size: 28px; }
.dialog p { margin: 0 0 14px; color: var(--paper2); }
.tabs { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; flex: none; padding-bottom: 6px; }
.tabs button { flex: none; min-height: 36px; padding: 4px 14px; border-radius: 18px; border: 1px solid #5b4b3b; background: #1c1612; color: var(--paper2); }
.tabs button.on { background: var(--verm); border-color: var(--verm2); color: #fff; }

#tip { position: absolute; z-index: 60; max-width: 260px; padding: 8px 10px; border-radius: 6px; background: #0e0b09f2; border: 1px solid #6b5a45; font-size: 13px; line-height: 1.5; pointer-events: none; opacity: 0; transition: opacity .12s; white-space: pre-line; color: var(--paper); box-shadow: 0 6px 20px #000a; }
#tip.on { opacity: 1; }
#tip b { color: var(--gold2); }
#toast { position: absolute; left: 50%; top: 30%; transform: translateX(-50%); z-index: 70; pointer-events: none; }
#toast div { background: #000d; border: 1px solid var(--verm); padding: 6px 16px; border-radius: 6px; animation: pop 1.3s forwards; white-space: nowrap; position: relative; transform: translateX(-50%); }

/* ---------- 标题 & 选人 ---------- */
.title { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 20px; text-align: center; }
.logo { position: relative; display: flex; align-items: center; gap: 14px; }
.logo h1 { margin: 0; font-family: var(--brush); font-weight: 400; font-size: clamp(64px, 18vw, 120px); line-height: 1; color: var(--paper); text-shadow: 0 4px 0 #000, 0 0 40px #0008; letter-spacing: .05em; }
.seal { width: clamp(48px, 12vw, 70px); height: clamp(48px, 12vw, 70px); border-radius: 8px; background: var(--verm); color: #fff0e0; font-family: var(--brush); font-size: clamp(20px, 5vw, 30px); line-height: 1; display: grid; grid-template-columns: 1fr 1fr; place-items: center; padding: 4px; box-shadow: inset 0 0 0 3px #f0c8b8aa, 0 4px 10px #0008; transform: rotate(-6deg); }
.tagline { color: var(--paper2); font-size: 16px; letter-spacing: .3em; margin: 4px 0 18px; }
.menu { display: flex; flex-direction: column; gap: 10px; width: min(280px, 80vw); }
.menu .btn { width: 100%; }
.ver { position: absolute; bottom: calc(var(--safe-b) + 8px); right: 12px; font-size: 12px; color: #6b5f50; }
.heroes { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: 14px; width: min(760px, 100%); }
.hero { padding: 14px; display: flex; gap: 14px; align-items: flex-start; text-align: left; cursor: pointer; border: 2px solid transparent; }
.hero.on { border-color: var(--gold2); box-shadow: 0 0 24px #e8c87744, 0 10px 30px #000a; }
.hero .disk { --es: 78px; flex: none; background: radial-gradient(circle at 38% 32%, #c4442a, #6a1a0c 70%); }
.hero h3 { margin: 0; font-family: var(--brush); font-weight: 400; font-size: 30px; line-height: 1.1; }
.hero h3 small { font-family: var(--serif); font-size: 14px; color: var(--dim); margin-left: 6px; }
.hero p { margin: 4px 0; font-size: 14px; color: var(--paper2); }
.hero .meta { font-size: 13px; color: var(--dim); }
.asc { display: flex; align-items: center; gap: 10px; justify-content: center; margin: 14px 0 6px; }
.asc b { font-size: 20px; min-width: 70px; text-align: center; font-family: var(--brush); font-weight: 400; color: var(--verm2); }

/* ---------- 房间 ---------- */
.room { flex: 1; display: flex; flex-direction: column; align-items: center; padding: 14px; gap: 12px; min-height: 0; }
.room > .scroll-y { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 12px; flex: 1; min-height: 0; padding-bottom: 12px; }
.bigdisk { --es: 110px; }
.bigdisk .glyph { font-size: 64px; }
.evtext { max-width: 560px; padding: 16px 18px; border-radius: 8px; line-height: 1.8; font-size: 16px; }
.opts { display: flex; flex-direction: column; gap: 10px; width: min(520px, 100%); }
.opt { text-align: left; padding: 10px 14px; min-height: 52px; border-radius: 8px; border: 1px solid #6b5a45; background: linear-gradient(#30271f, #211a15); }
.opt b { display: block; font-size: 16px; color: var(--paper); }
.opt span { font-size: 13px; color: var(--dim); }
.opt:hover { border-color: var(--gold); }
.opt[disabled] { opacity: .4; pointer-events: none; }
.rewards { width: min(420px, 100%); display: flex; flex-direction: column; gap: 8px; }
.rw { display: flex; align-items: center; gap: 12px; padding: 8px 12px; min-height: 52px; border-radius: 8px; border: 1px solid #6b5a45; background: linear-gradient(#30271f, #211a15); text-align: left; }
.rw .ic { width: 34px; height: 34px; flex: none; display: grid; place-items: center; font-family: var(--brush); font-size: 22px; border-radius: 6px; }
.rw.done { opacity: .35; pointer-events: none; }
.choices { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.choices .card { cursor: pointer; transition: transform .15s; }
.choices .card:hover { transform: translateY(-6px); }
.shopgrid { width: min(760px, 100%); display: flex; flex-direction: column; gap: 14px; }
.shopsec h4 { margin: 0 0 6px; font-weight: 400; color: var(--dim); font-size: 14px; }
.shoprow { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }
.item { display: flex; flex-direction: column; align-items: center; gap: 4px; cursor: pointer; position: relative; }
.item .price { font-size: 14px; font-weight: 700; color: var(--gold2); white-space: nowrap; }
.item.poor .price { color: #c0392b; }
.item.sold { opacity: .25; pointer-events: none; }
.item .sale { position: absolute; top: -6px; right: -6px; background: var(--verm); color: #fff; font-size: 11px; padding: 0 5px; border-radius: 3px; z-index: 3; }
.bigrelic { width: 56px; height: 56px; font-size: 32px; border-radius: 10px; }
.restopts { display: flex; gap: 16px; flex-wrap: wrap; justify-content: center; }
.restopt { width: 150px; padding: 16px 10px; display: flex; flex-direction: column; align-items: center; gap: 6px; border-radius: 10px; border: 1px solid #6b5a45; background: linear-gradient(#30271f, #211a15); }
.restopt .g { font-family: var(--brush); font-size: 48px; line-height: 1; color: var(--verm2); }
.restopt[disabled] { opacity: .4; pointer-events: none; }
.stats { width: min(420px, 100%); display: grid; grid-template-columns: 1fr auto; gap: 4px 16px; font-size: 15px; }
.stats span:nth-child(even) { text-align: right; font-weight: 700; }
.hist { width: min(560px, 100%); display: flex; flex-direction: column; gap: 6px; }
.hist .h { display: flex; justify-content: space-between; gap: 8px; padding: 8px 12px; border-radius: 6px; background: #ffffff0a; font-size: 14px; }
.hist .h.won { border-left: 3px solid var(--gold2); } .hist .h.lost { border-left: 3px solid #6b5a45; }
.toggle { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid #ffffff14; }
.help { max-width: 620px; margin: 0 auto; line-height: 1.8; font-size: 15px; color: var(--paper2); }
.help h4 { margin: 14px 0 4px; color: var(--paper); font-family: var(--brush); font-weight: 400; font-size: 22px; }
.help b { color: var(--gold2); }
.relicline { display: flex; gap: 10px; align-items: center; padding: 8px; border-bottom: 1px solid #ffffff10; text-align: left; }
.relicline .relic { width: 40px; height: 40px; font-size: 24px; }
.relicline.unseen { opacity: .35; }
.relicline p { margin: 0; font-size: 13px; color: var(--dim); white-space: pre-line; }
.compgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); gap: 0 16px; }

/* ---------- 响应式 ---------- */
@media (max-width: 420px) {
  .hud { gap: 6px; padding: 0 6px; }
  .hud .floor { display: none; }
  .foe .fname { font-size: 12px; }
  .me .info { width: 120px; }
}
@media (min-width: 700px) and (min-height: 700px) {
  :root { --cw: 120px; }
  .foe { --es: 120px; } .foe.elite { --es: 136px; } .foe.boss { --es: 160px; }
  .me .disk { --es: 78px; } .me .info { width: 190px; }
  .hud { height: 52px; }
}
@media (max-height: 640px) and (max-width: 699px) { :root { --cw: 80px; } .foe { --es: 76px; } .foe.boss { --es: 100px; } .foe.elite { --es: 88px; } }
@media (orientation: landscape) and (max-height: 520px) {
  :root { --cw: 74px; }
  .foe { --es: 64px; } .foe.elite { --es: 72px; } .foe.boss { --es: 84px; }
  .foes { top: 0; height: 70%; } .hud { height: 40px; } .relics { min-height: 34px; padding: 2px 10px; }
  .ctrl { height: 48px; } .energy { width: 44px; height: 44px; }
  .me .disk { --es: 48px; } .me .disk .glyph { font-size: 28px; }
}
@media (min-width: 900px) and (min-height: 760px) {
  :root { --cw: 136px; }
  .foe { --es: 140px; } .foe.elite { --es: 160px; } .foe.boss { --es: 190px; }
  .foe .fname { font-size: 15px; } .foe .intent { font-size: 20px; height: 36px; } .foe .intent svg { width: 28px; height: 28px; }
  .me .disk { --es: 90px; } .me .disk .glyph { font-size: 50px; } .me .info { width: 220px; }
  .energy { width: 64px; height: 64px; font-size: 22px; } .ctrl { height: 70px; }
}
