/* 我的手機會修仙 v2 — 水墨宣紙風 */
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
:root {
  --paper: #f3ecdf; --paper2: #e9dfcc; --ink: #1f1a17; --ink2: #4a413a; --mute: #8a7d70; --seal: #b8312f;
  --gang: #b5553c; --rou: #3f7f8c; --yin: #5b4a72; --yang: #c08a1e; --gold: #c9971f;
  --kai: "KaiTi", "STKaiti", "BiauKai", "DFKai-SB", "標楷體", serif;
  --sans: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif;
  --brush: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 12' preserveAspectRatio='none'%3E%3Cpath d='M3 5.2 L1.2 3.6 L4.5 2.1 L9 1.4 L30 1.2 L55 1.6 L80 1.1 L95.5 1.5 L98.6 3 L97.4 5.4 L99 7.6 L96.2 10.2 L88 10.8 L60 10.4 L35 10.9 L10 10.5 L3.6 10 L0.8 8.4 L2.6 6.8Z'/%3E%3C/svg%3E");
  --blot: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 40' preserveAspectRatio='none'%3E%3Cpath d='M6 4 Q2 6 2.5 12 L1.5 28 Q2 36 8 37.5 L40 38.5 L70 37.8 L93 38.6 Q98.5 37 98 31 L98.8 14 Q98.5 4 92 2.2 L62 1.6 L30 2.4Z'/%3E%3C/svg%3E");
}
html, body { height: 100%; touch-action: manipulation; background: #d9cfbd; color: var(--ink); font-family: var(--sans); user-select: none; -webkit-user-select: none; overflow: hidden; }
#app {
  max-width: 480px; height: 100%; margin: 0 auto; display: flex; flex-direction: column; position: relative; overflow: hidden;
  background: radial-gradient(circle at 20% 30%, rgba(120,90,50,.06), transparent 40%), radial-gradient(circle at 80% 70%, rgba(120,90,50,.05), transparent 45%), var(--paper);
  box-shadow: 0 0 40px rgba(0,0,0,.18);
}
.hidden { display: none !important; }
button { font: inherit; color: inherit; }
.mask-blot { -webkit-mask: var(--blot) center / 100% 100% no-repeat; mask: var(--blot) center / 100% 100% no-repeat; }

/* ---------- 頂部 ---------- */
#top { display: flex; align-items: center; gap: 12px; padding: 10px 14px; position: relative; flex: none; }
#top::after, #tabs::before { content: ""; position: absolute; left: 4%; right: 4%; height: 3px; background: var(--ink); opacity: .25;
  -webkit-mask: var(--brush) center / 100% 100% no-repeat; mask: var(--brush) center / 100% 100% no-repeat; }
#top::after { bottom: 0; }
.realm-seal { font-family: var(--kai); color: #fff; background: var(--seal); width: 50px; height: 50px; border-radius: 6px; flex: none;
  display: flex; align-items: center; justify-content: center; text-align: center; font-size: 16px; line-height: 1.15; font-weight: 700;
  box-shadow: inset 0 0 0 3px rgba(255,255,255,.25); transform: rotate(-3deg); }
.res { flex: 1; min-width: 0; }
.cur { font-family: var(--kai); display: flex; align-items: center; gap: 2px; }
.cur b { font-size: 24px; }
.cur small { font-size: 12px; color: var(--mute); margin-left: 4px; }
.cur b.bump { animation: bump .35s ease-out; }
.sub { font-size: 12px; color: var(--ink2); margin-top: 1px; }
.sub b { color: var(--ink); }
.ico { display: inline-block; width: 20px; height: 18px; margin-right: 3px; vertical-align: -3px; font-style: normal; }
.ui-ico { width: 100%; height: 100%; display: block; }
#soundBtn { width: 38px; height: 38px; flex: none; border-radius: 50%; border: 1.5px solid var(--ink); background: var(--paper);
  font-family: var(--kai); font-size: 18px; font-weight: 700; cursor: pointer; }

/* ---------- 洞府 ---------- */
.screen { flex: 1; min-height: 0; overflow-y: auto; }
#home { display: flex; flex-direction: column; gap: 10px; padding-bottom: 12px; }
#homeScene { position: relative; height: 34vh; min-height: 220px; flex: none; overflow: hidden; background: linear-gradient(#e6dccb, transparent 80%); }
#homeScene .bg { position: absolute; inset: 0; width: 100%; height: 100%; }
#homeHero { position: absolute; left: 50%; bottom: 12%; transform: translateX(-50%); }
#homeHero .token { --H: 150px; position: relative; width: 70px; height: var(--H); }
#homeHero .token::before { content: ""; position: absolute; left: -60%; right: -60%; top: 10%; bottom: -4%; border-radius: 50%; z-index: -1;
  background: radial-gradient(ellipse, rgba(246,226,166,.55), transparent 65%); animation: aura 3s ease-in-out infinite; }
@keyframes aura { 0%,100% { opacity: .55; transform: scale(1); } 50% { opacity: 1; transform: scale(1.08); } }
.phone-hint { position: absolute; left: 10px; right: 10px; top: 10px; display: flex; gap: 8px; align-items: flex-start;
  background: rgba(31,26,23,.88); color: var(--paper); border-radius: 12px; padding: 8px 12px; font-size: 13px; line-height: 1.5;
  box-shadow: 0 4px 12px rgba(0,0,0,.2); animation: appIn .4s ease-out; cursor: pointer; }
.phone-hint b { flex: none; color: #f2c57c; font-family: var(--kai); font-size: 13px; letter-spacing: 2px; padding-top: 1px; }
.phone-hint em { font-style: normal; color: #f2c57c; font-weight: 700; }
#regionPick { display: flex; align-items: center; gap: 8px; padding: 0 16px; }
#regionPick button { width: 40px; height: 40px; border-radius: 50%; border: 1.5px solid var(--ink2); background: none; font-size: 24px; line-height: 1; cursor: pointer; flex: none; }
#regionPick button:disabled { opacity: .25; cursor: default; }
#regionInfo { flex: 1; text-align: center; font-family: var(--kai); }
#regionInfo b { display: block; font-size: 24px; }
#regionInfo small { font-family: var(--sans); font-size: 12px; color: var(--mute); }
#regionInfo small em { font-style: normal; color: var(--seal); font-weight: 700; }
.big-btn { margin: 0 16px; height: 64px; border: none; cursor: pointer; color: #fff; font-family: var(--kai); font-size: 28px; font-weight: 900; letter-spacing: 8px;
  background: linear-gradient(#c63d3a, #9c2826); -webkit-mask: var(--blot) center / 100% 100% no-repeat; mask: var(--blot) center / 100% 100% no-repeat;
  transition: transform .08s, filter .15s; animation: breathe2 2.4s ease-in-out infinite; }
.big-btn:active { transform: scale(.97); }
.big-btn:disabled { background: #b3a793; animation: none; cursor: default; }
@keyframes breathe2 { 0%,100% { filter: brightness(1); } 50% { filter: brightness(1.15); } }
#idleCard { margin: 0 16px; display: flex; align-items: center; gap: 12px; padding: 10px 12px; background: rgba(255,255,255,.42);
  box-shadow: inset 3px 0 0 rgba(31,26,23,.75); border-radius: 4px; }
.idle-l { flex: 1; min-width: 0; }
.idle-l b { font-family: var(--kai); font-size: 17px; }
.idle-l small { font-size: 12px; color: var(--mute); margin-left: 6px; }
.idle-bar { height: 6px; background: #e0d5c2; border-radius: 3px; margin-top: 6px; overflow: hidden; }
.idle-bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #d9b75a, var(--gold)); }
#collectBtn { min-width: 86px; display: flex; flex-direction: column; align-items: center; padding: 6px 10px; }
#collectBtn span { font-size: 16px; }
#collectBtn small { font-size: 11px; opacity: .85; }

/* ---------- 分頁 ---------- */
#tabs { display: flex; position: relative; flex: none; padding-bottom: env(safe-area-inset-bottom, 0px); }
#tabs::before { top: 0; }
.tab { flex: 1; padding: 12px 0; border: none; background: none; font-family: var(--kai); font-size: 18px; font-weight: 700; color: var(--mute); cursor: pointer; position: relative; }
.tab.active { color: var(--ink); }
.tab.active::after { content: ""; position: absolute; left: 26%; right: 26%; bottom: 5px; height: 6px; background: var(--seal);
  -webkit-mask: var(--brush) center / 100% 100% no-repeat; mask: var(--brush) center / 100% 100% no-repeat; }
.tab.dot::before { content: ""; position: absolute; top: 9px; right: 26%; width: 8px; height: 8px; border-radius: 50%; background: var(--seal); }

/* ---------- 面板（修為／境界） ---------- */
#panel { padding: 12px 14px 20px; display: flex; flex-direction: column; gap: 8px; }
.section-title { font-family: var(--kai); font-size: 17px; font-weight: 700; margin: 8px 2px 0; display: flex; justify-content: space-between; align-items: baseline; }
.section-title small { font-family: var(--sans); font-size: 11px; color: var(--mute); font-weight: 400; }
.note { font-size: 12px; color: var(--ink2); background: rgba(255,255,255,.35); border-left: 3px solid var(--seal); padding: 7px 10px; border-radius: 4px; line-height: 1.6; }
.card { display: flex; align-items: center; gap: 10px; padding: 9px 10px; background: rgba(255,255,255,.42);
  box-shadow: inset 3px 0 0 rgba(31,26,23,.75); border-radius: 4px; }
.card.maxed { opacity: .65; }
.glyph { width: 42px; height: 42px; flex: none; background: var(--ink); color: var(--paper); font-family: var(--kai); font-size: 24px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; -webkit-mask: var(--blot) center / 100% 100% no-repeat; mask: var(--blot) center / 100% 100% no-repeat; }
.info { flex: 1; min-width: 0; }
.name { font-family: var(--kai); font-size: 17px; font-weight: 700; }
.name small { font-family: var(--sans); font-size: 11px; color: var(--mute); font-weight: 400; margin-left: 4px; }
.desc { font-size: 12px; color: var(--ink2); margin-top: 1px; line-height: 1.45; }
.desc .nx { color: var(--seal); }
.mile { display: inline-block; font-size: 10px; color: var(--gold); border: 1px solid var(--gold); border-radius: 8px; padding: 0 5px; margin-left: 4px; }
.btn { border: none; cursor: pointer; background: var(--ink); color: var(--paper); font-weight: 700; font-size: 13px; padding: 8px 12px; min-width: 76px;
  -webkit-mask: var(--blot) center / 100% 100% no-repeat; mask: var(--blot) center / 100% 100% no-repeat; transition: filter .15s, transform .08s; white-space: nowrap; }
.btn:active { transform: scale(.96); }
.btn.seal { background: linear-gradient(#c63d3a, #9c2826); }
.btn.gold { background: linear-gradient(#d8a73a, #a67a12); }
.btn.cant { background: #b3a793; }
.btn.done { background: none; color: var(--mute); -webkit-mask: none; mask: none; }
.btn.ghost { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--ink); -webkit-mask: none; mask: none; border-radius: 18px; }
.btn small { display: block; font-size: 10px; font-weight: 400; opacity: .85; }
.statgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; font-size: 13px; }
.statgrid div { background: rgba(255,255,255,.35); padding: 6px 10px; border-radius: 4px; display: flex; justify-content: space-between; }
.statgrid b { font-family: var(--kai); font-size: 15px; }
.realm-big { text-align: center; padding: 6px 0 2px; }
.realm-big .realm-seal { width: 84px; height: 84px; font-size: 24px; margin: 0 auto 10px; }
.bar { height: 10px; background: #e0d5c2; border-radius: 5px; overflow: hidden; margin: 6px 0; }
.bar i { display: block; height: 100%; background: linear-gradient(90deg, #4f97a5, #2c5f6a); }
.ladder { display: flex; flex-direction: column; gap: 4px; }
.ladder div { display: flex; gap: 10px; align-items: baseline; font-size: 12px; color: var(--mute); padding: 4px 8px; border-radius: 4px; }
.ladder div b { font-family: var(--kai); font-size: 15px; width: 40px; flex: none; }
.ladder div.on { color: var(--ink); background: rgba(255,255,255,.4); }
.ladder div.cur { box-shadow: inset 3px 0 0 var(--seal); }
.codex { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 6px; }
.codex div { font-family: var(--kai); font-size: 13px; text-align: center; padding: 6px 2px; border-radius: 4px; background: rgba(255,255,255,.4); color: var(--ink); }
.codex div.unseen { color: #c9bda9; background: rgba(255,255,255,.15); }
.regions { display: flex; flex-direction: column; gap: 4px; }
.regions div { display: flex; justify-content: space-between; font-size: 13px; padding: 5px 10px; background: rgba(255,255,255,.35); border-radius: 4px; }
.regions div.locked { color: #b3a793; }
.regions b { font-family: var(--kai); }

/* ================= 闖裂隙 ================= */
#run { position: absolute; inset: 0; z-index: 10; display: flex; flex-direction: column; background: var(--paper); }
#runTop { display: flex; align-items: center; gap: 6px; padding: 8px 10px 4px; flex: none; }
#runTitle { flex: 1; min-width: 0; font-family: var(--kai); white-space: nowrap; overflow: hidden; display: flex; flex-direction: column; line-height: 1.15; }
#runTitle b { font-size: 18px; }
#runTitle span { font-size: 13px; color: var(--ink2); }
#runTitle span em { font-style: normal; color: var(--seal); font-size: 16px; font-weight: 700; }
.pill { border: 1.5px solid var(--ink); background: var(--paper); border-radius: 15px; padding: 4px 10px; font-family: var(--kai); font-weight: 700; font-size: 14px; cursor: pointer; flex: none; }
.pill.on { background: var(--ink); color: var(--paper); }
#quitBtn { width: 32px; padding: 4px 0; }
#floorBar { display: flex; gap: 2px; padding: 2px 10px 6px; flex: none; }
#floorBar i { flex: 1; height: 14px; border-radius: 2px; background: #e3d8c5; font-style: normal; font-size: 9px; line-height: 14px; text-align: center; color: var(--mute); font-family: var(--kai); font-weight: 700; }
#floorBar i.done { background: var(--ink2); color: var(--paper); }
#floorBar i.cur { background: var(--seal); color: #fff; animation: pulse 1s ease-in-out infinite; }
#floorBar i.ev { color: var(--rou); }
#floorBar i.el { color: var(--yang); }
#floorBar i.bo { color: var(--seal); }
#floorBar i.done.ev, #floorBar i.done.el, #floorBar i.done.bo { color: var(--paper); }

#scene { position: relative; height: 40vh; min-height: 250px; max-height: 380px; flex: none; overflow: hidden; background: linear-gradient(#e6dccb, transparent 75%); }
#bgStrip { position: absolute; top: 0; bottom: 0; left: 0; width: 200%; display: flex; }
#bgStrip svg { width: 50%; height: 100%; flex: none; }
#scene.walking #bgStrip { animation: walk 2.2s linear infinite; }
@keyframes walk { from { transform: translateX(0); } to { transform: translateX(-50%); } }
#scene.walking #hero .pose-idle { animation: walkBob .35s ease-in-out infinite; }
@keyframes walkBob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
#scene.quake { animation: quake .45s; }
@keyframes quake { 0%,100% { transform: none; } 20% { transform: translate(-6px, 3px); } 40% { transform: translate(5px, -4px); } 60% { transform: translate(-4px, 2px); } 80% { transform: translate(3px, -1px); } }
#scene.redflash::after { content: ""; position: absolute; inset: 0; background: radial-gradient(ellipse at 25% 70%, transparent 40%, rgba(184,49,47,.35)); animation: fadeout .4s forwards; pointer-events: none; }

.unit { position: absolute; bottom: 14%; display: flex; flex-direction: column; align-items: center; gap: 16px; transition: transform .12s; }
#hero { left: 12%; }
#foe { right: 12%; }
#foe.enter { animation: foeIn .45s ease-out; }
@keyframes foeIn { from { transform: translateX(90px); opacity: 0; } to { transform: none; opacity: 1; } }
#hero.atk { transform: translateX(24px); }
#foe.atk { transform: translateX(-20px); }
.hpbar { position: relative; width: 96px; height: 12px; padding: 1.6px; background: var(--ink);
  -webkit-mask: var(--brush) center / 100% 100% no-repeat; mask: var(--brush) center / 100% 100% no-repeat; }
.hpin { position: relative; width: 100%; height: 100%; overflow: hidden; background: #e6dccb;
  -webkit-mask: var(--brush) center / 100% 100% no-repeat; mask: var(--brush) center / 100% 100% no-repeat; }
.hpin i { position: absolute; left: 0; top: 0; bottom: 0; width: 100%; display: block; }
.hpin .trail { background: #f2c57c; transition: width .45s ease-in .25s; }
.hpin .fill { transition: width .08s linear; }
.hpin .shield { background: rgba(240,248,255,.85); width: 0; box-shadow: inset 0 0 0 1px #7fb3bf; }
#hero .fill { background: linear-gradient(#4f97a5, #2c5f6a); }
#foe .fill { background: linear-gradient(#c8443f, #8a2220); }
.hpwrap { position: relative; }
.hpnum { position: absolute; left: -24px; right: -24px; top: calc(100% + 1px); text-align: center; font-size: 10px; font-weight: 700; color: var(--ink2); white-space: nowrap;
  text-shadow: 0 0 2px var(--paper), 0 0 2px var(--paper); }
#hero.low .fill { animation: lowhp .7s ease-in-out infinite; }
@keyframes lowhp { 0%,100% { filter: brightness(1); } 50% { filter: brightness(1.6) saturate(.4); } }
.foe-name { position: absolute; bottom: -20px; left: 50%; transform: translateX(-50%); white-space: nowrap; font-family: var(--kai); font-size: 13px; font-weight: 700; color: var(--ink2); }
#foe.elite .foe-name { color: var(--yang); }
#foe.boss .foe-name { color: var(--seal); font-size: 15px; }

.token { position: relative; width: 112px; height: 112px; }
.token::after { content: ""; position: absolute; left: 10%; right: 10%; bottom: 1%; height: 9px; border-radius: 50%; background: radial-gradient(ellipse, rgba(31,26,23,.32), transparent 70%); z-index: -1; }
.sprite { width: 100%; height: 100%; overflow: visible; display: block; }
.sprite .bob { animation: bob 2.4s ease-in-out infinite; transform-box: fill-box; transform-origin: center bottom; }
.sprite .float { animation: floaty 3s ease-in-out infinite; }
.sprite .flap { animation: flap .9s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
#foe .arm-l { transform-box: fill-box; transform-origin: 100% 50%; transition: transform .12s; }
#foe.atk .arm-l { transform: rotate(30deg); }
#foe.dead .token { filter: blur(3px); opacity: 0; transition: filter .3s, opacity .3s; }
#foe.hit .token, #hero.hit .token { animation: shake .18s; }
#foe.boss .token { width: 140px; height: 140px; }
#foe.boss .hpbar { width: 140px; height: 15px; }
#foe.elite .hpbar { width: 116px; }
.badge { position: absolute; top: 4px; right: 4px; width: 24px; height: 24px; border-radius: 4px; background: var(--seal); color: #fff; font-family: var(--kai); font-size: 16px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; transform: rotate(4deg); box-shadow: inset 0 0 0 1.5px rgba(255,255,255,.3); }
#foe.boss .badge { width: 30px; height: 30px; font-size: 20px; }

/* 主角動作圖 */
#hero .token { --H: 138px; width: 62px; height: var(--H); }
.pose { position: absolute; bottom: 0; width: auto; opacity: 0; pointer-events: none; }
.pose-idle { opacity: 1; transform-origin: 50% 100%; animation: breathe 2.6s ease-in-out infinite; }
@keyframes breathe { 0%,100% { transform: scale(1, 1); } 50% { transform: scale(1.012, 1.022) translateY(-1px); } }
#hero.hit .pose { opacity: 0; }  #hero.hit .pose-hurt { opacity: 1; }
#hero.atk .pose { opacity: 0; }  #hero.atk .pose-slash { opacity: 1; }
#hero.cast .pose { opacity: 0; } #hero.cast .pose-cast { opacity: 1; filter: drop-shadow(0 0 8px rgba(233,185,73,.8)); }
#hero.ult .pose { opacity: 0; }  #hero.ult .pose-fly { opacity: 1; animation: ultFly 1.1s ease-out; }
#hero.dead .pose { opacity: 0; } #hero.dead .pose-down { opacity: 1; }
@keyframes ultFly { 0% { transform: translate(-10px, 0); } 30% { transform: translate(30px, -26px); } 70% { transform: translate(60px, -20px); } 100% { transform: translate(0, 0); } }
#hero.shielded .token::before { content: ""; position: absolute; left: -30%; right: -30%; top: -6%; bottom: -4%; border-radius: 50%;
  background: radial-gradient(ellipse, transparent 55%, rgba(127,179,191,.45) 70%, transparent 75%); animation: aura 2s ease-in-out infinite; z-index: 2; pointer-events: none; }
/* 敵人圖 */
#foe .token { --H: 138px; }
#foe .token.pic { width: auto; height: auto; min-width: 70px; display: flex; justify-content: center; align-items: flex-end; }
.foe-pic { position: relative; flex: none; }
.foe-pic img { display: block; width: 100%; height: 100%; pointer-events: none; transform-origin: 50% 100%; animation: breathe 2.2s ease-in-out infinite; }
.foe-pic.float img { animation: floaty 3s ease-in-out infinite; }
.foe-aura { position: absolute; left: -20%; right: -20%; top: 10%; bottom: -6%; border-radius: 50%; z-index: -1;
  background: radial-gradient(ellipse, rgba(184,49,47,.32), rgba(31,26,23,.18) 45%, transparent 70%); filter: blur(4px); }
#foe .token.pic .badge { top: 0; right: -6px; }
.foe-pic img.atk { position: absolute; bottom: 0; max-width: none; opacity: 0; animation: none; }
#foe.atk .foe-pic.has-atk img.idle { opacity: 0; }
#foe.atk .foe-pic.has-atk img.atk { opacity: 1; }
#foe.elite .token { filter: drop-shadow(0 0 6px rgba(192,138,30,.75)); }
@media (max-height: 700px) { #hero .token, #foe .token { --H: 118px; } #hero .token { width: 54px; } #scene { min-height: 220px; } }

/* 特效 */
#fx { position: absolute; inset: 0; pointer-events: none; z-index: 5; }
.dmg { position: absolute; font-family: var(--kai); font-weight: 800; font-size: 19px; color: var(--ink); animation: rise .8s ease-out forwards; white-space: nowrap;
  text-shadow: 0 0 3px var(--paper), 0 0 3px var(--paper), 0 0 3px var(--paper); }
.dmg.crit { color: var(--seal); font-size: 28px; animation: critPop .9s ease-out forwards; }
.dmg.crit::before { content: "暴擊 "; font-size: 13px; vertical-align: 5px; }
.dmg.heal { color: var(--rou); font-size: 16px; }
.dmg.hurt { color: #7a2222; font-size: 17px; }
.dmg.gold { color: #8a6410; font-size: 15px; }
.dmg.tag { color: var(--yang); font-size: 16px; }
.dmg.gang { color: var(--gang); } .dmg.yin { color: var(--yin); } .dmg.yang { color: var(--yang); } .dmg.ult { color: var(--seal); font-size: 40px; }
@keyframes rise { from { opacity: 1; transform: translateY(0); } to { opacity: 0; transform: translateY(-46px); } }
@keyframes critPop { 0% { opacity: 1; transform: scale(1.6); } 20% { transform: scale(1); } 100% { opacity: 0; transform: translateY(-50px); } }
.slashwrap { position: absolute; width: 100px; height: 100px; pointer-events: none; }
.slash { width: 100%; height: 100%; overflow: visible; }
.slash.big { transform: scale(1.5); }
.slash path { stroke-dasharray: 100; stroke-dashoffset: 100; animation: draw .32s ease-out forwards, fadeout .5s .25s forwards; opacity: .85; }
.bolt { position: absolute; width: 40px; top: 0; pointer-events: none; animation: fadeout .35s .1s forwards; }
.bolt path { stroke: #f6e2a6; stroke-width: 3; fill: none; filter: drop-shadow(0 0 6px #e9b949) drop-shadow(0 0 2px var(--gang)); }
.coin { position: absolute; width: 16px; height: 12px; pointer-events: none; transition: transform .55s cubic-bezier(.5,-0.3,.7,.5), opacity .55s; }
#banner { position: absolute; top: 24%; left: 50%; transform: translateX(-50%); font-family: var(--kai); font-size: 34px; font-weight: 900; letter-spacing: 6px; white-space: nowrap;
  opacity: 0; pointer-events: none; z-index: 6; text-shadow: 0 0 8px var(--paper), 0 0 4px var(--paper); }
#banner small { display: block; text-align: center; font-size: 15px; letter-spacing: 2px; color: var(--ink2); }
#banner.show { animation: banner 1.3s ease-out; }
@keyframes banner { 0% { opacity: 0; transform: translateX(-50%) scale(1.4); } 18% { opacity: 1; transform: translateX(-50%) scale(1); } 75% { opacity: 1; } 100% { opacity: 0; } }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes fadeout { to { opacity: 0; } }
@keyframes pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.08); } }
@keyframes shake { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
@keyframes bob { 0%,100% { transform: translateY(0) scaleY(1); } 50% { transform: translateY(-1.5px) scaleY(1.015); } }
@keyframes floaty { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
@keyframes flap { 0%,100% { transform: scaleY(1); } 50% { transform: scaleY(.82) translateY(-3px); } }
@keyframes bump { 0% { transform: scale(1); } 40% { transform: scale(1.25); color: var(--gold); } 100% { transform: scale(1); } }
@keyframes appIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* 神通 */
#ultBtn { position: absolute; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom, 0px)); margin-left: -44px; width: 88px; height: 88px; border-radius: 50%; border: none; z-index: 6; cursor: pointer;
  background: conic-gradient(var(--seal) var(--p, 0%), rgba(31,26,23,.18) 0); padding: 4px; }
#ultBtn span { display: flex; width: 100%; height: 100%; border-radius: 50%; align-items: center; justify-content: center; background: var(--paper); font-family: var(--kai); font-size: 22px; font-weight: 700; color: var(--mute); }
#ultBtn.full span { background: var(--seal); color: #fff; }
#ultBtn.full { animation: pulse 1s ease-in-out infinite; box-shadow: 0 0 16px rgba(184,49,47,.7); }
#ultFx { position: absolute; inset: 0; pointer-events: none; display: flex; flex-direction: column; align-items: center; justify-content: center; opacity: 0; z-index: 7; }
#ultFx.show { animation: ultIn 1.2s ease-out forwards; }
.ult-word { font-family: var(--kai); font-size: 68px; font-weight: 900; color: var(--seal); line-height: 1; text-shadow: 3px 3px 0 var(--ink), 0 0 18px rgba(243,236,223,.9); letter-spacing: 6px; }
.ult-name { font-family: var(--kai); font-size: 20px; font-weight: 700; color: var(--paper); background: var(--ink); padding: 2px 16px; margin-top: 6px; }
@keyframes ultIn { 0% { opacity: 0; transform: scale(1.8); } 15% { opacity: 1; transform: scale(1); } 75% { opacity: 1; } 100% { opacity: 0; transform: scale(.96); } }

/* 經驗、靈石 */
#xpRow { display: flex; align-items: center; gap: 8px; padding: 8px 12px 4px; flex: none; }
#runLv { font-family: var(--kai); font-size: 18px; width: 52px; flex: none; }
#runLv.up { animation: bump .5s ease-out; color: var(--seal); }
.xpbar { flex: 1; height: 10px; background: #e0d5c2; border-radius: 5px; overflow: hidden; }
.xpbar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #e2c06a, var(--gold)); transition: width .25s; }
.run-gold { font-family: var(--kai); font-size: 16px; flex: none; min-width: 70px; text-align: right; }
.run-gold b.bump { display: inline-block; animation: bump .35s ease-out; }
#deckTitle { font-family: var(--kai); font-size: 15px; font-weight: 700; padding: 6px 12px 2px; flex: none; }
#deckTitle small { font-family: var(--sans); font-size: 11px; color: var(--mute); font-weight: 400; margin-left: 6px; }
#deck { flex: 1; min-height: 0; overflow-y: auto; padding: 4px 12px 120px; display: grid; grid-template-columns: repeat(auto-fill, minmax(70px, 1fr)); gap: 6px; align-content: start; }
#deck .empty { grid-column: 1 / -1; font-size: 12px; color: var(--mute); padding: 6px 2px; }
.chip { position: relative; height: 48px; border: none; cursor: pointer; color: #fff; font-family: var(--kai); font-size: 15px; font-weight: 700; line-height: 1.1;
  -webkit-mask: var(--blot) center / 100% 100% no-repeat; mask: var(--blot) center / 100% 100% no-repeat; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.chip small { font-family: var(--sans); font-size: 10px; font-weight: 700; opacity: .9; margin-top: 2px; }
.chip.new { animation: chipIn .5s ease-out; }
@keyframes chipIn { 0% { transform: scale(1.5); filter: brightness(2); } 100% { transform: none; filter: none; } }

/* ================= 升級揀卡 ================= */
#pick { position: absolute; inset: 0; z-index: 20; background: rgba(31,26,23,.78); display: flex; flex-direction: column; justify-content: center; gap: 12px; padding: 18px; animation: fadeIn .2s; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.pick-head { text-align: center; color: var(--paper); font-family: var(--kai); }
.pick-head b { font-size: 40px; color: #f2c57c; letter-spacing: 6px; display: block; text-shadow: 0 0 16px rgba(242,197,124,.6); animation: critPop2 .5s ease-out; }
@keyframes critPop2 { 0% { transform: scale(1.8); opacity: 0; } 100% { transform: none; opacity: 1; } }
.pick-head span { font-size: 16px; margin-right: 8px; }
.pick-head small { font-size: 14px; opacity: .8; }
#pickCards { display: flex; flex-direction: column; gap: 10px; }
.pcard { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: none; cursor: pointer; text-align: left; background: var(--paper); border-radius: 6px; position: relative;
  box-shadow: inset 5px 0 0 var(--c, var(--ink)), 0 4px 12px rgba(0,0,0,.3); opacity: 0; animation: cardIn .35s ease-out forwards; transition: transform .1s; }
.pcard:nth-child(2) { animation-delay: .08s; } .pcard:nth-child(3) { animation-delay: .16s; }
@keyframes cardIn { from { opacity: 0; transform: translateX(40px); } to { opacity: 1; transform: none; } }
.pcard:active { transform: scale(.97); }
.pcard .glyph { width: 52px; height: 52px; font-size: 28px; background: var(--c, var(--ink)); }
.pcard .name { font-size: 20px; }
.pcard .lvtag { font-family: var(--sans); font-size: 11px; font-weight: 700; color: #fff; background: var(--c, var(--ink)); padding: 1px 6px; border-radius: 8px; margin-left: 6px; vertical-align: 2px; }
.pcard .lvtag.new { background: var(--seal); }
.pcard .desc { font-size: 13px; }
.pcard .desc s { color: var(--mute); }
.pcard.evo { background: linear-gradient(135deg, #fff6dc, #f3e2b0); box-shadow: inset 5px 0 0 var(--gold), 0 0 22px rgba(233,185,73,.8); }
.pcard.evo::after { content: "神功"; position: absolute; top: -8px; right: 10px; background: var(--gold); color: #fff; font-family: var(--kai); font-weight: 700; font-size: 13px; padding: 1px 8px; border-radius: 8px; }
.pcard.chosen { animation: chosen .35s ease-in forwards !important; }
@keyframes chosen { 0% { transform: scale(1); opacity: 1; } 40% { transform: scale(1.06); filter: brightness(1.2); } 100% { transform: scale(.6) translateY(120px); opacity: 0; } }
#rerollBtn { align-self: center; color: var(--paper); box-shadow: inset 0 0 0 1.5px var(--paper); padding: 8px 22px; }
#rerollBtn:disabled { opacity: .35; }

/* ================= 提示、彈窗 ================= */
#toasts { position: fixed; bottom: calc(70px + env(safe-area-inset-bottom, 0px)); left: 50%; transform: translateX(-50%); display: flex; flex-direction: column-reverse; gap: 6px; z-index: 40; width: min(92vw, 420px); pointer-events: none; align-items: center; }
.toast { background: rgba(31,26,23,.93); color: var(--paper); padding: 9px 20px; font-size: 13px; animation: appIn .3s ease-out; text-align: center;
  -webkit-mask: var(--blot) center / 100% 100% no-repeat; mask: var(--blot) center / 100% 100% no-repeat; }
.toast b { color: #f2c57c; }
.toast.out { opacity: 0; transition: opacity .4s; }
#modal { position: fixed; inset: 0; background: rgba(31,26,23,.55); display: flex; align-items: center; justify-content: center; z-index: 30; }
.modal-frame { position: relative; animation: unroll .35s ease-out; }
.modal-frame::before, .modal-frame::after { content: ""; position: absolute; left: -12px; right: -12px; height: 12px; border-radius: 6px; z-index: 2;
  background: linear-gradient(#6b4a2e, #3a2617 60%, #24170d); box-shadow: 0 2px 4px rgba(0,0,0,.35); }
.modal-frame::before { top: -6px; } .modal-frame::after { bottom: -6px; }
@keyframes unroll { from { transform: scaleY(.05); opacity: .4; } to { transform: scaleY(1); opacity: 1; } }
.modal-box { width: min(88vw, 360px); max-height: 86vh; overflow-y: auto; padding: 26px 22px; text-align: center;
  background: linear-gradient(90deg, #e9dfcc, var(--paper) 6%, var(--paper) 94%, #e9dfcc); box-shadow: 0 10px 30px rgba(0,0,0,.35); }
.modal-box h2 { font-family: var(--kai); font-size: 26px; margin-bottom: 8px; }
.modal-box p { font-size: 14px; line-height: 1.7; color: var(--ink2); }
#modalBtns { display: flex; gap: 8px; justify-content: center; margin-top: 16px; flex-wrap: wrap; }
#modalBtns .btn { min-width: 116px; padding: 11px 20px; font-size: 14px; }
#modalBtns.choices { flex-direction: column; align-items: stretch; }
.choice { border: 1.5px solid var(--ink); background: transparent; border-radius: 8px; padding: 10px 12px; cursor: pointer; font-family: var(--kai); font-size: 17px; font-weight: 700; text-align: left; }
.choice:hover, .choice:active { background: var(--ink); color: var(--paper); }
.choice small { display: block; font-family: var(--sans); font-size: 12px; font-weight: 400; opacity: .75; margin-top: 2px; }
.ev-glyph { width: 64px; height: 64px; margin: 0 auto 10px; background: var(--ink); color: var(--paper); font-family: var(--kai); font-size: 36px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; -webkit-mask: var(--blot) center / 100% 100% no-repeat; mask: var(--blot) center / 100% 100% no-repeat; }
.ev-text { text-align: left; }
.result-big { font-family: var(--kai); font-size: 44px; font-weight: 900; letter-spacing: 8px; color: var(--seal); line-height: 1.1; animation: critPop2 .5s ease-out; }
.result-big.lose { color: var(--ink2); }
.result-rows { margin: 12px 0 4px; display: flex; flex-direction: column; gap: 4px; text-align: left; }
.result-rows div { display: flex; justify-content: space-between; font-size: 14px; padding: 5px 10px; background: rgba(255,255,255,.4); border-radius: 4px; }
.result-rows b { font-family: var(--kai); font-size: 17px; }
.result-rows .hl { box-shadow: inset 3px 0 0 var(--seal); }
.newbest { display: inline-block; margin-top: 6px; color: #fff; background: var(--seal); font-family: var(--kai); font-weight: 700; padding: 2px 12px; border-radius: 10px; font-size: 14px; animation: pulse 1s ease-in-out infinite; }
.phone { width: 230px; margin: 4px auto 0; border: 3px solid var(--ink); border-radius: 22px; padding: 10px 10px 16px; background: #1f1a17; text-align: left; }
.phone-bar { text-align: center; font-family: var(--kai); font-size: 13px; color: #f2c57c; letter-spacing: 4px; margin-bottom: 8px; }
.app-msg { background: rgba(243,236,223,.95); color: var(--ink); border-radius: 10px; padding: 7px 10px; font-size: 13px; line-height: 1.5; margin-top: 6px; opacity: 0; animation: appIn .4s ease-out forwards; }
.app-msg b { color: var(--seal); }
.story-dots { display: flex; gap: 5px; justify-content: center; margin-top: 10px; }
.story-dots i { width: 6px; height: 6px; border-radius: 50%; background: #c9bda9; }
.story-dots i.on { background: var(--seal); }
#foe.dead { opacity: 0; transition: opacity .3s .15s, transform .12s; }
body.in-run #toasts { bottom: calc(118px + env(safe-area-inset-bottom, 0px)); }

/* ================= 第一批：法寶、每日、簽到、無盡、共鳴 ================= */
.endless-btn { margin: -2px 16px 0; padding: 7px 12px; border: none; border-radius: 10px; background: rgba(31,26,23,.92); color: var(--paper); cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 1px; }
.endless-btn b { font-family: var(--kai); font-size: 18px; letter-spacing: 3px; color: #f2c57c; }
.endless-btn small { font-size: 11px; opacity: .85; }
.endless-btn small em { font-style: normal; color: #f2c57c; font-weight: 700; }
.endless-btn.locked { background: transparent; color: var(--mute); box-shadow: inset 0 0 0 1.5px #c9bda9; }
.endless-btn.locked b { color: var(--mute); }

#homeTiles { margin: 0 16px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.tile { position: relative; border: none; cursor: pointer; background: rgba(255,255,255,.42); box-shadow: inset 0 0 0 1.5px rgba(31,26,23,.22); border-radius: 8px;
  padding: 8px 4px 7px; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.tile i { font-style: normal; width: 32px; height: 30px; display: flex; align-items: center; justify-content: center; background: var(--ink); color: var(--paper);
  font-family: var(--kai); font-size: 17px; font-weight: 700; -webkit-mask: var(--blot) center / 100% 100% no-repeat; mask: var(--blot) center / 100% 100% no-repeat; }
#signBtn i { background: var(--seal); }
#chestBtn i { background: linear-gradient(#d8a73a, #a67a12); }
.tile.done i { background: var(--rou); }
.tile b { font-family: var(--kai); font-size: 14px; }
.tile small { font-size: 11px; color: var(--mute); }
.tile.dot::after { content: ""; position: absolute; top: 6px; right: 8px; width: 9px; height: 9px; border-radius: 50%; background: var(--seal);
  box-shadow: 0 0 0 2px var(--paper); animation: pulse 1.2s ease-in-out infinite; }

/* 法寶頁 */
.gear-slots { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.gslot { position: relative; border: none; cursor: pointer; background: rgba(255,255,255,.5); border-radius: 8px; padding: 8px 4px 7px;
  display: flex; flex-direction: column; align-items: center; gap: 3px; box-shadow: inset 0 0 0 2px var(--rc, #c9bda9); }
.gslot > span { font-size: 11px; color: var(--mute); }
.gicon { font-style: normal; width: 46px; height: 44px; display: flex; align-items: center; justify-content: center; background: var(--rc, #b3a793); color: #fff;
  font-family: var(--kai); font-size: 25px; font-weight: 700; -webkit-mask: var(--blot) center / 100% 100% no-repeat; mask: var(--blot) center / 100% 100% no-repeat; }
.gslot b { font-family: var(--kai); font-size: 14px; white-space: nowrap; }
.gslot small { font-size: 11px; color: var(--rc, var(--mute)); font-weight: 700; }
.gslot small em { font-style: normal; color: var(--seal); }
.gslot.empty { box-shadow: inset 0 0 0 1.5px #c9bda9; }
.gslot.empty .gicon { background: #d8ccb6; }
.chest-row { display: flex; align-items: center; gap: 8px; padding: 10px; background: rgba(255,255,255,.42); border-radius: 6px; box-shadow: inset 3px 0 0 var(--gold); }
.chest-ico { font-style: normal; width: 44px; height: 42px; flex: none; display: flex; align-items: center; justify-content: center; background: linear-gradient(#d8a73a, #a67a12);
  color: #fff; font-family: var(--kai); font-size: 24px; font-weight: 700; -webkit-mask: var(--blot) center / 100% 100% no-repeat; mask: var(--blot) center / 100% 100% no-repeat; }
.chest-row .info b { font-family: var(--kai); font-size: 17px; }
.chest-row .info small { display: block; font-size: 11px; color: var(--mute); line-height: 1.4; }
.chest-row .btn { min-width: 62px; padding: 8px 6px; }
.btn.wide { width: 100%; padding: 10px; font-size: 14px; }
.bag-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 8px; }
.gtile { position: relative; border: none; cursor: pointer; background: rgba(255,255,255,.5); border-radius: 6px; padding: 6px 2px 5px;
  display: flex; flex-direction: column; align-items: center; gap: 1px; box-shadow: inset 0 0 0 1.5px var(--rc); }
.gtile i { font-style: normal; width: 34px; height: 32px; display: flex; align-items: center; justify-content: center; background: var(--rc); color: #fff;
  font-family: var(--kai); font-size: 19px; font-weight: 700; -webkit-mask: var(--blot) center / 100% 100% no-repeat; mask: var(--blot) center / 100% 100% no-repeat; }
.gtile span { font-family: var(--kai); font-size: 12px; font-weight: 700; white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.gtile small { font-size: 10px; color: var(--rc); font-weight: 700; }
.gtile em { position: absolute; top: -7px; right: -4px; font-style: normal; font-size: 10px; background: var(--seal); color: #fff; padding: 0 5px; border-radius: 6px; }
.item-big { width: 76px; height: 72px; margin: 0 auto 8px; filter: drop-shadow(0 0 10px var(--rc)); }
.item-big i { font-style: normal; width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; background: var(--rc); color: #fff;
  font-family: var(--kai); font-size: 40px; font-weight: 700; -webkit-mask: var(--blot) center / 100% 100% no-repeat; mask: var(--blot) center / 100% 100% no-repeat; }
.rar-tag { display: inline-block; font-size: 12px; font-weight: 700; color: #fff; background: var(--rc); padding: 2px 10px; border-radius: 10px; margin-bottom: 4px; }
p.small, .modal-box p.small { font-size: 12px; color: var(--mute); margin-top: 8px; line-height: 1.6; }
.result-rows div.gold { box-shadow: inset 3px 0 0 var(--gold); }
.result-rows div.gold b { color: #a67a12; }

/* 開寶箱 */
.chest-anim { width: 92px; height: 88px; margin: 10px auto 12px; display: flex; align-items: center; justify-content: center; background: linear-gradient(#e2b54a, #a67a12);
  color: #fff; font-family: var(--kai); font-size: 48px; font-weight: 900; -webkit-mask: var(--blot) center / 100% 100% no-repeat; mask: var(--blot) center / 100% 100% no-repeat;
  animation: chestShake .75s ease-in forwards; }
@keyframes chestShake { 0% { transform: scale(.8); } 20% { transform: scale(1) rotate(-8deg); } 40% { transform: rotate(8deg); } 60% { transform: rotate(-10deg) scale(1.05); }
  80% { transform: rotate(10deg) scale(1.12); filter: brightness(1.4); } 100% { transform: scale(1.35); filter: brightness(2.2); } }
.loot { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 12px 0 4px; }
.loot-it { width: 86px; padding: 8px 4px; border-radius: 8px; background: rgba(255,255,255,.6); box-shadow: inset 0 0 0 2px var(--rc);
  display: flex; flex-direction: column; align-items: center; gap: 2px; opacity: 0; animation: lootPop .45s ease-out forwards; }
.loot-it i { font-style: normal; width: 42px; height: 40px; display: flex; align-items: center; justify-content: center; background: var(--rc); color: #fff;
  font-family: var(--kai); font-size: 23px; font-weight: 700; -webkit-mask: var(--blot) center / 100% 100% no-repeat; mask: var(--blot) center / 100% 100% no-repeat; }
.loot-it b { font-family: var(--kai); font-size: 13px; white-space: nowrap; }
.loot-it small { font-size: 10px; color: var(--rc); font-weight: 700; }
.loot-it.r2, .loot-it.r3 { box-shadow: inset 0 0 0 2px var(--rc), 0 0 16px var(--rc); }
@keyframes lootPop { 0% { opacity: 0; transform: scale(.4) translateY(20px); } 70% { opacity: 1; transform: scale(1.12); } 100% { opacity: 1; transform: none; } }

/* 每日任務 */
.tasks { display: flex; flex-direction: column; gap: 6px; text-align: left; margin-top: 8px; }
.task { display: flex; align-items: center; gap: 8px; padding: 8px 10px; background: rgba(255,255,255,.45); border-radius: 6px; }
.task.got { opacity: .55; }
.task.all { box-shadow: inset 3px 0 0 var(--gold); }
.t-info { flex: 1; min-width: 0; }
.t-info b { font-family: var(--kai); font-size: 15px; }
.t-info small { display: block; font-size: 11px; color: var(--mute); }
.t-info .bar { height: 6px; margin: 4px 0 0; }
.task .btn { min-width: 72px; padding: 7px 6px; font-size: 12px; }
.t-done { font-size: 12px; color: var(--mute); font-weight: 700; min-width: 72px; text-align: center; }

/* 七日簽到 */
.sign-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 10px 0; }
.sday { position: relative; padding: 6px 2px; border-radius: 6px; background: rgba(255,255,255,.45); display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 2px; min-height: 64px; }
.sday small { font-size: 10px; color: var(--mute); }
.sday b { font-family: var(--kai); font-size: 13px; line-height: 1.25; }
.sday.big { grid-column: span 2; background: linear-gradient(135deg, #fff6dc, #f3e2b0); box-shadow: inset 0 0 0 1.5px var(--gold); }
.sday.got { opacity: .45; }
.sday.got::after { content: "\2713"; position: absolute; top: 2px; right: 6px; color: var(--seal); font-weight: 900; }
.sday.today { box-shadow: inset 0 0 0 2px var(--seal); animation: pulse 1.2s ease-in-out infinite; }
.big-claim { width: 100%; padding: 12px; font-size: 16px; margin-top: 4px; }

/* 共鳴、一局寶箱 */
#resRow { display: flex; flex-wrap: wrap; gap: 4px; padding: 2px 12px 4px; flex: none; }
.res-tag { font-size: 11px; color: var(--ink2); background: rgba(255,255,255,.5); border-radius: 10px; padding: 2px 8px; box-shadow: inset 0 0 0 1.5px var(--c); }
.res-tag b { color: var(--c); font-family: var(--kai); font-size: 13px; margin-right: 4px; }
.res-tag.t2 { background: var(--c); color: #fff; }
.res-tag.t2 b { color: #fff; }
.res-hint { font-size: 11px; color: var(--mute); margin-top: 3px; }
.res-hint.on { color: var(--seal); font-weight: 700; }
.run-chest { font-family: var(--kai); font-size: 14px; color: #8a6410; background: #f3e2b0; padding: 1px 8px; border-radius: 10px; flex: none; }
.run-chest.bump { animation: bump .4s ease-out; }
.dmg.chestp { color: #a67a12; font-size: 21px; }
#floorBar.endless i { font-size: 9px; }

/* ================= 第二批：靈寵、心魔、商店、成就 ================= */
#homeTiles { grid-template-columns: repeat(4, 1fr); gap: 6px; }
.tile { padding: 8px 2px 7px; }
.tile b { font-size: 13px; }
#achBtn i { background: var(--yin); }
.tab { font-size: 17px; }
.card .col { display: flex; flex-direction: column; gap: 4px; align-items: stretch; flex: none; }
.card .col .btn { min-width: 70px; padding: 6px 8px; }

/* 戰鬥中嘅靈寵：企喺主角前面，向右 */
#pet { left: 35%; bottom: 13%; z-index: 1; }
#pet .token { --H: 78px; width: auto; height: auto; min-width: 44px; display: flex; align-items: flex-end; justify-content: center; }
#pet .token::after { left: 0; right: 0; }
.pet-mirror { transform: scaleX(-1); display: flex; align-items: flex-end; justify-content: center; }
#pet .badge, .pet-art .badge { display: none; }
#pet .sprite { width: 62px; height: 62px; }
#pet.atk { transform: translateX(28px); }
#scene.walking #pet .token { animation: walkBob .3s ease-in-out infinite; }

/* 靈寵頁 */
.pet-art { --H: 60px; flex: none; min-width: calc(var(--H) * .8); height: calc(var(--H) * 1.05); display: flex; align-items: flex-end; justify-content: center; }
.pet-art .sprite { width: var(--H); height: var(--H); }
.pet-art .foe-pic img { animation-duration: 2.6s; }
.pet-main { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 8px; background: linear-gradient(135deg, rgba(255,255,255,.6), rgba(233,223,204,.6));
  box-shadow: inset 0 0 0 2px var(--seal); }
.pet-main .name { font-size: 20px; }
.card.active-pet { box-shadow: inset 3px 0 0 var(--seal), 0 0 0 1.5px rgba(184,49,47,.35); }
.card.locked-pet { opacity: .55; }
.pet-tame { display: flex; justify-content: center; margin-bottom: 4px; filter: drop-shadow(0 0 12px rgba(242,197,124,.9)); animation: lootPop .5s ease-out; }

/* 心魔功法 */
#pick.demon { background: rgba(30,8,12,.86); }
#pick.demon .pick-head b { color: #ff8a80; text-shadow: 0 0 18px rgba(255,80,80,.7); }
.pcard.demon { background: linear-gradient(135deg, #2a1418, #46202a); color: #f6e4e4; box-shadow: inset 5px 0 0 #d04a4a, 0 0 18px rgba(208,74,74,.45); }
.pcard.demon .glyph { background: #b8312f; }
.pcard.demon .desc { color: #edd2d2; }
.pcard.demon .lvtag { background: #b8312f; }
#skipBtn { align-self: center; color: var(--paper); box-shadow: inset 0 0 0 1.5px rgba(243,236,223,.6); padding: 7px 20px; font-size: 13px; }

/* 裂隙商店 */
#shop { position: absolute; inset: 0; z-index: 15; background: rgba(31,26,23,.72); display: flex; align-items: center; justify-content: center; padding: 16px; animation: fadeIn .2s; }
.shop-box { width: 100%; max-width: 380px; background: linear-gradient(90deg, #e9dfcc, var(--paper) 6%, var(--paper) 94%, #e9dfcc); border-radius: 6px; padding: 16px;
  box-shadow: 0 10px 30px rgba(0,0,0,.4); display: flex; flex-direction: column; gap: 10px; animation: unroll .3s ease-out; }
.shop-head { display: flex; align-items: center; gap: 10px; }
.shop-head i { font-style: normal; width: 46px; height: 44px; flex: none; display: flex; align-items: center; justify-content: center; background: var(--seal); color: #fff;
  font-family: var(--kai); font-size: 26px; font-weight: 700; -webkit-mask: var(--blot) center / 100% 100% no-repeat; mask: var(--blot) center / 100% 100% no-repeat; }
.shop-head b { font-family: var(--kai); font-size: 22px; display: block; }
.shop-head small { font-size: 11px; color: var(--mute); }
.shop-gold { font-family: var(--kai); font-size: 15px; text-align: right; }
.shop-gold b { font-size: 20px; color: #8a6410; }
#shopItems { display: flex; flex-direction: column; gap: 6px; }
.sitem { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: none; cursor: pointer; border-radius: 6px; background: rgba(255,255,255,.55);
  box-shadow: inset 0 0 0 1.5px rgba(31,26,23,.25); text-align: left; }
.sitem:active { transform: scale(.98); }
.sitem i { font-style: normal; width: 38px; height: 36px; flex: none; display: flex; align-items: center; justify-content: center; background: var(--ink); color: var(--paper);
  font-family: var(--kai); font-size: 20px; font-weight: 700; -webkit-mask: var(--blot) center / 100% 100% no-repeat; mask: var(--blot) center / 100% 100% no-repeat; }
.sitem span { flex: 1; min-width: 0; }
.sitem b { font-family: var(--kai); font-size: 16px; display: block; }
.sitem small { font-size: 11px; color: var(--mute); }
.sitem em { font-style: normal; font-family: var(--kai); font-weight: 700; font-size: 16px; color: #8a6410; background: #f3e2b0; padding: 3px 10px; border-radius: 12px; }
.sitem.cant { opacity: .45; }
#shopLeave { padding: 11px; font-size: 15px; }
#floorBar i.sh { color: #8a6410; }
#floorBar i.done.sh { color: var(--paper); }
.dmg.pet { color: #2f6f5e; font-size: 16px; }

/* ================= 第三批：商城、仙玉、廣告、外觀 ================= */
#mallBtn { position: relative; width: 38px; height: 38px; flex: none; border-radius: 50%; border: none; background: var(--seal); color: #fff;
  font-family: var(--kai); font-size: 18px; font-weight: 700; cursor: pointer; box-shadow: inset 0 0 0 2px rgba(255,255,255,.3); }
#mallBtn.dot::after { content: ""; position: absolute; top: -1px; right: -1px; width: 10px; height: 10px; border-radius: 50%; background: #f2c57c; box-shadow: 0 0 0 2px var(--paper); }
.jade-n { color: #3f7f8c; }
.idle-btns { display: flex; flex-direction: column; gap: 4px; }
.idle-btns .btn { min-width: 86px; }
#collect2Btn { padding: 4px 10px; display: flex; flex-direction: column; align-items: center; }
#collect2Btn span { font-size: 14px; }
#collect2Btn small { font-size: 10px; }

/* 主角外觀 */
#hero .pose, #homeHero .pose { filter: var(--skin-filter, brightness(1)); }
#hero.cast .pose-cast { filter: var(--skin-filter, brightness(1)) drop-shadow(0 0 8px rgba(233,185,73,.8)); }
#homeHero .token::before { background: radial-gradient(ellipse, var(--skin-aura, rgba(246,226,166,.55)), transparent 65%); }

/* 商城 */
.jade-bar { font-family: var(--kai); font-size: 16px; margin-top: -2px; }
.jade-bar b { font-size: 24px; color: #3f7f8c; margin: 0 4px; }
.jade-bar small { display: block; font-family: var(--sans); font-size: 11px; color: var(--mute); }
.test-note { color: var(--seal) !important; font-weight: 700; }
.mall-sec { font-family: var(--kai); font-size: 17px; font-weight: 700; text-align: left; margin: 14px 2px 6px; display: flex; justify-content: space-between; align-items: baseline; }
.mall-sec small { font-family: var(--sans); font-size: 11px; color: var(--mute); font-weight: 400; }
.mall-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; margin-bottom: 6px; border-radius: 6px; background: rgba(255,255,255,.5); text-align: left; }
.mall-item > i { font-style: normal; width: 38px; height: 36px; flex: none; display: flex; align-items: center; justify-content: center; background: var(--ink); color: var(--paper);
  font-family: var(--kai); font-size: 20px; font-weight: 700; -webkit-mask: var(--blot) center / 100% 100% no-repeat; mask: var(--blot) center / 100% 100% no-repeat; }
.mall-item > span { flex: 1; min-width: 0; }
.mall-item b { font-family: var(--kai); font-size: 16px; }
.mall-item small { display: block; font-size: 11px; color: var(--ink2); line-height: 1.45; }
.mall-item small em { font-style: normal; color: var(--seal); font-weight: 700; }
.mall-item em.tag { font-style: normal; font-size: 10px; color: #fff; background: var(--seal); padding: 0 5px; border-radius: 6px; margin-left: 4px; vertical-align: 2px; }
.mall-item .btn { min-width: 72px; padding: 8px 8px; font-size: 13px; }
.mall-item.owned { opacity: .6; }
.mall-btns { display: flex; flex-direction: column; gap: 4px; flex: none !important; }
.jade-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.jade-pack { position: relative; border: none; cursor: pointer; border-radius: 8px; padding: 10px 6px 8px; background: linear-gradient(160deg, #eef6f5, #d7e8e6);
  box-shadow: inset 0 0 0 1.5px rgba(63,127,140,.5); display: flex; flex-direction: column; align-items: center; gap: 2px; }
.jade-pack i { font-style: normal; width: 34px; height: 32px; display: flex; align-items: center; justify-content: center; background: #3f7f8c; color: #fff;
  font-family: var(--kai); font-size: 19px; font-weight: 700; -webkit-mask: var(--blot) center / 100% 100% no-repeat; mask: var(--blot) center / 100% 100% no-repeat; }
.jade-pack b { font-family: var(--kai); font-size: 18px; color: #2c5f6a; }
.jade-pack small { font-size: 11px; color: var(--mute); }
.jade-pack span { font-size: 13px; font-weight: 700; color: #fff; background: linear-gradient(#d8a73a, #a67a12); border-radius: 10px; padding: 1px 10px; margin-top: 2px; }
.jade-pack em { position: absolute; top: -7px; right: -4px; font-style: normal; font-size: 10px; color: #fff; background: var(--seal); padding: 1px 6px; border-radius: 8px; }
.skin-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.skin { border: none; cursor: pointer; border-radius: 8px; padding: 6px 2px 6px; background: rgba(255,255,255,.5); box-shadow: inset 0 0 0 1.5px rgba(31,26,23,.2);
  display: flex; flex-direction: column; align-items: center; gap: 1px; }
.skin.on { box-shadow: inset 0 0 0 2.5px var(--seal); }
.skin-hero { height: 78px; display: flex; align-items: flex-end; justify-content: center; width: 100%;
  background: radial-gradient(ellipse at 50% 60%, var(--sa), transparent 65%); }
.skin-hero img { height: 74px; width: auto; filter: var(--sf); }
.skin b { font-family: var(--kai); font-size: 14px; }
.skin small { font-size: 10px; color: var(--mute); }

/* 平台：模擬廣告、測試付款 */
.pf-overlay { position: fixed; inset: 0; z-index: 60; background: rgba(10,8,6,.86); display: flex; align-items: center; justify-content: center; animation: fadeIn .2s; }
.pf-box { width: min(86vw, 340px); background: var(--paper); border-radius: 10px; padding: 20px 18px; text-align: center; display: flex; flex-direction: column; gap: 10px; align-items: center; }
.pf-tag { font-size: 12px; font-weight: 700; color: #fff; background: var(--seal); padding: 2px 10px; border-radius: 10px; }
.pf-ad { width: 120px; height: 96px; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #3f7f8c, #1f1a17); color: #fff;
  font-family: var(--kai); font-size: 48px; font-weight: 900; border-radius: 8px; animation: pulse 1.2s ease-in-out infinite; }
.pf-box h3 { font-family: var(--kai); font-size: 22px; }
.pf-price { font-family: var(--kai); font-size: 26px; font-weight: 700; color: #a67a12; }
.pf-box p { font-size: 13px; line-height: 1.6; color: var(--ink2); }
.pf-btn { border: none; cursor: pointer; min-width: 150px; padding: 11px 18px; color: #fff; font-weight: 700; font-size: 15px; background: linear-gradient(#c63d3a, #9c2826);
  -webkit-mask: var(--blot) center / 100% 100% no-repeat; mask: var(--blot) center / 100% 100% no-repeat; }
.pf-btn:disabled { background: #b3a793; }
.pf-skip { border: none; background: none; color: var(--mute); font-size: 12px; text-decoration: underline; cursor: pointer; }

/* ---- 法寶水墨圖示：淡淡品階色墨跡做底，圖喺上面 ---- */
.gicon.gi-img, .gtile i.gi-img, .loot-it i.gi-img, .item-big i.gi-img { position: relative; background: none; -webkit-mask: none; mask: none; }
i.gi-img::before { content: ''; position: absolute; inset: 4%; background: var(--rc, #b3a793); opacity: .3;
  -webkit-mask: var(--blot) center / 100% 100% no-repeat; mask: var(--blot) center / 100% 100% no-repeat; }
i.gi-img img { position: relative; max-width: 112%; max-height: 112%; object-fit: contain; filter: drop-shadow(0 0 2px var(--rc, transparent)); pointer-events: none; }

/* ================= v1.1 版面：水墨背景大場景 ================= */
/* 洞府：場景拉高，揀區浮喺場景底，下面自然淡入宣紙 */
#homeScene { height: 47vh; min-height: 290px; max-height: 460px; background: #e6dccb; }
#homeScene .bg { position: absolute; inset: 0; overflow: hidden; }
#homeScene .bg img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: 50% 100%; animation: bgDrift 40s ease-in-out infinite alternate; }
#homeScene .bg svg { width: 100%; height: 100%; }
@keyframes bgDrift { from { transform: scale(1.06) translateX(1.5%); } to { transform: scale(1.06) translateX(-1.5%); } }
.scene-fade { position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(to bottom, rgba(243,236,223,.35), transparent 18%, transparent 62%, rgba(243,236,223,.78) 88%, var(--paper)); }
#homeHero { bottom: 70px; z-index: 1; }
#regionPick { position: absolute; left: 0; right: 0; bottom: 6px; padding: 0 12px; z-index: 2; }
#regionPick button { background: rgba(243,236,223,.82); border-color: var(--ink); }
#regionInfo b { font-size: 27px; letter-spacing: 2px; text-shadow: 0 0 6px var(--paper), 0 0 14px var(--paper), 0 0 2px var(--paper); }
#regionInfo small { display: inline-block; background: rgba(243,236,223,.8); padding: 1px 10px; border-radius: 9px; margin-top: 2px; }
#home { gap: 9px; }
#home .big-btn { margin-top: -4px; }
#verTag { text-align: center; font-size: 11px; color: var(--mute); letter-spacing: 1px; padding: 4px 0 2px; opacity: .8; }

/* 戰鬥：場景拉高，背景係水墨圖時用 3 張圖循環捲 */
#scene { height: 46vh; min-height: 260px; max-height: 430px; background: #e6dccb; }
#bgStrip.imgs { width: auto; height: 100%; }
#bgStrip.imgs img { display: block; height: 100%; width: auto; flex: none; }
#scene.walking #bgStrip.imgs { animation: walk3 7s linear infinite; }
@keyframes walk3 { from { transform: translateX(0); } to { transform: translateX(-33.3333%); } }
#scene .scene-fade { z-index: 0; background: linear-gradient(to bottom, rgba(243,236,223,.5), transparent 16%, transparent 80%, rgba(243,236,223,.7) 96%, var(--paper)); }
#scene .unit { z-index: 1; bottom: 12%; }
#scene #banner, #scene #fx, #scene #ultFx { z-index: 6; }
.hpnum { text-shadow: 0 0 3px var(--paper), 0 0 3px var(--paper), 0 0 2px var(--paper); }
.foe-name { text-shadow: 0 0 4px var(--paper), 0 0 8px var(--paper); }
@media (max-height: 700px) { #homeScene { height: 42vh; min-height: 250px; } #scene { min-height: 230px; } }

/* ---- v1.1 水墨筆觸按鈕（Codex 畫：assets/ui-*.webp） ---- */
.big-btn { background: url("assets/ui-red.webp") center / 104% 150% no-repeat; -webkit-mask: none; mask: none; height: 74px;
  text-shadow: 0 2px 0 rgba(90,16,14,.55), 0 0 10px rgba(90,16,14,.35); }
.big-btn:disabled { background: url("assets/ui-ink.webp") center / 100% 100% no-repeat; opacity: .35; }
.btn { background: url("assets/ui-ink.webp") center / 100% 100% no-repeat; -webkit-mask: none; mask: none; padding: 9px 14px; text-shadow: 0 1px 0 rgba(0,0,0,.35); }
.btn.seal { background: url("assets/ui-red.webp") center / 100% 100% no-repeat; }
.btn.gold { background: url("assets/ui-gold.webp") center / 100% 100% no-repeat; color: #fff; text-shadow: 0 1px 0 rgba(90,60,0,.6), 0 0 6px rgba(90,60,0,.4); }
.btn.cant { background: url("assets/ui-ink.webp") center / 100% 100% no-repeat; opacity: .32; }
.btn.done { background: none; text-shadow: none; }
.btn.ghost { background: url("assets/ui-frame.webp") center / 100% 100% no-repeat; box-shadow: none; border-radius: 0; text-shadow: none; }
/* 境界印：朱文印（紅框紅字） */
.realm-seal { background: url("assets/ui-seal.webp") center / 100% 100% no-repeat; color: var(--seal); box-shadow: none; }
/* 右上角、揀區：墨圈 */
#mallBtn, #soundBtn, #regionPick button { background: url("assets/ui-enso.webp") center / 100% 100% no-repeat; border: none; border-radius: 50%; box-shadow: none; }
#mallBtn { color: var(--seal); }
#regionPick button { background-color: rgba(243,236,223,.65); }
/* 卡片：墨框 */
#idleCard, .endless-btn.locked { border: 9px solid transparent; border-image: url("assets/ui-frame.webp") 26 / 9px stretch; box-shadow: none; background: rgba(255,255,255,.38); background-clip: padding-box; }
.endless-btn:not(.locked) { background: url("assets/ui-ink.webp") center / 100% 100% no-repeat; border-radius: 0; padding: 9px 12px; }
/* v1.1：靈寵出招都用攻擊圖 */
#pet.atk .foe-pic.has-atk img.idle { opacity: 0; }
#pet.atk .foe-pic.has-atk img.atk { opacity: 1; }
